Class: AWSCDK::ApplicationAutoScaling::StepScalingPolicyProps

Inherits:
BasicStepScalingPolicyProps
  • Object
show all
Defined in:
application_auto_scaling/step_scaling_policy_props.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(metric:, scaling_steps:, adjustment_type: nil, cooldown: nil, datapoints_to_alarm: nil, evaluation_periods: nil, metric_aggregation_type: nil, min_adjustment_magnitude: nil, scaling_target:) ⇒ StepScalingPolicyProps

Returns a new instance of StepScalingPolicyProps.

Parameters:



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'application_auto_scaling/step_scaling_policy_props.rb', line 15

def initialize(metric:, scaling_steps:, adjustment_type: nil, cooldown: nil, datapoints_to_alarm: nil, evaluation_periods: nil, metric_aggregation_type: nil, min_adjustment_magnitude: nil, scaling_target:)
  @metric = metric
  Jsii::Type.check_type(@metric, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5JTWV0cmljIn0=")), "metric")
  @scaling_steps = scaling_steps.is_a?(Array) ? scaling_steps.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::ApplicationAutoScaling::ScalingInterval.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : scaling_steps
  Jsii::Type.check_type(@scaling_steps, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19hcHBsaWNhdGlvbmF1dG9zY2FsaW5nLlNjYWxpbmdJbnRlcnZhbCJ9LCJraW5kIjoiYXJyYXkifX0=")), "scalingSteps")
  @adjustment_type = adjustment_type
  Jsii::Type.check_type(@adjustment_type, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXBwbGljYXRpb25hdXRvc2NhbGluZy5BZGp1c3RtZW50VHlwZSJ9")), "adjustmentType") unless @adjustment_type.nil?
  @cooldown = cooldown
  Jsii::Type.check_type(@cooldown, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "cooldown") unless @cooldown.nil?
  @datapoints_to_alarm = datapoints_to_alarm
  Jsii::Type.check_type(@datapoints_to_alarm, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "datapointsToAlarm") unless @datapoints_to_alarm.nil?
  @evaluation_periods = evaluation_periods
  Jsii::Type.check_type(@evaluation_periods, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "evaluationPeriods") unless @evaluation_periods.nil?
  @metric_aggregation_type = metric_aggregation_type
  Jsii::Type.check_type(@metric_aggregation_type, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXBwbGljYXRpb25hdXRvc2NhbGluZy5NZXRyaWNBZ2dyZWdhdGlvblR5cGUifQ==")), "metricAggregationType") unless @metric_aggregation_type.nil?
  @min_adjustment_magnitude = min_adjustment_magnitude
  Jsii::Type.check_type(@min_adjustment_magnitude, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "minAdjustmentMagnitude") unless @min_adjustment_magnitude.nil?
  @scaling_target = scaling_target
  Jsii::Type.check_type(@scaling_target, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5pbnRlcmZhY2VzLmF3c19hcHBsaWNhdGlvbmF1dG9zY2FsaW5nLklTY2FsYWJsZVRhcmdldFJlZiJ9")), "scalingTarget")
end

Instance Attribute Details

#adjustment_typeAWSCDK::ApplicationAutoScaling::AdjustmentType? (readonly)

Note:

Default: ChangeInCapacity

How the adjustment numbers inside 'intervals' are interpreted.



52
53
54
# File 'application_auto_scaling/step_scaling_policy_props.rb', line 52

def adjustment_type
  @adjustment_type
end

#cooldownAWSCDK::Duration? (readonly)

Note:

Default: No cooldown period

Grace period after scaling activity.

Subsequent scale outs during the cooldown period are squashed so that only the biggest scale out happens.

Subsequent scale ins during the cooldown period are ignored.



63
64
65
# File 'application_auto_scaling/step_scaling_policy_props.rb', line 63

def cooldown
  @cooldown
end

#datapoints_to_alarmNumeric? (readonly)

Note:

Default: - Same as evaluationPeriods

The number of data points out of the evaluation periods that must be breaching to trigger a scaling action.

Creates an "M out of N" alarm, where this property is the M and the value set for evaluation_periods is the N value.

Only has meaning if evaluationPeriods != 1.

Returns:

  • (Numeric, nil)


73
74
75
# File 'application_auto_scaling/step_scaling_policy_props.rb', line 73

def datapoints_to_alarm
  @datapoints_to_alarm
end

#evaluation_periodsNumeric? (readonly)

Note:

Default: 1

How many evaluation periods of the metric to wait before triggering a scaling action.

Raising this value can be used to smooth out the metric, at the expense of slower response times.

If datapoints_to_alarm is not set, then all data points in the evaluation period must meet the criteria to trigger a scaling action.

Returns:

  • (Numeric, nil)


84
85
86
# File 'application_auto_scaling/step_scaling_policy_props.rb', line 84

def evaluation_periods
  @evaluation_periods
end

#metricAWSCDK::CloudWatch::IMetric (readonly)

Metric to scale on.



39
40
41
# File 'application_auto_scaling/step_scaling_policy_props.rb', line 39

def metric
  @metric
end

#metric_aggregation_typeAWSCDK::ApplicationAutoScaling::MetricAggregationType? (readonly)

Note:

Default: - The statistic from the metric if applicable (MIN, MAX, AVERAGE), otherwise AVERAGE.

Aggregation to apply to all data points over the evaluation periods.

Only has meaning if evaluationPeriods != 1.



91
92
93
# File 'application_auto_scaling/step_scaling_policy_props.rb', line 91

def metric_aggregation_type
  @metric_aggregation_type
end

#min_adjustment_magnitudeNumeric? (readonly)

Note:

Default: No minimum scaling effect

Minimum absolute number to adjust capacity with as result of percentage scaling.

Only when using AdjustmentType = PercentChangeInCapacity, this number controls the minimum absolute effect size.

Returns:

  • (Numeric, nil)


99
100
101
# File 'application_auto_scaling/step_scaling_policy_props.rb', line 99

def min_adjustment_magnitude
  @min_adjustment_magnitude
end

#scaling_stepsArray<AWSCDK::ApplicationAutoScaling::ScalingInterval> (readonly)

The intervals for scaling.

Maps a range of metric values to a particular scaling behavior.

Must be between 2 and 40 steps.



47
48
49
# File 'application_auto_scaling/step_scaling_policy_props.rb', line 47

def scaling_steps
  @scaling_steps
end

#scaling_targetAWSCDK::Interfaces::AWSApplicationautoscaling::IScalableTargetRef (readonly)

The scaling target.



103
104
105
# File 'application_auto_scaling/step_scaling_policy_props.rb', line 103

def scaling_target
  @scaling_target
end

Class Method Details

.jsii_propertiesObject



105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'application_auto_scaling/step_scaling_policy_props.rb', line 105

def self.jsii_properties
  {
    :metric => "metric",
    :scaling_steps => "scalingSteps",
    :adjustment_type => "adjustmentType",
    :cooldown => "cooldown",
    :datapoints_to_alarm => "datapointsToAlarm",
    :evaluation_periods => "evaluationPeriods",
    :metric_aggregation_type => "metricAggregationType",
    :min_adjustment_magnitude => "minAdjustmentMagnitude",
    :scaling_target => "scalingTarget",
  }
end

Instance Method Details

#to_jsiiObject



119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'application_auto_scaling/step_scaling_policy_props.rb', line 119

def to_jsii
  result = {}
  result.merge!(super)
  result.merge!({
    "metric" => @metric,
    "scalingSteps" => @scaling_steps,
    "adjustmentType" => @adjustment_type,
    "cooldown" => @cooldown,
    "datapointsToAlarm" => @datapoints_to_alarm,
    "evaluationPeriods" => @evaluation_periods,
    "metricAggregationType" => @metric_aggregation_type,
    "minAdjustmentMagnitude" => @min_adjustment_magnitude,
    "scalingTarget" => @scaling_target,
  })
  result.compact
end