io.cloudshiftdev.awscdk.services.dynamodb.UtilizationScalingProps.kt Maven / Gradle / Ivy
The newest version!
@file:Suppress("RedundantVisibilityModifier","RedundantUnitReturnType","RemoveRedundantQualifierName","unused","UnusedImport","ClassName","REDUNDANT_PROJECTION","DEPRECATION")
package io.cloudshiftdev.awscdk.services.dynamodb
import io.cloudshiftdev.awscdk.Duration
import io.cloudshiftdev.awscdk.common.CdkDslMarker
import io.cloudshiftdev.awscdk.common.CdkObject
import io.cloudshiftdev.awscdk.common.CdkObjectWrappers
import io.cloudshiftdev.awscdk.services.applicationautoscaling.BaseTargetTrackingProps
import kotlin.Boolean
import kotlin.Number
import kotlin.String
import kotlin.Unit
/**
* Properties for enabling DynamoDB utilization tracking.
*
* Example:
*
* ```
* import io.cloudshiftdev.awscdk.services.dynamodb.*;
* Table table;
* IScalableTableAttribute readCapacity = table.autoScaleReadCapacity(EnableScalingProps.builder()
* .minCapacity(10)
* .maxCapacity(1000)
* .build());
* readCapacity.scaleOnUtilization(UtilizationScalingProps.builder()
* .targetUtilizationPercent(60)
* .build());
* ```
*/
public interface UtilizationScalingProps : BaseTargetTrackingProps {
/**
* Target utilization percentage for the attribute.
*/
public fun targetUtilizationPercent(): Number
/**
* A builder for [UtilizationScalingProps]
*/
@CdkDslMarker
public interface Builder {
/**
* @param disableScaleIn Indicates whether scale in by the target tracking policy is disabled.
* If the value is true, scale in is disabled and the target tracking policy
* won't remove capacity from the scalable resource. Otherwise, scale in is
* enabled and the target tracking policy can remove capacity from the
* scalable resource.
*/
public fun disableScaleIn(disableScaleIn: Boolean)
/**
* @param policyName A name for the scaling policy.
*/
public fun policyName(policyName: String)
/**
* @param scaleInCooldown Period after a scale in activity completes before another scale in
* activity can start.
*/
public fun scaleInCooldown(scaleInCooldown: Duration)
/**
* @param scaleOutCooldown Period after a scale out activity completes before another scale out
* activity can start.
*/
public fun scaleOutCooldown(scaleOutCooldown: Duration)
/**
* @param targetUtilizationPercent Target utilization percentage for the attribute.
*/
public fun targetUtilizationPercent(targetUtilizationPercent: Number)
}
private class BuilderImpl : Builder {
private val cdkBuilder: software.amazon.awscdk.services.dynamodb.UtilizationScalingProps.Builder
= software.amazon.awscdk.services.dynamodb.UtilizationScalingProps.builder()
/**
* @param disableScaleIn Indicates whether scale in by the target tracking policy is disabled.
* If the value is true, scale in is disabled and the target tracking policy
* won't remove capacity from the scalable resource. Otherwise, scale in is
* enabled and the target tracking policy can remove capacity from the
* scalable resource.
*/
override fun disableScaleIn(disableScaleIn: Boolean) {
cdkBuilder.disableScaleIn(disableScaleIn)
}
/**
* @param policyName A name for the scaling policy.
*/
override fun policyName(policyName: String) {
cdkBuilder.policyName(policyName)
}
/**
* @param scaleInCooldown Period after a scale in activity completes before another scale in
* activity can start.
*/
override fun scaleInCooldown(scaleInCooldown: Duration) {
cdkBuilder.scaleInCooldown(scaleInCooldown.let(Duration.Companion::unwrap))
}
/**
* @param scaleOutCooldown Period after a scale out activity completes before another scale out
* activity can start.
*/
override fun scaleOutCooldown(scaleOutCooldown: Duration) {
cdkBuilder.scaleOutCooldown(scaleOutCooldown.let(Duration.Companion::unwrap))
}
/**
* @param targetUtilizationPercent Target utilization percentage for the attribute.
*/
override fun targetUtilizationPercent(targetUtilizationPercent: Number) {
cdkBuilder.targetUtilizationPercent(targetUtilizationPercent)
}
public fun build(): software.amazon.awscdk.services.dynamodb.UtilizationScalingProps =
cdkBuilder.build()
}
private class Wrapper(
cdkObject: software.amazon.awscdk.services.dynamodb.UtilizationScalingProps,
) : CdkObject(cdkObject),
UtilizationScalingProps {
/**
* Indicates whether scale in by the target tracking policy is disabled.
*
* If the value is true, scale in is disabled and the target tracking policy
* won't remove capacity from the scalable resource. Otherwise, scale in is
* enabled and the target tracking policy can remove capacity from the
* scalable resource.
*
* Default: false
*/
override fun disableScaleIn(): Boolean? = unwrap(this).getDisableScaleIn()
/**
* A name for the scaling policy.
*
* Default: - Automatically generated name.
*/
override fun policyName(): String? = unwrap(this).getPolicyName()
/**
* Period after a scale in activity completes before another scale in activity can start.
*
* Default: Duration.seconds(300) for the following scalable targets: ECS services,
* Spot Fleet requests, EMR clusters, AppStream 2.0 fleets, Aurora DB clusters,
* Amazon SageMaker endpoint variants, Custom resources. For all other scalable
* targets, the default value is Duration.seconds(0): DynamoDB tables, DynamoDB
* global secondary indexes, Amazon Comprehend document classification endpoints,
* Lambda provisioned concurrency
*/
override fun scaleInCooldown(): Duration? =
unwrap(this).getScaleInCooldown()?.let(Duration::wrap)
/**
* Period after a scale out activity completes before another scale out activity can start.
*
* Default: Duration.seconds(300) for the following scalable targets: ECS services,
* Spot Fleet requests, EMR clusters, AppStream 2.0 fleets, Aurora DB clusters,
* Amazon SageMaker endpoint variants, Custom resources. For all other scalable
* targets, the default value is Duration.seconds(0): DynamoDB tables, DynamoDB
* global secondary indexes, Amazon Comprehend document classification endpoints,
* Lambda provisioned concurrency
*/
override fun scaleOutCooldown(): Duration? =
unwrap(this).getScaleOutCooldown()?.let(Duration::wrap)
/**
* Target utilization percentage for the attribute.
*/
override fun targetUtilizationPercent(): Number = unwrap(this).getTargetUtilizationPercent()
}
public companion object {
public operator fun invoke(block: Builder.() -> Unit = {}): UtilizationScalingProps {
val builderImpl = BuilderImpl()
return Wrapper(builderImpl.apply(block).build())
}
internal fun wrap(cdkObject: software.amazon.awscdk.services.dynamodb.UtilizationScalingProps):
UtilizationScalingProps = CdkObjectWrappers.wrap(cdkObject) as? UtilizationScalingProps ?:
Wrapper(cdkObject)
internal fun unwrap(wrapped: UtilizationScalingProps):
software.amazon.awscdk.services.dynamodb.UtilizationScalingProps = (wrapped as
CdkObject).cdkObject as software.amazon.awscdk.services.dynamodb.UtilizationScalingProps
}
}