io.github.cdklabs.cdkecsserviceextensions.ServiceProps Maven / Gradle / Ivy
Show all versions of cdk-ecs-service-extensions Show documentation
package io.github.cdklabs.cdkecsserviceextensions;
/**
* (experimental) The settings for an ECS Service.
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.103.1 (build bef2dea)", date = "2024-09-19T00:29:44.792Z")
@software.amazon.jsii.Jsii(module = io.github.cdklabs.cdkecsserviceextensions.$Module.class, fqn = "@aws-cdk-containers/ecs-service-extensions.ServiceProps")
@software.amazon.jsii.Jsii.Proxy(ServiceProps.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public interface ServiceProps extends software.amazon.jsii.JsiiSerializable {
/**
* (experimental) The environment to launch the service in.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@org.jetbrains.annotations.NotNull io.github.cdklabs.cdkecsserviceextensions.IEnvironment getEnvironment();
/**
* (experimental) The ServiceDescription used to build the service.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@org.jetbrains.annotations.NotNull io.github.cdklabs.cdkecsserviceextensions.ServiceDescription getServiceDescription();
/**
* (experimental) The options for configuring the auto scaling target.
*
* Default: none
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable io.github.cdklabs.cdkecsserviceextensions.AutoScalingOptions getAutoScaleTaskCount() {
return null;
}
/**
* (experimental) The desired number of instantiations of the task definition to keep running on the service.
*
* Default: - When creating the service, default is 1; when updating the service, default uses
* the current task number.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.Number getDesiredCount() {
return null;
}
/**
* (experimental) The name of the IAM role that grants containers in the task permission to call AWS APIs on your behalf.
*
* Default: - A task role is automatically created for you.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable software.amazon.awscdk.services.iam.IRole getTaskRole() {
return null;
}
/**
* @return a {@link Builder} of {@link ServiceProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link ServiceProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static final class Builder implements software.amazon.jsii.Builder {
io.github.cdklabs.cdkecsserviceextensions.IEnvironment environment;
io.github.cdklabs.cdkecsserviceextensions.ServiceDescription serviceDescription;
io.github.cdklabs.cdkecsserviceextensions.AutoScalingOptions autoScaleTaskCount;
java.lang.Number desiredCount;
software.amazon.awscdk.services.iam.IRole taskRole;
/**
* Sets the value of {@link ServiceProps#getEnvironment}
* @param environment The environment to launch the service in. This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder environment(io.github.cdklabs.cdkecsserviceextensions.IEnvironment environment) {
this.environment = environment;
return this;
}
/**
* Sets the value of {@link ServiceProps#getServiceDescription}
* @param serviceDescription The ServiceDescription used to build the service. This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder serviceDescription(io.github.cdklabs.cdkecsserviceextensions.ServiceDescription serviceDescription) {
this.serviceDescription = serviceDescription;
return this;
}
/**
* Sets the value of {@link ServiceProps#getAutoScaleTaskCount}
* @param autoScaleTaskCount The options for configuring the auto scaling target.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder autoScaleTaskCount(io.github.cdklabs.cdkecsserviceextensions.AutoScalingOptions autoScaleTaskCount) {
this.autoScaleTaskCount = autoScaleTaskCount;
return this;
}
/**
* Sets the value of {@link ServiceProps#getDesiredCount}
* @param desiredCount The desired number of instantiations of the task definition to keep running on the service.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder desiredCount(java.lang.Number desiredCount) {
this.desiredCount = desiredCount;
return this;
}
/**
* Sets the value of {@link ServiceProps#getTaskRole}
* @param taskRole The name of the IAM role that grants containers in the task permission to call AWS APIs on your behalf.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder taskRole(software.amazon.awscdk.services.iam.IRole taskRole) {
this.taskRole = taskRole;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link ServiceProps}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public ServiceProps build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link ServiceProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements ServiceProps {
private final io.github.cdklabs.cdkecsserviceextensions.IEnvironment environment;
private final io.github.cdklabs.cdkecsserviceextensions.ServiceDescription serviceDescription;
private final io.github.cdklabs.cdkecsserviceextensions.AutoScalingOptions autoScaleTaskCount;
private final java.lang.Number desiredCount;
private final software.amazon.awscdk.services.iam.IRole taskRole;
/**
* 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.environment = software.amazon.jsii.Kernel.get(this, "environment", software.amazon.jsii.NativeType.forClass(io.github.cdklabs.cdkecsserviceextensions.IEnvironment.class));
this.serviceDescription = software.amazon.jsii.Kernel.get(this, "serviceDescription", software.amazon.jsii.NativeType.forClass(io.github.cdklabs.cdkecsserviceextensions.ServiceDescription.class));
this.autoScaleTaskCount = software.amazon.jsii.Kernel.get(this, "autoScaleTaskCount", software.amazon.jsii.NativeType.forClass(io.github.cdklabs.cdkecsserviceextensions.AutoScalingOptions.class));
this.desiredCount = software.amazon.jsii.Kernel.get(this, "desiredCount", software.amazon.jsii.NativeType.forClass(java.lang.Number.class));
this.taskRole = software.amazon.jsii.Kernel.get(this, "taskRole", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.iam.IRole.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.environment = java.util.Objects.requireNonNull(builder.environment, "environment is required");
this.serviceDescription = java.util.Objects.requireNonNull(builder.serviceDescription, "serviceDescription is required");
this.autoScaleTaskCount = builder.autoScaleTaskCount;
this.desiredCount = builder.desiredCount;
this.taskRole = builder.taskRole;
}
@Override
public final io.github.cdklabs.cdkecsserviceextensions.IEnvironment getEnvironment() {
return this.environment;
}
@Override
public final io.github.cdklabs.cdkecsserviceextensions.ServiceDescription getServiceDescription() {
return this.serviceDescription;
}
@Override
public final io.github.cdklabs.cdkecsserviceextensions.AutoScalingOptions getAutoScaleTaskCount() {
return this.autoScaleTaskCount;
}
@Override
public final java.lang.Number getDesiredCount() {
return this.desiredCount;
}
@Override
public final software.amazon.awscdk.services.iam.IRole getTaskRole() {
return this.taskRole;
}
@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("environment", om.valueToTree(this.getEnvironment()));
data.set("serviceDescription", om.valueToTree(this.getServiceDescription()));
if (this.getAutoScaleTaskCount() != null) {
data.set("autoScaleTaskCount", om.valueToTree(this.getAutoScaleTaskCount()));
}
if (this.getDesiredCount() != null) {
data.set("desiredCount", om.valueToTree(this.getDesiredCount()));
}
if (this.getTaskRole() != null) {
data.set("taskRole", om.valueToTree(this.getTaskRole()));
}
final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
struct.set("fqn", om.valueToTree("@aws-cdk-containers/ecs-service-extensions.ServiceProps"));
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;
ServiceProps.Jsii$Proxy that = (ServiceProps.Jsii$Proxy) o;
if (!environment.equals(that.environment)) return false;
if (!serviceDescription.equals(that.serviceDescription)) return false;
if (this.autoScaleTaskCount != null ? !this.autoScaleTaskCount.equals(that.autoScaleTaskCount) : that.autoScaleTaskCount != null) return false;
if (this.desiredCount != null ? !this.desiredCount.equals(that.desiredCount) : that.desiredCount != null) return false;
return this.taskRole != null ? this.taskRole.equals(that.taskRole) : that.taskRole == null;
}
@Override
public final int hashCode() {
int result = this.environment.hashCode();
result = 31 * result + (this.serviceDescription.hashCode());
result = 31 * result + (this.autoScaleTaskCount != null ? this.autoScaleTaskCount.hashCode() : 0);
result = 31 * result + (this.desiredCount != null ? this.desiredCount.hashCode() : 0);
result = 31 * result + (this.taskRole != null ? this.taskRole.hashCode() : 0);
return result;
}
}
}