Package com.pulumi.alicloud.vpc
Class Switch
- java.lang.Object
-
- com.pulumi.resources.Resource
-
- com.pulumi.resources.CustomResource
-
- com.pulumi.alicloud.vpc.Switch
-
public class Switch extends com.pulumi.resources.CustomResource
Provides a VPC Vswitch resource. ## Module Support You can use to the existing vpc module to create a VPC and several VSwitches one-click. For information about VPC Vswitch and how to use it, see [What is Vswitch](https://www.alibabacloud.com/help/en/virtual-private-cloud/latest/work-with-vswitches). > **NOTE:** Available since v1.0.0. ## Example Usage Basic Usage ```java package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.alicloud.AlicloudFunctions; import com.pulumi.alicloud.inputs.GetZonesArgs; import com.pulumi.alicloud.vpc.Network; import com.pulumi.alicloud.vpc.NetworkArgs; import com.pulumi.alicloud.vpc.Switch; import com.pulumi.alicloud.vpc.SwitchArgs; 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 fooZones = AlicloudFunctions.getZones(GetZonesArgs.builder() .availableResourceCreation("VSwitch") .build()); var fooNetwork = new Network("fooNetwork", NetworkArgs.builder() .vpcName("terraform-example") .cidrBlock("172.16.0.0/12") .build()); var fooSwitch = new Switch("fooSwitch", SwitchArgs.builder() .vswitchName("terraform-example") .cidrBlock("172.16.0.0/21") .vpcId(fooNetwork.id()) .zoneId(fooZones.applyValue(getZonesResult -> getZonesResult.zones()[0].id())) .build()); } } ``` ```java package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.alicloud.AlicloudFunctions; import com.pulumi.alicloud.inputs.GetZonesArgs; import com.pulumi.alicloud.vpc.Network; import com.pulumi.alicloud.vpc.NetworkArgs; import com.pulumi.alicloud.vpc.Ipv4CidrBlock; import com.pulumi.alicloud.vpc.Ipv4CidrBlockArgs; import com.pulumi.alicloud.vpc.Switch; import com.pulumi.alicloud.vpc.SwitchArgs; 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 foo = AlicloudFunctions.getZones(GetZonesArgs.builder() .availableResourceCreation("VSwitch") .build()); var vpc = new Network("vpc", NetworkArgs.builder() .vpcName("terraform-example") .cidrBlock("172.16.0.0/12") .build()); var cidrBlocks = new Ipv4CidrBlock("cidrBlocks", Ipv4CidrBlockArgs.builder() .vpcId(vpc.id()) .secondaryCidrBlock("192.163.0.0/16") .build()); var island_nat = new Switch("island-nat", SwitchArgs.builder() .vpcId(cidrBlocks.vpcId()) .cidrBlock("172.16.0.0/21") .zoneId(foo.applyValue(getZonesResult -> getZonesResult.zones()[0].id())) .vswitchName("terraform-example") .tags(Map.ofEntries( Map.entry("BuiltBy", "example_value"), Map.entry("cnm_version", "example_value"), Map.entry("Environment", "example_value"), Map.entry("ManagedBy", "example_value") )) .build()); } } ``` Create a switch associated with the additional network segment ```java package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.alicloud.AlicloudFunctions; import com.pulumi.alicloud.inputs.GetZonesArgs; import com.pulumi.alicloud.vpc.Network; import com.pulumi.alicloud.vpc.NetworkArgs; import com.pulumi.alicloud.vpc.Ipv4CidrBlock; import com.pulumi.alicloud.vpc.Ipv4CidrBlockArgs; import com.pulumi.alicloud.vpc.Switch; import com.pulumi.alicloud.vpc.SwitchArgs; 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 fooZones = AlicloudFunctions.getZones(GetZonesArgs.builder() .availableResourceCreation("VSwitch") .build()); var fooNetwork = new Network("fooNetwork", NetworkArgs.builder() .vpcName("terraform-example") .cidrBlock("172.16.0.0/12") .build()); var fooIpv4CidrBlock = new Ipv4CidrBlock("fooIpv4CidrBlock", Ipv4CidrBlockArgs.builder() .vpcId(fooNetwork.id()) .secondaryCidrBlock("192.163.0.0/16") .build()); var fooSwitch = new Switch("fooSwitch", SwitchArgs.builder() .vpcId(fooIpv4CidrBlock.vpcId()) .cidrBlock("192.163.0.0/24") .zoneId(fooZones.applyValue(getZonesResult -> getZonesResult.zones()[0].id())) .build()); } } ``` ## Import VPC Vswitch can be imported using the id, e.g. ```sh $ pulumi import alicloud:vpc/switch:Switch example <id> ```
-
-
Constructor Summary
Constructors Constructor Description Switch(java.lang.String name)
Switch(java.lang.String name, SwitchArgs args)
Switch(java.lang.String name, SwitchArgs args, com.pulumi.resources.CustomResourceOptions options)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description com.pulumi.core.Output<java.lang.String>
availabilityZone()
com.pulumi.core.Output<java.lang.String>
cidrBlock()
com.pulumi.core.Output<java.lang.String>
createTime()
com.pulumi.core.Output<java.util.Optional<java.lang.String>>
description()
com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>>
enableIpv6()
static Switch
get(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, SwitchState state, com.pulumi.resources.CustomResourceOptions options)
Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.com.pulumi.core.Output<java.lang.String>
ipv6CidrBlock()
com.pulumi.core.Output<java.lang.Integer>
ipv6CidrBlockMask()
com.pulumi.core.Output<java.lang.String>
name()
com.pulumi.core.Output<java.lang.String>
status()
com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,java.lang.Object>>>
tags()
com.pulumi.core.Output<java.lang.String>
vpcId()
com.pulumi.core.Output<java.lang.String>
vswitchName()
com.pulumi.core.Output<java.lang.String>
zoneId()
-
-
-
Constructor Detail
-
Switch
public Switch(java.lang.String name)
- Parameters:
name
- The _unique_ name of the resulting resource.
-
Switch
public Switch(java.lang.String name, SwitchArgs args)
- Parameters:
name
- The _unique_ name of the resulting resource.args
- The arguments to use to populate this resource's properties.
-
Switch
public Switch(java.lang.String name, SwitchArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options)
- Parameters:
name
- The _unique_ name of the resulting resource.args
- The arguments to use to populate this resource's properties.options
- A bag of options that control this resource's behavior.
-
-
Method Detail
-
availabilityZone
public com.pulumi.core.Output<java.lang.String> availabilityZone()
- Returns:
- Field 'availability_zone' has been deprecated from provider version 1.119.0. New field 'zone_id' instead.
-
cidrBlock
public com.pulumi.core.Output<java.lang.String> cidrBlock()
- Returns:
- The IPv4 CIDR block of the VSwitch.
-
createTime
public com.pulumi.core.Output<java.lang.String> createTime()
- Returns:
- The creation time of the VSwitch.
-
description
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> description()
- Returns:
- The description of VSwitch.
-
enableIpv6
public com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> enableIpv6()
- Returns:
- Whether the IPv6 function is enabled in the switch. Value: - **true**: enables IPv6. - **false** (default): IPv6 is not enabled.
-
ipv6CidrBlock
public com.pulumi.core.Output<java.lang.String> ipv6CidrBlock()
- Returns:
- The IPv6 CIDR block of the VSwitch.
-
ipv6CidrBlockMask
public com.pulumi.core.Output<java.lang.Integer> ipv6CidrBlockMask()
- Returns:
- The IPv6 CIDR block of the VSwitch.
-
name
public com.pulumi.core.Output<java.lang.String> name()
- Returns:
- Field 'name' has been deprecated from provider version 1.119.0. New field 'vswitch_name' instead.
-
status
public com.pulumi.core.Output<java.lang.String> status()
- Returns:
- The status of the resource.
-
tags
public com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,java.lang.Object>>> tags()
- Returns:
- The tags of VSwitch.
-
vpcId
public com.pulumi.core.Output<java.lang.String> vpcId()
- Returns:
- The VPC ID. The following arguments will be discarded. Please use new fields as soon as possible:
-
vswitchName
public com.pulumi.core.Output<java.lang.String> vswitchName()
- Returns:
- The name of the VSwitch.
-
zoneId
public com.pulumi.core.Output<java.lang.String> zoneId()
- Returns:
- The AZ for the VSwitch. **Note:** Required for a VPC VSwitch.
-
get
public static Switch get(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, @Nullable SwitchState state, @Nullable com.pulumi.resources.CustomResourceOptions options)
Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.- Parameters:
name
- The _unique_ name of the resulting resource.id
- The _unique_ provider ID of the resource to lookup.state
-options
- Optional settings to control the behavior of the CustomResource.
-
-