aws_pocketknife 0.1.11 → 0.1.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3d489e5d3b08d9b817763e64af1a2b0a4151a40e
4
- data.tar.gz: 7f3c0b40772addd5dd5e8367b521e4bcf999c81f
3
+ metadata.gz: 41d96e16b3d9d08ed770b9bb9076c3a1a23d2f7a
4
+ data.tar.gz: 317c73ef82ae1bc136dfdbbd4ee8fb8a24e90670
5
5
  SHA512:
6
- metadata.gz: 301a948fde25353c5f990b3155a4e525fe5b627ea216b3400fcce255c199aa1f7f40b84ec4650d16f95b807f666e831200e40a55061445e0492baf1e328f35c1
7
- data.tar.gz: bded649da33c646d5f573ad0b4bdcc06a1ba05dcd5759d5ad8d3f59ef7ecc49fd4de93a27d7c683c9441e249b87fc5a533eae196a6f2dd3e6f21f3e4041ddc1a
6
+ metadata.gz: df4839229056434b2f9362557e21cd1b736fd145ddfa0ee0cc2e76cdbee77c22aac4d068f19eb03a7c84595d4de8cf5edbdf1114065c3d164ee69ce71b8e983e
7
+ data.tar.gz: 2133cd9f4e08c10cd0468b61ec4a043e1372214a002f15563470507d191ee48886964e55c240c61c3b006bfa24d98ad33159aa432dba225a85223908f3bb6594
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- ![Build Status](https://travis-ci.org/MYOB-Technology/aws_pocketknife.svg?branch=master)
1
+ ![Build Status](https://travis-ci.org/gustavosoares/aws_pocketknife.svg?branch=master)
2
2
  [![Gem Version](https://badge.fury.io/rb/aws_pocketknife.svg)](https://badge.fury.io/rb/aws_pocketknife)
3
3
 
4
4
  # Aws Pocketknife
@@ -33,7 +33,7 @@ And then execute:
33
33
  Or install it yourself as:
34
34
 
35
35
  ```
36
- git clone https://github.com/MYOB-Technology/aws_pocketknife.git
36
+ git clone https://github.com/gustavosoares/aws_pocketknife.git
37
37
  bundle install
38
38
  rake install
39
39
  ```
@@ -112,12 +112,22 @@ Commands:
112
112
  pocketknife route53 update_record HOSTED_ZONE ORIGIN_DNS_NAME DESTINY_RECORD_NAME DESTINY_HOSTED_ZONE RECORD_TYPE (default to A) # Update a dns record from an existing dns entry.
113
113
  ```
114
114
 
115
+ ### ECS
116
+
117
+ ```
118
+ Commands:
119
+ pocketknife ecs help [COMMAND] # Describe subcommands or one specific subcommand
120
+ pocketknife ecs list_clusters # list clustes
121
+ pocketknife ecs list_instances for CLUSTER_NAME # list instances for a given cluster
122
+ pocketknife ecs list_services CLUSTER_NAME # list services for a given cluster
123
+ ```
124
+
115
125
  ## Development
116
126
 
117
127
 
118
128
  ## Contributing
119
129
 
120
- Bug reports and pull requests are welcome on GitHub at https://github.com/MYOB-Technology/aws_pocketknife. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
130
+ This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
121
131
 
122
132
  * Fork it
123
133
  * Make you changes
@@ -44,6 +44,25 @@ module AwsPocketknife
44
44
  AwsPocketknife::Ecs.pretty_table(headers: headers, data: data)
45
45
  end
46
46
  end
47
+
48
+ desc "list_instances for CLUSTER_NAME", "list instances for a given cluster"
49
+ def list_instances(cluster)
50
+ instances = AwsPocketknife::Ecs.list_container_instances cluster: cluster
51
+ headers = ["name", "ec2_instance_id", "pending_tasks_count","running_tasks_count",
52
+ "status"]
53
+ data = []
54
+ if instances.nil?
55
+ puts "No instances found"
56
+ else
57
+ instances.each do |instance|
58
+ info = instance[:info]
59
+ data << [instance[:name], info.ec2_instance_id, info.pending_tasks_count,
60
+ info.running_tasks_count, info.status
61
+ ]
62
+ end
63
+ AwsPocketknife::Ecs.pretty_table(headers: headers, data: data)
64
+ end
65
+ end
47
66
  end
48
67
  end
49
68
  end
@@ -19,12 +19,11 @@ module AwsPocketknife
19
19
 
20
20
  class << self
21
21
  include AwsPocketknife::Common::Utils
22
- #include AwsPocketknife::Common::Logging
23
22
 
24
23
  Logging = Common::Logging.logger
25
24
 
26
- def describe_container_instances(name: '', container: '')
27
- ecs_client.describe_container_instances({cluster: name, container_instances: [container]}).container_instances.first
25
+ def describe_container_instances(cluster: '', container: '')
26
+ ecs_client.describe_container_instances({cluster: cluster, container_instances: [container]}).container_instances.first
28
27
  end
29
28
 
30
29
  # list container instances
@@ -32,7 +31,7 @@ module AwsPocketknife
32
31
  containers_list = []
33
32
  responses = []
34
33
 
35
- containers = get_containers max_results: max_results
34
+ containers = get_containers cluster: cluster, max_results: max_results
36
35
  responses << containers.container_instance_arns
37
36
  next_token = containers.next_token
38
37
 
@@ -48,11 +47,11 @@ module AwsPocketknife
48
47
  responses.each do |container|
49
48
  container_map = {}
50
49
  container_map[:name] = container.split('/')[1]
51
- info = describe_containers name: cluster, container: container
50
+ info = describe_container_instances cluster: cluster, container: container
52
51
  container_map[:info] = info
53
- container_list << container_map
52
+ containers_list << container_map
54
53
  end
55
- return container_list
54
+ return containers_list
56
55
  end
57
56
 
58
57
  # clusters
@@ -1,3 +1,3 @@
1
1
  module AwsPocketknife
2
- VERSION = "0.1.11"
2
+ VERSION = "0.1.12"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws_pocketknife
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.11
4
+ version: 0.1.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gustavo Soares Souza
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-02-20 00:00:00.000000000 Z
11
+ date: 2017-03-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-core