Class: AWSCDK::ApplicationAutoScaling::BasicStepScalingPolicyProps

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
application_auto_scaling/basic_step_scaling_policy_props.rb

Direct Known Subclasses

StepScalingPolicyProps

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) ⇒ BasicStepScalingPolicyProps

Returns a new instance of BasicStepScalingPolicyProps.

Parameters:

  • metric (AWSCDK::CloudWatch::IMetric)

    Metric to scale on.

  • scaling_steps (Array<AWSCDK::ApplicationAutoScaling::ScalingInterval>)

    The intervals for scaling.

  • adjustment_type (AWSCDK::ApplicationAutoScaling::AdjustmentType, nil) (defaults to: nil)

    How the adjustment numbers inside 'intervals' are interpreted.

  • cooldown (AWSCDK::Duration, nil) (defaults to: nil)

    Grace period after scaling activity.

  • datapoints_to_alarm (Numeric, nil) (defaults to: nil)

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

  • evaluation_periods (Numeric, nil) (defaults to: nil)

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

  • metric_aggregation_type (AWSCDK::ApplicationAutoScaling::MetricAggregationType, nil) (defaults to: nil)

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

  • min_adjustment_magnitude (Numeric, nil) (defaults to: nil)

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



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

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)
  @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?
end

Instance Attribute Details

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

Note:

Default: ChangeInCapacity

How the adjustment numbers inside 'intervals' are interpreted.



49
50
51
# File 'application_auto_scaling/basic_step_scaling_policy_props.rb', line 49

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.



60
61
62
# File 'application_auto_scaling/basic_step_scaling_policy_props.rb', line 60

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)


70
71
72
# File 'application_auto_scaling/basic_step_scaling_policy_props.rb', line 70

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)


81
82
83
# File 'application_auto_scaling/basic_step_scaling_policy_props.rb', line 81

def evaluation_periods
  @evaluation_periods
end

#metricAWSCDK::CloudWatch::IMetric (readonly)

Metric to scale on.



36
37
38
# File 'application_auto_scaling/basic_step_scaling_policy_props.rb', line 36

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.



88
89
90
# File 'application_auto_scaling/basic_step_scaling_policy_props.rb', line 88

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)


96
97
98
# File 'application_auto_scaling/basic_step_scaling_policy_props.rb', line 96

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.



44
45
46
# File 'application_auto_scaling/basic_step_scaling_policy_props.rb', line 44

def scaling_steps
  @scaling_steps
end

Class Method Details

.jsii_propertiesObject



98
99
100
101
102
103
104
105
106
107
108
109
# File 'application_auto_scaling/basic_step_scaling_policy_props.rb', line 98

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",
  }
end

Instance Method Details

#to_jsiiObject



111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'application_auto_scaling/basic_step_scaling_policy_props.rb', line 111

def to_jsii
  result = {}
  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,
  })
  result.compact
end