Module: Awspec::Helper::Finder::Ecs
- Included in:
- Awspec::Helper::Finder
- Defined in:
- lib/awspec/helper/finder/ecs.rb
Instance Method Summary collapse
- #find_ecs_cluster(cluster_name) ⇒ Object
- #find_ecs_container_instances(cluster_name, container_instances) ⇒ Object
- #find_ecs_service(service) ⇒ Object
- #find_ecs_task_definition(taskdef) ⇒ Object
- #list_ecs_container_instances(cluster_name) ⇒ Object
Instance Method Details
#find_ecs_cluster(cluster_name) ⇒ Object
4 5 6 7 |
# File 'lib/awspec/helper/finder/ecs.rb', line 4 def find_ecs_cluster(cluster_name) res = ecs_client.describe_clusters(clusters: [cluster_name]) res.clusters.first if res.clusters.count == 1 end |
#find_ecs_container_instances(cluster_name, container_instances) ⇒ Object
21 22 23 24 |
# File 'lib/awspec/helper/finder/ecs.rb', line 21 def find_ecs_container_instances(cluster_name, container_instances) res = ecs_client.describe_container_instances(cluster: cluster_name, container_instances: container_instances) res.container_instances if res.container_instances end |
#find_ecs_service(service) ⇒ Object
31 32 33 34 |
# File 'lib/awspec/helper/finder/ecs.rb', line 31 def find_ecs_service(service) res = ecs_client.describe_services(services: [service]) res.services.first if res.services.count == 1 end |
#find_ecs_task_definition(taskdef) ⇒ Object
26 27 28 29 |
# File 'lib/awspec/helper/finder/ecs.rb', line 26 def find_ecs_task_definition(taskdef) res = ecs_client.describe_task_definition(task_definition: taskdef) res.task_definition end |
#list_ecs_container_instances(cluster_name) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/awspec/helper/finder/ecs.rb', line 9 def list_ecs_container_instances(cluster_name) req = { cluster: cluster_name } container_instances = [] loop do res = ecs_client.list_container_instances(req) container_instances.push(*res.container_instance_arns) break if res.next_token.nil? req[:next_token] = res.next_token end container_instances end |