software.amazon.awscdk.services.ec2.alpha.NatGateway Maven / Gradle / Ivy
Show all versions of ec2-alpha Show documentation
package software.amazon.awscdk.services.ec2.alpha;
/**
* (experimental) Creates a network address translation (NAT) gateway.
*
* Example:
*
*
* 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.PRIVATE_ISOLATED)
* .build();
* NatGateway natgw = NatGateway.Builder.create(this, "NatGW")
* .subnet(subnet)
* .vpc(myVpc)
* .connectivityType(NatConnectivityType.PRIVATE)
* .privateIpAddress("10.0.0.42")
* .build();
* Route.Builder.create(this, "NatGwRoute")
* .routeTable(routeTable)
* .destination("0.0.0.0/0")
* .target(Map.of("gateway", natgw))
* .build();
*
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.102.0 (build e354887)", date = "2024-09-10T01:10:18.081Z")
@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.NatGateway")
public class NatGateway extends software.amazon.awscdk.Resource implements software.amazon.awscdk.services.ec2.alpha.IRouteTarget {
protected NatGateway(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
}
protected NatGateway(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) {
super(initializationMode);
}
/**
* @param scope This parameter is required.
* @param id This parameter is required.
* @param props This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public NatGateway(final @org.jetbrains.annotations.NotNull software.constructs.Construct scope, final @org.jetbrains.annotations.NotNull java.lang.String id, final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.ec2.alpha.NatGatewayProps 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"), java.util.Objects.requireNonNull(props, "props is required") });
}
/**
* (experimental) The NAT gateway CFN resource.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.ec2.CfnNatGateway getResource() {
return software.amazon.jsii.Kernel.get(this, "resource", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ec2.CfnNatGateway.class));
}
/**
* (experimental) The ID of the route target.
*/
@Override
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull java.lang.String getRouterTargetId() {
return software.amazon.jsii.Kernel.get(this, "routerTargetId", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
}
/**
* (experimental) The type of router used in the route.
*/
@Override
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.ec2.RouterType getRouterType() {
return software.amazon.jsii.Kernel.get(this, "routerType", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ec2.RouterType.class));
}
/**
* (experimental) Indicates whether the NAT gateway supports public or private connectivity.
*
* Default: public
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.Nullable java.lang.String getConnectivityType() {
return software.amazon.jsii.Kernel.get(this, "connectivityType", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
}
/**
* (experimental) The maximum amount of time to wait before forcibly releasing the IP addresses if connections are still in progress.
*
* Default: 350 seconds
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.Nullable software.amazon.awscdk.Duration getMaxDrainDuration() {
return software.amazon.jsii.Kernel.get(this, "maxDrainDuration", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.Duration.class));
}
/**
* (experimental) A fluent builder for {@link software.amazon.awscdk.services.ec2.alpha.NatGateway}.
*/
@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 final software.amazon.awscdk.services.ec2.alpha.NatGatewayProps.Builder props;
private Builder(final software.constructs.Construct scope, final java.lang.String id) {
this.scope = scope;
this.id = id;
this.props = new software.amazon.awscdk.services.ec2.alpha.NatGatewayProps.Builder();
}
/**
* (experimental) The subnet in which the NAT gateway is located.
*
* @return {@code this}
* @param subnet The subnet in which the NAT gateway is located. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder subnet(final software.amazon.awscdk.services.ec2.ISubnet subnet) {
this.props.subnet(subnet);
return this;
}
/**
* (experimental) AllocationID of Elastic IP address that's associated with the NAT gateway.
*
* This property is required for a public NAT
* gateway and cannot be specified with a private NAT gateway.
*
* Default: attr.allocationID of a new Elastic IP created by default
* //TODO: ADD L2 for elastic ip
*
* @return {@code this}
* @param allocationId AllocationID of Elastic IP address that's associated with the NAT gateway. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder allocationId(final java.lang.String allocationId) {
this.props.allocationId(allocationId);
return this;
}
/**
* (experimental) Indicates whether the NAT gateway supports public or private connectivity.
*
* Default: public
*
* @return {@code this}
* @param connectivityType Indicates whether the NAT gateway supports public or private connectivity. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder connectivityType(final software.amazon.awscdk.services.ec2.alpha.NatConnectivityType connectivityType) {
this.props.connectivityType(connectivityType);
return this;
}
/**
* (experimental) The maximum amount of time to wait before forcibly releasing the IP addresses if connections are still in progress.
*
* Default: 350 seconds
*
* @return {@code this}
* @param maxDrainDuration The maximum amount of time to wait before forcibly releasing the IP addresses if connections are still in progress. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder maxDrainDuration(final software.amazon.awscdk.Duration maxDrainDuration) {
this.props.maxDrainDuration(maxDrainDuration);
return this;
}
/**
* (experimental) The resource name of the NAT gateway.
*
* Default: none
*
* @return {@code this}
* @param natGatewayName The resource name of the NAT gateway. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder natGatewayName(final java.lang.String natGatewayName) {
this.props.natGatewayName(natGatewayName);
return this;
}
/**
* (experimental) The private IPv4 address to assign to the NAT gateway.
*
* If you don't provide an
* address, a private IPv4 address will be automatically assigned.
*
* Default: none
*
* @return {@code this}
* @param privateIpAddress The private IPv4 address to assign to the NAT gateway. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder privateIpAddress(final java.lang.String privateIpAddress) {
this.props.privateIpAddress(privateIpAddress);
return this;
}
/**
* (experimental) Secondary EIP allocation IDs.
*
* Default: none
*
* @return {@code this}
* @see https://docs.aws.amazon.com/vpc/latest/userguide/vpc-nat-gateway.html#nat-gateway-creating
* @param secondaryAllocationIds Secondary EIP allocation IDs. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder secondaryAllocationIds(final java.util.List secondaryAllocationIds) {
this.props.secondaryAllocationIds(secondaryAllocationIds);
return this;
}
/**
* (experimental) The number of secondary private IPv4 addresses you want to assign to the NAT gateway.
*
* SecondaryPrivateIpAddressCount
and SecondaryPrivateIpAddresses
cannot be
* set at the same time.
*
* Default: none
*
* @return {@code this}
* @see https://docs.aws.amazon.com/vpc/latest/userguide/vpc-nat-gateway.html#nat-gateway-creating
* @param secondaryPrivateIpAddressCount The number of secondary private IPv4 addresses you want to assign to the NAT gateway. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder secondaryPrivateIpAddressCount(final java.lang.Number secondaryPrivateIpAddressCount) {
this.props.secondaryPrivateIpAddressCount(secondaryPrivateIpAddressCount);
return this;
}
/**
* (experimental) Secondary private IPv4 addresses.
*
* SecondaryPrivateIpAddressCount
and SecondaryPrivateIpAddresses
cannot be
* set at the same time.
*
* Default: none
*
* @return {@code this}
* @see https://docs.aws.amazon.com/vpc/latest/userguide/vpc-nat-gateway.html#nat-gateway-creating
* @param secondaryPrivateIpAddresses Secondary private IPv4 addresses. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder secondaryPrivateIpAddresses(final java.util.List secondaryPrivateIpAddresses) {
this.props.secondaryPrivateIpAddresses(secondaryPrivateIpAddresses);
return this;
}
/**
* (experimental) The ID of the VPC in which the NAT gateway is located.
*
* Default: none
*
* @return {@code this}
* @param vpc The ID of the VPC in which the NAT gateway is located. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder vpc(final software.amazon.awscdk.services.ec2.alpha.IVpcV2 vpc) {
this.props.vpc(vpc);
return this;
}
/**
* @return a newly built instance of {@link software.amazon.awscdk.services.ec2.alpha.NatGateway}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public software.amazon.awscdk.services.ec2.alpha.NatGateway build() {
return new software.amazon.awscdk.services.ec2.alpha.NatGateway(
this.scope,
this.id,
this.props.build()
);
}
}
}