software.amazon.awscdk.services.ec2.alpha.SubnetV2Attributes Maven / Gradle / Ivy
Show all versions of ec2-alpha Show documentation
package software.amazon.awscdk.services.ec2.alpha;
/**
* (experimental) Properties required to import a subnet.
*
* Example:
*
*
* SubnetV2.fromSubnetV2Attributes(this, "ImportedSubnet", SubnetV2Attributes.builder()
* .subnetId("subnet-0123456789abcdef0")
* .availabilityZone("us-west-2a")
* .ipv4CidrBlock("10.2.0.0/24")
* .routeTableId("rtb-0871c310f98da2cbb")
* .subnetType(SubnetType.PRIVATE_ISOLATED)
* .build());
*
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.104.0 (build e79254c)", date = "2024-11-15T10:25:09.195Z")
@software.amazon.jsii.Jsii(module = software.amazon.awscdk.services.ec2.alpha.$Module.class, fqn = "@aws-cdk/aws-ec2-alpha.SubnetV2Attributes")
@software.amazon.jsii.Jsii.Proxy(SubnetV2Attributes.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public interface SubnetV2Attributes extends software.amazon.jsii.JsiiSerializable {
/**
* (experimental) The Availability Zone this subnet is located in.
*
* Default: - No AZ information, cannot use AZ selection features
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@org.jetbrains.annotations.NotNull java.lang.String getAvailabilityZone();
/**
* (experimental) The IPv4 CIDR block associated with the subnet.
*
* Default: - No CIDR information, cannot use CIDR filter features
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@org.jetbrains.annotations.NotNull java.lang.String getIpv4CidrBlock();
/**
* (experimental) The subnetId for this particular subnet.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@org.jetbrains.annotations.NotNull java.lang.String getSubnetId();
/**
* (experimental) The type of subnet (public or private) that this subnet represents.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@org.jetbrains.annotations.NotNull software.amazon.awscdk.services.ec2.SubnetType getSubnetType();
/**
* (experimental) The IPv4 CIDR block associated with the subnet.
*
* Default: - No CIDR information, cannot use CIDR filter features
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.String getIpv6CidrBlock() {
return null;
}
/**
* (experimental) The ID of the route table for this particular subnet.
*
* Default: - No route table information, cannot create VPC endpoints
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.String getRouteTableId() {
return null;
}
/**
* (experimental) Name of the given subnet.
*
* Default: - no subnet name
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.String getSubnetName() {
return null;
}
/**
* @return a {@link Builder} of {@link SubnetV2Attributes}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link SubnetV2Attributes}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static final class Builder implements software.amazon.jsii.Builder {
java.lang.String availabilityZone;
java.lang.String ipv4CidrBlock;
java.lang.String subnetId;
software.amazon.awscdk.services.ec2.SubnetType subnetType;
java.lang.String ipv6CidrBlock;
java.lang.String routeTableId;
java.lang.String subnetName;
/**
* Sets the value of {@link SubnetV2Attributes#getAvailabilityZone}
* @param availabilityZone The Availability Zone this subnet is located in. This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder availabilityZone(java.lang.String availabilityZone) {
this.availabilityZone = availabilityZone;
return this;
}
/**
* Sets the value of {@link SubnetV2Attributes#getIpv4CidrBlock}
* @param ipv4CidrBlock The IPv4 CIDR block associated with the subnet. This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder ipv4CidrBlock(java.lang.String ipv4CidrBlock) {
this.ipv4CidrBlock = ipv4CidrBlock;
return this;
}
/**
* Sets the value of {@link SubnetV2Attributes#getSubnetId}
* @param subnetId The subnetId for this particular subnet. This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder subnetId(java.lang.String subnetId) {
this.subnetId = subnetId;
return this;
}
/**
* Sets the value of {@link SubnetV2Attributes#getSubnetType}
* @param subnetType The type of subnet (public or private) that this subnet represents. This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder subnetType(software.amazon.awscdk.services.ec2.SubnetType subnetType) {
this.subnetType = subnetType;
return this;
}
/**
* Sets the value of {@link SubnetV2Attributes#getIpv6CidrBlock}
* @param ipv6CidrBlock The IPv4 CIDR block associated with the subnet.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder ipv6CidrBlock(java.lang.String ipv6CidrBlock) {
this.ipv6CidrBlock = ipv6CidrBlock;
return this;
}
/**
* Sets the value of {@link SubnetV2Attributes#getRouteTableId}
* @param routeTableId The ID of the route table for this particular subnet.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder routeTableId(java.lang.String routeTableId) {
this.routeTableId = routeTableId;
return this;
}
/**
* Sets the value of {@link SubnetV2Attributes#getSubnetName}
* @param subnetName Name of the given subnet.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder subnetName(java.lang.String subnetName) {
this.subnetName = subnetName;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link SubnetV2Attributes}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public SubnetV2Attributes build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link SubnetV2Attributes}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements SubnetV2Attributes {
private final java.lang.String availabilityZone;
private final java.lang.String ipv4CidrBlock;
private final java.lang.String subnetId;
private final software.amazon.awscdk.services.ec2.SubnetType subnetType;
private final java.lang.String ipv6CidrBlock;
private final java.lang.String routeTableId;
private final java.lang.String subnetName;
/**
* 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.availabilityZone = software.amazon.jsii.Kernel.get(this, "availabilityZone", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.ipv4CidrBlock = software.amazon.jsii.Kernel.get(this, "ipv4CidrBlock", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.subnetId = software.amazon.jsii.Kernel.get(this, "subnetId", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.subnetType = software.amazon.jsii.Kernel.get(this, "subnetType", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ec2.SubnetType.class));
this.ipv6CidrBlock = software.amazon.jsii.Kernel.get(this, "ipv6CidrBlock", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.routeTableId = software.amazon.jsii.Kernel.get(this, "routeTableId", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.subnetName = software.amazon.jsii.Kernel.get(this, "subnetName", 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.availabilityZone = java.util.Objects.requireNonNull(builder.availabilityZone, "availabilityZone is required");
this.ipv4CidrBlock = java.util.Objects.requireNonNull(builder.ipv4CidrBlock, "ipv4CidrBlock is required");
this.subnetId = java.util.Objects.requireNonNull(builder.subnetId, "subnetId is required");
this.subnetType = java.util.Objects.requireNonNull(builder.subnetType, "subnetType is required");
this.ipv6CidrBlock = builder.ipv6CidrBlock;
this.routeTableId = builder.routeTableId;
this.subnetName = builder.subnetName;
}
@Override
public final java.lang.String getAvailabilityZone() {
return this.availabilityZone;
}
@Override
public final java.lang.String getIpv4CidrBlock() {
return this.ipv4CidrBlock;
}
@Override
public final java.lang.String getSubnetId() {
return this.subnetId;
}
@Override
public final software.amazon.awscdk.services.ec2.SubnetType getSubnetType() {
return this.subnetType;
}
@Override
public final java.lang.String getIpv6CidrBlock() {
return this.ipv6CidrBlock;
}
@Override
public final java.lang.String getRouteTableId() {
return this.routeTableId;
}
@Override
public final java.lang.String getSubnetName() {
return this.subnetName;
}
@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("availabilityZone", om.valueToTree(this.getAvailabilityZone()));
data.set("ipv4CidrBlock", om.valueToTree(this.getIpv4CidrBlock()));
data.set("subnetId", om.valueToTree(this.getSubnetId()));
data.set("subnetType", om.valueToTree(this.getSubnetType()));
if (this.getIpv6CidrBlock() != null) {
data.set("ipv6CidrBlock", om.valueToTree(this.getIpv6CidrBlock()));
}
if (this.getRouteTableId() != null) {
data.set("routeTableId", om.valueToTree(this.getRouteTableId()));
}
if (this.getSubnetName() != null) {
data.set("subnetName", om.valueToTree(this.getSubnetName()));
}
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.SubnetV2Attributes"));
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;
SubnetV2Attributes.Jsii$Proxy that = (SubnetV2Attributes.Jsii$Proxy) o;
if (!availabilityZone.equals(that.availabilityZone)) return false;
if (!ipv4CidrBlock.equals(that.ipv4CidrBlock)) return false;
if (!subnetId.equals(that.subnetId)) return false;
if (!subnetType.equals(that.subnetType)) return false;
if (this.ipv6CidrBlock != null ? !this.ipv6CidrBlock.equals(that.ipv6CidrBlock) : that.ipv6CidrBlock != null) return false;
if (this.routeTableId != null ? !this.routeTableId.equals(that.routeTableId) : that.routeTableId != null) return false;
return this.subnetName != null ? this.subnetName.equals(that.subnetName) : that.subnetName == null;
}
@Override
public final int hashCode() {
int result = this.availabilityZone.hashCode();
result = 31 * result + (this.ipv4CidrBlock.hashCode());
result = 31 * result + (this.subnetId.hashCode());
result = 31 * result + (this.subnetType.hashCode());
result = 31 * result + (this.ipv6CidrBlock != null ? this.ipv6CidrBlock.hashCode() : 0);
result = 31 * result + (this.routeTableId != null ? this.routeTableId.hashCode() : 0);
result = 31 * result + (this.subnetName != null ? this.subnetName.hashCode() : 0);
return result;
}
}
}