1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. ens
  5. Vswitch
Alibaba Cloud v3.57.1 published on Wednesday, Jun 26, 2024 by Pulumi

alicloud.ens.Vswitch

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.57.1 published on Wednesday, Jun 26, 2024 by Pulumi

    Provides a ENS Vswitch resource.

    For information about ENS Vswitch and how to use it, see What is Vswitch.

    NOTE: Available since v1.213.0.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const config = new pulumi.Config();
    const name = config.get("name") || "terraform-example";
    const _default = new alicloud.ens.Network("default", {
        networkName: name,
        description: name,
        cidrBlock: "192.168.2.0/24",
        ensRegionId: "cn-chenzhou-telecom_unicom_cmcc",
    });
    const defaultVswitch = new alicloud.ens.Vswitch("default", {
        description: name,
        cidrBlock: "192.168.2.0/24",
        vswitchName: name,
        ensRegionId: "cn-chenzhou-telecom_unicom_cmcc",
        networkId: _default.id,
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    config = pulumi.Config()
    name = config.get("name")
    if name is None:
        name = "terraform-example"
    default = alicloud.ens.Network("default",
        network_name=name,
        description=name,
        cidr_block="192.168.2.0/24",
        ens_region_id="cn-chenzhou-telecom_unicom_cmcc")
    default_vswitch = alicloud.ens.Vswitch("default",
        description=name,
        cidr_block="192.168.2.0/24",
        vswitch_name=name,
        ens_region_id="cn-chenzhou-telecom_unicom_cmcc",
        network_id=default.id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ens"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		cfg := config.New(ctx, "")
    		name := "terraform-example"
    		if param := cfg.Get("name"); param != "" {
    			name = param
    		}
    		_, err := ens.NewNetwork(ctx, "default", &ens.NetworkArgs{
    			NetworkName: pulumi.String(name),
    			Description: pulumi.String(name),
    			CidrBlock:   pulumi.String("192.168.2.0/24"),
    			EnsRegionId: pulumi.String("cn-chenzhou-telecom_unicom_cmcc"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = ens.NewVswitch(ctx, "default", &ens.VswitchArgs{
    			Description: pulumi.String(name),
    			CidrBlock:   pulumi.String("192.168.2.0/24"),
    			VswitchName: pulumi.String(name),
    			EnsRegionId: pulumi.String("cn-chenzhou-telecom_unicom_cmcc"),
    			NetworkId:   _default.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        var name = config.Get("name") ?? "terraform-example";
        var @default = new AliCloud.Ens.Network("default", new()
        {
            NetworkName = name,
            Description = name,
            CidrBlock = "192.168.2.0/24",
            EnsRegionId = "cn-chenzhou-telecom_unicom_cmcc",
        });
    
        var defaultVswitch = new AliCloud.Ens.Vswitch("default", new()
        {
            Description = name,
            CidrBlock = "192.168.2.0/24",
            VswitchName = name,
            EnsRegionId = "cn-chenzhou-telecom_unicom_cmcc",
            NetworkId = @default.Id,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.ens.Network;
    import com.pulumi.alicloud.ens.NetworkArgs;
    import com.pulumi.alicloud.ens.Vswitch;
    import com.pulumi.alicloud.ens.VswitchArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            final var config = ctx.config();
            final var name = config.get("name").orElse("terraform-example");
            var default_ = new Network("default", NetworkArgs.builder()
                .networkName(name)
                .description(name)
                .cidrBlock("192.168.2.0/24")
                .ensRegionId("cn-chenzhou-telecom_unicom_cmcc")
                .build());
    
            var defaultVswitch = new Vswitch("defaultVswitch", VswitchArgs.builder()
                .description(name)
                .cidrBlock("192.168.2.0/24")
                .vswitchName(name)
                .ensRegionId("cn-chenzhou-telecom_unicom_cmcc")
                .networkId(default_.id())
                .build());
    
        }
    }
    
    configuration:
      name:
        type: string
        default: terraform-example
    resources:
      default:
        type: alicloud:ens:Network
        properties:
          networkName: ${name}
          description: ${name}
          cidrBlock: 192.168.2.0/24
          ensRegionId: cn-chenzhou-telecom_unicom_cmcc
      defaultVswitch:
        type: alicloud:ens:Vswitch
        name: default
        properties:
          description: ${name}
          cidrBlock: 192.168.2.0/24
          vswitchName: ${name}
          ensRegionId: cn-chenzhou-telecom_unicom_cmcc
          networkId: ${default.id}
    

    Create Vswitch Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new Vswitch(name: string, args: VswitchArgs, opts?: CustomResourceOptions);
    @overload
    def Vswitch(resource_name: str,
                args: VswitchArgs,
                opts: Optional[ResourceOptions] = None)
    
    @overload
    def Vswitch(resource_name: str,
                opts: Optional[ResourceOptions] = None,
                cidr_block: Optional[str] = None,
                ens_region_id: Optional[str] = None,
                description: Optional[str] = None,
                network_id: Optional[str] = None,
                vswitch_name: Optional[str] = None)
    func NewVswitch(ctx *Context, name string, args VswitchArgs, opts ...ResourceOption) (*Vswitch, error)
    public Vswitch(string name, VswitchArgs args, CustomResourceOptions? opts = null)
    public Vswitch(String name, VswitchArgs args)
    public Vswitch(String name, VswitchArgs args, CustomResourceOptions options)
    
    type: alicloud:ens:Vswitch
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args VswitchArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args VswitchArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args VswitchArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args VswitchArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args VswitchArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var vswitchResource = new AliCloud.Ens.Vswitch("vswitchResource", new()
    {
        CidrBlock = "string",
        EnsRegionId = "string",
        Description = "string",
        NetworkId = "string",
        VswitchName = "string",
    });
    
    example, err := ens.NewVswitch(ctx, "vswitchResource", &ens.VswitchArgs{
    	CidrBlock:   pulumi.String("string"),
    	EnsRegionId: pulumi.String("string"),
    	Description: pulumi.String("string"),
    	NetworkId:   pulumi.String("string"),
    	VswitchName: pulumi.String("string"),
    })
    
    var vswitchResource = new Vswitch("vswitchResource", VswitchArgs.builder()
        .cidrBlock("string")
        .ensRegionId("string")
        .description("string")
        .networkId("string")
        .vswitchName("string")
        .build());
    
    vswitch_resource = alicloud.ens.Vswitch("vswitchResource",
        cidr_block="string",
        ens_region_id="string",
        description="string",
        network_id="string",
        vswitch_name="string")
    
    const vswitchResource = new alicloud.ens.Vswitch("vswitchResource", {
        cidrBlock: "string",
        ensRegionId: "string",
        description: "string",
        networkId: "string",
        vswitchName: "string",
    });
    
    type: alicloud:ens:Vswitch
    properties:
        cidrBlock: string
        description: string
        ensRegionId: string
        networkId: string
        vswitchName: string
    

    Vswitch Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The Vswitch resource accepts the following input properties:

    CidrBlock string
    IPv4 CIDR block of the VSwitch instance.
    EnsRegionId string
    ENS Region ID.
    Description string
    Description of the VSwitch Instance.
    NetworkId string
    Network ID of the VSwitch instance.
    VswitchName string
    Name of the switch instance.
    CidrBlock string
    IPv4 CIDR block of the VSwitch instance.
    EnsRegionId string
    ENS Region ID.
    Description string
    Description of the VSwitch Instance.
    NetworkId string
    Network ID of the VSwitch instance.
    VswitchName string
    Name of the switch instance.
    cidrBlock String
    IPv4 CIDR block of the VSwitch instance.
    ensRegionId String
    ENS Region ID.
    description String
    Description of the VSwitch Instance.
    networkId String
    Network ID of the VSwitch instance.
    vswitchName String
    Name of the switch instance.
    cidrBlock string
    IPv4 CIDR block of the VSwitch instance.
    ensRegionId string
    ENS Region ID.
    description string
    Description of the VSwitch Instance.
    networkId string
    Network ID of the VSwitch instance.
    vswitchName string
    Name of the switch instance.
    cidr_block str
    IPv4 CIDR block of the VSwitch instance.
    ens_region_id str
    ENS Region ID.
    description str
    Description of the VSwitch Instance.
    network_id str
    Network ID of the VSwitch instance.
    vswitch_name str
    Name of the switch instance.
    cidrBlock String
    IPv4 CIDR block of the VSwitch instance.
    ensRegionId String
    ENS Region ID.
    description String
    Description of the VSwitch Instance.
    networkId String
    Network ID of the VSwitch instance.
    vswitchName String
    Name of the switch instance.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the Vswitch resource produces the following output properties:

    CreateTime string
    The creation time of the VSwitch instance, in the UTC time format, yyyy-MM-ddTHH:mm:ssZ.
    Id string
    The provider-assigned unique ID for this managed resource.
    Status string
    Status of the switch instance.
    CreateTime string
    The creation time of the VSwitch instance, in the UTC time format, yyyy-MM-ddTHH:mm:ssZ.
    Id string
    The provider-assigned unique ID for this managed resource.
    Status string
    Status of the switch instance.
    createTime String
    The creation time of the VSwitch instance, in the UTC time format, yyyy-MM-ddTHH:mm:ssZ.
    id String
    The provider-assigned unique ID for this managed resource.
    status String
    Status of the switch instance.
    createTime string
    The creation time of the VSwitch instance, in the UTC time format, yyyy-MM-ddTHH:mm:ssZ.
    id string
    The provider-assigned unique ID for this managed resource.
    status string
    Status of the switch instance.
    create_time str
    The creation time of the VSwitch instance, in the UTC time format, yyyy-MM-ddTHH:mm:ssZ.
    id str
    The provider-assigned unique ID for this managed resource.
    status str
    Status of the switch instance.
    createTime String
    The creation time of the VSwitch instance, in the UTC time format, yyyy-MM-ddTHH:mm:ssZ.
    id String
    The provider-assigned unique ID for this managed resource.
    status String
    Status of the switch instance.

    Look up Existing Vswitch Resource

    Get an existing Vswitch resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: VswitchState, opts?: CustomResourceOptions): Vswitch
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            cidr_block: Optional[str] = None,
            create_time: Optional[str] = None,
            description: Optional[str] = None,
            ens_region_id: Optional[str] = None,
            network_id: Optional[str] = None,
            status: Optional[str] = None,
            vswitch_name: Optional[str] = None) -> Vswitch
    func GetVswitch(ctx *Context, name string, id IDInput, state *VswitchState, opts ...ResourceOption) (*Vswitch, error)
    public static Vswitch Get(string name, Input<string> id, VswitchState? state, CustomResourceOptions? opts = null)
    public static Vswitch get(String name, Output<String> id, VswitchState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    CidrBlock string
    IPv4 CIDR block of the VSwitch instance.
    CreateTime string
    The creation time of the VSwitch instance, in the UTC time format, yyyy-MM-ddTHH:mm:ssZ.
    Description string
    Description of the VSwitch Instance.
    EnsRegionId string
    ENS Region ID.
    NetworkId string
    Network ID of the VSwitch instance.
    Status string
    Status of the switch instance.
    VswitchName string
    Name of the switch instance.
    CidrBlock string
    IPv4 CIDR block of the VSwitch instance.
    CreateTime string
    The creation time of the VSwitch instance, in the UTC time format, yyyy-MM-ddTHH:mm:ssZ.
    Description string
    Description of the VSwitch Instance.
    EnsRegionId string
    ENS Region ID.
    NetworkId string
    Network ID of the VSwitch instance.
    Status string
    Status of the switch instance.
    VswitchName string
    Name of the switch instance.
    cidrBlock String
    IPv4 CIDR block of the VSwitch instance.
    createTime String
    The creation time of the VSwitch instance, in the UTC time format, yyyy-MM-ddTHH:mm:ssZ.
    description String
    Description of the VSwitch Instance.
    ensRegionId String
    ENS Region ID.
    networkId String
    Network ID of the VSwitch instance.
    status String
    Status of the switch instance.
    vswitchName String
    Name of the switch instance.
    cidrBlock string
    IPv4 CIDR block of the VSwitch instance.
    createTime string
    The creation time of the VSwitch instance, in the UTC time format, yyyy-MM-ddTHH:mm:ssZ.
    description string
    Description of the VSwitch Instance.
    ensRegionId string
    ENS Region ID.
    networkId string
    Network ID of the VSwitch instance.
    status string
    Status of the switch instance.
    vswitchName string
    Name of the switch instance.
    cidr_block str
    IPv4 CIDR block of the VSwitch instance.
    create_time str
    The creation time of the VSwitch instance, in the UTC time format, yyyy-MM-ddTHH:mm:ssZ.
    description str
    Description of the VSwitch Instance.
    ens_region_id str
    ENS Region ID.
    network_id str
    Network ID of the VSwitch instance.
    status str
    Status of the switch instance.
    vswitch_name str
    Name of the switch instance.
    cidrBlock String
    IPv4 CIDR block of the VSwitch instance.
    createTime String
    The creation time of the VSwitch instance, in the UTC time format, yyyy-MM-ddTHH:mm:ssZ.
    description String
    Description of the VSwitch Instance.
    ensRegionId String
    ENS Region ID.
    networkId String
    Network ID of the VSwitch instance.
    status String
    Status of the switch instance.
    vswitchName String
    Name of the switch instance.

    Import

    ENS Vswitch can be imported using the id, e.g.

    $ pulumi import alicloud:ens/vswitch:Vswitch example <id>
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Alibaba Cloud pulumi/pulumi-alicloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the alicloud Terraform Provider.
    alicloud logo
    Alibaba Cloud v3.57.1 published on Wednesday, Jun 26, 2024 by Pulumi