software.amazon.awscdk.services.ecs.Ec2ServiceAttributes Maven / Gradle / Ivy
Show all versions of ecs Show documentation
package software.amazon.awscdk.services.ecs;
/**
* The properties to import from the service using the EC2 launch type.
*
* Example:
*
*
* // The code below shows an example of how to instantiate this type.
* // The values are placeholders you should change.
* import software.amazon.awscdk.services.ecs.*;
* Cluster cluster;
* Ec2ServiceAttributes ec2ServiceAttributes = Ec2ServiceAttributes.builder()
* .cluster(cluster)
* // the properties below are optional
* .serviceArn("serviceArn")
* .serviceName("serviceName")
* .build();
*
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.74.0 (build 6d08790)", date = "2023-03-28T21:34:28.877Z")
@software.amazon.jsii.Jsii(module = software.amazon.awscdk.services.ecs.$Module.class, fqn = "@aws-cdk/aws-ecs.Ec2ServiceAttributes")
@software.amazon.jsii.Jsii.Proxy(Ec2ServiceAttributes.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public interface Ec2ServiceAttributes extends software.amazon.jsii.JsiiSerializable {
/**
* The cluster that hosts the service.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@org.jetbrains.annotations.NotNull software.amazon.awscdk.services.ecs.ICluster getCluster();
/**
* The service ARN.
*
* Default: - either this, or {@link serviceName}, is required
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable java.lang.String getServiceArn() {
return null;
}
/**
* The name of the service.
*
* Default: - either this, or {@link serviceArn}, is required
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable java.lang.String getServiceName() {
return null;
}
/**
* @return a {@link Builder} of {@link Ec2ServiceAttributes}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link Ec2ServiceAttributes}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static final class Builder implements software.amazon.jsii.Builder {
software.amazon.awscdk.services.ecs.ICluster cluster;
java.lang.String serviceArn;
java.lang.String serviceName;
/**
* Sets the value of {@link Ec2ServiceAttributes#getCluster}
* @param cluster The cluster that hosts the service. This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder cluster(software.amazon.awscdk.services.ecs.ICluster cluster) {
this.cluster = cluster;
return this;
}
/**
* Sets the value of {@link Ec2ServiceAttributes#getServiceArn}
* @param serviceArn The service ARN.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder serviceArn(java.lang.String serviceArn) {
this.serviceArn = serviceArn;
return this;
}
/**
* Sets the value of {@link Ec2ServiceAttributes#getServiceName}
* @param serviceName The name of the service.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder serviceName(java.lang.String serviceName) {
this.serviceName = serviceName;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link Ec2ServiceAttributes}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@Override
public Ec2ServiceAttributes build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link Ec2ServiceAttributes}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements Ec2ServiceAttributes {
private final software.amazon.awscdk.services.ecs.ICluster cluster;
private final java.lang.String serviceArn;
private final java.lang.String serviceName;
/**
* 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.cluster = software.amazon.jsii.Kernel.get(this, "cluster", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ecs.ICluster.class));
this.serviceArn = software.amazon.jsii.Kernel.get(this, "serviceArn", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.serviceName = software.amazon.jsii.Kernel.get(this, "serviceName", software.amazon.jsii.NativeType.forClass(java.lang.String.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.cluster = java.util.Objects.requireNonNull(builder.cluster, "cluster is required");
this.serviceArn = builder.serviceArn;
this.serviceName = builder.serviceName;
}
@Override
public final software.amazon.awscdk.services.ecs.ICluster getCluster() {
return this.cluster;
}
@Override
public final java.lang.String getServiceArn() {
return this.serviceArn;
}
@Override
public final java.lang.String getServiceName() {
return this.serviceName;
}
@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("cluster", om.valueToTree(this.getCluster()));
if (this.getServiceArn() != null) {
data.set("serviceArn", om.valueToTree(this.getServiceArn()));
}
if (this.getServiceName() != null) {
data.set("serviceName", om.valueToTree(this.getServiceName()));
}
final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
struct.set("fqn", om.valueToTree("@aws-cdk/aws-ecs.Ec2ServiceAttributes"));
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;
Ec2ServiceAttributes.Jsii$Proxy that = (Ec2ServiceAttributes.Jsii$Proxy) o;
if (!cluster.equals(that.cluster)) return false;
if (this.serviceArn != null ? !this.serviceArn.equals(that.serviceArn) : that.serviceArn != null) return false;
return this.serviceName != null ? this.serviceName.equals(that.serviceName) : that.serviceName == null;
}
@Override
public final int hashCode() {
int result = this.cluster.hashCode();
result = 31 * result + (this.serviceArn != null ? this.serviceArn.hashCode() : 0);
result = 31 * result + (this.serviceName != null ? this.serviceName.hashCode() : 0);
return result;
}
}
}