Class: Stax::Cmd::Alb

Inherits:
SubCommand show all
Defined in:
lib/stax/mixin/alb.rb

Constant Summary collapse

COLORS =
{
  healthy:     :green,
  unhealthy:   :red,
  unavailable: :red,
}

Instance Method Summary collapse

Methods inherited from SubCommand

#info, stax_info, stax_info_tasks

Instance Method Details

#dnsObject



28
29
30
# File 'lib/stax/mixin/alb.rb', line 28

def dns
  puts Aws::Alb.describe(stack_albs.map(&:physical_resource_id)).map(&:dns_name)
end

#statusObject



33
34
35
36
37
38
39
40
41
42
# File 'lib/stax/mixin/alb.rb', line 33

def status
  stack_albs.each do |alb|
    Aws::Alb.target_groups(alb.physical_resource_id).each do |t|
      debug("ALB status for #{alb.logical_resource_id} #{t.protocol}:#{t.port} #{t.target_group_name}")
      print_table Aws::Alb.target_health(t.target_group_arn).map { |h|
        [h.target.id, h.target.port, color(h.target_health.state, COLORS), h.target_health.reason, h.target_health.description]
      }
    end
  end
end