From ec4aade1d067c56b4a6f2188187d60e528a5b447 Mon Sep 17 00:00:00 2001 From: pulumi-bot Date: Wed, 25 Oct 2023 02:38:24 +0000 Subject: [PATCH 1/2] make tfgen --- provider/go.mod | 2 +- provider/go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/provider/go.mod b/provider/go.mod index 8a18ed52..7758fdf9 100644 --- a/provider/go.mod +++ b/provider/go.mod @@ -11,7 +11,7 @@ replace ( require ( github.com/hashicorp/terraform-provider-vsphere v2.3.1+incompatible - github.com/pulumi/pulumi-terraform-bridge/v3 v3.63.0 + github.com/pulumi/pulumi-terraform-bridge/v3 v3.63.1 github.com/pulumi/pulumi/sdk/v3 v3.90.1 ) diff --git a/provider/go.sum b/provider/go.sum index 2a0741a7..4d6095db 100644 --- a/provider/go.sum +++ b/provider/go.sum @@ -2155,8 +2155,8 @@ github.com/pulumi/pulumi-java/pkg v0.9.8 h1:c8mYsalnRXA2Ibgvv6scefOn6mW1Vb0UT0mc github.com/pulumi/pulumi-java/pkg v0.9.8/go.mod h1:c6rSw/+q4O0IImgJ9axxoC6QesbPYWBaG5gimbHouUQ= github.com/pulumi/pulumi-terraform-bridge/testing v0.0.1 h1:SCg1gjfY9N4yn8U8peIUYATifjoDABkyR7H9lmefsfc= github.com/pulumi/pulumi-terraform-bridge/testing v0.0.1/go.mod h1:7OeUPH8rpt5ipyj9EFcnXpuzQ8SHL0dyqdfa8nOacdk= -github.com/pulumi/pulumi-terraform-bridge/v3 v3.63.0 h1:otdmkNsMGyZ+proUZClznZo+cEchkSSkmaGcq+Gf+6s= -github.com/pulumi/pulumi-terraform-bridge/v3 v3.63.0/go.mod h1:6YVbDo019OeHkQWo9MnUbBy6cCgCQeoXZDjmR9SYmUA= +github.com/pulumi/pulumi-terraform-bridge/v3 v3.63.1 h1:hBgediyT2LdS5yfD5AMiCmBJ/TYP94Xxv6a4TcAfV0g= +github.com/pulumi/pulumi-terraform-bridge/v3 v3.63.1/go.mod h1:6YVbDo019OeHkQWo9MnUbBy6cCgCQeoXZDjmR9SYmUA= github.com/pulumi/pulumi-terraform-bridge/x/muxer v0.0.4 h1:rIzMmtcVpPX8ynaz6/nW5AHNY63DiNfCohqmxWvMpM4= github.com/pulumi/pulumi-terraform-bridge/x/muxer v0.0.4/go.mod h1:Kt8RIZWa/N8rW3+0g6NrqCBmF3o+HuIhFaZpssEkG6w= github.com/pulumi/pulumi-yaml v1.2.2 h1:W6BeUBLhDrJ2GSU0em1AUVelG9PBI4ABY61DdhJOO3E= From 195a5d9a28c3dfc24f2ad8c4d83fff8e68913e49 Mon Sep 17 00:00:00 2001 From: pulumi-bot Date: Wed, 25 Oct 2023 02:40:13 +0000 Subject: [PATCH 2/2] make build_sdks --- sdk/dotnet/ComputeClusterVmAffinityRule.cs | 129 ++++++++++ sdk/dotnet/Datacenter.cs | 31 +++ sdk/dotnet/DistributedVirtualSwitch.cs | 84 ++++++ sdk/dotnet/File.cs | 44 ++++ sdk/dotnet/GetComputeCluster.cs | 56 ++++ sdk/dotnet/GetComputeClusterHostGroup.cs | 82 ++++++ sdk/dotnet/GetContentLibrary.cs | 44 ++++ sdk/dotnet/GetCustomAttribute.cs | 44 ++++ sdk/dotnet/GetDatacenter.cs | 44 ++++ sdk/dotnet/GetDatastore.cs | 58 +++++ sdk/dotnet/GetDatastoreCluster.cs | 56 ++++ sdk/dotnet/GetDistributedVirtualSwitch.cs | 92 +++++++ sdk/dotnet/GetDynamic.cs | 88 +++++++ sdk/dotnet/GetFolder.cs | 44 ++++ sdk/dotnet/GetHost.cs | 56 ++++ sdk/dotnet/GetHostPciDevice.cs | 62 +++++ sdk/dotnet/GetHostThumbprint.cs | 44 ++++ sdk/dotnet/GetLicense.cs | 44 ++++ sdk/dotnet/GetNetwork.cs | 56 ++++ sdk/dotnet/GetPolicy.cs | 54 ++++ sdk/dotnet/GetResourcePool.cs | 120 +++++++++ sdk/dotnet/GetRole.cs | 46 ++++ sdk/dotnet/GetTag.cs | 56 ++++ sdk/dotnet/GetTagCategory.cs | 44 ++++ sdk/dotnet/GetVappContainer.cs | 56 ++++ sdk/dotnet/GetVirtualMachine.cs | 122 +++++++++ sdk/dotnet/GetVmfsDisks.cs | 72 ++++++ sdk/dotnet/Host.cs | 90 +++++++ sdk/dotnet/HostPortGroup.cs | 122 +++++++++ .../Inputs/ComputeClusterVsanDiskGroupArgs.cs | 40 +++ .../ComputeClusterVsanDiskGroupGetArgs.cs | 40 +++ sdk/dotnet/License.cs | 23 ++ .../Outputs/ComputeClusterVsanDiskGroup.cs | 40 +++ sdk/dotnet/ResourcePool.cs | 87 +++++++ sdk/dotnet/VirtualMachineSnapshot.cs | 24 ++ sdk/dotnet/VmStoragePolicy.cs | 218 ++++++++++++++++ sdk/dotnet/Vnic.cs | 137 ++++++++++ .../vsphere/computeClusterVmAffinityRule.go | 140 ++++++++++ sdk/go/vsphere/datacenter.go | 48 ++++ sdk/go/vsphere/distributedVirtualSwitch.go | 183 +++++++++++++ sdk/go/vsphere/file.go | 60 +++++ sdk/go/vsphere/getComputeCluster.go | 33 +++ sdk/go/vsphere/getComputeClusterHostGroup.go | 48 ++++ sdk/go/vsphere/getContentLibrary.go | 26 ++ sdk/go/vsphere/getCustomAttribute.go | 26 ++ sdk/go/vsphere/getDatacenter.go | 26 ++ sdk/go/vsphere/getDatastore.go | 33 +++ sdk/go/vsphere/getDatastoreCluster.go | 33 +++ sdk/go/vsphere/getDistributedVirtualSwitch.go | 50 ++++ sdk/go/vsphere/getDynamic.go | 49 ++++ sdk/go/vsphere/getFolder.go | 26 ++ sdk/go/vsphere/getHost.go | 33 +++ sdk/go/vsphere/getHostPciDevice.go | 39 +++ sdk/go/vsphere/getHostThumbprint.go | 26 ++ sdk/go/vsphere/getLicense.go | 26 ++ sdk/go/vsphere/getNetwork.go | 33 +++ sdk/go/vsphere/getPolicy.go | 32 +++ sdk/go/vsphere/getResourcePool.go | 71 ++++++ sdk/go/vsphere/getRole.go | 26 ++ sdk/go/vsphere/getTag.go | 33 +++ sdk/go/vsphere/getTagCategory.go | 26 ++ sdk/go/vsphere/getVappContainer.go | 33 +++ sdk/go/vsphere/getVirtualMachine.go | 76 ++++++ sdk/go/vsphere/getVmfsDisks.go | 41 +++ sdk/go/vsphere/host.go | 118 +++++++++ sdk/go/vsphere/hostPortGroup.go | 145 +++++++++++ sdk/go/vsphere/license.go | 30 +++ sdk/go/vsphere/pulumiTypes.go | 125 +++++++++ sdk/go/vsphere/resourcePool.go | 115 +++++++++ sdk/go/vsphere/virtualMachineSnapshot.go | 32 +++ sdk/go/vsphere/vmStoragePolicy.go | 240 ++++++++++++++++++ sdk/go/vsphere/vnic.go | 159 ++++++++++++ sdk/nodejs/computeClusterVmAffinityRule.ts | 81 ++++++ sdk/nodejs/datacenter.ts | 16 ++ sdk/nodejs/distributedVirtualSwitch.ts | 48 ++++ sdk/nodejs/file.ts | 30 +++ sdk/nodejs/getComputeCluster.ts | 30 +++ sdk/nodejs/getComputeClusterHostGroup.ts | 48 ++++ sdk/nodejs/getContentLibrary.ts | 22 ++ sdk/nodejs/getCustomAttribute.ts | 22 ++ sdk/nodejs/getDatacenter.ts | 22 ++ sdk/nodejs/getDatastore.ts | 30 +++ sdk/nodejs/getDatastoreCluster.ts | 30 +++ sdk/nodejs/getDistributedVirtualSwitch.ts | 50 ++++ sdk/nodejs/getDynamic.ts | 54 ++++ sdk/nodejs/getFolder.ts | 22 ++ sdk/nodejs/getHost.ts | 30 +++ sdk/nodejs/getHostPciDevice.ts | 36 +++ sdk/nodejs/getHostThumbprint.ts | 22 ++ sdk/nodejs/getLicense.ts | 22 ++ sdk/nodejs/getNetwork.ts | 30 +++ sdk/nodejs/getPolicy.ts | 28 ++ sdk/nodejs/getResourcePool.ts | 76 ++++++ sdk/nodejs/getRole.ts | 22 ++ sdk/nodejs/getTag.ts | 30 +++ sdk/nodejs/getTagCategory.ts | 22 ++ sdk/nodejs/getVappContainer.ts | 30 +++ sdk/nodejs/getVirtualMachine.ts | 74 ++++++ sdk/nodejs/getVmfsDisks.ts | 40 +++ sdk/nodejs/host.ts | 60 +++++ sdk/nodejs/hostPortGroup.ts | 76 ++++++ sdk/nodejs/license.ts | 15 ++ sdk/nodejs/resourcePool.ts | 48 ++++ sdk/nodejs/types/input.ts | 26 ++ sdk/nodejs/types/output.ts | 26 ++ sdk/nodejs/virtualMachineSnapshot.ts | 17 ++ sdk/nodejs/vmStoragePolicy.ts | 129 ++++++++++ sdk/nodejs/vnic.ts | 84 ++++++ sdk/python/pulumi_vsphere/_inputs.py | 50 ++++ .../compute_cluster_vm_affinity_rule.py | 126 +++++++++ sdk/python/pulumi_vsphere/datacenter.py | 32 +++ .../distributed_virtual_switch.py | 112 ++++++++ sdk/python/pulumi_vsphere/file.py | 56 ++++ .../pulumi_vsphere/get_compute_cluster.py | 22 ++ .../get_compute_cluster_host_group.py | 34 +++ .../pulumi_vsphere/get_content_library.py | 18 ++ .../pulumi_vsphere/get_custom_attribute.py | 18 ++ sdk/python/pulumi_vsphere/get_datacenter.py | 18 ++ sdk/python/pulumi_vsphere/get_datastore.py | 22 ++ .../pulumi_vsphere/get_datastore_cluster.py | 22 ++ .../get_distributed_virtual_switch.py | 40 +++ sdk/python/pulumi_vsphere/get_dynamic.py | 38 +++ sdk/python/pulumi_vsphere/get_folder.py | 18 ++ sdk/python/pulumi_vsphere/get_host.py | 22 ++ .../pulumi_vsphere/get_host_pci_device.py | 28 +- .../pulumi_vsphere/get_host_thumbprint.py | 18 ++ sdk/python/pulumi_vsphere/get_license.py | 18 ++ sdk/python/pulumi_vsphere/get_network.py | 22 ++ sdk/python/pulumi_vsphere/get_policy.py | 20 ++ .../pulumi_vsphere/get_resource_pool.py | 64 +++++ sdk/python/pulumi_vsphere/get_role.py | 18 ++ sdk/python/pulumi_vsphere/get_tag.py | 22 ++ sdk/python/pulumi_vsphere/get_tag_category.py | 18 ++ .../pulumi_vsphere/get_vapp_container.py | 22 ++ .../pulumi_vsphere/get_virtual_machine.py | 54 ++++ sdk/python/pulumi_vsphere/get_vmfs_disks.py | 28 ++ sdk/python/pulumi_vsphere/host.py | 96 +++++++ sdk/python/pulumi_vsphere/host_port_group.py | 128 ++++++++++ sdk/python/pulumi_vsphere/license.py | 28 ++ sdk/python/pulumi_vsphere/outputs.py | 50 ++++ sdk/python/pulumi_vsphere/resource_pool.py | 80 ++++++ .../virtual_machine_snapshot.py | 32 +++ .../pulumi_vsphere/vm_storage_policy.py | 202 +++++++++++++++ sdk/python/pulumi_vsphere/vnic.py | 140 ++++++++++ 144 files changed, 7971 insertions(+), 2 deletions(-) diff --git a/sdk/dotnet/ComputeClusterVmAffinityRule.cs b/sdk/dotnet/ComputeClusterVmAffinityRule.cs index e67e6c0c..d70be3b9 100644 --- a/sdk/dotnet/ComputeClusterVmAffinityRule.cs +++ b/sdk/dotnet/ComputeClusterVmAffinityRule.cs @@ -31,6 +31,135 @@ namespace Pulumi.VSphere /// direct ESXi host connections. /// /// > **NOTE:** vSphere DRS requires a vSphere Enterprise Plus license. + /// + /// ## Example Usage + /// + /// The following example creates two virtual machines in a cluster using the + /// `vsphere.VirtualMachine` resource, creating the + /// virtual machines in the cluster looked up by the + /// `vsphere.ComputeCluster` data source. It + /// then creates an affinity rule for these two virtual machines, ensuring they + /// will run on the same host whenever possible. + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var datacenter = VSphere.GetDatacenter.Invoke(new() + /// { + /// Name = "dc-01", + /// }); + /// + /// var datastore = VSphere.GetDatastore.Invoke(new() + /// { + /// Name = "datastore-01", + /// DatacenterId = datacenter.Apply(getDatacenterResult => getDatacenterResult.Id), + /// }); + /// + /// var cluster = VSphere.GetComputeCluster.Invoke(new() + /// { + /// Name = "cluster-01", + /// DatacenterId = datacenter.Apply(getDatacenterResult => getDatacenterResult.Id), + /// }); + /// + /// var network = VSphere.GetNetwork.Invoke(new() + /// { + /// Name = "VM Network", + /// DatacenterId = datacenter.Apply(getDatacenterResult => getDatacenterResult.Id), + /// }); + /// + /// var vm = new List<VSphere.VirtualMachine>(); + /// for (var rangeIndex = 0; rangeIndex < 2; rangeIndex++) + /// { + /// var range = new { Value = rangeIndex }; + /// vm.Add(new VSphere.VirtualMachine($"vm-{range.Value}", new() + /// { + /// ResourcePoolId = cluster.Apply(getComputeClusterResult => getComputeClusterResult.ResourcePoolId), + /// DatastoreId = datastore.Apply(getDatastoreResult => getDatastoreResult.Id), + /// NumCpus = 1, + /// Memory = 1024, + /// GuestId = "otherLinux64Guest", + /// NetworkInterfaces = new[] + /// { + /// new VSphere.Inputs.VirtualMachineNetworkInterfaceArgs + /// { + /// NetworkId = network.Apply(getNetworkResult => getNetworkResult.Id), + /// }, + /// }, + /// Disks = new[] + /// { + /// new VSphere.Inputs.VirtualMachineDiskArgs + /// { + /// Label = "disk0", + /// Size = 20, + /// }, + /// }, + /// })); + /// } + /// var vmAffinityRule = new VSphere.ComputeClusterVmAffinityRule("vmAffinityRule", new() + /// { + /// ComputeClusterId = cluster.Apply(getComputeClusterResult => getComputeClusterResult.Id), + /// VirtualMachineIds = vm.Select((value, i) => new { Key = i.ToString(), Value = pair.Value }).Select(v => + /// { + /// return v.Id; + /// }).ToList(), + /// }); + /// + /// }); + /// ``` + /// + /// The following example creates an affinity rule for a set of virtual machines + /// in the cluster by looking up the virtual machine UUIDs from the + /// `vsphere.VirtualMachine` data source. + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var vms = new[] + /// { + /// "foo-0", + /// "foo-1", + /// }; + /// + /// var datacenter = VSphere.GetDatacenter.Invoke(new() + /// { + /// Name = "dc-01", + /// }); + /// + /// var cluster = VSphere.GetComputeCluster.Invoke(new() + /// { + /// Name = "cluster-01", + /// DatacenterId = datacenter.Apply(getDatacenterResult => getDatacenterResult.Id), + /// }); + /// + /// var vmsVirtualMachine = "TODO: Range range( length(vms) + /// ) false".Select(__index => + /// { + /// return VSphere.GetVirtualMachine.Invoke(new() + /// { + /// Name = vms[__index], + /// DatacenterId = _arg0_.Id, + /// }); + /// }).ToList(); + /// + /// var vmAffinityRule = new VSphere.ComputeClusterVmAffinityRule("vmAffinityRule", new() + /// { + /// Enabled = true, + /// ComputeClusterId = cluster.Apply(getComputeClusterResult => getComputeClusterResult.Id), + /// VirtualMachineIds = vmsVirtualMachine.Select(__item => __item.Id).ToList(), + /// }); + /// + /// }); + /// ``` /// [VSphereResourceType("vsphere:index/computeClusterVmAffinityRule:ComputeClusterVmAffinityRule")] public partial class ComputeClusterVmAffinityRule : global::Pulumi.CustomResource diff --git a/sdk/dotnet/Datacenter.cs b/sdk/dotnet/Datacenter.cs index 87f0834a..e52500e0 100644 --- a/sdk/dotnet/Datacenter.cs +++ b/sdk/dotnet/Datacenter.cs @@ -14,6 +14,37 @@ namespace Pulumi.VSphere /// container of inventory objects such as hosts and virtual machines. /// /// ## Example Usage + /// ### Create datacenter on the root folder + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var prodDatacenter = new VSphere.Datacenter("prodDatacenter"); + /// + /// }); + /// ``` + /// ### Create datacenter on a subfolder + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var researchDatacenter = new VSphere.Datacenter("researchDatacenter", new() + /// { + /// Folder = "/research/", + /// }); + /// + /// }); + /// ``` /// [VSphereResourceType("vsphere:index/datacenter:Datacenter")] public partial class Datacenter : global::Pulumi.CustomResource diff --git a/sdk/dotnet/DistributedVirtualSwitch.cs b/sdk/dotnet/DistributedVirtualSwitch.cs index 36006f67..e4a8cd23 100644 --- a/sdk/dotnet/DistributedVirtualSwitch.cs +++ b/sdk/dotnet/DistributedVirtualSwitch.cs @@ -607,6 +607,34 @@ public partial class DistributedVirtualSwitch : global::Pulumi.CustomResource /// and `max_vlan` sub-arguments to define the tagged VLAN range. Multiple /// `vlan_range` definitions are allowed, but they must not overlap. Example /// below: + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var vds = new VSphere.DistributedVirtualSwitch("vds", new() + /// { + /// VlanRanges = new[] + /// { + /// new VSphere.Inputs.DistributedVirtualSwitchVlanRangeArgs + /// { + /// MaxVlan = 199, + /// MinVlan = 100, + /// }, + /// new VSphere.Inputs.DistributedVirtualSwitchVlanRangeArgs + /// { + /// MaxVlan = 399, + /// MinVlan = 300, + /// }, + /// }, + /// }); + /// + /// }); + /// ``` /// [Output("vlanRanges")] public Output> VlanRanges { get; private set; } = null!; @@ -1338,6 +1366,34 @@ public InputList Uplinks /// and `max_vlan` sub-arguments to define the tagged VLAN range. Multiple /// `vlan_range` definitions are allowed, but they must not overlap. Example /// below: + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var vds = new VSphere.DistributedVirtualSwitch("vds", new() + /// { + /// VlanRanges = new[] + /// { + /// new VSphere.Inputs.DistributedVirtualSwitchVlanRangeArgs + /// { + /// MaxVlan = 199, + /// MinVlan = 100, + /// }, + /// new VSphere.Inputs.DistributedVirtualSwitchVlanRangeArgs + /// { + /// MaxVlan = 399, + /// MinVlan = 300, + /// }, + /// }, + /// }); + /// + /// }); + /// ``` /// public InputList VlanRanges { @@ -2041,6 +2097,34 @@ public InputList Uplinks /// and `max_vlan` sub-arguments to define the tagged VLAN range. Multiple /// `vlan_range` definitions are allowed, but they must not overlap. Example /// below: + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var vds = new VSphere.DistributedVirtualSwitch("vds", new() + /// { + /// VlanRanges = new[] + /// { + /// new VSphere.Inputs.DistributedVirtualSwitchVlanRangeArgs + /// { + /// MaxVlan = 199, + /// MinVlan = 100, + /// }, + /// new VSphere.Inputs.DistributedVirtualSwitchVlanRangeArgs + /// { + /// MaxVlan = 399, + /// MinVlan = 300, + /// }, + /// }, + /// }); + /// + /// }); + /// ``` /// public InputList VlanRanges { diff --git a/sdk/dotnet/File.cs b/sdk/dotnet/File.cs index 34f20304..8d6576ec 100644 --- a/sdk/dotnet/File.cs +++ b/sdk/dotnet/File.cs @@ -11,6 +11,50 @@ namespace Pulumi.VSphere { /// /// ## Example Usage + /// ### Uploading a File + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var ubuntuVmdkUpload = new VSphere.File("ubuntuVmdkUpload", new() + /// { + /// CreateDirectories = true, + /// Datacenter = "dc-01", + /// Datastore = "datastore-01", + /// DestinationFile = "/my/dst/path/custom_ubuntu.vmdk", + /// SourceFile = "/my/src/path/custom_ubuntu.vmdk", + /// }); + /// + /// }); + /// ``` + /// ### Copying a File + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var ubuntuCopy = new VSphere.File("ubuntuCopy", new() + /// { + /// CreateDirectories = true, + /// Datacenter = "dc-01", + /// Datastore = "datastore-01", + /// DestinationFile = "/my/dst/path/custom_ubuntu.vmdk", + /// SourceDatacenter = "dc-01", + /// SourceDatastore = "datastore-01", + /// SourceFile = "/my/src/path/custom_ubuntu.vmdk", + /// }); + /// + /// }); + /// ``` /// [VSphereResourceType("vsphere:index/file:File")] public partial class File : global::Pulumi.CustomResource diff --git a/sdk/dotnet/GetComputeCluster.cs b/sdk/dotnet/GetComputeCluster.cs index 821c18fb..5f5864bb 100644 --- a/sdk/dotnet/GetComputeCluster.cs +++ b/sdk/dotnet/GetComputeCluster.cs @@ -21,6 +21,34 @@ public static class GetComputeCluster /// > You may also wish to see the `vsphere.ComputeCluster` /// resource for more information about clusters and how to managed the resource /// in this provider. + /// + /// {{% examples %}} + /// ## Example Usage + /// {{% example %}} + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var datacenter = VSphere.GetDatacenter.Invoke(new() + /// { + /// Name = "dc-01", + /// }); + /// + /// var computeCluster = VSphere.GetComputeCluster.Invoke(new() + /// { + /// Name = "cluster-01", + /// DatacenterId = datacenter.Apply(getDatacenterResult => getDatacenterResult.Id), + /// }); + /// + /// }); + /// ``` + /// {{% /example %}} + /// {{% /examples %}} /// public static Task InvokeAsync(GetComputeClusterArgs args, InvokeOptions? options = null) => global::Pulumi.Deployment.Instance.InvokeAsync("vsphere:index/getComputeCluster:getComputeCluster", args ?? new GetComputeClusterArgs(), options.WithDefaults()); @@ -35,6 +63,34 @@ public static Task InvokeAsync(GetComputeClusterArgs ar /// > You may also wish to see the `vsphere.ComputeCluster` /// resource for more information about clusters and how to managed the resource /// in this provider. + /// + /// {{% examples %}} + /// ## Example Usage + /// {{% example %}} + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var datacenter = VSphere.GetDatacenter.Invoke(new() + /// { + /// Name = "dc-01", + /// }); + /// + /// var computeCluster = VSphere.GetComputeCluster.Invoke(new() + /// { + /// Name = "cluster-01", + /// DatacenterId = datacenter.Apply(getDatacenterResult => getDatacenterResult.Id), + /// }); + /// + /// }); + /// ``` + /// {{% /example %}} + /// {{% /examples %}} /// public static Output Invoke(GetComputeClusterInvokeArgs args, InvokeOptions? options = null) => global::Pulumi.Deployment.Instance.Invoke("vsphere:index/getComputeCluster:getComputeCluster", args ?? new GetComputeClusterInvokeArgs(), options.WithDefaults()); diff --git a/sdk/dotnet/GetComputeClusterHostGroup.cs b/sdk/dotnet/GetComputeClusterHostGroup.cs index 51761a81..5b60aa35 100644 --- a/sdk/dotnet/GetComputeClusterHostGroup.cs +++ b/sdk/dotnet/GetComputeClusterHostGroup.cs @@ -15,6 +15,47 @@ public static class GetComputeClusterHostGroup /// The `vsphere.ComputeClusterHostGroup` data source can be used to discover /// the IDs ESXi hosts in a host group and return host group attributes to other /// resources. + /// + /// {{% examples %}} + /// ## Example Usage + /// {{% example %}} + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var datacenter = VSphere.GetDatacenter.Invoke(new() + /// { + /// Name = @var.Vsphere_datacenter, + /// }); + /// + /// var cluster = VSphere.GetComputeCluster.Invoke(new() + /// { + /// Name = @var.Vsphere_cluster, + /// DatacenterId = datacenter.Apply(getDatacenterResult => getDatacenterResult.Id), + /// }); + /// + /// var hostGroup1 = VSphere.GetComputeClusterHostGroup.Invoke(new() + /// { + /// Name = "host_group1", + /// ComputeClusterId = cluster.Apply(getComputeClusterResult => getComputeClusterResult.Id), + /// }); + /// + /// var hostRule1 = new VSphere.ComputeClusterVmHostRule("hostRule1", new() + /// { + /// ComputeClusterId = cluster.Apply(getComputeClusterResult => getComputeClusterResult.Id), + /// VmGroupName = "vm_group1", + /// AffinityHostGroupName = hostGroup1.Apply(getComputeClusterHostGroupResult => getComputeClusterHostGroupResult.Name), + /// }); + /// + /// }); + /// ``` + /// {{% /example %}} + /// {{% /examples %}} /// public static Task InvokeAsync(GetComputeClusterHostGroupArgs args, InvokeOptions? options = null) => global::Pulumi.Deployment.Instance.InvokeAsync("vsphere:index/getComputeClusterHostGroup:getComputeClusterHostGroup", args ?? new GetComputeClusterHostGroupArgs(), options.WithDefaults()); @@ -23,6 +64,47 @@ public static Task InvokeAsync(GetComputeClust /// The `vsphere.ComputeClusterHostGroup` data source can be used to discover /// the IDs ESXi hosts in a host group and return host group attributes to other /// resources. + /// + /// {{% examples %}} + /// ## Example Usage + /// {{% example %}} + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var datacenter = VSphere.GetDatacenter.Invoke(new() + /// { + /// Name = @var.Vsphere_datacenter, + /// }); + /// + /// var cluster = VSphere.GetComputeCluster.Invoke(new() + /// { + /// Name = @var.Vsphere_cluster, + /// DatacenterId = datacenter.Apply(getDatacenterResult => getDatacenterResult.Id), + /// }); + /// + /// var hostGroup1 = VSphere.GetComputeClusterHostGroup.Invoke(new() + /// { + /// Name = "host_group1", + /// ComputeClusterId = cluster.Apply(getComputeClusterResult => getComputeClusterResult.Id), + /// }); + /// + /// var hostRule1 = new VSphere.ComputeClusterVmHostRule("hostRule1", new() + /// { + /// ComputeClusterId = cluster.Apply(getComputeClusterResult => getComputeClusterResult.Id), + /// VmGroupName = "vm_group1", + /// AffinityHostGroupName = hostGroup1.Apply(getComputeClusterHostGroupResult => getComputeClusterHostGroupResult.Name), + /// }); + /// + /// }); + /// ``` + /// {{% /example %}} + /// {{% /examples %}} /// public static Output Invoke(GetComputeClusterHostGroupInvokeArgs args, InvokeOptions? options = null) => global::Pulumi.Deployment.Instance.Invoke("vsphere:index/getComputeClusterHostGroup:getComputeClusterHostGroup", args ?? new GetComputeClusterHostGroupInvokeArgs(), options.WithDefaults()); diff --git a/sdk/dotnet/GetContentLibrary.cs b/sdk/dotnet/GetContentLibrary.cs index 179cfe1b..a50d61a0 100644 --- a/sdk/dotnet/GetContentLibrary.cs +++ b/sdk/dotnet/GetContentLibrary.cs @@ -15,6 +15,28 @@ public static class GetContentLibrary /// The `vsphere.ContentLibrary` data source can be used to discover the ID of a content library. /// /// > **NOTE:** This resource requires vCenter Server and is not available on direct ESXi host connections. + /// + /// {{% examples %}} + /// ## Example Usage + /// {{% example %}} + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var library = VSphere.GetContentLibrary.Invoke(new() + /// { + /// Name = "Content Library", + /// }); + /// + /// }); + /// ``` + /// {{% /example %}} + /// {{% /examples %}} /// public static Task InvokeAsync(GetContentLibraryArgs args, InvokeOptions? options = null) => global::Pulumi.Deployment.Instance.InvokeAsync("vsphere:index/getContentLibrary:getContentLibrary", args ?? new GetContentLibraryArgs(), options.WithDefaults()); @@ -23,6 +45,28 @@ public static Task InvokeAsync(GetContentLibraryArgs ar /// The `vsphere.ContentLibrary` data source can be used to discover the ID of a content library. /// /// > **NOTE:** This resource requires vCenter Server and is not available on direct ESXi host connections. + /// + /// {{% examples %}} + /// ## Example Usage + /// {{% example %}} + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var library = VSphere.GetContentLibrary.Invoke(new() + /// { + /// Name = "Content Library", + /// }); + /// + /// }); + /// ``` + /// {{% /example %}} + /// {{% /examples %}} /// public static Output Invoke(GetContentLibraryInvokeArgs args, InvokeOptions? options = null) => global::Pulumi.Deployment.Instance.Invoke("vsphere:index/getContentLibrary:getContentLibrary", args ?? new GetContentLibraryInvokeArgs(), options.WithDefaults()); diff --git a/sdk/dotnet/GetCustomAttribute.cs b/sdk/dotnet/GetCustomAttribute.cs index bc5f70ad..7c2901b4 100644 --- a/sdk/dotnet/GetCustomAttribute.cs +++ b/sdk/dotnet/GetCustomAttribute.cs @@ -20,6 +20,28 @@ public static class GetCustomAttribute /// /// > **NOTE:** Custom attributes are unsupported on direct ESXi host connections /// and require vCenter Server. + /// + /// {{% examples %}} + /// ## Example Usage + /// {{% example %}} + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var attribute = VSphere.GetCustomAttribute.Invoke(new() + /// { + /// Name = "test-attribute", + /// }); + /// + /// }); + /// ``` + /// {{% /example %}} + /// {{% /examples %}} /// public static Task InvokeAsync(GetCustomAttributeArgs args, InvokeOptions? options = null) => global::Pulumi.Deployment.Instance.InvokeAsync("vsphere:index/getCustomAttribute:getCustomAttribute", args ?? new GetCustomAttributeArgs(), options.WithDefaults()); @@ -33,6 +55,28 @@ public static Task InvokeAsync(GetCustomAttributeArgs /// /// > **NOTE:** Custom attributes are unsupported on direct ESXi host connections /// and require vCenter Server. + /// + /// {{% examples %}} + /// ## Example Usage + /// {{% example %}} + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var attribute = VSphere.GetCustomAttribute.Invoke(new() + /// { + /// Name = "test-attribute", + /// }); + /// + /// }); + /// ``` + /// {{% /example %}} + /// {{% /examples %}} /// public static Output Invoke(GetCustomAttributeInvokeArgs args, InvokeOptions? options = null) => global::Pulumi.Deployment.Instance.Invoke("vsphere:index/getCustomAttribute:getCustomAttribute", args ?? new GetCustomAttributeInvokeArgs(), options.WithDefaults()); diff --git a/sdk/dotnet/GetDatacenter.cs b/sdk/dotnet/GetDatacenter.cs index b000be9f..f49fdb44 100644 --- a/sdk/dotnet/GetDatacenter.cs +++ b/sdk/dotnet/GetDatacenter.cs @@ -16,6 +16,28 @@ public static class GetDatacenter /// vSphere datacenter object. This can then be used with resources or data sources /// that require a datacenter, such as the `vsphere.Host` /// data source. + /// + /// {{% examples %}} + /// ## Example Usage + /// {{% example %}} + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var datacenter = VSphere.GetDatacenter.Invoke(new() + /// { + /// Name = "dc-01", + /// }); + /// + /// }); + /// ``` + /// {{% /example %}} + /// {{% /examples %}} /// public static Task InvokeAsync(GetDatacenterArgs? args = null, InvokeOptions? options = null) => global::Pulumi.Deployment.Instance.InvokeAsync("vsphere:index/getDatacenter:getDatacenter", args ?? new GetDatacenterArgs(), options.WithDefaults()); @@ -25,6 +47,28 @@ public static Task InvokeAsync(GetDatacenterArgs? args = nu /// vSphere datacenter object. This can then be used with resources or data sources /// that require a datacenter, such as the `vsphere.Host` /// data source. + /// + /// {{% examples %}} + /// ## Example Usage + /// {{% example %}} + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var datacenter = VSphere.GetDatacenter.Invoke(new() + /// { + /// Name = "dc-01", + /// }); + /// + /// }); + /// ``` + /// {{% /example %}} + /// {{% /examples %}} /// public static Output Invoke(GetDatacenterInvokeArgs? args = null, InvokeOptions? options = null) => global::Pulumi.Deployment.Instance.Invoke("vsphere:index/getDatacenter:getDatacenter", args ?? new GetDatacenterInvokeArgs(), options.WithDefaults()); diff --git a/sdk/dotnet/GetDatastore.cs b/sdk/dotnet/GetDatastore.cs index 358a09a0..9e97767e 100644 --- a/sdk/dotnet/GetDatastore.cs +++ b/sdk/dotnet/GetDatastore.cs @@ -16,6 +16,35 @@ public static class GetDatastore /// vSphere datastore object. This can then be used with resources or data sources /// that require a datastore. For example, to create virtual machines in using the /// `vsphere.VirtualMachine` resource. + /// + /// + /// {{% examples %}} + /// ## Example Usage + /// {{% example %}} + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var datacenter = VSphere.GetDatacenter.Invoke(new() + /// { + /// Name = "dc-01", + /// }); + /// + /// var datastore = VSphere.GetDatastore.Invoke(new() + /// { + /// Name = "datastore-01", + /// DatacenterId = datacenter.Apply(getDatacenterResult => getDatacenterResult.Id), + /// }); + /// + /// }); + /// ``` + /// {{% /example %}} + /// {{% /examples %}} /// public static Task InvokeAsync(GetDatastoreArgs args, InvokeOptions? options = null) => global::Pulumi.Deployment.Instance.InvokeAsync("vsphere:index/getDatastore:getDatastore", args ?? new GetDatastoreArgs(), options.WithDefaults()); @@ -25,6 +54,35 @@ public static Task InvokeAsync(GetDatastoreArgs args, Invoke /// vSphere datastore object. This can then be used with resources or data sources /// that require a datastore. For example, to create virtual machines in using the /// `vsphere.VirtualMachine` resource. + /// + /// + /// {{% examples %}} + /// ## Example Usage + /// {{% example %}} + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var datacenter = VSphere.GetDatacenter.Invoke(new() + /// { + /// Name = "dc-01", + /// }); + /// + /// var datastore = VSphere.GetDatastore.Invoke(new() + /// { + /// Name = "datastore-01", + /// DatacenterId = datacenter.Apply(getDatacenterResult => getDatacenterResult.Id), + /// }); + /// + /// }); + /// ``` + /// {{% /example %}} + /// {{% /examples %}} /// public static Output Invoke(GetDatastoreInvokeArgs args, InvokeOptions? options = null) => global::Pulumi.Deployment.Instance.Invoke("vsphere:index/getDatastore:getDatastore", args ?? new GetDatastoreInvokeArgs(), options.WithDefaults()); diff --git a/sdk/dotnet/GetDatastoreCluster.cs b/sdk/dotnet/GetDatastoreCluster.cs index e393842c..0a82cab9 100644 --- a/sdk/dotnet/GetDatastoreCluster.cs +++ b/sdk/dotnet/GetDatastoreCluster.cs @@ -16,6 +16,34 @@ public static class GetDatastoreCluster /// vSphere datastore cluster object. This can then be used with resources or data sources /// that require a datastore. For example, to assign datastores using the /// `vsphere.NasDatastore` or `vsphere.VmfsDatastore` resources, or to create virtual machines in using the `vsphere.VirtualMachine` resource. + /// + /// {{% examples %}} + /// ## Example Usage + /// {{% example %}} + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var datacenter = VSphere.GetDatacenter.Invoke(new() + /// { + /// Name = "dc-01", + /// }); + /// + /// var datastoreCluster = VSphere.GetDatastoreCluster.Invoke(new() + /// { + /// Name = "datastore-cluster-01", + /// DatacenterId = datacenter.Apply(getDatacenterResult => getDatacenterResult.Id), + /// }); + /// + /// }); + /// ``` + /// {{% /example %}} + /// {{% /examples %}} /// public static Task InvokeAsync(GetDatastoreClusterArgs args, InvokeOptions? options = null) => global::Pulumi.Deployment.Instance.InvokeAsync("vsphere:index/getDatastoreCluster:getDatastoreCluster", args ?? new GetDatastoreClusterArgs(), options.WithDefaults()); @@ -25,6 +53,34 @@ public static Task InvokeAsync(GetDatastoreClusterArg /// vSphere datastore cluster object. This can then be used with resources or data sources /// that require a datastore. For example, to assign datastores using the /// `vsphere.NasDatastore` or `vsphere.VmfsDatastore` resources, or to create virtual machines in using the `vsphere.VirtualMachine` resource. + /// + /// {{% examples %}} + /// ## Example Usage + /// {{% example %}} + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var datacenter = VSphere.GetDatacenter.Invoke(new() + /// { + /// Name = "dc-01", + /// }); + /// + /// var datastoreCluster = VSphere.GetDatastoreCluster.Invoke(new() + /// { + /// Name = "datastore-cluster-01", + /// DatacenterId = datacenter.Apply(getDatacenterResult => getDatacenterResult.Id), + /// }); + /// + /// }); + /// ``` + /// {{% /example %}} + /// {{% /examples %}} /// public static Output Invoke(GetDatastoreClusterInvokeArgs args, InvokeOptions? options = null) => global::Pulumi.Deployment.Instance.Invoke("vsphere:index/getDatastoreCluster:getDatastoreCluster", args ?? new GetDatastoreClusterInvokeArgs(), options.WithDefaults()); diff --git a/sdk/dotnet/GetDistributedVirtualSwitch.cs b/sdk/dotnet/GetDistributedVirtualSwitch.cs index faa12dc3..57326913 100644 --- a/sdk/dotnet/GetDistributedVirtualSwitch.cs +++ b/sdk/dotnet/GetDistributedVirtualSwitch.cs @@ -20,6 +20,52 @@ public static class GetDistributedVirtualSwitch /// /// > **NOTE:** This data source requires vCenter Server and is not available on /// direct ESXi host connections. + /// + /// {{% examples %}} + /// ## Example Usage + /// {{% example %}} + /// + /// The following example locates a distributed switch named `vds-01`, in the + /// datacenter `dc-01`. It then uses this distributed switch to set up a + /// `vsphere.DistributedPortGroup` resource that uses the first uplink as a + /// primary uplink and the second uplink as a secondary. + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var datacenter = VSphere.GetDatacenter.Invoke(new() + /// { + /// Name = "dc-01", + /// }); + /// + /// var vds = VSphere.GetDistributedVirtualSwitch.Invoke(new() + /// { + /// Name = "vds-01", + /// DatacenterId = datacenter.Apply(getDatacenterResult => getDatacenterResult.Id), + /// }); + /// + /// var dvpg = new VSphere.DistributedPortGroup("dvpg", new() + /// { + /// DistributedVirtualSwitchUuid = vds.Apply(getDistributedVirtualSwitchResult => getDistributedVirtualSwitchResult.Id), + /// ActiveUplinks = new[] + /// { + /// vds.Apply(getDistributedVirtualSwitchResult => getDistributedVirtualSwitchResult.Uplinks[0]), + /// }, + /// StandbyUplinks = new[] + /// { + /// vds.Apply(getDistributedVirtualSwitchResult => getDistributedVirtualSwitchResult.Uplinks[1]), + /// }, + /// }); + /// + /// }); + /// ``` + /// {{% /example %}} + /// {{% /examples %}} /// public static Task InvokeAsync(GetDistributedVirtualSwitchArgs args, InvokeOptions? options = null) => global::Pulumi.Deployment.Instance.InvokeAsync("vsphere:index/getDistributedVirtualSwitch:getDistributedVirtualSwitch", args ?? new GetDistributedVirtualSwitchArgs(), options.WithDefaults()); @@ -33,6 +79,52 @@ public static Task InvokeAsync(GetDistributed /// /// > **NOTE:** This data source requires vCenter Server and is not available on /// direct ESXi host connections. + /// + /// {{% examples %}} + /// ## Example Usage + /// {{% example %}} + /// + /// The following example locates a distributed switch named `vds-01`, in the + /// datacenter `dc-01`. It then uses this distributed switch to set up a + /// `vsphere.DistributedPortGroup` resource that uses the first uplink as a + /// primary uplink and the second uplink as a secondary. + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var datacenter = VSphere.GetDatacenter.Invoke(new() + /// { + /// Name = "dc-01", + /// }); + /// + /// var vds = VSphere.GetDistributedVirtualSwitch.Invoke(new() + /// { + /// Name = "vds-01", + /// DatacenterId = datacenter.Apply(getDatacenterResult => getDatacenterResult.Id), + /// }); + /// + /// var dvpg = new VSphere.DistributedPortGroup("dvpg", new() + /// { + /// DistributedVirtualSwitchUuid = vds.Apply(getDistributedVirtualSwitchResult => getDistributedVirtualSwitchResult.Id), + /// ActiveUplinks = new[] + /// { + /// vds.Apply(getDistributedVirtualSwitchResult => getDistributedVirtualSwitchResult.Uplinks[0]), + /// }, + /// StandbyUplinks = new[] + /// { + /// vds.Apply(getDistributedVirtualSwitchResult => getDistributedVirtualSwitchResult.Uplinks[1]), + /// }, + /// }); + /// + /// }); + /// ``` + /// {{% /example %}} + /// {{% /examples %}} /// public static Output Invoke(GetDistributedVirtualSwitchInvokeArgs args, InvokeOptions? options = null) => global::Pulumi.Deployment.Instance.Invoke("vsphere:index/getDistributedVirtualSwitch:getDistributedVirtualSwitch", args ?? new GetDistributedVirtualSwitchInvokeArgs(), options.WithDefaults()); diff --git a/sdk/dotnet/GetDynamic.cs b/sdk/dotnet/GetDynamic.cs index d9ef93b8..b7fc08f7 100644 --- a/sdk/dotnet/GetDynamic.cs +++ b/sdk/dotnet/GetDynamic.cs @@ -18,6 +18,50 @@ public static class GetDynamic /// of any tagged managed object in vCenter Server by providing a list of tag IDs /// and an optional regular expression to filter objects by name. /// + /// {{% examples %}} + /// ## Example Usage + /// {{% example %}} + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var category = VSphere.GetTagCategory.Invoke(new() + /// { + /// Name = "SomeCategory", + /// }); + /// + /// var tag1 = VSphere.GetTag.Invoke(new() + /// { + /// Name = "FirstTag", + /// CategoryId = data.Vsphere_tag_category.Cat.Id, + /// }); + /// + /// var tag2 = VSphere.GetTag.Invoke(new() + /// { + /// Name = "SecondTag", + /// CategoryId = data.Vsphere_tag_category.Cat.Id, + /// }); + /// + /// var dyn = VSphere.GetDynamic.Invoke(new() + /// { + /// Filters = new[] + /// { + /// tag1.Apply(getTagResult => getTagResult.Id), + /// tag1.Apply(getTagResult => getTagResult.Id), + /// }, + /// NameRegex = "ubuntu", + /// Type = "Datacenter", + /// }); + /// + /// }); + /// ``` + /// {{% /example %}} + /// {{% /examples %}} /// public static Task InvokeAsync(GetDynamicArgs args, InvokeOptions? options = null) => global::Pulumi.Deployment.Instance.InvokeAsync("vsphere:index/getDynamic:getDynamic", args ?? new GetDynamicArgs(), options.WithDefaults()); @@ -29,6 +73,50 @@ public static Task InvokeAsync(GetDynamicArgs args, InvokeOpti /// of any tagged managed object in vCenter Server by providing a list of tag IDs /// and an optional regular expression to filter objects by name. /// + /// {{% examples %}} + /// ## Example Usage + /// {{% example %}} + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var category = VSphere.GetTagCategory.Invoke(new() + /// { + /// Name = "SomeCategory", + /// }); + /// + /// var tag1 = VSphere.GetTag.Invoke(new() + /// { + /// Name = "FirstTag", + /// CategoryId = data.Vsphere_tag_category.Cat.Id, + /// }); + /// + /// var tag2 = VSphere.GetTag.Invoke(new() + /// { + /// Name = "SecondTag", + /// CategoryId = data.Vsphere_tag_category.Cat.Id, + /// }); + /// + /// var dyn = VSphere.GetDynamic.Invoke(new() + /// { + /// Filters = new[] + /// { + /// tag1.Apply(getTagResult => getTagResult.Id), + /// tag1.Apply(getTagResult => getTagResult.Id), + /// }, + /// NameRegex = "ubuntu", + /// Type = "Datacenter", + /// }); + /// + /// }); + /// ``` + /// {{% /example %}} + /// {{% /examples %}} /// public static Output Invoke(GetDynamicInvokeArgs args, InvokeOptions? options = null) => global::Pulumi.Deployment.Instance.Invoke("vsphere:index/getDynamic:getDynamic", args ?? new GetDynamicInvokeArgs(), options.WithDefaults()); diff --git a/sdk/dotnet/GetFolder.cs b/sdk/dotnet/GetFolder.cs index fd436a01..5aac10ed 100644 --- a/sdk/dotnet/GetFolder.cs +++ b/sdk/dotnet/GetFolder.cs @@ -14,6 +14,28 @@ public static class GetFolder /// /// The `vsphere.Folder` data source can be used to get the general attributes of a /// vSphere inventory folder. Paths are absolute and must include the datacenter. + /// + /// {{% examples %}} + /// ## Example Usage + /// {{% example %}} + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var folder = VSphere.GetFolder.Invoke(new() + /// { + /// Path = "/dc-01/datastore-01/folder-01", + /// }); + /// + /// }); + /// ``` + /// {{% /example %}} + /// {{% /examples %}} /// public static Task InvokeAsync(GetFolderArgs args, InvokeOptions? options = null) => global::Pulumi.Deployment.Instance.InvokeAsync("vsphere:index/getFolder:getFolder", args ?? new GetFolderArgs(), options.WithDefaults()); @@ -21,6 +43,28 @@ public static Task InvokeAsync(GetFolderArgs args, InvokeOption /// /// The `vsphere.Folder` data source can be used to get the general attributes of a /// vSphere inventory folder. Paths are absolute and must include the datacenter. + /// + /// {{% examples %}} + /// ## Example Usage + /// {{% example %}} + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var folder = VSphere.GetFolder.Invoke(new() + /// { + /// Path = "/dc-01/datastore-01/folder-01", + /// }); + /// + /// }); + /// ``` + /// {{% /example %}} + /// {{% /examples %}} /// public static Output Invoke(GetFolderInvokeArgs args, InvokeOptions? options = null) => global::Pulumi.Deployment.Instance.Invoke("vsphere:index/getFolder:getFolder", args ?? new GetFolderInvokeArgs(), options.WithDefaults()); diff --git a/sdk/dotnet/GetHost.cs b/sdk/dotnet/GetHost.cs index 79c87e23..772d9048 100644 --- a/sdk/dotnet/GetHost.cs +++ b/sdk/dotnet/GetHost.cs @@ -15,6 +15,34 @@ public static class GetHost /// The `vsphere.Host` data source can be used to discover the ID of an ESXi host. /// This can then be used with resources or data sources that require an ESX /// host's managed object reference ID. + /// + /// {{% examples %}} + /// ## Example Usage + /// {{% example %}} + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var datacenter = VSphere.GetDatacenter.Invoke(new() + /// { + /// Name = "dc-01", + /// }); + /// + /// var host = VSphere.GetHost.Invoke(new() + /// { + /// Name = "esxi-01.example.com", + /// DatacenterId = datacenter.Apply(getDatacenterResult => getDatacenterResult.Id), + /// }); + /// + /// }); + /// ``` + /// {{% /example %}} + /// {{% /examples %}} /// public static Task InvokeAsync(GetHostArgs args, InvokeOptions? options = null) => global::Pulumi.Deployment.Instance.InvokeAsync("vsphere:index/getHost:getHost", args ?? new GetHostArgs(), options.WithDefaults()); @@ -23,6 +51,34 @@ public static Task InvokeAsync(GetHostArgs args, InvokeOptions? o /// The `vsphere.Host` data source can be used to discover the ID of an ESXi host. /// This can then be used with resources or data sources that require an ESX /// host's managed object reference ID. + /// + /// {{% examples %}} + /// ## Example Usage + /// {{% example %}} + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var datacenter = VSphere.GetDatacenter.Invoke(new() + /// { + /// Name = "dc-01", + /// }); + /// + /// var host = VSphere.GetHost.Invoke(new() + /// { + /// Name = "esxi-01.example.com", + /// DatacenterId = datacenter.Apply(getDatacenterResult => getDatacenterResult.Id), + /// }); + /// + /// }); + /// ``` + /// {{% /example %}} + /// {{% /examples %}} /// public static Output Invoke(GetHostInvokeArgs args, InvokeOptions? options = null) => global::Pulumi.Deployment.Instance.Invoke("vsphere:index/getHost:getHost", args ?? new GetHostInvokeArgs(), options.WithDefaults()); diff --git a/sdk/dotnet/GetHostPciDevice.cs b/sdk/dotnet/GetHostPciDevice.cs index 14112ef5..b16004b7 100644 --- a/sdk/dotnet/GetHostPciDevice.cs +++ b/sdk/dotnet/GetHostPciDevice.cs @@ -18,7 +18,38 @@ public static class GetHostPciDevice /// /// {{% examples %}} /// ## Example Usage + /// {{% example %}} + /// ### With Vendor ID And Class ID /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var datacenter = VSphere.GetDatacenter.Invoke(new() + /// { + /// Name = "dc-01", + /// }); + /// + /// var host = VSphere.GetHost.Invoke(new() + /// { + /// Name = "esxi-01.example.com", + /// DatacenterId = datacenter.Apply(getDatacenterResult => getDatacenterResult.Id), + /// }); + /// + /// var dev = VSphere.GetHostPciDevice.Invoke(new() + /// { + /// HostId = host.Apply(getHostResult => getHostResult.Id), + /// ClassId = "123", + /// VendorId = "456", + /// }); + /// + /// }); + /// ``` + /// {{% /example %}} /// ### With Name Regular Expression /// /// ```hcl @@ -48,7 +79,38 @@ public static Task InvokeAsync(GetHostPciDeviceArgs args /// /// {{% examples %}} /// ## Example Usage + /// {{% example %}} + /// ### With Vendor ID And Class ID + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var datacenter = VSphere.GetDatacenter.Invoke(new() + /// { + /// Name = "dc-01", + /// }); + /// + /// var host = VSphere.GetHost.Invoke(new() + /// { + /// Name = "esxi-01.example.com", + /// DatacenterId = datacenter.Apply(getDatacenterResult => getDatacenterResult.Id), + /// }); + /// + /// var dev = VSphere.GetHostPciDevice.Invoke(new() + /// { + /// HostId = host.Apply(getHostResult => getHostResult.Id), + /// ClassId = "123", + /// VendorId = "456", + /// }); /// + /// }); + /// ``` + /// {{% /example %}} /// ### With Name Regular Expression /// /// ```hcl diff --git a/sdk/dotnet/GetHostThumbprint.cs b/sdk/dotnet/GetHostThumbprint.cs index 845c0284..bbc90998 100644 --- a/sdk/dotnet/GetHostThumbprint.cs +++ b/sdk/dotnet/GetHostThumbprint.cs @@ -16,6 +16,28 @@ public static class GetHostThumbprint /// thumbprint of an ESXi host. This can be used when adding the `vsphere.Host` /// resource. If the ESXi host is using a certificate chain, the first one returned /// will be used to generate the thumbprint. + /// + /// {{% examples %}} + /// ## Example Usage + /// {{% example %}} + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var thumbprint = VSphere.GetHostThumbprint.Invoke(new() + /// { + /// Address = "esxi-01.example.com", + /// }); + /// + /// }); + /// ``` + /// {{% /example %}} + /// {{% /examples %}} /// public static Task InvokeAsync(GetHostThumbprintArgs args, InvokeOptions? options = null) => global::Pulumi.Deployment.Instance.InvokeAsync("vsphere:index/getHostThumbprint:getHostThumbprint", args ?? new GetHostThumbprintArgs(), options.WithDefaults()); @@ -25,6 +47,28 @@ public static Task InvokeAsync(GetHostThumbprintArgs ar /// thumbprint of an ESXi host. This can be used when adding the `vsphere.Host` /// resource. If the ESXi host is using a certificate chain, the first one returned /// will be used to generate the thumbprint. + /// + /// {{% examples %}} + /// ## Example Usage + /// {{% example %}} + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var thumbprint = VSphere.GetHostThumbprint.Invoke(new() + /// { + /// Address = "esxi-01.example.com", + /// }); + /// + /// }); + /// ``` + /// {{% /example %}} + /// {{% /examples %}} /// public static Output Invoke(GetHostThumbprintInvokeArgs args, InvokeOptions? options = null) => global::Pulumi.Deployment.Instance.Invoke("vsphere:index/getHostThumbprint:getHostThumbprint", args ?? new GetHostThumbprintInvokeArgs(), options.WithDefaults()); diff --git a/sdk/dotnet/GetLicense.cs b/sdk/dotnet/GetLicense.cs index e95efa9d..a0d6fae2 100644 --- a/sdk/dotnet/GetLicense.cs +++ b/sdk/dotnet/GetLicense.cs @@ -14,6 +14,28 @@ public static class GetLicense /// /// The `vsphere.License` data source can be used to get the general attributes of /// a license keys from a vCenter Server instance. + /// + /// {{% examples %}} + /// ## Example Usage + /// {{% example %}} + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var license = VSphere.GetLicense.Invoke(new() + /// { + /// LicenseKey = "00000-00000-00000-00000-00000", + /// }); + /// + /// }); + /// ``` + /// {{% /example %}} + /// {{% /examples %}} /// public static Task InvokeAsync(GetLicenseArgs args, InvokeOptions? options = null) => global::Pulumi.Deployment.Instance.InvokeAsync("vsphere:index/getLicense:getLicense", args ?? new GetLicenseArgs(), options.WithDefaults()); @@ -21,6 +43,28 @@ public static Task InvokeAsync(GetLicenseArgs args, InvokeOpti /// /// The `vsphere.License` data source can be used to get the general attributes of /// a license keys from a vCenter Server instance. + /// + /// {{% examples %}} + /// ## Example Usage + /// {{% example %}} + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var license = VSphere.GetLicense.Invoke(new() + /// { + /// LicenseKey = "00000-00000-00000-00000-00000", + /// }); + /// + /// }); + /// ``` + /// {{% /example %}} + /// {{% /examples %}} /// public static Output Invoke(GetLicenseInvokeArgs args, InvokeOptions? options = null) => global::Pulumi.Deployment.Instance.Invoke("vsphere:index/getLicense:getLicense", args ?? new GetLicenseInvokeArgs(), options.WithDefaults()); diff --git a/sdk/dotnet/GetNetwork.cs b/sdk/dotnet/GetNetwork.cs index 44e7716b..0d23b74a 100644 --- a/sdk/dotnet/GetNetwork.cs +++ b/sdk/dotnet/GetNetwork.cs @@ -17,6 +17,34 @@ public static class GetNetwork /// network interface for `vsphere.VirtualMachine` or any other vSphere resource /// that requires a network. This includes standard (host-based) port groups, /// distributed port groups, or opaque networks such as those managed by NSX. + /// + /// {{% examples %}} + /// ## Example Usage + /// {{% example %}} + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var datacenter = VSphere.GetDatacenter.Invoke(new() + /// { + /// Name = "dc-01", + /// }); + /// + /// var network = VSphere.GetNetwork.Invoke(new() + /// { + /// Name = "VM Network", + /// DatacenterId = datacenter.Apply(getDatacenterResult => getDatacenterResult.Id), + /// }); + /// + /// }); + /// ``` + /// {{% /example %}} + /// {{% /examples %}} /// public static Task InvokeAsync(GetNetworkArgs args, InvokeOptions? options = null) => global::Pulumi.Deployment.Instance.InvokeAsync("vsphere:index/getNetwork:getNetwork", args ?? new GetNetworkArgs(), options.WithDefaults()); @@ -27,6 +55,34 @@ public static Task InvokeAsync(GetNetworkArgs args, InvokeOpti /// network interface for `vsphere.VirtualMachine` or any other vSphere resource /// that requires a network. This includes standard (host-based) port groups, /// distributed port groups, or opaque networks such as those managed by NSX. + /// + /// {{% examples %}} + /// ## Example Usage + /// {{% example %}} + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var datacenter = VSphere.GetDatacenter.Invoke(new() + /// { + /// Name = "dc-01", + /// }); + /// + /// var network = VSphere.GetNetwork.Invoke(new() + /// { + /// Name = "VM Network", + /// DatacenterId = datacenter.Apply(getDatacenterResult => getDatacenterResult.Id), + /// }); + /// + /// }); + /// ``` + /// {{% /example %}} + /// {{% /examples %}} /// public static Output Invoke(GetNetworkInvokeArgs args, InvokeOptions? options = null) => global::Pulumi.Deployment.Instance.Invoke("vsphere:index/getNetwork:getNetwork", args ?? new GetNetworkInvokeArgs(), options.WithDefaults()); diff --git a/sdk/dotnet/GetPolicy.cs b/sdk/dotnet/GetPolicy.cs index d492e6d9..e233057a 100644 --- a/sdk/dotnet/GetPolicy.cs +++ b/sdk/dotnet/GetPolicy.cs @@ -18,6 +18,33 @@ public static class GetPolicy /// /// > **NOTE:** Storage policies are not supported on direct ESXi hosts and /// requires vCenter Server. + /// + /// {{% examples %}} + /// ## Example Usage + /// {{% example %}} + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var prodPlatinumReplicated = VSphere.GetPolicy.Invoke(new() + /// { + /// Name = "prod_platinum_replicated", + /// }); + /// + /// var devSilverNonreplicated = VSphere.GetPolicy.Invoke(new() + /// { + /// Name = "dev_silver_nonreplicated", + /// }); + /// + /// }); + /// ``` + /// {{% /example %}} + /// {{% /examples %}} /// public static Task InvokeAsync(GetPolicyArgs args, InvokeOptions? options = null) => global::Pulumi.Deployment.Instance.InvokeAsync("vsphere:index/getPolicy:getPolicy", args ?? new GetPolicyArgs(), options.WithDefaults()); @@ -29,6 +56,33 @@ public static Task InvokeAsync(GetPolicyArgs args, InvokeOption /// /// > **NOTE:** Storage policies are not supported on direct ESXi hosts and /// requires vCenter Server. + /// + /// {{% examples %}} + /// ## Example Usage + /// {{% example %}} + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var prodPlatinumReplicated = VSphere.GetPolicy.Invoke(new() + /// { + /// Name = "prod_platinum_replicated", + /// }); + /// + /// var devSilverNonreplicated = VSphere.GetPolicy.Invoke(new() + /// { + /// Name = "dev_silver_nonreplicated", + /// }); + /// + /// }); + /// ``` + /// {{% /example %}} + /// {{% /examples %}} /// public static Output Invoke(GetPolicyInvokeArgs args, InvokeOptions? options = null) => global::Pulumi.Deployment.Instance.Invoke("vsphere:index/getPolicy:getPolicy", args ?? new GetPolicyInvokeArgs(), options.WithDefaults()); diff --git a/sdk/dotnet/GetResourcePool.cs b/sdk/dotnet/GetResourcePool.cs index a89aaf6c..791f27e7 100644 --- a/sdk/dotnet/GetResourcePool.cs +++ b/sdk/dotnet/GetResourcePool.cs @@ -16,6 +16,66 @@ public static class GetResourcePool /// resource pool in vSphere. This is useful to return the ID of a resource pool /// that you want to use to create virtual machines in using the /// `vsphere.VirtualMachine` resource. + /// + /// {{% examples %}} + /// ## Example Usage + /// {{% example %}} + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var datacenter = VSphere.GetDatacenter.Invoke(new() + /// { + /// Name = "dc-01", + /// }); + /// + /// var pool = VSphere.GetResourcePool.Invoke(new() + /// { + /// Name = "resource-pool-01", + /// DatacenterId = datacenter.Apply(getDatacenterResult => getDatacenterResult.Id), + /// }); + /// + /// }); + /// ``` + /// {{% /example %}} + /// {{% example %}} + /// ### Specifying the Root Resource Pool for a Standalone ESXi Host + /// + /// > **NOTE:** Returning the root resource pool for a cluster can be done + /// directly via the `vsphere.ComputeCluster` + /// data source. + /// + /// All compute resources in vSphere have a resource pool, even if one has not been + /// explicitly created. This resource pool is referred to as the + /// _root resource pool_ and can be looked up by specifying the path. + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var pool = VSphere.GetResourcePool.Invoke(new() + /// { + /// Name = "esxi-01.example.com/Resources", + /// DatacenterId = data.Vsphere_datacenter.Datacenter.Id, + /// }); + /// + /// }); + /// ``` + /// + /// For more information on the root resource pool, see [Managing Resource Pools][vmware-docs-resource-pools] in the vSphere documentation. + /// + /// [vmware-docs-resource-pools]: https://docs.vmware.com/en/VMware-vSphere/7.0/com.vmware.vsphere.resmgmt.doc/GUID-60077B40-66FF-4625-934A-641703ED7601.html + /// {{% /example %}} + /// {{% /examples %}} /// public static Task InvokeAsync(GetResourcePoolArgs? args = null, InvokeOptions? options = null) => global::Pulumi.Deployment.Instance.InvokeAsync("vsphere:index/getResourcePool:getResourcePool", args ?? new GetResourcePoolArgs(), options.WithDefaults()); @@ -25,6 +85,66 @@ public static Task InvokeAsync(GetResourcePoolArgs? args /// resource pool in vSphere. This is useful to return the ID of a resource pool /// that you want to use to create virtual machines in using the /// `vsphere.VirtualMachine` resource. + /// + /// {{% examples %}} + /// ## Example Usage + /// {{% example %}} + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var datacenter = VSphere.GetDatacenter.Invoke(new() + /// { + /// Name = "dc-01", + /// }); + /// + /// var pool = VSphere.GetResourcePool.Invoke(new() + /// { + /// Name = "resource-pool-01", + /// DatacenterId = datacenter.Apply(getDatacenterResult => getDatacenterResult.Id), + /// }); + /// + /// }); + /// ``` + /// {{% /example %}} + /// {{% example %}} + /// ### Specifying the Root Resource Pool for a Standalone ESXi Host + /// + /// > **NOTE:** Returning the root resource pool for a cluster can be done + /// directly via the `vsphere.ComputeCluster` + /// data source. + /// + /// All compute resources in vSphere have a resource pool, even if one has not been + /// explicitly created. This resource pool is referred to as the + /// _root resource pool_ and can be looked up by specifying the path. + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var pool = VSphere.GetResourcePool.Invoke(new() + /// { + /// Name = "esxi-01.example.com/Resources", + /// DatacenterId = data.Vsphere_datacenter.Datacenter.Id, + /// }); + /// + /// }); + /// ``` + /// + /// For more information on the root resource pool, see [Managing Resource Pools][vmware-docs-resource-pools] in the vSphere documentation. + /// + /// [vmware-docs-resource-pools]: https://docs.vmware.com/en/VMware-vSphere/7.0/com.vmware.vsphere.resmgmt.doc/GUID-60077B40-66FF-4625-934A-641703ED7601.html + /// {{% /example %}} + /// {{% /examples %}} /// public static Output Invoke(GetResourcePoolInvokeArgs? args = null, InvokeOptions? options = null) => global::Pulumi.Deployment.Instance.Invoke("vsphere:index/getResourcePool:getResourcePool", args ?? new GetResourcePoolInvokeArgs(), options.WithDefaults()); diff --git a/sdk/dotnet/GetRole.cs b/sdk/dotnet/GetRole.cs index c135e29f..426ce921 100644 --- a/sdk/dotnet/GetRole.cs +++ b/sdk/dotnet/GetRole.cs @@ -14,6 +14,29 @@ public static class GetRole /// /// The `vsphere.Role` data source can be used to discover the `id` and privileges associated /// with a role given its name or display label. + /// + /// + /// {{% examples %}} + /// ## Example Usage + /// {{% example %}} + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var terraformRole = VSphere.GetRole.Invoke(new() + /// { + /// Label = "Terraform to vSphere Integration Role", + /// }); + /// + /// }); + /// ``` + /// {{% /example %}} + /// {{% /examples %}} /// public static Task InvokeAsync(GetRoleArgs args, InvokeOptions? options = null) => global::Pulumi.Deployment.Instance.InvokeAsync("vsphere:index/getRole:getRole", args ?? new GetRoleArgs(), options.WithDefaults()); @@ -21,6 +44,29 @@ public static Task InvokeAsync(GetRoleArgs args, InvokeOptions? o /// /// The `vsphere.Role` data source can be used to discover the `id` and privileges associated /// with a role given its name or display label. + /// + /// + /// {{% examples %}} + /// ## Example Usage + /// {{% example %}} + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var terraformRole = VSphere.GetRole.Invoke(new() + /// { + /// Label = "Terraform to vSphere Integration Role", + /// }); + /// + /// }); + /// ``` + /// {{% /example %}} + /// {{% /examples %}} /// public static Output Invoke(GetRoleInvokeArgs args, InvokeOptions? options = null) => global::Pulumi.Deployment.Instance.Invoke("vsphere:index/getRole:getRole", args ?? new GetRoleInvokeArgs(), options.WithDefaults()); diff --git a/sdk/dotnet/GetTag.cs b/sdk/dotnet/GetTag.cs index 76da4e0a..c550fa77 100644 --- a/sdk/dotnet/GetTag.cs +++ b/sdk/dotnet/GetTag.cs @@ -20,6 +20,34 @@ public static class GetTag /// /// > **NOTE:** Tagging is not supported on direct ESXi hosts connections and /// requires vCenter Server. + /// + /// {{% examples %}} + /// ## Example Usage + /// {{% example %}} + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var category = VSphere.GetTagCategory.Invoke(new() + /// { + /// Name = "example-category", + /// }); + /// + /// var tag = VSphere.GetTag.Invoke(new() + /// { + /// Name = "example-tag", + /// CategoryId = category.Apply(getTagCategoryResult => getTagCategoryResult.Id), + /// }); + /// + /// }); + /// ``` + /// {{% /example %}} + /// {{% /examples %}} /// public static Task InvokeAsync(GetTagArgs args, InvokeOptions? options = null) => global::Pulumi.Deployment.Instance.InvokeAsync("vsphere:index/getTag:getTag", args ?? new GetTagArgs(), options.WithDefaults()); @@ -33,6 +61,34 @@ public static Task InvokeAsync(GetTagArgs args, InvokeOptions? opt /// /// > **NOTE:** Tagging is not supported on direct ESXi hosts connections and /// requires vCenter Server. + /// + /// {{% examples %}} + /// ## Example Usage + /// {{% example %}} + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var category = VSphere.GetTagCategory.Invoke(new() + /// { + /// Name = "example-category", + /// }); + /// + /// var tag = VSphere.GetTag.Invoke(new() + /// { + /// Name = "example-tag", + /// CategoryId = category.Apply(getTagCategoryResult => getTagCategoryResult.Id), + /// }); + /// + /// }); + /// ``` + /// {{% /example %}} + /// {{% /examples %}} /// public static Output Invoke(GetTagInvokeArgs args, InvokeOptions? options = null) => global::Pulumi.Deployment.Instance.Invoke("vsphere:index/getTag:getTag", args ?? new GetTagInvokeArgs(), options.WithDefaults()); diff --git a/sdk/dotnet/GetTagCategory.cs b/sdk/dotnet/GetTagCategory.cs index 612bafa7..dc6f4395 100644 --- a/sdk/dotnet/GetTagCategory.cs +++ b/sdk/dotnet/GetTagCategory.cs @@ -20,6 +20,28 @@ public static class GetTagCategory /// /// > **NOTE:** Tagging is not supported on direct ESXi hosts connections and /// requires vCenter Server. + /// + /// {{% examples %}} + /// ## Example Usage + /// {{% example %}} + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var category = VSphere.GetTagCategory.Invoke(new() + /// { + /// Name = "example-category", + /// }); + /// + /// }); + /// ``` + /// {{% /example %}} + /// {{% /examples %}} /// public static Task InvokeAsync(GetTagCategoryArgs args, InvokeOptions? options = null) => global::Pulumi.Deployment.Instance.InvokeAsync("vsphere:index/getTagCategory:getTagCategory", args ?? new GetTagCategoryArgs(), options.WithDefaults()); @@ -33,6 +55,28 @@ public static Task InvokeAsync(GetTagCategoryArgs args, In /// /// > **NOTE:** Tagging is not supported on direct ESXi hosts connections and /// requires vCenter Server. + /// + /// {{% examples %}} + /// ## Example Usage + /// {{% example %}} + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var category = VSphere.GetTagCategory.Invoke(new() + /// { + /// Name = "example-category", + /// }); + /// + /// }); + /// ``` + /// {{% /example %}} + /// {{% /examples %}} /// public static Output Invoke(GetTagCategoryInvokeArgs args, InvokeOptions? options = null) => global::Pulumi.Deployment.Instance.Invoke("vsphere:index/getTagCategory:getTagCategory", args ?? new GetTagCategoryInvokeArgs(), options.WithDefaults()); diff --git a/sdk/dotnet/GetVappContainer.cs b/sdk/dotnet/GetVappContainer.cs index 8f8c782c..1df5fa71 100644 --- a/sdk/dotnet/GetVappContainer.cs +++ b/sdk/dotnet/GetVappContainer.cs @@ -16,6 +16,34 @@ public static class GetVappContainer /// vApp container in vSphere. This is useful to return the ID of a vApp container /// that you want to use to create virtual machines in using the /// `vsphere.VirtualMachine` resource. + /// + /// {{% examples %}} + /// ## Example Usage + /// {{% example %}} + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var datacenter = VSphere.GetDatacenter.Invoke(new() + /// { + /// Name = "dc-01", + /// }); + /// + /// var pool = VSphere.GetVappContainer.Invoke(new() + /// { + /// Name = "vapp-container-01", + /// DatacenterId = datacenter.Apply(getDatacenterResult => getDatacenterResult.Id), + /// }); + /// + /// }); + /// ``` + /// {{% /example %}} + /// {{% /examples %}} /// public static Task InvokeAsync(GetVappContainerArgs args, InvokeOptions? options = null) => global::Pulumi.Deployment.Instance.InvokeAsync("vsphere:index/getVappContainer:getVappContainer", args ?? new GetVappContainerArgs(), options.WithDefaults()); @@ -25,6 +53,34 @@ public static Task InvokeAsync(GetVappContainerArgs args /// vApp container in vSphere. This is useful to return the ID of a vApp container /// that you want to use to create virtual machines in using the /// `vsphere.VirtualMachine` resource. + /// + /// {{% examples %}} + /// ## Example Usage + /// {{% example %}} + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var datacenter = VSphere.GetDatacenter.Invoke(new() + /// { + /// Name = "dc-01", + /// }); + /// + /// var pool = VSphere.GetVappContainer.Invoke(new() + /// { + /// Name = "vapp-container-01", + /// DatacenterId = datacenter.Apply(getDatacenterResult => getDatacenterResult.Id), + /// }); + /// + /// }); + /// ``` + /// {{% /example %}} + /// {{% /examples %}} /// public static Output Invoke(GetVappContainerInvokeArgs args, InvokeOptions? options = null) => global::Pulumi.Deployment.Instance.Invoke("vsphere:index/getVappContainer:getVappContainer", args ?? new GetVappContainerInvokeArgs(), options.WithDefaults()); diff --git a/sdk/dotnet/GetVirtualMachine.cs b/sdk/dotnet/GetVirtualMachine.cs index 492f0215..6bb90526 100644 --- a/sdk/dotnet/GetVirtualMachine.cs +++ b/sdk/dotnet/GetVirtualMachine.cs @@ -17,6 +17,67 @@ public static class GetVirtualMachine /// the UUID of a template to be used as the source for cloning to a new /// `vsphere.VirtualMachine` resource. It also /// reads the guest ID so that can be supplied as well. + /// + /// {{% examples %}} + /// ## Example Usage + /// {{% example %}} + /// + /// In the following example, a virtual machine template is returned by its + /// unique name within the `vsphere.Datacenter`. + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var datacenter = VSphere.GetDatacenter.Invoke(new() + /// { + /// Name = "dc-01", + /// }); + /// + /// var template = VSphere.GetVirtualMachine.Invoke(new() + /// { + /// Name = "ubuntu-server-template", + /// DatacenterId = datacenter.Apply(getDatacenterResult => getDatacenterResult.Id), + /// }); + /// + /// }); + /// ``` + /// In the following example, each virtual machine template is returned by its + /// unique full path within the `vsphere.Datacenter`. + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var datacenter = VSphere.GetDatacenter.Invoke(new() + /// { + /// Name = "dc-01", + /// }); + /// + /// var productionTemplate = VSphere.GetVirtualMachine.Invoke(new() + /// { + /// Name = "production/templates/ubuntu-server-template", + /// DatacenterId = datacenter.Apply(getDatacenterResult => getDatacenterResult.Id), + /// }); + /// + /// var developmentTemplate = VSphere.GetVirtualMachine.Invoke(new() + /// { + /// Name = "development/templates/ubuntu-server-template", + /// DatacenterId = datacenter.Apply(getDatacenterResult => getDatacenterResult.Id), + /// }); + /// + /// }); + /// ``` + /// {{% /example %}} + /// {{% /examples %}} /// public static Task InvokeAsync(GetVirtualMachineArgs? args = null, InvokeOptions? options = null) => global::Pulumi.Deployment.Instance.InvokeAsync("vsphere:index/getVirtualMachine:getVirtualMachine", args ?? new GetVirtualMachineArgs(), options.WithDefaults()); @@ -27,6 +88,67 @@ public static Task InvokeAsync(GetVirtualMachineArgs? a /// the UUID of a template to be used as the source for cloning to a new /// `vsphere.VirtualMachine` resource. It also /// reads the guest ID so that can be supplied as well. + /// + /// {{% examples %}} + /// ## Example Usage + /// {{% example %}} + /// + /// In the following example, a virtual machine template is returned by its + /// unique name within the `vsphere.Datacenter`. + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var datacenter = VSphere.GetDatacenter.Invoke(new() + /// { + /// Name = "dc-01", + /// }); + /// + /// var template = VSphere.GetVirtualMachine.Invoke(new() + /// { + /// Name = "ubuntu-server-template", + /// DatacenterId = datacenter.Apply(getDatacenterResult => getDatacenterResult.Id), + /// }); + /// + /// }); + /// ``` + /// In the following example, each virtual machine template is returned by its + /// unique full path within the `vsphere.Datacenter`. + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var datacenter = VSphere.GetDatacenter.Invoke(new() + /// { + /// Name = "dc-01", + /// }); + /// + /// var productionTemplate = VSphere.GetVirtualMachine.Invoke(new() + /// { + /// Name = "production/templates/ubuntu-server-template", + /// DatacenterId = datacenter.Apply(getDatacenterResult => getDatacenterResult.Id), + /// }); + /// + /// var developmentTemplate = VSphere.GetVirtualMachine.Invoke(new() + /// { + /// Name = "development/templates/ubuntu-server-template", + /// DatacenterId = datacenter.Apply(getDatacenterResult => getDatacenterResult.Id), + /// }); + /// + /// }); + /// ``` + /// {{% /example %}} + /// {{% /examples %}} /// public static Output Invoke(GetVirtualMachineInvokeArgs? args = null, InvokeOptions? options = null) => global::Pulumi.Deployment.Instance.Invoke("vsphere:index/getVirtualMachine:getVirtualMachine", args ?? new GetVirtualMachineInvokeArgs(), options.WithDefaults()); diff --git a/sdk/dotnet/GetVmfsDisks.cs b/sdk/dotnet/GetVmfsDisks.cs index 5129130e..cd1934fa 100644 --- a/sdk/dotnet/GetVmfsDisks.cs +++ b/sdk/dotnet/GetVmfsDisks.cs @@ -16,6 +16,42 @@ public static class GetVmfsDisks /// devices available on an ESXi host. This data source can be combined with the /// `vsphere.VmfsDatastore` resource to create VMFS /// datastores based off a set of discovered disks. + /// + /// + /// {{% examples %}} + /// ## Example Usage + /// {{% example %}} + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var datacenter = VSphere.GetDatacenter.Invoke(new() + /// { + /// Name = "dc-01", + /// }); + /// + /// var host = VSphere.GetHost.Invoke(new() + /// { + /// Name = "esxi-01.example.com", + /// DatacenterId = datacenter.Apply(getDatacenterResult => getDatacenterResult.Id), + /// }); + /// + /// var vmfsDisks = VSphere.GetVmfsDisks.Invoke(new() + /// { + /// HostSystemId = host.Apply(getHostResult => getHostResult.Id), + /// Rescan = true, + /// Filter = "mpx.vmhba1:C0:T[12]:L0", + /// }); + /// + /// }); + /// ``` + /// {{% /example %}} + /// {{% /examples %}} /// public static Task InvokeAsync(GetVmfsDisksArgs args, InvokeOptions? options = null) => global::Pulumi.Deployment.Instance.InvokeAsync("vsphere:index/getVmfsDisks:getVmfsDisks", args ?? new GetVmfsDisksArgs(), options.WithDefaults()); @@ -25,6 +61,42 @@ public static Task InvokeAsync(GetVmfsDisksArgs args, Invoke /// devices available on an ESXi host. This data source can be combined with the /// `vsphere.VmfsDatastore` resource to create VMFS /// datastores based off a set of discovered disks. + /// + /// + /// {{% examples %}} + /// ## Example Usage + /// {{% example %}} + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var datacenter = VSphere.GetDatacenter.Invoke(new() + /// { + /// Name = "dc-01", + /// }); + /// + /// var host = VSphere.GetHost.Invoke(new() + /// { + /// Name = "esxi-01.example.com", + /// DatacenterId = datacenter.Apply(getDatacenterResult => getDatacenterResult.Id), + /// }); + /// + /// var vmfsDisks = VSphere.GetVmfsDisks.Invoke(new() + /// { + /// HostSystemId = host.Apply(getHostResult => getHostResult.Id), + /// Rescan = true, + /// Filter = "mpx.vmhba1:C0:T[12]:L0", + /// }); + /// + /// }); + /// ``` + /// {{% /example %}} + /// {{% /examples %}} /// public static Output Invoke(GetVmfsDisksInvokeArgs args, InvokeOptions? options = null) => global::Pulumi.Deployment.Instance.Invoke("vsphere:index/getVmfsDisks:getVmfsDisks", args ?? new GetVmfsDisksInvokeArgs(), options.WithDefaults()); diff --git a/sdk/dotnet/Host.cs b/sdk/dotnet/Host.cs index aec11895..d11d2bb6 100644 --- a/sdk/dotnet/Host.cs +++ b/sdk/dotnet/Host.cs @@ -14,6 +14,96 @@ namespace Pulumi.VSphere /// can be used either as a member of a cluster or as a standalone host. /// /// ## Example Usage + /// ### Create a standalone host + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var datacenter = VSphere.GetDatacenter.Invoke(new() + /// { + /// Name = "dc-01", + /// }); + /// + /// var thumbprint = VSphere.GetHostThumbprint.Invoke(new() + /// { + /// Address = "esx-01.example.com", + /// Insecure = true, + /// }); + /// + /// var esx_01 = new VSphere.Host("esx-01", new() + /// { + /// Hostname = "esx-01.example.com", + /// Username = "root", + /// Password = "password", + /// License = "00000-00000-00000-00000-00000", + /// Thumbprint = thumbprint.Apply(getHostThumbprintResult => getHostThumbprintResult.Id), + /// Datacenter = datacenter.Apply(getDatacenterResult => getDatacenterResult.Id), + /// }); + /// + /// }); + /// ``` + /// ### Create host in a compute cluster + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var datacenter = VSphere.GetDatacenter.Invoke(new() + /// { + /// Name = "dc-01", + /// }); + /// + /// var cluster = VSphere.GetComputeCluster.Invoke(new() + /// { + /// Name = "cluster-01", + /// DatacenterId = datacenter.Apply(getDatacenterResult => getDatacenterResult.Id), + /// }); + /// + /// var thumbprint = VSphere.GetHostThumbprint.Invoke(new() + /// { + /// Address = "esx-01.example.com", + /// Insecure = true, + /// }); + /// + /// var esx_01 = new VSphere.Host("esx-01", new() + /// { + /// Hostname = "esx-01.example.com", + /// Username = "root", + /// Password = "password", + /// License = "00000-00000-00000-00000-00000", + /// Thumbprint = thumbprint.Apply(getHostThumbprintResult => getHostThumbprintResult.Id), + /// Cluster = cluster.Apply(getComputeClusterResult => getComputeClusterResult.Id), + /// }); + /// + /// }); + /// ``` + /// ## Importing + /// + /// An existing host can be [imported][docs-import] into this resource by supplying + /// the host's ID. An example is below: + /// + /// [docs-import]: /docs/import/index.html + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// + /// return await Deployment.RunAsync(() => + /// { + /// }); + /// ``` + /// + /// The above would import the host with ID `host-123`. /// [VSphereResourceType("vsphere:index/host:Host")] public partial class Host : global::Pulumi.CustomResource diff --git a/sdk/dotnet/HostPortGroup.cs b/sdk/dotnet/HostPortGroup.cs index 6a7e3416..954cccaa 100644 --- a/sdk/dotnet/HostPortGroup.cs +++ b/sdk/dotnet/HostPortGroup.cs @@ -18,6 +18,128 @@ namespace Pulumi.VSphere /// For an overview on vSphere networking concepts, see [the product documentation][ref-vsphere-net-concepts]. /// /// [ref-vsphere-net-concepts]: https://docs.vmware.com/en/VMware-vSphere/7.0/com.vmware.vsphere.networking.doc/GUID-2B11DBB8-CB3C-4AFF-8885-EFEA0FC562F4.html + /// + /// ## Example Usage + /// + /// **Create a Virtual Switch and Bind a Port Group:** + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var datacenter = VSphere.GetDatacenter.Invoke(new() + /// { + /// Name = "dc-01", + /// }); + /// + /// var host = VSphere.GetHost.Invoke(new() + /// { + /// Name = "esxi-01.example.com", + /// DatacenterId = datacenter.Apply(getDatacenterResult => getDatacenterResult.Id), + /// }); + /// + /// var hostVirtualSwitch = new VSphere.HostVirtualSwitch("hostVirtualSwitch", new() + /// { + /// HostSystemId = host.Apply(getHostResult => getHostResult.Id), + /// NetworkAdapters = new[] + /// { + /// "vmnic0", + /// "vmnic1", + /// }, + /// ActiveNics = new[] + /// { + /// "vmnic0", + /// }, + /// StandbyNics = new[] + /// { + /// "vmnic1", + /// }, + /// }); + /// + /// var pg = new VSphere.HostPortGroup("pg", new() + /// { + /// HostSystemId = host.Apply(getHostResult => getHostResult.Id), + /// VirtualSwitchName = hostVirtualSwitch.Name, + /// }); + /// + /// }); + /// ``` + /// + /// **Create a Port Group with a VLAN and ab Override:** + /// + /// This example sets the trunk mode VLAN (`4095`, which passes through all tags) + /// and sets + /// `allow_promiscuous` + /// to ensure that all traffic is seen on the port. The setting overrides + /// the implicit default of `false` set on the standard switch. + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var datacenter = VSphere.GetDatacenter.Invoke(new() + /// { + /// Name = "dc-01", + /// }); + /// + /// var host = VSphere.GetHost.Invoke(new() + /// { + /// Name = "esxi-01.example.com", + /// DatacenterId = datacenter.Apply(getDatacenterResult => getDatacenterResult.Id), + /// }); + /// + /// var hostVirtualSwitch = new VSphere.HostVirtualSwitch("hostVirtualSwitch", new() + /// { + /// HostSystemId = host.Apply(getHostResult => getHostResult.Id), + /// NetworkAdapters = new[] + /// { + /// "vmnic0", + /// "vmnic1", + /// }, + /// ActiveNics = new[] + /// { + /// "vmnic0", + /// }, + /// StandbyNics = new[] + /// { + /// "vmnic1", + /// }, + /// }); + /// + /// var pg = new VSphere.HostPortGroup("pg", new() + /// { + /// HostSystemId = host.Apply(getHostResult => getHostResult.Id), + /// VirtualSwitchName = hostVirtualSwitch.Name, + /// VlanId = 4095, + /// AllowPromiscuous = true, + /// }); + /// + /// }); + /// ``` + /// ## Importing + /// + /// An existing host port group can be imported into this resource + /// using the host port group's ID. An example is below: + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// + /// return await Deployment.RunAsync(() => + /// { + /// }); + /// ``` + /// + /// The above would import the `management` host port group from host with ID `host-123`. /// [VSphereResourceType("vsphere:index/hostPortGroup:HostPortGroup")] public partial class HostPortGroup : global::Pulumi.CustomResource diff --git a/sdk/dotnet/Inputs/ComputeClusterVsanDiskGroupArgs.cs b/sdk/dotnet/Inputs/ComputeClusterVsanDiskGroupArgs.cs index 66704e1f..83576101 100644 --- a/sdk/dotnet/Inputs/ComputeClusterVsanDiskGroupArgs.cs +++ b/sdk/dotnet/Inputs/ComputeClusterVsanDiskGroupArgs.cs @@ -26,6 +26,46 @@ public sealed class ComputeClusterVsanDiskGroupArgs : global::Pulumi.ResourceArg /// /// > **NOTE:** You must disable vSphere HA before you enable vSAN on the cluster. /// You can enable or re-enable vSphere HA after vSAN is configured. + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var computeCluster = new VSphere.ComputeCluster("computeCluster", new() + /// { + /// DatacenterId = data.Vsphere_datacenter.Datacenter.Id, + /// HostSystemIds = new[] + /// { + /// data.Vsphere_host.Host.Select(__item => __item.Id).ToList(), + /// }, + /// DrsEnabled = true, + /// DrsAutomationLevel = "fullyAutomated", + /// HaEnabled = false, + /// VsanEnabled = true, + /// VsanDedupEnabled = true, + /// VsanCompressionEnabled = true, + /// VsanPerformanceEnabled = true, + /// VsanVerboseModeEnabled = true, + /// VsanNetworkDiagnosticModeEnabled = true, + /// VsanUnmapEnabled = true, + /// VsanDitEncryptionEnabled = true, + /// VsanDitRekeyInterval = 1800, + /// VsanDiskGroups = new[] + /// { + /// new VSphere.Inputs.ComputeClusterVsanDiskGroupArgs + /// { + /// Cache = data.Vsphere_vmfs_disks.Cache_disks[0], + /// Storages = data.Vsphere_vmfs_disks.Storage_disks, + /// }, + /// }, + /// }); + /// + /// }); + /// ``` /// public InputList Storages { diff --git a/sdk/dotnet/Inputs/ComputeClusterVsanDiskGroupGetArgs.cs b/sdk/dotnet/Inputs/ComputeClusterVsanDiskGroupGetArgs.cs index fb4e8ac8..7266cc80 100644 --- a/sdk/dotnet/Inputs/ComputeClusterVsanDiskGroupGetArgs.cs +++ b/sdk/dotnet/Inputs/ComputeClusterVsanDiskGroupGetArgs.cs @@ -26,6 +26,46 @@ public sealed class ComputeClusterVsanDiskGroupGetArgs : global::Pulumi.Resource /// /// > **NOTE:** You must disable vSphere HA before you enable vSAN on the cluster. /// You can enable or re-enable vSphere HA after vSAN is configured. + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var computeCluster = new VSphere.ComputeCluster("computeCluster", new() + /// { + /// DatacenterId = data.Vsphere_datacenter.Datacenter.Id, + /// HostSystemIds = new[] + /// { + /// data.Vsphere_host.Host.Select(__item => __item.Id).ToList(), + /// }, + /// DrsEnabled = true, + /// DrsAutomationLevel = "fullyAutomated", + /// HaEnabled = false, + /// VsanEnabled = true, + /// VsanDedupEnabled = true, + /// VsanCompressionEnabled = true, + /// VsanPerformanceEnabled = true, + /// VsanVerboseModeEnabled = true, + /// VsanNetworkDiagnosticModeEnabled = true, + /// VsanUnmapEnabled = true, + /// VsanDitEncryptionEnabled = true, + /// VsanDitRekeyInterval = 1800, + /// VsanDiskGroups = new[] + /// { + /// new VSphere.Inputs.ComputeClusterVsanDiskGroupArgs + /// { + /// Cache = data.Vsphere_vmfs_disks.Cache_disks[0], + /// Storages = data.Vsphere_vmfs_disks.Storage_disks, + /// }, + /// }, + /// }); + /// + /// }); + /// ``` /// public InputList Storages { diff --git a/sdk/dotnet/License.cs b/sdk/dotnet/License.cs index 292f65cb..b1cf80fd 100644 --- a/sdk/dotnet/License.cs +++ b/sdk/dotnet/License.cs @@ -11,6 +11,29 @@ namespace Pulumi.VSphere { /// /// Provides a VMware vSphere license resource. This can be used to add and remove license keys. + /// + /// ## Example Usage + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var licenseKey = new VSphere.License("licenseKey", new() + /// { + /// Labels = + /// { + /// { "VpxClientLicenseLabel", "Hello World" }, + /// { "Workflow", "Hello World" }, + /// }, + /// LicenseKey = "452CQ-2EK54-K8742-00000-00000", + /// }); + /// + /// }); + /// ``` /// [VSphereResourceType("vsphere:index/license:License")] public partial class License : global::Pulumi.CustomResource diff --git a/sdk/dotnet/Outputs/ComputeClusterVsanDiskGroup.cs b/sdk/dotnet/Outputs/ComputeClusterVsanDiskGroup.cs index 92c20c32..8a1e60cc 100644 --- a/sdk/dotnet/Outputs/ComputeClusterVsanDiskGroup.cs +++ b/sdk/dotnet/Outputs/ComputeClusterVsanDiskGroup.cs @@ -22,6 +22,46 @@ public sealed class ComputeClusterVsanDiskGroup /// /// > **NOTE:** You must disable vSphere HA before you enable vSAN on the cluster. /// You can enable or re-enable vSphere HA after vSAN is configured. + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var computeCluster = new VSphere.ComputeCluster("computeCluster", new() + /// { + /// DatacenterId = data.Vsphere_datacenter.Datacenter.Id, + /// HostSystemIds = new[] + /// { + /// data.Vsphere_host.Host.Select(__item => __item.Id).ToList(), + /// }, + /// DrsEnabled = true, + /// DrsAutomationLevel = "fullyAutomated", + /// HaEnabled = false, + /// VsanEnabled = true, + /// VsanDedupEnabled = true, + /// VsanCompressionEnabled = true, + /// VsanPerformanceEnabled = true, + /// VsanVerboseModeEnabled = true, + /// VsanNetworkDiagnosticModeEnabled = true, + /// VsanUnmapEnabled = true, + /// VsanDitEncryptionEnabled = true, + /// VsanDitRekeyInterval = 1800, + /// VsanDiskGroups = new[] + /// { + /// new VSphere.Inputs.ComputeClusterVsanDiskGroupArgs + /// { + /// Cache = data.Vsphere_vmfs_disks.Cache_disks[0], + /// Storages = data.Vsphere_vmfs_disks.Storage_disks, + /// }, + /// }, + /// }); + /// + /// }); + /// ``` /// public readonly ImmutableArray Storages; diff --git a/sdk/dotnet/ResourcePool.cs b/sdk/dotnet/ResourcePool.cs index c6ee887f..5d6093ad 100644 --- a/sdk/dotnet/ResourcePool.cs +++ b/sdk/dotnet/ResourcePool.cs @@ -18,6 +18,93 @@ namespace Pulumi.VSphere /// /// [ref-vsphere-resource_pools]: https://docs.vmware.com/en/VMware-vSphere/7.0/com.vmware.vsphere.resmgmt.doc/GUID-60077B40-66FF-4625-934A-641703ED7601.html /// + /// ## Example Usage + /// + /// The following example sets up a resource pool in an existing compute cluster + /// with the default settings for CPU and memory reservations, shares, and limits. + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var datacenter = VSphere.GetDatacenter.Invoke(new() + /// { + /// Name = "dc-01", + /// }); + /// + /// var computeCluster = VSphere.GetComputeCluster.Invoke(new() + /// { + /// Name = "cluster-01", + /// DatacenterId = datacenter.Apply(getDatacenterResult => getDatacenterResult.Id), + /// }); + /// + /// var resourcePool = new VSphere.ResourcePool("resourcePool", new() + /// { + /// ParentResourcePoolId = computeCluster.Apply(getComputeClusterResult => getComputeClusterResult.ResourcePoolId), + /// }); + /// + /// }); + /// ``` + /// + /// A virtual machine resource could be targeted to use the default resource pool + /// of the cluster using the following: + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var vm = new VSphere.VirtualMachine("vm", new() + /// { + /// ResourcePoolId = data.Vsphere_compute_cluster.Cluster.Resource_pool_id, + /// }); + /// + /// // ... other configuration ... + /// }); + /// ``` + /// + /// The following example sets up a parent resource pool in an existing compute cluster + /// with a child resource pool nested below. Each resource pool is configured with + /// the default settings for CPU and memory reservations, shares, and limits. + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var datacenter = VSphere.GetDatacenter.Invoke(new() + /// { + /// Name = "dc-01", + /// }); + /// + /// var computeCluster = VSphere.GetComputeCluster.Invoke(new() + /// { + /// Name = "cluster-01", + /// DatacenterId = datacenter.Apply(getDatacenterResult => getDatacenterResult.Id), + /// }); + /// + /// var resourcePoolParent = new VSphere.ResourcePool("resourcePoolParent", new() + /// { + /// ParentResourcePoolId = computeCluster.Apply(getComputeClusterResult => getComputeClusterResult.ResourcePoolId), + /// }); + /// + /// var resourcePoolChild = new VSphere.ResourcePool("resourcePoolChild", new() + /// { + /// ParentResourcePoolId = resourcePoolParent.Id, + /// }); + /// + /// }); + /// ``` /// ## Importing /// ### Settings that Require vSphere 7.0 or higher /// diff --git a/sdk/dotnet/VirtualMachineSnapshot.cs b/sdk/dotnet/VirtualMachineSnapshot.cs index 18006ac5..df9b0e23 100644 --- a/sdk/dotnet/VirtualMachineSnapshot.cs +++ b/sdk/dotnet/VirtualMachineSnapshot.cs @@ -31,6 +31,30 @@ namespace Pulumi.VSphere /// limitation of virtual machine snapshots, see [here][ext-vm-snap-limitations]. /// /// [ext-vm-snap-limitations]: https://docs.vmware.com/en/VMware-vSphere/7.0/com.vmware.vsphere.vm_admin.doc/GUID-53F65726-A23B-4CF0-A7D5-48E584B88613.html + /// + /// ## Example Usage + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var demo1 = new VSphere.VirtualMachineSnapshot("demo1", new() + /// { + /// Consolidate = true, + /// Description = "This is Demo Snapshot", + /// Memory = true, + /// Quiesce = true, + /// RemoveChildren = false, + /// SnapshotName = "Snapshot Name", + /// VirtualMachineUuid = "9aac5551-a351-4158-8c5c-15a71e8ec5c9", + /// }); + /// + /// }); + /// ``` /// [VSphereResourceType("vsphere:index/virtualMachineSnapshot:VirtualMachineSnapshot")] public partial class VirtualMachineSnapshot : global::Pulumi.CustomResource diff --git a/sdk/dotnet/VmStoragePolicy.cs b/sdk/dotnet/VmStoragePolicy.cs index f45f0850..c7233f7d 100644 --- a/sdk/dotnet/VmStoragePolicy.cs +++ b/sdk/dotnet/VmStoragePolicy.cs @@ -13,6 +13,224 @@ namespace Pulumi.VSphere /// The `vsphere.VmStoragePolicy` resource can be used to create and manage storage /// policies. Using this resource, tag based placement rules can be created to /// place virtual machines on a datastore with matching tags. If storage requirements for the applications on the virtual machine change, you can modify the storage policy that was originally applied to the virtual machine. + /// + /// ## Example Usage + /// + /// The following example creates storage policies with `tag_rules` base on sets of environment, service level, and replication attributes. + /// + /// In this example, tags are first applied to datastores. + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var environment = VSphere.GetTagCategory.Invoke(new() + /// { + /// Name = "environment", + /// }); + /// + /// var serviceLevel = VSphere.GetTagCategory.Invoke(new() + /// { + /// Name = "service_level", + /// }); + /// + /// var replication = VSphere.GetTagCategory.Invoke(new() + /// { + /// Name = "replication", + /// }); + /// + /// var production = VSphere.GetTag.Invoke(new() + /// { + /// CategoryId = "data.vsphere_tag_category.environment.id", + /// Name = "production", + /// }); + /// + /// var development = VSphere.GetTag.Invoke(new() + /// { + /// CategoryId = "data.vsphere_tag_category.environment.id", + /// Name = "development", + /// }); + /// + /// var platinum = VSphere.GetTag.Invoke(new() + /// { + /// CategoryId = "data.vsphere_tag_category.service_level.id", + /// Name = "platinum", + /// }); + /// + /// var gold = VSphere.GetTag.Invoke(new() + /// { + /// CategoryId = "data.vsphere_tag_category.service_level.id", + /// Name = "platinum", + /// }); + /// + /// var silver = VSphere.GetTag.Invoke(new() + /// { + /// CategoryId = "data.vsphere_tag_category.service_level.id", + /// Name = "silver", + /// }); + /// + /// var bronze = VSphere.GetTag.Invoke(new() + /// { + /// CategoryId = "data.vsphere_tag_category.service_level.id", + /// Name = "bronze", + /// }); + /// + /// var replicated = VSphere.GetTag.Invoke(new() + /// { + /// CategoryId = "data.vsphere_tag_category.replication.id", + /// Name = "replicated", + /// }); + /// + /// var nonReplicated = VSphere.GetTag.Invoke(new() + /// { + /// CategoryId = "data.vsphere_tag_category.replication.id", + /// Name = "non_replicated", + /// }); + /// + /// var prodDatastore = new VSphere.VmfsDatastore("prodDatastore", new() + /// { + /// Tags = new[] + /// { + /// "data.vsphere_tag.production.id", + /// "data.vsphere_tag.platinum.id", + /// "data.vsphere_tag.replicated.id", + /// }, + /// }); + /// + /// var devDatastore = new VSphere.NasDatastore("devDatastore", new() + /// { + /// Tags = new[] + /// { + /// "data.vsphere_tag.development.id", + /// "data.vsphere_tag.silver.id", + /// "data.vsphere_tag.non_replicated.id", + /// }, + /// }); + /// + /// }); + /// ``` + /// + /// Next, storage policies are created and `tag_rules` are applied. + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var prodPlatinumReplicated = new VSphere.VmStoragePolicy("prodPlatinumReplicated", new() + /// { + /// Description = "prod_platinum_replicated", + /// TagRules = new[] + /// { + /// new VSphere.Inputs.VmStoragePolicyTagRuleArgs + /// { + /// TagCategory = data.Vsphere_tag_category.Environment.Name, + /// Tags = new[] + /// { + /// data.Vsphere_tag.Production.Name, + /// }, + /// IncludeDatastoresWithTags = true, + /// }, + /// new VSphere.Inputs.VmStoragePolicyTagRuleArgs + /// { + /// TagCategory = data.Vsphere_tag_category.Service_level.Name, + /// Tags = new[] + /// { + /// data.Vsphere_tag.Platinum.Name, + /// }, + /// IncludeDatastoresWithTags = true, + /// }, + /// new VSphere.Inputs.VmStoragePolicyTagRuleArgs + /// { + /// TagCategory = data.Vsphere_tag_category.Replication.Name, + /// Tags = new[] + /// { + /// data.Vsphere_tag.Replicated.Name, + /// }, + /// IncludeDatastoresWithTags = true, + /// }, + /// }, + /// }); + /// + /// var devSilverNonreplicated = new VSphere.VmStoragePolicy("devSilverNonreplicated", new() + /// { + /// Description = "dev_silver_nonreplicated", + /// TagRules = new[] + /// { + /// new VSphere.Inputs.VmStoragePolicyTagRuleArgs + /// { + /// TagCategory = data.Vsphere_tag_category.Environment.Name, + /// Tags = new[] + /// { + /// data.Vsphere_tag.Development.Name, + /// }, + /// IncludeDatastoresWithTags = true, + /// }, + /// new VSphere.Inputs.VmStoragePolicyTagRuleArgs + /// { + /// TagCategory = data.Vsphere_tag_category.Service_level.Name, + /// Tags = new[] + /// { + /// data.Vsphere_tag.Silver.Name, + /// }, + /// IncludeDatastoresWithTags = true, + /// }, + /// new VSphere.Inputs.VmStoragePolicyTagRuleArgs + /// { + /// TagCategory = data.Vsphere_tag_category.Replication.Name, + /// Tags = new[] + /// { + /// data.Vsphere_tag.Non_replicated.Name, + /// }, + /// IncludeDatastoresWithTags = true, + /// }, + /// }, + /// }); + /// + /// }); + /// ``` + /// + /// Lasttly, when creating a virtual machine resource, a storage policy can be specificed to direct virtual machine placement to a datastore which matches the policy's `tags_rules`. + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var prodPlatinumReplicated = VSphere.GetPolicy.Invoke(new() + /// { + /// Name = "prod_platinum_replicated", + /// }); + /// + /// var devSilverNonreplicated = VSphere.GetPolicy.Invoke(new() + /// { + /// Name = "dev_silver_nonreplicated", + /// }); + /// + /// var prodVm = new VSphere.VirtualMachine("prodVm", new() + /// { + /// StoragePolicyId = data.Vsphere_storage_policy.Storage_policy.Prod_platinum_replicated.Id, + /// }); + /// + /// // ... other configuration ... + /// var devVm = new VSphere.VirtualMachine("devVm", new() + /// { + /// StoragePolicyId = data.Vsphere_storage_policy.Storage_policy.Dev_silver_nonreplicated.Id, + /// }); + /// + /// // ... other configuration ... + /// }); + /// ``` /// [VSphereResourceType("vsphere:index/vmStoragePolicy:VmStoragePolicy")] public partial class VmStoragePolicy : global::Pulumi.CustomResource diff --git a/sdk/dotnet/Vnic.cs b/sdk/dotnet/Vnic.cs index 8a5b82bb..1dcdb3ca 100644 --- a/sdk/dotnet/Vnic.cs +++ b/sdk/dotnet/Vnic.cs @@ -15,6 +15,143 @@ namespace Pulumi.VSphere /// ## Example Usage /// /// ### S + /// ### Create a vnic attached to a distributed virtual switch using the vmotion TCP/IP stack + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var dc = VSphere.GetDatacenter.Invoke(new() + /// { + /// Name = "mydc", + /// }); + /// + /// var h1 = VSphere.GetHost.Invoke(new() + /// { + /// Name = "esxi1.host.test", + /// DatacenterId = dc.Apply(getDatacenterResult => getDatacenterResult.Id), + /// }); + /// + /// var d1 = new VSphere.DistributedVirtualSwitch("d1", new() + /// { + /// DatacenterId = dc.Apply(getDatacenterResult => getDatacenterResult.Id), + /// Hosts = new[] + /// { + /// new VSphere.Inputs.DistributedVirtualSwitchHostArgs + /// { + /// HostSystemId = h1.Apply(getHostResult => getHostResult.Id), + /// Devices = new[] + /// { + /// "vnic3", + /// }, + /// }, + /// }, + /// }); + /// + /// var p1 = new VSphere.DistributedPortGroup("p1", new() + /// { + /// VlanId = 1234, + /// DistributedVirtualSwitchUuid = d1.Id, + /// }); + /// + /// var v1 = new VSphere.Vnic("v1", new() + /// { + /// Host = h1.Apply(getHostResult => getHostResult.Id), + /// DistributedSwitchPort = d1.Id, + /// DistributedPortGroup = p1.Id, + /// Ipv4 = new VSphere.Inputs.VnicIpv4Args + /// { + /// Dhcp = true, + /// }, + /// Netstack = "vmotion", + /// }); + /// + /// }); + /// ``` + /// ### Create a vnic attached to a portgroup using the default TCP/IP stack + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using VSphere = Pulumi.VSphere; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var dc = VSphere.GetDatacenter.Invoke(new() + /// { + /// Name = "mydc", + /// }); + /// + /// var h1 = VSphere.GetHost.Invoke(new() + /// { + /// Name = "esxi1.host.test", + /// DatacenterId = dc.Apply(getDatacenterResult => getDatacenterResult.Id), + /// }); + /// + /// var hvs1 = new VSphere.HostVirtualSwitch("hvs1", new() + /// { + /// HostSystemId = h1.Apply(getHostResult => getHostResult.Id), + /// NetworkAdapters = new[] + /// { + /// "vmnic3", + /// "vmnic4", + /// }, + /// ActiveNics = new[] + /// { + /// "vmnic3", + /// }, + /// StandbyNics = new[] + /// { + /// "vmnic4", + /// }, + /// }); + /// + /// var p1 = new VSphere.HostPortGroup("p1", new() + /// { + /// VirtualSwitchName = hvs1.Name, + /// HostSystemId = h1.Apply(getHostResult => getHostResult.Id), + /// }); + /// + /// var v1 = new VSphere.Vnic("v1", new() + /// { + /// Host = h1.Apply(getHostResult => getHostResult.Id), + /// Portgroup = p1.Name, + /// Ipv4 = new VSphere.Inputs.VnicIpv4Args + /// { + /// Dhcp = true, + /// }, + /// Services = new[] + /// { + /// "vsan", + /// "management", + /// }, + /// }); + /// + /// }); + /// ``` + /// ## Importing + /// + /// An existing vNic can be [imported][docs-import] into this resource + /// via supplying the vNic's ID. An example is below: + /// + /// [docs-import]: /docs/import/index.html + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// + /// return await Deployment.RunAsync(() => + /// { + /// }); + /// ``` + /// + /// The above would import the vnic `vmk2` from host with ID `host-123`. /// [VSphereResourceType("vsphere:index/vnic:Vnic")] public partial class Vnic : global::Pulumi.CustomResource diff --git a/sdk/go/vsphere/computeClusterVmAffinityRule.go b/sdk/go/vsphere/computeClusterVmAffinityRule.go index 8c970b47..dbd06159 100644 --- a/sdk/go/vsphere/computeClusterVmAffinityRule.go +++ b/sdk/go/vsphere/computeClusterVmAffinityRule.go @@ -34,6 +34,146 @@ import ( // direct ESXi host connections. // // > **NOTE:** vSphere DRS requires a vSphere Enterprise Plus license. +// +// ## Example Usage +// +// The following example creates two virtual machines in a cluster using the +// `VirtualMachine` resource, creating the +// virtual machines in the cluster looked up by the +// `ComputeCluster` data source. It +// then creates an affinity rule for these two virtual machines, ensuring they +// will run on the same host whenever possible. +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// datacenter, err := vsphere.LookupDatacenter(ctx, &vsphere.LookupDatacenterArgs{ +// Name: pulumi.StringRef("dc-01"), +// }, nil) +// if err != nil { +// return err +// } +// datastore, err := vsphere.GetDatastore(ctx, &vsphere.GetDatastoreArgs{ +// Name: "datastore-01", +// DatacenterId: pulumi.StringRef(datacenter.Id), +// }, nil) +// if err != nil { +// return err +// } +// cluster, err := vsphere.LookupComputeCluster(ctx, &vsphere.LookupComputeClusterArgs{ +// Name: "cluster-01", +// DatacenterId: pulumi.StringRef(datacenter.Id), +// }, nil) +// if err != nil { +// return err +// } +// network, err := vsphere.GetNetwork(ctx, &vsphere.GetNetworkArgs{ +// Name: "VM Network", +// DatacenterId: pulumi.StringRef(datacenter.Id), +// }, nil) +// if err != nil { +// return err +// } +// var vm []*vsphere.VirtualMachine +// for index := 0; index < 2; index++ { +// key0 := index +// _ := index +// __res, err := vsphere.NewVirtualMachine(ctx, fmt.Sprintf("vm-%v", key0), &vsphere.VirtualMachineArgs{ +// ResourcePoolId: *pulumi.String(cluster.ResourcePoolId), +// DatastoreId: *pulumi.String(datastore.Id), +// NumCpus: pulumi.Int(1), +// Memory: pulumi.Int(1024), +// GuestId: pulumi.String("otherLinux64Guest"), +// NetworkInterfaces: vsphere.VirtualMachineNetworkInterfaceArray{ +// &vsphere.VirtualMachineNetworkInterfaceArgs{ +// NetworkId: *pulumi.String(network.Id), +// }, +// }, +// Disks: vsphere.VirtualMachineDiskArray{ +// &vsphere.VirtualMachineDiskArgs{ +// Label: pulumi.String("disk0"), +// Size: pulumi.Int(20), +// }, +// }, +// }) +// if err != nil { +// return err +// } +// vm = append(vm, __res) +// } +// _, err = vsphere.NewComputeClusterVmAffinityRule(ctx, "vmAffinityRule", &vsphere.ComputeClusterVmAffinityRuleArgs{ +// ComputeClusterId: *pulumi.String(cluster.Id), +// VirtualMachineIds: "TODO: For expression", +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// +// The following example creates an affinity rule for a set of virtual machines +// in the cluster by looking up the virtual machine UUIDs from the +// `VirtualMachine` data source. +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// vms := []string{ +// "foo-0", +// "foo-1", +// } +// datacenter, err := vsphere.LookupDatacenter(ctx, &vsphere.LookupDatacenterArgs{ +// Name: pulumi.StringRef("dc-01"), +// }, nil) +// if err != nil { +// return err +// } +// cluster, err := vsphere.LookupComputeCluster(ctx, &vsphere.LookupComputeClusterArgs{ +// Name: "cluster-01", +// DatacenterId: pulumi.StringRef(datacenter.Id), +// }, nil) +// if err != nil { +// return err +// } +// vmsVirtualMachine := "TODO: For expression" +// var splat0 []*string +// for _, val0 := range vmsVirtualMachine { +// splat0 = append(splat0, val0.Id) +// } +// _, err = vsphere.NewComputeClusterVmAffinityRule(ctx, "vmAffinityRule", &vsphere.ComputeClusterVmAffinityRuleArgs{ +// Enabled: pulumi.Bool(true), +// ComputeClusterId: *pulumi.String(cluster.Id), +// VirtualMachineIds: []*pulumi.String(splat0), +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` type ComputeClusterVmAffinityRule struct { pulumi.CustomResourceState diff --git a/sdk/go/vsphere/datacenter.go b/sdk/go/vsphere/datacenter.go index 660b8fcf..e44f075b 100644 --- a/sdk/go/vsphere/datacenter.go +++ b/sdk/go/vsphere/datacenter.go @@ -16,6 +16,54 @@ import ( // container of inventory objects such as hosts and virtual machines. // // ## Example Usage +// ### Create datacenter on the root folder +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// _, err := vsphere.NewDatacenter(ctx, "prodDatacenter", nil) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// ### Create datacenter on a subfolder +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// _, err := vsphere.NewDatacenter(ctx, "researchDatacenter", &vsphere.DatacenterArgs{ +// Folder: pulumi.String("/research/"), +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` type Datacenter struct { pulumi.CustomResourceState diff --git a/sdk/go/vsphere/distributedVirtualSwitch.go b/sdk/go/vsphere/distributedVirtualSwitch.go index 6bf75657..28a1de46 100644 --- a/sdk/go/vsphere/distributedVirtualSwitch.go +++ b/sdk/go/vsphere/distributedVirtualSwitch.go @@ -266,6 +266,36 @@ type DistributedVirtualSwitch struct { // and `maxVlan` sub-arguments to define the tagged VLAN range. Multiple // `vlanRange` definitions are allowed, but they must not overlap. Example // below: + // + // ```go + // package main + // + // import ( + // "github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere" + // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" + // ) + // + // func main() { + // pulumi.Run(func(ctx *pulumi.Context) error { + // _, err := vsphere.NewDistributedVirtualSwitch(ctx, "vds", &vsphere.DistributedVirtualSwitchArgs{ + // VlanRanges: vsphere.DistributedVirtualSwitchVlanRangeArray{ + // &vsphere.DistributedVirtualSwitchVlanRangeArgs{ + // MaxVlan: pulumi.Int(199), + // MinVlan: pulumi.Int(100), + // }, + // &vsphere.DistributedVirtualSwitchVlanRangeArgs{ + // MaxVlan: pulumi.Int(399), + // MinVlan: pulumi.Int(300), + // }, + // }, + // }) + // if err != nil { + // return err + // } + // return nil + // }) + // } + // ``` VlanRanges DistributedVirtualSwitchVlanRangeArrayOutput `pulumi:"vlanRanges"` // The maximum allowed usage for the vmotion traffic class, in Mbits/sec. VmotionMaximumMbit pulumi.IntOutput `pulumi:"vmotionMaximumMbit"` @@ -568,6 +598,36 @@ type distributedVirtualSwitchState struct { // and `maxVlan` sub-arguments to define the tagged VLAN range. Multiple // `vlanRange` definitions are allowed, but they must not overlap. Example // below: + // + // ```go + // package main + // + // import ( + // "github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere" + // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" + // ) + // + // func main() { + // pulumi.Run(func(ctx *pulumi.Context) error { + // _, err := vsphere.NewDistributedVirtualSwitch(ctx, "vds", &vsphere.DistributedVirtualSwitchArgs{ + // VlanRanges: vsphere.DistributedVirtualSwitchVlanRangeArray{ + // &vsphere.DistributedVirtualSwitchVlanRangeArgs{ + // MaxVlan: pulumi.Int(199), + // MinVlan: pulumi.Int(100), + // }, + // &vsphere.DistributedVirtualSwitchVlanRangeArgs{ + // MaxVlan: pulumi.Int(399), + // MinVlan: pulumi.Int(300), + // }, + // }, + // }) + // if err != nil { + // return err + // } + // return nil + // }) + // } + // ``` VlanRanges []DistributedVirtualSwitchVlanRange `pulumi:"vlanRanges"` // The maximum allowed usage for the vmotion traffic class, in Mbits/sec. VmotionMaximumMbit *int `pulumi:"vmotionMaximumMbit"` @@ -838,6 +898,36 @@ type DistributedVirtualSwitchState struct { // and `maxVlan` sub-arguments to define the tagged VLAN range. Multiple // `vlanRange` definitions are allowed, but they must not overlap. Example // below: + // + // ```go + // package main + // + // import ( + // "github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere" + // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" + // ) + // + // func main() { + // pulumi.Run(func(ctx *pulumi.Context) error { + // _, err := vsphere.NewDistributedVirtualSwitch(ctx, "vds", &vsphere.DistributedVirtualSwitchArgs{ + // VlanRanges: vsphere.DistributedVirtualSwitchVlanRangeArray{ + // &vsphere.DistributedVirtualSwitchVlanRangeArgs{ + // MaxVlan: pulumi.Int(199), + // MinVlan: pulumi.Int(100), + // }, + // &vsphere.DistributedVirtualSwitchVlanRangeArgs{ + // MaxVlan: pulumi.Int(399), + // MinVlan: pulumi.Int(300), + // }, + // }, + // }) + // if err != nil { + // return err + // } + // return nil + // }) + // } + // ``` VlanRanges DistributedVirtualSwitchVlanRangeArrayInput // The maximum allowed usage for the vmotion traffic class, in Mbits/sec. VmotionMaximumMbit pulumi.IntPtrInput @@ -1109,6 +1199,36 @@ type distributedVirtualSwitchArgs struct { // and `maxVlan` sub-arguments to define the tagged VLAN range. Multiple // `vlanRange` definitions are allowed, but they must not overlap. Example // below: + // + // ```go + // package main + // + // import ( + // "github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere" + // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" + // ) + // + // func main() { + // pulumi.Run(func(ctx *pulumi.Context) error { + // _, err := vsphere.NewDistributedVirtualSwitch(ctx, "vds", &vsphere.DistributedVirtualSwitchArgs{ + // VlanRanges: vsphere.DistributedVirtualSwitchVlanRangeArray{ + // &vsphere.DistributedVirtualSwitchVlanRangeArgs{ + // MaxVlan: pulumi.Int(199), + // MinVlan: pulumi.Int(100), + // }, + // &vsphere.DistributedVirtualSwitchVlanRangeArgs{ + // MaxVlan: pulumi.Int(399), + // MinVlan: pulumi.Int(300), + // }, + // }, + // }) + // if err != nil { + // return err + // } + // return nil + // }) + // } + // ``` VlanRanges []DistributedVirtualSwitchVlanRange `pulumi:"vlanRanges"` // The maximum allowed usage for the vmotion traffic class, in Mbits/sec. VmotionMaximumMbit *int `pulumi:"vmotionMaximumMbit"` @@ -1377,6 +1497,36 @@ type DistributedVirtualSwitchArgs struct { // and `maxVlan` sub-arguments to define the tagged VLAN range. Multiple // `vlanRange` definitions are allowed, but they must not overlap. Example // below: + // + // ```go + // package main + // + // import ( + // "github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere" + // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" + // ) + // + // func main() { + // pulumi.Run(func(ctx *pulumi.Context) error { + // _, err := vsphere.NewDistributedVirtualSwitch(ctx, "vds", &vsphere.DistributedVirtualSwitchArgs{ + // VlanRanges: vsphere.DistributedVirtualSwitchVlanRangeArray{ + // &vsphere.DistributedVirtualSwitchVlanRangeArgs{ + // MaxVlan: pulumi.Int(199), + // MinVlan: pulumi.Int(100), + // }, + // &vsphere.DistributedVirtualSwitchVlanRangeArgs{ + // MaxVlan: pulumi.Int(399), + // MinVlan: pulumi.Int(300), + // }, + // }, + // }) + // if err != nil { + // return err + // } + // return nil + // }) + // } + // ``` VlanRanges DistributedVirtualSwitchVlanRangeArrayInput // The maximum allowed usage for the vmotion traffic class, in Mbits/sec. VmotionMaximumMbit pulumi.IntPtrInput @@ -2017,6 +2167,39 @@ func (o DistributedVirtualSwitchOutput) VlanId() pulumi.IntOutput { // and `maxVlan` sub-arguments to define the tagged VLAN range. Multiple // `vlanRange` definitions are allowed, but they must not overlap. Example // below: +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// _, err := vsphere.NewDistributedVirtualSwitch(ctx, "vds", &vsphere.DistributedVirtualSwitchArgs{ +// VlanRanges: vsphere.DistributedVirtualSwitchVlanRangeArray{ +// &vsphere.DistributedVirtualSwitchVlanRangeArgs{ +// MaxVlan: pulumi.Int(199), +// MinVlan: pulumi.Int(100), +// }, +// &vsphere.DistributedVirtualSwitchVlanRangeArgs{ +// MaxVlan: pulumi.Int(399), +// MinVlan: pulumi.Int(300), +// }, +// }, +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` func (o DistributedVirtualSwitchOutput) VlanRanges() DistributedVirtualSwitchVlanRangeArrayOutput { return o.ApplyT(func(v *DistributedVirtualSwitch) DistributedVirtualSwitchVlanRangeArrayOutput { return v.VlanRanges }).(DistributedVirtualSwitchVlanRangeArrayOutput) } diff --git a/sdk/go/vsphere/file.go b/sdk/go/vsphere/file.go index 6b4bd760..07c53636 100644 --- a/sdk/go/vsphere/file.go +++ b/sdk/go/vsphere/file.go @@ -14,6 +14,66 @@ import ( ) // ## Example Usage +// ### Uploading a File +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// _, err := vsphere.NewFile(ctx, "ubuntuVmdkUpload", &vsphere.FileArgs{ +// CreateDirectories: pulumi.Bool(true), +// Datacenter: pulumi.String("dc-01"), +// Datastore: pulumi.String("datastore-01"), +// DestinationFile: pulumi.String("/my/dst/path/custom_ubuntu.vmdk"), +// SourceFile: pulumi.String("/my/src/path/custom_ubuntu.vmdk"), +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// ### Copying a File +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// _, err := vsphere.NewFile(ctx, "ubuntuCopy", &vsphere.FileArgs{ +// CreateDirectories: pulumi.Bool(true), +// Datacenter: pulumi.String("dc-01"), +// Datastore: pulumi.String("datastore-01"), +// DestinationFile: pulumi.String("/my/dst/path/custom_ubuntu.vmdk"), +// SourceDatacenter: pulumi.String("dc-01"), +// SourceDatastore: pulumi.String("datastore-01"), +// SourceFile: pulumi.String("/my/src/path/custom_ubuntu.vmdk"), +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` type File struct { pulumi.CustomResourceState diff --git a/sdk/go/vsphere/getComputeCluster.go b/sdk/go/vsphere/getComputeCluster.go index d8bba144..772d7862 100644 --- a/sdk/go/vsphere/getComputeCluster.go +++ b/sdk/go/vsphere/getComputeCluster.go @@ -22,6 +22,39 @@ import ( // // resource for more information about clusters and how to managed the resource // in this provider. +// +// ## Example Usage +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// datacenter, err := vsphere.LookupDatacenter(ctx, &vsphere.LookupDatacenterArgs{ +// Name: pulumi.StringRef("dc-01"), +// }, nil) +// if err != nil { +// return err +// } +// _, err = vsphere.LookupComputeCluster(ctx, &vsphere.LookupComputeClusterArgs{ +// Name: "cluster-01", +// DatacenterId: pulumi.StringRef(datacenter.Id), +// }, nil) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` func LookupComputeCluster(ctx *pulumi.Context, args *LookupComputeClusterArgs, opts ...pulumi.InvokeOption) (*LookupComputeClusterResult, error) { opts = internal.PkgInvokeDefaultOpts(opts) var rv LookupComputeClusterResult diff --git a/sdk/go/vsphere/getComputeClusterHostGroup.go b/sdk/go/vsphere/getComputeClusterHostGroup.go index 1171beea..0e618fd2 100644 --- a/sdk/go/vsphere/getComputeClusterHostGroup.go +++ b/sdk/go/vsphere/getComputeClusterHostGroup.go @@ -15,6 +15,54 @@ import ( // The `ComputeClusterHostGroup` data source can be used to discover // the IDs ESXi hosts in a host group and return host group attributes to other // resources. +// +// ## Example Usage +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// datacenter, err := vsphere.LookupDatacenter(ctx, &vsphere.LookupDatacenterArgs{ +// Name: pulumi.StringRef(_var.Vsphere_datacenter), +// }, nil) +// if err != nil { +// return err +// } +// cluster, err := vsphere.LookupComputeCluster(ctx, &vsphere.LookupComputeClusterArgs{ +// Name: _var.Vsphere_cluster, +// DatacenterId: pulumi.StringRef(datacenter.Id), +// }, nil) +// if err != nil { +// return err +// } +// hostGroup1, err := vsphere.LookupComputeClusterHostGroup(ctx, &vsphere.LookupComputeClusterHostGroupArgs{ +// Name: "host_group1", +// ComputeClusterId: cluster.Id, +// }, nil) +// if err != nil { +// return err +// } +// _, err = vsphere.NewComputeClusterVmHostRule(ctx, "hostRule1", &vsphere.ComputeClusterVmHostRuleArgs{ +// ComputeClusterId: *pulumi.String(cluster.Id), +// VmGroupName: pulumi.String("vm_group1"), +// AffinityHostGroupName: *pulumi.String(hostGroup1.Name), +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` func LookupComputeClusterHostGroup(ctx *pulumi.Context, args *LookupComputeClusterHostGroupArgs, opts ...pulumi.InvokeOption) (*LookupComputeClusterHostGroupResult, error) { opts = internal.PkgInvokeDefaultOpts(opts) var rv LookupComputeClusterHostGroupResult diff --git a/sdk/go/vsphere/getContentLibrary.go b/sdk/go/vsphere/getContentLibrary.go index be126366..fc84af3f 100644 --- a/sdk/go/vsphere/getContentLibrary.go +++ b/sdk/go/vsphere/getContentLibrary.go @@ -15,6 +15,32 @@ import ( // The `ContentLibrary` data source can be used to discover the ID of a content library. // // > **NOTE:** This resource requires vCenter Server and is not available on direct ESXi host connections. +// +// ## Example Usage +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// _, err := vsphere.LookupContentLibrary(ctx, &vsphere.LookupContentLibraryArgs{ +// Name: "Content Library", +// }, nil) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` func LookupContentLibrary(ctx *pulumi.Context, args *LookupContentLibraryArgs, opts ...pulumi.InvokeOption) (*LookupContentLibraryResult, error) { opts = internal.PkgInvokeDefaultOpts(opts) var rv LookupContentLibraryResult diff --git a/sdk/go/vsphere/getCustomAttribute.go b/sdk/go/vsphere/getCustomAttribute.go index 98f1f685..6d493437 100644 --- a/sdk/go/vsphere/getCustomAttribute.go +++ b/sdk/go/vsphere/getCustomAttribute.go @@ -20,6 +20,32 @@ import ( // // > **NOTE:** Custom attributes are unsupported on direct ESXi host connections // and require vCenter Server. +// +// ## Example Usage +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// _, err := vsphere.LookupCustomAttribute(ctx, &vsphere.LookupCustomAttributeArgs{ +// Name: "test-attribute", +// }, nil) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` func LookupCustomAttribute(ctx *pulumi.Context, args *LookupCustomAttributeArgs, opts ...pulumi.InvokeOption) (*LookupCustomAttributeResult, error) { opts = internal.PkgInvokeDefaultOpts(opts) var rv LookupCustomAttributeResult diff --git a/sdk/go/vsphere/getDatacenter.go b/sdk/go/vsphere/getDatacenter.go index c99a0e0a..c4595e55 100644 --- a/sdk/go/vsphere/getDatacenter.go +++ b/sdk/go/vsphere/getDatacenter.go @@ -16,6 +16,32 @@ import ( // vSphere datacenter object. This can then be used with resources or data sources // that require a datacenter, such as the `Host` // data source. +// +// ## Example Usage +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// _, err := vsphere.LookupDatacenter(ctx, &vsphere.LookupDatacenterArgs{ +// Name: pulumi.StringRef("dc-01"), +// }, nil) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` func LookupDatacenter(ctx *pulumi.Context, args *LookupDatacenterArgs, opts ...pulumi.InvokeOption) (*LookupDatacenterResult, error) { opts = internal.PkgInvokeDefaultOpts(opts) var rv LookupDatacenterResult diff --git a/sdk/go/vsphere/getDatastore.go b/sdk/go/vsphere/getDatastore.go index 8b64ccc0..15f6ec37 100644 --- a/sdk/go/vsphere/getDatastore.go +++ b/sdk/go/vsphere/getDatastore.go @@ -16,6 +16,39 @@ import ( // vSphere datastore object. This can then be used with resources or data sources // that require a datastore. For example, to create virtual machines in using the // `VirtualMachine` resource. +// +// ## Example Usage +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// datacenter, err := vsphere.LookupDatacenter(ctx, &vsphere.LookupDatacenterArgs{ +// Name: pulumi.StringRef("dc-01"), +// }, nil) +// if err != nil { +// return err +// } +// _, err = vsphere.GetDatastore(ctx, &vsphere.GetDatastoreArgs{ +// Name: "datastore-01", +// DatacenterId: pulumi.StringRef(datacenter.Id), +// }, nil) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` func GetDatastore(ctx *pulumi.Context, args *GetDatastoreArgs, opts ...pulumi.InvokeOption) (*GetDatastoreResult, error) { opts = internal.PkgInvokeDefaultOpts(opts) var rv GetDatastoreResult diff --git a/sdk/go/vsphere/getDatastoreCluster.go b/sdk/go/vsphere/getDatastoreCluster.go index bcfcc9e2..d1610650 100644 --- a/sdk/go/vsphere/getDatastoreCluster.go +++ b/sdk/go/vsphere/getDatastoreCluster.go @@ -16,6 +16,39 @@ import ( // vSphere datastore cluster object. This can then be used with resources or data sources // that require a datastore. For example, to assign datastores using the // `NasDatastore` or `VmfsDatastore` resources, or to create virtual machines in using the `VirtualMachine` resource. +// +// ## Example Usage +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// datacenter, err := vsphere.LookupDatacenter(ctx, &vsphere.LookupDatacenterArgs{ +// Name: pulumi.StringRef("dc-01"), +// }, nil) +// if err != nil { +// return err +// } +// _, err = vsphere.LookupDatastoreCluster(ctx, &vsphere.LookupDatastoreClusterArgs{ +// Name: "datastore-cluster-01", +// DatacenterId: pulumi.StringRef(datacenter.Id), +// }, nil) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` func LookupDatastoreCluster(ctx *pulumi.Context, args *LookupDatastoreClusterArgs, opts ...pulumi.InvokeOption) (*LookupDatastoreClusterResult, error) { opts = internal.PkgInvokeDefaultOpts(opts) var rv LookupDatastoreClusterResult diff --git a/sdk/go/vsphere/getDistributedVirtualSwitch.go b/sdk/go/vsphere/getDistributedVirtualSwitch.go index 2b1c0b9a..9531eaa9 100644 --- a/sdk/go/vsphere/getDistributedVirtualSwitch.go +++ b/sdk/go/vsphere/getDistributedVirtualSwitch.go @@ -20,6 +20,56 @@ import ( // // > **NOTE:** This data source requires vCenter Server and is not available on // direct ESXi host connections. +// +// ## Example Usage +// +// The following example locates a distributed switch named `vds-01`, in the +// datacenter `dc-01`. It then uses this distributed switch to set up a +// `DistributedPortGroup` resource that uses the first uplink as a +// primary uplink and the second uplink as a secondary. +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// datacenter, err := vsphere.LookupDatacenter(ctx, &vsphere.LookupDatacenterArgs{ +// Name: pulumi.StringRef("dc-01"), +// }, nil) +// if err != nil { +// return err +// } +// vds, err := vsphere.LookupDistributedVirtualSwitch(ctx, &vsphere.LookupDistributedVirtualSwitchArgs{ +// Name: "vds-01", +// DatacenterId: pulumi.StringRef(datacenter.Id), +// }, nil) +// if err != nil { +// return err +// } +// _, err = vsphere.NewDistributedPortGroup(ctx, "dvpg", &vsphere.DistributedPortGroupArgs{ +// DistributedVirtualSwitchUuid: *pulumi.String(vds.Id), +// ActiveUplinks: pulumi.StringArray{ +// *pulumi.String(vds.Uplinks[0]), +// }, +// StandbyUplinks: pulumi.StringArray{ +// *pulumi.String(vds.Uplinks[1]), +// }, +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` func LookupDistributedVirtualSwitch(ctx *pulumi.Context, args *LookupDistributedVirtualSwitchArgs, opts ...pulumi.InvokeOption) (*LookupDistributedVirtualSwitchResult, error) { opts = internal.PkgInvokeDefaultOpts(opts) var rv LookupDistributedVirtualSwitchResult diff --git a/sdk/go/vsphere/getDynamic.go b/sdk/go/vsphere/getDynamic.go index 8e05a578..847cbc19 100644 --- a/sdk/go/vsphere/getDynamic.go +++ b/sdk/go/vsphere/getDynamic.go @@ -17,6 +17,55 @@ import ( // The `getDynamic` data source can be used to get the [managed object reference ID][docs-about-morefs] // of any tagged managed object in vCenter Server by providing a list of tag IDs // and an optional regular expression to filter objects by name. +// +// ## Example Usage +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// _, err := vsphere.LookupTagCategory(ctx, &vsphere.LookupTagCategoryArgs{ +// Name: "SomeCategory", +// }, nil); +// if err != nil { +// return err +// } +// tag1, err := vsphere.LookupTag(ctx, &vsphere.LookupTagArgs{ +// Name: "FirstTag", +// CategoryId: data.Vsphere_tag_category.Cat.Id, +// }, nil); +// if err != nil { +// return err +// } +// _, err = vsphere.LookupTag(ctx, &vsphere.LookupTagArgs{ +// Name: "SecondTag", +// CategoryId: data.Vsphere_tag_category.Cat.Id, +// }, nil); +// if err != nil { +// return err +// } +// _, err = vsphere.GetDynamic(ctx, &vsphere.GetDynamicArgs{ +// Filters: interface{}{ +// tag1.Id, +// tag1.Id, +// }, +// NameRegex: pulumi.StringRef("ubuntu"), +// Type: pulumi.StringRef("Datacenter"), +// }, nil); +// if err != nil { +// return err +// } +// return nil +// }) +// } +// ``` func GetDynamic(ctx *pulumi.Context, args *GetDynamicArgs, opts ...pulumi.InvokeOption) (*GetDynamicResult, error) { opts = internal.PkgInvokeDefaultOpts(opts) var rv GetDynamicResult diff --git a/sdk/go/vsphere/getFolder.go b/sdk/go/vsphere/getFolder.go index 27296e9f..b494cbf1 100644 --- a/sdk/go/vsphere/getFolder.go +++ b/sdk/go/vsphere/getFolder.go @@ -14,6 +14,32 @@ import ( // The `Folder` data source can be used to get the general attributes of a // vSphere inventory folder. Paths are absolute and must include the datacenter. +// +// ## Example Usage +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// _, err := vsphere.LookupFolder(ctx, &vsphere.LookupFolderArgs{ +// Path: "/dc-01/datastore-01/folder-01", +// }, nil) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` func LookupFolder(ctx *pulumi.Context, args *LookupFolderArgs, opts ...pulumi.InvokeOption) (*LookupFolderResult, error) { opts = internal.PkgInvokeDefaultOpts(opts) var rv LookupFolderResult diff --git a/sdk/go/vsphere/getHost.go b/sdk/go/vsphere/getHost.go index dee7a81f..59d6d0d0 100644 --- a/sdk/go/vsphere/getHost.go +++ b/sdk/go/vsphere/getHost.go @@ -15,6 +15,39 @@ import ( // The `Host` data source can be used to discover the ID of an ESXi host. // This can then be used with resources or data sources that require an ESX // host's managed object reference ID. +// +// ## Example Usage +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// datacenter, err := vsphere.LookupDatacenter(ctx, &vsphere.LookupDatacenterArgs{ +// Name: pulumi.StringRef("dc-01"), +// }, nil) +// if err != nil { +// return err +// } +// _, err = vsphere.LookupHost(ctx, &vsphere.LookupHostArgs{ +// Name: pulumi.StringRef("esxi-01.example.com"), +// DatacenterId: datacenter.Id, +// }, nil) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` func LookupHost(ctx *pulumi.Context, args *LookupHostArgs, opts ...pulumi.InvokeOption) (*LookupHostResult, error) { opts = internal.PkgInvokeDefaultOpts(opts) var rv LookupHostResult diff --git a/sdk/go/vsphere/getHostPciDevice.go b/sdk/go/vsphere/getHostPciDevice.go index fec34e47..218d7ae2 100644 --- a/sdk/go/vsphere/getHostPciDevice.go +++ b/sdk/go/vsphere/getHostPciDevice.go @@ -17,7 +17,46 @@ import ( // `VirtualMachine`'s `pciDeviceId`. // // ## Example Usage +// ### With Vendor ID And Class ID // +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// datacenter, err := vsphere.LookupDatacenter(ctx, &vsphere.LookupDatacenterArgs{ +// Name: pulumi.StringRef("dc-01"), +// }, nil) +// if err != nil { +// return err +// } +// host, err := vsphere.LookupHost(ctx, &vsphere.LookupHostArgs{ +// Name: pulumi.StringRef("esxi-01.example.com"), +// DatacenterId: datacenter.Id, +// }, nil) +// if err != nil { +// return err +// } +// _, err = vsphere.GetHostPciDevice(ctx, &vsphere.GetHostPciDeviceArgs{ +// HostId: host.Id, +// ClassId: pulumi.StringRef("123"), +// VendorId: pulumi.StringRef("456"), +// }, nil) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` // ### With Name Regular Expression func GetHostPciDevice(ctx *pulumi.Context, args *GetHostPciDeviceArgs, opts ...pulumi.InvokeOption) (*GetHostPciDeviceResult, error) { opts = internal.PkgInvokeDefaultOpts(opts) diff --git a/sdk/go/vsphere/getHostThumbprint.go b/sdk/go/vsphere/getHostThumbprint.go index e446a932..befac967 100644 --- a/sdk/go/vsphere/getHostThumbprint.go +++ b/sdk/go/vsphere/getHostThumbprint.go @@ -16,6 +16,32 @@ import ( // thumbprint of an ESXi host. This can be used when adding the `Host` // resource. If the ESXi host is using a certificate chain, the first one returned // will be used to generate the thumbprint. +// +// ## Example Usage +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// _, err := vsphere.GetHostThumbprint(ctx, &vsphere.GetHostThumbprintArgs{ +// Address: "esxi-01.example.com", +// }, nil) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` func GetHostThumbprint(ctx *pulumi.Context, args *GetHostThumbprintArgs, opts ...pulumi.InvokeOption) (*GetHostThumbprintResult, error) { opts = internal.PkgInvokeDefaultOpts(opts) var rv GetHostThumbprintResult diff --git a/sdk/go/vsphere/getLicense.go b/sdk/go/vsphere/getLicense.go index 3157aac4..5ba82da0 100644 --- a/sdk/go/vsphere/getLicense.go +++ b/sdk/go/vsphere/getLicense.go @@ -14,6 +14,32 @@ import ( // The `License` data source can be used to get the general attributes of // a license keys from a vCenter Server instance. +// +// ## Example Usage +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// _, err := vsphere.LookupLicense(ctx, &vsphere.LookupLicenseArgs{ +// LicenseKey: "00000-00000-00000-00000-00000", +// }, nil) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` func LookupLicense(ctx *pulumi.Context, args *LookupLicenseArgs, opts ...pulumi.InvokeOption) (*LookupLicenseResult, error) { opts = internal.PkgInvokeDefaultOpts(opts) var rv LookupLicenseResult diff --git a/sdk/go/vsphere/getNetwork.go b/sdk/go/vsphere/getNetwork.go index a713f599..362673d2 100644 --- a/sdk/go/vsphere/getNetwork.go +++ b/sdk/go/vsphere/getNetwork.go @@ -17,6 +17,39 @@ import ( // network interface for `VirtualMachine` or any other vSphere resource // that requires a network. This includes standard (host-based) port groups, // distributed port groups, or opaque networks such as those managed by NSX. +// +// ## Example Usage +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// datacenter, err := vsphere.LookupDatacenter(ctx, &vsphere.LookupDatacenterArgs{ +// Name: pulumi.StringRef("dc-01"), +// }, nil) +// if err != nil { +// return err +// } +// _, err = vsphere.GetNetwork(ctx, &vsphere.GetNetworkArgs{ +// Name: "VM Network", +// DatacenterId: pulumi.StringRef(datacenter.Id), +// }, nil) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` func GetNetwork(ctx *pulumi.Context, args *GetNetworkArgs, opts ...pulumi.InvokeOption) (*GetNetworkResult, error) { opts = internal.PkgInvokeDefaultOpts(opts) var rv GetNetworkResult diff --git a/sdk/go/vsphere/getPolicy.go b/sdk/go/vsphere/getPolicy.go index fc191cb1..5fa7be25 100644 --- a/sdk/go/vsphere/getPolicy.go +++ b/sdk/go/vsphere/getPolicy.go @@ -18,6 +18,38 @@ import ( // // > **NOTE:** Storage policies are not supported on direct ESXi hosts and // requires vCenter Server. +// +// ## Example Usage +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// _, err := vsphere.GetPolicy(ctx, &vsphere.GetPolicyArgs{ +// Name: "prod_platinum_replicated", +// }, nil) +// if err != nil { +// return err +// } +// _, err = vsphere.GetPolicy(ctx, &vsphere.GetPolicyArgs{ +// Name: "dev_silver_nonreplicated", +// }, nil) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` func GetPolicy(ctx *pulumi.Context, args *GetPolicyArgs, opts ...pulumi.InvokeOption) (*GetPolicyResult, error) { opts = internal.PkgInvokeDefaultOpts(opts) var rv GetPolicyResult diff --git a/sdk/go/vsphere/getResourcePool.go b/sdk/go/vsphere/getResourcePool.go index d5fcec58..7085d4cf 100644 --- a/sdk/go/vsphere/getResourcePool.go +++ b/sdk/go/vsphere/getResourcePool.go @@ -16,6 +16,77 @@ import ( // resource pool in vSphere. This is useful to return the ID of a resource pool // that you want to use to create virtual machines in using the // `VirtualMachine` resource. +// +// ## Example Usage +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// datacenter, err := vsphere.LookupDatacenter(ctx, &vsphere.LookupDatacenterArgs{ +// Name: pulumi.StringRef("dc-01"), +// }, nil) +// if err != nil { +// return err +// } +// _, err = vsphere.LookupResourcePool(ctx, &vsphere.LookupResourcePoolArgs{ +// Name: pulumi.StringRef("resource-pool-01"), +// DatacenterId: pulumi.StringRef(datacenter.Id), +// }, nil) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// ### Specifying the Root Resource Pool for a Standalone ESXi Host +// +// > **NOTE:** Returning the root resource pool for a cluster can be done +// directly via the `ComputeCluster` +// data source. +// +// All compute resources in vSphere have a resource pool, even if one has not been +// explicitly created. This resource pool is referred to as the +// _root resource pool_ and can be looked up by specifying the path. +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// _, err := vsphere.LookupResourcePool(ctx, &vsphere.LookupResourcePoolArgs{ +// Name: pulumi.StringRef("esxi-01.example.com/Resources"), +// DatacenterId: pulumi.StringRef(data.Vsphere_datacenter.Datacenter.Id), +// }, nil) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// +// For more information on the root resource pool, see [Managing Resource Pools][vmware-docs-resource-pools] in the vSphere documentation. +// +// [vmware-docs-resource-pools]: https://docs.vmware.com/en/VMware-vSphere/7.0/com.vmware.vsphere.resmgmt.doc/GUID-60077B40-66FF-4625-934A-641703ED7601.html func LookupResourcePool(ctx *pulumi.Context, args *LookupResourcePoolArgs, opts ...pulumi.InvokeOption) (*LookupResourcePoolResult, error) { opts = internal.PkgInvokeDefaultOpts(opts) var rv LookupResourcePoolResult diff --git a/sdk/go/vsphere/getRole.go b/sdk/go/vsphere/getRole.go index 1777e306..aadddf95 100644 --- a/sdk/go/vsphere/getRole.go +++ b/sdk/go/vsphere/getRole.go @@ -14,6 +14,32 @@ import ( // The `Role` data source can be used to discover the `id` and privileges associated // with a role given its name or display label. +// +// ## Example Usage +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// _, err := vsphere.LookupRole(ctx, &vsphere.LookupRoleArgs{ +// Label: "Terraform to vSphere Integration Role", +// }, nil) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` func LookupRole(ctx *pulumi.Context, args *LookupRoleArgs, opts ...pulumi.InvokeOption) (*LookupRoleResult, error) { opts = internal.PkgInvokeDefaultOpts(opts) var rv LookupRoleResult diff --git a/sdk/go/vsphere/getTag.go b/sdk/go/vsphere/getTag.go index 76bde619..600b14f7 100644 --- a/sdk/go/vsphere/getTag.go +++ b/sdk/go/vsphere/getTag.go @@ -20,6 +20,39 @@ import ( // // > **NOTE:** Tagging is not supported on direct ESXi hosts connections and // requires vCenter Server. +// +// ## Example Usage +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// category, err := vsphere.LookupTagCategory(ctx, &vsphere.LookupTagCategoryArgs{ +// Name: "example-category", +// }, nil) +// if err != nil { +// return err +// } +// _, err = vsphere.LookupTag(ctx, &vsphere.LookupTagArgs{ +// Name: "example-tag", +// CategoryId: category.Id, +// }, nil) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` func LookupTag(ctx *pulumi.Context, args *LookupTagArgs, opts ...pulumi.InvokeOption) (*LookupTagResult, error) { opts = internal.PkgInvokeDefaultOpts(opts) var rv LookupTagResult diff --git a/sdk/go/vsphere/getTagCategory.go b/sdk/go/vsphere/getTagCategory.go index a775d489..e5829c9a 100644 --- a/sdk/go/vsphere/getTagCategory.go +++ b/sdk/go/vsphere/getTagCategory.go @@ -20,6 +20,32 @@ import ( // // > **NOTE:** Tagging is not supported on direct ESXi hosts connections and // requires vCenter Server. +// +// ## Example Usage +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// _, err := vsphere.LookupTagCategory(ctx, &vsphere.LookupTagCategoryArgs{ +// Name: "example-category", +// }, nil) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` func LookupTagCategory(ctx *pulumi.Context, args *LookupTagCategoryArgs, opts ...pulumi.InvokeOption) (*LookupTagCategoryResult, error) { opts = internal.PkgInvokeDefaultOpts(opts) var rv LookupTagCategoryResult diff --git a/sdk/go/vsphere/getVappContainer.go b/sdk/go/vsphere/getVappContainer.go index 8c78a39b..389a5452 100644 --- a/sdk/go/vsphere/getVappContainer.go +++ b/sdk/go/vsphere/getVappContainer.go @@ -16,6 +16,39 @@ import ( // vApp container in vSphere. This is useful to return the ID of a vApp container // that you want to use to create virtual machines in using the // `VirtualMachine` resource. +// +// ## Example Usage +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// datacenter, err := vsphere.LookupDatacenter(ctx, &vsphere.LookupDatacenterArgs{ +// Name: pulumi.StringRef("dc-01"), +// }, nil) +// if err != nil { +// return err +// } +// _, err = vsphere.LookupVappContainer(ctx, &vsphere.LookupVappContainerArgs{ +// Name: "vapp-container-01", +// DatacenterId: datacenter.Id, +// }, nil) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` func LookupVappContainer(ctx *pulumi.Context, args *LookupVappContainerArgs, opts ...pulumi.InvokeOption) (*LookupVappContainerResult, error) { opts = internal.PkgInvokeDefaultOpts(opts) var rv LookupVappContainerResult diff --git a/sdk/go/vsphere/getVirtualMachine.go b/sdk/go/vsphere/getVirtualMachine.go index f6f098c4..88628370 100644 --- a/sdk/go/vsphere/getVirtualMachine.go +++ b/sdk/go/vsphere/getVirtualMachine.go @@ -17,6 +17,82 @@ import ( // the UUID of a template to be used as the source for cloning to a new // `VirtualMachine` resource. It also // reads the guest ID so that can be supplied as well. +// +// ## Example Usage +// +// In the following example, a virtual machine template is returned by its +// unique name within the `Datacenter`. +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// datacenter, err := vsphere.LookupDatacenter(ctx, &vsphere.LookupDatacenterArgs{ +// Name: pulumi.StringRef("dc-01"), +// }, nil) +// if err != nil { +// return err +// } +// _, err = vsphere.LookupVirtualMachine(ctx, &vsphere.LookupVirtualMachineArgs{ +// Name: pulumi.StringRef("ubuntu-server-template"), +// DatacenterId: pulumi.StringRef(datacenter.Id), +// }, nil) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// In the following example, each virtual machine template is returned by its +// unique full path within the `Datacenter`. +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// datacenter, err := vsphere.LookupDatacenter(ctx, &vsphere.LookupDatacenterArgs{ +// Name: pulumi.StringRef("dc-01"), +// }, nil) +// if err != nil { +// return err +// } +// _, err = vsphere.LookupVirtualMachine(ctx, &vsphere.LookupVirtualMachineArgs{ +// Name: pulumi.StringRef("production/templates/ubuntu-server-template"), +// DatacenterId: pulumi.StringRef(datacenter.Id), +// }, nil) +// if err != nil { +// return err +// } +// _, err = vsphere.LookupVirtualMachine(ctx, &vsphere.LookupVirtualMachineArgs{ +// Name: pulumi.StringRef("development/templates/ubuntu-server-template"), +// DatacenterId: pulumi.StringRef(datacenter.Id), +// }, nil) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` func LookupVirtualMachine(ctx *pulumi.Context, args *LookupVirtualMachineArgs, opts ...pulumi.InvokeOption) (*LookupVirtualMachineResult, error) { opts = internal.PkgInvokeDefaultOpts(opts) var rv LookupVirtualMachineResult diff --git a/sdk/go/vsphere/getVmfsDisks.go b/sdk/go/vsphere/getVmfsDisks.go index 2e1110d9..f1d5c031 100644 --- a/sdk/go/vsphere/getVmfsDisks.go +++ b/sdk/go/vsphere/getVmfsDisks.go @@ -16,6 +16,47 @@ import ( // devices available on an ESXi host. This data source can be combined with the // `VmfsDatastore` resource to create VMFS // datastores based off a set of discovered disks. +// +// ## Example Usage +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// datacenter, err := vsphere.LookupDatacenter(ctx, &vsphere.LookupDatacenterArgs{ +// Name: pulumi.StringRef("dc-01"), +// }, nil) +// if err != nil { +// return err +// } +// host, err := vsphere.LookupHost(ctx, &vsphere.LookupHostArgs{ +// Name: pulumi.StringRef("esxi-01.example.com"), +// DatacenterId: datacenter.Id, +// }, nil) +// if err != nil { +// return err +// } +// _, err = vsphere.GetVmfsDisks(ctx, &vsphere.GetVmfsDisksArgs{ +// HostSystemId: host.Id, +// Rescan: pulumi.BoolRef(true), +// Filter: pulumi.StringRef("mpx.vmhba1:C0:T[12]:L0"), +// }, nil) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` func GetVmfsDisks(ctx *pulumi.Context, args *GetVmfsDisksArgs, opts ...pulumi.InvokeOption) (*GetVmfsDisksResult, error) { opts = internal.PkgInvokeDefaultOpts(opts) var rv GetVmfsDisksResult diff --git a/sdk/go/vsphere/host.go b/sdk/go/vsphere/host.go index e084da40..bff637d0 100644 --- a/sdk/go/vsphere/host.go +++ b/sdk/go/vsphere/host.go @@ -17,6 +17,124 @@ import ( // can be used either as a member of a cluster or as a standalone host. // // ## Example Usage +// ### Create a standalone host +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// datacenter, err := vsphere.LookupDatacenter(ctx, &vsphere.LookupDatacenterArgs{ +// Name: pulumi.StringRef("dc-01"), +// }, nil) +// if err != nil { +// return err +// } +// thumbprint, err := vsphere.GetHostThumbprint(ctx, &vsphere.GetHostThumbprintArgs{ +// Address: "esx-01.example.com", +// Insecure: pulumi.BoolRef(true), +// }, nil) +// if err != nil { +// return err +// } +// _, err = vsphere.NewHost(ctx, "esx-01", &vsphere.HostArgs{ +// Hostname: pulumi.String("esx-01.example.com"), +// Username: pulumi.String("root"), +// Password: pulumi.String("password"), +// License: pulumi.String("00000-00000-00000-00000-00000"), +// Thumbprint: *pulumi.String(thumbprint.Id), +// Datacenter: *pulumi.String(datacenter.Id), +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// ### Create host in a compute cluster +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// datacenter, err := vsphere.LookupDatacenter(ctx, &vsphere.LookupDatacenterArgs{ +// Name: pulumi.StringRef("dc-01"), +// }, nil) +// if err != nil { +// return err +// } +// cluster, err := vsphere.LookupComputeCluster(ctx, &vsphere.LookupComputeClusterArgs{ +// Name: "cluster-01", +// DatacenterId: pulumi.StringRef(datacenter.Id), +// }, nil) +// if err != nil { +// return err +// } +// thumbprint, err := vsphere.GetHostThumbprint(ctx, &vsphere.GetHostThumbprintArgs{ +// Address: "esx-01.example.com", +// Insecure: pulumi.BoolRef(true), +// }, nil) +// if err != nil { +// return err +// } +// _, err = vsphere.NewHost(ctx, "esx-01", &vsphere.HostArgs{ +// Hostname: pulumi.String("esx-01.example.com"), +// Username: pulumi.String("root"), +// Password: pulumi.String("password"), +// License: pulumi.String("00000-00000-00000-00000-00000"), +// Thumbprint: *pulumi.String(thumbprint.Id), +// Cluster: *pulumi.String(cluster.Id), +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// ## Importing +// +// An existing host can be [imported][docs-import] into this resource by supplying +// the host's ID. An example is below: +// +// [docs-import]: /docs/import/index.html +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// return nil +// }) +// } +// +// ``` +// +// The above would import the host with ID `host-123`. type Host struct { pulumi.CustomResourceState diff --git a/sdk/go/vsphere/hostPortGroup.go b/sdk/go/vsphere/hostPortGroup.go index 96562285..e84c7817 100644 --- a/sdk/go/vsphere/hostPortGroup.go +++ b/sdk/go/vsphere/hostPortGroup.go @@ -20,6 +20,151 @@ import ( // // For an overview on vSphere networking concepts, see [the product documentation][ref-vsphere-net-concepts]. // +// ## Example Usage +// +// **Create a Virtual Switch and Bind a Port Group:** +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// datacenter, err := vsphere.LookupDatacenter(ctx, &vsphere.LookupDatacenterArgs{ +// Name: pulumi.StringRef("dc-01"), +// }, nil) +// if err != nil { +// return err +// } +// host, err := vsphere.LookupHost(ctx, &vsphere.LookupHostArgs{ +// Name: pulumi.StringRef("esxi-01.example.com"), +// DatacenterId: datacenter.Id, +// }, nil) +// if err != nil { +// return err +// } +// hostVirtualSwitch, err := vsphere.NewHostVirtualSwitch(ctx, "hostVirtualSwitch", &vsphere.HostVirtualSwitchArgs{ +// HostSystemId: *pulumi.String(host.Id), +// NetworkAdapters: pulumi.StringArray{ +// pulumi.String("vmnic0"), +// pulumi.String("vmnic1"), +// }, +// ActiveNics: pulumi.StringArray{ +// pulumi.String("vmnic0"), +// }, +// StandbyNics: pulumi.StringArray{ +// pulumi.String("vmnic1"), +// }, +// }) +// if err != nil { +// return err +// } +// _, err = vsphere.NewHostPortGroup(ctx, "pg", &vsphere.HostPortGroupArgs{ +// HostSystemId: *pulumi.String(host.Id), +// VirtualSwitchName: hostVirtualSwitch.Name, +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// +// **Create a Port Group with a VLAN and ab Override:** +// +// This example sets the trunk mode VLAN (`4095`, which passes through all tags) +// and sets +// `allowPromiscuous` +// to ensure that all traffic is seen on the port. The setting overrides +// the implicit default of `false` set on the standard switch. +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// datacenter, err := vsphere.LookupDatacenter(ctx, &vsphere.LookupDatacenterArgs{ +// Name: pulumi.StringRef("dc-01"), +// }, nil) +// if err != nil { +// return err +// } +// host, err := vsphere.LookupHost(ctx, &vsphere.LookupHostArgs{ +// Name: pulumi.StringRef("esxi-01.example.com"), +// DatacenterId: datacenter.Id, +// }, nil) +// if err != nil { +// return err +// } +// hostVirtualSwitch, err := vsphere.NewHostVirtualSwitch(ctx, "hostVirtualSwitch", &vsphere.HostVirtualSwitchArgs{ +// HostSystemId: *pulumi.String(host.Id), +// NetworkAdapters: pulumi.StringArray{ +// pulumi.String("vmnic0"), +// pulumi.String("vmnic1"), +// }, +// ActiveNics: pulumi.StringArray{ +// pulumi.String("vmnic0"), +// }, +// StandbyNics: pulumi.StringArray{ +// pulumi.String("vmnic1"), +// }, +// }) +// if err != nil { +// return err +// } +// _, err = vsphere.NewHostPortGroup(ctx, "pg", &vsphere.HostPortGroupArgs{ +// HostSystemId: *pulumi.String(host.Id), +// VirtualSwitchName: hostVirtualSwitch.Name, +// VlanId: pulumi.Int(4095), +// AllowPromiscuous: pulumi.Bool(true), +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// ## Importing +// +// An existing host port group can be imported into this resource +// using the host port group's ID. An example is below: +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// return nil +// }) +// } +// +// ``` +// +// The above would import the `management` host port group from host with ID `host-123`. +// // [ref-vsphere-net-concepts]: https://docs.vmware.com/en/VMware-vSphere/7.0/com.vmware.vsphere.networking.doc/GUID-2B11DBB8-CB3C-4AFF-8885-EFEA0FC562F4.html type HostPortGroup struct { pulumi.CustomResourceState diff --git a/sdk/go/vsphere/license.go b/sdk/go/vsphere/license.go index b50fa30c..f3534c69 100644 --- a/sdk/go/vsphere/license.go +++ b/sdk/go/vsphere/license.go @@ -14,6 +14,36 @@ import ( ) // Provides a VMware vSphere license resource. This can be used to add and remove license keys. +// +// ## Example Usage +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// _, err := vsphere.NewLicense(ctx, "licenseKey", &vsphere.LicenseArgs{ +// Labels: pulumi.StringMap{ +// "VpxClientLicenseLabel": pulumi.String("Hello World"), +// "Workflow": pulumi.String("Hello World"), +// }, +// LicenseKey: pulumi.String("452CQ-2EK54-K8742-00000-00000"), +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` type License struct { pulumi.CustomResourceState diff --git a/sdk/go/vsphere/pulumiTypes.go b/sdk/go/vsphere/pulumiTypes.go index f1449f2e..d8622b7d 100644 --- a/sdk/go/vsphere/pulumiTypes.go +++ b/sdk/go/vsphere/pulumiTypes.go @@ -21,6 +21,47 @@ type ComputeClusterVsanDiskGroup struct { // // > **NOTE:** You must disable vSphere HA before you enable vSAN on the cluster. // You can enable or re-enable vSphere HA after vSAN is configured. + // + // ```go + // package main + // + // import ( + // "github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere" + // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" + // ) + // func main() { + // pulumi.Run(func(ctx *pulumi.Context) error { + // _, err := vsphere.NewComputeCluster(ctx, "computeCluster", &vsphere.ComputeClusterArgs{ + // DatacenterId: pulumi.Any(data.Vsphere_datacenter.Datacenter.Id), + // HostSystemIds: pulumi.StringArray{ + // %!v(PANIC=Format method: fatal: A failure has occurred: unlowered splat expression @ #-types-vsphere:index-ComputeClusterVsanDiskGroup:ComputeClusterVsanDiskGroup-storages.pp:2,18-45), + // }, + // DrsEnabled: pulumi.Bool(true), + // DrsAutomationLevel: pulumi.String("fullyAutomated"), + // HaEnabled: pulumi.Bool(false), + // VsanEnabled: pulumi.Bool(true), + // VsanDedupEnabled: pulumi.Bool(true), + // VsanCompressionEnabled: pulumi.Bool(true), + // VsanPerformanceEnabled: pulumi.Bool(true), + // VsanVerboseModeEnabled: pulumi.Bool(true), + // VsanNetworkDiagnosticModeEnabled: pulumi.Bool(true), + // VsanUnmapEnabled: pulumi.Bool(true), + // VsanDitEncryptionEnabled: pulumi.Bool(true), + // VsanDitRekeyInterval: pulumi.Int(1800), + // VsanDiskGroups: vsphere.ComputeClusterVsanDiskGroupArray{ + // &vsphere.ComputeClusterVsanDiskGroupArgs{ + // Cache: pulumi.Any(data.Vsphere_vmfs_disks.Cache_disks[0]), + // Storages: pulumi.Any(data.Vsphere_vmfs_disks.Storage_disks), + // }, + // }, + // }) + // if err != nil { + // return err + // } + // return nil + // }) + // } + // ``` Storages []string `pulumi:"storages"` } @@ -42,6 +83,47 @@ type ComputeClusterVsanDiskGroupArgs struct { // // > **NOTE:** You must disable vSphere HA before you enable vSAN on the cluster. // You can enable or re-enable vSphere HA after vSAN is configured. + // + // ```go + // package main + // + // import ( + // "github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere" + // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" + // ) + // func main() { + // pulumi.Run(func(ctx *pulumi.Context) error { + // _, err := vsphere.NewComputeCluster(ctx, "computeCluster", &vsphere.ComputeClusterArgs{ + // DatacenterId: pulumi.Any(data.Vsphere_datacenter.Datacenter.Id), + // HostSystemIds: pulumi.StringArray{ + // %!v(PANIC=Format method: fatal: A failure has occurred: unlowered splat expression @ #-types-vsphere:index-ComputeClusterVsanDiskGroup:ComputeClusterVsanDiskGroup-storages.pp:2,18-45), + // }, + // DrsEnabled: pulumi.Bool(true), + // DrsAutomationLevel: pulumi.String("fullyAutomated"), + // HaEnabled: pulumi.Bool(false), + // VsanEnabled: pulumi.Bool(true), + // VsanDedupEnabled: pulumi.Bool(true), + // VsanCompressionEnabled: pulumi.Bool(true), + // VsanPerformanceEnabled: pulumi.Bool(true), + // VsanVerboseModeEnabled: pulumi.Bool(true), + // VsanNetworkDiagnosticModeEnabled: pulumi.Bool(true), + // VsanUnmapEnabled: pulumi.Bool(true), + // VsanDitEncryptionEnabled: pulumi.Bool(true), + // VsanDitRekeyInterval: pulumi.Int(1800), + // VsanDiskGroups: vsphere.ComputeClusterVsanDiskGroupArray{ + // &vsphere.ComputeClusterVsanDiskGroupArgs{ + // Cache: pulumi.Any(data.Vsphere_vmfs_disks.Cache_disks[0]), + // Storages: pulumi.Any(data.Vsphere_vmfs_disks.Storage_disks), + // }, + // }, + // }) + // if err != nil { + // return err + // } + // return nil + // }) + // } + // ``` Storages pulumi.StringArrayInput `pulumi:"storages"` } @@ -123,6 +205,49 @@ func (o ComputeClusterVsanDiskGroupOutput) Cache() pulumi.StringPtrOutput { // // > **NOTE:** You must disable vSphere HA before you enable vSAN on the cluster. // You can enable or re-enable vSphere HA after vSAN is configured. +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// _, err := vsphere.NewComputeCluster(ctx, "computeCluster", &vsphere.ComputeClusterArgs{ +// DatacenterId: pulumi.Any(data.Vsphere_datacenter.Datacenter.Id), +// HostSystemIds: pulumi.StringArray{ +// %!v(PANIC=Format method: fatal: A failure has occurred: unlowered splat expression @ #-types-vsphere:index-ComputeClusterVsanDiskGroup:ComputeClusterVsanDiskGroup-storages.pp:2,18-45), +// }, +// DrsEnabled: pulumi.Bool(true), +// DrsAutomationLevel: pulumi.String("fullyAutomated"), +// HaEnabled: pulumi.Bool(false), +// VsanEnabled: pulumi.Bool(true), +// VsanDedupEnabled: pulumi.Bool(true), +// VsanCompressionEnabled: pulumi.Bool(true), +// VsanPerformanceEnabled: pulumi.Bool(true), +// VsanVerboseModeEnabled: pulumi.Bool(true), +// VsanNetworkDiagnosticModeEnabled: pulumi.Bool(true), +// VsanUnmapEnabled: pulumi.Bool(true), +// VsanDitEncryptionEnabled: pulumi.Bool(true), +// VsanDitRekeyInterval: pulumi.Int(1800), +// VsanDiskGroups: vsphere.ComputeClusterVsanDiskGroupArray{ +// &vsphere.ComputeClusterVsanDiskGroupArgs{ +// Cache: pulumi.Any(data.Vsphere_vmfs_disks.Cache_disks[0]), +// Storages: pulumi.Any(data.Vsphere_vmfs_disks.Storage_disks), +// }, +// }, +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// ``` func (o ComputeClusterVsanDiskGroupOutput) Storages() pulumi.StringArrayOutput { return o.ApplyT(func(v ComputeClusterVsanDiskGroup) []string { return v.Storages }).(pulumi.StringArrayOutput) } diff --git a/sdk/go/vsphere/resourcePool.go b/sdk/go/vsphere/resourcePool.go index b7398004..f7ca3a72 100644 --- a/sdk/go/vsphere/resourcePool.go +++ b/sdk/go/vsphere/resourcePool.go @@ -19,6 +19,121 @@ import ( // For more information on vSphere resource pools, please refer to the // [product documentation][ref-vsphere-resource_pools]. // +// ## Example Usage +// +// The following example sets up a resource pool in an existing compute cluster +// with the default settings for CPU and memory reservations, shares, and limits. +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// datacenter, err := vsphere.LookupDatacenter(ctx, &vsphere.LookupDatacenterArgs{ +// Name: pulumi.StringRef("dc-01"), +// }, nil) +// if err != nil { +// return err +// } +// computeCluster, err := vsphere.LookupComputeCluster(ctx, &vsphere.LookupComputeClusterArgs{ +// Name: "cluster-01", +// DatacenterId: pulumi.StringRef(datacenter.Id), +// }, nil) +// if err != nil { +// return err +// } +// _, err = vsphere.NewResourcePool(ctx, "resourcePool", &vsphere.ResourcePoolArgs{ +// ParentResourcePoolId: *pulumi.String(computeCluster.ResourcePoolId), +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// +// A virtual machine resource could be targeted to use the default resource pool +// of the cluster using the following: +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// _, err := vsphere.NewVirtualMachine(ctx, "vm", &vsphere.VirtualMachineArgs{ +// ResourcePoolId: pulumi.Any(data.Vsphere_compute_cluster.Cluster.Resource_pool_id), +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// +// The following example sets up a parent resource pool in an existing compute cluster +// with a child resource pool nested below. Each resource pool is configured with +// the default settings for CPU and memory reservations, shares, and limits. +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// datacenter, err := vsphere.LookupDatacenter(ctx, &vsphere.LookupDatacenterArgs{ +// Name: pulumi.StringRef("dc-01"), +// }, nil) +// if err != nil { +// return err +// } +// computeCluster, err := vsphere.LookupComputeCluster(ctx, &vsphere.LookupComputeClusterArgs{ +// Name: "cluster-01", +// DatacenterId: pulumi.StringRef(datacenter.Id), +// }, nil) +// if err != nil { +// return err +// } +// resourcePoolParent, err := vsphere.NewResourcePool(ctx, "resourcePoolParent", &vsphere.ResourcePoolArgs{ +// ParentResourcePoolId: *pulumi.String(computeCluster.ResourcePoolId), +// }) +// if err != nil { +// return err +// } +// _, err = vsphere.NewResourcePool(ctx, "resourcePoolChild", &vsphere.ResourcePoolArgs{ +// ParentResourcePoolId: resourcePoolParent.ID(), +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` // ## Importing // ### Settings that Require vSphere 7.0 or higher // diff --git a/sdk/go/vsphere/virtualMachineSnapshot.go b/sdk/go/vsphere/virtualMachineSnapshot.go index a95ddbfc..d86dcf79 100644 --- a/sdk/go/vsphere/virtualMachineSnapshot.go +++ b/sdk/go/vsphere/virtualMachineSnapshot.go @@ -31,6 +31,38 @@ import ( // NOT recommend using them as as backup feature. For more information on the // limitation of virtual machine snapshots, see [here][ext-vm-snap-limitations]. // +// ## Example Usage +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// _, err := vsphere.NewVirtualMachineSnapshot(ctx, "demo1", &vsphere.VirtualMachineSnapshotArgs{ +// Consolidate: pulumi.Bool(true), +// Description: pulumi.String("This is Demo Snapshot"), +// Memory: pulumi.Bool(true), +// Quiesce: pulumi.Bool(true), +// RemoveChildren: pulumi.Bool(false), +// SnapshotName: pulumi.String("Snapshot Name"), +// VirtualMachineUuid: pulumi.String("9aac5551-a351-4158-8c5c-15a71e8ec5c9"), +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// // [ext-vm-snapshot-management]: https://docs.vmware.com/en/VMware-vSphere/7.0/com.vmware.vsphere.vm_admin.doc/GUID-CA948C69-7F58-4519-AEB1-739545EA94E5.html // [ext-vm-snap-limitations]: https://docs.vmware.com/en/VMware-vSphere/7.0/com.vmware.vsphere.vm_admin.doc/GUID-53F65726-A23B-4CF0-A7D5-48E584B88613.html type VirtualMachineSnapshot struct { diff --git a/sdk/go/vsphere/vmStoragePolicy.go b/sdk/go/vsphere/vmStoragePolicy.go index 276e162c..bdc877b2 100644 --- a/sdk/go/vsphere/vmStoragePolicy.go +++ b/sdk/go/vsphere/vmStoragePolicy.go @@ -16,6 +16,246 @@ import ( // The `VmStoragePolicy` resource can be used to create and manage storage // policies. Using this resource, tag based placement rules can be created to // place virtual machines on a datastore with matching tags. If storage requirements for the applications on the virtual machine change, you can modify the storage policy that was originally applied to the virtual machine. +// +// ## Example Usage +// +// The following example creates storage policies with `tagRules` base on sets of environment, service level, and replication attributes. +// +// In this example, tags are first applied to datastores. +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// _, err := vsphere.LookupTagCategory(ctx, &vsphere.LookupTagCategoryArgs{ +// Name: "environment", +// }, nil) +// if err != nil { +// return err +// } +// _, err = vsphere.LookupTagCategory(ctx, &vsphere.LookupTagCategoryArgs{ +// Name: "service_level", +// }, nil) +// if err != nil { +// return err +// } +// _, err = vsphere.LookupTagCategory(ctx, &vsphere.LookupTagCategoryArgs{ +// Name: "replication", +// }, nil) +// if err != nil { +// return err +// } +// _, err = vsphere.LookupTag(ctx, &vsphere.LookupTagArgs{ +// CategoryId: "data.vsphere_tag_category.environment.id", +// Name: "production", +// }, nil) +// if err != nil { +// return err +// } +// _, err = vsphere.LookupTag(ctx, &vsphere.LookupTagArgs{ +// CategoryId: "data.vsphere_tag_category.environment.id", +// Name: "development", +// }, nil) +// if err != nil { +// return err +// } +// _, err = vsphere.LookupTag(ctx, &vsphere.LookupTagArgs{ +// CategoryId: "data.vsphere_tag_category.service_level.id", +// Name: "platinum", +// }, nil) +// if err != nil { +// return err +// } +// _, err = vsphere.LookupTag(ctx, &vsphere.LookupTagArgs{ +// CategoryId: "data.vsphere_tag_category.service_level.id", +// Name: "platinum", +// }, nil) +// if err != nil { +// return err +// } +// _, err = vsphere.LookupTag(ctx, &vsphere.LookupTagArgs{ +// CategoryId: "data.vsphere_tag_category.service_level.id", +// Name: "silver", +// }, nil) +// if err != nil { +// return err +// } +// _, err = vsphere.LookupTag(ctx, &vsphere.LookupTagArgs{ +// CategoryId: "data.vsphere_tag_category.service_level.id", +// Name: "bronze", +// }, nil) +// if err != nil { +// return err +// } +// _, err = vsphere.LookupTag(ctx, &vsphere.LookupTagArgs{ +// CategoryId: "data.vsphere_tag_category.replication.id", +// Name: "replicated", +// }, nil) +// if err != nil { +// return err +// } +// _, err = vsphere.LookupTag(ctx, &vsphere.LookupTagArgs{ +// CategoryId: "data.vsphere_tag_category.replication.id", +// Name: "non_replicated", +// }, nil) +// if err != nil { +// return err +// } +// _, err = vsphere.NewVmfsDatastore(ctx, "prodDatastore", &vsphere.VmfsDatastoreArgs{ +// Tags: pulumi.StringArray{ +// pulumi.String("data.vsphere_tag.production.id"), +// pulumi.String("data.vsphere_tag.platinum.id"), +// pulumi.String("data.vsphere_tag.replicated.id"), +// }, +// }) +// if err != nil { +// return err +// } +// _, err = vsphere.NewNasDatastore(ctx, "devDatastore", &vsphere.NasDatastoreArgs{ +// Tags: pulumi.StringArray{ +// pulumi.String("data.vsphere_tag.development.id"), +// pulumi.String("data.vsphere_tag.silver.id"), +// pulumi.String("data.vsphere_tag.non_replicated.id"), +// }, +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// +// Next, storage policies are created and `tagRules` are applied. +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// _, err := vsphere.NewVmStoragePolicy(ctx, "prodPlatinumReplicated", &vsphere.VmStoragePolicyArgs{ +// Description: pulumi.String("prod_platinum_replicated"), +// TagRules: vsphere.VmStoragePolicyTagRuleArray{ +// &vsphere.VmStoragePolicyTagRuleArgs{ +// TagCategory: pulumi.Any(data.Vsphere_tag_category.Environment.Name), +// Tags: pulumi.StringArray{ +// data.Vsphere_tag.Production.Name, +// }, +// IncludeDatastoresWithTags: pulumi.Bool(true), +// }, +// &vsphere.VmStoragePolicyTagRuleArgs{ +// TagCategory: pulumi.Any(data.Vsphere_tag_category.Service_level.Name), +// Tags: pulumi.StringArray{ +// data.Vsphere_tag.Platinum.Name, +// }, +// IncludeDatastoresWithTags: pulumi.Bool(true), +// }, +// &vsphere.VmStoragePolicyTagRuleArgs{ +// TagCategory: pulumi.Any(data.Vsphere_tag_category.Replication.Name), +// Tags: pulumi.StringArray{ +// data.Vsphere_tag.Replicated.Name, +// }, +// IncludeDatastoresWithTags: pulumi.Bool(true), +// }, +// }, +// }) +// if err != nil { +// return err +// } +// _, err = vsphere.NewVmStoragePolicy(ctx, "devSilverNonreplicated", &vsphere.VmStoragePolicyArgs{ +// Description: pulumi.String("dev_silver_nonreplicated"), +// TagRules: vsphere.VmStoragePolicyTagRuleArray{ +// &vsphere.VmStoragePolicyTagRuleArgs{ +// TagCategory: pulumi.Any(data.Vsphere_tag_category.Environment.Name), +// Tags: pulumi.StringArray{ +// data.Vsphere_tag.Development.Name, +// }, +// IncludeDatastoresWithTags: pulumi.Bool(true), +// }, +// &vsphere.VmStoragePolicyTagRuleArgs{ +// TagCategory: pulumi.Any(data.Vsphere_tag_category.Service_level.Name), +// Tags: pulumi.StringArray{ +// data.Vsphere_tag.Silver.Name, +// }, +// IncludeDatastoresWithTags: pulumi.Bool(true), +// }, +// &vsphere.VmStoragePolicyTagRuleArgs{ +// TagCategory: pulumi.Any(data.Vsphere_tag_category.Replication.Name), +// Tags: pulumi.StringArray{ +// data.Vsphere_tag.Non_replicated.Name, +// }, +// IncludeDatastoresWithTags: pulumi.Bool(true), +// }, +// }, +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// +// Lasttly, when creating a virtual machine resource, a storage policy can be specificed to direct virtual machine placement to a datastore which matches the policy's `tagsRules`. +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// _, err := vsphere.GetPolicy(ctx, &vsphere.GetPolicyArgs{ +// Name: "prod_platinum_replicated", +// }, nil) +// if err != nil { +// return err +// } +// _, err = vsphere.GetPolicy(ctx, &vsphere.GetPolicyArgs{ +// Name: "dev_silver_nonreplicated", +// }, nil) +// if err != nil { +// return err +// } +// _, err = vsphere.NewVirtualMachine(ctx, "prodVm", &vsphere.VirtualMachineArgs{ +// StoragePolicyId: pulumi.Any(data.Vsphere_storage_policy.Storage_policy.Prod_platinum_replicated.Id), +// }) +// if err != nil { +// return err +// } +// _, err = vsphere.NewVirtualMachine(ctx, "devVm", &vsphere.VirtualMachineArgs{ +// StoragePolicyId: pulumi.Any(data.Vsphere_storage_policy.Storage_policy.Dev_silver_nonreplicated.Id), +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` type VmStoragePolicy struct { pulumi.CustomResourceState diff --git a/sdk/go/vsphere/vnic.go b/sdk/go/vsphere/vnic.go index 6527dca4..7aacb319 100644 --- a/sdk/go/vsphere/vnic.go +++ b/sdk/go/vsphere/vnic.go @@ -18,6 +18,165 @@ import ( // ## Example Usage // // ### S +// ### Create a vnic attached to a distributed virtual switch using the vmotion TCP/IP stack +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// dc, err := vsphere.LookupDatacenter(ctx, &vsphere.LookupDatacenterArgs{ +// Name: pulumi.StringRef("mydc"), +// }, nil) +// if err != nil { +// return err +// } +// h1, err := vsphere.LookupHost(ctx, &vsphere.LookupHostArgs{ +// Name: pulumi.StringRef("esxi1.host.test"), +// DatacenterId: dc.Id, +// }, nil) +// if err != nil { +// return err +// } +// d1, err := vsphere.NewDistributedVirtualSwitch(ctx, "d1", &vsphere.DistributedVirtualSwitchArgs{ +// DatacenterId: *pulumi.String(dc.Id), +// Hosts: vsphere.DistributedVirtualSwitchHostArray{ +// &vsphere.DistributedVirtualSwitchHostArgs{ +// HostSystemId: *pulumi.String(h1.Id), +// Devices: pulumi.StringArray{ +// pulumi.String("vnic3"), +// }, +// }, +// }, +// }) +// if err != nil { +// return err +// } +// p1, err := vsphere.NewDistributedPortGroup(ctx, "p1", &vsphere.DistributedPortGroupArgs{ +// VlanId: pulumi.Int(1234), +// DistributedVirtualSwitchUuid: d1.ID(), +// }) +// if err != nil { +// return err +// } +// _, err = vsphere.NewVnic(ctx, "v1", &vsphere.VnicArgs{ +// Host: *pulumi.String(h1.Id), +// DistributedSwitchPort: d1.ID(), +// DistributedPortGroup: p1.ID(), +// Ipv4: &vsphere.VnicIpv4Args{ +// Dhcp: pulumi.Bool(true), +// }, +// Netstack: pulumi.String("vmotion"), +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// ### Create a vnic attached to a portgroup using the default TCP/IP stack +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// dc, err := vsphere.LookupDatacenter(ctx, &vsphere.LookupDatacenterArgs{ +// Name: pulumi.StringRef("mydc"), +// }, nil) +// if err != nil { +// return err +// } +// h1, err := vsphere.LookupHost(ctx, &vsphere.LookupHostArgs{ +// Name: pulumi.StringRef("esxi1.host.test"), +// DatacenterId: dc.Id, +// }, nil) +// if err != nil { +// return err +// } +// hvs1, err := vsphere.NewHostVirtualSwitch(ctx, "hvs1", &vsphere.HostVirtualSwitchArgs{ +// HostSystemId: *pulumi.String(h1.Id), +// NetworkAdapters: pulumi.StringArray{ +// pulumi.String("vmnic3"), +// pulumi.String("vmnic4"), +// }, +// ActiveNics: pulumi.StringArray{ +// pulumi.String("vmnic3"), +// }, +// StandbyNics: pulumi.StringArray{ +// pulumi.String("vmnic4"), +// }, +// }) +// if err != nil { +// return err +// } +// p1, err := vsphere.NewHostPortGroup(ctx, "p1", &vsphere.HostPortGroupArgs{ +// VirtualSwitchName: hvs1.Name, +// HostSystemId: *pulumi.String(h1.Id), +// }) +// if err != nil { +// return err +// } +// _, err = vsphere.NewVnic(ctx, "v1", &vsphere.VnicArgs{ +// Host: *pulumi.String(h1.Id), +// Portgroup: p1.Name, +// Ipv4: &vsphere.VnicIpv4Args{ +// Dhcp: pulumi.Bool(true), +// }, +// Services: pulumi.StringArray{ +// pulumi.String("vsan"), +// pulumi.String("management"), +// }, +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// ## Importing +// +// An existing vNic can be [imported][docs-import] into this resource +// via supplying the vNic's ID. An example is below: +// +// [docs-import]: /docs/import/index.html +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// return nil +// }) +// } +// +// ``` +// +// The above would import the vnic `vmk2` from host with ID `host-123`. type Vnic struct { pulumi.CustomResourceState diff --git a/sdk/nodejs/computeClusterVmAffinityRule.ts b/sdk/nodejs/computeClusterVmAffinityRule.ts index 0b4a3783..a964066c 100644 --- a/sdk/nodejs/computeClusterVmAffinityRule.ts +++ b/sdk/nodejs/computeClusterVmAffinityRule.ts @@ -26,6 +26,87 @@ import * as utilities from "./utilities"; * direct ESXi host connections. * * > **NOTE:** vSphere DRS requires a vSphere Enterprise Plus license. + * + * ## Example Usage + * + * The following example creates two virtual machines in a cluster using the + * `vsphere.VirtualMachine` resource, creating the + * virtual machines in the cluster looked up by the + * `vsphere.ComputeCluster` data source. It + * then creates an affinity rule for these two virtual machines, ensuring they + * will run on the same host whenever possible. + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const datacenter = vsphere.getDatacenter({ + * name: "dc-01", + * }); + * const datastore = datacenter.then(datacenter => vsphere.getDatastore({ + * name: "datastore-01", + * datacenterId: datacenter.id, + * })); + * const cluster = datacenter.then(datacenter => vsphere.getComputeCluster({ + * name: "cluster-01", + * datacenterId: datacenter.id, + * })); + * const network = datacenter.then(datacenter => vsphere.getNetwork({ + * name: "VM Network", + * datacenterId: datacenter.id, + * })); + * const vm: vsphere.VirtualMachine[] = []; + * for (const range = {value: 0}; range.value < 2; range.value++) { + * vm.push(new vsphere.VirtualMachine(`vm-${range.value}`, { + * resourcePoolId: cluster.then(cluster => cluster.resourcePoolId), + * datastoreId: datastore.then(datastore => datastore.id), + * numCpus: 1, + * memory: 1024, + * guestId: "otherLinux64Guest", + * networkInterfaces: [{ + * networkId: network.then(network => network.id), + * }], + * disks: [{ + * label: "disk0", + * size: 20, + * }], + * })); + * } + * const vmAffinityRule = new vsphere.ComputeClusterVmAffinityRule("vmAffinityRule", { + * computeClusterId: cluster.then(cluster => cluster.id), + * virtualMachineIds: vm.map((v, k) => [k, v]).map(([, ]) => (v.id)), + * }); + * ``` + * + * The following example creates an affinity rule for a set of virtual machines + * in the cluster by looking up the virtual machine UUIDs from the + * `vsphere.VirtualMachine` data source. + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const vms = [ + * "foo-0", + * "foo-1", + * ]; + * const datacenter = vsphere.getDatacenter({ + * name: "dc-01", + * }); + * const cluster = datacenter.then(datacenter => vsphere.getComputeCluster({ + * name: "cluster-01", + * datacenterId: datacenter.id, + * })); + * const vmsVirtualMachine = (new Array(vms.length)).map((_, i) => i).map(__index => (vsphere.getVirtualMachine({ + * name: vms[__index], + * datacenterId: _arg0_.id, + * }))); + * const vmAffinityRule = new vsphere.ComputeClusterVmAffinityRule("vmAffinityRule", { + * enabled: true, + * computeClusterId: cluster.then(cluster => cluster.id), + * virtualMachineIds: vmsVirtualMachine.map(__item => __item.id), + * }); + * ``` */ export class ComputeClusterVmAffinityRule extends pulumi.CustomResource { /** diff --git a/sdk/nodejs/datacenter.ts b/sdk/nodejs/datacenter.ts index 688d952a..a318112c 100644 --- a/sdk/nodejs/datacenter.ts +++ b/sdk/nodejs/datacenter.ts @@ -9,6 +9,22 @@ import * as utilities from "./utilities"; * container of inventory objects such as hosts and virtual machines. * * ## Example Usage + * ### Create datacenter on the root folder + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const prodDatacenter = new vsphere.Datacenter("prodDatacenter", {}); + * ``` + * ### Create datacenter on a subfolder + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const researchDatacenter = new vsphere.Datacenter("researchDatacenter", {folder: "/research/"}); + * ``` */ export class Datacenter extends pulumi.CustomResource { /** diff --git a/sdk/nodejs/distributedVirtualSwitch.ts b/sdk/nodejs/distributedVirtualSwitch.ts index ba596f07..16594119 100644 --- a/sdk/nodejs/distributedVirtualSwitch.ts +++ b/sdk/nodejs/distributedVirtualSwitch.ts @@ -457,6 +457,22 @@ export class DistributedVirtualSwitch extends pulumi.CustomResource { * and `maxVlan` sub-arguments to define the tagged VLAN range. Multiple * `vlanRange` definitions are allowed, but they must not overlap. Example * below: + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const vds = new vsphere.DistributedVirtualSwitch("vds", {vlanRanges: [ + * { + * maxVlan: 199, + * minVlan: 100, + * }, + * { + * maxVlan: 399, + * minVlan: 300, + * }, + * ]}); + * ``` */ public readonly vlanRanges!: pulumi.Output; /** @@ -1133,6 +1149,22 @@ export interface DistributedVirtualSwitchState { * and `maxVlan` sub-arguments to define the tagged VLAN range. Multiple * `vlanRange` definitions are allowed, but they must not overlap. Example * below: + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const vds = new vsphere.DistributedVirtualSwitch("vds", {vlanRanges: [ + * { + * maxVlan: 199, + * minVlan: 100, + * }, + * { + * maxVlan: 399, + * minVlan: 300, + * }, + * ]}); + * ``` */ vlanRanges?: pulumi.Input[]>; /** @@ -1591,6 +1623,22 @@ export interface DistributedVirtualSwitchArgs { * and `maxVlan` sub-arguments to define the tagged VLAN range. Multiple * `vlanRange` definitions are allowed, but they must not overlap. Example * below: + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const vds = new vsphere.DistributedVirtualSwitch("vds", {vlanRanges: [ + * { + * maxVlan: 199, + * minVlan: 100, + * }, + * { + * maxVlan: 399, + * minVlan: 300, + * }, + * ]}); + * ``` */ vlanRanges?: pulumi.Input[]>; /** diff --git a/sdk/nodejs/file.ts b/sdk/nodejs/file.ts index cbce3014..eb2ac734 100644 --- a/sdk/nodejs/file.ts +++ b/sdk/nodejs/file.ts @@ -6,6 +6,36 @@ import * as utilities from "./utilities"; /** * ## Example Usage + * ### Uploading a File + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const ubuntuVmdkUpload = new vsphere.File("ubuntuVmdkUpload", { + * createDirectories: true, + * datacenter: "dc-01", + * datastore: "datastore-01", + * destinationFile: "/my/dst/path/custom_ubuntu.vmdk", + * sourceFile: "/my/src/path/custom_ubuntu.vmdk", + * }); + * ``` + * ### Copying a File + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const ubuntuCopy = new vsphere.File("ubuntuCopy", { + * createDirectories: true, + * datacenter: "dc-01", + * datastore: "datastore-01", + * destinationFile: "/my/dst/path/custom_ubuntu.vmdk", + * sourceDatacenter: "dc-01", + * sourceDatastore: "datastore-01", + * sourceFile: "/my/src/path/custom_ubuntu.vmdk", + * }); + * ``` */ export class File extends pulumi.CustomResource { /** diff --git a/sdk/nodejs/getComputeCluster.ts b/sdk/nodejs/getComputeCluster.ts index 8e66481e..531521da 100644 --- a/sdk/nodejs/getComputeCluster.ts +++ b/sdk/nodejs/getComputeCluster.ts @@ -14,6 +14,21 @@ import * as utilities from "./utilities"; * > You may also wish to see the `vsphere.ComputeCluster` * resource for more information about clusters and how to managed the resource * in this provider. + * + * ## Example Usage + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const datacenter = vsphere.getDatacenter({ + * name: "dc-01", + * }); + * const computeCluster = datacenter.then(datacenter => vsphere.getComputeCluster({ + * name: "cluster-01", + * datacenterId: datacenter.id, + * })); + * ``` */ export function getComputeCluster(args: GetComputeClusterArgs, opts?: pulumi.InvokeOptions): Promise { @@ -67,6 +82,21 @@ export interface GetComputeClusterResult { * > You may also wish to see the `vsphere.ComputeCluster` * resource for more information about clusters and how to managed the resource * in this provider. + * + * ## Example Usage + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const datacenter = vsphere.getDatacenter({ + * name: "dc-01", + * }); + * const computeCluster = datacenter.then(datacenter => vsphere.getComputeCluster({ + * name: "cluster-01", + * datacenterId: datacenter.id, + * })); + * ``` */ export function getComputeClusterOutput(args: GetComputeClusterOutputArgs, opts?: pulumi.InvokeOptions): pulumi.Output { return pulumi.output(args).apply((a: any) => getComputeCluster(a, opts)) diff --git a/sdk/nodejs/getComputeClusterHostGroup.ts b/sdk/nodejs/getComputeClusterHostGroup.ts index 19eb058d..db797c21 100644 --- a/sdk/nodejs/getComputeClusterHostGroup.ts +++ b/sdk/nodejs/getComputeClusterHostGroup.ts @@ -8,6 +8,30 @@ import * as utilities from "./utilities"; * The `vsphere.ComputeClusterHostGroup` data source can be used to discover * the IDs ESXi hosts in a host group and return host group attributes to other * resources. + * + * ## Example Usage + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const datacenter = vsphere.getDatacenter({ + * name: _var.vsphere_datacenter, + * }); + * const cluster = datacenter.then(datacenter => vsphere.getComputeCluster({ + * name: _var.vsphere_cluster, + * datacenterId: datacenter.id, + * })); + * const hostGroup1 = cluster.then(cluster => vsphere.getComputeClusterHostGroup({ + * name: "host_group1", + * computeClusterId: cluster.id, + * })); + * const hostRule1 = new vsphere.ComputeClusterVmHostRule("hostRule1", { + * computeClusterId: cluster.then(cluster => cluster.id), + * vmGroupName: "vm_group1", + * affinityHostGroupName: hostGroup1.then(hostGroup1 => hostGroup1.name), + * }); + * ``` */ export function getComputeClusterHostGroup(args: GetComputeClusterHostGroupArgs, opts?: pulumi.InvokeOptions): Promise { @@ -55,6 +79,30 @@ export interface GetComputeClusterHostGroupResult { * The `vsphere.ComputeClusterHostGroup` data source can be used to discover * the IDs ESXi hosts in a host group and return host group attributes to other * resources. + * + * ## Example Usage + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const datacenter = vsphere.getDatacenter({ + * name: _var.vsphere_datacenter, + * }); + * const cluster = datacenter.then(datacenter => vsphere.getComputeCluster({ + * name: _var.vsphere_cluster, + * datacenterId: datacenter.id, + * })); + * const hostGroup1 = cluster.then(cluster => vsphere.getComputeClusterHostGroup({ + * name: "host_group1", + * computeClusterId: cluster.id, + * })); + * const hostRule1 = new vsphere.ComputeClusterVmHostRule("hostRule1", { + * computeClusterId: cluster.then(cluster => cluster.id), + * vmGroupName: "vm_group1", + * affinityHostGroupName: hostGroup1.then(hostGroup1 => hostGroup1.name), + * }); + * ``` */ export function getComputeClusterHostGroupOutput(args: GetComputeClusterHostGroupOutputArgs, opts?: pulumi.InvokeOptions): pulumi.Output { return pulumi.output(args).apply((a: any) => getComputeClusterHostGroup(a, opts)) diff --git a/sdk/nodejs/getContentLibrary.ts b/sdk/nodejs/getContentLibrary.ts index dfb0c947..53b4230b 100644 --- a/sdk/nodejs/getContentLibrary.ts +++ b/sdk/nodejs/getContentLibrary.ts @@ -8,6 +8,17 @@ import * as utilities from "./utilities"; * The `vsphere.ContentLibrary` data source can be used to discover the ID of a content library. * * > **NOTE:** This resource requires vCenter Server and is not available on direct ESXi host connections. + * + * ## Example Usage + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const library = vsphere.getContentLibrary({ + * name: "Content Library", + * }); + * ``` */ export function getContentLibrary(args: GetContentLibraryArgs, opts?: pulumi.InvokeOptions): Promise { @@ -41,6 +52,17 @@ export interface GetContentLibraryResult { * The `vsphere.ContentLibrary` data source can be used to discover the ID of a content library. * * > **NOTE:** This resource requires vCenter Server and is not available on direct ESXi host connections. + * + * ## Example Usage + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const library = vsphere.getContentLibrary({ + * name: "Content Library", + * }); + * ``` */ export function getContentLibraryOutput(args: GetContentLibraryOutputArgs, opts?: pulumi.InvokeOptions): pulumi.Output { return pulumi.output(args).apply((a: any) => getContentLibrary(a, opts)) diff --git a/sdk/nodejs/getCustomAttribute.ts b/sdk/nodejs/getCustomAttribute.ts index 6b405402..abea3b10 100644 --- a/sdk/nodejs/getCustomAttribute.ts +++ b/sdk/nodejs/getCustomAttribute.ts @@ -13,6 +13,17 @@ import * as utilities from "./utilities"; * * > **NOTE:** Custom attributes are unsupported on direct ESXi host connections * and require vCenter Server. + * + * ## Example Usage + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const attribute = vsphere.getCustomAttribute({ + * name: "test-attribute", + * }); + * ``` */ export function getCustomAttribute(args: GetCustomAttributeArgs, opts?: pulumi.InvokeOptions): Promise { @@ -52,6 +63,17 @@ export interface GetCustomAttributeResult { * * > **NOTE:** Custom attributes are unsupported on direct ESXi host connections * and require vCenter Server. + * + * ## Example Usage + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const attribute = vsphere.getCustomAttribute({ + * name: "test-attribute", + * }); + * ``` */ export function getCustomAttributeOutput(args: GetCustomAttributeOutputArgs, opts?: pulumi.InvokeOptions): pulumi.Output { return pulumi.output(args).apply((a: any) => getCustomAttribute(a, opts)) diff --git a/sdk/nodejs/getDatacenter.ts b/sdk/nodejs/getDatacenter.ts index 5ac35430..68523667 100644 --- a/sdk/nodejs/getDatacenter.ts +++ b/sdk/nodejs/getDatacenter.ts @@ -9,6 +9,17 @@ import * as utilities from "./utilities"; * vSphere datacenter object. This can then be used with resources or data sources * that require a datacenter, such as the `vsphere.Host` * data source. + * + * ## Example Usage + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const datacenter = vsphere.getDatacenter({ + * name: "dc-01", + * }); + * ``` */ export function getDatacenter(args?: GetDatacenterArgs, opts?: pulumi.InvokeOptions): Promise { args = args || {}; @@ -50,6 +61,17 @@ export interface GetDatacenterResult { * vSphere datacenter object. This can then be used with resources or data sources * that require a datacenter, such as the `vsphere.Host` * data source. + * + * ## Example Usage + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const datacenter = vsphere.getDatacenter({ + * name: "dc-01", + * }); + * ``` */ export function getDatacenterOutput(args?: GetDatacenterOutputArgs, opts?: pulumi.InvokeOptions): pulumi.Output { return pulumi.output(args).apply((a: any) => getDatacenter(a, opts)) diff --git a/sdk/nodejs/getDatastore.ts b/sdk/nodejs/getDatastore.ts index c68e3243..d6bcb724 100644 --- a/sdk/nodejs/getDatastore.ts +++ b/sdk/nodejs/getDatastore.ts @@ -9,6 +9,21 @@ import * as utilities from "./utilities"; * vSphere datastore object. This can then be used with resources or data sources * that require a datastore. For example, to create virtual machines in using the * `vsphere.VirtualMachine` resource. + * + * ## Example Usage + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const datacenter = vsphere.getDatacenter({ + * name: "dc-01", + * }); + * const datastore = datacenter.then(datacenter => vsphere.getDatastore({ + * name: "datastore-01", + * datacenterId: datacenter.id, + * })); + * ``` */ export function getDatastore(args: GetDatastoreArgs, opts?: pulumi.InvokeOptions): Promise { @@ -52,6 +67,21 @@ export interface GetDatastoreResult { * vSphere datastore object. This can then be used with resources or data sources * that require a datastore. For example, to create virtual machines in using the * `vsphere.VirtualMachine` resource. + * + * ## Example Usage + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const datacenter = vsphere.getDatacenter({ + * name: "dc-01", + * }); + * const datastore = datacenter.then(datacenter => vsphere.getDatastore({ + * name: "datastore-01", + * datacenterId: datacenter.id, + * })); + * ``` */ export function getDatastoreOutput(args: GetDatastoreOutputArgs, opts?: pulumi.InvokeOptions): pulumi.Output { return pulumi.output(args).apply((a: any) => getDatastore(a, opts)) diff --git a/sdk/nodejs/getDatastoreCluster.ts b/sdk/nodejs/getDatastoreCluster.ts index 759b2c4e..e09b484d 100644 --- a/sdk/nodejs/getDatastoreCluster.ts +++ b/sdk/nodejs/getDatastoreCluster.ts @@ -9,6 +9,21 @@ import * as utilities from "./utilities"; * vSphere datastore cluster object. This can then be used with resources or data sources * that require a datastore. For example, to assign datastores using the * `vsphere.NasDatastore` or `vsphere.VmfsDatastore` resources, or to create virtual machines in using the `vsphere.VirtualMachine` resource. + * + * ## Example Usage + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const datacenter = vsphere.getDatacenter({ + * name: "dc-01", + * }); + * const datastoreCluster = datacenter.then(datacenter => vsphere.getDatastoreCluster({ + * name: "datastore-cluster-01", + * datacenterId: datacenter.id, + * })); + * ``` */ export function getDatastoreCluster(args: GetDatastoreClusterArgs, opts?: pulumi.InvokeOptions): Promise { @@ -53,6 +68,21 @@ export interface GetDatastoreClusterResult { * vSphere datastore cluster object. This can then be used with resources or data sources * that require a datastore. For example, to assign datastores using the * `vsphere.NasDatastore` or `vsphere.VmfsDatastore` resources, or to create virtual machines in using the `vsphere.VirtualMachine` resource. + * + * ## Example Usage + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const datacenter = vsphere.getDatacenter({ + * name: "dc-01", + * }); + * const datastoreCluster = datacenter.then(datacenter => vsphere.getDatastoreCluster({ + * name: "datastore-cluster-01", + * datacenterId: datacenter.id, + * })); + * ``` */ export function getDatastoreClusterOutput(args: GetDatastoreClusterOutputArgs, opts?: pulumi.InvokeOptions): pulumi.Output { return pulumi.output(args).apply((a: any) => getDatastoreCluster(a, opts)) diff --git a/sdk/nodejs/getDistributedVirtualSwitch.ts b/sdk/nodejs/getDistributedVirtualSwitch.ts index e24e41cd..48b8b694 100644 --- a/sdk/nodejs/getDistributedVirtualSwitch.ts +++ b/sdk/nodejs/getDistributedVirtualSwitch.ts @@ -13,6 +13,31 @@ import * as utilities from "./utilities"; * * > **NOTE:** This data source requires vCenter Server and is not available on * direct ESXi host connections. + * + * ## Example Usage + * + * The following example locates a distributed switch named `vds-01`, in the + * datacenter `dc-01`. It then uses this distributed switch to set up a + * `vsphere.DistributedPortGroup` resource that uses the first uplink as a + * primary uplink and the second uplink as a secondary. + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const datacenter = vsphere.getDatacenter({ + * name: "dc-01", + * }); + * const vds = datacenter.then(datacenter => vsphere.getDistributedVirtualSwitch({ + * name: "vds-01", + * datacenterId: datacenter.id, + * })); + * const dvpg = new vsphere.DistributedPortGroup("dvpg", { + * distributedVirtualSwitchUuid: vds.then(vds => vds.id), + * activeUplinks: [vds.then(vds => vds.uplinks?.[0])], + * standbyUplinks: [vds.then(vds => vds.uplinks?.[1])], + * }); + * ``` */ export function getDistributedVirtualSwitch(args: GetDistributedVirtualSwitchArgs, opts?: pulumi.InvokeOptions): Promise { @@ -67,6 +92,31 @@ export interface GetDistributedVirtualSwitchResult { * * > **NOTE:** This data source requires vCenter Server and is not available on * direct ESXi host connections. + * + * ## Example Usage + * + * The following example locates a distributed switch named `vds-01`, in the + * datacenter `dc-01`. It then uses this distributed switch to set up a + * `vsphere.DistributedPortGroup` resource that uses the first uplink as a + * primary uplink and the second uplink as a secondary. + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const datacenter = vsphere.getDatacenter({ + * name: "dc-01", + * }); + * const vds = datacenter.then(datacenter => vsphere.getDistributedVirtualSwitch({ + * name: "vds-01", + * datacenterId: datacenter.id, + * })); + * const dvpg = new vsphere.DistributedPortGroup("dvpg", { + * distributedVirtualSwitchUuid: vds.then(vds => vds.id), + * activeUplinks: [vds.then(vds => vds.uplinks?.[0])], + * standbyUplinks: [vds.then(vds => vds.uplinks?.[1])], + * }); + * ``` */ export function getDistributedVirtualSwitchOutput(args: GetDistributedVirtualSwitchOutputArgs, opts?: pulumi.InvokeOptions): pulumi.Output { return pulumi.output(args).apply((a: any) => getDistributedVirtualSwitch(a, opts)) diff --git a/sdk/nodejs/getDynamic.ts b/sdk/nodejs/getDynamic.ts index 9d8aac49..4fadb1ca 100644 --- a/sdk/nodejs/getDynamic.ts +++ b/sdk/nodejs/getDynamic.ts @@ -10,6 +10,33 @@ import * as utilities from "./utilities"; * The `vsphere.getDynamic` data source can be used to get the [managed object reference ID][docs-about-morefs] * of any tagged managed object in vCenter Server by providing a list of tag IDs * and an optional regular expression to filter objects by name. + * + * ## Example Usage + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const category = vsphere.getTagCategory({ + * name: "SomeCategory", + * }); + * const tag1 = vsphere.getTag({ + * name: "FirstTag", + * categoryId: data.vsphere_tag_category.cat.id, + * }); + * const tag2 = vsphere.getTag({ + * name: "SecondTag", + * categoryId: data.vsphere_tag_category.cat.id, + * }); + * const dyn = Promise.all([tag1, tag1]).then(([tag1, tag11]) => vsphere.getDynamic({ + * filters: [ + * tag1.id, + * tag11.id, + * ], + * nameRegex: "ubuntu", + * type: "Datacenter", + * })); + * ``` */ export function getDynamic(args: GetDynamicArgs, opts?: pulumi.InvokeOptions): Promise { @@ -61,6 +88,33 @@ export interface GetDynamicResult { * The `vsphere.getDynamic` data source can be used to get the [managed object reference ID][docs-about-morefs] * of any tagged managed object in vCenter Server by providing a list of tag IDs * and an optional regular expression to filter objects by name. + * + * ## Example Usage + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const category = vsphere.getTagCategory({ + * name: "SomeCategory", + * }); + * const tag1 = vsphere.getTag({ + * name: "FirstTag", + * categoryId: data.vsphere_tag_category.cat.id, + * }); + * const tag2 = vsphere.getTag({ + * name: "SecondTag", + * categoryId: data.vsphere_tag_category.cat.id, + * }); + * const dyn = Promise.all([tag1, tag1]).then(([tag1, tag11]) => vsphere.getDynamic({ + * filters: [ + * tag1.id, + * tag11.id, + * ], + * nameRegex: "ubuntu", + * type: "Datacenter", + * })); + * ``` */ export function getDynamicOutput(args: GetDynamicOutputArgs, opts?: pulumi.InvokeOptions): pulumi.Output { return pulumi.output(args).apply((a: any) => getDynamic(a, opts)) diff --git a/sdk/nodejs/getFolder.ts b/sdk/nodejs/getFolder.ts index 1a81d29e..b0a444c3 100644 --- a/sdk/nodejs/getFolder.ts +++ b/sdk/nodejs/getFolder.ts @@ -7,6 +7,17 @@ import * as utilities from "./utilities"; /** * The `vsphere.Folder` data source can be used to get the general attributes of a * vSphere inventory folder. Paths are absolute and must include the datacenter. + * + * ## Example Usage + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const folder = vsphere.getFolder({ + * path: "/dc-01/datastore-01/folder-01", + * }); + * ``` */ export function getFolder(args: GetFolderArgs, opts?: pulumi.InvokeOptions): Promise { @@ -43,6 +54,17 @@ export interface GetFolderResult { /** * The `vsphere.Folder` data source can be used to get the general attributes of a * vSphere inventory folder. Paths are absolute and must include the datacenter. + * + * ## Example Usage + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const folder = vsphere.getFolder({ + * path: "/dc-01/datastore-01/folder-01", + * }); + * ``` */ export function getFolderOutput(args: GetFolderOutputArgs, opts?: pulumi.InvokeOptions): pulumi.Output { return pulumi.output(args).apply((a: any) => getFolder(a, opts)) diff --git a/sdk/nodejs/getHost.ts b/sdk/nodejs/getHost.ts index 48da1040..297677d4 100644 --- a/sdk/nodejs/getHost.ts +++ b/sdk/nodejs/getHost.ts @@ -8,6 +8,21 @@ import * as utilities from "./utilities"; * The `vsphere.Host` data source can be used to discover the ID of an ESXi host. * This can then be used with resources or data sources that require an ESX * host's managed object reference ID. + * + * ## Example Usage + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const datacenter = vsphere.getDatacenter({ + * name: "dc-01", + * }); + * const host = datacenter.then(datacenter => vsphere.getHost({ + * name: "esxi-01.example.com", + * datacenterId: datacenter.id, + * })); + * ``` */ export function getHost(args: GetHostArgs, opts?: pulumi.InvokeOptions): Promise { @@ -57,6 +72,21 @@ export interface GetHostResult { * The `vsphere.Host` data source can be used to discover the ID of an ESXi host. * This can then be used with resources or data sources that require an ESX * host's managed object reference ID. + * + * ## Example Usage + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const datacenter = vsphere.getDatacenter({ + * name: "dc-01", + * }); + * const host = datacenter.then(datacenter => vsphere.getHost({ + * name: "esxi-01.example.com", + * datacenterId: datacenter.id, + * })); + * ``` */ export function getHostOutput(args: GetHostOutputArgs, opts?: pulumi.InvokeOptions): pulumi.Output { return pulumi.output(args).apply((a: any) => getHost(a, opts)) diff --git a/sdk/nodejs/getHostPciDevice.ts b/sdk/nodejs/getHostPciDevice.ts index 3c7a49b4..e4ca1a23 100644 --- a/sdk/nodejs/getHostPciDevice.ts +++ b/sdk/nodejs/getHostPciDevice.ts @@ -10,7 +10,25 @@ import * as utilities from "./utilities"; * `vsphere.VirtualMachine`'s `pciDeviceId`. * * ## Example Usage + * ### With Vendor ID And Class ID * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const datacenter = vsphere.getDatacenter({ + * name: "dc-01", + * }); + * const host = datacenter.then(datacenter => vsphere.getHost({ + * name: "esxi-01.example.com", + * datacenterId: datacenter.id, + * })); + * const dev = host.then(host => vsphere.getHostPciDevice({ + * hostId: host.id, + * classId: "123", + * vendorId: "456", + * })); + * ``` * ### With Name Regular Expression */ export function getHostPciDevice(args: GetHostPciDeviceArgs, opts?: pulumi.InvokeOptions): Promise { @@ -74,7 +92,25 @@ export interface GetHostPciDeviceResult { * `vsphere.VirtualMachine`'s `pciDeviceId`. * * ## Example Usage + * ### With Vendor ID And Class ID + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; * + * const datacenter = vsphere.getDatacenter({ + * name: "dc-01", + * }); + * const host = datacenter.then(datacenter => vsphere.getHost({ + * name: "esxi-01.example.com", + * datacenterId: datacenter.id, + * })); + * const dev = host.then(host => vsphere.getHostPciDevice({ + * hostId: host.id, + * classId: "123", + * vendorId: "456", + * })); + * ``` * ### With Name Regular Expression */ export function getHostPciDeviceOutput(args: GetHostPciDeviceOutputArgs, opts?: pulumi.InvokeOptions): pulumi.Output { diff --git a/sdk/nodejs/getHostThumbprint.ts b/sdk/nodejs/getHostThumbprint.ts index 0e9a2b7b..588813c6 100644 --- a/sdk/nodejs/getHostThumbprint.ts +++ b/sdk/nodejs/getHostThumbprint.ts @@ -9,6 +9,17 @@ import * as utilities from "./utilities"; * thumbprint of an ESXi host. This can be used when adding the `vsphere.Host` * resource. If the ESXi host is using a certificate chain, the first one returned * will be used to generate the thumbprint. + * + * ## Example Usage + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const thumbprint = vsphere.getHostThumbprint({ + * address: "esxi-01.example.com", + * }); + * ``` */ export function getHostThumbprint(args: GetHostThumbprintArgs, opts?: pulumi.InvokeOptions): Promise { @@ -57,6 +68,17 @@ export interface GetHostThumbprintResult { * thumbprint of an ESXi host. This can be used when adding the `vsphere.Host` * resource. If the ESXi host is using a certificate chain, the first one returned * will be used to generate the thumbprint. + * + * ## Example Usage + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const thumbprint = vsphere.getHostThumbprint({ + * address: "esxi-01.example.com", + * }); + * ``` */ export function getHostThumbprintOutput(args: GetHostThumbprintOutputArgs, opts?: pulumi.InvokeOptions): pulumi.Output { return pulumi.output(args).apply((a: any) => getHostThumbprint(a, opts)) diff --git a/sdk/nodejs/getLicense.ts b/sdk/nodejs/getLicense.ts index d8bbe950..fa862109 100644 --- a/sdk/nodejs/getLicense.ts +++ b/sdk/nodejs/getLicense.ts @@ -7,6 +7,17 @@ import * as utilities from "./utilities"; /** * The `vsphere.License` data source can be used to get the general attributes of * a license keys from a vCenter Server instance. + * + * ## Example Usage + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const license = vsphere.getLicense({ + * licenseKey: "00000-00000-00000-00000-00000", + * }); + * ``` */ export function getLicense(args: GetLicenseArgs, opts?: pulumi.InvokeOptions): Promise { @@ -56,6 +67,17 @@ export interface GetLicenseResult { /** * The `vsphere.License` data source can be used to get the general attributes of * a license keys from a vCenter Server instance. + * + * ## Example Usage + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const license = vsphere.getLicense({ + * licenseKey: "00000-00000-00000-00000-00000", + * }); + * ``` */ export function getLicenseOutput(args: GetLicenseOutputArgs, opts?: pulumi.InvokeOptions): pulumi.Output { return pulumi.output(args).apply((a: any) => getLicense(a, opts)) diff --git a/sdk/nodejs/getNetwork.ts b/sdk/nodejs/getNetwork.ts index cf1a2bc5..72c3e48e 100644 --- a/sdk/nodejs/getNetwork.ts +++ b/sdk/nodejs/getNetwork.ts @@ -10,6 +10,21 @@ import * as utilities from "./utilities"; * network interface for `vsphere.VirtualMachine` or any other vSphere resource * that requires a network. This includes standard (host-based) port groups, * distributed port groups, or opaque networks such as those managed by NSX. + * + * ## Example Usage + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const datacenter = vsphere.getDatacenter({ + * name: "dc-01", + * }); + * const network = datacenter.then(datacenter => vsphere.getNetwork({ + * name: "VM Network", + * datacenterId: datacenter.id, + * })); + * ``` */ export function getNetwork(args: GetNetworkArgs, opts?: pulumi.InvokeOptions): Promise { @@ -70,6 +85,21 @@ export interface GetNetworkResult { * network interface for `vsphere.VirtualMachine` or any other vSphere resource * that requires a network. This includes standard (host-based) port groups, * distributed port groups, or opaque networks such as those managed by NSX. + * + * ## Example Usage + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const datacenter = vsphere.getDatacenter({ + * name: "dc-01", + * }); + * const network = datacenter.then(datacenter => vsphere.getNetwork({ + * name: "VM Network", + * datacenterId: datacenter.id, + * })); + * ``` */ export function getNetworkOutput(args: GetNetworkOutputArgs, opts?: pulumi.InvokeOptions): pulumi.Output { return pulumi.output(args).apply((a: any) => getNetwork(a, opts)) diff --git a/sdk/nodejs/getPolicy.ts b/sdk/nodejs/getPolicy.ts index a14dd4da..80c3330b 100644 --- a/sdk/nodejs/getPolicy.ts +++ b/sdk/nodejs/getPolicy.ts @@ -11,6 +11,20 @@ import * as utilities from "./utilities"; * * > **NOTE:** Storage policies are not supported on direct ESXi hosts and * requires vCenter Server. + * + * ## Example Usage + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const prodPlatinumReplicated = vsphere.getPolicy({ + * name: "prod_platinum_replicated", + * }); + * const devSilverNonreplicated = vsphere.getPolicy({ + * name: "dev_silver_nonreplicated", + * }); + * ``` */ export function getPolicy(args: GetPolicyArgs, opts?: pulumi.InvokeOptions): Promise { @@ -47,6 +61,20 @@ export interface GetPolicyResult { * * > **NOTE:** Storage policies are not supported on direct ESXi hosts and * requires vCenter Server. + * + * ## Example Usage + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const prodPlatinumReplicated = vsphere.getPolicy({ + * name: "prod_platinum_replicated", + * }); + * const devSilverNonreplicated = vsphere.getPolicy({ + * name: "dev_silver_nonreplicated", + * }); + * ``` */ export function getPolicyOutput(args: GetPolicyOutputArgs, opts?: pulumi.InvokeOptions): pulumi.Output { return pulumi.output(args).apply((a: any) => getPolicy(a, opts)) diff --git a/sdk/nodejs/getResourcePool.ts b/sdk/nodejs/getResourcePool.ts index 4dac4fcb..8ae929d5 100644 --- a/sdk/nodejs/getResourcePool.ts +++ b/sdk/nodejs/getResourcePool.ts @@ -9,6 +9,44 @@ import * as utilities from "./utilities"; * resource pool in vSphere. This is useful to return the ID of a resource pool * that you want to use to create virtual machines in using the * `vsphere.VirtualMachine` resource. + * + * ## Example Usage + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const datacenter = vsphere.getDatacenter({ + * name: "dc-01", + * }); + * const pool = datacenter.then(datacenter => vsphere.getResourcePool({ + * name: "resource-pool-01", + * datacenterId: datacenter.id, + * })); + * ``` + * ### Specifying the Root Resource Pool for a Standalone ESXi Host + * + * > **NOTE:** Returning the root resource pool for a cluster can be done + * directly via the `vsphere.ComputeCluster` + * data source. + * + * All compute resources in vSphere have a resource pool, even if one has not been + * explicitly created. This resource pool is referred to as the + * _root resource pool_ and can be looked up by specifying the path. + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const pool = vsphere.getResourcePool({ + * name: "esxi-01.example.com/Resources", + * datacenterId: data.vsphere_datacenter.datacenter.id, + * }); + * ``` + * + * For more information on the root resource pool, see [Managing Resource Pools][vmware-docs-resource-pools] in the vSphere documentation. + * + * [vmware-docs-resource-pools]: https://docs.vmware.com/en/VMware-vSphere/7.0/com.vmware.vsphere.resmgmt.doc/GUID-60077B40-66FF-4625-934A-641703ED7601.html */ export function getResourcePool(args?: GetResourcePoolArgs, opts?: pulumi.InvokeOptions): Promise { args = args || {}; @@ -59,6 +97,44 @@ export interface GetResourcePoolResult { * resource pool in vSphere. This is useful to return the ID of a resource pool * that you want to use to create virtual machines in using the * `vsphere.VirtualMachine` resource. + * + * ## Example Usage + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const datacenter = vsphere.getDatacenter({ + * name: "dc-01", + * }); + * const pool = datacenter.then(datacenter => vsphere.getResourcePool({ + * name: "resource-pool-01", + * datacenterId: datacenter.id, + * })); + * ``` + * ### Specifying the Root Resource Pool for a Standalone ESXi Host + * + * > **NOTE:** Returning the root resource pool for a cluster can be done + * directly via the `vsphere.ComputeCluster` + * data source. + * + * All compute resources in vSphere have a resource pool, even if one has not been + * explicitly created. This resource pool is referred to as the + * _root resource pool_ and can be looked up by specifying the path. + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const pool = vsphere.getResourcePool({ + * name: "esxi-01.example.com/Resources", + * datacenterId: data.vsphere_datacenter.datacenter.id, + * }); + * ``` + * + * For more information on the root resource pool, see [Managing Resource Pools][vmware-docs-resource-pools] in the vSphere documentation. + * + * [vmware-docs-resource-pools]: https://docs.vmware.com/en/VMware-vSphere/7.0/com.vmware.vsphere.resmgmt.doc/GUID-60077B40-66FF-4625-934A-641703ED7601.html */ export function getResourcePoolOutput(args?: GetResourcePoolOutputArgs, opts?: pulumi.InvokeOptions): pulumi.Output { return pulumi.output(args).apply((a: any) => getResourcePool(a, opts)) diff --git a/sdk/nodejs/getRole.ts b/sdk/nodejs/getRole.ts index 50159bda..b300463f 100644 --- a/sdk/nodejs/getRole.ts +++ b/sdk/nodejs/getRole.ts @@ -7,6 +7,17 @@ import * as utilities from "./utilities"; /** * The `vsphere.Role` data source can be used to discover the `id` and privileges associated * with a role given its name or display label. + * + * ## Example Usage + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const terraformRole = vsphere.getRole({ + * label: "Terraform to vSphere Integration Role", + * }); + * ``` */ export function getRole(args: GetRoleArgs, opts?: pulumi.InvokeOptions): Promise { @@ -63,6 +74,17 @@ export interface GetRoleResult { /** * The `vsphere.Role` data source can be used to discover the `id` and privileges associated * with a role given its name or display label. + * + * ## Example Usage + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const terraformRole = vsphere.getRole({ + * label: "Terraform to vSphere Integration Role", + * }); + * ``` */ export function getRoleOutput(args: GetRoleOutputArgs, opts?: pulumi.InvokeOptions): pulumi.Output { return pulumi.output(args).apply((a: any) => getRole(a, opts)) diff --git a/sdk/nodejs/getTag.ts b/sdk/nodejs/getTag.ts index d48a69d1..0a054df7 100644 --- a/sdk/nodejs/getTag.ts +++ b/sdk/nodejs/getTag.ts @@ -13,6 +13,21 @@ import * as utilities from "./utilities"; * * > **NOTE:** Tagging is not supported on direct ESXi hosts connections and * requires vCenter Server. + * + * ## Example Usage + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const category = vsphere.getTagCategory({ + * name: "example-category", + * }); + * const tag = category.then(category => vsphere.getTag({ + * name: "example-tag", + * categoryId: category.id, + * })); + * ``` */ export function getTag(args: GetTagArgs, opts?: pulumi.InvokeOptions): Promise { @@ -59,6 +74,21 @@ export interface GetTagResult { * * > **NOTE:** Tagging is not supported on direct ESXi hosts connections and * requires vCenter Server. + * + * ## Example Usage + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const category = vsphere.getTagCategory({ + * name: "example-category", + * }); + * const tag = category.then(category => vsphere.getTag({ + * name: "example-tag", + * categoryId: category.id, + * })); + * ``` */ export function getTagOutput(args: GetTagOutputArgs, opts?: pulumi.InvokeOptions): pulumi.Output { return pulumi.output(args).apply((a: any) => getTag(a, opts)) diff --git a/sdk/nodejs/getTagCategory.ts b/sdk/nodejs/getTagCategory.ts index df92167b..47fbc3a8 100644 --- a/sdk/nodejs/getTagCategory.ts +++ b/sdk/nodejs/getTagCategory.ts @@ -13,6 +13,17 @@ import * as utilities from "./utilities"; * * > **NOTE:** Tagging is not supported on direct ESXi hosts connections and * requires vCenter Server. + * + * ## Example Usage + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const category = vsphere.getTagCategory({ + * name: "example-category", + * }); + * ``` */ export function getTagCategory(args: GetTagCategoryArgs, opts?: pulumi.InvokeOptions): Promise { @@ -54,6 +65,17 @@ export interface GetTagCategoryResult { * * > **NOTE:** Tagging is not supported on direct ESXi hosts connections and * requires vCenter Server. + * + * ## Example Usage + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const category = vsphere.getTagCategory({ + * name: "example-category", + * }); + * ``` */ export function getTagCategoryOutput(args: GetTagCategoryOutputArgs, opts?: pulumi.InvokeOptions): pulumi.Output { return pulumi.output(args).apply((a: any) => getTagCategory(a, opts)) diff --git a/sdk/nodejs/getVappContainer.ts b/sdk/nodejs/getVappContainer.ts index 7331f190..6a3f6309 100644 --- a/sdk/nodejs/getVappContainer.ts +++ b/sdk/nodejs/getVappContainer.ts @@ -9,6 +9,21 @@ import * as utilities from "./utilities"; * vApp container in vSphere. This is useful to return the ID of a vApp container * that you want to use to create virtual machines in using the * `vsphere.VirtualMachine` resource. + * + * ## Example Usage + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const datacenter = vsphere.getDatacenter({ + * name: "dc-01", + * }); + * const pool = datacenter.then(datacenter => vsphere.getVappContainer({ + * name: "vapp-container-01", + * datacenterId: datacenter.id, + * })); + * ``` */ export function getVappContainer(args: GetVappContainerArgs, opts?: pulumi.InvokeOptions): Promise { @@ -51,6 +66,21 @@ export interface GetVappContainerResult { * vApp container in vSphere. This is useful to return the ID of a vApp container * that you want to use to create virtual machines in using the * `vsphere.VirtualMachine` resource. + * + * ## Example Usage + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const datacenter = vsphere.getDatacenter({ + * name: "dc-01", + * }); + * const pool = datacenter.then(datacenter => vsphere.getVappContainer({ + * name: "vapp-container-01", + * datacenterId: datacenter.id, + * })); + * ``` */ export function getVappContainerOutput(args: GetVappContainerOutputArgs, opts?: pulumi.InvokeOptions): pulumi.Output { return pulumi.output(args).apply((a: any) => getVappContainer(a, opts)) diff --git a/sdk/nodejs/getVirtualMachine.ts b/sdk/nodejs/getVirtualMachine.ts index b9cbc22a..bc38eae6 100644 --- a/sdk/nodejs/getVirtualMachine.ts +++ b/sdk/nodejs/getVirtualMachine.ts @@ -12,6 +12,43 @@ import * as utilities from "./utilities"; * the UUID of a template to be used as the source for cloning to a new * `vsphere.VirtualMachine` resource. It also * reads the guest ID so that can be supplied as well. + * + * ## Example Usage + * + * In the following example, a virtual machine template is returned by its + * unique name within the `vsphere.Datacenter`. + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const datacenter = vsphere.getDatacenter({ + * name: "dc-01", + * }); + * const template = datacenter.then(datacenter => vsphere.getVirtualMachine({ + * name: "ubuntu-server-template", + * datacenterId: datacenter.id, + * })); + * ``` + * In the following example, each virtual machine template is returned by its + * unique full path within the `vsphere.Datacenter`. + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const datacenter = vsphere.getDatacenter({ + * name: "dc-01", + * }); + * const productionTemplate = datacenter.then(datacenter => vsphere.getVirtualMachine({ + * name: "production/templates/ubuntu-server-template", + * datacenterId: datacenter.id, + * })); + * const developmentTemplate = datacenter.then(datacenter => vsphere.getVirtualMachine({ + * name: "development/templates/ubuntu-server-template", + * datacenterId: datacenter.id, + * })); + * ``` */ export function getVirtualMachine(args?: GetVirtualMachineArgs, opts?: pulumi.InvokeOptions): Promise { args = args || {}; @@ -334,6 +371,43 @@ export interface GetVirtualMachineResult { * the UUID of a template to be used as the source for cloning to a new * `vsphere.VirtualMachine` resource. It also * reads the guest ID so that can be supplied as well. + * + * ## Example Usage + * + * In the following example, a virtual machine template is returned by its + * unique name within the `vsphere.Datacenter`. + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const datacenter = vsphere.getDatacenter({ + * name: "dc-01", + * }); + * const template = datacenter.then(datacenter => vsphere.getVirtualMachine({ + * name: "ubuntu-server-template", + * datacenterId: datacenter.id, + * })); + * ``` + * In the following example, each virtual machine template is returned by its + * unique full path within the `vsphere.Datacenter`. + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const datacenter = vsphere.getDatacenter({ + * name: "dc-01", + * }); + * const productionTemplate = datacenter.then(datacenter => vsphere.getVirtualMachine({ + * name: "production/templates/ubuntu-server-template", + * datacenterId: datacenter.id, + * })); + * const developmentTemplate = datacenter.then(datacenter => vsphere.getVirtualMachine({ + * name: "development/templates/ubuntu-server-template", + * datacenterId: datacenter.id, + * })); + * ``` */ export function getVirtualMachineOutput(args?: GetVirtualMachineOutputArgs, opts?: pulumi.InvokeOptions): pulumi.Output { return pulumi.output(args).apply((a: any) => getVirtualMachine(a, opts)) diff --git a/sdk/nodejs/getVmfsDisks.ts b/sdk/nodejs/getVmfsDisks.ts index cada3f9b..9a3e53c5 100644 --- a/sdk/nodejs/getVmfsDisks.ts +++ b/sdk/nodejs/getVmfsDisks.ts @@ -9,6 +9,26 @@ import * as utilities from "./utilities"; * devices available on an ESXi host. This data source can be combined with the * `vsphere.VmfsDatastore` resource to create VMFS * datastores based off a set of discovered disks. + * + * ## Example Usage + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const datacenter = vsphere.getDatacenter({ + * name: "dc-01", + * }); + * const host = datacenter.then(datacenter => vsphere.getHost({ + * name: "esxi-01.example.com", + * datacenterId: datacenter.id, + * })); + * const vmfsDisks = host.then(host => vsphere.getVmfsDisks({ + * hostSystemId: host.id, + * rescan: true, + * filter: "mpx.vmhba1:C0:T[12]:L0", + * })); + * ``` */ export function getVmfsDisks(args: GetVmfsDisksArgs, opts?: pulumi.InvokeOptions): Promise { @@ -68,6 +88,26 @@ export interface GetVmfsDisksResult { * devices available on an ESXi host. This data source can be combined with the * `vsphere.VmfsDatastore` resource to create VMFS * datastores based off a set of discovered disks. + * + * ## Example Usage + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const datacenter = vsphere.getDatacenter({ + * name: "dc-01", + * }); + * const host = datacenter.then(datacenter => vsphere.getHost({ + * name: "esxi-01.example.com", + * datacenterId: datacenter.id, + * })); + * const vmfsDisks = host.then(host => vsphere.getVmfsDisks({ + * hostSystemId: host.id, + * rescan: true, + * filter: "mpx.vmhba1:C0:T[12]:L0", + * })); + * ``` */ export function getVmfsDisksOutput(args: GetVmfsDisksOutputArgs, opts?: pulumi.InvokeOptions): pulumi.Output { return pulumi.output(args).apply((a: any) => getVmfsDisks(a, opts)) diff --git a/sdk/nodejs/host.ts b/sdk/nodejs/host.ts index 35a76c3c..b201af82 100644 --- a/sdk/nodejs/host.ts +++ b/sdk/nodejs/host.ts @@ -9,6 +9,66 @@ import * as utilities from "./utilities"; * can be used either as a member of a cluster or as a standalone host. * * ## Example Usage + * ### Create a standalone host + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const datacenter = vsphere.getDatacenter({ + * name: "dc-01", + * }); + * const thumbprint = vsphere.getHostThumbprint({ + * address: "esx-01.example.com", + * insecure: true, + * }); + * const esx_01 = new vsphere.Host("esx-01", { + * hostname: "esx-01.example.com", + * username: "root", + * password: "password", + * license: "00000-00000-00000-00000-00000", + * thumbprint: thumbprint.then(thumbprint => thumbprint.id), + * datacenter: datacenter.then(datacenter => datacenter.id), + * }); + * ``` + * ### Create host in a compute cluster + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const datacenter = vsphere.getDatacenter({ + * name: "dc-01", + * }); + * const cluster = datacenter.then(datacenter => vsphere.getComputeCluster({ + * name: "cluster-01", + * datacenterId: datacenter.id, + * })); + * const thumbprint = vsphere.getHostThumbprint({ + * address: "esx-01.example.com", + * insecure: true, + * }); + * const esx_01 = new vsphere.Host("esx-01", { + * hostname: "esx-01.example.com", + * username: "root", + * password: "password", + * license: "00000-00000-00000-00000-00000", + * thumbprint: thumbprint.then(thumbprint => thumbprint.id), + * cluster: cluster.then(cluster => cluster.id), + * }); + * ``` + * ## Importing + * + * An existing host can be [imported][docs-import] into this resource by supplying + * the host's ID. An example is below: + * + * [docs-import]: /docs/import/index.html + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * ``` + * + * The above would import the host with ID `host-123`. */ export class Host extends pulumi.CustomResource { /** diff --git a/sdk/nodejs/hostPortGroup.ts b/sdk/nodejs/hostPortGroup.ts index fcaffbd3..dd8ff58d 100644 --- a/sdk/nodejs/hostPortGroup.ts +++ b/sdk/nodejs/hostPortGroup.ts @@ -15,6 +15,82 @@ import * as utilities from "./utilities"; * For an overview on vSphere networking concepts, see [the product documentation][ref-vsphere-net-concepts]. * * [ref-vsphere-net-concepts]: https://docs.vmware.com/en/VMware-vSphere/7.0/com.vmware.vsphere.networking.doc/GUID-2B11DBB8-CB3C-4AFF-8885-EFEA0FC562F4.html + * + * ## Example Usage + * + * **Create a Virtual Switch and Bind a Port Group:** + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const datacenter = vsphere.getDatacenter({ + * name: "dc-01", + * }); + * const host = datacenter.then(datacenter => vsphere.getHost({ + * name: "esxi-01.example.com", + * datacenterId: datacenter.id, + * })); + * const hostVirtualSwitch = new vsphere.HostVirtualSwitch("hostVirtualSwitch", { + * hostSystemId: host.then(host => host.id), + * networkAdapters: [ + * "vmnic0", + * "vmnic1", + * ], + * activeNics: ["vmnic0"], + * standbyNics: ["vmnic1"], + * }); + * const pg = new vsphere.HostPortGroup("pg", { + * hostSystemId: host.then(host => host.id), + * virtualSwitchName: hostVirtualSwitch.name, + * }); + * ``` + * + * **Create a Port Group with a VLAN and ab Override:** + * + * This example sets the trunk mode VLAN (`4095`, which passes through all tags) + * and sets + * `allowPromiscuous` + * to ensure that all traffic is seen on the port. The setting overrides + * the implicit default of `false` set on the standard switch. + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const datacenter = vsphere.getDatacenter({ + * name: "dc-01", + * }); + * const host = datacenter.then(datacenter => vsphere.getHost({ + * name: "esxi-01.example.com", + * datacenterId: datacenter.id, + * })); + * const hostVirtualSwitch = new vsphere.HostVirtualSwitch("hostVirtualSwitch", { + * hostSystemId: host.then(host => host.id), + * networkAdapters: [ + * "vmnic0", + * "vmnic1", + * ], + * activeNics: ["vmnic0"], + * standbyNics: ["vmnic1"], + * }); + * const pg = new vsphere.HostPortGroup("pg", { + * hostSystemId: host.then(host => host.id), + * virtualSwitchName: hostVirtualSwitch.name, + * vlanId: 4095, + * allowPromiscuous: true, + * }); + * ``` + * ## Importing + * + * An existing host port group can be imported into this resource + * using the host port group's ID. An example is below: + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * ``` + * + * The above would import the `management` host port group from host with ID `host-123`. */ export class HostPortGroup extends pulumi.CustomResource { /** diff --git a/sdk/nodejs/license.ts b/sdk/nodejs/license.ts index a3e5cff5..4d923a95 100644 --- a/sdk/nodejs/license.ts +++ b/sdk/nodejs/license.ts @@ -6,6 +6,21 @@ import * as utilities from "./utilities"; /** * Provides a VMware vSphere license resource. This can be used to add and remove license keys. + * + * ## Example Usage + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const licenseKey = new vsphere.License("licenseKey", { + * labels: { + * VpxClientLicenseLabel: "Hello World", + * Workflow: "Hello World", + * }, + * licenseKey: "452CQ-2EK54-K8742-00000-00000", + * }); + * ``` */ export class License extends pulumi.CustomResource { /** diff --git a/sdk/nodejs/resourcePool.ts b/sdk/nodejs/resourcePool.ts index a671e0f6..61e9edf4 100644 --- a/sdk/nodejs/resourcePool.ts +++ b/sdk/nodejs/resourcePool.ts @@ -13,6 +13,54 @@ import * as utilities from "./utilities"; * * [ref-vsphere-resource_pools]: https://docs.vmware.com/en/VMware-vSphere/7.0/com.vmware.vsphere.resmgmt.doc/GUID-60077B40-66FF-4625-934A-641703ED7601.html * + * ## Example Usage + * + * The following example sets up a resource pool in an existing compute cluster + * with the default settings for CPU and memory reservations, shares, and limits. + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const datacenter = vsphere.getDatacenter({ + * name: "dc-01", + * }); + * const computeCluster = datacenter.then(datacenter => vsphere.getComputeCluster({ + * name: "cluster-01", + * datacenterId: datacenter.id, + * })); + * const resourcePool = new vsphere.ResourcePool("resourcePool", {parentResourcePoolId: computeCluster.then(computeCluster => computeCluster.resourcePoolId)}); + * ``` + * + * A virtual machine resource could be targeted to use the default resource pool + * of the cluster using the following: + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const vm = new vsphere.VirtualMachine("vm", {resourcePoolId: data.vsphere_compute_cluster.cluster.resource_pool_id}); + * // ... other configuration ... + * ``` + * + * The following example sets up a parent resource pool in an existing compute cluster + * with a child resource pool nested below. Each resource pool is configured with + * the default settings for CPU and memory reservations, shares, and limits. + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const datacenter = vsphere.getDatacenter({ + * name: "dc-01", + * }); + * const computeCluster = datacenter.then(datacenter => vsphere.getComputeCluster({ + * name: "cluster-01", + * datacenterId: datacenter.id, + * })); + * const resourcePoolParent = new vsphere.ResourcePool("resourcePoolParent", {parentResourcePoolId: computeCluster.then(computeCluster => computeCluster.resourcePoolId)}); + * const resourcePoolChild = new vsphere.ResourcePool("resourcePoolChild", {parentResourcePoolId: resourcePoolParent.id}); + * ``` * ## Importing * ### Settings that Require vSphere 7.0 or higher * diff --git a/sdk/nodejs/types/input.ts b/sdk/nodejs/types/input.ts index 28fbca1e..8d573719 100644 --- a/sdk/nodejs/types/input.ts +++ b/sdk/nodejs/types/input.ts @@ -15,6 +15,32 @@ export interface ComputeClusterVsanDiskGroup { * * > **NOTE:** You must disable vSphere HA before you enable vSAN on the cluster. * You can enable or re-enable vSphere HA after vSAN is configured. + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const computeCluster = new vsphere.ComputeCluster("computeCluster", { + * datacenterId: data.vsphere_datacenter.datacenter.id, + * hostSystemIds: [data.vsphere_host.host.map(__item => __item.id)], + * drsEnabled: true, + * drsAutomationLevel: "fullyAutomated", + * haEnabled: false, + * vsanEnabled: true, + * vsanDedupEnabled: true, + * vsanCompressionEnabled: true, + * vsanPerformanceEnabled: true, + * vsanVerboseModeEnabled: true, + * vsanNetworkDiagnosticModeEnabled: true, + * vsanUnmapEnabled: true, + * vsanDitEncryptionEnabled: true, + * vsanDitRekeyInterval: 1800, + * vsanDiskGroups: [{ + * cache: data.vsphere_vmfs_disks.cache_disks[0], + * storages: data.vsphere_vmfs_disks.storage_disks, + * }], + * }); + * ``` */ storages?: pulumi.Input[]>; } diff --git a/sdk/nodejs/types/output.ts b/sdk/nodejs/types/output.ts index bcddea56..ad42bfb4 100644 --- a/sdk/nodejs/types/output.ts +++ b/sdk/nodejs/types/output.ts @@ -15,6 +15,32 @@ export interface ComputeClusterVsanDiskGroup { * * > **NOTE:** You must disable vSphere HA before you enable vSAN on the cluster. * You can enable or re-enable vSphere HA after vSAN is configured. + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const computeCluster = new vsphere.ComputeCluster("computeCluster", { + * datacenterId: data.vsphere_datacenter.datacenter.id, + * hostSystemIds: [data.vsphere_host.host.map(__item => __item.id)], + * drsEnabled: true, + * drsAutomationLevel: "fullyAutomated", + * haEnabled: false, + * vsanEnabled: true, + * vsanDedupEnabled: true, + * vsanCompressionEnabled: true, + * vsanPerformanceEnabled: true, + * vsanVerboseModeEnabled: true, + * vsanNetworkDiagnosticModeEnabled: true, + * vsanUnmapEnabled: true, + * vsanDitEncryptionEnabled: true, + * vsanDitRekeyInterval: 1800, + * vsanDiskGroups: [{ + * cache: data.vsphere_vmfs_disks.cache_disks[0], + * storages: data.vsphere_vmfs_disks.storage_disks, + * }], + * }); + * ``` */ storages?: string[]; } diff --git a/sdk/nodejs/virtualMachineSnapshot.ts b/sdk/nodejs/virtualMachineSnapshot.ts index fdfa18ec..2935a118 100644 --- a/sdk/nodejs/virtualMachineSnapshot.ts +++ b/sdk/nodejs/virtualMachineSnapshot.ts @@ -26,6 +26,23 @@ import * as utilities from "./utilities"; * limitation of virtual machine snapshots, see [here][ext-vm-snap-limitations]. * * [ext-vm-snap-limitations]: https://docs.vmware.com/en/VMware-vSphere/7.0/com.vmware.vsphere.vm_admin.doc/GUID-53F65726-A23B-4CF0-A7D5-48E584B88613.html + * + * ## Example Usage + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const demo1 = new vsphere.VirtualMachineSnapshot("demo1", { + * consolidate: true, + * description: "This is Demo Snapshot", + * memory: true, + * quiesce: true, + * removeChildren: false, + * snapshotName: "Snapshot Name", + * virtualMachineUuid: "9aac5551-a351-4158-8c5c-15a71e8ec5c9", + * }); + * ``` */ export class VirtualMachineSnapshot extends pulumi.CustomResource { /** diff --git a/sdk/nodejs/vmStoragePolicy.ts b/sdk/nodejs/vmStoragePolicy.ts index fb1728e7..0d5c4adf 100644 --- a/sdk/nodejs/vmStoragePolicy.ts +++ b/sdk/nodejs/vmStoragePolicy.ts @@ -10,6 +10,135 @@ import * as utilities from "./utilities"; * The `vsphere.VmStoragePolicy` resource can be used to create and manage storage * policies. Using this resource, tag based placement rules can be created to * place virtual machines on a datastore with matching tags. If storage requirements for the applications on the virtual machine change, you can modify the storage policy that was originally applied to the virtual machine. + * + * ## Example Usage + * + * The following example creates storage policies with `tagRules` base on sets of environment, service level, and replication attributes. + * + * In this example, tags are first applied to datastores. + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const environment = vsphere.getTagCategory({ + * name: "environment", + * }); + * const serviceLevel = vsphere.getTagCategory({ + * name: "service_level", + * }); + * const replication = vsphere.getTagCategory({ + * name: "replication", + * }); + * const production = vsphere.getTag({ + * categoryId: "data.vsphere_tag_category.environment.id", + * name: "production", + * }); + * const development = vsphere.getTag({ + * categoryId: "data.vsphere_tag_category.environment.id", + * name: "development", + * }); + * const platinum = vsphere.getTag({ + * categoryId: "data.vsphere_tag_category.service_level.id", + * name: "platinum", + * }); + * const gold = vsphere.getTag({ + * categoryId: "data.vsphere_tag_category.service_level.id", + * name: "platinum", + * }); + * const silver = vsphere.getTag({ + * categoryId: "data.vsphere_tag_category.service_level.id", + * name: "silver", + * }); + * const bronze = vsphere.getTag({ + * categoryId: "data.vsphere_tag_category.service_level.id", + * name: "bronze", + * }); + * const replicated = vsphere.getTag({ + * categoryId: "data.vsphere_tag_category.replication.id", + * name: "replicated", + * }); + * const nonReplicated = vsphere.getTag({ + * categoryId: "data.vsphere_tag_category.replication.id", + * name: "non_replicated", + * }); + * const prodDatastore = new vsphere.VmfsDatastore("prodDatastore", {tags: [ + * "data.vsphere_tag.production.id", + * "data.vsphere_tag.platinum.id", + * "data.vsphere_tag.replicated.id", + * ]}); + * const devDatastore = new vsphere.NasDatastore("devDatastore", {tags: [ + * "data.vsphere_tag.development.id", + * "data.vsphere_tag.silver.id", + * "data.vsphere_tag.non_replicated.id", + * ]}); + * ``` + * + * Next, storage policies are created and `tagRules` are applied. + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const prodPlatinumReplicated = new vsphere.VmStoragePolicy("prodPlatinumReplicated", { + * description: "prod_platinum_replicated", + * tagRules: [ + * { + * tagCategory: data.vsphere_tag_category.environment.name, + * tags: [data.vsphere_tag.production.name], + * includeDatastoresWithTags: true, + * }, + * { + * tagCategory: data.vsphere_tag_category.service_level.name, + * tags: [data.vsphere_tag.platinum.name], + * includeDatastoresWithTags: true, + * }, + * { + * tagCategory: data.vsphere_tag_category.replication.name, + * tags: [data.vsphere_tag.replicated.name], + * includeDatastoresWithTags: true, + * }, + * ], + * }); + * const devSilverNonreplicated = new vsphere.VmStoragePolicy("devSilverNonreplicated", { + * description: "dev_silver_nonreplicated", + * tagRules: [ + * { + * tagCategory: data.vsphere_tag_category.environment.name, + * tags: [data.vsphere_tag.development.name], + * includeDatastoresWithTags: true, + * }, + * { + * tagCategory: data.vsphere_tag_category.service_level.name, + * tags: [data.vsphere_tag.silver.name], + * includeDatastoresWithTags: true, + * }, + * { + * tagCategory: data.vsphere_tag_category.replication.name, + * tags: [data.vsphere_tag.non_replicated.name], + * includeDatastoresWithTags: true, + * }, + * ], + * }); + * ``` + * + * Lasttly, when creating a virtual machine resource, a storage policy can be specificed to direct virtual machine placement to a datastore which matches the policy's `tagsRules`. + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const prodPlatinumReplicated = vsphere.getPolicy({ + * name: "prod_platinum_replicated", + * }); + * const devSilverNonreplicated = vsphere.getPolicy({ + * name: "dev_silver_nonreplicated", + * }); + * const prodVm = new vsphere.VirtualMachine("prodVm", {storagePolicyId: data.vsphere_storage_policy.storage_policy.prod_platinum_replicated.id}); + * // ... other configuration ... + * const devVm = new vsphere.VirtualMachine("devVm", {storagePolicyId: data.vsphere_storage_policy.storage_policy.dev_silver_nonreplicated.id}); + * // ... other configuration ... + * ``` */ export class VmStoragePolicy extends pulumi.CustomResource { /** diff --git a/sdk/nodejs/vnic.ts b/sdk/nodejs/vnic.ts index 80d890be..fc32ffb5 100644 --- a/sdk/nodejs/vnic.ts +++ b/sdk/nodejs/vnic.ts @@ -12,6 +12,90 @@ import * as utilities from "./utilities"; * ## Example Usage * * ### S + * ### Create a vnic attached to a distributed virtual switch using the vmotion TCP/IP stack + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const dc = vsphere.getDatacenter({ + * name: "mydc", + * }); + * const h1 = dc.then(dc => vsphere.getHost({ + * name: "esxi1.host.test", + * datacenterId: dc.id, + * })); + * const d1 = new vsphere.DistributedVirtualSwitch("d1", { + * datacenterId: dc.then(dc => dc.id), + * hosts: [{ + * hostSystemId: h1.then(h1 => h1.id), + * devices: ["vnic3"], + * }], + * }); + * const p1 = new vsphere.DistributedPortGroup("p1", { + * vlanId: 1234, + * distributedVirtualSwitchUuid: d1.id, + * }); + * const v1 = new vsphere.Vnic("v1", { + * host: h1.then(h1 => h1.id), + * distributedSwitchPort: d1.id, + * distributedPortGroup: p1.id, + * ipv4: { + * dhcp: true, + * }, + * netstack: "vmotion", + * }); + * ``` + * ### Create a vnic attached to a portgroup using the default TCP/IP stack + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as vsphere from "@pulumi/vsphere"; + * + * const dc = vsphere.getDatacenter({ + * name: "mydc", + * }); + * const h1 = dc.then(dc => vsphere.getHost({ + * name: "esxi1.host.test", + * datacenterId: dc.id, + * })); + * const hvs1 = new vsphere.HostVirtualSwitch("hvs1", { + * hostSystemId: h1.then(h1 => h1.id), + * networkAdapters: [ + * "vmnic3", + * "vmnic4", + * ], + * activeNics: ["vmnic3"], + * standbyNics: ["vmnic4"], + * }); + * const p1 = new vsphere.HostPortGroup("p1", { + * virtualSwitchName: hvs1.name, + * hostSystemId: h1.then(h1 => h1.id), + * }); + * const v1 = new vsphere.Vnic("v1", { + * host: h1.then(h1 => h1.id), + * portgroup: p1.name, + * ipv4: { + * dhcp: true, + * }, + * services: [ + * "vsan", + * "management", + * ], + * }); + * ``` + * ## Importing + * + * An existing vNic can be [imported][docs-import] into this resource + * via supplying the vNic's ID. An example is below: + * + * [docs-import]: /docs/import/index.html + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * ``` + * + * The above would import the vnic `vmk2` from host with ID `host-123`. */ export class Vnic extends pulumi.CustomResource { /** diff --git a/sdk/python/pulumi_vsphere/_inputs.py b/sdk/python/pulumi_vsphere/_inputs.py index 46500e22..a831fc13 100644 --- a/sdk/python/pulumi_vsphere/_inputs.py +++ b/sdk/python/pulumi_vsphere/_inputs.py @@ -46,6 +46,31 @@ def __init__(__self__, *, > **NOTE:** You must disable vSphere HA before you enable vSAN on the cluster. You can enable or re-enable vSphere HA after vSAN is configured. + + ```python + import pulumi + import pulumi_vsphere as vsphere + + compute_cluster = vsphere.ComputeCluster("computeCluster", + datacenter_id=data["vsphere_datacenter"]["datacenter"]["id"], + host_system_ids=[[__item["id"] for __item in data["vsphere_host"]["host"]]], + drs_enabled=True, + drs_automation_level="fullyAutomated", + ha_enabled=False, + vsan_enabled=True, + vsan_dedup_enabled=True, + vsan_compression_enabled=True, + vsan_performance_enabled=True, + vsan_verbose_mode_enabled=True, + vsan_network_diagnostic_mode_enabled=True, + vsan_unmap_enabled=True, + vsan_dit_encryption_enabled=True, + vsan_dit_rekey_interval=1800, + vsan_disk_groups=[vsphere.ComputeClusterVsanDiskGroupArgs( + cache=data["vsphere_vmfs_disks"]["cache_disks"], + storages=data["vsphere_vmfs_disks"]["storage_disks"], + )]) + ``` """ ComputeClusterVsanDiskGroupArgs._configure( lambda key, value: pulumi.set(__self__, key, value), @@ -85,6 +110,31 @@ def storages(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]: > **NOTE:** You must disable vSphere HA before you enable vSAN on the cluster. You can enable or re-enable vSphere HA after vSAN is configured. + + ```python + import pulumi + import pulumi_vsphere as vsphere + + compute_cluster = vsphere.ComputeCluster("computeCluster", + datacenter_id=data["vsphere_datacenter"]["datacenter"]["id"], + host_system_ids=[[__item["id"] for __item in data["vsphere_host"]["host"]]], + drs_enabled=True, + drs_automation_level="fullyAutomated", + ha_enabled=False, + vsan_enabled=True, + vsan_dedup_enabled=True, + vsan_compression_enabled=True, + vsan_performance_enabled=True, + vsan_verbose_mode_enabled=True, + vsan_network_diagnostic_mode_enabled=True, + vsan_unmap_enabled=True, + vsan_dit_encryption_enabled=True, + vsan_dit_rekey_interval=1800, + vsan_disk_groups=[vsphere.ComputeClusterVsanDiskGroupArgs( + cache=data["vsphere_vmfs_disks"]["cache_disks"], + storages=data["vsphere_vmfs_disks"]["storage_disks"], + )]) + ``` """ return pulumi.get(self, "storages") diff --git a/sdk/python/pulumi_vsphere/compute_cluster_vm_affinity_rule.py b/sdk/python/pulumi_vsphere/compute_cluster_vm_affinity_rule.py index 1344862e..2cfd28ad 100644 --- a/sdk/python/pulumi_vsphere/compute_cluster_vm_affinity_rule.py +++ b/sdk/python/pulumi_vsphere/compute_cluster_vm_affinity_rule.py @@ -301,6 +301,69 @@ def __init__(__self__, > **NOTE:** vSphere DRS requires a vSphere Enterprise Plus license. + ## Example Usage + + The following example creates two virtual machines in a cluster using the + `VirtualMachine` resource, creating the + virtual machines in the cluster looked up by the + `ComputeCluster` data source. It + then creates an affinity rule for these two virtual machines, ensuring they + will run on the same host whenever possible. + + ```python + import pulumi + import pulumi_vsphere as vsphere + + datacenter = vsphere.get_datacenter(name="dc-01") + datastore = vsphere.get_datastore(name="datastore-01", + datacenter_id=datacenter.id) + cluster = vsphere.get_compute_cluster(name="cluster-01", + datacenter_id=datacenter.id) + network = vsphere.get_network(name="VM Network", + datacenter_id=datacenter.id) + vm = [] + for range in [{"value": i} for i in range(0, 2)]: + vm.append(vsphere.VirtualMachine(f"vm-{range['value']}", + resource_pool_id=cluster.resource_pool_id, + datastore_id=datastore.id, + num_cpus=1, + memory=1024, + guest_id="otherLinux64Guest", + network_interfaces=[vsphere.VirtualMachineNetworkInterfaceArgs( + network_id=network.id, + )], + disks=[vsphere.VirtualMachineDiskArgs( + label="disk0", + size=20, + )])) + vm_affinity_rule = vsphere.ComputeClusterVmAffinityRule("vmAffinityRule", + compute_cluster_id=cluster.id, + virtual_machine_ids=[v.id for k, v in vm]) + ``` + + The following example creates an affinity rule for a set of virtual machines + in the cluster by looking up the virtual machine UUIDs from the + `VirtualMachine` data source. + + ```python + import pulumi + import pulumi_vsphere as vsphere + + vms = [ + "foo-0", + "foo-1", + ] + datacenter = vsphere.get_datacenter(name="dc-01") + cluster = vsphere.get_compute_cluster(name="cluster-01", + datacenter_id=datacenter.id) + vms_virtual_machine = [vsphere.get_virtual_machine(name=vms[__index], + datacenter_id=datacenter.id) for __index in range(len(vms))] + vm_affinity_rule = vsphere.ComputeClusterVmAffinityRule("vmAffinityRule", + enabled=True, + compute_cluster_id=cluster.id, + virtual_machine_ids=[__item.id for __item in vms_virtual_machine]) + ``` + :param str resource_name: The name of the resource. :param pulumi.ResourceOptions opts: Options for the resource. :param pulumi.Input[str] compute_cluster_id: The managed object reference @@ -346,6 +409,69 @@ def __init__(__self__, > **NOTE:** vSphere DRS requires a vSphere Enterprise Plus license. + ## Example Usage + + The following example creates two virtual machines in a cluster using the + `VirtualMachine` resource, creating the + virtual machines in the cluster looked up by the + `ComputeCluster` data source. It + then creates an affinity rule for these two virtual machines, ensuring they + will run on the same host whenever possible. + + ```python + import pulumi + import pulumi_vsphere as vsphere + + datacenter = vsphere.get_datacenter(name="dc-01") + datastore = vsphere.get_datastore(name="datastore-01", + datacenter_id=datacenter.id) + cluster = vsphere.get_compute_cluster(name="cluster-01", + datacenter_id=datacenter.id) + network = vsphere.get_network(name="VM Network", + datacenter_id=datacenter.id) + vm = [] + for range in [{"value": i} for i in range(0, 2)]: + vm.append(vsphere.VirtualMachine(f"vm-{range['value']}", + resource_pool_id=cluster.resource_pool_id, + datastore_id=datastore.id, + num_cpus=1, + memory=1024, + guest_id="otherLinux64Guest", + network_interfaces=[vsphere.VirtualMachineNetworkInterfaceArgs( + network_id=network.id, + )], + disks=[vsphere.VirtualMachineDiskArgs( + label="disk0", + size=20, + )])) + vm_affinity_rule = vsphere.ComputeClusterVmAffinityRule("vmAffinityRule", + compute_cluster_id=cluster.id, + virtual_machine_ids=[v.id for k, v in vm]) + ``` + + The following example creates an affinity rule for a set of virtual machines + in the cluster by looking up the virtual machine UUIDs from the + `VirtualMachine` data source. + + ```python + import pulumi + import pulumi_vsphere as vsphere + + vms = [ + "foo-0", + "foo-1", + ] + datacenter = vsphere.get_datacenter(name="dc-01") + cluster = vsphere.get_compute_cluster(name="cluster-01", + datacenter_id=datacenter.id) + vms_virtual_machine = [vsphere.get_virtual_machine(name=vms[__index], + datacenter_id=datacenter.id) for __index in range(len(vms))] + vm_affinity_rule = vsphere.ComputeClusterVmAffinityRule("vmAffinityRule", + enabled=True, + compute_cluster_id=cluster.id, + virtual_machine_ids=[__item.id for __item in vms_virtual_machine]) + ``` + :param str resource_name: The name of the resource. :param ComputeClusterVmAffinityRuleArgs args: The arguments to use to populate this resource's properties. :param pulumi.ResourceOptions opts: Options for the resource. diff --git a/sdk/python/pulumi_vsphere/datacenter.py b/sdk/python/pulumi_vsphere/datacenter.py index a8568a6a..74104288 100644 --- a/sdk/python/pulumi_vsphere/datacenter.py +++ b/sdk/python/pulumi_vsphere/datacenter.py @@ -278,6 +278,22 @@ def __init__(__self__, container of inventory objects such as hosts and virtual machines. ## Example Usage + ### Create datacenter on the root folder + + ```python + import pulumi + import pulumi_vsphere as vsphere + + prod_datacenter = vsphere.Datacenter("prodDatacenter") + ``` + ### Create datacenter on a subfolder + + ```python + import pulumi + import pulumi_vsphere as vsphere + + research_datacenter = vsphere.Datacenter("researchDatacenter", folder="/research/") + ``` :param str resource_name: The name of the resource. :param pulumi.ResourceOptions opts: Options for the resource. @@ -310,6 +326,22 @@ def __init__(__self__, container of inventory objects such as hosts and virtual machines. ## Example Usage + ### Create datacenter on the root folder + + ```python + import pulumi + import pulumi_vsphere as vsphere + + prod_datacenter = vsphere.Datacenter("prodDatacenter") + ``` + ### Create datacenter on a subfolder + + ```python + import pulumi + import pulumi_vsphere as vsphere + + research_datacenter = vsphere.Datacenter("researchDatacenter", folder="/research/") + ``` :param str resource_name: The name of the resource. :param DatacenterArgs args: The arguments to use to populate this resource's properties. diff --git a/sdk/python/pulumi_vsphere/distributed_virtual_switch.py b/sdk/python/pulumi_vsphere/distributed_virtual_switch.py index ca317098..50f345fd 100644 --- a/sdk/python/pulumi_vsphere/distributed_virtual_switch.py +++ b/sdk/python/pulumi_vsphere/distributed_virtual_switch.py @@ -274,6 +274,22 @@ def __init__(__self__, *, and `max_vlan` sub-arguments to define the tagged VLAN range. Multiple `vlan_range` definitions are allowed, but they must not overlap. Example below: + + ```python + import pulumi + import pulumi_vsphere as vsphere + + vds = vsphere.DistributedVirtualSwitch("vds", vlan_ranges=[ + vsphere.DistributedVirtualSwitchVlanRangeArgs( + max_vlan=199, + min_vlan=100, + ), + vsphere.DistributedVirtualSwitchVlanRangeArgs( + max_vlan=399, + min_vlan=300, + ), + ]) + ``` :param pulumi.Input[int] vmotion_maximum_mbit: The maximum allowed usage for the vmotion traffic class, in Mbits/sec. :param pulumi.Input[int] vmotion_reservation_mbit: The amount of guaranteed bandwidth for the vmotion traffic class, in Mbits/sec. :param pulumi.Input[int] vmotion_share_count: The amount of shares to allocate to the vmotion traffic class for a custom share level. @@ -1943,6 +1959,22 @@ def vlan_ranges(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['Distribute and `max_vlan` sub-arguments to define the tagged VLAN range. Multiple `vlan_range` definitions are allowed, but they must not overlap. Example below: + + ```python + import pulumi + import pulumi_vsphere as vsphere + + vds = vsphere.DistributedVirtualSwitch("vds", vlan_ranges=[ + vsphere.DistributedVirtualSwitchVlanRangeArgs( + max_vlan=199, + min_vlan=100, + ), + vsphere.DistributedVirtualSwitchVlanRangeArgs( + max_vlan=399, + min_vlan=300, + ), + ]) + ``` """ return pulumi.get(self, "vlan_ranges") @@ -2311,6 +2343,22 @@ def __init__(__self__, *, and `max_vlan` sub-arguments to define the tagged VLAN range. Multiple `vlan_range` definitions are allowed, but they must not overlap. Example below: + + ```python + import pulumi + import pulumi_vsphere as vsphere + + vds = vsphere.DistributedVirtualSwitch("vds", vlan_ranges=[ + vsphere.DistributedVirtualSwitchVlanRangeArgs( + max_vlan=199, + min_vlan=100, + ), + vsphere.DistributedVirtualSwitchVlanRangeArgs( + max_vlan=399, + min_vlan=300, + ), + ]) + ``` :param pulumi.Input[int] vmotion_maximum_mbit: The maximum allowed usage for the vmotion traffic class, in Mbits/sec. :param pulumi.Input[int] vmotion_reservation_mbit: The amount of guaranteed bandwidth for the vmotion traffic class, in Mbits/sec. :param pulumi.Input[int] vmotion_share_count: The amount of shares to allocate to the vmotion traffic class for a custom share level. @@ -3998,6 +4046,22 @@ def vlan_ranges(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['Distribute and `max_vlan` sub-arguments to define the tagged VLAN range. Multiple `vlan_range` definitions are allowed, but they must not overlap. Example below: + + ```python + import pulumi + import pulumi_vsphere as vsphere + + vds = vsphere.DistributedVirtualSwitch("vds", vlan_ranges=[ + vsphere.DistributedVirtualSwitchVlanRangeArgs( + max_vlan=199, + min_vlan=100, + ), + vsphere.DistributedVirtualSwitchVlanRangeArgs( + max_vlan=399, + min_vlan=300, + ), + ]) + ``` """ return pulumi.get(self, "vlan_ranges") @@ -4368,6 +4432,22 @@ def __init__(__self__, and `max_vlan` sub-arguments to define the tagged VLAN range. Multiple `vlan_range` definitions are allowed, but they must not overlap. Example below: + + ```python + import pulumi + import pulumi_vsphere as vsphere + + vds = vsphere.DistributedVirtualSwitch("vds", vlan_ranges=[ + vsphere.DistributedVirtualSwitchVlanRangeArgs( + max_vlan=199, + min_vlan=100, + ), + vsphere.DistributedVirtualSwitchVlanRangeArgs( + max_vlan=399, + min_vlan=300, + ), + ]) + ``` :param pulumi.Input[int] vmotion_maximum_mbit: The maximum allowed usage for the vmotion traffic class, in Mbits/sec. :param pulumi.Input[int] vmotion_reservation_mbit: The amount of guaranteed bandwidth for the vmotion traffic class, in Mbits/sec. :param pulumi.Input[int] vmotion_share_count: The amount of shares to allocate to the vmotion traffic class for a custom share level. @@ -4880,6 +4960,22 @@ def get(resource_name: str, and `max_vlan` sub-arguments to define the tagged VLAN range. Multiple `vlan_range` definitions are allowed, but they must not overlap. Example below: + + ```python + import pulumi + import pulumi_vsphere as vsphere + + vds = vsphere.DistributedVirtualSwitch("vds", vlan_ranges=[ + vsphere.DistributedVirtualSwitchVlanRangeArgs( + max_vlan=199, + min_vlan=100, + ), + vsphere.DistributedVirtualSwitchVlanRangeArgs( + max_vlan=399, + min_vlan=300, + ), + ]) + ``` :param pulumi.Input[int] vmotion_maximum_mbit: The maximum allowed usage for the vmotion traffic class, in Mbits/sec. :param pulumi.Input[int] vmotion_reservation_mbit: The amount of guaranteed bandwidth for the vmotion traffic class, in Mbits/sec. :param pulumi.Input[int] vmotion_share_count: The amount of shares to allocate to the vmotion traffic class for a custom share level. @@ -5760,6 +5856,22 @@ def vlan_ranges(self) -> pulumi.Output[Sequence['outputs.DistributedVirtualSwitc and `max_vlan` sub-arguments to define the tagged VLAN range. Multiple `vlan_range` definitions are allowed, but they must not overlap. Example below: + + ```python + import pulumi + import pulumi_vsphere as vsphere + + vds = vsphere.DistributedVirtualSwitch("vds", vlan_ranges=[ + vsphere.DistributedVirtualSwitchVlanRangeArgs( + max_vlan=199, + min_vlan=100, + ), + vsphere.DistributedVirtualSwitchVlanRangeArgs( + max_vlan=399, + min_vlan=300, + ), + ]) + ``` """ return pulumi.get(self, "vlan_ranges") diff --git a/sdk/python/pulumi_vsphere/file.py b/sdk/python/pulumi_vsphere/file.py index 86436554..a0235cb3 100644 --- a/sdk/python/pulumi_vsphere/file.py +++ b/sdk/python/pulumi_vsphere/file.py @@ -367,6 +367,34 @@ def __init__(__self__, __props__=None): """ ## Example Usage + ### Uploading a File + + ```python + import pulumi + import pulumi_vsphere as vsphere + + ubuntu_vmdk_upload = vsphere.File("ubuntuVmdkUpload", + create_directories=True, + datacenter="dc-01", + datastore="datastore-01", + destination_file="/my/dst/path/custom_ubuntu.vmdk", + source_file="/my/src/path/custom_ubuntu.vmdk") + ``` + ### Copying a File + + ```python + import pulumi + import pulumi_vsphere as vsphere + + ubuntu_copy = vsphere.File("ubuntuCopy", + create_directories=True, + datacenter="dc-01", + datastore="datastore-01", + destination_file="/my/dst/path/custom_ubuntu.vmdk", + source_datacenter="dc-01", + source_datastore="datastore-01", + source_file="/my/src/path/custom_ubuntu.vmdk") + ``` :param str resource_name: The name of the resource. :param pulumi.ResourceOptions opts: Options for the resource. @@ -395,6 +423,34 @@ def __init__(__self__, opts: Optional[pulumi.ResourceOptions] = None): """ ## Example Usage + ### Uploading a File + + ```python + import pulumi + import pulumi_vsphere as vsphere + + ubuntu_vmdk_upload = vsphere.File("ubuntuVmdkUpload", + create_directories=True, + datacenter="dc-01", + datastore="datastore-01", + destination_file="/my/dst/path/custom_ubuntu.vmdk", + source_file="/my/src/path/custom_ubuntu.vmdk") + ``` + ### Copying a File + + ```python + import pulumi + import pulumi_vsphere as vsphere + + ubuntu_copy = vsphere.File("ubuntuCopy", + create_directories=True, + datacenter="dc-01", + datastore="datastore-01", + destination_file="/my/dst/path/custom_ubuntu.vmdk", + source_datacenter="dc-01", + source_datastore="datastore-01", + source_file="/my/src/path/custom_ubuntu.vmdk") + ``` :param str resource_name: The name of the resource. :param FileArgs args: The arguments to use to populate this resource's properties. diff --git a/sdk/python/pulumi_vsphere/get_compute_cluster.py b/sdk/python/pulumi_vsphere/get_compute_cluster.py index 7c3d72fa..ab21e86c 100644 --- a/sdk/python/pulumi_vsphere/get_compute_cluster.py +++ b/sdk/python/pulumi_vsphere/get_compute_cluster.py @@ -89,6 +89,17 @@ def get_compute_cluster(datacenter_id: Optional[str] = None, resource for more information about clusters and how to managed the resource in this provider. + ## Example Usage + + ```python + import pulumi + import pulumi_vsphere as vsphere + + datacenter = vsphere.get_datacenter(name="dc-01") + compute_cluster = vsphere.get_compute_cluster(name="cluster-01", + datacenter_id=datacenter.id) + ``` + :param str datacenter_id: The managed object reference ID of the datacenter the cluster is located in. This can be omitted if the @@ -124,6 +135,17 @@ def get_compute_cluster_output(datacenter_id: Optional[pulumi.Input[Optional[str resource for more information about clusters and how to managed the resource in this provider. + ## Example Usage + + ```python + import pulumi + import pulumi_vsphere as vsphere + + datacenter = vsphere.get_datacenter(name="dc-01") + compute_cluster = vsphere.get_compute_cluster(name="cluster-01", + datacenter_id=datacenter.id) + ``` + :param str datacenter_id: The managed object reference ID of the datacenter the cluster is located in. This can be omitted if the diff --git a/sdk/python/pulumi_vsphere/get_compute_cluster_host_group.py b/sdk/python/pulumi_vsphere/get_compute_cluster_host_group.py index b09d2653..706a26f6 100644 --- a/sdk/python/pulumi_vsphere/get_compute_cluster_host_group.py +++ b/sdk/python/pulumi_vsphere/get_compute_cluster_host_group.py @@ -83,6 +83,23 @@ def get_compute_cluster_host_group(compute_cluster_id: Optional[str] = None, the IDs ESXi hosts in a host group and return host group attributes to other resources. + ## Example Usage + + ```python + import pulumi + import pulumi_vsphere as vsphere + + datacenter = vsphere.get_datacenter(name=var["vsphere_datacenter"]) + cluster = vsphere.get_compute_cluster(name=var["vsphere_cluster"], + datacenter_id=datacenter.id) + host_group1 = vsphere.get_compute_cluster_host_group(name="host_group1", + compute_cluster_id=cluster.id) + host_rule1 = vsphere.ComputeClusterVmHostRule("hostRule1", + compute_cluster_id=cluster.id, + vm_group_name="vm_group1", + affinity_host_group_name=host_group1.name) + ``` + :param str compute_cluster_id: The [managed object reference ID][docs-about-morefs] of the compute cluster for the host group. @@ -112,6 +129,23 @@ def get_compute_cluster_host_group_output(compute_cluster_id: Optional[pulumi.In the IDs ESXi hosts in a host group and return host group attributes to other resources. + ## Example Usage + + ```python + import pulumi + import pulumi_vsphere as vsphere + + datacenter = vsphere.get_datacenter(name=var["vsphere_datacenter"]) + cluster = vsphere.get_compute_cluster(name=var["vsphere_cluster"], + datacenter_id=datacenter.id) + host_group1 = vsphere.get_compute_cluster_host_group(name="host_group1", + compute_cluster_id=cluster.id) + host_rule1 = vsphere.ComputeClusterVmHostRule("hostRule1", + compute_cluster_id=cluster.id, + vm_group_name="vm_group1", + affinity_host_group_name=host_group1.name) + ``` + :param str compute_cluster_id: The [managed object reference ID][docs-about-morefs] of the compute cluster for the host group. diff --git a/sdk/python/pulumi_vsphere/get_content_library.py b/sdk/python/pulumi_vsphere/get_content_library.py index 829c075a..12fd14ca 100644 --- a/sdk/python/pulumi_vsphere/get_content_library.py +++ b/sdk/python/pulumi_vsphere/get_content_library.py @@ -60,6 +60,15 @@ def get_content_library(name: Optional[str] = None, > **NOTE:** This resource requires vCenter Server and is not available on direct ESXi host connections. + ## Example Usage + + ```python + import pulumi + import pulumi_vsphere as vsphere + + library = vsphere.get_content_library(name="Content Library") + ``` + :param str name: The name of the content library. """ @@ -81,6 +90,15 @@ def get_content_library_output(name: Optional[pulumi.Input[str]] = None, > **NOTE:** This resource requires vCenter Server and is not available on direct ESXi host connections. + ## Example Usage + + ```python + import pulumi + import pulumi_vsphere as vsphere + + library = vsphere.get_content_library(name="Content Library") + ``` + :param str name: The name of the content library. """ diff --git a/sdk/python/pulumi_vsphere/get_custom_attribute.py b/sdk/python/pulumi_vsphere/get_custom_attribute.py index c4cefd73..eb5f075e 100644 --- a/sdk/python/pulumi_vsphere/get_custom_attribute.py +++ b/sdk/python/pulumi_vsphere/get_custom_attribute.py @@ -74,6 +74,15 @@ def get_custom_attribute(name: Optional[str] = None, > **NOTE:** Custom attributes are unsupported on direct ESXi host connections and require vCenter Server. + ## Example Usage + + ```python + import pulumi + import pulumi_vsphere as vsphere + + attribute = vsphere.get_custom_attribute(name="test-attribute") + ``` + :param str name: The name of the custom attribute. """ @@ -101,6 +110,15 @@ def get_custom_attribute_output(name: Optional[pulumi.Input[str]] = None, > **NOTE:** Custom attributes are unsupported on direct ESXi host connections and require vCenter Server. + ## Example Usage + + ```python + import pulumi + import pulumi_vsphere as vsphere + + attribute = vsphere.get_custom_attribute(name="test-attribute") + ``` + :param str name: The name of the custom attribute. """ diff --git a/sdk/python/pulumi_vsphere/get_datacenter.py b/sdk/python/pulumi_vsphere/get_datacenter.py index 2116bbe7..1fb70cb7 100644 --- a/sdk/python/pulumi_vsphere/get_datacenter.py +++ b/sdk/python/pulumi_vsphere/get_datacenter.py @@ -61,6 +61,15 @@ def get_datacenter(name: Optional[str] = None, that require a datacenter, such as the `Host` data source. + ## Example Usage + + ```python + import pulumi + import pulumi_vsphere as vsphere + + datacenter = vsphere.get_datacenter(name="dc-01") + ``` + :param str name: The name of the datacenter. This can be a name or path. Can be omitted if there is only one datacenter in the inventory. @@ -89,6 +98,15 @@ def get_datacenter_output(name: Optional[pulumi.Input[Optional[str]]] = None, that require a datacenter, such as the `Host` data source. + ## Example Usage + + ```python + import pulumi + import pulumi_vsphere as vsphere + + datacenter = vsphere.get_datacenter(name="dc-01") + ``` + :param str name: The name of the datacenter. This can be a name or path. Can be omitted if there is only one datacenter in the inventory. diff --git a/sdk/python/pulumi_vsphere/get_datastore.py b/sdk/python/pulumi_vsphere/get_datastore.py index e75b59c0..6d63a307 100644 --- a/sdk/python/pulumi_vsphere/get_datastore.py +++ b/sdk/python/pulumi_vsphere/get_datastore.py @@ -71,6 +71,17 @@ def get_datastore(datacenter_id: Optional[str] = None, that require a datastore. For example, to create virtual machines in using the `VirtualMachine` resource. + ## Example Usage + + ```python + import pulumi + import pulumi_vsphere as vsphere + + datacenter = vsphere.get_datacenter(name="dc-01") + datastore = vsphere.get_datastore(name="datastore-01", + datacenter_id=datacenter.id) + ``` + :param str datacenter_id: The managed object reference ID of the datacenter the datastore is located in. This can be omitted if the @@ -100,6 +111,17 @@ def get_datastore_output(datacenter_id: Optional[pulumi.Input[Optional[str]]] = that require a datastore. For example, to create virtual machines in using the `VirtualMachine` resource. + ## Example Usage + + ```python + import pulumi + import pulumi_vsphere as vsphere + + datacenter = vsphere.get_datacenter(name="dc-01") + datastore = vsphere.get_datastore(name="datastore-01", + datacenter_id=datacenter.id) + ``` + :param str datacenter_id: The managed object reference ID of the datacenter the datastore is located in. This can be omitted if the diff --git a/sdk/python/pulumi_vsphere/get_datastore_cluster.py b/sdk/python/pulumi_vsphere/get_datastore_cluster.py index 35eecd17..dcac8e70 100644 --- a/sdk/python/pulumi_vsphere/get_datastore_cluster.py +++ b/sdk/python/pulumi_vsphere/get_datastore_cluster.py @@ -71,6 +71,17 @@ def get_datastore_cluster(datacenter_id: Optional[str] = None, that require a datastore. For example, to assign datastores using the `NasDatastore` or `VmfsDatastore` resources, or to create virtual machines in using the `VirtualMachine` resource. + ## Example Usage + + ```python + import pulumi + import pulumi_vsphere as vsphere + + datacenter = vsphere.get_datacenter(name="dc-01") + datastore_cluster = vsphere.get_datastore_cluster(name="datastore-cluster-01", + datacenter_id=datacenter.id) + ``` + :param str datacenter_id: The managed object reference ID of the datacenter the datastore cluster is located in. @@ -101,6 +112,17 @@ def get_datastore_cluster_output(datacenter_id: Optional[pulumi.Input[Optional[s that require a datastore. For example, to assign datastores using the `NasDatastore` or `VmfsDatastore` resources, or to create virtual machines in using the `VirtualMachine` resource. + ## Example Usage + + ```python + import pulumi + import pulumi_vsphere as vsphere + + datacenter = vsphere.get_datacenter(name="dc-01") + datastore_cluster = vsphere.get_datastore_cluster(name="datastore-cluster-01", + datacenter_id=datacenter.id) + ``` + :param str datacenter_id: The managed object reference ID of the datacenter the datastore cluster is located in. diff --git a/sdk/python/pulumi_vsphere/get_distributed_virtual_switch.py b/sdk/python/pulumi_vsphere/get_distributed_virtual_switch.py index 2b72a137..778397d3 100644 --- a/sdk/python/pulumi_vsphere/get_distributed_virtual_switch.py +++ b/sdk/python/pulumi_vsphere/get_distributed_virtual_switch.py @@ -90,6 +90,26 @@ def get_distributed_virtual_switch(datacenter_id: Optional[str] = None, > **NOTE:** This data source requires vCenter Server and is not available on direct ESXi host connections. + ## Example Usage + + The following example locates a distributed switch named `vds-01`, in the + datacenter `dc-01`. It then uses this distributed switch to set up a + `DistributedPortGroup` resource that uses the first uplink as a + primary uplink and the second uplink as a secondary. + + ```python + import pulumi + import pulumi_vsphere as vsphere + + datacenter = vsphere.get_datacenter(name="dc-01") + vds = vsphere.get_distributed_virtual_switch(name="vds-01", + datacenter_id=datacenter.id) + dvpg = vsphere.DistributedPortGroup("dvpg", + distributed_virtual_switch_uuid=vds.id, + active_uplinks=[vds.uplinks[0]], + standby_uplinks=[vds.uplinks[1]]) + ``` + :param str datacenter_id: The managed object reference ID of the datacenter the VDS is located in. This can be omitted if the search @@ -124,6 +144,26 @@ def get_distributed_virtual_switch_output(datacenter_id: Optional[pulumi.Input[O > **NOTE:** This data source requires vCenter Server and is not available on direct ESXi host connections. + ## Example Usage + + The following example locates a distributed switch named `vds-01`, in the + datacenter `dc-01`. It then uses this distributed switch to set up a + `DistributedPortGroup` resource that uses the first uplink as a + primary uplink and the second uplink as a secondary. + + ```python + import pulumi + import pulumi_vsphere as vsphere + + datacenter = vsphere.get_datacenter(name="dc-01") + vds = vsphere.get_distributed_virtual_switch(name="vds-01", + datacenter_id=datacenter.id) + dvpg = vsphere.DistributedPortGroup("dvpg", + distributed_virtual_switch_uuid=vds.id, + active_uplinks=[vds.uplinks[0]], + standby_uplinks=[vds.uplinks[1]]) + ``` + :param str datacenter_id: The managed object reference ID of the datacenter the VDS is located in. This can be omitted if the search diff --git a/sdk/python/pulumi_vsphere/get_dynamic.py b/sdk/python/pulumi_vsphere/get_dynamic.py index 6380bb93..098d83eb 100644 --- a/sdk/python/pulumi_vsphere/get_dynamic.py +++ b/sdk/python/pulumi_vsphere/get_dynamic.py @@ -82,6 +82,25 @@ def get_dynamic(filters: Optional[Sequence[str]] = None, of any tagged managed object in vCenter Server by providing a list of tag IDs and an optional regular expression to filter objects by name. + ## Example Usage + + ```python + import pulumi + import pulumi_vsphere as vsphere + + category = vsphere.get_tag_category(name="SomeCategory") + tag1 = vsphere.get_tag(name="FirstTag", + category_id=data["vsphere_tag_category"]["cat"]["id"]) + tag2 = vsphere.get_tag(name="SecondTag", + category_id=data["vsphere_tag_category"]["cat"]["id"]) + dyn = vsphere.get_dynamic(filters=[ + tag1.id, + tag1.id, + ], + name_regex="ubuntu", + type="Datacenter") + ``` + :param Sequence[str] filters: A list of tag IDs that must be present on an object to be a match. @@ -117,6 +136,25 @@ def get_dynamic_output(filters: Optional[pulumi.Input[Sequence[str]]] = None, of any tagged managed object in vCenter Server by providing a list of tag IDs and an optional regular expression to filter objects by name. + ## Example Usage + + ```python + import pulumi + import pulumi_vsphere as vsphere + + category = vsphere.get_tag_category(name="SomeCategory") + tag1 = vsphere.get_tag(name="FirstTag", + category_id=data["vsphere_tag_category"]["cat"]["id"]) + tag2 = vsphere.get_tag(name="SecondTag", + category_id=data["vsphere_tag_category"]["cat"]["id"]) + dyn = vsphere.get_dynamic(filters=[ + tag1.id, + tag1.id, + ], + name_regex="ubuntu", + type="Datacenter") + ``` + :param Sequence[str] filters: A list of tag IDs that must be present on an object to be a match. diff --git a/sdk/python/pulumi_vsphere/get_folder.py b/sdk/python/pulumi_vsphere/get_folder.py index 0a6f292d..ab7fe73d 100644 --- a/sdk/python/pulumi_vsphere/get_folder.py +++ b/sdk/python/pulumi_vsphere/get_folder.py @@ -59,6 +59,15 @@ def get_folder(path: Optional[str] = None, The `Folder` data source can be used to get the general attributes of a vSphere inventory folder. Paths are absolute and must include the datacenter. + ## Example Usage + + ```python + import pulumi + import pulumi_vsphere as vsphere + + folder = vsphere.get_folder(path="/dc-01/datastore-01/folder-01") + ``` + :param str path: The absolute path of the folder. For example, given a default datacenter of `default-dc`, a folder of type `vm`, and a folder name @@ -83,6 +92,15 @@ def get_folder_output(path: Optional[pulumi.Input[str]] = None, The `Folder` data source can be used to get the general attributes of a vSphere inventory folder. Paths are absolute and must include the datacenter. + ## Example Usage + + ```python + import pulumi + import pulumi_vsphere as vsphere + + folder = vsphere.get_folder(path="/dc-01/datastore-01/folder-01") + ``` + :param str path: The absolute path of the folder. For example, given a default datacenter of `default-dc`, a folder of type `vm`, and a folder name diff --git a/sdk/python/pulumi_vsphere/get_host.py b/sdk/python/pulumi_vsphere/get_host.py index 3bb33454..81beea6e 100644 --- a/sdk/python/pulumi_vsphere/get_host.py +++ b/sdk/python/pulumi_vsphere/get_host.py @@ -83,6 +83,17 @@ def get_host(datacenter_id: Optional[str] = None, This can then be used with resources or data sources that require an ESX host's managed object reference ID. + ## Example Usage + + ```python + import pulumi + import pulumi_vsphere as vsphere + + datacenter = vsphere.get_datacenter(name="dc-01") + host = vsphere.get_host(name="esxi-01.example.com", + datacenter_id=datacenter.id) + ``` + :param str datacenter_id: The managed object reference ID of a vSphere datacenter object. @@ -114,6 +125,17 @@ def get_host_output(datacenter_id: Optional[pulumi.Input[str]] = None, This can then be used with resources or data sources that require an ESX host's managed object reference ID. + ## Example Usage + + ```python + import pulumi + import pulumi_vsphere as vsphere + + datacenter = vsphere.get_datacenter(name="dc-01") + host = vsphere.get_host(name="esxi-01.example.com", + datacenter_id=datacenter.id) + ``` + :param str datacenter_id: The managed object reference ID of a vSphere datacenter object. diff --git a/sdk/python/pulumi_vsphere/get_host_pci_device.py b/sdk/python/pulumi_vsphere/get_host_pci_device.py index b68c09b8..0a682c89 100644 --- a/sdk/python/pulumi_vsphere/get_host_pci_device.py +++ b/sdk/python/pulumi_vsphere/get_host_pci_device.py @@ -103,7 +103,19 @@ def get_host_pci_device(class_id: Optional[str] = None, `VirtualMachine`'s `pci_device_id`. ## Example Usage - + ### With Vendor ID And Class ID + + ```python + import pulumi + import pulumi_vsphere as vsphere + + datacenter = vsphere.get_datacenter(name="dc-01") + host = vsphere.get_host(name="esxi-01.example.com", + datacenter_id=datacenter.id) + dev = vsphere.get_host_pci_device(host_id=host.id, + class_id="123", + vendor_id="456") + ``` ### With Name Regular Expression @@ -146,7 +158,19 @@ def get_host_pci_device_output(class_id: Optional[pulumi.Input[Optional[str]]] = `VirtualMachine`'s `pci_device_id`. ## Example Usage - + ### With Vendor ID And Class ID + + ```python + import pulumi + import pulumi_vsphere as vsphere + + datacenter = vsphere.get_datacenter(name="dc-01") + host = vsphere.get_host(name="esxi-01.example.com", + datacenter_id=datacenter.id) + dev = vsphere.get_host_pci_device(host_id=host.id, + class_id="123", + vendor_id="456") + ``` ### With Name Regular Expression diff --git a/sdk/python/pulumi_vsphere/get_host_thumbprint.py b/sdk/python/pulumi_vsphere/get_host_thumbprint.py index 8ddf1aab..0e206092 100644 --- a/sdk/python/pulumi_vsphere/get_host_thumbprint.py +++ b/sdk/python/pulumi_vsphere/get_host_thumbprint.py @@ -81,6 +81,15 @@ def get_host_thumbprint(address: Optional[str] = None, resource. If the ESXi host is using a certificate chain, the first one returned will be used to generate the thumbprint. + ## Example Usage + + ```python + import pulumi + import pulumi_vsphere as vsphere + + thumbprint = vsphere.get_host_thumbprint(address="esxi-01.example.com") + ``` + :param str address: The address of the ESXi host to retrieve the thumbprint from. @@ -113,6 +122,15 @@ def get_host_thumbprint_output(address: Optional[pulumi.Input[str]] = None, resource. If the ESXi host is using a certificate chain, the first one returned will be used to generate the thumbprint. + ## Example Usage + + ```python + import pulumi + import pulumi_vsphere as vsphere + + thumbprint = vsphere.get_host_thumbprint(address="esxi-01.example.com") + ``` + :param str address: The address of the ESXi host to retrieve the thumbprint from. diff --git a/sdk/python/pulumi_vsphere/get_license.py b/sdk/python/pulumi_vsphere/get_license.py index c2465345..4d7fe06e 100644 --- a/sdk/python/pulumi_vsphere/get_license.py +++ b/sdk/python/pulumi_vsphere/get_license.py @@ -116,6 +116,15 @@ def get_license(license_key: Optional[str] = None, The `License` data source can be used to get the general attributes of a license keys from a vCenter Server instance. + ## Example Usage + + ```python + import pulumi + import pulumi_vsphere as vsphere + + license = vsphere.get_license(license_key="00000-00000-00000-00000-00000") + ``` + :param str license_key: The license key. """ @@ -141,6 +150,15 @@ def get_license_output(license_key: Optional[pulumi.Input[str]] = None, The `License` data source can be used to get the general attributes of a license keys from a vCenter Server instance. + ## Example Usage + + ```python + import pulumi + import pulumi_vsphere as vsphere + + license = vsphere.get_license(license_key="00000-00000-00000-00000-00000") + ``` + :param str license_key: The license key. """ diff --git a/sdk/python/pulumi_vsphere/get_network.py b/sdk/python/pulumi_vsphere/get_network.py index f48d7edb..1b3a2a97 100644 --- a/sdk/python/pulumi_vsphere/get_network.py +++ b/sdk/python/pulumi_vsphere/get_network.py @@ -97,6 +97,17 @@ def get_network(datacenter_id: Optional[str] = None, that requires a network. This includes standard (host-based) port groups, distributed port groups, or opaque networks such as those managed by NSX. + ## Example Usage + + ```python + import pulumi + import pulumi_vsphere as vsphere + + datacenter = vsphere.get_datacenter(name="dc-01") + network = vsphere.get_network(name="VM Network", + datacenter_id=datacenter.id) + ``` + :param str datacenter_id: The managed object reference ID of the datacenter the network is located in. This can be omitted if the @@ -135,6 +146,17 @@ def get_network_output(datacenter_id: Optional[pulumi.Input[Optional[str]]] = No that requires a network. This includes standard (host-based) port groups, distributed port groups, or opaque networks such as those managed by NSX. + ## Example Usage + + ```python + import pulumi + import pulumi_vsphere as vsphere + + datacenter = vsphere.get_datacenter(name="dc-01") + network = vsphere.get_network(name="VM Network", + datacenter_id=datacenter.id) + ``` + :param str datacenter_id: The managed object reference ID of the datacenter the network is located in. This can be omitted if the diff --git a/sdk/python/pulumi_vsphere/get_policy.py b/sdk/python/pulumi_vsphere/get_policy.py index 69ef212f..85f0641d 100644 --- a/sdk/python/pulumi_vsphere/get_policy.py +++ b/sdk/python/pulumi_vsphere/get_policy.py @@ -63,6 +63,16 @@ def get_policy(name: Optional[str] = None, > **NOTE:** Storage policies are not supported on direct ESXi hosts and requires vCenter Server. + ## Example Usage + + ```python + import pulumi + import pulumi_vsphere as vsphere + + prod_platinum_replicated = vsphere.get_policy(name="prod_platinum_replicated") + dev_silver_nonreplicated = vsphere.get_policy(name="dev_silver_nonreplicated") + ``` + :param str name: The name of the storage policy. """ @@ -87,6 +97,16 @@ def get_policy_output(name: Optional[pulumi.Input[str]] = None, > **NOTE:** Storage policies are not supported on direct ESXi hosts and requires vCenter Server. + ## Example Usage + + ```python + import pulumi + import pulumi_vsphere as vsphere + + prod_platinum_replicated = vsphere.get_policy(name="prod_platinum_replicated") + dev_silver_nonreplicated = vsphere.get_policy(name="dev_silver_nonreplicated") + ``` + :param str name: The name of the storage policy. """ diff --git a/sdk/python/pulumi_vsphere/get_resource_pool.py b/sdk/python/pulumi_vsphere/get_resource_pool.py index 7f8f3d03..d900773d 100644 --- a/sdk/python/pulumi_vsphere/get_resource_pool.py +++ b/sdk/python/pulumi_vsphere/get_resource_pool.py @@ -71,6 +71,38 @@ def get_resource_pool(datacenter_id: Optional[str] = None, that you want to use to create virtual machines in using the `VirtualMachine` resource. + ## Example Usage + + ```python + import pulumi + import pulumi_vsphere as vsphere + + datacenter = vsphere.get_datacenter(name="dc-01") + pool = vsphere.get_resource_pool(name="resource-pool-01", + datacenter_id=datacenter.id) + ``` + ### Specifying the Root Resource Pool for a Standalone ESXi Host + + > **NOTE:** Returning the root resource pool for a cluster can be done + directly via the `ComputeCluster` + data source. + + All compute resources in vSphere have a resource pool, even if one has not been + explicitly created. This resource pool is referred to as the + _root resource pool_ and can be looked up by specifying the path. + + ```python + import pulumi + import pulumi_vsphere as vsphere + + pool = vsphere.get_resource_pool(name="esxi-01.example.com/Resources", + datacenter_id=data["vsphere_datacenter"]["datacenter"]["id"]) + ``` + + For more information on the root resource pool, see [Managing Resource Pools][vmware-docs-resource-pools] in the vSphere documentation. + + [vmware-docs-resource-pools]: https://docs.vmware.com/en/VMware-vSphere/7.0/com.vmware.vsphere.resmgmt.doc/GUID-60077B40-66FF-4625-934A-641703ED7601.html + :param str datacenter_id: The managed object reference ID of the datacenter in which the resource pool is located. This can be omitted @@ -106,6 +138,38 @@ def get_resource_pool_output(datacenter_id: Optional[pulumi.Input[Optional[str]] that you want to use to create virtual machines in using the `VirtualMachine` resource. + ## Example Usage + + ```python + import pulumi + import pulumi_vsphere as vsphere + + datacenter = vsphere.get_datacenter(name="dc-01") + pool = vsphere.get_resource_pool(name="resource-pool-01", + datacenter_id=datacenter.id) + ``` + ### Specifying the Root Resource Pool for a Standalone ESXi Host + + > **NOTE:** Returning the root resource pool for a cluster can be done + directly via the `ComputeCluster` + data source. + + All compute resources in vSphere have a resource pool, even if one has not been + explicitly created. This resource pool is referred to as the + _root resource pool_ and can be looked up by specifying the path. + + ```python + import pulumi + import pulumi_vsphere as vsphere + + pool = vsphere.get_resource_pool(name="esxi-01.example.com/Resources", + datacenter_id=data["vsphere_datacenter"]["datacenter"]["id"]) + ``` + + For more information on the root resource pool, see [Managing Resource Pools][vmware-docs-resource-pools] in the vSphere documentation. + + [vmware-docs-resource-pools]: https://docs.vmware.com/en/VMware-vSphere/7.0/com.vmware.vsphere.resmgmt.doc/GUID-60077B40-66FF-4625-934A-641703ED7601.html + :param str datacenter_id: The managed object reference ID of the datacenter in which the resource pool is located. This can be omitted diff --git a/sdk/python/pulumi_vsphere/get_role.py b/sdk/python/pulumi_vsphere/get_role.py index 32b3c023..ade2852c 100644 --- a/sdk/python/pulumi_vsphere/get_role.py +++ b/sdk/python/pulumi_vsphere/get_role.py @@ -98,6 +98,15 @@ def get_role(description: Optional[str] = None, The `Role` data source can be used to discover the `id` and privileges associated with a role given its name or display label. + ## Example Usage + + ```python + import pulumi + import pulumi_vsphere as vsphere + + terraform_role = vsphere.get_role(label="Terraform to vSphere Integration Role") + ``` + :param str description: The description of the role. :param str label: The label of the role. @@ -129,6 +138,15 @@ def get_role_output(description: Optional[pulumi.Input[Optional[str]]] = None, The `Role` data source can be used to discover the `id` and privileges associated with a role given its name or display label. + ## Example Usage + + ```python + import pulumi + import pulumi_vsphere as vsphere + + terraform_role = vsphere.get_role(label="Terraform to vSphere Integration Role") + ``` + :param str description: The description of the role. :param str label: The label of the role. diff --git a/sdk/python/pulumi_vsphere/get_tag.py b/sdk/python/pulumi_vsphere/get_tag.py index 5c5b8f42..14e64fd7 100644 --- a/sdk/python/pulumi_vsphere/get_tag.py +++ b/sdk/python/pulumi_vsphere/get_tag.py @@ -84,6 +84,17 @@ def get_tag(category_id: Optional[str] = None, > **NOTE:** Tagging is not supported on direct ESXi hosts connections and requires vCenter Server. + ## Example Usage + + ```python + import pulumi + import pulumi_vsphere as vsphere + + category = vsphere.get_tag_category(name="example-category") + tag = vsphere.get_tag(name="example-tag", + category_id=category.id) + ``` + :param str category_id: The ID of the tag category in which the tag is located. @@ -116,6 +127,17 @@ def get_tag_output(category_id: Optional[pulumi.Input[str]] = None, > **NOTE:** Tagging is not supported on direct ESXi hosts connections and requires vCenter Server. + ## Example Usage + + ```python + import pulumi + import pulumi_vsphere as vsphere + + category = vsphere.get_tag_category(name="example-category") + tag = vsphere.get_tag(name="example-tag", + category_id=category.id) + ``` + :param str category_id: The ID of the tag category in which the tag is located. diff --git a/sdk/python/pulumi_vsphere/get_tag_category.py b/sdk/python/pulumi_vsphere/get_tag_category.py index 4ba15bfc..368dfb8d 100644 --- a/sdk/python/pulumi_vsphere/get_tag_category.py +++ b/sdk/python/pulumi_vsphere/get_tag_category.py @@ -92,6 +92,15 @@ def get_tag_category(name: Optional[str] = None, > **NOTE:** Tagging is not supported on direct ESXi hosts connections and requires vCenter Server. + ## Example Usage + + ```python + import pulumi + import pulumi_vsphere as vsphere + + category = vsphere.get_tag_category(name="example-category") + ``` + :param str name: The name of the tag category. """ @@ -121,6 +130,15 @@ def get_tag_category_output(name: Optional[pulumi.Input[str]] = None, > **NOTE:** Tagging is not supported on direct ESXi hosts connections and requires vCenter Server. + ## Example Usage + + ```python + import pulumi + import pulumi_vsphere as vsphere + + category = vsphere.get_tag_category(name="example-category") + ``` + :param str name: The name of the tag category. """ diff --git a/sdk/python/pulumi_vsphere/get_vapp_container.py b/sdk/python/pulumi_vsphere/get_vapp_container.py index 717bfefe..c78fa1d9 100644 --- a/sdk/python/pulumi_vsphere/get_vapp_container.py +++ b/sdk/python/pulumi_vsphere/get_vapp_container.py @@ -71,6 +71,17 @@ def get_vapp_container(datacenter_id: Optional[str] = None, that you want to use to create virtual machines in using the `VirtualMachine` resource. + ## Example Usage + + ```python + import pulumi + import pulumi_vsphere as vsphere + + datacenter = vsphere.get_datacenter(name="dc-01") + pool = vsphere.get_vapp_container(name="vapp-container-01", + datacenter_id=datacenter.id) + ``` + :param str datacenter_id: The managed object reference ID of the datacenter in which the vApp container is located. @@ -99,6 +110,17 @@ def get_vapp_container_output(datacenter_id: Optional[pulumi.Input[str]] = None, that you want to use to create virtual machines in using the `VirtualMachine` resource. + ## Example Usage + + ```python + import pulumi + import pulumi_vsphere as vsphere + + datacenter = vsphere.get_datacenter(name="dc-01") + pool = vsphere.get_vapp_container(name="vapp-container-01", + datacenter_id=datacenter.id) + ``` + :param str datacenter_id: The managed object reference ID of the datacenter in which the vApp container is located. diff --git a/sdk/python/pulumi_vsphere/get_virtual_machine.py b/sdk/python/pulumi_vsphere/get_virtual_machine.py index f615121b..8b3878c7 100644 --- a/sdk/python/pulumi_vsphere/get_virtual_machine.py +++ b/sdk/python/pulumi_vsphere/get_virtual_machine.py @@ -737,6 +737,33 @@ def get_virtual_machine(alternate_guest_name: Optional[str] = None, `VirtualMachine` resource. It also reads the guest ID so that can be supplied as well. + ## Example Usage + + In the following example, a virtual machine template is returned by its + unique name within the `Datacenter`. + + ```python + import pulumi + import pulumi_vsphere as vsphere + + datacenter = vsphere.get_datacenter(name="dc-01") + template = vsphere.get_virtual_machine(name="ubuntu-server-template", + datacenter_id=datacenter.id) + ``` + In the following example, each virtual machine template is returned by its + unique full path within the `Datacenter`. + + ```python + import pulumi + import pulumi_vsphere as vsphere + + datacenter = vsphere.get_datacenter(name="dc-01") + production_template = vsphere.get_virtual_machine(name="production/templates/ubuntu-server-template", + datacenter_id=datacenter.id) + development_template = vsphere.get_virtual_machine(name="development/templates/ubuntu-server-template", + datacenter_id=datacenter.id) + ``` + :param str alternate_guest_name: The alternate guest name of the virtual machine when `guest_id` is a non-specific operating system, like `otherGuest` or `otherGuest64`. @@ -952,6 +979,33 @@ def get_virtual_machine_output(alternate_guest_name: Optional[pulumi.Input[Optio `VirtualMachine` resource. It also reads the guest ID so that can be supplied as well. + ## Example Usage + + In the following example, a virtual machine template is returned by its + unique name within the `Datacenter`. + + ```python + import pulumi + import pulumi_vsphere as vsphere + + datacenter = vsphere.get_datacenter(name="dc-01") + template = vsphere.get_virtual_machine(name="ubuntu-server-template", + datacenter_id=datacenter.id) + ``` + In the following example, each virtual machine template is returned by its + unique full path within the `Datacenter`. + + ```python + import pulumi + import pulumi_vsphere as vsphere + + datacenter = vsphere.get_datacenter(name="dc-01") + production_template = vsphere.get_virtual_machine(name="production/templates/ubuntu-server-template", + datacenter_id=datacenter.id) + development_template = vsphere.get_virtual_machine(name="development/templates/ubuntu-server-template", + datacenter_id=datacenter.id) + ``` + :param str alternate_guest_name: The alternate guest name of the virtual machine when `guest_id` is a non-specific operating system, like `otherGuest` or `otherGuest64`. diff --git a/sdk/python/pulumi_vsphere/get_vmfs_disks.py b/sdk/python/pulumi_vsphere/get_vmfs_disks.py index 9932a175..e057cfe9 100644 --- a/sdk/python/pulumi_vsphere/get_vmfs_disks.py +++ b/sdk/python/pulumi_vsphere/get_vmfs_disks.py @@ -94,6 +94,20 @@ def get_vmfs_disks(filter: Optional[str] = None, `VmfsDatastore` resource to create VMFS datastores based off a set of discovered disks. + ## Example Usage + + ```python + import pulumi + import pulumi_vsphere as vsphere + + datacenter = vsphere.get_datacenter(name="dc-01") + host = vsphere.get_host(name="esxi-01.example.com", + datacenter_id=datacenter.id) + vmfs_disks = vsphere.get_vmfs_disks(host_system_id=host.id, + rescan=True, + filter="mpx.vmhba1:C0:T[12]:L0") + ``` + :param str filter: A regular expression to filter the disks against. Only disks with canonical names that match will be included. @@ -133,6 +147,20 @@ def get_vmfs_disks_output(filter: Optional[pulumi.Input[Optional[str]]] = None, `VmfsDatastore` resource to create VMFS datastores based off a set of discovered disks. + ## Example Usage + + ```python + import pulumi + import pulumi_vsphere as vsphere + + datacenter = vsphere.get_datacenter(name="dc-01") + host = vsphere.get_host(name="esxi-01.example.com", + datacenter_id=datacenter.id) + vmfs_disks = vsphere.get_vmfs_disks(host_system_id=host.id, + rescan=True, + filter="mpx.vmhba1:C0:T[12]:L0") + ``` + :param str filter: A regular expression to filter the disks against. Only disks with canonical names that match will be included. diff --git a/sdk/python/pulumi_vsphere/host.py b/sdk/python/pulumi_vsphere/host.py index 98fef612..964be80e 100644 --- a/sdk/python/pulumi_vsphere/host.py +++ b/sdk/python/pulumi_vsphere/host.py @@ -701,6 +701,54 @@ def __init__(__self__, can be used either as a member of a cluster or as a standalone host. ## Example Usage + ### Create a standalone host + + ```python + import pulumi + import pulumi_vsphere as vsphere + + datacenter = vsphere.get_datacenter(name="dc-01") + thumbprint = vsphere.get_host_thumbprint(address="esx-01.example.com", + insecure=True) + esx_01 = vsphere.Host("esx-01", + hostname="esx-01.example.com", + username="root", + password="password", + license="00000-00000-00000-00000-00000", + thumbprint=thumbprint.id, + datacenter=datacenter.id) + ``` + ### Create host in a compute cluster + + ```python + import pulumi + import pulumi_vsphere as vsphere + + datacenter = vsphere.get_datacenter(name="dc-01") + cluster = vsphere.get_compute_cluster(name="cluster-01", + datacenter_id=datacenter.id) + thumbprint = vsphere.get_host_thumbprint(address="esx-01.example.com", + insecure=True) + esx_01 = vsphere.Host("esx-01", + hostname="esx-01.example.com", + username="root", + password="password", + license="00000-00000-00000-00000-00000", + thumbprint=thumbprint.id, + cluster=cluster.id) + ``` + ## Importing + + An existing host can be [imported][docs-import] into this resource by supplying + the host's ID. An example is below: + + [docs-import]: /docs/import/index.html + + ```python + import pulumi + ``` + + The above would import the host with ID `host-123`. :param str resource_name: The name of the resource. :param pulumi.ResourceOptions opts: Options for the resource. @@ -759,6 +807,54 @@ def __init__(__self__, can be used either as a member of a cluster or as a standalone host. ## Example Usage + ### Create a standalone host + + ```python + import pulumi + import pulumi_vsphere as vsphere + + datacenter = vsphere.get_datacenter(name="dc-01") + thumbprint = vsphere.get_host_thumbprint(address="esx-01.example.com", + insecure=True) + esx_01 = vsphere.Host("esx-01", + hostname="esx-01.example.com", + username="root", + password="password", + license="00000-00000-00000-00000-00000", + thumbprint=thumbprint.id, + datacenter=datacenter.id) + ``` + ### Create host in a compute cluster + + ```python + import pulumi + import pulumi_vsphere as vsphere + + datacenter = vsphere.get_datacenter(name="dc-01") + cluster = vsphere.get_compute_cluster(name="cluster-01", + datacenter_id=datacenter.id) + thumbprint = vsphere.get_host_thumbprint(address="esx-01.example.com", + insecure=True) + esx_01 = vsphere.Host("esx-01", + hostname="esx-01.example.com", + username="root", + password="password", + license="00000-00000-00000-00000-00000", + thumbprint=thumbprint.id, + cluster=cluster.id) + ``` + ## Importing + + An existing host can be [imported][docs-import] into this resource by supplying + the host's ID. An example is below: + + [docs-import]: /docs/import/index.html + + ```python + import pulumi + ``` + + The above would import the host with ID `host-123`. :param str resource_name: The name of the resource. :param HostArgs args: The arguments to use to populate this resource's properties. diff --git a/sdk/python/pulumi_vsphere/host_port_group.py b/sdk/python/pulumi_vsphere/host_port_group.py index d67e41b5..45565a40 100644 --- a/sdk/python/pulumi_vsphere/host_port_group.py +++ b/sdk/python/pulumi_vsphere/host_port_group.py @@ -850,6 +850,70 @@ def __init__(__self__, [ref-vsphere-net-concepts]: https://docs.vmware.com/en/VMware-vSphere/7.0/com.vmware.vsphere.networking.doc/GUID-2B11DBB8-CB3C-4AFF-8885-EFEA0FC562F4.html + ## Example Usage + + **Create a Virtual Switch and Bind a Port Group:** + + ```python + import pulumi + import pulumi_vsphere as vsphere + + datacenter = vsphere.get_datacenter(name="dc-01") + host = vsphere.get_host(name="esxi-01.example.com", + datacenter_id=datacenter.id) + host_virtual_switch = vsphere.HostVirtualSwitch("hostVirtualSwitch", + host_system_id=host.id, + network_adapters=[ + "vmnic0", + "vmnic1", + ], + active_nics=["vmnic0"], + standby_nics=["vmnic1"]) + pg = vsphere.HostPortGroup("pg", + host_system_id=host.id, + virtual_switch_name=host_virtual_switch.name) + ``` + + **Create a Port Group with a VLAN and ab Override:** + + This example sets the trunk mode VLAN (`4095`, which passes through all tags) + and sets + `allow_promiscuous` + to ensure that all traffic is seen on the port. The setting overrides + the implicit default of `false` set on the standard switch. + + ```python + import pulumi + import pulumi_vsphere as vsphere + + datacenter = vsphere.get_datacenter(name="dc-01") + host = vsphere.get_host(name="esxi-01.example.com", + datacenter_id=datacenter.id) + host_virtual_switch = vsphere.HostVirtualSwitch("hostVirtualSwitch", + host_system_id=host.id, + network_adapters=[ + "vmnic0", + "vmnic1", + ], + active_nics=["vmnic0"], + standby_nics=["vmnic1"]) + pg = vsphere.HostPortGroup("pg", + host_system_id=host.id, + virtual_switch_name=host_virtual_switch.name, + vlan_id=4095, + allow_promiscuous=True) + ``` + ## Importing + + An existing host port group can be imported into this resource + using the host port group's ID. An example is below: + + ```python + import pulumi + ``` + + The above would import the `management` host port group from host with ID `host-123`. + :param str resource_name: The name of the resource. :param pulumi.ResourceOptions opts: Options for the resource. :param pulumi.Input[Sequence[pulumi.Input[str]]] active_nics: List of active network adapters used for load balancing. @@ -895,6 +959,70 @@ def __init__(__self__, [ref-vsphere-net-concepts]: https://docs.vmware.com/en/VMware-vSphere/7.0/com.vmware.vsphere.networking.doc/GUID-2B11DBB8-CB3C-4AFF-8885-EFEA0FC562F4.html + ## Example Usage + + **Create a Virtual Switch and Bind a Port Group:** + + ```python + import pulumi + import pulumi_vsphere as vsphere + + datacenter = vsphere.get_datacenter(name="dc-01") + host = vsphere.get_host(name="esxi-01.example.com", + datacenter_id=datacenter.id) + host_virtual_switch = vsphere.HostVirtualSwitch("hostVirtualSwitch", + host_system_id=host.id, + network_adapters=[ + "vmnic0", + "vmnic1", + ], + active_nics=["vmnic0"], + standby_nics=["vmnic1"]) + pg = vsphere.HostPortGroup("pg", + host_system_id=host.id, + virtual_switch_name=host_virtual_switch.name) + ``` + + **Create a Port Group with a VLAN and ab Override:** + + This example sets the trunk mode VLAN (`4095`, which passes through all tags) + and sets + `allow_promiscuous` + to ensure that all traffic is seen on the port. The setting overrides + the implicit default of `false` set on the standard switch. + + ```python + import pulumi + import pulumi_vsphere as vsphere + + datacenter = vsphere.get_datacenter(name="dc-01") + host = vsphere.get_host(name="esxi-01.example.com", + datacenter_id=datacenter.id) + host_virtual_switch = vsphere.HostVirtualSwitch("hostVirtualSwitch", + host_system_id=host.id, + network_adapters=[ + "vmnic0", + "vmnic1", + ], + active_nics=["vmnic0"], + standby_nics=["vmnic1"]) + pg = vsphere.HostPortGroup("pg", + host_system_id=host.id, + virtual_switch_name=host_virtual_switch.name, + vlan_id=4095, + allow_promiscuous=True) + ``` + ## Importing + + An existing host port group can be imported into this resource + using the host port group's ID. An example is below: + + ```python + import pulumi + ``` + + The above would import the `management` host port group from host with ID `host-123`. + :param str resource_name: The name of the resource. :param HostPortGroupArgs args: The arguments to use to populate this resource's properties. :param pulumi.ResourceOptions opts: Options for the resource. diff --git a/sdk/python/pulumi_vsphere/license.py b/sdk/python/pulumi_vsphere/license.py index 21fd6745..1de1cdd1 100644 --- a/sdk/python/pulumi_vsphere/license.py +++ b/sdk/python/pulumi_vsphere/license.py @@ -207,6 +207,20 @@ def __init__(__self__, """ Provides a VMware vSphere license resource. This can be used to add and remove license keys. + ## Example Usage + + ```python + import pulumi + import pulumi_vsphere as vsphere + + license_key = vsphere.License("licenseKey", + labels={ + "VpxClientLicenseLabel": "Hello World", + "Workflow": "Hello World", + }, + license_key="452CQ-2EK54-K8742-00000-00000") + ``` + :param str resource_name: The name of the resource. :param pulumi.ResourceOptions opts: Options for the resource. :param pulumi.Input[Mapping[str, pulumi.Input[str]]] labels: A map of key/value pairs to be attached as labels (tags) to the license key. @@ -221,6 +235,20 @@ def __init__(__self__, """ Provides a VMware vSphere license resource. This can be used to add and remove license keys. + ## Example Usage + + ```python + import pulumi + import pulumi_vsphere as vsphere + + license_key = vsphere.License("licenseKey", + labels={ + "VpxClientLicenseLabel": "Hello World", + "Workflow": "Hello World", + }, + license_key="452CQ-2EK54-K8742-00000-00000") + ``` + :param str resource_name: The name of the resource. :param LicenseArgs args: The arguments to use to populate this resource's properties. :param pulumi.ResourceOptions opts: Options for the resource. diff --git a/sdk/python/pulumi_vsphere/outputs.py b/sdk/python/pulumi_vsphere/outputs.py index 1d32b6ac..aca3c978 100644 --- a/sdk/python/pulumi_vsphere/outputs.py +++ b/sdk/python/pulumi_vsphere/outputs.py @@ -49,6 +49,31 @@ def __init__(__self__, *, > **NOTE:** You must disable vSphere HA before you enable vSAN on the cluster. You can enable or re-enable vSphere HA after vSAN is configured. + + ```python + import pulumi + import pulumi_vsphere as vsphere + + compute_cluster = vsphere.ComputeCluster("computeCluster", + datacenter_id=data["vsphere_datacenter"]["datacenter"]["id"], + host_system_ids=[[__item["id"] for __item in data["vsphere_host"]["host"]]], + drs_enabled=True, + drs_automation_level="fullyAutomated", + ha_enabled=False, + vsan_enabled=True, + vsan_dedup_enabled=True, + vsan_compression_enabled=True, + vsan_performance_enabled=True, + vsan_verbose_mode_enabled=True, + vsan_network_diagnostic_mode_enabled=True, + vsan_unmap_enabled=True, + vsan_dit_encryption_enabled=True, + vsan_dit_rekey_interval=1800, + vsan_disk_groups=[vsphere.ComputeClusterVsanDiskGroupArgs( + cache=data["vsphere_vmfs_disks"]["cache_disks"], + storages=data["vsphere_vmfs_disks"]["storage_disks"], + )]) + ``` """ ComputeClusterVsanDiskGroup._configure( lambda key, value: pulumi.set(__self__, key, value), @@ -84,6 +109,31 @@ def storages(self) -> Optional[Sequence[str]]: > **NOTE:** You must disable vSphere HA before you enable vSAN on the cluster. You can enable or re-enable vSphere HA after vSAN is configured. + + ```python + import pulumi + import pulumi_vsphere as vsphere + + compute_cluster = vsphere.ComputeCluster("computeCluster", + datacenter_id=data["vsphere_datacenter"]["datacenter"]["id"], + host_system_ids=[[__item["id"] for __item in data["vsphere_host"]["host"]]], + drs_enabled=True, + drs_automation_level="fullyAutomated", + ha_enabled=False, + vsan_enabled=True, + vsan_dedup_enabled=True, + vsan_compression_enabled=True, + vsan_performance_enabled=True, + vsan_verbose_mode_enabled=True, + vsan_network_diagnostic_mode_enabled=True, + vsan_unmap_enabled=True, + vsan_dit_encryption_enabled=True, + vsan_dit_rekey_interval=1800, + vsan_disk_groups=[vsphere.ComputeClusterVsanDiskGroupArgs( + cache=data["vsphere_vmfs_disks"]["cache_disks"], + storages=data["vsphere_vmfs_disks"]["storage_disks"], + )]) + ``` """ return pulumi.get(self, "storages") diff --git a/sdk/python/pulumi_vsphere/resource_pool.py b/sdk/python/pulumi_vsphere/resource_pool.py index b06e6793..b51f3d0c 100644 --- a/sdk/python/pulumi_vsphere/resource_pool.py +++ b/sdk/python/pulumi_vsphere/resource_pool.py @@ -784,6 +784,46 @@ def __init__(__self__, [ref-vsphere-resource_pools]: https://docs.vmware.com/en/VMware-vSphere/7.0/com.vmware.vsphere.resmgmt.doc/GUID-60077B40-66FF-4625-934A-641703ED7601.html + ## Example Usage + + The following example sets up a resource pool in an existing compute cluster + with the default settings for CPU and memory reservations, shares, and limits. + + ```python + import pulumi + import pulumi_vsphere as vsphere + + datacenter = vsphere.get_datacenter(name="dc-01") + compute_cluster = vsphere.get_compute_cluster(name="cluster-01", + datacenter_id=datacenter.id) + resource_pool = vsphere.ResourcePool("resourcePool", parent_resource_pool_id=compute_cluster.resource_pool_id) + ``` + + A virtual machine resource could be targeted to use the default resource pool + of the cluster using the following: + + ```python + import pulumi + import pulumi_vsphere as vsphere + + vm = vsphere.VirtualMachine("vm", resource_pool_id=data["vsphere_compute_cluster"]["cluster"]["resource_pool_id"]) + # ... other configuration ... + ``` + + The following example sets up a parent resource pool in an existing compute cluster + with a child resource pool nested below. Each resource pool is configured with + the default settings for CPU and memory reservations, shares, and limits. + + ```python + import pulumi + import pulumi_vsphere as vsphere + + datacenter = vsphere.get_datacenter(name="dc-01") + compute_cluster = vsphere.get_compute_cluster(name="cluster-01", + datacenter_id=datacenter.id) + resource_pool_parent = vsphere.ResourcePool("resourcePoolParent", parent_resource_pool_id=compute_cluster.resource_pool_id) + resource_pool_child = vsphere.ResourcePool("resourcePoolChild", parent_resource_pool_id=resource_pool_parent.id) + ``` ## Importing ### Settings that Require vSphere 7.0 or higher @@ -853,6 +893,46 @@ def __init__(__self__, [ref-vsphere-resource_pools]: https://docs.vmware.com/en/VMware-vSphere/7.0/com.vmware.vsphere.resmgmt.doc/GUID-60077B40-66FF-4625-934A-641703ED7601.html + ## Example Usage + + The following example sets up a resource pool in an existing compute cluster + with the default settings for CPU and memory reservations, shares, and limits. + + ```python + import pulumi + import pulumi_vsphere as vsphere + + datacenter = vsphere.get_datacenter(name="dc-01") + compute_cluster = vsphere.get_compute_cluster(name="cluster-01", + datacenter_id=datacenter.id) + resource_pool = vsphere.ResourcePool("resourcePool", parent_resource_pool_id=compute_cluster.resource_pool_id) + ``` + + A virtual machine resource could be targeted to use the default resource pool + of the cluster using the following: + + ```python + import pulumi + import pulumi_vsphere as vsphere + + vm = vsphere.VirtualMachine("vm", resource_pool_id=data["vsphere_compute_cluster"]["cluster"]["resource_pool_id"]) + # ... other configuration ... + ``` + + The following example sets up a parent resource pool in an existing compute cluster + with a child resource pool nested below. Each resource pool is configured with + the default settings for CPU and memory reservations, shares, and limits. + + ```python + import pulumi + import pulumi_vsphere as vsphere + + datacenter = vsphere.get_datacenter(name="dc-01") + compute_cluster = vsphere.get_compute_cluster(name="cluster-01", + datacenter_id=datacenter.id) + resource_pool_parent = vsphere.ResourcePool("resourcePoolParent", parent_resource_pool_id=compute_cluster.resource_pool_id) + resource_pool_child = vsphere.ResourcePool("resourcePoolChild", parent_resource_pool_id=resource_pool_parent.id) + ``` ## Importing ### Settings that Require vSphere 7.0 or higher diff --git a/sdk/python/pulumi_vsphere/virtual_machine_snapshot.py b/sdk/python/pulumi_vsphere/virtual_machine_snapshot.py index dab62f64..af89f99d 100644 --- a/sdk/python/pulumi_vsphere/virtual_machine_snapshot.py +++ b/sdk/python/pulumi_vsphere/virtual_machine_snapshot.py @@ -374,6 +374,22 @@ def __init__(__self__, [ext-vm-snap-limitations]: https://docs.vmware.com/en/VMware-vSphere/7.0/com.vmware.vsphere.vm_admin.doc/GUID-53F65726-A23B-4CF0-A7D5-48E584B88613.html + ## Example Usage + + ```python + import pulumi + import pulumi_vsphere as vsphere + + demo1 = vsphere.VirtualMachineSnapshot("demo1", + consolidate=True, + description="This is Demo Snapshot", + memory=True, + quiesce=True, + remove_children=False, + snapshot_name="Snapshot Name", + virtual_machine_uuid="9aac5551-a351-4158-8c5c-15a71e8ec5c9") + ``` + :param str resource_name: The name of the resource. :param pulumi.ResourceOptions opts: Options for the resource. :param pulumi.Input[bool] consolidate: If set to `true`, the delta disks involved in this @@ -419,6 +435,22 @@ def __init__(__self__, [ext-vm-snap-limitations]: https://docs.vmware.com/en/VMware-vSphere/7.0/com.vmware.vsphere.vm_admin.doc/GUID-53F65726-A23B-4CF0-A7D5-48E584B88613.html + ## Example Usage + + ```python + import pulumi + import pulumi_vsphere as vsphere + + demo1 = vsphere.VirtualMachineSnapshot("demo1", + consolidate=True, + description="This is Demo Snapshot", + memory=True, + quiesce=True, + remove_children=False, + snapshot_name="Snapshot Name", + virtual_machine_uuid="9aac5551-a351-4158-8c5c-15a71e8ec5c9") + ``` + :param str resource_name: The name of the resource. :param VirtualMachineSnapshotArgs args: The arguments to use to populate this resource's properties. :param pulumi.ResourceOptions opts: Options for the resource. diff --git a/sdk/python/pulumi_vsphere/vm_storage_policy.py b/sdk/python/pulumi_vsphere/vm_storage_policy.py index 5abd306b..d91e3b9c 100644 --- a/sdk/python/pulumi_vsphere/vm_storage_policy.py +++ b/sdk/python/pulumi_vsphere/vm_storage_policy.py @@ -174,6 +174,107 @@ def __init__(__self__, policies. Using this resource, tag based placement rules can be created to place virtual machines on a datastore with matching tags. If storage requirements for the applications on the virtual machine change, you can modify the storage policy that was originally applied to the virtual machine. + ## Example Usage + + The following example creates storage policies with `tag_rules` base on sets of environment, service level, and replication attributes. + + In this example, tags are first applied to datastores. + + ```python + import pulumi + import pulumi_vsphere as vsphere + + environment = vsphere.get_tag_category(name="environment") + service_level = vsphere.get_tag_category(name="service_level") + replication = vsphere.get_tag_category(name="replication") + production = vsphere.get_tag(category_id="data.vsphere_tag_category.environment.id", + name="production") + development = vsphere.get_tag(category_id="data.vsphere_tag_category.environment.id", + name="development") + platinum = vsphere.get_tag(category_id="data.vsphere_tag_category.service_level.id", + name="platinum") + gold = vsphere.get_tag(category_id="data.vsphere_tag_category.service_level.id", + name="platinum") + silver = vsphere.get_tag(category_id="data.vsphere_tag_category.service_level.id", + name="silver") + bronze = vsphere.get_tag(category_id="data.vsphere_tag_category.service_level.id", + name="bronze") + replicated = vsphere.get_tag(category_id="data.vsphere_tag_category.replication.id", + name="replicated") + non_replicated = vsphere.get_tag(category_id="data.vsphere_tag_category.replication.id", + name="non_replicated") + prod_datastore = vsphere.VmfsDatastore("prodDatastore", tags=[ + "data.vsphere_tag.production.id", + "data.vsphere_tag.platinum.id", + "data.vsphere_tag.replicated.id", + ]) + dev_datastore = vsphere.NasDatastore("devDatastore", tags=[ + "data.vsphere_tag.development.id", + "data.vsphere_tag.silver.id", + "data.vsphere_tag.non_replicated.id", + ]) + ``` + + Next, storage policies are created and `tag_rules` are applied. + + ```python + import pulumi + import pulumi_vsphere as vsphere + + prod_platinum_replicated = vsphere.VmStoragePolicy("prodPlatinumReplicated", + description="prod_platinum_replicated", + tag_rules=[ + vsphere.VmStoragePolicyTagRuleArgs( + tag_category=data["vsphere_tag_category"]["environment"]["name"], + tags=[data["vsphere_tag"]["production"]["name"]], + include_datastores_with_tags=True, + ), + vsphere.VmStoragePolicyTagRuleArgs( + tag_category=data["vsphere_tag_category"]["service_level"]["name"], + tags=[data["vsphere_tag"]["platinum"]["name"]], + include_datastores_with_tags=True, + ), + vsphere.VmStoragePolicyTagRuleArgs( + tag_category=data["vsphere_tag_category"]["replication"]["name"], + tags=[data["vsphere_tag"]["replicated"]["name"]], + include_datastores_with_tags=True, + ), + ]) + dev_silver_nonreplicated = vsphere.VmStoragePolicy("devSilverNonreplicated", + description="dev_silver_nonreplicated", + tag_rules=[ + vsphere.VmStoragePolicyTagRuleArgs( + tag_category=data["vsphere_tag_category"]["environment"]["name"], + tags=[data["vsphere_tag"]["development"]["name"]], + include_datastores_with_tags=True, + ), + vsphere.VmStoragePolicyTagRuleArgs( + tag_category=data["vsphere_tag_category"]["service_level"]["name"], + tags=[data["vsphere_tag"]["silver"]["name"]], + include_datastores_with_tags=True, + ), + vsphere.VmStoragePolicyTagRuleArgs( + tag_category=data["vsphere_tag_category"]["replication"]["name"], + tags=[data["vsphere_tag"]["non_replicated"]["name"]], + include_datastores_with_tags=True, + ), + ]) + ``` + + Lasttly, when creating a virtual machine resource, a storage policy can be specificed to direct virtual machine placement to a datastore which matches the policy's `tags_rules`. + + ```python + import pulumi + import pulumi_vsphere as vsphere + + prod_platinum_replicated = vsphere.get_policy(name="prod_platinum_replicated") + dev_silver_nonreplicated = vsphere.get_policy(name="dev_silver_nonreplicated") + prod_vm = vsphere.VirtualMachine("prodVm", storage_policy_id=data["vsphere_storage_policy"]["storage_policy"]["prod_platinum_replicated"]["id"]) + # ... other configuration ... + dev_vm = vsphere.VirtualMachine("devVm", storage_policy_id=data["vsphere_storage_policy"]["storage_policy"]["dev_silver_nonreplicated"]["id"]) + # ... other configuration ... + ``` + :param str resource_name: The name of the resource. :param pulumi.ResourceOptions opts: Options for the resource. :param pulumi.Input[str] description: Description of the storage policy. @@ -191,6 +292,107 @@ def __init__(__self__, policies. Using this resource, tag based placement rules can be created to place virtual machines on a datastore with matching tags. If storage requirements for the applications on the virtual machine change, you can modify the storage policy that was originally applied to the virtual machine. + ## Example Usage + + The following example creates storage policies with `tag_rules` base on sets of environment, service level, and replication attributes. + + In this example, tags are first applied to datastores. + + ```python + import pulumi + import pulumi_vsphere as vsphere + + environment = vsphere.get_tag_category(name="environment") + service_level = vsphere.get_tag_category(name="service_level") + replication = vsphere.get_tag_category(name="replication") + production = vsphere.get_tag(category_id="data.vsphere_tag_category.environment.id", + name="production") + development = vsphere.get_tag(category_id="data.vsphere_tag_category.environment.id", + name="development") + platinum = vsphere.get_tag(category_id="data.vsphere_tag_category.service_level.id", + name="platinum") + gold = vsphere.get_tag(category_id="data.vsphere_tag_category.service_level.id", + name="platinum") + silver = vsphere.get_tag(category_id="data.vsphere_tag_category.service_level.id", + name="silver") + bronze = vsphere.get_tag(category_id="data.vsphere_tag_category.service_level.id", + name="bronze") + replicated = vsphere.get_tag(category_id="data.vsphere_tag_category.replication.id", + name="replicated") + non_replicated = vsphere.get_tag(category_id="data.vsphere_tag_category.replication.id", + name="non_replicated") + prod_datastore = vsphere.VmfsDatastore("prodDatastore", tags=[ + "data.vsphere_tag.production.id", + "data.vsphere_tag.platinum.id", + "data.vsphere_tag.replicated.id", + ]) + dev_datastore = vsphere.NasDatastore("devDatastore", tags=[ + "data.vsphere_tag.development.id", + "data.vsphere_tag.silver.id", + "data.vsphere_tag.non_replicated.id", + ]) + ``` + + Next, storage policies are created and `tag_rules` are applied. + + ```python + import pulumi + import pulumi_vsphere as vsphere + + prod_platinum_replicated = vsphere.VmStoragePolicy("prodPlatinumReplicated", + description="prod_platinum_replicated", + tag_rules=[ + vsphere.VmStoragePolicyTagRuleArgs( + tag_category=data["vsphere_tag_category"]["environment"]["name"], + tags=[data["vsphere_tag"]["production"]["name"]], + include_datastores_with_tags=True, + ), + vsphere.VmStoragePolicyTagRuleArgs( + tag_category=data["vsphere_tag_category"]["service_level"]["name"], + tags=[data["vsphere_tag"]["platinum"]["name"]], + include_datastores_with_tags=True, + ), + vsphere.VmStoragePolicyTagRuleArgs( + tag_category=data["vsphere_tag_category"]["replication"]["name"], + tags=[data["vsphere_tag"]["replicated"]["name"]], + include_datastores_with_tags=True, + ), + ]) + dev_silver_nonreplicated = vsphere.VmStoragePolicy("devSilverNonreplicated", + description="dev_silver_nonreplicated", + tag_rules=[ + vsphere.VmStoragePolicyTagRuleArgs( + tag_category=data["vsphere_tag_category"]["environment"]["name"], + tags=[data["vsphere_tag"]["development"]["name"]], + include_datastores_with_tags=True, + ), + vsphere.VmStoragePolicyTagRuleArgs( + tag_category=data["vsphere_tag_category"]["service_level"]["name"], + tags=[data["vsphere_tag"]["silver"]["name"]], + include_datastores_with_tags=True, + ), + vsphere.VmStoragePolicyTagRuleArgs( + tag_category=data["vsphere_tag_category"]["replication"]["name"], + tags=[data["vsphere_tag"]["non_replicated"]["name"]], + include_datastores_with_tags=True, + ), + ]) + ``` + + Lasttly, when creating a virtual machine resource, a storage policy can be specificed to direct virtual machine placement to a datastore which matches the policy's `tags_rules`. + + ```python + import pulumi + import pulumi_vsphere as vsphere + + prod_platinum_replicated = vsphere.get_policy(name="prod_platinum_replicated") + dev_silver_nonreplicated = vsphere.get_policy(name="dev_silver_nonreplicated") + prod_vm = vsphere.VirtualMachine("prodVm", storage_policy_id=data["vsphere_storage_policy"]["storage_policy"]["prod_platinum_replicated"]["id"]) + # ... other configuration ... + dev_vm = vsphere.VirtualMachine("devVm", storage_policy_id=data["vsphere_storage_policy"]["storage_policy"]["dev_silver_nonreplicated"]["id"]) + # ... other configuration ... + ``` + :param str resource_name: The name of the resource. :param VmStoragePolicyArgs args: The arguments to use to populate this resource's properties. :param pulumi.ResourceOptions opts: Options for the resource. diff --git a/sdk/python/pulumi_vsphere/vnic.py b/sdk/python/pulumi_vsphere/vnic.py index 65134868..87bdd7fb 100644 --- a/sdk/python/pulumi_vsphere/vnic.py +++ b/sdk/python/pulumi_vsphere/vnic.py @@ -438,6 +438,76 @@ def __init__(__self__, ## Example Usage ### S + ### Create a vnic attached to a distributed virtual switch using the vmotion TCP/IP stack + + ```python + import pulumi + import pulumi_vsphere as vsphere + + dc = vsphere.get_datacenter(name="mydc") + h1 = vsphere.get_host(name="esxi1.host.test", + datacenter_id=dc.id) + d1 = vsphere.DistributedVirtualSwitch("d1", + datacenter_id=dc.id, + hosts=[vsphere.DistributedVirtualSwitchHostArgs( + host_system_id=h1.id, + devices=["vnic3"], + )]) + p1 = vsphere.DistributedPortGroup("p1", + vlan_id=1234, + distributed_virtual_switch_uuid=d1.id) + v1 = vsphere.Vnic("v1", + host=h1.id, + distributed_switch_port=d1.id, + distributed_port_group=p1.id, + ipv4=vsphere.VnicIpv4Args( + dhcp=True, + ), + netstack="vmotion") + ``` + ### Create a vnic attached to a portgroup using the default TCP/IP stack + + ```python + import pulumi + import pulumi_vsphere as vsphere + + dc = vsphere.get_datacenter(name="mydc") + h1 = vsphere.get_host(name="esxi1.host.test", + datacenter_id=dc.id) + hvs1 = vsphere.HostVirtualSwitch("hvs1", + host_system_id=h1.id, + network_adapters=[ + "vmnic3", + "vmnic4", + ], + active_nics=["vmnic3"], + standby_nics=["vmnic4"]) + p1 = vsphere.HostPortGroup("p1", + virtual_switch_name=hvs1.name, + host_system_id=h1.id) + v1 = vsphere.Vnic("v1", + host=h1.id, + portgroup=p1.name, + ipv4=vsphere.VnicIpv4Args( + dhcp=True, + ), + services=[ + "vsan", + "management", + ]) + ``` + ## Importing + + An existing vNic can be [imported][docs-import] into this resource + via supplying the vNic's ID. An example is below: + + [docs-import]: /docs/import/index.html + + ```python + import pulumi + ``` + + The above would import the vnic `vmk2` from host with ID `host-123`. :param str resource_name: The name of the resource. :param pulumi.ResourceOptions opts: Options for the resource. @@ -464,6 +534,76 @@ def __init__(__self__, ## Example Usage ### S + ### Create a vnic attached to a distributed virtual switch using the vmotion TCP/IP stack + + ```python + import pulumi + import pulumi_vsphere as vsphere + + dc = vsphere.get_datacenter(name="mydc") + h1 = vsphere.get_host(name="esxi1.host.test", + datacenter_id=dc.id) + d1 = vsphere.DistributedVirtualSwitch("d1", + datacenter_id=dc.id, + hosts=[vsphere.DistributedVirtualSwitchHostArgs( + host_system_id=h1.id, + devices=["vnic3"], + )]) + p1 = vsphere.DistributedPortGroup("p1", + vlan_id=1234, + distributed_virtual_switch_uuid=d1.id) + v1 = vsphere.Vnic("v1", + host=h1.id, + distributed_switch_port=d1.id, + distributed_port_group=p1.id, + ipv4=vsphere.VnicIpv4Args( + dhcp=True, + ), + netstack="vmotion") + ``` + ### Create a vnic attached to a portgroup using the default TCP/IP stack + + ```python + import pulumi + import pulumi_vsphere as vsphere + + dc = vsphere.get_datacenter(name="mydc") + h1 = vsphere.get_host(name="esxi1.host.test", + datacenter_id=dc.id) + hvs1 = vsphere.HostVirtualSwitch("hvs1", + host_system_id=h1.id, + network_adapters=[ + "vmnic3", + "vmnic4", + ], + active_nics=["vmnic3"], + standby_nics=["vmnic4"]) + p1 = vsphere.HostPortGroup("p1", + virtual_switch_name=hvs1.name, + host_system_id=h1.id) + v1 = vsphere.Vnic("v1", + host=h1.id, + portgroup=p1.name, + ipv4=vsphere.VnicIpv4Args( + dhcp=True, + ), + services=[ + "vsan", + "management", + ]) + ``` + ## Importing + + An existing vNic can be [imported][docs-import] into this resource + via supplying the vNic's ID. An example is below: + + [docs-import]: /docs/import/index.html + + ```python + import pulumi + ``` + + The above would import the vnic `vmk2` from host with ID `host-123`. :param str resource_name: The name of the resource. :param VnicArgs args: The arguments to use to populate this resource's properties.