io.github.cdklabs.cdkecsserviceextensions.AliasedPortProps Maven / Gradle / Ivy
Show all versions of cdk-ecs-service-extensions Show documentation
package io.github.cdklabs.cdkecsserviceextensions;
/**
* (experimental) AliasedPortProps defines the properties of an aliased port extension.
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.103.1 (build bef2dea)", date = "2024-09-27T00:29:46.189Z")
@software.amazon.jsii.Jsii(module = io.github.cdklabs.cdkecsserviceextensions.$Module.class, fqn = "@aws-cdk-containers/ecs-service-extensions.AliasedPortProps")
@software.amazon.jsii.Jsii.Proxy(AliasedPortProps.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public interface AliasedPortProps extends software.amazon.jsii.JsiiSerializable {
/**
* (experimental) The DNS alias to advertise for downstream clients.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@org.jetbrains.annotations.NotNull java.lang.String getAlias();
/**
* (experimental) The traffic port for clients to use to connect to the DNS alias.
*
* Default: - same as containerPort.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.Number getAliasPort() {
return null;
}
/**
* (experimental) The protocol to use over the specified port.
*
* May be one of HTTP, HTTP2, or GRPC.
*
* Default: - none
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable software.amazon.awscdk.services.ecs.AppProtocol getAppProtocol() {
return null;
}
/**
* @return a {@link Builder} of {@link AliasedPortProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link AliasedPortProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static final class Builder implements software.amazon.jsii.Builder {
java.lang.String alias;
java.lang.Number aliasPort;
software.amazon.awscdk.services.ecs.AppProtocol appProtocol;
/**
* Sets the value of {@link AliasedPortProps#getAlias}
* @param alias The DNS alias to advertise for downstream clients. This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder alias(java.lang.String alias) {
this.alias = alias;
return this;
}
/**
* Sets the value of {@link AliasedPortProps#getAliasPort}
* @param aliasPort The traffic port for clients to use to connect to the DNS alias.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder aliasPort(java.lang.Number aliasPort) {
this.aliasPort = aliasPort;
return this;
}
/**
* Sets the value of {@link AliasedPortProps#getAppProtocol}
* @param appProtocol The protocol to use over the specified port.
* May be one of HTTP, HTTP2, or GRPC.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder appProtocol(software.amazon.awscdk.services.ecs.AppProtocol appProtocol) {
this.appProtocol = appProtocol;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link AliasedPortProps}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public AliasedPortProps build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link AliasedPortProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements AliasedPortProps {
private final java.lang.String alias;
private final java.lang.Number aliasPort;
private final software.amazon.awscdk.services.ecs.AppProtocol appProtocol;
/**
* 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.alias = software.amazon.jsii.Kernel.get(this, "alias", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.aliasPort = software.amazon.jsii.Kernel.get(this, "aliasPort", software.amazon.jsii.NativeType.forClass(java.lang.Number.class));
this.appProtocol = software.amazon.jsii.Kernel.get(this, "appProtocol", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ecs.AppProtocol.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.alias = java.util.Objects.requireNonNull(builder.alias, "alias is required");
this.aliasPort = builder.aliasPort;
this.appProtocol = builder.appProtocol;
}
@Override
public final java.lang.String getAlias() {
return this.alias;
}
@Override
public final java.lang.Number getAliasPort() {
return this.aliasPort;
}
@Override
public final software.amazon.awscdk.services.ecs.AppProtocol getAppProtocol() {
return this.appProtocol;
}
@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("alias", om.valueToTree(this.getAlias()));
if (this.getAliasPort() != null) {
data.set("aliasPort", om.valueToTree(this.getAliasPort()));
}
if (this.getAppProtocol() != null) {
data.set("appProtocol", om.valueToTree(this.getAppProtocol()));
}
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.AliasedPortProps"));
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;
AliasedPortProps.Jsii$Proxy that = (AliasedPortProps.Jsii$Proxy) o;
if (!alias.equals(that.alias)) return false;
if (this.aliasPort != null ? !this.aliasPort.equals(that.aliasPort) : that.aliasPort != null) return false;
return this.appProtocol != null ? this.appProtocol.equals(that.appProtocol) : that.appProtocol == null;
}
@Override
public final int hashCode() {
int result = this.alias.hashCode();
result = 31 * result + (this.aliasPort != null ? this.aliasPort.hashCode() : 0);
result = 31 * result + (this.appProtocol != null ? this.appProtocol.hashCode() : 0);
return result;
}
}
}