class OpenStax::Aws::AutoScalingGroup

Attributes

raw_asg[R]

Public Class Methods

new(name:, region:) click to toggle source
# File lib/openstax/aws/auto_scaling_group.rb, line 7
def initialize(name:, region:)
  @raw_asg = Aws::AutoScaling::AutoScalingGroup.new(
    name: name,
    client: Aws::AutoScaling::Client.new(region: region)
  )
end

Public Instance Methods

desired_capacity() click to toggle source
# File lib/openstax/aws/auto_scaling_group.rb, line 24
def desired_capacity
  raw_asg.desired_capacity
end
increase_desired_capacity(by:) click to toggle source
# File lib/openstax/aws/auto_scaling_group.rb, line 14
def increase_desired_capacity(by:)
  # take the smaller of max size or desired+by (or this call raises an exception)
  increase_to = [raw_asg.max_size, raw_asg.desired_capacity + by].min

  raw_asg.set_desired_capacity(
    {
      desired_capacity: increase_to
    })
end