software.amazon.awscdk.services.ec2.alpha.VpcV2 Maven / Gradle / Ivy
Show all versions of ec2-alpha Show documentation
package software.amazon.awscdk.services.ec2.alpha;
/**
* (experimental) This class provides a foundation for creating and configuring a VPC with advanced features such as IPAM (IP Address Management) and IPv6 support.
*
* For more information, see the {@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.Vpc.html AWS CDK Documentation on VPCs}.
*
* Example:
*
*
* Stack stack = new Stack();
* VpcV2 myVpc = new VpcV2(this, "Vpc");
* RouteTable routeTable = RouteTable.Builder.create(this, "RouteTable")
* .vpc(myVpc)
* .build();
* SubnetV2 subnet = SubnetV2.Builder.create(this, "Subnet")
* .vpc(myVpc)
* .availabilityZone("eu-west-2a")
* .ipv4CidrBlock(new IpCidr("10.0.0.0/24"))
* .subnetType(SubnetType.PUBLIC)
* .build();
* myVpc.addInternetGateway();
* myVpc.addNatGateway(NatGatewayOptions.builder()
* .subnet(subnet)
* .connectivityType(NatConnectivityType.PUBLIC)
* .build());
*
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.103.1 (build bef2dea)", date = "2024-10-11T15:56:07.943Z")
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Jsii(module = software.amazon.awscdk.services.ec2.alpha.$Module.class, fqn = "@aws-cdk/aws-ec2-alpha.VpcV2")
public class VpcV2 extends software.amazon.awscdk.services.ec2.alpha.VpcV2Base {
protected VpcV2(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
}
protected VpcV2(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) {
super(initializationMode);
}
/**
* @param scope This parameter is required.
* @param id This parameter is required.
* @param props
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public VpcV2(final @org.jetbrains.annotations.NotNull software.constructs.Construct scope, final @org.jetbrains.annotations.NotNull java.lang.String id, final @org.jetbrains.annotations.Nullable software.amazon.awscdk.services.ec2.alpha.VpcV2Props props) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(scope, "scope is required"), java.util.Objects.requireNonNull(id, "id is required"), props });
}
/**
* @param scope This parameter is required.
* @param id This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public VpcV2(final @org.jetbrains.annotations.NotNull software.constructs.Construct scope, final @org.jetbrains.annotations.NotNull java.lang.String id) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(scope, "scope is required"), java.util.Objects.requireNonNull(id, "id is required") });
}
/**
* (experimental) Indicates if instances launched in this VPC will have public DNS hostnames.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull java.lang.Boolean getDnsHostnamesEnabled() {
return software.amazon.jsii.Kernel.get(this, "dnsHostnamesEnabled", software.amazon.jsii.NativeType.forClass(java.lang.Boolean.class));
}
/**
* (experimental) Indicates if DNS support is enabled for this VPC.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull java.lang.Boolean getDnsSupportEnabled() {
return software.amazon.jsii.Kernel.get(this, "dnsSupportEnabled", software.amazon.jsii.NativeType.forClass(java.lang.Boolean.class));
}
/**
* (experimental) To define dependency on internet connectivity.
*/
@Override
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull software.constructs.IDependable getInternetConnectivityEstablished() {
return software.amazon.jsii.Kernel.get(this, "internetConnectivityEstablished", software.amazon.jsii.NativeType.forClass(software.constructs.IDependable.class));
}
/**
* (experimental) The provider of ipv4 addresses.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.ec2.alpha.IIpAddresses getIpAddresses() {
return software.amazon.jsii.Kernel.get(this, "ipAddresses", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ec2.alpha.IIpAddresses.class));
}
/**
* (experimental) The primary IPv4 CIDR block associated with the VPC.
*
* Needed in order to validate the vpc range of subnet
* current prop vpcCidrBlock refers to the token value
* For more information, see the {@link https://docs.aws.amazon.com/vpc/latest/userguide/vpc-cidr-blocks.html#vpc-sizing-ipv4}.
*/
@Override
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull java.lang.String getIpv4CidrBlock() {
return software.amazon.jsii.Kernel.get(this, "ipv4CidrBlock", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
}
/**
* (experimental) The IPv6 CIDR blocks for the VPC.
*
* See https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpc.html#aws-resource-ec2-vpc-return-values
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull java.util.List getIpv6CidrBlocks() {
return java.util.Collections.unmodifiableList(software.amazon.jsii.Kernel.get(this, "ipv6CidrBlocks", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(java.lang.String.class))));
}
/**
* (experimental) Isolated Subnets that are part of this VPC.
*/
@Override
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull java.util.List getIsolatedSubnets() {
return java.util.Collections.unmodifiableList(software.amazon.jsii.Kernel.get(this, "isolatedSubnets", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ec2.ISubnet.class))));
}
/**
* (experimental) Pbulic Subnets that are part of this VPC.
*/
@Override
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull java.util.List getPrivateSubnets() {
return java.util.Collections.unmodifiableList(software.amazon.jsii.Kernel.get(this, "privateSubnets", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ec2.ISubnet.class))));
}
/**
* (experimental) Public Subnets that are part of this VPC.
*/
@Override
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull java.util.List getPublicSubnets() {
return java.util.Collections.unmodifiableList(software.amazon.jsii.Kernel.get(this, "publicSubnets", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ec2.ISubnet.class))));
}
/**
* (experimental) The AWS CloudFormation resource representing the VPC.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.ec2.CfnVPC getResource() {
return software.amazon.jsii.Kernel.get(this, "resource", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ec2.CfnVPC.class));
}
/**
* (experimental) reference to all secondary blocks attached.
*/
@Override
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull java.util.List getSecondaryCidrBlock() {
return java.util.Collections.unmodifiableList(software.amazon.jsii.Kernel.get(this, "secondaryCidrBlock", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ec2.CfnVPCCidrBlock.class))));
}
/**
* (experimental) For validation to define IPv6 subnets, set to true in case of Amazon Provided IPv6 cidr range if true, IPv6 addresses can be attached to the subnets.
*
* Default: false
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull java.lang.Boolean getUseIpv6() {
return software.amazon.jsii.Kernel.get(this, "useIpv6", software.amazon.jsii.NativeType.forClass(java.lang.Boolean.class));
}
/**
* (experimental) Arn of this VPC.
*/
@Override
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull java.lang.String getVpcArn() {
return software.amazon.jsii.Kernel.get(this, "vpcArn", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
}
/**
* (experimental) CIDR range for this VPC.
*/
@Override
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull java.lang.String getVpcCidrBlock() {
return software.amazon.jsii.Kernel.get(this, "vpcCidrBlock", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
}
/**
* (experimental) Identifier for this VPC.
*/
@Override
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull java.lang.String getVpcId() {
return software.amazon.jsii.Kernel.get(this, "vpcId", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
}
/**
* (experimental) A fluent builder for {@link software.amazon.awscdk.services.ec2.alpha.VpcV2}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static final class Builder implements software.amazon.jsii.Builder {
/**
* @return a new instance of {@link Builder}.
* @param scope This parameter is required.
* @param id This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static Builder create(final software.constructs.Construct scope, final java.lang.String id) {
return new Builder(scope, id);
}
private final software.constructs.Construct scope;
private final java.lang.String id;
private software.amazon.awscdk.services.ec2.alpha.VpcV2Props.Builder props;
private Builder(final software.constructs.Construct scope, final java.lang.String id) {
this.scope = scope;
this.id = id;
}
/**
* (experimental) The default tenancy of instances launched into the VPC.
*
* By setting this to dedicated tenancy, instances will be launched on
* hardware dedicated to a single AWS customer, unless specifically specified
* at instance launch time. Please note, not all instance types are usable
* with Dedicated tenancy.
*
* Default: DefaultInstanceTenancy.Default (shared) tenancy
*
* @return {@code this}
* @param defaultInstanceTenancy The default tenancy of instances launched into the VPC. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder defaultInstanceTenancy(final software.amazon.awscdk.services.ec2.DefaultInstanceTenancy defaultInstanceTenancy) {
this.props().defaultInstanceTenancy(defaultInstanceTenancy);
return this;
}
/**
* (experimental) Indicates whether the instances launched in the VPC get DNS hostnames.
*
* Default: true
*
* @return {@code this}
* @param enableDnsHostnames Indicates whether the instances launched in the VPC get DNS hostnames. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder enableDnsHostnames(final java.lang.Boolean enableDnsHostnames) {
this.props().enableDnsHostnames(enableDnsHostnames);
return this;
}
/**
* (experimental) Indicates whether the DNS resolution is supported for the VPC.
*
* Default: true
*
* @return {@code this}
* @param enableDnsSupport Indicates whether the DNS resolution is supported for the VPC. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder enableDnsSupport(final java.lang.Boolean enableDnsSupport) {
this.props().enableDnsSupport(enableDnsSupport);
return this;
}
/**
* (experimental) A must IPv4 CIDR block for the VPC.
*
* Default: - Ipv4 CIDR Block ('10.0.0.0/16')
*
* @return {@code this}
* @see https://docs.aws.amazon.com/vpc/latest/userguide/vpc-cidr-blocks.html
* @param primaryAddressBlock A must IPv4 CIDR block for the VPC. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder primaryAddressBlock(final software.amazon.awscdk.services.ec2.alpha.IIpAddresses primaryAddressBlock) {
this.props().primaryAddressBlock(primaryAddressBlock);
return this;
}
/**
* (experimental) The secondary CIDR blocks associated with the VPC.
*
* Can be IPv4 or IPv6, two IPv4 ranges must follow RFC#1918 convention
* For more information,
*
* Default: - No secondary IP address
*
* @return {@code this}
* @see https://docs.aws.amazon.com/vpc/latest/userguide/vpc-cidr-blocks.html#vpc-resize}.
* @param secondaryAddressBlocks The secondary CIDR blocks associated with the VPC. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder secondaryAddressBlocks(final java.util.List extends software.amazon.awscdk.services.ec2.alpha.IIpAddresses> secondaryAddressBlocks) {
this.props().secondaryAddressBlocks(secondaryAddressBlocks);
return this;
}
/**
* (experimental) Physical name for the VPC.
*
* Default: - autogenerated by CDK
*
* @return {@code this}
* @param vpcName Physical name for the VPC. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder vpcName(final java.lang.String vpcName) {
this.props().vpcName(vpcName);
return this;
}
/**
* @return a newly built instance of {@link software.amazon.awscdk.services.ec2.alpha.VpcV2}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public software.amazon.awscdk.services.ec2.alpha.VpcV2 build() {
return new software.amazon.awscdk.services.ec2.alpha.VpcV2(
this.scope,
this.id,
this.props != null ? this.props.build() : null
);
}
private software.amazon.awscdk.services.ec2.alpha.VpcV2Props.Builder props() {
if (this.props == null) {
this.props = new software.amazon.awscdk.services.ec2.alpha.VpcV2Props.Builder();
}
return this.props;
}
}
}