io.github.cdklabs.cdkecsserviceextensions.Service Maven / Gradle / Ivy
Show all versions of cdk-ecs-service-extensions Show documentation
package io.github.cdklabs.cdkecsserviceextensions;
/**
* (experimental) This Service construct serves as a Builder class for an ECS service.
*
* It
* supports various extensions and keeps track of any mutating state, allowing
* it to build up an ECS service progressively.
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.103.1 (build bef2dea)", date = "2024-09-25T00:29:02.316Z")
@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.Service")
public class Service extends software.constructs.Construct {
protected Service(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
}
protected Service(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) {
super(initializationMode);
}
/**
* @param scope This parameter is required.
* @param id This parameter is required.
* @param props This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Service(final @org.jetbrains.annotations.NotNull software.constructs.Construct scope, final @org.jetbrains.annotations.NotNull java.lang.String id, final @org.jetbrains.annotations.NotNull io.github.cdklabs.cdkecsserviceextensions.ServiceProps props) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(scope, "scope is required"), java.util.Objects.requireNonNull(id, "id is required"), java.util.Objects.requireNonNull(props, "props is required") });
}
/**
* (experimental) This method adds a new URL for the service.
*
* This allows extensions to
* submit a URL for the service. For example, a load balancer might add its
* URL, or App Mesh can add its DNS name for the service.
*
* @param urlName
- The identifier name for this URL.
This parameter is required.
* @param url - The URL itself.
This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public void addURL(final @org.jetbrains.annotations.NotNull java.lang.String urlName, final @org.jetbrains.annotations.NotNull java.lang.String url) {
software.amazon.jsii.Kernel.call(this, "addURL", software.amazon.jsii.NativeType.VOID, new Object[] { java.util.Objects.requireNonNull(urlName, "urlName is required"), java.util.Objects.requireNonNull(url, "url is required") });
}
/**
* (experimental) Tell extensions from one service to connect to extensions from another sevice if they have implemented a hook for it.
*
* @param service This parameter is required.
* @param connectToProps
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public void connectTo(final @org.jetbrains.annotations.NotNull io.github.cdklabs.cdkecsserviceextensions.Service service, final @org.jetbrains.annotations.Nullable io.github.cdklabs.cdkecsserviceextensions.ConnectToProps connectToProps) {
software.amazon.jsii.Kernel.call(this, "connectTo", software.amazon.jsii.NativeType.VOID, new Object[] { java.util.Objects.requireNonNull(service, "service is required"), connectToProps });
}
/**
* (experimental) Tell extensions from one service to connect to extensions from another sevice if they have implemented a hook for it.
*
* @param service This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public void connectTo(final @org.jetbrains.annotations.NotNull io.github.cdklabs.cdkecsserviceextensions.Service service) {
software.amazon.jsii.Kernel.call(this, "connectTo", software.amazon.jsii.NativeType.VOID, new Object[] { java.util.Objects.requireNonNull(service, "service is required") });
}
/**
* (experimental) This helper method is used to set the autoScalingPoliciesEnabled
attribute whenever an auto scaling policy is configured for the service.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public void enableAutoScalingPolicy() {
software.amazon.jsii.Kernel.call(this, "enableAutoScalingPolicy", software.amazon.jsii.NativeType.VOID);
}
/**
* (experimental) Retrieve a URL for the service.
*
* The URL must have previously been
* stored by one of the URL providing extensions.
*
* @param urlName
- The URL to look up.
This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull java.lang.String getURL(final @org.jetbrains.annotations.NotNull java.lang.String urlName) {
return software.amazon.jsii.Kernel.call(this, "getURL", software.amazon.jsii.NativeType.forClass(java.lang.String.class), new Object[] { java.util.Objects.requireNonNull(urlName, "urlName is required") });
}
/**
* (experimental) The capacity type that this service will use.
*
* Valid values are EC2 or FARGATE.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull io.github.cdklabs.cdkecsserviceextensions.EnvironmentCapacityType getCapacityType() {
return software.amazon.jsii.Kernel.get(this, "capacityType", software.amazon.jsii.NativeType.forClass(io.github.cdklabs.cdkecsserviceextensions.EnvironmentCapacityType.class));
}
/**
* (experimental) The cluster that is providing capacity for this service.
*
* [disable-awslint:ref-via-interface]
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.ecs.ICluster getCluster() {
return software.amazon.jsii.Kernel.get(this, "cluster", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ecs.ICluster.class));
}
/**
* (experimental) The environment where this service was launched.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull io.github.cdklabs.cdkecsserviceextensions.IEnvironment getEnvironment() {
return software.amazon.jsii.Kernel.get(this, "environment", software.amazon.jsii.NativeType.forClass(io.github.cdklabs.cdkecsserviceextensions.IEnvironment.class));
}
/**
* (experimental) The name of the service.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull java.lang.String getId() {
return software.amazon.jsii.Kernel.get(this, "id", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
}
/**
* (experimental) The ServiceDescription used to build this service.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull io.github.cdklabs.cdkecsserviceextensions.ServiceDescription getServiceDescription() {
return software.amazon.jsii.Kernel.get(this, "serviceDescription", software.amazon.jsii.NativeType.forClass(io.github.cdklabs.cdkecsserviceextensions.ServiceDescription.class));
}
/**
* (experimental) The VPC where this service should be placed.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.ec2.IVpc getVpc() {
return software.amazon.jsii.Kernel.get(this, "vpc", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ec2.IVpc.class));
}
/**
* (experimental) The scalable attribute representing task count.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.Nullable software.amazon.awscdk.services.ecs.ScalableTaskCount getScalableTaskCount() {
return software.amazon.jsii.Kernel.get(this, "scalableTaskCount", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ecs.ScalableTaskCount.class));
}
/**
* (experimental) The underlying ECS service that was created.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull java.lang.Object getEcsService() {
return software.amazon.jsii.Kernel.get(this, "ecsService", software.amazon.jsii.NativeType.forClass(java.lang.Object.class));
}
/**
* (experimental) The underlying ECS service that was created.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public void setEcsService(final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.ecs.Ec2Service value) {
software.amazon.jsii.Kernel.set(this, "ecsService", java.util.Objects.requireNonNull(value, "ecsService is required"));
}
/**
* (experimental) The underlying ECS service that was created.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public void setEcsService(final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.ecs.FargateService value) {
software.amazon.jsii.Kernel.set(this, "ecsService", java.util.Objects.requireNonNull(value, "ecsService is required"));
}
/**
* (experimental) The generated task definition for this service.
*
* It is only
* generated after .prepare() has been executed.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
protected @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.ecs.TaskDefinition getTaskDefinition() {
return software.amazon.jsii.Kernel.get(this, "taskDefinition", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ecs.TaskDefinition.class));
}
/**
* (experimental) The generated task definition for this service.
*
* It is only
* generated after .prepare() has been executed.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
protected void setTaskDefinition(final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.ecs.TaskDefinition value) {
software.amazon.jsii.Kernel.set(this, "taskDefinition", java.util.Objects.requireNonNull(value, "taskDefinition is required"));
}
/**
* (experimental) The application target group if the service has an HTTPLoadBalancerExtension.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.Nullable software.amazon.awscdk.services.elasticloadbalancingv2.ApplicationTargetGroup getTargetGroup() {
return software.amazon.jsii.Kernel.get(this, "targetGroup", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.elasticloadbalancingv2.ApplicationTargetGroup.class));
}
/**
* (experimental) The application target group if the service has an HTTPLoadBalancerExtension.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public void setTargetGroup(final @org.jetbrains.annotations.Nullable software.amazon.awscdk.services.elasticloadbalancingv2.ApplicationTargetGroup value) {
software.amazon.jsii.Kernel.set(this, "targetGroup", value);
}
/**
* (experimental) A fluent builder for {@link io.github.cdklabs.cdkecsserviceextensions.Service}.
*/
@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}.
* @param scope This parameter is required.
* @param id This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static Builder create(final software.constructs.Construct scope, final java.lang.String id) {
return new Builder(scope, id);
}
private final software.constructs.Construct scope;
private final java.lang.String id;
private final io.github.cdklabs.cdkecsserviceextensions.ServiceProps.Builder props;
private Builder(final software.constructs.Construct scope, final java.lang.String id) {
this.scope = scope;
this.id = id;
this.props = new io.github.cdklabs.cdkecsserviceextensions.ServiceProps.Builder();
}
/**
* (experimental) The environment to launch the service in.
*
* @return {@code this}
* @param environment The environment to launch the service in. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder environment(final io.github.cdklabs.cdkecsserviceextensions.IEnvironment environment) {
this.props.environment(environment);
return this;
}
/**
* (experimental) The ServiceDescription used to build the service.
*
* @return {@code this}
* @param serviceDescription The ServiceDescription used to build the service. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder serviceDescription(final io.github.cdklabs.cdkecsserviceextensions.ServiceDescription serviceDescription) {
this.props.serviceDescription(serviceDescription);
return this;
}
/**
* (experimental) The options for configuring the auto scaling target.
*
* Default: none
*
* @return {@code this}
* @param autoScaleTaskCount The options for configuring the auto scaling target. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder autoScaleTaskCount(final io.github.cdklabs.cdkecsserviceextensions.AutoScalingOptions autoScaleTaskCount) {
this.props.autoScaleTaskCount(autoScaleTaskCount);
return this;
}
/**
* (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.
*
* @return {@code this}
* @param desiredCount The desired number of instantiations of the task definition to keep running on the service. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder desiredCount(final java.lang.Number desiredCount) {
this.props.desiredCount(desiredCount);
return this;
}
/**
* (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.
*
* @return {@code this}
* @param taskRole The name of the IAM role that grants containers in the task permission to call AWS APIs on your behalf. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder taskRole(final software.amazon.awscdk.services.iam.IRole taskRole) {
this.props.taskRole(taskRole);
return this;
}
/**
* @return a newly built instance of {@link io.github.cdklabs.cdkecsserviceextensions.Service}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public io.github.cdklabs.cdkecsserviceextensions.Service build() {
return new io.github.cdklabs.cdkecsserviceextensions.Service(
this.scope,
this.id,
this.props.build()
);
}
}
}