Class: Hako::Schedulers::EcsAutoscaling::Policy

Inherits:
Object
  • Object
show all
Defined in:
lib/hako/schedulers/ecs_autoscaling.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Policy

Returns a new instance of Policy.

Parameters:

  • options (Hash)


143
144
145
146
147
148
149
150
151
# File 'lib/hako/schedulers/ecs_autoscaling.rb', line 143

def initialize(options)
  @alarms = required_option(options, 'alarms')
  @cooldown = required_option(options, 'cooldown')
  @adjustment_type = required_option(options, 'adjustment_type')
  @scaling_adjustment = required_option(options, 'scaling_adjustment')
  @metric_interval_lower_bound = options.fetch('metric_interval_lower_bound', nil)
  @metric_interval_upper_bound = options.fetch('metric_interval_upper_bound', nil)
  @metric_aggregation_type = required_option(options, 'metric_aggregation_type')
end

Instance Attribute Details

#adjustment_typeObject (readonly)

Returns the value of attribute adjustment_type.



140
141
142
# File 'lib/hako/schedulers/ecs_autoscaling.rb', line 140

def adjustment_type
  @adjustment_type
end

#alarmsObject (readonly)

Returns the value of attribute alarms.



140
141
142
# File 'lib/hako/schedulers/ecs_autoscaling.rb', line 140

def alarms
  @alarms
end

#cooldownObject (readonly)

Returns the value of attribute cooldown.



140
141
142
# File 'lib/hako/schedulers/ecs_autoscaling.rb', line 140

def cooldown
  @cooldown
end

#metric_aggregation_typeObject (readonly)

Returns the value of attribute metric_aggregation_type.



140
141
142
# File 'lib/hako/schedulers/ecs_autoscaling.rb', line 140

def metric_aggregation_type
  @metric_aggregation_type
end

#metric_interval_lower_boundObject (readonly)

Returns the value of attribute metric_interval_lower_bound.



140
141
142
# File 'lib/hako/schedulers/ecs_autoscaling.rb', line 140

def metric_interval_lower_bound
  @metric_interval_lower_bound
end

#metric_interval_upper_boundObject (readonly)

Returns the value of attribute metric_interval_upper_bound.



140
141
142
# File 'lib/hako/schedulers/ecs_autoscaling.rb', line 140

def metric_interval_upper_bound
  @metric_interval_upper_bound
end

#scaling_adjustmentObject (readonly)

Returns the value of attribute scaling_adjustment.



140
141
142
# File 'lib/hako/schedulers/ecs_autoscaling.rb', line 140

def scaling_adjustment
  @scaling_adjustment
end

Instance Method Details

#nameString

Returns:

  • (String)


154
155
156
# File 'lib/hako/schedulers/ecs_autoscaling.rb', line 154

def name
  alarms.join('-and-')
end

#required_option(options, key) ⇒ Object (private)

Parameters:

  • options (Hash)
  • key (String)

Returns:

  • (Object)


163
164
165
# File 'lib/hako/schedulers/ecs_autoscaling.rb', line 163

def required_option(options, key)
  options.fetch(key) { raise Error.new("scheduler.autoscaling.policies.#{key} must be set") }
end