io.github.cdklabs.cdk.ecs.codedeploy.TargetService Maven / Gradle / Ivy
Show all versions of cdk-ecs-codedeploy Show documentation
package io.github.cdklabs.cdk.ecs.codedeploy;
/**
* (experimental) Describe the target for CodeDeploy to use when creating a deployment for an ecs.EcsDeploymentGroup.
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.103.1 (build bef2dea)", date = "2024-10-08T18:15:42.294Z")
@software.amazon.jsii.Jsii(module = io.github.cdklabs.cdk.ecs.codedeploy.$Module.class, fqn = "@cdklabs/cdk-ecs-codedeploy.TargetService")
@software.amazon.jsii.Jsii.Proxy(TargetService.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public interface TargetService extends software.amazon.jsii.JsiiSerializable {
/**
* (experimental) The name of the Amazon ECS container that contains your Amazon ECS application.
*
* It must be a container specified in your Amazon ECS task definition.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@org.jetbrains.annotations.NotNull java.lang.String getContainerName();
/**
* (experimental) The port on the container where traffic will be routed to.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@org.jetbrains.annotations.NotNull java.lang.Number getContainerPort();
/**
* (experimental) The TaskDefintion to deploy to the target services.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@org.jetbrains.annotations.NotNull software.amazon.awscdk.services.ecs.ITaskDefinition getTaskDefinition();
/**
* (experimental) Network configuration for ECS services that have a network type of awsvpc
.
*
* Default: reuse current network settings for ECS service.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable io.github.cdklabs.cdk.ecs.codedeploy.AwsvpcConfiguration getAwsvpcConfiguration() {
return null;
}
/**
* (experimental) A list of Amazon ECS capacity providers to use for the deployment.
*
* Default: reuse current capcity provider strategy for ECS service.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.util.List getCapacityProviderStrategy() {
return null;
}
/**
* (experimental) The platform version of the Fargate tasks in the deployed Amazon ECS service.
*
* see: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/platform_versions.html
*
* Default: LATEST
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable software.amazon.awscdk.services.ecs.FargatePlatformVersion getPlatformVersion() {
return null;
}
/**
* @return a {@link Builder} of {@link TargetService}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link TargetService}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static final class Builder implements software.amazon.jsii.Builder {
java.lang.String containerName;
java.lang.Number containerPort;
software.amazon.awscdk.services.ecs.ITaskDefinition taskDefinition;
io.github.cdklabs.cdk.ecs.codedeploy.AwsvpcConfiguration awsvpcConfiguration;
java.util.List capacityProviderStrategy;
software.amazon.awscdk.services.ecs.FargatePlatformVersion platformVersion;
/**
* Sets the value of {@link TargetService#getContainerName}
* @param containerName The name of the Amazon ECS container that contains your Amazon ECS application. This parameter is required.
* It must be a container specified in your Amazon ECS task definition.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder containerName(java.lang.String containerName) {
this.containerName = containerName;
return this;
}
/**
* Sets the value of {@link TargetService#getContainerPort}
* @param containerPort The port on the container where traffic will be routed to. This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder containerPort(java.lang.Number containerPort) {
this.containerPort = containerPort;
return this;
}
/**
* Sets the value of {@link TargetService#getTaskDefinition}
* @param taskDefinition The TaskDefintion to deploy to the target services. This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder taskDefinition(software.amazon.awscdk.services.ecs.ITaskDefinition taskDefinition) {
this.taskDefinition = taskDefinition;
return this;
}
/**
* Sets the value of {@link TargetService#getAwsvpcConfiguration}
* @param awsvpcConfiguration Network configuration for ECS services that have a network type of awsvpc
.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder awsvpcConfiguration(io.github.cdklabs.cdk.ecs.codedeploy.AwsvpcConfiguration awsvpcConfiguration) {
this.awsvpcConfiguration = awsvpcConfiguration;
return this;
}
/**
* Sets the value of {@link TargetService#getCapacityProviderStrategy}
* @param capacityProviderStrategy A list of Amazon ECS capacity providers to use for the deployment.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@SuppressWarnings("unchecked")
public Builder capacityProviderStrategy(java.util.List extends software.amazon.awscdk.services.ecs.CapacityProviderStrategy> capacityProviderStrategy) {
this.capacityProviderStrategy = (java.util.List)capacityProviderStrategy;
return this;
}
/**
* Sets the value of {@link TargetService#getPlatformVersion}
* @param platformVersion The platform version of the Fargate tasks in the deployed Amazon ECS service.
* see: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/platform_versions.html
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder platformVersion(software.amazon.awscdk.services.ecs.FargatePlatformVersion platformVersion) {
this.platformVersion = platformVersion;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link TargetService}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public TargetService build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link TargetService}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements TargetService {
private final java.lang.String containerName;
private final java.lang.Number containerPort;
private final software.amazon.awscdk.services.ecs.ITaskDefinition taskDefinition;
private final io.github.cdklabs.cdk.ecs.codedeploy.AwsvpcConfiguration awsvpcConfiguration;
private final java.util.List capacityProviderStrategy;
private final software.amazon.awscdk.services.ecs.FargatePlatformVersion platformVersion;
/**
* 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.containerName = software.amazon.jsii.Kernel.get(this, "containerName", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.containerPort = software.amazon.jsii.Kernel.get(this, "containerPort", software.amazon.jsii.NativeType.forClass(java.lang.Number.class));
this.taskDefinition = software.amazon.jsii.Kernel.get(this, "taskDefinition", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ecs.ITaskDefinition.class));
this.awsvpcConfiguration = software.amazon.jsii.Kernel.get(this, "awsvpcConfiguration", software.amazon.jsii.NativeType.forClass(io.github.cdklabs.cdk.ecs.codedeploy.AwsvpcConfiguration.class));
this.capacityProviderStrategy = software.amazon.jsii.Kernel.get(this, "capacityProviderStrategy", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ecs.CapacityProviderStrategy.class)));
this.platformVersion = software.amazon.jsii.Kernel.get(this, "platformVersion", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ecs.FargatePlatformVersion.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.containerName = java.util.Objects.requireNonNull(builder.containerName, "containerName is required");
this.containerPort = java.util.Objects.requireNonNull(builder.containerPort, "containerPort is required");
this.taskDefinition = java.util.Objects.requireNonNull(builder.taskDefinition, "taskDefinition is required");
this.awsvpcConfiguration = builder.awsvpcConfiguration;
this.capacityProviderStrategy = (java.util.List)builder.capacityProviderStrategy;
this.platformVersion = builder.platformVersion;
}
@Override
public final java.lang.String getContainerName() {
return this.containerName;
}
@Override
public final java.lang.Number getContainerPort() {
return this.containerPort;
}
@Override
public final software.amazon.awscdk.services.ecs.ITaskDefinition getTaskDefinition() {
return this.taskDefinition;
}
@Override
public final io.github.cdklabs.cdk.ecs.codedeploy.AwsvpcConfiguration getAwsvpcConfiguration() {
return this.awsvpcConfiguration;
}
@Override
public final java.util.List getCapacityProviderStrategy() {
return this.capacityProviderStrategy;
}
@Override
public final software.amazon.awscdk.services.ecs.FargatePlatformVersion getPlatformVersion() {
return this.platformVersion;
}
@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("containerName", om.valueToTree(this.getContainerName()));
data.set("containerPort", om.valueToTree(this.getContainerPort()));
data.set("taskDefinition", om.valueToTree(this.getTaskDefinition()));
if (this.getAwsvpcConfiguration() != null) {
data.set("awsvpcConfiguration", om.valueToTree(this.getAwsvpcConfiguration()));
}
if (this.getCapacityProviderStrategy() != null) {
data.set("capacityProviderStrategy", om.valueToTree(this.getCapacityProviderStrategy()));
}
if (this.getPlatformVersion() != null) {
data.set("platformVersion", om.valueToTree(this.getPlatformVersion()));
}
final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
struct.set("fqn", om.valueToTree("@cdklabs/cdk-ecs-codedeploy.TargetService"));
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;
TargetService.Jsii$Proxy that = (TargetService.Jsii$Proxy) o;
if (!containerName.equals(that.containerName)) return false;
if (!containerPort.equals(that.containerPort)) return false;
if (!taskDefinition.equals(that.taskDefinition)) return false;
if (this.awsvpcConfiguration != null ? !this.awsvpcConfiguration.equals(that.awsvpcConfiguration) : that.awsvpcConfiguration != null) return false;
if (this.capacityProviderStrategy != null ? !this.capacityProviderStrategy.equals(that.capacityProviderStrategy) : that.capacityProviderStrategy != null) return false;
return this.platformVersion != null ? this.platformVersion.equals(that.platformVersion) : that.platformVersion == null;
}
@Override
public final int hashCode() {
int result = this.containerName.hashCode();
result = 31 * result + (this.containerPort.hashCode());
result = 31 * result + (this.taskDefinition.hashCode());
result = 31 * result + (this.awsvpcConfiguration != null ? this.awsvpcConfiguration.hashCode() : 0);
result = 31 * result + (this.capacityProviderStrategy != null ? this.capacityProviderStrategy.hashCode() : 0);
result = 31 * result + (this.platformVersion != null ? this.platformVersion.hashCode() : 0);
return result;
}
}
}