software.amazon.awscdk.services.ec2.alpha.Route Maven / Gradle / Ivy
Show all versions of ec2-alpha Show documentation
package software.amazon.awscdk.services.ec2.alpha;
/**
* (experimental) Creates a new route with added functionality.
*
* 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.104.0 (build e79254c)", date = "2024-11-15T10:25:09.191Z")
@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.Route")
public class Route extends software.amazon.awscdk.Resource implements software.amazon.awscdk.services.ec2.alpha.IRouteV2 {
protected Route(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
}
protected Route(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 Route(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.RouteProps 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 IPv4 or IPv6 CIDR block used for the destination match.
*
* Routing decisions are based on the most specific match.
*/
@Override
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull java.lang.String getDestination() {
return software.amazon.jsii.Kernel.get(this, "destination", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
}
/**
* (experimental) The route table for the route.
*/
@Override
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.ec2.IRouteTable getRouteTable() {
return software.amazon.jsii.Kernel.get(this, "routeTable", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ec2.IRouteTable.class));
}
/**
* (experimental) The gateway or endpoint targeted by the route.
*/
@Override
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.ec2.alpha.RouteTargetType getTarget() {
return software.amazon.jsii.Kernel.get(this, "target", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ec2.alpha.RouteTargetType.class));
}
/**
* (experimental) The type of router the route is targetting.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.ec2.RouterType getTargetRouterType() {
return software.amazon.jsii.Kernel.get(this, "targetRouterType", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ec2.RouterType.class));
}
/**
* (experimental) The route CFN resource.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.Nullable software.amazon.awscdk.services.ec2.CfnRoute getResource() {
return software.amazon.jsii.Kernel.get(this, "resource", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ec2.CfnRoute.class));
}
/**
* (experimental) A fluent builder for {@link software.amazon.awscdk.services.ec2.alpha.Route}.
*/
@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.RouteProps.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.RouteProps.Builder();
}
/**
* (experimental) The IPv4 or IPv6 CIDR block used for the destination match.
*
* Routing decisions are based on the most specific match.
*
* @return {@code this}
* @param destination The IPv4 or IPv6 CIDR block used for the destination match. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder destination(final java.lang.String destination) {
this.props.destination(destination);
return this;
}
/**
* (experimental) The ID of the route table for the route.
*
* @return {@code this}
* @param routeTable The ID of the route table for the route. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder routeTable(final software.amazon.awscdk.services.ec2.IRouteTable routeTable) {
this.props.routeTable(routeTable);
return this;
}
/**
* (experimental) The gateway or endpoint targeted by the route.
*
* @return {@code this}
* @param target The gateway or endpoint targeted by the route. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder target(final software.amazon.awscdk.services.ec2.alpha.RouteTargetType target) {
this.props.target(target);
return this;
}
/**
* (experimental) The resource name of the route.
*
* Default: - provisioned without a route name
*
* @return {@code this}
* @param routeName The resource name of the route. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder routeName(final java.lang.String routeName) {
this.props.routeName(routeName);
return this;
}
/**
* @return a newly built instance of {@link software.amazon.awscdk.services.ec2.alpha.Route}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public software.amazon.awscdk.services.ec2.alpha.Route build() {
return new software.amazon.awscdk.services.ec2.alpha.Route(
this.scope,
this.id,
this.props.build()
);
}
}
}