Class: Vaws::Aws::EcsDescriber
- Defined in:
- lib/vaws/aws/ecs_describer.rb
Instance Attribute Summary collapse
-
#term_table ⇒ Object
readonly
Returns the value of attribute term_table.
Instance Method Summary collapse
-
#initialize ⇒ EcsDescriber
constructor
A new instance of EcsDescriber.
- #set_basic_info ⇒ Object
Constructor Details
#initialize ⇒ EcsDescriber
Returns a new instance of EcsDescriber.
9 10 11 12 13 14 |
# File 'lib/vaws/aws/ecs_describer.rb', line 9 def initialize @ecs_client = ::Aws::ECS::Client.new @term_table = '' @cluster_arns = [] @cluster_info = {} end |
Instance Attribute Details
#term_table ⇒ Object (readonly)
Returns the value of attribute term_table.
7 8 9 |
# File 'lib/vaws/aws/ecs_describer.rb', line 7 def term_table @term_table end |
Instance Method Details
#set_basic_info ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/vaws/aws/ecs_describer.rb', line 16 def set_basic_info get_cluster_arns rows = [] @cluster_arns.each do |cluster_arn| cluster_name = cluster_arn.gsub(/arn:aws:ecs:#{ENV['AWS_DEFAULT_REGION']}:[0-9]*:cluster\//, "") @cluster_info.store("#{cluster_name}", {}) cluster_name = "#{cluster_name}" cluster_services = get_service_names(cluster_arn) ecs_cluster = @ecs_client.describe_clusters({ clusters: ["#{cluster_arn}"] }).clusters running_tasks_count = ecs_cluster[0].running_tasks_count pending_tasks_count = ecs_cluster[0].pending_tasks_count active_services_count = ecs_cluster[0].active_services_count rows << [cluster_name, cluster_services, active_services_count, running_tasks_count, pending_tasks_count] end @term_table = Terminal::Table.new :headings => ['ClusterName', 'Services', 'ActService', 'RunTask', 'PenTask'], :rows => rows.sort end |