software.amazon.awscdk.services.apprunner.alpha.VpcConnectorProps Maven / Gradle / Ivy
Show all versions of apprunner-alpha Show documentation
package software.amazon.awscdk.services.apprunner.alpha;
/**
* (experimental) Properties of the AppRunner VPC Connector.
*
* Example:
*
*
* import software.amazon.awscdk.services.ec2.*;
* Vpc vpc = Vpc.Builder.create(this, "Vpc")
* .cidr("10.0.0.0/16")
* .build();
* VpcConnector vpcConnector = VpcConnector.Builder.create(this, "VpcConnector")
* .vpc(vpc)
* .vpcSubnets(vpc.selectSubnets(SubnetSelection.builder().subnetType(SubnetType.PUBLIC).build()))
* .vpcConnectorName("MyVpcConnector")
* .build();
* Service.Builder.create(this, "Service")
* .source(Source.fromEcrPublic(EcrPublicProps.builder()
* .imageConfiguration(ImageConfiguration.builder().port(8000).build())
* .imageIdentifier("public.ecr.aws/aws-containers/hello-app-runner:latest")
* .build()))
* .vpcConnector(vpcConnector)
* .build();
*
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.60.1 (build 2799dc8)", date = "2022-07-13T22:14:11.921Z")
@software.amazon.jsii.Jsii(module = software.amazon.awscdk.services.apprunner.alpha.$Module.class, fqn = "@aws-cdk/aws-apprunner-alpha.VpcConnectorProps")
@software.amazon.jsii.Jsii.Proxy(VpcConnectorProps.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public interface VpcConnectorProps extends software.amazon.jsii.JsiiSerializable {
/**
* (experimental) The VPC for the VPC Connector.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@org.jetbrains.annotations.NotNull software.amazon.awscdk.services.ec2.IVpc getVpc();
/**
* (experimental) A list of IDs of security groups that App Runner should use for access to AWS resources under the specified subnets.
*
* Default: - a new security group will be created in the specified VPC
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.util.List getSecurityGroups() {
return null;
}
/**
* (experimental) The name for the VpcConnector.
*
* Default: - a name generated by CloudFormation
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.String getVpcConnectorName() {
return null;
}
/**
* (experimental) Where to place the VPC Connector within the VPC.
*
* Default: - Private subnets.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable software.amazon.awscdk.services.ec2.SubnetSelection getVpcSubnets() {
return null;
}
/**
* @return a {@link Builder} of {@link VpcConnectorProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link VpcConnectorProps}
*/
@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.IVpc vpc;
java.util.List securityGroups;
java.lang.String vpcConnectorName;
software.amazon.awscdk.services.ec2.SubnetSelection vpcSubnets;
/**
* Sets the value of {@link VpcConnectorProps#getVpc}
* @param vpc The VPC for the VPC Connector. This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder vpc(software.amazon.awscdk.services.ec2.IVpc vpc) {
this.vpc = vpc;
return this;
}
/**
* Sets the value of {@link VpcConnectorProps#getSecurityGroups}
* @param securityGroups A list of IDs of security groups that App Runner should use for access to AWS resources under the specified subnets.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@SuppressWarnings("unchecked")
public Builder securityGroups(java.util.List extends software.amazon.awscdk.services.ec2.ISecurityGroup> securityGroups) {
this.securityGroups = (java.util.List)securityGroups;
return this;
}
/**
* Sets the value of {@link VpcConnectorProps#getVpcConnectorName}
* @param vpcConnectorName The name for the VpcConnector.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder vpcConnectorName(java.lang.String vpcConnectorName) {
this.vpcConnectorName = vpcConnectorName;
return this;
}
/**
* Sets the value of {@link VpcConnectorProps#getVpcSubnets}
* @param vpcSubnets Where to place the VPC Connector within the VPC.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder vpcSubnets(software.amazon.awscdk.services.ec2.SubnetSelection vpcSubnets) {
this.vpcSubnets = vpcSubnets;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link VpcConnectorProps}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public VpcConnectorProps build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link VpcConnectorProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements VpcConnectorProps {
private final software.amazon.awscdk.services.ec2.IVpc vpc;
private final java.util.List securityGroups;
private final java.lang.String vpcConnectorName;
private final software.amazon.awscdk.services.ec2.SubnetSelection vpcSubnets;
/**
* 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.vpc = software.amazon.jsii.Kernel.get(this, "vpc", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ec2.IVpc.class));
this.securityGroups = software.amazon.jsii.Kernel.get(this, "securityGroups", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ec2.ISecurityGroup.class)));
this.vpcConnectorName = software.amazon.jsii.Kernel.get(this, "vpcConnectorName", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.vpcSubnets = software.amazon.jsii.Kernel.get(this, "vpcSubnets", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ec2.SubnetSelection.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.vpc = java.util.Objects.requireNonNull(builder.vpc, "vpc is required");
this.securityGroups = (java.util.List)builder.securityGroups;
this.vpcConnectorName = builder.vpcConnectorName;
this.vpcSubnets = builder.vpcSubnets;
}
@Override
public final software.amazon.awscdk.services.ec2.IVpc getVpc() {
return this.vpc;
}
@Override
public final java.util.List getSecurityGroups() {
return this.securityGroups;
}
@Override
public final java.lang.String getVpcConnectorName() {
return this.vpcConnectorName;
}
@Override
public final software.amazon.awscdk.services.ec2.SubnetSelection getVpcSubnets() {
return this.vpcSubnets;
}
@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("vpc", om.valueToTree(this.getVpc()));
if (this.getSecurityGroups() != null) {
data.set("securityGroups", om.valueToTree(this.getSecurityGroups()));
}
if (this.getVpcConnectorName() != null) {
data.set("vpcConnectorName", om.valueToTree(this.getVpcConnectorName()));
}
if (this.getVpcSubnets() != null) {
data.set("vpcSubnets", om.valueToTree(this.getVpcSubnets()));
}
final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
struct.set("fqn", om.valueToTree("@aws-cdk/aws-apprunner-alpha.VpcConnectorProps"));
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;
VpcConnectorProps.Jsii$Proxy that = (VpcConnectorProps.Jsii$Proxy) o;
if (!vpc.equals(that.vpc)) return false;
if (this.securityGroups != null ? !this.securityGroups.equals(that.securityGroups) : that.securityGroups != null) return false;
if (this.vpcConnectorName != null ? !this.vpcConnectorName.equals(that.vpcConnectorName) : that.vpcConnectorName != null) return false;
return this.vpcSubnets != null ? this.vpcSubnets.equals(that.vpcSubnets) : that.vpcSubnets == null;
}
@Override
public final int hashCode() {
int result = this.vpc.hashCode();
result = 31 * result + (this.securityGroups != null ? this.securityGroups.hashCode() : 0);
result = 31 * result + (this.vpcConnectorName != null ? this.vpcConnectorName.hashCode() : 0);
result = 31 * result + (this.vpcSubnets != null ? this.vpcSubnets.hashCode() : 0);
return result;
}
}
}