aws_pocketknife 0.1.10 → 0.1.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d9c9ad66dadfc2e200c6750694a39d648737f026
4
- data.tar.gz: 7d908a272af5c333e134104b4e9c3109ae289184
3
+ metadata.gz: 3d489e5d3b08d9b817763e64af1a2b0a4151a40e
4
+ data.tar.gz: 7f3c0b40772addd5dd5e8367b521e4bcf999c81f
5
5
  SHA512:
6
- metadata.gz: 25c0580c9841afc651bc9d81814ed5c98f9ea6880607559c3f70fd2228b707fa08b5a3ce941d5175eb3733e2fd1adce13d149f88746685a332fd754a60de9d5a
7
- data.tar.gz: b9f0edd94a31a86d3794962ea20d09cc340f96e6aba54c0f5337bc95fd5254a1248bd14ab3c57e2b633e5bd6784ba4600122bc31d0d6e0a65ecd7296a54bac64
6
+ metadata.gz: 301a948fde25353c5f990b3155a4e525fe5b627ea216b3400fcce255c199aa1f7f40b84ec4650d16f95b807f666e831200e40a55061445e0492baf1e328f35c1
7
+ data.tar.gz: bded649da33c646d5f573ad0b4bdcc06a1ba05dcd5759d5ad8d3f59ef7ecc49fd4de93a27d7c683c9441e249b87fc5a533eae196a6f2dd3e6f21f3e4041ddc1a
@@ -15,7 +15,7 @@ old AMIs along its snapshots or cleaning up manual RDS snapshots or even creatin
15
15
 
16
16
  These commands are also handy if you have multiple aws accounts to manage, since you can't have multiple tabs open for
17
17
  different accounts in a web browser. The only way would be to use diffente browsers or open incognito windows."
18
- spec.homepage = "https://github.com/MYOB-Technology/aws_pocketknife"
18
+ spec.homepage = "https://github.com/gustavosoares/aws_pocketknife"
19
19
  spec.license = "MIT"
20
20
 
21
21
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
@@ -23,6 +23,40 @@ module AwsPocketknife
23
23
 
24
24
  Logging = Common::Logging.logger
25
25
 
26
+ def describe_container_instances(name: '', container: '')
27
+ ecs_client.describe_container_instances({cluster: name, container_instances: [container]}).container_instances.first
28
+ end
29
+
30
+ # list container instances
31
+ def list_container_instances(cluster: '', max_results: 50)
32
+ containers_list = []
33
+ responses = []
34
+
35
+ containers = get_containers max_results: max_results
36
+ responses << containers.container_instance_arns
37
+ next_token = containers.next_token
38
+
39
+ while true
40
+ break if next_token.nil? or next_token.empty?
41
+ resp = get_containers(cluster: cluster, next_token: next_token, max_results: max_results)
42
+ responses << resp.container_instance_arns
43
+ next_token = resp.next_token
44
+ end
45
+
46
+ responses.flatten!
47
+
48
+ responses.each do |container|
49
+ container_map = {}
50
+ container_map[:name] = container.split('/')[1]
51
+ info = describe_containers name: cluster, container: container
52
+ container_map[:info] = info
53
+ container_list << container_map
54
+ end
55
+ return container_list
56
+ end
57
+
58
+ # clusters
59
+
26
60
  def describe_clusters(name: '')
27
61
  ecs_client.describe_clusters({clusters: [name]}).clusters.first
28
62
  end
@@ -38,7 +72,7 @@ module AwsPocketknife
38
72
  while true
39
73
  break if next_token.nil? or next_token.empty?
40
74
  resp = get_clusters(next_token: next_token, max_results: max_results)
41
- responses << clusters.cluster_arns
75
+ responses << resp.cluster_arns
42
76
  next_token = resp.next_token
43
77
  end
44
78
 
@@ -69,7 +103,7 @@ module AwsPocketknife
69
103
  while true
70
104
  break if next_token.nil? or next_token.empty?
71
105
  resp = get_services(next_token: next_token, max_results: max_results, cluster: cluster)
72
- responses << services.service_arns
106
+ responses << resp.service_arns
73
107
  next_token = resp.next_token
74
108
  end
75
109
 
@@ -100,6 +134,14 @@ module AwsPocketknife
100
134
  })
101
135
  end
102
136
 
137
+ def get_containers(cluster: "", next_token: "", max_results: 100)
138
+ ecs_client.list_container_instances({
139
+ max_results: max_results,
140
+ cluster: cluster,
141
+ next_token: next_token
142
+ })
143
+ end
144
+
103
145
  end
104
146
 
105
147
  end
@@ -1,3 +1,3 @@
1
1
  module AwsPocketknife
2
- VERSION = "0.1.10"
2
+ VERSION = "0.1.11"
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.10
4
+ version: 0.1.11
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-15 00:00:00.000000000 Z
11
+ date: 2017-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-core
@@ -253,7 +253,7 @@ files:
253
253
  - lib/aws_pocketknife/tasks/iam.rake
254
254
  - lib/aws_pocketknife/tasks/route53.rake
255
255
  - lib/aws_pocketknife/version.rb
256
- homepage: https://github.com/MYOB-Technology/aws_pocketknife
256
+ homepage: https://github.com/gustavosoares/aws_pocketknife
257
257
  licenses:
258
258
  - MIT
259
259
  metadata: {}