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 +4 -4
- data/README.md +13 -3
- data/lib/aws_pocketknife/cli/ecs.rb +19 -0
- data/lib/aws_pocketknife/ecs.rb +6 -7
- data/lib/aws_pocketknife/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 41d96e16b3d9d08ed770b9bb9076c3a1a23d2f7a
|
4
|
+
data.tar.gz: 317c73ef82ae1bc136dfdbbd4ee8fb8a24e90670
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df4839229056434b2f9362557e21cd1b736fd145ddfa0ee0cc2e76cdbee77c22aac4d068f19eb03a7c84595d4de8cf5edbdf1114065c3d164ee69ce71b8e983e
|
7
|
+
data.tar.gz: 2133cd9f4e08c10cd0468b61ec4a043e1372214a002f15563470507d191ee48886964e55c240c61c3b006bfa24d98ad33159aa432dba225a85223908f3bb6594
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-

|
2
2
|
[](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/
|
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
|
-
|
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
|
data/lib/aws_pocketknife/ecs.rb
CHANGED
@@ -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(
|
27
|
-
ecs_client.describe_container_instances({cluster:
|
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 =
|
50
|
+
info = describe_container_instances cluster: cluster, container: container
|
52
51
|
container_map[:info] = info
|
53
|
-
|
52
|
+
containers_list << container_map
|
54
53
|
end
|
55
|
-
return
|
54
|
+
return containers_list
|
56
55
|
end
|
57
56
|
|
58
57
|
# clusters
|
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.
|
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-
|
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
|