Class: Ufo::Apps
- Inherits:
-
Object
- Object
- Ufo::Apps
- Extended by:
- Memoist
- Includes:
- Stack::Helper
- Defined in:
- lib/ufo/apps.rb,
lib/ufo/apps/cfn_map.rb,
lib/ufo/apps/cluster.rb,
lib/ufo/apps/service.rb
Defined Under Namespace
Classes: CfnMap, Cluster, Service
Instance Method Summary collapse
- #display_info(resp) ⇒ Object
-
#initialize(options) ⇒ Apps
constructor
A new instance of Apps.
- #list(cluster) ⇒ Object
- #list_all ⇒ Object
-
#service_info(s) ⇒ Object
for specs.
Methods included from Stack::Helper
#adjust_stack_name, #find_stack, #status
Methods included from Settings
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
Instance Method Details
#display_info(resp) ⇒ Object
42 43 44 45 46 47 48 49 |
# File 'lib/ufo/apps.rb', line 42 def display_info(resp) table = Text::Table.new table.head = ["Service Name", "Task Definition", "Running", "Launch type", "Ufo?"] resp["services"].each do |s| table.rows << service_info(s) end puts table unless ENV['TEST'] end |
#list(cluster) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/ufo/apps.rb', line 23 def list(cluster) begin resp = ecs.list_services(cluster: cluster) rescue Aws::ECS::Errors::ClusterNotFoundException => e puts "ECS cluster #{cluster.color(:green)} not found." return end arns = resp.service_arns.sort puts "Listing ECS services in the #{cluster.color(:green)} cluster." if arns.empty? puts "No ECS services found in the #{cluster.color(:green)} cluster." return end resp = ecs.describe_services(services: arns, cluster: cluster) display_info(resp) end |
#list_all ⇒ Object
17 18 19 20 21 |
# File 'lib/ufo/apps.rb', line 17 def list_all @clusters.each do |cluster| list(cluster) end end |