io.github.cdklabs.cdkecsserviceextensions.Environment Maven / Gradle / Ivy
Show all versions of cdk-ecs-service-extensions Show documentation
package io.github.cdklabs.cdkecsserviceextensions;
/**
* (experimental) An environment into which to deploy a service.
*
* This environment
* can either be instantiated with a pre-existing AWS VPC and ECS cluster,
* or it can create its own VPC and cluster. By default, it will create
* a cluster with Fargate capacity.
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.103.1 (build bef2dea)", date = "2024-09-27T00:29:46.234Z")
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Jsii(module = io.github.cdklabs.cdkecsserviceextensions.$Module.class, fqn = "@aws-cdk-containers/ecs-service-extensions.Environment")
public class Environment extends software.constructs.Construct implements io.github.cdklabs.cdkecsserviceextensions.IEnvironment {
protected Environment(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
}
protected Environment(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) {
super(initializationMode);
}
/**
* @param scope This parameter is required.
* @param id This parameter is required.
* @param props
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Environment(final @org.jetbrains.annotations.NotNull software.constructs.Construct scope, final @org.jetbrains.annotations.NotNull java.lang.String id, final @org.jetbrains.annotations.Nullable io.github.cdklabs.cdkecsserviceextensions.EnvironmentProps props) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(scope, "scope is required"), java.util.Objects.requireNonNull(id, "id is required"), props });
}
/**
* @param scope This parameter is required.
* @param id This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Environment(final @org.jetbrains.annotations.NotNull software.constructs.Construct scope, final @org.jetbrains.annotations.NotNull java.lang.String id) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(scope, "scope is required"), java.util.Objects.requireNonNull(id, "id is required") });
}
/**
* (experimental) Import an existing environment from its attributes.
*
* @param scope This parameter is required.
* @param id This parameter is required.
* @param attrs This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static @org.jetbrains.annotations.NotNull io.github.cdklabs.cdkecsserviceextensions.IEnvironment fromEnvironmentAttributes(final @org.jetbrains.annotations.NotNull software.constructs.Construct scope, final @org.jetbrains.annotations.NotNull java.lang.String id, final @org.jetbrains.annotations.NotNull io.github.cdklabs.cdkecsserviceextensions.EnvironmentAttributes attrs) {
return software.amazon.jsii.JsiiObject.jsiiStaticCall(io.github.cdklabs.cdkecsserviceextensions.Environment.class, "fromEnvironmentAttributes", software.amazon.jsii.NativeType.forClass(io.github.cdklabs.cdkecsserviceextensions.IEnvironment.class), new Object[] { java.util.Objects.requireNonNull(scope, "scope is required"), java.util.Objects.requireNonNull(id, "id is required"), java.util.Objects.requireNonNull(attrs, "attrs is required") });
}
/**
* (experimental) Add a default cloudmap namespace to the environment's cluster.
*
* The environment's cluster must not be imported.
*
* @param options This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public void addDefaultCloudMapNamespace(final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.ecs.CloudMapNamespaceOptions options) {
software.amazon.jsii.Kernel.call(this, "addDefaultCloudMapNamespace", software.amazon.jsii.NativeType.VOID, new Object[] { java.util.Objects.requireNonNull(options, "options is required") });
}
/**
* (experimental) The capacity type used by the service's cluster.
*/
@Override
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull io.github.cdklabs.cdkecsserviceextensions.EnvironmentCapacityType getCapacityType() {
return software.amazon.jsii.Kernel.get(this, "capacityType", software.amazon.jsii.NativeType.forClass(io.github.cdklabs.cdkecsserviceextensions.EnvironmentCapacityType.class));
}
/**
* (experimental) The cluster that is providing capacity for this service.
*/
@Override
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.ecs.ICluster getCluster() {
return software.amazon.jsii.Kernel.get(this, "cluster", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ecs.ICluster.class));
}
/**
* (experimental) The name of this environment.
*/
@Override
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull java.lang.String getId() {
return software.amazon.jsii.Kernel.get(this, "id", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
}
/**
* (experimental) The VPC where environment services should be placed.
*/
@Override
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.ec2.IVpc getVpc() {
return software.amazon.jsii.Kernel.get(this, "vpc", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ec2.IVpc.class));
}
/**
* (experimental) A fluent builder for {@link io.github.cdklabs.cdkecsserviceextensions.Environment}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static final class Builder implements software.amazon.jsii.Builder {
/**
* @return a new instance of {@link Builder}.
* @param scope This parameter is required.
* @param id This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static Builder create(final software.constructs.Construct scope, final java.lang.String id) {
return new Builder(scope, id);
}
private final software.constructs.Construct scope;
private final java.lang.String id;
private io.github.cdklabs.cdkecsserviceextensions.EnvironmentProps.Builder props;
private Builder(final software.constructs.Construct scope, final java.lang.String id) {
this.scope = scope;
this.id = id;
}
/**
* (experimental) The type of capacity to use for this environment.
*
* Default: - EnvironmentCapacityType.FARGATE
*
* @return {@code this}
* @param capacityType The type of capacity to use for this environment. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder capacityType(final io.github.cdklabs.cdkecsserviceextensions.EnvironmentCapacityType capacityType) {
this.props().capacityType(capacityType);
return this;
}
/**
* (experimental) The ECS cluster which provides compute capacity to this service.
*
* [disable-awslint:ref-via-interface]
*
* Default: - Create a new cluster
*
* @return {@code this}
* @param cluster The ECS cluster which provides compute capacity to this service. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder cluster(final software.amazon.awscdk.services.ecs.Cluster cluster) {
this.props().cluster(cluster);
return this;
}
/**
* (experimental) The VPC used by the service for networking.
*
* Default: - Create a new VPC
*
* @return {@code this}
* @param vpc The VPC used by the service for networking. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder vpc(final software.amazon.awscdk.services.ec2.IVpc vpc) {
this.props().vpc(vpc);
return this;
}
/**
* @return a newly built instance of {@link io.github.cdklabs.cdkecsserviceextensions.Environment}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public io.github.cdklabs.cdkecsserviceextensions.Environment build() {
return new io.github.cdklabs.cdkecsserviceextensions.Environment(
this.scope,
this.id,
this.props != null ? this.props.build() : null
);
}
private io.github.cdklabs.cdkecsserviceextensions.EnvironmentProps.Builder props() {
if (this.props == null) {
this.props = new io.github.cdklabs.cdkecsserviceextensions.EnvironmentProps.Builder();
}
return this.props;
}
}
}