Class: Ufo::Info
Instance Method Summary collapse
-
#load_balancer(service) ⇒ Object
Passing in service so method can be used else where.
- #route53_dns ⇒ Object
- #run ⇒ Object
- #service ⇒ Object
- #stack ⇒ Object
- #stack_resources ⇒ Object
Methods inherited from Base
#full_service, #info, #initialize, #no_service_message, #switch_current
Methods included from Stack::Helper
#adjust_stack_name, #cfn, #find_stack, #status
Methods included from Util
#default_cluster, #display_params, #execute, #pretty_time, #settings, #task_definition_arns, #user_params
Methods included from AwsService
#cloudformation, #cloudwatchlogs, #ec2, #ecr, #ecs, #elb
Constructor Details
This class inherits a constructor from Ufo::Base
Instance Method Details
#load_balancer(service) ⇒ Object
Passing in service so method can be used else where.
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/ufo/info.rb', line 17 def load_balancer(service) load_balancer = service.load_balancers.first return unless load_balancer resp = elb.describe_target_groups( target_group_arns: [load_balancer.target_group_arn] ) target_group = resp.target_groups.first load_balancer_arn = target_group.load_balancer_arns.first # assume first only resp = elb.describe_load_balancers(load_balancer_arns: [load_balancer_arn]) resp.load_balancers.first end |
#route53_dns ⇒ Object
47 48 49 50 51 52 53 54 |
# File 'lib/ufo/info.rb', line 47 def route53_dns return unless stack output = stack.outputs.find do |o| o.output_key == "Route53Dns" end output.output_value if output end |
#run ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/ufo/info.rb', line 3 def run unless service puts return end puts "Resources:" stack_resources.each do |r| # pp r puts "#{r.logical_resource_id} - #{r.resource_type}:".color(:green) puts " #{r.physical_resource_id}" end end |
#service ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/ufo/info.rb', line 32 def service return unless stack service = stack_resources.find { |r| r.resource_type == "AWS::ECS::Service" } arn = service.physical_resource_id resp = ecs.describe_services(services: [arn], cluster: @cluster) resp.services.first end |
#stack ⇒ Object
42 43 44 |
# File 'lib/ufo/info.rb', line 42 def stack find_stack(@stack_name) end |
#stack_resources ⇒ Object
56 57 58 59 |
# File 'lib/ufo/info.rb', line 56 def stack_resources resp = cloudformation.describe_stack_resources(stack_name: @stack_name) resp.stack_resources end |