software.amazon.awscdk.services.ecs.AssociateCloudMapServiceOptions Maven / Gradle / Ivy
Show all versions of ecs Show documentation
package software.amazon.awscdk.services.ecs;
/**
* The options for using a cloudmap service.
*
* Example:
*
*
* Service cloudMapService;
* FargateService ecsService;
* ecsService.associateCloudMapService(AssociateCloudMapServiceOptions.builder()
* .service(cloudMapService)
* .build());
*
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.74.0 (build 6d08790)", date = "2023-03-28T21:34:28.640Z")
@software.amazon.jsii.Jsii(module = software.amazon.awscdk.services.ecs.$Module.class, fqn = "@aws-cdk/aws-ecs.AssociateCloudMapServiceOptions")
@software.amazon.jsii.Jsii.Proxy(AssociateCloudMapServiceOptions.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public interface AssociateCloudMapServiceOptions extends software.amazon.jsii.JsiiSerializable {
/**
* The cloudmap service to register with.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@org.jetbrains.annotations.NotNull software.amazon.awscdk.services.servicediscovery.IService getService();
/**
* The container to point to for a SRV record.
*
* Default: - the task definition's default container
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable software.amazon.awscdk.services.ecs.ContainerDefinition getContainer() {
return null;
}
/**
* The port to point to for a SRV record.
*
* Default: - the default port of the task definition's default container
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable java.lang.Number getContainerPort() {
return null;
}
/**
* @return a {@link Builder} of {@link AssociateCloudMapServiceOptions}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link AssociateCloudMapServiceOptions}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static final class Builder implements software.amazon.jsii.Builder {
software.amazon.awscdk.services.servicediscovery.IService service;
software.amazon.awscdk.services.ecs.ContainerDefinition container;
java.lang.Number containerPort;
/**
* Sets the value of {@link AssociateCloudMapServiceOptions#getService}
* @param service The cloudmap service to register with. This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder service(software.amazon.awscdk.services.servicediscovery.IService service) {
this.service = service;
return this;
}
/**
* Sets the value of {@link AssociateCloudMapServiceOptions#getContainer}
* @param container The container to point to for a SRV record.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder container(software.amazon.awscdk.services.ecs.ContainerDefinition container) {
this.container = container;
return this;
}
/**
* Sets the value of {@link AssociateCloudMapServiceOptions#getContainerPort}
* @param containerPort The port to point to for a SRV record.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder containerPort(java.lang.Number containerPort) {
this.containerPort = containerPort;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link AssociateCloudMapServiceOptions}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@Override
public AssociateCloudMapServiceOptions build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link AssociateCloudMapServiceOptions}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements AssociateCloudMapServiceOptions {
private final software.amazon.awscdk.services.servicediscovery.IService service;
private final software.amazon.awscdk.services.ecs.ContainerDefinition container;
private final java.lang.Number containerPort;
/**
* 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.service = software.amazon.jsii.Kernel.get(this, "service", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.servicediscovery.IService.class));
this.container = software.amazon.jsii.Kernel.get(this, "container", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ecs.ContainerDefinition.class));
this.containerPort = software.amazon.jsii.Kernel.get(this, "containerPort", software.amazon.jsii.NativeType.forClass(java.lang.Number.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.service = java.util.Objects.requireNonNull(builder.service, "service is required");
this.container = builder.container;
this.containerPort = builder.containerPort;
}
@Override
public final software.amazon.awscdk.services.servicediscovery.IService getService() {
return this.service;
}
@Override
public final software.amazon.awscdk.services.ecs.ContainerDefinition getContainer() {
return this.container;
}
@Override
public final java.lang.Number getContainerPort() {
return this.containerPort;
}
@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("service", om.valueToTree(this.getService()));
if (this.getContainer() != null) {
data.set("container", om.valueToTree(this.getContainer()));
}
if (this.getContainerPort() != null) {
data.set("containerPort", om.valueToTree(this.getContainerPort()));
}
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.AssociateCloudMapServiceOptions"));
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;
AssociateCloudMapServiceOptions.Jsii$Proxy that = (AssociateCloudMapServiceOptions.Jsii$Proxy) o;
if (!service.equals(that.service)) return false;
if (this.container != null ? !this.container.equals(that.container) : that.container != null) return false;
return this.containerPort != null ? this.containerPort.equals(that.containerPort) : that.containerPort == null;
}
@Override
public final int hashCode() {
int result = this.service.hashCode();
result = 31 * result + (this.container != null ? this.container.hashCode() : 0);
result = 31 * result + (this.containerPort != null ? this.containerPort.hashCode() : 0);
return result;
}
}
}