swa 0.3.0 → 0.3.1
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/lib/swa/cli/ec2_command.rb +40 -2
- data/lib/swa/data_presentation.rb +5 -0
- data/lib/swa/ec2/snapshot.rb +34 -0
- data/lib/swa/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: edb6eed402b48a9becd4603b16ce035cbfb4506b
|
4
|
+
data.tar.gz: 01990ca10d51726866bd933ce6b1393f7f5c076e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c94db3dd53d1fd461c2ef75ee64e47db90d8efee0d26ac5547713ffd5c547e6bed0dae2cb4d8ffe5dfd6a07fc694c684a2cef2b11dbfafddf6ecfa4a140c5bea
|
7
|
+
data.tar.gz: fac54c6cef75b2c85d12cb974a4084eb8556b87588ff133a50c1997b915abfdcbdbaf2f944cd9ff588886a54c669863a5526fd8eed7572adb55358963a428262
|
data/lib/swa/cli/ec2_command.rb
CHANGED
@@ -7,6 +7,7 @@ require "swa/ec2/key_pair"
|
|
7
7
|
require "swa/ec2/image"
|
8
8
|
require "swa/ec2/instance"
|
9
9
|
require "swa/ec2/security_group"
|
10
|
+
require "swa/ec2/snapshot"
|
10
11
|
require "swa/ec2/volume"
|
11
12
|
|
12
13
|
module Swa
|
@@ -201,7 +202,44 @@ module Swa
|
|
201
202
|
|
202
203
|
end
|
203
204
|
|
204
|
-
subcommand ["
|
205
|
+
subcommand ["snapshot", "snap"], "Show snapshot" do
|
206
|
+
|
207
|
+
parameter "SNAPSHOT-ID", "snapshot id"
|
208
|
+
|
209
|
+
include ItemBehaviour
|
210
|
+
|
211
|
+
private
|
212
|
+
|
213
|
+
def snapshot
|
214
|
+
Swa::EC2::Snapshot.new(ec2.snapshot(snapshot_id))
|
215
|
+
end
|
216
|
+
|
217
|
+
alias_method :item, :snapshot
|
218
|
+
|
219
|
+
end
|
220
|
+
|
221
|
+
subcommand ["snapshots", "snaps"], "List snapshots" do
|
222
|
+
|
223
|
+
option "--owned-by", "OWNER", "with specified owner", :default => "self"
|
224
|
+
|
225
|
+
include TagFilterOptions
|
226
|
+
include CollectionBehaviour
|
227
|
+
|
228
|
+
private
|
229
|
+
|
230
|
+
def snapshots
|
231
|
+
options = {
|
232
|
+
:owner_ids => [owned_by]
|
233
|
+
}
|
234
|
+
options[:filters] = filters unless filters.empty?
|
235
|
+
Swa::EC2::Snapshot.list(ec2.snapshots(options))
|
236
|
+
end
|
237
|
+
|
238
|
+
alias_method :collection, :snapshots
|
239
|
+
|
240
|
+
end
|
241
|
+
|
242
|
+
subcommand ["volume", "vol"], "Show volume" do
|
205
243
|
|
206
244
|
parameter "VOLUME-ID", "volume id"
|
207
245
|
|
@@ -217,7 +255,7 @@ module Swa
|
|
217
255
|
|
218
256
|
end
|
219
257
|
|
220
|
-
subcommand ["volumes", "
|
258
|
+
subcommand ["volumes", "vols"], "List volumes" do
|
221
259
|
|
222
260
|
include TagFilterOptions
|
223
261
|
include CollectionBehaviour
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require "forwardable"
|
2
|
+
require "swa/resource"
|
3
|
+
require "swa/ec2/tagged_resource"
|
4
|
+
|
5
|
+
module Swa
|
6
|
+
module EC2
|
7
|
+
|
8
|
+
class Snapshot < Resource
|
9
|
+
|
10
|
+
include TaggedResource
|
11
|
+
|
12
|
+
def summary
|
13
|
+
[
|
14
|
+
pad(s.snapshot_id, 13),
|
15
|
+
pad(s.volume_id, 12),
|
16
|
+
sprintf("%4d ", s.volume_size),
|
17
|
+
s.start_time.iso8601,
|
18
|
+
rpad(s.progress, 5),
|
19
|
+
quoted(s.description)
|
20
|
+
].join(" ")
|
21
|
+
end
|
22
|
+
|
23
|
+
extend Forwardable
|
24
|
+
|
25
|
+
def_delegators :s, :delete
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
alias_method :s, :aws_resource
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
data/lib/swa/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: swa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Williams
|
@@ -139,6 +139,7 @@ files:
|
|
139
139
|
- lib/swa/ec2/instance.rb
|
140
140
|
- lib/swa/ec2/key_pair.rb
|
141
141
|
- lib/swa/ec2/security_group.rb
|
142
|
+
- lib/swa/ec2/snapshot.rb
|
142
143
|
- lib/swa/ec2/tagged_resource.rb
|
143
144
|
- lib/swa/ec2/volume.rb
|
144
145
|
- lib/swa/resource.rb
|