From bec893e37c5371d98ba973d4fe7f206257395bb9 Mon Sep 17 00:00:00 2001 From: Achilleas Koutsou Date: Fri, 31 Jan 2025 18:26:22 +0100 Subject: [PATCH] go.mod: update github.com/vmware/govmomi to v0.48.0 Needs manual change of import paths. --- go.mod | 2 +- go.sum | 4 +- internal/boot/vmwaretest/vmware.go | 10 +- internal/upload/vmware/vmware.go | 4 +- .../github.com/vmware/govmomi/.goreleaser.yml | 51 +- vendor/github.com/vmware/govmomi/.mailmap | 6 + vendor/github.com/vmware/govmomi/CHANGELOG.md | 555 +++++ .../github.com/vmware/govmomi/CONTRIBUTING.md | 45 +- vendor/github.com/vmware/govmomi/CONTRIBUTORS | 17 + vendor/github.com/vmware/govmomi/Makefile | 20 +- vendor/github.com/vmware/govmomi/README.md | 57 +- vendor/github.com/vmware/govmomi/USAGE.md | 0 .../vmware/govmomi/{govc => }/cli/command.go | 2 +- .../govmomi/{govc => cli}/datastore/cp.go | 4 +- .../govmomi/{govc => cli}/datastore/create.go | 29 +- .../{govc => cli}/datastore/download.go | 62 +- .../govmomi/{govc => cli}/datastore/info.go | 10 +- .../govmomi/{govc => cli}/datastore/ls.go | 29 +- .../govmomi/{govc => cli}/datastore/mkdir.go | 17 +- .../govmomi/{govc => cli}/datastore/mv.go | 2 +- .../govmomi/{govc => cli}/datastore/remove.go | 4 +- .../govmomi/{govc => cli}/datastore/rm.go | 4 +- .../govmomi/{govc => cli}/datastore/tail.go | 4 +- .../govmomi/{govc => cli}/datastore/upload.go | 4 +- .../{govc/host/esxcli => cli/esx}/command.go | 20 +- .../{govc/host/esxcli => cli/esx}/executor.go | 89 +- .../host/esxcli => cli/esx}/firewall_info.go | 15 +- .../host/esxcli => cli/esx}/guest_info.go | 22 +- .../{govc/host/esxcli => cli/esx}/response.go | 92 +- .../govmomi/{govc => cli}/flags/client.go | 59 +- .../govmomi/{govc => cli}/flags/cluster.go | 0 .../govmomi/{govc => cli}/flags/common.go | 0 .../govmomi/{govc => cli}/flags/datacenter.go | 18 +- .../govmomi/{govc => cli}/flags/datastore.go | 0 .../govmomi/{govc => cli}/flags/debug.go | 6 +- .../govmomi/{govc => cli}/flags/empty.go | 0 .../vmware/govmomi/{govc => cli}/flags/env.go | 0 .../govmomi/{govc => cli}/flags/folder.go | 0 .../{govc => cli}/flags/host_connect.go | 17 +- .../{govc => cli}/flags/host_system.go | 0 .../govmomi/{govc => cli}/flags/int32.go | 0 .../govmomi/{govc => cli}/flags/int64.go | 0 .../govmomi/{govc => cli}/flags/library.go | 0 .../govmomi/{govc => cli}/flags/list.go | 0 .../govmomi/{govc => cli}/flags/network.go | 0 .../{govc => cli}/flags/optional_bool.go | 0 .../{govc => cli}/flags/optional_string.go | 0 .../govmomi/{govc => cli}/flags/output.go | 2 +- .../flags/resource_allocation_info.go | 0 .../{govc => cli}/flags/resource_pool.go | 0 .../govmomi/{govc => cli}/flags/search.go | 13 +- .../{govc => cli}/flags/storage_pod.go | 0 .../govmomi/cli/flags/storage_profile.go | 124 ++ .../govmomi/{govc => cli}/flags/version.go | 0 .../{govc => cli}/flags/virtual_app.go | 0 .../{govc => cli}/flags/virtual_machine.go | 0 .../govmomi/{govc => cli}/importx/options.go | 2 +- .../govmomi/{govc => cli}/importx/ova.go | 2 +- .../govmomi/{govc => cli}/importx/ovf.go | 4 +- .../govmomi/{govc => cli}/importx/spec.go | 4 +- .../govmomi/{govc => cli}/importx/vmdk.go | 4 +- .../vmware/govmomi/{govc => }/cli/register.go | 0 .../vmware/govmomi/{govc => cli}/vm/change.go | 27 +- .../vmware/govmomi/{govc => cli}/vm/clone.go | 4 +- .../govmomi/{govc => cli}/vm/console.go | 4 +- .../vmware/govmomi/{govc => cli}/vm/create.go | 50 +- .../govmomi/{govc => cli}/vm/customize.go | 4 +- .../govmomi/{govc => cli}/vm/destroy.go | 4 +- .../govmomi/{govc => cli}/vm/guest/auth.go | 0 .../govmomi/{govc => cli}/vm/guest/chmod.go | 2 +- .../govmomi/{govc => cli}/vm/guest/chown.go | 2 +- .../govmomi/{govc => cli}/vm/guest/df.go | 4 +- .../{govc => cli}/vm/guest/download.go | 2 +- .../{govc => cli}/vm/guest/file_attr.go | 2 +- .../govmomi/{govc => cli}/vm/guest/getenv.go | 2 +- .../govmomi/{govc => cli}/vm/guest/guest.go | 2 +- .../govmomi/{govc => cli}/vm/guest/kill.go | 2 +- .../govmomi/{govc => cli}/vm/guest/ls.go | 2 +- .../govmomi/{govc => cli}/vm/guest/mkdir.go | 15 +- .../govmomi/{govc => cli}/vm/guest/mktemp.go | 2 +- .../govmomi/{govc => cli}/vm/guest/mv.go | 15 +- .../govmomi/{govc => cli}/vm/guest/ps.go | 4 +- .../govmomi/{govc => cli}/vm/guest/rm.go | 2 +- .../govmomi/{govc => cli}/vm/guest/rmdir.go | 2 +- .../govmomi/{govc => cli}/vm/guest/run.go | 2 +- .../govmomi/{govc => cli}/vm/guest/start.go | 2 +- .../govmomi/{govc => cli}/vm/guest/tools.go | 4 +- .../govmomi/{govc => cli}/vm/guest/touch.go | 12 +- .../govmomi/{govc => cli}/vm/guest/upload.go | 2 +- .../vmware/govmomi/{govc => cli}/vm/info.go | 4 +- .../govmomi/{govc => cli}/vm/instantclone.go | 4 +- .../vmware/govmomi/{govc => cli}/vm/ip.go | 10 +- .../govmomi/{govc => cli}/vm/keystrokes.go | 4 +- .../{govc => cli}/vm/markastemplate.go | 4 +- .../govmomi/{govc => cli}/vm/markasvm.go | 4 +- .../govmomi/{govc => cli}/vm/migrate.go | 4 +- .../vmware/govmomi/{govc => cli}/vm/power.go | 17 +- .../govmomi/{govc => cli}/vm/question.go | 4 +- .../govmomi/{govc => cli}/vm/register.go | 4 +- .../govmomi/{govc => cli}/vm/unregister.go | 4 +- .../govmomi/{govc => cli}/vm/upgrade.go | 21 +- .../vmware/govmomi/{govc => cli}/vm/vnc.go | 4 +- vendor/github.com/vmware/govmomi/client.go | 18 +- .../vmware/govmomi/cns/methods/unreleased.go | 44 + .../vmware/govmomi/cns/types/types.go | 356 +-- .../govmomi/cns/types/unreleased_types.go | 68 + .../vmware/govmomi/cns/unreleased_client.go | 38 + .../github.com/vmware/govmomi/fault/fault.go | 317 +++ vendor/github.com/vmware/govmomi/find/doc.go | 7 +- .../github.com/vmware/govmomi/find/finder.go | 23 +- .../vmware/govmomi/govc/host/esxcli/esxcli.go | 190 -- .../vmware/govmomi/internal/helpers.go | 31 + .../vmware/govmomi/internal/methods.go | 25 + .../vmware/govmomi/internal/types.go | 63 +- .../govmomi/internal/version/version.go | 2 +- .../github.com/vmware/govmomi/list/lister.go | 14 +- .../vmware/govmomi/object/common.go | 54 +- .../vmware/govmomi/object/datacenter.go | 19 +- .../vmware/govmomi/object/datastore.go | 36 +- .../object/host_certificate_manager.go | 8 +- .../govmomi/object/virtual_device_list.go | 27 +- .../govmomi/object/virtual_disk_manager.go | 2 +- .../object/virtual_disk_manager_internal.go | 60 +- .../vmware/govmomi/object/virtual_machine.go | 25 +- vendor/github.com/vmware/govmomi/ovf/cim.go | 209 +- .../vmware/govmomi/ovf/configspec.go | 1081 +++++++++ vendor/github.com/vmware/govmomi/ovf/env.go | 24 +- .../github.com/vmware/govmomi/ovf/envelope.go | 198 +- .../vmware/govmomi/ovf/importer/archive.go | 28 +- .../vmware/govmomi/ovf/importer/importer.go | 20 +- .../vmware/govmomi/ovf/importer/spec.go | 4 +- .../github.com/vmware/govmomi/ovf/manager.go | 2 +- vendor/github.com/vmware/govmomi/ovf/ovf.go | 23 +- .../github.com/vmware/govmomi/pbm/client.go | 37 +- .../govmomi/pbm/methods/internal_methods.go | 44 + .../vmware/govmomi/pbm/methods/methods.go | 18 +- .../vmware/govmomi/pbm/types/enum.go | 77 +- .../github.com/vmware/govmomi/pbm/types/if.go | 18 +- .../govmomi/pbm/types/internal_types.go | 95 + .../vmware/govmomi/pbm/types/types.go | 26 +- .../vmware/govmomi/property/collector.go | 13 +- .../vmware/govmomi/session/cache/session.go | 16 +- .../vmware/govmomi/session/manager.go | 50 +- .../govmomi/vapi/library/finder/path.go | 133 +- .../vmware/govmomi/vapi/library/library.go | 7 + .../vmware/govmomi/vapi/rest/client.go | 36 +- .../github.com/vmware/govmomi/vim25/client.go | 2 +- .../govmomi/vim25/json/discriminator.go | 6 +- .../vmware/govmomi/vim25/methods/methods.go | 258 ++- .../github.com/vmware/govmomi/vim25/mo/mo.go | 18 +- .../vmware/govmomi/vim25/mo/registry.go | 38 +- .../vmware/govmomi/vim25/mo/retrieve.go | 23 +- .../vmware/govmomi/vim25/mo/type_info.go | 36 +- .../vmware/govmomi/vim25/soap/client.go | 70 +- .../vmware/govmomi/vim25/soap/error.go | 66 +- .../vmware/govmomi/vim25/soap/json_client.go | 14 +- .../vmware/govmomi/vim25/soap/soap.go | 18 +- .../vmware/govmomi/vim25/types/byte_slice.go | 3 +- .../vmware/govmomi/vim25/types/deep_copy.go | 65 + .../vmware/govmomi/vim25/types/enum.go | 697 +++++- .../vmware/govmomi/vim25/types/fault.go | 12 + .../vmware/govmomi/vim25/types/helpers.go | 79 + .../vmware/govmomi/vim25/types/if.go | 142 +- .../vmware/govmomi/vim25/types/types.go | 1973 ++++++++++++++++- .../vmware/govmomi/vim25/types/unreleased.go | 57 +- .../vmware/govmomi/vim25/xml/marshal.go | 10 +- .../vmware/govmomi/vmdk/descriptor.go | 161 ++ .../vmware/govmomi/vmdk/disk_info.go | 27 +- .../github.com/vmware/govmomi/vmdk/import.go | 2 +- vendor/modules.txt | 17 +- 170 files changed, 7474 insertions(+), 1604 deletions(-) delete mode 100644 vendor/github.com/vmware/govmomi/USAGE.md rename vendor/github.com/vmware/govmomi/{govc => }/cli/command.go (98%) rename vendor/github.com/vmware/govmomi/{govc => cli}/datastore/cp.go (97%) rename vendor/github.com/vmware/govmomi/{govc => cli}/datastore/create.go (89%) rename vendor/github.com/vmware/govmomi/{govc => cli}/datastore/download.go (62%) rename vendor/github.com/vmware/govmomi/{govc => cli}/datastore/info.go (93%) rename vendor/github.com/vmware/govmomi/{govc => cli}/datastore/ls.go (91%) rename vendor/github.com/vmware/govmomi/{govc => cli}/datastore/mkdir.go (85%) rename vendor/github.com/vmware/govmomi/{govc => cli}/datastore/mv.go (97%) rename vendor/github.com/vmware/govmomi/{govc => cli}/datastore/remove.go (96%) rename vendor/github.com/vmware/govmomi/{govc => cli}/datastore/rm.go (96%) rename vendor/github.com/vmware/govmomi/{govc => cli}/datastore/tail.go (97%) rename vendor/github.com/vmware/govmomi/{govc => cli}/datastore/upload.go (96%) rename vendor/github.com/vmware/govmomi/{govc/host/esxcli => cli/esx}/command.go (90%) rename vendor/github.com/vmware/govmomi/{govc/host/esxcli => cli/esx}/executor.go (59%) rename vendor/github.com/vmware/govmomi/{govc/host/esxcli => cli/esx}/firewall_info.go (78%) rename vendor/github.com/vmware/govmomi/{govc/host/esxcli => cli/esx}/guest_info.go (79%) rename vendor/github.com/vmware/govmomi/{govc/host/esxcli => cli/esx}/response.go (54%) rename vendor/github.com/vmware/govmomi/{govc => cli}/flags/client.go (87%) rename vendor/github.com/vmware/govmomi/{govc => cli}/flags/cluster.go (100%) rename vendor/github.com/vmware/govmomi/{govc => cli}/flags/common.go (100%) rename vendor/github.com/vmware/govmomi/{govc => cli}/flags/datacenter.go (94%) rename vendor/github.com/vmware/govmomi/{govc => cli}/flags/datastore.go (100%) rename vendor/github.com/vmware/govmomi/{govc => cli}/flags/debug.go (98%) rename vendor/github.com/vmware/govmomi/{govc => cli}/flags/empty.go (100%) rename vendor/github.com/vmware/govmomi/{govc => cli}/flags/env.go (100%) rename vendor/github.com/vmware/govmomi/{govc => cli}/flags/folder.go (100%) rename vendor/github.com/vmware/govmomi/{govc => cli}/flags/host_connect.go (89%) rename vendor/github.com/vmware/govmomi/{govc => cli}/flags/host_system.go (100%) rename vendor/github.com/vmware/govmomi/{govc => cli}/flags/int32.go (100%) rename vendor/github.com/vmware/govmomi/{govc => cli}/flags/int64.go (100%) rename vendor/github.com/vmware/govmomi/{govc => cli}/flags/library.go (100%) rename vendor/github.com/vmware/govmomi/{govc => cli}/flags/list.go (100%) rename vendor/github.com/vmware/govmomi/{govc => cli}/flags/network.go (100%) rename vendor/github.com/vmware/govmomi/{govc => cli}/flags/optional_bool.go (100%) rename vendor/github.com/vmware/govmomi/{govc => cli}/flags/optional_string.go (100%) rename vendor/github.com/vmware/govmomi/{govc => cli}/flags/output.go (99%) rename vendor/github.com/vmware/govmomi/{govc => cli}/flags/resource_allocation_info.go (100%) rename vendor/github.com/vmware/govmomi/{govc => cli}/flags/resource_pool.go (100%) rename vendor/github.com/vmware/govmomi/{govc => cli}/flags/search.go (96%) rename vendor/github.com/vmware/govmomi/{govc => cli}/flags/storage_pod.go (100%) create mode 100644 vendor/github.com/vmware/govmomi/cli/flags/storage_profile.go rename vendor/github.com/vmware/govmomi/{govc => cli}/flags/version.go (100%) rename vendor/github.com/vmware/govmomi/{govc => cli}/flags/virtual_app.go (100%) rename vendor/github.com/vmware/govmomi/{govc => cli}/flags/virtual_machine.go (100%) rename vendor/github.com/vmware/govmomi/{govc => cli}/importx/options.go (98%) rename vendor/github.com/vmware/govmomi/{govc => cli}/importx/ova.go (97%) rename vendor/github.com/vmware/govmomi/{govc => cli}/importx/ovf.go (98%) rename vendor/github.com/vmware/govmomi/{govc => cli}/importx/spec.go (96%) rename vendor/github.com/vmware/govmomi/{govc => cli}/importx/vmdk.go (97%) rename vendor/github.com/vmware/govmomi/{govc => }/cli/register.go (100%) rename vendor/github.com/vmware/govmomi/{govc => cli}/vm/change.go (87%) rename vendor/github.com/vmware/govmomi/{govc => cli}/vm/clone.go (99%) rename vendor/github.com/vmware/govmomi/{govc => cli}/vm/console.go (98%) rename vendor/github.com/vmware/govmomi/{govc => cli}/vm/create.go (95%) rename vendor/github.com/vmware/govmomi/{govc => cli}/vm/customize.go (99%) rename vendor/github.com/vmware/govmomi/{govc => cli}/vm/destroy.go (96%) rename vendor/github.com/vmware/govmomi/{govc => cli}/vm/guest/auth.go (100%) rename vendor/github.com/vmware/govmomi/{govc => cli}/vm/guest/chmod.go (97%) rename vendor/github.com/vmware/govmomi/{govc => cli}/vm/guest/chown.go (98%) rename vendor/github.com/vmware/govmomi/{govc => cli}/vm/guest/df.go (96%) rename vendor/github.com/vmware/govmomi/{govc => cli}/vm/guest/download.go (98%) rename vendor/github.com/vmware/govmomi/{govc => cli}/vm/guest/file_attr.go (97%) rename vendor/github.com/vmware/govmomi/{govc => cli}/vm/guest/getenv.go (97%) rename vendor/github.com/vmware/govmomi/{govc => cli}/vm/guest/guest.go (98%) rename vendor/github.com/vmware/govmomi/{govc => cli}/vm/guest/kill.go (97%) rename vendor/github.com/vmware/govmomi/{govc => cli}/vm/guest/ls.go (98%) rename vendor/github.com/vmware/govmomi/{govc => cli}/vm/guest/mkdir.go (82%) rename vendor/github.com/vmware/govmomi/{govc => cli}/vm/guest/mktemp.go (98%) rename vendor/github.com/vmware/govmomi/{govc => cli}/vm/guest/mv.go (80%) rename vendor/github.com/vmware/govmomi/{govc => cli}/vm/guest/ps.go (98%) rename vendor/github.com/vmware/govmomi/{govc => cli}/vm/guest/rm.go (97%) rename vendor/github.com/vmware/govmomi/{govc => cli}/vm/guest/rmdir.go (97%) rename vendor/github.com/vmware/govmomi/{govc => cli}/vm/guest/run.go (98%) rename vendor/github.com/vmware/govmomi/{govc => cli}/vm/guest/start.go (98%) rename vendor/github.com/vmware/govmomi/{govc => cli}/vm/guest/tools.go (97%) rename vendor/github.com/vmware/govmomi/{govc => cli}/vm/guest/touch.go (89%) rename vendor/github.com/vmware/govmomi/{govc => cli}/vm/guest/upload.go (98%) rename vendor/github.com/vmware/govmomi/{govc => cli}/vm/info.go (99%) rename vendor/github.com/vmware/govmomi/{govc => cli}/vm/instantclone.go (98%) rename vendor/github.com/vmware/govmomi/{govc => cli}/vm/ip.go (96%) rename vendor/github.com/vmware/govmomi/{govc => cli}/vm/keystrokes.go (99%) rename vendor/github.com/vmware/govmomi/{govc => cli}/vm/markastemplate.go (95%) rename vendor/github.com/vmware/govmomi/{govc => cli}/vm/markasvm.go (96%) rename vendor/github.com/vmware/govmomi/{govc => cli}/vm/migrate.go (98%) rename vendor/github.com/vmware/govmomi/{govc => cli}/vm/power.go (93%) rename vendor/github.com/vmware/govmomi/{govc => cli}/vm/question.go (96%) rename vendor/github.com/vmware/govmomi/{govc => cli}/vm/register.go (97%) rename vendor/github.com/vmware/govmomi/{govc => cli}/vm/unregister.go (95%) rename vendor/github.com/vmware/govmomi/{govc => cli}/vm/upgrade.go (81%) rename vendor/github.com/vmware/govmomi/{govc => cli}/vm/vnc.go (99%) create mode 100644 vendor/github.com/vmware/govmomi/cns/methods/unreleased.go create mode 100644 vendor/github.com/vmware/govmomi/cns/types/unreleased_types.go create mode 100644 vendor/github.com/vmware/govmomi/cns/unreleased_client.go create mode 100644 vendor/github.com/vmware/govmomi/fault/fault.go delete mode 100644 vendor/github.com/vmware/govmomi/govc/host/esxcli/esxcli.go create mode 100644 vendor/github.com/vmware/govmomi/ovf/configspec.go create mode 100644 vendor/github.com/vmware/govmomi/pbm/methods/internal_methods.go create mode 100644 vendor/github.com/vmware/govmomi/pbm/types/internal_types.go create mode 100644 vendor/github.com/vmware/govmomi/vim25/types/deep_copy.go create mode 100644 vendor/github.com/vmware/govmomi/vmdk/descriptor.go diff --git a/go.mod b/go.mod index 67632a39b..c24cb7393 100644 --- a/go.mod +++ b/go.mod @@ -53,7 +53,7 @@ require ( github.com/spf13/cobra v1.8.1 github.com/stretchr/testify v1.10.0 github.com/ubccr/kerby v0.0.0-20230802201021-412be7bfaee5 - github.com/vmware/govmomi v0.42.0 + github.com/vmware/govmomi v0.48.0 golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 golang.org/x/oauth2 v0.25.0 golang.org/x/sync v0.10.0 diff --git a/go.sum b/go.sum index 53c459fd0..174202bbf 100644 --- a/go.sum +++ b/go.sum @@ -656,8 +656,8 @@ github.com/vbatts/tar-split v0.11.5 h1:3bHCTIheBm1qFTcgh9oPu+nNBtX+XJIupG/vacinC github.com/vbatts/tar-split v0.11.5/go.mod h1:yZbwRsSeGjusneWgA781EKej9HF8vme8okylkAeNKLk= github.com/vbauerster/mpb/v8 v8.7.5 h1:hUF3zaNsuaBBwzEFoCvfuX3cpesQXZC0Phm/JcHZQ+c= github.com/vbauerster/mpb/v8 v8.7.5/go.mod h1:bRCnR7K+mj5WXKsy0NWB6Or+wctYGvVwKn6huwvxKa0= -github.com/vmware/govmomi v0.42.0 h1:MbvAlVfjNBE1mHMaQ7yOSop1KLB0/93x6VAGuCtjqtI= -github.com/vmware/govmomi v0.42.0/go.mod h1:1H5LWwsBif8HKZqbFp0FdoKTHyJE4FzL6ACequMKYQg= +github.com/vmware/govmomi v0.48.0 h1:CP5bCvkDNGkmn29UlcJKTWMLwDg3iusP8anrZnedWrg= +github.com/vmware/govmomi v0.48.0/go.mod h1:bYwUHpGpisE4AOlDl5eph90T+cjJMIcKx/kaa5v5rQM= github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb h1:zGWFAtiMcyryUHoUjUJX0/lt1H2+i2Ka2n+D3DImSNo= github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0= diff --git a/internal/boot/vmwaretest/vmware.go b/internal/boot/vmwaretest/vmware.go index 8f78bc294..9c92be15e 100644 --- a/internal/boot/vmwaretest/vmware.go +++ b/internal/boot/vmwaretest/vmware.go @@ -11,11 +11,11 @@ import ( "strings" // importing the packages registers these cli commands - "github.com/vmware/govmomi/govc/cli" - _ "github.com/vmware/govmomi/govc/datastore" - _ "github.com/vmware/govmomi/govc/importx" - _ "github.com/vmware/govmomi/govc/vm" - _ "github.com/vmware/govmomi/govc/vm/guest" + "github.com/vmware/govmomi/cli" + _ "github.com/vmware/govmomi/cli/datastore" + _ "github.com/vmware/govmomi/cli/importx" + _ "github.com/vmware/govmomi/cli/vm" + _ "github.com/vmware/govmomi/cli/vm/guest" ) const WaitTimeout = 6000 // in seconds diff --git a/internal/upload/vmware/vmware.go b/internal/upload/vmware/vmware.go index d2a9b52ac..ead378708 100644 --- a/internal/upload/vmware/vmware.go +++ b/internal/upload/vmware/vmware.go @@ -3,8 +3,8 @@ package vmware import ( "fmt" - "github.com/vmware/govmomi/govc/cli" - _ "github.com/vmware/govmomi/govc/importx" + "github.com/vmware/govmomi/cli" + _ "github.com/vmware/govmomi/cli/importx" ) type Credentials struct { diff --git a/vendor/github.com/vmware/govmomi/.goreleaser.yml b/vendor/github.com/vmware/govmomi/.goreleaser.yml index de6ced253..a359fc975 100644 --- a/vendor/github.com/vmware/govmomi/.goreleaser.yml +++ b/vendor/github.com/vmware/govmomi/.goreleaser.yml @@ -17,8 +17,9 @@ builds: - s390x env: - CGO_ENABLED=0 - - PKGPATH=github.com/vmware/govmomi/govc/flags - main: ./govc/main.go + - PKGPATH=github.com/vmware/govmomi/cli/flags + dir: ./govc + main: . binary: govc ldflags: - "-X {{.Env.PKGPATH}}.BuildVersion={{.Version}} -X {{.Env.PKGPATH}}.BuildCommit={{.ShortCommit}} -X {{.Env.PKGPATH}}.BuildDate={{.Date}}" @@ -28,7 +29,8 @@ builds: goarch: *goarch-defs env: - CGO_ENABLED=0 - main: ./vcsim/main.go + dir: ./vcsim + main: . binary: vcsim ldflags: - "-X main.buildVersion={{.Version}} -X main.buildCommit={{.ShortCommit}} -X main.buildDate={{.Date}}" @@ -90,49 +92,6 @@ changelog: - Merge pull request - Merge branch -# upload disabled since it is maintained in homebrew-core -brews: - - name: govc - ids: - - govcbuild - repository: - owner: govmomi - name: homebrew-tap - # TODO: create token in specified tap repo, add as secret to govmomi repo and reference in release workflow - # token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }}" - # enable once we do fully automated releases - skip_upload: true - commit_author: - name: Alfred the Narwhal - email: cna-alfred@vmware.com - directory: Formula - homepage: "https://github.com/vmware/govmomi/blob/main/govc/README.md" - description: "govc is a vSphere CLI built on top of govmomi." - test: | - system "#{bin}/govc version" - install: | - bin.install "govc" - - name: vcsim - ids: - - vcsimbuild - repository: - owner: govmomi - name: homebrew-tap - # TODO: create token in specified tap repo, add as secret to govmomi repo and reference in release workflow - # token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }}" - # enable once we do fully automated releases - skip_upload: true - commit_author: - name: Alfred the Narwhal - email: cna-alfred@vmware.com - directory: Formula - homepage: "https://github.com/vmware/govmomi/blob/main/vcsim/README.md" - description: "vcsim is a vSphere API simulator built on top of govmomi." - test: | - system "#{bin}/vcsim -h" - install: | - bin.install "vcsim" - dockers: - image_templates: - "vmware/govc:{{ .Tag }}" diff --git a/vendor/github.com/vmware/govmomi/.mailmap b/vendor/github.com/vmware/govmomi/.mailmap index dd869e10f..a0c1afcba 100644 --- a/vendor/github.com/vmware/govmomi/.mailmap +++ b/vendor/github.com/vmware/govmomi/.mailmap @@ -57,3 +57,9 @@ Yun Zhou <41678287+gh05tn0va@users.noreply.github.com> Zach G zach96guan Zach Tucker Zee Yang +Arunesh Pandey Arunesh Pandey +Eric Cao Eric Cao <32748317+ericvmw@users.noreply.github.com> +Eric Cao Eric Cao +Ryan Johnson Ryan Johnson +Stoyan Zhelyazkov Stoyan Zhelyazkov <156204153+spacegospod@users.noreply.github.com> +Yanlei Zhao Yanlei Zhao <136122252+yanleizhao-vmware@users.noreply.github.com> diff --git a/vendor/github.com/vmware/govmomi/CHANGELOG.md b/vendor/github.com/vmware/govmomi/CHANGELOG.md index 254f540f1..3e7c2d446 100644 --- a/vendor/github.com/vmware/govmomi/CHANGELOG.md +++ b/vendor/github.com/vmware/govmomi/CHANGELOG.md @@ -1,4 +1,559 @@ + +## [Release v0.43.0](https://github.com/vmware/govmomi/compare/v0.42.0...v0.43.0) + +> Release Date: 2024-09-10 + +### 🐞 Fix + +- [97aa7214] vcsim: avoid possible race when encoding PropertyCollector response +- [ad2d3573] use complete InventoryPath in Datacenter.Folders + +### 💫 API Changes + +- [476704a3] Fault helpers +- [caad54aa] add VirtualMachine.AddDeviceWithProfile method +- [a316da5c] VirtualMachine.AttachDisk unitNumber param is optional +- [8491321a] ToString for vim types +- [64610213] add namespace.RegisterVM binding +- [e602029e] Fix panic when encoding nil iface ptrs to JSON + +### 💫 `govc` (CLI) + +- [8fd86912] add disk.create '-profile' flag +- [ea3cf257] add vm.disk.create '-profile' flag +- [e73c34fa] add vm.disk.attach '-profile' flag +- [06dcf31a] Add '-size' flag to datastore.create +- [23390c23] add namespace.registervm command +- [1892eecd] Support thick/eager disk opts on vm.create + +### 💫 `vcsim` (Simulator) + +- [8421b678] Support PlaceVm with relocate placement type +- [9234233e] Support PlaceVm with reconfigure placement type +- [f06d0834] add VirtualMachine AttachDisk and DetachDisk methods +- [35dc193f] Support VM crypto spec in vC Sim +- [0517b87e] add namespace/registervm implementation + +### 🧹 Chore + +- [b17abb20] Update version.go for v0.43.0 +- [93da4a20] sync generated govc/USAGE.md +- [51105db8] govc: add common StorageProfileFlag + +### ⚠️ BREAKING + +VirtualMachine.AttachDisk unitNumber param is optional [a316da5c]: +switching from int32 to *int32, otherwise the client must choose a valid unitNumber. +vCenter will choose a unitNumber when not provided. + +### 📖 Commits + +- [b17abb20] chore: Update version.go for v0.43.0 +- [476704a3] api: Fault helpers +- [8421b678] vcsim: Support PlaceVm with relocate placement type +- [93b97e18] Update library state info to content library API +- [9234233e] vcsim: Support PlaceVm with reconfigure placement type +- [a2cbe108] build(deps): bump golang.org/x/text from 0.17.0 to 0.18.0 +- [93da4a20] chore: sync generated govc/USAGE.md +- [8fd86912] govc: add disk.create '-profile' flag +- [ea3cf257] govc: add vm.disk.create '-profile' flag +- [e73c34fa] govc: add vm.disk.attach '-profile' flag +- [51105db8] chore: govc: add common StorageProfileFlag +- [caad54aa] api: add VirtualMachine.AddDeviceWithProfile method +- [f06d0834] vcsim: add VirtualMachine AttachDisk and DetachDisk methods +- [97aa7214] fix: vcsim: avoid possible race when encoding PropertyCollector response +- [014a150b] build(deps): bump peter-evans/create-pull-request from 6 to 7 +- [35dc193f] vcsim: Support VM crypto spec in vC Sim +- [a56e33d3] Add BackingDiskPath to BackingObjectDetails +- [06dcf31a] govc: Add '-size' flag to datastore.create +- [f881d9b6] govc add disk.attach and disk.detach commands +- [a316da5c] api: VirtualMachine.AttachDisk unitNumber param is optional +- [8491321a] api: ToString for vim types +- [0517b87e] vcsim: add namespace/registervm implementation +- [23390c23] govc: add namespace.registervm command +- [64610213] api: add namespace.RegisterVM binding +- [e602029e] api: Fix panic when encoding nil iface ptrs to JSON +- [1892eecd] govc: Support thick/eager disk opts on vm.create +- [ad2d3573] fix: use complete InventoryPath in Datacenter.Folders + + +## [Release v0.42.0](https://github.com/vmware/govmomi/compare/v0.41.0...v0.42.0) + +> Release Date: 2024-08-16 + +### 💫 API Changes + +- [3fd16f78] update eam bindings to include authentication schema with eam-vcenter build 24075398 Closes: 3521 + +### 🧹 Chore + +- [7a7c0646] Update version.go for v0.42.0 + +### ⚠️ BREAKING + +### 📖 Commits + +- [7a7c0646] chore: Update version.go for v0.42.0 +- [3fd16f78] api: update eam bindings to include authentication schema with eam-vcenter build 24075398 Closes: 3521 + + +## [Release v0.41.0](https://github.com/vmware/govmomi/compare/v0.40.0...v0.41.0) + +> Release Date: 2024-08-16 + +### 💫 API Changes + +- [5a036494] OptionValues IsTrue|IsFalse + +### 🧹 Chore + +- [a6cdbd4c] Update version.go for v0.41.0 + +### ⚠️ BREAKING + +### 📖 Commits + +- [a6cdbd4c] chore: Update version.go for v0.41.0 +- [5a036494] api: OptionValues IsTrue|IsFalse + + +## [Release v0.40.0](https://github.com/vmware/govmomi/compare/v0.39.0...v0.40.0) + +> Release Date: 2024-08-12 + +### 🐞 Fix + +- [15d5ffdb] govc object.collect truncation +- [18e43541] govc: output Message field for 'EventEx' types +- [11dc5a39] restore govc import.spec DiskProvisioning default value + +### 💡 Examples + +- [eea1d299] add ExampleCollector_WaitForUpdatesEx_pagination + +### 💫 API Changes + +- [d035dc72] add session.Manager.ImpersonateUser method +- [ea3e806f] add alarm package with helpers for AlarmManager and Alarms +- [208d532c] convert vSAN directory name to uuid in ResolveLibraryItemStorage + +### 💫 `govc` (CLI) + +- [0917e718] add session.login '-as' flag to impersonate user +- [d6a3b614] add alarm commands +- [2975ade1] add event.post command +- [db6e9623] add library.sync '-f' flag to force sync file content +- [cc02310c] add library.info -S flag + +### 💫 `vcsim` (Simulator) + +- [ee966a69] add SessionManager.ImpersonateUser method +- [5a501b50] implement WaitForUpdatesEx pagination support +- [9c282108] add AlarmManager +- [db40be6b] fix panic in CancelTask +- [e63f1272] add ovf DiskProvisioning validation +- [0633de5c] add DatastoreNamespaceManager + +### 🧹 Chore + +- [6e27ff34] Update version.go for v0.40.0 + +### ⚠️ BREAKING + +### 📖 Commits + +- [6e27ff34] chore: Update version.go for v0.40.0 +- [eea1d299] examples: add ExampleCollector_WaitForUpdatesEx_pagination +- [ee966a69] vcsim: add SessionManager.ImpersonateUser method +- [0917e718] govc: add session.login '-as' flag to impersonate user +- [d035dc72] api: add session.Manager.ImpersonateUser method +- [15d5ffdb] fix: govc object.collect truncation +- [5a501b50] vcsim: implement WaitForUpdatesEx pagination support +- [9c282108] vcsim: add AlarmManager +- [d6a3b614] govc: add alarm commands +- [ea3e806f] api: add alarm package with helpers for AlarmManager and Alarms +- [2975ade1] govc: add event.post command +- [18e43541] fix: govc: output Message field for 'EventEx' types +- [6f998780] build(deps): bump golang.org/x/text from 0.16.0 to 0.17.0 +- [db40be6b] vcsim: fix panic in CancelTask +- [db6e9623] govc: add library.sync '-f' flag to force sync file content +- [11dc5a39] fix: restore govc import.spec DiskProvisioning default value +- [e63f1272] vcsim: add ovf DiskProvisioning validation +- [208d532c] api: convert vSAN directory name to uuid in ResolveLibraryItemStorage +- [0633de5c] vcsim: add DatastoreNamespaceManager +- [cc02310c] govc: add library.info -S flag +- [0d6a605c] review feedback +- [2957bedf] review feedback +- [8e509dfb] implement capacityAllocationUnits parser + + +## [Release v0.39.0](https://github.com/vmware/govmomi/compare/v0.38.0...v0.39.0) + +> Release Date: 2024-07-22 + +### 🐞 Fix + +- [1bc3a4a4] handle base types by default in mo.LoadObjectContent + +### 💫 API Changes + +- [5c0af375] use CheckTestType in compat and provisioning checkers +- [2e77836c] add sata controller +- [bdb034ee] Exporting Unit field in MetricSeries struct for external use +- [78f07c63] Add simulator test for GetVirtualDiskInfoByUUID +- [2d16e19f] GetVirtualDiskInfoByUUID for getting capacity/size info +- [29b1bce9] change CoresPerNumaNode to a pointer type +- [3139de32] Add a method for extending VMDK +- [6096c0d4] add ResolveLibraryItemStorage + +### 💫 `govc` (CLI) + +- [04fe4c26] add vm.check commands +- [976bca3b] add '-spec' flag to vm clone, migrate and create commands +- [d92015c4] add vm.migrate -net flag + +### 💫 `vcsim` (Simulator) + +- [eb2e1ea1] add VmCompatibilityChecker and VmProvisioningChecker +- [a463e543] Add support for DRS automation levels +- [f7a85a81] Re-enable TenantManager + +### 🧹 Chore + +- [590c92b1] Update version.go for v0.39.0 +- [4434e26b] bump go version +- [d7e27099] fix codeql ([#3492](https://github.com/vmware/govmomi/issues/3492)) +- [fb6e5977] fix codeql + +### ⚠️ BREAKING + +### 📖 Commits + +- [590c92b1] chore: Update version.go for v0.39.0 +- [5c0af375] api: use CheckTestType in compat and provisioning checkers +- [2e77836c] api: add sata controller +- [bdb034ee] api: Exporting Unit field in MetricSeries struct for external use +- [4434e26b] chore: bump go version +- [04fe4c26] govc: add vm.check commands +- [976bca3b] govc: add '-spec' flag to vm clone, migrate and create commands +- [d92015c4] govc: add vm.migrate -net flag +- [eb2e1ea1] vcsim: add VmCompatibilityChecker and VmProvisioningChecker +- [12467b00] refactor: make importing templates available as a lib +- [d7e27099] chore: fix codeql ([#3492](https://github.com/vmware/govmomi/issues/3492)) +- [fb6e5977] chore: fix codeql +- [a463e543] vcsim: Add support for DRS automation levels +- [78f07c63] api: Add simulator test for GetVirtualDiskInfoByUUID +- [2d16e19f] api: GetVirtualDiskInfoByUUID for getting capacity/size info +- [29b1bce9] api: change CoresPerNumaNode to a pointer type +- [3139de32] api: Add a method for extending VMDK +- [6096c0d4] api: add ResolveLibraryItemStorage +- [1bc3a4a4] fix: handle base types by default in mo.LoadObjectContent +- [f7a85a81] vcsim: Re-enable TenantManager + + +## [Release v0.38.0](https://github.com/vmware/govmomi/compare/v0.37.3...v0.38.0) + +> Release Date: 2024-06-24 + +### 🐞 Fix + +- [22607cd8] xml marshal byte array fields as vCenter does +- [298cfbf3] govc vm.disk.change should only modify CapacityInBytes + +### 💫 API Changes + +- [0de9553a] EnsureDisksHaveControllers helper +- [3d70ab5c] OptionValueList helper +- [d80136a5] add storage_specs field to Namespace related structures +- [748043cd] add pbm.DatastoreMap for finding compatible Datastores +- [fc2a6b12] HardwareVersion.IsSupported vs IsValid +- [a68c21f2] Add library item storage APIs +- [7d1be3e7] Update ConfigInfoToConfigSpec +- [12ab4099] Update generated types +- [45aa2e92] add checksum validation in Content Library update session file API +- [7a00a0b4] Generate enum consts with Values funcs +- [f2852e39] add SSLCertificate to TransferEndpoint in content library API + +### 💫 `govc` (CLI) + +- [c3c5ffba] add vsan.info -file-service-enabled flag +- [a916df4e] add host.tpm.info and host.tpm.report commands +- [7f0c9f0c] add host.cert.info -show flag +- [ae316d65] add storage.policy.create zonal option +- [3e648db2] add '-storage' flag to namespace.create and namespace.update commands +- [e7d54f90] add vm.create '-profile' and '-place' flags +- [5677b0e5] Add feature to pass fullname and org for windows vm customization + +### 💫 `vcsim` (Simulator) + +- [e9f4cb73] add vSAN FileServiceConfig support +- [072011c6] add HostCertificateManager +- [a0bbbf3f] add library item storage API support +- [3b7ff25f] add PropertyCollector index support +- [651f7d27] fix: ignore unknown refs in Datacenter.PowerOnMultiVM +- [7251db75] Add PbmCheckCompatibility method in pbm simulator +- [542398a2] add HostVirtualNicManager +- [0be5fec8] fix ReconfigVM validation when changing disk size + +### 🧹 Chore + +- [51648874] Update version.go for v0.38.0 +- [43510fbc] make doc +- [36631314] govc: use generated enum lists + +### ⚠️ BREAKING + +HardwareVersion.IsSupported vs IsValid [fc2a6b12]: +HardwareVersion.IsValid is more relaxed, consider IsSupported +* HardwareVersion.IsValid returns true if the specified value + matches a VMX version format. +* HardwareVersion.IsSupported behaves how IsValid used to behave. + +### 📖 Commits + +- [51648874] chore: Update version.go for v0.38.0 +- [c3c5ffba] govc: add vsan.info -file-service-enabled flag +- [e9f4cb73] vcsim: add vSAN FileServiceConfig support +- [43510fbc] chore: make doc +- [a916df4e] govc: add host.tpm.info and host.tpm.report commands +- [072011c6] vcsim: add HostCertificateManager +- [7f0c9f0c] govc: add host.cert.info -show flag +- [22607cd8] fix: xml marshal byte array fields as vCenter does +- [ae316d65] govc: add storage.policy.create zonal option +- [0de9553a] api: EnsureDisksHaveControllers helper +- [3d70ab5c] api: OptionValueList helper +- [3e648db2] govc: add '-storage' flag to namespace.create and namespace.update commands +- [d80136a5] api: add storage_specs field to Namespace related structures +- [e7d54f90] govc: add vm.create '-profile' and '-place' flags +- [748043cd] api: add pbm.DatastoreMap for finding compatible Datastores +- [5677b0e5] govc: Add feature to pass fullname and org for windows vm customization +- [298cfbf3] fix: govc vm.disk.change should only modify CapacityInBytes +- [ee49793c] build(deps): bump goreleaser/goreleaser-action from 5 to 6 +- [a0bbbf3f] vcsim: add library item storage API support +- [1ec975ca] nfc: Record the SSL thumbprint for the host the (device) URL refers to +- [3b7ff25f] vcsim: add PropertyCollector index support +- [651f7d27] vcsim: fix: ignore unknown refs in Datacenter.PowerOnMultiVM +- [fc2a6b12] api: HardwareVersion.IsSupported vs IsValid +- [1edfbe3b] feat: vSphere Zones API bindings +- [a68c21f2] api: Add library item storage APIs +- [b20c733e] build(deps): bump nokogiri from 1.16.2 to 1.16.5 in /gen +- [7d1be3e7] api: Update ConfigInfoToConfigSpec +- [12ab4099] api: Update generated types +- [7251db75] vcsim: Add PbmCheckCompatibility method in pbm simulator +- [45aa2e92] api: add checksum validation in Content Library update session file API +- [542398a2] vcsim: add HostVirtualNicManager +- [36631314] chore: govc: use generated enum lists +- [7a00a0b4] api: Generate enum consts with Values funcs +- [0be5fec8] vcsim: fix ReconfigVM validation when changing disk size +- [f2852e39] api: add SSLCertificate to TransferEndpoint in content library API +- [12f8babe] build(deps): bump chuhlomin/render-template from 1.9 to 1.10 +- [0893552e] bugfix: Exclude ServerGUID from MOR comparison in WaitEx + + +## [Release v0.37.3](https://github.com/vmware/govmomi/compare/v0.37.2...v0.37.3) + +> Release Date: 2024-06-05 + +### 🧹 Chore + +- [6b391d35] Update version.go for v0.37.3 + +### ⚠️ BREAKING + +### 📖 Commits + +- [6b391d35] chore: Update version.go for v0.37.3 +- [a554e040] nfc: Record the SSL thumbprint for the host the (device) URL refers to + + +## [Release v0.37.2](https://github.com/vmware/govmomi/compare/v0.37.1...v0.37.2) + +> Release Date: 2024-05-09 + +### 💫 API Changes + +- [37269b6a] add checksum validation in Content Library update session file API +- [ce7ef70a] add SSLCertificate to TransferEndpoint in content library API + +### 💫 `vcsim` (Simulator) + +- [6a0d7e7d] Add PbmCheckCompatibility method in pbm simulator +- [e6fe159b] fix ReconfigVM validation when changing disk size + +### 🧹 Chore + +- [9a1b3c8f] Update version.go for v0.37.2 + +### ⚠️ BREAKING + +### 📖 Commits + +- [9a1b3c8f] chore: Update version.go for v0.37.2 +- [6a0d7e7d] vcsim: Add PbmCheckCompatibility method in pbm simulator +- [37269b6a] api: add checksum validation in Content Library update session file API +- [e6fe159b] vcsim: fix ReconfigVM validation when changing disk size +- [ce7ef70a] api: add SSLCertificate to TransferEndpoint in content library API + + +## [Release v0.37.1](https://github.com/vmware/govmomi/compare/v0.37.0...v0.37.1) + +> Release Date: 2024-04-18 + +### 🧹 Chore + +- [bf28314d] Update version.go for v0.37.1 + +### ⚠️ BREAKING + +### 📖 Commits + +- [bf28314d] chore: Update version.go for v0.37.1 +- [8c99cb85] bugfix: Exclude ServerGUID from MOR comparison in WaitEx + + +## [Release v0.37.0](https://github.com/vmware/govmomi/compare/v0.36.3...v0.37.0) + +> Release Date: 2024-04-12 + +### 🐞 Fix + +- [095f926b] make cns.Client independent of vim25.Client +- [dcf063cd] vcsim: re-parent children in ResourcePool.Destroy +- [7455935a] endpoint url to bypass lookup service if envoy sidecar enabled +- [83754772] lookup client to use envoy sidecar url if enabled + +### 💫 API Changes + +- [f5080d3e] use RetrievePropertiesEx in mo package functions +- [a0a8257a] change RetrieveProperties to collect results in batches +- [367c55fe] move vim25.Client.UseServiceVersion to soap.Client +- [f6710489] Expose vSphere API to evict subscribed content library +- [3784b2f2] Add Downloadendpoint field in the library item file struct + +### 💫 `govc` (CLI) + +- [9285e441] Add library.evict command +- [fc20e24d] add default output formatting for namespace commands +- [27824cf5] snapshot.tree json output to stdout + +### 💫 `vcsim` (Simulator) + +- [70a7617d] toggle Content Library cached fields in sync and evict calls +- [cf719441] add ExtensionManager.FindExtension method +- [4348bd9f] RetrievePropertiesEx & ContinueRetrievePropertiesEx +- [4cec0597] add TaskHistoryCollector support +- [9c59e9c5] add TaskManager.CreateTask support +- [d9af2a26] add ExtensionManager support + +### 📃 Documentation + +- [368d194a] update CHANGELOG +- [2bbe81af] update CONTRIBUTORS + +### 🧹 Chore + +- [134152d4] Update version.go for v0.37.0 + +### ⚠️ BREAKING + +### 📖 Commits + +- [134152d4] chore: Update version.go for v0.37.0 +- [70a7617d] vcsim: toggle Content Library cached fields in sync and evict calls +- [9285e441] govc: Add library.evict command +- [cf719441] vcsim: add ExtensionManager.FindExtension method +- [92a29ebf] build(deps): add vcsim to rpm +- [fc20e24d] govc: add default output formatting for namespace commands +- [095f926b] fix: make cns.Client independent of vim25.Client +- [f5080d3e] api: use RetrievePropertiesEx in mo package functions +- [4348bd9f] vcsim: RetrievePropertiesEx & ContinueRetrievePropertiesEx +- [a0a8257a] api: change RetrieveProperties to collect results in batches +- [8a618f77] feat: Add VAPI bindings for guest namespaces and virtual machine classes +- [e66065ab] build(deps): enable rpm builds and add archs +- [367c55fe] api: move vim25.Client.UseServiceVersion to soap.Client +- [f6710489] api: Expose vSphere API to evict subscribed content library +- [dcf063cd] fix: vcsim: re-parent children in ResourcePool.Destroy +- [4cec0597] vcsim: add TaskHistoryCollector support +- [041fd59a] Remove deprecation for task.Wait and task.WaitForResult +- [27824cf5] govc: snapshot.tree json output to stdout +- [7455935a] fix: endpoint url to bypass lookup service if envoy sidecar enabled +- [3784b2f2] api: Add Downloadendpoint field in the library item file struct +- [9c59e9c5] vcsim: add TaskManager.CreateTask support +- [d9af2a26] vcsim: add ExtensionManager support +- [e0ab2da2] build(deps): bump google.golang.org/protobuf in /hack/tools +- [8bfb252c] Add support for SHA256 thumbprint based vCenter authentication +- [83754772] fix: lookup client to use envoy sidecar url if enabled +- [368d194a] docs: update CHANGELOG +- [2bbe81af] docs: update CONTRIBUTORS + + +## [Release v0.36.3](https://github.com/vmware/govmomi/compare/v0.36.2...v0.36.3) + +> Release Date: 2024-04-02 + +### 🧹 Chore + +- [35df9f35] Update version.go for v0.36.3 + +### ⚠️ BREAKING + +### 📖 Commits + +- [35df9f35] chore: Update version.go for v0.36.3 +- [47c5ff94] Remove deprecation for task.Wait and task.WaitForResult + + +## [Release v0.36.2](https://github.com/vmware/govmomi/compare/v0.36.1...v0.36.2) + +> Release Date: 2024-03-27 + +### 🐞 Fix + +- [9c5fca64] endpoint url to bypass lookup service if envoy sidecar enabled + +### 💫 API Changes + +- [f9e1a48e] Add Downloadendpoint field in the library item file struct + +### 💫 `govc` (CLI) + +- [cd9ce0ae] snapshot.tree json output to stdout + +### 🧹 Chore + +- [f2a87d75] Update version.go for v0.36.2 + +### ⚠️ BREAKING + +### 📖 Commits + +- [f2a87d75] chore: Update version.go for v0.36.2 +- [cd9ce0ae] govc: snapshot.tree json output to stdout +- [9c5fca64] fix: endpoint url to bypass lookup service if envoy sidecar enabled +- [f9e1a48e] api: Add Downloadendpoint field in the library item file struct + + +## [Release v0.36.1](https://github.com/vmware/govmomi/compare/v0.36.0...v0.36.1) + +> Release Date: 2024-03-12 + +### 🐞 Fix + +- [edf70dc3] lookup client to use envoy sidecar url if enabled + +### 🧹 Chore + +- [cc533e4b] Update version.go for v0.36.1 + +### ⚠️ BREAKING + +### 📖 Commits + +- [cc533e4b] chore: Update version.go for v0.36.1 +- [27996347] Add support for SHA256 thumbprint based vCenter authentication +- [edf70dc3] fix: lookup client to use envoy sidecar url if enabled + ## [Release v0.36.0](https://github.com/vmware/govmomi/compare/v0.35.0...v0.36.0) diff --git a/vendor/github.com/vmware/govmomi/CONTRIBUTING.md b/vendor/github.com/vmware/govmomi/CONTRIBUTING.md index 038e5321b..7166d6069 100644 --- a/vendor/github.com/vmware/govmomi/CONTRIBUTING.md +++ b/vendor/github.com/vmware/govmomi/CONTRIBUTING.md @@ -1,5 +1,11 @@ # Contributing to `govmomi` +tl;dr + +- Sign your commits, unless you've signed the CLA +- Include a component `prefix:` in your commit message, if applicable +- Squash fixup commits and force push to your branch + ## Getting started First, fork the repository on GitHub to your personal account. @@ -27,6 +33,7 @@ This is a rough outline of what a contributor's workflow looks like: - Create an issue describing the feature/fix - Create a topic branch from where you want to base your work. - Make commits of logical units. +- [Sign](#sign-off-your-work) your commits. - Make sure your commit messages are in the proper format (see below). - Push your changes to a topic branch in your fork of the repository. - Submit a pull request to `vmware/govmomi`. @@ -38,12 +45,30 @@ and **supported prefixes**, e.g. `govc: `. > my!](https://www.mgasch.com/2021/05/git-basics/) for more details on how to > successfully contribute to an open source project. +### Sign-off Your Work + +Use the [Developer Certificate of Origin](https://developercertificate.org/) (DCO) on all Pull Requests. +By adding this line to their commit messages, contributors *sign-off* that they adhere to the requirements of the DCO. + +Git provides the `-s` command-line option to append the required line +automatically to the commit message: + +```bash +git commit -s -m 'This is my commit message' +``` + +For an existing commit, you can also use this option with `--amend`: + +```bash +git commit -s --amend +``` + ### Example 1 - Fix a Bug in `govmomi` ```bash git checkout -b issue- main git add -git commit -m "fix: ..." -m "Closes: #" +git commit -s -m "fix: ..." -m "Closes: #" git push $USER issue- ``` @@ -52,7 +77,7 @@ git push $USER issue- ```bash git checkout -b issue- main git add -git commit -m "Add API ..." -m "Closes: #" +git commit -s -m "Add API ..." -m "Closes: #" git push $USER issue- ``` @@ -61,10 +86,10 @@ git push $USER issue- ```bash git checkout -b issue- main git add -git commit -m "govc: Add feature ..." -m "Closes: #" +git commit -s -m "govc: Add feature ..." -m "Closes: #" git push $USER issue- ``` -**Note**: +**Note**: To register the new `govc` command package, add a blank `_` import to `govmomi/govc/main.go`. ### Example 4 - Fix a Bug in `vcsim` @@ -72,7 +97,7 @@ To register the new `govc` command package, add a blank `_` import to `govmomi/g ```bash git checkout -b issue- main git add -git commit -m "vcsim: Fix ..." -m "Closes: #" +git commit -s -m "vcsim: Fix ..." -m "Closes: #" git push $USER issue- ``` @@ -80,7 +105,7 @@ git push $USER issue- Breaking changes, e.g. to the `govmomi` APIs, are highlighted in the `CHANGELOG` and release notes when the keyword `BREAKING:` is used in the commit message -body. +body. The text after `BREAKING:` is used in the corresponding highlighted section. Thus these details should be stated at the body of the commit message. @@ -89,7 +114,7 @@ Multi-line strings are supported. ```bash git checkout -b issue- main git add -cat << EOF | git commit -F - +cat << EOF | git commit -s -F - Add ctx to funcXYZ This commit introduces context.Context to function XYZ @@ -127,7 +152,7 @@ directly instead. git add . # create a fixup commit which will be merged into your (original) -git commit --fixup +git commit -s --fixup git push $USER issue- ``` @@ -162,7 +187,7 @@ e.g. `Closes: #`. The [`CHANGELOG.md`](./CHANGELOG.md) and release page uses **commit message prefixes** for grouping and highlighting. A commit message that starts with `[prefix:] ` will place this commit under the respective -section in the `CHANGELOG`. +section in the `CHANGELOG`. The following example creates a commit referencing the `issue: 1234` and puts the commit message in the `govc` `CHANGELOG` section: @@ -186,7 +211,7 @@ is recommended to break up your commits using distinct prefixes. ### Running CI Checks and Tests You can run both `make check` and `make test` from the top level of the -repository. +repository. While `make check` will catch formatting and import errors, it will not apply any fixes. The developer is expected to do that. diff --git a/vendor/github.com/vmware/govmomi/CONTRIBUTORS b/vendor/github.com/vmware/govmomi/CONTRIBUTORS index 03ca7c2f9..7d132852d 100644 --- a/vendor/github.com/vmware/govmomi/CONTRIBUTORS +++ b/vendor/github.com/vmware/govmomi/CONTRIBUTORS @@ -8,6 +8,7 @@ abrarshivani Adam Chalkley Adam Fowler Adam Shannon +Adnan Baruni Akanksha Panse Al Biheiri Alessandro Cortiana @@ -24,6 +25,7 @@ Andrew Andrew Chin Andrew Kutz Andrey Klimentyev +aneesurrehman001 <55150455+aneesurrehman001@users.noreply.github.com> Anfernee Yongkun Gui angystardust aniketGslab @@ -32,6 +34,7 @@ Ankit Vaidya Ankur Huralikoppi Anna Carrigan Antony Saba +Anusha Ramineni Ariel Chinn Arran Walker Artem Anisimov @@ -46,6 +49,7 @@ Ben Vickers Benjamin Davini Benjamin Peterson Benjamin Vickers +Bernd Zeimetz Bhavya Choudhary Bob Killen Brad Fitzpatrick @@ -57,6 +61,7 @@ Bruno Meneguello <1322552+bkmeneguello@users.noreply.github.com> Bryan Venteicher C S P Nanda Carsten Grohmann +Chebrolu Cheng Cheng Chethan Venkatesh Choudhury Sarada Prasanna Nanda @@ -82,6 +87,7 @@ Davide Agnello Davinder Kumar Defa demarey +Derek Beard Deric Crago Deyan Popov Dinesh Bhat <35480850+dbhat-arkin@users.noreply.github.com> @@ -92,12 +98,14 @@ Doug MacEachern East <60801291+houfangdong@users.noreply.github.com> Eloy Coto Eng Zer Jun +Eric Cao Eric Edens Eric Graham <16710890+Pheric@users.noreply.github.com> Eric Gray Eric Yutao Erik Hollensbe Erik Lund +Erim Erdal Essodjolo KAHANAM Ethan Kaley Evan Chu @@ -121,6 +129,7 @@ Hasan Mahmood Haydon Ryan Heiko Reese Henrik Hodne +Himanshu Ranjan hkumar Hrabur Stoyanov hui luo @@ -135,10 +144,12 @@ Jeremy Canady jeremy-clerc Jiatong Wang jingyizPensando +jitinkumar94 Jonas Ausevicius Jorge Sevilla Joseph LeBlanc João Pereira +Jukka Lehtniemi Julien PILLON Justin J. Novack kayrus @@ -155,6 +166,7 @@ Liping Xue liron.levin Louie Jiang Lubron Zhan +Luis Davim Luther Monson Madanagopal Arunachalam makelarisjr <8687447+makelarisjr@users.noreply.github.com> @@ -209,16 +221,19 @@ Robin Watkins Rowan Jacobs Roy Ling rsikdar +rubinthomasdev runner.mei Ryan Johnson S R Ashrith S.Çağlar Onur Saad Malik +Sai Diliyaer Sam Zhu samzhu333 <45263849+samzhu333@users.noreply.github.com> Sandeep Pissay Srinivasa Rao schmikei Scott Holden +Sebastian Mitterle Sergey Ignatov serokles shahra @@ -229,6 +244,7 @@ shylasrinivas sky-joker smaftoul smahadik +Sreeja Acharya Sten Feldman Stepan Mazurov Steve Purcell @@ -264,6 +280,7 @@ xing-yang xinyanw409 Yang Yang yangxi +Yanlei Zhao Yann Hodique Yash Nitin Desai Yassine TIJANI diff --git a/vendor/github.com/vmware/govmomi/Makefile b/vendor/github.com/vmware/govmomi/Makefile index 0f31649af..2d13dc993 100644 --- a/vendor/github.com/vmware/govmomi/Makefile +++ b/vendor/github.com/vmware/govmomi/Makefile @@ -94,13 +94,21 @@ install: ## Install govc and vcsim ## Generate ## -------------------------------------- -.PHONY: mod -mod: ## Runs go mod tidy to validate modules - go mod tidy -v +GO_MOD_FILES := $(filter-out ./hack/tools/go.mod,$(shell find . -name go.mod)) +GO_MOD_OP := tidy -.PHONY: mod-get -mod-get: ## Downloads and caches the modules - go mod download +.PHONY: $(GO_MOD_FILES) +$(GO_MOD_FILES): + go -C $(@D) mod $(GO_MOD_OP) + +.PHONY: mod +mod: $(GO_MOD_FILES) +mod: ## Validates the modules + +.PHONY: modules-download +mod-download: GO_MOD_OP=download +mod-download: $(GO_MOD_FILES) +mod-download: ## Downloads and caches the modules .PHONY: doc doc: install diff --git a/vendor/github.com/vmware/govmomi/README.md b/vendor/github.com/vmware/govmomi/README.md index 13ba3bf30..070714d03 100644 --- a/vendor/github.com/vmware/govmomi/README.md +++ b/vendor/github.com/vmware/govmomi/README.md @@ -19,9 +19,7 @@ In addition to the vSphere API client, this repository includes: ## Compatibility -This library supports vCenter Server and ESXi versions following the [VMware Product Lifecycle Matrix][reference-lifecycle]. - -Product versions that are end of support may work, but are not officially supported. +vSphere 7.0 and higher. ## Documentation @@ -37,10 +35,7 @@ Installation instructions, released binaries, and Docker images are documented i ## Discussion -The project encourages the community to collaborate using GitHub [issues][govmomi-github-issues], GitHub [discussions][govmomi-github-discussions], and [Slack][slack-channel]. - -> **Note** -> Access to Slack requires a free [VMware {code}][slack-join] developer program membership. +Collaborate with the community using GitHub [discussions][govmomi-github-discussions] and GitHub [issues][govmomi-github-issues]. ## Status @@ -48,29 +43,8 @@ Changes to the API are subject to [semantic versioning][reference-semver]. Refer to the [CHANGELOG][govmomi-changelog] for version to version changes. -## Notable Projects Using govmomi - -* [collectd-vsphere][project-travisci-collectd-vsphere] -* [Docker LinuxKit][project-docker-linuxKit] -* [Elastic Agent VMware vSphere integration][project-elastic-agent] -* [Gru][project-gru] -* [Juju][project-juju] -* [Jupiter Brain][project-travisci-jupiter-brain] -* [Kubernetes vSphere Cloud Provider][project-k8s-cloud-provider] -* [Kubernetes Cluster API][project-k8s-cluster-api] -* [OPS][project-nanovms-ops] -* [OpenTelemetry Collector Contrib][opentelemetry-collector-contrib] -* [Packer Plugin for VMware vSphere][project-hashicorp-packer-plugin-vsphere] -* [Rancher][project-rancher] -* [Terraform Provider for VMware vSphere][project-hashicorp-terraform-provider-vsphere] -* [Telegraf][project-influxdata-telegraf] -* [VMware Event Broker Appliance][project-vmware-veba] -* [VMware vSphere Integrated Containers Engine][project-vmware-vic] -* [VMware vSphere 7.0][project-vmware-vsphere] - ## Related Projects -* [go-vmware-nsxt][reference-go-vmware-nsxt] * [pyvmomi][reference-pyvmomi] * [rbvmomi][reference-rbvmomi] @@ -80,7 +54,7 @@ govmomi is available under the [Apache 2 License][govmomi-license]. ## Name -Pronounced: _go·​v·​mom·​ie_ +Pronounced: _go·​v·​mom·​e_ Follows pyvmomi and rbvmomi: language prefix + the vSphere acronym "VM Object Management Infrastructure". @@ -97,31 +71,10 @@ Follows pyvmomi and rbvmomi: language prefix + the vSphere acronym "VM Object Ma [go-reference]: https://pkg.go.dev/github.com/vmware/govmomi [go-report-card]: https://goreportcard.com/report/github.com/vmware/govmomi [go-version]: https://github.com/vmware/govmomi -[opentelemetry-collector-contrib]: https://github.com/open-telemetry/opentelemetry-collector-contrib -[project-docker-linuxKit]: https://github.com/linuxkit/linuxkit/tree/master/src/cmd/linuxkit -[project-elastic-agent]: https://github.com/elastic/integrations/tree/main/packages/vsphere -[project-gru]: https://github.com/dnaeon/gru -[project-hashicorp-packer-plugin-vsphere]: https://github.com/hashicorp/packer-plugin-vsphere -[project-hashicorp-terraform-provider-vsphere]: https://github.com/hashicorp/terraform-provider-vsphere -[project-influxdata-telegraf]: https://github.com/influxdata/telegraf/tree/master/plugins/inputs/vsphere -[project-juju]: https://github.com/juju/juju -[project-k8s-cloud-provider]: https://github.com/kubernetes/cloud-provider-vsphere -[project-k8s-cluster-api]: https://github.com/kubernetes-sigs/cluster-api-provider-vsphere -[project-nanovms-ops]: https://github.com/nanovms/ops -[project-rancher]: https://github.com/rancher/rancher/blob/master/pkg/api/norman/customization/vsphere/listers.go -[project-travisci-collectd-vsphere]: https://github.com/travis-ci/collectd-vsphere -[project-travisci-jupiter-brain]: https://github.com/travis-ci/jupiter-brain -[project-vmware-veba]: https://github.com/vmware-samples/vcenter-event-broker-appliance/tree/development/vmware-event-router -[project-vmware-vic]: https://github.com/vmware/vic -[project-vmware-vsphere]: https://docs.vmware.com/en/VMware-vSphere/7.0/rn/vsphere-esxi-vcenter-server-7-vsphere-with-kubernetes-release-notes.html -[reference-api]: https://developer.vmware.com/apis/968/vsphere -[reference-godoc]: http://godoc.org/github.com/vmware/govmomi -[reference-go-vmware-nsxt]: https://github.com/vmware/go-vmware-nsxt -[reference-lifecycle]: https://lifecycle.vmware.com +[reference-api]: https://developer.broadcom.com/xapis/vsphere-web-services-api/latest/ +[reference-godoc]: https://pkg.go.dev/github.com/vmware/govmomi [reference-pyvmomi]: https://github.com/vmware/pyvmomi [reference-rbvmomi]: https://github.com/vmware/rbvmomi [reference-semver]: http://semver.org -[slack-join]: https://developer.vmware.com/join/ -[slack-channel]: https://vmwarecode.slack.com/messages/govmomi [toolbox]: toolbox/README.md [vcsim]: vcsim/README.md diff --git a/vendor/github.com/vmware/govmomi/USAGE.md b/vendor/github.com/vmware/govmomi/USAGE.md deleted file mode 100644 index e69de29bb..000000000 diff --git a/vendor/github.com/vmware/govmomi/govc/cli/command.go b/vendor/github.com/vmware/govmomi/cli/command.go similarity index 98% rename from vendor/github.com/vmware/govmomi/govc/cli/command.go rename to vendor/github.com/vmware/govmomi/cli/command.go index ef468c622..e1ebcb61a 100644 --- a/vendor/github.com/vmware/govmomi/govc/cli/command.go +++ b/vendor/github.com/vmware/govmomi/cli/command.go @@ -65,7 +65,7 @@ It is licensed under the Apache License, Version 2.0 The available commands are listed below. A detailed description of each command can be displayed with "govc -h". The description of all -commands can be also found at https://via.vmw.com/GJ98hk . +commands can be also found at https://github.com/vmware/govmomi/blob/main/govc/USAGE.md. Examples: show usage of a command: govc -h diff --git a/vendor/github.com/vmware/govmomi/govc/datastore/cp.go b/vendor/github.com/vmware/govmomi/cli/datastore/cp.go similarity index 97% rename from vendor/github.com/vmware/govmomi/govc/datastore/cp.go rename to vendor/github.com/vmware/govmomi/cli/datastore/cp.go index e9fc774b9..42c8e29da 100644 --- a/vendor/github.com/vmware/govmomi/govc/datastore/cp.go +++ b/vendor/github.com/vmware/govmomi/cli/datastore/cp.go @@ -21,8 +21,8 @@ import ( "flag" "fmt" - "github.com/vmware/govmomi/govc/cli" - "github.com/vmware/govmomi/govc/flags" + "github.com/vmware/govmomi/cli" + "github.com/vmware/govmomi/cli/flags" "github.com/vmware/govmomi/object" ) diff --git a/vendor/github.com/vmware/govmomi/govc/datastore/create.go b/vendor/github.com/vmware/govmomi/cli/datastore/create.go similarity index 89% rename from vendor/github.com/vmware/govmomi/govc/datastore/create.go rename to vendor/github.com/vmware/govmomi/cli/datastore/create.go index a3f78d653..02a95b6c0 100644 --- a/vendor/github.com/vmware/govmomi/govc/datastore/create.go +++ b/vendor/github.com/vmware/govmomi/cli/datastore/create.go @@ -25,13 +25,19 @@ import ( "path/filepath" "strings" - "github.com/vmware/govmomi/govc/cli" - "github.com/vmware/govmomi/govc/flags" + "github.com/vmware/govmomi/cli" + "github.com/vmware/govmomi/cli/flags" "github.com/vmware/govmomi/object" + "github.com/vmware/govmomi/units" "github.com/vmware/govmomi/vim25/soap" "github.com/vmware/govmomi/vim25/types" ) +const ( + sectorSize = 512 // Sector size in bytes + startSector = 2048 // Start sector (typically fixed) +) + type create struct { *flags.HostSystemFlag @@ -50,6 +56,7 @@ type create struct { // Options for VMFS DiskCanonicalName string Version *int32 + Size units.ByteSize // Options for local Path string @@ -144,6 +151,7 @@ func (cmd *create) Register(ctx context.Context, f *flag.FlagSet) { // Options for VMFS f.StringVar(&cmd.DiskCanonicalName, "disk", "", "Canonical name of disk (VMFS only)") f.Var(flags.NewOptionalInt32(&cmd.Version), "version", "VMFS major version") + f.Var(&cmd.Size, "size", "Size of new disk. Default is to use entire disk") // Options for Local f.StringVar(&cmd.Path, "path", "", "Local directory path for the datastore (local only)") @@ -165,7 +173,8 @@ func (cmd *create) Description() string { Examples: govc datastore.create -type nfs -name nfsDatastore -remote-host 10.143.2.232 -remote-path /share cluster1 - govc datastore.create -type vmfs -name vmfsDatastore -disk=mpx.vmhba0:C0:T0:L0 cluster1 + govc datastore.create -type vmfs -name vmfsDatastore -disk=mpx.vmhba0:C0:T0:L0 cluster1 # use entire disk + govc datastore.create -type vmfs -name vmfsDatastore -disk=mpx.vmhba0:C0:T0:L0 -size 20G cluster1 # use 20G of disk govc datastore.create -type local -name localDatastore -path /var/datastore host1` } @@ -289,6 +298,12 @@ func (cmd *create) CreateVmfsDatastore(ctx context.Context, hosts []*object.Host spec := *option.Spec.(*types.VmfsDatastoreCreateSpec) spec.Vmfs.VolumeName = cmd.Name + if cmd.Size > 0 { + endSector := CalculateSectors(int64(cmd.Size)) + // set values for Sectors + spec.Partition.Partition[0].StartSector = startSector + spec.Partition.Partition[0].EndSector = endSector + } if cmd.Version != nil { spec.Vmfs.MajorVersion = *cmd.Version } @@ -301,6 +316,14 @@ func (cmd *create) CreateVmfsDatastore(ctx context.Context, hosts []*object.Host return nil } +// CalculateSectors calculates the start and end sectors based on the given size. +func CalculateSectors(sizeInBytes int64) (endSector int64) { + totalSectors := sizeInBytes / sectorSize + endSector = startSector + totalSectors - 1 + + return endSector +} + func (cmd *create) CreateLocalDatastore(ctx context.Context, hosts []*object.HostSystem) error { for _, host := range hosts { ds, err := host.ConfigManager().DatastoreSystem(ctx) diff --git a/vendor/github.com/vmware/govmomi/govc/datastore/download.go b/vendor/github.com/vmware/govmomi/cli/datastore/download.go similarity index 62% rename from vendor/github.com/vmware/govmomi/govc/datastore/download.go rename to vendor/github.com/vmware/govmomi/cli/datastore/download.go index bb4cb8e7d..dc21edb3d 100644 --- a/vendor/github.com/vmware/govmomi/govc/datastore/download.go +++ b/vendor/github.com/vmware/govmomi/cli/datastore/download.go @@ -1,18 +1,6 @@ -/* -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. -*/ +// © Broadcom. All Rights Reserved. +// The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. +// SPDX-License-Identifier: Apache-2.0 package datastore @@ -23,10 +11,14 @@ import ( "fmt" "io" "os" + "path" - "github.com/vmware/govmomi/govc/cli" - "github.com/vmware/govmomi/govc/flags" + "github.com/vmware/govmomi/cli" + "github.com/vmware/govmomi/cli/flags" + "github.com/vmware/govmomi/object" + "github.com/vmware/govmomi/ovf" "github.com/vmware/govmomi/vim25/soap" + "github.com/vmware/govmomi/vmdk" ) type download struct { @@ -67,7 +59,10 @@ If DEST name is "-", source is written to stdout. Examples: govc datastore.download vm-name/vmware.log ./local.log - govc datastore.download vm-name/vmware.log - | grep -i error` + govc datastore.download vm-name/vmware.log - | grep -i error + govc datastore.download -json vm-name/vm-name.vmdk - | jq .ddb + ovf=$(govc library.info -l -L vmservice/photon-5.0/*.ovf) + govc datastore.download -json "$ovf" - | jq -r .diskSection.disk[].capacity` } func (cmd *download) Run(ctx context.Context, f *flag.FlagSet) error { @@ -76,6 +71,16 @@ func (cmd *download) Run(ctx context.Context, f *flag.FlagSet) error { return errors.New("invalid arguments") } + src := args[0] + dst := args[1] + + var dp object.DatastorePath + if dp.FromString(src) { + // e.g. `govc library.info -l -L ...` + cmd.DatastoreFlag.Name = dp.Datastore + src = dp.Path + } + ds, err := cmd.Datastore() if err != nil { return err @@ -95,14 +100,29 @@ func (cmd *download) Run(ctx context.Context, f *flag.FlagSet) error { p := soap.DefaultDownload - src := args[0] - dst := args[1] - if dst == "-" { f, _, err := ds.Download(ctx, src, &p) if err != nil { return err } + + if cmd.DatastoreFlag.All() { + switch path.Ext(src) { + case ".vmdk": + data, err := vmdk.ParseDescriptor(f) + if err != nil { + return err + } + return cmd.DatastoreFlag.WriteResult(data) + case ".ovf": + data, err := ovf.Unmarshal(f) + if err != nil { + return err + } + return cmd.DatastoreFlag.WriteResult(data) + } + } + _, err = io.Copy(os.Stdout, f) return err } diff --git a/vendor/github.com/vmware/govmomi/govc/datastore/info.go b/vendor/github.com/vmware/govmomi/cli/datastore/info.go similarity index 93% rename from vendor/github.com/vmware/govmomi/govc/datastore/info.go rename to vendor/github.com/vmware/govmomi/cli/datastore/info.go index 0c3b3c6a3..7c2cf0421 100644 --- a/vendor/github.com/vmware/govmomi/govc/datastore/info.go +++ b/vendor/github.com/vmware/govmomi/cli/datastore/info.go @@ -1,5 +1,5 @@ /* -Copyright (c) 2015-2023 VMware, Inc. All Rights Reserved. +Copyright (c) 2015-2024 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. @@ -24,8 +24,8 @@ import ( "os" "text/tabwriter" - "github.com/vmware/govmomi/govc/cli" - "github.com/vmware/govmomi/govc/flags" + "github.com/vmware/govmomi/cli" + "github.com/vmware/govmomi/cli/flags" "github.com/vmware/govmomi/object" "github.com/vmware/govmomi/property" "github.com/vmware/govmomi/vim25/mo" @@ -81,9 +81,9 @@ Examples: govc datastore.info govc datastore.info vsanDatastore # info on Datastores shared between cluster hosts: - govc object.collect -s -d " " /dc1/host/k8s-cluster host | xargs govc datastore.info -H + govc collect -s -d " " /dc1/host/k8s-cluster host | xargs govc datastore.info -H # info on Datastores shared between VM hosts: - govc ls /dc1/vm/*k8s* | xargs -n1 -I% govc object.collect -s % summary.runtime.host | xargs govc datastore.info -H` + govc ls /dc1/vm/*k8s* | xargs -n1 -I% govc collect -s % summary.runtime.host | xargs govc datastore.info -H` } func intersect(common []types.ManagedObjectReference, refs []types.ManagedObjectReference) []types.ManagedObjectReference { diff --git a/vendor/github.com/vmware/govmomi/govc/datastore/ls.go b/vendor/github.com/vmware/govmomi/cli/datastore/ls.go similarity index 91% rename from vendor/github.com/vmware/govmomi/govc/datastore/ls.go rename to vendor/github.com/vmware/govmomi/cli/datastore/ls.go index 48bf19dc3..888fd2570 100644 --- a/vendor/github.com/vmware/govmomi/govc/datastore/ls.go +++ b/vendor/github.com/vmware/govmomi/cli/datastore/ls.go @@ -1,11 +1,11 @@ /* -Copyright (c) 2014-2016 VMware, Inc. All Rights Reserved. +Copyright (c) 2014-2024 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 +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, @@ -26,8 +26,9 @@ import ( "strings" "text/tabwriter" - "github.com/vmware/govmomi/govc/cli" - "github.com/vmware/govmomi/govc/flags" + "github.com/vmware/govmomi/cli" + "github.com/vmware/govmomi/cli/flags" + "github.com/vmware/govmomi/fault" "github.com/vmware/govmomi/object" "github.com/vmware/govmomi/units" "github.com/vmware/govmomi/vim25/types" @@ -41,6 +42,7 @@ type ls struct { slash bool all bool recurse bool + human bool } func init() { @@ -54,6 +56,7 @@ func (cmd *ls) Register(ctx context.Context, f *flag.FlagSet) { cmd.OutputFlag, ctx = flags.NewOutputFlag(ctx) cmd.OutputFlag.Register(ctx, f) + f.BoolVar(&cmd.human, "H", true, "Display human friendly name") // vSAN top-level dirs are ID by default f.BoolVar(&cmd.long, "l", false, "Long listing format") f.BoolVar(&cmd.slash, "p", false, "Append / indicator to directories") f.BoolVar(&cmd.all, "a", false, "Do not ignore entries starting with .") @@ -75,14 +78,7 @@ func (cmd *ls) Usage() string { } func isInvalid(err error) bool { - if f, ok := err.(types.HasFault); ok { - switch f.Fault().(type) { - case *types.InvalidArgument: - return true - } - } - - return false + return fault.Is(err, &types.InvalidArgument{}) } func (cmd *ls) Run(ctx context.Context, f *flag.FlagSet) error { @@ -212,10 +208,17 @@ func (o *listOutput) add(r types.HostDatastoreBrowserSearchResults) { res.File = nil for _, f := range r.File { - if f.GetFileInfo().Path[0] == '.' && !o.cmd.all { + info := f.GetFileInfo() + if info.Path[0] == '.' && !o.cmd.all { continue } + if o.cmd.human { + if info.FriendlyName != "" { + info.Path = info.FriendlyName + } + } + if o.cmd.slash { if d, ok := f.(*types.FolderFileInfo); ok { d.Path += "/" diff --git a/vendor/github.com/vmware/govmomi/govc/datastore/mkdir.go b/vendor/github.com/vmware/govmomi/cli/datastore/mkdir.go similarity index 85% rename from vendor/github.com/vmware/govmomi/govc/datastore/mkdir.go rename to vendor/github.com/vmware/govmomi/cli/datastore/mkdir.go index 7cc21e766..11abd3b42 100644 --- a/vendor/github.com/vmware/govmomi/govc/datastore/mkdir.go +++ b/vendor/github.com/vmware/govmomi/cli/datastore/mkdir.go @@ -1,11 +1,11 @@ /* -Copyright (c) 2014-2015 VMware, Inc. All Rights Reserved. +Copyright (c) 2014-2024 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 +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, @@ -22,10 +22,10 @@ import ( "flag" "fmt" - "github.com/vmware/govmomi/govc/cli" - "github.com/vmware/govmomi/govc/flags" + "github.com/vmware/govmomi/cli" + "github.com/vmware/govmomi/cli/flags" + "github.com/vmware/govmomi/fault" "github.com/vmware/govmomi/object" - "github.com/vmware/govmomi/vim25/soap" "github.com/vmware/govmomi/vim25/types" ) @@ -105,11 +105,8 @@ func (cmd *mkdir) Run(ctx context.Context, f *flag.FlagSet) error { // ignore EEXIST if -p flag is given if err != nil && cmd.createParents { - if soap.IsSoapFault(err) { - soapFault := soap.ToSoapFault(err) - if _, ok := soapFault.VimFault().(types.FileAlreadyExists); ok { - return nil - } + if fault.Is(err, &types.FileAlreadyExists{}) { + return nil } } } diff --git a/vendor/github.com/vmware/govmomi/govc/datastore/mv.go b/vendor/github.com/vmware/govmomi/cli/datastore/mv.go similarity index 97% rename from vendor/github.com/vmware/govmomi/govc/datastore/mv.go rename to vendor/github.com/vmware/govmomi/cli/datastore/mv.go index 91ce42ad2..5b395fa15 100644 --- a/vendor/github.com/vmware/govmomi/govc/datastore/mv.go +++ b/vendor/github.com/vmware/govmomi/cli/datastore/mv.go @@ -21,7 +21,7 @@ import ( "flag" "fmt" - "github.com/vmware/govmomi/govc/cli" + "github.com/vmware/govmomi/cli" ) type mv struct { diff --git a/vendor/github.com/vmware/govmomi/govc/datastore/remove.go b/vendor/github.com/vmware/govmomi/cli/datastore/remove.go similarity index 96% rename from vendor/github.com/vmware/govmomi/govc/datastore/remove.go rename to vendor/github.com/vmware/govmomi/cli/datastore/remove.go index 12ec9a467..d0ff57629 100644 --- a/vendor/github.com/vmware/govmomi/govc/datastore/remove.go +++ b/vendor/github.com/vmware/govmomi/cli/datastore/remove.go @@ -20,8 +20,8 @@ import ( "context" "flag" - "github.com/vmware/govmomi/govc/cli" - "github.com/vmware/govmomi/govc/flags" + "github.com/vmware/govmomi/cli" + "github.com/vmware/govmomi/cli/flags" ) type remove struct { diff --git a/vendor/github.com/vmware/govmomi/govc/datastore/rm.go b/vendor/github.com/vmware/govmomi/cli/datastore/rm.go similarity index 96% rename from vendor/github.com/vmware/govmomi/govc/datastore/rm.go rename to vendor/github.com/vmware/govmomi/cli/datastore/rm.go index 9c292024f..1bf232966 100644 --- a/vendor/github.com/vmware/govmomi/govc/datastore/rm.go +++ b/vendor/github.com/vmware/govmomi/cli/datastore/rm.go @@ -20,8 +20,8 @@ import ( "context" "flag" - "github.com/vmware/govmomi/govc/cli" - "github.com/vmware/govmomi/govc/flags" + "github.com/vmware/govmomi/cli" + "github.com/vmware/govmomi/cli/flags" "github.com/vmware/govmomi/object" "github.com/vmware/govmomi/vim25/types" ) diff --git a/vendor/github.com/vmware/govmomi/govc/datastore/tail.go b/vendor/github.com/vmware/govmomi/cli/datastore/tail.go similarity index 97% rename from vendor/github.com/vmware/govmomi/govc/datastore/tail.go rename to vendor/github.com/vmware/govmomi/cli/datastore/tail.go index 5e5ef6d54..4c40e0277 100644 --- a/vendor/github.com/vmware/govmomi/govc/datastore/tail.go +++ b/vendor/github.com/vmware/govmomi/cli/datastore/tail.go @@ -23,8 +23,8 @@ import ( "os" "time" - "github.com/vmware/govmomi/govc/cli" - "github.com/vmware/govmomi/govc/flags" + "github.com/vmware/govmomi/cli" + "github.com/vmware/govmomi/cli/flags" ) type tail struct { diff --git a/vendor/github.com/vmware/govmomi/govc/datastore/upload.go b/vendor/github.com/vmware/govmomi/cli/datastore/upload.go similarity index 96% rename from vendor/github.com/vmware/govmomi/govc/datastore/upload.go rename to vendor/github.com/vmware/govmomi/cli/datastore/upload.go index 2d9420d28..e4acf5e1f 100644 --- a/vendor/github.com/vmware/govmomi/govc/datastore/upload.go +++ b/vendor/github.com/vmware/govmomi/cli/datastore/upload.go @@ -22,8 +22,8 @@ import ( "flag" "os" - "github.com/vmware/govmomi/govc/cli" - "github.com/vmware/govmomi/govc/flags" + "github.com/vmware/govmomi/cli" + "github.com/vmware/govmomi/cli/flags" "github.com/vmware/govmomi/vim25/soap" ) diff --git a/vendor/github.com/vmware/govmomi/govc/host/esxcli/command.go b/vendor/github.com/vmware/govmomi/cli/esx/command.go similarity index 90% rename from vendor/github.com/vmware/govmomi/govc/host/esxcli/command.go rename to vendor/github.com/vmware/govmomi/cli/esx/command.go index f7db7aa76..1032269d4 100644 --- a/vendor/github.com/vmware/govmomi/govc/host/esxcli/command.go +++ b/vendor/github.com/vmware/govmomi/cli/esx/command.go @@ -1,5 +1,5 @@ /* -Copyright (c) 2014-2023 VMware, Inc. All Rights Reserved. +Copyright (c) 2014-2024 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. @@ -14,14 +14,13 @@ See the License for the specific language governing permissions and limitations under the License. */ -package esxcli +package esx import ( "flag" "fmt" "strings" - "github.com/vmware/govmomi/govc/flags" "github.com/vmware/govmomi/internal" ) @@ -57,7 +56,7 @@ type CommandInfoMethod struct { type CommandInfo struct { CommandInfoItem - Method []*CommandInfoMethod `xml:"method" json:"method"` + Method []CommandInfoMethod `xml:"method" json:"method"` } func NewCommand(args []string) *Command { @@ -91,11 +90,22 @@ func (c *Command) Moid() string { return "ha-cli-handler-" + strings.Join(c.name[:len(c.name)-1], "-") } +type stringList []string + +func (l *stringList) String() string { + return fmt.Sprint(*l) +} + +func (l *stringList) Set(value string) error { + *l = append(*l, value) + return nil +} + // Parse generates a flag.FlagSet based on the given []CommandInfoParam and // returns arguments for use with methods.ExecuteSoap func (c *Command) Parse(params []CommandInfoParam) ([]internal.ReflectManagedMethodExecuterSoapArgument, error) { fs := flag.NewFlagSet(strings.Join(c.name, " "), flag.ExitOnError) - vals := make([]flags.StringList, len(params)) + vals := make([]stringList, len(params)) for i, p := range params { v := &vals[i] diff --git a/vendor/github.com/vmware/govmomi/govc/host/esxcli/executor.go b/vendor/github.com/vmware/govmomi/cli/esx/executor.go similarity index 59% rename from vendor/github.com/vmware/govmomi/govc/host/esxcli/executor.go rename to vendor/github.com/vmware/govmomi/cli/esx/executor.go index d8b33a720..f5900c71b 100644 --- a/vendor/github.com/vmware/govmomi/govc/host/esxcli/executor.go +++ b/vendor/github.com/vmware/govmomi/cli/esx/executor.go @@ -1,5 +1,5 @@ /* -Copyright (c) 2014-2023 VMware, Inc. All Rights Reserved. +Copyright (c) 2014-2024 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. @@ -14,15 +14,16 @@ See the License for the specific language governing permissions and limitations under the License. */ -package esxcli +package esx import ( "context" "fmt" "github.com/vmware/govmomi/internal" - "github.com/vmware/govmomi/object" "github.com/vmware/govmomi/vim25" + "github.com/vmware/govmomi/vim25/mo" + "github.com/vmware/govmomi/vim25/types" "github.com/vmware/govmomi/vim25/xml" ) @@ -35,7 +36,7 @@ func (f Fault) Error() string { return f.Message } -func (f Fault) messageDetail() string { +func (f Fault) MessageDetail() string { if f.Detail != "" { return fmt.Sprintf("%s %s", f.Message, f.Detail) } @@ -45,14 +46,15 @@ func (f Fault) messageDetail() string { type Executor struct { c *vim25.Client - host *object.HostSystem + host mo.Reference mme *internal.ReflectManagedMethodExecuter dtm *internal.InternalDynamicTypeManager info map[string]*CommandInfo + + Trace func(*internal.ExecuteSoapRequest, *internal.ExecuteSoapResponse) } -func NewExecutor(c *vim25.Client, host *object.HostSystem) (*Executor, error) { - ctx := context.TODO() +func NewExecutor(ctx context.Context, c *vim25.Client, host mo.Reference) (*Executor, error) { e := &Executor{ c: c, host: host, @@ -88,42 +90,60 @@ func NewExecutor(c *vim25.Client, host *object.HostSystem) (*Executor, error) { return e, nil } -func (e *Executor) CommandInfo(c *Command) (*CommandInfoMethod, error) { +func (e *Executor) Client() *vim25.Client { + return e.c +} + +func (e *Executor) DynamicTypeManager() types.ManagedObjectReference { + return e.dtm.ManagedObjectReference +} + +func (e *Executor) CommandInfo(ctx context.Context, ns string) (*CommandInfo, error) { + info, ok := e.info[ns] + if ok { + return info, nil + } + + req := internal.ExecuteSoapRequest{ + Moid: "ha-dynamic-type-manager-local-cli-cliinfo", + Method: "vim.CLIInfo.FetchCLIInfo", + Argument: []internal.ReflectManagedMethodExecuterSoapArgument{ + NewCommand(nil).Argument("typeName", "vim.EsxCLI."+ns), + }, + } + + info = new(CommandInfo) + if err := e.Execute(ctx, &req, info); err != nil { + return nil, err + } + + e.info[ns] = info + + return info, nil +} + +func (e *Executor) CommandInfoMethod(ctx context.Context, c *Command) (*CommandInfoMethod, error) { ns := c.Namespace() - var info *CommandInfo - var ok bool - if info, ok = e.info[ns]; !ok { - req := internal.ExecuteSoapRequest{ - Moid: "ha-dynamic-type-manager-local-cli-cliinfo", - Method: "vim.CLIInfo.FetchCLIInfo", - Argument: []internal.ReflectManagedMethodExecuterSoapArgument{ - c.Argument("typeName", "vim.EsxCLI."+ns), - }, - } - - info = new(CommandInfo) - if err := e.Execute(&req, info); err != nil { - return nil, err - } - - e.info[ns] = info + info, err := e.CommandInfo(ctx, ns) + if err != nil { + return nil, err } name := c.Name() for _, method := range info.Method { if method.Name == name { - return method, nil + return &method, nil } } return nil, fmt.Errorf("method '%s' not found in name space '%s'", name, c.Namespace()) } -func (e *Executor) NewRequest(args []string) (*internal.ExecuteSoapRequest, *CommandInfoMethod, error) { +func (e *Executor) NewRequest(ctx context.Context, args []string) (*internal.ExecuteSoapRequest, *CommandInfoMethod, error) { c := NewCommand(args) - info, err := e.CommandInfo(c) + info, err := e.CommandInfoMethod(ctx, c) if err != nil { return nil, nil, err } @@ -142,8 +162,7 @@ func (e *Executor) NewRequest(args []string) (*internal.ExecuteSoapRequest, *Com return &sreq, info, nil } -func (e *Executor) Execute(req *internal.ExecuteSoapRequest, res interface{}) error { - ctx := context.TODO() +func (e *Executor) Execute(ctx context.Context, req *internal.ExecuteSoapRequest, res interface{}) error { req.This = e.mme.ManagedObjectReference req.Version = "urn:vim25/5.0" @@ -152,6 +171,10 @@ func (e *Executor) Execute(req *internal.ExecuteSoapRequest, res interface{}) er return err } + if e.Trace != nil { + e.Trace(req, x) + } + if x.Returnval != nil { if x.Returnval.Fault != nil { return &Fault{ @@ -168,8 +191,8 @@ func (e *Executor) Execute(req *internal.ExecuteSoapRequest, res interface{}) er return nil } -func (e *Executor) Run(args []string) (*Response, error) { - req, info, err := e.NewRequest(args) +func (e *Executor) Run(ctx context.Context, args []string) (*Response, error) { + req, info, err := e.NewRequest(ctx, args) if err != nil { return nil, err } @@ -178,7 +201,7 @@ func (e *Executor) Run(args []string) (*Response, error) { Info: info, } - if err := e.Execute(req, res); err != nil { + if err := e.Execute(ctx, req, res); err != nil { return nil, err } diff --git a/vendor/github.com/vmware/govmomi/govc/host/esxcli/firewall_info.go b/vendor/github.com/vmware/govmomi/cli/esx/firewall_info.go similarity index 78% rename from vendor/github.com/vmware/govmomi/govc/host/esxcli/firewall_info.go rename to vendor/github.com/vmware/govmomi/cli/esx/firewall_info.go index d1a5134e7..3fcbc73c4 100644 --- a/vendor/github.com/vmware/govmomi/govc/host/esxcli/firewall_info.go +++ b/vendor/github.com/vmware/govmomi/cli/esx/firewall_info.go @@ -1,5 +1,5 @@ /* -Copyright (c) 2015-2023 VMware, Inc. All Rights Reserved. +Copyright (c) 2015-2024 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. @@ -14,9 +14,9 @@ See the License for the specific language governing permissions and limitations under the License. */ -package esxcli +package esx -import "github.com/vmware/govmomi/object" +import "context" type FirewallInfo struct { Loaded bool `json:"loaded"` @@ -27,13 +27,8 @@ type FirewallInfo struct { // GetFirewallInfo via 'esxcli network firewall get' // The HostFirewallSystem type does not expose this data. // This helper can be useful in particular to determine if the firewall is enabled or disabled. -func GetFirewallInfo(s *object.HostSystem) (*FirewallInfo, error) { - x, err := NewExecutor(s.Client(), s) - if err != nil { - return nil, err - } - - res, err := x.Run([]string{"network", "firewall", "get"}) +func (x *Executor) GetFirewallInfo(ctx context.Context) (*FirewallInfo, error) { + res, err := x.Run(ctx, []string{"network", "firewall", "get"}) if err != nil { return nil, err } diff --git a/vendor/github.com/vmware/govmomi/govc/host/esxcli/guest_info.go b/vendor/github.com/vmware/govmomi/cli/esx/guest_info.go similarity index 79% rename from vendor/github.com/vmware/govmomi/govc/host/esxcli/guest_info.go rename to vendor/github.com/vmware/govmomi/cli/esx/guest_info.go index c310a843d..30c2a540f 100644 --- a/vendor/github.com/vmware/govmomi/govc/host/esxcli/guest_info.go +++ b/vendor/github.com/vmware/govmomi/cli/esx/guest_info.go @@ -1,11 +1,11 @@ /* -Copyright (c) 2014-2015 VMware, Inc. All Rights Reserved. +Copyright (c) 2014-2024 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 +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, @@ -14,13 +14,12 @@ See the License for the specific language governing permissions and limitations under the License. */ -package esxcli +package esx import ( "context" "strings" - "github.com/vmware/govmomi/object" "github.com/vmware/govmomi/property" "github.com/vmware/govmomi/vim25" "github.com/vmware/govmomi/vim25/mo" @@ -44,20 +43,18 @@ func NewGuestInfo(c *vim25.Client) *GuestInfo { } } -func (g *GuestInfo) hostInfo(ref *types.ManagedObjectReference) (*hostInfo, error) { +func (g *GuestInfo) hostInfo(ctx context.Context, ref *types.ManagedObjectReference) (*hostInfo, error) { // cache exectuor and uuid -> worldid map if h, ok := g.hosts[ref.Value]; ok { return h, nil } - host := object.NewHostSystem(g.c, *ref) - - e, err := NewExecutor(g.c, host) + e, err := NewExecutor(ctx, g.c, ref) if err != nil { return nil, err } - res, err := e.Run([]string{"vm", "process", "list"}) + res, err := e.Run(ctx, []string{"vm", "process", "list"}) if err != nil { return nil, err } @@ -82,8 +79,7 @@ func (g *GuestInfo) hostInfo(ref *types.ManagedObjectReference) (*hostInfo, erro // ESX hosts must be configured with the /Net/GuestIPHack enabled. // For example: // $ govc host.esxcli -- system settings advanced set -o /Net/GuestIPHack -i 1 -func (g *GuestInfo) IpAddress(vm *object.VirtualMachine) (string, error) { - ctx := context.TODO() +func (g *GuestInfo) IpAddress(ctx context.Context, vm mo.Reference) (string, error) { const any = "0.0.0.0" var mvm mo.VirtualMachine @@ -93,7 +89,7 @@ func (g *GuestInfo) IpAddress(vm *object.VirtualMachine) (string, error) { return "", err } - h, err := g.hostInfo(mvm.Runtime.Host) + h, err := g.hostInfo(ctx, mvm.Runtime.Host) if err != nil { return "", err } @@ -102,7 +98,7 @@ func (g *GuestInfo) IpAddress(vm *object.VirtualMachine) (string, error) { uuid := strings.Replace(mvm.Config.Uuid, "-", "", -1) if wid, ok := h.wids[uuid]; ok { - res, err := h.Run([]string{"network", "vm", "port", "list", "--world-id", wid}) + res, err := h.Run(ctx, []string{"network", "vm", "port", "list", "--world-id", wid}) if err != nil { return "", err } diff --git a/vendor/github.com/vmware/govmomi/govc/host/esxcli/response.go b/vendor/github.com/vmware/govmomi/cli/esx/response.go similarity index 54% rename from vendor/github.com/vmware/govmomi/govc/host/esxcli/response.go rename to vendor/github.com/vmware/govmomi/cli/esx/response.go index 6a026cd53..26dfdb574 100644 --- a/vendor/github.com/vmware/govmomi/govc/host/esxcli/response.go +++ b/vendor/github.com/vmware/govmomi/cli/esx/response.go @@ -1,5 +1,5 @@ /* -Copyright (c) 2014-2023 VMware, Inc. All Rights Reserved. +Copyright (c) 2014-2024 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. @@ -13,7 +13,8 @@ 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 esxcli + +package esx import ( "io" @@ -27,6 +28,7 @@ type Response struct { Info *CommandInfoMethod `json:"info"` Values []Values `json:"values"` String string `json:"string"` + Kind string `json:"-"` } func (v Values) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { @@ -55,6 +57,37 @@ func (v Values) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { } } +func (s Values) MarshalXML(e *xml.Encoder, start xml.StartElement) error { + tokens := []xml.Token{start} + + for key, val := range s { + field := xml.StartElement{Name: xml.Name{Local: key}} + for _, v := range val { + tokens = append(tokens, field, xml.CharData(v), field.End()) + } + } + + tokens = append(tokens, start.End()) + + for _, t := range tokens { + err := e.EncodeToken(t) + if err != nil { + return err + } + } + + return nil +} + +func (v Values) Value(name string) string { + if val, ok := v[name]; ok { + if len(val) != 0 { + return val[0] + } + } + return "" +} + func (r *Response) Type(start xml.StartElement) string { for _, a := range start.Attr { if a.Name.Local == "type" { @@ -69,7 +102,7 @@ func (r *Response) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { if stype != "ArrayOfDataObject" { switch stype { - case "xsd:string": + case "xsd:string", "xsd:boolean", "xsd:long": return d.DecodeElement(&r.String, &start) } v := Values{} @@ -100,3 +133,56 @@ func (r *Response) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { } } } + +func (r *Response) MarshalXML(e *xml.Encoder, _ xml.StartElement) error { + kind := "ArrayOfDataObject" + native := r.String != "" + if native { + kind = "xsd:" + r.Kind + } + + start := xml.StartElement{ + Name: xml.Name{ + Space: "urn:vim25", + Local: "obj", + }, + Attr: []xml.Attr{ + { + Name: xml.Name{Local: "xmlns:xsd"}, + Value: "http://www.w3.org/2001/XMLSchema", + }, + { + Name: xml.Name{Local: "xmlns:xsi"}, + Value: "http://www.w3.org/2001/XMLSchema-instance", + }, + { + Name: xml.Name{Local: "xsi:type"}, + Value: kind, + }, + }, + } + + if err := e.EncodeToken(start); err != nil { + return err + } + + var err error + if native { + err = e.EncodeToken(xml.CharData(r.String)) + } else { + obj := xml.StartElement{ + Name: xml.Name{Local: "DataObject"}, + Attr: []xml.Attr{{ + Name: xml.Name{Local: "xsi:type"}, + Value: r.Kind, + }}, + } + err = e.EncodeElement(r.Values, obj) + } + + if err != nil { + return err + } + + return e.EncodeToken(start.End()) +} diff --git a/vendor/github.com/vmware/govmomi/govc/flags/client.go b/vendor/github.com/vmware/govmomi/cli/flags/client.go similarity index 87% rename from vendor/github.com/vmware/govmomi/govc/flags/client.go rename to vendor/github.com/vmware/govmomi/cli/flags/client.go index b36ebdf90..75ad62d0e 100644 --- a/vendor/github.com/vmware/govmomi/govc/flags/client.go +++ b/vendor/github.com/vmware/govmomi/cli/flags/client.go @@ -53,8 +53,6 @@ const ( envVimVersion = "GOVC_VIM_VERSION" envTLSCaCerts = "GOVC_TLS_CA_CERTS" envTLSKnownHosts = "GOVC_TLS_KNOWN_HOSTS" - - defaultMinVimVersion = "5.5" ) const cDescr = "ESX or vCenter URL" @@ -69,7 +67,6 @@ type ClientFlag struct { cert string key string persist bool - minAPIVersion string vimNamespace string vimVersion string tlsCaCerts string @@ -167,15 +164,6 @@ func (flag *ClientFlag) Register(ctx context.Context, f *flag.FlagSet) { f.BoolVar(&flag.persist, "persist-session", persist, usage) } - { - env := os.Getenv(envMinAPIVersion) - if env == "" { - env = defaultMinVimVersion - } - - flag.minAPIVersion = env - } - { value := os.Getenv(envVimNamespace) if value == "" { @@ -310,45 +298,6 @@ func (flag *ClientFlag) SetRootCAs(c *soap.Client) error { return nil } -func isDevelopmentVersion(apiVersion string) bool { - // Skip version check for development builds which can be in the form of "r4A70F" or "6.5.x" - return strings.Count(apiVersion, ".") == 0 || strings.HasSuffix(apiVersion, ".x") -} - -// apiVersionValid returns whether or not the API version supported by the -// server the client is connected to is not recent enough. -func apiVersionValid(c *vim25.Client, minVersionString string) error { - if minVersionString == "-" { - // Disable version check - return nil - } - - apiVersion := c.ServiceContent.About.ApiVersion - if isDevelopmentVersion(apiVersion) { - return nil - } - - realVersion, err := ParseVersion(apiVersion) - if err != nil { - return fmt.Errorf("error parsing API version %q: %s", apiVersion, err) - } - - minVersion, err := ParseVersion(minVersionString) - if err != nil { - return fmt.Errorf("error parsing %s=%q: %s", envMinAPIVersion, minVersionString, err) - } - - if !minVersion.Lte(realVersion) { - err = fmt.Errorf("require API version %q, connected to API version %q (set %s to override)", - minVersionString, - c.ServiceContent.About.ApiVersion, - envMinAPIVersion) - return err - } - - return nil -} - func (flag *ClientFlag) RoundTripper(c *soap.Client) soap.RoundTripper { // Retry twice when a temporary I/O error occurs. // This means a maximum of 3 attempts. @@ -375,13 +324,7 @@ func (flag *ClientFlag) Client() (*vim25.Client, error) { return nil, err } - // Check that the endpoint has the right API version - err = apiVersionValid(c, flag.minAPIVersion) - if err != nil { - return nil, err - } - - if flag.vimVersion == "" { + if flag.vimVersion == "" || flag.vimVersion == "-" { err = c.UseServiceVersion() if err != nil { return nil, err diff --git a/vendor/github.com/vmware/govmomi/govc/flags/cluster.go b/vendor/github.com/vmware/govmomi/cli/flags/cluster.go similarity index 100% rename from vendor/github.com/vmware/govmomi/govc/flags/cluster.go rename to vendor/github.com/vmware/govmomi/cli/flags/cluster.go diff --git a/vendor/github.com/vmware/govmomi/govc/flags/common.go b/vendor/github.com/vmware/govmomi/cli/flags/common.go similarity index 100% rename from vendor/github.com/vmware/govmomi/govc/flags/common.go rename to vendor/github.com/vmware/govmomi/cli/flags/common.go diff --git a/vendor/github.com/vmware/govmomi/govc/flags/datacenter.go b/vendor/github.com/vmware/govmomi/cli/flags/datacenter.go similarity index 94% rename from vendor/github.com/vmware/govmomi/govc/flags/datacenter.go rename to vendor/github.com/vmware/govmomi/cli/flags/datacenter.go index 7cfcef3bd..9d5e03ac0 100644 --- a/vendor/github.com/vmware/govmomi/govc/flags/datacenter.go +++ b/vendor/github.com/vmware/govmomi/cli/flags/datacenter.go @@ -1,11 +1,11 @@ /* -Copyright (c) 2014-2016 VMware, Inc. All Rights Reserved. +Copyright (c) 2014-2024 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 +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, @@ -197,16 +197,6 @@ func (flag *DatacenterFlag) ManagedObjects(ctx context.Context, args []string) ( } for _, arg := range args { - if ref := object.ReferenceFromString(arg); ref != nil { - // e.g. output from object.collect - refs = append(refs, *ref) - continue - } - - if !strings.Contains(arg, "/") { - return nil, fmt.Errorf("%q must be qualified with a path", arg) - } - elements, err := finder.ManagedObjectList(ctx, arg) if err != nil { return nil, err @@ -216,6 +206,10 @@ func (flag *DatacenterFlag) ManagedObjects(ctx context.Context, args []string) ( return nil, fmt.Errorf("object '%s' not found", arg) } + if len(elements) > 1 && !strings.Contains(arg, "/") { + return nil, fmt.Errorf("%q must be qualified with a path", arg) + } + for _, e := range elements { refs = append(refs, e.Object.Reference()) } diff --git a/vendor/github.com/vmware/govmomi/govc/flags/datastore.go b/vendor/github.com/vmware/govmomi/cli/flags/datastore.go similarity index 100% rename from vendor/github.com/vmware/govmomi/govc/flags/datastore.go rename to vendor/github.com/vmware/govmomi/cli/flags/datastore.go diff --git a/vendor/github.com/vmware/govmomi/govc/flags/debug.go b/vendor/github.com/vmware/govmomi/cli/flags/debug.go similarity index 98% rename from vendor/github.com/vmware/govmomi/govc/flags/debug.go rename to vendor/github.com/vmware/govmomi/cli/flags/debug.go index 702cf42e6..c48c002bd 100644 --- a/vendor/github.com/vmware/govmomi/govc/flags/debug.go +++ b/vendor/github.com/vmware/govmomi/cli/flags/debug.go @@ -1,11 +1,11 @@ /* -Copyright (c) 2014-2016 VMware, Inc. All Rights Reserved. +Copyright (c) 2014-2024 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 +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, @@ -331,7 +331,7 @@ func (v *verbose) propertyValue(obj types.ManagedObjectReference, name string, p val := v.value(pval) if obj.Type != "Task" && !strings.HasPrefix(obj.Value, "session") { if len(val) > 512 { - val = fmt.Sprintf("`govc object.collect -dump %s %s`", obj, name) + val = fmt.Sprintf("`govc collect -dump %s %s`", obj, name) } } return fmt.Sprintf("%s\t%s:\t%s", v.mor(obj), name, val) diff --git a/vendor/github.com/vmware/govmomi/govc/flags/empty.go b/vendor/github.com/vmware/govmomi/cli/flags/empty.go similarity index 100% rename from vendor/github.com/vmware/govmomi/govc/flags/empty.go rename to vendor/github.com/vmware/govmomi/cli/flags/empty.go diff --git a/vendor/github.com/vmware/govmomi/govc/flags/env.go b/vendor/github.com/vmware/govmomi/cli/flags/env.go similarity index 100% rename from vendor/github.com/vmware/govmomi/govc/flags/env.go rename to vendor/github.com/vmware/govmomi/cli/flags/env.go diff --git a/vendor/github.com/vmware/govmomi/govc/flags/folder.go b/vendor/github.com/vmware/govmomi/cli/flags/folder.go similarity index 100% rename from vendor/github.com/vmware/govmomi/govc/flags/folder.go rename to vendor/github.com/vmware/govmomi/cli/flags/folder.go diff --git a/vendor/github.com/vmware/govmomi/govc/flags/host_connect.go b/vendor/github.com/vmware/govmomi/cli/flags/host_connect.go similarity index 89% rename from vendor/github.com/vmware/govmomi/govc/flags/host_connect.go rename to vendor/github.com/vmware/govmomi/cli/flags/host_connect.go index c64e4368b..bd88fc7cc 100644 --- a/vendor/github.com/vmware/govmomi/govc/flags/host_connect.go +++ b/vendor/github.com/vmware/govmomi/cli/flags/host_connect.go @@ -1,11 +1,11 @@ /* -Copyright (c) 2015 VMware, Inc. All Rights Reserved. +Copyright (c) 2015-2024 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 +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, @@ -22,6 +22,7 @@ import ( "fmt" "net/url" + "github.com/vmware/govmomi/fault" "github.com/vmware/govmomi/object" "github.com/vmware/govmomi/vim25" "github.com/vmware/govmomi/vim25/types" @@ -85,15 +86,9 @@ func (flag *HostConnectFlag) Spec(c *vim25.Client) types.HostConnectSpec { // Fault checks if error is SSLVerifyFault, including the thumbprint if so func (flag *HostConnectFlag) Fault(err error) error { - if err == nil { - return nil - } - - if f, ok := err.(types.HasFault); ok { - switch fault := f.Fault().(type) { - case *types.SSLVerifyFault: - return fmt.Errorf("%s thumbprint=%s", err, fault.Thumbprint) - } + var verify *types.SSLVerifyFault + if _, ok := fault.As(err, &verify); ok { + return fmt.Errorf("%s thumbprint=%s", err, verify.Thumbprint) } return err diff --git a/vendor/github.com/vmware/govmomi/govc/flags/host_system.go b/vendor/github.com/vmware/govmomi/cli/flags/host_system.go similarity index 100% rename from vendor/github.com/vmware/govmomi/govc/flags/host_system.go rename to vendor/github.com/vmware/govmomi/cli/flags/host_system.go diff --git a/vendor/github.com/vmware/govmomi/govc/flags/int32.go b/vendor/github.com/vmware/govmomi/cli/flags/int32.go similarity index 100% rename from vendor/github.com/vmware/govmomi/govc/flags/int32.go rename to vendor/github.com/vmware/govmomi/cli/flags/int32.go diff --git a/vendor/github.com/vmware/govmomi/govc/flags/int64.go b/vendor/github.com/vmware/govmomi/cli/flags/int64.go similarity index 100% rename from vendor/github.com/vmware/govmomi/govc/flags/int64.go rename to vendor/github.com/vmware/govmomi/cli/flags/int64.go diff --git a/vendor/github.com/vmware/govmomi/govc/flags/library.go b/vendor/github.com/vmware/govmomi/cli/flags/library.go similarity index 100% rename from vendor/github.com/vmware/govmomi/govc/flags/library.go rename to vendor/github.com/vmware/govmomi/cli/flags/library.go diff --git a/vendor/github.com/vmware/govmomi/govc/flags/list.go b/vendor/github.com/vmware/govmomi/cli/flags/list.go similarity index 100% rename from vendor/github.com/vmware/govmomi/govc/flags/list.go rename to vendor/github.com/vmware/govmomi/cli/flags/list.go diff --git a/vendor/github.com/vmware/govmomi/govc/flags/network.go b/vendor/github.com/vmware/govmomi/cli/flags/network.go similarity index 100% rename from vendor/github.com/vmware/govmomi/govc/flags/network.go rename to vendor/github.com/vmware/govmomi/cli/flags/network.go diff --git a/vendor/github.com/vmware/govmomi/govc/flags/optional_bool.go b/vendor/github.com/vmware/govmomi/cli/flags/optional_bool.go similarity index 100% rename from vendor/github.com/vmware/govmomi/govc/flags/optional_bool.go rename to vendor/github.com/vmware/govmomi/cli/flags/optional_bool.go diff --git a/vendor/github.com/vmware/govmomi/govc/flags/optional_string.go b/vendor/github.com/vmware/govmomi/cli/flags/optional_string.go similarity index 100% rename from vendor/github.com/vmware/govmomi/govc/flags/optional_string.go rename to vendor/github.com/vmware/govmomi/cli/flags/optional_string.go diff --git a/vendor/github.com/vmware/govmomi/govc/flags/output.go b/vendor/github.com/vmware/govmomi/cli/flags/output.go similarity index 99% rename from vendor/github.com/vmware/govmomi/govc/flags/output.go rename to vendor/github.com/vmware/govmomi/cli/flags/output.go index 8975285e0..198db2c33 100644 --- a/vendor/github.com/vmware/govmomi/govc/flags/output.go +++ b/vendor/github.com/vmware/govmomi/cli/flags/output.go @@ -30,7 +30,7 @@ import ( "github.com/dougm/pretty" - "github.com/vmware/govmomi/govc/cli" + "github.com/vmware/govmomi/cli" "github.com/vmware/govmomi/task" "github.com/vmware/govmomi/vim25/progress" "github.com/vmware/govmomi/vim25/soap" diff --git a/vendor/github.com/vmware/govmomi/govc/flags/resource_allocation_info.go b/vendor/github.com/vmware/govmomi/cli/flags/resource_allocation_info.go similarity index 100% rename from vendor/github.com/vmware/govmomi/govc/flags/resource_allocation_info.go rename to vendor/github.com/vmware/govmomi/cli/flags/resource_allocation_info.go diff --git a/vendor/github.com/vmware/govmomi/govc/flags/resource_pool.go b/vendor/github.com/vmware/govmomi/cli/flags/resource_pool.go similarity index 100% rename from vendor/github.com/vmware/govmomi/govc/flags/resource_pool.go rename to vendor/github.com/vmware/govmomi/cli/flags/resource_pool.go diff --git a/vendor/github.com/vmware/govmomi/govc/flags/search.go b/vendor/github.com/vmware/govmomi/cli/flags/search.go similarity index 96% rename from vendor/github.com/vmware/govmomi/govc/flags/search.go rename to vendor/github.com/vmware/govmomi/cli/flags/search.go index ba884090a..f2ab71285 100644 --- a/vendor/github.com/vmware/govmomi/govc/flags/search.go +++ b/vendor/github.com/vmware/govmomi/cli/flags/search.go @@ -1,11 +1,11 @@ /* -Copyright (c) 2014-2016 VMware, Inc. All Rights Reserved. +Copyright (c) 2014-2024 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 +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, @@ -23,10 +23,10 @@ import ( "fmt" "strings" + "github.com/vmware/govmomi/fault" "github.com/vmware/govmomi/find" "github.com/vmware/govmomi/object" "github.com/vmware/govmomi/vim25" - "github.com/vmware/govmomi/vim25/soap" "github.com/vmware/govmomi/vim25/types" ) @@ -205,11 +205,8 @@ func (flag *SearchFlag) searchByUUID(c *vim25.Client, dc *object.Datacenter) (ob for _, iu := range []*bool{nil, types.NewBool(true)} { ref, err = flag.searchIndex(c).FindByUuid(ctx, dc, flag.byUUID, isVM, iu) if err != nil { - if soap.IsSoapFault(err) { - fault := soap.ToSoapFault(err).VimFault() - if _, ok := fault.(types.InvalidArgument); ok { - continue - } + if fault.Is(err, &types.InvalidArgument{}) { + continue } return nil, err } diff --git a/vendor/github.com/vmware/govmomi/govc/flags/storage_pod.go b/vendor/github.com/vmware/govmomi/cli/flags/storage_pod.go similarity index 100% rename from vendor/github.com/vmware/govmomi/govc/flags/storage_pod.go rename to vendor/github.com/vmware/govmomi/cli/flags/storage_pod.go diff --git a/vendor/github.com/vmware/govmomi/cli/flags/storage_profile.go b/vendor/github.com/vmware/govmomi/cli/flags/storage_profile.go new file mode 100644 index 000000000..3dc1dab35 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/cli/flags/storage_profile.go @@ -0,0 +1,124 @@ +/* +Copyright (c) 2024-2024 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 flags + +import ( + "context" + "errors" + "flag" + "fmt" + + "github.com/vmware/govmomi/vim25/types" +) + +type StorageProfileFlag struct { + *ClientFlag + + Name []string + + option string +} + +func NewStorageProfileFlag(ctx context.Context, option ...string) (*StorageProfileFlag, context.Context) { + v := &StorageProfileFlag{} + if len(option) == 1 { + v.option = option[0] + } else { + v.option = "profile" + } + v.ClientFlag, ctx = NewClientFlag(ctx) + return v, ctx +} + +func (e *StorageProfileFlag) String() string { + return fmt.Sprint(e.Name) +} + +func (e *StorageProfileFlag) Set(value string) error { + e.Name = append(e.Name, value) + return nil +} + +func (flag *StorageProfileFlag) Register(ctx context.Context, f *flag.FlagSet) { + flag.ClientFlag.Register(ctx, f) + + f.Var(flag, flag.option, "Storage profile name or ID") +} + +func (flag *StorageProfileFlag) StorageProfileList(ctx context.Context) ([]string, error) { + if len(flag.Name) == 0 { + return nil, nil + } + + c, err := flag.PbmClient() + if err != nil { + return nil, err + } + m, err := c.ProfileMap(ctx) + if err != nil { + return nil, err + } + + list := make([]string, len(flag.Name)) + + for i, name := range flag.Name { + p, ok := m.Name[name] + if !ok { + return nil, fmt.Errorf("storage profile %q not found", name) + } + + list[i] = p.GetPbmProfile().ProfileId.UniqueId + } + + return list, nil +} + +func (flag *StorageProfileFlag) StorageProfile(ctx context.Context) (string, error) { + switch len(flag.Name) { + case 0: + return "", nil + case 1: + default: + return "", errors.New("only 1 '-profile' can be specified") + } + + list, err := flag.StorageProfileList(ctx) + if err != nil { + return "", err + } + + return list[0], nil +} + +func (flag *StorageProfileFlag) StorageProfileSpec(ctx context.Context) ([]types.BaseVirtualMachineProfileSpec, error) { + if len(flag.Name) == 0 { + return nil, nil + } + + list, err := flag.StorageProfileList(ctx) + if err != nil { + return nil, err + } + + spec := make([]types.BaseVirtualMachineProfileSpec, len(list)) + for i, name := range list { + spec[i] = &types.VirtualMachineDefinedProfileSpec{ + ProfileId: name, + } + } + return spec, nil +} diff --git a/vendor/github.com/vmware/govmomi/govc/flags/version.go b/vendor/github.com/vmware/govmomi/cli/flags/version.go similarity index 100% rename from vendor/github.com/vmware/govmomi/govc/flags/version.go rename to vendor/github.com/vmware/govmomi/cli/flags/version.go diff --git a/vendor/github.com/vmware/govmomi/govc/flags/virtual_app.go b/vendor/github.com/vmware/govmomi/cli/flags/virtual_app.go similarity index 100% rename from vendor/github.com/vmware/govmomi/govc/flags/virtual_app.go rename to vendor/github.com/vmware/govmomi/cli/flags/virtual_app.go diff --git a/vendor/github.com/vmware/govmomi/govc/flags/virtual_machine.go b/vendor/github.com/vmware/govmomi/cli/flags/virtual_machine.go similarity index 100% rename from vendor/github.com/vmware/govmomi/govc/flags/virtual_machine.go rename to vendor/github.com/vmware/govmomi/cli/flags/virtual_machine.go diff --git a/vendor/github.com/vmware/govmomi/govc/importx/options.go b/vendor/github.com/vmware/govmomi/cli/importx/options.go similarity index 98% rename from vendor/github.com/vmware/govmomi/govc/importx/options.go rename to vendor/github.com/vmware/govmomi/cli/importx/options.go index ddea6e388..d56d81741 100644 --- a/vendor/github.com/vmware/govmomi/govc/importx/options.go +++ b/vendor/github.com/vmware/govmomi/cli/importx/options.go @@ -23,7 +23,7 @@ import ( "fmt" "os" - "github.com/vmware/govmomi/govc/flags" + "github.com/vmware/govmomi/cli/flags" "github.com/vmware/govmomi/object" "github.com/vmware/govmomi/ovf" "github.com/vmware/govmomi/ovf/importer" diff --git a/vendor/github.com/vmware/govmomi/govc/importx/ova.go b/vendor/github.com/vmware/govmomi/cli/importx/ova.go similarity index 97% rename from vendor/github.com/vmware/govmomi/govc/importx/ova.go rename to vendor/github.com/vmware/govmomi/cli/importx/ova.go index 67712050f..85c827c2c 100644 --- a/vendor/github.com/vmware/govmomi/govc/importx/ova.go +++ b/vendor/github.com/vmware/govmomi/cli/importx/ova.go @@ -20,7 +20,7 @@ import ( "context" "flag" - "github.com/vmware/govmomi/govc/cli" + "github.com/vmware/govmomi/cli" "github.com/vmware/govmomi/object" "github.com/vmware/govmomi/ovf/importer" "github.com/vmware/govmomi/vim25/types" diff --git a/vendor/github.com/vmware/govmomi/govc/importx/ovf.go b/vendor/github.com/vmware/govmomi/cli/importx/ovf.go similarity index 98% rename from vendor/github.com/vmware/govmomi/govc/importx/ovf.go rename to vendor/github.com/vmware/govmomi/cli/importx/ovf.go index c903fc9a1..b55895f6a 100644 --- a/vendor/github.com/vmware/govmomi/govc/importx/ovf.go +++ b/vendor/github.com/vmware/govmomi/cli/importx/ovf.go @@ -21,8 +21,8 @@ import ( "errors" "flag" - "github.com/vmware/govmomi/govc/cli" - "github.com/vmware/govmomi/govc/flags" + "github.com/vmware/govmomi/cli" + "github.com/vmware/govmomi/cli/flags" "github.com/vmware/govmomi/object" "github.com/vmware/govmomi/ovf/importer" ) diff --git a/vendor/github.com/vmware/govmomi/govc/importx/spec.go b/vendor/github.com/vmware/govmomi/cli/importx/spec.go similarity index 96% rename from vendor/github.com/vmware/govmomi/govc/importx/spec.go rename to vendor/github.com/vmware/govmomi/cli/importx/spec.go index 01dcf0b69..58230e227 100644 --- a/vendor/github.com/vmware/govmomi/govc/importx/spec.go +++ b/vendor/github.com/vmware/govmomi/cli/importx/spec.go @@ -23,8 +23,8 @@ import ( "io" "path" - "github.com/vmware/govmomi/govc/cli" - "github.com/vmware/govmomi/govc/flags" + "github.com/vmware/govmomi/cli" + "github.com/vmware/govmomi/cli/flags" "github.com/vmware/govmomi/ovf/importer" ) diff --git a/vendor/github.com/vmware/govmomi/govc/importx/vmdk.go b/vendor/github.com/vmware/govmomi/cli/importx/vmdk.go similarity index 97% rename from vendor/github.com/vmware/govmomi/govc/importx/vmdk.go rename to vendor/github.com/vmware/govmomi/cli/importx/vmdk.go index 6e0ac5f99..de2f0964e 100644 --- a/vendor/github.com/vmware/govmomi/govc/importx/vmdk.go +++ b/vendor/github.com/vmware/govmomi/cli/importx/vmdk.go @@ -23,8 +23,8 @@ import ( "fmt" "path" - "github.com/vmware/govmomi/govc/cli" - "github.com/vmware/govmomi/govc/flags" + "github.com/vmware/govmomi/cli" + "github.com/vmware/govmomi/cli/flags" "github.com/vmware/govmomi/vmdk" ) diff --git a/vendor/github.com/vmware/govmomi/govc/cli/register.go b/vendor/github.com/vmware/govmomi/cli/register.go similarity index 100% rename from vendor/github.com/vmware/govmomi/govc/cli/register.go rename to vendor/github.com/vmware/govmomi/cli/register.go diff --git a/vendor/github.com/vmware/govmomi/govc/vm/change.go b/vendor/github.com/vmware/govmomi/cli/vm/change.go similarity index 87% rename from vendor/github.com/vmware/govmomi/govc/vm/change.go rename to vendor/github.com/vmware/govmomi/cli/vm/change.go index a5a73b531..69cccd495 100644 --- a/vendor/github.com/vmware/govmomi/govc/vm/change.go +++ b/vendor/github.com/vmware/govmomi/cli/vm/change.go @@ -24,8 +24,8 @@ import ( "reflect" "strings" - "github.com/vmware/govmomi/govc/cli" - "github.com/vmware/govmomi/govc/flags" + "github.com/vmware/govmomi/cli" + "github.com/vmware/govmomi/cli/flags" "github.com/vmware/govmomi/vim25/types" ) @@ -78,6 +78,7 @@ type change struct { extraConfigFile extraConfigFile Latency string hwUpgradePolicy string + managedBy string } func init() { @@ -102,7 +103,11 @@ func (cmd *change) setLatency() error { return fmt.Errorf("latency must be one of: %s", strings.Join(latencyLevels, "|")) } -var hwUpgradePolicies = types.ScheduledHardwareUpgradeInfoHardwareUpgradePolicy("").Strings() +var ( + hwUpgradePolicies = types.ScheduledHardwareUpgradeInfoHardwareUpgradePolicy("").Strings() + ftEncryptionModes = types.VirtualMachineConfigSpecEncryptedFtModes("").Strings() + migrateEncryptionModes = types.VirtualMachineConfigSpecEncryptedVMotionModes("").Strings() +) // setHwUpgradePolicy validates hwUpgradePolicy if set func (cmd *change) setHwUpgradePolicy() error { @@ -160,6 +165,7 @@ func (cmd *change) Register(ctx context.Context, f *flag.FlagSet) { f.StringVar(&cmd.Latency, "latency", "", fmt.Sprintf("Latency sensitivity (%s)", strings.Join(latencyLevels, "|"))) f.StringVar(&cmd.Annotation, "annotation", "", "VM description") f.StringVar(&cmd.Uuid, "uuid", "", "BIOS UUID") + f.StringVar(&cmd.managedBy, "managed-by", "", "Set or clear managed by VC Extension") f.Var(&cmd.extraConfig, "e", "ExtraConfig. =") f.Var(&cmd.extraConfigFile, "f", "ExtraConfig. =") @@ -174,6 +180,9 @@ func (cmd *change) Register(ctx context.Context, f *flag.FlagSet) { f.Var(flags.NewOptionalBool(&cmd.Flags.VvtdEnabled), "iommu-enabled", "Enable IOMMU") f.StringVar(&cmd.hwUpgradePolicy, "scheduled-hw-upgrade-policy", "", fmt.Sprintf("Schedule hardware upgrade policy (%s)", strings.Join(hwUpgradePolicies, "|"))) + + f.StringVar(&cmd.FtEncryptionMode, "ft-encryption-mode", "", fmt.Sprintf("Encrypted fault tolerance mode (%s)", strings.Join(ftEncryptionModes, "|"))) + f.StringVar(&cmd.MigrateEncryption, "migrate-encryption", "", fmt.Sprintf("Encrypted vMotion mode (%s)", strings.Join(migrateEncryptionModes, "|"))) } func (cmd *change) Description() string { @@ -234,6 +243,18 @@ func (cmd *change) Run(ctx context.Context, f *flag.FlagSet) error { return err } + if cmd.managedBy != "" { + // From the VirtualMachineConfigSpec doc: + // To unset this field pass a ManagedByInfo object with an empty extensionKey + if cmd.managedBy == "-" { + cmd.managedBy = "" + } + cmd.ManagedBy = &types.ManagedByInfo{ + Type: vm.Reference().Type, + ExtensionKey: cmd.managedBy, + } + } + task, err := vm.Reconfigure(ctx, cmd.VirtualMachineConfigSpec) if err != nil { return err diff --git a/vendor/github.com/vmware/govmomi/govc/vm/clone.go b/vendor/github.com/vmware/govmomi/cli/vm/clone.go similarity index 99% rename from vendor/github.com/vmware/govmomi/govc/vm/clone.go rename to vendor/github.com/vmware/govmomi/cli/vm/clone.go index 0e85970ee..3bdd20912 100644 --- a/vendor/github.com/vmware/govmomi/govc/vm/clone.go +++ b/vendor/github.com/vmware/govmomi/cli/vm/clone.go @@ -21,8 +21,8 @@ import ( "flag" "fmt" - "github.com/vmware/govmomi/govc/cli" - "github.com/vmware/govmomi/govc/flags" + "github.com/vmware/govmomi/cli" + "github.com/vmware/govmomi/cli/flags" "github.com/vmware/govmomi/object" "github.com/vmware/govmomi/property" "github.com/vmware/govmomi/vim25" diff --git a/vendor/github.com/vmware/govmomi/govc/vm/console.go b/vendor/github.com/vmware/govmomi/cli/vm/console.go similarity index 98% rename from vendor/github.com/vmware/govmomi/govc/vm/console.go rename to vendor/github.com/vmware/govmomi/cli/vm/console.go index 77c849b41..27aa2b155 100644 --- a/vendor/github.com/vmware/govmomi/govc/vm/console.go +++ b/vendor/github.com/vmware/govmomi/cli/vm/console.go @@ -24,8 +24,8 @@ import ( "net/url" "os" - "github.com/vmware/govmomi/govc/cli" - "github.com/vmware/govmomi/govc/flags" + "github.com/vmware/govmomi/cli" + "github.com/vmware/govmomi/cli/flags" "github.com/vmware/govmomi/object" "github.com/vmware/govmomi/session" "github.com/vmware/govmomi/vim25/soap" diff --git a/vendor/github.com/vmware/govmomi/govc/vm/create.go b/vendor/github.com/vmware/govmomi/cli/vm/create.go similarity index 95% rename from vendor/github.com/vmware/govmomi/govc/vm/create.go rename to vendor/github.com/vmware/govmomi/cli/vm/create.go index 757fc2ea5..7474c21e5 100644 --- a/vendor/github.com/vmware/govmomi/govc/vm/create.go +++ b/vendor/github.com/vmware/govmomi/cli/vm/create.go @@ -24,9 +24,9 @@ import ( "strings" "text/tabwriter" + "github.com/vmware/govmomi/cli" + "github.com/vmware/govmomi/cli/flags" "github.com/vmware/govmomi/find" - "github.com/vmware/govmomi/govc/cli" - "github.com/vmware/govmomi/govc/flags" "github.com/vmware/govmomi/object" "github.com/vmware/govmomi/property" "github.com/vmware/govmomi/units" @@ -51,6 +51,7 @@ type create struct { *flags.HostSystemFlag *flags.NetworkFlag *flags.FolderFlag + *flags.StorageProfileFlag name string memory int @@ -60,11 +61,12 @@ type create struct { on bool force bool controller string + eager bool + thick bool annotation string firmware string version string place bool - profile string iso string isoDatastoreFlag *flags.DatastoreFlag @@ -119,6 +121,9 @@ func (cmd *create) Register(ctx context.Context, f *flag.FlagSet) { cmd.FolderFlag, ctx = flags.NewFolderFlag(ctx) cmd.FolderFlag.Register(ctx, f) + cmd.StorageProfileFlag, ctx = flags.NewStorageProfileFlag(ctx) + cmd.StorageProfileFlag.Register(ctx, f) + f.IntVar(&cmd.memory, "m", 1024, "Size in MB of memory") f.IntVar(&cmd.cpus, "c", 1, "Number of CPUs") f.StringVar(&cmd.guestID, "g", "otherGuest", "Guest OS ID") @@ -126,9 +131,10 @@ func (cmd *create) Register(ctx context.Context, f *flag.FlagSet) { f.BoolVar(&cmd.on, "on", true, "Power on VM") f.BoolVar(&cmd.force, "force", false, "Create VM if vmx already exists") f.StringVar(&cmd.controller, "disk.controller", "scsi", "Disk controller type") + f.BoolVar(&cmd.eager, "disk.eager", false, "Eagerly scrub new disk") + f.BoolVar(&cmd.thick, "disk.thick", false, "Thick provision new disk") f.StringVar(&cmd.annotation, "annotation", "", "VM description") f.StringVar(&cmd.firmware, "firmware", FirmwareTypes[0], FirmwareUsage) - f.StringVar(&cmd.profile, "profile", "", "Storage profile name or ID") if cli.ShowUnreleased() { f.BoolVar(&cmd.place, "place", false, "Place VM without creating") } @@ -178,6 +184,9 @@ func (cmd *create) Process(ctx context.Context) error { if err := cmd.FolderFlag.Process(ctx); err != nil { return err } + if err := cmd.StorageProfileFlag.Process(ctx); err != nil { + return err + } // Default iso/disk datastores to the VM's datastore if cmd.isoDatastoreFlag.Name == "" { @@ -411,22 +420,9 @@ func (cmd *create) createVM(ctx context.Context) (*object.Task, error) { Version: cmd.version, } - if cmd.profile != "" { - c, err := cmd.PbmClient() - if err != nil { - return nil, err - } - m, err := c.ProfileMap(ctx) - if err != nil { - return nil, err - } - p, ok := m.Name[cmd.profile] - if !ok { - return nil, fmt.Errorf("profile %q not found", cmd.profile) - } - spec.VmProfile = []types.BaseVirtualMachineProfileSpec{&types.VirtualMachineDefinedProfileSpec{ - ProfileId: p.GetPbmProfile().ProfileId.UniqueId, - }} + spec.VmProfile, err = cmd.StorageProfileSpec(ctx) + if err != nil { + return nil, err } devices, err = cmd.addStorage(nil) @@ -558,13 +554,17 @@ func (cmd *create) addStorage(devices object.VirtualDeviceList) (object.VirtualD return nil, err } + backing := &types.VirtualDiskFlatVer2BackingInfo{ + DiskMode: string(types.VirtualDiskModePersistent), + ThinProvisioned: types.NewBool(!cmd.thick), + } + if cmd.thick { + backing.EagerlyScrub = &cmd.eager + } disk := &types.VirtualDisk{ VirtualDevice: types.VirtualDevice{ - Key: devices.NewKey(), - Backing: &types.VirtualDiskFlatVer2BackingInfo{ - DiskMode: string(types.VirtualDiskModePersistent), - ThinProvisioned: types.NewBool(true), - }, + Key: devices.NewKey(), + Backing: backing, }, CapacityInKB: cmd.diskByteSize / 1024, } diff --git a/vendor/github.com/vmware/govmomi/govc/vm/customize.go b/vendor/github.com/vmware/govmomi/cli/vm/customize.go similarity index 99% rename from vendor/github.com/vmware/govmomi/govc/vm/customize.go rename to vendor/github.com/vmware/govmomi/cli/vm/customize.go index e7f0e4b61..754c711eb 100644 --- a/vendor/github.com/vmware/govmomi/govc/vm/customize.go +++ b/vendor/github.com/vmware/govmomi/cli/vm/customize.go @@ -23,8 +23,8 @@ import ( "strconv" "strings" - "github.com/vmware/govmomi/govc/cli" - "github.com/vmware/govmomi/govc/flags" + "github.com/vmware/govmomi/cli" + "github.com/vmware/govmomi/cli/flags" "github.com/vmware/govmomi/object" "github.com/vmware/govmomi/vim25/types" ) diff --git a/vendor/github.com/vmware/govmomi/govc/vm/destroy.go b/vendor/github.com/vmware/govmomi/cli/vm/destroy.go similarity index 96% rename from vendor/github.com/vmware/govmomi/govc/vm/destroy.go rename to vendor/github.com/vmware/govmomi/cli/vm/destroy.go index a27b3b763..a34444bc2 100644 --- a/vendor/github.com/vmware/govmomi/govc/vm/destroy.go +++ b/vendor/github.com/vmware/govmomi/cli/vm/destroy.go @@ -20,8 +20,8 @@ import ( "context" "flag" - "github.com/vmware/govmomi/govc/cli" - "github.com/vmware/govmomi/govc/flags" + "github.com/vmware/govmomi/cli" + "github.com/vmware/govmomi/cli/flags" "github.com/vmware/govmomi/object" "github.com/vmware/govmomi/vim25/types" ) diff --git a/vendor/github.com/vmware/govmomi/govc/vm/guest/auth.go b/vendor/github.com/vmware/govmomi/cli/vm/guest/auth.go similarity index 100% rename from vendor/github.com/vmware/govmomi/govc/vm/guest/auth.go rename to vendor/github.com/vmware/govmomi/cli/vm/guest/auth.go diff --git a/vendor/github.com/vmware/govmomi/govc/vm/guest/chmod.go b/vendor/github.com/vmware/govmomi/cli/vm/guest/chmod.go similarity index 97% rename from vendor/github.com/vmware/govmomi/govc/vm/guest/chmod.go rename to vendor/github.com/vmware/govmomi/cli/vm/guest/chmod.go index 29f0745b7..6c3c6e75e 100644 --- a/vendor/github.com/vmware/govmomi/govc/vm/guest/chmod.go +++ b/vendor/github.com/vmware/govmomi/cli/vm/guest/chmod.go @@ -21,7 +21,7 @@ import ( "flag" "strconv" - "github.com/vmware/govmomi/govc/cli" + "github.com/vmware/govmomi/cli" "github.com/vmware/govmomi/vim25/types" ) diff --git a/vendor/github.com/vmware/govmomi/govc/vm/guest/chown.go b/vendor/github.com/vmware/govmomi/cli/vm/guest/chown.go similarity index 98% rename from vendor/github.com/vmware/govmomi/govc/vm/guest/chown.go rename to vendor/github.com/vmware/govmomi/cli/vm/guest/chown.go index 0b6a455af..b99360489 100644 --- a/vendor/github.com/vmware/govmomi/govc/vm/guest/chown.go +++ b/vendor/github.com/vmware/govmomi/cli/vm/guest/chown.go @@ -22,7 +22,7 @@ import ( "strconv" "strings" - "github.com/vmware/govmomi/govc/cli" + "github.com/vmware/govmomi/cli" "github.com/vmware/govmomi/vim25/types" ) diff --git a/vendor/github.com/vmware/govmomi/govc/vm/guest/df.go b/vendor/github.com/vmware/govmomi/cli/vm/guest/df.go similarity index 96% rename from vendor/github.com/vmware/govmomi/govc/vm/guest/df.go rename to vendor/github.com/vmware/govmomi/cli/vm/guest/df.go index 466ccaa92..776b29aaa 100644 --- a/vendor/github.com/vmware/govmomi/govc/vm/guest/df.go +++ b/vendor/github.com/vmware/govmomi/cli/vm/guest/df.go @@ -23,8 +23,8 @@ import ( "io" "text/tabwriter" - "github.com/vmware/govmomi/govc/cli" - "github.com/vmware/govmomi/govc/flags" + "github.com/vmware/govmomi/cli" + "github.com/vmware/govmomi/cli/flags" "github.com/vmware/govmomi/units" "github.com/vmware/govmomi/vim25/mo" "github.com/vmware/govmomi/vim25/types" diff --git a/vendor/github.com/vmware/govmomi/govc/vm/guest/download.go b/vendor/github.com/vmware/govmomi/cli/vm/guest/download.go similarity index 98% rename from vendor/github.com/vmware/govmomi/govc/vm/guest/download.go rename to vendor/github.com/vmware/govmomi/cli/vm/guest/download.go index c30b4c14b..0c28d5879 100644 --- a/vendor/github.com/vmware/govmomi/govc/vm/guest/download.go +++ b/vendor/github.com/vmware/govmomi/cli/vm/guest/download.go @@ -22,7 +22,7 @@ import ( "io" "os" - "github.com/vmware/govmomi/govc/cli" + "github.com/vmware/govmomi/cli" "github.com/vmware/govmomi/vim25/progress" ) diff --git a/vendor/github.com/vmware/govmomi/govc/vm/guest/file_attr.go b/vendor/github.com/vmware/govmomi/cli/vm/guest/file_attr.go similarity index 97% rename from vendor/github.com/vmware/govmomi/govc/vm/guest/file_attr.go rename to vendor/github.com/vmware/govmomi/cli/vm/guest/file_attr.go index 3e18602f1..98e6d0f8d 100644 --- a/vendor/github.com/vmware/govmomi/govc/vm/guest/file_attr.go +++ b/vendor/github.com/vmware/govmomi/cli/vm/guest/file_attr.go @@ -20,7 +20,7 @@ import ( "context" "flag" - "github.com/vmware/govmomi/govc/flags" + "github.com/vmware/govmomi/cli/flags" "github.com/vmware/govmomi/vim25/types" ) diff --git a/vendor/github.com/vmware/govmomi/govc/vm/guest/getenv.go b/vendor/github.com/vmware/govmomi/cli/vm/guest/getenv.go similarity index 97% rename from vendor/github.com/vmware/govmomi/govc/vm/guest/getenv.go rename to vendor/github.com/vmware/govmomi/cli/vm/guest/getenv.go index a7b43d643..d43ff6370 100644 --- a/vendor/github.com/vmware/govmomi/govc/vm/guest/getenv.go +++ b/vendor/github.com/vmware/govmomi/cli/vm/guest/getenv.go @@ -21,7 +21,7 @@ import ( "flag" "fmt" - "github.com/vmware/govmomi/govc/cli" + "github.com/vmware/govmomi/cli" ) type getenv struct { diff --git a/vendor/github.com/vmware/govmomi/govc/vm/guest/guest.go b/vendor/github.com/vmware/govmomi/cli/vm/guest/guest.go similarity index 98% rename from vendor/github.com/vmware/govmomi/govc/vm/guest/guest.go rename to vendor/github.com/vmware/govmomi/cli/vm/guest/guest.go index 7e02c5d71..8ecd601aa 100644 --- a/vendor/github.com/vmware/govmomi/govc/vm/guest/guest.go +++ b/vendor/github.com/vmware/govmomi/cli/vm/guest/guest.go @@ -22,7 +22,7 @@ import ( "flag" "net/url" - "github.com/vmware/govmomi/govc/flags" + "github.com/vmware/govmomi/cli/flags" "github.com/vmware/govmomi/guest" "github.com/vmware/govmomi/guest/toolbox" "github.com/vmware/govmomi/object" diff --git a/vendor/github.com/vmware/govmomi/govc/vm/guest/kill.go b/vendor/github.com/vmware/govmomi/cli/vm/guest/kill.go similarity index 97% rename from vendor/github.com/vmware/govmomi/govc/vm/guest/kill.go rename to vendor/github.com/vmware/govmomi/cli/vm/guest/kill.go index 53bee80a9..874de6146 100644 --- a/vendor/github.com/vmware/govmomi/govc/vm/guest/kill.go +++ b/vendor/github.com/vmware/govmomi/cli/vm/guest/kill.go @@ -20,7 +20,7 @@ import ( "context" "flag" - "github.com/vmware/govmomi/govc/cli" + "github.com/vmware/govmomi/cli" ) type kill struct { diff --git a/vendor/github.com/vmware/govmomi/govc/vm/guest/ls.go b/vendor/github.com/vmware/govmomi/cli/vm/guest/ls.go similarity index 98% rename from vendor/github.com/vmware/govmomi/govc/vm/guest/ls.go rename to vendor/github.com/vmware/govmomi/cli/vm/guest/ls.go index b53c36877..a47ea6490 100644 --- a/vendor/github.com/vmware/govmomi/govc/vm/guest/ls.go +++ b/vendor/github.com/vmware/govmomi/cli/vm/guest/ls.go @@ -23,7 +23,7 @@ import ( "os" "text/tabwriter" - "github.com/vmware/govmomi/govc/cli" + "github.com/vmware/govmomi/cli" "github.com/vmware/govmomi/units" "github.com/vmware/govmomi/vim25/types" ) diff --git a/vendor/github.com/vmware/govmomi/govc/vm/guest/mkdir.go b/vendor/github.com/vmware/govmomi/cli/vm/guest/mkdir.go similarity index 82% rename from vendor/github.com/vmware/govmomi/govc/vm/guest/mkdir.go rename to vendor/github.com/vmware/govmomi/cli/vm/guest/mkdir.go index 541f6d7f3..607f67f9c 100644 --- a/vendor/github.com/vmware/govmomi/govc/vm/guest/mkdir.go +++ b/vendor/github.com/vmware/govmomi/cli/vm/guest/mkdir.go @@ -1,11 +1,11 @@ /* -Copyright (c) 2014-2017 VMware, Inc. All Rights Reserved. +Copyright (c) 2014-2024 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 +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, @@ -20,8 +20,8 @@ import ( "context" "flag" - "github.com/vmware/govmomi/govc/cli" - "github.com/vmware/govmomi/vim25/soap" + "github.com/vmware/govmomi/cli" + "github.com/vmware/govmomi/fault" "github.com/vmware/govmomi/vim25/types" ) @@ -71,11 +71,8 @@ func (cmd *mkdir) Run(ctx context.Context, f *flag.FlagSet) error { // ignore EEXIST if -p flag is given if err != nil && cmd.createParents { - if soap.IsSoapFault(err) { - soapFault := soap.ToSoapFault(err) - if _, ok := soapFault.VimFault().(types.FileAlreadyExists); ok { - return nil - } + if fault.Is(err, &types.FileAlreadyExists{}) { + return nil } } diff --git a/vendor/github.com/vmware/govmomi/govc/vm/guest/mktemp.go b/vendor/github.com/vmware/govmomi/cli/vm/guest/mktemp.go similarity index 98% rename from vendor/github.com/vmware/govmomi/govc/vm/guest/mktemp.go rename to vendor/github.com/vmware/govmomi/cli/vm/guest/mktemp.go index 3637bcefc..f89c49fff 100644 --- a/vendor/github.com/vmware/govmomi/govc/vm/guest/mktemp.go +++ b/vendor/github.com/vmware/govmomi/cli/vm/guest/mktemp.go @@ -21,7 +21,7 @@ import ( "flag" "fmt" - "github.com/vmware/govmomi/govc/cli" + "github.com/vmware/govmomi/cli" ) type mktemp struct { diff --git a/vendor/github.com/vmware/govmomi/govc/vm/guest/mv.go b/vendor/github.com/vmware/govmomi/cli/vm/guest/mv.go similarity index 80% rename from vendor/github.com/vmware/govmomi/govc/vm/guest/mv.go rename to vendor/github.com/vmware/govmomi/cli/vm/guest/mv.go index 4890a6f8a..97d55691a 100644 --- a/vendor/github.com/vmware/govmomi/govc/vm/guest/mv.go +++ b/vendor/github.com/vmware/govmomi/cli/vm/guest/mv.go @@ -1,11 +1,11 @@ /* -Copyright (c) 2017 VMware, Inc. All Rights Reserved. +Copyright (c) 2017-2024 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 +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, @@ -20,8 +20,8 @@ import ( "context" "flag" - "github.com/vmware/govmomi/govc/cli" - "github.com/vmware/govmomi/vim25/soap" + "github.com/vmware/govmomi/cli" + "github.com/vmware/govmomi/fault" "github.com/vmware/govmomi/vim25/types" ) @@ -73,11 +73,8 @@ func (cmd *mv) Run(ctx context.Context, f *flag.FlagSet) error { err = m.MoveFile(ctx, cmd.Auth(), src, dst, !cmd.noclobber) if err != nil { - if soap.IsSoapFault(err) { - soapFault := soap.ToSoapFault(err) - if _, ok := soapFault.VimFault().(types.NotAFile); ok { - err = m.MoveDirectory(ctx, cmd.Auth(), src, dst) - } + if fault.Is(err, &types.NotAFile{}) { + err = m.MoveDirectory(ctx, cmd.Auth(), src, dst) } } diff --git a/vendor/github.com/vmware/govmomi/govc/vm/guest/ps.go b/vendor/github.com/vmware/govmomi/cli/vm/guest/ps.go similarity index 98% rename from vendor/github.com/vmware/govmomi/govc/vm/guest/ps.go rename to vendor/github.com/vmware/govmomi/cli/vm/guest/ps.go index d7c55e997..002e732f4 100644 --- a/vendor/github.com/vmware/govmomi/govc/vm/guest/ps.go +++ b/vendor/github.com/vmware/govmomi/cli/vm/guest/ps.go @@ -26,8 +26,8 @@ import ( "text/tabwriter" "time" - "github.com/vmware/govmomi/govc/cli" - "github.com/vmware/govmomi/govc/flags" + "github.com/vmware/govmomi/cli" + "github.com/vmware/govmomi/cli/flags" "github.com/vmware/govmomi/vim25/types" ) diff --git a/vendor/github.com/vmware/govmomi/govc/vm/guest/rm.go b/vendor/github.com/vmware/govmomi/cli/vm/guest/rm.go similarity index 97% rename from vendor/github.com/vmware/govmomi/govc/vm/guest/rm.go rename to vendor/github.com/vmware/govmomi/cli/vm/guest/rm.go index bd21a55eb..0bbd147b9 100644 --- a/vendor/github.com/vmware/govmomi/govc/vm/guest/rm.go +++ b/vendor/github.com/vmware/govmomi/cli/vm/guest/rm.go @@ -20,7 +20,7 @@ import ( "context" "flag" - "github.com/vmware/govmomi/govc/cli" + "github.com/vmware/govmomi/cli" ) type rm struct { diff --git a/vendor/github.com/vmware/govmomi/govc/vm/guest/rmdir.go b/vendor/github.com/vmware/govmomi/cli/vm/guest/rmdir.go similarity index 97% rename from vendor/github.com/vmware/govmomi/govc/vm/guest/rmdir.go rename to vendor/github.com/vmware/govmomi/cli/vm/guest/rmdir.go index 7b69a879c..f8ba91dce 100644 --- a/vendor/github.com/vmware/govmomi/govc/vm/guest/rmdir.go +++ b/vendor/github.com/vmware/govmomi/cli/vm/guest/rmdir.go @@ -20,7 +20,7 @@ import ( "context" "flag" - "github.com/vmware/govmomi/govc/cli" + "github.com/vmware/govmomi/cli" ) type rmdir struct { diff --git a/vendor/github.com/vmware/govmomi/govc/vm/guest/run.go b/vendor/github.com/vmware/govmomi/cli/vm/guest/run.go similarity index 98% rename from vendor/github.com/vmware/govmomi/govc/vm/guest/run.go rename to vendor/github.com/vmware/govmomi/cli/vm/guest/run.go index 3562abded..dab12256b 100644 --- a/vendor/github.com/vmware/govmomi/govc/vm/guest/run.go +++ b/vendor/github.com/vmware/govmomi/cli/vm/guest/run.go @@ -23,7 +23,7 @@ import ( "os" "os/exec" - "github.com/vmware/govmomi/govc/cli" + "github.com/vmware/govmomi/cli" ) type run struct { diff --git a/vendor/github.com/vmware/govmomi/govc/vm/guest/start.go b/vendor/github.com/vmware/govmomi/cli/vm/guest/start.go similarity index 98% rename from vendor/github.com/vmware/govmomi/govc/vm/guest/start.go rename to vendor/github.com/vmware/govmomi/cli/vm/guest/start.go index ba6a91d32..6fc22a56e 100644 --- a/vendor/github.com/vmware/govmomi/govc/vm/guest/start.go +++ b/vendor/github.com/vmware/govmomi/cli/vm/guest/start.go @@ -22,7 +22,7 @@ import ( "fmt" "strings" - "github.com/vmware/govmomi/govc/cli" + "github.com/vmware/govmomi/cli" "github.com/vmware/govmomi/vim25/types" ) diff --git a/vendor/github.com/vmware/govmomi/govc/vm/guest/tools.go b/vendor/github.com/vmware/govmomi/cli/vm/guest/tools.go similarity index 97% rename from vendor/github.com/vmware/govmomi/govc/vm/guest/tools.go rename to vendor/github.com/vmware/govmomi/cli/vm/guest/tools.go index 1e1e36a28..7725da929 100644 --- a/vendor/github.com/vmware/govmomi/govc/vm/guest/tools.go +++ b/vendor/github.com/vmware/govmomi/cli/vm/guest/tools.go @@ -20,8 +20,8 @@ import ( "context" "flag" - "github.com/vmware/govmomi/govc/cli" - "github.com/vmware/govmomi/govc/flags" + "github.com/vmware/govmomi/cli" + "github.com/vmware/govmomi/cli/flags" "github.com/vmware/govmomi/object" ) diff --git a/vendor/github.com/vmware/govmomi/govc/vm/guest/touch.go b/vendor/github.com/vmware/govmomi/cli/vm/guest/touch.go similarity index 89% rename from vendor/github.com/vmware/govmomi/govc/vm/guest/touch.go rename to vendor/github.com/vmware/govmomi/cli/vm/guest/touch.go index 741bf2b45..93bd59b44 100644 --- a/vendor/github.com/vmware/govmomi/govc/vm/guest/touch.go +++ b/vendor/github.com/vmware/govmomi/cli/vm/guest/touch.go @@ -1,11 +1,11 @@ /* -Copyright (c) 2017 VMware, Inc. All Rights Reserved. +Copyright (c) 2017-2024 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 +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, @@ -22,7 +22,8 @@ import ( "flag" "time" - "github.com/vmware/govmomi/govc/cli" + "github.com/vmware/govmomi/cli" + "github.com/vmware/govmomi/fault" "github.com/vmware/govmomi/vim25/soap" "github.com/vmware/govmomi/vim25/types" ) @@ -96,9 +97,8 @@ func (cmd *touch) Run(ctx context.Context, f *flag.FlagSet) error { } err = m.ChangeFileAttributes(ctx, cmd.Auth(), name, &attr) - if err != nil && !cmd.nocreate && soap.IsSoapFault(err) { - fault := soap.ToSoapFault(err) - if _, ok := fault.VimFault().(types.FileNotFound); ok { + if err != nil && !cmd.nocreate { + if fault.Is(err, &types.FileNotFound{}) { // create a new empty file url, cerr := m.InitiateFileTransferToGuest(ctx, cmd.Auth(), name, &attr, 0, false) if cerr != nil { diff --git a/vendor/github.com/vmware/govmomi/govc/vm/guest/upload.go b/vendor/github.com/vmware/govmomi/cli/vm/guest/upload.go similarity index 98% rename from vendor/github.com/vmware/govmomi/govc/vm/guest/upload.go rename to vendor/github.com/vmware/govmomi/cli/vm/guest/upload.go index db0490c12..0f34a782e 100644 --- a/vendor/github.com/vmware/govmomi/govc/vm/guest/upload.go +++ b/vendor/github.com/vmware/govmomi/cli/vm/guest/upload.go @@ -23,7 +23,7 @@ import ( "os" "path/filepath" - "github.com/vmware/govmomi/govc/cli" + "github.com/vmware/govmomi/cli" "github.com/vmware/govmomi/vim25/soap" ) diff --git a/vendor/github.com/vmware/govmomi/govc/vm/info.go b/vendor/github.com/vmware/govmomi/cli/vm/info.go similarity index 99% rename from vendor/github.com/vmware/govmomi/govc/vm/info.go rename to vendor/github.com/vmware/govmomi/cli/vm/info.go index 385167a9d..331732117 100644 --- a/vendor/github.com/vmware/govmomi/govc/vm/info.go +++ b/vendor/github.com/vmware/govmomi/cli/vm/info.go @@ -25,9 +25,9 @@ import ( "strings" "text/tabwriter" + "github.com/vmware/govmomi/cli" + "github.com/vmware/govmomi/cli/flags" "github.com/vmware/govmomi/find" - "github.com/vmware/govmomi/govc/cli" - "github.com/vmware/govmomi/govc/flags" "github.com/vmware/govmomi/object" "github.com/vmware/govmomi/property" "github.com/vmware/govmomi/units" diff --git a/vendor/github.com/vmware/govmomi/govc/vm/instantclone.go b/vendor/github.com/vmware/govmomi/cli/vm/instantclone.go similarity index 98% rename from vendor/github.com/vmware/govmomi/govc/vm/instantclone.go rename to vendor/github.com/vmware/govmomi/cli/vm/instantclone.go index 9f020df44..55384ec35 100644 --- a/vendor/github.com/vmware/govmomi/govc/vm/instantclone.go +++ b/vendor/github.com/vmware/govmomi/cli/vm/instantclone.go @@ -21,8 +21,8 @@ import ( "flag" "fmt" - "github.com/vmware/govmomi/govc/cli" - "github.com/vmware/govmomi/govc/flags" + "github.com/vmware/govmomi/cli" + "github.com/vmware/govmomi/cli/flags" "github.com/vmware/govmomi/object" "github.com/vmware/govmomi/vim25" "github.com/vmware/govmomi/vim25/types" diff --git a/vendor/github.com/vmware/govmomi/govc/vm/ip.go b/vendor/github.com/vmware/govmomi/cli/vm/ip.go similarity index 96% rename from vendor/github.com/vmware/govmomi/govc/vm/ip.go rename to vendor/github.com/vmware/govmomi/cli/vm/ip.go index 57a110c35..83c314101 100644 --- a/vendor/github.com/vmware/govmomi/govc/vm/ip.go +++ b/vendor/github.com/vmware/govmomi/cli/vm/ip.go @@ -23,9 +23,9 @@ import ( "strings" "time" - "github.com/vmware/govmomi/govc/cli" - "github.com/vmware/govmomi/govc/flags" - "github.com/vmware/govmomi/govc/host/esxcli" + "github.com/vmware/govmomi/cli" + "github.com/vmware/govmomi/cli/esx" + "github.com/vmware/govmomi/cli/flags" "github.com/vmware/govmomi/object" ) @@ -123,7 +123,7 @@ func (cmd *ip) Run(ctx context.Context, f *flag.FlagSet) error { if cmd.esx { get = func(vm *object.VirtualMachine, deadline context.Context) (string, error) { - guest := esxcli.NewGuestInfo(c) + guest := esx.NewGuestInfo(c) ticker := time.NewTicker(time.Millisecond * 500) defer ticker.Stop() @@ -131,7 +131,7 @@ func (cmd *ip) Run(ctx context.Context, f *flag.FlagSet) error { for { select { case <-ticker.C: - ip, err := guest.IpAddress(vm) + ip, err := guest.IpAddress(ctx, vm) if err != nil { return "", err } diff --git a/vendor/github.com/vmware/govmomi/govc/vm/keystrokes.go b/vendor/github.com/vmware/govmomi/cli/vm/keystrokes.go similarity index 99% rename from vendor/github.com/vmware/govmomi/govc/vm/keystrokes.go rename to vendor/github.com/vmware/govmomi/cli/vm/keystrokes.go index 67ae4d880..dbddb1787 100644 --- a/vendor/github.com/vmware/govmomi/govc/vm/keystrokes.go +++ b/vendor/github.com/vmware/govmomi/cli/vm/keystrokes.go @@ -24,8 +24,8 @@ import ( "strconv" "strings" - "github.com/vmware/govmomi/govc/cli" - "github.com/vmware/govmomi/govc/flags" + "github.com/vmware/govmomi/cli" + "github.com/vmware/govmomi/cli/flags" "github.com/vmware/govmomi/object" "github.com/vmware/govmomi/vim25/types" ) diff --git a/vendor/github.com/vmware/govmomi/govc/vm/markastemplate.go b/vendor/github.com/vmware/govmomi/cli/vm/markastemplate.go similarity index 95% rename from vendor/github.com/vmware/govmomi/govc/vm/markastemplate.go rename to vendor/github.com/vmware/govmomi/cli/vm/markastemplate.go index eccfb77e0..c49715d1c 100644 --- a/vendor/github.com/vmware/govmomi/govc/vm/markastemplate.go +++ b/vendor/github.com/vmware/govmomi/cli/vm/markastemplate.go @@ -20,8 +20,8 @@ import ( "context" "flag" - "github.com/vmware/govmomi/govc/cli" - "github.com/vmware/govmomi/govc/flags" + "github.com/vmware/govmomi/cli" + "github.com/vmware/govmomi/cli/flags" ) type markastemplate struct { diff --git a/vendor/github.com/vmware/govmomi/govc/vm/markasvm.go b/vendor/github.com/vmware/govmomi/cli/vm/markasvm.go similarity index 96% rename from vendor/github.com/vmware/govmomi/govc/vm/markasvm.go rename to vendor/github.com/vmware/govmomi/cli/vm/markasvm.go index 46fa57b34..857b773fc 100644 --- a/vendor/github.com/vmware/govmomi/govc/vm/markasvm.go +++ b/vendor/github.com/vmware/govmomi/cli/vm/markasvm.go @@ -20,8 +20,8 @@ import ( "context" "flag" - "github.com/vmware/govmomi/govc/cli" - "github.com/vmware/govmomi/govc/flags" + "github.com/vmware/govmomi/cli" + "github.com/vmware/govmomi/cli/flags" ) type markasvm struct { diff --git a/vendor/github.com/vmware/govmomi/govc/vm/migrate.go b/vendor/github.com/vmware/govmomi/cli/vm/migrate.go similarity index 98% rename from vendor/github.com/vmware/govmomi/govc/vm/migrate.go rename to vendor/github.com/vmware/govmomi/cli/vm/migrate.go index 0e6d1a9fe..6bf2644df 100644 --- a/vendor/github.com/vmware/govmomi/govc/vm/migrate.go +++ b/vendor/github.com/vmware/govmomi/cli/vm/migrate.go @@ -21,8 +21,8 @@ import ( "flag" "fmt" - "github.com/vmware/govmomi/govc/cli" - "github.com/vmware/govmomi/govc/flags" + "github.com/vmware/govmomi/cli" + "github.com/vmware/govmomi/cli/flags" "github.com/vmware/govmomi/object" "github.com/vmware/govmomi/vim25/types" ) diff --git a/vendor/github.com/vmware/govmomi/govc/vm/power.go b/vendor/github.com/vmware/govmomi/cli/vm/power.go similarity index 93% rename from vendor/github.com/vmware/govmomi/govc/vm/power.go rename to vendor/github.com/vmware/govmomi/cli/vm/power.go index d3c8c8e5f..43463672b 100644 --- a/vendor/github.com/vmware/govmomi/govc/vm/power.go +++ b/vendor/github.com/vmware/govmomi/cli/vm/power.go @@ -1,5 +1,5 @@ /* -Copyright (c) 2014-2023 VMware, Inc. All Rights Reserved. +Copyright (c) 2014-2024 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. @@ -21,10 +21,10 @@ import ( "flag" "fmt" - "github.com/vmware/govmomi/govc/cli" - "github.com/vmware/govmomi/govc/flags" + "github.com/vmware/govmomi/cli" + "github.com/vmware/govmomi/cli/flags" + "github.com/vmware/govmomi/fault" "github.com/vmware/govmomi/object" - "github.com/vmware/govmomi/vim25/soap" "github.com/vmware/govmomi/vim25/types" ) @@ -107,14 +107,7 @@ func (cmd *power) Process(ctx context.Context) error { } func isToolsUnavailable(err error) bool { - if soap.IsSoapFault(err) { - soapFault := soap.ToSoapFault(err) - if _, ok := soapFault.VimFault().(types.ToolsUnavailable); ok { - return ok - } - } - - return false + return fault.Is(err, &types.ToolsUnavailable{}) } // this is annoying, but the likely use cases for Datacenter.PowerOnVM outside of this command would diff --git a/vendor/github.com/vmware/govmomi/govc/vm/question.go b/vendor/github.com/vmware/govmomi/cli/vm/question.go similarity index 96% rename from vendor/github.com/vmware/govmomi/govc/vm/question.go rename to vendor/github.com/vmware/govmomi/cli/vm/question.go index 1e1c8c847..b659ebc9c 100644 --- a/vendor/github.com/vmware/govmomi/govc/vm/question.go +++ b/vendor/github.com/vmware/govmomi/cli/vm/question.go @@ -22,8 +22,8 @@ import ( "flag" "fmt" - "github.com/vmware/govmomi/govc/cli" - "github.com/vmware/govmomi/govc/flags" + "github.com/vmware/govmomi/cli" + "github.com/vmware/govmomi/cli/flags" "github.com/vmware/govmomi/property" "github.com/vmware/govmomi/vim25/mo" "github.com/vmware/govmomi/vim25/types" diff --git a/vendor/github.com/vmware/govmomi/govc/vm/register.go b/vendor/github.com/vmware/govmomi/cli/vm/register.go similarity index 97% rename from vendor/github.com/vmware/govmomi/govc/vm/register.go rename to vendor/github.com/vmware/govmomi/cli/vm/register.go index aeaa6aaad..2d93a8f84 100644 --- a/vendor/github.com/vmware/govmomi/govc/vm/register.go +++ b/vendor/github.com/vmware/govmomi/cli/vm/register.go @@ -20,8 +20,8 @@ import ( "context" "flag" - "github.com/vmware/govmomi/govc/cli" - "github.com/vmware/govmomi/govc/flags" + "github.com/vmware/govmomi/cli" + "github.com/vmware/govmomi/cli/flags" ) type register struct { diff --git a/vendor/github.com/vmware/govmomi/govc/vm/unregister.go b/vendor/github.com/vmware/govmomi/cli/vm/unregister.go similarity index 95% rename from vendor/github.com/vmware/govmomi/govc/vm/unregister.go rename to vendor/github.com/vmware/govmomi/cli/vm/unregister.go index 789d1eea5..bd8f69af2 100644 --- a/vendor/github.com/vmware/govmomi/govc/vm/unregister.go +++ b/vendor/github.com/vmware/govmomi/cli/vm/unregister.go @@ -20,8 +20,8 @@ import ( "context" "flag" - "github.com/vmware/govmomi/govc/cli" - "github.com/vmware/govmomi/govc/flags" + "github.com/vmware/govmomi/cli" + "github.com/vmware/govmomi/cli/flags" ) type unregister struct { diff --git a/vendor/github.com/vmware/govmomi/govc/vm/upgrade.go b/vendor/github.com/vmware/govmomi/cli/vm/upgrade.go similarity index 81% rename from vendor/github.com/vmware/govmomi/govc/vm/upgrade.go rename to vendor/github.com/vmware/govmomi/cli/vm/upgrade.go index 1b436aed0..d3e880455 100644 --- a/vendor/github.com/vmware/govmomi/govc/vm/upgrade.go +++ b/vendor/github.com/vmware/govmomi/cli/vm/upgrade.go @@ -1,11 +1,11 @@ /* -Copyright (c) 2014-2022 VMware, Inc. All Rights Reserved. +Copyright (c) 2017-2024 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 +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, @@ -21,9 +21,9 @@ import ( "flag" "fmt" - "github.com/vmware/govmomi/govc/cli" - "github.com/vmware/govmomi/govc/flags" - "github.com/vmware/govmomi/task" + "github.com/vmware/govmomi/cli" + "github.com/vmware/govmomi/cli/flags" + "github.com/vmware/govmomi/fault" "github.com/vmware/govmomi/vim25/types" ) @@ -36,15 +36,6 @@ func init() { cli.Register("vm.upgrade", &upgrade{}) } -func isAlreadyUpgraded(err error) bool { - if fault, ok := err.(task.Error); ok { - _, ok = fault.Fault().(*types.AlreadyUpgraded) - return ok - } - - return false -} - func (cmd *upgrade) Register(ctx context.Context, f *flag.FlagSet) { cmd.VirtualMachineFlag, ctx = flags.NewVirtualMachineFlag(ctx) cmd.VirtualMachineFlag.Register(ctx, f) @@ -85,7 +76,7 @@ func (cmd *upgrade) Run(ctx context.Context, f *flag.FlagSet) error { } err = task.Wait(ctx) if err != nil { - if isAlreadyUpgraded(err) { + if fault.Is(err, &types.AlreadyUpgraded{}) { fmt.Println(err.Error()) } else { return err diff --git a/vendor/github.com/vmware/govmomi/govc/vm/vnc.go b/vendor/github.com/vmware/govmomi/cli/vm/vnc.go similarity index 99% rename from vendor/github.com/vmware/govmomi/govc/vm/vnc.go rename to vendor/github.com/vmware/govmomi/cli/vm/vnc.go index 9e8165c55..fd2318cca 100644 --- a/vendor/github.com/vmware/govmomi/govc/vm/vnc.go +++ b/vendor/github.com/vmware/govmomi/cli/vm/vnc.go @@ -27,8 +27,8 @@ import ( "strconv" "strings" - "github.com/vmware/govmomi/govc/cli" - "github.com/vmware/govmomi/govc/flags" + "github.com/vmware/govmomi/cli" + "github.com/vmware/govmomi/cli/flags" "github.com/vmware/govmomi/object" "github.com/vmware/govmomi/property" "github.com/vmware/govmomi/vim25" diff --git a/vendor/github.com/vmware/govmomi/client.go b/vendor/github.com/vmware/govmomi/client.go index 5becedd48..c67e74b05 100644 --- a/vendor/github.com/vmware/govmomi/client.go +++ b/vendor/github.com/vmware/govmomi/client.go @@ -1,18 +1,6 @@ -/* -Copyright (c) 2014-2023 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. -*/ +// © Broadcom. All Rights Reserved. +// The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. +// SPDX-License-Identifier: Apache-2.0 /* This package is the root package of the govmomi library. diff --git a/vendor/github.com/vmware/govmomi/cns/methods/unreleased.go b/vendor/github.com/vmware/govmomi/cns/methods/unreleased.go new file mode 100644 index 000000000..097d6cb5c --- /dev/null +++ b/vendor/github.com/vmware/govmomi/cns/methods/unreleased.go @@ -0,0 +1,44 @@ +/* +Copyright (c) 2024-2024 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/cns/types" + "github.com/vmware/govmomi/vim25/soap" +) + +type CnsUpdateVolumeCryptoBody struct { + Req *types.CnsUpdateVolumeCrypto `xml:"urn:vsan CnsUpdateVolumeCrypto,omitempty"` + Res *types.CnsUpdateVolumeCryptoResponse `xml:"urn:vsan CnsUpdateVolumeCryptoResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *CnsUpdateVolumeCryptoBody) Fault() *soap.Fault { return b.Fault_ } + +func CnsUpdateVolumeCrypto(ctx context.Context, r soap.RoundTripper, req *types.CnsUpdateVolumeCrypto) (*types.CnsUpdateVolumeCryptoResponse, error) { + var reqBody, resBody CnsUpdateVolumeCryptoBody + + 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/cns/types/types.go b/vendor/github.com/vmware/govmomi/cns/types/types.go index a649aedd1..3b5ce9c0b 100644 --- a/vendor/github.com/vmware/govmomi/cns/types/types.go +++ b/vendor/github.com/vmware/govmomi/cns/types/types.go @@ -25,8 +25,8 @@ import ( ) type CnsCreateVolumeRequestType struct { - This types.ManagedObjectReference `xml:"_this"` - CreateSpecs []CnsVolumeCreateSpec `xml:"createSpecs,omitempty"` + This types.ManagedObjectReference `xml:"_this" json:"-"` + CreateSpecs []CnsVolumeCreateSpec `xml:"createSpecs,omitempty" json:"createSpecs"` } func init() { @@ -40,16 +40,16 @@ func init() { } type CnsCreateVolumeResponse struct { - Returnval types.ManagedObjectReference `xml:"returnval"` + Returnval types.ManagedObjectReference `xml:"returnval" json:"returnval"` } type CnsEntityMetadata struct { types.DynamicData - EntityName string `xml:"entityName"` - Labels []types.KeyValue `xml:"labels,omitempty"` - Delete bool `xml:"delete,omitempty"` - ClusterID string `xml:"clusterId,omitempty"` + EntityName string `xml:"entityName" json:"entityName"` + Labels []types.KeyValue `xml:"labels,omitempty" json:"labels"` + Delete bool `xml:"delete,omitempty" json:"delete"` + ClusterID string `xml:"clusterId,omitempty" json:"clusterID"` } func init() { @@ -57,18 +57,18 @@ func init() { } type CnsKubernetesEntityReference struct { - EntityType string `xml:"entityType"` - EntityName string `xml:"entityName"` - Namespace string `xml:"namespace,omitempty"` - ClusterID string `xml:"clusterId,omitempty"` + EntityType string `xml:"entityType" json:"entityType"` + EntityName string `xml:"entityName" json:"entityName"` + Namespace string `xml:"namespace,omitempty" json:"namespace"` + ClusterID string `xml:"clusterId,omitempty" json:"clusterID"` } type CnsKubernetesEntityMetadata struct { CnsEntityMetadata - EntityType string `xml:"entityType"` - Namespace string `xml:"namespace,omitempty"` - ReferredEntity []CnsKubernetesEntityReference `xml:"referredEntity,omitempty"` + EntityType string `xml:"entityType" json:"entityType"` + Namespace string `xml:"namespace,omitempty" json:"namespace"` + ReferredEntity []CnsKubernetesEntityReference `xml:"referredEntity,omitempty" json:"referredEntity"` } func init() { @@ -78,9 +78,9 @@ func init() { type CnsVolumeMetadata struct { types.DynamicData - ContainerCluster CnsContainerCluster `xml:"containerCluster"` - EntityMetadata []BaseCnsEntityMetadata `xml:"entityMetadata,typeattr,omitempty"` - ContainerClusterArray []CnsContainerCluster `xml:"containerClusterArray,omitempty"` + ContainerCluster CnsContainerCluster `xml:"containerCluster" json:"containerCluster"` + EntityMetadata []BaseCnsEntityMetadata `xml:"entityMetadata,typeattr,omitempty" json:"entityMetadata"` + ContainerClusterArray []CnsContainerCluster `xml:"containerClusterArray,omitempty" json:"containerClusterArray"` } func init() { @@ -89,14 +89,14 @@ func init() { type CnsVolumeCreateSpec struct { types.DynamicData - Name string `xml:"name"` - VolumeType string `xml:"volumeType"` - Datastores []types.ManagedObjectReference `xml:"datastores,omitempty"` - Metadata CnsVolumeMetadata `xml:"metadata,omitempty"` - BackingObjectDetails BaseCnsBackingObjectDetails `xml:"backingObjectDetails,typeattr"` - Profile []types.BaseVirtualMachineProfileSpec `xml:"profile,omitempty,typeattr"` - CreateSpec BaseCnsBaseCreateSpec `xml:"createSpec,omitempty,typeattr"` - VolumeSource BaseCnsVolumeSource `xml:"volumeSource,omitempty,typeattr"` + Name string `xml:"name" json:"name"` + VolumeType string `xml:"volumeType" json:"volumeType"` + Datastores []types.ManagedObjectReference `xml:"datastores,omitempty" json:"datastores"` + Metadata CnsVolumeMetadata `xml:"metadata,omitempty" json:"metadata"` + BackingObjectDetails BaseCnsBackingObjectDetails `xml:"backingObjectDetails,typeattr" json:"backingObjectDetails"` + Profile []types.BaseVirtualMachineProfileSpec `xml:"profile,omitempty,typeattr" json:"profile"` + CreateSpec BaseCnsBaseCreateSpec `xml:"createSpec,omitempty,typeattr" json:"createSpec"` + VolumeSource BaseCnsVolumeSource `xml:"volumeSource,omitempty,typeattr" json:"volumeSource"` } func init() { @@ -104,8 +104,8 @@ func init() { } type CnsUpdateVolumeMetadataRequestType struct { - This types.ManagedObjectReference `xml:"_this"` - UpdateSpecs []CnsVolumeMetadataUpdateSpec `xml:"updateSpecs,omitempty"` + This types.ManagedObjectReference `xml:"_this" json:"-"` + UpdateSpecs []CnsVolumeMetadataUpdateSpec `xml:"updateSpecs,omitempty" json:"updateSpecs"` } func init() { @@ -119,14 +119,14 @@ func init() { } type CnsUpdateVolumeMetadataResponse struct { - Returnval types.ManagedObjectReference `xml:"returnval"` + Returnval types.ManagedObjectReference `xml:"returnval" json:"returnval"` } type CnsVolumeMetadataUpdateSpec struct { types.DynamicData - VolumeId CnsVolumeId `xml:"volumeId"` - Metadata CnsVolumeMetadata `xml:"metadata,omitempty"` + VolumeId CnsVolumeId `xml:"volumeId" json:"volumeId"` + Metadata CnsVolumeMetadata `xml:"metadata,omitempty" json:"metadata"` } func init() { @@ -134,9 +134,9 @@ func init() { } type CnsDeleteVolumeRequestType struct { - This types.ManagedObjectReference `xml:"_this"` - VolumeIds []CnsVolumeId `xml:"volumeIds"` - DeleteDisk bool `xml:"deleteDisk"` + This types.ManagedObjectReference `xml:"_this" json:"-"` + VolumeIds []CnsVolumeId `xml:"volumeIds" json:"volumeIds"` + DeleteDisk bool `xml:"deleteDisk" json:"deleteDisk"` } func init() { @@ -150,12 +150,12 @@ func init() { } type CnsDeleteVolumeResponse struct { - Returnval types.ManagedObjectReference `xml:"returnval"` + Returnval types.ManagedObjectReference `xml:"returnval" json:"returnval"` } type CnsExtendVolumeRequestType struct { - This types.ManagedObjectReference `xml:"_this"` - ExtendSpecs []CnsVolumeExtendSpec `xml:"extendSpecs,omitempty"` + This types.ManagedObjectReference `xml:"_this" json:"-"` + ExtendSpecs []CnsVolumeExtendSpec `xml:"extendSpecs,omitempty" json:"extendSpecs"` } func init() { @@ -169,14 +169,14 @@ func init() { } type CnsExtendVolumeResponse struct { - Returnval types.ManagedObjectReference `xml:"returnval"` + Returnval types.ManagedObjectReference `xml:"returnval" json:"returnval"` } type CnsVolumeExtendSpec struct { types.DynamicData - VolumeId CnsVolumeId `xml:"volumeId"` - CapacityInMb int64 `xml:"capacityInMb"` + VolumeId CnsVolumeId `xml:"volumeId" json:"volumeId"` + CapacityInMb int64 `xml:"capacityInMb" json:"capacityInMb"` } func init() { @@ -184,8 +184,8 @@ func init() { } type CnsAttachVolumeRequestType struct { - This types.ManagedObjectReference `xml:"_this"` - AttachSpecs []CnsVolumeAttachDetachSpec `xml:"attachSpecs,omitempty"` + This types.ManagedObjectReference `xml:"_this" json:"-"` + AttachSpecs []CnsVolumeAttachDetachSpec `xml:"attachSpecs,omitempty" json:"attachSpecs"` } func init() { @@ -199,12 +199,12 @@ func init() { } type CnsAttachVolumeResponse struct { - Returnval types.ManagedObjectReference `xml:"returnval"` + Returnval types.ManagedObjectReference `xml:"returnval" json:"returnval"` } type CnsDetachVolumeRequestType struct { - This types.ManagedObjectReference `xml:"_this"` - DetachSpecs []CnsVolumeAttachDetachSpec `xml:"detachSpecs,omitempty"` + This types.ManagedObjectReference `xml:"_this" json:"-"` + DetachSpecs []CnsVolumeAttachDetachSpec `xml:"detachSpecs,omitempty" json:"detachSpecs"` } func init() { @@ -218,14 +218,14 @@ func init() { } type CnsDetachVolumeResponse struct { - Returnval types.ManagedObjectReference `xml:"returnval"` + Returnval types.ManagedObjectReference `xml:"returnval" json:"returnval"` } type CnsVolumeAttachDetachSpec struct { types.DynamicData - VolumeId CnsVolumeId `xml:"volumeId"` - Vm types.ManagedObjectReference `xml:"vm"` + VolumeId CnsVolumeId `xml:"volumeId" json:"volumeId"` + Vm types.ManagedObjectReference `xml:"vm" json:"vm"` } func init() { @@ -239,8 +239,8 @@ func init() { } type CnsQueryVolumeRequestType struct { - This types.ManagedObjectReference `xml:"_this"` - Filter CnsQueryFilter `xml:"filter"` + This types.ManagedObjectReference `xml:"_this" json:"-"` + Filter CnsQueryFilter `xml:"filter" json:"filter"` } func init() { @@ -248,7 +248,7 @@ func init() { } type CnsQueryVolumeResponse struct { - Returnval CnsQueryResult `xml:"returnval"` + Returnval CnsQueryResult `xml:"returnval" json:"returnval"` } type CnsQueryVolumeInfo CnsQueryVolumeInfoRequestType @@ -258,12 +258,12 @@ func init() { } type CnsQueryVolumeInfoRequestType struct { - This types.ManagedObjectReference `xml:"_this"` - VolumeIds []CnsVolumeId `xml:"volumes"` + This types.ManagedObjectReference `xml:"_this" json:"-"` + VolumeIds []CnsVolumeId `xml:"volumes" json:"volumeIds"` } type CnsQueryVolumeInfoResponse struct { - Returnval types.ManagedObjectReference `xml:"returnval"` + Returnval types.ManagedObjectReference `xml:"returnval" json:"returnval"` } type CnsQueryAllVolume CnsQueryAllVolumeRequestType @@ -273,9 +273,9 @@ func init() { } type CnsQueryAllVolumeRequestType struct { - This types.ManagedObjectReference `xml:"_this"` - Filter CnsQueryFilter `xml:"filter"` - Selection CnsQuerySelection `xml:"selection"` + This types.ManagedObjectReference `xml:"_this" json:"-"` + Filter CnsQueryFilter `xml:"filter" json:"filter"` + Selection CnsQuerySelection `xml:"selection" json:"selection"` } func init() { @@ -283,17 +283,18 @@ func init() { } type CnsQueryAllVolumeResponse struct { - Returnval CnsQueryResult `xml:"returnval"` + Returnval CnsQueryResult `xml:"returnval" json:"returnval"` } type CnsContainerCluster struct { types.DynamicData - ClusterType string `xml:"clusterType"` - ClusterId string `xml:"clusterId"` - VSphereUser string `xml:"vSphereUser"` - ClusterFlavor string `xml:"clusterFlavor,omitempty"` - ClusterDistribution string `xml:"clusterDistribution,omitempty"` + ClusterType string `xml:"clusterType" json:"clusterType"` + ClusterId string `xml:"clusterId" json:"clusterId"` + VSphereUser string `xml:"vSphereUser" json:"vSphereUser"` + ClusterFlavor string `xml:"clusterFlavor,omitempty" json:"clusterFlavor"` + ClusterDistribution string `xml:"clusterDistribution,omitempty" json:"clusterDistribution"` + Delete bool `xml:"delete,omitempty" json:"delete"` } func init() { @@ -303,16 +304,16 @@ func init() { type CnsVolume struct { types.DynamicData - VolumeId CnsVolumeId `xml:"volumeId"` - DatastoreUrl string `xml:"datastoreUrl,omitempty"` - Name string `xml:"name,omitempty"` - VolumeType string `xml:"volumeType,omitempty"` - StoragePolicyId string `xml:"storagePolicyId,omitempty"` - Metadata CnsVolumeMetadata `xml:"metadata,omitempty"` - BackingObjectDetails BaseCnsBackingObjectDetails `xml:"backingObjectDetails,omitempty"` - ComplianceStatus string `xml:"complianceStatus,omitempty"` - DatastoreAccessibilityStatus string `xml:"datastoreAccessibilityStatus,omitempty"` - HealthStatus string `xml:"healthStatus,omitempty"` + VolumeId CnsVolumeId `xml:"volumeId" json:"volumeId"` + DatastoreUrl string `xml:"datastoreUrl,omitempty" json:"datastoreUrl"` + Name string `xml:"name,omitempty" json:"name"` + VolumeType string `xml:"volumeType,omitempty" json:"volumeType"` + StoragePolicyId string `xml:"storagePolicyId,omitempty" json:"storagePolicyId"` + Metadata CnsVolumeMetadata `xml:"metadata,omitempty" json:"metadata"` + BackingObjectDetails BaseCnsBackingObjectDetails `xml:"backingObjectDetails,omitempty" json:"backingObjectDetails"` + ComplianceStatus string `xml:"complianceStatus,omitempty" json:"complianceStatus"` + DatastoreAccessibilityStatus string `xml:"datastoreAccessibilityStatus,omitempty" json:"datastoreAccessibilityStatus"` + HealthStatus string `xml:"healthStatus,omitempty" json:"healthStatus"` } func init() { @@ -322,8 +323,8 @@ func init() { type CnsVolumeOperationResult struct { types.DynamicData - VolumeId CnsVolumeId `xml:"volumeId,omitempty"` - Fault *types.LocalizedMethodFault `xml:"fault,omitempty"` + VolumeId CnsVolumeId `xml:"volumeId,omitempty" json:"volumeId"` + Fault *types.LocalizedMethodFault `xml:"fault,omitempty" json:"fault"` } func init() { @@ -333,7 +334,7 @@ func init() { type CnsVolumeOperationBatchResult struct { types.DynamicData - VolumeResults []BaseCnsVolumeOperationResult `xml:"volumeResults,omitempty,typeattr"` + VolumeResults []BaseCnsVolumeOperationResult `xml:"volumeResults,omitempty,typeattr" json:"volumeResults"` } func init() { @@ -341,8 +342,8 @@ func init() { } type CnsPlacementResult struct { - Datastore types.ManagedObjectReference `xml:"datastore,omitempty"` - PlacementFaults []*types.LocalizedMethodFault `xml:"placementFaults,omitempty"` + Datastore types.ManagedObjectReference `xml:"datastore,omitempty" json:"datastore"` + PlacementFaults []*types.LocalizedMethodFault `xml:"placementFaults,omitempty" json:"placementFaults"` } func init() { @@ -351,8 +352,8 @@ func init() { type CnsVolumeCreateResult struct { CnsVolumeOperationResult - Name string `xml:"name,omitempty"` - PlacementResults []CnsPlacementResult `xml:"placementResults,omitempty"` + Name string `xml:"name,omitempty" json:"name"` + PlacementResults []CnsPlacementResult `xml:"placementResults,omitempty" json:"placementResults"` } func init() { @@ -362,7 +363,7 @@ func init() { type CnsVolumeAttachResult struct { CnsVolumeOperationResult - DiskUUID string `xml:"diskUUID,omitempty"` + DiskUUID string `xml:"diskUUID,omitempty" json:"diskUUID"` } func init() { @@ -372,7 +373,7 @@ func init() { type CnsVolumeId struct { types.DynamicData - Id string `xml:"id"` + Id string `xml:"id" json:"id"` } func init() { @@ -382,7 +383,7 @@ func init() { type CnsBackingObjectDetails struct { types.DynamicData - CapacityInMb int64 `xml:"capacityInMb,omitempty"` + CapacityInMb int64 `xml:"capacityInMb,omitempty" json:"capacityInMb"` } func init() { @@ -392,10 +393,11 @@ func init() { type CnsBlockBackingDetails struct { CnsBackingObjectDetails - BackingDiskId string `xml:"backingDiskId,omitempty"` - BackingDiskUrlPath string `xml:"backingDiskUrlPath,omitempty"` - BackingDiskObjectId string `xml:"backingDiskObjectId,omitempty"` - AggregatedSnapshotCapacityInMb int64 `xml:"aggregatedSnapshotCapacityInMb,omitempty"` + BackingDiskId string `xml:"backingDiskId,omitempty" json:"backingDiskId"` + BackingDiskUrlPath string `xml:"backingDiskUrlPath,omitempty" json:"backingDiskUrlPath"` + BackingDiskObjectId string `xml:"backingDiskObjectId,omitempty" json:"backingDiskObjectId"` + AggregatedSnapshotCapacityInMb int64 `xml:"aggregatedSnapshotCapacityInMb,omitempty" json:"aggregatedSnapshotCapacityInMb"` + BackingDiskPath string `xml:"backingDiskPath,omitempty" json:"backingDiskPath"` } func init() { @@ -405,7 +407,7 @@ func init() { type CnsFileBackingDetails struct { CnsBackingObjectDetails - BackingFileId string `xml:"backingFileId,omitempty"` + BackingFileId string `xml:"backingFileId,omitempty" json:"backingFileId"` } func init() { @@ -415,8 +417,8 @@ func init() { type CnsVsanFileShareBackingDetails struct { CnsFileBackingDetails - Name string `xml:"name,omitempty"` - AccessPoints []types.KeyValue `xml:"accessPoints,omitempty"` + Name string `xml:"name,omitempty" json:"name"` + AccessPoints []types.KeyValue `xml:"accessPoints,omitempty" json:"accessPoints"` } func init() { @@ -441,8 +443,8 @@ func init() { type CnsVSANFileCreateSpec struct { CnsFileCreateSpec - SoftQuotaInMb int64 `xml:"softQuotaInMb,omitempty"` - Permission []vsanfstypes.VsanFileShareNetPermission `xml:"permission,omitempty,typeattr"` + SoftQuotaInMb int64 `xml:"softQuotaInMb,omitempty" json:"softQuotaInMb"` + Permission []vsanfstypes.VsanFileShareNetPermission `xml:"permission,omitempty,typeattr" json:"permission"` } func init() { @@ -452,16 +454,16 @@ func init() { type CnsQueryFilter struct { types.DynamicData - VolumeIds []CnsVolumeId `xml:"volumeIds,omitempty"` - Names []string `xml:"names,omitempty"` - ContainerClusterIds []string `xml:"containerClusterIds,omitempty"` - StoragePolicyId string `xml:"storagePolicyId,omitempty"` - Datastores []types.ManagedObjectReference `xml:"datastores,omitempty"` - Labels []types.KeyValue `xml:"labels,omitempty"` - ComplianceStatus string `xml:"complianceStatus,omitempty"` - DatastoreAccessibilityStatus string `xml:"datastoreAccessibilityStatus,omitempty"` - Cursor *CnsCursor `xml:"cursor,omitempty"` - HealthStatus string `xml:"healthStatus,omitempty"` + VolumeIds []CnsVolumeId `xml:"volumeIds,omitempty" json:"volumeIds"` + Names []string `xml:"names,omitempty" json:"names"` + ContainerClusterIds []string `xml:"containerClusterIds,omitempty" json:"containerClusterIds"` + StoragePolicyId string `xml:"storagePolicyId,omitempty" json:"storagePolicyId"` + Datastores []types.ManagedObjectReference `xml:"datastores,omitempty" json:"datastores"` + Labels []types.KeyValue `xml:"labels,omitempty" json:"labels"` + ComplianceStatus string `xml:"complianceStatus,omitempty" json:"complianceStatus"` + DatastoreAccessibilityStatus string `xml:"datastoreAccessibilityStatus,omitempty" json:"datastoreAccessibilityStatus"` + Cursor *CnsCursor `xml:"cursor,omitempty" json:"cursor"` + HealthStatus string `xml:"healthStatus,omitempty" json:"healthStatus"` } func init() { @@ -471,14 +473,14 @@ func init() { type CnsQuerySelection struct { types.DynamicData - Names []string `xml:"names,omitempty"` + Names []string `xml:"names,omitempty" json:"names"` } type CnsQueryResult struct { types.DynamicData - Volumes []CnsVolume `xml:"volumes,omitempty"` - Cursor CnsCursor `xml:"cursor"` + Volumes []CnsVolume `xml:"volumes,omitempty" json:"volumes"` + Cursor CnsCursor `xml:"cursor" json:"cursor"` } func init() { @@ -496,7 +498,7 @@ func init() { type CnsBlockVolumeInfo struct { CnsVolumeInfo - VStorageObject types.VStorageObject `xml:"vStorageObject"` + VStorageObject types.VStorageObject `xml:"vStorageObject" json:"vStorageObject"` } func init() { @@ -506,7 +508,7 @@ func init() { type CnsQueryVolumeInfoResult struct { CnsVolumeOperationResult - VolumeInfo BaseCnsVolumeInfo `xml:"volumeInfo,typeattr,omitempty"` + VolumeInfo BaseCnsVolumeInfo `xml:"volumeInfo,typeattr,omitempty" json:"volumeInfo"` } func init() { @@ -514,8 +516,8 @@ func init() { } type CnsRelocateVolumeRequestType struct { - This types.ManagedObjectReference `xml:"_this"` - RelocateSpecs []BaseCnsVolumeRelocateSpec `xml:"relocateSpecs,typeattr"` + This types.ManagedObjectReference `xml:"_this" json:"-"` + RelocateSpecs []BaseCnsVolumeRelocateSpec `xml:"relocateSpecs,typeattr" json:"relocateSpecs"` } func init() { @@ -529,16 +531,16 @@ func init() { } type CnsRelocateVolumeResponse struct { - Returnval types.ManagedObjectReference `xml:"returnval"` + Returnval types.ManagedObjectReference `xml:"returnval" json:"returnval"` } type CnsVolumeRelocateSpec struct { types.DynamicData - VolumeId CnsVolumeId `xml:"volumeId"` - Datastore types.ManagedObjectReference `xml:"datastore"` - Profile []types.BaseVirtualMachineProfileSpec `xml:"profile,omitempty,typeattr"` - ServiceLocator *types.ServiceLocator `xml:"serviceLocator,omitempty"` + VolumeId CnsVolumeId `xml:"volumeId" json:"volumeId"` + Datastore types.ManagedObjectReference `xml:"datastore" json:"datastore"` + Profile []types.BaseVirtualMachineProfileSpec `xml:"profile,omitempty,typeattr" json:"profile"` + ServiceLocator *types.ServiceLocator `xml:"serviceLocator,omitempty" json:"serviceLocator"` } func init() { @@ -571,9 +573,9 @@ func init() { type CnsCursor struct { types.DynamicData - Offset int64 `xml:"offset"` - Limit int64 `xml:"limit"` - TotalRecords int64 `xml:"totalRecords,omitempty"` + Offset int64 `xml:"offset" json:"offset"` + Limit int64 `xml:"limit" json:"limit"` + TotalRecords int64 `xml:"totalRecords,omitempty" json:"totalRecords"` } func init() { @@ -583,7 +585,7 @@ func init() { type CnsFault struct { types.BaseMethodFault `xml:"fault,typeattr"` - Reason string `xml:"reason,omitempty"` + Reason string `xml:"reason,omitempty" json:"reason"` } func init() { @@ -593,7 +595,7 @@ func init() { type CnsVolumeNotFoundFault struct { CnsFault - VolumeId CnsVolumeId `xml:"volumeId"` + VolumeId CnsVolumeId `xml:"volumeId" json:"volumeId"` } func init() { @@ -603,7 +605,7 @@ func init() { type CnsAlreadyRegisteredFault struct { CnsFault `xml:"fault,typeattr"` - VolumeId CnsVolumeId `xml:"volumeId,omitempty"` + VolumeId CnsVolumeId `xml:"volumeId,omitempty" json:"volumeId"` } func init() { @@ -613,8 +615,8 @@ func init() { type CnsSnapshotNotFoundFault struct { CnsFault - VolumeId CnsVolumeId `xml:"volumeId,omitempty"` - SnapshotId CnsSnapshotId `xml:"SnapshotId"` + VolumeId CnsVolumeId `xml:"volumeId,omitempty" json:"volumeId"` + SnapshotId CnsSnapshotId `xml:"SnapshotId" json:"snapshotId"` } func init() { @@ -624,9 +626,9 @@ func init() { type CnsSnapshotCreatedFault struct { CnsFault - VolumeId CnsVolumeId `xml:"volumeId"` - SnapshotId CnsSnapshotId `xml:"SnapshotId"` - Datastore types.ManagedObjectReference `xml:"datastore"` + VolumeId CnsVolumeId `xml:"volumeId" json:"volumeId"` + SnapshotId CnsSnapshotId `xml:"SnapshotId" json:"snapshotId"` + Datastore types.ManagedObjectReference `xml:"datastore" json:"datastore"` } func init() { @@ -640,8 +642,8 @@ func init() { } type CnsConfigureVolumeACLsRequestType struct { - This types.ManagedObjectReference `xml:"_this"` - ACLConfigSpecs []CnsVolumeACLConfigureSpec `xml:"ACLConfigSpecs"` + This types.ManagedObjectReference `xml:"_this" json:"-"` + ACLConfigSpecs []CnsVolumeACLConfigureSpec `xml:"ACLConfigSpecs" json:"aclConfigSpecs"` } func init() { @@ -649,20 +651,20 @@ func init() { } type CnsConfigureVolumeACLsResponse struct { - Returnval types.ManagedObjectReference `xml:"returnval"` + Returnval types.ManagedObjectReference `xml:"returnval" json:"returnval"` } type CnsVolumeACLConfigureSpec struct { types.DynamicData - VolumeId CnsVolumeId `xml:"volumeId"` - AccessControlSpecList []CnsNFSAccessControlSpec `xml:"accessControlSpecList,typeattr"` + VolumeId CnsVolumeId `xml:"volumeId" json:"volumeId"` + AccessControlSpecList []CnsNFSAccessControlSpec `xml:"accessControlSpecList,typeattr" json:"accessControlSpecList"` } type CnsNFSAccessControlSpec struct { types.DynamicData - Permission []vsanfstypes.VsanFileShareNetPermission `xml:"netPermission,omitempty,typeattr"` - Delete bool `xml:"delete,omitempty"` + Permission []vsanfstypes.VsanFileShareNetPermission `xml:"netPermission,omitempty,typeattr" json:"permission"` + Delete bool `xml:"delete,omitempty" json:"delete"` } func init() { @@ -676,9 +678,9 @@ func init() { } type CnsQueryAsyncRequestType struct { - This types.ManagedObjectReference `xml:"_this"` - Filter CnsQueryFilter `xml:"filter"` - Selection *CnsQuerySelection `xml:"selection,omitempty"` + This types.ManagedObjectReference `xml:"_this" json:"-"` + Filter CnsQueryFilter `xml:"filter" json:"filter"` + Selection *CnsQuerySelection `xml:"selection,omitempty" json:"selection"` } func init() { @@ -686,13 +688,13 @@ func init() { } type CnsQueryAsyncResponse struct { - Returnval types.ManagedObjectReference `xml:"returnval"` + Returnval types.ManagedObjectReference `xml:"returnval" json:"returnval"` } type CnsAsyncQueryResult struct { CnsVolumeOperationResult - QueryResult CnsQueryResult `xml:"queryResult,omitempty"` + QueryResult CnsQueryResult `xml:"queryResult,omitempty" json:"queryResult"` } func init() { @@ -702,8 +704,8 @@ func init() { // Cns Snapshot Types type CnsCreateSnapshotsRequestType struct { - This types.ManagedObjectReference `xml:"_this"` - SnapshotSpecs []CnsSnapshotCreateSpec `xml:"snapshotSpecs,omitempty"` + This types.ManagedObjectReference `xml:"_this" json:"-"` + SnapshotSpecs []CnsSnapshotCreateSpec `xml:"snapshotSpecs,omitempty" json:"snapshotSpecs"` } func init() { @@ -717,14 +719,14 @@ func init() { } type CnsCreateSnapshotsResponse struct { - Returnval types.ManagedObjectReference `xml:"returnval"` + Returnval types.ManagedObjectReference `xml:"returnval" json:"returnval"` } type CnsSnapshotCreateSpec struct { types.DynamicData - VolumeId CnsVolumeId `xml:"volumeId"` - Description string `xml:"description"` + VolumeId CnsVolumeId `xml:"volumeId" json:"volumeId"` + Description string `xml:"description" json:"description"` } func init() { @@ -732,8 +734,8 @@ func init() { } type CnsDeleteSnapshotsRequestType struct { - This types.ManagedObjectReference `xml:"_this"` - SnapshotDeleteSpecs []CnsSnapshotDeleteSpec `xml:"snapshotDeleteSpecs,omitempty"` + This types.ManagedObjectReference `xml:"_this" json:"-"` + SnapshotDeleteSpecs []CnsSnapshotDeleteSpec `xml:"snapshotDeleteSpecs,omitempty" json:"snapshotDeleteSpecs"` } func init() { @@ -747,13 +749,13 @@ func init() { } type CnsDeleteSnapshotsResponse struct { - Returnval types.ManagedObjectReference `xml:"returnval"` + Returnval types.ManagedObjectReference `xml:"returnval" json:"returnval"` } type CnsSnapshotId struct { types.DynamicData - Id string `xml:"id"` + Id string `xml:"id" json:"id"` } func init() { @@ -763,8 +765,8 @@ func init() { type CnsSnapshotDeleteSpec struct { types.DynamicData - VolumeId CnsVolumeId `xml:"volumeId"` - SnapshotId CnsSnapshotId `xml:"snapshotId"` + VolumeId CnsVolumeId `xml:"volumeId" json:"volumeId"` + SnapshotId CnsSnapshotId `xml:"snapshotId" json:"snapshotId"` } func init() { @@ -774,10 +776,10 @@ func init() { type CnsSnapshot struct { types.DynamicData - SnapshotId CnsSnapshotId `xml:"snapshotId"` - VolumeId CnsVolumeId `xml:"volumeId"` - Description string `xml:"description,omitempty"` - CreateTime time.Time `xml:"createTime"` + SnapshotId CnsSnapshotId `xml:"snapshotId" json:"snapshotId"` + VolumeId CnsVolumeId `xml:"volumeId" json:"volumeId"` + Description string `xml:"description,omitempty" json:"description"` + CreateTime time.Time `xml:"createTime" json:"createTime"` } func init() { @@ -794,8 +796,8 @@ func init() { type CnsSnapshotCreateResult struct { CnsSnapshotOperationResult - Snapshot CnsSnapshot `xml:"snapshot,omitempty"` - AggregatedSnapshotCapacityInMb int64 `xml:"aggregatedSnapshotCapacityInMb,omitempty"` + Snapshot CnsSnapshot `xml:"snapshot,omitempty" json:"snapshot"` + AggregatedSnapshotCapacityInMb int64 `xml:"aggregatedSnapshotCapacityInMb,omitempty" json:"aggregatedSnapshotCapacityInMb"` } func init() { @@ -804,8 +806,8 @@ func init() { type CnsSnapshotDeleteResult struct { CnsSnapshotOperationResult - SnapshotId CnsSnapshotId `xml:"snapshotId,omitempty"` - AggregatedSnapshotCapacityInMb int64 `xml:"aggregatedSnapshotCapacityInMb,omitempty"` + SnapshotId CnsSnapshotId `xml:"snapshotId,omitempty" json:"snapshotId"` + AggregatedSnapshotCapacityInMb int64 `xml:"aggregatedSnapshotCapacityInMb,omitempty" json:"aggregatedSnapshotCapacityInMb"` } func init() { @@ -823,8 +825,8 @@ func init() { type CnsSnapshotVolumeSource struct { CnsVolumeSource - VolumeId CnsVolumeId `xml:"volumeId,omitempty"` - SnapshotId CnsSnapshotId `xml:"snapshotId,omitempty"` + VolumeId CnsVolumeId `xml:"volumeId,omitempty" json:"volumeId"` + SnapshotId CnsSnapshotId `xml:"snapshotId,omitempty" json:"snapshotId"` } func init() { @@ -834,8 +836,8 @@ func init() { // CNS QuerySnapshots related types type CnsQuerySnapshotsRequestType struct { - This types.ManagedObjectReference `xml:"_this"` - SnapshotQueryFilter CnsSnapshotQueryFilter `xml:"snapshotQueryFilter"` + This types.ManagedObjectReference `xml:"_this" json:"-"` + SnapshotQueryFilter CnsSnapshotQueryFilter `xml:"snapshotQueryFilter" json:"snapshotQueryFilter"` } func init() { @@ -849,14 +851,14 @@ func init() { } type CnsQuerySnapshotsResponse struct { - Returnval types.ManagedObjectReference `xml:"returnval"` + Returnval types.ManagedObjectReference `xml:"returnval" json:"returnval"` } type CnsSnapshotQueryResult struct { types.DynamicData - Entries []CnsSnapshotQueryResultEntry `xml:"entries,omitempty"` - Cursor CnsCursor `xml:"cursor"` + Entries []CnsSnapshotQueryResultEntry `xml:"entries,omitempty" json:"entries"` + Cursor CnsCursor `xml:"cursor" json:"cursor"` } func init() { @@ -866,8 +868,8 @@ func init() { type CnsSnapshotQueryResultEntry struct { types.DynamicData - Snapshot CnsSnapshot `xml:"snapshot,omitempty"` - Error *types.LocalizedMethodFault `xml:"error,omitempty"` + Snapshot CnsSnapshot `xml:"snapshot,omitempty" json:"snapshot"` + Error *types.LocalizedMethodFault `xml:"error,omitempty" json:"error"` } func init() { @@ -877,8 +879,8 @@ func init() { type CnsSnapshotQueryFilter struct { types.DynamicData - SnapshotQuerySpecs []CnsSnapshotQuerySpec `xml:"snapshotQuerySpecs,omitempty"` - Cursor *CnsCursor `xml:"cursor,omitempty"` + SnapshotQuerySpecs []CnsSnapshotQuerySpec `xml:"snapshotQuerySpecs,omitempty" json:"snapshotQuerySpecs"` + Cursor *CnsCursor `xml:"cursor,omitempty" json:"cursor"` } func init() { @@ -888,8 +890,8 @@ func init() { type CnsSnapshotQuerySpec struct { types.DynamicData - VolumeId CnsVolumeId `xml:"volumeId"` - SnapshotId *CnsSnapshotId `xml:"snapshotId,omitempty"` + VolumeId CnsVolumeId `xml:"volumeId" json:"volumeId"` + SnapshotId *CnsSnapshotId `xml:"snapshotId,omitempty" json:"snapshotId"` } func init() { @@ -903,8 +905,8 @@ func init() { } type CnsReconfigVolumePolicyRequestType struct { - This types.ManagedObjectReference `xml:"_this"` - VolumePolicyReconfigSpecs []CnsVolumePolicyReconfigSpec `xml:"volumePolicyReconfigSpecs,omitempty"` + This types.ManagedObjectReference `xml:"_this" json:"-"` + VolumePolicyReconfigSpecs []CnsVolumePolicyReconfigSpec `xml:"volumePolicyReconfigSpecs,omitempty" json:"volumePolicyReconfigSpecs"` } func init() { @@ -912,14 +914,14 @@ func init() { } type CnsReconfigVolumePolicyResponse struct { - Returnval types.ManagedObjectReference `xml:"returnval"` + Returnval types.ManagedObjectReference `xml:"returnval" json:"returnval"` } type CnsVolumePolicyReconfigSpec struct { types.DynamicData - VolumeId CnsVolumeId `xml:"volumeId"` - Profile []types.BaseVirtualMachineProfileSpec `xml:"profile,omitempty,typeattr"` + VolumeId CnsVolumeId `xml:"volumeId" json:"volumeId"` + Profile []types.BaseVirtualMachineProfileSpec `xml:"profile,omitempty,typeattr" json:"profile"` } func init() { @@ -933,9 +935,9 @@ func init() { } type CnsSyncDatastoreRequestType struct { - This types.ManagedObjectReference `xml:"_this"` - DatastoreUrl string `xml:"datastoreUrl,omitempty"` - FullSync *bool `xml:"fullSync"` + This types.ManagedObjectReference `xml:"_this" json:"-"` + DatastoreUrl string `xml:"datastoreUrl,omitempty" json:"datastoreUrl"` + FullSync *bool `xml:"fullSync" json:"fullSync"` } func init() { @@ -943,5 +945,5 @@ func init() { } type CnsSyncDatastoreResponse struct { - Returnval types.ManagedObjectReference `xml:"returnval"` + Returnval types.ManagedObjectReference `xml:"returnval" json:"returnval"` } diff --git a/vendor/github.com/vmware/govmomi/cns/types/unreleased_types.go b/vendor/github.com/vmware/govmomi/cns/types/unreleased_types.go new file mode 100644 index 000000000..d7ff5e9f3 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/cns/types/unreleased_types.go @@ -0,0 +1,68 @@ +/* +Copyright (c) 2024-2024 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" +) + +// CnsBlockCreateSpec is the specification for creating block volumes. +type CnsBlockCreateSpec struct { + CnsBaseCreateSpec + + // Crypto specifies the encryption settings for the volume to be created. + // Works with block volumes only. + CryptoSpec types.BaseCryptoSpec `xml:"cryptoSpec,omitempty,typeattr" json:"cryptoSpec"` +} + +func init() { + types.Add("CnsBlockCreateSpec", reflect.TypeOf((*CnsBlockCreateSpec)(nil)).Elem()) +} + +type CnsUpdateVolumeCryptoRequestType struct { + This types.ManagedObjectReference `xml:"_this" json:"-"` + UpdateSpecs []CnsVolumeCryptoUpdateSpec `xml:"updateSpecs,omitempty" json:"updateSpecs"` +} + +func init() { + types.Add("CnsUpdateVolumeCryptoRequestType", reflect.TypeOf((*CnsUpdateVolumeCryptoRequestType)(nil)).Elem()) +} + +type CnsUpdateVolumeCrypto CnsUpdateVolumeCryptoRequestType + +func init() { + types.Add("CnsUpdateVolumeCrypto", reflect.TypeOf((*CnsUpdateVolumeCrypto)(nil)).Elem()) +} + +type CnsUpdateVolumeCryptoResponse struct { + Returnval types.ManagedObjectReference `xml:"returnval" json:"returnval"` +} + +// CnsVolumeCryptoUpdateSpec is the specification for volume crypto update operation. +type CnsVolumeCryptoUpdateSpec struct { + types.DynamicData + + VolumeId CnsVolumeId `xml:"volumeId" json:"volumeId"` + Profile []types.BaseVirtualMachineProfileSpec `xml:"profile,omitempty,typeattr" json:"profile"` + DisksCrypto *types.DiskCryptoSpec `xml:"disksCrypto,omitempty" json:"disksCrypto"` +} + +func init() { + types.Add("CnsVolumeCryptoUpdateSpec", reflect.TypeOf((*CnsVolumeCryptoUpdateSpec)(nil)).Elem()) +} diff --git a/vendor/github.com/vmware/govmomi/cns/unreleased_client.go b/vendor/github.com/vmware/govmomi/cns/unreleased_client.go new file mode 100644 index 000000000..3890d535f --- /dev/null +++ b/vendor/github.com/vmware/govmomi/cns/unreleased_client.go @@ -0,0 +1,38 @@ +/* +Copyright (c) 2024-2024 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 cns + +import ( + "context" + + "github.com/vmware/govmomi/cns/methods" + cnstypes "github.com/vmware/govmomi/cns/types" + "github.com/vmware/govmomi/object" +) + +// UpdateVolumeCrypto updates container volumes with given crypto specifications. +func (c *Client) UpdateVolumeCrypto(ctx context.Context, updateSpecList []cnstypes.CnsVolumeCryptoUpdateSpec) (*object.Task, error) { + req := cnstypes.CnsUpdateVolumeCrypto{ + This: CnsVolumeManagerInstance, + UpdateSpecs: updateSpecList, + } + res, err := methods.CnsUpdateVolumeCrypto(ctx, c, &req) + if err != nil { + return nil, err + } + return object.NewTask(c.vim25Client, res.Returnval), nil +} diff --git a/vendor/github.com/vmware/govmomi/fault/fault.go b/vendor/github.com/vmware/govmomi/fault/fault.go new file mode 100644 index 000000000..40f2bd1e9 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/fault/fault.go @@ -0,0 +1,317 @@ +/* +Copyright (c) 2024-2024 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 fault + +import ( + "reflect" + + "github.com/vmware/govmomi/vim25/types" +) + +// As finds the first fault in the error's tree that matches target, and if one +// is found, sets the target to that fault value and returns the fault's +// localized message and true. Otherwise, false is returned. +// +// The tree is inspected according to the object type. If the object implements +// Golang's error interface, the Unwrap() error or Unwrap() []error methods are +// repeatedly checked for additional errors. If the object implements GoVmomi's +// BaseMethodFault or HasLocalizedMethodFault interfaces, the object is checked +// for an underlying FaultCause. When err wraps multiple errors or faults, err +// is examined followed by a depth-first traversal of its children. +// +// An error matches target if the error's concrete value is assignable to the +// value pointed to by target, or if the error has a method +// AsFault(BaseMethodFault) (string, bool) such that AsFault(BaseMethodFault) +// returns true. In the latter case, the AsFault method is responsible for +// setting target. +// +// An error type might provide an AsFault method so it can be treated as if it +// were a different error type. +// +// This function panics if err does not implement error, types.BaseMethodFault, +// types.HasLocalizedMethodFault, Fault() types.BaseMethodFault, or if target is +// not a pointer. +func As(err, target any) (localizedMessage string, okay bool) { + if err == nil { + return + } + if target == nil { + panic("fault: target cannot be nil") + } + val := reflect.ValueOf(target) + typ := val.Type() + if typ.Kind() != reflect.Ptr || val.IsNil() { + panic("fault: target must be a non-nil pointer") + } + targetType := typ.Elem() + if targetType.Kind() != reflect.Interface && + !targetType.Implements(baseMethodFaultType) { + panic("fault: *target must be interface or implement BaseMethodFault") + } + if !as(err, target, val, targetType, &localizedMessage) { + return "", false + } + return localizedMessage, true +} + +func as( + err, + target any, + targetVal reflect.Value, + targetType reflect.Type, + localizedMsg *string) bool { + + for { + if reflect.TypeOf(err).AssignableTo(targetType) { + targetVal.Elem().Set(reflect.ValueOf(err)) + return true + } + if tErr, ok := err.(hasAsFault); ok { + if msg, ok := tErr.AsFault(target); ok { + *localizedMsg = msg + return true + } + return false + } + switch tErr := err.(type) { + case types.HasLocalizedMethodFault: + if fault := tErr.GetLocalizedMethodFault(); fault != nil { + *localizedMsg = fault.LocalizedMessage + if fault.Fault != nil { + return as( + fault.Fault, + target, + targetVal, + targetType, + localizedMsg) + } + } + return false + case types.BaseMethodFault: + if fault := tErr.GetMethodFault(); fault != nil { + if fault.FaultCause != nil { + *localizedMsg = fault.FaultCause.LocalizedMessage + return as( + fault.FaultCause, + target, + targetVal, + targetType, + localizedMsg) + } + } + return false + case hasFault: + if fault := tErr.Fault(); fault != nil { + return as(fault, target, targetVal, targetType, localizedMsg) + } + return false + case unwrappableError: + if err = tErr.Unwrap(); err == nil { + return false + } + case unwrappableErrorSlice: + for _, err := range tErr.Unwrap() { + if err == nil { + continue + } + return as(err, target, targetVal, targetType, localizedMsg) + } + return false + default: + return false + } + } +} + +// Is reports whether any fault in err's tree matches target. +// +// The tree is inspected according to the object type. If the object implements +// Golang's error interface, the Unwrap() error or Unwrap() []error methods are +// repeatedly checked for additional errors. If the object implements GoVmomi's +// BaseMethodFault or HasLocalizedMethodFault interfaces, the object is checked +// for an underlying FaultCause. When err wraps multiple errors or faults, err +// is examined followed by a depth-first traversal of its children. +// +// An error is considered to match a target if it is equal to that target or if +// it implements a method IsFault(BaseMethodFault) bool such that +// IsFault(BaseMethodFault) returns true. +// +// An error type might provide an IsFault method so it can be treated as +// equivalent to an existing fault. For example, if MyFault defines: +// +// func (m MyFault) IsFault(target BaseMethodFault) bool { +// return target == &types.NotSupported{} +// } +// +// then IsFault(MyError{}, &types.NotSupported{}) returns true. An IsFault +// method should only shallowly compare err and the target and not unwrap +// either. +func Is(err any, target types.BaseMethodFault) bool { + if target == nil { + return err == target + } + isComparable := reflect.TypeOf(target).Comparable() + return is(err, target, isComparable) +} + +func is(err any, target types.BaseMethodFault, targetComparable bool) bool { + for { + if targetComparable && err == target { + return true + } + if tErr, ok := err.(hasIsFault); ok && tErr.IsFault(target) { + return true + } + switch tErr := err.(type) { + case types.HasLocalizedMethodFault: + fault := tErr.GetLocalizedMethodFault() + if fault == nil { + return false + } + err = fault.Fault + case types.BaseMethodFault: + if reflect.ValueOf(err).Type() == reflect.ValueOf(target).Type() { + return true + } + fault := tErr.GetMethodFault() + if fault == nil { + return false + } + err = fault.FaultCause + case hasFault: + if err = tErr.Fault(); err == nil { + return false + } + case unwrappableError: + if err = tErr.Unwrap(); err == nil { + return false + } + case unwrappableErrorSlice: + for _, err := range tErr.Unwrap() { + if is(err, target, targetComparable) { + return true + } + } + return false + default: + return false + } + } +} + +// OnFaultFn is called for every fault encountered when inspecting an error +// or fault for a fault tree. The In function returns when the entire tree is +// inspected or the OnFaultFn returns true. +type OnFaultFn func( + fault types.BaseMethodFault, + localizedMessage string, + localizableMessages []types.LocalizableMessage) bool + +// In invokes onFaultFn for each fault in err's tree. +// +// The tree is inspected according to the object type. If the object implements +// Golang's error interface, the Unwrap() error or Unwrap() []error methods are +// repeatedly checked for additional errors. If the object implements GoVmomi's +// BaseMethodFault or HasLocalizedMethodFault interfaces, the object is checked +// for an underlying FaultCause. When err wraps multiple errors or faults, err +// is examined followed by a depth-first traversal of its children. +// +// This function panics if err does not implement error, types.BaseMethodFault, +// types.HasLocalizedMethodFault, Fault() types.BaseMethodFault, or if onFaultFn +// is nil. +func In(err any, onFaultFn OnFaultFn) { + if onFaultFn == nil { + panic("fault: onFaultFn must not be nil") + } + switch tErr := err.(type) { + case types.HasLocalizedMethodFault: + inFault(tErr.GetLocalizedMethodFault(), onFaultFn) + case types.BaseMethodFault: + inFault(&types.LocalizedMethodFault{Fault: tErr}, onFaultFn) + case hasFault: + if fault := tErr.Fault(); fault != nil { + inFault(&types.LocalizedMethodFault{Fault: fault}, onFaultFn) + } + case unwrappableError: + In(tErr.Unwrap(), onFaultFn) + case unwrappableErrorSlice: + for _, uErr := range tErr.Unwrap() { + if uErr == nil { + continue + } + In(uErr, onFaultFn) + } + case error: + // No-op + default: + panic("fault: err must implement error, types.BaseMethodFault, or " + + "types.HasLocalizedMethodFault") + } +} + +func inFault( + localizedMethodFault *types.LocalizedMethodFault, + onFaultFn OnFaultFn) { + + if localizedMethodFault == nil { + return + } + + fault := localizedMethodFault.Fault + if fault == nil { + return + } + + var ( + faultCause *types.LocalizedMethodFault + faultMessages []types.LocalizableMessage + ) + + if methodFault := fault.GetMethodFault(); methodFault != nil { + faultCause = methodFault.FaultCause + faultMessages = methodFault.FaultMessage + } + + if onFaultFn(fault, localizedMethodFault.LocalizedMessage, faultMessages) { + return + } + + // Check the fault's children. + inFault(faultCause, onFaultFn) +} + +type hasFault interface { + Fault() types.BaseMethodFault +} + +type hasAsFault interface { + AsFault(target any) (string, bool) +} + +type hasIsFault interface { + IsFault(target types.BaseMethodFault) bool +} + +type unwrappableError interface { + Unwrap() error +} + +type unwrappableErrorSlice interface { + Unwrap() []error +} + +var baseMethodFaultType = reflect.TypeOf((*types.BaseMethodFault)(nil)).Elem() diff --git a/vendor/github.com/vmware/govmomi/find/doc.go b/vendor/github.com/vmware/govmomi/find/doc.go index d22e88353..a42a910a3 100644 --- a/vendor/github.com/vmware/govmomi/find/doc.go +++ b/vendor/github.com/vmware/govmomi/find/doc.go @@ -1,11 +1,11 @@ /* -Copyright (c) 2014-2017 VMware, Inc. All Rights Reserved. +Copyright (c) 2017-2022 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 +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, @@ -32,6 +32,9 @@ 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/...") +Finder methods can also convert a managed object reference (aka MOID) to an object instance. +For example: VirtualMachine("VirtualMachine:vm-123") or VirtualMachine("vm-123") + See also: https://github.com/vmware/govmomi/blob/main/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 887ddd5c7..b49495974 100644 --- a/vendor/github.com/vmware/govmomi/find/finder.go +++ b/vendor/github.com/vmware/govmomi/find/finder.go @@ -1,11 +1,11 @@ /* -Copyright (c) 2014-2023 VMware, Inc. All Rights Reserved. +Copyright (c) 2014-2024 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 +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, @@ -22,6 +22,7 @@ import ( "path" "strings" + "github.com/vmware/govmomi/fault" "github.com/vmware/govmomi/internal" "github.com/vmware/govmomi/list" "github.com/vmware/govmomi/object" @@ -116,6 +117,19 @@ func (f *Finder) findRoot(ctx context.Context, root *list.Element, parts []strin func (f *Finder) find(ctx context.Context, arg string, s *spec) ([]list.Element, error) { isPath := strings.Contains(arg, "/") + if !isPath { + if ref := object.ReferenceFromString(arg); ref != nil { + p, err := InventoryPath(ctx, f.client, *ref) + if err == nil { + if t, ok := mo.Value(*ref); ok { + return []list.Element{{Object: t, Path: p}}, nil + } + } else if !fault.Is(err, &types.ManagedObjectNotFound{}) { + return nil, err + } // else fall through to name based lookup + } + } + root := list.Element{ Object: object.NewRootFolder(f.client), Path: "/", @@ -821,11 +835,6 @@ func (f *Finder) Network(ctx context.Context, path string) (object.NetworkRefere } func (f *Finder) networkByID(ctx context.Context, path string) (object.NetworkReference, error) { - if ref := object.ReferenceFromString(path); ref != nil { - // This is a MOID - return object.NewReference(f.client, *ref).(object.NetworkReference), nil - } - kind := []string{"DistributedVirtualPortgroup"} m := view.NewManager(f.client) diff --git a/vendor/github.com/vmware/govmomi/govc/host/esxcli/esxcli.go b/vendor/github.com/vmware/govmomi/govc/host/esxcli/esxcli.go deleted file mode 100644 index 3ddd14300..000000000 --- a/vendor/github.com/vmware/govmomi/govc/host/esxcli/esxcli.go +++ /dev/null @@ -1,190 +0,0 @@ -/* -Copyright (c) 2014-2023 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 esxcli - -import ( - "context" - "errors" - "flag" - "fmt" - "io" - "sort" - "strings" - "text/tabwriter" - - "github.com/vmware/govmomi/govc/cli" - "github.com/vmware/govmomi/govc/flags" -) - -type esxcli struct { - *flags.HostSystemFlag - - hints bool -} - -func init() { - cli.Register("host.esxcli", &esxcli{}) -} - -func (cmd *esxcli) Usage() string { - return "COMMAND [ARG]..." -} - -func (cmd *esxcli) Register(ctx context.Context, f *flag.FlagSet) { - cmd.HostSystemFlag, ctx = flags.NewHostSystemFlag(ctx) - cmd.HostSystemFlag.Register(ctx, f) - - f.BoolVar(&cmd.hints, "hints", true, "Use command info hints when formatting output") -} - -func (cmd *esxcli) Description() string { - return `Invoke esxcli command on HOST. - -Output is rendered in table form when possible, unless disabled with '-hints=false'. - -Examples: - govc host.esxcli network ip connection list - govc host.esxcli system settings advanced set -o /Net/GuestIPHack -i 1 - govc host.esxcli network firewall ruleset set -r remoteSerialPort -e true - govc host.esxcli network firewall set -e false - govc host.esxcli hardware platform get` -} - -func (cmd *esxcli) Process(ctx context.Context) error { - if err := cmd.HostSystemFlag.Process(ctx); err != nil { - return err - } - return nil -} - -func (cmd *esxcli) Run(ctx context.Context, f *flag.FlagSet) error { - if f.NArg() == 0 { - return flag.ErrHelp - } - - c, err := cmd.Client() - if err != nil { - return err - } - - host, err := cmd.HostSystem() - if err != nil { - return err - } - - e, err := NewExecutor(c, host) - if err != nil { - return err - } - - res, err := e.Run(f.Args()) - if err != nil { - if f, ok := err.(*Fault); ok { - return errors.New(f.messageDetail()) - } - return err - } - - if len(res.Values) == 0 { - if res.String != "" { - fmt.Print(res.String) - if !strings.HasSuffix(res.String, "\n") { - fmt.Println() - } - } - return nil - } - - return cmd.WriteResult(&result{res, cmd}) -} - -type result struct { - *Response - cmd *esxcli -} - -func (r *result) Write(w io.Writer) error { - var formatType string - if r.cmd.hints { - formatType = r.Info.Hints.Formatter() - } - - switch formatType { - case "table": - r.cmd.formatTable(w, r.Response) - default: - r.cmd.formatSimple(w, r.Response) - } - - return nil -} - -func (cmd *esxcli) formatSimple(w io.Writer, res *Response) { - var keys []string - for key := range res.Values[0] { - keys = append(keys, key) - } - sort.Strings(keys) - - tw := tabwriter.NewWriter(w, 2, 0, 2, ' ', 0) - - for i, rv := range res.Values { - if i > 0 { - fmt.Fprintln(tw) - _ = tw.Flush() - } - for _, key := range keys { - fmt.Fprintf(tw, "%s:\t%s\n", key, strings.Join(rv[key], ", ")) - } - } - - _ = tw.Flush() -} - -func (cmd *esxcli) formatTable(w io.Writer, res *Response) { - fields := res.Info.Hints.Fields() - if len(fields) == 0 { - cmd.formatSimple(w, res) - return - } - tw := tabwriter.NewWriter(w, len(fields), 0, 2, ' ', 0) - - var hr []string - for _, name := range fields { - hr = append(hr, strings.Repeat("-", len(name))) - } - - fmt.Fprintln(tw, strings.Join(fields, "\t")) - fmt.Fprintln(tw, strings.Join(hr, "\t")) - - for _, vals := range res.Values { - var row []string - - for _, name := range fields { - key := strings.Replace(name, " ", "", -1) - if val, ok := vals[key]; ok { - row = append(row, strings.Join(val, ", ")) - } else { - row = append(row, "") - } - } - - fmt.Fprintln(tw, strings.Join(row, "\t")) - } - - _ = tw.Flush() -} diff --git a/vendor/github.com/vmware/govmomi/internal/helpers.go b/vendor/github.com/vmware/govmomi/internal/helpers.go index 859469a09..f547c25d4 100644 --- a/vendor/github.com/vmware/govmomi/internal/helpers.go +++ b/vendor/github.com/vmware/govmomi/internal/helpers.go @@ -18,13 +18,16 @@ package internal import ( "context" + "encoding/xml" "fmt" + "io" "net" "net/http" "net/url" "os" "path" "slices" + "strings" "github.com/vmware/govmomi/vim25" "github.com/vmware/govmomi/vim25/mo" @@ -149,3 +152,31 @@ func HostGatewayTransferURL(u *url.URL, hostMoref types.ManagedObjectReference) turl.Path = fmt.Sprintf("/hgw/%s%s", hostMoref.Value, oldPath) return &turl } + +func (arg ReflectManagedMethodExecuterSoapArgument) Value() []string { + if arg.Val == "" { + return nil + } + + d := xml.NewDecoder(strings.NewReader(arg.Val)) + var val []string + + for { + t, err := d.Token() + if err != nil { + if err == io.EOF { + break + } + panic(err) + } + if c, ok := t.(xml.CharData); ok { + val = append(val, string(c)) + } + } + + return val +} + +func EsxcliName(name string) string { + return strings.ReplaceAll(strings.Title(name), ".", "") +} diff --git a/vendor/github.com/vmware/govmomi/internal/methods.go b/vendor/github.com/vmware/govmomi/internal/methods.go index 95ccee8d2..b59770c0e 100644 --- a/vendor/github.com/vmware/govmomi/internal/methods.go +++ b/vendor/github.com/vmware/govmomi/internal/methods.go @@ -121,3 +121,28 @@ func ExecuteSoap(ctx context.Context, r soap.RoundTripper, req *ExecuteSoapReque return resBody.Res, nil } + +type QueryVirtualDiskInfoTaskBody struct { + Req *QueryVirtualDiskInfoTaskRequest `xml:"urn:internalvim25 QueryVirtualDiskInfo_Task,omitempty"` + Res *QueryVirtualDiskInfo_TaskResponse `xml:"urn:vim25 QueryVirtualDiskInfo_TaskResponse,omitempty"` + InternalRes *QueryVirtualDiskInfo_TaskResponse `xml:"urn:internalvim25 QueryVirtualDiskInfo_TaskResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *QueryVirtualDiskInfoTaskBody) Fault() *soap.Fault { return b.Fault_ } + +func QueryVirtualDiskInfoTask(ctx context.Context, r soap.RoundTripper, req *QueryVirtualDiskInfoTaskRequest) (*QueryVirtualDiskInfo_TaskResponse, error) { + var reqBody, resBody QueryVirtualDiskInfoTaskBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + if resBody.Res != nil { + return resBody.Res, nil + } + + return resBody.InternalRes, nil +} diff --git a/vendor/github.com/vmware/govmomi/internal/types.go b/vendor/github.com/vmware/govmomi/internal/types.go index b84103b89..cada7a904 100644 --- a/vendor/github.com/vmware/govmomi/internal/types.go +++ b/vendor/github.com/vmware/govmomi/internal/types.go @@ -1,11 +1,11 @@ /* -Copyright (c) 2014 VMware, Inc. All Rights Reserved. +Copyright (c) 2017-2024 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 +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, @@ -22,11 +22,25 @@ import ( "github.com/vmware/govmomi/vim25/types" ) +type VimEsxCLICLIFault struct { + types.MethodFault + + ErrMsg []string `xml:"errMsg"` +} + +func init() { + types.Add("VimEsxCLICLIFault", reflect.TypeOf((*VimEsxCLICLIFault)(nil)).Elem()) +} + type DynamicTypeMgrQueryMoInstancesRequest struct { This types.ManagedObjectReference `xml:"_this"` FilterSpec BaseDynamicTypeMgrFilterSpec `xml:"filterSpec,omitempty,typeattr"` } +func init() { + types.Add("DynamicTypeMgrQueryMoInstances", reflect.TypeOf((*DynamicTypeMgrQueryMoInstancesRequest)(nil)).Elem()) +} + type DynamicTypeMgrQueryMoInstancesResponse struct { Returnval []DynamicTypeMgrMoInstance `xml:"urn:vim25 returnval"` } @@ -45,7 +59,7 @@ func init() { types.Add("DynamicTypeEnumTypeInfo", reflect.TypeOf((*DynamicTypeEnumTypeInfo)(nil)).Elem()) } -type DynamicTypeMgrAllTypeInfoRequest struct { +type DynamicTypeMgrAllTypeInfo struct { types.DynamicData ManagedTypeInfo []DynamicTypeMgrManagedTypeInfo `xml:"managedTypeInfo,omitempty"` @@ -54,7 +68,7 @@ type DynamicTypeMgrAllTypeInfoRequest struct { } func init() { - types.Add("DynamicTypeMgrAllTypeInfo", reflect.TypeOf((*DynamicTypeMgrAllTypeInfoRequest)(nil)).Elem()) + types.Add("DynamicTypeMgrAllTypeInfo", reflect.TypeOf((*DynamicTypeMgrAllTypeInfo)(nil)).Elem()) } type DynamicTypeMgrAnnotation struct { @@ -182,8 +196,12 @@ type DynamicTypeMgrQueryTypeInfoRequest struct { FilterSpec BaseDynamicTypeMgrFilterSpec `xml:"filterSpec,omitempty,typeattr"` } +func init() { + types.Add("DynamicTypeMgrQueryTypeInfo", reflect.TypeOf((*DynamicTypeMgrQueryTypeInfoRequest)(nil)).Elem()) +} + type DynamicTypeMgrQueryTypeInfoResponse struct { - Returnval DynamicTypeMgrAllTypeInfoRequest `xml:"urn:vim25 returnval"` + Returnval DynamicTypeMgrAllTypeInfo `xml:"urn:vim25 returnval"` } func init() { @@ -237,6 +255,10 @@ type RetrieveDynamicTypeManagerResponse struct { Returnval *InternalDynamicTypeManager `xml:"urn:vim25 returnval"` } +func init() { + types.Add("RetrieveDynamicTypeManager", reflect.TypeOf((*RetrieveDynamicTypeManagerRequest)(nil)).Elem()) +} + type RetrieveManagedMethodExecuterRequest struct { This types.ManagedObjectReference `xml:"_this"` } @@ -268,3 +290,34 @@ type ExecuteSoapRequest struct { type ExecuteSoapResponse struct { Returnval *ReflectManagedMethodExecuterSoapResult `xml:"urn:vim25 returnval"` } + +func init() { + types.Add("ExecuteSoap", reflect.TypeOf((*ExecuteSoapRequest)(nil)).Elem()) + + types.Add("ArrayOfVirtualDiskInfo", reflect.TypeOf((*ArrayOfVirtualDiskInfo)(nil)).Elem()) + + types.Add("VirtualDiskInfo", reflect.TypeOf((*VirtualDiskInfo)(nil)).Elem()) + + types.Add("QueryVirtualDiskInfo_Task", reflect.TypeOf((*QueryVirtualDiskInfoTaskRequest)(nil)).Elem()) +} + +type VirtualDiskInfo struct { + Name string `xml:"unit>name"` + DiskType string `xml:"diskType"` + Parent string `xml:"parent,omitempty"` +} + +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 QueryVirtualDiskInfo_TaskResponse struct { + Returnval types.ManagedObjectReference `xml:"returnval"` +} diff --git a/vendor/github.com/vmware/govmomi/internal/version/version.go b/vendor/github.com/vmware/govmomi/internal/version/version.go index f0c027c6f..121948f4e 100644 --- a/vendor/github.com/vmware/govmomi/internal/version/version.go +++ b/vendor/github.com/vmware/govmomi/internal/version/version.go @@ -21,5 +21,5 @@ const ( ClientName = "govmomi" // ClientVersion is the version of this SDK - ClientVersion = "0.42.0" + ClientVersion = "0.48.0" ) diff --git a/vendor/github.com/vmware/govmomi/list/lister.go b/vendor/github.com/vmware/govmomi/list/lister.go index 92a40e8ba..dd1a540e5 100644 --- a/vendor/github.com/vmware/govmomi/list/lister.go +++ b/vendor/github.com/vmware/govmomi/list/lister.go @@ -1,11 +1,11 @@ /* -Copyright (c) 2014-2023 VMware, Inc. All Rights Reserved. +Copyright (c) 2014-2024 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 +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, @@ -22,9 +22,9 @@ import ( "path" "reflect" + "github.com/vmware/govmomi/fault" "github.com/vmware/govmomi/property" "github.com/vmware/govmomi/vim25/mo" - "github.com/vmware/govmomi/vim25/soap" "github.com/vmware/govmomi/vim25/types" ) @@ -132,12 +132,8 @@ func (l Lister) retrieveProperties(ctx context.Context, req types.RetrieveProper for _, p := range res.Returnval { v, err := mo.ObjectContentToType(p) if err != nil { - // Ignore fault if it is ManagedObjectNotFound - if soap.IsVimFault(err) { - switch soap.ToVimFault(err).(type) { - case *types.ManagedObjectNotFound: - continue - } + if fault.Is(err, &types.ManagedObjectNotFound{}) { + continue } return err diff --git a/vendor/github.com/vmware/govmomi/object/common.go b/vendor/github.com/vmware/govmomi/object/common.go index 88ce78fce..11064ac0e 100644 --- a/vendor/github.com/vmware/govmomi/object/common.go +++ b/vendor/github.com/vmware/govmomi/object/common.go @@ -21,6 +21,7 @@ import ( "errors" "fmt" "path" + "strings" "github.com/vmware/govmomi/property" "github.com/vmware/govmomi/vim25" @@ -136,13 +137,58 @@ func (c Common) SetCustomValue(ctx context.Context, key string, value string) er return err } +var refTypeMap = map[string]string{ + "datacenter": "Datacenter", + "datastore": "Datastore", + "domain": "ComputeResource", + "dvportgroup": "DistributedVirtualPortgroup", + "dvs": "DistributedVirtualSwitch", + "group": "Folder", + "host": "HostSystem", + "network": "Network", + "resgroup": "ResourcePool", + "vm": "VirtualMachine", +} + +// sub types +var prefixTypeMap = map[string]struct{ prefix, kind string }{ + "domain": {"c", "ClusterComputeResource"}, // extends ComputeResource + "group": {"p", "StoragePod"}, // extends Folder + "resgroup": {"v", "VirtualApp"}, // extends ResourcePool +} + +// ReferenceFromString converts a string to ManagedObjectReference. +// First checks for ManagedObjectReference (MOR), in the format of: +// "$Type:$ID", e.g. "Datacenter:datacenter-3" +// Next checks for Managed Object ID (MOID), where type is derived from the ID. +// For example, "datacenter-3" is converted to a MOR "Datacenter:datacenter-3" +// Returns nil if string is not in either format. func ReferenceFromString(s string) *types.ManagedObjectReference { var ref types.ManagedObjectReference - if !ref.FromString(s) { - return nil - } - if mo.IsManagedObjectType(ref.Type) { + if ref.FromString(s) && mo.IsManagedObjectType(ref.Type) { return &ref } + + id := strings.SplitN(s, "-", 2) + if len(id) != 2 { + return nil + } + + if kind, ok := refTypeMap[id[0]]; ok { + if p, ok := prefixTypeMap[id[0]]; ok { + if strings.HasPrefix(id[1], p.prefix) { + return &types.ManagedObjectReference{ + Type: p.kind, + Value: s, + } + } + } + + return &types.ManagedObjectReference{ + Type: kind, + Value: s, + } + } + return nil } diff --git a/vendor/github.com/vmware/govmomi/object/datacenter.go b/vendor/github.com/vmware/govmomi/object/datacenter.go index 41fa35265..46facadc1 100644 --- a/vendor/github.com/vmware/govmomi/object/datacenter.go +++ b/vendor/github.com/vmware/govmomi/object/datacenter.go @@ -1,11 +1,11 @@ /* -Copyright (c) 2015 VMware, Inc. All Rights Reserved. +Copyright (c) 2015-2024 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 +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, @@ -18,8 +18,9 @@ package object import ( "context" - "fmt" + "path" + "github.com/vmware/govmomi/fault" "github.com/vmware/govmomi/vim25" "github.com/vmware/govmomi/vim25/methods" "github.com/vmware/govmomi/vim25/mo" @@ -69,8 +70,12 @@ func (d *Datacenter) Folders(ctx context.Context) (*DatacenterFolders, error) { {"network", &df.NetworkFolder.InventoryPath}, } + dcPath := d.InventoryPath + if dcPath == "" { + dcPath = "/" + md.Name + } for _, p := range paths { - *p.path = fmt.Sprintf("/%s/%s", md.Name, p.name) + *p.path = path.Join(dcPath, p.name) } return df, nil @@ -117,10 +122,8 @@ func (d Datacenter) PowerOnVM(ctx context.Context, vm []types.ManagedObjectRefer err = task.Wait(ctx) if err != nil { // Ignore any InvalidPowerState fault, as it indicates the VM is already powered on - if f, ok := err.(types.HasFault); ok { - if _, ok = f.Fault().(*types.InvalidPowerState); !ok { - return nil, err - } + if !fault.Is(err, &types.InvalidPowerState{}) { + return nil, err } } } diff --git a/vendor/github.com/vmware/govmomi/object/datastore.go b/vendor/github.com/vmware/govmomi/object/datastore.go index 991ad4f82..ac157d1f3 100644 --- a/vendor/github.com/vmware/govmomi/object/datastore.go +++ b/vendor/github.com/vmware/govmomi/object/datastore.go @@ -105,25 +105,33 @@ func (d Datastore) Path(path string) string { }).String() } -// NewURL constructs a url.URL with the given file path for datastore access over HTTP. -func (d Datastore) NewURL(path string) *url.URL { - u := d.c.URL() - - scheme := u.Scheme +// NewDatastoreURL constructs a url.URL with the given file path for datastore access over HTTP. +func NewDatastoreURL(base url.URL, dcPath, dsName, path string) *url.URL { + scheme := base.Scheme // In rare cases where vCenter and ESX are accessed using different schemes. if overrideScheme := os.Getenv("GOVMOMI_DATASTORE_ACCESS_SCHEME"); overrideScheme != "" { scheme = overrideScheme } - return &url.URL{ - Scheme: scheme, - Host: u.Host, - Path: fmt.Sprintf("/folder/%s", path), - RawQuery: url.Values{ - "dcPath": []string{d.DatacenterPath}, - "dsName": []string{d.Name()}, - }.Encode(), - } + base.Scheme = scheme + base.Path = fmt.Sprintf("/folder/%s", path) + base.RawQuery = url.Values{ + "dcPath": []string{dcPath}, + "dsName": []string{dsName}, + }.Encode() + + return &base +} + +// NewURL constructs a url.URL with the given file path for datastore access over HTTP. +// The Datastore object is used to derive url, dcPath and dsName params to NewDatastoreURL. +// For dcPath, Datastore.DatacenterPath must be set and for dsName, Datastore.InventoryPath. +// This is the case when the object.Datastore instance is created by Finder. +// Otherwise, Datastore.FindInventoryPath should be called first, to set DatacenterPath +// and InventoryPath. +func (d Datastore) NewURL(path string) *url.URL { + u := d.c.URL() + return NewDatastoreURL(*u, d.DatacenterPath, d.Name(), path) } func (d Datastore) Browser(ctx context.Context) (*HostDatastoreBrowser, error) { diff --git a/vendor/github.com/vmware/govmomi/object/host_certificate_manager.go b/vendor/github.com/vmware/govmomi/object/host_certificate_manager.go index 30787e7a4..8c8f581de 100644 --- a/vendor/github.com/vmware/govmomi/object/host_certificate_manager.go +++ b/vendor/github.com/vmware/govmomi/object/host_certificate_manager.go @@ -19,11 +19,11 @@ package object import ( "context" + "github.com/vmware/govmomi/fault" "github.com/vmware/govmomi/property" "github.com/vmware/govmomi/vim25" "github.com/vmware/govmomi/vim25/methods" "github.com/vmware/govmomi/vim25/mo" - "github.com/vmware/govmomi/vim25/soap" "github.com/vmware/govmomi/vim25/types" ) @@ -119,10 +119,8 @@ func (m HostCertificateManager) InstallServerCertificate(ctx context.Context, ce } err = m.Client().RoundTrip(ctx, &body, &body) - if err != nil && soap.IsSoapFault(err) { - if _, ok := soap.ToSoapFault(err).VimFault().(types.MethodNotFound); ok { - return nil - } + if err != nil && fault.Is(err, &types.MethodNotFound{}) { + return nil } return err } diff --git a/vendor/github.com/vmware/govmomi/object/virtual_device_list.go b/vendor/github.com/vmware/govmomi/object/virtual_device_list.go index 295171af7..32cd4c2ab 100644 --- a/vendor/github.com/vmware/govmomi/object/virtual_device_list.go +++ b/vendor/github.com/vmware/govmomi/object/virtual_device_list.go @@ -1,5 +1,5 @@ /* -Copyright (c) 2015-2017 VMware, Inc. All Rights Reserved. +Copyright (c) 2015-2024 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. @@ -402,6 +402,10 @@ func (l VirtualDeviceList) FindSATAController(name string) (types.BaseVirtualCon func (l VirtualDeviceList) CreateSATAController() (types.BaseVirtualDevice, error) { sata := &types.VirtualAHCIController{} sata.BusNumber = l.newSATABusNumber() + if sata.BusNumber == -1 { + return nil, errors.New("no bus numbers available") + } + sata.Key = l.NewKey() return sata, nil @@ -545,6 +549,8 @@ func (l VirtualDeviceList) AssignController(device types.BaseVirtualDevice, c ty if d.Key == 0 { d.Key = l.newRandomKey() } + + c.GetVirtualController().Device = append(c.GetVirtualController().Device, d.Key) } // newRandomKey returns a random negative device key. @@ -567,15 +573,20 @@ func (l VirtualDeviceList) CreateDisk(c types.BaseVirtualController, ds types.Ma name += ".vmdk" } + bi := types.VirtualDeviceFileBackingInfo{ + FileName: name, + } + + if ds.Value != "" { + bi.Datastore = &ds + } + device := &types.VirtualDisk{ VirtualDevice: types.VirtualDevice{ Backing: &types.VirtualDiskFlatVer2BackingInfo{ - DiskMode: string(types.VirtualDiskModePersistent), - ThinProvisioned: types.NewBool(true), - VirtualDeviceFileBackingInfo: types.VirtualDeviceFileBackingInfo{ - FileName: name, - Datastore: &ds, - }, + DiskMode: string(types.VirtualDiskModePersistent), + ThinProvisioned: types.NewBool(true), + VirtualDeviceFileBackingInfo: bi, }, }, } @@ -650,7 +661,7 @@ func (l VirtualDeviceList) FindCdrom(name string) (*types.VirtualCdrom, error) { } // CreateCdrom creates a new VirtualCdrom device which can be added to a VM. -func (l VirtualDeviceList) CreateCdrom(c *types.VirtualIDEController) (*types.VirtualCdrom, error) { +func (l VirtualDeviceList) CreateCdrom(c types.BaseVirtualController) (*types.VirtualCdrom, error) { device := &types.VirtualCdrom{} l.AssignController(device, c) diff --git a/vendor/github.com/vmware/govmomi/object/virtual_disk_manager.go b/vendor/github.com/vmware/govmomi/object/virtual_disk_manager.go index 6724843e7..0b1a6c5f5 100644 --- a/vendor/github.com/vmware/govmomi/object/virtual_disk_manager.go +++ b/vendor/github.com/vmware/govmomi/object/virtual_disk_manager.go @@ -41,7 +41,7 @@ func (m VirtualDiskManager) CopyVirtualDisk( ctx context.Context, sourceName string, sourceDatacenter *Datacenter, destName string, destDatacenter *Datacenter, - destSpec *types.VirtualDiskSpec, force bool) (*Task, error) { + destSpec types.BaseVirtualDiskSpec, force bool) (*Task, error) { req := types.CopyVirtualDisk_Task{ This: m.Reference(), 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 index faa9ecad5..92967788e 100644 --- a/vendor/github.com/vmware/govmomi/object/virtual_disk_manager_internal.go +++ b/vendor/github.com/vmware/govmomi/object/virtual_disk_manager_internal.go @@ -18,66 +18,16 @@ package object import ( "context" - "reflect" + "github.com/vmware/govmomi/internal" "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"` - InternalRes *queryVirtualDiskInfoTaskResponse `xml:"urn:internalvim25 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 - } - - if resBody.Res != nil { - return resBody.Res, nil - } - - return resBody.InternalRes, nil -} - -type VirtualDiskInfo struct { - Name string `xml:"unit>name"` - DiskType string `xml:"diskType"` - Parent string `xml:"parent,omitempty"` -} +type VirtualDiskInfo = internal.VirtualDiskInfo func (m VirtualDiskManager) QueryVirtualDiskInfo(ctx context.Context, name string, dc *Datacenter, includeParents bool) ([]VirtualDiskInfo, error) { - req := queryVirtualDiskInfoTaskRequest{ + req := internal.QueryVirtualDiskInfoTaskRequest{ This: m.Reference(), Name: name, IncludeParents: includeParents, @@ -88,7 +38,7 @@ func (m VirtualDiskManager) QueryVirtualDiskInfo(ctx context.Context, name strin req.Datacenter = &ref } - res, err := queryVirtualDiskInfoTask(ctx, m.Client(), &req) + res, err := internal.QueryVirtualDiskInfoTask(ctx, m.Client(), &req) if err != nil { return nil, err } @@ -98,7 +48,7 @@ func (m VirtualDiskManager) QueryVirtualDiskInfo(ctx context.Context, name strin return nil, err } - return info.Result.(arrayOfVirtualDiskInfo).VirtualDiskInfo, nil + return info.Result.(internal.ArrayOfVirtualDiskInfo).VirtualDiskInfo, nil } type createChildDiskTaskRequest struct { diff --git a/vendor/github.com/vmware/govmomi/object/virtual_machine.go b/vendor/github.com/vmware/govmomi/object/virtual_machine.go index 4665fcb74..3f8f6ebe2 100644 --- a/vendor/github.com/vmware/govmomi/object/virtual_machine.go +++ b/vendor/github.com/vmware/govmomi/object/virtual_machine.go @@ -1,5 +1,5 @@ /* -Copyright (c) 2015-2023 VMware, Inc. All Rights Reserved. +Copyright (c) 2015-2024 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. @@ -500,7 +500,7 @@ func diskFileOperation(op types.VirtualDeviceConfigSpecOperation, fop types.Virt return "" } -func (v VirtualMachine) configureDevice(ctx context.Context, op types.VirtualDeviceConfigSpecOperation, fop types.VirtualDeviceConfigSpecFileOperation, devices ...types.BaseVirtualDevice) error { +func (v VirtualMachine) configureDevice(ctx context.Context, profile []types.BaseVirtualMachineProfileSpec, op types.VirtualDeviceConfigSpecOperation, fop types.VirtualDeviceConfigSpecFileOperation, devices ...types.BaseVirtualDevice) error { spec := types.VirtualMachineConfigSpec{} for _, device := range devices { @@ -508,6 +508,7 @@ func (v VirtualMachine) configureDevice(ctx context.Context, op types.VirtualDev Device: device, Operation: op, FileOperation: diskFileOperation(op, fop, device), + Profile: profile, } spec.DeviceChange = append(spec.DeviceChange, config) @@ -523,12 +524,22 @@ func (v VirtualMachine) configureDevice(ctx context.Context, op types.VirtualDev // AddDevice adds the given devices to the VirtualMachine func (v VirtualMachine) AddDevice(ctx context.Context, device ...types.BaseVirtualDevice) error { - return v.configureDevice(ctx, types.VirtualDeviceConfigSpecOperationAdd, types.VirtualDeviceConfigSpecFileOperationCreate, device...) + return v.AddDeviceWithProfile(ctx, nil, device...) +} + +// AddDeviceWithProfile adds the given devices to the VirtualMachine with the given profile +func (v VirtualMachine) AddDeviceWithProfile(ctx context.Context, profile []types.BaseVirtualMachineProfileSpec, device ...types.BaseVirtualDevice) error { + return v.configureDevice(ctx, profile, types.VirtualDeviceConfigSpecOperationAdd, types.VirtualDeviceConfigSpecFileOperationCreate, device...) } // EditDevice edits the given (existing) devices on the VirtualMachine func (v VirtualMachine) EditDevice(ctx context.Context, device ...types.BaseVirtualDevice) error { - return v.configureDevice(ctx, types.VirtualDeviceConfigSpecOperationEdit, types.VirtualDeviceConfigSpecFileOperationReplace, device...) + return v.EditDeviceWithProfile(ctx, nil, device...) +} + +// EditDeviceWithProfile edits the given (existing) devices on the VirtualMachine with the given profile +func (v VirtualMachine) EditDeviceWithProfile(ctx context.Context, profile []types.BaseVirtualMachineProfileSpec, device ...types.BaseVirtualDevice) error { + return v.configureDevice(ctx, profile, types.VirtualDeviceConfigSpecOperationEdit, types.VirtualDeviceConfigSpecFileOperationReplace, device...) } // RemoveDevice removes the given devices on the VirtualMachine @@ -537,17 +548,17 @@ func (v VirtualMachine) RemoveDevice(ctx context.Context, keepFiles bool, device if keepFiles { fop = "" } - return v.configureDevice(ctx, types.VirtualDeviceConfigSpecOperationRemove, fop, device...) + return v.configureDevice(ctx, nil, types.VirtualDeviceConfigSpecOperationRemove, fop, device...) } // AttachDisk attaches the given disk to the VirtualMachine -func (v VirtualMachine) AttachDisk(ctx context.Context, id string, datastore *Datastore, controllerKey int32, unitNumber int32) error { +func (v VirtualMachine) AttachDisk(ctx context.Context, id string, datastore *Datastore, controllerKey int32, unitNumber *int32) error { req := types.AttachDisk_Task{ This: v.Reference(), DiskId: types.ID{Id: id}, Datastore: datastore.Reference(), ControllerKey: controllerKey, - UnitNumber: &unitNumber, + UnitNumber: unitNumber, } res, err := methods.AttachDisk_Task(ctx, v.c, &req) diff --git a/vendor/github.com/vmware/govmomi/ovf/cim.go b/vendor/github.com/vmware/govmomi/ovf/cim.go index 427699954..7524dcecd 100644 --- a/vendor/github.com/vmware/govmomi/ovf/cim.go +++ b/vendor/github.com/vmware/govmomi/ovf/cim.go @@ -20,33 +20,78 @@ import ( "github.com/vmware/govmomi/vim25/types" ) +/* +Source: + - https://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.24.0/CIM_ResourceAllocationSettingData.xsd + - https://schemas.dmtf.org/wbem/cim-html/2/CIM_ResourceAllocationSettingData.html +*/ +type CIMResourceType uint16 + +// Please note, the iota pattern is not used to ensure these constants remain +// affixed to an explicit value. +const ( + Other CIMResourceType = 1 + ComputerSystem CIMResourceType = 2 + Processor CIMResourceType = 3 + Memory CIMResourceType = 4 + IdeController CIMResourceType = 5 + ParallelScsiHba CIMResourceType = 6 + FcHba CIMResourceType = 7 + IScsiHba CIMResourceType = 8 + IbHba CIMResourceType = 9 + EthernetAdapter CIMResourceType = 10 + OtherNetwork CIMResourceType = 11 + IoSlot CIMResourceType = 12 + IoDevice CIMResourceType = 13 + FloppyDrive CIMResourceType = 14 + CdDrive CIMResourceType = 15 + DvdDrive CIMResourceType = 16 + DiskDrive CIMResourceType = 17 + TapeDrive CIMResourceType = 18 + StorageExtent CIMResourceType = 19 + OtherStorage CIMResourceType = 20 + SerialPort CIMResourceType = 21 + ParallelPort CIMResourceType = 22 + UsbController CIMResourceType = 23 + Graphics CIMResourceType = 24 + Ieee1394 CIMResourceType = 25 + PartitionableUnit CIMResourceType = 26 + BasePartitionable CIMResourceType = 27 + PowerSupply CIMResourceType = 28 + CoolingDevice CIMResourceType = 29 + EthernetSwitchPort CIMResourceType = 30 + LogicalDisk CIMResourceType = 31 + StorageVolume CIMResourceType = 32 + EthernetConnection CIMResourceType = 33 +) + /* Source: http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.24.0/CIM_VirtualSystemSettingData.xsd */ type CIMVirtualSystemSettingData struct { - ElementName string `xml:"ElementName"` - InstanceID string `xml:"InstanceID"` + ElementName string `xml:"ElementName" json:"elementName"` + InstanceID string `xml:"InstanceID" json:"instanceID"` - AutomaticRecoveryAction *uint8 `xml:"AutomaticRecoveryAction"` - AutomaticShutdownAction *uint8 `xml:"AutomaticShutdownAction"` - AutomaticStartupAction *uint8 `xml:"AutomaticStartupAction"` - AutomaticStartupActionDelay *string `xml:"AutomaticStartupActionDelay>Interval"` - AutomaticStartupActionSequenceNumber *uint16 `xml:"AutomaticStartupActionSequenceNumber"` - Caption *string `xml:"Caption"` - ConfigurationDataRoot *string `xml:"ConfigurationDataRoot"` - ConfigurationFile *string `xml:"ConfigurationFile"` - ConfigurationID *string `xml:"ConfigurationID"` - CreationTime *string `xml:"CreationTime"` - Description *string `xml:"Description"` - LogDataRoot *string `xml:"LogDataRoot"` - Notes []string `xml:"Notes"` - RecoveryFile *string `xml:"RecoveryFile"` - SnapshotDataRoot *string `xml:"SnapshotDataRoot"` - SuspendDataRoot *string `xml:"SuspendDataRoot"` - SwapFileDataRoot *string `xml:"SwapFileDataRoot"` - VirtualSystemIdentifier *string `xml:"VirtualSystemIdentifier"` - VirtualSystemType *string `xml:"VirtualSystemType"` + AutomaticRecoveryAction *uint8 `xml:"AutomaticRecoveryAction" json:"automaticRecoveryAction,omitempty"` + AutomaticShutdownAction *uint8 `xml:"AutomaticShutdownAction" json:"automaticShutdownAction,omitempty"` + AutomaticStartupAction *uint8 `xml:"AutomaticStartupAction" json:"automaticStartupAction,omitempty"` + AutomaticStartupActionDelay *string `xml:"AutomaticStartupActionDelay>Interval" json:"automaticStartupActionDelay,omitempty"` + AutomaticStartupActionSequenceNumber *uint16 `xml:"AutomaticStartupActionSequenceNumber" json:"automaticStartupActionSequenceNumber,omitempty"` + Caption *string `xml:"Caption" json:"caption,omitempty"` + ConfigurationDataRoot *string `xml:"ConfigurationDataRoot" json:"configurationDataRoot,omitempty"` + ConfigurationFile *string `xml:"ConfigurationFile" json:"configurationFile,omitempty"` + ConfigurationID *string `xml:"ConfigurationID" json:"configurationID,omitempty"` + CreationTime *string `xml:"CreationTime" json:"creationTime,omitempty"` + Description *string `xml:"Description" json:"description,omitempty"` + LogDataRoot *string `xml:"LogDataRoot" json:"logDataRoot,omitempty"` + Notes []string `xml:"Notes" json:"notes,omitempty"` + RecoveryFile *string `xml:"RecoveryFile" json:"recoveryFile,omitempty"` + SnapshotDataRoot *string `xml:"SnapshotDataRoot" json:"snapshotDataRoot,omitempty"` + SuspendDataRoot *string `xml:"SuspendDataRoot" json:"suspendDataRoot,omitempty"` + SwapFileDataRoot *string `xml:"SwapFileDataRoot" json:"swapFileDataRoot,omitempty"` + VirtualSystemIdentifier *string `xml:"VirtualSystemIdentifier" json:"virtualSystemIdentifier,omitempty"` + VirtualSystemType *string `xml:"VirtualSystemType" json:"virtualSystemType,omitempty"` } /* @@ -54,75 +99,75 @@ Source: http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.24.0/CIM_ResourceAlloc */ type CIMResourceAllocationSettingData struct { - ElementName string `xml:"ElementName"` - InstanceID string `xml:"InstanceID"` + ElementName string `xml:"ElementName" json:"elementName,omitempty"` + InstanceID string `xml:"InstanceID" json:"instanceID,omitempty"` - ResourceType *uint16 `xml:"ResourceType"` - OtherResourceType *string `xml:"OtherResourceType"` - ResourceSubType *string `xml:"ResourceSubType"` + ResourceType *CIMResourceType `xml:"ResourceType" json:"resourceType,omitempty"` + OtherResourceType *string `xml:"OtherResourceType" json:"otherResourceType,omitempty"` + ResourceSubType *string `xml:"ResourceSubType" json:"resourceSubType,omitempty"` - AddressOnParent *string `xml:"AddressOnParent"` - Address *string `xml:"Address"` - AllocationUnits *string `xml:"AllocationUnits"` - AutomaticAllocation *bool `xml:"AutomaticAllocation"` - AutomaticDeallocation *bool `xml:"AutomaticDeallocation"` - Caption *string `xml:"Caption"` - Connection []string `xml:"Connection"` - ConsumerVisibility *uint16 `xml:"ConsumerVisibility"` - Description *string `xml:"Description"` - HostResource []string `xml:"HostResource"` - Limit *uint64 `xml:"Limit"` - MappingBehavior *uint `xml:"MappingBehavior"` - Parent *string `xml:"Parent"` - PoolID *string `xml:"PoolID"` - Reservation *uint64 `xml:"Reservation"` - VirtualQuantity *uint `xml:"VirtualQuantity"` - VirtualQuantityUnits *string `xml:"VirtualQuantityUnits"` - Weight *uint `xml:"Weight"` + AddressOnParent *string `xml:"AddressOnParent" json:"addressOnParent,omitempty"` + Address *string `xml:"Address" json:"address,omitempty"` + AllocationUnits *string `xml:"AllocationUnits" json:"allocationUnits,omitempty"` + AutomaticAllocation *bool `xml:"AutomaticAllocation" json:"automaticAllocation,omitempty"` + AutomaticDeallocation *bool `xml:"AutomaticDeallocation" json:"automaticDeallocation,omitempty"` + Caption *string `xml:"Caption" json:"caption,omitempty"` + Connection []string `xml:"Connection" json:"connection,omitempty"` + ConsumerVisibility *uint16 `xml:"ConsumerVisibility" json:"consumerVisibility,omitempty"` + Description *string `xml:"Description" json:"description,omitempty"` + HostResource []string `xml:"HostResource" json:"hostResource,omitempty"` + Limit *uint64 `xml:"Limit" json:"limit,omitempty"` + MappingBehavior *uint `xml:"MappingBehavior" json:"mappingBehavior,omitempty"` + Parent *string `xml:"Parent" json:"parent,omitempty"` + PoolID *string `xml:"PoolID" json:"poolID,omitempty"` + Reservation *uint64 `xml:"Reservation" json:"reservation,omitempty"` + VirtualQuantity *uint `xml:"VirtualQuantity" json:"virtualQuantity,omitempty"` + VirtualQuantityUnits *string `xml:"VirtualQuantityUnits" json:"virtualQuantityUnits,omitempty"` + Weight *uint `xml:"Weight" json:"weight,omitempty"` } /* Source: http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.24.0/CIM_StorageAllocationSettingData.xsd */ type CIMStorageAllocationSettingData struct { - ElementName string `xml:"ElementName"` - InstanceID string `xml:"InstanceID"` + ElementName string `xml:"ElementName" json:"elementName"` + InstanceID string `xml:"InstanceID" json:"instanceID"` - ResourceType *uint16 `xml:"ResourceType"` - OtherResourceType *string `xml:"OtherResourceType"` - ResourceSubType *string `xml:"ResourceSubType"` + ResourceType *CIMResourceType `xml:"ResourceType" json:"resourceType,omitempty"` + OtherResourceType *string `xml:"OtherResourceType" json:"otherResourceType,omitempty"` + ResourceSubType *string `xml:"ResourceSubType" json:"resourceSubType,omitempty"` - Access *uint16 `xml:"Access"` - Address *string `xml:"Address"` - AddressOnParent *string `xml:"AddressOnParent"` - AllocationUnits *string `xml:"AllocationUnits"` - AutomaticAllocation *bool `xml:"AutomaticAllocation"` - AutomaticDeallocation *bool `xml:"AutomaticDeallocation"` - Caption *string `xml:"Caption"` - ChangeableType *uint16 `xml:"ChangeableType"` - ComponentSetting []types.AnyType `xml:"ComponentSetting"` - ConfigurationName *string `xml:"ConfigurationName"` - Connection []string `xml:"Connection"` - ConsumerVisibility *uint16 `xml:"ConsumerVisibility"` - Description *string `xml:"Description"` - Generation *uint64 `xml:"Generation"` - HostExtentName *string `xml:"HostExtentName"` - HostExtentNameFormat *uint16 `xml:"HostExtentNameFormat"` - HostExtentNameNamespace *uint16 `xml:"HostExtentNameNamespace"` - HostExtentStartingAddress *uint64 `xml:"HostExtentStartingAddress"` - HostResource []string `xml:"HostResource"` - HostResourceBlockSize *uint64 `xml:"HostResourceBlockSize"` - Limit *uint64 `xml:"Limit"` - MappingBehavior *uint `xml:"MappingBehavior"` - OtherHostExtentNameFormat *string `xml:"OtherHostExtentNameFormat"` - OtherHostExtentNameNamespace *string `xml:"OtherHostExtentNameNamespace"` - Parent *string `xml:"Parent"` - PoolID *string `xml:"PoolID"` - Reservation *uint64 `xml:"Reservation"` - SoID *string `xml:"SoID"` - SoOrgID *string `xml:"SoOrgID"` - VirtualQuantity *uint `xml:"VirtualQuantity"` - VirtualQuantityUnits *string `xml:"VirtualQuantityUnits"` - VirtualResourceBlockSize *uint64 `xml:"VirtualResourceBlockSize"` - Weight *uint `xml:"Weight"` + Access *uint16 `xml:"Access" json:"access,omitempty"` + Address *string `xml:"Address" json:"address,omitempty"` + AddressOnParent *string `xml:"AddressOnParent" json:"addressOnParent,omitempty"` + AllocationUnits *string `xml:"AllocationUnits" json:"allocationUnits,omitempty"` + AutomaticAllocation *bool `xml:"AutomaticAllocation" json:"automaticAllocation,omitempty"` + AutomaticDeallocation *bool `xml:"AutomaticDeallocation" json:"automaticDeallocation,omitempty"` + Caption *string `xml:"Caption" json:"caption,omitempty"` + ChangeableType *uint16 `xml:"ChangeableType" json:"changeableType,omitempty"` + ComponentSetting []types.AnyType `xml:"ComponentSetting" json:"componentSetting,omitempty"` + ConfigurationName *string `xml:"ConfigurationName" json:"configurationName,omitempty"` + Connection []string `xml:"Connection" json:"connection,omitempty"` + ConsumerVisibility *uint16 `xml:"ConsumerVisibility" json:"consumerVisibility,omitempty"` + Description *string `xml:"Description" json:"description,omitempty"` + Generation *uint64 `xml:"Generation" json:"generation,omitempty"` + HostExtentName *string `xml:"HostExtentName" json:"hostExtentName,omitempty"` + HostExtentNameFormat *uint16 `xml:"HostExtentNameFormat" json:"hostExtentNameFormat,omitempty"` + HostExtentNameNamespace *uint16 `xml:"HostExtentNameNamespace" json:"hostExtentNameNamespace,omitempty"` + HostExtentStartingAddress *uint64 `xml:"HostExtentStartingAddress" json:"hostExtentStartingAddress,omitempty"` + HostResource []string `xml:"HostResource" json:"hostResource,omitempty"` + HostResourceBlockSize *uint64 `xml:"HostResourceBlockSize" json:"hostResourceBlockSize,omitempty"` + Limit *uint64 `xml:"Limit" json:"limit,omitempty"` + MappingBehavior *uint `xml:"MappingBehavior" json:"mappingBehavior,omitempty"` + OtherHostExtentNameFormat *string `xml:"OtherHostExtentNameFormat" json:"otherHostExtentNameFormat,omitempty"` + OtherHostExtentNameNamespace *string `xml:"OtherHostExtentNameNamespace" json:"otherHostExtentNameNamespace,omitempty"` + Parent *string `xml:"Parent" json:"parent,omitempty"` + PoolID *string `xml:"PoolID" json:"poolID,omitempty"` + Reservation *uint64 `xml:"Reservation" json:"reservation,omitempty"` + SoID *string `xml:"SoID" json:"soID,omitempty"` + SoOrgID *string `xml:"SoOrgID" json:"soOrgID,omitempty"` + VirtualQuantity *uint `xml:"VirtualQuantity" json:"virtualQuantity,omitempty"` + VirtualQuantityUnits *string `xml:"VirtualQuantityUnits" json:"virtualQuantityUnits,omitempty"` + VirtualResourceBlockSize *uint64 `xml:"VirtualResourceBlockSize" json:"virtualResourceBlockSize,omitempty"` + Weight *uint `xml:"Weight" json:"weight,omitempty"` } diff --git a/vendor/github.com/vmware/govmomi/ovf/configspec.go b/vendor/github.com/vmware/govmomi/ovf/configspec.go new file mode 100644 index 000000000..d7e04fb54 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/ovf/configspec.go @@ -0,0 +1,1081 @@ +/* +Copyright (c) 2024-2024 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 ovf + +import ( + "errors" + "fmt" + "math" + "strconv" + "strings" + + "github.com/vmware/govmomi/object" + "github.com/vmware/govmomi/vim25/types" +) + +const ( + ResourceSubTypeSoundCardSB16 = "vmware.soundcard.sb16" + ResourceSubTypeSoundCardEnsoniq1371 = "vmware.soundcard.ensoniq1371" + ResourceSubTypeSoundCardHDAudio = "vmware.soundcard.hdaudio" + ResourceSubTypePCIController = "vmware.pcicontroller" + ResourceSubTypePS2Controller = "vmware.ps2controller" + ResourceSubTypeSIOController = "vmware.siocontroller" + ResourceSubTypeKeyboard = "vmware.keyboard" + ResourceSubTypePointingDevice = "vmware.pointingdevice" + ResourceSubTypeVMCI = "vmware.vmci" + ResourceSubTypeUSBEHCI = "vmware.usb.ehci" /* USB 2.0 */ + ResourceSubTypeUSBXHCI = "vmware.usb.xhci" /* USB 3.0 */ + ResourceSubTypeCdromISO = "vmware.cdrom.iso" + ResourceSubTypeCDROMRemotePassthrough = "vmware.cdrom.remotepassthrough" + ResourceSubTypeCDROMRemoteATAPI = "vmware.cdrom.remoteatapi" + ResourceSubTypeCDROMPassthrough = "vmware.cdrom.passthrough" + ResourceSubTypeCDROMATAPI = "vmware.cdrom.atapi" + ResourceSubTypeFloppyDevice = "vmware.floppy.device" + ResourceSubTypeFloppyImage = "vmware.floppy.image" + ResourceSubTypeFloppyRemoveDevice = "vmware.floppy.remotedevice" + ResourceSubTypeSCSIPassthrough = "vmware.scsi.passthrough" + ResourceSubTypeParallelPortDevice = "vmware.parallelport.device" + ResourceSubTypeParallelPortFile = "vmware.parallelport.file" + ResourceSubTypeSerialPortDevice = "vmware.serialport.device" + ResourceSubTypeSerialPortFile = "vmware.serialport.file" + ResourceSubTypeSerialPortPipe = "vmware.serialport.pipe" + ResourceSubTypeSerialPortURI = "vmware.serialport.uri" + ResourceSubTypeSerialPortThinPrint = "vmware.serialport.thinprint" + ResourceSubTypeSATAAHCI = "vmware.sata.ahci" + ResourceSubTypeSATAAHCIAlter = "ahci" + ResourceSubTypeNVMEController = "vmware.nvme.controller" + ResourceSubTypeNVDIMMController = "vmware.nvdimm.controller" + ResourceSubTypeNVDIMMDevice = "vmware.nvdimm.device" + ResourceSubTypePCIPassthrough = "vmware.pci.passthrough" + ResourceSubTypePCIPassthroughDVX = "vmware.pci.passthrough-dvx" + ResourceSubTypePCIPassthroughAH = "vmware.pci.passthrough-ah" + ResourceSubTypePCIPassthroughVMIOP = "vmware.pci.passthrough-vmiop" + ResourceSubTypePrecisionClock = "vmware.precisionclock" + ResourceSubTypeWatchdogTimer = "vmware.watchdogtimer" + ResourceSubTypeVTPM = "vmware.vtpm" +) + +var errUnsupportedResourceSubtype = errors.New("unsupported resource subtype") + +// ErrUnsupportedItem is returned by Envelope.ToConfigSpec when there is an +// invalid item configuration. +type ErrUnsupportedItem struct { + Name string + Index int + InstanceID string + ResourceType CIMResourceType + ResourceSubType string + LocalizedMessage string +} + +func (e ErrUnsupportedItem) Error() string { + msg := fmt.Sprintf( + "unsupported item name=%q, index=%d, instanceID=%q", + e.Name, e.Index, e.InstanceID) + if e.ResourceType > 0 { + msg = fmt.Sprintf("%s, resourceType=%d", msg, e.ResourceType) + } + if e.ResourceSubType != "" { + msg = fmt.Sprintf("%s, resourceSubType=%s", msg, e.ResourceSubType) + } + if e.LocalizedMessage != "" { + msg = fmt.Sprintf("%s, msg=%q", msg, e.LocalizedMessage) + } + return msg +} + +// AsErrUnsupportedItem returns any possible wrapped ErrUnsupportedItem error +// from the provided error. +func AsErrUnsupportedItem(in error) (ErrUnsupportedItem, bool) { + var out ErrUnsupportedItem + if errors.As(in, &out) { + return out, true + } + return ErrUnsupportedItem{}, false +} + +func errUnsupportedItem( + index int, + item itemElement, + inner error, + args ...any) error { + + err := ErrUnsupportedItem{ + Name: item.ElementName, + InstanceID: item.InstanceID, + Index: index, + ResourceSubType: item.resourceSubType, + } + + if item.ResourceType != nil { + err.ResourceType = *item.ResourceType + } + + if len(args) == 1 { + err.LocalizedMessage = args[0].(string) + } else if len(args) > 1 { + err.LocalizedMessage = fmt.Sprintf(args[0].(string), args[1:]...) + } + + if inner != nil { + return fmt.Errorf("%w, %w", err, inner) + } + + return err +} + +type itemElement struct { + ResourceAllocationSettingData + + resourceSubType string +} + +type configSpec = types.VirtualMachineConfigSpec + +// ToConfigSpecOptions influence the behavior of the ToConfigSpecWithOptions +// function. +type ToConfigSpecOptions struct { + + // Strict indicates that an error should be returned on Item elements in + // a VirtualHardware section that have an unknown ResourceType, i.e. a value + // that falls outside the range of the enum CIMResourceType. + Strict bool +} + +// ToConfigSpec calls ToConfigSpecWithOptions with an empty ToConfigSpecOptions +// object. +func (e Envelope) ToConfigSpec() (types.VirtualMachineConfigSpec, error) { + return e.ToConfigSpecWithOptions(ToConfigSpecOptions{}) +} + +// ToConfigSpecWithOptions transforms the envelope into a ConfigSpec that may be +// used to create a new virtual machine. +// Please note, at this time: +// - Only a single VirtualSystem is supported. The VirtualSystemCollection +// section is ignored. +// - Only the first VirtualHardware section is supported. +// - Only the default deployment option configuration is considered. Elements +// part of a non-default configuration are ignored. +// - Disks must specify zero or one HostResource elements. +// - Many, many more constraints... +func (e Envelope) ToConfigSpecWithOptions( + opts ToConfigSpecOptions) (types.VirtualMachineConfigSpec, error) { + + vs := e.VirtualSystem + if vs == nil { + return configSpec{}, errors.New("no VirtualSystem") + } + + // Determine if there is a default configuration. + var defaultConfigName string + if do := e.DeploymentOption; do != nil { + for _, c := range do.Configuration { + if d := c.Default; d != nil && *d { + defaultConfigName = c.ID + break + } + } + } + + dst := configSpec{ + Files: &types.VirtualMachineFileInfo{}, + Name: vs.ID, + } + + // Set the guest ID. + if os := vs.OperatingSystem; os != nil && os.OSType != nil { + dst.GuestId = *os.OSType + } + + // Parse the hardware. + if err := e.toHardware(&dst, defaultConfigName, vs, opts); err != nil { + return configSpec{}, err + } + + // Parse the vApp config. + if err := e.toVAppConfig(&dst, defaultConfigName, vs); err != nil { + return configSpec{}, err + } + + return dst, nil +} + +func (e Envelope) toHardware( + dst *configSpec, + configName string, + vs *VirtualSystem, + opts ToConfigSpecOptions) error { + + var hw VirtualHardwareSection + if len(vs.VirtualHardware) == 0 { + return errors.New("no VirtualHardware") + } + hw = vs.VirtualHardware[0] + + // Set the hardware version. + if vmx := hw.System.VirtualSystemType; vmx != nil { + dst.Version = *vmx + } + + // Parse the config + e.toConfig(dst, hw) + + // Parse the extra config. + e.toExtraConfig(dst, hw) + + var ( + devices object.VirtualDeviceList + resources = map[string]types.BaseVirtualDevice{} + ) + + for index := range hw.Item { + item := itemElement{ + ResourceAllocationSettingData: hw.Item[index], + } + + if c := item.Configuration; c != nil { + if *c != configName { + // Skip items that do not belong to the provided config. + continue + } + } + + if item.ResourceType == nil { + return errUnsupportedItem(index, item, nil, "nil ResourceType") + } + + // Get the resource sub type, if any. + if rst := item.ResourceSubType; rst != nil { + item.resourceSubType = strings.ToLower(*rst) + } + + var ( + d types.BaseVirtualDevice + err error + ) + + switch *item.ResourceType { + + case Other: // 1 + d, err = e.toOther(item, devices, resources) + + case ComputerSystem: // 2 + // TODO(akutz) + + case Processor: // 3 + if item.VirtualQuantity == nil { + return errUnsupportedItem( + index, item, nil, "nil VirtualQuantity") + } + dst.NumCPUs = int32(*item.VirtualQuantity) + if cps := item.CoresPerSocket; cps != nil { + dst.NumCoresPerSocket = cps.Value + } + + case Memory: // 4 + if item.VirtualQuantity == nil { + return errUnsupportedItem( + index, item, nil, "nil VirtualQuantity") + } + dst.MemoryMB = int64(*item.VirtualQuantity) + + case IdeController: // 5 + d, err = e.toIDEController(item, devices, resources) + + case ParallelScsiHba: // 6 + d, err = e.toSCSIController(item, devices, resources) + + case FcHba: // 7 + // TODO(akutz) + + case IScsiHba: // 8 + // TODO(akutz) + + case IbHba: // 9 + // TODO(akutz) + + case EthernetAdapter: // 10 + d, err = e.toNetworkInterface(item, devices, resources) + + case OtherNetwork: // 11 + // TODO(akutz) + + case IoSlot: // 12 + // TODO(akutz) + + case IoDevice: // 13 + // TODO(akutz) + + case FloppyDrive: // 14 + if devices.PickController((*types.VirtualSIOController)(nil)) == nil { + c := &types.VirtualSIOController{} + c.Key = devices.NewKey() + devices = append(devices, c) + } + d, err = e.toFloppyDrive(item, devices, resources) + + case CdDrive, DvdDrive: // 15, 16 + d, err = e.toCDOrDVDDrive(item, devices, resources) + + case DiskDrive: // 17 + d, err = e.toVirtualDisk(item, devices, resources) + + case TapeDrive: // 18 + // TODO(akutz) + + case StorageExtent: // 19 + // TODO(akutz) + + case OtherStorage: // 20 + d, err = e.toOtherStorage(item, devices, resources) + + case SerialPort: // 21 + // TODO(akutz) + + case ParallelPort: // 22 + // TODO(akutz) + + case UsbController: // 23 + d, err = e.toUSB(item, devices, resources) + + case Graphics: // 24 + d, err = e.toVideoCard(item, devices, resources) + + case Ieee1394: // 25 + // TODO(akutz) + + case PartitionableUnit: // 26 + // TODO(akutz) + + case BasePartitionable: // 27 + // TODO(akutz) + + case PowerSupply: // 28 + // TODO(akutz) + + case CoolingDevice: // 29 + // TODO(akutz) + + case EthernetSwitchPort: // 30 + // TODO(akutz) + + case LogicalDisk: // 31 + // TODO(akutz) + + case StorageVolume: // 32 + // TODO(akutz) + + case EthernetConnection: // 33 + // TODO(akutz) + + default: + if opts.Strict { + return errUnsupportedItem( + index, item, nil, "unsupported resource type") + } + } + + if err != nil { + if err == errUnsupportedResourceSubtype { + if !opts.Strict { + continue + } + } + return errUnsupportedItem(index, item, err) + } + + if d != nil { + setConnectable(d, item) + if err := e.setUnitNumber(item, d); err != nil { + return errUnsupportedItem(index, item, err) + } + if err := e.setPCISlotNumber(item, d); err != nil { + return errUnsupportedItem(index, item, err) + } + devices = append(devices, d) + } + } + + // Add the devices to the ConfigSpec. + dst.DeviceChange, _ = devices.ConfigSpec(types.VirtualDeviceConfigSpecOperationAdd) + + return nil +} + +func (e Envelope) setUnitNumber( + item itemElement, + d types.BaseVirtualDevice) error { + + if item.AddressOnParent == nil || *item.AddressOnParent == "" { + return nil + } + + unitNumber, err := strconv.ParseInt(*item.AddressOnParent, 10, 32) + if err != nil { + return fmt.Errorf("invalid AddressOnParent=%q", *item.AddressOnParent) + } + + d.GetVirtualDevice().UnitNumber = types.NewInt32(int32(unitNumber)) + return nil +} + +func (e Envelope) setBusNumber( + item itemElement, + d types.BaseVirtualDevice) error { + + if item.Address == nil || *item.Address == "" { + return nil + } + + c, ok := d.(types.BaseVirtualController) + if !ok { + return fmt.Errorf("expectedType=%s, actualType=%T", + "types.BaseVirtualController", d) + } + + busNumber, err := strconv.ParseInt(*item.Address, 10, 32) + if err != nil { + return fmt.Errorf("invalid Address=%q", *item.Address) + } + + c.GetVirtualController().BusNumber = int32(busNumber) + return nil +} + +func (e Envelope) setPCISlotNumber( + item itemElement, + d types.BaseVirtualDevice) error { + + var pciSlotNumber int32 = -1 + + for i := range item.Config { + c := item.Config[i] + if c.Key == "slotInfo.pciSlotNumber" { + if c.Value != "" { + v, err := strconv.ParseInt(c.Value, 10, 32) + if err != nil { + return fmt.Errorf("invalid pci slot number %s", c.Value) + } + pciSlotNumber = int32(v) + } + break + } + } + + if pciSlotNumber >= 0 { + vd := d.GetVirtualDevice() + if vd.SlotInfo == nil { + vd.SlotInfo = &types.VirtualDevicePciBusSlotInfo{} + } + si, ok := vd.SlotInfo.(*types.VirtualDevicePciBusSlotInfo) + if !ok { + return fmt.Errorf("expectedType=%s, actualType=%T", + "*types.VirtualDevicePciBusSlotInfo", vd.SlotInfo) + } + si.PciSlotNumber = pciSlotNumber + } + + return nil +} + +func (e Envelope) ovfDisk(diskID string) *VirtualDiskDesc { + for _, disk := range e.Disk.Disks { + if strings.HasSuffix(diskID, disk.DiskID) { + return &disk + } + } + return nil +} + +func (e Envelope) toVirtualDisk( + item itemElement, + devices object.VirtualDeviceList, + resources map[string]types.BaseVirtualDevice) (types.BaseVirtualDevice, error) { + + if item.Parent == nil { + return nil, fmt.Errorf("missing Parent") + } + + r, ok := resources[*item.Parent] + if !ok { + return nil, nil + } + + c, ok := r.(types.BaseVirtualController) + if !ok { + return nil, fmt.Errorf("expectedType=%s, actualType=%T", + "types.BaseVirtualController", r) + } + + d := devices.CreateDisk(c, types.ManagedObjectReference{}, "") + + d.VirtualDevice.DeviceInfo = &types.Description{ + Label: item.ElementName, + } + + // Find the disk's capacity. + var capacityInBytes uint64 + switch len(item.HostResource) { + + case 0: + var allocUnitsSz string + if item.AllocationUnits != nil { + allocUnitsSz = *item.AllocationUnits + } + capacityInBytes = uint64(ParseCapacityAllocationUnits(allocUnitsSz)) + if r := item.VirtualQuantity; r != nil { + capacityInBytes *= uint64(*r) + } + + case 1: + diskID := item.HostResource[0] + dd := e.ovfDisk(diskID) + if dd == nil { + return nil, fmt.Errorf("missing diskID %q", diskID) + } + + var allocUnitsSz string + if dd.CapacityAllocationUnits != nil { + allocUnitsSz = *dd.CapacityAllocationUnits + } + capacityInBytes = uint64(ParseCapacityAllocationUnits(allocUnitsSz)) + if capSz := dd.Capacity; capSz != "" { + cap, err := strconv.ParseUint(dd.Capacity, 10, 64) + if err != nil { + return nil, fmt.Errorf("disk=%s has invalid capacity=%q", + diskID, capSz) + } + capacityInBytes *= cap + } + + default: + return nil, fmt.Errorf("multiple HostResource elements") + } + + if capacityInBytes > math.MaxInt64 { + return nil, fmt.Errorf( + "capacityInBytes=%d exceeds math.MaxInt64", capacityInBytes) + } + + d.CapacityInBytes = int64(capacityInBytes) + + return d, nil +} + +func (e Envelope) toCDOrDVDDrive( + item itemElement, + devices object.VirtualDeviceList, + resources map[string]types.BaseVirtualDevice) (types.BaseVirtualDevice, error) { + + if item.Parent == nil { + return nil, fmt.Errorf("missing Parent") + } + + r, ok := resources[*item.Parent] + if !ok { + return nil, nil // Parent is unsupported + } + + c, ok := r.(types.BaseVirtualController) + if !ok { + return nil, fmt.Errorf("expectedType=%s, actualType=%T", + "*types.VirtualIDEController", r) + } + + d, err := devices.CreateCdrom(c) + if err != nil { + return nil, err + } + + return d, nil +} + +func (e Envelope) toSCSIController( + item itemElement, + devices object.VirtualDeviceList, + resources map[string]types.BaseVirtualDevice) (types.BaseVirtualDevice, error) { + + d, err := devices.CreateSCSIController(item.resourceSubType) + if err != nil { + return nil, err + } + if err := e.setBusNumber(item, d); err != nil { + return nil, err + } + resources[item.InstanceID] = d + + return d, nil +} + +func (e Envelope) toIDEController( + item itemElement, + devices object.VirtualDeviceList, + resources map[string]types.BaseVirtualDevice) (types.BaseVirtualDevice, error) { + + d, err := devices.CreateIDEController() + if err != nil { + return nil, err + } + if err := e.setBusNumber(item, d); err != nil { + return nil, err + } + resources[item.InstanceID] = d + return d, nil +} + +func (e Envelope) toOtherStorage( + item itemElement, + devices object.VirtualDeviceList, + resources map[string]types.BaseVirtualDevice) (types.BaseVirtualDevice, error) { + + switch item.resourceSubType { + case ResourceSubTypeSATAAHCI, ResourceSubTypeSATAAHCIAlter: + return e.toSATAController(item, devices, resources) + case ResourceSubTypeNVMEController: + return e.toNVMEController(item, devices, resources) + } + return nil, errUnsupportedResourceSubtype +} + +func (e Envelope) toSATAController( + item itemElement, + devices object.VirtualDeviceList, + resources map[string]types.BaseVirtualDevice) (types.BaseVirtualDevice, error) { + + d, err := devices.CreateSATAController() + if err != nil { + return nil, err + } + if err := e.setBusNumber(item, d); err != nil { + return nil, err + } + resources[item.InstanceID] = d + return d, nil +} + +func (e Envelope) toNVMEController( + item itemElement, + devices object.VirtualDeviceList, + resources map[string]types.BaseVirtualDevice) (types.BaseVirtualDevice, error) { + + d, err := devices.CreateNVMEController() + if err != nil { + return nil, err + } + if err := e.setBusNumber(item, d); err != nil { + return nil, err + } + resources[item.InstanceID] = d + return d, nil +} + +func (e Envelope) toUSB( + item itemElement, + devices object.VirtualDeviceList, + resources map[string]types.BaseVirtualDevice) (types.BaseVirtualDevice, error) { + + var d types.BaseVirtualDevice + + vc := types.VirtualController{ + VirtualDevice: types.VirtualDevice{ + Key: devices.NewKey(), + }, + } + + switch item.resourceSubType { + case ResourceSubTypeUSBEHCI: + c := &types.VirtualUSBController{VirtualController: vc} + for i := range item.Config { + ic := item.Config[i] + switch ic.Key { + case "autoConnectDevices": + c.AutoConnectDevices = szToBoolPtr(ic.Value) + case "ehciEnabled": + c.EhciEnabled = szToBoolPtr(ic.Value) + } + } + d = c + case ResourceSubTypeUSBXHCI: + c := &types.VirtualUSBXHCIController{VirtualController: vc} + for i := range item.Config { + ic := item.Config[i] + switch ic.Key { + case "autoConnectDevices": + c.AutoConnectDevices = szToBoolPtr(ic.Value) + } + } + d = c + default: + return nil, errUnsupportedResourceSubtype + } + + if err := e.setBusNumber(item, d); err != nil { + return nil, err + } + + resources[item.InstanceID] = d + return d, nil +} + +func (e Envelope) toNetworkInterface( + item itemElement, + devices object.VirtualDeviceList, + _ map[string]types.BaseVirtualDevice) (types.BaseVirtualDevice, error) { + + d, err := devices.CreateEthernetCard(item.resourceSubType, nil) + if err != nil { + return nil, err + } + + nic := d.(types.BaseVirtualEthernetCard).GetVirtualEthernetCard() + + for i := range item.Config { + c := item.Config[i] + switch c.Key { + case "wakeOnLanEnabled": + nic.WakeOnLanEnabled = szToBoolPtr(c.Value) + case "uptCompatibilityEnabled": + nic.UptCompatibilityEnabled = szToBoolPtr(c.Value) + } + } + + return d, nil +} + +func (e Envelope) toFloppyDrive( + item itemElement, + devices object.VirtualDeviceList, + resources map[string]types.BaseVirtualDevice) (types.BaseVirtualDevice, error) { + + d, err := devices.CreateFloppy() + if err != nil { + return nil, err + } + resources[item.InstanceID] = d + + return d, nil +} + +func (e Envelope) toVideoCard( + item itemElement, + devices object.VirtualDeviceList, + _ map[string]types.BaseVirtualDevice) (types.BaseVirtualDevice, error) { + + d := &types.VirtualMachineVideoCard{ + VirtualDevice: types.VirtualDevice{ + Key: devices.NewKey(), + }, + } + + for i := range item.Config { + c := item.Config[i] + switch c.Key { + case "enable3DSupport": + d.Enable3DSupport = szToBoolPtr(c.Value) + case "graphicsMemorySizeInKB": + v, err := strconv.ParseInt(c.Value, 10, 64) + if err != nil { + return nil, fmt.Errorf("invalid %q=%s", c.Key, c.Value) + } + d.GraphicsMemorySizeInKB = v + case "useAutoDetect": + d.UseAutoDetect = szToBoolPtr(c.Value) + case "videoRamSizeInKB": + v, err := strconv.ParseInt(c.Value, 10, 64) + if err != nil { + return nil, fmt.Errorf("invalid %q=%s", c.Key, c.Value) + } + d.VideoRamSizeInKB = v + case "numDisplays": + v, err := strconv.ParseInt(c.Value, 10, 32) + if err != nil { + return nil, fmt.Errorf("invalid %q=%s", c.Key, c.Value) + } + d.NumDisplays = int32(v) + case "use3dRenderer": + d.Use3dRenderer = c.Value + } + } + + return d, nil +} + +func (e Envelope) toOther( + item itemElement, + devices object.VirtualDeviceList, + resources map[string]types.BaseVirtualDevice) (types.BaseVirtualDevice, error) { + + switch item.resourceSubType { + case ResourceSubTypeVMCI: + return e.toVMCI(item, devices, resources) + } + return nil, errUnsupportedResourceSubtype +} + +func (e Envelope) toVMCI( + item itemElement, + devices object.VirtualDeviceList, + _ map[string]types.BaseVirtualDevice) (types.BaseVirtualDevice, error) { + + d := &types.VirtualMachineVMCIDevice{ + VirtualDevice: types.VirtualDevice{ + Key: devices.NewKey(), + }, + } + + for i := range item.Config { + c := item.Config[i] + switch c.Key { + case "allowUnrestrictedCommunication": + d.AllowUnrestrictedCommunication = szToBoolPtr(c.Value) + } + } + + return d, nil +} + +func (e Envelope) toConfig( + dst *configSpec, + hw VirtualHardwareSection) { + + for i := range hw.Config { + c := hw.Config[i] + switch c.Key { + case "cpuHotAddEnabled": + dst.CpuHotAddEnabled = szToBoolPtr(c.Value) + case "cpuHotRemoveEnabled": + dst.CpuHotRemoveEnabled = szToBoolPtr(c.Value) + case "bootOptions.efiSecureBootEnabled": + initBootOptions(dst) + dst.BootOptions.EfiSecureBootEnabled = szToBoolPtr(c.Value) + case "firmware": + dst.Firmware = c.Value + case "flags.vbsEnabled": + initFlags(dst) + dst.Flags.VbsEnabled = szToBoolPtr(c.Value) + case "flags.vvtdEnabled": + initFlags(dst) + dst.Flags.VvtdEnabled = szToBoolPtr(c.Value) + case "memoryHotAddEnabled": + dst.MemoryHotAddEnabled = szToBoolPtr(c.Value) + case "nestedHVEnabled": + dst.NestedHVEnabled = szToBoolPtr(c.Value) + case "virtualICH7MPresent": + dst.VirtualICH7MPresent = szToBoolPtr(c.Value) + case "virtualSMCPresent": + dst.VirtualSMCPresent = szToBoolPtr(c.Value) + case "cpuAllocation.shares.shares": + initCPUAllocationShares(dst) + dst.CpuAllocation.Shares.Shares = szToInt32(c.Value) + case "cpuAllocation.shares.level": + initCPUAllocationShares(dst) + dst.CpuAllocation.Shares.Level = types.SharesLevel(c.Value) + case "simultaneousThreads": + dst.SimultaneousThreads = szToInt32(c.Value) + case "tools.syncTimeWithHost": + initToolsConfig(dst) + dst.Tools.SyncTimeWithHost = szToBoolPtr(c.Value) + case "tools.syncTimeWithHostAllowed": + initToolsConfig(dst) + dst.Tools.SyncTimeWithHostAllowed = szToBoolPtr(c.Value) + case "tools.afterPowerOn": + initToolsConfig(dst) + dst.Tools.AfterPowerOn = szToBoolPtr(c.Value) + case "tools.afterResume": + initToolsConfig(dst) + dst.Tools.AfterResume = szToBoolPtr(c.Value) + case "tools.beforeGuestShutdown": + initToolsConfig(dst) + dst.Tools.BeforeGuestShutdown = szToBoolPtr(c.Value) + case "tools.beforeGuestStandby": + initToolsConfig(dst) + dst.Tools.BeforeGuestStandby = szToBoolPtr(c.Value) + case "tools.toolsUpgradePolicy": + initToolsConfig(dst) + dst.Tools.ToolsUpgradePolicy = c.Value + case "powerOpInfo.powerOffType": + initPowerOpInfo(dst) + dst.PowerOpInfo.PowerOffType = c.Value + case "powerOpInfo.resetType": + initPowerOpInfo(dst) + dst.PowerOpInfo.ResetType = c.Value + case "powerOpInfo.suspendType": + initPowerOpInfo(dst) + dst.PowerOpInfo.SuspendType = c.Value + case "powerOpInfo.standbyAction": + initPowerOpInfo(dst) + dst.PowerOpInfo.StandbyAction = c.Value + case "vPMCEnabled": + dst.VPMCEnabled = szToBoolPtr(c.Value) + } + } +} + +func (e Envelope) toExtraConfig( + dst *configSpec, + hw VirtualHardwareSection) { + + var newEC object.OptionValueList + for i := range hw.ExtraConfig { + newEC = append(newEC, &types.OptionValue{ + Key: hw.ExtraConfig[i].Key, + Value: hw.ExtraConfig[i].Value, + }) + } + dst.ExtraConfig = newEC.Join(dst.ExtraConfig...) +} + +func initToolsConfig(dst *configSpec) { + if dst.Tools == nil { + dst.Tools = &types.ToolsConfigInfo{} + } +} + +func initPowerOpInfo(dst *configSpec) { + if dst.PowerOpInfo == nil { + dst.PowerOpInfo = &types.VirtualMachineDefaultPowerOpInfo{} + } +} + +func initCPUAllocation(dst *configSpec) { + if dst.CpuAllocation == nil { + dst.CpuAllocation = &types.ResourceAllocationInfo{} + } +} + +func initCPUAllocationShares(dst *configSpec) { + initCPUAllocation(dst) + if dst.CpuAllocation.Shares == nil { + dst.CpuAllocation.Shares = &types.SharesInfo{} + } +} + +func initFlags(dst *configSpec) { + if dst.Flags == nil { + dst.Flags = &types.VirtualMachineFlagInfo{} + } +} + +func initBootOptions(dst *configSpec) { + if dst.BootOptions == nil { + dst.BootOptions = &types.VirtualMachineBootOptions{} + } +} + +func setConnectable(dst types.BaseVirtualDevice, src itemElement) { + + d := dst.GetVirtualDevice() + for i := range src.Config { + c := src.Config[i] + switch c.Key { + case "connectable.allowGuestControl": + if d.Connectable == nil { + d.Connectable = &types.VirtualDeviceConnectInfo{} + } + d.Connectable.AllowGuestControl = szToBool(c.Value) + } + } +} + +func szToBoolPtr(s string) *bool { + if s == "" { + return nil + } + b, _ := strconv.ParseBool(s) + return &b +} + +func szToBool(s string) bool { + b, _ := strconv.ParseBool(s) + return b +} + +func szToInt32(s string) int32 { + v, _ := strconv.ParseInt(s, 10, 32) + return int32(v) +} + +func deref[T any](pT *T) T { + var t T + if pT != nil { + t = *pT + } + return t +} + +func (e Envelope) toVAppConfig( + dst *configSpec, + configName string, + vs *VirtualSystem) error { + + if len(vs.Product) == 0 { + return nil + } + + vapp := &types.VAppConfigSpec{} + + index := 0 + for i, product := range vs.Product { + vapp.Product = append(vapp.Product, types.VAppProductSpec{ + ArrayUpdateSpec: types.ArrayUpdateSpec{ + Operation: types.ArrayUpdateOperationAdd, + }, + Info: &types.VAppProductInfo{ + Key: int32(i), + ClassId: deref(product.Class), + InstanceId: deref(product.Instance), + Name: product.Product, + Vendor: product.Vendor, + Version: product.Version, + FullVersion: product.FullVersion, + ProductUrl: product.ProductURL, + VendorUrl: product.VendorURL, + AppUrl: product.AppURL, + }, + }) + + for _, p := range product.Property { + if p.Configuration != nil && *p.Configuration != configName { + // Skip properties that are not part of the provided + // configuration. + continue + } + vapp.Property = append(vapp.Property, types.VAppPropertySpec{ + ArrayUpdateSpec: types.ArrayUpdateSpec{ + Operation: types.ArrayUpdateOperationAdd, + }, + Info: &types.VAppPropertyInfo{ + Key: int32(index), + ClassId: deref(product.Class), + InstanceId: deref(product.Instance), + Id: p.Key, + Category: product.Category, + Label: deref(p.Label), + Type: p.Type, + UserConfigurable: p.UserConfigurable, + DefaultValue: deref(p.Default), + Value: "", + Description: deref(p.Description), + }, + }) + index++ + } + } + + dst.VAppConfig = vapp + return nil +} diff --git a/vendor/github.com/vmware/govmomi/ovf/env.go b/vendor/github.com/vmware/govmomi/ovf/env.go index 3ec1b99d0..02f7d7a2f 100644 --- a/vendor/github.com/vmware/govmomi/ovf/env.go +++ b/vendor/github.com/vmware/govmomi/ovf/env.go @@ -44,28 +44,28 @@ const ( ) type Env struct { - XMLName xml.Name `xml:"http://schemas.dmtf.org/ovf/environment/1 Environment"` - ID string `xml:"id,attr"` - EsxID string `xml:"http://www.vmware.com/schema/ovfenv esxId,attr"` + XMLName xml.Name `xml:"http://schemas.dmtf.org/ovf/environment/1 Environment" json:"xmlName"` + ID string `xml:"id,attr" json:"id"` + EsxID string `xml:"http://www.vmware.com/schema/ovfenv esxId,attr" json:"esxID"` - Platform *PlatformSection `xml:"PlatformSection"` - Property *PropertySection `xml:"PropertySection"` + Platform *PlatformSection `xml:"PlatformSection" json:"platformSection,omitempty"` + Property *PropertySection `xml:"PropertySection" json:"propertySection,omitempty"` } type PlatformSection struct { - Kind string `xml:"Kind"` - Version string `xml:"Version"` - Vendor string `xml:"Vendor"` - Locale string `xml:"Locale"` + Kind string `xml:"Kind" json:"kind,omitempty"` + Version string `xml:"Version" json:"version,omitempty"` + Vendor string `xml:"Vendor" json:"vendor,omitempty"` + Locale string `xml:"Locale" json:"locale,omitempty"` } type PropertySection struct { - Properties []EnvProperty `xml:"Property"` + Properties []EnvProperty `xml:"Property" json:"property,omitempty"` } type EnvProperty struct { - Key string `xml:"key,attr"` - Value string `xml:"value,attr"` + Key string `xml:"key,attr" json:"key"` + Value string `xml:"value,attr" json:"value,omitempty"` } // Marshal marshals Env to xml by using xml.Marshal. diff --git a/vendor/github.com/vmware/govmomi/ovf/envelope.go b/vendor/github.com/vmware/govmomi/ovf/envelope.go index aa77aab2d..287cb22d2 100644 --- a/vendor/github.com/vmware/govmomi/ovf/envelope.go +++ b/vendor/github.com/vmware/govmomi/ovf/envelope.go @@ -1,5 +1,5 @@ /* -Copyright (c) 2015-2023 VMware, Inc. All Rights Reserved. +Copyright (c) 2015-2024 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,74 +20,88 @@ import ( "fmt" ) +// Envelope is defined according to +// https://www.dmtf.org/sites/default/files/standards/documents/DSP0243_2.1.1.pdf. +// +// Section 9 describes the parent/child relationships. +// +// A VirtualSystem may have zero or more VirtualHardware sections. type Envelope struct { - References []File `xml:"References>File"` + References []File `xml:"References>File" json:"references,omitempty"` // Package level meta-data - Annotation *AnnotationSection `xml:"AnnotationSection"` - Product *ProductSection `xml:"ProductSection"` - Network *NetworkSection `xml:"NetworkSection"` - Disk *DiskSection `xml:"DiskSection"` - OperatingSystem *OperatingSystemSection `xml:"OperatingSystemSection"` - Eula *EulaSection `xml:"EulaSection"` - VirtualHardware *VirtualHardwareSection `xml:"VirtualHardwareSection"` - ResourceAllocation *ResourceAllocationSection `xml:"ResourceAllocationSection"` - DeploymentOption *DeploymentOptionSection `xml:"DeploymentOptionSection"` + Disk *DiskSection `xml:"DiskSection,omitempty" json:"diskSection,omitempty"` + Network *NetworkSection `xml:"NetworkSection,omitempty" json:"networkSection,omitempty"` + DeploymentOption *DeploymentOptionSection `xml:"DeploymentOptionSection,omitempty" json:"deploymentOptionSection,omitempty"` // Content: A VirtualSystem or a VirtualSystemCollection - VirtualSystem *VirtualSystem `xml:"VirtualSystem"` + VirtualSystem *VirtualSystem `xml:"VirtualSystem,omitempty" json:"virtualSystem,omitempty"` + VirtualSystemCollection *VirtualSystemCollection `xml:"VirtualSystemCollection,omitempty" json:"virtualSystemCollection,omitempty"` } type VirtualSystem struct { Content - Annotation []AnnotationSection `xml:"AnnotationSection"` - Product []ProductSection `xml:"ProductSection"` - OperatingSystem []OperatingSystemSection `xml:"OperatingSystemSection"` - Eula []EulaSection `xml:"EulaSection"` - VirtualHardware []VirtualHardwareSection `xml:"VirtualHardwareSection"` + Annotation *AnnotationSection `xml:"AnnotationSection,omitempty" json:"annotationSection,omitempty"` + Product []ProductSection `xml:"ProductSection,omitempty" json:"productSection,omitempty"` + Eula []EulaSection `xml:"EulaSection,omitempty" json:"eulaSection,omitempty"` + OperatingSystem *OperatingSystemSection `xml:"OperatingSystemSection,omitempty" json:"operatingSystemSection,omitempty"` + VirtualHardware []VirtualHardwareSection `xml:"VirtualHardwareSection,omitempty" json:"virtualHardwareSection,omitempty"` +} + +type VirtualSystemCollection struct { + Content + + // Collection level meta-data + ResourceAllocation *ResourceAllocationSection `xml:"ResourceAllocationSection,omitempty" json:"resourceAllocationSection,omitempty"` + Annotation *AnnotationSection `xml:"AnnotationSection,omitempty" json:"annotationSection,omitempty"` + Product []ProductSection `xml:"ProductSection,omitempty" json:"productSection,omitempty"` + Eula []EulaSection `xml:"EulaSection,omitempty" json:"eulaSection,omitempty"` + + // Content: One or more VirtualSystems + VirtualSystem []VirtualSystem `xml:"VirtualSystem,omitempty" json:"virtualSystem,omitempty"` } type File struct { - ID string `xml:"id,attr"` - Href string `xml:"href,attr"` - Size uint `xml:"size,attr"` - Compression *string `xml:"compression,attr"` - ChunkSize *int `xml:"chunkSize,attr"` + ID string `xml:"id,attr" json:"id,omitempty"` + Href string `xml:"href,attr" json:"href,omitempty"` + Size uint `xml:"size,attr" json:"size,omitempty"` + Compression *string `xml:"compression,attr" json:"compression,omitempty"` + ChunkSize *int `xml:"chunkSize,attr" json:"chunkSize,omitempty"` } type Content struct { - ID string `xml:"id,attr"` - Info string `xml:"Info"` - Name *string `xml:"Name"` + ID string `xml:"id,attr" json:"id,omitempty"` + Info string `xml:"Info" json:"info,omitempty"` + Name *string `xml:"Name" json:"name,omitempty"` } type Section struct { - Required *bool `xml:"required,attr"` - Info string `xml:"Info"` - Category string `xml:"Category"` + Required *bool `xml:"required,attr" json:"required,omitempty"` + Info string `xml:"Info" json:"info,omitempty"` + Category string `xml:"Category" json:"category,omitempty"` } type AnnotationSection struct { Section - Annotation string `xml:"Annotation"` + Annotation string `xml:"Annotation" json:"annotation,omitempty"` } type ProductSection struct { Section - Class *string `xml:"class,attr"` - Instance *string `xml:"instance,attr"` + Class *string `xml:"class,attr" json:"class,omitempty"` + Instance *string `xml:"instance,attr" json:"instance,omitempty"` - Product string `xml:"Product"` - Vendor string `xml:"Vendor"` - Version string `xml:"Version"` - FullVersion string `xml:"FullVersion"` - ProductURL string `xml:"ProductUrl"` - VendorURL string `xml:"VendorUrl"` - AppURL string `xml:"AppUrl"` - Property []Property `xml:"Property"` + Product string `xml:"Product" json:"product,omitempty"` + Vendor string `xml:"Vendor" json:"vendor,omitempty"` + Version string `xml:"Version" json:"version,omitempty"` + FullVersion string `xml:"FullVersion" json:"fullVersion,omitempty"` + ProductURL string `xml:"ProductUrl" json:"productUrl,omitempty"` + VendorURL string `xml:"VendorUrl" json:"vendorUrl,omitempty"` + AppURL string `xml:"AppUrl" json:"appUrl,omitempty"` + Property []Property `xml:"Property" json:"property,omitempty"` } func (p ProductSection) Key(prop Property) string { @@ -105,85 +119,86 @@ func (p ProductSection) Key(prop Property) string { } type Property struct { - Key string `xml:"key,attr"` - Type string `xml:"type,attr"` - Qualifiers *string `xml:"qualifiers,attr"` - UserConfigurable *bool `xml:"userConfigurable,attr"` - Default *string `xml:"value,attr"` - Password *bool `xml:"password,attr"` + Key string `xml:"key,attr" json:"key,omitempty"` + Type string `xml:"type,attr" json:"type,omitempty"` + Qualifiers *string `xml:"qualifiers,attr" json:"qualifiers,omitempty"` + UserConfigurable *bool `xml:"userConfigurable,attr" json:"userConfigurable,omitempty"` + Default *string `xml:"value,attr" json:"default,omitempty"` + Password *bool `xml:"password,attr" json:"password,omitempty"` + Configuration *string `xml:"configuration,attr" json:"configuration,omitempty"` - Label *string `xml:"Label"` - Description *string `xml:"Description"` + Label *string `xml:"Label" json:"label,omitempty"` + Description *string `xml:"Description" json:"description,omitempty"` - Values []PropertyConfigurationValue `xml:"Value"` + Values []PropertyConfigurationValue `xml:"Value" json:"value,omitempty"` } type PropertyConfigurationValue struct { - Value string `xml:"value,attr"` - Configuration *string `xml:"configuration,attr"` + Value string `xml:"value,attr" json:"value,omitempty"` + Configuration *string `xml:"configuration,attr" json:"configuration,omitempty"` } type NetworkSection struct { Section - Networks []Network `xml:"Network"` + Networks []Network `xml:"Network" json:"network,omitempty"` } type Network struct { - Name string `xml:"name,attr"` + Name string `xml:"name,attr" json:"name,omitempty"` - Description string `xml:"Description"` + Description string `xml:"Description" json:"description,omitempty"` } type DiskSection struct { Section - Disks []VirtualDiskDesc `xml:"Disk"` + Disks []VirtualDiskDesc `xml:"Disk" json:"disk,omitempty"` } type VirtualDiskDesc struct { - DiskID string `xml:"diskId,attr"` - FileRef *string `xml:"fileRef,attr"` - Capacity string `xml:"capacity,attr"` - CapacityAllocationUnits *string `xml:"capacityAllocationUnits,attr"` - Format *string `xml:"format,attr"` - PopulatedSize *int `xml:"populatedSize,attr"` - ParentRef *string `xml:"parentRef,attr"` + DiskID string `xml:"diskId,attr" json:"diskId,omitempty"` + FileRef *string `xml:"fileRef,attr" json:"fileRef,omitempty"` + Capacity string `xml:"capacity,attr" json:"capacity,omitempty"` + CapacityAllocationUnits *string `xml:"capacityAllocationUnits,attr" json:"capacityAllocationUnits,omitempty"` + Format *string `xml:"format,attr" json:"format,omitempty"` + PopulatedSize *int `xml:"populatedSize,attr" json:"populatedSize,omitempty"` + ParentRef *string `xml:"parentRef,attr" json:"parentRef,omitempty"` } type OperatingSystemSection struct { Section - ID int16 `xml:"id,attr"` - Version *string `xml:"version,attr"` - OSType *string `xml:"osType,attr"` + ID int16 `xml:"id,attr" json:"id"` + Version *string `xml:"version,attr" json:"version,omitempty"` + OSType *string `xml:"osType,attr" json:"osType,omitempty"` - Description *string `xml:"Description"` + Description *string `xml:"Description" json:"description,omitempty"` } type EulaSection struct { Section - License string `xml:"License"` + License string `xml:"License" json:"license,omitempty"` } type Config struct { - Required *bool `xml:"required,attr"` - Key string `xml:"key,attr"` - Value string `xml:"value,attr"` + Required *bool `xml:"required,attr" json:"required,omitempty"` + Key string `xml:"key,attr" json:"key,omitempty"` + Value string `xml:"value,attr" json:"value,omitempty"` } type VirtualHardwareSection struct { Section - ID *string `xml:"id,attr"` - Transport *string `xml:"transport,attr"` + ID *string `xml:"id,attr" json:"id"` + Transport *string `xml:"transport,attr" json:"transport,omitempty"` - System *VirtualSystemSettingData `xml:"System"` - Item []ResourceAllocationSettingData `xml:"Item"` - StorageItem []StorageAllocationSettingData `xml:"StorageItem"` - Config []Config `xml:"Config"` - ExtraConfig []Config `xml:"ExtraConfig"` + System *VirtualSystemSettingData `xml:"System" json:"system,omitempty"` + Item []ResourceAllocationSettingData `xml:"Item" json:"item,omitempty"` + StorageItem []StorageAllocationSettingData `xml:"StorageItem" json:"storageItem,omitempty"` + Config []Config `xml:"Config" json:"config,omitempty"` + ExtraConfig []Config `xml:"ExtraConfig" json:"extraConfig,omitempty"` } type VirtualSystemSettingData struct { @@ -193,35 +208,42 @@ type VirtualSystemSettingData struct { type ResourceAllocationSettingData struct { CIMResourceAllocationSettingData - Required *bool `xml:"required,attr"` - Configuration *string `xml:"configuration,attr"` - Bound *string `xml:"bound,attr"` + Required *bool `xml:"required,attr" json:"required,omitempty"` + Configuration *string `xml:"configuration,attr" json:"configuration,omitempty"` + Bound *string `xml:"bound,attr" json:"bound,omitempty"` + Config []Config `xml:"Config" json:"config,omitempty"` + CoresPerSocket *CoresPerSocket `xml:"CoresPerSocket" json:"coresPerSocket,omitempty"` } type StorageAllocationSettingData struct { CIMStorageAllocationSettingData - Required *bool `xml:"required,attr"` - Configuration *string `xml:"configuration,attr"` - Bound *string `xml:"bound,attr"` + Required *bool `xml:"required,attr" json:"required,omitempty"` + Configuration *string `xml:"configuration,attr" json:"configuration,omitempty"` + Bound *string `xml:"bound,attr" json:"bound,omitempty"` } type ResourceAllocationSection struct { Section - Item []ResourceAllocationSettingData `xml:"Item"` + Item []ResourceAllocationSettingData `xml:"Item" json:"item,omitempty"` } type DeploymentOptionSection struct { Section - Configuration []DeploymentOptionConfiguration `xml:"Configuration"` + Configuration []DeploymentOptionConfiguration `xml:"Configuration" json:"configuration,omitempty"` } type DeploymentOptionConfiguration struct { - ID string `xml:"id,attr"` - Default *bool `xml:"default,attr"` + ID string `xml:"id,attr" json:"id"` + Default *bool `xml:"default,attr" json:"default,omitempty"` - Label string `xml:"Label"` - Description string `xml:"Description"` + Label string `xml:"Label" json:"label,omitempty"` + Description string `xml:"Description" json:"description,omitempty"` +} + +type CoresPerSocket struct { + Required *bool `xml:"required,attr" json:"required,omitempty"` + Value int32 `xml:",chardata" json:"value,omitempty"` } diff --git a/vendor/github.com/vmware/govmomi/ovf/importer/archive.go b/vendor/github.com/vmware/govmomi/ovf/importer/archive.go index 6b3f631ff..a6cc9ef1c 100644 --- a/vendor/github.com/vmware/govmomi/ovf/importer/archive.go +++ b/vendor/github.com/vmware/govmomi/ovf/importer/archive.go @@ -1,18 +1,6 @@ -/* -Copyright (c) 2024-2024 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. -*/ +// © Broadcom. All Rights Reserved. +// The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. +// SPDX-License-Identifier: Apache-2.0 package importer @@ -113,9 +101,13 @@ type FileArchive struct { func (t *FileArchive) Open(name string) (io.ReadCloser, int64, error) { fpath := name if name != t.Path { - index := strings.LastIndex(t.Path, "/") - if index != -1 { - fpath = t.Path[:index] + "/" + name + if IsRemotePath(t.Path) { + index := strings.LastIndex(t.Path, "/") + if index != -1 { + fpath = t.Path[:index] + "/" + name + } + } else if !filepath.IsAbs(name) { + fpath = filepath.Join(filepath.Dir(t.Path), name) } } diff --git a/vendor/github.com/vmware/govmomi/ovf/importer/importer.go b/vendor/github.com/vmware/govmomi/ovf/importer/importer.go index 55382f06c..7a888f185 100644 --- a/vendor/github.com/vmware/govmomi/ovf/importer/importer.go +++ b/vendor/github.com/vmware/govmomi/ovf/importer/importer.go @@ -21,7 +21,6 @@ import ( "context" "errors" "fmt" - "os" "path" "path/filepath" "strings" @@ -58,15 +57,16 @@ type Importer struct { Manifest map[string]*library.Checksum } -func (imp *Importer) ReadManifest(fpath string) error { +func (imp *Importer) manifestPath(fpath string) string { base := filepath.Base(fpath) ext := filepath.Ext(base) - mfName := strings.Replace(base, ext, ".mf", 1) + return filepath.Join(filepath.Dir(fpath), strings.Replace(base, ext, ".mf", 1)) +} - mf, _, err := imp.Archive.Open(mfName) +func (imp *Importer) ReadManifest(fpath string) error { + mf, _, err := imp.Archive.Open(imp.manifestPath(fpath)) if err != nil { - msg := fmt.Sprintf("manifest %q: %s", mf, err) - fmt.Fprintln(os.Stderr, msg) + msg := fmt.Sprintf("failed to read manifest %q: %s", mf, err) return errors.New(msg) } imp.Manifest, err = library.ReadManifest(mf) @@ -126,7 +126,7 @@ func (imp *Importer) Import(ctx context.Context, fpath string, opts Options) (*t } m := ovf.NewManager(imp.Client) - spec, err := m.CreateImportSpec(ctx, string(o), imp.ResourcePool, imp.Datastore, cisp) + spec, err := m.CreateImportSpec(ctx, string(o), imp.ResourcePool, imp.Datastore, &cisp) if err != nil { return nil, err } @@ -161,6 +161,7 @@ func (imp *Importer) Import(ctx context.Context, fpath string, opts Options) (*t info, err := lease.Wait(ctx, spec.FileItem) if err != nil { + _ = lease.Abort(ctx, nil) return nil, err } @@ -169,6 +170,11 @@ func (imp *Importer) Import(ctx context.Context, fpath string, opts Options) (*t for _, i := range info.Items { if err := imp.Upload(ctx, lease, i); err != nil { + _ = lease.Abort(ctx, &types.LocalizedMethodFault{ + Fault: &types.FileFault{ + File: i.Path, + }, + }) return nil, err } } diff --git a/vendor/github.com/vmware/govmomi/ovf/importer/spec.go b/vendor/github.com/vmware/govmomi/ovf/importer/spec.go index 5afd00b89..637815350 100644 --- a/vendor/github.com/vmware/govmomi/ovf/importer/spec.go +++ b/vendor/github.com/vmware/govmomi/ovf/importer/spec.go @@ -114,9 +114,7 @@ func Spec(fpath string, a Archive, hidden, verbose bool) (*Options, error) { } if e.VirtualSystem != nil && e.VirtualSystem.Annotation != nil { - for _, a := range e.VirtualSystem.Annotation { - o.Annotation += a.Annotation - } + o.Annotation = e.VirtualSystem.Annotation.Annotation } if e.Network != nil { diff --git a/vendor/github.com/vmware/govmomi/ovf/manager.go b/vendor/github.com/vmware/govmomi/ovf/manager.go index 3ee2afdd4..8e4549e5c 100644 --- a/vendor/github.com/vmware/govmomi/ovf/manager.go +++ b/vendor/github.com/vmware/govmomi/ovf/manager.go @@ -52,7 +52,7 @@ func (m *Manager) CreateDescriptor(ctx context.Context, obj mo.Reference, cdp ty } // CreateImportSpec wraps methods.CreateImportSpec -func (m *Manager) CreateImportSpec(ctx context.Context, ovfDescriptor string, resourcePool mo.Reference, datastore mo.Reference, cisp types.OvfCreateImportSpecParams) (*types.OvfCreateImportSpecResult, error) { +func (m *Manager) CreateImportSpec(ctx context.Context, ovfDescriptor string, resourcePool mo.Reference, datastore mo.Reference, cisp types.BaseOvfCreateImportSpecParams) (*types.OvfCreateImportSpecResult, error) { req := types.CreateImportSpec{ This: m.Reference(), OvfDescriptor: ovfDescriptor, diff --git a/vendor/github.com/vmware/govmomi/ovf/ovf.go b/vendor/github.com/vmware/govmomi/ovf/ovf.go index bd279e757..d641b3107 100644 --- a/vendor/github.com/vmware/govmomi/ovf/ovf.go +++ b/vendor/github.com/vmware/govmomi/ovf/ovf.go @@ -1,18 +1,6 @@ -/* -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. -*/ +// © Broadcom. All Rights Reserved. +// The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. +// SPDX-License-Identifier: Apache-2.0 package ovf @@ -33,3 +21,8 @@ func Unmarshal(r io.Reader) (*Envelope, error) { return &e, nil } + +// Write satisfies the flags.OutputWriter interface. +func (e *Envelope) Write(w io.Writer) error { + return xml.NewEncoder(w).Encode(e) +} diff --git a/vendor/github.com/vmware/govmomi/pbm/client.go b/vendor/github.com/vmware/govmomi/pbm/client.go index 3c7965ca8..b137446ed 100644 --- a/vendor/github.com/vmware/govmomi/pbm/client.go +++ b/vendor/github.com/vmware/govmomi/pbm/client.go @@ -1,11 +1,11 @@ /* -Copyright (c) 2017 VMware, Inc. All Rights Reserved. +Copyright (c) 2017-2024 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 +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, @@ -49,6 +49,7 @@ type Client struct { func NewClient(ctx context.Context, c *vim25.Client) (*Client, error) { sc := c.Client.NewServiceClient(Path, Namespace) + sc.Cookie = c.SessionCookie // vcSessionCookie soap.Header, value must be from vim25.Client req := types.PbmRetrieveServiceContent{ This: ServiceInstance, @@ -313,3 +314,35 @@ func (c *Client) QueryAssociatedProfiles(ctx context.Context, entities []types.P return res.Returnval, nil } + +func (c *Client) QueryIOFiltersFromProfileId( + ctx context.Context, profileID string) ([]types.PbmProfileToIofilterMap, error) { + + req := types.PbmQueryIOFiltersFromProfileId{ + This: c.ServiceContent.ProfileManager, + ProfileIds: []types.PbmProfileId{{UniqueId: profileID}}, + } + res, err := methods.PbmQueryIOFiltersFromProfileId(ctx, c, &req) + if err != nil { + return nil, err + } + return res.Returnval, nil +} + +func (c *Client) SupportsEncryption( + ctx context.Context, profileID string) (bool, error) { + + list, err := c.QueryIOFiltersFromProfileId(ctx, profileID) + if err != nil { + return false, err + } + for i := range list { + for j := range list[i].Iofilters { + f := list[i].Iofilters[j] + if f.FilterType == string(types.PbmIofilterInfoFilterTypeENCRYPTION) { + return true, nil + } + } + } + return false, nil +} diff --git a/vendor/github.com/vmware/govmomi/pbm/methods/internal_methods.go b/vendor/github.com/vmware/govmomi/pbm/methods/internal_methods.go new file mode 100644 index 000000000..3c82f7ef5 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/pbm/methods/internal_methods.go @@ -0,0 +1,44 @@ +/* +Copyright (c) 2024-2024 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 PbmQueryIOFiltersFromProfileIdBody struct { + Req *types.PbmQueryIOFiltersFromProfileId `xml:"urn:internalpbm PbmQueryIOFiltersFromProfileId,omitempty"` + Res *types.PbmQueryIOFiltersFromProfileIdResponse `xml:"urn:internalpbm PbmQueryIOFiltersFromProfileIdResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *PbmQueryIOFiltersFromProfileIdBody) Fault() *soap.Fault { return b.Fault_ } + +func PbmQueryIOFiltersFromProfileId(ctx context.Context, r soap.RoundTripper, req *types.PbmQueryIOFiltersFromProfileId) (*types.PbmQueryIOFiltersFromProfileIdResponse, error) { + var reqBody, resBody PbmQueryIOFiltersFromProfileIdBody + + 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/methods/methods.go b/vendor/github.com/vmware/govmomi/pbm/methods/methods.go index d7298dfce..f95bb0279 100644 --- a/vendor/github.com/vmware/govmomi/pbm/methods/methods.go +++ b/vendor/github.com/vmware/govmomi/pbm/methods/methods.go @@ -1,18 +1,6 @@ -/* -Copyright (c) 2014-2024 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. -*/ +// © Broadcom. All Rights Reserved. +// The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. +// SPDX-License-Identifier: Apache-2.0 package methods diff --git a/vendor/github.com/vmware/govmomi/pbm/types/enum.go b/vendor/github.com/vmware/govmomi/pbm/types/enum.go index 992bcfdc3..9ef431bea 100644 --- a/vendor/github.com/vmware/govmomi/pbm/types/enum.go +++ b/vendor/github.com/vmware/govmomi/pbm/types/enum.go @@ -1,18 +1,6 @@ -/* -Copyright (c) 2014-2024 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. -*/ +// © Broadcom. All Rights Reserved. +// The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. +// SPDX-License-Identifier: Apache-2.0 package types @@ -22,6 +10,40 @@ import ( "github.com/vmware/govmomi/vim25/types" ) +type ManagedObjectTypes string + +const ( + ManagedObjectTypesPbmServiceInstance = ManagedObjectTypes("PbmServiceInstance") + ManagedObjectTypesPbmSessionManager = ManagedObjectTypes("PbmSessionManager") + ManagedObjectTypesPbmCapabilityMetadataManager = ManagedObjectTypes("PbmCapabilityMetadataManager") + ManagedObjectTypesPbmComplianceManager = ManagedObjectTypes("PbmComplianceManager") + ManagedObjectTypesPbmPlacementSolver = ManagedObjectTypes("PbmPlacementSolver") + ManagedObjectTypesPbmProfileProfileManager = ManagedObjectTypes("PbmProfileProfileManager") + ManagedObjectTypesPbmProvider = ManagedObjectTypes("PbmProvider") + ManagedObjectTypesPbmReplicationManager = ManagedObjectTypes("PbmReplicationManager") +) + +func (e ManagedObjectTypes) Values() []ManagedObjectTypes { + return []ManagedObjectTypes{ + ManagedObjectTypesPbmServiceInstance, + ManagedObjectTypesPbmSessionManager, + ManagedObjectTypesPbmCapabilityMetadataManager, + ManagedObjectTypesPbmComplianceManager, + ManagedObjectTypesPbmPlacementSolver, + ManagedObjectTypesPbmProfileProfileManager, + ManagedObjectTypesPbmProvider, + ManagedObjectTypesPbmReplicationManager, + } +} + +func (e ManagedObjectTypes) Strings() []string { + return types.EnumValuesAsStrings(e.Values()) +} + +func init() { + types.Add("pbm:ManagedObjectTypes", reflect.TypeOf((*ManagedObjectTypes)(nil)).Elem()) +} + type PbmAssociateAndApplyPolicyStatusPolicyStatus string const ( @@ -195,6 +217,31 @@ func init() { types.Add("pbm:PbmCapabilityOperator", reflect.TypeOf((*PbmCapabilityOperator)(nil)).Elem()) } +// Capability category type constants. +type PbmCapabilitySchemaCapabilityCategory string + +const ( + // Common and identical in all sub-profiles. + PbmCapabilitySchemaCapabilityCategoryCommon = PbmCapabilitySchemaCapabilityCategory("common") + // Part of a single sub-profile. + PbmCapabilitySchemaCapabilityCategoryDatastoreSpecific = PbmCapabilitySchemaCapabilityCategory("datastoreSpecific") +) + +func (e PbmCapabilitySchemaCapabilityCategory) Values() []PbmCapabilitySchemaCapabilityCategory { + return []PbmCapabilitySchemaCapabilityCategory{ + PbmCapabilitySchemaCapabilityCategoryCommon, + PbmCapabilitySchemaCapabilityCategoryDatastoreSpecific, + } +} + +func (e PbmCapabilitySchemaCapabilityCategory) Strings() []string { + return types.EnumValuesAsStrings(e.Values()) +} + +func init() { + types.Add("pbm:PbmCapabilitySchemaCapabilityCategory", reflect.TypeOf((*PbmCapabilitySchemaCapabilityCategory)(nil)).Elem()) +} + // The `PbmCapabilityTimeUnitType_enum` enumeration type // defines the supported list of time units for profiles that specify // time span capabilities and constraints. diff --git a/vendor/github.com/vmware/govmomi/pbm/types/if.go b/vendor/github.com/vmware/govmomi/pbm/types/if.go index 3301d21e6..05bae2f35 100644 --- a/vendor/github.com/vmware/govmomi/pbm/types/if.go +++ b/vendor/github.com/vmware/govmomi/pbm/types/if.go @@ -1,18 +1,6 @@ -/* -Copyright (c) 2014-2024 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. -*/ +// © Broadcom. All Rights Reserved. +// The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. +// SPDX-License-Identifier: Apache-2.0 package types diff --git a/vendor/github.com/vmware/govmomi/pbm/types/internal_types.go b/vendor/github.com/vmware/govmomi/pbm/types/internal_types.go new file mode 100644 index 000000000..d166d9dc9 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/pbm/types/internal_types.go @@ -0,0 +1,95 @@ +/* +Copyright (c) 2024-2024 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 ArrayOfPbmIofilterInfo struct { + PbmIofilterInfo []PbmIofilterInfo `xml:"PbmIofilterInfo,omitempty" json:"_value"` +} + +func init() { + types.Add("pbm:ArrayOfPbmIofilterInfo", reflect.TypeOf((*ArrayOfPbmIofilterInfo)(nil)).Elem()) +} + +type ArrayOfPbmProfileToIofilterMap struct { + PbmProfileToIofilterMap []PbmProfileToIofilterMap `xml:"PbmProfileToIofilterMap,omitempty" json:"_value"` +} + +func init() { + types.Add("pbm:ArrayOfPbmProfileToIofilterMap", reflect.TypeOf((*ArrayOfPbmProfileToIofilterMap)(nil)).Elem()) +} + +type PbmQueryIOFiltersFromProfileId PbmQueryIOFiltersFromProfileIdRequestType + +func init() { + types.Add("pbm:PbmQueryIOFiltersFromProfileId", reflect.TypeOf((*PbmQueryIOFiltersFromProfileId)(nil)).Elem()) +} + +type PbmQueryIOFiltersFromProfileIdRequestType struct { + This types.ManagedObjectReference `xml:"_this" json:"_this"` + ProfileIds []PbmProfileId `xml:"profileIds,typeattr" json:"profileIds"` +} + +func init() { + types.Add("pbm:PbmQueryIOFiltersFromProfileIdRequestType", reflect.TypeOf((*PbmQueryIOFiltersFromProfileIdRequestType)(nil)).Elem()) +} + +type PbmQueryIOFiltersFromProfileIdResponse struct { + Returnval []PbmProfileToIofilterMap `xml:"returnval" json:"returnval"` +} + +type PbmIofilterInfo struct { + types.DynamicData + + VibId string `xml:"vibId" json:"vibId"` + FilterType string `xml:"filterType,omitempty" json:"filterType,omitempty"` +} + +func init() { + types.Add("pbm:PbmIofilterInfo", reflect.TypeOf((*PbmIofilterInfo)(nil)).Elem()) +} + +type PbmProfileToIofilterMap struct { + types.DynamicData + + Key PbmProfileId `xml:"key,typeattr" json:"key"` + Iofilters []PbmIofilterInfo `xml:"iofilters,omitempty" json:"iofilters,omitempty"` + Fault *types.LocalizedMethodFault `xml:"fault,omitempty" json:"fault,omitempty"` +} + +func init() { + types.Add("pbm:PbmProfileToIofilterMap", reflect.TypeOf((*PbmProfileToIofilterMap)(nil)).Elem()) +} + +type PbmProfileDetails struct { + types.DynamicData + + Profile BasePbmCapabilityProfile `xml:"profile,typeattr" json:"profile"` + IofInfos []PbmIofilterInfo `xml:"iofInfos,omitempty" json:"iofInfos,omitempty"` + IofMethodFault *types.LocalizedMethodFault `xml:"iofMethodFault,omitempty" json:"iofMethodFault,omitempty"` + IsReplicationPolicy bool `xml:"isReplicationPolicy" json:"isReplicationPolicy"` + RepMethodFault *types.LocalizedMethodFault `xml:"repMethodFault,omitempty" json:"repMethodFault,omitempty"` +} + +func init() { + types.Add("pbm:PbmProfileDetails", reflect.TypeOf((*PbmProfileDetails)(nil)).Elem()) +} diff --git a/vendor/github.com/vmware/govmomi/pbm/types/types.go b/vendor/github.com/vmware/govmomi/pbm/types/types.go index 5bd9598f7..2dcab1efb 100644 --- a/vendor/github.com/vmware/govmomi/pbm/types/types.go +++ b/vendor/github.com/vmware/govmomi/pbm/types/types.go @@ -1,18 +1,6 @@ -/* -Copyright (c) 2014-2024 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. -*/ +// © Broadcom. All Rights Reserved. +// The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. +// SPDX-License-Identifier: Apache-2.0 package types @@ -983,6 +971,14 @@ type PbmCapabilitySchema struct { LineOfService BasePbmLineOfServiceInfo `xml:"lineOfService,omitempty,typeattr" json:"lineOfService,omitempty"` // Capability metadata organized by category CapabilityMetadataPerCategory []PbmCapabilityMetadataPerCategory `xml:"capabilityMetadataPerCategory" json:"capabilityMetadataPerCategory"` + // The category of the capabilities in this schema. + // + // See `PbmCapabilitySchemaCapabilityCategory_enum` for the list of supported types. + // If omitted this specifies `datastoreSpecific` + // unless the `PbmCapabilitySchema.lineOfService` is of type `PbmVaioDataServiceInfo`. + // If `PbmCapabilitySchema.lineOfService` is of type `PbmVaioDataServiceInfo` + // then this schema is of `common` type. + CapabilityCategory string `xml:"capabilityCategory,omitempty" json:"capabilityCategory,omitempty"` } func init() { diff --git a/vendor/github.com/vmware/govmomi/property/collector.go b/vendor/github.com/vmware/govmomi/property/collector.go index 9ee78d0d3..244796dfc 100644 --- a/vendor/github.com/vmware/govmomi/property/collector.go +++ b/vendor/github.com/vmware/govmomi/property/collector.go @@ -264,9 +264,12 @@ func (p *Collector) RetrieveOne(ctx context.Context, obj types.ManagedObjectRefe // WaitForUpdatesEx waits for any of the specified properties of the specified // managed object to change. It calls the specified function for every update it -// receives. If this function returns false, it continues waiting for +// receives an update - including the empty filter set, which can occur if no +// objects are eligible for updates. +// +// If this function returns false, it continues waiting for // subsequent updates. If this function returns true, it stops waiting and -// returns. +// returns upon receiving the first non-empty filter set. // // If the Context is canceled, a call to CancelWaitForUpdates() is made and its // error value is returned. @@ -313,6 +316,12 @@ func (p *Collector) WaitForUpdatesEx( opts.Truncated = *set.Truncated } + if len(set.FilterSet) == 0 { + // Trigger callbacks in case callers need to be notified + // of the empty filter set. + _ = onUpdatesFn(make([]types.ObjectUpdate, 0)) + } + for _, fs := range set.FilterSet { if opts.PropagateMissing { for i := range fs.ObjectSet { diff --git a/vendor/github.com/vmware/govmomi/session/cache/session.go b/vendor/github.com/vmware/govmomi/session/cache/session.go index c6c3955c1..33273c69f 100644 --- a/vendor/github.com/vmware/govmomi/session/cache/session.go +++ b/vendor/github.com/vmware/govmomi/session/cache/session.go @@ -1,11 +1,11 @@ /* -Copyright (c) 2020 VMware, Inc. All Rights Reserved. +Copyright (c) 2020-2024 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 +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, @@ -18,7 +18,7 @@ package cache import ( "context" - "crypto/sha1" + "crypto/sha256" "encoding/json" "fmt" "net/url" @@ -26,6 +26,7 @@ import ( "os/user" "path/filepath" + "github.com/vmware/govmomi/fault" "github.com/vmware/govmomi/session" "github.com/vmware/govmomi/vapi/rest" "github.com/vmware/govmomi/vim25" @@ -104,7 +105,7 @@ func (s *Session) key(path string) string { // Key session file off of full URI and insecure setting. // Hash key to get a predictable, canonical format. key := fmt.Sprintf("%s#insecure=%t", p.String(), s.Insecure) - return fmt.Sprintf("%040x", sha1.Sum([]byte(key))) + return fmt.Sprintf("%064x", sha256.Sum256([]byte(key))) } func (s *Session) file(p string) string { @@ -227,12 +228,9 @@ func soapSessionValid(ctx context.Context, client *vim25.Client) (bool, error) { m := session.NewManager(client) u, err := m.UserSession(ctx) if err != nil { - if soap.IsSoapFault(err) { - fault := soap.ToSoapFault(err).VimFault() + if fault.Is(err, &types.ManagedObjectNotFound{}) { // If the PropertyCollector is not found, the saved session for this URL is not valid - if _, ok := fault.(types.ManagedObjectNotFound); ok { - return false, nil - } + return false, nil } return false, err diff --git a/vendor/github.com/vmware/govmomi/session/manager.go b/vendor/github.com/vmware/govmomi/session/manager.go index 6a24fb954..ac8d11dff 100644 --- a/vendor/github.com/vmware/govmomi/session/manager.go +++ b/vendor/github.com/vmware/govmomi/session/manager.go @@ -1,11 +1,11 @@ /* -Copyright (c) 2015 VMware, Inc. All Rights Reserved. +Copyright (c) 2015-2024 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 +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, @@ -21,7 +21,9 @@ import ( "net/url" "os" "strings" + "sync" + "github.com/vmware/govmomi/fault" "github.com/vmware/govmomi/property" "github.com/vmware/govmomi/vim25" "github.com/vmware/govmomi/vim25/methods" @@ -59,6 +61,7 @@ func Secret(value string) (string, error) { type Manager struct { client *vim25.Client userSession *types.UserSession + mu sync.Mutex } func NewManager(client *vim25.Client) *Manager { @@ -69,7 +72,7 @@ func NewManager(client *vim25.Client) *Manager { return &m } -func (sm Manager) Reference() types.ManagedObjectReference { +func (sm *Manager) Reference() types.ManagedObjectReference { return *sm.client.ServiceContent.SessionManager } @@ -83,6 +86,21 @@ func (sm *Manager) SetLocale(ctx context.Context, locale string) error { return err } +func (sm *Manager) setUserSession(val *types.UserSession) { + sm.mu.Lock() + sm.userSession = val + sm.mu.Unlock() +} + +func (sm *Manager) getUserSession() (types.UserSession, bool) { + sm.mu.Lock() + defer sm.mu.Unlock() + if sm.userSession == nil { + return types.UserSession{}, false + } + return *sm.userSession, true +} + func (sm *Manager) Login(ctx context.Context, u *url.Userinfo) error { req := types.Login{ This: sm.Reference(), @@ -101,7 +119,7 @@ func (sm *Manager) Login(ctx context.Context, u *url.Userinfo) error { return err } - sm.userSession = &login.Returnval + sm.setUserSession(&login.Returnval) return nil } @@ -139,7 +157,7 @@ func (sm *Manager) LoginExtensionByCertificate(ctx context.Context, key string) // Copy the session cookie sm.client.Jar.SetCookies(u, c.Jar.Cookies(c.URL())) - sm.userSession = &login.Returnval + sm.setUserSession(&login.Returnval) return nil } @@ -154,7 +172,7 @@ func (sm *Manager) LoginByToken(ctx context.Context) error { return err } - sm.userSession = &login.Returnval + sm.setUserSession(&login.Returnval) return nil } @@ -168,7 +186,7 @@ func (sm *Manager) Logout(ctx context.Context) error { return err } - sm.userSession = nil + sm.setUserSession(nil) return nil } @@ -181,11 +199,8 @@ func (sm *Manager) UserSession(ctx context.Context) (*types.UserSession, error) err := pc.RetrieveOne(ctx, sm.Reference(), []string{"currentSession"}, &mgr) if err != nil { // It's OK if we can't retrieve properties because we're not authenticated - if f, ok := err.(types.HasFault); ok { - switch f.Fault().(type) { - case *types.NotAuthenticated: - return nil, nil - } + if fault.Is(err, &types.NotAuthenticated{}) { + return nil, nil } return nil, err @@ -207,14 +222,15 @@ func (sm *Manager) TerminateSession(ctx context.Context, sessionId []string) err // SessionIsActive checks whether the session that was created at login is // still valid. This function only works against vCenter. func (sm *Manager) SessionIsActive(ctx context.Context) (bool, error) { - if sm.userSession == nil { + userSession, ok := sm.getUserSession() + if !ok { return false, nil } req := types.SessionIsActive{ This: sm.Reference(), - SessionID: sm.userSession.Key, - UserName: sm.userSession.UserName, + SessionID: userSession.Key, + UserName: userSession.UserName, } active, err := methods.SessionIsActive(ctx, sm.client, &req) @@ -277,7 +293,7 @@ func (sm *Manager) CloneSession(ctx context.Context, ticket string) error { return err } - sm.userSession = &res.Returnval + sm.setUserSession(&res.Returnval) return nil } @@ -304,6 +320,6 @@ func (sm *Manager) ImpersonateUser(ctx context.Context, name string) error { return err } - sm.userSession = &res.Returnval + sm.setUserSession(&res.Returnval) return nil } diff --git a/vendor/github.com/vmware/govmomi/vapi/library/finder/path.go b/vendor/github.com/vmware/govmomi/vapi/library/finder/path.go index 10780a29c..521a9e5c6 100644 --- a/vendor/github.com/vmware/govmomi/vapi/library/finder/path.go +++ b/vendor/github.com/vmware/govmomi/vapi/library/finder/path.go @@ -18,12 +18,12 @@ package finder import ( "context" + "errors" "fmt" "net/url" "path" "strings" - "github.com/vmware/govmomi/internal" "github.com/vmware/govmomi/object" "github.com/vmware/govmomi/property" "github.com/vmware/govmomi/vapi/library" @@ -135,78 +135,133 @@ func (f *PathFinder) datastoreName(ctx context.Context, id string) (string, erro return name, nil } -func (f *PathFinder) convertPath(ctx context.Context, b *mo.Datastore, path string) (string, error) { - if !internal.IsDatastoreVSAN(*b) { +func (f *PathFinder) convertPath( + ctx context.Context, + dc *object.Datacenter, + ds mo.Datastore, + path string) (string, error) { + + if v := ds.Capability.TopLevelDirectoryCreateSupported; v != nil && *v { return path, nil } - var dc *object.Datacenter - - entities, err := mo.Ancestors(ctx, f.c, f.c.ServiceContent.PropertyCollector, b.Self) - if err != nil { - return "", err + if dc == nil { + entities, err := mo.Ancestors( + ctx, + f.c, + f.c.ServiceContent.PropertyCollector, + ds.Self) + if err != nil { + return "", fmt.Errorf("failed to find ancestors: %w", err) + } + for _, entity := range entities { + if entity.Self.Type == "Datacenter" { + dc = object.NewDatacenter(f.c, entity.Self) + break + } + } } - for _, entity := range entities { - if entity.Self.Type == "Datacenter" { - dc = object.NewDatacenter(f.c, entity.Self) - break - } + if dc == nil { + return "", errors.New("failed to find datacenter") } m := object.NewDatastoreNamespaceManager(f.c) return m.ConvertNamespacePathToUuidPath(ctx, dc, path) } -// ResolveLibraryItemStorage transforms StorageURIs Datastore url (uuid) to Datastore name. -func (f *PathFinder) ResolveLibraryItemStorage(ctx context.Context, storage []library.Storage) error { +// ResolveLibraryItemStorage transforms the StorageURIs field in the provided +// storage items from a datastore URL, ex. +// "ds:///vmfs/volumes/DATASTORE_UUID/contentlib-LIB_UUID/ITEM_UUID/file.vmdk", +// to the format that includes the datastore name, ex. +// "[DATASTORE_NAME] contentlib-LIB_UUID/ITEM_UUID/file.vmdk". +// +// If datastoreMap is provided, then it will be updated with the datastores +// involved in the resolver. The properties name, summary.url, and +// capability.topLevelDirectoryCreateSupported will be available after the +// resolver completes. +// +// If a storage item resides on a datastore that does not support the creation +// of top-level directories, then this means the datastore is vSAN and the +// storage item path needs to be further converted. If this occurs, then the +// datacenter to which the datastore belongs is required. If the datacenter +// parameter is non-nil, it is used, otherwise the datacenter for each datastore +// is resolved as needed. It is much more efficient to send in the datacenter if +// it is known ahead of time that the content library is stored on a vSAN +// datastore. +func (f *PathFinder) ResolveLibraryItemStorage( + ctx context.Context, + datacenter *object.Datacenter, + datastoreMap map[string]mo.Datastore, + storage []library.Storage) error { + // TODO: // - reuse PathFinder.cache - // - the transform here isn't Content Library specific, but is currently the only known use case - backing := map[string]*mo.Datastore{} + // - the transform here isn't Content Library specific, but is currently + // the only known use case var ids []types.ManagedObjectReference - // don't think we can have more than 1 Datastore backing currently, future proof anyhow - for _, item := range storage { - id := item.StorageBacking.DatastoreID - if _, ok := backing[id]; ok { - continue - } - backing[id] = nil - ids = append(ids, types.ManagedObjectReference{Type: "Datastore", Value: id}) + if datastoreMap == nil { + datastoreMap = map[string]mo.Datastore{} } - var ds []mo.Datastore - pc := property.DefaultCollector(f.c) - props := []string{"name", "summary.url", "summary.type"} - if err := pc.Retrieve(ctx, ids, props, &ds); err != nil { + // Currently ContentLibrary only supports a single storage backing, but this + // future proofs things. + for _, item := range storage { + id := item.StorageBacking.DatastoreID + if _, ok := datastoreMap[id]; ok { + continue + } + datastoreMap[id] = mo.Datastore{} + ids = append( + ids, + types.ManagedObjectReference{Type: "Datastore", Value: id}) + } + + var ( + datastores []mo.Datastore + pc = property.DefaultCollector(f.c) + props = []string{ + "name", + "summary.url", + "capability.topLevelDirectoryCreateSupported", + } + ) + + if err := pc.Retrieve(ctx, ids, props, &datastores); err != nil { return err } - for i := range ds { - backing[ds[i].Self.Value] = &ds[i] + for i := range datastores { + datastoreMap[datastores[i].Self.Value] = datastores[i] } for _, item := range storage { - b := backing[item.StorageBacking.DatastoreID] - dsurl := b.Summary.Url + ds := datastoreMap[item.StorageBacking.DatastoreID] + dsURL := ds.Summary.Url for i := range item.StorageURIs { - uri, err := url.Parse(item.StorageURIs[i]) + szURI := item.StorageURIs[i] + uri, err := url.Parse(szURI) if err != nil { - return err + return fmt.Errorf( + "failed to parse storage URI %q: %w", szURI, err) } + + uri.OmitHost = false // `ds://` required for ConvertNamespacePathToUuidPath() uri.Path = path.Clean(uri.Path) // required for ConvertNamespacePathToUuidPath() uri.RawQuery = "" - u, err := f.convertPath(ctx, b, uri.String()) + + uriPath := uri.String() + u, err := f.convertPath(ctx, datacenter, ds, uriPath) if err != nil { - return err + return fmt.Errorf("failed to convert path %q: %w", uriPath, err) } - u = strings.TrimPrefix(u, dsurl) + u = strings.TrimPrefix(u, dsURL) u = strings.TrimPrefix(u, "/") item.StorageURIs[i] = (&object.DatastorePath{ - Datastore: b.Name, + Datastore: ds.Name, Path: u, }).String() } diff --git a/vendor/github.com/vmware/govmomi/vapi/library/library.go b/vendor/github.com/vmware/govmomi/vapi/library/library.go index 148464938..7c9b3f1e8 100644 --- a/vendor/github.com/vmware/govmomi/vapi/library/library.go +++ b/vendor/github.com/vmware/govmomi/vapi/library/library.go @@ -50,6 +50,13 @@ type Library struct { Publication *Publication `json:"publish_info,omitempty"` SecurityPolicyID string `json:"security_policy_id,omitempty"` UnsetSecurityPolicyID bool `json:"unset_security_policy_id,omitempty"` + ServerGUID string `json:"server_guid,omitempty"` + StateInfo *StateInfo `json:"state_info,omitempty"` +} + +// StateInfo provides the state info of a content library. +type StateInfo struct { + State string `json:"state"` } // Subscription info diff --git a/vendor/github.com/vmware/govmomi/vapi/rest/client.go b/vendor/github.com/vmware/govmomi/vapi/rest/client.go index 52552bf00..048b65f36 100644 --- a/vendor/github.com/vmware/govmomi/vapi/rest/client.go +++ b/vendor/github.com/vmware/govmomi/vapi/rest/client.go @@ -1,11 +1,11 @@ /* -Copyright (c) 2018 VMware, Inc. All Rights Reserved. +Copyright (c) 2018-2024 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 +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, @@ -22,8 +22,10 @@ import ( "encoding/json" "fmt" "io" + "mime" "net/http" "net/url" + "os" "strings" "sync" "time" @@ -273,6 +275,36 @@ func (c *Client) DownloadFile(ctx context.Context, file string, u *url.URL, para return c.Client.DownloadFile(ctx, file, u, &p) } +// DownloadAttachment writes the response to given filename, defaulting to Content-Disposition filename in the response. +// A filename of "-" writes the response to stdout. +func (c *Client) DownloadAttachment(ctx context.Context, req *http.Request, filename string) error { + return c.Client.Do(ctx, req, func(res *http.Response) error { + if filename == "" { + d := res.Header.Get("Content-Disposition") + _, params, err := mime.ParseMediaType(d) + if err == nil { + filename = params["filename"] + } + } + + var w io.Writer + + if filename == "-" { + w = os.Stdout + } else { + f, err := os.Create(filename) + if err != nil { + return err + } + defer f.Close() + w = f + } + + _, err := io.Copy(w, res.Body) + return err + }) +} + // Upload wraps soap.Client.Upload, adding the REST authentication header func (c *Client) Upload(ctx context.Context, f io.Reader, u *url.URL, param *soap.Upload) error { p := *param diff --git a/vendor/github.com/vmware/govmomi/vim25/client.go b/vendor/github.com/vmware/govmomi/vim25/client.go index 3daaf131a..855bc1604 100644 --- a/vendor/github.com/vmware/govmomi/vim25/client.go +++ b/vendor/github.com/vmware/govmomi/vim25/client.go @@ -28,7 +28,7 @@ import ( const ( Namespace = "vim25" - Version = "8.0.3.0" + Version = "9.0.0.0" Path = "/sdk" ) diff --git a/vendor/github.com/vmware/govmomi/vim25/json/discriminator.go b/vendor/github.com/vmware/govmomi/vim25/json/discriminator.go index ce315dd52..eed9a664f 100644 --- a/vendor/github.com/vmware/govmomi/vim25/json/discriminator.go +++ b/vendor/github.com/vmware/govmomi/vim25/json/discriminator.go @@ -354,7 +354,11 @@ func discriminatorInterfaceEncode(e *encodeState, v reflect.Value, opts encOpts) e.discriminatorEncodeTypeName = true newStructEncoder(v.Type())(e, v, opts) case reflect.Ptr: - discriminatorInterfaceEncode(e, v, opts) + if v.IsZero() { + newPtrEncoder(v.Type())(e, v, opts) + } else { + discriminatorInterfaceEncode(e, v, opts) + } default: discriminatorValue := opts.discriminatorValueFn(v.Type()) if discriminatorValue == "" { diff --git a/vendor/github.com/vmware/govmomi/vim25/methods/methods.go b/vendor/github.com/vmware/govmomi/vim25/methods/methods.go index 2bc99d218..153e9707f 100644 --- a/vendor/github.com/vmware/govmomi/vim25/methods/methods.go +++ b/vendor/github.com/vmware/govmomi/vim25/methods/methods.go @@ -1,18 +1,6 @@ -/* -Copyright (c) 2014-2024 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. -*/ +// © Broadcom. All Rights Reserved. +// The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. +// SPDX-License-Identifier: Apache-2.0 package methods @@ -4603,6 +4591,106 @@ func DetachTagFromVStorageObject(ctx context.Context, r soap.RoundTripper, req * return resBody.Res, nil } +type DirectPathProfileManagerCreateBody struct { + Req *types.DirectPathProfileManagerCreate `xml:"urn:vim25 DirectPathProfileManagerCreate,omitempty"` + Res *types.DirectPathProfileManagerCreateResponse `xml:"DirectPathProfileManagerCreateResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *DirectPathProfileManagerCreateBody) Fault() *soap.Fault { return b.Fault_ } + +func DirectPathProfileManagerCreate(ctx context.Context, r soap.RoundTripper, req *types.DirectPathProfileManagerCreate) (*types.DirectPathProfileManagerCreateResponse, error) { + var reqBody, resBody DirectPathProfileManagerCreateBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type DirectPathProfileManagerDeleteBody struct { + Req *types.DirectPathProfileManagerDelete `xml:"urn:vim25 DirectPathProfileManagerDelete,omitempty"` + Res *types.DirectPathProfileManagerDeleteResponse `xml:"DirectPathProfileManagerDeleteResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *DirectPathProfileManagerDeleteBody) Fault() *soap.Fault { return b.Fault_ } + +func DirectPathProfileManagerDelete(ctx context.Context, r soap.RoundTripper, req *types.DirectPathProfileManagerDelete) (*types.DirectPathProfileManagerDeleteResponse, error) { + var reqBody, resBody DirectPathProfileManagerDeleteBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type DirectPathProfileManagerListBody struct { + Req *types.DirectPathProfileManagerList `xml:"urn:vim25 DirectPathProfileManagerList,omitempty"` + Res *types.DirectPathProfileManagerListResponse `xml:"DirectPathProfileManagerListResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *DirectPathProfileManagerListBody) Fault() *soap.Fault { return b.Fault_ } + +func DirectPathProfileManagerList(ctx context.Context, r soap.RoundTripper, req *types.DirectPathProfileManagerList) (*types.DirectPathProfileManagerListResponse, error) { + var reqBody, resBody DirectPathProfileManagerListBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type DirectPathProfileManagerQueryCapacityBody struct { + Req *types.DirectPathProfileManagerQueryCapacity `xml:"urn:vim25 DirectPathProfileManagerQueryCapacity,omitempty"` + Res *types.DirectPathProfileManagerQueryCapacityResponse `xml:"DirectPathProfileManagerQueryCapacityResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *DirectPathProfileManagerQueryCapacityBody) Fault() *soap.Fault { return b.Fault_ } + +func DirectPathProfileManagerQueryCapacity(ctx context.Context, r soap.RoundTripper, req *types.DirectPathProfileManagerQueryCapacity) (*types.DirectPathProfileManagerQueryCapacityResponse, error) { + var reqBody, resBody DirectPathProfileManagerQueryCapacityBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type DirectPathProfileManagerUpdateBody struct { + Req *types.DirectPathProfileManagerUpdate `xml:"urn:vim25 DirectPathProfileManagerUpdate,omitempty"` + Res *types.DirectPathProfileManagerUpdateResponse `xml:"DirectPathProfileManagerUpdateResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *DirectPathProfileManagerUpdateBody) Fault() *soap.Fault { return b.Fault_ } + +func DirectPathProfileManagerUpdate(ctx context.Context, r soap.RoundTripper, req *types.DirectPathProfileManagerUpdate) (*types.DirectPathProfileManagerUpdateResponse, error) { + var reqBody, resBody DirectPathProfileManagerUpdateBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + type DisableAlarmBody struct { Req *types.DisableAlarm `xml:"urn:vim25 DisableAlarm,omitempty"` Res *types.DisableAlarmResponse `xml:"DisableAlarmResponse,omitempty"` @@ -4723,6 +4811,26 @@ func DisableMultipathPath(ctx context.Context, r soap.RoundTripper, req *types.D return resBody.Res, nil } +type DisableNetworkBoot_TaskBody struct { + Req *types.DisableNetworkBoot_Task `xml:"urn:vim25 DisableNetworkBoot_Task,omitempty"` + Res *types.DisableNetworkBoot_TaskResponse `xml:"DisableNetworkBoot_TaskResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *DisableNetworkBoot_TaskBody) Fault() *soap.Fault { return b.Fault_ } + +func DisableNetworkBoot_Task(ctx context.Context, r soap.RoundTripper, req *types.DisableNetworkBoot_Task) (*types.DisableNetworkBoot_TaskResponse, error) { + var reqBody, resBody DisableNetworkBoot_TaskBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + type DisableRulesetBody struct { Req *types.DisableRuleset `xml:"urn:vim25 DisableRuleset,omitempty"` Res *types.DisableRulesetResponse `xml:"DisableRulesetResponse,omitempty"` @@ -5183,6 +5291,26 @@ func EnableMultipathPath(ctx context.Context, r soap.RoundTripper, req *types.En return resBody.Res, nil } +type EnableNetworkBoot_TaskBody struct { + Req *types.EnableNetworkBoot_Task `xml:"urn:vim25 EnableNetworkBoot_Task,omitempty"` + Res *types.EnableNetworkBoot_TaskResponse `xml:"EnableNetworkBoot_TaskResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *EnableNetworkBoot_TaskBody) Fault() *soap.Fault { return b.Fault_ } + +func EnableNetworkBoot_Task(ctx context.Context, r soap.RoundTripper, req *types.EnableNetworkBoot_Task) (*types.EnableNetworkBoot_TaskResponse, error) { + var reqBody, resBody EnableNetworkBoot_TaskBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + type EnableNetworkResourceManagementBody struct { Req *types.EnableNetworkResourceManagement `xml:"urn:vim25 EnableNetworkResourceManagement,omitempty"` Res *types.EnableNetworkResourceManagementResponse `xml:"EnableNetworkResourceManagementResponse,omitempty"` @@ -7683,6 +7811,26 @@ func InitiateFileTransferToGuest(ctx context.Context, r soap.RoundTripper, req * return resBody.Res, nil } +type InitiateTransitionToVLCM_TaskBody struct { + Req *types.InitiateTransitionToVLCM_Task `xml:"urn:vim25 InitiateTransitionToVLCM_Task,omitempty"` + Res *types.InitiateTransitionToVLCM_TaskResponse `xml:"InitiateTransitionToVLCM_TaskResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *InitiateTransitionToVLCM_TaskBody) Fault() *soap.Fault { return b.Fault_ } + +func InitiateTransitionToVLCM_Task(ctx context.Context, r soap.RoundTripper, req *types.InitiateTransitionToVLCM_Task) (*types.InitiateTransitionToVLCM_TaskResponse, error) { + var reqBody, resBody InitiateTransitionToVLCM_TaskBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + type InstallHostPatchV2_TaskBody struct { Req *types.InstallHostPatchV2_Task `xml:"urn:vim25 InstallHostPatchV2_Task,omitempty"` Res *types.InstallHostPatchV2_TaskResponse `xml:"InstallHostPatchV2_TaskResponse,omitempty"` @@ -7823,6 +7971,26 @@ func IsClusteredVmdkEnabled(ctx context.Context, r soap.RoundTripper, req *types return resBody.Res, nil } +type IsGuestOsCustomizableBody struct { + Req *types.IsGuestOsCustomizable `xml:"urn:vim25 IsGuestOsCustomizable,omitempty"` + Res *types.IsGuestOsCustomizableResponse `xml:"IsGuestOsCustomizableResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *IsGuestOsCustomizableBody) Fault() *soap.Fault { return b.Fault_ } + +func IsGuestOsCustomizable(ctx context.Context, r soap.RoundTripper, req *types.IsGuestOsCustomizable) (*types.IsGuestOsCustomizableResponse, error) { + var reqBody, resBody IsGuestOsCustomizableBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + type IsKmsClusterActiveBody struct { Req *types.IsKmsClusterActive `xml:"urn:vim25 IsKmsClusterActive,omitempty"` Res *types.IsKmsClusterActiveResponse `xml:"IsKmsClusterActiveResponse,omitempty"` @@ -11883,6 +12051,26 @@ func ReadNextTasks(ctx context.Context, r soap.RoundTripper, req *types.ReadNext return resBody.Res, nil } +type ReadNextTasksByViewSpecBody struct { + Req *types.ReadNextTasksByViewSpec `xml:"urn:vim25 ReadNextTasksByViewSpec,omitempty"` + Res *types.ReadNextTasksByViewSpecResponse `xml:"ReadNextTasksByViewSpecResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *ReadNextTasksByViewSpecBody) Fault() *soap.Fault { return b.Fault_ } + +func ReadNextTasksByViewSpec(ctx context.Context, r soap.RoundTripper, req *types.ReadNextTasksByViewSpec) (*types.ReadNextTasksByViewSpecResponse, error) { + var reqBody, resBody ReadNextTasksByViewSpecBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + type ReadPreviousEventsBody struct { Req *types.ReadPreviousEvents `xml:"urn:vim25 ReadPreviousEvents,omitempty"` Res *types.ReadPreviousEventsResponse `xml:"ReadPreviousEventsResponse,omitempty"` @@ -12023,6 +12211,26 @@ func RecommissionVsanNode_Task(ctx context.Context, r soap.RoundTripper, req *ty return resBody.Res, nil } +type ReconcileDatastoreInventoryEx_TaskBody struct { + Req *types.ReconcileDatastoreInventoryEx_Task `xml:"urn:vim25 ReconcileDatastoreInventoryEx_Task,omitempty"` + Res *types.ReconcileDatastoreInventoryEx_TaskResponse `xml:"ReconcileDatastoreInventoryEx_TaskResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *ReconcileDatastoreInventoryEx_TaskBody) Fault() *soap.Fault { return b.Fault_ } + +func ReconcileDatastoreInventoryEx_Task(ctx context.Context, r soap.RoundTripper, req *types.ReconcileDatastoreInventoryEx_Task) (*types.ReconcileDatastoreInventoryEx_TaskResponse, error) { + var reqBody, resBody ReconcileDatastoreInventoryEx_TaskBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + type ReconcileDatastoreInventory_TaskBody struct { Req *types.ReconcileDatastoreInventory_Task `xml:"urn:vim25 ReconcileDatastoreInventory_Task,omitempty"` Res *types.ReconcileDatastoreInventory_TaskResponse `xml:"ReconcileDatastoreInventory_TaskResponse,omitempty"` @@ -13623,6 +13831,26 @@ func RemoveSmartCardTrustAnchorByFingerprint(ctx context.Context, r soap.RoundTr return resBody.Res, nil } +type RemoveSmartCardTrustAnchorCertificateBody struct { + Req *types.RemoveSmartCardTrustAnchorCertificate `xml:"urn:vim25 RemoveSmartCardTrustAnchorCertificate,omitempty"` + Res *types.RemoveSmartCardTrustAnchorCertificateResponse `xml:"RemoveSmartCardTrustAnchorCertificateResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *RemoveSmartCardTrustAnchorCertificateBody) Fault() *soap.Fault { return b.Fault_ } + +func RemoveSmartCardTrustAnchorCertificate(ctx context.Context, r soap.RoundTripper, req *types.RemoveSmartCardTrustAnchorCertificate) (*types.RemoveSmartCardTrustAnchorCertificateResponse, error) { + var reqBody, resBody RemoveSmartCardTrustAnchorCertificateBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + type RemoveSnapshot_TaskBody struct { Req *types.RemoveSnapshot_Task `xml:"urn:vim25 RemoveSnapshot_Task,omitempty"` Res *types.RemoveSnapshot_TaskResponse `xml:"RemoveSnapshot_TaskResponse,omitempty"` diff --git a/vendor/github.com/vmware/govmomi/vim25/mo/mo.go b/vendor/github.com/vmware/govmomi/vim25/mo/mo.go index 5b91ae47d..3559e8aa6 100644 --- a/vendor/github.com/vmware/govmomi/vim25/mo/mo.go +++ b/vendor/github.com/vmware/govmomi/vim25/mo/mo.go @@ -1,18 +1,6 @@ -/* -Copyright (c) 2014-2024 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. -*/ +// © Broadcom. All Rights Reserved. +// The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. +// SPDX-License-Identifier: Apache-2.0 package mo diff --git a/vendor/github.com/vmware/govmomi/vim25/mo/registry.go b/vendor/github.com/vmware/govmomi/vim25/mo/registry.go index deacf508b..ed5b5e359 100644 --- a/vendor/github.com/vmware/govmomi/vim25/mo/registry.go +++ b/vendor/github.com/vmware/govmomi/vim25/mo/registry.go @@ -1,21 +1,27 @@ -/* -Copyright (c) 2014 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. -*/ +// © Broadcom. All Rights Reserved. +// The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. +// SPDX-License-Identifier: Apache-2.0 package mo -import "reflect" +import ( + "reflect" + + "github.com/vmware/govmomi/vim25/types" +) var t = map[string]reflect.Type{} + +// TODO: 9.0 mo below, not included in the generate mo/mo.go, since the generator still uses older rbvmomi vmodl.db + +type DirectPathProfileManager struct { + Self types.ManagedObjectReference `json:"self"` +} + +func (m DirectPathProfileManager) Reference() types.ManagedObjectReference { + return m.Self +} + +func init() { + t["DirectPathProfileManager"] = reflect.TypeOf((*DirectPathProfileManager)(nil)).Elem() +} diff --git a/vendor/github.com/vmware/govmomi/vim25/mo/retrieve.go b/vendor/github.com/vmware/govmomi/vim25/mo/retrieve.go index 66a8a9782..51b4c8c3a 100644 --- a/vendor/github.com/vmware/govmomi/vim25/mo/retrieve.go +++ b/vendor/github.com/vmware/govmomi/vim25/mo/retrieve.go @@ -1,18 +1,6 @@ -/* -Copyright (c) 2014-2024 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. -*/ +// © Broadcom. All Rights Reserved. +// The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. +// SPDX-License-Identifier: Apache-2.0 package mo @@ -36,6 +24,11 @@ func ignoreMissingProperty(ref types.ManagedObjectReference, p types.MissingProp // Seen with vApp child VM return true } + case "ResourcePool": + switch p.Path { + case "resourceConfigSpecDetailed": + return true + } } return false diff --git a/vendor/github.com/vmware/govmomi/vim25/mo/type_info.go b/vendor/github.com/vmware/govmomi/vim25/mo/type_info.go index 003b56c29..3068da1c8 100644 --- a/vendor/github.com/vmware/govmomi/vim25/mo/type_info.go +++ b/vendor/github.com/vmware/govmomi/vim25/mo/type_info.go @@ -1,18 +1,6 @@ -/* -Copyright (c) 2014-2024 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. -*/ +// © Broadcom. All Rights Reserved. +// The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. +// SPDX-License-Identifier: Apache-2.0 package mo @@ -192,8 +180,10 @@ var nilValue reflect.Value func assignValue(val reflect.Value, fi []int, pv reflect.Value, field ...string) { // Indexed property path can only use base types if val.Kind() == reflect.Interface { - base := baseType(val.Type()) - val.Set(reflect.New(base)) + if val.IsNil() { + base := baseType(val.Type()) + val.Set(reflect.New(base)) + } val = val.Elem() } @@ -337,6 +327,18 @@ func IsManagedObjectType(kind string) bool { return ok } +// Value returns a new mo instance of the given ref Type. +func Value(ref types.ManagedObjectReference) (Reference, bool) { + if rt, ok := t[ref.Type]; ok { + val := reflect.New(rt) + if e, ok := val.Interface().(Entity); ok { + e.Entity().Self = ref + return val.Elem().Interface().(Reference), true + } + } + return nil, false +} + // Field of a ManagedObject in string form. type Field struct { Path string diff --git a/vendor/github.com/vmware/govmomi/vim25/soap/client.go b/vendor/github.com/vmware/govmomi/vim25/soap/client.go index d6c810818..b7ff99f5a 100644 --- a/vendor/github.com/vmware/govmomi/vim25/soap/client.go +++ b/vendor/github.com/vmware/govmomi/vim25/soap/client.go @@ -1,5 +1,5 @@ /* -Copyright (c) 2014-2023 VMware, Inc. All Rights Reserved. +Copyright (c) 2014-2024 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. @@ -86,7 +86,11 @@ type Client struct { Types types.Func `json:"types"` UserAgent string `json:"userAgent"` - cookie string + // Cookie returns a value for the SOAP Header.Cookie. + // This SOAP request header is used for authentication by + // API endpoints such as pbm, vslm and sms. + // When nil, no SOAP Header.Cookie is set. + Cookie func() *HeaderElement insecureCookies bool useJSON bool @@ -135,20 +139,31 @@ func ParseURL(s string) (*url.URL, error) { return u, nil } +// Go's ForceAttemptHTTP2 default is true, we disable by default. +// This undocumented env var can be used to enable. +var http2 = os.Getenv("GOVMOMI_HTTP2") == "true" + func NewClient(u *url.URL, insecure bool) *Client { var t *http.Transport if d, ok := http.DefaultTransport.(*http.Transport); ok { - t = d.Clone() + // Inherit the same defaults explicitly set in http.DefaultTransport, + // unless otherwise noted. + t = &http.Transport{ + Proxy: d.Proxy, + DialContext: d.DialContext, + ForceAttemptHTTP2: http2, // false by default in govmomi + MaxIdleConns: d.MaxIdleConns, + IdleConnTimeout: d.IdleConnTimeout, + TLSHandshakeTimeout: d.TLSHandshakeTimeout, + ExpectContinueTimeout: d.ExpectContinueTimeout, + } } else { t = new(http.Transport) } - if insecure { - if t.TLSClientConfig == nil { - t.TLSClientConfig = new(tls.Config) - } - t.TLSClientConfig.InsecureSkipVerify = insecure + t.TLSClientConfig = &tls.Config{ + InsecureSkipVerify: insecure, } c := newClientWithTransport(u, insecure, t) @@ -199,6 +214,31 @@ func (c *Client) NewServiceClient(path string, namespace string) *Client { return c.newServiceClientWithTransport(path, namespace, c.t) } +func sessionCookie(jar http.CookieJar, u *url.URL) *HeaderElement { + for _, cookie := range jar.Cookies(u) { + if cookie.Name == SessionCookieName { + return &HeaderElement{Value: cookie.Value} + } + } + return nil +} + +// SessionCookie returns a SessionCookie with value of the vmware_soap_session http.Cookie. +func (c *Client) SessionCookie() *HeaderElement { + u := c.URL() + + if cookie := sessionCookie(c.Jar, u); cookie != nil { + return cookie + } + + // Default "/sdk" Path would match above, + // but saw a case of Path == "sdk", where above returns nil. + // The jar entry Path is normally "/", so fallback to that. + u.Path = "/" + + return sessionCookie(c.Jar, u) +} + func (c *Client) newServiceClientWithTransport(path string, namespace string, t *http.Transport) *Client { vc := c.URL() u, err := url.Parse(path) @@ -223,14 +263,6 @@ func (c *Client) newServiceClientWithTransport(path string, namespace string, t // 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 == SessionCookieName { - client.cookie = cookie.Value - break - } - } - // Copy any query params (e.g. GOVMOMI_TUNNEL_PROXY_PORT used in testing) client.u.RawQuery = vc.RawQuery @@ -707,8 +739,10 @@ func (c *Client) soapRoundTrip(ctx context.Context, reqBody, resBody HasFault) e h.ID = id } - h.Cookie = c.cookie - if h.Cookie != "" || h.ID != "" || h.Security != nil { + if c.Cookie != nil { + h.Cookie = c.Cookie() + } + if h.Cookie != nil || h.ID != "" || h.Security != nil { reqEnv.Header = &h // XML marshal header only if a field is set } diff --git a/vendor/github.com/vmware/govmomi/vim25/soap/error.go b/vendor/github.com/vmware/govmomi/vim25/soap/error.go index fd30e3ff8..b82e508b0 100644 --- a/vendor/github.com/vmware/govmomi/vim25/soap/error.go +++ b/vendor/github.com/vmware/govmomi/vim25/soap/error.go @@ -1,11 +1,11 @@ /* -Copyright (c) 2014 VMware, Inc. All Rights Reserved. +Copyright (c) 2014-2024 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 +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, @@ -27,14 +27,6 @@ import ( "github.com/vmware/govmomi/vim25/types" ) -type regularError struct { - err error -} - -func (r regularError) Error() string { - return r.err.Error() -} - type soapFaultError struct { fault *Fault } @@ -62,6 +54,26 @@ func (s soapFaultError) MarshalJSON() ([]byte, error) { return json.Marshal(out) } +func (s soapFaultError) Fault() types.BaseMethodFault { + if s.fault != nil { + fault := s.fault.Detail.Fault + if fault == nil { + return nil + } + if f, ok := fault.(types.BaseMethodFault); ok { + return f + } + if val := reflect.ValueOf(fault); val.Kind() != reflect.Pointer { + ptrVal := reflect.New(val.Type()) + ptrVal.Elem().Set(val) + if f, ok := ptrVal.Interface().(types.BaseMethodFault); ok { + return f + } + } + } + return nil +} + type vimFaultError struct { fault types.BaseMethodFault } @@ -79,32 +91,6 @@ func (v vimFaultError) Fault() types.BaseMethodFault { return v.fault } -func Wrap(err error) error { - switch err.(type) { - case regularError: - return err - case soapFaultError: - return err - case vimFaultError: - return err - } - - return WrapRegularError(err) -} - -func WrapRegularError(err error) error { - return regularError{err} -} - -func IsRegularError(err error) bool { - _, ok := err.(regularError) - return ok -} - -func ToRegularError(err error) error { - return err.(regularError).err -} - func WrapSoapFault(f *Fault) error { return soapFaultError{f} } @@ -135,15 +121,11 @@ func IsCertificateUntrusted(err error) bool { // golang 1.20 introduce a new type to wrap 509 errors. So instead of // casting the type, now we check the error chain contains the // x509 error or not. - x509UnknownAuthorityErr := &x509.UnknownAuthorityError{} - ok := errors.As(err, x509UnknownAuthorityErr) - if ok { + if errors.As(err, &x509.UnknownAuthorityError{}) { return true } - x509HostNameErr := &x509.HostnameError{} - ok = errors.As(err, x509HostNameErr) - if ok { + if errors.As(err, &x509.HostnameError{}) { return true } diff --git a/vendor/github.com/vmware/govmomi/vim25/soap/json_client.go b/vendor/github.com/vmware/govmomi/vim25/soap/json_client.go index ca5075de3..b5d25b596 100644 --- a/vendor/github.com/vmware/govmomi/vim25/soap/json_client.go +++ b/vendor/github.com/vmware/govmomi/vim25/soap/json_client.go @@ -1,5 +1,5 @@ /* -Copyright (c) 2023-2023 VMware, Inc. All Rights Reserved. +Copyright (c) 2023-2024 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. @@ -71,8 +71,10 @@ func (c *Client) invoke(ctx context.Context, this types.ManagedObjectReference, return err } - if len(c.cookie) != 0 { - req.Header.Add(sessionHeader, c.cookie) + if c.Cookie != nil { + if cookie := c.Cookie(); cookie != nil { + req.Header.Add(sessionHeader, cookie.Value) + } } result, err := getSOAPResultPtr(res) @@ -156,8 +158,10 @@ func isError(statusCode int) bool { // session header. func (c *Client) checkForSessionHeader(resp *http.Response) { sessionKey := resp.Header.Get(sessionHeader) - if len(sessionKey) > 0 { - c.cookie = sessionKey + if sessionKey != "" { + c.Cookie = func() *HeaderElement { + return &HeaderElement{Value: sessionKey} + } } } diff --git a/vendor/github.com/vmware/govmomi/vim25/soap/soap.go b/vendor/github.com/vmware/govmomi/vim25/soap/soap.go index a8dc121ba..d7703ae8f 100644 --- a/vendor/github.com/vmware/govmomi/vim25/soap/soap.go +++ b/vendor/github.com/vmware/govmomi/vim25/soap/soap.go @@ -1,11 +1,11 @@ /* -Copyright (c) 2014-2018 VMware, Inc. All Rights Reserved. +Copyright (c) 2014-2024 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 +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, @@ -21,12 +21,18 @@ import ( "github.com/vmware/govmomi/vim25/xml" ) +// HeaderElement allows changing the default XMLName (e.g. Cookie's default of vcSessionCookie) +type HeaderElement struct { + XMLName xml.Name + Value string `xml:",chardata"` +} + // Header includes optional soap Header fields. type Header struct { - Action string `xml:"-"` // Action is the 'SOAPAction' HTTP header value. Defaults to "Client.Namespace/Client.Version". - Cookie string `xml:"vcSessionCookie,omitempty"` // Cookie is a vCenter session cookie that can be used with other SDK endpoints (e.g. pbm). - ID string `xml:"operationID,omitempty"` // ID is the operationID used by ESX/vCenter logging for correlation. - Security interface{} `xml:",omitempty"` // Security is used for SAML token authentication and request signing. + Action string `xml:"-"` // Action is the 'SOAPAction' HTTP header value. Defaults to "Client.Namespace/Client.Version". + Cookie *HeaderElement `xml:"vcSessionCookie,omitempty"` // Cookie is a vCenter session cookie that can be used with other SDK endpoints (e.g. pbm, vslm). + ID string `xml:"operationID,omitempty"` // ID is the operationID used by ESX/vCenter logging for correlation. + Security interface{} `xml:",omitempty"` // Security is used for SAML token authentication and request signing. } type Envelope struct { diff --git a/vendor/github.com/vmware/govmomi/vim25/types/byte_slice.go b/vendor/github.com/vmware/govmomi/vim25/types/byte_slice.go index a19a0bb23..af164400b 100644 --- a/vendor/github.com/vmware/govmomi/vim25/types/byte_slice.go +++ b/vendor/github.com/vmware/govmomi/vim25/types/byte_slice.go @@ -36,7 +36,8 @@ func (b ByteSlice) MarshalXML(e *xml.Encoder, field xml.StartElement) error { Name: field.Name, } for i := range b { - if err := e.EncodeElement(b[i], start); err != nil { + // Using int8() here to output a signed byte (issue #3615) + if err := e.EncodeElement(int8(b[i]), start); err != nil { return err } } diff --git a/vendor/github.com/vmware/govmomi/vim25/types/deep_copy.go b/vendor/github.com/vmware/govmomi/vim25/types/deep_copy.go new file mode 100644 index 000000000..ca5d99ab7 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/vim25/types/deep_copy.go @@ -0,0 +1,65 @@ +/* +Copyright (c) 2024-2024 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 ( + "bytes" +) + +// DeepCopyInto creates a deep-copy of src by encoding it to JSON and then +// decoding that into dst. +// Please note, empty slices or maps in src that are set to omitempty will be +// nil in the copied object. +func DeepCopyInto[T AnyType](dst *T, src T) error { + var w bytes.Buffer + e := NewJSONEncoder(&w) + if err := e.Encode(src); err != nil { + return err + } + d := NewJSONDecoder(&w) + if err := d.Decode(dst); err != nil { + return err + } + return nil +} + +// MustDeepCopyInto panics if DeepCopyInto returns an error. +func MustDeepCopyInto[T AnyType](dst *T, src T) error { + if err := DeepCopyInto(dst, src); err != nil { + panic(err) + } + return nil +} + +// DeepCopy creates a deep-copy of src by encoding it to JSON and then decoding +// that into a new instance of T. +// Please note, empty slices or maps in src that are set to omitempty will be +// nil in the copied object. +func DeepCopy[T AnyType](src T) (T, error) { + var dst T + err := DeepCopyInto(&dst, src) + return dst, err +} + +// MustDeepCopy panics if DeepCopy returns an error. +func MustDeepCopy[T AnyType](src T) T { + dst, err := DeepCopy(src) + if err != nil { + panic(err) + } + return dst +} diff --git a/vendor/github.com/vmware/govmomi/vim25/types/enum.go b/vendor/github.com/vmware/govmomi/vim25/types/enum.go index ea07f156b..e5cd57990 100644 --- a/vendor/github.com/vmware/govmomi/vim25/types/enum.go +++ b/vendor/github.com/vmware/govmomi/vim25/types/enum.go @@ -1,18 +1,6 @@ -/* -Copyright (c) 2014-2024 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. -*/ +// © Broadcom. All Rights Reserved. +// The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. +// SPDX-License-Identifier: Apache-2.0 package types @@ -588,6 +576,8 @@ const ( CannotUseNetworkReasonNetworkUnderMaintenance = CannotUseNetworkReason("NetworkUnderMaintenance") // Source and destination networks do not have same ENS(Enhanced Network Stack) mode CannotUseNetworkReasonMismatchedEnsMode = CannotUseNetworkReason("MismatchedEnsMode") + // Source and destination networks do not have the same real-time flag + CannotUseNetworkReasonMismatchedRealTimeDvs = CannotUseNetworkReason("MismatchedRealTimeDvs") ) func (e CannotUseNetworkReason) Values() []CannotUseNetworkReason { @@ -598,6 +588,7 @@ func (e CannotUseNetworkReason) Values() []CannotUseNetworkReason { CannotUseNetworkReasonVMotionToUnsupportedNetworkType, CannotUseNetworkReasonNetworkUnderMaintenance, CannotUseNetworkReasonMismatchedEnsMode, + CannotUseNetworkReasonMismatchedRealTimeDvs, } } @@ -607,6 +598,9 @@ func (e CannotUseNetworkReason) Strings() []string { func init() { t["CannotUseNetworkReason"] = reflect.TypeOf((*CannotUseNetworkReason)(nil)).Elem() + minAPIVersionForEnumValue["CannotUseNetworkReason"] = map[string]string{ + "MismatchedRealTimeDvs": "8.0.3.1", + } } // The types of tests which can requested by any of the methods in either @@ -1578,6 +1572,29 @@ func init() { t["ComputeResourceHostSPBMLicenseInfoHostSPBMLicenseState"] = reflect.TypeOf((*ComputeResourceHostSPBMLicenseInfoHostSPBMLicenseState)(nil)).Elem() } +type ComputeResourceNetworkBootMode string + +const ( + ComputeResourceNetworkBootModeBootstrap = ComputeResourceNetworkBootMode("bootstrap") + ComputeResourceNetworkBootModeStateless = ComputeResourceNetworkBootMode("stateless") +) + +func (e ComputeResourceNetworkBootMode) Values() []ComputeResourceNetworkBootMode { + return []ComputeResourceNetworkBootMode{ + ComputeResourceNetworkBootModeBootstrap, + ComputeResourceNetworkBootModeStateless, + } +} + +func (e ComputeResourceNetworkBootMode) Strings() []string { + return EnumValuesAsStrings(e.Values()) +} + +func init() { + t["ComputeResourceNetworkBootMode"] = reflect.TypeOf((*ComputeResourceNetworkBootMode)(nil)).Elem() + minAPIVersionForType["ComputeResourceNetworkBootMode"] = "9.0.0.0" +} + // Config spec operation type. type ConfigSpecOperation string @@ -1650,6 +1667,10 @@ const ( CryptoManagerKmipCryptoKeyStatusKeyUnavailableReasonKeyStateManagedByNKP = CryptoManagerKmipCryptoKeyStatusKeyUnavailableReason("KeyStateManagedByNKP") // No permission to access key provider CryptoManagerKmipCryptoKeyStatusKeyUnavailableReasonNoPermissionToAccessKeyProvider = CryptoManagerKmipCryptoKeyStatusKeyUnavailableReason("NoPermissionToAccessKeyProvider") + // Wrapping Key not found in KMS + CryptoManagerKmipCryptoKeyStatusKeyUnavailableReasonWrappingKeyMissingInKMS = CryptoManagerKmipCryptoKeyStatusKeyUnavailableReason("WrappingKeyMissingInKMS") + // Wrapping Key not active or enabled + CryptoManagerKmipCryptoKeyStatusKeyUnavailableReasonWrappingKeyNotActiveOrEnabled = CryptoManagerKmipCryptoKeyStatusKeyUnavailableReason("WrappingKeyNotActiveOrEnabled") ) func (e CryptoManagerKmipCryptoKeyStatusKeyUnavailableReason) Values() []CryptoManagerKmipCryptoKeyStatusKeyUnavailableReason { @@ -1662,6 +1683,8 @@ func (e CryptoManagerKmipCryptoKeyStatusKeyUnavailableReason) Values() []CryptoM CryptoManagerKmipCryptoKeyStatusKeyUnavailableReasonKeyStateManagedByTrustAuthority, CryptoManagerKmipCryptoKeyStatusKeyUnavailableReasonKeyStateManagedByNKP, CryptoManagerKmipCryptoKeyStatusKeyUnavailableReasonNoPermissionToAccessKeyProvider, + CryptoManagerKmipCryptoKeyStatusKeyUnavailableReasonWrappingKeyMissingInKMS, + CryptoManagerKmipCryptoKeyStatusKeyUnavailableReasonWrappingKeyNotActiveOrEnabled, } } @@ -1674,6 +1697,8 @@ func init() { minAPIVersionForEnumValue["CryptoManagerKmipCryptoKeyStatusKeyUnavailableReason"] = map[string]string{ "KeyStateManagedByNKP": "8.0.3.0", "NoPermissionToAccessKeyProvider": "8.0.3.0", + "WrappingKeyMissingInKMS": "9.0.0.0", + "WrappingKeyNotActiveOrEnabled": "9.0.0.0", } } @@ -2075,6 +2100,35 @@ func init() { t["DatastoreAccessible"] = reflect.TypeOf((*DatastoreAccessible)(nil)).Elem() } +// The type of the sector size, such as, datastore and virtual disk, +type DatastoreSectorFormat string + +const ( + // 512 native sector size disk. + DatastoreSectorFormatNative_512 = DatastoreSectorFormat("native_512") + // 4K sector size disk in 512 emulation mode. + DatastoreSectorFormatEmulated_512 = DatastoreSectorFormat("emulated_512") + // 4K native sector size disk. + DatastoreSectorFormatNative_4k = DatastoreSectorFormat("native_4k") +) + +func (e DatastoreSectorFormat) Values() []DatastoreSectorFormat { + return []DatastoreSectorFormat{ + DatastoreSectorFormatNative_512, + DatastoreSectorFormatEmulated_512, + DatastoreSectorFormatNative_4k, + } +} + +func (e DatastoreSectorFormat) Strings() []string { + return EnumValuesAsStrings(e.Values()) +} + +func init() { + t["DatastoreSectorFormat"] = reflect.TypeOf((*DatastoreSectorFormat)(nil)).Elem() + minAPIVersionForType["DatastoreSectorFormat"] = "9.0.0.0" +} + // Defines the current maintenance mode state of the datastore. type DatastoreSummaryMaintenanceModeState string @@ -2471,6 +2525,8 @@ const ( DistributedVirtualSwitchHostInfrastructureTrafficClassBackupNfc = DistributedVirtualSwitchHostInfrastructureTrafficClass("backupNfc") // vSphere NVMETCP Traffic DistributedVirtualSwitchHostInfrastructureTrafficClassNvmetcp = DistributedVirtualSwitchHostInfrastructureTrafficClass("nvmetcp") + // vSphere Provisioning Traffic + DistributedVirtualSwitchHostInfrastructureTrafficClassProvisioning = DistributedVirtualSwitchHostInfrastructureTrafficClass("provisioning") ) func (e DistributedVirtualSwitchHostInfrastructureTrafficClass) Values() []DistributedVirtualSwitchHostInfrastructureTrafficClass { @@ -2486,6 +2542,7 @@ func (e DistributedVirtualSwitchHostInfrastructureTrafficClass) Values() []Distr DistributedVirtualSwitchHostInfrastructureTrafficClassVdp, DistributedVirtualSwitchHostInfrastructureTrafficClassBackupNfc, DistributedVirtualSwitchHostInfrastructureTrafficClassNvmetcp, + DistributedVirtualSwitchHostInfrastructureTrafficClassProvisioning, } } @@ -2496,8 +2553,9 @@ func (e DistributedVirtualSwitchHostInfrastructureTrafficClass) Strings() []stri func init() { t["DistributedVirtualSwitchHostInfrastructureTrafficClass"] = reflect.TypeOf((*DistributedVirtualSwitchHostInfrastructureTrafficClass)(nil)).Elem() minAPIVersionForEnumValue["DistributedVirtualSwitchHostInfrastructureTrafficClass"] = map[string]string{ - "backupNfc": "7.0.1.0", - "nvmetcp": "7.0.3.0", + "backupNfc": "7.0.1.0", + "nvmetcp": "7.0.3.0", + "provisioning": "9.0.0.0", } } @@ -3288,6 +3346,89 @@ func init() { t["FolderDesiredHostState"] = reflect.TypeOf((*FolderDesiredHostState)(nil)).Elem() } +// Supported types of externally managed folder. +// +// NSX Virtual Private Clouds(VPCs) is an abstraction layer that simplifies +// setting up self-contained virtual private cloud networks within an NSX +// project to consume networking and security services in a self-service +// consumption model. It contains multiple subnets which represents an +// independent layer 2 broadcast domain. +// vCenter users can manage (create, update, delete) VPC and subnet under +// `VPC_ROOT` folder. Requests are forwarded to NSX, and the VPCs +// and subnets in NSX are realized as `VPC` and `SUBNET` folder +// in vCenter. +// A project in NSX is analogous to a tenant. NSX user can create VPC, segment, +// and subnet within a project. These objects are represented as +// `PROJECT`, `VPC`, `SEGMENT`, and `SUBNET` folder +type FolderExternallyManagedFolderType string + +const ( + // The root folder of `PROJECT` folders. + // + // It is a child of the network folder of a data center and + // may contain multiple `PROJECT` folders. + FolderExternallyManagedFolderTypePROJECT_ROOT = FolderExternallyManagedFolderType("PROJECT_ROOT") + // The folder representing a project in NSX. + // + // It is a child of the `PROJECT_ROOT` folder. + // A project folder can contain multiple `VPC`, + // and `SEGMENT` folders. + FolderExternallyManagedFolderTypePROJECT = FolderExternallyManagedFolderType("PROJECT") + // The folder containing VPC and subnet that can be managed by vCenter. + // + // It is a child of the network folder of a data center. + // It may contain multiple `VPC` folders. + FolderExternallyManagedFolderTypeVPC_ROOT = FolderExternallyManagedFolderType("VPC_ROOT") + // The folder representing a VPC in NSX. + // + // It is a child of the `VPC_ROOT` folder or the `PROJECT` + // folder. + // It may contain multiple `SUBNET` folders. + FolderExternallyManagedFolderTypeVPC = FolderExternallyManagedFolderType("VPC") + // The folder representing a subnet in NSX. + // + // It is a child of the `VPC` folder. + FolderExternallyManagedFolderTypeSUBNET = FolderExternallyManagedFolderType("SUBNET") + // The folder representing a segment in NSX. + // + // It is a child of the `PROJECT` folder. + FolderExternallyManagedFolderTypeSEGMENT = FolderExternallyManagedFolderType("SEGMENT") + // The folder representing a vSphere IaaS Control Plane Supervisor. + // + // It is a VM\_TYPE folder and child of vSphere Namespaces Root folder. + // It may contain multiple namespace associated folder, i.e., folder with + // `Folder.namespace` property set and vSphere IaaS Control Plane + // Virtual Machines. + FolderExternallyManagedFolderTypeSUPERVISOR = FolderExternallyManagedFolderType("SUPERVISOR") + // The folder containing vSphere Pods. + // + // It is a child of namespace associated folder, i.e., folder with + // `Folder.namespace` property set and may contain vSphere Pods. + FolderExternallyManagedFolderTypeVSPHERE_POD = FolderExternallyManagedFolderType("VSPHERE_POD") +) + +func (e FolderExternallyManagedFolderType) Values() []FolderExternallyManagedFolderType { + return []FolderExternallyManagedFolderType{ + FolderExternallyManagedFolderTypePROJECT_ROOT, + FolderExternallyManagedFolderTypePROJECT, + FolderExternallyManagedFolderTypeVPC_ROOT, + FolderExternallyManagedFolderTypeVPC, + FolderExternallyManagedFolderTypeSUBNET, + FolderExternallyManagedFolderTypeSEGMENT, + FolderExternallyManagedFolderTypeSUPERVISOR, + FolderExternallyManagedFolderTypeVSPHERE_POD, + } +} + +func (e FolderExternallyManagedFolderType) Strings() []string { + return EnumValuesAsStrings(e.Values()) +} + +func init() { + t["FolderExternallyManagedFolderType"] = reflect.TypeOf((*FolderExternallyManagedFolderType)(nil)).Elem() + minAPIVersionForType["FolderExternallyManagedFolderType"] = "9.0.0.0" +} + // HostSelectionType defines how the host was selected type FtIssuesOnHostHostSelectionType string @@ -3980,6 +4121,31 @@ func init() { t["HostConfigChangeOperation"] = reflect.TypeOf((*HostConfigChangeOperation)(nil)).Elem() } +type HostConfigChangeOwner string + +const ( + // The owner is NSX (Network Virtualization and Security). + HostConfigChangeOwnerNSX = HostConfigChangeOwner("NSX") + // The owner is vSAN (VMware Virtual Storage Area Network). + HostConfigChangeOwnerVSAN = HostConfigChangeOwner("VSAN") +) + +func (e HostConfigChangeOwner) Values() []HostConfigChangeOwner { + return []HostConfigChangeOwner{ + HostConfigChangeOwnerNSX, + HostConfigChangeOwnerVSAN, + } +} + +func (e HostConfigChangeOwner) Strings() []string { + return EnumValuesAsStrings(e.Values()) +} + +func init() { + t["HostConfigChangeOwner"] = reflect.TypeOf((*HostConfigChangeOwner)(nil)).Elem() + minAPIVersionForType["HostConfigChangeOwner"] = "9.0.0.0" +} + type HostCpuPackageVendor string const ( @@ -5654,6 +5820,13 @@ const ( // This // ensures the integrity of the NFS file data. HostNasVolumeSecurityTypeSEC_KRB5I = HostNasVolumeSecurityType("SEC_KRB5I") + // Extends `SEC_KRB5I` to send and receive encrypted NFS packets over + // the wire. + // + // `SEC_KRB5P` provides data privacy in addition to data + // integrity for NFS files. To date, SEC\_KRB5P provides the highest form of + // security for NFS payload. + HostNasVolumeSecurityTypeSEC_KRB5P = HostNasVolumeSecurityType("SEC_KRB5P") ) func (e HostNasVolumeSecurityType) Values() []HostNasVolumeSecurityType { @@ -5661,6 +5834,7 @@ func (e HostNasVolumeSecurityType) Values() []HostNasVolumeSecurityType { HostNasVolumeSecurityTypeAUTH_SYS, HostNasVolumeSecurityTypeSEC_KRB5, HostNasVolumeSecurityTypeSEC_KRB5I, + HostNasVolumeSecurityTypeSEC_KRB5P, } } @@ -5670,6 +5844,9 @@ func (e HostNasVolumeSecurityType) Strings() []string { func init() { t["HostNasVolumeSecurityType"] = reflect.TypeOf((*HostNasVolumeSecurityType)(nil)).Elem() + minAPIVersionForEnumValue["HostNasVolumeSecurityType"] = map[string]string{ + "SEC_KRB5P": "9.0.0.0", + } } // Define TCP congestion control algorithm used by an instance @@ -7111,6 +7288,33 @@ func init() { t["HostSystemRemediationStateState"] = reflect.TypeOf((*HostSystemRemediationStateState)(nil)).Elem() } +type HostTdxInfoTdxState string + +const ( + HostTdxInfoTdxStateInitializing = HostTdxInfoTdxState("initializing") + HostTdxInfoTdxStateInitialized = HostTdxInfoTdxState("initialized") + HostTdxInfoTdxStateConfigured = HostTdxInfoTdxState("configured") + HostTdxInfoTdxStateReady = HostTdxInfoTdxState("ready") +) + +func (e HostTdxInfoTdxState) Values() []HostTdxInfoTdxState { + return []HostTdxInfoTdxState{ + HostTdxInfoTdxStateInitializing, + HostTdxInfoTdxStateInitialized, + HostTdxInfoTdxStateConfigured, + HostTdxInfoTdxStateReady, + } +} + +func (e HostTdxInfoTdxState) Strings() []string { + return EnumValuesAsStrings(e.Values()) +} + +func init() { + t["HostTdxInfoTdxState"] = reflect.TypeOf((*HostTdxInfoTdxState)(nil)).Elem() + minAPIVersionForType["HostTdxInfoTdxState"] = "9.0.0.0" +} + // Status constants of TPM attestation. type HostTpmAttestationInfoAcceptanceStatus string @@ -7280,6 +7484,8 @@ const ( HostVirtualNicManagerNicTypeNvmeTcp = HostVirtualNicManagerNicType("nvmeTcp") // The VirtualNic is used for NVMe over RDMA traffic. HostVirtualNicManagerNicTypeNvmeRdma = HostVirtualNicManagerNicType("nvmeRdma") + // The VirtualNic is used for external vSAN traffic. + HostVirtualNicManagerNicTypeVsanExternal = HostVirtualNicManagerNicType("vsanExternal") ) func (e HostVirtualNicManagerNicType) Values() []HostVirtualNicManagerNicType { @@ -7296,6 +7502,7 @@ func (e HostVirtualNicManagerNicType) Values() []HostVirtualNicManagerNicType { HostVirtualNicManagerNicTypePtp, HostVirtualNicManagerNicTypeNvmeTcp, HostVirtualNicManagerNicTypeNvmeRdma, + HostVirtualNicManagerNicTypeVsanExternal, } } @@ -7306,8 +7513,9 @@ func (e HostVirtualNicManagerNicType) Strings() []string { func init() { t["HostVirtualNicManagerNicType"] = reflect.TypeOf((*HostVirtualNicManagerNicType)(nil)).Elem() minAPIVersionForEnumValue["HostVirtualNicManagerNicType"] = map[string]string{ - "nvmeTcp": "7.0.3.0", - "nvmeRdma": "7.0.3.0", + "nvmeTcp": "7.0.3.0", + "nvmeRdma": "7.0.3.0", + "vsanExternal": "9.0.0.0", } } @@ -7689,6 +7897,36 @@ func init() { t["IscsiPortInfoPathStatus"] = reflect.TypeOf((*IscsiPortInfoPathStatus)(nil)).Elem() } +type KmipClusterInfoKeyType string + +const ( + // Key is fetched directly from KMS. + KmipClusterInfoKeyTypeRawKey = KmipClusterInfoKeyType("rawKey") + // Key is wrapped by a wrapping key from KMS. + // + // The wrapping key details are specified in + // `KmipClusterInfoWrappingKeyIdKeyInfo` + // or + // `KmipClusterInfoWrappingRotationIntervalKeyInfo`. + KmipClusterInfoKeyTypeWrappedKey = KmipClusterInfoKeyType("wrappedKey") +) + +func (e KmipClusterInfoKeyType) Values() []KmipClusterInfoKeyType { + return []KmipClusterInfoKeyType{ + KmipClusterInfoKeyTypeRawKey, + KmipClusterInfoKeyTypeWrappedKey, + } +} + +func (e KmipClusterInfoKeyType) Strings() []string { + return EnumValuesAsStrings(e.Values()) +} + +func init() { + t["KmipClusterInfoKeyType"] = reflect.TypeOf((*KmipClusterInfoKeyType)(nil)).Elem() + minAPIVersionForType["KmipClusterInfoKeyType"] = "9.0.0.0" +} + // Key provider management type. type KmipClusterInfoKmsManagementType string @@ -8180,6 +8418,302 @@ func init() { t["ManagedEntityStatus"] = reflect.TypeOf((*ManagedEntityStatus)(nil)).Elem() } +type ManagedObjectTypes string + +const ( + ManagedObjectTypesPropertyCollector = ManagedObjectTypes("PropertyCollector") + ManagedObjectTypesPropertyFilter = ManagedObjectTypes("PropertyFilter") + ManagedObjectTypesAuthorizationManager = ManagedObjectTypes("AuthorizationManager") + ManagedObjectTypesCertificateManager = ManagedObjectTypes("CertificateManager") + ManagedObjectTypesClusterComputeResource = ManagedObjectTypes("ClusterComputeResource") + ManagedObjectTypesComputeResource = ManagedObjectTypes("ComputeResource") + ManagedObjectTypesCustomFieldsManager = ManagedObjectTypes("CustomFieldsManager") + ManagedObjectTypesCustomizationSpecManager = ManagedObjectTypes("CustomizationSpecManager") + ManagedObjectTypesDatacenter = ManagedObjectTypes("Datacenter") + ManagedObjectTypesDatastore = ManagedObjectTypes("Datastore") + ManagedObjectTypesDatastoreNamespaceManager = ManagedObjectTypes("DatastoreNamespaceManager") + ManagedObjectTypesDiagnosticManager = ManagedObjectTypes("DiagnosticManager") + ManagedObjectTypesDirectPathProfileManager = ManagedObjectTypes("DirectPathProfileManager") + ManagedObjectTypesDistributedVirtualSwitch = ManagedObjectTypes("DistributedVirtualSwitch") + ManagedObjectTypesEnvironmentBrowser = ManagedObjectTypes("EnvironmentBrowser") + ManagedObjectTypesExtensibleManagedObject = ManagedObjectTypes("ExtensibleManagedObject") + ManagedObjectTypesExtensionManager = ManagedObjectTypes("ExtensionManager") + ManagedObjectTypesFileManager = ManagedObjectTypes("FileManager") + ManagedObjectTypesFolder = ManagedObjectTypes("Folder") + ManagedObjectTypesHealthUpdateManager = ManagedObjectTypes("HealthUpdateManager") + ManagedObjectTypesHistoryCollector = ManagedObjectTypes("HistoryCollector") + ManagedObjectTypesHostSystem = ManagedObjectTypes("HostSystem") + ManagedObjectTypesHttpNfcLease = ManagedObjectTypes("HttpNfcLease") + ManagedObjectTypesIoFilterManager = ManagedObjectTypes("IoFilterManager") + ManagedObjectTypesIpPoolManager = ManagedObjectTypes("IpPoolManager") + ManagedObjectTypesLicenseAssignmentManager = ManagedObjectTypes("LicenseAssignmentManager") + ManagedObjectTypesLicenseManager = ManagedObjectTypes("LicenseManager") + ManagedObjectTypesLocalizationManager = ManagedObjectTypes("LocalizationManager") + ManagedObjectTypesManagedEntity = ManagedObjectTypes("ManagedEntity") + ManagedObjectTypesNetwork = ManagedObjectTypes("Network") + ManagedObjectTypesOpaqueNetwork = ManagedObjectTypes("OpaqueNetwork") + ManagedObjectTypesOverheadMemoryManager = ManagedObjectTypes("OverheadMemoryManager") + ManagedObjectTypesOvfManager = ManagedObjectTypes("OvfManager") + ManagedObjectTypesPerformanceManager = ManagedObjectTypes("PerformanceManager") + ManagedObjectTypesResourcePlanningManager = ManagedObjectTypes("ResourcePlanningManager") + ManagedObjectTypesResourcePool = ManagedObjectTypes("ResourcePool") + ManagedObjectTypesSearchIndex = ManagedObjectTypes("SearchIndex") + ManagedObjectTypesServiceInstance = ManagedObjectTypes("ServiceInstance") + ManagedObjectTypesServiceManager = ManagedObjectTypes("ServiceManager") + ManagedObjectTypesSessionManager = ManagedObjectTypes("SessionManager") + ManagedObjectTypesSimpleCommand = ManagedObjectTypes("SimpleCommand") + ManagedObjectTypesSiteInfoManager = ManagedObjectTypes("SiteInfoManager") + ManagedObjectTypesStoragePod = ManagedObjectTypes("StoragePod") + ManagedObjectTypesStorageQueryManager = ManagedObjectTypes("StorageQueryManager") + ManagedObjectTypesStorageResourceManager = ManagedObjectTypes("StorageResourceManager") + ManagedObjectTypesTask = ManagedObjectTypes("Task") + ManagedObjectTypesTaskHistoryCollector = ManagedObjectTypes("TaskHistoryCollector") + ManagedObjectTypesTaskManager = ManagedObjectTypes("TaskManager") + ManagedObjectTypesUserDirectory = ManagedObjectTypes("UserDirectory") + ManagedObjectTypesVirtualApp = ManagedObjectTypes("VirtualApp") + ManagedObjectTypesVirtualDiskManager = ManagedObjectTypes("VirtualDiskManager") + ManagedObjectTypesVirtualMachine = ManagedObjectTypes("VirtualMachine") + ManagedObjectTypesVirtualizationManager = ManagedObjectTypes("VirtualizationManager") + ManagedObjectTypesVsanUpgradeSystem = ManagedObjectTypes("VsanUpgradeSystem") + ManagedObjectTypesAlarm = ManagedObjectTypes("Alarm") + ManagedObjectTypesAlarmManager = ManagedObjectTypes("AlarmManager") + ManagedObjectTypesClusterEVCManager = ManagedObjectTypes("ClusterEVCManager") + ManagedObjectTypesDistributedVirtualPortgroup = ManagedObjectTypes("DistributedVirtualPortgroup") + ManagedObjectTypesDistributedVirtualSwitchManager = ManagedObjectTypes("DistributedVirtualSwitchManager") + ManagedObjectTypesVmwareDistributedVirtualSwitch = ManagedObjectTypes("VmwareDistributedVirtualSwitch") + ManagedObjectTypesCryptoManager = ManagedObjectTypes("CryptoManager") + ManagedObjectTypesCryptoManagerHost = ManagedObjectTypes("CryptoManagerHost") + ManagedObjectTypesCryptoManagerHostKMS = ManagedObjectTypes("CryptoManagerHostKMS") + ManagedObjectTypesCryptoManagerKmip = ManagedObjectTypes("CryptoManagerKmip") + ManagedObjectTypesEventHistoryCollector = ManagedObjectTypes("EventHistoryCollector") + ManagedObjectTypesEventManager = ManagedObjectTypes("EventManager") + ManagedObjectTypesHostActiveDirectoryAuthentication = ManagedObjectTypes("HostActiveDirectoryAuthentication") + ManagedObjectTypesHostAssignableHardwareManager = ManagedObjectTypes("HostAssignableHardwareManager") + ManagedObjectTypesHostAuthenticationManager = ManagedObjectTypes("HostAuthenticationManager") + ManagedObjectTypesHostAuthenticationStore = ManagedObjectTypes("HostAuthenticationStore") + ManagedObjectTypesHostAutoStartManager = ManagedObjectTypes("HostAutoStartManager") + ManagedObjectTypesHostBootDeviceSystem = ManagedObjectTypes("HostBootDeviceSystem") + ManagedObjectTypesHostCacheConfigurationManager = ManagedObjectTypes("HostCacheConfigurationManager") + ManagedObjectTypesHostCertificateManager = ManagedObjectTypes("HostCertificateManager") + ManagedObjectTypesHostCpuSchedulerSystem = ManagedObjectTypes("HostCpuSchedulerSystem") + ManagedObjectTypesHostDatastoreBrowser = ManagedObjectTypes("HostDatastoreBrowser") + ManagedObjectTypesHostDatastoreSystem = ManagedObjectTypes("HostDatastoreSystem") + ManagedObjectTypesHostDateTimeSystem = ManagedObjectTypes("HostDateTimeSystem") + ManagedObjectTypesHostDiagnosticSystem = ManagedObjectTypes("HostDiagnosticSystem") + ManagedObjectTypesHostDirectoryStore = ManagedObjectTypes("HostDirectoryStore") + ManagedObjectTypesHostEsxAgentHostManager = ManagedObjectTypes("HostEsxAgentHostManager") + ManagedObjectTypesHostFirewallSystem = ManagedObjectTypes("HostFirewallSystem") + ManagedObjectTypesHostFirmwareSystem = ManagedObjectTypes("HostFirmwareSystem") + ManagedObjectTypesHostGraphicsManager = ManagedObjectTypes("HostGraphicsManager") + ManagedObjectTypesHostHealthStatusSystem = ManagedObjectTypes("HostHealthStatusSystem") + ManagedObjectTypesHostAccessManager = ManagedObjectTypes("HostAccessManager") + ManagedObjectTypesHostImageConfigManager = ManagedObjectTypes("HostImageConfigManager") + ManagedObjectTypesIscsiManager = ManagedObjectTypes("IscsiManager") + ManagedObjectTypesHostKernelModuleSystem = ManagedObjectTypes("HostKernelModuleSystem") + ManagedObjectTypesHostLocalAccountManager = ManagedObjectTypes("HostLocalAccountManager") + ManagedObjectTypesHostLocalAuthentication = ManagedObjectTypes("HostLocalAuthentication") + ManagedObjectTypesHostMemorySystem = ManagedObjectTypes("HostMemorySystem") + ManagedObjectTypesMessageBusProxy = ManagedObjectTypes("MessageBusProxy") + ManagedObjectTypesHostNetworkSystem = ManagedObjectTypes("HostNetworkSystem") + ManagedObjectTypesHostNvdimmSystem = ManagedObjectTypes("HostNvdimmSystem") + ManagedObjectTypesHostPatchManager = ManagedObjectTypes("HostPatchManager") + ManagedObjectTypesHostPciPassthruSystem = ManagedObjectTypes("HostPciPassthruSystem") + ManagedObjectTypesHostPowerSystem = ManagedObjectTypes("HostPowerSystem") + ManagedObjectTypesHostServiceSystem = ManagedObjectTypes("HostServiceSystem") + ManagedObjectTypesHostSnmpSystem = ManagedObjectTypes("HostSnmpSystem") + ManagedObjectTypesHostStorageSystem = ManagedObjectTypes("HostStorageSystem") + ManagedObjectTypesHostVFlashManager = ManagedObjectTypes("HostVFlashManager") + ManagedObjectTypesHostVMotionSystem = ManagedObjectTypes("HostVMotionSystem") + ManagedObjectTypesHostVirtualNicManager = ManagedObjectTypes("HostVirtualNicManager") + ManagedObjectTypesHostVsanInternalSystem = ManagedObjectTypes("HostVsanInternalSystem") + ManagedObjectTypesHostVsanSystem = ManagedObjectTypes("HostVsanSystem") + ManagedObjectTypesOptionManager = ManagedObjectTypes("OptionManager") + ManagedObjectTypesProfileComplianceManager = ManagedObjectTypes("ProfileComplianceManager") + ManagedObjectTypesProfile = ManagedObjectTypes("Profile") + ManagedObjectTypesProfileManager = ManagedObjectTypes("ProfileManager") + ManagedObjectTypesClusterProfile = ManagedObjectTypes("ClusterProfile") + ManagedObjectTypesClusterProfileManager = ManagedObjectTypes("ClusterProfileManager") + ManagedObjectTypesHostProfile = ManagedObjectTypes("HostProfile") + ManagedObjectTypesHostSpecificationManager = ManagedObjectTypes("HostSpecificationManager") + ManagedObjectTypesHostProfileManager = ManagedObjectTypes("HostProfileManager") + ManagedObjectTypesScheduledTask = ManagedObjectTypes("ScheduledTask") + ManagedObjectTypesScheduledTaskManager = ManagedObjectTypes("ScheduledTaskManager") + ManagedObjectTypesTenantTenantManager = ManagedObjectTypes("TenantTenantManager") + ManagedObjectTypesFailoverClusterConfigurator = ManagedObjectTypes("FailoverClusterConfigurator") + ManagedObjectTypesFailoverClusterManager = ManagedObjectTypes("FailoverClusterManager") + ManagedObjectTypesContainerView = ManagedObjectTypes("ContainerView") + ManagedObjectTypesInventoryView = ManagedObjectTypes("InventoryView") + ManagedObjectTypesListView = ManagedObjectTypes("ListView") + ManagedObjectTypesManagedObjectView = ManagedObjectTypes("ManagedObjectView") + ManagedObjectTypesView = ManagedObjectTypes("View") + ManagedObjectTypesViewManager = ManagedObjectTypes("ViewManager") + ManagedObjectTypesVirtualMachineGuestCustomizationManager = ManagedObjectTypes("VirtualMachineGuestCustomizationManager") + ManagedObjectTypesVirtualMachineSnapshot = ManagedObjectTypes("VirtualMachineSnapshot") + ManagedObjectTypesVirtualMachineCompatibilityChecker = ManagedObjectTypes("VirtualMachineCompatibilityChecker") + ManagedObjectTypesVirtualMachineProvisioningChecker = ManagedObjectTypes("VirtualMachineProvisioningChecker") + ManagedObjectTypesGuestAliasManager = ManagedObjectTypes("GuestAliasManager") + ManagedObjectTypesGuestAuthManager = ManagedObjectTypes("GuestAuthManager") + ManagedObjectTypesGuestFileManager = ManagedObjectTypes("GuestFileManager") + ManagedObjectTypesGuestOperationsManager = ManagedObjectTypes("GuestOperationsManager") + ManagedObjectTypesGuestProcessManager = ManagedObjectTypes("GuestProcessManager") + ManagedObjectTypesGuestWindowsRegistryManager = ManagedObjectTypes("GuestWindowsRegistryManager") + ManagedObjectTypesVStorageObjectManagerBase = ManagedObjectTypes("VStorageObjectManagerBase") + ManagedObjectTypesHostVStorageObjectManager = ManagedObjectTypes("HostVStorageObjectManager") + ManagedObjectTypesVcenterVStorageObjectManager = ManagedObjectTypes("VcenterVStorageObjectManager") +) + +func (e ManagedObjectTypes) Values() []ManagedObjectTypes { + return []ManagedObjectTypes{ + ManagedObjectTypesPropertyCollector, + ManagedObjectTypesPropertyFilter, + ManagedObjectTypesAuthorizationManager, + ManagedObjectTypesCertificateManager, + ManagedObjectTypesClusterComputeResource, + ManagedObjectTypesComputeResource, + ManagedObjectTypesCustomFieldsManager, + ManagedObjectTypesCustomizationSpecManager, + ManagedObjectTypesDatacenter, + ManagedObjectTypesDatastore, + ManagedObjectTypesDatastoreNamespaceManager, + ManagedObjectTypesDiagnosticManager, + ManagedObjectTypesDirectPathProfileManager, + ManagedObjectTypesDistributedVirtualSwitch, + ManagedObjectTypesEnvironmentBrowser, + ManagedObjectTypesExtensibleManagedObject, + ManagedObjectTypesExtensionManager, + ManagedObjectTypesFileManager, + ManagedObjectTypesFolder, + ManagedObjectTypesHealthUpdateManager, + ManagedObjectTypesHistoryCollector, + ManagedObjectTypesHostSystem, + ManagedObjectTypesHttpNfcLease, + ManagedObjectTypesIoFilterManager, + ManagedObjectTypesIpPoolManager, + ManagedObjectTypesLicenseAssignmentManager, + ManagedObjectTypesLicenseManager, + ManagedObjectTypesLocalizationManager, + ManagedObjectTypesManagedEntity, + ManagedObjectTypesNetwork, + ManagedObjectTypesOpaqueNetwork, + ManagedObjectTypesOverheadMemoryManager, + ManagedObjectTypesOvfManager, + ManagedObjectTypesPerformanceManager, + ManagedObjectTypesResourcePlanningManager, + ManagedObjectTypesResourcePool, + ManagedObjectTypesSearchIndex, + ManagedObjectTypesServiceInstance, + ManagedObjectTypesServiceManager, + ManagedObjectTypesSessionManager, + ManagedObjectTypesSimpleCommand, + ManagedObjectTypesSiteInfoManager, + ManagedObjectTypesStoragePod, + ManagedObjectTypesStorageQueryManager, + ManagedObjectTypesStorageResourceManager, + ManagedObjectTypesTask, + ManagedObjectTypesTaskHistoryCollector, + ManagedObjectTypesTaskManager, + ManagedObjectTypesUserDirectory, + ManagedObjectTypesVirtualApp, + ManagedObjectTypesVirtualDiskManager, + ManagedObjectTypesVirtualMachine, + ManagedObjectTypesVirtualizationManager, + ManagedObjectTypesVsanUpgradeSystem, + ManagedObjectTypesAlarm, + ManagedObjectTypesAlarmManager, + ManagedObjectTypesClusterEVCManager, + ManagedObjectTypesDistributedVirtualPortgroup, + ManagedObjectTypesDistributedVirtualSwitchManager, + ManagedObjectTypesVmwareDistributedVirtualSwitch, + ManagedObjectTypesCryptoManager, + ManagedObjectTypesCryptoManagerHost, + ManagedObjectTypesCryptoManagerHostKMS, + ManagedObjectTypesCryptoManagerKmip, + ManagedObjectTypesEventHistoryCollector, + ManagedObjectTypesEventManager, + ManagedObjectTypesHostActiveDirectoryAuthentication, + ManagedObjectTypesHostAssignableHardwareManager, + ManagedObjectTypesHostAuthenticationManager, + ManagedObjectTypesHostAuthenticationStore, + ManagedObjectTypesHostAutoStartManager, + ManagedObjectTypesHostBootDeviceSystem, + ManagedObjectTypesHostCacheConfigurationManager, + ManagedObjectTypesHostCertificateManager, + ManagedObjectTypesHostCpuSchedulerSystem, + ManagedObjectTypesHostDatastoreBrowser, + ManagedObjectTypesHostDatastoreSystem, + ManagedObjectTypesHostDateTimeSystem, + ManagedObjectTypesHostDiagnosticSystem, + ManagedObjectTypesHostDirectoryStore, + ManagedObjectTypesHostEsxAgentHostManager, + ManagedObjectTypesHostFirewallSystem, + ManagedObjectTypesHostFirmwareSystem, + ManagedObjectTypesHostGraphicsManager, + ManagedObjectTypesHostHealthStatusSystem, + ManagedObjectTypesHostAccessManager, + ManagedObjectTypesHostImageConfigManager, + ManagedObjectTypesIscsiManager, + ManagedObjectTypesHostKernelModuleSystem, + ManagedObjectTypesHostLocalAccountManager, + ManagedObjectTypesHostLocalAuthentication, + ManagedObjectTypesHostMemorySystem, + ManagedObjectTypesMessageBusProxy, + ManagedObjectTypesHostNetworkSystem, + ManagedObjectTypesHostNvdimmSystem, + ManagedObjectTypesHostPatchManager, + ManagedObjectTypesHostPciPassthruSystem, + ManagedObjectTypesHostPowerSystem, + ManagedObjectTypesHostServiceSystem, + ManagedObjectTypesHostSnmpSystem, + ManagedObjectTypesHostStorageSystem, + ManagedObjectTypesHostVFlashManager, + ManagedObjectTypesHostVMotionSystem, + ManagedObjectTypesHostVirtualNicManager, + ManagedObjectTypesHostVsanInternalSystem, + ManagedObjectTypesHostVsanSystem, + ManagedObjectTypesOptionManager, + ManagedObjectTypesProfileComplianceManager, + ManagedObjectTypesProfile, + ManagedObjectTypesProfileManager, + ManagedObjectTypesClusterProfile, + ManagedObjectTypesClusterProfileManager, + ManagedObjectTypesHostProfile, + ManagedObjectTypesHostSpecificationManager, + ManagedObjectTypesHostProfileManager, + ManagedObjectTypesScheduledTask, + ManagedObjectTypesScheduledTaskManager, + ManagedObjectTypesTenantTenantManager, + ManagedObjectTypesFailoverClusterConfigurator, + ManagedObjectTypesFailoverClusterManager, + ManagedObjectTypesContainerView, + ManagedObjectTypesInventoryView, + ManagedObjectTypesListView, + ManagedObjectTypesManagedObjectView, + ManagedObjectTypesView, + ManagedObjectTypesViewManager, + ManagedObjectTypesVirtualMachineGuestCustomizationManager, + ManagedObjectTypesVirtualMachineSnapshot, + ManagedObjectTypesVirtualMachineCompatibilityChecker, + ManagedObjectTypesVirtualMachineProvisioningChecker, + ManagedObjectTypesGuestAliasManager, + ManagedObjectTypesGuestAuthManager, + ManagedObjectTypesGuestFileManager, + ManagedObjectTypesGuestOperationsManager, + ManagedObjectTypesGuestProcessManager, + ManagedObjectTypesGuestWindowsRegistryManager, + ManagedObjectTypesVStorageObjectManagerBase, + ManagedObjectTypesHostVStorageObjectManager, + ManagedObjectTypesVcenterVStorageObjectManager, + } +} + +func (e ManagedObjectTypes) Strings() []string { + return EnumValuesAsStrings(e.Values()) +} + +func init() { + t["ManagedObjectTypes"] = reflect.TypeOf((*ManagedObjectTypes)(nil)).Elem() +} + // The operation on the target metric item. type MetricAlarmOperator string @@ -9089,6 +9623,34 @@ func init() { t["PhysicalNicVmDirectPathGen2SupportedMode"] = reflect.TypeOf((*PhysicalNicVmDirectPathGen2SupportedMode)(nil)).Elem() } +type PlaceVmsXClusterSpecPlacementType string + +const ( + // Create a new VM that should be powered-on in the near future. + PlaceVmsXClusterSpecPlacementTypeCreateAndPowerOn = PlaceVmsXClusterSpecPlacementType("createAndPowerOn") + // Reconfigure a powered-off or a powered-on VM. + PlaceVmsXClusterSpecPlacementTypeReconfigure = PlaceVmsXClusterSpecPlacementType("reconfigure") + // Relocate a powered-off or a powered-on VM. + PlaceVmsXClusterSpecPlacementTypeRelocate = PlaceVmsXClusterSpecPlacementType("relocate") +) + +func (e PlaceVmsXClusterSpecPlacementType) Values() []PlaceVmsXClusterSpecPlacementType { + return []PlaceVmsXClusterSpecPlacementType{ + PlaceVmsXClusterSpecPlacementTypeCreateAndPowerOn, + PlaceVmsXClusterSpecPlacementTypeReconfigure, + PlaceVmsXClusterSpecPlacementTypeRelocate, + } +} + +func (e PlaceVmsXClusterSpecPlacementType) Strings() []string { + return EnumValuesAsStrings(e.Values()) +} + +func init() { + t["PlaceVmsXClusterSpecPlacementType"] = reflect.TypeOf((*PlaceVmsXClusterSpecPlacementType)(nil)).Elem() + minAPIVersionForType["PlaceVmsXClusterSpecPlacementType"] = "9.0.0.0" +} + // Rule scope determines conditions when an affinity rule is // satisfied. // @@ -13140,6 +13702,10 @@ const ( VirtualMachineGuestOsIdentifierFreebsd14Guest = VirtualMachineGuestOsIdentifier("freebsd14Guest") // FreeBSD 14 x64 VirtualMachineGuestOsIdentifierFreebsd14_64Guest = VirtualMachineGuestOsIdentifier("freebsd14_64Guest") + // FreeBSD 15 + VirtualMachineGuestOsIdentifierFreebsd15Guest = VirtualMachineGuestOsIdentifier("freebsd15Guest") + // FreeBSD 15 x64 + VirtualMachineGuestOsIdentifierFreebsd15_64Guest = VirtualMachineGuestOsIdentifier("freebsd15_64Guest") // Red Hat Linux 2.1 VirtualMachineGuestOsIdentifierRedhatGuest = VirtualMachineGuestOsIdentifier("redhatGuest") // Red Hat Enterprise Linux 2 @@ -13168,6 +13734,8 @@ const ( VirtualMachineGuestOsIdentifierRhel8_64Guest = VirtualMachineGuestOsIdentifier("rhel8_64Guest") // Red Hat Enterprise Linux 9 (64 bit) VirtualMachineGuestOsIdentifierRhel9_64Guest = VirtualMachineGuestOsIdentifier("rhel9_64Guest") + // Red Hat Enterprise Linux 10 (64 bit) + VirtualMachineGuestOsIdentifierRhel10_64Guest = VirtualMachineGuestOsIdentifier("rhel10_64Guest") // CentOS 4/5 VirtualMachineGuestOsIdentifierCentosGuest = VirtualMachineGuestOsIdentifier("centosGuest") // CentOS 4/5 (64-bit) @@ -13200,6 +13768,8 @@ const ( VirtualMachineGuestOsIdentifierOracleLinux8_64Guest = VirtualMachineGuestOsIdentifier("oracleLinux8_64Guest") // Oracle 9 (64-bit) VirtualMachineGuestOsIdentifierOracleLinux9_64Guest = VirtualMachineGuestOsIdentifier("oracleLinux9_64Guest") + // Oracle 10 (64-bit) + VirtualMachineGuestOsIdentifierOracleLinux10_64Guest = VirtualMachineGuestOsIdentifier("oracleLinux10_64Guest") // Suse Linux VirtualMachineGuestOsIdentifierSuseGuest = VirtualMachineGuestOsIdentifier("suseGuest") // Suse Linux (64 bit) @@ -13280,6 +13850,10 @@ const ( VirtualMachineGuestOsIdentifierDebian12Guest = VirtualMachineGuestOsIdentifier("debian12Guest") // Debian GNU/Linux 12 (64 bit) VirtualMachineGuestOsIdentifierDebian12_64Guest = VirtualMachineGuestOsIdentifier("debian12_64Guest") + // Debian GNU/Linux 13 + VirtualMachineGuestOsIdentifierDebian13Guest = VirtualMachineGuestOsIdentifier("debian13Guest") + // Debian GNU/Linux 13 (64 bit) + VirtualMachineGuestOsIdentifierDebian13_64Guest = VirtualMachineGuestOsIdentifier("debian13_64Guest") // Asianux Server 3 VirtualMachineGuestOsIdentifierAsianux3Guest = VirtualMachineGuestOsIdentifier("asianux3Guest") // Asianux Server 3 (64 bit) @@ -13296,6 +13870,10 @@ const ( VirtualMachineGuestOsIdentifierAsianux8_64Guest = VirtualMachineGuestOsIdentifier("asianux8_64Guest") // Asianux Server 9 (64 bit) VirtualMachineGuestOsIdentifierAsianux9_64Guest = VirtualMachineGuestOsIdentifier("asianux9_64Guest") + // MIRACLE LINUX (64-bit) + VirtualMachineGuestOsIdentifierMiraclelinux_64Guest = VirtualMachineGuestOsIdentifier("miraclelinux_64Guest") + // Pardus (64-bit) + VirtualMachineGuestOsIdentifierPardus_64Guest = VirtualMachineGuestOsIdentifier("pardus_64Guest") // OpenSUSE Linux VirtualMachineGuestOsIdentifierOpensuseGuest = VirtualMachineGuestOsIdentifier("opensuseGuest") // OpenSUSE Linux (64 bit) @@ -13322,6 +13900,8 @@ const ( VirtualMachineGuestOsIdentifierOther5xLinuxGuest = VirtualMachineGuestOsIdentifier("other5xLinuxGuest") // Linux 6.x Kernel VirtualMachineGuestOsIdentifierOther6xLinuxGuest = VirtualMachineGuestOsIdentifier("other6xLinuxGuest") + // Linux 7.x Kernel + VirtualMachineGuestOsIdentifierOther7xLinuxGuest = VirtualMachineGuestOsIdentifier("other7xLinuxGuest") // Other Linux VirtualMachineGuestOsIdentifierGenericLinuxGuest = VirtualMachineGuestOsIdentifier("genericLinuxGuest") // Linux 2.4.x Kernel (64 bit) @@ -13336,6 +13916,8 @@ const ( VirtualMachineGuestOsIdentifierOther5xLinux64Guest = VirtualMachineGuestOsIdentifier("other5xLinux64Guest") // Linux 6.x Kernel (64 bit) VirtualMachineGuestOsIdentifierOther6xLinux64Guest = VirtualMachineGuestOsIdentifier("other6xLinux64Guest") + // Linux 7.x Kernel (64 bit) + VirtualMachineGuestOsIdentifierOther7xLinux64Guest = VirtualMachineGuestOsIdentifier("other7xLinux64Guest") // Linux (64 bit) VirtualMachineGuestOsIdentifierOtherLinux64Guest = VirtualMachineGuestOsIdentifier("otherLinux64Guest") // Solaris 6 @@ -13352,6 +13934,12 @@ const ( VirtualMachineGuestOsIdentifierSolaris10_64Guest = VirtualMachineGuestOsIdentifier("solaris10_64Guest") // Solaris 11 (64 bit) VirtualMachineGuestOsIdentifierSolaris11_64Guest = VirtualMachineGuestOsIdentifier("solaris11_64Guest") + // FusionOS (64 bit) + VirtualMachineGuestOsIdentifierFusionos_64Guest = VirtualMachineGuestOsIdentifier("fusionos_64Guest") + // ProLinux (64 bit) + VirtualMachineGuestOsIdentifierProlinux_64Guest = VirtualMachineGuestOsIdentifier("prolinux_64Guest") + // Kylinlinux (64 bit) + VirtualMachineGuestOsIdentifierKylinlinux_64Guest = VirtualMachineGuestOsIdentifier("kylinlinux_64Guest") // OS/2 VirtualMachineGuestOsIdentifierOs2Guest = VirtualMachineGuestOsIdentifier("os2Guest") // eComStation 1.x @@ -13418,6 +14006,8 @@ const ( VirtualMachineGuestOsIdentifierVmkernel7Guest = VirtualMachineGuestOsIdentifier("vmkernel7Guest") // VMware ESX 8 VirtualMachineGuestOsIdentifierVmkernel8Guest = VirtualMachineGuestOsIdentifier("vmkernel8Guest") + // VMware ESX 9 + VirtualMachineGuestOsIdentifierVmkernel9Guest = VirtualMachineGuestOsIdentifier("vmkernel9Guest") // Amazon Linux 2 (64 bit) VirtualMachineGuestOsIdentifierAmazonlinux2_64Guest = VirtualMachineGuestOsIdentifier("amazonlinux2_64Guest") // Amazon Linux 3 (64 bit) @@ -13487,6 +14077,8 @@ func (e VirtualMachineGuestOsIdentifier) Values() []VirtualMachineGuestOsIdentif VirtualMachineGuestOsIdentifierFreebsd13_64Guest, VirtualMachineGuestOsIdentifierFreebsd14Guest, VirtualMachineGuestOsIdentifierFreebsd14_64Guest, + VirtualMachineGuestOsIdentifierFreebsd15Guest, + VirtualMachineGuestOsIdentifierFreebsd15_64Guest, VirtualMachineGuestOsIdentifierRedhatGuest, VirtualMachineGuestOsIdentifierRhel2Guest, VirtualMachineGuestOsIdentifierRhel3Guest, @@ -13501,6 +14093,7 @@ func (e VirtualMachineGuestOsIdentifier) Values() []VirtualMachineGuestOsIdentif VirtualMachineGuestOsIdentifierRhel7_64Guest, VirtualMachineGuestOsIdentifierRhel8_64Guest, VirtualMachineGuestOsIdentifierRhel9_64Guest, + VirtualMachineGuestOsIdentifierRhel10_64Guest, VirtualMachineGuestOsIdentifierCentosGuest, VirtualMachineGuestOsIdentifierCentos64Guest, VirtualMachineGuestOsIdentifierCentos6Guest, @@ -13517,6 +14110,7 @@ func (e VirtualMachineGuestOsIdentifier) Values() []VirtualMachineGuestOsIdentif VirtualMachineGuestOsIdentifierOracleLinux7_64Guest, VirtualMachineGuestOsIdentifierOracleLinux8_64Guest, VirtualMachineGuestOsIdentifierOracleLinux9_64Guest, + VirtualMachineGuestOsIdentifierOracleLinux10_64Guest, VirtualMachineGuestOsIdentifierSuseGuest, VirtualMachineGuestOsIdentifierSuse64Guest, VirtualMachineGuestOsIdentifierSlesGuest, @@ -13557,6 +14151,8 @@ func (e VirtualMachineGuestOsIdentifier) Values() []VirtualMachineGuestOsIdentif VirtualMachineGuestOsIdentifierDebian11_64Guest, VirtualMachineGuestOsIdentifierDebian12Guest, VirtualMachineGuestOsIdentifierDebian12_64Guest, + VirtualMachineGuestOsIdentifierDebian13Guest, + VirtualMachineGuestOsIdentifierDebian13_64Guest, VirtualMachineGuestOsIdentifierAsianux3Guest, VirtualMachineGuestOsIdentifierAsianux3_64Guest, VirtualMachineGuestOsIdentifierAsianux4Guest, @@ -13565,6 +14161,8 @@ func (e VirtualMachineGuestOsIdentifier) Values() []VirtualMachineGuestOsIdentif VirtualMachineGuestOsIdentifierAsianux7_64Guest, VirtualMachineGuestOsIdentifierAsianux8_64Guest, VirtualMachineGuestOsIdentifierAsianux9_64Guest, + VirtualMachineGuestOsIdentifierMiraclelinux_64Guest, + VirtualMachineGuestOsIdentifierPardus_64Guest, VirtualMachineGuestOsIdentifierOpensuseGuest, VirtualMachineGuestOsIdentifierOpensuse64Guest, VirtualMachineGuestOsIdentifierFedoraGuest, @@ -13578,6 +14176,7 @@ func (e VirtualMachineGuestOsIdentifier) Values() []VirtualMachineGuestOsIdentif VirtualMachineGuestOsIdentifierOther4xLinuxGuest, VirtualMachineGuestOsIdentifierOther5xLinuxGuest, VirtualMachineGuestOsIdentifierOther6xLinuxGuest, + VirtualMachineGuestOsIdentifierOther7xLinuxGuest, VirtualMachineGuestOsIdentifierGenericLinuxGuest, VirtualMachineGuestOsIdentifierOther24xLinux64Guest, VirtualMachineGuestOsIdentifierOther26xLinux64Guest, @@ -13585,6 +14184,7 @@ func (e VirtualMachineGuestOsIdentifier) Values() []VirtualMachineGuestOsIdentif VirtualMachineGuestOsIdentifierOther4xLinux64Guest, VirtualMachineGuestOsIdentifierOther5xLinux64Guest, VirtualMachineGuestOsIdentifierOther6xLinux64Guest, + VirtualMachineGuestOsIdentifierOther7xLinux64Guest, VirtualMachineGuestOsIdentifierOtherLinux64Guest, VirtualMachineGuestOsIdentifierSolaris6Guest, VirtualMachineGuestOsIdentifierSolaris7Guest, @@ -13593,6 +14193,9 @@ func (e VirtualMachineGuestOsIdentifier) Values() []VirtualMachineGuestOsIdentif VirtualMachineGuestOsIdentifierSolaris10Guest, VirtualMachineGuestOsIdentifierSolaris10_64Guest, VirtualMachineGuestOsIdentifierSolaris11_64Guest, + VirtualMachineGuestOsIdentifierFusionos_64Guest, + VirtualMachineGuestOsIdentifierProlinux_64Guest, + VirtualMachineGuestOsIdentifierKylinlinux_64Guest, VirtualMachineGuestOsIdentifierOs2Guest, VirtualMachineGuestOsIdentifierEComStationGuest, VirtualMachineGuestOsIdentifierEComStation2Guest, @@ -13626,6 +14229,7 @@ func (e VirtualMachineGuestOsIdentifier) Values() []VirtualMachineGuestOsIdentif VirtualMachineGuestOsIdentifierVmkernel65Guest, VirtualMachineGuestOsIdentifierVmkernel7Guest, VirtualMachineGuestOsIdentifierVmkernel8Guest, + VirtualMachineGuestOsIdentifierVmkernel9Guest, VirtualMachineGuestOsIdentifierAmazonlinux2_64Guest, VirtualMachineGuestOsIdentifierAmazonlinux3_64Guest, VirtualMachineGuestOsIdentifierCrxPod1Guest, @@ -13652,22 +14256,36 @@ func init() { "freebsd13_64Guest": "7.0.1.0", "freebsd14Guest": "8.0.0.1", "freebsd14_64Guest": "8.0.0.1", + "freebsd15Guest": "9.0.0.0", + "freebsd15_64Guest": "9.0.0.0", "rhel9_64Guest": "7.0.1.0", + "rhel10_64Guest": "9.0.0.0", "centos9_64Guest": "7.0.1.0", "oracleLinux9_64Guest": "7.0.1.0", + "oracleLinux10_64Guest": "9.0.0.0", "sles16_64Guest": "7.0.1.0", "debian12Guest": "8.0.0.1", "debian12_64Guest": "8.0.0.1", + "debian13Guest": "9.0.0.0", + "debian13_64Guest": "9.0.0.0", "asianux9_64Guest": "7.0.1.0", + "miraclelinux_64Guest": "9.0.0.0", + "pardus_64Guest": "9.0.0.0", "other5xLinuxGuest": "7.0.1.0", "other6xLinuxGuest": "8.0.0.1", + "other7xLinuxGuest": "9.0.0.0", "other5xLinux64Guest": "7.0.1.0", "other6xLinux64Guest": "8.0.0.1", + "other7xLinux64Guest": "9.0.0.0", + "fusionos_64Guest": "9.0.0.0", + "prolinux_64Guest": "9.0.0.0", + "kylinlinux_64Guest": "9.0.0.0", "darwin20_64Guest": "7.0.1.0", "darwin21_64Guest": "7.0.1.0", "darwin22_64Guest": "8.0.0.1", "darwin23_64Guest": "8.0.0.1", "vmkernel8Guest": "8.0.0.1", + "vmkernel9Guest": "9.0.0.0", "amazonlinux3_64Guest": "7.0.1.0", "crxSys1Guest": "8.0.3.0", "rockylinux_64Guest": "8.0.0.1", @@ -15042,6 +15660,45 @@ func init() { t["VirtualSerialPortEndPoint"] = reflect.TypeOf((*VirtualSerialPortEndPoint)(nil)).Elem() } +// TSO (TCP Segmentation Offload) and LRO (Large Receive Offload) +// are both offloading techniques that improve network performance +// by reducing CPU overhead associated with packet segmentation +// and aggregation, respectively. +// +// They are commonly used in modern +// networking environments to optimize data transmission and +// reception processes. This is the type of disable offload on a +// network adapter. +type VirtualVmxnet3StrictLatencyConfigDisableOffload string + +const ( + // Do not disable. + VirtualVmxnet3StrictLatencyConfigDisableOffloadNONE = VirtualVmxnet3StrictLatencyConfigDisableOffload("NONE") + // Disable TCP Segmentation Offload (TSO). + VirtualVmxnet3StrictLatencyConfigDisableOffloadTSO = VirtualVmxnet3StrictLatencyConfigDisableOffload("TSO") + // Disable Large Receive Offload (LRO). + VirtualVmxnet3StrictLatencyConfigDisableOffloadLRO = VirtualVmxnet3StrictLatencyConfigDisableOffload("LRO") + // Disable both TSO and LRO. + VirtualVmxnet3StrictLatencyConfigDisableOffloadTSO_LRO = VirtualVmxnet3StrictLatencyConfigDisableOffload("TSO_LRO") +) + +func (e VirtualVmxnet3StrictLatencyConfigDisableOffload) Values() []VirtualVmxnet3StrictLatencyConfigDisableOffload { + return []VirtualVmxnet3StrictLatencyConfigDisableOffload{ + VirtualVmxnet3StrictLatencyConfigDisableOffloadNONE, + VirtualVmxnet3StrictLatencyConfigDisableOffloadTSO, + VirtualVmxnet3StrictLatencyConfigDisableOffloadLRO, + VirtualVmxnet3StrictLatencyConfigDisableOffloadTSO_LRO, + } +} + +func (e VirtualVmxnet3StrictLatencyConfigDisableOffload) Strings() []string { + return EnumValuesAsStrings(e.Values()) +} + +func init() { + t["VirtualVmxnet3StrictLatencyConfigDisableOffload"] = reflect.TypeOf((*VirtualVmxnet3StrictLatencyConfigDisableOffload)(nil)).Elem() +} + // The enumeration of all known valid VRDMA device protocols. type VirtualVmxnet3VrdmaOptionDeviceProtocols string @@ -15678,6 +16335,7 @@ const ( VslmDiskInfoFlagKeyProviderId = VslmDiskInfoFlag("keyProviderId") VslmDiskInfoFlagNativeSnapshotSupported = VslmDiskInfoFlag("nativeSnapshotSupported") VslmDiskInfoFlagCbtEnabled = VslmDiskInfoFlag("cbtEnabled") + VslmDiskInfoFlagVirtualDiskFormat = VslmDiskInfoFlag("virtualDiskFormat") ) func (e VslmDiskInfoFlag) Values() []VslmDiskInfoFlag { @@ -15703,6 +16361,7 @@ func (e VslmDiskInfoFlag) Values() []VslmDiskInfoFlag { VslmDiskInfoFlagKeyProviderId, VslmDiskInfoFlagNativeSnapshotSupported, VslmDiskInfoFlagCbtEnabled, + VslmDiskInfoFlagVirtualDiskFormat, } } diff --git a/vendor/github.com/vmware/govmomi/vim25/types/fault.go b/vendor/github.com/vmware/govmomi/vim25/types/fault.go index 813ea9ec6..8b0c1a8dc 100644 --- a/vendor/github.com/vmware/govmomi/vim25/types/fault.go +++ b/vendor/github.com/vmware/govmomi/vim25/types/fault.go @@ -41,3 +41,15 @@ func IsAlreadyExists(err error) bool { return false } + +// HasLocalizedMethodFault is any type that has a LocalizedMethodFault. +type HasLocalizedMethodFault interface { + + // GetLocalizedMethodFault returns the LocalizedMethodFault instance. + GetLocalizedMethodFault() *LocalizedMethodFault +} + +// GetLocalizedMethodFault returns this LocalizedMethodFault. +func (f *LocalizedMethodFault) GetLocalizedMethodFault() *LocalizedMethodFault { + return f +} diff --git a/vendor/github.com/vmware/govmomi/vim25/types/helpers.go b/vendor/github.com/vmware/govmomi/vim25/types/helpers.go index 94fb50df4..2527788b8 100644 --- a/vendor/github.com/vmware/govmomi/vim25/types/helpers.go +++ b/vendor/github.com/vmware/govmomi/vim25/types/helpers.go @@ -17,6 +17,9 @@ limitations under the License. package types import ( + "bytes" + "encoding/json" + "fmt" "net/url" "reflect" "strings" @@ -31,6 +34,10 @@ func EnumValuesAsStrings[T ~string](enumValues []T) []string { return stringValues } +func New[T any](t T) *T { + return &t +} + func NewBool(v bool) *bool { return &v } @@ -316,6 +323,78 @@ func (ci VirtualMachineConfigInfo) ToConfigSpec() VirtualMachineConfigSpec { return cs } +// ToString returns the string-ified version of the provided input value by +// first attempting to encode the value to JSON using the vimtype JSON encoder, +// and if that should fail, using the standard JSON encoder, and if that fails, +// returning the value formatted with Sprintf("%v"). +// +// Please note, this function is not intended to replace marshaling the data +// to JSON using the normal workflows. This function is for when a string-ified +// version of the data is needed for things like logging. +func ToString(in AnyType) (s string) { + if in == nil { + return "null" + } + + marshalWithSprintf := func() string { + return fmt.Sprintf("%v", in) + } + + defer func() { + if err := recover(); err != nil { + s = marshalWithSprintf() + } + }() + + rv := reflect.ValueOf(in) + switch rv.Kind() { + + case reflect.Bool, + reflect.Complex64, reflect.Complex128, + reflect.Float32, reflect.Float64: + + return fmt.Sprintf("%v", in) + + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, + reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, + reflect.Uintptr: + + return fmt.Sprintf("%d", in) + + case reflect.String: + return in.(string) + + case reflect.Interface, reflect.Pointer: + if rv.IsZero() { + return "null" + } + return ToString(rv.Elem().Interface()) + } + + marshalWithStdlibJSONEncoder := func() string { + data, err := json.Marshal(in) + if err != nil { + return marshalWithSprintf() + } + return string(data) + } + + defer func() { + if err := recover(); err != nil { + s = marshalWithStdlibJSONEncoder() + } + }() + + var w bytes.Buffer + enc := NewJSONEncoder(&w) + if err := enc.Encode(in); err != nil { + return marshalWithStdlibJSONEncoder() + } + + // Do not include the newline character added by the vimtype JSON encoder. + return strings.TrimSuffix(w.String(), "\n") +} + func init() { // Known 6.5 issue where this event type is sent even though it is internal. // This workaround allows us to unmarshal and avoid NPEs. diff --git a/vendor/github.com/vmware/govmomi/vim25/types/if.go b/vendor/github.com/vmware/govmomi/vim25/types/if.go index e33fb392e..000da856a 100644 --- a/vendor/github.com/vmware/govmomi/vim25/types/if.go +++ b/vendor/github.com/vmware/govmomi/vim25/types/if.go @@ -1,18 +1,6 @@ -/* -Copyright (c) 2014-2024 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. -*/ +// © Broadcom. All Rights Reserved. +// The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. +// SPDX-License-Identifier: Apache-2.0 package types @@ -422,6 +410,18 @@ func init() { t["BaseCpuIncompatible"] = reflect.TypeOf((*CpuIncompatible)(nil)).Elem() } +func (b *CryptoManagerKmipCryptoKeyStatusKeyInfo) GetCryptoManagerKmipCryptoKeyStatusKeyInfo() *CryptoManagerKmipCryptoKeyStatusKeyInfo { + return b +} + +type BaseCryptoManagerKmipCryptoKeyStatusKeyInfo interface { + GetCryptoManagerKmipCryptoKeyStatusKeyInfo() *CryptoManagerKmipCryptoKeyStatusKeyInfo +} + +func init() { + t["BaseCryptoManagerKmipCryptoKeyStatusKeyInfo"] = reflect.TypeOf((*CryptoManagerKmipCryptoKeyStatusKeyInfo)(nil)).Elem() +} + func (b *CryptoSpec) GetCryptoSpec() *CryptoSpec { return b } type BaseCryptoSpec interface { @@ -762,6 +762,54 @@ func init() { t["BaseDeviceNotSupported"] = reflect.TypeOf((*DeviceNotSupported)(nil)).Elem() } +func (b *DirectPathProfileManagerCapacityQuerySpec) GetDirectPathProfileManagerCapacityQuerySpec() *DirectPathProfileManagerCapacityQuerySpec { + return b +} + +type BaseDirectPathProfileManagerCapacityQuerySpec interface { + GetDirectPathProfileManagerCapacityQuerySpec() *DirectPathProfileManagerCapacityQuerySpec +} + +func init() { + t["BaseDirectPathProfileManagerCapacityQuerySpec"] = reflect.TypeOf((*DirectPathProfileManagerCapacityQuerySpec)(nil)).Elem() +} + +func (b *DirectPathProfileManagerCapacityResult) GetDirectPathProfileManagerCapacityResult() *DirectPathProfileManagerCapacityResult { + return b +} + +type BaseDirectPathProfileManagerCapacityResult interface { + GetDirectPathProfileManagerCapacityResult() *DirectPathProfileManagerCapacityResult +} + +func init() { + t["BaseDirectPathProfileManagerCapacityResult"] = reflect.TypeOf((*DirectPathProfileManagerCapacityResult)(nil)).Elem() +} + +func (b *DirectPathProfileManagerDirectPathConfig) GetDirectPathProfileManagerDirectPathConfig() *DirectPathProfileManagerDirectPathConfig { + return b +} + +type BaseDirectPathProfileManagerDirectPathConfig interface { + GetDirectPathProfileManagerDirectPathConfig() *DirectPathProfileManagerDirectPathConfig +} + +func init() { + t["BaseDirectPathProfileManagerDirectPathConfig"] = reflect.TypeOf((*DirectPathProfileManagerDirectPathConfig)(nil)).Elem() +} + +func (b *DirectPathProfileManagerTargetEntity) GetDirectPathProfileManagerTargetEntity() *DirectPathProfileManagerTargetEntity { + return b +} + +type BaseDirectPathProfileManagerTargetEntity interface { + GetDirectPathProfileManagerTargetEntity() *DirectPathProfileManagerTargetEntity +} + +func init() { + t["BaseDirectPathProfileManagerTargetEntity"] = reflect.TypeOf((*DirectPathProfileManagerTargetEntity)(nil)).Elem() +} + func (b *DiskNotSupported) GetDiskNotSupported() *DiskNotSupported { return b } type BaseDiskNotSupported interface { @@ -978,6 +1026,18 @@ func init() { t["BaseEventArgument"] = reflect.TypeOf((*EventArgument)(nil)).Elem() } +func (b *EventManagerEventViewSpec) GetEventManagerEventViewSpec() *EventManagerEventViewSpec { + return b +} + +type BaseEventManagerEventViewSpec interface { + GetEventManagerEventViewSpec() *EventManagerEventViewSpec +} + +func init() { + t["BaseEventManagerEventViewSpec"] = reflect.TypeOf((*EventManagerEventViewSpec)(nil)).Elem() +} + func (b *ExitStandbyModeFailedEvent) GetExitStandbyModeFailedEvent() *ExitStandbyModeFailedEvent { return b } @@ -1204,6 +1264,16 @@ func init() { t["BaseGuestRegistryValueFault"] = reflect.TypeOf((*GuestRegistryValueFault)(nil)).Elem() } +func (b *HbrReplicationTargetSpec) GetHbrReplicationTargetSpec() *HbrReplicationTargetSpec { return b } + +type BaseHbrReplicationTargetSpec interface { + GetHbrReplicationTargetSpec() *HbrReplicationTargetSpec +} + +func init() { + t["BaseHbrReplicationTargetSpec"] = reflect.TypeOf((*HbrReplicationTargetSpec)(nil)).Elem() +} + func (b *HostAccountSpec) GetHostAccountSpec() *HostAccountSpec { return b } type BaseHostAccountSpec interface { @@ -1842,6 +1912,26 @@ func init() { t["BaseIscsiFault"] = reflect.TypeOf((*IscsiFault)(nil)).Elem() } +func (b *KmipClusterInfoKeyInfo) GetKmipClusterInfoKeyInfo() *KmipClusterInfoKeyInfo { return b } + +type BaseKmipClusterInfoKeyInfo interface { + GetKmipClusterInfoKeyInfo() *KmipClusterInfoKeyInfo +} + +func init() { + t["BaseKmipClusterInfoKeyInfo"] = reflect.TypeOf((*KmipClusterInfoKeyInfo)(nil)).Elem() +} + +func (b *KmipServerSpecKeySpec) GetKmipServerSpecKeySpec() *KmipServerSpecKeySpec { return b } + +type BaseKmipServerSpecKeySpec interface { + GetKmipServerSpecKeySpec() *KmipServerSpecKeySpec +} + +func init() { + t["BaseKmipServerSpecKeySpec"] = reflect.TypeOf((*KmipServerSpecKeySpec)(nil)).Elem() +} + func (b *LicenseEvent) GetLicenseEvent() *LicenseEvent { return b } type BaseLicenseEvent interface { @@ -2116,6 +2206,18 @@ func init() { t["BaseOvfConsumerCallbackFault"] = reflect.TypeOf((*OvfConsumerCallbackFault)(nil)).Elem() } +func (b *OvfCreateImportSpecParams) GetOvfCreateImportSpecParams() *OvfCreateImportSpecParams { + return b +} + +type BaseOvfCreateImportSpecParams interface { + GetOvfCreateImportSpecParams() *OvfCreateImportSpecParams +} + +func init() { + t["BaseOvfCreateImportSpecParams"] = reflect.TypeOf((*OvfCreateImportSpecParams)(nil)).Elem() +} + func (b *OvfElement) GetOvfElement() *OvfElement { return b } type BaseOvfElement interface { @@ -2652,6 +2754,16 @@ func init() { t["BaseTaskInProgress"] = reflect.TypeOf((*TaskInProgress)(nil)).Elem() } +func (b *TaskManagerTaskViewSpec) GetTaskManagerTaskViewSpec() *TaskManagerTaskViewSpec { return b } + +type BaseTaskManagerTaskViewSpec interface { + GetTaskManagerTaskViewSpec() *TaskManagerTaskViewSpec +} + +func init() { + t["BaseTaskManagerTaskViewSpec"] = reflect.TypeOf((*TaskManagerTaskViewSpec)(nil)).Elem() +} + func (b *TaskReason) GetTaskReason() *TaskReason { return b } type BaseTaskReason interface { diff --git a/vendor/github.com/vmware/govmomi/vim25/types/types.go b/vendor/github.com/vmware/govmomi/vim25/types/types.go index 43f8c0a9e..4420467dc 100644 --- a/vendor/github.com/vmware/govmomi/vim25/types/types.go +++ b/vendor/github.com/vmware/govmomi/vim25/types/types.go @@ -1,18 +1,6 @@ -/* -Copyright (c) 2014-2024 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. -*/ +// © Broadcom. All Rights Reserved. +// The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. +// SPDX-License-Identifier: Apache-2.0 package types @@ -96,9 +84,9 @@ type AboutInfo struct { FullName string `xml:"fullName" json:"fullName"` // Name of the vendor of this product. Vendor string `xml:"vendor" json:"vendor"` - // Dot-separated version string. + // Dot-separated product version string. // - // For example, "1.2". + // For example, "10.0.2.0". Version string `xml:"version" json:"version"` // Patch level for the server. PatchLevel string `xml:"patchLevel,omitempty" json:"patchLevel,omitempty" vim:"7.0.2.0"` @@ -143,9 +131,10 @@ type AboutInfo struct { // - "VirtualCenter" - For a VirtualCenter instance. // - "HostAgent" - For host agent on an ESX Server or VMware Server host. ApiType string `xml:"apiType" json:"apiType"` - // The version of the API as a dot-separated string. + // The newest long-term supported API version provided by the server. // - // For example, "1.0.0". + // The version format is "x.y.z.a", where "x", "y", and "z" are numbers + // that do not exceed 99, and "a" does not exceed 9999. ApiVersion string `xml:"apiVersion" json:"apiVersion"` // A globally unique identifier associated with this service instance. InstanceUuid string `xml:"instanceUuid,omitempty" json:"instanceUuid,omitempty"` @@ -3120,6 +3109,36 @@ func init() { t["ArrayOfDiagnosticManagerLogDescriptor"] = reflect.TypeOf((*ArrayOfDiagnosticManagerLogDescriptor)(nil)).Elem() } +// A boxed array of `DirectPathProfileInfo`. To be used in `Any` placeholders. +type ArrayOfDirectPathProfileInfo struct { + DirectPathProfileInfo []DirectPathProfileInfo `xml:"DirectPathProfileInfo,omitempty" json:"_value"` +} + +func init() { + t["ArrayOfDirectPathProfileInfo"] = reflect.TypeOf((*ArrayOfDirectPathProfileInfo)(nil)).Elem() + minAPIVersionForType["ArrayOfDirectPathProfileInfo"] = "9.0.0.0" +} + +// A boxed array of `DirectPathProfileManagerCapacityQuerySpec`. To be used in `Any` placeholders. +type ArrayOfDirectPathProfileManagerCapacityQuerySpec struct { + DirectPathProfileManagerCapacityQuerySpec []BaseDirectPathProfileManagerCapacityQuerySpec `xml:"DirectPathProfileManagerCapacityQuerySpec,omitempty,typeattr" json:"_value"` +} + +func init() { + t["ArrayOfDirectPathProfileManagerCapacityQuerySpec"] = reflect.TypeOf((*ArrayOfDirectPathProfileManagerCapacityQuerySpec)(nil)).Elem() + minAPIVersionForType["ArrayOfDirectPathProfileManagerCapacityQuerySpec"] = "9.0.0.0" +} + +// A boxed array of `DirectPathProfileManagerCapacityResult`. To be used in `Any` placeholders. +type ArrayOfDirectPathProfileManagerCapacityResult struct { + DirectPathProfileManagerCapacityResult []BaseDirectPathProfileManagerCapacityResult `xml:"DirectPathProfileManagerCapacityResult,omitempty,typeattr" json:"_value"` +} + +func init() { + t["ArrayOfDirectPathProfileManagerCapacityResult"] = reflect.TypeOf((*ArrayOfDirectPathProfileManagerCapacityResult)(nil)).Elem() + minAPIVersionForType["ArrayOfDirectPathProfileManagerCapacityResult"] = "9.0.0.0" +} + // A boxed array of `DiskChangeExtent`. To be used in `Any` placeholders. type ArrayOfDiskChangeExtent struct { DiskChangeExtent []DiskChangeExtent `xml:"DiskChangeExtent,omitempty" json:"_value"` @@ -3846,6 +3865,16 @@ func init() { t["ArrayOfHbrManagerVmReplicationCapability"] = reflect.TypeOf((*ArrayOfHbrManagerVmReplicationCapability)(nil)).Elem() } +// A boxed array of `HbrTargetSpec`. To be used in `Any` placeholders. +type ArrayOfHbrTargetSpec struct { + HbrTargetSpec []HbrTargetSpec `xml:"HbrTargetSpec,omitempty" json:"_value"` +} + +func init() { + t["ArrayOfHbrTargetSpec"] = reflect.TypeOf((*ArrayOfHbrTargetSpec)(nil)).Elem() + minAPIVersionForType["ArrayOfHbrTargetSpec"] = "9.0.0.0" +} + // A boxed array of `HealthUpdate`. To be used in `Any` placeholders. type ArrayOfHealthUpdate struct { HealthUpdate []HealthUpdate `xml:"HealthUpdate,omitempty" json:"_value"` @@ -3909,6 +3938,16 @@ func init() { t["ArrayOfHostAssignableHardwareConfigAttributeOverride"] = reflect.TypeOf((*ArrayOfHostAssignableHardwareConfigAttributeOverride)(nil)).Elem() } +// A boxed array of `HostAuthenticationInfo`. To be used in `Any` placeholders. +type ArrayOfHostAuthenticationInfo struct { + HostAuthenticationInfo []HostAuthenticationInfo `xml:"HostAuthenticationInfo,omitempty" json:"_value"` +} + +func init() { + t["ArrayOfHostAuthenticationInfo"] = reflect.TypeOf((*ArrayOfHostAuthenticationInfo)(nil)).Elem() + minAPIVersionForType["ArrayOfHostAuthenticationInfo"] = "9.0.0.0" +} + // A boxed array of `HostAuthenticationStoreInfo`. To be used in `Any` placeholders. type ArrayOfHostAuthenticationStoreInfo struct { HostAuthenticationStoreInfo []BaseHostAuthenticationStoreInfo `xml:"HostAuthenticationStoreInfo,omitempty,typeattr" json:"_value"` @@ -5782,6 +5821,16 @@ func init() { t["ArrayOfOvfConsumerOvfSection"] = reflect.TypeOf((*ArrayOfOvfConsumerOvfSection)(nil)).Elem() } +// A boxed array of `OvfDatastoreMapping`. To be used in `Any` placeholders. +type ArrayOfOvfDatastoreMapping struct { + OvfDatastoreMapping []OvfDatastoreMapping `xml:"OvfDatastoreMapping,omitempty" json:"_value"` +} + +func init() { + t["ArrayOfOvfDatastoreMapping"] = reflect.TypeOf((*ArrayOfOvfDatastoreMapping)(nil)).Elem() + minAPIVersionForType["ArrayOfOvfDatastoreMapping"] = "9.0.0.0" +} + // A boxed array of `OvfDeploymentOption`. To be used in `Any` placeholders. type ArrayOfOvfDeploymentOption struct { OvfDeploymentOption []OvfDeploymentOption `xml:"OvfDeploymentOption,omitempty" json:"_value"` @@ -5845,6 +5894,16 @@ func init() { t["ArrayOfOvfResourceMap"] = reflect.TypeOf((*ArrayOfOvfResourceMap)(nil)).Elem() } +// A boxed array of `OvfStorageProfileMapping`. To be used in `Any` placeholders. +type ArrayOfOvfStorageProfileMapping struct { + OvfStorageProfileMapping []OvfStorageProfileMapping `xml:"OvfStorageProfileMapping,omitempty" json:"_value"` +} + +func init() { + t["ArrayOfOvfStorageProfileMapping"] = reflect.TypeOf((*ArrayOfOvfStorageProfileMapping)(nil)).Elem() + minAPIVersionForType["ArrayOfOvfStorageProfileMapping"] = "9.0.0.0" +} + // A boxed array of `PerfCounterInfo`. To be used in `Any` placeholders. type ArrayOfPerfCounterInfo struct { PerfCounterInfo []PerfCounterInfo `xml:"PerfCounterInfo,omitempty" json:"_value"` @@ -6484,6 +6543,16 @@ func init() { t["ArrayOfStructuredCustomizations"] = reflect.TypeOf((*ArrayOfStructuredCustomizations)(nil)).Elem() } +// A boxed array of `SubnetInfo`. To be used in `Any` placeholders. +type ArrayOfSubnetInfo struct { + SubnetInfo []SubnetInfo `xml:"SubnetInfo,omitempty" json:"_value"` +} + +func init() { + t["ArrayOfSubnetInfo"] = reflect.TypeOf((*ArrayOfSubnetInfo)(nil)).Elem() + minAPIVersionForType["ArrayOfSubnetInfo"] = "9.0.0.0" +} + // A boxed array of `SystemEventInfo`. To be used in `Any` placeholders. type ArrayOfSystemEventInfo struct { SystemEventInfo []SystemEventInfo `xml:"SystemEventInfo,omitempty" json:"_value"` @@ -6772,6 +6841,26 @@ func init() { t["ArrayOfVStorageObjectAssociationsVmDiskAssociations"] = reflect.TypeOf((*ArrayOfVStorageObjectAssociationsVmDiskAssociations)(nil)).Elem() } +// A boxed array of `VStorageObjectReconcileResultInvalidDiskPath`. To be used in `Any` placeholders. +type ArrayOfVStorageObjectReconcileResultInvalidDiskPath struct { + VStorageObjectReconcileResultInvalidDiskPath []VStorageObjectReconcileResultInvalidDiskPath `xml:"VStorageObjectReconcileResultInvalidDiskPath,omitempty" json:"_value"` +} + +func init() { + t["ArrayOfVStorageObjectReconcileResultInvalidDiskPath"] = reflect.TypeOf((*ArrayOfVStorageObjectReconcileResultInvalidDiskPath)(nil)).Elem() + minAPIVersionForType["ArrayOfVStorageObjectReconcileResultInvalidDiskPath"] = "9.0.0.0" +} + +// A boxed array of `VStorageObjectReconcileResultReconcileDetail`. To be used in `Any` placeholders. +type ArrayOfVStorageObjectReconcileResultReconcileDetail struct { + VStorageObjectReconcileResultReconcileDetail []VStorageObjectReconcileResultReconcileDetail `xml:"VStorageObjectReconcileResultReconcileDetail,omitempty" json:"_value"` +} + +func init() { + t["ArrayOfVStorageObjectReconcileResultReconcileDetail"] = reflect.TypeOf((*ArrayOfVStorageObjectReconcileResultReconcileDetail)(nil)).Elem() + minAPIVersionForType["ArrayOfVStorageObjectReconcileResultReconcileDetail"] = "9.0.0.0" +} + // A boxed array of `VStorageObjectSnapshotInfoVStorageObjectSnapshot`. To be used in `Any` placeholders. type ArrayOfVStorageObjectSnapshotInfoVStorageObjectSnapshot struct { VStorageObjectSnapshotInfoVStorageObjectSnapshot []VStorageObjectSnapshotInfoVStorageObjectSnapshot `xml:"VStorageObjectSnapshotInfoVStorageObjectSnapshot,omitempty" json:"_value"` @@ -11328,6 +11417,9 @@ type ClusterConfigInfoEx struct { ProactiveDrsConfig *ClusterProactiveDrsConfigInfo `xml:"proactiveDrsConfig,omitempty" json:"proactiveDrsConfig,omitempty"` // Cluster-wide configuration of the encryption mode. CryptoConfig *ClusterCryptoConfigInfo `xml:"cryptoConfig,omitempty" json:"cryptoConfig,omitempty"` + // vSAN first-class settings that will be configured together with + // vSAN enablement. + VsanCoreConfig *VsanClusterCoreConfig `xml:"vsanCoreConfig,omitempty" json:"vsanCoreConfig,omitempty" vim:"9.0.0.0"` } func init() { @@ -11632,6 +11724,9 @@ type ClusterConfigSpecEx struct { InHciWorkflow *bool `xml:"inHciWorkflow" json:"inHciWorkflow,omitempty"` // Cluster-wide configuration of encryption mode. CryptoConfig *ClusterCryptoConfigInfo `xml:"cryptoConfig,omitempty" json:"cryptoConfig,omitempty"` + // vSAN first-class settings that will be configured together with + // vSAN enablement. + VsanCoreConfigSpec *VsanClusterCoreConfigSpec `xml:"vsanCoreConfigSpec,omitempty" json:"vsanCoreConfigSpec,omitempty" vim:"9.0.0.0"` } func init() { @@ -13411,6 +13506,11 @@ func init() { } // Information about an IO Filter on a compute resource. +// +// On vLCM managed cluster, this contains information +// about iofilter at solution level. So, iofilter +// information properties output on a compute resource +// can differ from the hosts on a vLCM cluster. type ClusterIoFilterInfo struct { IoFilterInfo @@ -14014,6 +14114,16 @@ type ClusterUsageSummary struct { PoweredOffVmCount int32 `xml:"poweredOffVmCount" json:"poweredOffVmCount"` // The number of VMs in the cluster TotalVmCount int32 `xml:"totalVmCount" json:"totalVmCount"` + // Total Tier 0 memory capacity in a cluster. + Tier0MemCapacityMB int32 `xml:"tier0MemCapacityMB,omitempty" json:"tier0MemCapacityMB,omitempty" vim:"9.0.0.0"` + // Total amount of Tier 0 memory used to satisfy virtual machine reservation. + ReservedTier0MemMB int32 `xml:"reservedTier0MemMB,omitempty" json:"reservedTier0MemMB,omitempty" vim:"9.0.0.0"` + // Total amount of Tier 0 memory available to satisfy reservation. + // + // Available + // reservation is calculated after accounting for DRS overheads and current + // reservation. + UnreservedTier0MemMB int32 `xml:"unreservedTier0MemMB,omitempty" json:"unreservedTier0MemMB,omitempty" vim:"9.0.0.0"` } func init() { @@ -14658,7 +14768,10 @@ type ComputeResourceConfigSpec struct { // Desired software spec for the set of physical compute resources. // // This - // parameter is only supported in vim.Folder#createClusterEx operation. + // parameter is supported in vim.Folder#createClusterEx and + // vim.Folder#addStandaloneHost operations. + // If unset, this field will be initialized with the latest base image + // from the image depot on vSphere version 9.0 and later. DesiredSoftwareSpec *DesiredSoftwareSpec `xml:"desiredSoftwareSpec,omitempty" json:"desiredSoftwareSpec,omitempty"` // Key for Maximum Hardware Version to be used on this compute resource // in the format of `VirtualMachineConfigOptionDescriptor.key`. @@ -14678,6 +14791,25 @@ type ComputeResourceConfigSpec struct { EnableConfigManager *bool `xml:"enableConfigManager" json:"enableConfigManager,omitempty" vim:"7.0.3.1"` // Specification for the host seeding operation. HostSeedSpec *ComputeResourceHostSeedSpec `xml:"hostSeedSpec,omitempty" json:"hostSeedSpec,omitempty" vim:"8.0.3.0"` + // ID of a software specification from the repository. + // + // This software specification is created in the repository before + // cluster creation operation or add standalone host operation. + // This desired state software specification will be applied to the + // cluster or the standalone host. + // The lifecycle of the created cluster or the added standalone host + // will be managed by vLCM. + SoftwareSpecId string `xml:"softwareSpecId,omitempty" json:"softwareSpecId,omitempty" vim:"9.0.0.0"` + // Enumeration indicating whether and what kind of netwoork boot mode + // should be configured for the compute resource. + // + // Supported values are + // enumerated in `ComputeResourceNetworkBootMode_enum`. If the + // property is not set not network boot will not be supported by this + // compute resource. + // This property is only supported in `Folder.CreateClusterEx` + // operation. + NetworkBootMode string `xml:"networkBootMode,omitempty" json:"networkBootMode,omitempty" vim:"9.0.0.0"` } func init() { @@ -14865,6 +14997,8 @@ type ConfigTarget struct { // List of distributed virtual switch available for virtual network // adapters. DistributedVirtualSwitch []DistributedVirtualSwitchInfo `xml:"distributedVirtualSwitch,omitempty" json:"distributedVirtualSwitch,omitempty"` + // List of subnets available for virtual network adapters. + SubnetInfo []SubnetInfo `xml:"subnetInfo,omitempty" json:"subnetInfo,omitempty" vim:"9.0.0.0"` // List of CD-ROM devices available for use by virtual CD-ROMs. // // Used for @@ -14962,6 +15096,19 @@ type ConfigTarget struct { MaxSimultaneousThreads int32 `xml:"maxSimultaneousThreads,omitempty" json:"maxSimultaneousThreads,omitempty" vim:"8.0.0.1"` // List of Device Virtualization Extensions (DVX) classes. DvxClassInfo []VirtualMachineDvxClassInfo `xml:"dvxClassInfo,omitempty" json:"dvxClassInfo,omitempty" vim:"8.0.0.1"` + // Indicates whether the compute resource is capable of running AMD Secure + // Encrypted Virtualization Secure Nested Paging (SEV-SNP) enabled virtual + // machines. + // + // The compute resource supports SEV-SNP when this value is set + // to true. + SevSnpSupported *bool `xml:"sevSnpSupported" json:"sevSnpSupported,omitempty" vim:"9.0.0.0"` + // Indicates whether the compute resource is capable of running INTEL Trusted + // Domain Extensions (TDX) enabled virtual machines. + // + // The compute resource + // supports TDX when this value is set to true. + TdxSupported *bool `xml:"tdxSupported" json:"tdxSupported,omitempty" vim:"9.0.0.0"` } func init() { @@ -16303,7 +16450,7 @@ type CreateImportSpecRequestType struct { Datastore ManagedObjectReference `xml:"datastore" json:"datastore"` // Additional parameters to the method, bundled in an instance of // CreateImportSpecParams. - Cisp OvfCreateImportSpecParams `xml:"cisp" json:"cisp"` + Cisp BaseOvfCreateImportSpecParams `xml:"cisp,typeattr" json:"cisp"` } func init() { @@ -17442,6 +17589,10 @@ type CryptoManagerKmipCryptoKeyStatus struct { // // `CryptoManagerKmipCryptoKeyStatusKeyUnavailableReason_enum` lists the set of supported values. Reason string `xml:"reason,omitempty" json:"reason,omitempty"` + // The key info of the wrapped key. + // + // If key is not a wrapped, then it will unset. + KeyInfo BaseCryptoManagerKmipCryptoKeyStatusKeyInfo `xml:"keyInfo,omitempty,typeattr" json:"keyInfo,omitempty" vim:"9.0.0.0"` // The list of VMs which use that key // // Refers instances of `VirtualMachine`. @@ -17458,6 +17609,52 @@ func init() { t["CryptoManagerKmipCryptoKeyStatus"] = reflect.TypeOf((*CryptoManagerKmipCryptoKeyStatus)(nil)).Elem() } +// Base class of key information. +type CryptoManagerKmipCryptoKeyStatusKeyInfo struct { + DynamicData + + // Wrapping Key ID + KeyId string `xml:"keyId" json:"keyId"` +} + +func init() { + t["CryptoManagerKmipCryptoKeyStatusKeyInfo"] = reflect.TypeOf((*CryptoManagerKmipCryptoKeyStatusKeyInfo)(nil)).Elem() + minAPIVersionForType["CryptoManagerKmipCryptoKeyStatusKeyInfo"] = "9.0.0.0" +} + +// Wrapping key ID key information. +type CryptoManagerKmipCryptoKeyStatusWrappingKeyIdKeyInfo struct { + CryptoManagerKmipCryptoKeyStatusKeyInfo + + // Wrapping Key manually configured time. + ConfiguredTime *time.Time `xml:"configuredTime" json:"configuredTime,omitempty"` +} + +func init() { + t["CryptoManagerKmipCryptoKeyStatusWrappingKeyIdKeyInfo"] = reflect.TypeOf((*CryptoManagerKmipCryptoKeyStatusWrappingKeyIdKeyInfo)(nil)).Elem() + minAPIVersionForType["CryptoManagerKmipCryptoKeyStatusWrappingKeyIdKeyInfo"] = "9.0.0.0" +} + +// Wrapping rotation interval key information. +type CryptoManagerKmipCryptoKeyStatusWrappingRotationIntervalKeyInfo struct { + CryptoManagerKmipCryptoKeyStatusKeyInfo + + // Wrapping Key create time. + // + // Will be unset when the creation time is unknown. + CreateTime *time.Time `xml:"createTime" json:"createTime,omitempty"` + // Wrapping Key rotate out time. + // + // Will be unset when the wrapping key has not rotated, or the + // rotation time is unknown. + RotateTime *time.Time `xml:"rotateTime" json:"rotateTime,omitempty"` +} + +func init() { + t["CryptoManagerKmipCryptoKeyStatusWrappingRotationIntervalKeyInfo"] = reflect.TypeOf((*CryptoManagerKmipCryptoKeyStatusWrappingRotationIntervalKeyInfo)(nil)).Elem() + minAPIVersionForType["CryptoManagerKmipCryptoKeyStatusWrappingRotationIntervalKeyInfo"] = "9.0.0.0" +} + // Crypto key custom attribute spec type CryptoManagerKmipCustomAttributeSpec struct { DynamicData @@ -17471,6 +17668,23 @@ func init() { minAPIVersionForType["CryptoManagerKmipCustomAttributeSpec"] = "8.0.1.0" } +// Specification for key generation. +type CryptoManagerKmipGenerateKeySpec struct { + DynamicData + + // Request key type. + // + // If it unset then will use the `KmipClusterInfo.defaultKeyType` + // of the key provider. + // See `KmipClusterInfoKeyType_enum` for supported values. + KeyType string `xml:"keyType,omitempty" json:"keyType,omitempty"` +} + +func init() { + t["CryptoManagerKmipGenerateKeySpec"] = reflect.TypeOf((*CryptoManagerKmipGenerateKeySpec)(nil)).Elem() + minAPIVersionForType["CryptoManagerKmipGenerateKeySpec"] = "9.0.0.0" +} + // Information about the KMIP server certificate. type CryptoManagerKmipServerCertInfo struct { DynamicData @@ -19085,6 +19299,8 @@ type DVPortgroupConfigInfo struct { LogicalSwitchUuid string `xml:"logicalSwitchUuid,omitempty" json:"logicalSwitchUuid,omitempty"` // The segment ID of logical switch SegmentId string `xml:"segmentId,omitempty" json:"segmentId,omitempty"` + // ID of the VPC Subnet when the DVPG is backed by a VPC Subnet + SubnetId string `xml:"subnetId,omitempty" json:"subnetId,omitempty" vim:"9.0.0.0"` } func init() { @@ -19182,6 +19398,8 @@ type DVPortgroupConfigSpec struct { LogicalSwitchUuid string `xml:"logicalSwitchUuid,omitempty" json:"logicalSwitchUuid,omitempty"` // The segment ID of logical switch SegmentId string `xml:"segmentId,omitempty" json:"segmentId,omitempty"` + // The subnet ID of logical switch + SubnetId string `xml:"subnetId,omitempty" json:"subnetId,omitempty" vim:"9.0.0.0"` } func init() { @@ -21199,6 +21417,22 @@ type DatastoreInfo struct { // datastore. // See `DatastoreInfo.containerId`. AliasOf string `xml:"aliasOf,omitempty" json:"aliasOf,omitempty"` + // A list of virtual disk format type which can be supported + // on that datastore. + // + // Supported values are `native_512` and + // `native_4k`. + SupportedVDiskFormats []string `xml:"supportedVDiskFormats,omitempty" json:"supportedVDiskFormats,omitempty" vim:"9.0.0.0"` + // The logical sector size of the datastore. + // + // If not set, + // the default is 512 bytes. + LogicalSectorSize int32 `xml:"logicalSectorSize,omitempty" json:"logicalSectorSize,omitempty" vim:"9.0.0.0"` + // The physical sector size of the datastore. + // + // If not set, + // the default is 512 bytes. + PhysicalSectorSize int32 `xml:"physicalSectorSize,omitempty" json:"physicalSectorSize,omitempty" vim:"9.0.0.0"` } func init() { @@ -22800,6 +23034,535 @@ func init() { t["DigestNotSupportedFault"] = reflect.TypeOf((*DigestNotSupportedFault)(nil)).Elem() } +// Information about a DirectPath profile. +type DirectPathProfileInfo struct { + DynamicData + + // Unique identifier of the DirectPath profile. + Id string `xml:"id" json:"id"` + // Name of the DirectPath profile. + Name string `xml:"name" json:"name"` + // Description of the DirectPath profile. + Description string `xml:"description,omitempty" json:"description,omitempty"` + // Name of the vendor for the device represented by this DirectPath + // profile. + VendorName string `xml:"vendorName" json:"vendorName"` + // Configuration of the DirectPath device represented by this DirectPath + // profile. + // + // Since one DirectPath profile represents one device, the + // configuration will be one of the following types: + // 1\) `DirectPathProfileManagerVmiopDirectPathConfig` + // 2\) `DirectPathProfileManagerDvxDirectPathConfig` + // 3\) `DirectPathProfileManagerDynamicDirectPathConfig` + // 4\) `DirectPathProfileManagerVirtualDeviceGroupDirectPathConfig` + DeviceConfig BaseDirectPathProfileManagerDirectPathConfig `xml:"deviceConfig,typeattr" json:"deviceConfig"` +} + +func init() { + t["DirectPathProfileInfo"] = reflect.TypeOf((*DirectPathProfileInfo)(nil)).Elem() + minAPIVersionForType["DirectPathProfileInfo"] = "9.0.0.0" +} + +// Specification for a successful capacity query result returned from +// `DirectPathProfileManager.DirectPathProfileManagerQueryCapacity`. +// +// The result object contains the +// resulting DirectPath profile and detailed capacity information. +type DirectPathProfileManagerCapacityInfo struct { + DirectPathProfileManagerCapacityResult + + // Detailed information of the DirectPath profile. + // + // See `DirectPathProfileInfo`. + Profile DirectPathProfileInfo `xml:"profile" json:"profile"` + // Number of DirectPath profile units consumed by the powered-on VMs on + // the `DirectPathProfileManagerTargetEntity`. + Consumed int32 `xml:"consumed" json:"consumed"` + // Number of DirectPath profile units that are remaining and have not yet + // been assigned to any powered-on VM on the `DirectPathProfileManagerTargetEntity`. + Remaining int32 `xml:"remaining" json:"remaining"` + // The total capacity of DirectPath profile in the `DirectPathProfileManagerTargetEntity`. + // + // The total capacity of a profile is computed in a theoretical condition + // when no VM is running on the `DirectPathProfileManagerTargetEntity`. In addition, this + // capacity doesn't include the capacity consumed by vSphere's system + // components. + Max int32 `xml:"max" json:"max"` + // Number of DirectPath profile units that are reserved but have not yet + // been assigned to any powered-on VM. + // + // These units can be used to power-on + // VMs for which the capacity has been reserved. This is different from + // remaining capacity because this capacity is actually reserved but just + // unused by any VM whereas remaining capacity indicates what has not even + // been reserved either. For any given DirectPath profile, we will always + // have the constraint: + // max >= consumed + remaining + unusedReservation + UnusedReservation int32 `xml:"unusedReservation" json:"unusedReservation"` +} + +func init() { + t["DirectPathProfileManagerCapacityInfo"] = reflect.TypeOf((*DirectPathProfileManagerCapacityInfo)(nil)).Elem() + minAPIVersionForType["DirectPathProfileManagerCapacityInfo"] = "9.0.0.0" +} + +// Specification describing device config of the DirectPath profile for +// which capacity needs to be queried using +// `DirectPathProfileManager.DirectPathProfileManagerQueryCapacity`. +type DirectPathProfileManagerCapacityQueryByDeviceConfig struct { + DirectPathProfileManagerCapacityQuerySpec + + // Device config of the DirectPath profile. + DeviceConfig BaseDirectPathProfileManagerDirectPathConfig `xml:"deviceConfig,typeattr" json:"deviceConfig"` +} + +func init() { + t["DirectPathProfileManagerCapacityQueryByDeviceConfig"] = reflect.TypeOf((*DirectPathProfileManagerCapacityQueryByDeviceConfig)(nil)).Elem() + minAPIVersionForType["DirectPathProfileManagerCapacityQueryByDeviceConfig"] = "9.0.0.0" +} + +// Specification describing id of the DirectPath profile for which capacity +// needs to be queried using `DirectPathProfileManager.DirectPathProfileManagerQueryCapacity`. +type DirectPathProfileManagerCapacityQueryById struct { + DirectPathProfileManagerCapacityQuerySpec + + // Identifier of the DirectPath profile. + Id string `xml:"id" json:"id"` +} + +func init() { + t["DirectPathProfileManagerCapacityQueryById"] = reflect.TypeOf((*DirectPathProfileManagerCapacityQueryById)(nil)).Elem() + minAPIVersionForType["DirectPathProfileManagerCapacityQueryById"] = "9.0.0.0" +} + +// Specification describing name of the DirectPath profile for which +// capacity needs to be queried using +// `DirectPathProfileManager.DirectPathProfileManagerQueryCapacity`. +type DirectPathProfileManagerCapacityQueryByName struct { + DirectPathProfileManagerCapacityQuerySpec + + // Name of the DirectPath profile. + Name string `xml:"name" json:"name"` +} + +func init() { + t["DirectPathProfileManagerCapacityQueryByName"] = reflect.TypeOf((*DirectPathProfileManagerCapacityQueryByName)(nil)).Elem() + minAPIVersionForType["DirectPathProfileManagerCapacityQueryByName"] = "9.0.0.0" +} + +// Base specification describing information about a DirectPath profile +// for which capacity needs to be queried using +// `DirectPathProfileManager.DirectPathProfileManagerQueryCapacity`. +type DirectPathProfileManagerCapacityQuerySpec struct { + DynamicData +} + +func init() { + t["DirectPathProfileManagerCapacityQuerySpec"] = reflect.TypeOf((*DirectPathProfileManagerCapacityQuerySpec)(nil)).Elem() + minAPIVersionForType["DirectPathProfileManagerCapacityQuerySpec"] = "9.0.0.0" +} + +// Base specification for capacity query result returned from +// `DirectPathProfileManager.DirectPathProfileManagerQueryCapacity`. +// +// Each of the result object +// corresponds to each of the specification described in +// `DirectPathProfileManagerCapacityQuerySpec`. +type DirectPathProfileManagerCapacityResult struct { + DynamicData +} + +func init() { + t["DirectPathProfileManagerCapacityResult"] = reflect.TypeOf((*DirectPathProfileManagerCapacityResult)(nil)).Elem() + minAPIVersionForType["DirectPathProfileManagerCapacityResult"] = "9.0.0.0" +} + +// Specification for an unsuccessful capacity query result returned from +// `DirectPathProfileManager.DirectPathProfileManagerQueryCapacity`. +// +// The result object contains +// the original query specification and detailed fault messages. +type DirectPathProfileManagerCapacityUnknown struct { + DirectPathProfileManagerCapacityResult + + // The query specification associated with the failure. + QuerySpec BaseDirectPathProfileManagerCapacityQuerySpec `xml:"querySpec,typeattr" json:"querySpec"` + // List of faults explaining why the query result is invalid. + // + // The faults + // contain the reason(s) for failure(s). + // Example of failure reasons are the DirectPath profile is not found or + // the name string is too long. + FaultList []LocalizedMethodFault `xml:"faultList,omitempty" json:"faultList,omitempty"` +} + +func init() { + t["DirectPathProfileManagerCapacityUnknown"] = reflect.TypeOf((*DirectPathProfileManagerCapacityUnknown)(nil)).Elem() + minAPIVersionForType["DirectPathProfileManagerCapacityUnknown"] = "9.0.0.0" +} + +type DirectPathProfileManagerCreate DirectPathProfileManagerCreateRequestType + +func init() { + t["DirectPathProfileManagerCreate"] = reflect.TypeOf((*DirectPathProfileManagerCreate)(nil)).Elem() +} + +// The parameters of `DirectPathProfileManager.DirectPathProfileManagerCreate`. +type DirectPathProfileManagerCreateRequestType struct { + This ManagedObjectReference `xml:"_this" json:"-"` + Spec DirectPathProfileManagerCreateSpec `xml:"spec" json:"spec"` +} + +func init() { + t["DirectPathProfileManagerCreateRequestType"] = reflect.TypeOf((*DirectPathProfileManagerCreateRequestType)(nil)).Elem() + minAPIVersionForType["DirectPathProfileManagerCreateRequestType"] = "9.0.0.0" +} + +type DirectPathProfileManagerCreateResponse struct { + Returnval string `xml:"returnval" json:"returnval"` +} + +// Specification describing the parameters used for creating a +// DirectPath profile. +type DirectPathProfileManagerCreateSpec struct { + DynamicData + + // Name of the DirectPath profile. + // + // The name should be less than or equal + // to 80 characters. + Name string `xml:"name" json:"name"` + // Description of the DirectPath profile. + // + // The description should be less + // than 256 characters. + Description string `xml:"description,omitempty" json:"description,omitempty"` + // Configuration of the DirectPath device to be represented. + // + // Since one + // DirectPath profile represents one device, the specified configuration + // can be one of the following types: + // 1\) `DirectPathProfileManagerVmiopDirectPathConfig` + // 2\) `DirectPathProfileManagerDvxDirectPathConfig` + // 3\) `DirectPathProfileManagerDynamicDirectPathConfig` + // 4\) `DirectPathProfileManagerVirtualDeviceGroupDirectPathConfig` + DeviceConfig BaseDirectPathProfileManagerDirectPathConfig `xml:"deviceConfig,typeattr" json:"deviceConfig"` +} + +func init() { + t["DirectPathProfileManagerCreateSpec"] = reflect.TypeOf((*DirectPathProfileManagerCreateSpec)(nil)).Elem() + minAPIVersionForType["DirectPathProfileManagerCreateSpec"] = "9.0.0.0" +} + +type DirectPathProfileManagerDelete DirectPathProfileManagerDeleteRequestType + +func init() { + t["DirectPathProfileManagerDelete"] = reflect.TypeOf((*DirectPathProfileManagerDelete)(nil)).Elem() +} + +// The parameters of `DirectPathProfileManager.DirectPathProfileManagerDelete`. +type DirectPathProfileManagerDeleteRequestType struct { + This ManagedObjectReference `xml:"_this" json:"-"` + // Unique identifier of the DirectPath profile to be deleted. + Id string `xml:"id" json:"id"` +} + +func init() { + t["DirectPathProfileManagerDeleteRequestType"] = reflect.TypeOf((*DirectPathProfileManagerDeleteRequestType)(nil)).Elem() + minAPIVersionForType["DirectPathProfileManagerDeleteRequestType"] = "9.0.0.0" +} + +type DirectPathProfileManagerDeleteResponse struct { +} + +// Base configuration of a DirectPath device. +// +// This contains the information +// about a DirectPath device that is needed for representing the device via +// a DirectPath profile. A DirectPath device can be of different sub-types. +// Each sub-type extends from this base configuration and further defines +// its own properties. +type DirectPathProfileManagerDirectPathConfig struct { + DynamicData +} + +func init() { + t["DirectPathProfileManagerDirectPathConfig"] = reflect.TypeOf((*DirectPathProfileManagerDirectPathConfig)(nil)).Elem() + minAPIVersionForType["DirectPathProfileManagerDirectPathConfig"] = "9.0.0.0" +} + +// Configuration of a DVX DirectPath device. +// +// This configuration represents +// the properties of a DVX device that are needed for creating a DirectPath +// profile. +type DirectPathProfileManagerDvxDirectPathConfig struct { + DirectPathProfileManagerDirectPathConfig + + // Backing that represents the information specific to a DVX device. + // + // See `VirtualPCIPassthroughDvxBackingInfo` for + // details. + DvxBacking VirtualPCIPassthroughDvxBackingInfo `xml:"dvxBacking" json:"dvxBacking"` +} + +func init() { + t["DirectPathProfileManagerDvxDirectPathConfig"] = reflect.TypeOf((*DirectPathProfileManagerDvxDirectPathConfig)(nil)).Elem() + minAPIVersionForType["DirectPathProfileManagerDvxDirectPathConfig"] = "9.0.0.0" +} + +// Configuration of a Dynamic DirectPath device. +// +// This configuration +// represents the properties of a Dynamic DirectPath device that are needed +// for creating a DirectPath profile. +type DirectPathProfileManagerDynamicDirectPathConfig struct { + DirectPathProfileManagerDirectPathConfig + + // Backing that maps a virtual device onto a physical device for a + // Dynamic DirectPath device. + // + // See `VirtualPCIPassthroughDynamicBackingInfo` for + // details. + DynamicDirectPathBacking VirtualPCIPassthroughDynamicBackingInfo `xml:"dynamicDirectPathBacking" json:"dynamicDirectPathBacking"` +} + +func init() { + t["DirectPathProfileManagerDynamicDirectPathConfig"] = reflect.TypeOf((*DirectPathProfileManagerDynamicDirectPathConfig)(nil)).Elem() + minAPIVersionForType["DirectPathProfileManagerDynamicDirectPathConfig"] = "9.0.0.0" +} + +// Specification describing the parameters used to filter the results when +// listing DirectPath profiles in a vCenter (see +// `DirectPathProfileManager.DirectPathProfileManagerList`). +// +// If multiple fields are specified, only +// the DirectPath profiles that match at least one element of each field +// match the filter. +type DirectPathProfileManagerFilterSpec struct { + DynamicData + + // Identifiers of the DirectPath profiles to be retrieved. + // + // If a non-empty + // list of identifiers is specified while listing DirectPath profiles in + // a vCenter (see `DirectPathProfileManager.DirectPathProfileManagerList`), then information about + // every DirectPath profile whose identifier matches with one of the + // specified identifiers will be retrieved. In other words, if identifier + // of a DirectPath profile is not present in the specified list of + // identifiers, then that DirectPath profile will not be retrieved. + Ids []string `xml:"ids,omitempty" json:"ids,omitempty"` + // Names of the DirectPath profiles to be retrieved. + // + // If a non-empty list + // of names is specified while listing DirectPath profiles in a vCenter + // (see `DirectPathProfileManager.DirectPathProfileManagerList`) then information about every + // DirectPath profile whose name matches with one of the specified names + // will be retrieved. In other words, if name of a DirectPath profile is + // not present in the specified list of names, then that DirectPath + // profile will not be retrieved. + Names []string `xml:"names,omitempty" json:"names,omitempty"` + // MoRefs of the vSphere clusters for which DirectPath profiles need + // to be retrieved. + // + // If a non-empty list of cluster MoRefs is specified + // while listing DirectPath profiles in a vCenter + // (see `DirectPathProfileManager.DirectPathProfileManagerList`), then information about the + // DirectPath profiles applicable to all the specified clusters is + // returned. + // + // Refers instances of `ClusterComputeResource`. + Clusters []ManagedObjectReference `xml:"clusters,omitempty" json:"clusters,omitempty"` +} + +func init() { + t["DirectPathProfileManagerFilterSpec"] = reflect.TypeOf((*DirectPathProfileManagerFilterSpec)(nil)).Elem() + minAPIVersionForType["DirectPathProfileManagerFilterSpec"] = "9.0.0.0" +} + +type DirectPathProfileManagerList DirectPathProfileManagerListRequestType + +func init() { + t["DirectPathProfileManagerList"] = reflect.TypeOf((*DirectPathProfileManagerList)(nil)).Elem() +} + +// The parameters of `DirectPathProfileManager.DirectPathProfileManagerList`. +type DirectPathProfileManagerListRequestType struct { + This ManagedObjectReference `xml:"_this" json:"-"` + FilterSpec DirectPathProfileManagerFilterSpec `xml:"filterSpec" json:"filterSpec"` +} + +func init() { + t["DirectPathProfileManagerListRequestType"] = reflect.TypeOf((*DirectPathProfileManagerListRequestType)(nil)).Elem() + minAPIVersionForType["DirectPathProfileManagerListRequestType"] = "9.0.0.0" +} + +type DirectPathProfileManagerListResponse struct { + Returnval []DirectPathProfileInfo `xml:"returnval,omitempty" json:"returnval,omitempty"` +} + +type DirectPathProfileManagerQueryCapacity DirectPathProfileManagerQueryCapacityRequestType + +func init() { + t["DirectPathProfileManagerQueryCapacity"] = reflect.TypeOf((*DirectPathProfileManagerQueryCapacity)(nil)).Elem() +} + +// The parameters of `DirectPathProfileManager.DirectPathProfileManagerQueryCapacity`. +type DirectPathProfileManagerQueryCapacityRequestType struct { + This ManagedObjectReference `xml:"_this" json:"-"` + // specifies the compute resource for which the capacity + // needs to be computed. See `DirectPathProfileManagerTargetEntity`. A null or an invalid + // target will cause an exception. + Target BaseDirectPathProfileManagerTargetEntity `xml:"target,typeattr" json:"target"` + // specifies a list of `DirectPathProfileManagerCapacityQuerySpec`, where each + // of them specifies the information about the DirectPath profile for which + // capacity needs to be computed. + QuerySpec []BaseDirectPathProfileManagerCapacityQuerySpec `xml:"querySpec,omitempty,typeattr" json:"querySpec,omitempty"` +} + +func init() { + t["DirectPathProfileManagerQueryCapacityRequestType"] = reflect.TypeOf((*DirectPathProfileManagerQueryCapacityRequestType)(nil)).Elem() + minAPIVersionForType["DirectPathProfileManagerQueryCapacityRequestType"] = "9.0.0.0" +} + +type DirectPathProfileManagerQueryCapacityResponse struct { + Returnval []BaseDirectPathProfileManagerCapacityResult `xml:"returnval,omitempty,typeattr" json:"returnval,omitempty"` +} + +// Specification of a vSphere cluster as the target entity against which the +// capacity of a DirectPath profile can be queried using +// `DirectPathProfileManager.DirectPathProfileManagerQueryCapacity`. +type DirectPathProfileManagerTargetCluster struct { + DirectPathProfileManagerTargetEntity + + // MoRef of the target vSphere cluster. + // + // Refers instance of `ClusterComputeResource`. + Cluster ManagedObjectReference `xml:"cluster" json:"cluster"` +} + +func init() { + t["DirectPathProfileManagerTargetCluster"] = reflect.TypeOf((*DirectPathProfileManagerTargetCluster)(nil)).Elem() + minAPIVersionForType["DirectPathProfileManagerTargetCluster"] = "9.0.0.0" +} + +// Base specification describing the target entity against which the +// capacity of a DirectPath profile can be queried using +// `DirectPathProfileManager.DirectPathProfileManagerQueryCapacity`. +type DirectPathProfileManagerTargetEntity struct { + DynamicData +} + +func init() { + t["DirectPathProfileManagerTargetEntity"] = reflect.TypeOf((*DirectPathProfileManagerTargetEntity)(nil)).Elem() + minAPIVersionForType["DirectPathProfileManagerTargetEntity"] = "9.0.0.0" +} + +// Specification of an ESXi host as the target entity against which the +// capacity of a DirectPath profile can be queried using +// `DirectPathProfileManager.DirectPathProfileManagerQueryCapacity`. +type DirectPathProfileManagerTargetHost struct { + DirectPathProfileManagerTargetEntity + + // MoRef of the target ESXi host. + // + // Refers instance of `HostSystem`. + Host ManagedObjectReference `xml:"host" json:"host"` +} + +func init() { + t["DirectPathProfileManagerTargetHost"] = reflect.TypeOf((*DirectPathProfileManagerTargetHost)(nil)).Elem() + minAPIVersionForType["DirectPathProfileManagerTargetHost"] = "9.0.0.0" +} + +type DirectPathProfileManagerUpdate DirectPathProfileManagerUpdateRequestType + +func init() { + t["DirectPathProfileManagerUpdate"] = reflect.TypeOf((*DirectPathProfileManagerUpdate)(nil)).Elem() +} + +// The parameters of `DirectPathProfileManager.DirectPathProfileManagerUpdate`. +type DirectPathProfileManagerUpdateRequestType struct { + This ManagedObjectReference `xml:"_this" json:"-"` + // Unique identifier of the DirectPath profile being updated. + Id string `xml:"id" json:"id"` + // Specification for the DirectPath device being updated. + Spec DirectPathProfileManagerUpdateSpec `xml:"spec" json:"spec"` +} + +func init() { + t["DirectPathProfileManagerUpdateRequestType"] = reflect.TypeOf((*DirectPathProfileManagerUpdateRequestType)(nil)).Elem() + minAPIVersionForType["DirectPathProfileManagerUpdateRequestType"] = "9.0.0.0" +} + +type DirectPathProfileManagerUpdateResponse struct { +} + +// Specification describing the parameters used for updating an already +// existing DirectPath profile. +// +// Once a DirectPath profile has been created, +// its `DirectPathProfileManagerDirectPathConfig` cannot be updated. +type DirectPathProfileManagerUpdateSpec struct { + DynamicData + + // The desired name of the DirectPath profile being updated. + // + // The name + // should be less than or equal to 80 characters. + Name string `xml:"name,omitempty" json:"name,omitempty"` + // The desired description of the DirectPath profile being updated. + // + // The + // description should be less than 256 characters. + Description string `xml:"description,omitempty" json:"description,omitempty"` +} + +func init() { + t["DirectPathProfileManagerUpdateSpec"] = reflect.TypeOf((*DirectPathProfileManagerUpdateSpec)(nil)).Elem() + minAPIVersionForType["DirectPathProfileManagerUpdateSpec"] = "9.0.0.0" +} + +// Configuration of a Vendor Device Group. +// +// This configuration represents the +// the properties of a Vendor Device Group that are needed for creating a +// DirectPath profile. +// Vendor Device Groups allow third-parties to define collections of +// devices that must be allocated to a virtual machine as a unit. Typically, +// this is because the set of devices are related in some way, e.g. a +// physical link connects the devices. +type DirectPathProfileManagerVirtualDeviceGroupDirectPathConfig struct { + DirectPathProfileManagerDirectPathConfig + + // Name of the Vendor Device Group. + DeviceGroupName string `xml:"deviceGroupName" json:"deviceGroupName"` +} + +func init() { + t["DirectPathProfileManagerVirtualDeviceGroupDirectPathConfig"] = reflect.TypeOf((*DirectPathProfileManagerVirtualDeviceGroupDirectPathConfig)(nil)).Elem() + minAPIVersionForType["DirectPathProfileManagerVirtualDeviceGroupDirectPathConfig"] = "9.0.0.0" +} + +// Configuration of a VMIOP DirectPath device. +// +// This configuration represents +// the properties of a VMIOP device that are needed for creating a DirectPath +// profile. At present, vGPUs are the only devices implemented using VMIOP +// interface. +type DirectPathProfileManagerVmiopDirectPathConfig struct { + DirectPathProfileManagerDirectPathConfig + + // The name of vGPU configuration type exposed by a VMIOP plugin. + VgpuProfile string `xml:"vgpuProfile" json:"vgpuProfile"` +} + +func init() { + t["DirectPathProfileManagerVmiopDirectPathConfig"] = reflect.TypeOf((*DirectPathProfileManagerVmiopDirectPathConfig)(nil)).Elem() + minAPIVersionForType["DirectPathProfileManagerVmiopDirectPathConfig"] = "9.0.0.0" +} + // This fault is thrown when an operation fails because the specified // directory is not empty. type DirectoryNotEmpty struct { @@ -22967,6 +23730,24 @@ func init() { type DisableMultipathPathResponse struct { } +type DisableNetworkBootRequestType struct { + This ManagedObjectReference `xml:"_this" json:"-"` +} + +func init() { + t["DisableNetworkBootRequestType"] = reflect.TypeOf((*DisableNetworkBootRequestType)(nil)).Elem() +} + +type DisableNetworkBoot_Task DisableNetworkBootRequestType + +func init() { + t["DisableNetworkBoot_Task"] = reflect.TypeOf((*DisableNetworkBoot_Task)(nil)).Elem() +} + +type DisableNetworkBoot_TaskResponse struct { + Returnval ManagedObjectReference `xml:"returnval" json:"returnval"` +} + type DisableRuleset DisableRulesetRequestType func init() { @@ -23574,6 +24355,8 @@ type DistributedVirtualPortgroupInfo struct { LogicalSwitchUuid string `xml:"logicalSwitchUuid,omitempty" json:"logicalSwitchUuid,omitempty"` // The segment ID of logical switch, which is used by NSX portroup SegmentId string `xml:"segmentId,omitempty" json:"segmentId,omitempty"` + // The subnet ID of logical switch + SubnetId string `xml:"subnetId,omitempty" json:"subnetId,omitempty" vim:"9.0.0.0"` } func init() { @@ -26867,6 +27650,27 @@ func init() { type EnableMultipathPathResponse struct { } +// The parameters of `ComputeResource.EnableNetworkBoot_Task`. +type EnableNetworkBootRequestType struct { + This ManagedObjectReference `xml:"_this" json:"-"` + NetworkBootMode string `xml:"networkBootMode" json:"networkBootMode"` +} + +func init() { + t["EnableNetworkBootRequestType"] = reflect.TypeOf((*EnableNetworkBootRequestType)(nil)).Elem() + minAPIVersionForType["EnableNetworkBootRequestType"] = "9.0.0.0" +} + +type EnableNetworkBoot_Task EnableNetworkBootRequestType + +func init() { + t["EnableNetworkBoot_Task"] = reflect.TypeOf((*EnableNetworkBoot_Task)(nil)).Elem() +} + +type EnableNetworkBoot_TaskResponse struct { + Returnval ManagedObjectReference `xml:"returnval" json:"returnval"` +} + type EnableNetworkResourceManagement EnableNetworkResourceManagementRequestType func init() { @@ -27862,6 +28666,41 @@ func init() { t["EventFilterSpecByUsername"] = reflect.TypeOf((*EventFilterSpecByUsername)(nil)).Elem() } +// BaseClass allowing different views on filtered set. +type EventManagerEventViewSpec struct { + DynamicData +} + +func init() { + t["EventManagerEventViewSpec"] = reflect.TypeOf((*EventManagerEventViewSpec)(nil)).Elem() + minAPIVersionForType["EventManagerEventViewSpec"] = "9.0.0.0" +} + +// Defines the view parameters with starting event ID for the event query. +type EventManagerViewByStartId struct { + EventManagerEventViewSpec + + // An integer value specifying the ID of the event from which to start + // the query. + // + // Must be >= 0. The maximum event ID is defined by + // "config.vpxd.event.maxEventId" advanced vCenter configuration option + // which has a default value of 2147480000. + StartEventId int32 `xml:"startEventId" json:"startEventId"` + // A boolean flag indicating the direction of the query. + // + // If true, the query retrieves events with IDs greater than + // startEventId, representing newer events. + // If false, the query retrieves events with IDs less than + // startEventId, representing older events. + IsForward bool `xml:"isForward" json:"isForward"` +} + +func init() { + t["EventManagerViewByStartId"] = reflect.TypeOf((*EventManagerViewByStartId)(nil)).Elem() + minAPIVersionForType["EventManagerViewByStartId"] = "9.0.0.0" +} + type ExecuteHostProfile ExecuteHostProfileRequestType func init() { @@ -29716,6 +30555,12 @@ type FileBackedVirtualDiskSpec struct { Profile []BaseVirtualMachineProfileSpec `xml:"profile,omitempty,typeattr" json:"profile,omitempty"` // Encryption options for the new virtual disk. Crypto BaseCryptoSpec `xml:"crypto,omitempty,typeattr" json:"crypto,omitempty"` + // Optional sector format. + // + // If not specified, an appropriate default format will be choosen by + // the storage system. If available, native\_512 is preferred. + // For the list of supported values, see `DatastoreSectorFormat_enum`. + SectorFormat string `xml:"sectorFormat,omitempty" json:"sectorFormat,omitempty" vim:"9.0.0.0"` } func init() { @@ -30470,6 +31315,23 @@ func init() { t["FolderEventArgument"] = reflect.TypeOf((*FolderEventArgument)(nil)).Elem() } +// Information of externally managed folder. +type FolderExternallyManagedFolderInfo struct { + DynamicData + + // The ID of the folder in the external system. + Id string `xml:"id" json:"id"` + // The type of the externally managed folder. + // + // See `FolderExternallyManagedFolderType_enum` for supported values. + Type string `xml:"type" json:"type"` +} + +func init() { + t["FolderExternallyManagedFolderInfo"] = reflect.TypeOf((*FolderExternallyManagedFolderInfo)(nil)).Elem() + minAPIVersionForType["FolderExternallyManagedFolderInfo"] = "9.0.0.0" +} + type FolderFailedHostResult struct { DynamicData @@ -31087,6 +31949,10 @@ type GenerateKeyRequestType struct { KeyProvider *KeyProviderId `xml:"keyProvider,omitempty" json:"keyProvider,omitempty"` // \[in\] The spec that contains custom attributes key/value pairs. Spec *CryptoManagerKmipCustomAttributeSpec `xml:"spec,omitempty" json:"spec,omitempty" vim:"8.0.1.0"` + // \[in\] The keySpec that contains key generation options. + // If unset, key will be generated with default settings + // of the key provider. + KeySpec *CryptoManagerKmipGenerateKeySpec `xml:"keySpec,omitempty" json:"keySpec,omitempty" vim:"9.0.0.0"` } func init() { @@ -33125,6 +33991,52 @@ func init() { t["HbrManagerVmReplicationCapability"] = reflect.TypeOf((*HbrManagerVmReplicationCapability)(nil)).Elem() } +// The base data type for all different spec operations. +type HbrReplicationTargetSpec struct { + DynamicData +} + +func init() { + t["HbrReplicationTargetSpec"] = reflect.TypeOf((*HbrReplicationTargetSpec)(nil)).Elem() + minAPIVersionForType["HbrReplicationTargetSpec"] = "9.0.0.0" +} + +// TargetSpec represents the settings of remote target on source host. +type HbrTargetSpec struct { + DynamicData + + // The replication target IP address. + TargetIP string `xml:"targetIP" json:"targetIP"` + // The target PEM-encoded certificate. + Certificate string `xml:"certificate" json:"certificate"` +} + +func init() { + t["HbrTargetSpec"] = reflect.TypeOf((*HbrTargetSpec)(nil)).Elem() + minAPIVersionForType["HbrTargetSpec"] = "9.0.0.0" +} + +// Defines replace-all specs on source host operation. +// +// This operation will +// remove all existing specs and will replace them with new ones. +// If specs is empty array, all existing specs will be removed and nothing new +// will be added. +type HbrTargetSpecReplacement struct { + HbrReplicationTargetSpec + + // Array of all new targets. + // + // If this is empty array, nothing new will be + // configured and all existing ones will be deleted. + Spec []HbrTargetSpec `xml:"spec,omitempty" json:"spec,omitempty"` +} + +func init() { + t["HbrTargetSpecReplacement"] = reflect.TypeOf((*HbrTargetSpecReplacement)(nil)).Elem() + minAPIVersionForType["HbrTargetSpecReplacement"] = "9.0.0.0" +} + // Event used to report change in health status of VirtualCenter components. type HealthStatusChangedEvent struct { Event @@ -33597,6 +34509,31 @@ func init() { t["HostAssignableHardwareConfigAttributeOverride"] = reflect.TypeOf((*HostAssignableHardwareConfigAttributeOverride)(nil)).Elem() } +// Authentication information for a host managed by a vCenter +// Server or a vCenter extension to login into other hosts without +// username/password authentication. +type HostAuthenticationInfo struct { + DynamicData + + // The principal used for the login session + Principal string `xml:"principal" json:"principal"` + // The tag associated with this registration. + // + // Owner tags allow + // multiple entities to register the same certificate without + // interfering with each other on the life cycle of the certificate with + // their unique tags. + // Each solution must use a unique tag to identify itself. + OwnerTag string `xml:"ownerTag" json:"ownerTag"` + // Specify the PEM-encoded SSL certificate to register on the host. + SslCertificates []string `xml:"sslCertificates,omitempty" json:"sslCertificates,omitempty"` +} + +func init() { + t["HostAuthenticationInfo"] = reflect.TypeOf((*HostAuthenticationInfo)(nil)).Elem() + minAPIVersionForType["HostAuthenticationInfo"] = "9.0.0.0" +} + // The `HostAuthenticationManagerInfo` data object provides // access to authentication information for the ESX host. type HostAuthenticationManagerInfo struct { @@ -34397,6 +35334,10 @@ type HostCapability struct { VmknicBindingOnNFSv41 *bool `xml:"vmknicBindingOnNFSv41" json:"vmknicBindingOnNFSv41,omitempty" vim:"8.0.3.0"` // Indicates whether VasaProvider Status can be monitored on the host. VpStatusCheckSupported *bool `xml:"vpStatusCheckSupported" json:"vpStatusCheckSupported,omitempty" vim:"8.0.3.0"` + // Indicates whether E2E 4KN capability is supported on the host. + E2e4knSupported *bool `xml:"e2e4knSupported" json:"e2e4knSupported,omitempty" vim:"9.0.0.0"` + // Indicates whether vSAN external vmknic configuration is supported on the host. + VsanDedicatedVmkNicSupported *bool `xml:"vsanDedicatedVmkNicSupported" json:"vsanDedicatedVmkNicSupported,omitempty" vim:"9.0.0.0"` // Indicates whether NFS41 NCONNECT is supported on this host. NConnectSupported *bool `xml:"nConnectSupported" json:"nConnectSupported,omitempty" vim:"8.0.3.0"` // Indicates whether user-provided private key installation is supported on this host. @@ -34410,6 +35351,18 @@ type HostCapability struct { // time UEFI Secure Boot state and its complete configuration. An // out-of-band management channel may also be considered. UefiSecureBoot *bool `xml:"uefiSecureBoot" json:"uefiSecureBoot,omitempty" vim:"8.0.3.0"` + // Indicates whether this host can populate and consume + // `VirtualMachineConfigInfo.vmxRuntimeConfig` property. + VpxdVmxGenerationSupported *bool `xml:"vpxdVmxGenerationSupported" json:"vpxdVmxGenerationSupported,omitempty" vim:"9.0.0.0"` + // Indicates whether this host supports NFS41 + // encryption using KRB5P protocol. + Nfs41Krb5pSupported *bool `xml:"nfs41Krb5pSupported" json:"nfs41Krb5pSupported,omitempty" vim:"9.0.0.0"` + // Indicates whether this host supports CIM + CimSupported *bool `xml:"cimSupported" json:"cimSupported,omitempty" vim:"9.0.0.0"` + // Indicate whether this host supports NPIV + NpivSupported *bool `xml:"npivSupported" json:"npivSupported,omitempty" vim:"9.0.0.0"` + // Indicates whether this host supports license entitlements + EntitlementSupported *bool `xml:"entitlementSupported" json:"entitlementSupported,omitempty" vim:"9.0.0.0"` } func init() { @@ -34450,6 +35403,11 @@ type HostCertificateManagerCertificateSpec struct { // The list of supported values can be found in `HostCertificateManagerCertificateKind_enum` Kind string `xml:"kind" json:"kind"` + // List of subject alternative names to be included in the certificate. + // + // May contain both DNS names and IP addresses. + // If unset, the certificate will contain only its CN as a SAN. + SubjectAlternativeNames []string `xml:"subjectAlternativeNames,omitempty" json:"subjectAlternativeNames,omitempty" vim:"9.0.0.0"` } func init() { @@ -34872,6 +35830,8 @@ type HostConfigInfo struct { SslThumbprintInfo *HostSslThumbprintInfo `xml:"sslThumbprintInfo,omitempty" json:"sslThumbprintInfo,omitempty"` // SSL Thumbprints registered on this host. SslThumbprintData []HostSslThumbprintInfo `xml:"sslThumbprintData,omitempty" json:"sslThumbprintData,omitempty"` + // Authentication info registered on this host. + AuthenticationData []HostAuthenticationInfo `xml:"authenticationData,omitempty" json:"authenticationData,omitempty" vim:"9.0.0.0"` // Full Host Certificate in PEM format, if known Certificate ByteSlice `xml:"certificate,omitempty" json:"certificate,omitempty"` // PCI passthrough information. @@ -35191,6 +36151,11 @@ type HostConfigSummary struct { Port int32 `xml:"port" json:"port"` // The SSL thumbprint of the host, if known. SslThumbprint string `xml:"sslThumbprint,omitempty" json:"sslThumbprint,omitempty"` + // The SSL certificate of the host, if known. + // + // Note: `HostConfigSummary.sslThumbprint` and `HostConfigSummary.sslCertificate` parameters are + // mutually exclusive, and should never be used simultaneously. + SslCertificate string `xml:"sslCertificate,omitempty" json:"sslCertificate,omitempty" vim:"9.0.0.0"` // Information about the software running on the host, if known. // // The current supported hosts are ESX Server 2.0.1 (and later) and VMware Server @@ -35378,6 +36343,14 @@ type HostConnectSpec struct { // xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx // where, 'x' represents a hexadecimal digit SslThumbprint string `xml:"sslThumbprint,omitempty" json:"sslThumbprint,omitempty"` + // The expected SSL certificate of the host in PEM format. + // + // This value is a fallback to be used when the certificate provided + // by the host can not be verified via a trusted CA. A replacement of + // `HostConnectSpec.sslThumbprint`. + // Note: `HostConnectSpec.sslThumbprint` and `HostConnectSpec.sslCertificate` parameters are + // mutually exclusive, and should never be used simultaneously. + SslCertificate string `xml:"sslCertificate,omitempty" json:"sslCertificate,omitempty" vim:"9.0.0.0"` // The administration account on the host. // // (Required for adding @@ -36677,10 +37650,15 @@ type HostDiskPartitionSpec struct { Chs *HostDiskDimensionsChs `xml:"chs,omitempty" json:"chs,omitempty"` // Disk dimensions expressed as a total number of sectors. // - // For sector size, see the `sectorSize` field. + // For sector size, see the `HostDiskPartitionSpec.sectorSize` field. TotalSectors int64 `xml:"totalSectors,omitempty" json:"totalSectors,omitempty"` // List of partitions on the disk. Partition []HostDiskPartitionAttributes `xml:"partition,omitempty" json:"partition,omitempty"` + // The sector size in bytes. + // + // The typical values are 512 and 4096. + // If unset, the value should be considered 512. + SectorSize int32 `xml:"sectorSize,omitempty" json:"sectorSize,omitempty" vim:"9.0.0.0"` } func init() { @@ -37643,6 +38621,8 @@ type HostHardwareInfo struct { // order of tiers (ie, tier 0 at array index 0, tier 1 at array index 1, // and so on). MemoryTierInfo []HostMemoryTierInfo `xml:"memoryTierInfo,omitempty" json:"memoryTierInfo,omitempty" vim:"7.0.3.0"` + // TDX (Trust Domain Extensions) configuration on this host. + TdxInfo *HostTdxInfo `xml:"tdxInfo,omitempty" json:"tdxInfo,omitempty" vim:"9.0.0.0"` } func init() { @@ -37676,6 +38656,8 @@ type HostHardwareSummary struct { Vendor string `xml:"vendor" json:"vendor"` // The system model identification. Model string `xml:"model" json:"model"` + // The system family identification. + Family string `xml:"family,omitempty" json:"family,omitempty" vim:"9.0.0.0"` // The hardware BIOS identification. Uuid string `xml:"uuid" json:"uuid"` // Other identification information. @@ -38557,6 +39539,9 @@ func init() { } // Information about an IO Filter installed on a host. +// +// On vLCM managed cluster, this contains information +// about iofilter at agent level. type HostIoFilterInfo struct { IoFilterInfo @@ -39568,10 +40553,14 @@ type HostMountInfo struct { // If the datastore becomes accessible following an inaccessible condition, // the property `HostMountInfo.inaccessibleReason` will be unset. InaccessibleReason string `xml:"inaccessibleReason,omitempty" json:"inaccessibleReason,omitempty"` - // The name of the vmknic used during mount. + // The name of the vmknic used during mount for NFSv3 datstore. // // Populated by the vmk control layer if the NAS // volume is mounted successfully with a vmknic binding. + // In case of NFS v4.1, if vmknic binding is enabled successfully, + // then output will be in format {hostip1:vmknic1, hostip2:vmknic2}. + // If vmknic binding is not enabled, then vmknicName + // will have 'None' string. VmknicName string `xml:"vmknicName,omitempty" json:"vmknicName,omitempty" vim:"8.0.1.0"` // Indicates whether vmknic is active or inactive. // @@ -40340,6 +41329,12 @@ type HostNetStackInstance struct { // This property is not supported currently. IpV6Enabled *bool `xml:"ipV6Enabled" json:"ipV6Enabled,omitempty"` RouteTableConfig *HostIpRouteTableConfig `xml:"routeTableConfig,omitempty" json:"routeTableConfig,omitempty"` + // Owner of this stack instance. + // + // It is only valid for showing system + // net stack instance. The unset means not owned by the system. + // See `HostConfigChangeOwner_enum` for supported values. + Owner string `xml:"owner,omitempty" json:"owner,omitempty" vim:"9.0.0.0"` } func init() { @@ -41949,6 +42944,10 @@ type HostPciDevice struct { Bus byte `xml:"bus" json:"bus"` // The slot ID of this PCI. Slot byte `xml:"slot" json:"slot"` + // The physical slot of this PCI device + PhysicalSlot int32 `xml:"physicalSlot,omitempty" json:"physicalSlot,omitempty" vim:"9.0.0.0"` + // The slot description + SlotDescription string `xml:"slotDescription,omitempty" json:"slotDescription,omitempty" vim:"9.0.0.0"` // The function ID of this PCI. Function byte `xml:"function" json:"function"` // The vendor ID of this PCI. @@ -43374,6 +44373,11 @@ type HostReconcileDatastoreInventoryRequestType struct { // // Refers instance of `Datastore`. Datastore ManagedObjectReference `xml:"datastore" json:"datastore"` + // If set true, the reconcile task will check for the + // extent files and the disk descriptor file content + // as part of reconciliation. Note that this is a time + // consuming process. + DeepCleansing *bool `xml:"deepCleansing" json:"deepCleansing,omitempty" vim:"9.0.0.0"` } func init() { @@ -43857,6 +44861,11 @@ type HostScheduleReconcileDatastoreInventoryRequestType struct { // // Refers instance of `Datastore`. Datastore ManagedObjectReference `xml:"datastore" json:"datastore"` + // If set true, the reconcile task will check for the + // extent files and the disk descriptor file content + // as part of reconciliation. Note that this is a time + // consuming process. + DeepCleansing *bool `xml:"deepCleansing" json:"deepCleansing,omitempty" vim:"9.0.0.0"` } func init() { @@ -44186,6 +45195,11 @@ type HostServiceTicket struct { // The expected thumbprint of the SSL cert of the host to which // we are connecting. SslThumbprint string `xml:"sslThumbprint,omitempty" json:"sslThumbprint,omitempty"` + // PEM-encoded SSL certificate of the host to which we are connecting. + // + // Note: `HostServiceTicket.sslThumbprint` and `HostServiceTicket.sslCertificate` parameters are + // mutually exclusive, and should never be used simultaneously. + SslCertificate string `xml:"sslCertificate,omitempty" json:"sslCertificate,omitempty" vim:"9.0.0.0"` // The name of the service to which to connect. Service string `xml:"service" json:"service"` // A dot-separated string identifying the service protocol version. @@ -44291,6 +45305,13 @@ type HostSevInfo struct { SevState string `xml:"sevState" json:"sevState"` // The maximum number of SEV-ES and SEV-SNP guests supported on this host. MaxSevEsGuests int64 `xml:"maxSevEsGuests" json:"maxSevEsGuests"` + // State of SEV-SNP (SEV Secure Nested Paging) on the host. + // + // The supported + // values are described in `HostSevInfoSevState_enum`. + SnpState string `xml:"snpState,omitempty" json:"snpState,omitempty" vim:"9.0.0.0"` + // SEV-SNP (SEV Secure Nested Paging) supported + SnpSupported *bool `xml:"snpSupported" json:"snpSupported,omitempty" vim:"9.0.0.0"` } func init() { @@ -44982,6 +46003,8 @@ type HostSystemInfo struct { Vendor string `xml:"vendor" json:"vendor"` // System model identification. Model string `xml:"model" json:"model"` + // System family identification. + Family string `xml:"family,omitempty" json:"family,omitempty" vim:"9.0.0.0"` // Hardware BIOS identification. Uuid string `xml:"uuid" json:"uuid"` // Other System identification information. @@ -45232,6 +46255,25 @@ func init() { minAPIVersionForType["HostTcpTargetTransport"] = "7.0.3.0" } +// Data object describing the TDX (Trust Domain Extensions) configuration +// on the ESXi host. +type HostTdxInfo struct { + DynamicData + + // State of TDX on the host. + // + // The supported values are described in + // `HostTdxInfoTdxState_enum`. + TdxState string `xml:"tdxState" json:"tdxState"` + // The number of TDX private key IDs on this host. + NumTDXPrivateKeyIDs int32 `xml:"numTDXPrivateKeyIDs" json:"numTDXPrivateKeyIDs"` +} + +func init() { + t["HostTdxInfo"] = reflect.TypeOf((*HostTdxInfo)(nil)).Elem() + minAPIVersionForType["HostTdxInfo"] = "9.0.0.0" +} + // This data object type represents result of TPM attestation. type HostTpmAttestationInfo struct { DynamicData @@ -46347,6 +47389,12 @@ type HostVirtualNic struct { // If the Virtual NIC is connected to // DistributedVirtualSwitch or opaque network, this property is unset. Port string `xml:"port,omitempty" json:"port,omitempty"` + // Owner of vmknic. + // + // It is only valid for system vmknic. The unset means + // not owned by the system. + // See `HostConfigChangeOwner_enum` for supported values. + Owner string `xml:"owner,omitempty" json:"owner,omitempty" vim:"9.0.0.0"` } func init() { @@ -47366,6 +48414,8 @@ type HttpNfcLeaseDeviceUrl struct { // Empty if no SSL thumbprint // is available or needed. SslThumbprint string `xml:"sslThumbprint" json:"sslThumbprint"` + // PEM encoded SSL Certificate of the host + SslCertificate string `xml:"sslCertificate,omitempty" json:"sslCertificate,omitempty" vim:"9.0.0.0"` // Optional value to specify if the attached file is a disk in // vmdk format. Disk *bool `xml:"disk" json:"disk,omitempty"` @@ -47646,6 +48696,11 @@ type HttpNfcLeaseSourceFile struct { // Client should verify the server certificate and provide // certificate thumbprint here. SslThumbprint string `xml:"sslThumbprint,omitempty" json:"sslThumbprint,omitempty"` + // PEM encoded SSL Certificate of the source server. + // + // Note: `HttpNfcLeaseSourceFile.sslThumbprint` and `HttpNfcLeaseSourceFile.sslCertificate` parameters are + // mutually exclusive, and should never be used simultaneously. + SslCertificate string `xml:"sslCertificate,omitempty" json:"sslCertificate,omitempty" vim:"9.0.0.0"` // For the case when remote server requires authentication or any other // type of custom HTTP headers be provided with the request. HttpHeaders []KeyValue `xml:"httpHeaders,omitempty" json:"httpHeaders,omitempty"` @@ -48373,6 +49428,30 @@ type InitiateFileTransferToGuestResponse struct { Returnval string `xml:"returnval" json:"returnval"` } +// The parameters of `IoFilterManager.InitiateTransitionToVLCM_Task`. +type InitiateTransitionToVLCMRequestType struct { + This ManagedObjectReference `xml:"_this" json:"-"` + // The cluster. + // + // Refers instance of `ClusterComputeResource`. + Cluster ManagedObjectReference `xml:"cluster" json:"cluster"` +} + +func init() { + t["InitiateTransitionToVLCMRequestType"] = reflect.TypeOf((*InitiateTransitionToVLCMRequestType)(nil)).Elem() + minAPIVersionForType["InitiateTransitionToVLCMRequestType"] = "9.0.0.0" +} + +type InitiateTransitionToVLCM_Task InitiateTransitionToVLCMRequestType + +func init() { + t["InitiateTransitionToVLCM_Task"] = reflect.TypeOf((*InitiateTransitionToVLCM_Task)(nil)).Elem() +} + +type InitiateTransitionToVLCM_TaskResponse struct { + Returnval ManagedObjectReference `xml:"returnval" json:"returnval"` +} + // The parameters of `HostPatchManager.InstallHostPatch_Task`. type InstallHostPatchRequestType struct { This ManagedObjectReference `xml:"_this" json:"-"` @@ -50380,6 +51459,29 @@ type IsClusteredVmdkEnabledResponse struct { Returnval bool `xml:"returnval" json:"returnval"` } +type IsGuestOsCustomizable IsGuestOsCustomizableRequestType + +func init() { + t["IsGuestOsCustomizable"] = reflect.TypeOf((*IsGuestOsCustomizable)(nil)).Elem() +} + +// The parameters of `CustomizationSpecManager.IsGuestOsCustomizable`. +type IsGuestOsCustomizableRequestType struct { + This ManagedObjectReference `xml:"_this" json:"-"` + // Short name from the guest OS descriptor list describing the + // OS we intend to check. + GuestId string `xml:"guestId" json:"guestId"` +} + +func init() { + t["IsGuestOsCustomizableRequestType"] = reflect.TypeOf((*IsGuestOsCustomizableRequestType)(nil)).Elem() + minAPIVersionForType["IsGuestOsCustomizableRequestType"] = "9.0.0.0" +} + +type IsGuestOsCustomizableResponse struct { + Returnval bool `xml:"returnval" json:"returnval"` +} + type IsKmsClusterActive IsKmsClusterActiveRequestType func init() { @@ -51002,12 +52104,60 @@ type KmipClusterInfo struct { HasBackup *bool `xml:"hasBackup" json:"hasBackup,omitempty" vim:"7.0.2.0"` TpmRequired *bool `xml:"tpmRequired" json:"tpmRequired,omitempty" vim:"7.0.2.0"` KeyId string `xml:"keyId,omitempty" json:"keyId,omitempty" vim:"7.0.2.0"` + // Key type which the key provider generates by default. + // + // See `KmipClusterInfoKeyType_enum` for supported values. + DefaultKeyType string `xml:"defaultKeyType,omitempty" json:"defaultKeyType,omitempty" vim:"9.0.0.0"` + // Key information. + KeyInfo BaseKmipClusterInfoKeyInfo `xml:"keyInfo,omitempty,typeattr" json:"keyInfo,omitempty" vim:"9.0.0.0"` } func init() { t["KmipClusterInfo"] = reflect.TypeOf((*KmipClusterInfo)(nil)).Elem() } +// Base class of key information. +type KmipClusterInfoKeyInfo struct { + DynamicData +} + +func init() { + t["KmipClusterInfoKeyInfo"] = reflect.TypeOf((*KmipClusterInfoKeyInfo)(nil)).Elem() + minAPIVersionForType["KmipClusterInfoKeyInfo"] = "9.0.0.0" +} + +// Wrapping key ID key information. +type KmipClusterInfoWrappingKeyIdKeyInfo struct { + KmipClusterInfoKeyInfo + + // Wrapping key identifier. + KeyId string `xml:"keyId" json:"keyId"` + // The time when `KmipClusterInfoWrappingKeyIdKeyInfo.keyId` was set as the wrapping key ID. + ConfiguredTime time.Time `xml:"configuredTime" json:"configuredTime"` +} + +func init() { + t["KmipClusterInfoWrappingKeyIdKeyInfo"] = reflect.TypeOf((*KmipClusterInfoWrappingKeyIdKeyInfo)(nil)).Elem() + minAPIVersionForType["KmipClusterInfoWrappingKeyIdKeyInfo"] = "9.0.0.0" +} + +// Wrapping rotation interval key information. +type KmipClusterInfoWrappingRotationIntervalKeyInfo struct { + KmipClusterInfoKeyInfo + + // Wrapping key identifier. + KeyId string `xml:"keyId,omitempty" json:"keyId,omitempty"` + // Wrapping key rotation interval (number of days). + RotationInterval int32 `xml:"rotationInterval,omitempty" json:"rotationInterval,omitempty"` + // Last wrapping key rotation timestamp. + LastRotation *time.Time `xml:"lastRotation" json:"lastRotation,omitempty"` +} + +func init() { + t["KmipClusterInfoWrappingRotationIntervalKeyInfo"] = reflect.TypeOf((*KmipClusterInfoWrappingRotationIntervalKeyInfo)(nil)).Elem() + minAPIVersionForType["KmipClusterInfoWrappingRotationIntervalKeyInfo"] = "9.0.0.0" +} + // Data Object representing a KMIP server connection information. type KmipServerInfo struct { DynamicData @@ -51068,12 +52218,64 @@ type KmipServerSpec struct { // // Set value to empty string to delete the entry. Password string `xml:"password,omitempty" json:"password,omitempty"` + // Key type which the key provider generates by default. + // + // See `KmipClusterInfoKeyType_enum` for supported values. + DefaultKeyType string `xml:"defaultKeyType,omitempty" json:"defaultKeyType,omitempty" vim:"9.0.0.0"` + // Specification of key. + KeySpec BaseKmipServerSpecKeySpec `xml:"keySpec,omitempty,typeattr" json:"keySpec,omitempty" vim:"9.0.0.0"` } func init() { t["KmipServerSpec"] = reflect.TypeOf((*KmipServerSpec)(nil)).Elem() } +// Base class of key specification. +type KmipServerSpecKeySpec struct { + DynamicData +} + +func init() { + t["KmipServerSpecKeySpec"] = reflect.TypeOf((*KmipServerSpecKeySpec)(nil)).Elem() + minAPIVersionForType["KmipServerSpecKeySpec"] = "9.0.0.0" +} + +// Wrapping key ID key specification. +// +// Key rotation will not occur automatically when a client +// specified key ID is used. +type KmipServerSpecWrappingKeyIdKeySpec struct { + KmipServerSpecKeySpec + + // Wrapping key identifier. + KeyId string `xml:"keyId" json:"keyId"` +} + +func init() { + t["KmipServerSpecWrappingKeyIdKeySpec"] = reflect.TypeOf((*KmipServerSpecWrappingKeyIdKeySpec)(nil)).Elem() + minAPIVersionForType["KmipServerSpecWrappingKeyIdKeySpec"] = "9.0.0.0" +} + +// Wrapping rotation interval key specification. +// +// The wrapping key will be created automatically and will rotate +// automatically based on the rotation interval. +type KmipServerSpecWrappingRotationIntervalKeySpec struct { + KmipServerSpecKeySpec + + // Wrapping key regular rotation interval (number of days). + // + // The allowed minimum number of days is 30 days, + // and maximum number of days is 3650 days. + // If not set, then a system default number of days will be used. + RotationInterval int32 `xml:"rotationInterval,omitempty" json:"rotationInterval,omitempty"` +} + +func init() { + t["KmipServerSpecWrappingRotationIntervalKeySpec"] = reflect.TypeOf((*KmipServerSpecWrappingRotationIntervalKeySpec)(nil)).Elem() + minAPIVersionForType["KmipServerSpecWrappingRotationIntervalKeySpec"] = "9.0.0.0" +} + // Data Object representing a KMIP server status. type KmipServerStatus struct { DynamicData @@ -58257,6 +59459,21 @@ func init() { t["OvfCreateImportSpecResult"] = reflect.TypeOf((*OvfCreateImportSpecResult)(nil)).Elem() } +// A DatastoreMapping is a choice made by the caller about which datastore to +// use for a specific disk in the OVF descriptor as specified by "ovf:diskId". +type OvfDatastoreMapping struct { + DynamicData + + DiskId string `xml:"diskId" json:"diskId"` + // Refers instance of `Datastore`. + Datastore ManagedObjectReference `xml:"datastore" json:"datastore"` +} + +func init() { + t["OvfDatastoreMapping"] = reflect.TypeOf((*OvfDatastoreMapping)(nil)).Elem() + minAPIVersionForType["OvfDatastoreMapping"] = "9.0.0.0" +} + // A deployment option as defined in the OVF specfication. // // This corresponds to the Configuration element of the DeploymentOptionSection in the @@ -58764,6 +59981,64 @@ func init() { t["OvfImportFault"] = reflect.TypeOf((*OvfImportFault)(nil)).Elem() } +// Custom parameters used while deploying an OVF. +type OvfImportParams struct { + OvfCreateImportSpecParams + + // Use Push mode for transferring VM files to ESX. + // + // Push mode transfers + // files from client to ESXi, whereas in Pull mode ESX "pulls" the files + // directly from source. This flag only applies to vCenter as ESXi + // can only pull directly if `OvfManager.DeployVm_Task` is invoked + // on ESX itself. + // See (@link vim.HttpNfcLease#pullFromUrls) for more on Pull mode. + // The default/Default: false + PushMode *bool `xml:"pushMode" json:"pushMode,omitempty"` + // Require that the OVF package has a signed certificate and manifest + // and both match. + // + // See also manifest validation. + // Default is false. + SignatureRequired *bool `xml:"signatureRequired" json:"signatureRequired,omitempty"` + // If a manifest file is present in the OVF package the format is checked. + // + // Also all file SHA entries are validated against SHA of read files. If + // value is true and manifest file is present a warning is generated. + // Default is false. + SkipManifestCheck *bool `xml:"skipManifestCheck" json:"skipManifestCheck,omitempty"` + // Whether to power on the deployed entity. + // + // Note for ESX and Virtual Machine deployment: In order to customize + // GuestOS on a deployed Virtual Machine we require that the + // powerOn flag must be true. GuestOS customization happens + // after VM is powered On and then reconfigured. vCenter does not + // require a powerOn and reconfigure to customize GuestOS as it + // stores all OVF properties as VApp properties and pushes them to + // GuestOS upon powerOn for consumption. + // Default is false. + PowerOn *bool `xml:"powerOn" json:"powerOn,omitempty"` + // For the case when remote server requires authentication or any other + // type of custom HTTP headers be provided with the request. + CustomHttpHeaders []KeyValue `xml:"customHttpHeaders,omitempty" json:"customHttpHeaders,omitempty"` + // Optionally used for source validation. + // + // The source server certificate + // in PEM format. + SourceCertificate string `xml:"sourceCertificate,omitempty" json:"sourceCertificate,omitempty"` + // The optional datastore mapping(s). + DatastoreMappings []OvfDatastoreMapping `xml:"datastoreMappings,omitempty" json:"datastoreMappings,omitempty"` + // The optional Storage Profile Id for VM's home. + VmProfile string `xml:"vmProfile,omitempty" json:"vmProfile,omitempty"` + // The optional Storage Profile mapping(s). + DiskProfiles []OvfStorageProfileMapping `xml:"diskProfiles,omitempty" json:"diskProfiles,omitempty"` +} + +func init() { + t["OvfImportParams"] = reflect.TypeOf((*OvfImportParams)(nil)).Elem() + minAPIVersionForType["OvfImportParams"] = "9.0.0.0" +} + // Disk mode not supported type OvfInternalError struct { OvfSystemFault @@ -59436,6 +60711,23 @@ func init() { t["OvfResourceMap"] = reflect.TypeOf((*OvfResourceMap)(nil)).Elem() } +// A StorageProfileMapping is the mapping of diskId in "ovf:diskId" field in +// OVF to the Storage Profile Id(SPBM ID) in the inventory. +// +// The SPBM profile +// ID will apply to non-PMem disks only. +type OvfStorageProfileMapping struct { + DynamicData + + DiskId string `xml:"diskId" json:"diskId"` + StorageProfileId string `xml:"storageProfileId" json:"storageProfileId"` +} + +func init() { + t["OvfStorageProfileMapping"] = reflect.TypeOf((*OvfStorageProfileMapping)(nil)).Elem() + minAPIVersionForType["OvfStorageProfileMapping"] = "9.0.0.0" +} + // A common base class to host all the OVF subsystems's system faults. // // This is a class of fault that can be thrown because of @@ -63755,6 +65047,13 @@ type QueryConnectionInfoRequestType struct { Password string `xml:"password" json:"password"` // The expected SSL thumbprint of the host's certificate. SslThumbprint string `xml:"sslThumbprint,omitempty" json:"sslThumbprint,omitempty"` + // The expected SSL certificate of the host in PEM format. + // This parameter is a fallback to be used when the certificate provided + // by the host can not be verified via a trusted CA. A replacement of + // `sslThumbprint`. + // Note: `sslThumbprint` and `sslCertificate` parameters are + // mutually exclusive, and should never be used simultaneously. + SslCertificate string `xml:"sslCertificate,omitempty" json:"sslCertificate,omitempty" vim:"9.0.0.0"` } func init() { @@ -64117,8 +65416,22 @@ func init() { // The parameters of `EventManager.QueryEvents`. type QueryEventsRequestType struct { This ManagedObjectReference `xml:"_this" json:"-"` - // The events qualified. + // Defines a filtering criteria for the event query. Filter EventFilterSpec `xml:"filter" json:"filter"` + // Defines the view parameters for the event query. + // + // To retrieve the newest events in the system, use 2147480000 + // (or the value of "config.vpxd.event.maxEventId" advanced vCenter + // configuration option) as `EventManagerViewByStartId.startEventId` and + // set `EventManagerViewByStartId.isForward` to false. To retrieve subsequent + // pages of results with older events, use the smallest event ID + // from the previous response as the `EventManagerViewByStartId.startEventId` + // and set`EventManagerViewByStartId.isForward` to false in the next query. + // To retrieve subsequent pages of results with newer events, use + // the biggest event ID from the previous page as the + // `EventManagerViewByStartId.startEventId` and set + // `EventManagerViewByStartId.isForward` to true in the next query. + EventViewSpec BaseEventManagerEventViewSpec `xml:"eventViewSpec,omitempty,typeattr" json:"eventViewSpec,omitempty" vim:"9.0.0.0"` } func init() { @@ -66234,6 +67547,32 @@ func init() { t["ReadNextTasks"] = reflect.TypeOf((*ReadNextTasks)(nil)).Elem() } +type ReadNextTasksByViewSpec ReadNextTasksByViewSpecRequestType + +func init() { + t["ReadNextTasksByViewSpec"] = reflect.TypeOf((*ReadNextTasksByViewSpec)(nil)).Elem() +} + +// The parameters of `TaskManager.ReadNextTasksByViewSpec`. +type ReadNextTasksByViewSpecRequestType struct { + This ManagedObjectReference `xml:"_this" json:"-"` + // The view parameters for the tasks query. + ViewSpec BaseTaskManagerTaskViewSpec `xml:"viewSpec,typeattr" json:"viewSpec"` + // The specification for the task query filter. + FilterSpec TaskFilterSpec `xml:"filterSpec" json:"filterSpec"` + // The specification for the task info filter. + InfoFilterSpec *TaskInfoFilterSpec `xml:"infoFilterSpec,omitempty" json:"infoFilterSpec,omitempty"` +} + +func init() { + t["ReadNextTasksByViewSpecRequestType"] = reflect.TypeOf((*ReadNextTasksByViewSpecRequestType)(nil)).Elem() + minAPIVersionForType["ReadNextTasksByViewSpecRequestType"] = "9.0.0.0" +} + +type ReadNextTasksByViewSpecResponse struct { + Returnval []TaskInfo `xml:"returnval,omitempty" json:"returnval,omitempty"` +} + // The parameters of `TaskHistoryCollector.ReadNextTasks`. type ReadNextTasksRequestType struct { This ManagedObjectReference `xml:"_this" json:"-"` @@ -66449,6 +67788,29 @@ type RecommissionVsanNode_TaskResponse struct { Returnval ManagedObjectReference `xml:"returnval" json:"returnval"` } +// The parameters of `VcenterVStorageObjectManager.ReconcileDatastoreInventoryEx_Task`. +type ReconcileDatastoreInventoryExRequestType struct { + This ManagedObjectReference `xml:"_this" json:"-"` + // The specification to reconcile/scan a datastore for virtual + // storage objects. + Spec VStorageObjectReconcileSpec `xml:"spec" json:"spec"` +} + +func init() { + t["ReconcileDatastoreInventoryExRequestType"] = reflect.TypeOf((*ReconcileDatastoreInventoryExRequestType)(nil)).Elem() + minAPIVersionForType["ReconcileDatastoreInventoryExRequestType"] = "9.0.0.0" +} + +type ReconcileDatastoreInventoryEx_Task ReconcileDatastoreInventoryExRequestType + +func init() { + t["ReconcileDatastoreInventoryEx_Task"] = reflect.TypeOf((*ReconcileDatastoreInventoryEx_Task)(nil)).Elem() +} + +type ReconcileDatastoreInventoryEx_TaskResponse struct { + Returnval ManagedObjectReference `xml:"returnval" json:"returnval"` +} + // The parameters of `VcenterVStorageObjectManager.ReconcileDatastoreInventory_Task`. type ReconcileDatastoreInventoryRequestType struct { This ManagedObjectReference `xml:"_this" json:"-"` @@ -66456,6 +67818,11 @@ type ReconcileDatastoreInventoryRequestType struct { // // Refers instance of `Datastore`. Datastore ManagedObjectReference `xml:"datastore" json:"datastore"` + // If set true, the reconcile task will check for the + // extent files and the disk descriptor file content + // as part of reconciliation. Note that this is a time + // consuming process. + DeepCleansing *bool `xml:"deepCleansing" json:"deepCleansing,omitempty" vim:"9.0.0.0"` } func init() { @@ -67369,8 +68736,8 @@ type RegisterKmipServerRequestType struct { This ManagedObjectReference `xml:"_this" json:"-"` // \[in\] KMIP server connection information. // When register a new KMIP server to the key provider, - // the `KmipServerSpec#defaultKeyType` and - // `KmipServerSpec#wrappingKeySpec` must match + // the `KmipServerSpec.defaultKeyType` and + // `KmipServerSpecWrappingKeyIdKeySpec` must match // existing servers. Server KmipServerSpec `xml:"server" json:"server"` } @@ -68364,6 +69731,27 @@ func init() { type RemoveSmartCardTrustAnchorByFingerprintResponse struct { } +type RemoveSmartCardTrustAnchorCertificate RemoveSmartCardTrustAnchorCertificateRequestType + +func init() { + t["RemoveSmartCardTrustAnchorCertificate"] = reflect.TypeOf((*RemoveSmartCardTrustAnchorCertificate)(nil)).Elem() +} + +// The parameters of `HostActiveDirectoryAuthentication.RemoveSmartCardTrustAnchorCertificate`. +type RemoveSmartCardTrustAnchorCertificateRequestType struct { + This ManagedObjectReference `xml:"_this" json:"-"` + // PEM encoded certificate to remove + Certificate string `xml:"certificate" json:"certificate"` +} + +func init() { + t["RemoveSmartCardTrustAnchorCertificateRequestType"] = reflect.TypeOf((*RemoveSmartCardTrustAnchorCertificateRequestType)(nil)).Elem() + minAPIVersionForType["RemoveSmartCardTrustAnchorCertificateRequestType"] = "9.0.0.0" +} + +type RemoveSmartCardTrustAnchorCertificateResponse struct { +} + // The parameters of `HostActiveDirectoryAuthentication.RemoveSmartCardTrustAnchor`. type RemoveSmartCardTrustAnchorRequestType struct { This ManagedObjectReference `xml:"_this" json:"-"` @@ -68783,7 +70171,7 @@ type ReplicationConfigSpec struct { // This field is only relevant when net encryption is enabled. EncryptionPort int32 `xml:"encryptionPort,omitempty" json:"encryptionPort,omitempty"` // Deprecated field is deprecated, use - // `vim.HbrManager.configureReplicationTargets` instead. + // `HbrManager.HbrConfigureReplicationTargets_Task` instead. // // The SHA256 thumbprint of the remote server certificate. // @@ -71443,6 +72831,10 @@ type SSLVerifyFault struct { // // This field is optional since vSphere 8.0u2. Thumbprint string `xml:"thumbprint,omitempty" json:"thumbprint,omitempty"` + // The certificate of the host + // Note: `SSLVerifyFault.thumbprint` and `SSLVerifyFault.certificate` parameters are + // mutually exclusive, and should never be used simultaneously. + Certificate string `xml:"certificate,omitempty" json:"certificate,omitempty" vim:"9.0.0.0"` } func init() { @@ -71585,6 +72977,11 @@ type ScheduleReconcileDatastoreInventoryRequestType struct { // // Refers instance of `Datastore`. Datastore ManagedObjectReference `xml:"datastore" json:"datastore"` + // If set true, the reconcile task will check for the + // extent files and the disk descriptor file content + // as part of reconciliation. Note that this is a time + // consuming process. + DeepCleansing *bool `xml:"deepCleansing" json:"deepCleansing,omitempty" vim:"9.0.0.0"` } func init() { @@ -72735,6 +74132,10 @@ type ServiceContent struct { // // Refers instance of `StorageQueryManager`. StorageQueryManager *ManagedObjectReference `xml:"storageQueryManager,omitempty" json:"storageQueryManager,omitempty"` + // A singleton managed object used to query DirectPath profiles. + // + // Refers instance of `DirectPathProfileManager`. + DirectPathProfileManager *ManagedObjectReference `xml:"directPathProfileManager,omitempty" json:"directPathProfileManager,omitempty" vim:"9.0.0.0"` } func init() { @@ -72759,10 +74160,16 @@ type ServiceLocator struct { Credential BaseServiceLocatorCredential `xml:"credential,typeattr" json:"credential"` // The SSL thumbprint of the certificate of the service endpoint. // - // Superceded by `#sslCertificate`. + // Superceded by `ServiceLocator.sslCertificate`. // Note: If both sslThumbprint and sslCertificate are set, // sslThumbprint must correspond to the sslCertificate. SslThumbprint string `xml:"sslThumbprint,omitempty" json:"sslThumbprint,omitempty"` + // The SSL certificate of the service endpoint in PEM format. + // + // A replacement for `ServiceLocator.sslThumbprint`. + // Note: If both sslThumbprint and sslCertificate are set, + // sslThumbprint must correspond to the sslCertificate. + SslCertificate string `xml:"sslCertificate,omitempty" json:"sslCertificate,omitempty" vim:"9.0.0.0"` } func init() { @@ -72920,6 +74327,13 @@ type SessionManagerGenericServiceTicket struct { // includes all hash types that are considered secure. See vmware.com // for the current security standards. CertThumbprintList []VirtualMachineCertThumbprint `xml:"certThumbprintList,omitempty" json:"certThumbprintList,omitempty" vim:"7.0.3.1"` + // Supported only by vCenter. + // + // The expected SSL certificate of the host to which we are connecting + // to, in PEM format. + // Note: `SessionManagerGenericServiceTicket.sslThumbprint` and `SessionManagerGenericServiceTicket.sslCertificate` parameters are + // mutually exclusive, and should never be used simultaneously. + SslCertificate string `xml:"sslCertificate,omitempty" json:"sslCertificate,omitempty" vim:"9.0.0.0"` // Type of the ticket // See { @Vim::SessionManager::GenericServiceTicket::TicketType } TicketType string `xml:"ticketType,omitempty" json:"ticketType,omitempty" vim:"7.0.2.0"` @@ -75385,7 +76799,7 @@ type StorageIORMConfigSpec struct { // datastore is higher than specified threshold value. // // This value (if present) overrides - // `vim.StorageResourceManager.PodConfigInfo.reservableIopsThreshold` + // `StorageIORMInfo.reservableIopsThreshold` ReservableIopsThreshold int32 `xml:"reservableIopsThreshold,omitempty" json:"reservableIopsThreshold,omitempty"` } @@ -75437,7 +76851,7 @@ type StorageIORMInfo struct { // datastore is higher than specified threshold value. // // This value (if present) overrides - // `vim.StorageResourceManager.PodConfigInfo.reservableIopsThreshold` + // `StorageIORMInfo.reservableIopsThreshold` ReservableIopsThreshold int32 `xml:"reservableIopsThreshold,omitempty" json:"reservableIopsThreshold,omitempty"` } @@ -75899,6 +77313,41 @@ func init() { t["StructuredCustomizations"] = reflect.TypeOf((*StructuredCustomizations)(nil)).Elem() } +type SubnetInfo struct { + VirtualMachineTargetInfo + + // The ID of the subnet + Id string `xml:"id" json:"id"` + // The subnet folder info + SubnetFolderInfo SubnetInfoFolderInfo `xml:"subnetFolderInfo" json:"subnetFolderInfo"` + // The VPC folder info + VpcFolderInfo SubnetInfoFolderInfo `xml:"vpcFolderInfo" json:"vpcFolderInfo"` + // The project folder info + ProjectFolderInfo *SubnetInfoFolderInfo `xml:"projectFolderInfo,omitempty" json:"projectFolderInfo,omitempty"` + // The root folder info. + // + // root folder can be either "Virtual Private Clouds" or "NSX Managed Folders" + RootFolderInfo SubnetInfoFolderInfo `xml:"rootFolderInfo" json:"rootFolderInfo"` +} + +func init() { + t["SubnetInfo"] = reflect.TypeOf((*SubnetInfo)(nil)).Elem() + minAPIVersionForType["SubnetInfo"] = "9.0.0.0" +} + +type SubnetInfoFolderInfo struct { + DynamicData + + Name string `xml:"name" json:"name"` + // Refers instance of `Folder`. + Folder ManagedObjectReference `xml:"folder" json:"folder"` +} + +func init() { + t["SubnetInfoFolderInfo"] = reflect.TypeOf((*SubnetInfoFolderInfo)(nil)).Elem() + minAPIVersionForType["SubnetInfoFolderInfo"] = "9.0.0.0" +} + type SuspendVAppRequestType struct { This ManagedObjectReference `xml:"_this" json:"-"` } @@ -76468,6 +77917,46 @@ func init() { minAPIVersionForType["TaskInfoFilterSpecFilterTaskResults"] = "8.0.3.0" } +// `TaskManagerTaskViewSpec` provides the specifications +// for returning the set of tasks in the +// Task Console. +type TaskManagerTaskViewSpec struct { + DynamicData +} + +func init() { + t["TaskManagerTaskViewSpec"] = reflect.TypeOf((*TaskManagerTaskViewSpec)(nil)).Elem() + minAPIVersionForType["TaskManagerTaskViewSpec"] = "9.0.0.0" +} + +// Defines the view parameters with starting task ID for the task query. +type TaskManagerViewByStartId struct { + TaskManagerTaskViewSpec + + // The page size to be fetched. + // + // When the value is > 0, the query will fetch tasks older than + // the specified task in `TaskManagerViewByStartId.startId` parameter with lesser task IDs. + // (Next page when the tasks are shown with the newest task first) + // When the value is < 0, the query will fetch tasks newer than + // the specified task in `TaskManagerViewByStartId.startId` parameter with greater task IDs. + // (Previous page when the tasks are shown with the newest task first) + Count int32 `xml:"count" json:"count"` + // Specifies the `TaskInfo.key` of the task from which to + // start the query. + // + // If it is set to an empty string and `TaskManagerViewByStartId.count` > 0, + // the query will return the latest (newest) `TaskManagerViewByStartId.count` tasks in the system. + // In order to read the oldest tasks in the system, the caller should set this + // field to "task-0" and `TaskManagerViewByStartId.count` to a negative number. + StartId string `xml:"startId" json:"startId"` +} + +func init() { + t["TaskManagerViewByStartId"] = reflect.TypeOf((*TaskManagerViewByStartId)(nil)).Elem() + minAPIVersionForType["TaskManagerViewByStartId"] = "9.0.0.0" +} + // Base type for all task reasons. // // Task reasons represent the kind of entity responsible for a task's creation. @@ -78867,8 +80356,8 @@ type UpdateKmipServerRequestType struct { This ManagedObjectReference `xml:"_this" json:"-"` // \[in\] KMIP server connection information. // When update a KMIP server settings, changes to - // `KmipServerSpec#defaultKeyType` and - // `KmipServerSpec#wrappingKeySpec` + // `KmipServerSpec.defaultKeyType` and + // `KmipServerSpecWrappingKeyIdKeySpec` // will apply to all servers. Server KmipServerSpec `xml:"server" json:"server"` } @@ -81576,6 +83065,8 @@ type VMwareDVSConfigInfo struct { // (`VMwareDVSConfigInfo.networkOffloadSpecId` // is not "None"). NetworkOffloadConfig *VmwareDistributedVirtualSwitchNetworkOffloadConfig `xml:"networkOffloadConfig,omitempty" json:"networkOffloadConfig,omitempty" vim:"8.0.3.0"` + // The real-time specific configuration of the switch. + RealTimeConfig *VmwareDistributedVirtualSwitchRealTimeConfig `xml:"realTimeConfig,omitempty" json:"realTimeConfig,omitempty" vim:"8.0.3.1"` } func init() { @@ -81650,6 +83141,8 @@ type VMwareDVSConfigSpec struct { // (`VMwareDVSConfigInfo.networkOffloadSpecId` // is not "None"). NetworkOffloadConfig *VmwareDistributedVirtualSwitchNetworkOffloadConfig `xml:"networkOffloadConfig,omitempty" json:"networkOffloadConfig,omitempty" vim:"8.0.3.0"` + // The real-time specific configuration of the switch. + RealTimeConfig *VmwareDistributedVirtualSwitchRealTimeConfig `xml:"realTimeConfig,omitempty" json:"realTimeConfig,omitempty" vim:"8.0.3.1"` } func init() { @@ -81698,6 +83191,12 @@ type VMwareDVSFeatureCapability struct { NsxSupported *bool `xml:"nsxSupported" json:"nsxSupported,omitempty"` // The support for version-specific supported MTU. MtuCapability *VMwareDvsMtuCapability `xml:"mtuCapability,omitempty" json:"mtuCapability,omitempty" vim:"7.0.2.0"` + // Flag to indicate whether real-time configuration is supported on + // Distributed Switch. + // + // Real-time configuration is supported in vSphere Distributed Switch + // Version 9.0 or later. + RealTimeConfigSupported *bool `xml:"realTimeConfigSupported" json:"realTimeConfigSupported,omitempty" vim:"8.0.3.1"` } func init() { @@ -82233,11 +83732,18 @@ type VMwareIpfixConfig struct { // // Legal value range is 60-3600. Default: 60. ActiveFlowTimeout int32 `xml:"activeFlowTimeout" json:"activeFlowTimeout"` + // Deprecated as of vSphere API 9.0 + // Since from 9.0, client still can set the value of IpfixConfig.idleFlowTimeout + // when creating/reconfiguring DVS, but no matter what value they set, + // it will be overrided to 15 by backend. + // In 9.0, idleFlow still functions with this overrided timeout '15', + // but it would be fully replaced by CT-based IPFIX in newer releases. + // // The number of seconds after which "idle" flows are forced to be // exported to the collector. // // Legal value range is 10-600. Default: 15. - IdleFlowTimeout int32 `xml:"idleFlowTimeout" json:"idleFlowTimeout"` + IdleFlowTimeout int32 `xml:"idleFlowTimeout,omitempty" json:"idleFlowTimeout,omitempty"` // The ratio of total number of packets to the number of packets // analyzed. // @@ -82544,6 +84050,12 @@ type VStorageObjectConfigInfo struct { // // For a virtual disk, this can be VM ID(s). ConsumerId []ID `xml:"consumerId,omitempty" json:"consumerId,omitempty"` + // The type of VirtualDisk for 4k native disk/array support. + // + // See `DatastoreSectorFormat_enum` for definitions of + // supported types. If not set, the default value is + // `native_512`. + VirtualDiskFormat string `xml:"virtualDiskFormat,omitempty" json:"virtualDiskFormat,omitempty" vim:"9.0.0.0"` } func init() { @@ -82664,6 +84176,125 @@ type VStorageObjectExtendDiskEx_TaskResponse struct { Returnval ManagedObjectReference `xml:"returnval" json:"returnval"` } +// Contains result to be returned for +// `VcenterVStorageObjectManager.ReconcileDatastoreInventoryEx_Task` task. +type VStorageObjectReconcileResult struct { + DynamicData + + ReconcileDetails []VStorageObjectReconcileResultReconcileDetail `xml:"reconcileDetails,omitempty" json:"reconcileDetails,omitempty"` +} + +func init() { + t["VStorageObjectReconcileResult"] = reflect.TypeOf((*VStorageObjectReconcileResult)(nil)).Elem() + minAPIVersionForType["VStorageObjectReconcileResult"] = "9.0.0.0" +} + +type VStorageObjectReconcileResultInvalidDiskPath struct { + DynamicData + + // invalid disk path for reconcile. + Path string `xml:"path" json:"path"` + // Reason for invalid disk path + Reason string `xml:"reason" json:"reason"` +} + +func init() { + t["VStorageObjectReconcileResultInvalidDiskPath"] = reflect.TypeOf((*VStorageObjectReconcileResultInvalidDiskPath)(nil)).Elem() + minAPIVersionForType["VStorageObjectReconcileResultInvalidDiskPath"] = "9.0.0.0" +} + +// Contains information related to the performed reconcile operation. +type VStorageObjectReconcileResultReconcileDetail struct { + DynamicData + + // Host name where reconcile operation was performed. + // + // This will have the either VC name or the host name based on + // where the details were captured. + // In case we do not get the hostName for the system it would be + // empty string. + HostName string `xml:"hostName,omitempty" json:"hostName,omitempty"` + // Reconcile report path in host. + ReconcileReportPath string `xml:"reconcileReportPath,omitempty" json:"reconcileReportPath,omitempty"` + // Set to true if reconcile was done from host, false otherwise + // for host. + // + // This will be unset for the vcenter part of result. + IsReconciled *bool `xml:"isReconciled" json:"isReconciled,omitempty"` + // If deepScan was done from host, false otherwise for host. + // + // This will be unset for vcenter part of result. + IsDeepScanned *bool `xml:"isDeepScanned" json:"isDeepScanned,omitempty"` + // Number of reconcile issues found + NumberOfReconcileIssues int32 `xml:"numberOfReconcileIssues,omitempty" json:"numberOfReconcileIssues,omitempty"` + // Number of fcds before reconcile operation + // This will be unset for vcenter part of result. + NumberOfFcdsBeforeReconcile int32 `xml:"numberOfFcdsBeforeReconcile,omitempty" json:"numberOfFcdsBeforeReconcile,omitempty"` + // Number of fcds after reconcile operation. + // + // This will be unset for vcenter part of result. + NumberOfFcdsAfterReconcile int32 `xml:"numberOfFcdsAfterReconcile,omitempty" json:"numberOfFcdsAfterReconcile,omitempty"` + // reconcile invalid disk paths + InvalidDiskPaths []VStorageObjectReconcileResultInvalidDiskPath `xml:"invalidDiskPaths,omitempty" json:"invalidDiskPaths,omitempty"` +} + +func init() { + t["VStorageObjectReconcileResultReconcileDetail"] = reflect.TypeOf((*VStorageObjectReconcileResultReconcileDetail)(nil)).Elem() + minAPIVersionForType["VStorageObjectReconcileResultReconcileDetail"] = "9.0.0.0" +} + +// Contains specification to reconcile a datastore +type VStorageObjectReconcileSpec struct { + DynamicData + + // The datastore managed object that is to be reconciled/scanned. + // + // Refers instance of `Datastore`. + Datastore ManagedObjectReference `xml:"datastore" json:"datastore"` + // List of paths of the disk descriptor files which are to be reconciled + // or scanned. + // + // This is an optional parameter and if specified, the reconciliation will + // scan only these disk paths and reconcile the catalog. + // This will save time and avoid scanning all the vmdk files. + // The disk paths should belong to the same datastore. + // The field should adhere to the following format: + // /vmfs/volume/<datastore-uuid>/.../<disk-name>.vmdk . + // Please note, either this field or `VStorageObjectReconcileSpec.excludeDiskPaths` + // should be specified in `VStorageObjectReconcileSpec` and not both. + IncludeDiskPaths []string `xml:"includeDiskPaths,omitempty" json:"includeDiskPaths,omitempty"` + // List of paths of the disk descriptor files which are excluded for reconcile + // or scan operation. + // + // This is an optional parameter and if specified, the reconciliation will + // skip these disk paths. + // This will be useful in a case when user wants to reconcile complete datastore + // and skip few set of the FCD's which are present in same datastore. + // The disk paths should belong to the same datastore. + // The field should adhere to the following format: + // /vmfs/volume/<datastore-uuid>/.../<disk-name>.vmdk + // Please note, either `VStorageObjectReconcileSpec.includeDiskPaths` or this field + // should be specified in `VStorageObjectReconcileSpec` and not both. + ExcludeDiskPaths []string `xml:"excludeDiskPaths,omitempty" json:"excludeDiskPaths,omitempty"` + // If true - Checks extent files and disk descriptor file contents + // Note that this is a time consuming process. + DeepScan *bool `xml:"deepScan" json:"deepScan,omitempty"` + // If true - Does not reconcile but only scans the datastore. + DryRun *bool `xml:"dryRun" json:"dryRun,omitempty"` + // If set to 1, generate report for + // `HostVStorageObjectManager.HostReconcileDatastoreInventoryEx_Task` task. + // + // If set to 0 or unset, do not generate report + // Partner apps can use 0 and 1 as values. + // Other values are reserved for future and internal use. + GenerateReport int32 `xml:"generateReport,omitempty" json:"generateReport,omitempty"` +} + +func init() { + t["VStorageObjectReconcileSpec"] = reflect.TypeOf((*VStorageObjectReconcileSpec)(nil)).Elem() + minAPIVersionForType["VStorageObjectReconcileSpec"] = "9.0.0.0" +} + // This data object type contains ID and VClock details of a virtual disk snapshot. type VStorageObjectSnapshot struct { DynamicData @@ -84346,6 +85977,20 @@ type VirtualDisk struct { VDiskId *ID `xml:"vDiskId,omitempty" json:"vDiskId,omitempty"` // Disk descriptor version of the virtual disk. VDiskVersion int32 `xml:"vDiskVersion,omitempty" json:"vDiskVersion,omitempty" vim:"8.0.1.0"` + // Indicates the disk format of the virtual disk. + // + // The supported values are `native_4k` + // and `native_512`. + // If unset during virtual machine creation `Folder.CreateVM_Task`, + // the default value will be based on `DatastoreInfo.supportedVDiskFormats`. + // If `DatastoreInfo.supportedVDiskFormats` has only one value + // then the default value will be the same. + // If `DatastoreInfo.supportedVDiskFormats` has both the values + // `native_512` and `native_4k` + // then default value will be `native_512`. + // If unset when returned as part of a `VirtualMachineConfigInfo` then the + // default value is `native_512`. + VirtualDiskFormat string `xml:"virtualDiskFormat,omitempty" json:"virtualDiskFormat,omitempty" vim:"9.0.0.0"` // Indicates whether a disk with // `VirtualDiskFlatVer2BackingInfo` backing is a linked // clone from an unmanaged delta disk and hence the @@ -84828,6 +86473,10 @@ type VirtualDiskFlatVer2BackingOption struct { DeltaDiskFormat *ChoiceOption `xml:"deltaDiskFormat,omitempty" json:"deltaDiskFormat,omitempty"` // Delta disk formats supported for each datastore type. DeltaDiskFormatsSupported []VirtualDiskDeltaDiskFormatsSupported `xml:"deltaDiskFormatsSupported,omitempty" json:"deltaDiskFormatsSupported,omitempty"` + // Virtual disk format. + // + // See `DatastoreSectorFormat_enum` for the list of supported types. + VirtualDiskFormat *ChoiceOption `xml:"virtualDiskFormat,omitempty" json:"virtualDiskFormat,omitempty" vim:"9.0.0.0"` } func init() { @@ -85202,6 +86851,10 @@ type VirtualDiskRawDiskMappingVer1BackingOption struct { DiskMode ChoiceOption `xml:"diskMode" json:"diskMode"` // Flag to indicate whether this backing supports disk UUID property. Uuid bool `xml:"uuid" json:"uuid"` + // Virtual disk format. + // + // See `DatastoreSectorFormat_enum` for the list of supported types. + VirtualDiskFormat *ChoiceOption `xml:"virtualDiskFormat,omitempty" json:"virtualDiskFormat,omitempty" vim:"9.0.0.0"` } func init() { @@ -85269,13 +86922,20 @@ func init() { t["VirtualDiskRuleSpec"] = reflect.TypeOf((*VirtualDiskRuleSpec)(nil)).Elem() } -// Backing type for virtual disks that use the space efficient -// sparse format. +// Deprecated as of vSphere API 9.0, space efficient sparse format only +// applies to delta disks, see +// `DeltaDiskFormat`. +// SE sparse base disk is no longer supported, instead set +// `VirtualDiskFlatVer2BackingInfo.thinProvisioned` +// to true for potential space saving. // // Space for space efficient sparse disks is allocated on // demand and optimizations are applied to achieve additional // space savings. The effective space usage of such a disk can // be obtained from `VirtualMachineFileLayoutEx`. +// +// Backing type for virtual disks that use the space efficient +// sparse format. type VirtualDiskSeSparseBackingInfo struct { VirtualDeviceFileBackingInfo @@ -85418,6 +87078,10 @@ type VirtualDiskSeSparseBackingOption struct { Uuid bool `xml:"uuid" json:"uuid"` // Delta disk formats supported for each datastore type. DeltaDiskFormatsSupported []VirtualDiskDeltaDiskFormatsSupported `xml:"deltaDiskFormatsSupported" json:"deltaDiskFormatsSupported"` + // Virtual disk format. + // + // See `DatastoreSectorFormat_enum` for the list of supported types. + VirtualDiskFormat *ChoiceOption `xml:"virtualDiskFormat,omitempty" json:"virtualDiskFormat,omitempty" vim:"9.0.0.0"` } func init() { @@ -85684,6 +87348,10 @@ type VirtualDiskSparseVer2BackingOption struct { HotGrowable bool `xml:"hotGrowable" json:"hotGrowable"` // Flag to indicate whether this backing supports disk UUID property. Uuid bool `xml:"uuid" json:"uuid"` + // Virtual disk format. + // + // See `DatastoreSectorFormat_enum` for the list of supported types. + VirtualDiskFormat *ChoiceOption `xml:"virtualDiskFormat,omitempty" json:"virtualDiskFormat,omitempty" vim:"9.0.0.0"` } func init() { @@ -85872,6 +87540,12 @@ type VirtualEthernetCard struct { // Clients can set this property enabled or disabled if ethernet // virtual device is Vmxnet3. UptCompatibilityEnabled *bool `xml:"uptCompatibilityEnabled" json:"uptCompatibilityEnabled,omitempty"` + // The ID of the subnet the virtual network adapter connects to. + // + // It + // is only set when the virtual network adapter is connected + // to a subnet. + SubnetId string `xml:"subnetId,omitempty" json:"subnetId,omitempty" vim:"9.0.0.0"` } func init() { @@ -86773,6 +88447,17 @@ type VirtualMachineCapability struct { ChangeModeDisksSupported *bool `xml:"changeModeDisksSupported" json:"changeModeDisksSupported,omitempty" vim:"8.0.0.1"` // Indicates support for Vendor Device Groups VendorDeviceGroupSupported *bool `xml:"vendorDeviceGroupSupported" json:"vendorDeviceGroupSupported,omitempty" vim:"8.0.1.0"` + // Indicates support for AMD-SEV-SNP (Secure Encrypted Virtualization Secure + // Nested Paging). + // + // SEV-SNP is supported when set to true, and unsupported + // otherwise. + SevSnpSupported *bool `xml:"sevSnpSupported" json:"sevSnpSupported,omitempty" vim:"9.0.0.0"` + // Indicates support for INTEL-TDX (Trusted Domain Extensions). + // + // TDX is + // supported when set to true, and unsupported otherwise. + TdxSupported *bool `xml:"tdxSupported" json:"tdxSupported,omitempty" vim:"9.0.0.0"` } func init() { @@ -87299,6 +88984,12 @@ type VirtualMachineConfigInfo struct { // \- If FALSE or unset, FT Metro Cluster is disabled for the VM. Both FT // primary and secondary will be put in the same HostGroup. MetroFtEnabled *bool `xml:"metroFtEnabled" json:"metroFtEnabled,omitempty" vim:"8.0.3.0"` + // Contains properties that are established when the VM + // powers-on and are later examined when the VM is resumed to ensure that + // the VM is compatible with the suspended device state. + // + // It is only populated while the VM is powered-on. + VmxRuntimeConfig []BaseOptionValue `xml:"vmxRuntimeConfig,omitempty,typeattr" json:"vmxRuntimeConfig,omitempty" vim:"9.0.0.0"` // Indicate the Host Group (`ClusterHostGroup`) for FT // Metro Cluster enabled Virtual Machine. // @@ -87306,6 +88997,16 @@ type VirtualMachineConfigInfo struct { // into two groups and ensure to place FT primary and FT secondary in // different groups. MetroFtHostGroup string `xml:"metroFtHostGroup,omitempty" json:"metroFtHostGroup,omitempty" vim:"8.0.3.0"` + // TDX (Trust Domain Extensions) enabled or not. + // + // TDX is enabled + // when set to true, and disabled otherwise. + TdxEnabled *bool `xml:"tdxEnabled" json:"tdxEnabled,omitempty" vim:"9.0.0.0"` + // SEV-SNP (Secure Encrypted Virtualization Secure Nested paging) enabled or + // not. + // + // SEV-SNP is enabled when set to true, and disabled otherwise. + SevSnpEnabled *bool `xml:"sevSnpEnabled" json:"sevSnpEnabled,omitempty" vim:"9.0.0.0"` } func init() { @@ -88027,6 +89728,16 @@ type VirtualMachineConfigSpec struct { // into two groups and ensure to place FT primary and FT secondary in // different groups. MetroFtHostGroup string `xml:"metroFtHostGroup,omitempty" json:"metroFtHostGroup,omitempty" vim:"8.0.3.0"` + // TDX (Trust Domain Extensions) enabled or not. + // + // TDX is enabled when + // set to true, and disabled otherwise. + TdxEnabled *bool `xml:"tdxEnabled" json:"tdxEnabled,omitempty" vim:"9.0.0.0"` + // SEV-SNP (Secure Encrypted Virtualization Secure Nested paging) enabled or + // not. + // + // SEV-SNP is enabled when set to true, and disabled otherwise. + SevSnpEnabled *bool `xml:"sevSnpEnabled" json:"sevSnpEnabled,omitempty" vim:"9.0.0.0"` } func init() { @@ -88226,6 +89937,12 @@ type VirtualMachineDatastoreInfo struct { // // See also `FileSystemMountInfoVStorageSupportStatus_enum`. VStorageSupport string `xml:"vStorageSupport,omitempty" json:"vStorageSupport,omitempty"` + // A list of virtual disk format types which are supported + // on that datastore. + // + // See `DatastoreSectorFormat_enum` for the list + // of supported types. + SupportedVDiskFormats []string `xml:"supportedVDiskFormats,omitempty" json:"supportedVDiskFormats,omitempty" vim:"9.0.0.0"` } func init() { @@ -88800,6 +90517,11 @@ type VirtualMachineFileLayoutExDiskLayout struct { // Identifier for the virtual disk in `VirtualHardware.device`. Key int32 `xml:"key" json:"key"` + // The sector format of the virtual disk. + // + // See `DatastoreSectorFormat_enum` for definitions of supported types. If not + // set, the default value is `native_512`. + VirtualDiskFormat string `xml:"virtualDiskFormat,omitempty" json:"virtualDiskFormat,omitempty" vim:"9.0.0.0"` // The disk-unit chain that makes up this virtual disk. Chain []VirtualMachineFileLayoutExDiskUnit `xml:"chain,omitempty" json:"chain,omitempty"` } @@ -90761,6 +92483,11 @@ type VirtualMachineTicket struct { // includes all hash types that are considered secure. See vmware.com // for the current security standards. CertThumbprintList []VirtualMachineCertThumbprint `xml:"certThumbprintList,omitempty" json:"certThumbprintList,omitempty" vim:"7.0.3.1"` + // PEM-encoded SSL certificate of the host to which we are connecting. + // + // Note: `VirtualMachineTicket.sslThumbprint` and `VirtualMachineTicket.sslCertificate` parameters are + // mutually exclusive, and should never be used simultaneously. + SslCertificate string `xml:"sslCertificate,omitempty" json:"sslCertificate,omitempty" vim:"9.0.0.0"` // Websocket URL. // // Some tickets are "websocket" tickets and are best expressed @@ -93530,6 +95257,14 @@ type VirtualVmxnet3 struct { // virtual device is Vmxnet3. It requires the VM hardware version is // compatible with ESXi version which has enabled smartnic feature. Uptv2Enabled *bool `xml:"uptv2Enabled" json:"uptv2Enabled,omitempty" vim:"8.0.0.1"` + // Indicates whether strict latency parameters are configured on this + // network adapter. + // + // Clients can set these parameters to control behaviors + // on this network adapter, e.g., set the TX/RX ring size, etc. Requires + // VM hardware version compatible with ESXi release supporting the + // "real-time switch" feature. + StrictLatencyConfig *VirtualVmxnet3StrictLatencyConfig `xml:"strictLatencyConfig,omitempty" json:"strictLatencyConfig,omitempty" vim:"8.0.3.1"` } func init() { @@ -93544,12 +95279,110 @@ type VirtualVmxnet3Option struct { // Flag to indicate whether UPTv2(Uniform Pass-through version 2) is // settable on this device. Uptv2Enabled *BoolOption `xml:"uptv2Enabled,omitempty" json:"uptv2Enabled,omitempty" vim:"8.0.0.1"` + // Strict latency configure options. + StrictLatencyConfigOption *VirtualVmxnet3OptionStrictLatencyConfigOption `xml:"strictLatencyConfigOption,omitempty" json:"strictLatencyConfigOption,omitempty" vim:"8.0.3.1"` } func init() { t["VirtualVmxnet3Option"] = reflect.TypeOf((*VirtualVmxnet3Option)(nil)).Elem() } +// Strict latency configure options. +// +// Indicates options for each strict +// latency configure specification, as defined by +// `VirtualVmxnet3StrictLatencyConfig`. +type VirtualVmxnet3OptionStrictLatencyConfigOption struct { + DynamicData + + // Indicates whether strict latency configuration is allowed on this + // network adapter. + Allowed BoolOption `xml:"allowed" json:"allowed"` + // Indicates whether latency measurement is enabled on this network + // adapter. + MeasureLatency BoolOption `xml:"measureLatency" json:"measureLatency"` + // Three properties (maxTxQueues.min, maxTxQueues.max, and + // maxTxQueues.defaultValue) define the minimum, maximum, and default + // number of transmit queues on this network adapter. + MaxTxQueues IntOption `xml:"maxTxQueues" json:"maxTxQueues"` + // Three properties (maxRxQueues.min, maxRxQueues.max, and + // maxRxQueues.defaultValue) define the minimum, maximum, and default + // number of receive queues on this network adapter. + MaxRxQueues IntOption `xml:"maxRxQueues" json:"maxRxQueues"` + // Three properties (txDataRingDescSize.min, txDataRingDescSize.max, and + // txDataRingDescSize.defaultValue) define the minimum, maximum, and + // default transmit data ring size on this network adapter. + TxDataRingDescSize IntOption `xml:"txDataRingDescSize" json:"txDataRingDescSize"` + // Three properties (rxDataRingDescSize.min, rxDataRingDescSize.max, and + // rxDataRingDescSize.defaultValue) define the minimum, maximum, and + // default receive data ring size on this network adapter. + RxDataRingDescSize IntOption `xml:"rxDataRingDescSize" json:"rxDataRingDescSize"` + // Type of disable offload being performed on the specified network + // adapter. + DisableOffload ChoiceOption `xml:"disableOffload" json:"disableOffload"` +} + +func init() { + t["VirtualVmxnet3OptionStrictLatencyConfigOption"] = reflect.TypeOf((*VirtualVmxnet3OptionStrictLatencyConfigOption)(nil)).Elem() + minAPIVersionForType["VirtualVmxnet3OptionStrictLatencyConfigOption"] = "8.0.3.1" +} + +// The structure below defines the strict latency configuration of a +// network adapter. +// +// The configuration parameters are only supported when +// the strict latency capability is enabled on the adapter. When adding +// a new adapter, unset config parameters are interpreted as "use the +// default value". When altering the configuration of an existing adapter, +// unset parameters mean "do not change the current config" +type VirtualVmxnet3StrictLatencyConfig struct { + DynamicData + + // Indicates whether strict latency configuration is allowed on this + // network adapter. + // + // Requires VM hardware version compatible with ESXi + // release supporting the "real-time switch" feature. + Allowed *bool `xml:"allowed" json:"allowed,omitempty"` + // Indicates whether the latency measurement is enabled. + // + // The default + // value is "enabled". + MeasureLatency *bool `xml:"measureLatency" json:"measureLatency,omitempty"` + // The number of transmit queues. + // + // The default value is 1. The allowed + // range is 1 to 32, including. + MaxTxQueues int32 `xml:"maxTxQueues,omitempty" json:"maxTxQueues,omitempty"` + // The number of receive queues. + // + // The default value is 1. The allowed + // range is 1 to 32, including. + MaxRxQueues int32 `xml:"maxRxQueues,omitempty" json:"maxRxQueues,omitempty"` + // The transmit data ring size. + // + // The default value is 256. The allowed + // range is 128 to 2048, including, must be multiple of 64. + TxDataRingDescSize int32 `xml:"txDataRingDescSize,omitempty" json:"txDataRingDescSize,omitempty"` + // The receive data ring size. + // + // The default value is 256. The allowed + // range is 128 to 2048, including, must be multiple of 64. + RxDataRingDescSize int32 `xml:"rxDataRingDescSize,omitempty" json:"rxDataRingDescSize,omitempty"` + // Type of disable offload being performed on the specified network + // adapter. + // + // If not specified, TSO\_LRO will be used as the default during + // adding new network adapter. The supported values are listed in + // `VirtualVmxnet3StrictLatencyConfigDisableOffload_enum`. + DisableOffload string `xml:"disableOffload,omitempty" json:"disableOffload,omitempty"` +} + +func init() { + t["VirtualVmxnet3StrictLatencyConfig"] = reflect.TypeOf((*VirtualVmxnet3StrictLatencyConfig)(nil)).Elem() + minAPIVersionForType["VirtualVmxnet3StrictLatencyConfig"] = "8.0.3.1" +} + // The VirtualVmxnet3Vrdma data object type represents an instance of the // VRDMA virtual Remote Direct Memory Access adapter attached to a virtual // machine. @@ -94307,6 +96140,10 @@ type VmDiskFileInfo struct { // field is always set. Inspect the VmDiskEncryptionInfo to // determine if the virtual disk is encrypted. Encryption *VmDiskFileEncryptionInfo `xml:"encryption,omitempty" json:"encryption,omitempty"` + // Sector format of this virtual disk. + // + // For the list of supported values, see `DatastoreSectorFormat_enum`. + SectorFormat string `xml:"sectorFormat,omitempty" json:"sectorFormat,omitempty" vim:"9.0.0.0"` } func init() { @@ -94412,6 +96249,9 @@ type VmDiskFileQueryFlags struct { // The flag to indicate whether the encryption information of the // virtual disk is returned. Encryption *bool `xml:"encryption" json:"encryption,omitempty"` + // The flag to indicate whether or not the sector format of the virtual + // disk is returned. + SectorFormat *bool `xml:"sectorFormat" json:"sectorFormat,omitempty" vim:"9.0.0.0"` } func init() { @@ -96400,6 +98240,43 @@ func init() { t["VmwareDistributedVirtualSwitchPvlanSpec"] = reflect.TypeOf((*VmwareDistributedVirtualSwitchPvlanSpec)(nil)).Elem() } +// This data structure defines the real-time specific configuration of +// a distributed virtual switch when real-time flag is enabled. +type VmwareDistributedVirtualSwitchRealTimeConfig struct { + DynamicData + + // The flag to indicate whether real-time configuration is allowed on + // the switch. + Allowed *bool `xml:"allowed" json:"allowed,omitempty"` + // The real-time LANs (LAN A/LAN B) annotation, to mark the uplink(s) + // for each LAN. + LanAnnotation *VmwareDistributedVirtualSwitchRealTimeLanAnnotation `xml:"lanAnnotation,omitempty" json:"lanAnnotation,omitempty"` +} + +func init() { + t["VmwareDistributedVirtualSwitchRealTimeConfig"] = reflect.TypeOf((*VmwareDistributedVirtualSwitchRealTimeConfig)(nil)).Elem() + minAPIVersionForType["VmwareDistributedVirtualSwitchRealTimeConfig"] = "8.0.3.1" +} + +// This data structure defines the real-time configuration for a distributed +// virtual switch when real-time flag is enabled. +// +// The uplink(s) are set in +// two different LANs (LAN A/LAN B). +type VmwareDistributedVirtualSwitchRealTimeLanAnnotation struct { + DynamicData + + // The name(s) of the LAN A uplink(s). + LanAUplink []string `xml:"lanAUplink,omitempty" json:"lanAUplink,omitempty"` + // The name(s) of the LAN B uplink(s). + LanBUplink []string `xml:"lanBUplink,omitempty" json:"lanBUplink,omitempty"` +} + +func init() { + t["VmwareDistributedVirtualSwitchRealTimeLanAnnotation"] = reflect.TypeOf((*VmwareDistributedVirtualSwitchRealTimeLanAnnotation)(nil)).Elem() + minAPIVersionForType["VmwareDistributedVirtualSwitchRealTimeLanAnnotation"] = "8.0.3.1" +} + // This data type specifies that the port uses trunk mode, // which allows the guest operating system to manage its own VLAN tags. type VmwareDistributedVirtualSwitchTrunkVlanSpec struct { @@ -96614,6 +98491,32 @@ func init() { t["VsanClusterConfigInfoHostDefaultInfo"] = reflect.TypeOf((*VsanClusterConfigInfoHostDefaultInfo)(nil)).Elem() } +// vSAN first-class settings which should be configured together with +// vSAN enablement. +type VsanClusterCoreConfig struct { + DynamicData + + VsanMaxEnabled *bool `xml:"vsanMaxEnabled" json:"vsanMaxEnabled,omitempty"` +} + +func init() { + t["VsanClusterCoreConfig"] = reflect.TypeOf((*VsanClusterCoreConfig)(nil)).Elem() + minAPIVersionForType["VsanClusterCoreConfig"] = "9.0.0.0" +} + +// vSAN first-class settings which should be configured together with +// vSAN enablement. +type VsanClusterCoreConfigSpec struct { + DynamicData + + VsanMaxEnabled *bool `xml:"vsanMaxEnabled" json:"vsanMaxEnabled,omitempty"` +} + +func init() { + t["VsanClusterCoreConfigSpec"] = reflect.TypeOf((*VsanClusterCoreConfigSpec)(nil)).Elem() + minAPIVersionForType["VsanClusterCoreConfigSpec"] = "9.0.0.0" +} + // Fault thrown for the case that an attempt is made to move a host which // is enabled for VSAN into a `ClusterComputeResource` whose // VSAN cluster UUID does not match. diff --git a/vendor/github.com/vmware/govmomi/vim25/types/unreleased.go b/vendor/github.com/vmware/govmomi/vim25/types/unreleased.go index 72bc1082b..2114d55fa 100644 --- a/vendor/github.com/vmware/govmomi/vim25/types/unreleased.go +++ b/vendor/github.com/vmware/govmomi/vim25/types/unreleased.go @@ -1,17 +1,17 @@ /* - Copyright (c) 2022 VMware, Inc. All Rights Reserved. +Copyright (c) 2022-2024 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 +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. +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 @@ -75,9 +75,10 @@ func init() { type PlaceVmsXClusterResultPlacementFaults struct { DynamicData - ResourcePool ManagedObjectReference `xml:"resourcePool"` - VmName string `xml:"vmName"` - Faults []LocalizedMethodFault `xml:"faults,omitempty"` + ResourcePool ManagedObjectReference `xml:"resourcePool"` + VmName string `xml:"vmName"` + Faults []LocalizedMethodFault `xml:"faults,omitempty"` + Vm *ManagedObjectReference `xml:"vm,omitempty"` } func init() { @@ -87,8 +88,9 @@ func init() { type PlaceVmsXClusterResultPlacementInfo struct { DynamicData - VmName string `xml:"vmName"` - Recommendation ClusterRecommendation `xml:"recommendation"` + VmName string `xml:"vmName"` + Recommendation ClusterRecommendation `xml:"recommendation"` + Vm *ManagedObjectReference `xml:"vm,omitempty"` } func init() { @@ -99,6 +101,7 @@ type PlaceVmsXClusterSpec struct { DynamicData ResourcePools []ManagedObjectReference `xml:"resourcePools,omitempty"` + PlacementType string `xml:"placementType,omitempty"` VmPlacementSpecs []PlaceVmsXClusterSpecVmPlacementSpec `xml:"vmPlacementSpecs,omitempty"` HostRecommRequired *bool `xml:"hostRecommRequired"` DatastoreRecommRequired *bool `xml:"datastoreRecommRequired"` @@ -111,7 +114,9 @@ func init() { type PlaceVmsXClusterSpecVmPlacementSpec struct { DynamicData - ConfigSpec VirtualMachineConfigSpec `xml:"configSpec"` + Vm *ManagedObjectReference `xml:"vm,omitempty"` + ConfigSpec VirtualMachineConfigSpec `xml:"configSpec"` + RelocateSpec *VirtualMachineRelocateSpec `xml:"relocateSpec,omitempty"` } func init() { @@ -119,3 +124,25 @@ func init() { } const RecommendationReasonCodeXClusterPlacement = RecommendationReasonCode("xClusterPlacement") + +type ClusterClusterReconfigurePlacementAction struct { + ClusterAction + TargetHost *ManagedObjectReference `xml:"targetHost,omitempty"` + Pool ManagedObjectReference `xml:"pool"` + ConfigSpec *VirtualMachineConfigSpec `xml:"configSpec,omitempty"` +} + +func init() { + t["ClusterClusterReconfigurePlacementAction"] = reflect.TypeOf((*ClusterClusterReconfigurePlacementAction)(nil)).Elem() +} + +type ClusterClusterRelocatePlacementAction struct { + ClusterAction + TargetHost *ManagedObjectReference `xml:"targetHost,omitempty"` + Pool ManagedObjectReference `xml:"pool"` + RelocateSpec *VirtualMachineRelocateSpec `xml:"relocateSpec,omitempty"` +} + +func init() { + t["ClusterClusterRelocatePlacementAction"] = reflect.TypeOf((*ClusterClusterRelocatePlacementAction)(nil)).Elem() +} diff --git a/vendor/github.com/vmware/govmomi/vim25/xml/marshal.go b/vendor/github.com/vmware/govmomi/vim25/xml/marshal.go index c0c0a588b..2efdb7a46 100644 --- a/vendor/github.com/vmware/govmomi/vim25/xml/marshal.go +++ b/vendor/github.com/vmware/govmomi/vim25/xml/marshal.go @@ -497,11 +497,6 @@ func (p *printer) marshalValue(val reflect.Value, finfo *fieldInfo, startTemplat start.Name.Local = name } - // Add type attribute if necessary - if finfo != nil && finfo.flags&fTypeAttr != 0 { - start.Attr = append(start.Attr, Attr{xmlSchemaInstance, typeToString(typ)}) - } - // Attributes for i := range tinfo.fields { finfo := &tinfo.fields[i] @@ -524,6 +519,11 @@ func (p *printer) marshalValue(val reflect.Value, finfo *fieldInfo, startTemplat } } + // Add type attribute if necessary + if finfo != nil && finfo.flags&fTypeAttr != 0 { + start.Attr = append(start.Attr, Attr{xmlSchemaInstance, typeToString(typ)}) + } + if err := p.writeStart(&start); err != nil { return err } diff --git a/vendor/github.com/vmware/govmomi/vmdk/descriptor.go b/vendor/github.com/vmware/govmomi/vmdk/descriptor.go new file mode 100644 index 000000000..4b1654d90 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/vmdk/descriptor.go @@ -0,0 +1,161 @@ +// © Broadcom. All Rights Reserved. +// The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. +// SPDX-License-Identifier: Apache-2.0 + +package vmdk + +import ( + "bufio" + "fmt" + "io" + "slices" + "strconv" + "strings" + "text/template" +) + +type Descriptor struct { + Encoding string `json:"encoding"` + Version int `json:"version"` + CID DiskContentID `json:"cid"` + ParentCID DiskContentID `json:"parentCID"` + Type string `json:"type"` + Extent []Extent `json:"extent"` + DDB map[string]string `json:"ddb"` +} + +type DiskContentID uint32 + +func (cid DiskContentID) String() string { + return fmt.Sprintf("%0.8x", uint32(cid)) +} + +type Extent struct { + Type string `json:"type"` + Permission string `json:"permission"` + Size uint64 `json:"size"` + Info string `json:"info"` +} + +func NewDescriptor(extent ...Extent) *Descriptor { + for i := range extent { + if extent[i].Type == "" { + extent[i].Type = "VMFS" + } + if extent[i].Permission == "" { + extent[i].Permission = "RW" + } + } + return &Descriptor{ + Version: 1, + Encoding: "UTF-8", + Type: "vmfs", + DDB: map[string]string{}, + Extent: extent, + } +} + +func ParseDescriptor(r io.Reader) (*Descriptor, error) { + d := NewDescriptor() + + scanner := bufio.NewScanner(r) + + // NOTE: not doing any validation currently, or using this function yet. + // Will add validation as needed when use-cases are implemented. + for scanner.Scan() { + line := strings.TrimSpace(scanner.Text()) + if line == "" || strings.HasPrefix(line, "#") { + continue + } + if d.parseExtent(line) { + continue + } + + s := strings.SplitN(line, "=", 2) + + if len(s) != 2 { + continue + } + + key, val := strings.TrimSpace(s[0]), strings.TrimSpace(s[1]) + val = strings.Trim(val, `"`) + if k := strings.TrimPrefix(key, "ddb."); k != key { + d.DDB[k] = val + continue + } + + switch strings.ToLower(key) { + case "encoding": + d.Encoding = val + case "version": + d.Version, _ = strconv.Atoi(val) + case "cid": + _, _ = fmt.Sscanf(val, "%x", &d.CID) + case "parentcid": + _, _ = fmt.Sscanf(val, "%x", &d.ParentCID) + case "createType": + d.Type = val + } + } + + return d, scanner.Err() +} + +var permissions = []string{"RDONLY", "RW", "NOACCESS"} + +func (d *Descriptor) parseExtent(line string) bool { + // Each extent is defined by a line following this pattern: + // perm size type "%s" + + s := strings.SplitN(line, " ", 2) + + if len(s) != 2 || !slices.Contains(permissions, s[0]) { + return false + } + + x := Extent{ + Permission: s[0], + } + + s = strings.SplitN(s[1], " ", 2) + size, err := strconv.ParseUint(s[0], 10, 64) + if len(s) != 2 || err != nil { + return false + } + + x.Size = size + + s = strings.SplitN(s[1], " ", 2) + x.Type = s[0] + + if len(s) == 2 { + x.Info = strings.Trim(s[1], `"`) + } + + d.Extent = append(d.Extent, x) + + return true +} + +var descriptor = `# Disk DescriptorFile +version={{ .Version }} +encoding="{{ .Encoding }}" +CID={{ .CID }} +parentCID={{ .ParentCID }} +createType="{{ .Type }}" + +# Extent description{{range .Extent }} +{{ .Permission }} {{ .Size }} {{ .Type }} "{{ .Info }}"{{end}} + +# The Disk Data Base +#DDB{{ range $key, $val := .DDB }} +ddb.{{ $key }} = "{{ $val }}"{{end}} +` + +func (d *Descriptor) Write(w io.Writer) error { + t, err := template.New("vmdk").Parse(descriptor) + if err != nil { + return err + } + return t.Execute(w, d) +} diff --git a/vendor/github.com/vmware/govmomi/vmdk/disk_info.go b/vendor/github.com/vmware/govmomi/vmdk/disk_info.go index 6c919f10e..ca6f70294 100644 --- a/vendor/github.com/vmware/govmomi/vmdk/disk_info.go +++ b/vendor/github.com/vmware/govmomi/vmdk/disk_info.go @@ -26,12 +26,18 @@ import ( "github.com/vmware/govmomi/vim25/types" ) +type VirtualDiskCryptoKey struct { + KeyID string + ProviderID string +} + type VirtualDiskInfo struct { CapacityInBytes int64 DeviceKey int32 FileName string Size int64 UniqueSize int64 + CryptoKey VirtualDiskCryptoKey } // GetVirtualDiskInfoByUUID returns information about a virtual disk identified @@ -87,8 +93,9 @@ func GetVirtualDiskInfoByUUID( // Find the disk by UUID by inspecting all of the disk backing types that // can have an associated UUID. var ( - disk *types.VirtualDisk - fileName string + disk *types.VirtualDisk + fileName string + cryptoKey *types.CryptoKeyId ) for i := range mo.Config.Hardware.Device { switch tvd := mo.Config.Hardware.Device[i].(type) { @@ -98,11 +105,13 @@ func GetVirtualDiskInfoByUUID( if tb.Uuid == diskUUID { disk = tvd fileName = tb.FileName + cryptoKey = tb.KeyId } case *types.VirtualDiskSeSparseBackingInfo: if tb.Uuid == diskUUID { disk = tvd fileName = tb.FileName + cryptoKey = tb.KeyId } case *types.VirtualDiskRawDiskMappingVer1BackingInfo: if tb.Uuid == diskUUID { @@ -113,6 +122,7 @@ func GetVirtualDiskInfoByUUID( if tb.Uuid == diskUUID { disk = tvd fileName = tb.FileName + cryptoKey = tb.KeyId } case *types.VirtualDiskRawDiskVer2BackingInfo: if tb.Uuid == diskUUID { @@ -154,11 +164,20 @@ func GetVirtualDiskInfoByUUID( } } - return VirtualDiskInfo{ + di := VirtualDiskInfo{ CapacityInBytes: disk.CapacityInBytes, DeviceKey: disk.Key, FileName: fileName, Size: size, UniqueSize: uniqueSize, - }, nil + } + + if ck := cryptoKey; ck != nil { + di.CryptoKey.KeyID = ck.KeyId + if pid := ck.ProviderId; pid != nil { + di.CryptoKey.ProviderID = pid.Id + } + } + + return di, nil } diff --git a/vendor/github.com/vmware/govmomi/vmdk/import.go b/vendor/github.com/vmware/govmomi/vmdk/import.go index 9354a5537..73708ceee 100644 --- a/vendor/github.com/vmware/govmomi/vmdk/import.go +++ b/vendor/github.com/vmware/govmomi/vmdk/import.go @@ -263,7 +263,7 @@ func Import(ctx context.Context, c *vim25.Client, name string, datastore *object EntityName: disk.ImportName, } - spec, err := m.CreateImportSpec(ctx, descriptor, pool, datastore, params) + spec, err := m.CreateImportSpec(ctx, descriptor, pool, datastore, ¶ms) if err != nil { return err } diff --git a/vendor/modules.txt b/vendor/modules.txt index f914bbc61..9e27b239c 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1208,20 +1208,21 @@ github.com/vbauerster/mpb/v8 github.com/vbauerster/mpb/v8/cwriter github.com/vbauerster/mpb/v8/decor github.com/vbauerster/mpb/v8/internal -# github.com/vmware/govmomi v0.42.0 +# github.com/vmware/govmomi v0.48.0 ## explicit; go 1.21 github.com/vmware/govmomi +github.com/vmware/govmomi/cli +github.com/vmware/govmomi/cli/datastore +github.com/vmware/govmomi/cli/esx +github.com/vmware/govmomi/cli/flags +github.com/vmware/govmomi/cli/importx +github.com/vmware/govmomi/cli/vm +github.com/vmware/govmomi/cli/vm/guest github.com/vmware/govmomi/cns github.com/vmware/govmomi/cns/methods github.com/vmware/govmomi/cns/types +github.com/vmware/govmomi/fault github.com/vmware/govmomi/find -github.com/vmware/govmomi/govc/cli -github.com/vmware/govmomi/govc/datastore -github.com/vmware/govmomi/govc/flags -github.com/vmware/govmomi/govc/host/esxcli -github.com/vmware/govmomi/govc/importx -github.com/vmware/govmomi/govc/vm -github.com/vmware/govmomi/govc/vm/guest github.com/vmware/govmomi/guest github.com/vmware/govmomi/guest/toolbox github.com/vmware/govmomi/history