software.amazon.awscdk.services.ec2.alpha.PoolOptions Maven / Gradle / Ivy
Show all versions of ec2-alpha Show documentation
package software.amazon.awscdk.services.ec2.alpha;
/**
* (experimental) Options for configuring an IPAM pool.
*
* Example:
*
*
* Stack stack = new Stack();
* Ipam ipam = Ipam.Builder.create(this, "Ipam")
* .operatingRegion(List.of("us-west-1"))
* .build();
* IIpamPool ipamPublicPool = ipam.publicScope.addPool("PublicPoolA", PoolOptions.builder()
* .addressFamily(AddressFamily.IP_V6)
* .awsService(AwsServiceName.EC2)
* .locale("us-west-1")
* .publicIpSource(IpamPoolPublicIpSource.AMAZON)
* .build());
* ipamPublicPool.provisionCidr("PublicPoolACidrA", IpamPoolCidrProvisioningOptions.builder().netmaskLength(52).build());
* IIpamPool ipamPrivatePool = ipam.privateScope.addPool("PrivatePoolA", PoolOptions.builder()
* .addressFamily(AddressFamily.IP_V4)
* .build());
* ipamPrivatePool.provisionCidr("PrivatePoolACidrA", IpamPoolCidrProvisioningOptions.builder().netmaskLength(8).build());
* VpcV2.Builder.create(this, "Vpc")
* .primaryAddressBlock(IpAddresses.ipv4("10.0.0.0/24"))
* .secondaryAddressBlocks(List.of(IpAddresses.amazonProvidedIpv6(SecondaryAddressProps.builder().cidrBlockName("AmazonIpv6").build()), IpAddresses.ipv6Ipam(IpamOptions.builder()
* .ipamPool(ipamPublicPool)
* .netmaskLength(52)
* .cidrBlockName("ipv6Ipam")
* .build()), IpAddresses.ipv4Ipam(IpamOptions.builder()
* .ipamPool(ipamPrivatePool)
* .netmaskLength(8)
* .cidrBlockName("ipv4Ipam")
* .build())))
* .build();
*
*
* @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-ipampool.html
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.102.0 (build e354887)", date = "2024-09-10T01:10:18.083Z")
@software.amazon.jsii.Jsii(module = software.amazon.awscdk.services.ec2.alpha.$Module.class, fqn = "@aws-cdk/aws-ec2-alpha.PoolOptions")
@software.amazon.jsii.Jsii.Proxy(PoolOptions.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public interface PoolOptions extends software.amazon.jsii.JsiiSerializable {
/**
* (experimental) addressFamily - The address family of the pool (ipv4 or ipv6).
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@org.jetbrains.annotations.NotNull software.amazon.awscdk.services.ec2.alpha.AddressFamily getAddressFamily();
/**
* (experimental) Limits which service in AWS that the pool can be used in.
*
* "ec2", for example, allows users to use space for Elastic IP addresses and VPCs.
*
* Default: - No service
*
* @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-ipampool.html#cfn-ec2-ipampool-awsservice
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable software.amazon.awscdk.services.ec2.alpha.AwsServiceName getAwsService() {
return null;
}
/**
* (experimental) Information about the CIDRs provisioned to the pool.
*
* Default: - No CIDRs are provisioned
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.util.List getIpv4ProvisionedCidrs() {
return null;
}
/**
* (experimental) The locale (AWS Region) of the pool.
*
* Should be one of the IPAM operating region.
* Only resources in the same Region as the locale of the pool can get IP address allocations from the pool.
* You can only allocate a CIDR for a VPC, for example, from an IPAM pool that shares a locale with the VPC’s Region.
* Note that once you choose a Locale for a pool, you cannot modify it. If you choose an AWS Region for locale that has not been configured as an operating Region for the IPAM, you'll get an error.
*
* Default: - Current operating region
*
* @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-ipampool.html#cfn-ec2-ipampool-locale
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.String getLocale() {
return null;
}
/**
* (experimental) The IP address source for pools in the public scope.
*
* Only used for IPv6 address
* Only allowed values to this are 'byoip' or 'amazon'
*
* Default: amazon
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable software.amazon.awscdk.services.ec2.alpha.IpamPoolPublicIpSource getPublicIpSource() {
return null;
}
/**
* @return a {@link Builder} of {@link PoolOptions}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link PoolOptions}
*/
@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.alpha.AddressFamily addressFamily;
software.amazon.awscdk.services.ec2.alpha.AwsServiceName awsService;
java.util.List ipv4ProvisionedCidrs;
java.lang.String locale;
software.amazon.awscdk.services.ec2.alpha.IpamPoolPublicIpSource publicIpSource;
/**
* Sets the value of {@link PoolOptions#getAddressFamily}
* @param addressFamily addressFamily - The address family of the pool (ipv4 or ipv6). This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder addressFamily(software.amazon.awscdk.services.ec2.alpha.AddressFamily addressFamily) {
this.addressFamily = addressFamily;
return this;
}
/**
* Sets the value of {@link PoolOptions#getAwsService}
* @param awsService Limits which service in AWS that the pool can be used in.
* "ec2", for example, allows users to use space for Elastic IP addresses and VPCs.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder awsService(software.amazon.awscdk.services.ec2.alpha.AwsServiceName awsService) {
this.awsService = awsService;
return this;
}
/**
* Sets the value of {@link PoolOptions#getIpv4ProvisionedCidrs}
* @param ipv4ProvisionedCidrs Information about the CIDRs provisioned to the pool.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder ipv4ProvisionedCidrs(java.util.List ipv4ProvisionedCidrs) {
this.ipv4ProvisionedCidrs = ipv4ProvisionedCidrs;
return this;
}
/**
* Sets the value of {@link PoolOptions#getLocale}
* @param locale The locale (AWS Region) of the pool.
* Should be one of the IPAM operating region.
* Only resources in the same Region as the locale of the pool can get IP address allocations from the pool.
* You can only allocate a CIDR for a VPC, for example, from an IPAM pool that shares a locale with the VPC’s Region.
* Note that once you choose a Locale for a pool, you cannot modify it. If you choose an AWS Region for locale that has not been configured as an operating Region for the IPAM, you'll get an error.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder locale(java.lang.String locale) {
this.locale = locale;
return this;
}
/**
* Sets the value of {@link PoolOptions#getPublicIpSource}
* @param publicIpSource The IP address source for pools in the public scope.
* Only used for IPv6 address
* Only allowed values to this are 'byoip' or 'amazon'
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder publicIpSource(software.amazon.awscdk.services.ec2.alpha.IpamPoolPublicIpSource publicIpSource) {
this.publicIpSource = publicIpSource;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link PoolOptions}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public PoolOptions build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link PoolOptions}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements PoolOptions {
private final software.amazon.awscdk.services.ec2.alpha.AddressFamily addressFamily;
private final software.amazon.awscdk.services.ec2.alpha.AwsServiceName awsService;
private final java.util.List ipv4ProvisionedCidrs;
private final java.lang.String locale;
private final software.amazon.awscdk.services.ec2.alpha.IpamPoolPublicIpSource publicIpSource;
/**
* 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.addressFamily = software.amazon.jsii.Kernel.get(this, "addressFamily", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ec2.alpha.AddressFamily.class));
this.awsService = software.amazon.jsii.Kernel.get(this, "awsService", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ec2.alpha.AwsServiceName.class));
this.ipv4ProvisionedCidrs = software.amazon.jsii.Kernel.get(this, "ipv4ProvisionedCidrs", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(java.lang.String.class)));
this.locale = software.amazon.jsii.Kernel.get(this, "locale", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.publicIpSource = software.amazon.jsii.Kernel.get(this, "publicIpSource", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ec2.alpha.IpamPoolPublicIpSource.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.addressFamily = java.util.Objects.requireNonNull(builder.addressFamily, "addressFamily is required");
this.awsService = builder.awsService;
this.ipv4ProvisionedCidrs = builder.ipv4ProvisionedCidrs;
this.locale = builder.locale;
this.publicIpSource = builder.publicIpSource;
}
@Override
public final software.amazon.awscdk.services.ec2.alpha.AddressFamily getAddressFamily() {
return this.addressFamily;
}
@Override
public final software.amazon.awscdk.services.ec2.alpha.AwsServiceName getAwsService() {
return this.awsService;
}
@Override
public final java.util.List getIpv4ProvisionedCidrs() {
return this.ipv4ProvisionedCidrs;
}
@Override
public final java.lang.String getLocale() {
return this.locale;
}
@Override
public final software.amazon.awscdk.services.ec2.alpha.IpamPoolPublicIpSource getPublicIpSource() {
return this.publicIpSource;
}
@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("addressFamily", om.valueToTree(this.getAddressFamily()));
if (this.getAwsService() != null) {
data.set("awsService", om.valueToTree(this.getAwsService()));
}
if (this.getIpv4ProvisionedCidrs() != null) {
data.set("ipv4ProvisionedCidrs", om.valueToTree(this.getIpv4ProvisionedCidrs()));
}
if (this.getLocale() != null) {
data.set("locale", om.valueToTree(this.getLocale()));
}
if (this.getPublicIpSource() != null) {
data.set("publicIpSource", om.valueToTree(this.getPublicIpSource()));
}
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.PoolOptions"));
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;
PoolOptions.Jsii$Proxy that = (PoolOptions.Jsii$Proxy) o;
if (!addressFamily.equals(that.addressFamily)) return false;
if (this.awsService != null ? !this.awsService.equals(that.awsService) : that.awsService != null) return false;
if (this.ipv4ProvisionedCidrs != null ? !this.ipv4ProvisionedCidrs.equals(that.ipv4ProvisionedCidrs) : that.ipv4ProvisionedCidrs != null) return false;
if (this.locale != null ? !this.locale.equals(that.locale) : that.locale != null) return false;
return this.publicIpSource != null ? this.publicIpSource.equals(that.publicIpSource) : that.publicIpSource == null;
}
@Override
public final int hashCode() {
int result = this.addressFamily.hashCode();
result = 31 * result + (this.awsService != null ? this.awsService.hashCode() : 0);
result = 31 * result + (this.ipv4ProvisionedCidrs != null ? this.ipv4ProvisionedCidrs.hashCode() : 0);
result = 31 * result + (this.locale != null ? this.locale.hashCode() : 0);
result = 31 * result + (this.publicIpSource != null ? this.publicIpSource.hashCode() : 0);
return result;
}
}
}