software.amazon.awscdk.services.ec2.alpha.VpcV2Props Maven / Gradle / Ivy
Show all versions of ec2-alpha Show documentation
package software.amazon.awscdk.services.ec2.alpha;
/**
* (experimental) Properties to define VPC [disable-awslint:from-method].
*
* Example:
*
*
* Stack stack = new Stack();
* VpcV2 myVpc = VpcV2.Builder.create(this, "Vpc")
* .primaryAddressBlock(IpAddresses.ipv4("10.1.0.0/16"))
* .secondaryAddressBlocks(List.of(IpAddresses.amazonProvidedIpv6(SecondaryAddressProps.builder()
* .cidrBlockName("AmazonProvided")
* .build())))
* .build();
* EgressOnlyInternetGateway eigw = EgressOnlyInternetGateway.Builder.create(this, "EIGW")
* .vpc(myVpc)
* .build();
* RouteTable routeTable = RouteTable.Builder.create(this, "RouteTable")
* .vpc(myVpc)
* .build();
* routeTable.addRoute("EIGW", "::/0", Map.of("gateway", eigw));
*
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.104.0 (build e79254c)", date = "2024-11-15T10:25:09.215Z")
@software.amazon.jsii.Jsii(module = software.amazon.awscdk.services.ec2.alpha.$Module.class, fqn = "@aws-cdk/aws-ec2-alpha.VpcV2Props")
@software.amazon.jsii.Jsii.Proxy(VpcV2Props.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public interface VpcV2Props extends software.amazon.jsii.JsiiSerializable {
/**
* (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
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable software.amazon.awscdk.services.ec2.DefaultInstanceTenancy getDefaultInstanceTenancy() {
return null;
}
/**
* (experimental) Indicates whether the instances launched in the VPC get DNS hostnames.
*
* Default: true
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.Boolean getEnableDnsHostnames() {
return null;
}
/**
* (experimental) Indicates whether the DNS resolution is supported for the VPC.
*
* Default: true
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.Boolean getEnableDnsSupport() {
return null;
}
/**
* (experimental) A must IPv4 CIDR block for the VPC.
*
* Default: - Ipv4 CIDR Block ('10.0.0.0/16')
*
* @see https://docs.aws.amazon.com/vpc/latest/userguide/vpc-cidr-blocks.html
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable software.amazon.awscdk.services.ec2.alpha.IIpAddresses getPrimaryAddressBlock() {
return null;
}
/**
* (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
*
* @see https://docs.aws.amazon.com/vpc/latest/userguide/vpc-cidr-blocks.html#vpc-resize}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.util.List getSecondaryAddressBlocks() {
return null;
}
/**
* (experimental) Physical name for the VPC.
*
* Default: - autogenerated by CDK
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.String getVpcName() {
return null;
}
/**
* @return a {@link Builder} of {@link VpcV2Props}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link VpcV2Props}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static final class Builder implements software.amazon.jsii.Builder {
software.amazon.awscdk.services.ec2.DefaultInstanceTenancy defaultInstanceTenancy;
java.lang.Boolean enableDnsHostnames;
java.lang.Boolean enableDnsSupport;
software.amazon.awscdk.services.ec2.alpha.IIpAddresses primaryAddressBlock;
java.util.List secondaryAddressBlocks;
java.lang.String vpcName;
/**
* Sets the value of {@link VpcV2Props#getDefaultInstanceTenancy}
* @param defaultInstanceTenancy 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.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder defaultInstanceTenancy(software.amazon.awscdk.services.ec2.DefaultInstanceTenancy defaultInstanceTenancy) {
this.defaultInstanceTenancy = defaultInstanceTenancy;
return this;
}
/**
* Sets the value of {@link VpcV2Props#getEnableDnsHostnames}
* @param enableDnsHostnames Indicates whether the instances launched in the VPC get DNS hostnames.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder enableDnsHostnames(java.lang.Boolean enableDnsHostnames) {
this.enableDnsHostnames = enableDnsHostnames;
return this;
}
/**
* Sets the value of {@link VpcV2Props#getEnableDnsSupport}
* @param enableDnsSupport Indicates whether the DNS resolution is supported for the VPC.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder enableDnsSupport(java.lang.Boolean enableDnsSupport) {
this.enableDnsSupport = enableDnsSupport;
return this;
}
/**
* Sets the value of {@link VpcV2Props#getPrimaryAddressBlock}
* @param primaryAddressBlock A must IPv4 CIDR block for the VPC.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder primaryAddressBlock(software.amazon.awscdk.services.ec2.alpha.IIpAddresses primaryAddressBlock) {
this.primaryAddressBlock = primaryAddressBlock;
return this;
}
/**
* Sets the value of {@link VpcV2Props#getSecondaryAddressBlocks}
* @param secondaryAddressBlocks The secondary CIDR blocks associated with the VPC.
* Can be IPv4 or IPv6, two IPv4 ranges must follow RFC#1918 convention
* For more information,
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@SuppressWarnings("unchecked")
public Builder secondaryAddressBlocks(java.util.List extends software.amazon.awscdk.services.ec2.alpha.IIpAddresses> secondaryAddressBlocks) {
this.secondaryAddressBlocks = (java.util.List)secondaryAddressBlocks;
return this;
}
/**
* Sets the value of {@link VpcV2Props#getVpcName}
* @param vpcName Physical name for the VPC.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder vpcName(java.lang.String vpcName) {
this.vpcName = vpcName;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link VpcV2Props}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public VpcV2Props build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link VpcV2Props}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements VpcV2Props {
private final software.amazon.awscdk.services.ec2.DefaultInstanceTenancy defaultInstanceTenancy;
private final java.lang.Boolean enableDnsHostnames;
private final java.lang.Boolean enableDnsSupport;
private final software.amazon.awscdk.services.ec2.alpha.IIpAddresses primaryAddressBlock;
private final java.util.List secondaryAddressBlocks;
private final java.lang.String vpcName;
/**
* 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.defaultInstanceTenancy = software.amazon.jsii.Kernel.get(this, "defaultInstanceTenancy", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ec2.DefaultInstanceTenancy.class));
this.enableDnsHostnames = software.amazon.jsii.Kernel.get(this, "enableDnsHostnames", software.amazon.jsii.NativeType.forClass(java.lang.Boolean.class));
this.enableDnsSupport = software.amazon.jsii.Kernel.get(this, "enableDnsSupport", software.amazon.jsii.NativeType.forClass(java.lang.Boolean.class));
this.primaryAddressBlock = software.amazon.jsii.Kernel.get(this, "primaryAddressBlock", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ec2.alpha.IIpAddresses.class));
this.secondaryAddressBlocks = software.amazon.jsii.Kernel.get(this, "secondaryAddressBlocks", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ec2.alpha.IIpAddresses.class)));
this.vpcName = software.amazon.jsii.Kernel.get(this, "vpcName", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
}
/**
* Constructor that initializes the object based on literal property values passed by the {@link Builder}.
*/
@SuppressWarnings("unchecked")
protected Jsii$Proxy(final Builder builder) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
this.defaultInstanceTenancy = builder.defaultInstanceTenancy;
this.enableDnsHostnames = builder.enableDnsHostnames;
this.enableDnsSupport = builder.enableDnsSupport;
this.primaryAddressBlock = builder.primaryAddressBlock;
this.secondaryAddressBlocks = (java.util.List)builder.secondaryAddressBlocks;
this.vpcName = builder.vpcName;
}
@Override
public final software.amazon.awscdk.services.ec2.DefaultInstanceTenancy getDefaultInstanceTenancy() {
return this.defaultInstanceTenancy;
}
@Override
public final java.lang.Boolean getEnableDnsHostnames() {
return this.enableDnsHostnames;
}
@Override
public final java.lang.Boolean getEnableDnsSupport() {
return this.enableDnsSupport;
}
@Override
public final software.amazon.awscdk.services.ec2.alpha.IIpAddresses getPrimaryAddressBlock() {
return this.primaryAddressBlock;
}
@Override
public final java.util.List getSecondaryAddressBlocks() {
return this.secondaryAddressBlocks;
}
@Override
public final java.lang.String getVpcName() {
return this.vpcName;
}
@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();
if (this.getDefaultInstanceTenancy() != null) {
data.set("defaultInstanceTenancy", om.valueToTree(this.getDefaultInstanceTenancy()));
}
if (this.getEnableDnsHostnames() != null) {
data.set("enableDnsHostnames", om.valueToTree(this.getEnableDnsHostnames()));
}
if (this.getEnableDnsSupport() != null) {
data.set("enableDnsSupport", om.valueToTree(this.getEnableDnsSupport()));
}
if (this.getPrimaryAddressBlock() != null) {
data.set("primaryAddressBlock", om.valueToTree(this.getPrimaryAddressBlock()));
}
if (this.getSecondaryAddressBlocks() != null) {
data.set("secondaryAddressBlocks", om.valueToTree(this.getSecondaryAddressBlocks()));
}
if (this.getVpcName() != null) {
data.set("vpcName", om.valueToTree(this.getVpcName()));
}
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.VpcV2Props"));
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;
VpcV2Props.Jsii$Proxy that = (VpcV2Props.Jsii$Proxy) o;
if (this.defaultInstanceTenancy != null ? !this.defaultInstanceTenancy.equals(that.defaultInstanceTenancy) : that.defaultInstanceTenancy != null) return false;
if (this.enableDnsHostnames != null ? !this.enableDnsHostnames.equals(that.enableDnsHostnames) : that.enableDnsHostnames != null) return false;
if (this.enableDnsSupport != null ? !this.enableDnsSupport.equals(that.enableDnsSupport) : that.enableDnsSupport != null) return false;
if (this.primaryAddressBlock != null ? !this.primaryAddressBlock.equals(that.primaryAddressBlock) : that.primaryAddressBlock != null) return false;
if (this.secondaryAddressBlocks != null ? !this.secondaryAddressBlocks.equals(that.secondaryAddressBlocks) : that.secondaryAddressBlocks != null) return false;
return this.vpcName != null ? this.vpcName.equals(that.vpcName) : that.vpcName == null;
}
@Override
public final int hashCode() {
int result = this.defaultInstanceTenancy != null ? this.defaultInstanceTenancy.hashCode() : 0;
result = 31 * result + (this.enableDnsHostnames != null ? this.enableDnsHostnames.hashCode() : 0);
result = 31 * result + (this.enableDnsSupport != null ? this.enableDnsSupport.hashCode() : 0);
result = 31 * result + (this.primaryAddressBlock != null ? this.primaryAddressBlock.hashCode() : 0);
result = 31 * result + (this.secondaryAddressBlocks != null ? this.secondaryAddressBlocks.hashCode() : 0);
result = 31 * result + (this.vpcName != null ? this.vpcName.hashCode() : 0);
return result;
}
}
}