GetSwitches

This data source provides a list of VSwitches owned by an Alibaba Cloud account.

Example Usage

using Pulumi;
using AliCloud = Pulumi.AliCloud;

class MyStack : Stack
{
    public MyStack()
    {
        var config = new Config();
        var name = config.Get("name") ?? "vswitchDatasourceName";
        var defaultZones = Output.Create(AliCloud.GetZones.InvokeAsync());
        var vpc = new AliCloud.Vpc.Network("vpc", new AliCloud.Vpc.NetworkArgs
        {
            CidrBlock = "172.16.0.0/16",
        });
        var vswitch = new AliCloud.Vpc.Switch("vswitch", new AliCloud.Vpc.SwitchArgs
        {
            AvailabilityZone = defaultZones.Apply(defaultZones => defaultZones.Zones[0].Id),
            CidrBlock = "172.16.0.0/24",
            VpcId = vpc.Id,
        });
        var defaultSwitches = vswitch.Name.Apply(name => AliCloud.Vpc.GetSwitches.InvokeAsync(new AliCloud.Vpc.GetSwitchesArgs
        {
            NameRegex = name,
        }));
    }

}

Coming soon!

import pulumi
import pulumi_alicloud as alicloud

config = pulumi.Config()
name = config.get("name")
if name is None:
    name = "vswitchDatasourceName"
default_zones = alicloud.get_zones()
vpc = alicloud.vpc.Network("vpc", cidr_block="172.16.0.0/16")
vswitch = alicloud.vpc.Switch("vswitch",
    availability_zone=default_zones.zones[0]["id"],
    cidr_block="172.16.0.0/24",
    vpc_id=vpc.id)
default_switches = vswitch.name.apply(lambda name: alicloud.vpc.get_switches(name_regex=name))
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const config = new pulumi.Config();
const name = config.get("name") || "vswitchDatasourceName";

const defaultZones = pulumi.output(alicloud.getZones({ async: true }));
const vpc = new alicloud.vpc.Network("vpc", {
    cidrBlock: "172.16.0.0/16",
});
const vswitch = new alicloud.vpc.Switch("vswitch", {
    availabilityZone: defaultZones.zones[0].id,
    cidrBlock: "172.16.0.0/24",
    vpcId: vpc.id,
});
const defaultSwitches = vswitch.name.apply(name => alicloud.vpc.getSwitches({
    nameRegex: name,
}, { async: true }));

Using GetSwitches

function getSwitches(args: GetSwitchesArgs, opts?: InvokeOptions): Promise<GetSwitchesResult>
function  get_switches(cidr_block=None, ids=None, is_default=None, name_regex=None, output_file=None, resource_group_id=None, tags=None, vpc_id=None, zone_id=None, opts=None)
func GetSwitches(ctx *Context, args *GetSwitchesArgs, opts ...InvokeOption) (*GetSwitchesResult, error)
public static class GetSwitches {
    public static Task<GetSwitchesResult> InvokeAsync(GetSwitchesArgs args, InvokeOptions? opts = null)
}

The following arguments are supported:

CidrBlock string

Filter results by a specific CIDR block. For example: “172.16.0.0/12”.

Ids List<string>

A list of VSwitch IDs.

IsDefault bool

Indicate whether the VSwitch is created by the system.

NameRegex string

A regex string to filter results by name.

OutputFile string
ResourceGroupId string

The Id of resource group which VSWitch belongs.

Tags Dictionary<string, object>

A mapping of tags to assign to the resource.

VpcId string

ID of the VPC that owns the VSwitch.

ZoneId string

The availability zone of the VSwitch.

CidrBlock string

Filter results by a specific CIDR block. For example: “172.16.0.0/12”.

Ids []string

A list of VSwitch IDs.

IsDefault bool

Indicate whether the VSwitch is created by the system.

NameRegex string

A regex string to filter results by name.

OutputFile string
ResourceGroupId string

The Id of resource group which VSWitch belongs.

Tags map[string]interface{}

A mapping of tags to assign to the resource.

VpcId string

ID of the VPC that owns the VSwitch.

ZoneId string

The availability zone of the VSwitch.

cidrBlock string

Filter results by a specific CIDR block. For example: “172.16.0.0/12”.

ids string[]

A list of VSwitch IDs.

isDefault boolean

Indicate whether the VSwitch is created by the system.

nameRegex string

A regex string to filter results by name.

outputFile string
resourceGroupId string

The Id of resource group which VSWitch belongs.

tags {[key: string]: any}

A mapping of tags to assign to the resource.

vpcId string

ID of the VPC that owns the VSwitch.

zoneId string

The availability zone of the VSwitch.

cidr_block str

Filter results by a specific CIDR block. For example: “172.16.0.0/12”.

ids List[str]

A list of VSwitch IDs.

is_default bool

Indicate whether the VSwitch is created by the system.

name_regex str

A regex string to filter results by name.

output_file str
resource_group_id str

