java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.CfnElement
software.amazon.awscdk.CfnRefElement
software.amazon.awscdk.CfnResource
software.amazon.awscdk.services.applicationautoscaling.CfnScalingPolicy
All Implemented Interfaces:
IInspectable, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.97.0 (build 729de35)", date="2024-04-18T17:54:12.345Z") @Stability(Stable) public class CfnScalingPolicy extends CfnResource implements IInspectable
The AWS::ApplicationAutoScaling::ScalingPolicy resource defines a scaling policy that Application Auto Scaling uses to adjust the capacity of a scalable target.

For more information, see Target tracking scaling policies and Step scaling policies in the Application Auto Scaling User Guide .

Example:

 // The code below shows an example of how to instantiate this type.
 // The values are placeholders you should change.
 import software.amazon.awscdk.services.applicationautoscaling.*;
 CfnScalingPolicy cfnScalingPolicy = CfnScalingPolicy.Builder.create(this, "MyCfnScalingPolicy")
         .policyName("policyName")
         .policyType("policyType")
         // the properties below are optional
         .resourceId("resourceId")
         .scalableDimension("scalableDimension")
         .scalingTargetId("scalingTargetId")
         .serviceNamespace("serviceNamespace")
         .stepScalingPolicyConfiguration(StepScalingPolicyConfigurationProperty.builder()
                 .adjustmentType("adjustmentType")
                 .cooldown(123)
                 .metricAggregationType("metricAggregationType")
                 .minAdjustmentMagnitude(123)
                 .stepAdjustments(List.of(StepAdjustmentProperty.builder()
                         .scalingAdjustment(123)
                         // the properties below are optional
                         .metricIntervalLowerBound(123)
                         .metricIntervalUpperBound(123)
                         .build()))
                 .build())
         .targetTrackingScalingPolicyConfiguration(TargetTrackingScalingPolicyConfigurationProperty.builder()
                 .targetValue(123)
                 // the properties below are optional
                 .customizedMetricSpecification(CustomizedMetricSpecificationProperty.builder()
                         .dimensions(List.of(MetricDimensionProperty.builder()
                                 .name("name")
                                 .value("value")
                                 .build()))
                         .metricName("metricName")
                         .metrics(List.of(TargetTrackingMetricDataQueryProperty.builder()
                                 .expression("expression")
                                 .id("id")
                                 .label("label")
                                 .metricStat(TargetTrackingMetricStatProperty.builder()
                                         .metric(TargetTrackingMetricProperty.builder()
                                                 .dimensions(List.of(TargetTrackingMetricDimensionProperty.builder()
                                                         .name("name")
                                                         .value("value")
                                                         .build()))
                                                 .metricName("metricName")
                                                 .namespace("namespace")
                                                 .build())
                                         .stat("stat")
                                         .unit("unit")
                                         .build())
                                 .returnData(false)
                                 .build()))
                         .namespace("namespace")
                         .statistic("statistic")
                         .unit("unit")
                         .build())
                 .disableScaleIn(false)
                 .predefinedMetricSpecification(PredefinedMetricSpecificationProperty.builder()
                         .predefinedMetricType("predefinedMetricType")
                         // the properties below are optional
                         .resourceLabel("resourceLabel")
                         .build())
                 .scaleInCooldown(123)
                 .scaleOutCooldown(123)
                 .build())
         .build();
 

