io.github.cdklabs.cdkecsserviceextensions.ScaleOnCpuUtilization Maven / Gradle / Ivy
Show all versions of cdk-ecs-service-extensions Show documentation
package io.github.cdklabs.cdkecsserviceextensions;
/**
* (deprecated) This extension helps you scale your service according to CPU utilization.
*
* @deprecated To enable target tracking based on CPU utilization, use the targetCpuUtilization
property of autoScaleTaskCount
in the Service
construct.
* For more information, please refer https://github.com/aws/aws-cdk/blob/master/packages/%40aws-cdk-containers/ecs-service-extensions/README.md#task-auto-scaling .
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.103.1 (build bef2dea)", date = "2024-09-20T00:29:08.067Z")
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated)
@Deprecated
@software.amazon.jsii.Jsii(module = io.github.cdklabs.cdkecsserviceextensions.$Module.class, fqn = "@aws-cdk-containers/ecs-service-extensions.ScaleOnCpuUtilization")
public class ScaleOnCpuUtilization extends io.github.cdklabs.cdkecsserviceextensions.ServiceExtension {
protected ScaleOnCpuUtilization(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
}
protected ScaleOnCpuUtilization(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) {
super(initializationMode);
}
/**
* @param props
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated)
@Deprecated
public ScaleOnCpuUtilization(final @org.jetbrains.annotations.Nullable io.github.cdklabs.cdkecsserviceextensions.CpuScalingProps props) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { props });
}
/**
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated)
@Deprecated
public ScaleOnCpuUtilization() {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this);
}
/**
* (deprecated) 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.Deprecated)
@Deprecated
@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") });
}
/**
* (deprecated) 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.Deprecated)
@Deprecated
@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") });
}
/**
* (deprecated) How many tasks to launch initially.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated)
@Deprecated
public @org.jetbrains.annotations.NotNull java.lang.Number getInitialTaskCount() {
return software.amazon.jsii.Kernel.get(this, "initialTaskCount", software.amazon.jsii.NativeType.forClass(java.lang.Number.class));
}
/**
* (deprecated) The maximum number of tasks when scaling out.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated)
@Deprecated
public @org.jetbrains.annotations.NotNull java.lang.Number getMaxTaskCount() {
return software.amazon.jsii.Kernel.get(this, "maxTaskCount", software.amazon.jsii.NativeType.forClass(java.lang.Number.class));
}
/**
* (deprecated) The minimum number of tasks when scaling in.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated)
@Deprecated
public @org.jetbrains.annotations.NotNull java.lang.Number getMinTaskCount() {
return software.amazon.jsii.Kernel.get(this, "minTaskCount", software.amazon.jsii.NativeType.forClass(java.lang.Number.class));
}
/**
* (deprecated) How long to wait between scale in actions.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated)
@Deprecated
public @org.jetbrains.annotations.NotNull software.amazon.awscdk.Duration getScaleInCooldown() {
return software.amazon.jsii.Kernel.get(this, "scaleInCooldown", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.Duration.class));
}
/**
* (deprecated) How long to wait between scale out actions.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated)
@Deprecated
public @org.jetbrains.annotations.NotNull software.amazon.awscdk.Duration getScaleOutCooldown() {
return software.amazon.jsii.Kernel.get(this, "scaleOutCooldown", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.Duration.class));
}
/**
* (deprecated) The CPU utilization to try ot maintain.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated)
@Deprecated
public @org.jetbrains.annotations.NotNull java.lang.Number getTargetCpuUtilization() {
return software.amazon.jsii.Kernel.get(this, "targetCpuUtilization", software.amazon.jsii.NativeType.forClass(java.lang.Number.class));
}
/**
* (deprecated) A fluent builder for {@link io.github.cdklabs.cdkecsserviceextensions.ScaleOnCpuUtilization}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated)
@Deprecated
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.Deprecated)
@Deprecated
public static Builder create() {
return new Builder();
}
private io.github.cdklabs.cdkecsserviceextensions.CpuScalingProps.Builder props;
private Builder() {
}
/**
* (deprecated) How many tasks to launch initially.
*
* Default: - 2
*
* @return {@code this}
* @param initialTaskCount How many tasks to launch initially. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated)
@Deprecated
public Builder initialTaskCount(final java.lang.Number initialTaskCount) {
this.props().initialTaskCount(initialTaskCount);
return this;
}
/**
* (deprecated) The maximum number of tasks when scaling out.
*
* Default: - 8
*
* @return {@code this}
* @param maxTaskCount The maximum number of tasks when scaling out. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated)
@Deprecated
public Builder maxTaskCount(final java.lang.Number maxTaskCount) {
this.props().maxTaskCount(maxTaskCount);
return this;
}
/**
* (deprecated) The minimum number of tasks when scaling in.
*
* Default: - 2
*
* @return {@code this}
* @param minTaskCount The minimum number of tasks when scaling in. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated)
@Deprecated
public Builder minTaskCount(final java.lang.Number minTaskCount) {
this.props().minTaskCount(minTaskCount);
return this;
}
/**
* (deprecated) How long to wait between scale in actions.
*
* Default: - 60 seconds
*
* @return {@code this}
* @param scaleInCooldown How long to wait between scale in actions. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated)
@Deprecated
public Builder scaleInCooldown(final software.amazon.awscdk.Duration scaleInCooldown) {
this.props().scaleInCooldown(scaleInCooldown);
return this;
}
/**
* (deprecated) How long to wait between scale out actions.
*
* Default: - 60 seconds
*
* @return {@code this}
* @param scaleOutCooldown How long to wait between scale out actions. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated)
@Deprecated
public Builder scaleOutCooldown(final software.amazon.awscdk.Duration scaleOutCooldown) {
this.props().scaleOutCooldown(scaleOutCooldown);
return this;
}
/**
* (deprecated) The CPU utilization to try ot maintain.
*
* Default: - 50%
*
* @return {@code this}
* @param targetCpuUtilization The CPU utilization to try ot maintain. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated)
@Deprecated
public Builder targetCpuUtilization(final java.lang.Number targetCpuUtilization) {
this.props().targetCpuUtilization(targetCpuUtilization);
return this;
}
/**
* @return a newly built instance of {@link io.github.cdklabs.cdkecsserviceextensions.ScaleOnCpuUtilization}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated)
@Deprecated
@Override
public io.github.cdklabs.cdkecsserviceextensions.ScaleOnCpuUtilization build() {
return new io.github.cdklabs.cdkecsserviceextensions.ScaleOnCpuUtilization(
this.props != null ? this.props.build() : null
);
}
private io.github.cdklabs.cdkecsserviceextensions.CpuScalingProps.Builder props() {
if (this.props == null) {
this.props = new io.github.cdklabs.cdkecsserviceextensions.CpuScalingProps.Builder();
}
return this.props;
}
}
}