Class: AWSCDK::Autoscaling::StepScalingPolicyProps
- Inherits:
-
BasicStepScalingPolicyProps
- Object
- BasicStepScalingPolicyProps
- AWSCDK::Autoscaling::StepScalingPolicyProps
- Defined in:
- autoscaling/step_scaling_policy_props.rb
Instance Attribute Summary collapse
-
#adjustment_type ⇒ AWSCDK::Autoscaling::AdjustmentType?
readonly
How the adjustment numbers inside 'intervals' are interpreted.
-
#auto_scaling_group ⇒ AWSCDK::Interfaces::AWSAutoscaling::IAutoScalingGroupRef
readonly
The auto scaling group.
-
#cooldown ⇒ AWSCDK::Duration?
readonly
Grace period after scaling activity.
-
#datapoints_to_alarm ⇒ Numeric?
readonly
The number of data points out of the evaluation periods that must be breaching to trigger a scaling action.
-
#estimated_instance_warmup ⇒ AWSCDK::Duration?
readonly
Estimated time until a newly launched instance can send metrics to CloudWatch.
-
#evaluation_periods ⇒ Numeric?
readonly
How many evaluation periods of the metric to wait before triggering a scaling action.
-
#metric ⇒ AWSCDK::CloudWatch::IMetric
readonly
Metric to scale on.
-
#metric_aggregation_type ⇒ AWSCDK::Autoscaling::MetricAggregationType?
readonly
Aggregation to apply to all data points over the evaluation periods.
-
#min_adjustment_magnitude ⇒ Numeric?
readonly
Minimum absolute number to adjust capacity with as result of percentage scaling.
-
#scaling_steps ⇒ Array<AWSCDK::Autoscaling::ScalingInterval>
readonly
The intervals for scaling.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(metric:, scaling_steps:, adjustment_type: nil, cooldown: nil, datapoints_to_alarm: nil, estimated_instance_warmup: nil, evaluation_periods: nil, metric_aggregation_type: nil, min_adjustment_magnitude: nil, auto_scaling_group:) ⇒ StepScalingPolicyProps
constructor
A new instance of StepScalingPolicyProps.
- #to_jsii ⇒ Object
Constructor Details
#initialize(metric:, scaling_steps:, adjustment_type: nil, cooldown: nil, datapoints_to_alarm: nil, estimated_instance_warmup: nil, evaluation_periods: nil, metric_aggregation_type: nil, min_adjustment_magnitude: nil, auto_scaling_group:) ⇒ StepScalingPolicyProps
Returns a new instance of StepScalingPolicyProps.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'autoscaling/step_scaling_policy_props.rb', line 16 def initialize(metric:, scaling_steps:, adjustment_type: nil, cooldown: nil, datapoints_to_alarm: nil, estimated_instance_warmup: nil, evaluation_periods: nil, metric_aggregation_type: nil, min_adjustment_magnitude: nil, auto_scaling_group:) @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::Autoscaling::ScalingInterval.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : scaling_steps Jsii::Type.check_type(@scaling_steps, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19hdXRvc2NhbGluZy5TY2FsaW5nSW50ZXJ2YWwifSwia2luZCI6ImFycmF5In19")), "scalingSteps") @adjustment_type = adjustment_type Jsii::Type.check_type(@adjustment_type, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXV0b3NjYWxpbmcuQWRqdXN0bWVudFR5cGUifQ==")), "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? @estimated_instance_warmup = estimated_instance_warmup Jsii::Type.check_type(@estimated_instance_warmup, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "estimatedInstanceWarmup") unless @estimated_instance_warmup.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("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXV0b3NjYWxpbmcuTWV0cmljQWdncmVnYXRpb25UeXBlIn0=")), "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? @auto_scaling_group = auto_scaling_group Jsii::Type.check_type(@auto_scaling_group, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5pbnRlcmZhY2VzLmF3c19hdXRvc2NhbGluZy5JQXV0b1NjYWxpbmdHcm91cFJlZiJ9")), "autoScalingGroup") end |
Instance Attribute Details
#adjustment_type ⇒ AWSCDK::Autoscaling::AdjustmentType? (readonly)
Default: ChangeInCapacity
How the adjustment numbers inside 'intervals' are interpreted.
55 56 57 |
# File 'autoscaling/step_scaling_policy_props.rb', line 55 def adjustment_type @adjustment_type end |
#auto_scaling_group ⇒ AWSCDK::Interfaces::AWSAutoscaling::IAutoScalingGroupRef (readonly)
The auto scaling group.
106 107 108 |
# File 'autoscaling/step_scaling_policy_props.rb', line 106 def auto_scaling_group @auto_scaling_group end |
#cooldown ⇒ AWSCDK::Duration? (readonly)
Default: Default cooldown period on your AutoScalingGroup
Grace period after scaling activity.
60 61 62 |
# File 'autoscaling/step_scaling_policy_props.rb', line 60 def cooldown @cooldown end |
#datapoints_to_alarm ⇒ Numeric? (readonly)
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. Must be less than or equal to
evaluation_periods.
71 72 73 |
# File 'autoscaling/step_scaling_policy_props.rb', line 71 def datapoints_to_alarm @datapoints_to_alarm end |
#estimated_instance_warmup ⇒ AWSCDK::Duration? (readonly)
Default: Same as the cooldown
Estimated time until a newly launched instance can send metrics to CloudWatch.
76 77 78 |
# File 'autoscaling/step_scaling_policy_props.rb', line 76 def estimated_instance_warmup @estimated_instance_warmup end |
#evaluation_periods ⇒ Numeric? (readonly)
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.
87 88 89 |
# File 'autoscaling/step_scaling_policy_props.rb', line 87 def evaluation_periods @evaluation_periods end |
#metric ⇒ AWSCDK::CloudWatch::IMetric (readonly)
Metric to scale on.
42 43 44 |
# File 'autoscaling/step_scaling_policy_props.rb', line 42 def metric @metric end |
#metric_aggregation_type ⇒ AWSCDK::Autoscaling::MetricAggregationType? (readonly)
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.
94 95 96 |
# File 'autoscaling/step_scaling_policy_props.rb', line 94 def metric_aggregation_type @metric_aggregation_type end |
#min_adjustment_magnitude ⇒ Numeric? (readonly)
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.
102 103 104 |
# File 'autoscaling/step_scaling_policy_props.rb', line 102 def min_adjustment_magnitude @min_adjustment_magnitude end |
#scaling_steps ⇒ Array<AWSCDK::Autoscaling::ScalingInterval> (readonly)
The intervals for scaling.
Maps a range of metric values to a particular scaling behavior.
Must be between 2 and 40 steps.
50 51 52 |
# File 'autoscaling/step_scaling_policy_props.rb', line 50 def scaling_steps @scaling_steps end |
Class Method Details
.jsii_properties ⇒ Object
108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'autoscaling/step_scaling_policy_props.rb', line 108 def self.jsii_properties { :metric => "metric", :scaling_steps => "scalingSteps", :adjustment_type => "adjustmentType", :cooldown => "cooldown", :datapoints_to_alarm => "datapointsToAlarm", :estimated_instance_warmup => "estimatedInstanceWarmup", :evaluation_periods => "evaluationPeriods", :metric_aggregation_type => "metricAggregationType", :min_adjustment_magnitude => "minAdjustmentMagnitude", :auto_scaling_group => "autoScalingGroup", } end |
Instance Method Details
#to_jsii ⇒ Object
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'autoscaling/step_scaling_policy_props.rb', line 123 def to_jsii result = {} result.merge!(super) result.merge!({ "metric" => @metric, "scalingSteps" => @scaling_steps, "adjustmentType" => @adjustment_type, "cooldown" => @cooldown, "datapointsToAlarm" => @datapoints_to_alarm, "estimatedInstanceWarmup" => @estimated_instance_warmup, "evaluationPeriods" => @evaluation_periods, "metricAggregationType" => @metric_aggregation_type, "minAdjustmentMagnitude" => @min_adjustment_magnitude, "autoScalingGroup" => @auto_scaling_group, }) result.compact end |