software.amazon.awscdk.services.ec2.alpha.RouteProps Maven / Gradle / Ivy
Show all versions of ec2-alpha Show documentation
package software.amazon.awscdk.services.ec2.alpha;
/**
* (experimental) Properties to define a route.
*
* 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.103.1 (build bef2dea)", date = "2024-10-11T15:56:07.924Z")
@software.amazon.jsii.Jsii(module = software.amazon.awscdk.services.ec2.alpha.$Module.class, fqn = "@aws-cdk/aws-ec2-alpha.RouteProps")
@software.amazon.jsii.Jsii.Proxy(RouteProps.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public interface RouteProps extends software.amazon.jsii.JsiiSerializable {
/**
* (experimental) The IPv4 or IPv6 CIDR block used for the destination match.
*
* Routing decisions are based on the most specific match.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@org.jetbrains.annotations.NotNull java.lang.String getDestination();
/**
* (experimental) The ID of the route table for the route.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@org.jetbrains.annotations.NotNull software.amazon.awscdk.services.ec2.IRouteTable getRouteTable();
/**
* (experimental) The gateway or endpoint targeted by the route.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@org.jetbrains.annotations.NotNull software.amazon.awscdk.services.ec2.alpha.RouteTargetType getTarget();
/**
* (experimental) The resource name of the route.
*
* Default: - provisioned without a route name
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.String getRouteName() {
return null;
}
/**
* @return a {@link Builder} of {@link RouteProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link RouteProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static final class Builder implements software.amazon.jsii.Builder {
java.lang.String destination;
software.amazon.awscdk.services.ec2.IRouteTable routeTable;
software.amazon.awscdk.services.ec2.alpha.RouteTargetType target;
java.lang.String routeName;
/**
* Sets the value of {@link RouteProps#getDestination}
* @param destination The IPv4 or IPv6 CIDR block used for the destination match. This parameter is required.
* Routing decisions are based on the most specific match.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder destination(java.lang.String destination) {
this.destination = destination;
return this;
}
/**
* Sets the value of {@link RouteProps#getRouteTable}
* @param routeTable The ID of the route table for the route. This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder routeTable(software.amazon.awscdk.services.ec2.IRouteTable routeTable) {
this.routeTable = routeTable;
return this;
}
/**
* Sets the value of {@link RouteProps#getTarget}
* @param target The gateway or endpoint targeted by the route. This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder target(software.amazon.awscdk.services.ec2.alpha.RouteTargetType target) {
this.target = target;
return this;
}
/**
* Sets the value of {@link RouteProps#getRouteName}
* @param routeName The resource name of the route.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder routeName(java.lang.String routeName) {
this.routeName = routeName;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link RouteProps}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public RouteProps build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link RouteProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements RouteProps {
private final java.lang.String destination;
private final software.amazon.awscdk.services.ec2.IRouteTable routeTable;
private final software.amazon.awscdk.services.ec2.alpha.RouteTargetType target;
private final java.lang.String routeName;
/**
* Constructor that initializes the object based on values retrieved from the JsiiObject.
* @param objRef Reference to the JSII managed object.
*/
protected Jsii$Proxy(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
this.destination = software.amazon.jsii.Kernel.get(this, "destination", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.routeTable = software.amazon.jsii.Kernel.get(this, "routeTable", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ec2.IRouteTable.class));
this.target = software.amazon.jsii.Kernel.get(this, "target", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ec2.alpha.RouteTargetType.class));
this.routeName = software.amazon.jsii.Kernel.get(this, "routeName", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
}
/**
* Constructor that initializes the object based on literal property values passed by the {@link Builder}.
*/
protected Jsii$Proxy(final Builder builder) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
this.destination = java.util.Objects.requireNonNull(builder.destination, "destination is required");
this.routeTable = java.util.Objects.requireNonNull(builder.routeTable, "routeTable is required");
this.target = java.util.Objects.requireNonNull(builder.target, "target is required");
this.routeName = builder.routeName;
}
@Override
public final java.lang.String getDestination() {
return this.destination;
}
@Override
public final software.amazon.awscdk.services.ec2.IRouteTable getRouteTable() {
return this.routeTable;
}
@Override
public final software.amazon.awscdk.services.ec2.alpha.RouteTargetType getTarget() {
return this.target;
}
@Override
public final java.lang.String getRouteName() {
return this.routeName;
}
@Override
@software.amazon.jsii.Internal
public com.fasterxml.jackson.databind.JsonNode $jsii$toJson() {
final com.fasterxml.jackson.databind.ObjectMapper om = software.amazon.jsii.JsiiObjectMapper.INSTANCE;
final com.fasterxml.jackson.databind.node.ObjectNode data = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
data.set("destination", om.valueToTree(this.getDestination()));
data.set("routeTable", om.valueToTree(this.getRouteTable()));
data.set("target", om.valueToTree(this.getTarget()));
if (this.getRouteName() != null) {
data.set("routeName", om.valueToTree(this.getRouteName()));
}
final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
struct.set("fqn", om.valueToTree("@aws-cdk/aws-ec2-alpha.RouteProps"));
struct.set("data", data);
final com.fasterxml.jackson.databind.node.ObjectNode obj = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
obj.set("$jsii.struct", struct);
return obj;
}
@Override
public final boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
RouteProps.Jsii$Proxy that = (RouteProps.Jsii$Proxy) o;
if (!destination.equals(that.destination)) return false;
if (!routeTable.equals(that.routeTable)) return false;
if (!target.equals(that.target)) return false;
return this.routeName != null ? this.routeName.equals(that.routeName) : that.routeName == null;
}
@Override
public final int hashCode() {
int result = this.destination.hashCode();
result = 31 * result + (this.routeTable.hashCode());
result = 31 * result + (this.target.hashCode());
result = 31 * result + (this.routeName != null ? this.routeName.hashCode() : 0);
return result;
}
}
}