Class: Hako::Schedulers::EcsAutoscaling::Policy
- Inherits:
-
Object
- Object
- Hako::Schedulers::EcsAutoscaling::Policy
- Defined in:
- lib/hako/schedulers/ecs_autoscaling.rb
Instance Attribute Summary collapse
-
#adjustment_type ⇒ Object
readonly
Returns the value of attribute adjustment_type.
-
#alarms ⇒ Object
readonly
Returns the value of attribute alarms.
-
#cooldown ⇒ Object
readonly
Returns the value of attribute cooldown.
-
#disable_scale_in ⇒ Object
readonly
Returns the value of attribute disable_scale_in.
-
#metric_aggregation_type ⇒ Object
readonly
Returns the value of attribute metric_aggregation_type.
-
#metric_interval_lower_bound ⇒ Object
readonly
Returns the value of attribute metric_interval_lower_bound.
-
#metric_interval_upper_bound ⇒ Object
readonly
Returns the value of attribute metric_interval_upper_bound.
-
#policy_type ⇒ Object
readonly
Returns the value of attribute policy_type.
-
#predefined_metric_type ⇒ Object
readonly
Returns the value of attribute predefined_metric_type.
-
#scale_in_cooldown ⇒ Object
readonly
Returns the value of attribute scale_in_cooldown.
-
#scale_out_cooldown ⇒ Object
readonly
Returns the value of attribute scale_out_cooldown.
-
#scaling_adjustment ⇒ Object
readonly
Returns the value of attribute scaling_adjustment.
-
#target_value ⇒ Object
readonly
Returns the value of attribute target_value.
Instance Method Summary collapse
-
#initialize(options) ⇒ Policy
constructor
A new instance of Policy.
- #name ⇒ String
- #required_option(options, key) ⇒ Object private
Constructor Details
#initialize(options) ⇒ Policy
Returns a new instance of Policy.
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 |
# File 'lib/hako/schedulers/ecs_autoscaling.rb', line 168 def initialize() @policy_type = .fetch('policy_type', 'StepScaling') case @policy_type when 'StepScaling' @alarms = required_option(, 'alarms') @cooldown = required_option(, 'cooldown') @adjustment_type = required_option(, 'adjustment_type') @scaling_adjustment = required_option(, 'scaling_adjustment') @metric_interval_lower_bound = .fetch('metric_interval_lower_bound', nil) @metric_interval_upper_bound = .fetch('metric_interval_upper_bound', nil) @metric_aggregation_type = required_option(, 'metric_aggregation_type') when 'TargetTrackingScaling' @name = required_option(, 'name') @target_value = required_option(, 'target_value') @predefined_metric_type = required_option(, 'predefined_metric_type') @scale_out_cooldown = .fetch('scale_out_cooldown', nil) @scale_in_cooldown = .fetch('scale_in_cooldown', nil) @disable_scale_in = .fetch('disable_scale_in', nil) else raise Error.new("scheduler.autoscaling.policies.#{policy_type} must be either 'StepScaling' or 'TargetTrackingScaling'") end end |
Instance Attribute Details
#adjustment_type ⇒ Object (readonly)
Returns the value of attribute adjustment_type.
165 166 167 |
# File 'lib/hako/schedulers/ecs_autoscaling.rb', line 165 def adjustment_type @adjustment_type end |
#alarms ⇒ Object (readonly)
Returns the value of attribute alarms.
165 166 167 |
# File 'lib/hako/schedulers/ecs_autoscaling.rb', line 165 def alarms @alarms end |
#cooldown ⇒ Object (readonly)
Returns the value of attribute cooldown.
165 166 167 |
# File 'lib/hako/schedulers/ecs_autoscaling.rb', line 165 def cooldown @cooldown end |
#disable_scale_in ⇒ Object (readonly)
Returns the value of attribute disable_scale_in.
165 166 167 |
# File 'lib/hako/schedulers/ecs_autoscaling.rb', line 165 def disable_scale_in @disable_scale_in end |
#metric_aggregation_type ⇒ Object (readonly)
Returns the value of attribute metric_aggregation_type.
165 166 167 |
# File 'lib/hako/schedulers/ecs_autoscaling.rb', line 165 def metric_aggregation_type @metric_aggregation_type end |
#metric_interval_lower_bound ⇒ Object (readonly)
Returns the value of attribute metric_interval_lower_bound.
165 166 167 |
# File 'lib/hako/schedulers/ecs_autoscaling.rb', line 165 def metric_interval_lower_bound @metric_interval_lower_bound end |
#metric_interval_upper_bound ⇒ Object (readonly)
Returns the value of attribute metric_interval_upper_bound.
165 166 167 |
# File 'lib/hako/schedulers/ecs_autoscaling.rb', line 165 def metric_interval_upper_bound @metric_interval_upper_bound end |
#policy_type ⇒ Object (readonly)
Returns the value of attribute policy_type.
165 166 167 |
# File 'lib/hako/schedulers/ecs_autoscaling.rb', line 165 def policy_type @policy_type end |
#predefined_metric_type ⇒ Object (readonly)
Returns the value of attribute predefined_metric_type.
165 166 167 |
# File 'lib/hako/schedulers/ecs_autoscaling.rb', line 165 def predefined_metric_type @predefined_metric_type end |
#scale_in_cooldown ⇒ Object (readonly)
Returns the value of attribute scale_in_cooldown.
165 166 167 |
# File 'lib/hako/schedulers/ecs_autoscaling.rb', line 165 def scale_in_cooldown @scale_in_cooldown end |
#scale_out_cooldown ⇒ Object (readonly)
Returns the value of attribute scale_out_cooldown.
165 166 167 |
# File 'lib/hako/schedulers/ecs_autoscaling.rb', line 165 def scale_out_cooldown @scale_out_cooldown end |
#scaling_adjustment ⇒ Object (readonly)
Returns the value of attribute scaling_adjustment.
165 166 167 |
# File 'lib/hako/schedulers/ecs_autoscaling.rb', line 165 def scaling_adjustment @scaling_adjustment end |
#target_value ⇒ Object (readonly)
Returns the value of attribute target_value.
165 166 167 |
# File 'lib/hako/schedulers/ecs_autoscaling.rb', line 165 def target_value @target_value end |
Instance Method Details
#name ⇒ String
192 193 194 195 196 197 198 |
# File 'lib/hako/schedulers/ecs_autoscaling.rb', line 192 def name if policy_type == 'StepScaling' alarms.join('-and-') else @name end end |
#required_option(options, key) ⇒ Object (private)
205 206 207 |
# File 'lib/hako/schedulers/ecs_autoscaling.rb', line 205 def required_option(, key) .fetch(key) { raise Error.new("scheduler.autoscaling.policies.#{key} must be set") } end |