swa 0.3.1 → 0.3.2
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 +62 -1
- data/lib/swa/cli/base_command.rb +1 -1
- data/lib/swa/data_presentation.rb +1 -1
- data/lib/swa/ec2/image.rb +3 -2
- data/lib/swa/ec2/instance.rb +6 -6
- data/lib/swa/ec2/key_pair.rb +2 -2
- data/lib/swa/ec2/security_group.rb +3 -3
- data/lib/swa/ec2/snapshot.rb +3 -3
- data/lib/swa/ec2/volume.rb +11 -6
- data/lib/swa/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5aa99633a7562065e12b0eda658a5eb0cb500298
|
4
|
+
data.tar.gz: bcf698098737d8e568952ed7db966abf9bc28b75
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c364ab568630bd03aca0d497db0bf6d3e292f9558764e9f3242ea8b8cf044290e5c6be28abd1fd8b11ac991578073fcfd01e082ecb6192837417d89c17ee0044
|
7
|
+
data.tar.gz: 04a8bf044e19cecbd4825a9c505eadd35c3b7d1076a9c7733ebf983d403504f56c154ef82f0dc5403eb5336c649590d0353d642f636b55d1bf8630d283c8f179
|
data/README.md
CHANGED
@@ -1,6 +1,67 @@
|
|
1
1
|
# SWA
|
2
2
|
|
3
|
-
|
3
|
+
SWA is AWS, backwards.
|
4
|
+
|
5
|
+
It's an alternative CLI for AWS. "Backwards" because commands put verbs at the end:
|
6
|
+
|
7
|
+
$ swa ec2 instance i-9336f049 terminate
|
8
|
+
|
9
|
+
rather than the front:
|
10
|
+
|
11
|
+
$ aws ec2 terminate-instances --instance-ids i-9336f049
|
12
|
+
|
13
|
+
## Listing things
|
14
|
+
|
15
|
+
SWA provides sub-commands for listing many types of AWS resource, e.g.
|
16
|
+
|
17
|
+
$ swa ec2 instances
|
18
|
+
|
19
|
+
Listing commands typically provide options for refining the search:
|
20
|
+
|
21
|
+
$ swa ec2 instances --tagged purpose=QA --filter availability-zone=ap-southeast-2b
|
22
|
+
|
23
|
+
By default you'll get a "summary" view, one line per resource:
|
24
|
+
|
25
|
+
$ swa ec2 instances | head
|
26
|
+
i-bcf48c2b ami-1e73737d c3.large running 10.47.5.16
|
27
|
+
i-1990d85c ami-538e7330 t2.micro running 10.47.7.25 "blarg/room-service"
|
28
|
+
i-f9e6ea27 ami-8bfd7eb1 t2.small running 10.47.11.54 "blarg/match-feed"
|
29
|
+
i-19155e5c ami-d5327ab6 c3.large running 10.47.6.238 "fnord-snarfer"
|
30
|
+
i-26357e63 ami-eded7ed7 t2.micro running 10.47.6.96 "fnord-dashboard"
|
31
|
+
i-b85f6c87 ami-695a7253 c3.xlarge running 10.47.5.252 "bam-boozle"
|
32
|
+
i-5627e187 ami-d9d779ba c4.2xlarge running 10.47.11.201 "pub-batch-42"
|
33
|
+
i-ced5ae59 ami-eded7ed7 t2.micro running 10.47.6.22 "atlas-hugged"
|
34
|
+
i-63e722b2 ami-8bfd7eb1 t2.small running 10.47.8.95 "blarg/first-service"
|
35
|
+
|
36
|
+
But you can ask for **all** the data, if you wish:
|
37
|
+
|
38
|
+
$ swa ec2 instances data
|
39
|
+
---
|
40
|
+
- InstanceId: i-bcf48c2b
|
41
|
+
ImageId: ami-1e73537d
|
42
|
+
State:
|
43
|
+
Code: 16
|
44
|
+
Name: running
|
45
|
+
PrivateDnsName: ip-10-48-9-16.ap-southeast-2.compute.internal
|
46
|
+
PublicDnsName: ''
|
47
|
+
...
|
48
|
+
|
49
|
+
Specify `-J` if you like JSON better than YAML.
|
50
|
+
|
51
|
+
## Inspecting things
|
52
|
+
|
53
|
+
Each "collection" operation has a corresponding "item" operation, e.g.
|
54
|
+
|
55
|
+
$ swa ec2 instance i-bcf48c2b ...
|
56
|
+
|
57
|
+
Different resource-types support different sub-commands, but they all implement `data`, which again dumps everything in YAML or JSON format.
|
58
|
+
|
59
|
+
$ swa ec2 instance i-bcf48c2b data
|
60
|
+
|
61
|
+
The "item" sub-command can be ommitted, when it can be inferred from the resource-id:
|
62
|
+
|
63
|
+
$ swa ec2 i-bcf48c2b data
|
64
|
+
$ swa ec2 ami-1e73737d data
|
4
65
|
|
5
66
|
## Contributing
|
6
67
|
|
data/lib/swa/cli/base_command.rb
CHANGED
data/lib/swa/ec2/image.rb
CHANGED
data/lib/swa/ec2/instance.rb
CHANGED
@@ -11,14 +11,14 @@ module Swa
|
|
11
11
|
|
12
12
|
def summary
|
13
13
|
[
|
14
|
-
pad(i.instance_id,
|
15
|
-
pad(i.image_id,
|
14
|
+
pad(i.instance_id, 10),
|
15
|
+
pad(i.image_id, 12),
|
16
16
|
pad(i.instance_type, 10),
|
17
|
-
pad(i.state.name,
|
18
|
-
pad(i.private_ip_address,
|
19
|
-
pad(i.public_ip_address,
|
17
|
+
pad(i.state.name, 10),
|
18
|
+
pad(i.private_ip_address, 14),
|
19
|
+
pad(i.public_ip_address, 14),
|
20
20
|
quoted(name)
|
21
|
-
].join("
|
21
|
+
].join(" ")
|
22
22
|
end
|
23
23
|
|
24
24
|
def name
|
data/lib/swa/ec2/key_pair.rb
CHANGED
data/lib/swa/ec2/snapshot.rb
CHANGED
@@ -13,11 +13,11 @@ module Swa
|
|
13
13
|
[
|
14
14
|
pad(s.snapshot_id, 13),
|
15
15
|
pad(s.volume_id, 12),
|
16
|
-
sprintf("%4d
|
16
|
+
sprintf("%4d", s.volume_size),
|
17
17
|
s.start_time.iso8601,
|
18
|
-
rpad(s.progress,
|
18
|
+
rpad(s.progress, 4),
|
19
19
|
quoted(s.description)
|
20
|
-
].join("
|
20
|
+
].join(" ")
|
21
21
|
end
|
22
22
|
|
23
23
|
extend Forwardable
|
data/lib/swa/ec2/volume.rb
CHANGED
@@ -11,19 +11,24 @@ module Swa
|
|
11
11
|
|
12
12
|
def summary
|
13
13
|
[
|
14
|
-
pad(v.volume_id,
|
15
|
-
pad(v.snapshot_id,
|
16
|
-
sprintf("%
|
17
|
-
pad(v.volume_type,
|
18
|
-
pad(
|
14
|
+
pad(v.volume_id, 12),
|
15
|
+
pad(v.snapshot_id, 13),
|
16
|
+
sprintf("%4d", v.size),
|
17
|
+
pad(v.volume_type, 9),
|
18
|
+
pad(attachment.instance_id, 10),
|
19
|
+
pad(attachment.device, 9),
|
19
20
|
quoted(name)
|
20
|
-
].join("
|
21
|
+
].join(" ")
|
21
22
|
end
|
22
23
|
|
23
24
|
def name
|
24
25
|
tags["Name"]
|
25
26
|
end
|
26
27
|
|
28
|
+
def attachment
|
29
|
+
v.attachments.first || OpenStruct.new
|
30
|
+
end
|
31
|
+
|
27
32
|
extend Forwardable
|
28
33
|
|
29
34
|
def_delegators :v, :delete
|
data/lib/swa/version.rb
CHANGED