Show / Hide Table of Contents

Class GetDistributedVirtualSwitch

Inheritance
System.Object
GetDistributedVirtualSwitch
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Pulumi.VSphere
Assembly: Pulumi.VSphere.dll
Syntax
public static class GetDistributedVirtualSwitch

Methods

View Source

InvokeAsync(GetDistributedVirtualSwitchArgs, InvokeOptions)

The vsphere..DistributedVirtualSwitch data source can be used to discover the ID and uplink data of a of a vSphere distributed virtual switch (DVS). This can then be used with resources or data sources that require a DVS, such as the vsphere..DistributedPortGroup resource, for which an example is shown below.

NOTE: This data source requires vCenter and is not available on direct ESXi connections.

{{% examples %}}

Example Usage

{{% example %}}

The following example locates a DVS that is named test-dvs, in the datacenter dc1. It then uses this DVS to set up a vsphere..DistributedPortGroup resource that uses the first uplink as a primary uplink and the second uplink as a secondary.

using Pulumi;
using VSphere = Pulumi.VSphere;

class MyStack : Stack
{
public MyStack()
{
    var datacenter = Output.Create(VSphere.GetDatacenter.InvokeAsync(new VSphere.GetDatacenterArgs
    {
        Name = "dc1",
    }));
    var dvs = datacenter.Apply(datacenter => Output.Create(VSphere.GetDistributedVirtualSwitch.InvokeAsync(new VSphere.GetDistributedVirtualSwitchArgs
    {
        DatacenterId = datacenter.Id,
        Name = "test-dvs",
    })));
    var pg = new VSphere.DistributedPortGroup("pg", new VSphere.DistributedPortGroupArgs
    {
        ActiveUplinks = 
        {
            dvs.Apply(dvs => dvs.Uplinks[0]),
        },
        DistributedVirtualSwitchUuid = dvs.Apply(dvs => dvs.Id),
        StandbyUplinks = 
        {
            dvs.Apply(dvs => dvs.Uplinks[1]),
        },
    });
}

}

{{% /example %}} {{% /examples %}}

Declaration
public static Task<GetDistributedVirtualSwitchResult> InvokeAsync(GetDistributedVirtualSwitchArgs args, InvokeOptions options = null)
Parameters
Type Name Description
GetDistributedVirtualSwitchArgs args
InvokeOptions options
Returns
Type Description
System.Threading.Tasks.Task<GetDistributedVirtualSwitchResult>
  • View Source
Back to top Copyright 2016-2020, Pulumi Corporation.