Method: EcsCmd::Clusters#list_clusters

Defined in:
lib/ecs_cmd/clusters.rb

#list_clustersObject



34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/ecs_cmd/clusters.rb', line 34

def list_clusters
  rows = []
  cluster_names.map do |c|
    cluster_name = c.split('/')[1]
    stats = @client.describe_clusters(clusters: [cluster_name])[0][0]
    rows << [cluster_name, get_container_instance_count(stats), get_service_count(stats),
             get_running_task_count(stats), get_pending_task_count(stats)]
  end
  table = Terminal::Table.new headings: ['CLUSTER NAME', 'CONTAINER_INSTANCE_COUNT',
                                         'SERVICES', 'RUNNING_TASKS', 'PENDING_TASKS'], rows: rows
  puts table
end