Class: EcsAutoscalingScheduler::Aws::Ecs

Inherits:
Object
  • Object
show all
Defined in:
lib/ecs_autoscaling_scheduler/aws/ecs.rb

Instance Method Summary collapse

Constructor Details

#initialize(client: ::Aws::ECS::Client.new) ⇒ Ecs

Returns a new instance of Ecs.



8
9
10
# File 'lib/ecs_autoscaling_scheduler/aws/ecs.rb', line 8

def initialize(client: ::Aws::ECS::Client.new)
  @client = client
end

Instance Method Details

#all_cluster_namesObject



12
13
14
15
# File 'lib/ecs_autoscaling_scheduler/aws/ecs.rb', line 12

def all_cluster_names
  cluster_arns = client.list_clusters.cluster_arns
  client.describe_clusters(clusters: cluster_arns).clusters.map(&:cluster_name)
end

#all_service_names(cluster:) ⇒ Object



17
18
19
20
# File 'lib/ecs_autoscaling_scheduler/aws/ecs.rb', line 17

def all_service_names(cluster:)
  service_arns = client.list_services(cluster: cluster).service_arns
  client.describe_services(cluster: cluster, services: service_arns).services.map(&:service_name)
end