Class: Stax::Aws::Ecs
Class Method Summary collapse
- .client ⇒ Object
- .clusters(names) ⇒ Object
- .instances(cluster) ⇒ Object
- .list_instances(cluster) ⇒ Object
- .list_tasks(opt) ⇒ Object
- .run(cluster, task) ⇒ Object
- .services(cluster, services) ⇒ Object
- .stop(cluster, task) ⇒ Object
- .task_definition(name) ⇒ Object
- .tasks(opt = {}) ⇒ Object
- .update_service(opt) ⇒ Object
Methods inherited from Sdk
Class Method Details
.client ⇒ Object
7 8 9 |
# File 'lib/stax/aws/ecs.rb', line 7 def client @_client ||= ::Aws::ECS::Client.new end |
.clusters(names) ⇒ Object
11 12 13 |
# File 'lib/stax/aws/ecs.rb', line 11 def clusters(names) client.describe_clusters(clusters: Array(names)).clusters end |
.instances(cluster) ⇒ Object
48 49 50 |
# File 'lib/stax/aws/ecs.rb', line 48 def instances(cluster) client.describe_container_instances(cluster: cluster, container_instances: list_instances(cluster)).container_instances end |
.list_instances(cluster) ⇒ Object
42 43 44 45 46 |
# File 'lib/stax/aws/ecs.rb', line 42 def list_instances(cluster) paginate(:container_instance_arns) do |token| client.list_container_instances(cluster: cluster, next_token: token) end end |
.list_tasks(opt) ⇒ Object
27 28 29 30 31 |
# File 'lib/stax/aws/ecs.rb', line 27 def list_tasks(opt) paginate(:task_arns) do |token| client.list_tasks(opt.merge(next_token: token)) end end |
.run(cluster, task) ⇒ Object
52 53 54 |
# File 'lib/stax/aws/ecs.rb', line 52 def run(cluster, task) client.run_task(cluster: cluster, task_definition: task).tasks end |
.services(cluster, services) ⇒ Object
15 16 17 |
# File 'lib/stax/aws/ecs.rb', line 15 def services(cluster, services) client.describe_services(cluster: cluster, services: services).services end |
.stop(cluster, task) ⇒ Object
56 57 58 |
# File 'lib/stax/aws/ecs.rb', line 56 def stop(cluster, task) client.stop_task(cluster: cluster, task: task).task end |
.task_definition(name) ⇒ Object
23 24 25 |
# File 'lib/stax/aws/ecs.rb', line 23 def task_definition(name) client.describe_task_definition(task_definition: name).task_definition end |
.tasks(opt = {}) ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'lib/stax/aws/ecs.rb', line 33 def tasks(opt = {}) tasks = list_tasks(opt) if tasks.empty? [] else client.describe_tasks(cluster: opt[:cluster], tasks: tasks).tasks end end |
.update_service(opt) ⇒ Object
19 20 21 |
# File 'lib/stax/aws/ecs.rb', line 19 def update_service(opt) client.update_service(opt).service end |