software.amazon.awscdk.services.ec2.alpha.IpamPoolCidrProvisioningOptions Maven / Gradle / Ivy
Show all versions of ec2-alpha Show documentation
package software.amazon.awscdk.services.ec2.alpha;
/**
* (experimental) Options to provision CIDRs to an IPAM pool.
*
* Used to create a new IpamPoolCidr
*
* 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-ipampoolcidr.html
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.102.0 (build e354887)", date = "2024-09-10T01:10:18.079Z")
@software.amazon.jsii.Jsii(module = software.amazon.awscdk.services.ec2.alpha.$Module.class, fqn = "@aws-cdk/aws-ec2-alpha.IpamPoolCidrProvisioningOptions")
@software.amazon.jsii.Jsii.Proxy(IpamPoolCidrProvisioningOptions.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public interface IpamPoolCidrProvisioningOptions extends software.amazon.jsii.JsiiSerializable {
/**
* (experimental) Ipv6 CIDR block for the IPAM pool.
*
* Default: none
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.String getCidr() {
return null;
}
/**
* (experimental) Ipv6 Netmask length for the CIDR.
*
* Default: none
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.Number getNetmaskLength() {
return null;
}
/**
* @return a {@link Builder} of {@link IpamPoolCidrProvisioningOptions}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link IpamPoolCidrProvisioningOptions}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static final class Builder implements software.amazon.jsii.Builder {
java.lang.String cidr;
java.lang.Number netmaskLength;
/**
* Sets the value of {@link IpamPoolCidrProvisioningOptions#getCidr}
* @param cidr Ipv6 CIDR block for the IPAM pool.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder cidr(java.lang.String cidr) {
this.cidr = cidr;
return this;
}
/**
* Sets the value of {@link IpamPoolCidrProvisioningOptions#getNetmaskLength}
* @param netmaskLength Ipv6 Netmask length for the CIDR.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder netmaskLength(java.lang.Number netmaskLength) {
this.netmaskLength = netmaskLength;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link IpamPoolCidrProvisioningOptions}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public IpamPoolCidrProvisioningOptions build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link IpamPoolCidrProvisioningOptions}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements IpamPoolCidrProvisioningOptions {
private final java.lang.String cidr;
private final java.lang.Number netmaskLength;
/**
* 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.cidr = software.amazon.jsii.Kernel.get(this, "cidr", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.netmaskLength = software.amazon.jsii.Kernel.get(this, "netmaskLength", software.amazon.jsii.NativeType.forClass(java.lang.Number.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.cidr = builder.cidr;
this.netmaskLength = builder.netmaskLength;
}
@Override
public final java.lang.String getCidr() {
return this.cidr;
}
@Override
public final java.lang.Number getNetmaskLength() {
return this.netmaskLength;
}
@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.getCidr() != null) {
data.set("cidr", om.valueToTree(this.getCidr()));
}
if (this.getNetmaskLength() != null) {
data.set("netmaskLength", om.valueToTree(this.getNetmaskLength()));
}
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.IpamPoolCidrProvisioningOptions"));
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;
IpamPoolCidrProvisioningOptions.Jsii$Proxy that = (IpamPoolCidrProvisioningOptions.Jsii$Proxy) o;
if (this.cidr != null ? !this.cidr.equals(that.cidr) : that.cidr != null) return false;
return this.netmaskLength != null ? this.netmaskLength.equals(that.netmaskLength) : that.netmaskLength == null;
}
@Override
public final int hashCode() {
int result = this.cidr != null ? this.cidr.hashCode() : 0;
result = 31 * result + (this.netmaskLength != null ? this.netmaskLength.hashCode() : 0);
return result;
}
}
}