See Also:
  • Field Details

    • CFN_RESOURCE_TYPE_NAME

      @Stability(Stable) public static final String CFN_RESOURCE_TYPE_NAME
      The CloudFormation resource type name for this resource class.
  • Constructor Details

    • CfnScalingPolicy

      protected CfnScalingPolicy(software.amazon.jsii.JsiiObjectRef objRef)
    • CfnScalingPolicy

      protected CfnScalingPolicy(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • CfnScalingPolicy

      @Stability(Stable) public CfnScalingPolicy(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull CfnScalingPolicyProps props)
      Parameters:
      scope - Scope in which this resource is defined. This parameter is required.
      id - Construct identifier for this resource (unique in its scope). This parameter is required.
      props - Resource properties. This parameter is required.
  • Method Details

    • inspect

      @Stability(Stable) public void inspect(@NotNull TreeInspector inspector)
      Examines the CloudFormation resource and discloses attributes.

      Specified by:
      inspect in interface IInspectable
      Parameters:
      inspector - tree inspector to collect and process attributes. This parameter is required.
    • renderProperties

      @Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String,Object> props)
      Overrides:
      renderProperties in class CfnResource
      Parameters:
      props - This parameter is required.
    • getAttrArn

      @Stability(Stable) @NotNull public String getAttrArn()
      Returns the ARN of a scaling policy.
    • getCfnProperties

      @Stability(Stable) @NotNull protected Map<String,Object> getCfnProperties()
      Overrides:
      getCfnProperties in class CfnResource
    • getPolicyName

      @Stability(Stable) @NotNull public String getPolicyName()
      The name of the scaling policy.
    • setPolicyName

      @Stability(Stable) public void setPolicyName(@NotNull String value)
      The name of the scaling policy.
    • getPolicyType

      @Stability(Stable) @NotNull public String getPolicyType()
      The scaling policy type.
    • setPolicyType

      @Stability(Stable) public void setPolicyType(@NotNull String value)
      The scaling policy type.
    • getResourceId

      @Stability(Stable) @Nullable public String getResourceId()
      The identifier of the resource associated with the scaling policy.
    • setResourceId

      @Stability(Stable) public void setResourceId(@Nullable String value)
      The identifier of the resource associated with the scaling policy.
    • getScalableDimension

      @Stability(Stable) @Nullable public String getScalableDimension()
      The scalable dimension.

      This string consists of the service namespace, resource type, and scaling property.

    • setScalableDimension

      @Stability(Stable) public void setScalableDimension(@Nullable String value)
      The scalable dimension.

      This string consists of the service namespace, resource type, and scaling property.

    • getScalingTargetId

      @Stability(Stable) @Nullable public String getScalingTargetId()
      The CloudFormation-generated ID of an Application Auto Scaling scalable target.
    • setScalingTargetId

      @Stability(Stable) public void setScalingTargetId(@Nullable String value)
      The CloudFormation-generated ID of an Application Auto Scaling scalable target.
    • getServiceNamespace

      @Stability(Stable) @Nullable public String getServiceNamespace()
      The namespace of the AWS service that provides the resource, or a custom-resource .
    • setServiceNamespace

      @Stability(Stable) public void setServiceNamespace(@Nullable String value)
      The namespace of the AWS service that provides the resource, or a custom-resource .
    • getStepScalingPolicyConfiguration

      @Stability(Stable) @Nullable public Object getStepScalingPolicyConfiguration()
      A step scaling policy.
    • setStepScalingPolicyConfiguration

      @Stability(Stable) public void setStepScalingPolicyConfiguration(@Nullable IResolvable value)
      A step scaling policy.
    • setStepScalingPolicyConfiguration

      @Stability(Stable) public void setStepScalingPolicyConfiguration(@Nullable CfnScalingPolicy.StepScalingPolicyConfigurationProperty value)
      A step scaling policy.
    • getTargetTrackingScalingPolicyConfiguration

      @Stability(Stable) @Nullable public Object getTargetTrackingScalingPolicyConfiguration()
      A target tracking scaling policy.
    • setTargetTrackingScalingPolicyConfiguration

      @Stability(Stable) public void setTargetTrackingScalingPolicyConfiguration(@Nullable IResolvable value)
      A target tracking scaling policy.
    • setTargetTrackingScalingPolicyConfiguration

      @Stability(Stable) public void setTargetTrackingScalingPolicyConfiguration(@Nullable CfnScalingPolicy.TargetTrackingScalingPolicyConfigurationProperty value)
      A target tracking scaling policy.