Module: Awspec::Helper::Finder::Ecs

Included in:
Awspec::Helper::Finder
Defined in:
lib/awspec/helper/finder/ecs.rb

Instance Method Summary collapse

Instance Method Details

#find_ecs_cluster(cluster) ⇒ Object



4
5
6
7
# File 'lib/awspec/helper/finder/ecs.rb', line 4

def find_ecs_cluster(cluster)
  res = ecs_client.describe_clusters(clusters: [cluster])
  res.clusters.single_resource(cluster)
end

#find_ecs_container_instance(cluster, uuid) ⇒ Object



9
10
11
12
# File 'lib/awspec/helper/finder/ecs.rb', line 9

def find_ecs_container_instance(cluster, uuid)
  res = ecs_client.describe_container_instances(cluster: cluster, container_instances: [uuid])
  res.container_instances.single_resource(uuid)
end

#find_ecs_container_instances(cluster, container_instances) ⇒ Object

deprecated method



37
38
39
40
# File 'lib/awspec/helper/finder/ecs.rb', line 37

def find_ecs_container_instances(cluster, container_instances)
  res = ecs_client.describe_container_instances(cluster: cluster, container_instances: container_instances)
  res.container_instances if res.container_instances
end

#find_ecs_service(cluster, service) ⇒ Object



19
20
21
22
# File 'lib/awspec/helper/finder/ecs.rb', line 19

def find_ecs_service(cluster, service)
  res = ecs_client.describe_services(cluster: cluster, services: [service])
  res.services.single_resource(service)
end

#find_ecs_task_definition(taskdef) ⇒ Object



14
15
16
17
# File 'lib/awspec/helper/finder/ecs.rb', line 14

def find_ecs_task_definition(taskdef)
  res = ecs_client.describe_task_definition(task_definition: taskdef)
  res.task_definition
end

#select_ecs_container_instance_arn_by_cluster_name(cluster) ⇒ Object Also known as: list_ecs_container_instances



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/awspec/helper/finder/ecs.rb', line 24

def select_ecs_container_instance_arn_by_cluster_name(cluster)
  req = { cluster: cluster }
  arns = []
  loop do
    res = ecs_client.list_container_instances(req)
    arns.push(*res.container_instance_arns)
    break if res.next_token.nil?
    req[:next_token] = res.next_token
  end
  arns
end