Class: Asg::Rebooter::Wrappers::AutoScalingGroup

Inherits:
Object
  • Object
show all
Defined in:
lib/asg/rebooter/wrappers/auto_scaling_group.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ AutoScalingGroup

Returns a new instance of AutoScalingGroup.



9
10
11
12
13
# File 'lib/asg/rebooter/wrappers/auto_scaling_group.rb', line 9

def initialize(name)
  raise AutoScalingGroupNameRequiredError unless name

  @name = name
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



7
8
9
# File 'lib/asg/rebooter/wrappers/auto_scaling_group.rb', line 7

def name
  @name
end

Instance Method Details

#instancesObject



41
42
43
44
45
# File 'lib/asg/rebooter/wrappers/auto_scaling_group.rb', line 41

def instances
  asg.instances.map do |instance|
    Asg::Rebooter::Wrappers::Instance.new(instance)
  end
end

#min_sizeObject



27
28
29
# File 'lib/asg/rebooter/wrappers/auto_scaling_group.rb', line 27

def min_size
  asg.min_size
end

#rebootObject



47
48
49
# File 'lib/asg/rebooter/wrappers/auto_scaling_group.rb', line 47

def reboot
  Asg::Rebooter::InstanceRebooter.new(self).execute
end

#resume_processes(processes) ⇒ Object



23
24
25
# File 'lib/asg/rebooter/wrappers/auto_scaling_group.rb', line 23

def resume_processes(processes)
  asg.resume_processes(scaling_processes: processes)
end

#suspend_processes(processes) ⇒ Object



19
20
21
# File 'lib/asg/rebooter/wrappers/auto_scaling_group.rb', line 19

def suspend_processes(processes)
  asg.suspend_processes(scaling_processes: processes)
end

#suspended_processesObject



15
16
17
# File 'lib/asg/rebooter/wrappers/auto_scaling_group.rb', line 15

def suspended_processes
  asg.suspended_processes
end

#target_groupsObject



35
36
37
38
39
# File 'lib/asg/rebooter/wrappers/auto_scaling_group.rb', line 35

def target_groups
  asg.target_group_arns.map do |arn|
    Asg::Rebooter::Wrappers::TargetGroup.new(arn)
  end
end

#update_min_size(new_min_size) ⇒ Object



31
32
33
# File 'lib/asg/rebooter/wrappers/auto_scaling_group.rb', line 31

def update_min_size(new_min_size)
  asg.update(min_size: new_min_size)
end