class AwsPocketknife::Cli::Asg
Public Instance Methods
desc(asg_name)
click to toggle source
# File lib/aws_pocketknife/cli/asg.rb, line 15 def desc(asg_name) asg = AwsPocketknife::Asg.describe_asg_by_name(name: asg_name) if asg.auto_scaling_groups.empty? puts "ASG #{asg_name} not found" else AwsPocketknife::Asg.nice_print(object: asg.to_h) end end
list()
click to toggle source
# File lib/aws_pocketknife/cli/asg.rb, line 9 def list asgs = AwsPocketknife::Asg.list print_asg(asgs: asgs) end
Private Instance Methods
print_asg(asgs: [])
click to toggle source
# File lib/aws_pocketknife/cli/asg.rb, line 26 def print_asg(asgs: []) headers = ["name", "min size", "max size", "desired capacity", "instances", "elb"] data = [] if asgs.length > 0 asgs.each do |asg| instances = [] asg.instances.map { |instance| instances << instance.instance_id } data << [asg.auto_scaling_group_name, asg.min_size, asg.max_size, asg.desired_capacity, instances.join(", "), asg.load_balancer_names.join(", ")] end AwsPocketknife::Asg.pretty_table(headers: headers, data: data) else puts "No asg(s) found for name #{args[:name]}" end end