From 23ee1745d3ac5aa9b244ebeea416a399396bf807 Mon Sep 17 00:00:00 2001 From: Balu Dontu Date: Mon, 22 May 2017 11:20:12 -0700 Subject: [PATCH] PBM govmomi dependencies --- Godeps/Godeps.json | 75 +- Godeps/LICENSES | 630 ++++++ vendor/github.com/vmware/govmomi/.mailmap | 16 + vendor/github.com/vmware/govmomi/BUILD | 1 + vendor/github.com/vmware/govmomi/CHANGELOG.md | 32 + vendor/github.com/vmware/govmomi/CONTRIBUTORS | 16 +- vendor/github.com/vmware/govmomi/README.md | 10 + vendor/github.com/vmware/govmomi/find/BUILD | 2 + vendor/github.com/vmware/govmomi/find/doc.go | 37 + .../github.com/vmware/govmomi/find/finder.go | 167 +- .../vmware/govmomi/find/recurser.go | 245 +++ vendor/github.com/vmware/govmomi/list/BUILD | 1 - .../github.com/vmware/govmomi/list/lister.go | 25 +- .../vmware/govmomi/list/recurser.go | 97 - vendor/github.com/vmware/govmomi/object/BUILD | 6 +- .../object/authorization_manager_internal.go | 86 + .../vmware/govmomi/object/datastore_file.go | 2 - .../govmomi/object/datastore_file_manager.go | 145 ++ .../govmomi/object/host_config_manager.go | 16 + .../object/host_vsan_internal_system.go | 117 ++ .../vmware/govmomi/object/list_view.go | 70 - .../vmware/govmomi/object/opaque_network.go | 57 + .../object/virtual_disk_manager_internal.go | 97 + .../vmware/govmomi/object/virtual_machine.go | 32 + vendor/github.com/vmware/govmomi/pbm/BUILD | 41 + .../github.com/vmware/govmomi/pbm/client.go | 217 +++ .../vmware/govmomi/pbm/methods/BUILD | 31 + .../vmware/govmomi/pbm/methods/methods.go | 664 +++++++ .../github.com/vmware/govmomi/pbm/pbm_util.go | 146 ++ .../github.com/vmware/govmomi/pbm/types/BUILD | 32 + .../vmware/govmomi/pbm/types/enum.go | 211 ++ .../github.com/vmware/govmomi/pbm/types/if.go | 139 ++ .../vmware/govmomi/pbm/types/types.go | 1712 +++++++++++++++++ .../github.com/vmware/govmomi/property/BUILD | 1 + .../vmware/govmomi/property/collector.go | 27 + .../vmware/govmomi/property/filter.go | 135 ++ vendor/github.com/vmware/govmomi/task/wait.go | 5 + .../vmware/govmomi/vim25/methods/methods.go | 2 +- .../vmware/govmomi/vim25/mo/ancestors.go | 2 + .../github.com/vmware/govmomi/vim25/mo/mo.go | 141 +- .../vmware/govmomi/vim25/soap/client.go | 34 + .../vmware/govmomi/vim25/soap/error.go | 8 +- .../vmware/govmomi/vim25/soap/soap.go | 8 +- .../vmware/govmomi/vim25/types/enum.go | 2 +- .../vmware/govmomi/vim25/types/helpers.go | 4 + .../vmware/govmomi/vim25/types/if.go | 2 +- .../vmware/govmomi/vim25/types/registry.go | 15 +- .../vmware/govmomi/vim25/types/types.go | 2 +- .../vmware/govmomi/vim25/xml/extras.go | 2 + .../vmware/govmomi/vim25/xml/read.go | 4 +- 50 files changed, 5272 insertions(+), 297 deletions(-) create mode 100644 vendor/github.com/vmware/govmomi/.mailmap create mode 100644 vendor/github.com/vmware/govmomi/find/doc.go create mode 100644 vendor/github.com/vmware/govmomi/find/recurser.go delete mode 100644 vendor/github.com/vmware/govmomi/list/recurser.go create mode 100644 vendor/github.com/vmware/govmomi/object/authorization_manager_internal.go create mode 100644 vendor/github.com/vmware/govmomi/object/datastore_file_manager.go create mode 100644 vendor/github.com/vmware/govmomi/object/host_vsan_internal_system.go delete mode 100644 vendor/github.com/vmware/govmomi/object/list_view.go create mode 100644 vendor/github.com/vmware/govmomi/object/opaque_network.go create mode 100644 vendor/github.com/vmware/govmomi/object/virtual_disk_manager_internal.go create mode 100644 vendor/github.com/vmware/govmomi/pbm/BUILD create mode 100644 vendor/github.com/vmware/govmomi/pbm/client.go create mode 100644 vendor/github.com/vmware/govmomi/pbm/methods/BUILD create mode 100644 vendor/github.com/vmware/govmomi/pbm/methods/methods.go create mode 100644 vendor/github.com/vmware/govmomi/pbm/pbm_util.go create mode 100644 vendor/github.com/vmware/govmomi/pbm/types/BUILD create mode 100644 vendor/github.com/vmware/govmomi/pbm/types/enum.go create mode 100644 vendor/github.com/vmware/govmomi/pbm/types/if.go create mode 100644 vendor/github.com/vmware/govmomi/pbm/types/types.go create mode 100644 vendor/github.com/vmware/govmomi/property/filter.go diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index d99055d9c5..457664bcf8 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -2438,78 +2438,93 @@ }, { "ImportPath": "github.com/vmware/govmomi", - "Comment": "v0.12.1-14-g0a28e59", - "Rev": "0a28e595c8e9e99879e8d2f796e82c5a68202ff0" + "Comment": "v0.14.0-11-gb8b228c", + "Rev": "b8b228cfbad7f0a69ed90393ca9aee085d3c6ef1" }, { "ImportPath": "github.com/vmware/govmomi/find", - "Comment": "v0.12.1-14-g0a28e59", - "Rev": "0a28e595c8e9e99879e8d2f796e82c5a68202ff0" + "Comment": "v0.14.0-11-gb8b228c", + "Rev": "b8b228cfbad7f0a69ed90393ca9aee085d3c6ef1" }, { "ImportPath": "github.com/vmware/govmomi/list", - "Comment": "v0.12.1-14-g0a28e59", - "Rev": "0a28e595c8e9e99879e8d2f796e82c5a68202ff0" + "Comment": "v0.14.0-11-gb8b228c", + "Rev": "b8b228cfbad7f0a69ed90393ca9aee085d3c6ef1" }, { "ImportPath": "github.com/vmware/govmomi/object", - "Comment": "v0.12.1-14-g0a28e59", - "Rev": "0a28e595c8e9e99879e8d2f796e82c5a68202ff0" + "Comment": "v0.14.0-11-gb8b228c", + "Rev": "b8b228cfbad7f0a69ed90393ca9aee085d3c6ef1" + }, + { + "ImportPath": "github.com/vmware/govmomi/pbm", + "Comment": "v0.14.0-11-gb8b228c", + "Rev": "b8b228cfbad7f0a69ed90393ca9aee085d3c6ef1" + }, + { + "ImportPath": "github.com/vmware/govmomi/pbm/methods", + "Comment": "v0.14.0-11-gb8b228c", + "Rev": "b8b228cfbad7f0a69ed90393ca9aee085d3c6ef1" + }, + { + "ImportPath": "github.com/vmware/govmomi/pbm/types", + "Comment": "v0.14.0-11-gb8b228c", + "Rev": "b8b228cfbad7f0a69ed90393ca9aee085d3c6ef1" }, { "ImportPath": "github.com/vmware/govmomi/property", - "Comment": "v0.12.1-14-g0a28e59", - "Rev": "0a28e595c8e9e99879e8d2f796e82c5a68202ff0" + "Comment": "v0.14.0-11-gb8b228c", + "Rev": "b8b228cfbad7f0a69ed90393ca9aee085d3c6ef1" }, { "ImportPath": "github.com/vmware/govmomi/session", - "Comment": "v0.12.1-14-g0a28e59", - "Rev": "0a28e595c8e9e99879e8d2f796e82c5a68202ff0" + "Comment": "v0.14.0-11-gb8b228c", + "Rev": "b8b228cfbad7f0a69ed90393ca9aee085d3c6ef1" }, { "ImportPath": "github.com/vmware/govmomi/task", - "Comment": "v0.12.1-14-g0a28e59", - "Rev": "0a28e595c8e9e99879e8d2f796e82c5a68202ff0" + "Comment": "v0.14.0-11-gb8b228c", + "Rev": "b8b228cfbad7f0a69ed90393ca9aee085d3c6ef1" }, { "ImportPath": "github.com/vmware/govmomi/vim25", - "Comment": "v0.12.1-14-g0a28e59", - "Rev": "0a28e595c8e9e99879e8d2f796e82c5a68202ff0" + "Comment": "v0.14.0-11-gb8b228c", + "Rev": "b8b228cfbad7f0a69ed90393ca9aee085d3c6ef1" }, { "ImportPath": "github.com/vmware/govmomi/vim25/debug", - "Comment": "v0.12.1-14-g0a28e59", - "Rev": "0a28e595c8e9e99879e8d2f796e82c5a68202ff0" + "Comment": "v0.14.0-11-gb8b228c", + "Rev": "b8b228cfbad7f0a69ed90393ca9aee085d3c6ef1" }, { "ImportPath": "github.com/vmware/govmomi/vim25/methods", - "Comment": "v0.12.1-14-g0a28e59", - "Rev": "0a28e595c8e9e99879e8d2f796e82c5a68202ff0" + "Comment": "v0.14.0-11-gb8b228c", + "Rev": "b8b228cfbad7f0a69ed90393ca9aee085d3c6ef1" }, { "ImportPath": "github.com/vmware/govmomi/vim25/mo", - "Comment": "v0.12.1-14-g0a28e59", - "Rev": "0a28e595c8e9e99879e8d2f796e82c5a68202ff0" + "Comment": "v0.14.0-11-gb8b228c", + "Rev": "b8b228cfbad7f0a69ed90393ca9aee085d3c6ef1" }, { "ImportPath": "github.com/vmware/govmomi/vim25/progress", - "Comment": "v0.12.1-14-g0a28e59", - "Rev": "0a28e595c8e9e99879e8d2f796e82c5a68202ff0" + "Comment": "v0.14.0-11-gb8b228c", + "Rev": "b8b228cfbad7f0a69ed90393ca9aee085d3c6ef1" }, { "ImportPath": "github.com/vmware/govmomi/vim25/soap", - "Comment": "v0.12.1-14-g0a28e59", - "Rev": "0a28e595c8e9e99879e8d2f796e82c5a68202ff0" + "Comment": "v0.14.0-11-gb8b228c", + "Rev": "b8b228cfbad7f0a69ed90393ca9aee085d3c6ef1" }, { "ImportPath": "github.com/vmware/govmomi/vim25/types", - "Comment": "v0.12.1-14-g0a28e59", - "Rev": "0a28e595c8e9e99879e8d2f796e82c5a68202ff0" + "Comment": "v0.14.0-11-gb8b228c", + "Rev": "b8b228cfbad7f0a69ed90393ca9aee085d3c6ef1" }, { "ImportPath": "github.com/vmware/govmomi/vim25/xml", - "Comment": "v0.12.1-14-g0a28e59", - "Rev": "0a28e595c8e9e99879e8d2f796e82c5a68202ff0" + "Comment": "v0.14.0-11-gb8b228c", + "Rev": "b8b228cfbad7f0a69ed90393ca9aee085d3c6ef1" }, { "ImportPath": "github.com/vmware/photon-controller-go-sdk/SSPI", diff --git a/Godeps/LICENSES b/Godeps/LICENSES index 9650748665..26cba7a370 100644 --- a/Godeps/LICENSES +++ b/Godeps/LICENSES @@ -77938,6 +77938,636 @@ SOFTWARE. ================================================================================ +================================================================================ += vendor/github.com/vmware/govmomi/pbm licensed under: = + + + 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. + += vendor/github.com/vmware/govmomi/LICENSE.txt 3b83ef96387f14655fc854ddc3c6bd57 - +================================================================================ + + +================================================================================ += vendor/github.com/vmware/govmomi/pbm/methods licensed under: = + + + 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. + += vendor/github.com/vmware/govmomi/LICENSE.txt 3b83ef96387f14655fc854ddc3c6bd57 - +================================================================================ + + +================================================================================ += vendor/github.com/vmware/govmomi/pbm/types licensed under: = + + + 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. + += vendor/github.com/vmware/govmomi/LICENSE.txt 3b83ef96387f14655fc854ddc3c6bd57 - +================================================================================ + + ================================================================================ = vendor/github.com/vmware/govmomi/property licensed under: = diff --git a/vendor/github.com/vmware/govmomi/.mailmap b/vendor/github.com/vmware/govmomi/.mailmap new file mode 100644 index 0000000000..31a0bd55aa --- /dev/null +++ b/vendor/github.com/vmware/govmomi/.mailmap @@ -0,0 +1,16 @@ +Amit Bathla +Bruce Downs +Bruce Downs +Clint Greenwood +Cédric Blomart +Cédric Blomart cedric +David Stark +Eric Gray +Eric Yutao eric +Henrik Hodne +Jeremy Canady +Pieter Noordhuis +Takaaki Furukawa takaaki.furukawa +Takaaki Furukawa tkak +Vadim Egorov +Zee Yang diff --git a/vendor/github.com/vmware/govmomi/BUILD b/vendor/github.com/vmware/govmomi/BUILD index 938b0270b8..7d4040cb59 100644 --- a/vendor/github.com/vmware/govmomi/BUILD +++ b/vendor/github.com/vmware/govmomi/BUILD @@ -34,6 +34,7 @@ filegroup( "//vendor/github.com/vmware/govmomi/find:all-srcs", "//vendor/github.com/vmware/govmomi/list:all-srcs", "//vendor/github.com/vmware/govmomi/object:all-srcs", + "//vendor/github.com/vmware/govmomi/pbm:all-srcs", "//vendor/github.com/vmware/govmomi/property:all-srcs", "//vendor/github.com/vmware/govmomi/session:all-srcs", "//vendor/github.com/vmware/govmomi/task:all-srcs", diff --git a/vendor/github.com/vmware/govmomi/CHANGELOG.md b/vendor/github.com/vmware/govmomi/CHANGELOG.md index fb648df346..ea4dd68db0 100644 --- a/vendor/github.com/vmware/govmomi/CHANGELOG.md +++ b/vendor/github.com/vmware/govmomi/CHANGELOG.md @@ -1,5 +1,37 @@ # changelog +### 0.14.0 (2017-04-08) + +* Add view.ContainerView type and methods + +* Add Collector.RetrieveWithFilter method + +* Add property.Filter type + +* Implement EthernetCardBackingInfo for OpaqueNetwork + +* Finder: support changing object root in find mode + +* Add VirtualDiskManager.QueryVirtualDiskInfo + +* Add performance.Manager APIs + +### 0.13.0 (2017-03-02) + +* Add DatastoreFileManager API wrapper + +* Add HostVsanInternalSystem API wrappers + +* Add Container support to view package + +* Finder supports Folder recursion without specifying a path + +* Add VirtualMachine.QueryConfigTarget method + +* Add device option to VirtualMachine.WaitForNetIP + +* Remove _Task suffix from vapp methods + ### 0.12.1 (2016-12-19) * Add DiagnosticLog helper diff --git a/vendor/github.com/vmware/govmomi/CONTRIBUTORS b/vendor/github.com/vmware/govmomi/CONTRIBUTORS index 03219c4ef4..6afdb9f56f 100644 --- a/vendor/github.com/vmware/govmomi/CONTRIBUTORS +++ b/vendor/github.com/vmware/govmomi/CONTRIBUTORS @@ -1,6 +1,6 @@ # People who can (and typically have) contributed to this repository. # -# Please keep the list sorted. +# This script is generated by contributors.sh # abrarshivani @@ -9,24 +9,26 @@ Amit Bathla Andrew Chin Arran Walker Austin Parker +bastienbc Bob Killen Brad Fitzpatrick Bruce Downs Cédric Blomart Christian Höltje -Clint Greenwood +Clint Greenwood Danny Lockard Dave Tucker Davide Agnello David Stark Doug MacEachern Eloy Coto +Eric Gray Eric Yutao Fabio Rapposelli Faiyaz Ahmed forkbomber Gavin Gray -Gavrie Philipson +Gavrie Philipson George Hicken Gerrit Renker gthombare @@ -34,18 +36,20 @@ Hasan Mahmood Henrik Hodne Isaac Rodman Jason Kincl +Jeremy Canady Louie Jiang +Marc Carmier Mevan Samaratunga Nicolas Lamirault -Pieter Noordhuis +Pieter Noordhuis runner.mei S.Çağlar Onur Sergey Ignatov Steve Purcell -Takaaki Furukawa +Takaaki Furukawa Ted Zlatanov Vadim Egorov Yang Yang Yuya Kusakabe Zach Tucker -Zee Yang +Zee Yang diff --git a/vendor/github.com/vmware/govmomi/README.md b/vendor/github.com/vmware/govmomi/README.md index ae3531961c..7ebdf1b17c 100644 --- a/vendor/github.com/vmware/govmomi/README.md +++ b/vendor/github.com/vmware/govmomi/README.md @@ -61,8 +61,18 @@ Refer to the [CHANGELOG](CHANGELOG.md) for version to version changes. * [Travis CI](https://github.com/travis-ci/jupiter-brain) +* [collectd-vsphere](https://github.com/travis-ci/collectd-vsphere) + * [Gru](https://github.com/dnaeon/gru) +* [Libretto](https://github.com/apcera/libretto/tree/master/virtualmachine/vsphere) + +## Related projects + +* [rbvmomi](https://github.com/vmware/rbvmomi) + +* [pyvmomi](https://github.com/vmware/pyvmomi) + ## License govmomi is available under the [Apache 2 license](LICENSE). diff --git a/vendor/github.com/vmware/govmomi/find/BUILD b/vendor/github.com/vmware/govmomi/find/BUILD index 0a77deec17..fd6df8e4d1 100644 --- a/vendor/github.com/vmware/govmomi/find/BUILD +++ b/vendor/github.com/vmware/govmomi/find/BUILD @@ -10,8 +10,10 @@ load( go_library( name = "go_default_library", srcs = [ + "doc.go", "error.go", "finder.go", + "recurser.go", ], tags = ["automanaged"], deps = [ diff --git a/vendor/github.com/vmware/govmomi/find/doc.go b/vendor/github.com/vmware/govmomi/find/doc.go new file mode 100644 index 0000000000..0c8acee016 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/find/doc.go @@ -0,0 +1,37 @@ +/* +Copyright (c) 2014-2017 VMware, Inc. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +/* +Package find implements inventory listing and searching. + +The Finder is an alternative to the object.SearchIndex FindByInventoryPath() and FindChild() methods. +SearchIndex.FindByInventoryPath requires an absolute path, whereas the Finder also supports relative paths +and patterns via path.Match. +SearchIndex.FindChild requires a parent to find the child, whereas the Finder also supports an ancestor via +recursive object traversal. + +The various Finder methods accept a "path" argument, which can absolute or relative to the Folder for the object type. +The Finder supports two modes, "list" and "find". The "list" mode behaves like the "ls" command, only searching within +the immediate path. The "find" mode behaves like the "find" command, with the search starting at the immediate path but +also recursing into sub Folders relative to the Datacenter. The default mode is "list" if the given path contains a "/", +otherwise "find" mode is used. + +The exception is to use a "..." wildcard with a path to find all objects recursively underneath any root object. +For example: VirtualMachineList("/DC1/...") + +See also: https://github.com/vmware/govmomi/blob/master/govc/README.md#usage +*/ +package find diff --git a/vendor/github.com/vmware/govmomi/find/finder.go b/vendor/github.com/vmware/govmomi/find/finder.go index 9f638a52a0..04d0e891a9 100644 --- a/vendor/github.com/vmware/govmomi/find/finder.go +++ b/vendor/github.com/vmware/govmomi/find/finder.go @@ -1,5 +1,5 @@ /* -Copyright (c) 2014-2016 VMware, Inc. All Rights Reserved. +Copyright (c) 2014-2017 VMware, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ import ( "context" "errors" "path" + "strings" "github.com/vmware/govmomi/list" "github.com/vmware/govmomi/object" @@ -30,17 +31,18 @@ import ( ) type Finder struct { - client *vim25.Client - recurser list.Recurser - + client *vim25.Client + r recurser dc *object.Datacenter + si *object.SearchIndex folders *object.DatacenterFolders } func NewFinder(client *vim25.Client, all bool) *Finder { f := &Finder{ client: client, - recurser: list.Recurser{ + si: object.NewSearchIndex(client), + r: recurser{ Collector: property.DefaultCollector(client), All: all, }, @@ -55,9 +57,41 @@ func (f *Finder) SetDatacenter(dc *object.Datacenter) *Finder { return f } -type findRelativeFunc func(ctx context.Context) (object.Reference, error) +// findRoot makes it possible to use "find" mode with a different root path. +// Example: ResourcePoolList("/dc1/host/cluster1/...") +func (f *Finder) findRoot(ctx context.Context, root *list.Element, parts []string) bool { + if len(parts) == 0 { + return false + } + + ix := len(parts) - 1 + + if parts[ix] != "..." { + return false + } + + if ix == 0 { + return true // We already have the Object for root.Path + } + + // Lookup the Object for the new root.Path + rootPath := path.Join(root.Path, path.Join(parts[:ix]...)) + + ref, err := f.si.FindByInventoryPath(ctx, rootPath) + if err != nil || ref == nil { + // If we get an error or fail to match, fall through to find() with the original root and path + return false + } + + root.Path = rootPath + root.Object = ref + + return true +} + +func (f *Finder) find(ctx context.Context, arg string, s *spec) ([]list.Element, error) { + isPath := strings.Contains(arg, "/") -func (f *Finder) find(ctx context.Context, fn findRelativeFunc, tl bool, arg string) ([]list.Element, error) { root := list.Element{ Path: "/", Object: object.NewRootFolder(f.client), @@ -70,7 +104,7 @@ func (f *Finder) find(ctx context.Context, fn findRelativeFunc, tl bool, arg str case "..": // Not supported; many edge case, little value return nil, errors.New("cannot traverse up a tree") case ".": // Relative to whatever - pivot, err := fn(ctx) + pivot, err := s.Relative(ctx) if err != nil { return nil, err } @@ -93,13 +127,17 @@ func (f *Finder) find(ctx context.Context, fn findRelativeFunc, tl bool, arg str } } - f.recurser.TraverseLeafs = tl - es, err := f.recurser.Recurse(ctx, root, parts) - if err != nil { - return nil, err + if s.listMode(isPath) { + if f.findRoot(ctx, &root, parts) { + parts = []string{"*"} + } else { + return f.r.List(ctx, s, root, parts) + } } - return es, nil + s.Parents = append(s.Parents, s.Nested...) + + return f.r.Find(ctx, s, root, parts) } func (f *Finder) datacenter() (*object.Datacenter, error) { @@ -208,7 +246,7 @@ func (f *Finder) rootFolder(_ context.Context) (object.Reference, error) { return object.NewRootFolder(f.client), nil } -func (f *Finder) managedObjectList(ctx context.Context, path string, tl bool) ([]list.Element, error) { +func (f *Finder) managedObjectList(ctx context.Context, path string, tl bool, include []string) ([]list.Element, error) { fn := f.rootFolder if f.dc != nil { @@ -219,7 +257,18 @@ func (f *Finder) managedObjectList(ctx context.Context, path string, tl bool) ([ path = "." } - return f.find(ctx, fn, tl, path) + s := &spec{ + Relative: fn, + Parents: []string{"ComputeResource", "ClusterComputeResource", "HostSystem", "VirtualApp", "StoragePod"}, + Include: include, + } + + if tl { + s.Contents = true + s.ListMode = types.NewBool(true) + } + + return f.find(ctx, path, s) } // Element returns an Element for the given ManagedObjectReference @@ -229,7 +278,11 @@ func (f *Finder) Element(ctx context.Context, ref types.ManagedObjectReference) return ref, nil } - e, err := f.find(ctx, rl, false, ".") + s := &spec{ + Relative: rl, + } + + e, err := f.find(ctx, "./", s) if err != nil { return nil, err } @@ -270,16 +323,21 @@ func (f *Finder) ObjectReference(ctx context.Context, ref types.ManagedObjectRef return r, nil } -func (f *Finder) ManagedObjectList(ctx context.Context, path string) ([]list.Element, error) { - return f.managedObjectList(ctx, path, false) +func (f *Finder) ManagedObjectList(ctx context.Context, path string, include ...string) ([]list.Element, error) { + return f.managedObjectList(ctx, path, false, include) } -func (f *Finder) ManagedObjectListChildren(ctx context.Context, path string) ([]list.Element, error) { - return f.managedObjectList(ctx, path, true) +func (f *Finder) ManagedObjectListChildren(ctx context.Context, path string, include ...string) ([]list.Element, error) { + return f.managedObjectList(ctx, path, true, include) } func (f *Finder) DatacenterList(ctx context.Context, path string) ([]*object.Datacenter, error) { - es, err := f.find(ctx, f.rootFolder, false, path) + s := &spec{ + Relative: f.rootFolder, + Include: []string{"Datacenter"}, + } + + es, err := f.find(ctx, path, s) if err != nil { return nil, err } @@ -336,7 +394,12 @@ func (f *Finder) DatacenterOrDefault(ctx context.Context, path string) (*object. } func (f *Finder) DatastoreList(ctx context.Context, path string) ([]*object.Datastore, error) { - es, err := f.find(ctx, f.datastoreFolder, false, path) + s := &spec{ + Relative: f.datastoreFolder, + Parents: []string{"StoragePod"}, + } + + es, err := f.find(ctx, path, s) if err != nil { return nil, err } @@ -404,7 +467,11 @@ func (f *Finder) DatastoreOrDefault(ctx context.Context, path string) (*object.D } func (f *Finder) DatastoreClusterList(ctx context.Context, path string) ([]*object.StoragePod, error) { - es, err := f.find(ctx, f.datastoreFolder, false, path) + s := &spec{ + Relative: f.datastoreFolder, + } + + es, err := f.find(ctx, path, s) if err != nil { return nil, err } @@ -461,7 +528,11 @@ func (f *Finder) DatastoreClusterOrDefault(ctx context.Context, path string) (*o } func (f *Finder) ComputeResourceList(ctx context.Context, path string) ([]*object.ComputeResource, error) { - es, err := f.find(ctx, f.hostFolder, false, path) + s := &spec{ + Relative: f.hostFolder, + } + + es, err := f.find(ctx, path, s) if err != nil { return nil, err } @@ -523,7 +594,11 @@ func (f *Finder) ComputeResourceOrDefault(ctx context.Context, path string) (*ob } func (f *Finder) ClusterComputeResourceList(ctx context.Context, path string) ([]*object.ClusterComputeResource, error) { - es, err := f.find(ctx, f.hostFolder, false, path) + s := &spec{ + Relative: f.hostFolder, + } + + es, err := f.find(ctx, path, s) if err != nil { return nil, err } @@ -564,7 +639,13 @@ func (f *Finder) ClusterComputeResource(ctx context.Context, path string) (*obje } func (f *Finder) HostSystemList(ctx context.Context, path string) ([]*object.HostSystem, error) { - es, err := f.find(ctx, f.hostFolder, false, path) + s := &spec{ + Relative: f.hostFolder, + Parents: []string{"ComputeResource", "ClusterComputeResource"}, + Include: []string{"HostSystem"}, + } + + es, err := f.find(ctx, path, s) if err != nil { return nil, err } @@ -635,7 +716,11 @@ func (f *Finder) HostSystemOrDefault(ctx context.Context, path string) (*object. } func (f *Finder) NetworkList(ctx context.Context, path string) ([]object.NetworkReference, error) { - es, err := f.find(ctx, f.networkFolder, false, path) + s := &spec{ + Relative: f.networkFolder, + } + + es, err := f.find(ctx, path, s) if err != nil { return nil, err } @@ -644,10 +729,14 @@ func (f *Finder) NetworkList(ctx context.Context, path string) ([]object.Network for _, e := range es { ref := e.Object.Reference() switch ref.Type { - case "Network", "OpaqueNetwork": + case "Network": r := object.NewNetwork(f.client, ref) r.InventoryPath = e.Path ns = append(ns, r) + case "OpaqueNetwork": + r := object.NewOpaqueNetwork(f.client, ref) + r.InventoryPath = e.Path + ns = append(ns, r) case "DistributedVirtualPortgroup": r := object.NewDistributedVirtualPortgroup(f.client, ref) r.InventoryPath = e.Path @@ -701,7 +790,14 @@ func (f *Finder) NetworkOrDefault(ctx context.Context, path string) (object.Netw } func (f *Finder) ResourcePoolList(ctx context.Context, path string) ([]*object.ResourcePool, error) { - es, err := f.find(ctx, f.hostFolder, true, path) + s := &spec{ + Relative: f.hostFolder, + Parents: []string{"ComputeResource", "ClusterComputeResource", "VirtualApp"}, + Nested: []string{"ResourcePool"}, + Contents: true, + } + + es, err := f.find(ctx, path, s) if err != nil { return nil, err } @@ -804,7 +900,12 @@ func (f *Finder) FolderOrDefault(ctx context.Context, path string) (*object.Fold } func (f *Finder) VirtualMachineList(ctx context.Context, path string) ([]*object.VirtualMachine, error) { - es, err := f.find(ctx, f.vmFolder, false, path) + s := &spec{ + Relative: f.vmFolder, + Parents: []string{"VirtualApp"}, + } + + es, err := f.find(ctx, path, s) if err != nil { return nil, err } @@ -840,7 +941,11 @@ func (f *Finder) VirtualMachine(ctx context.Context, path string) (*object.Virtu } func (f *Finder) VirtualAppList(ctx context.Context, path string) ([]*object.VirtualApp, error) { - es, err := f.find(ctx, f.vmFolder, false, path) + s := &spec{ + Relative: f.vmFolder, + } + + es, err := f.find(ctx, path, s) if err != nil { return nil, err } diff --git a/vendor/github.com/vmware/govmomi/find/recurser.go b/vendor/github.com/vmware/govmomi/find/recurser.go new file mode 100644 index 0000000000..b62e93a6f8 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/find/recurser.go @@ -0,0 +1,245 @@ +/* +Copyright (c) 2014-2017 VMware, Inc. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package find + +import ( + "context" + "os" + "path" + + "github.com/vmware/govmomi/list" + "github.com/vmware/govmomi/object" + "github.com/vmware/govmomi/property" + "github.com/vmware/govmomi/vim25/mo" +) + +// spec is used to specify per-search configuration, independent of the Finder instance. +type spec struct { + // Relative returns the root object to resolve Relative paths (starts with ".") + Relative func(ctx context.Context) (object.Reference, error) + + // ListMode can be used to optionally force "ls" behavior, rather than "find" behavior + ListMode *bool + + // Contents configures the Recurser to list the Contents of traversable leaf nodes. + // This is typically set to true when used from the ls command, where listing + // a folder means listing its Contents. This is typically set to false for + // commands that take managed entities that are not folders as input. + Contents bool + + // Parents specifies the types which can contain the child types being searched for. + // for example, when searching for a HostSystem, parent types can be + // "ComputeResource" or "ClusterComputeResource". + Parents []string + + // Include specifies which types to be included in the results, used only in "find" mode. + Include []string + + // Nested should be set to types that can be Nested, used only in "find" mode. + Nested []string + + // ChildType avoids traversing into folders that can't contain the Include types, used only in "find" mode. + ChildType []string +} + +func (s *spec) traversable(o mo.Reference) bool { + ref := o.Reference() + + switch ref.Type { + case "Datacenter": + if len(s.Include) == 1 && s.Include[0] == "Datacenter" { + // No point in traversing deeper as Datacenters cannot be nested + return false + } + return true + case "Folder": + if f, ok := o.(mo.Folder); ok { + // TODO: Not making use of this yet, but here we can optimize when searching the entire + // inventory across Datacenters for specific types, for example: 'govc ls -t VirtualMachine /**' + // should not traverse into a Datacenter's host, network or datatore folders. + if !s.traversableChildType(f.ChildType) { + return false + } + } + + return true + } + + for _, kind := range s.Parents { + if kind == ref.Type { + return true + } + } + + return false +} + +func (s *spec) traversableChildType(ctypes []string) bool { + if len(s.ChildType) == 0 { + return true + } + + for _, t := range ctypes { + for _, c := range s.ChildType { + if t == c { + return true + } + } + } + + return false +} + +func (s *spec) wanted(e list.Element) bool { + if len(s.Include) == 0 { + return true + } + + w := e.Object.Reference().Type + + for _, kind := range s.Include { + if w == kind { + return true + } + } + + return false +} + +// listMode is a global option to revert to the original Finder behavior, +// disabling the newer "find" mode. +var listMode = os.Getenv("GOVMOMI_FINDER_LIST_MODE") == "true" + +func (s *spec) listMode(isPath bool) bool { + if listMode { + return true + } + + if s.ListMode != nil { + return *s.ListMode + } + + return isPath +} + +type recurser struct { + Collector *property.Collector + + // All configures the recurses to fetch complete objects for leaf nodes. + All bool +} + +func (r recurser) List(ctx context.Context, s *spec, root list.Element, parts []string) ([]list.Element, error) { + if len(parts) == 0 { + // Include non-traversable leaf elements in result. For example, consider + // the pattern "./vm/my-vm-*", where the pattern should match the VMs and + // not try to traverse them. + // + // Include traversable leaf elements in result, if the contents + // field is set to false. + // + if !s.Contents || !s.traversable(root.Object.Reference()) { + return []list.Element{root}, nil + } + } + + k := list.Lister{ + Collector: r.Collector, + Reference: root.Object.Reference(), + Prefix: root.Path, + } + + if r.All && len(parts) < 2 { + k.All = true + } + + in, err := k.List(ctx) + if err != nil { + return nil, err + } + + // This folder is a leaf as far as the glob goes. + if len(parts) == 0 { + return in, nil + } + + pattern := parts[0] + parts = parts[1:] + + var out []list.Element + for _, e := range in { + matched, err := path.Match(pattern, path.Base(e.Path)) + if err != nil { + return nil, err + } + + if !matched { + continue + } + + nres, err := r.List(ctx, s, e, parts) + if err != nil { + return nil, err + } + + out = append(out, nres...) + } + + return out, nil +} + +func (r recurser) Find(ctx context.Context, s *spec, root list.Element, parts []string) ([]list.Element, error) { + var out []list.Element + + if len(parts) > 0 { + pattern := parts[0] + matched, err := path.Match(pattern, path.Base(root.Path)) + if err != nil { + return nil, err + } + + if matched && s.wanted(root) { + out = append(out, root) + } + } + + if !s.traversable(root.Object) { + return out, nil + } + + k := list.Lister{ + Collector: r.Collector, + Reference: root.Object.Reference(), + Prefix: root.Path, + } + + in, err := k.List(ctx) + if err != nil { + return nil, err + } + + for _, e := range in { + nres, err := r.Find(ctx, s, e, parts) + if err != nil { + return nil, err + } + + out = append(out, nres...) + } + + return out, nil +} diff --git a/vendor/github.com/vmware/govmomi/list/BUILD b/vendor/github.com/vmware/govmomi/list/BUILD index b619bd91e0..a58ef53322 100644 --- a/vendor/github.com/vmware/govmomi/list/BUILD +++ b/vendor/github.com/vmware/govmomi/list/BUILD @@ -12,7 +12,6 @@ go_library( srcs = [ "lister.go", "path.go", - "recurser.go", ], tags = ["automanaged"], deps = [ diff --git a/vendor/github.com/vmware/govmomi/list/lister.go b/vendor/github.com/vmware/govmomi/list/lister.go index ae162b7fc2..2ee32e6bc1 100644 --- a/vendor/github.com/vmware/govmomi/list/lister.go +++ b/vendor/github.com/vmware/govmomi/list/lister.go @@ -33,6 +33,10 @@ type Element struct { Object mo.Reference } +func (e Element) String() string { + return fmt.Sprintf("%s @ %s", e.Object.Reference(), e.Path) +} + func ToElement(r mo.Reference, prefix string) Element { var name string @@ -112,23 +116,6 @@ type Lister struct { All bool } -func traversable(ref types.ManagedObjectReference) bool { - switch ref.Type { - case "Folder": - case "Datacenter": - case "ComputeResource", "ClusterComputeResource": - // Treat ComputeResource and ClusterComputeResource as one and the same. - // It doesn't matter from the perspective of the lister. - case "HostSystem": - case "VirtualApp": - case "StoragePod": - default: - return false - } - - return true -} - func (l Lister) retrieveProperties(ctx context.Context, req types.RetrieveProperties, dst *[]interface{}) error { res, err := l.Collector.RetrieveProperties(ctx, req) if err != nil { @@ -225,6 +212,8 @@ func (l Lister) ListFolder(ctx context.Context) ([]Element, error) { // Additional basic properties. switch t { + case "Folder": + pspec.PathSet = append(pspec.PathSet, "childType") case "ComputeResource", "ClusterComputeResource": // The ComputeResource and ClusterComputeResource are dereferenced in // the ResourcePoolFlag. Make sure they always have their resourcePool @@ -286,7 +275,7 @@ func (l Lister) ListDatacenter(ctx context.Context) ([]Element, error) { if l.All { pspec.All = types.NewBool(true) } else { - pspec.PathSet = []string{"name"} + pspec.PathSet = []string{"name", "childType"} } req := types.RetrieveProperties{ diff --git a/vendor/github.com/vmware/govmomi/list/recurser.go b/vendor/github.com/vmware/govmomi/list/recurser.go deleted file mode 100644 index 32a67829f5..0000000000 --- a/vendor/github.com/vmware/govmomi/list/recurser.go +++ /dev/null @@ -1,97 +0,0 @@ -/* -Copyright (c) 2014-2015 VMware, Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package list - -import ( - "context" - "path" - "path/filepath" - - "github.com/vmware/govmomi/property" -) - -type Recurser struct { - Collector *property.Collector - - // All configures the recurses to fetch complete objects for leaf nodes. - All bool - - // TraverseLeafs configures the Recurser to traverse traversable leaf nodes. - // This is typically set to true when used from the ls command, where listing - // a folder means listing its contents. This is typically set to false for - // commands that take managed entities that are not folders as input. - TraverseLeafs bool -} - -func (r Recurser) Recurse(ctx context.Context, root Element, parts []string) ([]Element, error) { - if len(parts) == 0 { - // Include non-traversable leaf elements in result. For example, consider - // the pattern "./vm/my-vm-*", where the pattern should match the VMs and - // not try to traverse them. - // - // Include traversable leaf elements in result, if the TraverseLeafs - // field is set to false. - // - if !traversable(root.Object.Reference()) || !r.TraverseLeafs { - return []Element{root}, nil - } - } - - k := Lister{ - Collector: r.Collector, - Reference: root.Object.Reference(), - Prefix: root.Path, - } - - if r.All && len(parts) < 2 { - k.All = true - } - - in, err := k.List(ctx) - if err != nil { - return nil, err - } - - // This folder is a leaf as far as the glob goes. - if len(parts) == 0 { - return in, nil - } - - pattern := parts[0] - parts = parts[1:] - - var out []Element - for _, e := range in { - matched, err := filepath.Match(pattern, path.Base(e.Path)) - if err != nil { - return nil, err - } - - if !matched { - continue - } - - nres, err := r.Recurse(ctx, e, parts) - if err != nil { - return nil, err - } - - out = append(out, nres...) - } - - return out, nil -} diff --git a/vendor/github.com/vmware/govmomi/object/BUILD b/vendor/github.com/vmware/govmomi/object/BUILD index ae1691bd7f..8229b14713 100644 --- a/vendor/github.com/vmware/govmomi/object/BUILD +++ b/vendor/github.com/vmware/govmomi/object/BUILD @@ -11,6 +11,7 @@ go_library( name = "go_default_library", srcs = [ "authorization_manager.go", + "authorization_manager_internal.go", "cluster_compute_resource.go", "common.go", "compute_resource.go", @@ -19,6 +20,7 @@ go_library( "datacenter.go", "datastore.go", "datastore_file.go", + "datastore_file_manager.go", "datastore_path.go", "diagnostic_log.go", "diagnostic_manager.go", @@ -41,12 +43,13 @@ go_library( "host_storage_system.go", "host_system.go", "host_virtual_nic_manager.go", + "host_vsan_internal_system.go", "host_vsan_system.go", "http_nfc_lease.go", - "list_view.go", "namespace_manager.go", "network.go", "network_reference.go", + "opaque_network.go", "option_manager.go", "ovf_manager.go", "resource_pool.go", @@ -58,6 +61,7 @@ go_library( "virtual_app.go", "virtual_device_list.go", "virtual_disk_manager.go", + "virtual_disk_manager_internal.go", "virtual_machine.go", "vmware_distributed_virtual_switch.go", ], diff --git a/vendor/github.com/vmware/govmomi/object/authorization_manager_internal.go b/vendor/github.com/vmware/govmomi/object/authorization_manager_internal.go new file mode 100644 index 0000000000..4fa520f5ad --- /dev/null +++ b/vendor/github.com/vmware/govmomi/object/authorization_manager_internal.go @@ -0,0 +1,86 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package object + +import ( + "context" + + "github.com/vmware/govmomi/vim25/soap" + "github.com/vmware/govmomi/vim25/types" +) + +type DisabledMethodRequest struct { + Method string `xml:"method"` + Reason string `xml:"reasonId"` +} + +type disableMethodsRequest struct { + This types.ManagedObjectReference `xml:"_this"` + Entity []types.ManagedObjectReference `xml:"entity"` + Method []DisabledMethodRequest `xml:"method"` + Source string `xml:"sourceId"` + Scope bool `xml:"sessionScope,omitempty"` +} + +type disableMethodsBody struct { + Req *disableMethodsRequest `xml:"urn:internalvim25 DisableMethods,omitempty"` + Res interface{} `xml:"urn:vim25 DisableMethodsResponse,omitempty"` + Err *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *disableMethodsBody) Fault() *soap.Fault { return b.Err } + +func (m AuthorizationManager) DisableMethods(ctx context.Context, entity []types.ManagedObjectReference, method []DisabledMethodRequest, source string) error { + var reqBody, resBody disableMethodsBody + + reqBody.Req = &disableMethodsRequest{ + This: m.Reference(), + Entity: entity, + Method: method, + Source: source, + } + + return m.Client().RoundTrip(ctx, &reqBody, &resBody) +} + +type enableMethodsRequest struct { + This types.ManagedObjectReference `xml:"_this"` + Entity []types.ManagedObjectReference `xml:"entity"` + Method []string `xml:"method"` + Source string `xml:"sourceId"` +} + +type enableMethodsBody struct { + Req *enableMethodsRequest `xml:"urn:internalvim25 EnableMethods,omitempty"` + Res interface{} `xml:"urn:vim25 EnableMethodsResponse,omitempty"` + Err *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *enableMethodsBody) Fault() *soap.Fault { return b.Err } + +func (m AuthorizationManager) EnableMethods(ctx context.Context, entity []types.ManagedObjectReference, method []string, source string) error { + var reqBody, resBody enableMethodsBody + + reqBody.Req = &enableMethodsRequest{ + This: m.Reference(), + Entity: entity, + Method: method, + Source: source, + } + + return m.Client().RoundTrip(ctx, &reqBody, &resBody) +} diff --git a/vendor/github.com/vmware/govmomi/object/datastore_file.go b/vendor/github.com/vmware/govmomi/object/datastore_file.go index 1306ef6d4d..36c9523485 100644 --- a/vendor/github.com/vmware/govmomi/object/datastore_file.go +++ b/vendor/github.com/vmware/govmomi/object/datastore_file.go @@ -344,8 +344,6 @@ func (f *followDatastoreFile) Read(p []byte) (int, error) { offset := f.r.offset.seek stop := false - defer f.r.Close() - for { n, err := f.r.Read(p) if err != nil && err == io.EOF { diff --git a/vendor/github.com/vmware/govmomi/object/datastore_file_manager.go b/vendor/github.com/vmware/govmomi/object/datastore_file_manager.go new file mode 100644 index 0000000000..7164fbbed7 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/object/datastore_file_manager.go @@ -0,0 +1,145 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package object + +import ( + "bufio" + "bytes" + "context" + "fmt" + "io" + "log" + "path" + "strings" + + "github.com/vmware/govmomi/vim25/soap" +) + +// DatastoreFileManager combines FileManager and VirtualDiskManager to manage files on a Datastore +type DatastoreFileManager struct { + Datacenter *Datacenter + Datastore *Datastore + FileManager *FileManager + VirtualDiskManager *VirtualDiskManager + + Force bool +} + +// NewFileManager creates a new instance of DatastoreFileManager +func (d Datastore) NewFileManager(dc *Datacenter, force bool) *DatastoreFileManager { + c := d.Client() + + m := &DatastoreFileManager{ + Datacenter: dc, + Datastore: &d, + FileManager: NewFileManager(c), + VirtualDiskManager: NewVirtualDiskManager(c), + Force: force, + } + + return m +} + +// Delete dispatches to the appropriate Delete method based on file name extension +func (m *DatastoreFileManager) Delete(ctx context.Context, name string) error { + switch path.Ext(name) { + case ".vmdk": + return m.DeleteVirtualDisk(ctx, name) + default: + return m.DeleteFile(ctx, name) + } +} + +// DeleteFile calls FileManager.DeleteDatastoreFile +func (m *DatastoreFileManager) DeleteFile(ctx context.Context, name string) error { + p := m.Path(name) + + task, err := m.FileManager.DeleteDatastoreFile(ctx, p.String(), m.Datacenter) + if err != nil { + return err + } + + return task.Wait(ctx) +} + +// DeleteVirtualDisk calls VirtualDiskManager.DeleteVirtualDisk +// Regardless of the Datastore type, DeleteVirtualDisk will fail if 'ddb.deletable=false', +// so if Force=true this method attempts to set 'ddb.deletable=true' before starting the delete task. +func (m *DatastoreFileManager) DeleteVirtualDisk(ctx context.Context, name string) error { + p := m.Path(name) + + var merr error + + if m.Force { + merr = m.markDiskAsDeletable(ctx, p) + } + + task, err := m.VirtualDiskManager.DeleteVirtualDisk(ctx, p.String(), m.Datacenter) + if err != nil { + log.Printf("markDiskAsDeletable(%s): %s", p, merr) + return err + } + + return task.Wait(ctx) +} + +// Path converts path name to a DatastorePath +func (m *DatastoreFileManager) Path(name string) *DatastorePath { + var p DatastorePath + + if !p.FromString(name) { + p.Path = name + p.Datastore = m.Datastore.Name() + } + + return &p +} + +func (m *DatastoreFileManager) markDiskAsDeletable(ctx context.Context, path *DatastorePath) error { + r, _, err := m.Datastore.Download(ctx, path.Path, &soap.DefaultDownload) + if err != nil { + return err + } + + defer r.Close() + + hasFlag := false + buf := new(bytes.Buffer) + + s := bufio.NewScanner(&io.LimitedReader{R: r, N: 2048}) // should be only a few hundred bytes, limit to be sure + + for s.Scan() { + line := s.Text() + if strings.HasPrefix(line, "ddb.deletable") { + hasFlag = true + continue + } + + fmt.Fprintln(buf, line) + } + + if err := s.Err(); err != nil { + return err // any error other than EOF + } + + if !hasFlag { + return nil // already deletable, so leave as-is + } + + // rewrite the .vmdk with ddb.deletable flag removed (the default is true) + return m.Datastore.Upload(ctx, buf, path.Path, &soap.DefaultUpload) +} diff --git a/vendor/github.com/vmware/govmomi/object/host_config_manager.go b/vendor/github.com/vmware/govmomi/object/host_config_manager.go index 6f061a6d14..123227ecc7 100644 --- a/vendor/github.com/vmware/govmomi/object/host_config_manager.go +++ b/vendor/github.com/vmware/govmomi/object/host_config_manager.go @@ -105,6 +105,22 @@ func (m HostConfigManager) VsanSystem(ctx context.Context) (*HostVsanSystem, err return NewHostVsanSystem(m.c, *h.ConfigManager.VsanSystem), nil } +func (m HostConfigManager) VsanInternalSystem(ctx context.Context) (*HostVsanInternalSystem, error) { + var h mo.HostSystem + + err := m.Properties(ctx, m.Reference(), []string{"configManager.vsanInternalSystem"}, &h) + if err != nil { + return nil, err + } + + // Added in 5.5 + if h.ConfigManager.VsanInternalSystem == nil { + return nil, ErrNotSupported + } + + return NewHostVsanInternalSystem(m.c, *h.ConfigManager.VsanInternalSystem), nil +} + func (m HostConfigManager) AccountManager(ctx context.Context) (*HostAccountManager, error) { var h mo.HostSystem diff --git a/vendor/github.com/vmware/govmomi/object/host_vsan_internal_system.go b/vendor/github.com/vmware/govmomi/object/host_vsan_internal_system.go new file mode 100644 index 0000000000..65e4587f6c --- /dev/null +++ b/vendor/github.com/vmware/govmomi/object/host_vsan_internal_system.go @@ -0,0 +1,117 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package object + +import ( + "context" + "encoding/json" + + "github.com/vmware/govmomi/vim25" + "github.com/vmware/govmomi/vim25/methods" + "github.com/vmware/govmomi/vim25/types" +) + +type HostVsanInternalSystem struct { + Common +} + +func NewHostVsanInternalSystem(c *vim25.Client, ref types.ManagedObjectReference) *HostVsanInternalSystem { + m := HostVsanInternalSystem{ + Common: NewCommon(c, ref), + } + + return &m +} + +// QueryVsanObjectUuidsByFilter returns vSAN DOM object uuids by filter. +func (m HostVsanInternalSystem) QueryVsanObjectUuidsByFilter(ctx context.Context, uuids []string, limit int32, version int32) ([]string, error) { + req := types.QueryVsanObjectUuidsByFilter{ + This: m.Reference(), + Uuids: uuids, + Limit: limit, + Version: version, + } + + res, err := methods.QueryVsanObjectUuidsByFilter(ctx, m.Client(), &req) + if err != nil { + return nil, err + } + + return res.Returnval, nil +} + +type VsanObjExtAttrs struct { + Type string `json:"Object type"` + Class string `json:"Object class"` + Size string `json:"Object size"` + Path string `json:"Object path"` + Name string `json:"User friendly name"` +} + +func (a *VsanObjExtAttrs) DatastorePath(dir string) string { + l := len(dir) + path := a.Path + + if len(path) >= l { + path = a.Path[l:] + } + + if path != "" { + return path + } + + return a.Name // vmnamespace +} + +// GetVsanObjExtAttrs is internal and intended for troubleshooting/debugging situations in the field. +// WARNING: This API can be slow because we do IOs (reads) to all the objects. +func (m HostVsanInternalSystem) GetVsanObjExtAttrs(ctx context.Context, uuids []string) (map[string]VsanObjExtAttrs, error) { + req := types.GetVsanObjExtAttrs{ + This: m.Reference(), + Uuids: uuids, + } + + res, err := methods.GetVsanObjExtAttrs(ctx, m.Client(), &req) + if err != nil { + return nil, err + } + + var attrs map[string]VsanObjExtAttrs + + err = json.Unmarshal([]byte(res.Returnval), &attrs) + + return attrs, err +} + +// DeleteVsanObjects is internal and intended for troubleshooting/debugging only. +// WARNING: This API can be slow because we do IOs to all the objects. +// DOM won't allow access to objects which have lost quorum. Such objects can be deleted with the optional "force" flag. +// These objects may however re-appear with quorum if the absent components come back (network partition gets resolved, etc.) +func (m HostVsanInternalSystem) DeleteVsanObjects(ctx context.Context, uuids []string, force *bool) ([]types.HostVsanInternalSystemDeleteVsanObjectsResult, error) { + req := types.DeleteVsanObjects{ + This: m.Reference(), + Uuids: uuids, + Force: force, + } + + res, err := methods.DeleteVsanObjects(ctx, m.Client(), &req) + if err != nil { + return nil, err + } + + return res.Returnval, nil +} diff --git a/vendor/github.com/vmware/govmomi/object/list_view.go b/vendor/github.com/vmware/govmomi/object/list_view.go deleted file mode 100644 index 8c755427e8..0000000000 --- a/vendor/github.com/vmware/govmomi/object/list_view.go +++ /dev/null @@ -1,70 +0,0 @@ -/* -Copyright (c) 2015 VMware, Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package object - -import ( - "context" - - "github.com/vmware/govmomi/vim25" - "github.com/vmware/govmomi/vim25/methods" - "github.com/vmware/govmomi/vim25/types" -) - -type ListView struct { - Common -} - -func NewListView(c *vim25.Client, ref types.ManagedObjectReference) *ListView { - return &ListView{ - Common: NewCommon(c, ref), - } -} - -func (v ListView) Destroy(ctx context.Context) error { - req := types.DestroyView{ - This: v.Reference(), - } - _, err := methods.DestroyView(ctx, v.c, &req) - return err -} - -func (v ListView) Add(ctx context.Context, refs []types.ManagedObjectReference) error { - req := types.ModifyListView{ - This: v.Reference(), - Add: refs, - } - _, err := methods.ModifyListView(ctx, v.c, &req) - return err -} - -func (v ListView) Remove(ctx context.Context, refs []types.ManagedObjectReference) error { - req := types.ModifyListView{ - This: v.Reference(), - Remove: refs, - } - _, err := methods.ModifyListView(ctx, v.c, &req) - return err -} - -func (v ListView) Reset(ctx context.Context, refs []types.ManagedObjectReference) error { - req := types.ResetListView{ - This: v.Reference(), - Obj: refs, - } - _, err := methods.ResetListView(ctx, v.c, &req) - return err -} diff --git a/vendor/github.com/vmware/govmomi/object/opaque_network.go b/vendor/github.com/vmware/govmomi/object/opaque_network.go new file mode 100644 index 0000000000..47ce4cefe6 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/object/opaque_network.go @@ -0,0 +1,57 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package object + +import ( + "context" + "fmt" + + "github.com/vmware/govmomi/vim25" + "github.com/vmware/govmomi/vim25/mo" + "github.com/vmware/govmomi/vim25/types" +) + +type OpaqueNetwork struct { + Common +} + +func NewOpaqueNetwork(c *vim25.Client, ref types.ManagedObjectReference) *OpaqueNetwork { + return &OpaqueNetwork{ + Common: NewCommon(c, ref), + } +} + +// EthernetCardBackingInfo returns the VirtualDeviceBackingInfo for this Network +func (n OpaqueNetwork) EthernetCardBackingInfo(ctx context.Context) (types.BaseVirtualDeviceBackingInfo, error) { + var net mo.OpaqueNetwork + + if err := n.Properties(ctx, n.Reference(), []string{"summary"}, &net); err != nil { + return nil, err + } + + summary, ok := net.Summary.(*types.OpaqueNetworkSummary) + if !ok { + return nil, fmt.Errorf("%s unsupported network type: %T", n, net.Summary) + } + + backing := &types.VirtualEthernetCardOpaqueNetworkBackingInfo{ + OpaqueNetworkId: summary.OpaqueNetworkId, + OpaqueNetworkType: summary.OpaqueNetworkType, + } + + return backing, nil +} diff --git a/vendor/github.com/vmware/govmomi/object/virtual_disk_manager_internal.go b/vendor/github.com/vmware/govmomi/object/virtual_disk_manager_internal.go new file mode 100644 index 0000000000..642cd62f6e --- /dev/null +++ b/vendor/github.com/vmware/govmomi/object/virtual_disk_manager_internal.go @@ -0,0 +1,97 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package object + +import ( + "context" + "reflect" + + "github.com/vmware/govmomi/vim25/soap" + "github.com/vmware/govmomi/vim25/types" +) + +func init() { + types.Add("ArrayOfVirtualDiskInfo", reflect.TypeOf((*arrayOfVirtualDiskInfo)(nil)).Elem()) + + types.Add("VirtualDiskInfo", reflect.TypeOf((*VirtualDiskInfo)(nil)).Elem()) +} + +type arrayOfVirtualDiskInfo struct { + VirtualDiskInfo []VirtualDiskInfo `xml:"VirtualDiskInfo,omitempty"` +} + +type queryVirtualDiskInfoTaskRequest struct { + This types.ManagedObjectReference `xml:"_this"` + Name string `xml:"name"` + Datacenter *types.ManagedObjectReference `xml:"datacenter,omitempty"` + IncludeParents bool `xml:"includeParents"` +} + +type queryVirtualDiskInfoTaskResponse struct { + Returnval types.ManagedObjectReference `xml:"returnval"` +} + +type queryVirtualDiskInfoTaskBody struct { + Req *queryVirtualDiskInfoTaskRequest `xml:"urn:internalvim25 QueryVirtualDiskInfo_Task,omitempty"` + Res *queryVirtualDiskInfoTaskResponse `xml:"urn:vim25 QueryVirtualDiskInfo_TaskResponse,omitempty"` + Err *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *queryVirtualDiskInfoTaskBody) Fault() *soap.Fault { return b.Err } + +func queryVirtualDiskInfoTask(ctx context.Context, r soap.RoundTripper, req *queryVirtualDiskInfoTaskRequest) (*queryVirtualDiskInfoTaskResponse, error) { + var reqBody, resBody queryVirtualDiskInfoTaskBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type VirtualDiskInfo struct { + Name string `xml:"unit>name"` + DiskType string `xml:"diskType"` + Parent string `xml:"parent,omitempty"` +} + +func (m VirtualDiskManager) QueryVirtualDiskInfo(ctx context.Context, name string, dc *Datacenter, includeParents bool) ([]VirtualDiskInfo, error) { + req := queryVirtualDiskInfoTaskRequest{ + This: m.Reference(), + Name: name, + IncludeParents: includeParents, + } + + if dc != nil { + ref := dc.Reference() + req.Datacenter = &ref + } + + res, err := queryVirtualDiskInfoTask(ctx, m.Client(), &req) + if err != nil { + return nil, err + } + + info, err := NewTask(m.Client(), res.Returnval).WaitForResult(ctx, nil) + if err != nil { + return nil, err + } + + return info.Result.(arrayOfVirtualDiskInfo).VirtualDiskInfo, nil +} diff --git a/vendor/github.com/vmware/govmomi/object/virtual_machine.go b/vendor/github.com/vmware/govmomi/object/virtual_machine.go index 87ae9a5111..8fd6a421b2 100644 --- a/vendor/github.com/vmware/govmomi/object/virtual_machine.go +++ b/vendor/github.com/vmware/govmomi/object/virtual_machine.go @@ -725,3 +725,35 @@ func (v VirtualMachine) QueryConfigTarget(ctx context.Context) (*types.ConfigTar return res.Returnval, nil } + +func (v VirtualMachine) MountToolsInstaller(ctx context.Context) error { + req := types.MountToolsInstaller{ + This: v.Reference(), + } + + _, err := methods.MountToolsInstaller(ctx, v.Client(), &req) + return err +} + +func (v VirtualMachine) UnmountToolsInstaller(ctx context.Context) error { + req := types.UnmountToolsInstaller{ + This: v.Reference(), + } + + _, err := methods.UnmountToolsInstaller(ctx, v.Client(), &req) + return err +} + +func (v VirtualMachine) UpgradeTools(ctx context.Context, options string) (*Task, error) { + req := types.UpgradeTools_Task{ + This: v.Reference(), + InstallerOptions: options, + } + + res, err := methods.UpgradeTools_Task(ctx, v.Client(), &req) + if err != nil { + return nil, err + } + + return NewTask(v.c, res.Returnval), nil +} diff --git a/vendor/github.com/vmware/govmomi/pbm/BUILD b/vendor/github.com/vmware/govmomi/pbm/BUILD new file mode 100644 index 0000000000..738d8079ac --- /dev/null +++ b/vendor/github.com/vmware/govmomi/pbm/BUILD @@ -0,0 +1,41 @@ +package(default_visibility = ["//visibility:public"]) + +licenses(["notice"]) + +load( + "@io_bazel_rules_go//go:def.bzl", + "go_library", +) + +go_library( + name = "go_default_library", + srcs = [ + "client.go", + "pbm_util.go", + ], + tags = ["automanaged"], + deps = [ + "//vendor/github.com/vmware/govmomi/pbm/methods:go_default_library", + "//vendor/github.com/vmware/govmomi/pbm/types:go_default_library", + "//vendor/github.com/vmware/govmomi/vim25:go_default_library", + "//vendor/github.com/vmware/govmomi/vim25/soap:go_default_library", + "//vendor/github.com/vmware/govmomi/vim25/types:go_default_library", + ], +) + +filegroup( + name = "package-srcs", + srcs = glob(["**"]), + tags = ["automanaged"], + visibility = ["//visibility:private"], +) + +filegroup( + name = "all-srcs", + srcs = [ + ":package-srcs", + "//vendor/github.com/vmware/govmomi/pbm/methods:all-srcs", + "//vendor/github.com/vmware/govmomi/pbm/types:all-srcs", + ], + tags = ["automanaged"], +) diff --git a/vendor/github.com/vmware/govmomi/pbm/client.go b/vendor/github.com/vmware/govmomi/pbm/client.go new file mode 100644 index 0000000000..a0f07fc9e2 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/pbm/client.go @@ -0,0 +1,217 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package pbm + +import ( + "context" + "fmt" + + "github.com/vmware/govmomi/pbm/methods" + "github.com/vmware/govmomi/pbm/types" + "github.com/vmware/govmomi/vim25" + "github.com/vmware/govmomi/vim25/soap" + vim "github.com/vmware/govmomi/vim25/types" +) + +type Client struct { + *soap.Client + + ServiceContent types.PbmServiceInstanceContent +} + +func NewClient(ctx context.Context, c *vim25.Client) (*Client, error) { + sc := c.Client.NewServiceClient("/pbm/sdk", "urn:pbm") + + req := types.PbmRetrieveServiceContent{ + This: vim.ManagedObjectReference{ + Type: "PbmServiceInstance", + Value: "ServiceInstance", + }, + } + + res, err := methods.PbmRetrieveServiceContent(ctx, sc, &req) + if err != nil { + return nil, err + } + + return &Client{sc, res.Returnval}, nil +} + +func (c *Client) QueryProfile(ctx context.Context, rtype types.PbmProfileResourceType, category string) ([]types.PbmProfileId, error) { + req := types.PbmQueryProfile{ + This: c.ServiceContent.ProfileManager, + ResourceType: rtype, + ProfileCategory: category, + } + + res, err := methods.PbmQueryProfile(ctx, c, &req) + if err != nil { + return nil, err + } + + return res.Returnval, nil +} + +func (c *Client) RetrieveContent(ctx context.Context, ids []types.PbmProfileId) ([]types.BasePbmProfile, error) { + req := types.PbmRetrieveContent{ + This: c.ServiceContent.ProfileManager, + ProfileIds: ids, + } + + res, err := methods.PbmRetrieveContent(ctx, c, &req) + if err != nil { + return nil, err + } + + return res.Returnval, nil +} + +type PlacementCompatibilityResult []types.PbmPlacementCompatibilityResult + +func (c *Client) CheckRequirements(ctx context.Context, hubs []types.PbmPlacementHub, ref *types.PbmServerObjectRef, preq []types.BasePbmPlacementRequirement) (PlacementCompatibilityResult, error) { + req := types.PbmCheckRequirements{ + This: c.ServiceContent.PlacementSolver, + HubsToSearch: hubs, + PlacementSubjectRef: ref, + PlacementSubjectRequirement: preq, + } + + res, err := methods.PbmCheckRequirements(ctx, c, &req) + if err != nil { + return nil, err + } + + return res.Returnval, nil +} + +func (l PlacementCompatibilityResult) CompatibleDatastores() []types.PbmPlacementHub { + var compatibleDatastores []types.PbmPlacementHub + + for _, res := range l { + if len(res.Error) == 0 { + compatibleDatastores = append(compatibleDatastores, res.Hub) + } + } + return compatibleDatastores +} + +func (l PlacementCompatibilityResult) NonCompatibleDatastores() []types.PbmPlacementHub { + var nonCompatibleDatastores []types.PbmPlacementHub + + for _, res := range l { + if len(res.Error) > 0 { + nonCompatibleDatastores = append(nonCompatibleDatastores, res.Hub) + } + } + return nonCompatibleDatastores +} + +func (c *Client) CreateProfile(ctx context.Context, capabilityProfileCreateSpec types.PbmCapabilityProfileCreateSpec) (*types.PbmProfileId, error) { + req := types.PbmCreate{ + This: c.ServiceContent.ProfileManager, + CreateSpec: capabilityProfileCreateSpec, + } + + res, err := methods.PbmCreate(ctx, c, &req) + if err != nil { + return nil, err + } + + return &res.Returnval, nil +} + +func (c *Client) UpdateProfile(ctx context.Context, id types.PbmProfileId, updateSpec types.PbmCapabilityProfileUpdateSpec) error { + req := types.PbmUpdate{ + This: c.ServiceContent.ProfileManager, + ProfileId: id, + UpdateSpec: updateSpec, + } + + _, err := methods.PbmUpdate(ctx, c, &req) + if err != nil { + return err + } + + return nil +} + +func (c *Client) DeleteProfile(ctx context.Context, ids []types.PbmProfileId) ([]types.PbmProfileOperationOutcome, error) { + req := types.PbmDelete{ + This: c.ServiceContent.ProfileManager, + ProfileId: ids, + } + + res, err := methods.PbmDelete(ctx, c, &req) + if err != nil { + return nil, err + } + + return res.Returnval, nil +} + +func (c *Client) QueryAssociatedEntity(ctx context.Context, id types.PbmProfileId, entityType string) ([]types.PbmServerObjectRef, error) { + req := types.PbmQueryAssociatedEntity{ + This: c.ServiceContent.ProfileManager, + Profile: id, + EntityType: entityType, + } + + res, err := methods.PbmQueryAssociatedEntity(ctx, c, &req) + if err != nil { + return nil, err + } + + return res.Returnval, nil +} + +func (c *Client) QueryAssociatedEntities(ctx context.Context, ids []types.PbmProfileId) ([]types.PbmQueryProfileResult, error) { + req := types.PbmQueryAssociatedEntities{ + This: c.ServiceContent.ProfileManager, + Profiles: ids, + } + + res, err := methods.PbmQueryAssociatedEntities(ctx, c, &req) + if err != nil { + return nil, err + } + + return res.Returnval, nil +} + +func (c *Client) ProfileIDByName(ctx context.Context, profileName string) (string, error) { + resourceType := types.PbmProfileResourceType{ + ResourceType: string(types.PbmProfileResourceTypeEnumSTORAGE), + } + category := types.PbmProfileCategoryEnumREQUIREMENT + ids, err := c.QueryProfile(ctx, resourceType, string(category)) + if err != nil { + return "", err + } + + profiles, err := c.RetrieveContent(ctx, ids) + if err != nil { + return "", err + } + + for i := range profiles { + profile := profiles[i].GetPbmProfile() + if profile.Name == profileName { + return profile.ProfileId.UniqueId, nil + } + } + return "", fmt.Errorf("no pbm profile found with name: %q", profileName) +} diff --git a/vendor/github.com/vmware/govmomi/pbm/methods/BUILD b/vendor/github.com/vmware/govmomi/pbm/methods/BUILD new file mode 100644 index 0000000000..e46975ca60 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/pbm/methods/BUILD @@ -0,0 +1,31 @@ +package(default_visibility = ["//visibility:public"]) + +licenses(["notice"]) + +load( + "@io_bazel_rules_go//go:def.bzl", + "go_library", +) + +go_library( + name = "go_default_library", + srcs = ["methods.go"], + tags = ["automanaged"], + deps = [ + "//vendor/github.com/vmware/govmomi/pbm/types:go_default_library", + "//vendor/github.com/vmware/govmomi/vim25/soap:go_default_library", + ], +) + +filegroup( + name = "package-srcs", + srcs = glob(["**"]), + tags = ["automanaged"], + visibility = ["//visibility:private"], +) + +filegroup( + name = "all-srcs", + srcs = [":package-srcs"], + tags = ["automanaged"], +) diff --git a/vendor/github.com/vmware/govmomi/pbm/methods/methods.go b/vendor/github.com/vmware/govmomi/pbm/methods/methods.go new file mode 100644 index 0000000000..08ee48e990 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/pbm/methods/methods.go @@ -0,0 +1,664 @@ +/* +Copyright (c) 2014-2017 VMware, Inc. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package methods + +import ( + "context" + + "github.com/vmware/govmomi/pbm/types" + "github.com/vmware/govmomi/vim25/soap" +) + +type PbmAssignDefaultRequirementProfileBody struct { + Req *types.PbmAssignDefaultRequirementProfile `xml:"urn:pbm PbmAssignDefaultRequirementProfile,omitempty"` + Res *types.PbmAssignDefaultRequirementProfileResponse `xml:"urn:pbm PbmAssignDefaultRequirementProfileResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *PbmAssignDefaultRequirementProfileBody) Fault() *soap.Fault { return b.Fault_ } + +func PbmAssignDefaultRequirementProfile(ctx context.Context, r soap.RoundTripper, req *types.PbmAssignDefaultRequirementProfile) (*types.PbmAssignDefaultRequirementProfileResponse, error) { + var reqBody, resBody PbmAssignDefaultRequirementProfileBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type PbmCheckCompatibilityBody struct { + Req *types.PbmCheckCompatibility `xml:"urn:pbm PbmCheckCompatibility,omitempty"` + Res *types.PbmCheckCompatibilityResponse `xml:"urn:pbm PbmCheckCompatibilityResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *PbmCheckCompatibilityBody) Fault() *soap.Fault { return b.Fault_ } + +func PbmCheckCompatibility(ctx context.Context, r soap.RoundTripper, req *types.PbmCheckCompatibility) (*types.PbmCheckCompatibilityResponse, error) { + var reqBody, resBody PbmCheckCompatibilityBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type PbmCheckCompatibilityWithSpecBody struct { + Req *types.PbmCheckCompatibilityWithSpec `xml:"urn:pbm PbmCheckCompatibilityWithSpec,omitempty"` + Res *types.PbmCheckCompatibilityWithSpecResponse `xml:"urn:pbm PbmCheckCompatibilityWithSpecResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *PbmCheckCompatibilityWithSpecBody) Fault() *soap.Fault { return b.Fault_ } + +func PbmCheckCompatibilityWithSpec(ctx context.Context, r soap.RoundTripper, req *types.PbmCheckCompatibilityWithSpec) (*types.PbmCheckCompatibilityWithSpecResponse, error) { + var reqBody, resBody PbmCheckCompatibilityWithSpecBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type PbmCheckComplianceBody struct { + Req *types.PbmCheckCompliance `xml:"urn:pbm PbmCheckCompliance,omitempty"` + Res *types.PbmCheckComplianceResponse `xml:"urn:pbm PbmCheckComplianceResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *PbmCheckComplianceBody) Fault() *soap.Fault { return b.Fault_ } + +func PbmCheckCompliance(ctx context.Context, r soap.RoundTripper, req *types.PbmCheckCompliance) (*types.PbmCheckComplianceResponse, error) { + var reqBody, resBody PbmCheckComplianceBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type PbmCheckRequirementsBody struct { + Req *types.PbmCheckRequirements `xml:"urn:pbm PbmCheckRequirements,omitempty"` + Res *types.PbmCheckRequirementsResponse `xml:"urn:pbm PbmCheckRequirementsResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *PbmCheckRequirementsBody) Fault() *soap.Fault { return b.Fault_ } + +func PbmCheckRequirements(ctx context.Context, r soap.RoundTripper, req *types.PbmCheckRequirements) (*types.PbmCheckRequirementsResponse, error) { + var reqBody, resBody PbmCheckRequirementsBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type PbmCheckRollupComplianceBody struct { + Req *types.PbmCheckRollupCompliance `xml:"urn:pbm PbmCheckRollupCompliance,omitempty"` + Res *types.PbmCheckRollupComplianceResponse `xml:"urn:pbm PbmCheckRollupComplianceResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *PbmCheckRollupComplianceBody) Fault() *soap.Fault { return b.Fault_ } + +func PbmCheckRollupCompliance(ctx context.Context, r soap.RoundTripper, req *types.PbmCheckRollupCompliance) (*types.PbmCheckRollupComplianceResponse, error) { + var reqBody, resBody PbmCheckRollupComplianceBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type PbmCreateBody struct { + Req *types.PbmCreate `xml:"urn:pbm PbmCreate,omitempty"` + Res *types.PbmCreateResponse `xml:"urn:pbm PbmCreateResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *PbmCreateBody) Fault() *soap.Fault { return b.Fault_ } + +func PbmCreate(ctx context.Context, r soap.RoundTripper, req *types.PbmCreate) (*types.PbmCreateResponse, error) { + var reqBody, resBody PbmCreateBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type PbmDeleteBody struct { + Req *types.PbmDelete `xml:"urn:pbm PbmDelete,omitempty"` + Res *types.PbmDeleteResponse `xml:"urn:pbm PbmDeleteResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *PbmDeleteBody) Fault() *soap.Fault { return b.Fault_ } + +func PbmDelete(ctx context.Context, r soap.RoundTripper, req *types.PbmDelete) (*types.PbmDeleteResponse, error) { + var reqBody, resBody PbmDeleteBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type PbmFetchCapabilityMetadataBody struct { + Req *types.PbmFetchCapabilityMetadata `xml:"urn:pbm PbmFetchCapabilityMetadata,omitempty"` + Res *types.PbmFetchCapabilityMetadataResponse `xml:"urn:pbm PbmFetchCapabilityMetadataResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *PbmFetchCapabilityMetadataBody) Fault() *soap.Fault { return b.Fault_ } + +func PbmFetchCapabilityMetadata(ctx context.Context, r soap.RoundTripper, req *types.PbmFetchCapabilityMetadata) (*types.PbmFetchCapabilityMetadataResponse, error) { + var reqBody, resBody PbmFetchCapabilityMetadataBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type PbmFetchCapabilitySchemaBody struct { + Req *types.PbmFetchCapabilitySchema `xml:"urn:pbm PbmFetchCapabilitySchema,omitempty"` + Res *types.PbmFetchCapabilitySchemaResponse `xml:"urn:pbm PbmFetchCapabilitySchemaResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *PbmFetchCapabilitySchemaBody) Fault() *soap.Fault { return b.Fault_ } + +func PbmFetchCapabilitySchema(ctx context.Context, r soap.RoundTripper, req *types.PbmFetchCapabilitySchema) (*types.PbmFetchCapabilitySchemaResponse, error) { + var reqBody, resBody PbmFetchCapabilitySchemaBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type PbmFetchComplianceResultBody struct { + Req *types.PbmFetchComplianceResult `xml:"urn:pbm PbmFetchComplianceResult,omitempty"` + Res *types.PbmFetchComplianceResultResponse `xml:"urn:pbm PbmFetchComplianceResultResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *PbmFetchComplianceResultBody) Fault() *soap.Fault { return b.Fault_ } + +func PbmFetchComplianceResult(ctx context.Context, r soap.RoundTripper, req *types.PbmFetchComplianceResult) (*types.PbmFetchComplianceResultResponse, error) { + var reqBody, resBody PbmFetchComplianceResultBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type PbmFetchResourceTypeBody struct { + Req *types.PbmFetchResourceType `xml:"urn:pbm PbmFetchResourceType,omitempty"` + Res *types.PbmFetchResourceTypeResponse `xml:"urn:pbm PbmFetchResourceTypeResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *PbmFetchResourceTypeBody) Fault() *soap.Fault { return b.Fault_ } + +func PbmFetchResourceType(ctx context.Context, r soap.RoundTripper, req *types.PbmFetchResourceType) (*types.PbmFetchResourceTypeResponse, error) { + var reqBody, resBody PbmFetchResourceTypeBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type PbmFetchRollupComplianceResultBody struct { + Req *types.PbmFetchRollupComplianceResult `xml:"urn:pbm PbmFetchRollupComplianceResult,omitempty"` + Res *types.PbmFetchRollupComplianceResultResponse `xml:"urn:pbm PbmFetchRollupComplianceResultResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *PbmFetchRollupComplianceResultBody) Fault() *soap.Fault { return b.Fault_ } + +func PbmFetchRollupComplianceResult(ctx context.Context, r soap.RoundTripper, req *types.PbmFetchRollupComplianceResult) (*types.PbmFetchRollupComplianceResultResponse, error) { + var reqBody, resBody PbmFetchRollupComplianceResultBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type PbmFetchVendorInfoBody struct { + Req *types.PbmFetchVendorInfo `xml:"urn:pbm PbmFetchVendorInfo,omitempty"` + Res *types.PbmFetchVendorInfoResponse `xml:"urn:pbm PbmFetchVendorInfoResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *PbmFetchVendorInfoBody) Fault() *soap.Fault { return b.Fault_ } + +func PbmFetchVendorInfo(ctx context.Context, r soap.RoundTripper, req *types.PbmFetchVendorInfo) (*types.PbmFetchVendorInfoResponse, error) { + var reqBody, resBody PbmFetchVendorInfoBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type PbmFindApplicableDefaultProfileBody struct { + Req *types.PbmFindApplicableDefaultProfile `xml:"urn:pbm PbmFindApplicableDefaultProfile,omitempty"` + Res *types.PbmFindApplicableDefaultProfileResponse `xml:"urn:pbm PbmFindApplicableDefaultProfileResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *PbmFindApplicableDefaultProfileBody) Fault() *soap.Fault { return b.Fault_ } + +func PbmFindApplicableDefaultProfile(ctx context.Context, r soap.RoundTripper, req *types.PbmFindApplicableDefaultProfile) (*types.PbmFindApplicableDefaultProfileResponse, error) { + var reqBody, resBody PbmFindApplicableDefaultProfileBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type PbmQueryAssociatedEntitiesBody struct { + Req *types.PbmQueryAssociatedEntities `xml:"urn:pbm PbmQueryAssociatedEntities,omitempty"` + Res *types.PbmQueryAssociatedEntitiesResponse `xml:"urn:pbm PbmQueryAssociatedEntitiesResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *PbmQueryAssociatedEntitiesBody) Fault() *soap.Fault { return b.Fault_ } + +func PbmQueryAssociatedEntities(ctx context.Context, r soap.RoundTripper, req *types.PbmQueryAssociatedEntities) (*types.PbmQueryAssociatedEntitiesResponse, error) { + var reqBody, resBody PbmQueryAssociatedEntitiesBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type PbmQueryAssociatedEntityBody struct { + Req *types.PbmQueryAssociatedEntity `xml:"urn:pbm PbmQueryAssociatedEntity,omitempty"` + Res *types.PbmQueryAssociatedEntityResponse `xml:"urn:pbm PbmQueryAssociatedEntityResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *PbmQueryAssociatedEntityBody) Fault() *soap.Fault { return b.Fault_ } + +func PbmQueryAssociatedEntity(ctx context.Context, r soap.RoundTripper, req *types.PbmQueryAssociatedEntity) (*types.PbmQueryAssociatedEntityResponse, error) { + var reqBody, resBody PbmQueryAssociatedEntityBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type PbmQueryAssociatedProfileBody struct { + Req *types.PbmQueryAssociatedProfile `xml:"urn:pbm PbmQueryAssociatedProfile,omitempty"` + Res *types.PbmQueryAssociatedProfileResponse `xml:"urn:pbm PbmQueryAssociatedProfileResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *PbmQueryAssociatedProfileBody) Fault() *soap.Fault { return b.Fault_ } + +func PbmQueryAssociatedProfile(ctx context.Context, r soap.RoundTripper, req *types.PbmQueryAssociatedProfile) (*types.PbmQueryAssociatedProfileResponse, error) { + var reqBody, resBody PbmQueryAssociatedProfileBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type PbmQueryAssociatedProfilesBody struct { + Req *types.PbmQueryAssociatedProfiles `xml:"urn:pbm PbmQueryAssociatedProfiles,omitempty"` + Res *types.PbmQueryAssociatedProfilesResponse `xml:"urn:pbm PbmQueryAssociatedProfilesResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *PbmQueryAssociatedProfilesBody) Fault() *soap.Fault { return b.Fault_ } + +func PbmQueryAssociatedProfiles(ctx context.Context, r soap.RoundTripper, req *types.PbmQueryAssociatedProfiles) (*types.PbmQueryAssociatedProfilesResponse, error) { + var reqBody, resBody PbmQueryAssociatedProfilesBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type PbmQueryByRollupComplianceStatusBody struct { + Req *types.PbmQueryByRollupComplianceStatus `xml:"urn:pbm PbmQueryByRollupComplianceStatus,omitempty"` + Res *types.PbmQueryByRollupComplianceStatusResponse `xml:"urn:pbm PbmQueryByRollupComplianceStatusResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *PbmQueryByRollupComplianceStatusBody) Fault() *soap.Fault { return b.Fault_ } + +func PbmQueryByRollupComplianceStatus(ctx context.Context, r soap.RoundTripper, req *types.PbmQueryByRollupComplianceStatus) (*types.PbmQueryByRollupComplianceStatusResponse, error) { + var reqBody, resBody PbmQueryByRollupComplianceStatusBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type PbmQueryDefaultRequirementProfileBody struct { + Req *types.PbmQueryDefaultRequirementProfile `xml:"urn:pbm PbmQueryDefaultRequirementProfile,omitempty"` + Res *types.PbmQueryDefaultRequirementProfileResponse `xml:"urn:pbm PbmQueryDefaultRequirementProfileResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *PbmQueryDefaultRequirementProfileBody) Fault() *soap.Fault { return b.Fault_ } + +func PbmQueryDefaultRequirementProfile(ctx context.Context, r soap.RoundTripper, req *types.PbmQueryDefaultRequirementProfile) (*types.PbmQueryDefaultRequirementProfileResponse, error) { + var reqBody, resBody PbmQueryDefaultRequirementProfileBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type PbmQueryDefaultRequirementProfilesBody struct { + Req *types.PbmQueryDefaultRequirementProfiles `xml:"urn:pbm PbmQueryDefaultRequirementProfiles,omitempty"` + Res *types.PbmQueryDefaultRequirementProfilesResponse `xml:"urn:pbm PbmQueryDefaultRequirementProfilesResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *PbmQueryDefaultRequirementProfilesBody) Fault() *soap.Fault { return b.Fault_ } + +func PbmQueryDefaultRequirementProfiles(ctx context.Context, r soap.RoundTripper, req *types.PbmQueryDefaultRequirementProfiles) (*types.PbmQueryDefaultRequirementProfilesResponse, error) { + var reqBody, resBody PbmQueryDefaultRequirementProfilesBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type PbmQueryMatchingHubBody struct { + Req *types.PbmQueryMatchingHub `xml:"urn:pbm PbmQueryMatchingHub,omitempty"` + Res *types.PbmQueryMatchingHubResponse `xml:"urn:pbm PbmQueryMatchingHubResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *PbmQueryMatchingHubBody) Fault() *soap.Fault { return b.Fault_ } + +func PbmQueryMatchingHub(ctx context.Context, r soap.RoundTripper, req *types.PbmQueryMatchingHub) (*types.PbmQueryMatchingHubResponse, error) { + var reqBody, resBody PbmQueryMatchingHubBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type PbmQueryMatchingHubWithSpecBody struct { + Req *types.PbmQueryMatchingHubWithSpec `xml:"urn:pbm PbmQueryMatchingHubWithSpec,omitempty"` + Res *types.PbmQueryMatchingHubWithSpecResponse `xml:"urn:pbm PbmQueryMatchingHubWithSpecResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *PbmQueryMatchingHubWithSpecBody) Fault() *soap.Fault { return b.Fault_ } + +func PbmQueryMatchingHubWithSpec(ctx context.Context, r soap.RoundTripper, req *types.PbmQueryMatchingHubWithSpec) (*types.PbmQueryMatchingHubWithSpecResponse, error) { + var reqBody, resBody PbmQueryMatchingHubWithSpecBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type PbmQueryProfileBody struct { + Req *types.PbmQueryProfile `xml:"urn:pbm PbmQueryProfile,omitempty"` + Res *types.PbmQueryProfileResponse `xml:"urn:pbm PbmQueryProfileResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *PbmQueryProfileBody) Fault() *soap.Fault { return b.Fault_ } + +func PbmQueryProfile(ctx context.Context, r soap.RoundTripper, req *types.PbmQueryProfile) (*types.PbmQueryProfileResponse, error) { + var reqBody, resBody PbmQueryProfileBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type PbmQueryReplicationGroupsBody struct { + Req *types.PbmQueryReplicationGroups `xml:"urn:pbm PbmQueryReplicationGroups,omitempty"` + Res *types.PbmQueryReplicationGroupsResponse `xml:"urn:pbm PbmQueryReplicationGroupsResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *PbmQueryReplicationGroupsBody) Fault() *soap.Fault { return b.Fault_ } + +func PbmQueryReplicationGroups(ctx context.Context, r soap.RoundTripper, req *types.PbmQueryReplicationGroups) (*types.PbmQueryReplicationGroupsResponse, error) { + var reqBody, resBody PbmQueryReplicationGroupsBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type PbmQuerySpaceStatsForStorageContainerBody struct { + Req *types.PbmQuerySpaceStatsForStorageContainer `xml:"urn:pbm PbmQuerySpaceStatsForStorageContainer,omitempty"` + Res *types.PbmQuerySpaceStatsForStorageContainerResponse `xml:"urn:pbm PbmQuerySpaceStatsForStorageContainerResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *PbmQuerySpaceStatsForStorageContainerBody) Fault() *soap.Fault { return b.Fault_ } + +func PbmQuerySpaceStatsForStorageContainer(ctx context.Context, r soap.RoundTripper, req *types.PbmQuerySpaceStatsForStorageContainer) (*types.PbmQuerySpaceStatsForStorageContainerResponse, error) { + var reqBody, resBody PbmQuerySpaceStatsForStorageContainerBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type PbmResetDefaultRequirementProfileBody struct { + Req *types.PbmResetDefaultRequirementProfile `xml:"urn:pbm PbmResetDefaultRequirementProfile,omitempty"` + Res *types.PbmResetDefaultRequirementProfileResponse `xml:"urn:pbm PbmResetDefaultRequirementProfileResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *PbmResetDefaultRequirementProfileBody) Fault() *soap.Fault { return b.Fault_ } + +func PbmResetDefaultRequirementProfile(ctx context.Context, r soap.RoundTripper, req *types.PbmResetDefaultRequirementProfile) (*types.PbmResetDefaultRequirementProfileResponse, error) { + var reqBody, resBody PbmResetDefaultRequirementProfileBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type PbmResetVSanDefaultProfileBody struct { + Req *types.PbmResetVSanDefaultProfile `xml:"urn:pbm PbmResetVSanDefaultProfile,omitempty"` + Res *types.PbmResetVSanDefaultProfileResponse `xml:"urn:pbm PbmResetVSanDefaultProfileResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *PbmResetVSanDefaultProfileBody) Fault() *soap.Fault { return b.Fault_ } + +func PbmResetVSanDefaultProfile(ctx context.Context, r soap.RoundTripper, req *types.PbmResetVSanDefaultProfile) (*types.PbmResetVSanDefaultProfileResponse, error) { + var reqBody, resBody PbmResetVSanDefaultProfileBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type PbmRetrieveContentBody struct { + Req *types.PbmRetrieveContent `xml:"urn:pbm PbmRetrieveContent,omitempty"` + Res *types.PbmRetrieveContentResponse `xml:"urn:pbm PbmRetrieveContentResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *PbmRetrieveContentBody) Fault() *soap.Fault { return b.Fault_ } + +func PbmRetrieveContent(ctx context.Context, r soap.RoundTripper, req *types.PbmRetrieveContent) (*types.PbmRetrieveContentResponse, error) { + var reqBody, resBody PbmRetrieveContentBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type PbmRetrieveServiceContentBody struct { + Req *types.PbmRetrieveServiceContent `xml:"urn:pbm PbmRetrieveServiceContent,omitempty"` + Res *types.PbmRetrieveServiceContentResponse `xml:"urn:pbm PbmRetrieveServiceContentResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *PbmRetrieveServiceContentBody) Fault() *soap.Fault { return b.Fault_ } + +func PbmRetrieveServiceContent(ctx context.Context, r soap.RoundTripper, req *types.PbmRetrieveServiceContent) (*types.PbmRetrieveServiceContentResponse, error) { + var reqBody, resBody PbmRetrieveServiceContentBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type PbmUpdateBody struct { + Req *types.PbmUpdate `xml:"urn:pbm PbmUpdate,omitempty"` + Res *types.PbmUpdateResponse `xml:"urn:pbm PbmUpdateResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *PbmUpdateBody) Fault() *soap.Fault { return b.Fault_ } + +func PbmUpdate(ctx context.Context, r soap.RoundTripper, req *types.PbmUpdate) (*types.PbmUpdateResponse, error) { + var reqBody, resBody PbmUpdateBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} diff --git a/vendor/github.com/vmware/govmomi/pbm/pbm_util.go b/vendor/github.com/vmware/govmomi/pbm/pbm_util.go new file mode 100644 index 0000000000..4cc8085f34 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/pbm/pbm_util.go @@ -0,0 +1,146 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package pbm + +import ( + "fmt" + "strconv" + "strings" + + "github.com/vmware/govmomi/pbm/types" +) + +// A struct to capture pbm create spec details. +type CapabilityProfileCreateSpec struct { + Name string + Description string + Category string + CapabilityList []Capability +} + +// A struct to capture pbm capability instance details. +type Capability struct { + ID string + Namespace string + PropertyList []Property +} + +// A struct to capture pbm property instance details. +type Property struct { + ID string + Operator string + Value string + DataType string +} + +func CreateCapabilityProfileSpec(pbmCreateSpec CapabilityProfileCreateSpec) (*types.PbmCapabilityProfileCreateSpec, error) { + capabilities, err := createCapabilityInstances(pbmCreateSpec.CapabilityList) + if err != nil { + return nil, err + } + + pbmCapabilityProfileSpec := types.PbmCapabilityProfileCreateSpec{ + Name: pbmCreateSpec.Name, + Description: pbmCreateSpec.Description, + Category: pbmCreateSpec.Category, + ResourceType: types.PbmProfileResourceType{ + ResourceType: string(types.PbmProfileResourceTypeEnumSTORAGE), + }, + Constraints: &types.PbmCapabilitySubProfileConstraints{ + SubProfiles: []types.PbmCapabilitySubProfile{ + types.PbmCapabilitySubProfile{ + Capability: capabilities, + }, + }, + }, + } + return &pbmCapabilityProfileSpec, nil +} + +func createCapabilityInstances(rules []Capability) ([]types.PbmCapabilityInstance, error) { + var capabilityInstances []types.PbmCapabilityInstance + for _, capabilityRule := range rules { + capability := types.PbmCapabilityInstance{ + Id: types.PbmCapabilityMetadataUniqueId{ + Namespace: capabilityRule.Namespace, + Id: capabilityRule.ID, + }, + } + + var propertyInstances []types.PbmCapabilityPropertyInstance + for _, propertyRule := range capabilityRule.PropertyList { + property := types.PbmCapabilityPropertyInstance{ + Id: propertyRule.ID, + } + if propertyRule.Operator != "" { + property.Operator = propertyRule.Operator + } + var err error + switch strings.ToLower(propertyRule.DataType) { + case "int": + // Go int32 is marshalled to xsi:int whereas Go int is marshalled to xsi:long when sending down the wire. + var val int32 + val, err = verifyPropertyValueIsInt(propertyRule.Value, propertyRule.DataType) + property.Value = val + case "bool": + var val bool + val, err = verifyPropertyValueIsBoolean(propertyRule.Value, propertyRule.DataType) + property.Value = val + case "string": + property.Value = propertyRule.Value + case "set": + set := types.PbmCapabilityDiscreteSet{} + for _, val := range strings.Split(propertyRule.Value, ",") { + set.Values = append(set.Values, val) + } + property.Value = set + default: + return nil, fmt.Errorf("invalid value: %q with datatype: %q", propertyRule.Value, propertyRule.Value) + } + if err != nil { + return nil, fmt.Errorf("invalid value: %q with datatype: %q", propertyRule.Value, propertyRule.Value) + } + propertyInstances = append(propertyInstances, property) + } + constraintInstances := []types.PbmCapabilityConstraintInstance{ + types.PbmCapabilityConstraintInstance{ + PropertyInstance: propertyInstances, + }, + } + capability.Constraint = constraintInstances + capabilityInstances = append(capabilityInstances, capability) + } + return capabilityInstances, nil +} + +// Verify if the capability value is of type integer. +func verifyPropertyValueIsInt(propertyValue string, dataType string) (int32, error) { + val, err := strconv.ParseInt(propertyValue, 10, 32) + if err != nil { + return -1, err + } + return int32(val), nil +} + +// Verify if the capability value is of type integer. +func verifyPropertyValueIsBoolean(propertyValue string, dataType string) (bool, error) { + val, err := strconv.ParseBool(propertyValue) + if err != nil { + return false, err + } + return val, nil +} diff --git a/vendor/github.com/vmware/govmomi/pbm/types/BUILD b/vendor/github.com/vmware/govmomi/pbm/types/BUILD new file mode 100644 index 0000000000..5106154689 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/pbm/types/BUILD @@ -0,0 +1,32 @@ +package(default_visibility = ["//visibility:public"]) + +licenses(["notice"]) + +load( + "@io_bazel_rules_go//go:def.bzl", + "go_library", +) + +go_library( + name = "go_default_library", + srcs = [ + "enum.go", + "if.go", + "types.go", + ], + tags = ["automanaged"], + deps = ["//vendor/github.com/vmware/govmomi/vim25/types:go_default_library"], +) + +filegroup( + name = "package-srcs", + srcs = glob(["**"]), + tags = ["automanaged"], + visibility = ["//visibility:private"], +) + +filegroup( + name = "all-srcs", + srcs = [":package-srcs"], + tags = ["automanaged"], +) diff --git a/vendor/github.com/vmware/govmomi/pbm/types/enum.go b/vendor/github.com/vmware/govmomi/pbm/types/enum.go new file mode 100644 index 0000000000..7cee751417 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/pbm/types/enum.go @@ -0,0 +1,211 @@ +/* +Copyright (c) 2014-2017 VMware, Inc. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package types + +import ( + "reflect" + + "github.com/vmware/govmomi/vim25/types" +) + +type PbmBuiltinGenericType string + +const ( + PbmBuiltinGenericTypeVMW_RANGE = PbmBuiltinGenericType("VMW_RANGE") + PbmBuiltinGenericTypeVMW_SET = PbmBuiltinGenericType("VMW_SET") +) + +func init() { + types.Add("pbm:PbmBuiltinGenericType", reflect.TypeOf((*PbmBuiltinGenericType)(nil)).Elem()) +} + +type PbmBuiltinType string + +const ( + PbmBuiltinTypeXSD_LONG = PbmBuiltinType("XSD_LONG") + PbmBuiltinTypeXSD_SHORT = PbmBuiltinType("XSD_SHORT") + PbmBuiltinTypeXSD_INTEGER = PbmBuiltinType("XSD_INTEGER") + PbmBuiltinTypeXSD_INT = PbmBuiltinType("XSD_INT") + PbmBuiltinTypeXSD_STRING = PbmBuiltinType("XSD_STRING") + PbmBuiltinTypeXSD_BOOLEAN = PbmBuiltinType("XSD_BOOLEAN") + PbmBuiltinTypeXSD_DOUBLE = PbmBuiltinType("XSD_DOUBLE") + PbmBuiltinTypeXSD_DATETIME = PbmBuiltinType("XSD_DATETIME") + PbmBuiltinTypeVMW_TIMESPAN = PbmBuiltinType("VMW_TIMESPAN") + PbmBuiltinTypeVMW_POLICY = PbmBuiltinType("VMW_POLICY") +) + +func init() { + types.Add("pbm:PbmBuiltinType", reflect.TypeOf((*PbmBuiltinType)(nil)).Elem()) +} + +type PbmCapabilityOperator string + +const ( + PbmCapabilityOperatorNOT = PbmCapabilityOperator("NOT") +) + +func init() { + types.Add("pbm:PbmCapabilityOperator", reflect.TypeOf((*PbmCapabilityOperator)(nil)).Elem()) +} + +type PbmCapabilityTimeUnitType string + +const ( + PbmCapabilityTimeUnitTypeSECONDS = PbmCapabilityTimeUnitType("SECONDS") + PbmCapabilityTimeUnitTypeMINUTES = PbmCapabilityTimeUnitType("MINUTES") + PbmCapabilityTimeUnitTypeHOURS = PbmCapabilityTimeUnitType("HOURS") + PbmCapabilityTimeUnitTypeDAYS = PbmCapabilityTimeUnitType("DAYS") + PbmCapabilityTimeUnitTypeWEEKS = PbmCapabilityTimeUnitType("WEEKS") + PbmCapabilityTimeUnitTypeMONTHS = PbmCapabilityTimeUnitType("MONTHS") + PbmCapabilityTimeUnitTypeYEARS = PbmCapabilityTimeUnitType("YEARS") +) + +func init() { + types.Add("pbm:PbmCapabilityTimeUnitType", reflect.TypeOf((*PbmCapabilityTimeUnitType)(nil)).Elem()) +} + +type PbmComplianceResultComplianceTaskStatus string + +const ( + PbmComplianceResultComplianceTaskStatusInProgress = PbmComplianceResultComplianceTaskStatus("inProgress") + PbmComplianceResultComplianceTaskStatusSuccess = PbmComplianceResultComplianceTaskStatus("success") + PbmComplianceResultComplianceTaskStatusFailed = PbmComplianceResultComplianceTaskStatus("failed") +) + +func init() { + types.Add("pbm:PbmComplianceResultComplianceTaskStatus", reflect.TypeOf((*PbmComplianceResultComplianceTaskStatus)(nil)).Elem()) +} + +type PbmComplianceStatus string + +const ( + PbmComplianceStatusCompliant = PbmComplianceStatus("compliant") + PbmComplianceStatusNonCompliant = PbmComplianceStatus("nonCompliant") + PbmComplianceStatusUnknown = PbmComplianceStatus("unknown") + PbmComplianceStatusNotApplicable = PbmComplianceStatus("notApplicable") + PbmComplianceStatusOutOfDate = PbmComplianceStatus("outOfDate") +) + +func init() { + types.Add("pbm:PbmComplianceStatus", reflect.TypeOf((*PbmComplianceStatus)(nil)).Elem()) +} + +type PbmIofilterInfoFilterType string + +const ( + PbmIofilterInfoFilterTypeINSPECTION = PbmIofilterInfoFilterType("INSPECTION") + PbmIofilterInfoFilterTypeCOMPRESSION = PbmIofilterInfoFilterType("COMPRESSION") + PbmIofilterInfoFilterTypeENCRYPTION = PbmIofilterInfoFilterType("ENCRYPTION") + PbmIofilterInfoFilterTypeREPLICATION = PbmIofilterInfoFilterType("REPLICATION") + PbmIofilterInfoFilterTypeCACHE = PbmIofilterInfoFilterType("CACHE") + PbmIofilterInfoFilterTypeDATAPROVIDER = PbmIofilterInfoFilterType("DATAPROVIDER") + PbmIofilterInfoFilterTypeDATASTOREIOCONTROL = PbmIofilterInfoFilterType("DATASTOREIOCONTROL") +) + +func init() { + types.Add("pbm:PbmIofilterInfoFilterType", reflect.TypeOf((*PbmIofilterInfoFilterType)(nil)).Elem()) +} + +type PbmLineOfServiceInfoLineOfServiceEnum string + +const ( + PbmLineOfServiceInfoLineOfServiceEnumINSPECTION = PbmLineOfServiceInfoLineOfServiceEnum("INSPECTION") + PbmLineOfServiceInfoLineOfServiceEnumCOMPRESSION = PbmLineOfServiceInfoLineOfServiceEnum("COMPRESSION") + PbmLineOfServiceInfoLineOfServiceEnumENCRYPTION = PbmLineOfServiceInfoLineOfServiceEnum("ENCRYPTION") + PbmLineOfServiceInfoLineOfServiceEnumREPLICATION = PbmLineOfServiceInfoLineOfServiceEnum("REPLICATION") + PbmLineOfServiceInfoLineOfServiceEnumCACHING = PbmLineOfServiceInfoLineOfServiceEnum("CACHING") + PbmLineOfServiceInfoLineOfServiceEnumPERSISTENCE = PbmLineOfServiceInfoLineOfServiceEnum("PERSISTENCE") + PbmLineOfServiceInfoLineOfServiceEnumDATA_PROVIDER = PbmLineOfServiceInfoLineOfServiceEnum("DATA_PROVIDER") + PbmLineOfServiceInfoLineOfServiceEnumDATASTORE_IO_CONTROL = PbmLineOfServiceInfoLineOfServiceEnum("DATASTORE_IO_CONTROL") +) + +func init() { + types.Add("pbm:PbmLineOfServiceInfoLineOfServiceEnum", reflect.TypeOf((*PbmLineOfServiceInfoLineOfServiceEnum)(nil)).Elem()) +} + +type PbmObjectType string + +const ( + PbmObjectTypeVirtualMachine = PbmObjectType("virtualMachine") + PbmObjectTypeVirtualMachineAndDisks = PbmObjectType("virtualMachineAndDisks") + PbmObjectTypeVirtualDiskId = PbmObjectType("virtualDiskId") + PbmObjectTypeVirtualDiskUUID = PbmObjectType("virtualDiskUUID") + PbmObjectTypeDatastore = PbmObjectType("datastore") + PbmObjectTypeUnknown = PbmObjectType("unknown") +) + +func init() { + types.Add("pbm:PbmObjectType", reflect.TypeOf((*PbmObjectType)(nil)).Elem()) +} + +type PbmProfileCategoryEnum string + +const ( + PbmProfileCategoryEnumREQUIREMENT = PbmProfileCategoryEnum("REQUIREMENT") + PbmProfileCategoryEnumRESOURCE = PbmProfileCategoryEnum("RESOURCE") + PbmProfileCategoryEnumDATA_SERVICE_POLICY = PbmProfileCategoryEnum("DATA_SERVICE_POLICY") +) + +func init() { + types.Add("pbm:PbmProfileCategoryEnum", reflect.TypeOf((*PbmProfileCategoryEnum)(nil)).Elem()) +} + +type PbmProfileResourceTypeEnum string + +const ( + PbmProfileResourceTypeEnumSTORAGE = PbmProfileResourceTypeEnum("STORAGE") +) + +func init() { + types.Add("pbm:PbmProfileResourceTypeEnum", reflect.TypeOf((*PbmProfileResourceTypeEnum)(nil)).Elem()) +} + +type PbmSystemCreatedProfileType string + +const ( + PbmSystemCreatedProfileTypeVsanDefaultProfile = PbmSystemCreatedProfileType("VsanDefaultProfile") + PbmSystemCreatedProfileTypeVVolDefaultProfile = PbmSystemCreatedProfileType("VVolDefaultProfile") +) + +func init() { + types.Add("pbm:PbmSystemCreatedProfileType", reflect.TypeOf((*PbmSystemCreatedProfileType)(nil)).Elem()) +} + +type PbmVmOperation string + +const ( + PbmVmOperationCREATE = PbmVmOperation("CREATE") + PbmVmOperationRECONFIGURE = PbmVmOperation("RECONFIGURE") + PbmVmOperationMIGRATE = PbmVmOperation("MIGRATE") + PbmVmOperationCLONE = PbmVmOperation("CLONE") +) + +func init() { + types.Add("pbm:PbmVmOperation", reflect.TypeOf((*PbmVmOperation)(nil)).Elem()) +} + +type PbmVvolType string + +const ( + PbmVvolTypeConfig = PbmVvolType("Config") + PbmVvolTypeData = PbmVvolType("Data") + PbmVvolTypeSwap = PbmVvolType("Swap") +) + +func init() { + types.Add("pbm:PbmVvolType", reflect.TypeOf((*PbmVvolType)(nil)).Elem()) +} diff --git a/vendor/github.com/vmware/govmomi/pbm/types/if.go b/vendor/github.com/vmware/govmomi/pbm/types/if.go new file mode 100644 index 0000000000..2a3ac5acc0 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/pbm/types/if.go @@ -0,0 +1,139 @@ +/* +Copyright (c) 2014-2017 VMware, Inc. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package types + +import ( + "reflect" + + "github.com/vmware/govmomi/vim25/types" +) + +func (b *PbmCapabilityConstraints) GetPbmCapabilityConstraints() *PbmCapabilityConstraints { return b } + +type BasePbmCapabilityConstraints interface { + GetPbmCapabilityConstraints() *PbmCapabilityConstraints +} + +func init() { + types.Add("BasePbmCapabilityConstraints", reflect.TypeOf((*PbmCapabilityConstraints)(nil)).Elem()) +} + +func (b *PbmCapabilityProfile) GetPbmCapabilityProfile() *PbmCapabilityProfile { return b } + +type BasePbmCapabilityProfile interface { + GetPbmCapabilityProfile() *PbmCapabilityProfile +} + +func init() { + types.Add("BasePbmCapabilityProfile", reflect.TypeOf((*PbmCapabilityProfile)(nil)).Elem()) +} + +func (b *PbmCapabilityProfilePropertyMismatchFault) GetPbmCapabilityProfilePropertyMismatchFault() *PbmCapabilityProfilePropertyMismatchFault { + return b +} + +type BasePbmCapabilityProfilePropertyMismatchFault interface { + GetPbmCapabilityProfilePropertyMismatchFault() *PbmCapabilityProfilePropertyMismatchFault +} + +func init() { + types.Add("BasePbmCapabilityProfilePropertyMismatchFault", reflect.TypeOf((*PbmCapabilityProfilePropertyMismatchFault)(nil)).Elem()) +} + +func (b *PbmCapabilityTypeInfo) GetPbmCapabilityTypeInfo() *PbmCapabilityTypeInfo { return b } + +type BasePbmCapabilityTypeInfo interface { + GetPbmCapabilityTypeInfo() *PbmCapabilityTypeInfo +} + +func init() { + types.Add("BasePbmCapabilityTypeInfo", reflect.TypeOf((*PbmCapabilityTypeInfo)(nil)).Elem()) +} + +func (b *PbmCompatibilityCheckFault) GetPbmCompatibilityCheckFault() *PbmCompatibilityCheckFault { + return b +} + +type BasePbmCompatibilityCheckFault interface { + GetPbmCompatibilityCheckFault() *PbmCompatibilityCheckFault +} + +func init() { + types.Add("BasePbmCompatibilityCheckFault", reflect.TypeOf((*PbmCompatibilityCheckFault)(nil)).Elem()) +} + +func (b *PbmFault) GetPbmFault() *PbmFault { return b } + +type BasePbmFault interface { + GetPbmFault() *PbmFault +} + +func init() { + types.Add("BasePbmFault", reflect.TypeOf((*PbmFault)(nil)).Elem()) +} + +func (b *PbmLineOfServiceInfo) GetPbmLineOfServiceInfo() *PbmLineOfServiceInfo { return b } + +type BasePbmLineOfServiceInfo interface { + GetPbmLineOfServiceInfo() *PbmLineOfServiceInfo +} + +func init() { + types.Add("BasePbmLineOfServiceInfo", reflect.TypeOf((*PbmLineOfServiceInfo)(nil)).Elem()) +} + +func (b *PbmPlacementMatchingResources) GetPbmPlacementMatchingResources() *PbmPlacementMatchingResources { + return b +} + +type BasePbmPlacementMatchingResources interface { + GetPbmPlacementMatchingResources() *PbmPlacementMatchingResources +} + +func init() { + types.Add("BasePbmPlacementMatchingResources", reflect.TypeOf((*PbmPlacementMatchingResources)(nil)).Elem()) +} + +func (b *PbmPlacementRequirement) GetPbmPlacementRequirement() *PbmPlacementRequirement { return b } + +type BasePbmPlacementRequirement interface { + GetPbmPlacementRequirement() *PbmPlacementRequirement +} + +func init() { + types.Add("BasePbmPlacementRequirement", reflect.TypeOf((*PbmPlacementRequirement)(nil)).Elem()) +} + +func (b *PbmProfile) GetPbmProfile() *PbmProfile { return b } + +type BasePbmProfile interface { + GetPbmProfile() *PbmProfile +} + +func init() { + types.Add("BasePbmProfile", reflect.TypeOf((*PbmProfile)(nil)).Elem()) +} + +func (b *PbmPropertyMismatchFault) GetPbmPropertyMismatchFault() *PbmPropertyMismatchFault { return b } + +type BasePbmPropertyMismatchFault interface { + GetPbmPropertyMismatchFault() *PbmPropertyMismatchFault +} + +func init() { + types.Add("BasePbmPropertyMismatchFault", reflect.TypeOf((*PbmPropertyMismatchFault)(nil)).Elem()) +} diff --git a/vendor/github.com/vmware/govmomi/pbm/types/types.go b/vendor/github.com/vmware/govmomi/pbm/types/types.go new file mode 100644 index 0000000000..47bd73c17b --- /dev/null +++ b/vendor/github.com/vmware/govmomi/pbm/types/types.go @@ -0,0 +1,1712 @@ +/* +Copyright (c) 2014-2017 VMware, Inc. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package types + +import ( + "reflect" + "time" + + "github.com/vmware/govmomi/vim25/types" +) + +type ArrayOfPbmCapabilityConstraintInstance struct { + PbmCapabilityConstraintInstance []PbmCapabilityConstraintInstance `xml:"PbmCapabilityConstraintInstance,omitempty"` +} + +func init() { + types.Add("pbm:ArrayOfPbmCapabilityConstraintInstance", reflect.TypeOf((*ArrayOfPbmCapabilityConstraintInstance)(nil)).Elem()) +} + +type ArrayOfPbmCapabilityInstance struct { + PbmCapabilityInstance []PbmCapabilityInstance `xml:"PbmCapabilityInstance,omitempty"` +} + +func init() { + types.Add("pbm:ArrayOfPbmCapabilityInstance", reflect.TypeOf((*ArrayOfPbmCapabilityInstance)(nil)).Elem()) +} + +type ArrayOfPbmCapabilityMetadata struct { + PbmCapabilityMetadata []PbmCapabilityMetadata `xml:"PbmCapabilityMetadata,omitempty"` +} + +func init() { + types.Add("pbm:ArrayOfPbmCapabilityMetadata", reflect.TypeOf((*ArrayOfPbmCapabilityMetadata)(nil)).Elem()) +} + +type ArrayOfPbmCapabilityMetadataPerCategory struct { + PbmCapabilityMetadataPerCategory []PbmCapabilityMetadataPerCategory `xml:"PbmCapabilityMetadataPerCategory,omitempty"` +} + +func init() { + types.Add("pbm:ArrayOfPbmCapabilityMetadataPerCategory", reflect.TypeOf((*ArrayOfPbmCapabilityMetadataPerCategory)(nil)).Elem()) +} + +type ArrayOfPbmCapabilityPropertyInstance struct { + PbmCapabilityPropertyInstance []PbmCapabilityPropertyInstance `xml:"PbmCapabilityPropertyInstance,omitempty"` +} + +func init() { + types.Add("pbm:ArrayOfPbmCapabilityPropertyInstance", reflect.TypeOf((*ArrayOfPbmCapabilityPropertyInstance)(nil)).Elem()) +} + +type ArrayOfPbmCapabilityPropertyMetadata struct { + PbmCapabilityPropertyMetadata []PbmCapabilityPropertyMetadata `xml:"PbmCapabilityPropertyMetadata,omitempty"` +} + +func init() { + types.Add("pbm:ArrayOfPbmCapabilityPropertyMetadata", reflect.TypeOf((*ArrayOfPbmCapabilityPropertyMetadata)(nil)).Elem()) +} + +type ArrayOfPbmCapabilitySchema struct { + PbmCapabilitySchema []PbmCapabilitySchema `xml:"PbmCapabilitySchema,omitempty"` +} + +func init() { + types.Add("pbm:ArrayOfPbmCapabilitySchema", reflect.TypeOf((*ArrayOfPbmCapabilitySchema)(nil)).Elem()) +} + +type ArrayOfPbmCapabilitySubProfile struct { + PbmCapabilitySubProfile []PbmCapabilitySubProfile `xml:"PbmCapabilitySubProfile,omitempty"` +} + +func init() { + types.Add("pbm:ArrayOfPbmCapabilitySubProfile", reflect.TypeOf((*ArrayOfPbmCapabilitySubProfile)(nil)).Elem()) +} + +type ArrayOfPbmCapabilityVendorNamespaceInfo struct { + PbmCapabilityVendorNamespaceInfo []PbmCapabilityVendorNamespaceInfo `xml:"PbmCapabilityVendorNamespaceInfo,omitempty"` +} + +func init() { + types.Add("pbm:ArrayOfPbmCapabilityVendorNamespaceInfo", reflect.TypeOf((*ArrayOfPbmCapabilityVendorNamespaceInfo)(nil)).Elem()) +} + +type ArrayOfPbmCapabilityVendorResourceTypeInfo struct { + PbmCapabilityVendorResourceTypeInfo []PbmCapabilityVendorResourceTypeInfo `xml:"PbmCapabilityVendorResourceTypeInfo,omitempty"` +} + +func init() { + types.Add("pbm:ArrayOfPbmCapabilityVendorResourceTypeInfo", reflect.TypeOf((*ArrayOfPbmCapabilityVendorResourceTypeInfo)(nil)).Elem()) +} + +type ArrayOfPbmCompliancePolicyStatus struct { + PbmCompliancePolicyStatus []PbmCompliancePolicyStatus `xml:"PbmCompliancePolicyStatus,omitempty"` +} + +func init() { + types.Add("pbm:ArrayOfPbmCompliancePolicyStatus", reflect.TypeOf((*ArrayOfPbmCompliancePolicyStatus)(nil)).Elem()) +} + +type ArrayOfPbmComplianceResult struct { + PbmComplianceResult []PbmComplianceResult `xml:"PbmComplianceResult,omitempty"` +} + +func init() { + types.Add("pbm:ArrayOfPbmComplianceResult", reflect.TypeOf((*ArrayOfPbmComplianceResult)(nil)).Elem()) +} + +type ArrayOfPbmDatastoreSpaceStatistics struct { + PbmDatastoreSpaceStatistics []PbmDatastoreSpaceStatistics `xml:"PbmDatastoreSpaceStatistics,omitempty"` +} + +func init() { + types.Add("pbm:ArrayOfPbmDatastoreSpaceStatistics", reflect.TypeOf((*ArrayOfPbmDatastoreSpaceStatistics)(nil)).Elem()) +} + +type ArrayOfPbmDefaultProfileInfo struct { + PbmDefaultProfileInfo []PbmDefaultProfileInfo `xml:"PbmDefaultProfileInfo,omitempty"` +} + +func init() { + types.Add("pbm:ArrayOfPbmDefaultProfileInfo", reflect.TypeOf((*ArrayOfPbmDefaultProfileInfo)(nil)).Elem()) +} + +type ArrayOfPbmPlacementCompatibilityResult struct { + PbmPlacementCompatibilityResult []PbmPlacementCompatibilityResult `xml:"PbmPlacementCompatibilityResult,omitempty"` +} + +func init() { + types.Add("pbm:ArrayOfPbmPlacementCompatibilityResult", reflect.TypeOf((*ArrayOfPbmPlacementCompatibilityResult)(nil)).Elem()) +} + +type ArrayOfPbmPlacementHub struct { + PbmPlacementHub []PbmPlacementHub `xml:"PbmPlacementHub,omitempty"` +} + +func init() { + types.Add("pbm:ArrayOfPbmPlacementHub", reflect.TypeOf((*ArrayOfPbmPlacementHub)(nil)).Elem()) +} + +type ArrayOfPbmPlacementMatchingResources struct { + PbmPlacementMatchingResources []BasePbmPlacementMatchingResources `xml:"PbmPlacementMatchingResources,omitempty,typeattr"` +} + +func init() { + types.Add("pbm:ArrayOfPbmPlacementMatchingResources", reflect.TypeOf((*ArrayOfPbmPlacementMatchingResources)(nil)).Elem()) +} + +type ArrayOfPbmPlacementRequirement struct { + PbmPlacementRequirement []BasePbmPlacementRequirement `xml:"PbmPlacementRequirement,omitempty,typeattr"` +} + +func init() { + types.Add("pbm:ArrayOfPbmPlacementRequirement", reflect.TypeOf((*ArrayOfPbmPlacementRequirement)(nil)).Elem()) +} + +type ArrayOfPbmPlacementResourceUtilization struct { + PbmPlacementResourceUtilization []PbmPlacementResourceUtilization `xml:"PbmPlacementResourceUtilization,omitempty"` +} + +func init() { + types.Add("pbm:ArrayOfPbmPlacementResourceUtilization", reflect.TypeOf((*ArrayOfPbmPlacementResourceUtilization)(nil)).Elem()) +} + +type ArrayOfPbmProfile struct { + PbmProfile []BasePbmProfile `xml:"PbmProfile,omitempty,typeattr"` +} + +func init() { + types.Add("pbm:ArrayOfPbmProfile", reflect.TypeOf((*ArrayOfPbmProfile)(nil)).Elem()) +} + +type ArrayOfPbmProfileId struct { + PbmProfileId []PbmProfileId `xml:"PbmProfileId,omitempty"` +} + +func init() { + types.Add("pbm:ArrayOfPbmProfileId", reflect.TypeOf((*ArrayOfPbmProfileId)(nil)).Elem()) +} + +type ArrayOfPbmProfileOperationOutcome struct { + PbmProfileOperationOutcome []PbmProfileOperationOutcome `xml:"PbmProfileOperationOutcome,omitempty"` +} + +func init() { + types.Add("pbm:ArrayOfPbmProfileOperationOutcome", reflect.TypeOf((*ArrayOfPbmProfileOperationOutcome)(nil)).Elem()) +} + +type ArrayOfPbmProfileResourceType struct { + PbmProfileResourceType []PbmProfileResourceType `xml:"PbmProfileResourceType,omitempty"` +} + +func init() { + types.Add("pbm:ArrayOfPbmProfileResourceType", reflect.TypeOf((*ArrayOfPbmProfileResourceType)(nil)).Elem()) +} + +type ArrayOfPbmProfileType struct { + PbmProfileType []PbmProfileType `xml:"PbmProfileType,omitempty"` +} + +func init() { + types.Add("pbm:ArrayOfPbmProfileType", reflect.TypeOf((*ArrayOfPbmProfileType)(nil)).Elem()) +} + +type ArrayOfPbmQueryProfileResult struct { + PbmQueryProfileResult []PbmQueryProfileResult `xml:"PbmQueryProfileResult,omitempty"` +} + +func init() { + types.Add("pbm:ArrayOfPbmQueryProfileResult", reflect.TypeOf((*ArrayOfPbmQueryProfileResult)(nil)).Elem()) +} + +type ArrayOfPbmQueryReplicationGroupResult struct { + PbmQueryReplicationGroupResult []PbmQueryReplicationGroupResult `xml:"PbmQueryReplicationGroupResult,omitempty"` +} + +func init() { + types.Add("pbm:ArrayOfPbmQueryReplicationGroupResult", reflect.TypeOf((*ArrayOfPbmQueryReplicationGroupResult)(nil)).Elem()) +} + +type ArrayOfPbmRollupComplianceResult struct { + PbmRollupComplianceResult []PbmRollupComplianceResult `xml:"PbmRollupComplianceResult,omitempty"` +} + +func init() { + types.Add("pbm:ArrayOfPbmRollupComplianceResult", reflect.TypeOf((*ArrayOfPbmRollupComplianceResult)(nil)).Elem()) +} + +type ArrayOfPbmServerObjectRef struct { + PbmServerObjectRef []PbmServerObjectRef `xml:"PbmServerObjectRef,omitempty"` +} + +func init() { + types.Add("pbm:ArrayOfPbmServerObjectRef", reflect.TypeOf((*ArrayOfPbmServerObjectRef)(nil)).Elem()) +} + +type PbmAboutInfo struct { + types.DynamicData + + Name string `xml:"name"` + Version string `xml:"version"` + InstanceUuid string `xml:"instanceUuid"` +} + +func init() { + types.Add("pbm:PbmAboutInfo", reflect.TypeOf((*PbmAboutInfo)(nil)).Elem()) +} + +type PbmAlreadyExists struct { + PbmFault + + Name string `xml:"name,omitempty"` +} + +func init() { + types.Add("pbm:PbmAlreadyExists", reflect.TypeOf((*PbmAlreadyExists)(nil)).Elem()) +} + +type PbmAssignDefaultRequirementProfile PbmAssignDefaultRequirementProfileRequestType + +func init() { + types.Add("pbm:PbmAssignDefaultRequirementProfile", reflect.TypeOf((*PbmAssignDefaultRequirementProfile)(nil)).Elem()) +} + +type PbmAssignDefaultRequirementProfileRequestType struct { + This types.ManagedObjectReference `xml:"_this"` + Profile PbmProfileId `xml:"profile"` + Datastores []PbmPlacementHub `xml:"datastores"` +} + +func init() { + types.Add("pbm:PbmAssignDefaultRequirementProfileRequestType", reflect.TypeOf((*PbmAssignDefaultRequirementProfileRequestType)(nil)).Elem()) +} + +type PbmAssignDefaultRequirementProfileResponse struct { +} + +type PbmCapabilityConstraintInstance struct { + types.DynamicData + + PropertyInstance []PbmCapabilityPropertyInstance `xml:"propertyInstance"` +} + +func init() { + types.Add("pbm:PbmCapabilityConstraintInstance", reflect.TypeOf((*PbmCapabilityConstraintInstance)(nil)).Elem()) +} + +type PbmCapabilityConstraints struct { + types.DynamicData +} + +func init() { + types.Add("pbm:PbmCapabilityConstraints", reflect.TypeOf((*PbmCapabilityConstraints)(nil)).Elem()) +} + +type PbmCapabilityDescription struct { + types.DynamicData + + Description PbmExtendedElementDescription `xml:"description"` + Value types.AnyType `xml:"value,typeattr"` +} + +func init() { + types.Add("pbm:PbmCapabilityDescription", reflect.TypeOf((*PbmCapabilityDescription)(nil)).Elem()) +} + +type PbmCapabilityDiscreteSet struct { + types.DynamicData + + Values []types.AnyType `xml:"values,typeattr"` +} + +func init() { + types.Add("pbm:PbmCapabilityDiscreteSet", reflect.TypeOf((*PbmCapabilityDiscreteSet)(nil)).Elem()) +} + +type PbmCapabilityGenericTypeInfo struct { + PbmCapabilityTypeInfo + + GenericTypeName string `xml:"genericTypeName"` +} + +func init() { + types.Add("pbm:PbmCapabilityGenericTypeInfo", reflect.TypeOf((*PbmCapabilityGenericTypeInfo)(nil)).Elem()) +} + +type PbmCapabilityInstance struct { + types.DynamicData + + Id PbmCapabilityMetadataUniqueId `xml:"id"` + Constraint []PbmCapabilityConstraintInstance `xml:"constraint"` +} + +func init() { + types.Add("pbm:PbmCapabilityInstance", reflect.TypeOf((*PbmCapabilityInstance)(nil)).Elem()) +} + +type PbmCapabilityMetadata struct { + types.DynamicData + + Id PbmCapabilityMetadataUniqueId `xml:"id"` + Summary PbmExtendedElementDescription `xml:"summary"` + Mandatory *bool `xml:"mandatory"` + Hint *bool `xml:"hint"` + KeyId string `xml:"keyId,omitempty"` + AllowMultipleConstraints *bool `xml:"allowMultipleConstraints"` + PropertyMetadata []PbmCapabilityPropertyMetadata `xml:"propertyMetadata"` +} + +func init() { + types.Add("pbm:PbmCapabilityMetadata", reflect.TypeOf((*PbmCapabilityMetadata)(nil)).Elem()) +} + +type PbmCapabilityMetadataPerCategory struct { + types.DynamicData + + SubCategory string `xml:"subCategory"` + CapabilityMetadata []PbmCapabilityMetadata `xml:"capabilityMetadata"` +} + +func init() { + types.Add("pbm:PbmCapabilityMetadataPerCategory", reflect.TypeOf((*PbmCapabilityMetadataPerCategory)(nil)).Elem()) +} + +type PbmCapabilityMetadataUniqueId struct { + types.DynamicData + + Namespace string `xml:"namespace"` + Id string `xml:"id"` +} + +func init() { + types.Add("pbm:PbmCapabilityMetadataUniqueId", reflect.TypeOf((*PbmCapabilityMetadataUniqueId)(nil)).Elem()) +} + +type PbmCapabilityNamespaceInfo struct { + types.DynamicData + + Version string `xml:"version"` + Namespace string `xml:"namespace"` + Info *PbmExtendedElementDescription `xml:"info,omitempty"` +} + +func init() { + types.Add("pbm:PbmCapabilityNamespaceInfo", reflect.TypeOf((*PbmCapabilityNamespaceInfo)(nil)).Elem()) +} + +type PbmCapabilityProfile struct { + PbmProfile + + ProfileCategory string `xml:"profileCategory"` + ResourceType PbmProfileResourceType `xml:"resourceType"` + Constraints BasePbmCapabilityConstraints `xml:"constraints,typeattr"` + GenerationId int64 `xml:"generationId,omitempty"` + IsDefault bool `xml:"isDefault"` + SystemCreatedProfileType string `xml:"systemCreatedProfileType,omitempty"` + LineOfService string `xml:"lineOfService,omitempty"` +} + +func init() { + types.Add("pbm:PbmCapabilityProfile", reflect.TypeOf((*PbmCapabilityProfile)(nil)).Elem()) +} + +type PbmCapabilityProfileCreateSpec struct { + types.DynamicData + + Name string `xml:"name"` + Description string `xml:"description,omitempty"` + Category string `xml:"category,omitempty"` + ResourceType PbmProfileResourceType `xml:"resourceType"` + Constraints BasePbmCapabilityConstraints `xml:"constraints,typeattr"` +} + +func init() { + types.Add("pbm:PbmCapabilityProfileCreateSpec", reflect.TypeOf((*PbmCapabilityProfileCreateSpec)(nil)).Elem()) +} + +type PbmCapabilityProfilePropertyMismatchFault struct { + PbmPropertyMismatchFault + + ResourcePropertyInstance PbmCapabilityPropertyInstance `xml:"resourcePropertyInstance"` +} + +func init() { + types.Add("pbm:PbmCapabilityProfilePropertyMismatchFault", reflect.TypeOf((*PbmCapabilityProfilePropertyMismatchFault)(nil)).Elem()) +} + +type PbmCapabilityProfilePropertyMismatchFaultFault BasePbmCapabilityProfilePropertyMismatchFault + +func init() { + types.Add("pbm:PbmCapabilityProfilePropertyMismatchFaultFault", reflect.TypeOf((*PbmCapabilityProfilePropertyMismatchFaultFault)(nil)).Elem()) +} + +type PbmCapabilityProfileUpdateSpec struct { + types.DynamicData + + Name string `xml:"name,omitempty"` + Description string `xml:"description,omitempty"` + Constraints BasePbmCapabilityConstraints `xml:"constraints,omitempty,typeattr"` +} + +func init() { + types.Add("pbm:PbmCapabilityProfileUpdateSpec", reflect.TypeOf((*PbmCapabilityProfileUpdateSpec)(nil)).Elem()) +} + +type PbmCapabilityPropertyInstance struct { + types.DynamicData + + Id string `xml:"id"` + Operator string `xml:"operator,omitempty"` + Value types.AnyType `xml:"value,typeattr"` +} + +func init() { + types.Add("pbm:PbmCapabilityPropertyInstance", reflect.TypeOf((*PbmCapabilityPropertyInstance)(nil)).Elem()) +} + +type PbmCapabilityPropertyMetadata struct { + types.DynamicData + + Id string `xml:"id"` + Summary PbmExtendedElementDescription `xml:"summary"` + Mandatory bool `xml:"mandatory"` + Type BasePbmCapabilityTypeInfo `xml:"type,omitempty,typeattr"` + DefaultValue types.AnyType `xml:"defaultValue,omitempty,typeattr"` + AllowedValue types.AnyType `xml:"allowedValue,omitempty,typeattr"` + RequirementsTypeHint string `xml:"requirementsTypeHint,omitempty"` +} + +func init() { + types.Add("pbm:PbmCapabilityPropertyMetadata", reflect.TypeOf((*PbmCapabilityPropertyMetadata)(nil)).Elem()) +} + +type PbmCapabilityRange struct { + types.DynamicData + + Min types.AnyType `xml:"min,typeattr"` + Max types.AnyType `xml:"max,typeattr"` +} + +func init() { + types.Add("pbm:PbmCapabilityRange", reflect.TypeOf((*PbmCapabilityRange)(nil)).Elem()) +} + +type PbmCapabilitySchema struct { + types.DynamicData + + VendorInfo PbmCapabilitySchemaVendorInfo `xml:"vendorInfo"` + NamespaceInfo PbmCapabilityNamespaceInfo `xml:"namespaceInfo"` + LineOfService BasePbmLineOfServiceInfo `xml:"lineOfService,omitempty,typeattr"` + CapabilityMetadataPerCategory []PbmCapabilityMetadataPerCategory `xml:"capabilityMetadataPerCategory"` +} + +func init() { + types.Add("pbm:PbmCapabilitySchema", reflect.TypeOf((*PbmCapabilitySchema)(nil)).Elem()) +} + +type PbmCapabilitySchemaVendorInfo struct { + types.DynamicData + + VendorUuid string `xml:"vendorUuid"` + Info PbmExtendedElementDescription `xml:"info"` +} + +func init() { + types.Add("pbm:PbmCapabilitySchemaVendorInfo", reflect.TypeOf((*PbmCapabilitySchemaVendorInfo)(nil)).Elem()) +} + +type PbmCapabilitySubProfile struct { + types.DynamicData + + Name string `xml:"name"` + Capability []PbmCapabilityInstance `xml:"capability"` + ForceProvision *bool `xml:"forceProvision"` +} + +func init() { + types.Add("pbm:PbmCapabilitySubProfile", reflect.TypeOf((*PbmCapabilitySubProfile)(nil)).Elem()) +} + +type PbmCapabilitySubProfileConstraints struct { + PbmCapabilityConstraints + + SubProfiles []PbmCapabilitySubProfile `xml:"subProfiles"` +} + +func init() { + types.Add("pbm:PbmCapabilitySubProfileConstraints", reflect.TypeOf((*PbmCapabilitySubProfileConstraints)(nil)).Elem()) +} + +type PbmCapabilityTimeSpan struct { + types.DynamicData + + Value int32 `xml:"value"` + Unit string `xml:"unit"` +} + +func init() { + types.Add("pbm:PbmCapabilityTimeSpan", reflect.TypeOf((*PbmCapabilityTimeSpan)(nil)).Elem()) +} + +type PbmCapabilityTypeInfo struct { + types.DynamicData + + TypeName string `xml:"typeName"` +} + +func init() { + types.Add("pbm:PbmCapabilityTypeInfo", reflect.TypeOf((*PbmCapabilityTypeInfo)(nil)).Elem()) +} + +type PbmCapabilityVendorNamespaceInfo struct { + types.DynamicData + + VendorInfo PbmCapabilitySchemaVendorInfo `xml:"vendorInfo"` + NamespaceInfo PbmCapabilityNamespaceInfo `xml:"namespaceInfo"` +} + +func init() { + types.Add("pbm:PbmCapabilityVendorNamespaceInfo", reflect.TypeOf((*PbmCapabilityVendorNamespaceInfo)(nil)).Elem()) +} + +type PbmCapabilityVendorResourceTypeInfo struct { + types.DynamicData + + ResourceType string `xml:"resourceType"` + VendorNamespaceInfo []PbmCapabilityVendorNamespaceInfo `xml:"vendorNamespaceInfo"` +} + +func init() { + types.Add("pbm:PbmCapabilityVendorResourceTypeInfo", reflect.TypeOf((*PbmCapabilityVendorResourceTypeInfo)(nil)).Elem()) +} + +type PbmCheckCompatibility PbmCheckCompatibilityRequestType + +func init() { + types.Add("pbm:PbmCheckCompatibility", reflect.TypeOf((*PbmCheckCompatibility)(nil)).Elem()) +} + +type PbmCheckCompatibilityRequestType struct { + This types.ManagedObjectReference `xml:"_this"` + HubsToSearch []PbmPlacementHub `xml:"hubsToSearch,omitempty"` + Profile PbmProfileId `xml:"profile"` +} + +func init() { + types.Add("pbm:PbmCheckCompatibilityRequestType", reflect.TypeOf((*PbmCheckCompatibilityRequestType)(nil)).Elem()) +} + +type PbmCheckCompatibilityResponse struct { + Returnval []PbmPlacementCompatibilityResult `xml:"returnval,omitempty"` +} + +type PbmCheckCompatibilityWithSpec PbmCheckCompatibilityWithSpecRequestType + +func init() { + types.Add("pbm:PbmCheckCompatibilityWithSpec", reflect.TypeOf((*PbmCheckCompatibilityWithSpec)(nil)).Elem()) +} + +type PbmCheckCompatibilityWithSpecRequestType struct { + This types.ManagedObjectReference `xml:"_this"` + HubsToSearch []PbmPlacementHub `xml:"hubsToSearch,omitempty"` + ProfileSpec PbmCapabilityProfileCreateSpec `xml:"profileSpec"` +} + +func init() { + types.Add("pbm:PbmCheckCompatibilityWithSpecRequestType", reflect.TypeOf((*PbmCheckCompatibilityWithSpecRequestType)(nil)).Elem()) +} + +type PbmCheckCompatibilityWithSpecResponse struct { + Returnval []PbmPlacementCompatibilityResult `xml:"returnval,omitempty"` +} + +type PbmCheckCompliance PbmCheckComplianceRequestType + +func init() { + types.Add("pbm:PbmCheckCompliance", reflect.TypeOf((*PbmCheckCompliance)(nil)).Elem()) +} + +type PbmCheckComplianceRequestType struct { + This types.ManagedObjectReference `xml:"_this"` + Entities []PbmServerObjectRef `xml:"entities"` + Profile *PbmProfileId `xml:"profile,omitempty"` +} + +func init() { + types.Add("pbm:PbmCheckComplianceRequestType", reflect.TypeOf((*PbmCheckComplianceRequestType)(nil)).Elem()) +} + +type PbmCheckComplianceResponse struct { + Returnval []PbmComplianceResult `xml:"returnval,omitempty"` +} + +type PbmCheckRequirements PbmCheckRequirementsRequestType + +func init() { + types.Add("pbm:PbmCheckRequirements", reflect.TypeOf((*PbmCheckRequirements)(nil)).Elem()) +} + +type PbmCheckRequirementsRequestType struct { + This types.ManagedObjectReference `xml:"_this"` + HubsToSearch []PbmPlacementHub `xml:"hubsToSearch,omitempty"` + PlacementSubjectRef *PbmServerObjectRef `xml:"placementSubjectRef,omitempty"` + PlacementSubjectRequirement []BasePbmPlacementRequirement `xml:"placementSubjectRequirement,omitempty,typeattr"` +} + +func init() { + types.Add("pbm:PbmCheckRequirementsRequestType", reflect.TypeOf((*PbmCheckRequirementsRequestType)(nil)).Elem()) +} + +type PbmCheckRequirementsResponse struct { + Returnval []PbmPlacementCompatibilityResult `xml:"returnval,omitempty"` +} + +type PbmCheckRollupCompliance PbmCheckRollupComplianceRequestType + +func init() { + types.Add("pbm:PbmCheckRollupCompliance", reflect.TypeOf((*PbmCheckRollupCompliance)(nil)).Elem()) +} + +type PbmCheckRollupComplianceRequestType struct { + This types.ManagedObjectReference `xml:"_this"` + Entity []PbmServerObjectRef `xml:"entity"` +} + +func init() { + types.Add("pbm:PbmCheckRollupComplianceRequestType", reflect.TypeOf((*PbmCheckRollupComplianceRequestType)(nil)).Elem()) +} + +type PbmCheckRollupComplianceResponse struct { + Returnval []PbmRollupComplianceResult `xml:"returnval,omitempty"` +} + +type PbmCompatibilityCheckFault struct { + PbmFault + + Hub PbmPlacementHub `xml:"hub"` +} + +func init() { + types.Add("pbm:PbmCompatibilityCheckFault", reflect.TypeOf((*PbmCompatibilityCheckFault)(nil)).Elem()) +} + +type PbmCompatibilityCheckFaultFault BasePbmCompatibilityCheckFault + +func init() { + types.Add("pbm:PbmCompatibilityCheckFaultFault", reflect.TypeOf((*PbmCompatibilityCheckFaultFault)(nil)).Elem()) +} + +type PbmComplianceOperationalStatus struct { + types.DynamicData + + Healthy *bool `xml:"healthy"` + OperationETA *time.Time `xml:"operationETA"` + OperationProgress int64 `xml:"operationProgress,omitempty"` + Transitional *bool `xml:"transitional"` +} + +func init() { + types.Add("pbm:PbmComplianceOperationalStatus", reflect.TypeOf((*PbmComplianceOperationalStatus)(nil)).Elem()) +} + +type PbmCompliancePolicyStatus struct { + types.DynamicData + + ExpectedValue PbmCapabilityInstance `xml:"expectedValue"` + CurrentValue *PbmCapabilityInstance `xml:"currentValue,omitempty"` +} + +func init() { + types.Add("pbm:PbmCompliancePolicyStatus", reflect.TypeOf((*PbmCompliancePolicyStatus)(nil)).Elem()) +} + +type PbmComplianceResult struct { + types.DynamicData + + CheckTime time.Time `xml:"checkTime"` + Entity PbmServerObjectRef `xml:"entity"` + Profile *PbmProfileId `xml:"profile,omitempty"` + ComplianceTaskStatus string `xml:"complianceTaskStatus,omitempty"` + ComplianceStatus string `xml:"complianceStatus"` + Mismatch bool `xml:"mismatch"` + ViolatedPolicies []PbmCompliancePolicyStatus `xml:"violatedPolicies,omitempty"` + ErrorCause []types.LocalizedMethodFault `xml:"errorCause,omitempty"` + OperationalStatus *PbmComplianceOperationalStatus `xml:"operationalStatus,omitempty"` + Info *PbmExtendedElementDescription `xml:"info,omitempty"` +} + +func init() { + types.Add("pbm:PbmComplianceResult", reflect.TypeOf((*PbmComplianceResult)(nil)).Elem()) +} + +type PbmCreate PbmCreateRequestType + +func init() { + types.Add("pbm:PbmCreate", reflect.TypeOf((*PbmCreate)(nil)).Elem()) +} + +type PbmCreateRequestType struct { + This types.ManagedObjectReference `xml:"_this"` + CreateSpec PbmCapabilityProfileCreateSpec `xml:"createSpec"` +} + +func init() { + types.Add("pbm:PbmCreateRequestType", reflect.TypeOf((*PbmCreateRequestType)(nil)).Elem()) +} + +type PbmCreateResponse struct { + Returnval PbmProfileId `xml:"returnval"` +} + +type PbmDataServiceToPoliciesMap struct { + types.DynamicData + + DataServicePolicy PbmProfileId `xml:"dataServicePolicy"` + ParentStoragePolicies []PbmProfileId `xml:"parentStoragePolicies,omitempty"` + Fault *types.LocalizedMethodFault `xml:"fault,omitempty"` +} + +func init() { + types.Add("pbm:PbmDataServiceToPoliciesMap", reflect.TypeOf((*PbmDataServiceToPoliciesMap)(nil)).Elem()) +} + +type PbmDatastoreSpaceStatistics struct { + types.DynamicData + + ProfileId string `xml:"profileId,omitempty"` + PhysicalTotalInMB int64 `xml:"physicalTotalInMB"` + PhysicalFreeInMB int64 `xml:"physicalFreeInMB"` + PhysicalUsedInMB int64 `xml:"physicalUsedInMB"` + LogicalLimitInMB int64 `xml:"logicalLimitInMB,omitempty"` + LogicalFreeInMB int64 `xml:"logicalFreeInMB"` + LogicalUsedInMB int64 `xml:"logicalUsedInMB"` +} + +func init() { + types.Add("pbm:PbmDatastoreSpaceStatistics", reflect.TypeOf((*PbmDatastoreSpaceStatistics)(nil)).Elem()) +} + +type PbmDefaultCapabilityProfile struct { + PbmCapabilityProfile + + VvolType []string `xml:"vvolType"` + ContainerId string `xml:"containerId"` +} + +func init() { + types.Add("pbm:PbmDefaultCapabilityProfile", reflect.TypeOf((*PbmDefaultCapabilityProfile)(nil)).Elem()) +} + +type PbmDefaultProfileAppliesFault struct { + PbmCompatibilityCheckFault +} + +func init() { + types.Add("pbm:PbmDefaultProfileAppliesFault", reflect.TypeOf((*PbmDefaultProfileAppliesFault)(nil)).Elem()) +} + +type PbmDefaultProfileAppliesFaultFault PbmDefaultProfileAppliesFault + +func init() { + types.Add("pbm:PbmDefaultProfileAppliesFaultFault", reflect.TypeOf((*PbmDefaultProfileAppliesFaultFault)(nil)).Elem()) +} + +type PbmDefaultProfileInfo struct { + types.DynamicData + + Datastores []PbmPlacementHub `xml:"datastores"` + DefaultProfile BasePbmProfile `xml:"defaultProfile,omitempty,typeattr"` +} + +func init() { + types.Add("pbm:PbmDefaultProfileInfo", reflect.TypeOf((*PbmDefaultProfileInfo)(nil)).Elem()) +} + +type PbmDelete PbmDeleteRequestType + +func init() { + types.Add("pbm:PbmDelete", reflect.TypeOf((*PbmDelete)(nil)).Elem()) +} + +type PbmDeleteRequestType struct { + This types.ManagedObjectReference `xml:"_this"` + ProfileId []PbmProfileId `xml:"profileId"` +} + +func init() { + types.Add("pbm:PbmDeleteRequestType", reflect.TypeOf((*PbmDeleteRequestType)(nil)).Elem()) +} + +type PbmDeleteResponse struct { + Returnval []PbmProfileOperationOutcome `xml:"returnval,omitempty"` +} + +type PbmDuplicateName struct { + PbmFault + + Name string `xml:"name"` +} + +func init() { + types.Add("pbm:PbmDuplicateName", reflect.TypeOf((*PbmDuplicateName)(nil)).Elem()) +} + +type PbmDuplicateNameFault PbmDuplicateName + +func init() { + types.Add("pbm:PbmDuplicateNameFault", reflect.TypeOf((*PbmDuplicateNameFault)(nil)).Elem()) +} + +type PbmExtendedElementDescription struct { + types.DynamicData + + Label string `xml:"label"` + Summary string `xml:"summary"` + Key string `xml:"key"` + MessageCatalogKeyPrefix string `xml:"messageCatalogKeyPrefix"` + MessageArg []types.KeyAnyValue `xml:"messageArg,omitempty"` +} + +func init() { + types.Add("pbm:PbmExtendedElementDescription", reflect.TypeOf((*PbmExtendedElementDescription)(nil)).Elem()) +} + +type PbmFault struct { + types.MethodFault +} + +func init() { + types.Add("pbm:PbmFault", reflect.TypeOf((*PbmFault)(nil)).Elem()) +} + +type PbmFaultFault BasePbmFault + +func init() { + types.Add("pbm:PbmFaultFault", reflect.TypeOf((*PbmFaultFault)(nil)).Elem()) +} + +type PbmFaultInvalidLogin struct { + PbmFault +} + +func init() { + types.Add("pbm:PbmFaultInvalidLogin", reflect.TypeOf((*PbmFaultInvalidLogin)(nil)).Elem()) +} + +type PbmFaultInvalidLoginFault PbmFaultInvalidLogin + +func init() { + types.Add("pbm:PbmFaultInvalidLoginFault", reflect.TypeOf((*PbmFaultInvalidLoginFault)(nil)).Elem()) +} + +type PbmFaultNotFound struct { + PbmFault +} + +func init() { + types.Add("pbm:PbmFaultNotFound", reflect.TypeOf((*PbmFaultNotFound)(nil)).Elem()) +} + +type PbmFaultNotFoundFault PbmFaultNotFound + +func init() { + types.Add("pbm:PbmFaultNotFoundFault", reflect.TypeOf((*PbmFaultNotFoundFault)(nil)).Elem()) +} + +type PbmFaultProfileStorageFault struct { + PbmFault +} + +func init() { + types.Add("pbm:PbmFaultProfileStorageFault", reflect.TypeOf((*PbmFaultProfileStorageFault)(nil)).Elem()) +} + +type PbmFaultProfileStorageFaultFault PbmFaultProfileStorageFault + +func init() { + types.Add("pbm:PbmFaultProfileStorageFaultFault", reflect.TypeOf((*PbmFaultProfileStorageFaultFault)(nil)).Elem()) +} + +type PbmFetchCapabilityMetadata PbmFetchCapabilityMetadataRequestType + +func init() { + types.Add("pbm:PbmFetchCapabilityMetadata", reflect.TypeOf((*PbmFetchCapabilityMetadata)(nil)).Elem()) +} + +type PbmFetchCapabilityMetadataRequestType struct { + This types.ManagedObjectReference `xml:"_this"` + ResourceType *PbmProfileResourceType `xml:"resourceType,omitempty"` + VendorUuid string `xml:"vendorUuid,omitempty"` +} + +func init() { + types.Add("pbm:PbmFetchCapabilityMetadataRequestType", reflect.TypeOf((*PbmFetchCapabilityMetadataRequestType)(nil)).Elem()) +} + +type PbmFetchCapabilityMetadataResponse struct { + Returnval []PbmCapabilityMetadataPerCategory `xml:"returnval,omitempty"` +} + +type PbmFetchCapabilitySchema PbmFetchCapabilitySchemaRequestType + +func init() { + types.Add("pbm:PbmFetchCapabilitySchema", reflect.TypeOf((*PbmFetchCapabilitySchema)(nil)).Elem()) +} + +type PbmFetchCapabilitySchemaRequestType struct { + This types.ManagedObjectReference `xml:"_this"` + VendorUuid string `xml:"vendorUuid,omitempty"` + LineOfService []string `xml:"lineOfService,omitempty"` +} + +func init() { + types.Add("pbm:PbmFetchCapabilitySchemaRequestType", reflect.TypeOf((*PbmFetchCapabilitySchemaRequestType)(nil)).Elem()) +} + +type PbmFetchCapabilitySchemaResponse struct { + Returnval []PbmCapabilitySchema `xml:"returnval,omitempty"` +} + +type PbmFetchComplianceResult PbmFetchComplianceResultRequestType + +func init() { + types.Add("pbm:PbmFetchComplianceResult", reflect.TypeOf((*PbmFetchComplianceResult)(nil)).Elem()) +} + +type PbmFetchComplianceResultRequestType struct { + This types.ManagedObjectReference `xml:"_this"` + Entities []PbmServerObjectRef `xml:"entities"` + Profile *PbmProfileId `xml:"profile,omitempty"` +} + +func init() { + types.Add("pbm:PbmFetchComplianceResultRequestType", reflect.TypeOf((*PbmFetchComplianceResultRequestType)(nil)).Elem()) +} + +type PbmFetchComplianceResultResponse struct { + Returnval []PbmComplianceResult `xml:"returnval,omitempty"` +} + +type PbmFetchResourceType PbmFetchResourceTypeRequestType + +func init() { + types.Add("pbm:PbmFetchResourceType", reflect.TypeOf((*PbmFetchResourceType)(nil)).Elem()) +} + +type PbmFetchResourceTypeRequestType struct { + This types.ManagedObjectReference `xml:"_this"` +} + +func init() { + types.Add("pbm:PbmFetchResourceTypeRequestType", reflect.TypeOf((*PbmFetchResourceTypeRequestType)(nil)).Elem()) +} + +type PbmFetchResourceTypeResponse struct { + Returnval []PbmProfileResourceType `xml:"returnval,omitempty"` +} + +type PbmFetchRollupComplianceResult PbmFetchRollupComplianceResultRequestType + +func init() { + types.Add("pbm:PbmFetchRollupComplianceResult", reflect.TypeOf((*PbmFetchRollupComplianceResult)(nil)).Elem()) +} + +type PbmFetchRollupComplianceResultRequestType struct { + This types.ManagedObjectReference `xml:"_this"` + Entity []PbmServerObjectRef `xml:"entity"` +} + +func init() { + types.Add("pbm:PbmFetchRollupComplianceResultRequestType", reflect.TypeOf((*PbmFetchRollupComplianceResultRequestType)(nil)).Elem()) +} + +type PbmFetchRollupComplianceResultResponse struct { + Returnval []PbmRollupComplianceResult `xml:"returnval,omitempty"` +} + +type PbmFetchVendorInfo PbmFetchVendorInfoRequestType + +func init() { + types.Add("pbm:PbmFetchVendorInfo", reflect.TypeOf((*PbmFetchVendorInfo)(nil)).Elem()) +} + +type PbmFetchVendorInfoRequestType struct { + This types.ManagedObjectReference `xml:"_this"` + ResourceType *PbmProfileResourceType `xml:"resourceType,omitempty"` +} + +func init() { + types.Add("pbm:PbmFetchVendorInfoRequestType", reflect.TypeOf((*PbmFetchVendorInfoRequestType)(nil)).Elem()) +} + +type PbmFetchVendorInfoResponse struct { + Returnval []PbmCapabilityVendorResourceTypeInfo `xml:"returnval,omitempty"` +} + +type PbmFindApplicableDefaultProfile PbmFindApplicableDefaultProfileRequestType + +func init() { + types.Add("pbm:PbmFindApplicableDefaultProfile", reflect.TypeOf((*PbmFindApplicableDefaultProfile)(nil)).Elem()) +} + +type PbmFindApplicableDefaultProfileRequestType struct { + This types.ManagedObjectReference `xml:"_this"` + Datastores []PbmPlacementHub `xml:"datastores"` +} + +func init() { + types.Add("pbm:PbmFindApplicableDefaultProfileRequestType", reflect.TypeOf((*PbmFindApplicableDefaultProfileRequestType)(nil)).Elem()) +} + +type PbmFindApplicableDefaultProfileResponse struct { + Returnval []BasePbmProfile `xml:"returnval,omitempty,typeattr"` +} + +type PbmIncompatibleVendorSpecificRuleSet struct { + PbmCapabilityProfilePropertyMismatchFault +} + +func init() { + types.Add("pbm:PbmIncompatibleVendorSpecificRuleSet", reflect.TypeOf((*PbmIncompatibleVendorSpecificRuleSet)(nil)).Elem()) +} + +type PbmIncompatibleVendorSpecificRuleSetFault PbmIncompatibleVendorSpecificRuleSet + +func init() { + types.Add("pbm:PbmIncompatibleVendorSpecificRuleSetFault", reflect.TypeOf((*PbmIncompatibleVendorSpecificRuleSetFault)(nil)).Elem()) +} + +type PbmLegacyHubsNotSupported struct { + PbmFault + + Hubs []PbmPlacementHub `xml:"hubs"` +} + +func init() { + types.Add("pbm:PbmLegacyHubsNotSupported", reflect.TypeOf((*PbmLegacyHubsNotSupported)(nil)).Elem()) +} + +type PbmLegacyHubsNotSupportedFault PbmLegacyHubsNotSupported + +func init() { + types.Add("pbm:PbmLegacyHubsNotSupportedFault", reflect.TypeOf((*PbmLegacyHubsNotSupportedFault)(nil)).Elem()) +} + +type PbmLineOfServiceInfo struct { + types.DynamicData + + LineOfService string `xml:"lineOfService"` + Name PbmExtendedElementDescription `xml:"name"` + Description *PbmExtendedElementDescription `xml:"description,omitempty"` +} + +func init() { + types.Add("pbm:PbmLineOfServiceInfo", reflect.TypeOf((*PbmLineOfServiceInfo)(nil)).Elem()) +} + +type PbmNonExistentHubs struct { + PbmFault + + Hubs []PbmPlacementHub `xml:"hubs"` +} + +func init() { + types.Add("pbm:PbmNonExistentHubs", reflect.TypeOf((*PbmNonExistentHubs)(nil)).Elem()) +} + +type PbmNonExistentHubsFault PbmNonExistentHubs + +func init() { + types.Add("pbm:PbmNonExistentHubsFault", reflect.TypeOf((*PbmNonExistentHubsFault)(nil)).Elem()) +} + +type PbmPersistenceBasedDataServiceInfo struct { + PbmLineOfServiceInfo + + CompatiblePersistenceSchemaNamespace []string `xml:"compatiblePersistenceSchemaNamespace,omitempty"` +} + +func init() { + types.Add("pbm:PbmPersistenceBasedDataServiceInfo", reflect.TypeOf((*PbmPersistenceBasedDataServiceInfo)(nil)).Elem()) +} + +type PbmPlacementCapabilityConstraintsRequirement struct { + PbmPlacementRequirement + + Constraints BasePbmCapabilityConstraints `xml:"constraints,typeattr"` +} + +func init() { + types.Add("pbm:PbmPlacementCapabilityConstraintsRequirement", reflect.TypeOf((*PbmPlacementCapabilityConstraintsRequirement)(nil)).Elem()) +} + +type PbmPlacementCapabilityProfileRequirement struct { + PbmPlacementRequirement + + ProfileId PbmProfileId `xml:"profileId"` +} + +func init() { + types.Add("pbm:PbmPlacementCapabilityProfileRequirement", reflect.TypeOf((*PbmPlacementCapabilityProfileRequirement)(nil)).Elem()) +} + +type PbmPlacementCompatibilityResult struct { + types.DynamicData + + Hub PbmPlacementHub `xml:"hub"` + MatchingResources []BasePbmPlacementMatchingResources `xml:"matchingResources,omitempty,typeattr"` + HowMany int64 `xml:"howMany,omitempty"` + Utilization []PbmPlacementResourceUtilization `xml:"utilization,omitempty"` + Warning []types.LocalizedMethodFault `xml:"warning,omitempty"` + Error []types.LocalizedMethodFault `xml:"error,omitempty"` +} + +func init() { + types.Add("pbm:PbmPlacementCompatibilityResult", reflect.TypeOf((*PbmPlacementCompatibilityResult)(nil)).Elem()) +} + +type PbmPlacementHub struct { + types.DynamicData + + HubType string `xml:"hubType"` + HubId string `xml:"hubId"` +} + +func init() { + types.Add("pbm:PbmPlacementHub", reflect.TypeOf((*PbmPlacementHub)(nil)).Elem()) +} + +type PbmPlacementMatchingReplicationResources struct { + PbmPlacementMatchingResources + + ReplicationGroup []types.ReplicationGroupId `xml:"replicationGroup,omitempty"` +} + +func init() { + types.Add("pbm:PbmPlacementMatchingReplicationResources", reflect.TypeOf((*PbmPlacementMatchingReplicationResources)(nil)).Elem()) +} + +type PbmPlacementMatchingResources struct { + types.DynamicData +} + +func init() { + types.Add("pbm:PbmPlacementMatchingResources", reflect.TypeOf((*PbmPlacementMatchingResources)(nil)).Elem()) +} + +type PbmPlacementRequirement struct { + types.DynamicData +} + +func init() { + types.Add("pbm:PbmPlacementRequirement", reflect.TypeOf((*PbmPlacementRequirement)(nil)).Elem()) +} + +type PbmPlacementResourceUtilization struct { + types.DynamicData + + Name PbmExtendedElementDescription `xml:"name"` + Description PbmExtendedElementDescription `xml:"description"` + AvailableBefore int64 `xml:"availableBefore,omitempty"` + AvailableAfter int64 `xml:"availableAfter,omitempty"` + Total int64 `xml:"total,omitempty"` +} + +func init() { + types.Add("pbm:PbmPlacementResourceUtilization", reflect.TypeOf((*PbmPlacementResourceUtilization)(nil)).Elem()) +} + +type PbmProfile struct { + types.DynamicData + + ProfileId PbmProfileId `xml:"profileId"` + Name string `xml:"name"` + Description string `xml:"description,omitempty"` + CreationTime time.Time `xml:"creationTime"` + CreatedBy string `xml:"createdBy"` + LastUpdatedTime time.Time `xml:"lastUpdatedTime"` + LastUpdatedBy string `xml:"lastUpdatedBy"` +} + +func init() { + types.Add("pbm:PbmProfile", reflect.TypeOf((*PbmProfile)(nil)).Elem()) +} + +type PbmProfileId struct { + types.DynamicData + + UniqueId string `xml:"uniqueId"` +} + +func init() { + types.Add("pbm:PbmProfileId", reflect.TypeOf((*PbmProfileId)(nil)).Elem()) +} + +type PbmProfileOperationOutcome struct { + types.DynamicData + + ProfileId PbmProfileId `xml:"profileId"` + Fault *types.LocalizedMethodFault `xml:"fault,omitempty"` +} + +func init() { + types.Add("pbm:PbmProfileOperationOutcome", reflect.TypeOf((*PbmProfileOperationOutcome)(nil)).Elem()) +} + +type PbmProfileResourceType struct { + types.DynamicData + + ResourceType string `xml:"resourceType"` +} + +func init() { + types.Add("pbm:PbmProfileResourceType", reflect.TypeOf((*PbmProfileResourceType)(nil)).Elem()) +} + +type PbmProfileType struct { + types.DynamicData + + UniqueId string `xml:"uniqueId"` +} + +func init() { + types.Add("pbm:PbmProfileType", reflect.TypeOf((*PbmProfileType)(nil)).Elem()) +} + +type PbmPropertyMismatchFault struct { + PbmCompatibilityCheckFault + + CapabilityInstanceId PbmCapabilityMetadataUniqueId `xml:"capabilityInstanceId"` + RequirementPropertyInstance PbmCapabilityPropertyInstance `xml:"requirementPropertyInstance"` +} + +func init() { + types.Add("pbm:PbmPropertyMismatchFault", reflect.TypeOf((*PbmPropertyMismatchFault)(nil)).Elem()) +} + +type PbmPropertyMismatchFaultFault BasePbmPropertyMismatchFault + +func init() { + types.Add("pbm:PbmPropertyMismatchFaultFault", reflect.TypeOf((*PbmPropertyMismatchFaultFault)(nil)).Elem()) +} + +type PbmQueryAssociatedEntities PbmQueryAssociatedEntitiesRequestType + +func init() { + types.Add("pbm:PbmQueryAssociatedEntities", reflect.TypeOf((*PbmQueryAssociatedEntities)(nil)).Elem()) +} + +type PbmQueryAssociatedEntitiesRequestType struct { + This types.ManagedObjectReference `xml:"_this"` + Profiles []PbmProfileId `xml:"profiles,omitempty"` +} + +func init() { + types.Add("pbm:PbmQueryAssociatedEntitiesRequestType", reflect.TypeOf((*PbmQueryAssociatedEntitiesRequestType)(nil)).Elem()) +} + +type PbmQueryAssociatedEntitiesResponse struct { + Returnval []PbmQueryProfileResult `xml:"returnval,omitempty"` +} + +type PbmQueryAssociatedEntity PbmQueryAssociatedEntityRequestType + +func init() { + types.Add("pbm:PbmQueryAssociatedEntity", reflect.TypeOf((*PbmQueryAssociatedEntity)(nil)).Elem()) +} + +type PbmQueryAssociatedEntityRequestType struct { + This types.ManagedObjectReference `xml:"_this"` + Profile PbmProfileId `xml:"profile"` + EntityType string `xml:"entityType,omitempty"` +} + +func init() { + types.Add("pbm:PbmQueryAssociatedEntityRequestType", reflect.TypeOf((*PbmQueryAssociatedEntityRequestType)(nil)).Elem()) +} + +type PbmQueryAssociatedEntityResponse struct { + Returnval []PbmServerObjectRef `xml:"returnval,omitempty"` +} + +type PbmQueryAssociatedProfile PbmQueryAssociatedProfileRequestType + +func init() { + types.Add("pbm:PbmQueryAssociatedProfile", reflect.TypeOf((*PbmQueryAssociatedProfile)(nil)).Elem()) +} + +type PbmQueryAssociatedProfileRequestType struct { + This types.ManagedObjectReference `xml:"_this"` + Entity PbmServerObjectRef `xml:"entity"` +} + +func init() { + types.Add("pbm:PbmQueryAssociatedProfileRequestType", reflect.TypeOf((*PbmQueryAssociatedProfileRequestType)(nil)).Elem()) +} + +type PbmQueryAssociatedProfileResponse struct { + Returnval []PbmProfileId `xml:"returnval,omitempty"` +} + +type PbmQueryAssociatedProfiles PbmQueryAssociatedProfilesRequestType + +func init() { + types.Add("pbm:PbmQueryAssociatedProfiles", reflect.TypeOf((*PbmQueryAssociatedProfiles)(nil)).Elem()) +} + +type PbmQueryAssociatedProfilesRequestType struct { + This types.ManagedObjectReference `xml:"_this"` + Entities []PbmServerObjectRef `xml:"entities"` +} + +func init() { + types.Add("pbm:PbmQueryAssociatedProfilesRequestType", reflect.TypeOf((*PbmQueryAssociatedProfilesRequestType)(nil)).Elem()) +} + +type PbmQueryAssociatedProfilesResponse struct { + Returnval []PbmQueryProfileResult `xml:"returnval,omitempty"` +} + +type PbmQueryByRollupComplianceStatus PbmQueryByRollupComplianceStatusRequestType + +func init() { + types.Add("pbm:PbmQueryByRollupComplianceStatus", reflect.TypeOf((*PbmQueryByRollupComplianceStatus)(nil)).Elem()) +} + +type PbmQueryByRollupComplianceStatusRequestType struct { + This types.ManagedObjectReference `xml:"_this"` + Status string `xml:"status"` +} + +func init() { + types.Add("pbm:PbmQueryByRollupComplianceStatusRequestType", reflect.TypeOf((*PbmQueryByRollupComplianceStatusRequestType)(nil)).Elem()) +} + +type PbmQueryByRollupComplianceStatusResponse struct { + Returnval []PbmServerObjectRef `xml:"returnval,omitempty"` +} + +type PbmQueryDefaultRequirementProfile PbmQueryDefaultRequirementProfileRequestType + +func init() { + types.Add("pbm:PbmQueryDefaultRequirementProfile", reflect.TypeOf((*PbmQueryDefaultRequirementProfile)(nil)).Elem()) +} + +type PbmQueryDefaultRequirementProfileRequestType struct { + This types.ManagedObjectReference `xml:"_this"` + Hub PbmPlacementHub `xml:"hub"` +} + +func init() { + types.Add("pbm:PbmQueryDefaultRequirementProfileRequestType", reflect.TypeOf((*PbmQueryDefaultRequirementProfileRequestType)(nil)).Elem()) +} + +type PbmQueryDefaultRequirementProfileResponse struct { + Returnval *PbmProfileId `xml:"returnval,omitempty"` +} + +type PbmQueryDefaultRequirementProfiles PbmQueryDefaultRequirementProfilesRequestType + +func init() { + types.Add("pbm:PbmQueryDefaultRequirementProfiles", reflect.TypeOf((*PbmQueryDefaultRequirementProfiles)(nil)).Elem()) +} + +type PbmQueryDefaultRequirementProfilesRequestType struct { + This types.ManagedObjectReference `xml:"_this"` + Datastores []PbmPlacementHub `xml:"datastores"` +} + +func init() { + types.Add("pbm:PbmQueryDefaultRequirementProfilesRequestType", reflect.TypeOf((*PbmQueryDefaultRequirementProfilesRequestType)(nil)).Elem()) +} + +type PbmQueryDefaultRequirementProfilesResponse struct { + Returnval []PbmDefaultProfileInfo `xml:"returnval"` +} + +type PbmQueryMatchingHub PbmQueryMatchingHubRequestType + +func init() { + types.Add("pbm:PbmQueryMatchingHub", reflect.TypeOf((*PbmQueryMatchingHub)(nil)).Elem()) +} + +type PbmQueryMatchingHubRequestType struct { + This types.ManagedObjectReference `xml:"_this"` + HubsToSearch []PbmPlacementHub `xml:"hubsToSearch,omitempty"` + Profile PbmProfileId `xml:"profile"` +} + +func init() { + types.Add("pbm:PbmQueryMatchingHubRequestType", reflect.TypeOf((*PbmQueryMatchingHubRequestType)(nil)).Elem()) +} + +type PbmQueryMatchingHubResponse struct { + Returnval []PbmPlacementHub `xml:"returnval,omitempty"` +} + +type PbmQueryMatchingHubWithSpec PbmQueryMatchingHubWithSpecRequestType + +func init() { + types.Add("pbm:PbmQueryMatchingHubWithSpec", reflect.TypeOf((*PbmQueryMatchingHubWithSpec)(nil)).Elem()) +} + +type PbmQueryMatchingHubWithSpecRequestType struct { + This types.ManagedObjectReference `xml:"_this"` + HubsToSearch []PbmPlacementHub `xml:"hubsToSearch,omitempty"` + CreateSpec PbmCapabilityProfileCreateSpec `xml:"createSpec"` +} + +func init() { + types.Add("pbm:PbmQueryMatchingHubWithSpecRequestType", reflect.TypeOf((*PbmQueryMatchingHubWithSpecRequestType)(nil)).Elem()) +} + +type PbmQueryMatchingHubWithSpecResponse struct { + Returnval []PbmPlacementHub `xml:"returnval,omitempty"` +} + +type PbmQueryProfile PbmQueryProfileRequestType + +func init() { + types.Add("pbm:PbmQueryProfile", reflect.TypeOf((*PbmQueryProfile)(nil)).Elem()) +} + +type PbmQueryProfileRequestType struct { + This types.ManagedObjectReference `xml:"_this"` + ResourceType PbmProfileResourceType `xml:"resourceType"` + ProfileCategory string `xml:"profileCategory,omitempty"` +} + +func init() { + types.Add("pbm:PbmQueryProfileRequestType", reflect.TypeOf((*PbmQueryProfileRequestType)(nil)).Elem()) +} + +type PbmQueryProfileResponse struct { + Returnval []PbmProfileId `xml:"returnval,omitempty"` +} + +type PbmQueryProfileResult struct { + types.DynamicData + + Object PbmServerObjectRef `xml:"object"` + ProfileId []PbmProfileId `xml:"profileId,omitempty"` + Fault *types.LocalizedMethodFault `xml:"fault,omitempty"` +} + +func init() { + types.Add("pbm:PbmQueryProfileResult", reflect.TypeOf((*PbmQueryProfileResult)(nil)).Elem()) +} + +type PbmQueryReplicationGroupResult struct { + types.DynamicData + + Object PbmServerObjectRef `xml:"object"` + ReplicationGroupId *types.ReplicationGroupId `xml:"replicationGroupId,omitempty"` + Fault *types.LocalizedMethodFault `xml:"fault,omitempty"` +} + +func init() { + types.Add("pbm:PbmQueryReplicationGroupResult", reflect.TypeOf((*PbmQueryReplicationGroupResult)(nil)).Elem()) +} + +type PbmQueryReplicationGroups PbmQueryReplicationGroupsRequestType + +func init() { + types.Add("pbm:PbmQueryReplicationGroups", reflect.TypeOf((*PbmQueryReplicationGroups)(nil)).Elem()) +} + +type PbmQueryReplicationGroupsRequestType struct { + This types.ManagedObjectReference `xml:"_this"` + Entities []PbmServerObjectRef `xml:"entities,omitempty"` +} + +func init() { + types.Add("pbm:PbmQueryReplicationGroupsRequestType", reflect.TypeOf((*PbmQueryReplicationGroupsRequestType)(nil)).Elem()) +} + +type PbmQueryReplicationGroupsResponse struct { + Returnval []PbmQueryReplicationGroupResult `xml:"returnval,omitempty"` +} + +type PbmQuerySpaceStatsForStorageContainer PbmQuerySpaceStatsForStorageContainerRequestType + +func init() { + types.Add("pbm:PbmQuerySpaceStatsForStorageContainer", reflect.TypeOf((*PbmQuerySpaceStatsForStorageContainer)(nil)).Elem()) +} + +type PbmQuerySpaceStatsForStorageContainerRequestType struct { + This types.ManagedObjectReference `xml:"_this"` + Datastore PbmServerObjectRef `xml:"datastore"` + CapabilityProfileId []PbmProfileId `xml:"capabilityProfileId,omitempty"` +} + +func init() { + types.Add("pbm:PbmQuerySpaceStatsForStorageContainerRequestType", reflect.TypeOf((*PbmQuerySpaceStatsForStorageContainerRequestType)(nil)).Elem()) +} + +type PbmQuerySpaceStatsForStorageContainerResponse struct { + Returnval []PbmDatastoreSpaceStatistics `xml:"returnval,omitempty"` +} + +type PbmResetDefaultRequirementProfile PbmResetDefaultRequirementProfileRequestType + +func init() { + types.Add("pbm:PbmResetDefaultRequirementProfile", reflect.TypeOf((*PbmResetDefaultRequirementProfile)(nil)).Elem()) +} + +type PbmResetDefaultRequirementProfileRequestType struct { + This types.ManagedObjectReference `xml:"_this"` + Profile *PbmProfileId `xml:"profile,omitempty"` +} + +func init() { + types.Add("pbm:PbmResetDefaultRequirementProfileRequestType", reflect.TypeOf((*PbmResetDefaultRequirementProfileRequestType)(nil)).Elem()) +} + +type PbmResetDefaultRequirementProfileResponse struct { +} + +type PbmResetVSanDefaultProfile PbmResetVSanDefaultProfileRequestType + +func init() { + types.Add("pbm:PbmResetVSanDefaultProfile", reflect.TypeOf((*PbmResetVSanDefaultProfile)(nil)).Elem()) +} + +type PbmResetVSanDefaultProfileRequestType struct { + This types.ManagedObjectReference `xml:"_this"` +} + +func init() { + types.Add("pbm:PbmResetVSanDefaultProfileRequestType", reflect.TypeOf((*PbmResetVSanDefaultProfileRequestType)(nil)).Elem()) +} + +type PbmResetVSanDefaultProfileResponse struct { +} + +type PbmResourceInUse struct { + PbmFault + + Type string `xml:"type,omitempty"` + Name string `xml:"name,omitempty"` +} + +func init() { + types.Add("pbm:PbmResourceInUse", reflect.TypeOf((*PbmResourceInUse)(nil)).Elem()) +} + +type PbmResourceInUseFault PbmResourceInUse + +func init() { + types.Add("pbm:PbmResourceInUseFault", reflect.TypeOf((*PbmResourceInUseFault)(nil)).Elem()) +} + +type PbmRetrieveContent PbmRetrieveContentRequestType + +func init() { + types.Add("pbm:PbmRetrieveContent", reflect.TypeOf((*PbmRetrieveContent)(nil)).Elem()) +} + +type PbmRetrieveContentRequestType struct { + This types.ManagedObjectReference `xml:"_this"` + ProfileIds []PbmProfileId `xml:"profileIds"` +} + +func init() { + types.Add("pbm:PbmRetrieveContentRequestType", reflect.TypeOf((*PbmRetrieveContentRequestType)(nil)).Elem()) +} + +type PbmRetrieveContentResponse struct { + Returnval []BasePbmProfile `xml:"returnval,typeattr"` +} + +type PbmRetrieveServiceContent PbmRetrieveServiceContentRequestType + +func init() { + types.Add("pbm:PbmRetrieveServiceContent", reflect.TypeOf((*PbmRetrieveServiceContent)(nil)).Elem()) +} + +type PbmRetrieveServiceContentRequestType struct { + This types.ManagedObjectReference `xml:"_this"` +} + +func init() { + types.Add("pbm:PbmRetrieveServiceContentRequestType", reflect.TypeOf((*PbmRetrieveServiceContentRequestType)(nil)).Elem()) +} + +type PbmRetrieveServiceContentResponse struct { + Returnval PbmServiceInstanceContent `xml:"returnval"` +} + +type PbmRollupComplianceResult struct { + types.DynamicData + + OldestCheckTime time.Time `xml:"oldestCheckTime"` + Entity PbmServerObjectRef `xml:"entity"` + OverallComplianceStatus string `xml:"overallComplianceStatus"` + OverallComplianceTaskStatus string `xml:"overallComplianceTaskStatus,omitempty"` + Result []PbmComplianceResult `xml:"result,omitempty"` + ErrorCause []types.LocalizedMethodFault `xml:"errorCause,omitempty"` + ProfileMismatch bool `xml:"profileMismatch"` +} + +func init() { + types.Add("pbm:PbmRollupComplianceResult", reflect.TypeOf((*PbmRollupComplianceResult)(nil)).Elem()) +} + +type PbmServerObjectRef struct { + types.DynamicData + + ObjectType string `xml:"objectType"` + Key string `xml:"key"` + ServerUuid string `xml:"serverUuid,omitempty"` +} + +func init() { + types.Add("pbm:PbmServerObjectRef", reflect.TypeOf((*PbmServerObjectRef)(nil)).Elem()) +} + +type PbmServiceInstanceContent struct { + types.DynamicData + + AboutInfo PbmAboutInfo `xml:"aboutInfo"` + SessionManager types.ManagedObjectReference `xml:"sessionManager"` + CapabilityMetadataManager types.ManagedObjectReference `xml:"capabilityMetadataManager"` + ProfileManager types.ManagedObjectReference `xml:"profileManager"` + ComplianceManager types.ManagedObjectReference `xml:"complianceManager"` + PlacementSolver types.ManagedObjectReference `xml:"placementSolver"` + ReplicationManager *types.ManagedObjectReference `xml:"replicationManager,omitempty"` +} + +func init() { + types.Add("pbm:PbmServiceInstanceContent", reflect.TypeOf((*PbmServiceInstanceContent)(nil)).Elem()) +} + +type PbmUpdate PbmUpdateRequestType + +func init() { + types.Add("pbm:PbmUpdate", reflect.TypeOf((*PbmUpdate)(nil)).Elem()) +} + +type PbmUpdateRequestType struct { + This types.ManagedObjectReference `xml:"_this"` + ProfileId PbmProfileId `xml:"profileId"` + UpdateSpec PbmCapabilityProfileUpdateSpec `xml:"updateSpec"` +} + +func init() { + types.Add("pbm:PbmUpdateRequestType", reflect.TypeOf((*PbmUpdateRequestType)(nil)).Elem()) +} + +type PbmUpdateResponse struct { +} + +type PbmVaioDataServiceInfo struct { + PbmLineOfServiceInfo +} + +func init() { + types.Add("pbm:PbmVaioDataServiceInfo", reflect.TypeOf((*PbmVaioDataServiceInfo)(nil)).Elem()) +} diff --git a/vendor/github.com/vmware/govmomi/property/BUILD b/vendor/github.com/vmware/govmomi/property/BUILD index 30c0b55954..ba6f040c4a 100644 --- a/vendor/github.com/vmware/govmomi/property/BUILD +++ b/vendor/github.com/vmware/govmomi/property/BUILD @@ -11,6 +11,7 @@ go_library( name = "go_default_library", srcs = [ "collector.go", + "filter.go", "wait.go", ], tags = ["automanaged"], diff --git a/vendor/github.com/vmware/govmomi/property/collector.go b/vendor/github.com/vmware/govmomi/property/collector.go index 32a0e409e2..e2059d923f 100644 --- a/vendor/github.com/vmware/govmomi/property/collector.go +++ b/vendor/github.com/vmware/govmomi/property/collector.go @@ -164,9 +164,36 @@ func (p *Collector) Retrieve(ctx context.Context, objs []types.ManagedObjectRefe return err } + if d, ok := dst.(*[]types.ObjectContent); ok { + *d = res.Returnval + return nil + } + return mo.LoadRetrievePropertiesResponse(res, dst) } +// RetrieveWithFilter populates dst as Retrieve does, but only for entities matching the given filter. +func (p *Collector) RetrieveWithFilter(ctx context.Context, objs []types.ManagedObjectReference, ps []string, dst interface{}, filter Filter) error { + if len(filter) == 0 { + return p.Retrieve(ctx, objs, ps, dst) + } + + var content []types.ObjectContent + + err := p.Retrieve(ctx, objs, filter.Keys(), &content) + if err != nil { + return err + } + + objs = filter.MatchObjectContent(content) + + if len(objs) == 0 { + return nil + } + + return p.Retrieve(ctx, objs, ps, dst) +} + // RetrieveOne calls Retrieve with a single managed object reference. func (p *Collector) RetrieveOne(ctx context.Context, obj types.ManagedObjectReference, ps []string, dst interface{}) error { var objs = []types.ManagedObjectReference{obj} diff --git a/vendor/github.com/vmware/govmomi/property/filter.go b/vendor/github.com/vmware/govmomi/property/filter.go new file mode 100644 index 0000000000..a6fa1de9ff --- /dev/null +++ b/vendor/github.com/vmware/govmomi/property/filter.go @@ -0,0 +1,135 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package property + +import ( + "fmt" + "path/filepath" + "reflect" + "strconv" + "strings" + + "github.com/vmware/govmomi/vim25/types" +) + +// Filter provides methods for matching against types.DynamicProperty +type Filter map[string]types.AnyType + +// Keys returns the Filter map keys as a []string +func (f Filter) Keys() []string { + keys := make([]string, 0, len(f)) + + for key := range f { + keys = append(keys, key) + } + + return keys +} + +// MatchProperty returns true if a Filter entry matches the given prop. +func (f Filter) MatchProperty(prop types.DynamicProperty) bool { + match, ok := f[prop.Name] + if !ok { + return false + } + + if match == prop.Val { + return true + } + + ptype := reflect.TypeOf(prop.Val) + + if strings.HasPrefix(ptype.Name(), "ArrayOf") { + pval := reflect.ValueOf(prop.Val).Field(0) + + for i := 0; i < pval.Len(); i++ { + prop.Val = pval.Index(i).Interface() + + if f.MatchProperty(prop) { + return true + } + } + + return false + } + + if reflect.TypeOf(match) != ptype { + s, ok := match.(string) + if !ok { + return false + } + + // convert if we can + switch prop.Val.(type) { + case bool: + match, _ = strconv.ParseBool(s) + case int16: + x, _ := strconv.ParseInt(s, 10, 16) + match = int16(x) + case int32: + x, _ := strconv.ParseInt(s, 10, 32) + match = int32(x) + case int64: + match, _ = strconv.ParseInt(s, 10, 64) + case float32: + x, _ := strconv.ParseFloat(s, 32) + match = float32(x) + case float64: + match, _ = strconv.ParseFloat(s, 64) + case fmt.Stringer: + prop.Val = prop.Val.(fmt.Stringer).String() + default: + if ptype.Kind() != reflect.String { + return false + } + // An enum type we can convert to a string type + prop.Val = reflect.ValueOf(prop.Val).String() + } + } + + switch pval := prop.Val.(type) { + case string: + m, _ := filepath.Match(match.(string), pval) + return m + default: + return reflect.DeepEqual(match, pval) + } +} + +// MatchPropertyList returns true if all given props match the Filter. +func (f Filter) MatchPropertyList(props []types.DynamicProperty) bool { + for _, p := range props { + if !f.MatchProperty(p) { + return false + } + } + + return true +} + +// MatchObjectContent returns a list of ObjectContent.Obj where the ObjectContent.PropSet matches the Filter. +func (f Filter) MatchObjectContent(objects []types.ObjectContent) []types.ManagedObjectReference { + var refs []types.ManagedObjectReference + + for _, o := range objects { + if f.MatchPropertyList(o.PropSet) { + refs = append(refs, o.Obj) + } + } + + return refs +} diff --git a/vendor/github.com/vmware/govmomi/task/wait.go b/vendor/github.com/vmware/govmomi/task/wait.go index 379093ee76..19fee53846 100644 --- a/vendor/github.com/vmware/govmomi/task/wait.go +++ b/vendor/github.com/vmware/govmomi/task/wait.go @@ -68,6 +68,11 @@ func (t *taskCallback) fn(pc []types.PropertyChange) bool { t.info = &ti } + // t.info could be nil if pc can't satify the rules above + if t.info == nil { + return false + } + pr := taskProgress{t.info} // Store copy of error, so Wait() can return it as well. diff --git a/vendor/github.com/vmware/govmomi/vim25/methods/methods.go b/vendor/github.com/vmware/govmomi/vim25/methods/methods.go index 79c49435a4..0895a81c60 100644 --- a/vendor/github.com/vmware/govmomi/vim25/methods/methods.go +++ b/vendor/github.com/vmware/govmomi/vim25/methods/methods.go @@ -1,5 +1,5 @@ /* -Copyright (c) 2014-2016 VMware, Inc. All Rights Reserved. +Copyright (c) 2014-2017 VMware, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/vendor/github.com/vmware/govmomi/vim25/mo/ancestors.go b/vendor/github.com/vmware/govmomi/vim25/mo/ancestors.go index 86a3a69f7c..d3da5b1847 100644 --- a/vendor/github.com/vmware/govmomi/vim25/mo/ancestors.go +++ b/vendor/github.com/vmware/govmomi/vim25/mo/ancestors.go @@ -104,6 +104,8 @@ func Ancestors(ctx context.Context, rt soap.RoundTripper, pc, obj types.ManagedO me.Name = x.Name case DistributedVirtualPortgroup: me.Name = x.Name + case OpaqueNetwork: + me.Name = x.Name default: // ManagedEntity always has a Name, if we hit this point we missed a case above. panic(fmt.Sprintf("%#v Name is empty", me.Reference())) diff --git a/vendor/github.com/vmware/govmomi/vim25/mo/mo.go b/vendor/github.com/vmware/govmomi/vim25/mo/mo.go index 0764eb49fb..ede6e44d7d 100644 --- a/vendor/github.com/vmware/govmomi/vim25/mo/mo.go +++ b/vendor/github.com/vmware/govmomi/vim25/mo/mo.go @@ -1,5 +1,5 @@ /* -Copyright (c) 2014-2016 VMware, Inc. All Rights Reserved. +Copyright (c) 2014-2017 VMware, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -150,6 +150,30 @@ func init() { t["ContainerView"] = reflect.TypeOf((*ContainerView)(nil)).Elem() } +type CryptoManager struct { + Self types.ManagedObjectReference + + Enabled bool `mo:"enabled"` +} + +func (m CryptoManager) Reference() types.ManagedObjectReference { + return m.Self +} + +func init() { + t["CryptoManager"] = reflect.TypeOf((*CryptoManager)(nil)).Elem() +} + +type CryptoManagerKmip struct { + CryptoManager + + KmipServers []types.KmipClusterInfo `mo:"kmipServers"` +} + +func init() { + t["CryptoManagerKmip"] = reflect.TypeOf((*CryptoManagerKmip)(nil)).Elem() +} + type CustomFieldsManager struct { Self types.ManagedObjectReference @@ -356,6 +380,34 @@ func init() { t["ExtensionManager"] = reflect.TypeOf((*ExtensionManager)(nil)).Elem() } +type FailoverClusterConfigurator struct { + Self types.ManagedObjectReference + + DisabledConfigureMethod []string `mo:"disabledConfigureMethod"` +} + +func (m FailoverClusterConfigurator) Reference() types.ManagedObjectReference { + return m.Self +} + +func init() { + t["FailoverClusterConfigurator"] = reflect.TypeOf((*FailoverClusterConfigurator)(nil)).Elem() +} + +type FailoverClusterManager struct { + Self types.ManagedObjectReference + + DisabledClusterMethod []string `mo:"disabledClusterMethod"` +} + +func (m FailoverClusterManager) Reference() types.ManagedObjectReference { + return m.Self +} + +func init() { + t["FailoverClusterManager"] = reflect.TypeOf((*FailoverClusterManager)(nil)).Elem() +} + type FileManager struct { Self types.ManagedObjectReference } @@ -461,6 +513,18 @@ func init() { t["GuestWindowsRegistryManager"] = reflect.TypeOf((*GuestWindowsRegistryManager)(nil)).Elem() } +type HealthUpdateManager struct { + Self types.ManagedObjectReference +} + +func (m HealthUpdateManager) Reference() types.ManagedObjectReference { + return m.Self +} + +func init() { + t["HealthUpdateManager"] = reflect.TypeOf((*HealthUpdateManager)(nil)).Elem() +} + type HistoryCollector struct { Self types.ManagedObjectReference @@ -695,8 +759,9 @@ func init() { type HostGraphicsManager struct { ExtensibleManagedObject - GraphicsInfo []types.HostGraphicsInfo `mo:"graphicsInfo"` - SharedPassthruGpuTypes []string `mo:"sharedPassthruGpuTypes"` + GraphicsInfo []types.HostGraphicsInfo `mo:"graphicsInfo"` + GraphicsConfig *types.HostGraphicsConfig `mo:"graphicsConfig"` + SharedPassthruGpuTypes []string `mo:"sharedPassthruGpuTypes"` } func init() { @@ -803,7 +868,8 @@ func init() { type HostPciPassthruSystem struct { ExtensibleManagedObject - PciPassthruInfo []types.BaseHostPciPassthruInfo `mo:"pciPassthruInfo"` + PciPassthruInfo []types.BaseHostPciPassthruInfo `mo:"pciPassthruInfo"` + SriovDevicePoolInfo []types.BaseHostSriovDevicePoolInfo `mo:"sriovDevicePoolInfo"` } func init() { @@ -868,6 +934,18 @@ func init() { t["HostSnmpSystem"] = reflect.TypeOf((*HostSnmpSystem)(nil)).Elem() } +type HostSpecificationManager struct { + Self types.ManagedObjectReference +} + +func (m HostSpecificationManager) Reference() types.ManagedObjectReference { + return m.Self +} + +func init() { + t["HostSpecificationManager"] = reflect.TypeOf((*HostSpecificationManager)(nil)).Elem() +} + type HostStorageSystem struct { ExtensibleManagedObject @@ -931,6 +1009,14 @@ func init() { t["HostVMotionSystem"] = reflect.TypeOf((*HostVMotionSystem)(nil)).Elem() } +type HostVStorageObjectManager struct { + VStorageObjectManagerBase +} + +func init() { + t["HostVStorageObjectManager"] = reflect.TypeOf((*HostVStorageObjectManager)(nil)).Elem() +} + type HostVirtualNicManager struct { ExtensibleManagedObject @@ -984,18 +1070,6 @@ func init() { t["HttpNfcLease"] = reflect.TypeOf((*HttpNfcLease)(nil)).Elem() } -type InternalDynamicTypeManager struct { - Self types.ManagedObjectReference -} - -func (m InternalDynamicTypeManager) Reference() types.ManagedObjectReference { - return m.Self -} - -func init() { - t["InternalDynamicTypeManager"] = reflect.TypeOf((*InternalDynamicTypeManager)(nil)).Elem() -} - type InventoryView struct { ManagedObjectView } @@ -1163,6 +1237,9 @@ func init() { type OpaqueNetwork struct { Network + + Capability *types.OpaqueNetworkCapability `mo:"capability"` + ExtraConfig []types.BaseOptionValue `mo:"extraConfig"` } func init() { @@ -1302,18 +1379,6 @@ func init() { t["PropertyFilter"] = reflect.TypeOf((*PropertyFilter)(nil)).Elem() } -type ReflectManagedMethodExecuter struct { - Self types.ManagedObjectReference -} - -func (m ReflectManagedMethodExecuter) Reference() types.ManagedObjectReference { - return m.Self -} - -func init() { - t["ReflectManagedMethodExecuter"] = reflect.TypeOf((*ReflectManagedMethodExecuter)(nil)).Elem() -} - type ResourcePlanningManager struct { Self types.ManagedObjectReference } @@ -1520,6 +1585,26 @@ func init() { t["UserDirectory"] = reflect.TypeOf((*UserDirectory)(nil)).Elem() } +type VStorageObjectManagerBase struct { + Self types.ManagedObjectReference +} + +func (m VStorageObjectManagerBase) Reference() types.ManagedObjectReference { + return m.Self +} + +func init() { + t["VStorageObjectManagerBase"] = reflect.TypeOf((*VStorageObjectManagerBase)(nil)).Elem() +} + +type VcenterVStorageObjectManager struct { + VStorageObjectManagerBase +} + +func init() { + t["VcenterVStorageObjectManager"] = reflect.TypeOf((*VcenterVStorageObjectManager)(nil)).Elem() +} + type View struct { Self types.ManagedObjectReference } diff --git a/vendor/github.com/vmware/govmomi/vim25/soap/client.go b/vendor/github.com/vmware/govmomi/vim25/soap/client.go index e89ffc8107..9ac3cc4d6d 100644 --- a/vendor/github.com/vmware/govmomi/vim25/soap/client.go +++ b/vendor/github.com/vmware/govmomi/vim25/soap/client.go @@ -58,6 +58,10 @@ const ( DefaultMinVimVersion = "5.5" ) +type header struct { + Cookie string `xml:"vcSessionCookie,omitempty"` +} + type Client struct { http.Client @@ -73,6 +77,8 @@ type Client struct { Namespace string // Vim namespace Version string // Vim version UserAgent string + + header *header } var schemeMatch = regexp.MustCompile(`^\w+://`) @@ -147,6 +153,32 @@ func NewClient(u *url.URL, insecure bool) *Client { return &c } +// NewServiceClient creates a NewClient with the given URL.Path and namespace. +func (c *Client) NewServiceClient(path string, namespace string) *Client { + u := c.URL() + u.Path = path + + client := NewClient(u, c.k) + + client.Namespace = namespace + + // Copy the cookies + client.Client.Jar.SetCookies(u, c.Client.Jar.Cookies(u)) + + // Set SOAP Header cookie + for _, cookie := range client.Jar.Cookies(u) { + if cookie.Name == "vmware_soap_session" { + client.header = &header{ + Cookie: cookie.Value, + } + + break + } + } + + return client +} + // SetRootCAs defines the set of root certificate authorities // that clients use when verifying server certificates. // By default TLS uses the host's root CA set. @@ -401,6 +433,8 @@ func (c *Client) RoundTrip(ctx context.Context, reqBody, resBody HasFault) error reqEnv := Envelope{Body: reqBody} resEnv := Envelope{Body: resBody} + reqEnv.Header = c.header + // Create debugging context for this round trip d := c.d.newRoundTrip() if d.enabled() { diff --git a/vendor/github.com/vmware/govmomi/vim25/soap/error.go b/vendor/github.com/vmware/govmomi/vim25/soap/error.go index 0408e7bf0d..d89208522a 100644 --- a/vendor/github.com/vmware/govmomi/vim25/soap/error.go +++ b/vendor/github.com/vmware/govmomi/vim25/soap/error.go @@ -36,7 +36,13 @@ type soapFaultError struct { } func (s soapFaultError) Error() string { - return fmt.Sprintf("%s: %s", s.fault.Code, s.fault.String) + msg := s.fault.String + + if msg == "" { + msg = reflect.TypeOf(s.fault.Detail.Fault).Name() + } + + return fmt.Sprintf("%s: %s", s.fault.Code, msg) } type vimFaultError struct { diff --git a/vendor/github.com/vmware/govmomi/vim25/soap/soap.go b/vendor/github.com/vmware/govmomi/vim25/soap/soap.go index ea35e77ad7..a8baa0122a 100644 --- a/vendor/github.com/vmware/govmomi/vim25/soap/soap.go +++ b/vendor/github.com/vmware/govmomi/vim25/soap/soap.go @@ -22,15 +22,11 @@ import ( ) type Envelope struct { - XMLName xml.Name `xml:"http://schemas.xmlsoap.org/soap/envelope/ Envelope"` - Header *Header `xml:",omitempty"` + XMLName xml.Name `xml:"http://schemas.xmlsoap.org/soap/envelope/ Envelope"` + Header interface{} `xml:",omitempty"` Body interface{} } -type Header struct { - XMLName xml.Name `xml:"http://schemas.xmlsoap.org/soap/envelope/ Header"` -} - type Fault struct { XMLName xml.Name `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault"` Code string `xml:"faultcode"` diff --git a/vendor/github.com/vmware/govmomi/vim25/types/enum.go b/vendor/github.com/vmware/govmomi/vim25/types/enum.go index 1db935ef7a..02f7f3cb59 100644 --- a/vendor/github.com/vmware/govmomi/vim25/types/enum.go +++ b/vendor/github.com/vmware/govmomi/vim25/types/enum.go @@ -1,5 +1,5 @@ /* -Copyright (c) 2014-2016 VMware, Inc. All Rights Reserved. +Copyright (c) 2014-2017 VMware, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/vendor/github.com/vmware/govmomi/vim25/types/helpers.go b/vendor/github.com/vmware/govmomi/vim25/types/helpers.go index 7b72358b25..2364ed4213 100644 --- a/vendor/github.com/vmware/govmomi/vim25/types/helpers.go +++ b/vendor/github.com/vmware/govmomi/vim25/types/helpers.go @@ -46,3 +46,7 @@ func (r *ManagedObjectReference) FromString(o string) bool { return true } + +func (c *PerfCounterInfo) Name() string { + return c.GroupInfo.GetElementDescription().Key + "." + c.NameInfo.GetElementDescription().Key + "." + string(c.RollupType) +} diff --git a/vendor/github.com/vmware/govmomi/vim25/types/if.go b/vendor/github.com/vmware/govmomi/vim25/types/if.go index 5ae275c6da..dbf594cfc0 100644 --- a/vendor/github.com/vmware/govmomi/vim25/types/if.go +++ b/vendor/github.com/vmware/govmomi/vim25/types/if.go @@ -1,5 +1,5 @@ /* -Copyright (c) 2014-2016 VMware, Inc. All Rights Reserved. +Copyright (c) 2014-2017 VMware, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/vendor/github.com/vmware/govmomi/vim25/types/registry.go b/vendor/github.com/vmware/govmomi/vim25/types/registry.go index 8f238088db..ff7c302d31 100644 --- a/vendor/github.com/vmware/govmomi/vim25/types/registry.go +++ b/vendor/github.com/vmware/govmomi/vim25/types/registry.go @@ -16,15 +16,28 @@ limitations under the License. package types -import "reflect" +import ( + "reflect" + "strings" +) var t = map[string]reflect.Type{} +func Add(name string, kind reflect.Type) { + t[name] = kind +} + type Func func(string) (reflect.Type, bool) func TypeFunc() Func { return func(name string) (reflect.Type, bool) { typ, ok := t[name] + if !ok { + // The /sdk endpoint does not prefix types with the namespace, + // but extension endpoints, such as /pbm/sdk do. + name = strings.TrimPrefix(name, "vim25:") + typ, ok = t[name] + } return typ, ok } } diff --git a/vendor/github.com/vmware/govmomi/vim25/types/types.go b/vendor/github.com/vmware/govmomi/vim25/types/types.go index ffb4606c63..fa62c01815 100644 --- a/vendor/github.com/vmware/govmomi/vim25/types/types.go +++ b/vendor/github.com/vmware/govmomi/vim25/types/types.go @@ -1,5 +1,5 @@ /* -Copyright (c) 2014-2016 VMware, Inc. All Rights Reserved. +Copyright (c) 2014-2017 VMware, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/vendor/github.com/vmware/govmomi/vim25/xml/extras.go b/vendor/github.com/vmware/govmomi/vim25/xml/extras.go index 3b7f44b01b..9a15b7c8eb 100644 --- a/vendor/github.com/vmware/govmomi/vim25/xml/extras.go +++ b/vendor/github.com/vmware/govmomi/vim25/xml/extras.go @@ -23,6 +23,8 @@ import ( var xmlSchemaInstance = Name{Space: "http://www.w3.org/2001/XMLSchema-instance", Local: "type"} +var xsiType = Name{Space: "xsi", Local: "type"} + var stringToTypeMap = map[string]reflect.Type{ "xsd:boolean": reflect.TypeOf((*bool)(nil)).Elem(), "xsd:byte": reflect.TypeOf((*int8)(nil)).Elem(), diff --git a/vendor/github.com/vmware/govmomi/vim25/xml/read.go b/vendor/github.com/vmware/govmomi/vim25/xml/read.go index 5b407b7909..fe35fce6ca 100644 --- a/vendor/github.com/vmware/govmomi/vim25/xml/read.go +++ b/vendor/github.com/vmware/govmomi/vim25/xml/read.go @@ -272,13 +272,15 @@ var ( func (p *Decoder) typeForElement(val reflect.Value, start *StartElement) reflect.Type { t := "" for i, a := range start.Attr { - if a.Name == xmlSchemaInstance { + if a.Name == xmlSchemaInstance || a.Name == xsiType { t = a.Value // HACK: ensure xsi:type is last in the list to avoid using that value for // a "type" attribute, such as ManagedObjectReference.Type for example. // Note that xsi:type is already the last attribute in VC/ESX responses. // This is only an issue with govmomi simulator generated responses. // Proper fix will require finding a few needles in this xml package haystack. + // Note: govmomi uses xmlSchemaInstance, other clients (e.g. rbvmomi) use xsiType. + // They are the same thing to XML parsers, but not to this hack here. x := len(start.Attr) - 1 if i != x { start.Attr[i] = start.Attr[x]