io.github.cdklabs.cdkecsserviceextensions.AssignPublicIpExtension Maven / Gradle / Ivy
Show all versions of cdk-ecs-service-extensions Show documentation
package io.github.cdklabs.cdkecsserviceextensions;
/**
* (experimental) Modifies the service to assign a public ip to each task and optionally exposes public IPs in a Route 53 record set.
*
* Note: If you want to change the DNS zone or record name, you will need to
* remove this extension completely and then re-add it.
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.103.1 (build bef2dea)", date = "2024-09-26T00:28:54.188Z")
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Jsii(module = io.github.cdklabs.cdkecsserviceextensions.$Module.class, fqn = "@aws-cdk-containers/ecs-service-extensions.AssignPublicIpExtension")
public class AssignPublicIpExtension extends io.github.cdklabs.cdkecsserviceextensions.ServiceExtension {
protected AssignPublicIpExtension(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
}
protected AssignPublicIpExtension(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) {
super(initializationMode);
}
/**
* @param options
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public AssignPublicIpExtension(final @org.jetbrains.annotations.Nullable io.github.cdklabs.cdkecsserviceextensions.AssignPublicIpExtensionOptions options) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { options });
}
/**
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public AssignPublicIpExtension() {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this);
}
/**
* (experimental) Prior to launching the task definition as a service, this hook is called on each extension to give it a chance to mutate the properties of the service to be created.
*
* @param props This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public @org.jetbrains.annotations.NotNull io.github.cdklabs.cdkecsserviceextensions.ServiceBuild modifyServiceProps(final @org.jetbrains.annotations.NotNull io.github.cdklabs.cdkecsserviceextensions.ServiceBuild props) {
return software.amazon.jsii.Kernel.call(this, "modifyServiceProps", software.amazon.jsii.NativeType.forClass(io.github.cdklabs.cdkecsserviceextensions.ServiceBuild.class), new Object[] { java.util.Objects.requireNonNull(props, "props is required") });
}
/**
* (experimental) A hook that is called for each extension ahead of time to allow for any initial setup, such as creating resources in advance.
*
* @param service This parameter is required.
* @param _scope This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public void prehook(final @org.jetbrains.annotations.NotNull io.github.cdklabs.cdkecsserviceextensions.Service service, final @org.jetbrains.annotations.NotNull software.constructs.Construct _scope) {
software.amazon.jsii.Kernel.call(this, "prehook", software.amazon.jsii.NativeType.VOID, new Object[] { java.util.Objects.requireNonNull(service, "service is required"), java.util.Objects.requireNonNull(_scope, "_scope is required") });
}
/**
* (experimental) When this hook is implemented by extension, it allows the extension to use the service which has been created.
*
* It is generally used to
* create any final resources which might depend on the service itself.
*
* @param service This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public void useService(final @org.jetbrains.annotations.NotNull java.lang.Object service) {
if (software.amazon.jsii.Configuration.getRuntimeTypeChecking()) {
if (
!(service instanceof software.amazon.awscdk.services.ecs.Ec2Service)
&& !(service instanceof software.amazon.awscdk.services.ecs.FargateService)
) {
throw new IllegalArgumentException(
new java.lang.StringBuilder("Expected ")
.append("service")
.append(" to be one of: software.amazon.awscdk.services.ecs.Ec2Service, software.amazon.awscdk.services.ecs.FargateService; received ")
.append(service.getClass()).toString());
}
}
software.amazon.jsii.Kernel.call(this, "useService", software.amazon.jsii.NativeType.VOID, new Object[] { java.util.Objects.requireNonNull(service, "service is required") });
}
/**
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.Nullable io.github.cdklabs.cdkecsserviceextensions.AssignPublicIpDnsOptions getDns() {
return software.amazon.jsii.Kernel.get(this, "dns", software.amazon.jsii.NativeType.forClass(io.github.cdklabs.cdkecsserviceextensions.AssignPublicIpDnsOptions.class));
}
/**
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public void setDns(final @org.jetbrains.annotations.Nullable io.github.cdklabs.cdkecsserviceextensions.AssignPublicIpDnsOptions value) {
software.amazon.jsii.Kernel.set(this, "dns", value);
}
/**
* (experimental) A fluent builder for {@link io.github.cdklabs.cdkecsserviceextensions.AssignPublicIpExtension}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static final class Builder implements software.amazon.jsii.Builder {
/**
* @return a new instance of {@link Builder}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static Builder create() {
return new Builder();
}
private io.github.cdklabs.cdkecsserviceextensions.AssignPublicIpExtensionOptions.Builder options;
private Builder() {
}
/**
* (experimental) Enable publishing task public IPs to a recordset in a Route 53 hosted zone.
*
* Note: If you want to change the DNS zone or record name, you will need to
* remove this extension completely and then re-add it.
*
* @return {@code this}
* @param dns Enable publishing task public IPs to a recordset in a Route 53 hosted zone. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder dns(final io.github.cdklabs.cdkecsserviceextensions.AssignPublicIpDnsOptions dns) {
this.options().dns(dns);
return this;
}
/**
* @return a newly built instance of {@link io.github.cdklabs.cdkecsserviceextensions.AssignPublicIpExtension}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public io.github.cdklabs.cdkecsserviceextensions.AssignPublicIpExtension build() {
return new io.github.cdklabs.cdkecsserviceextensions.AssignPublicIpExtension(
this.options != null ? this.options.build() : null
);
}
private io.github.cdklabs.cdkecsserviceextensions.AssignPublicIpExtensionOptions.Builder options() {
if (this.options == null) {
this.options = new io.github.cdklabs.cdkecsserviceextensions.AssignPublicIpExtensionOptions.Builder();
}
return this.options;
}
}
}