The Id of resource group which VSWitch belongs.

tags Dict[str, Any]

A mapping of tags to assign to the resource.

vpc_id str

ID of the VPC that owns the VSwitch.

zone_id str

The availability zone of the VSwitch.

GetSwitches Result

The following output properties are available:

Id string

The provider-assigned unique ID for this managed resource.

Ids List<string>

A list of VSwitch IDs.

Names List<string>

A list of VSwitch names.

Vswitches List<Pulumi.AliCloud.Vpc.Outputs.GetSwitchesVswitch>

A list of VSwitches. Each element contains the following attributes:

CidrBlock string

CIDR block of the VSwitch.

IsDefault bool

Whether the VSwitch is the default one in the region.

NameRegex string
OutputFile string
ResourceGroupId string
Tags Dictionary<string, object>
VpcId string

ID of the VPC that owns the VSwitch.

ZoneId string

ID of the availability zone where the VSwitch is located.

Id string

The provider-assigned unique ID for this managed resource.

Ids []string

A list of VSwitch IDs.

Names []string

A list of VSwitch names.

Vswitches []GetSwitchesVswitch

A list of VSwitches. Each element contains the following attributes:

CidrBlock string

CIDR block of the VSwitch.

IsDefault bool

Whether the VSwitch is the default one in the region.

NameRegex string
OutputFile string
ResourceGroupId string
Tags map[string]interface{}
VpcId string

ID of the VPC that owns the VSwitch.

ZoneId string

ID of the availability zone where the VSwitch is located.

id string

The provider-assigned unique ID for this managed resource.

ids string[]

A list of VSwitch IDs.

names string[]

A list of VSwitch names.

vswitches GetSwitchesVswitch[]

A list of VSwitches. Each element contains the following attributes:

cidrBlock string

CIDR block of the VSwitch.

isDefault boolean

Whether the VSwitch is the default one in the region.

nameRegex string
outputFile string
resourceGroupId string
tags {[key: string]: any}
vpcId string

ID of the VPC that owns the VSwitch.

zoneId string

ID of the availability zone where the VSwitch is located.

id str

The provider-assigned unique ID for this managed resource.

ids List[str]

A list of VSwitch IDs.

names List[str]

A list of VSwitch names.

vswitches List[GetSwitchesVswitch]

A list of VSwitches. Each element contains the following attributes:

cidr_block str

CIDR block of the VSwitch.

is_default bool

Whether the VSwitch is the default one in the region.

name_regex str
output_file str
resource_group_id str
tags Dict[str, Any]
vpc_id str

ID of the VPC that owns the VSwitch.

zone_id str

ID of the availability zone where the VSwitch is located.

Supporting Types

GetSwitchesVswitch

See the output API doc for this type.

See the output API doc for this type.

See the output API doc for this type.

CidrBlock string

Filter results by a specific CIDR block. For example: “172.16.0.0/12”.

CreationTime string

Time of creation.

Description string

Description of the VSwitch.

Id string

ID of the VSwitch.

InstanceIds List<string>

List of ECS instance IDs in the specified VSwitch.

IsDefault bool

Indicate whether the VSwitch is created by the system.

Name string

Name of the VSwitch.

VpcId string

ID of the VPC that owns the VSwitch.

ZoneId string

The availability zone of the VSwitch.

CidrBlock string

Filter results by a specific CIDR block. For example: “172.16.0.0/12”.

CreationTime string

Time of creation.

Description string

Description of the VSwitch.

Id string

ID of the VSwitch.

InstanceIds []string

List of ECS instance IDs in the specified VSwitch.

IsDefault bool

Indicate whether the VSwitch is created by the system.

Name string

Name of the VSwitch.

VpcId string

ID of the VPC that owns the VSwitch.

ZoneId string

The availability zone of the VSwitch.

cidrBlock string

Filter results by a specific CIDR block. For example: “172.16.0.0/12”.

creationTime string

Time of creation.

description string

Description of the VSwitch.

id string

ID of the VSwitch.

instanceIds string[]

List of ECS instance IDs in the specified VSwitch.

isDefault boolean

Indicate whether the VSwitch is created by the system.

name string

Name of the VSwitch.

vpcId string

ID of the VPC that owns the VSwitch.

zoneId string

The availability zone of the VSwitch.

cidr_block str

Filter results by a specific CIDR block. For example: “172.16.0.0/12”.

creation_time str

Time of creation.

description str

Description of the VSwitch.

id str

ID of the VSwitch.

instance_ids List[str]

List of ECS instance IDs in the specified VSwitch.

is_default bool

Indicate whether the VSwitch is created by the system.

name str

Name of the VSwitch.

vpc_id str

ID of the VPC that owns the VSwitch.

zone_id str

The availability zone of the VSwitch.

Package Details

Repository
https://github.com/pulumi/pulumi-alicloud
License
Apache-2.0
Notes
This Pulumi package is based on the alicloud Terraform Provider.