fog 0.3.7 → 0.3.8
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +6 -6
- data/README.rdoc +7 -1
- data/bin/fog +4 -3
- data/fog.gemspec +39 -24
- data/lib/fog.rb +4 -12
- data/lib/fog/aws.rb +14 -5
- data/lib/fog/aws/compute.rb +26 -9
- data/lib/fog/aws/elb.rb +3 -2
- data/lib/fog/aws/models/compute/address.rb +2 -1
- data/lib/fog/aws/models/compute/addresses.rb +11 -9
- data/lib/fog/aws/models/compute/flavor.rb +1 -1
- data/lib/fog/aws/models/compute/flavors.rb +13 -11
- data/lib/fog/aws/models/compute/image.rb +2 -1
- data/lib/fog/aws/models/compute/images.rb +7 -9
- data/lib/fog/aws/models/compute/key_pair.rb +1 -1
- data/lib/fog/aws/models/compute/key_pairs.rb +10 -8
- data/lib/fog/aws/models/compute/security_group.rb +1 -1
- data/lib/fog/aws/models/compute/security_groups.rb +11 -9
- data/lib/fog/aws/models/compute/server.rb +10 -3
- data/lib/fog/aws/models/compute/servers.rb +14 -8
- data/lib/fog/aws/models/compute/snapshot.rb +3 -2
- data/lib/fog/aws/models/compute/snapshots.rb +11 -16
- data/lib/fog/aws/models/compute/tag.rb +36 -0
- data/lib/fog/aws/models/compute/tags.rb +34 -0
- data/lib/fog/aws/models/compute/volume.rb +11 -10
- data/lib/fog/aws/models/compute/volumes.rb +11 -9
- data/lib/fog/aws/models/storage/directories.rb +1 -1
- data/lib/fog/aws/models/storage/directory.rb +1 -1
- data/lib/fog/aws/models/storage/file.rb +3 -2
- data/lib/fog/aws/models/storage/files.rb +1 -7
- data/lib/fog/aws/parsers/compute/describe_availability_zones.rb +4 -2
- data/lib/fog/aws/parsers/compute/describe_images.rb +23 -13
- data/lib/fog/aws/parsers/compute/describe_instances.rb +34 -8
- data/lib/fog/aws/parsers/compute/describe_security_groups.rb +4 -3
- data/lib/fog/aws/parsers/compute/describe_snapshots.rb +33 -13
- data/lib/fog/aws/parsers/compute/describe_tags.rb +30 -0
- data/lib/fog/aws/parsers/compute/describe_volumes.rb +17 -3
- data/lib/fog/aws/parsers/compute/run_instances.rb +4 -4
- data/lib/fog/aws/parsers/storage/get_bucket.rb +1 -1
- data/lib/fog/aws/parsers/storage/get_bucket_logging.rb +1 -1
- data/lib/fog/aws/parsers/storage/get_bucket_object_versions.rb +3 -3
- data/lib/fog/aws/requests/compute/create_snapshot.rb +1 -0
- data/lib/fog/aws/requests/compute/create_tags.rb +78 -0
- data/lib/fog/aws/requests/compute/delete_tags.rb +45 -0
- data/lib/fog/aws/requests/compute/describe_addresses.rb +27 -19
- data/lib/fog/aws/requests/compute/describe_availability_zones.rb +31 -25
- data/lib/fog/aws/requests/compute/describe_images.rb +11 -18
- data/lib/fog/aws/requests/compute/describe_instances.rb +125 -53
- data/lib/fog/aws/requests/compute/describe_key_pairs.rb +29 -21
- data/lib/fog/aws/requests/compute/describe_regions.rb +28 -23
- data/lib/fog/aws/requests/compute/describe_reserved_instances.rb +8 -4
- data/lib/fog/aws/requests/compute/describe_security_groups.rb +48 -19
- data/lib/fog/aws/requests/compute/describe_snapshots.rb +72 -35
- data/lib/fog/aws/requests/compute/describe_tags.rb +42 -0
- data/lib/fog/aws/requests/compute/describe_volumes.rb +67 -36
- data/lib/fog/aws/requests/compute/run_instances.rb +10 -3
- data/lib/fog/aws/simpledb.rb +3 -1
- data/lib/fog/aws/storage.rb +17 -8
- data/lib/fog/bluebox/models/compute/flavor.rb +1 -1
- data/lib/fog/bluebox/models/compute/flavors.rb +1 -1
- data/lib/fog/bluebox/models/compute/image.rb +1 -1
- data/lib/fog/bluebox/models/compute/images.rb +1 -1
- data/lib/fog/bluebox/models/compute/server.rb +8 -6
- data/lib/fog/bluebox/models/compute/servers.rb +1 -1
- data/lib/fog/bluebox/requests/compute/get_blocks.rb +1 -1
- data/lib/fog/core.rb +11 -0
- data/lib/fog/{attributes.rb → core/attributes.rb} +0 -0
- data/lib/fog/{bin.rb → core/bin.rb} +1 -1
- data/lib/fog/{collection.rb → core/collection.rb} +4 -0
- data/lib/fog/{connection.rb → core/connection.rb} +0 -0
- data/lib/fog/{credentials.rb → core/credentials.rb} +2 -0
- data/lib/fog/{deprecation.rb → core/deprecation.rb} +0 -0
- data/lib/fog/{errors.rb → core/errors.rb} +0 -0
- data/lib/fog/{hmac.rb → core/hmac.rb} +0 -0
- data/lib/fog/{model.rb → core/model.rb} +0 -0
- data/lib/fog/{parser.rb → core/parser.rb} +0 -0
- data/lib/fog/{provider.rb → core/provider.rb} +0 -0
- data/lib/fog/{service.rb → core/service.rb} +1 -0
- data/lib/fog/{ssh.rb → core/ssh.rb} +7 -7
- data/lib/fog/go_grid.rb +1 -1
- data/lib/fog/go_grid/compute.rb +6 -1
- data/lib/fog/go_grid/models/compute/image.rb +60 -0
- data/lib/fog/go_grid/models/compute/images.rb +33 -0
- data/lib/fog/go_grid/models/compute/server.rb +56 -0
- data/lib/fog/go_grid/models/compute/servers.rb +35 -0
- data/lib/fog/go_grid/requests/compute/grid_image_get.rb +41 -0
- data/lib/fog/go_grid/requests/compute/grid_image_list.rb +6 -1
- data/lib/fog/go_grid/requests/compute/grid_server_power.rb +2 -2
- data/lib/fog/google/models/storage/directories.rb +1 -1
- data/lib/fog/google/models/storage/directory.rb +1 -1
- data/lib/fog/google/models/storage/file.rb +3 -2
- data/lib/fog/google/models/storage/files.rb +1 -7
- data/lib/fog/google/parsers/storage/get_bucket.rb +1 -1
- data/lib/fog/linode/requests/compute/avail_linodeplans.rb +2 -2
- data/lib/fog/local/models/storage/directories.rb +1 -1
- data/lib/fog/local/models/storage/directory.rb +1 -1
- data/lib/fog/local/models/storage/file.rb +2 -2
- data/lib/fog/local/models/storage/files.rb +2 -5
- data/lib/fog/local/storage.rb +1 -1
- data/lib/fog/new_servers/compute.rb +1 -1
- data/lib/fog/rackspace/models/compute/flavor.rb +1 -3
- data/lib/fog/rackspace/models/compute/flavors.rb +1 -1
- data/lib/fog/rackspace/models/compute/image.rb +2 -1
- data/lib/fog/rackspace/models/compute/images.rb +1 -1
- data/lib/fog/rackspace/models/compute/server.rb +12 -11
- data/lib/fog/rackspace/models/compute/servers.rb +1 -1
- data/lib/fog/rackspace/models/storage/directories.rb +1 -1
- data/lib/fog/rackspace/models/storage/directory.rb +1 -1
- data/lib/fog/rackspace/models/storage/file.rb +4 -4
- data/lib/fog/rackspace/models/storage/files.rb +1 -1
- data/lib/fog/rackspace/requests/compute/create_image.rb +2 -2
- data/lib/fog/rackspace/requests/compute/delete_image.rb +1 -1
- data/lib/fog/rackspace/requests/compute/delete_server.rb +1 -1
- data/lib/fog/rackspace/requests/compute/get_server_details.rb +1 -1
- data/lib/fog/rackspace/requests/compute/list_addresses.rb +1 -1
- data/lib/fog/rackspace/requests/compute/list_images_detail.rb +2 -2
- data/lib/fog/rackspace/requests/compute/list_private_addresses.rb +1 -1
- data/lib/fog/rackspace/requests/compute/list_public_addresses.rb +1 -1
- data/lib/fog/rackspace/requests/compute/update_server.rb +1 -1
- data/lib/fog/rackspace/requests/storage/put_object.rb +4 -3
- data/lib/fog/slicehost/models/compute/flavor.rb +1 -1
- data/lib/fog/slicehost/models/compute/flavors.rb +1 -1
- data/lib/fog/slicehost/models/compute/image.rb +1 -1
- data/lib/fog/slicehost/models/compute/images.rb +1 -1
- data/lib/fog/slicehost/models/compute/server.rb +3 -1
- data/lib/fog/slicehost/models/compute/servers.rb +1 -1
- data/lib/fog/terremark/ecloud.rb +34 -33
- data/lib/fog/terremark/models/shared/address.rb +1 -1
- data/lib/fog/terremark/models/shared/network.rb +1 -1
- data/lib/fog/terremark/models/shared/server.rb +1 -1
- data/lib/fog/terremark/models/shared/servers.rb +1 -1
- data/lib/fog/terremark/models/shared/task.rb +1 -1
- data/lib/fog/terremark/models/shared/tasks.rb +1 -1
- data/lib/fog/terremark/models/shared/vdc.rb +1 -1
- data/lib/fog/terremark/parser.rb +1 -0
- data/lib/fog/terremark/vcloud.rb +4 -4
- data/lib/fog/vcloud.rb +15 -7
- data/lib/fog/vcloud/terremark/ecloud.rb +15 -3
- data/lib/fog/vcloud/terremark/ecloud/models/firewall_acls.rb +1 -1
- data/lib/fog/vcloud/terremark/ecloud/models/internet_services.rb +1 -1
- data/lib/fog/vcloud/terremark/ecloud/models/ips.rb +1 -1
- data/lib/fog/vcloud/terremark/ecloud/models/networks.rb +1 -1
- data/lib/fog/vcloud/terremark/ecloud/models/nodes.rb +1 -1
- data/lib/fog/vcloud/terremark/ecloud/models/public_ips.rb +1 -1
- data/lib/fog/vcloud/terremark/ecloud/models/servers.rb +1 -1
- data/lib/fog/vcloud/terremark/ecloud/models/tasks.rb +1 -1
- data/lib/fog/vcloud/terremark/ecloud/models/vdcs.rb +1 -1
- data/lib/fog/vcloud/terremark/ecloud/requests/add_internet_service.rb +55 -49
- data/lib/fog/vcloud/terremark/ecloud/requests/add_node.rb +19 -15
- data/lib/fog/vcloud/terremark/ecloud/requests/configure_internet_service.rb +8 -1
- data/lib/fog/vcloud/terremark/ecloud/requests/configure_node.rb +17 -12
- data/lib/fog/vcloud/terremark/ecloud/requests/get_catalog.rb +29 -1
- data/lib/fog/vcloud/terremark/ecloud/requests/get_catalog_item.rb +38 -2
- data/lib/fog/vcloud/terremark/ecloud/requests/get_customization_options.rb +8 -2
- data/lib/fog/vcloud/terremark/ecloud/requests/instantiate_vapp_template.rb +46 -4
- data/spec/aws/models/compute/server_spec.rb +2 -0
- data/spec/aws/requests/simpledb/select_spec.rb +1 -0
- data/spec/spec_helper.rb +1 -1
- data/spec/vcloud/spec_helper.rb +1 -1
- data/spec/vcloud/terremark/ecloud/requests/get_catalog_item_spec.rb +62 -0
- data/spec/vcloud/terremark/ecloud/requests/get_catalog_spec.rb +44 -0
- data/spec/vcloud/terremark/ecloud/requests/get_customization_options_spec.rb +39 -0
- data/spec/vcloud/terremark/ecloud/requests/instantiate_vapp_template_spec.rb +73 -0
- data/tests/aws/requests/compute/address_tests.rb +2 -6
- data/tests/aws/requests/compute/availability_zone_tests.rb +3 -10
- data/tests/aws/requests/compute/image_tests.rb +4 -9
- data/tests/aws/requests/compute/instance_tests.rb +7 -8
- data/tests/aws/requests/compute/key_pair_tests.rb +2 -6
- data/tests/aws/requests/compute/region_tests.rb +2 -9
- data/tests/aws/requests/compute/security_group_tests.rb +3 -7
- data/tests/aws/requests/compute/snapshot_tests.rb +4 -7
- data/tests/aws/requests/compute/tag_tests.rb +49 -0
- data/tests/aws/requests/compute/volume_tests.rb +2 -6
- data/tests/aws/requests/storage/bucket_tests.rb +48 -0
- data/tests/aws/requests/storage/object_tests.rb +63 -0
- data/tests/bluebox/requests/compute/block_tests.rb +24 -11
- data/tests/bluebox/requests/compute/product_tests.rb +3 -0
- data/tests/bluebox/requests/compute/template_tests.rb +3 -0
- data/tests/go_grid/helper.rb +0 -0
- data/tests/go_grid/requests/compute/image_tests.rb +0 -0
- data/tests/helper.rb +5 -1
- data/tests/linode/requests/compute/datacenter_tests.rb +1 -0
- data/tests/linode/requests/compute/distribution_tests.rb +2 -0
- data/tests/linode/requests/compute/linode_tests.rb +6 -0
- data/tests/linode/requests/compute/linodeplans_tests.rb +2 -0
- data/tests/lorem.txt +1 -0
- data/tests/rackspace/requests/compute/flavor_tests.rb +4 -0
- data/tests/rackspace/requests/compute/image_tests.rb +12 -4
- data/tests/rackspace/requests/compute/server_tests.rb +9 -0
- data/tests/slicehost/requests/compute/backup_tests.rb +1 -0
- data/tests/slicehost/requests/compute/flavor_tests.rb +3 -0
- data/tests/slicehost/requests/compute/image_tests.rb +3 -0
- data/tests/slicehost/requests/compute/slice_tests.rb +14 -2
- metadata +42 -27
- data/spec/aws/requests/storage/delete_bucket_spec.rb +0 -35
- data/spec/aws/requests/storage/delete_object_spec.rb +0 -36
- data/spec/aws/requests/storage/get_object_spec.rb +0 -58
- data/spec/aws/requests/storage/get_service_spec.rb +0 -32
- data/spec/aws/requests/storage/head_object_spec.rb +0 -26
- data/spec/aws/requests/storage/put_bucket_spec.rb +0 -19
- data/spec/aws/requests/storage/put_object_spec.rb +0 -43
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'fog/core/model'
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module AWS
|
5
|
+
class Compute
|
6
|
+
|
7
|
+
class Tag < Fog::Model
|
8
|
+
|
9
|
+
identity :key
|
10
|
+
|
11
|
+
attribute :value
|
12
|
+
attribute :resource_id, :aliases => 'resourceId'
|
13
|
+
attribute :resource_type, :aliases => 'resourceType'
|
14
|
+
|
15
|
+
def initialize(attributes = {})
|
16
|
+
super
|
17
|
+
end
|
18
|
+
|
19
|
+
def destroy
|
20
|
+
requires :key, :resource_id
|
21
|
+
connection.delete_tags(resource_id, key)
|
22
|
+
true
|
23
|
+
end
|
24
|
+
|
25
|
+
def save
|
26
|
+
requires :key, :resource_id
|
27
|
+
connection.create_tags(resource_id, key => value)
|
28
|
+
true
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'fog/core/collection'
|
2
|
+
require 'fog/aws/models/compute/tag'
|
3
|
+
|
4
|
+
module Fog
|
5
|
+
module AWS
|
6
|
+
class Compute
|
7
|
+
|
8
|
+
class Tags < Fog::Collection
|
9
|
+
|
10
|
+
attribute :filters
|
11
|
+
|
12
|
+
model Fog::AWS::Compute::Tag
|
13
|
+
|
14
|
+
def initialize(attributes)
|
15
|
+
@filters ||= {}
|
16
|
+
super
|
17
|
+
end
|
18
|
+
|
19
|
+
def all(filters = @filters)
|
20
|
+
@filters = filters
|
21
|
+
data = connection.describe_tags(@filters).body
|
22
|
+
load(data['tagSet'])
|
23
|
+
end
|
24
|
+
|
25
|
+
def get(key)
|
26
|
+
if key
|
27
|
+
self.class.new(:connection => connection).all('key' => key)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'fog/model'
|
1
|
+
require 'fog/core/model'
|
2
2
|
|
3
3
|
module Fog
|
4
4
|
module AWS
|
@@ -18,6 +18,7 @@ module Fog
|
|
18
18
|
attribute :size
|
19
19
|
attribute :snapshot_id, :aliases => 'snapshotId'
|
20
20
|
attribute :state, :aliases => 'status'
|
21
|
+
attribute :tags, :aliases => 'tagSet'
|
21
22
|
|
22
23
|
def initialize(attributes = {})
|
23
24
|
# assign server first to prevent race condition with new_record?
|
@@ -36,15 +37,8 @@ module Fog
|
|
36
37
|
state == 'available'
|
37
38
|
end
|
38
39
|
|
39
|
-
def server=(new_server)
|
40
|
-
if new_server
|
41
|
-
attach(new_server)
|
42
|
-
else
|
43
|
-
detach
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
40
|
def save
|
41
|
+
raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if identity
|
48
42
|
requires :availability_zone, :size
|
49
43
|
|
50
44
|
data = connection.create_volume(@availability_zone, @size, @snapshot_id).body
|
@@ -56,9 +50,16 @@ module Fog
|
|
56
50
|
true
|
57
51
|
end
|
58
52
|
|
53
|
+
def server=(new_server)
|
54
|
+
if new_server
|
55
|
+
attach(new_server)
|
56
|
+
else
|
57
|
+
detach
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
59
61
|
def snapshots
|
60
62
|
requires :id
|
61
|
-
|
62
63
|
connection.snapshots(:volume => self)
|
63
64
|
end
|
64
65
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'fog/collection'
|
1
|
+
require 'fog/core/collection'
|
2
2
|
require 'fog/aws/models/compute/volume'
|
3
3
|
|
4
4
|
module Fog
|
@@ -7,19 +7,23 @@ module Fog
|
|
7
7
|
|
8
8
|
class Volumes < Fog::Collection
|
9
9
|
|
10
|
-
attribute :
|
10
|
+
attribute :filters
|
11
11
|
attribute :server
|
12
12
|
|
13
13
|
model Fog::AWS::Compute::Volume
|
14
14
|
|
15
15
|
def initialize(attributes)
|
16
|
-
@
|
16
|
+
@filters ||= {}
|
17
17
|
super
|
18
18
|
end
|
19
19
|
|
20
|
-
def all(
|
21
|
-
|
22
|
-
|
20
|
+
def all(filters = @filters)
|
21
|
+
unless filters.is_a?(Hash)
|
22
|
+
Formatador.display_line("[yellow][WARN] all with #{filters.class} param is deprecated, use all('volume-id' => []) instead[/] [light_black](#{caller.first})[/]")
|
23
|
+
filters = {'volume-id' => [*filters]}
|
24
|
+
end
|
25
|
+
@filters = filters
|
26
|
+
data = connection.describe_volumes(@filters).body
|
23
27
|
load(data['volumeSet'])
|
24
28
|
if server
|
25
29
|
self.replace(self.select {|volume| volume.server_id == server.id})
|
@@ -29,10 +33,8 @@ module Fog
|
|
29
33
|
|
30
34
|
def get(volume_id)
|
31
35
|
if volume_id
|
32
|
-
all(volume_id).first
|
36
|
+
self.class.new(:connection => connection).all('volume-id' => volume_id).first
|
33
37
|
end
|
34
|
-
rescue Fog::Errors::NotFound
|
35
|
-
nil
|
36
38
|
end
|
37
39
|
|
38
40
|
def new(attributes = {})
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'fog/model'
|
1
|
+
require 'fog/core/model'
|
2
2
|
|
3
3
|
module Fog
|
4
4
|
module AWS
|
@@ -8,7 +8,7 @@ module Fog
|
|
8
8
|
|
9
9
|
identity :key, :aliases => 'Key'
|
10
10
|
|
11
|
-
|
11
|
+
attr_writer :body
|
12
12
|
attribute :content_length, :aliases => 'Content-Length'
|
13
13
|
attribute :content_type, :aliases => 'Content-Type'
|
14
14
|
attribute :etag, :aliases => ['Etag', 'ETag']
|
@@ -58,6 +58,7 @@ module Fog
|
|
58
58
|
true
|
59
59
|
end
|
60
60
|
|
61
|
+
remove_method :owner=
|
61
62
|
def owner=(new_owner)
|
62
63
|
if new_owner
|
63
64
|
@owner = {
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'fog/collection'
|
1
|
+
require 'fog/core/collection'
|
2
2
|
require 'fog/aws/models/storage/file'
|
3
3
|
|
4
4
|
module Fog
|
@@ -81,12 +81,6 @@ module Fog
|
|
81
81
|
super({ :directory => directory }.merge!(attributes))
|
82
82
|
end
|
83
83
|
|
84
|
-
private
|
85
|
-
|
86
|
-
def directory=(new_directory)
|
87
|
-
@directory = new_directory
|
88
|
-
end
|
89
|
-
|
90
84
|
end
|
91
85
|
|
92
86
|
end
|
@@ -6,7 +6,7 @@ module Fog
|
|
6
6
|
class DescribeAvailabilityZones < Fog::Parsers::Base
|
7
7
|
|
8
8
|
def reset
|
9
|
-
@availability_zone = {}
|
9
|
+
@availability_zone = { 'messageSet' => [] }
|
10
10
|
@response = { 'availabilityZoneInfo' => [] }
|
11
11
|
end
|
12
12
|
|
@@ -14,7 +14,9 @@ module Fog
|
|
14
14
|
case name
|
15
15
|
when 'item'
|
16
16
|
@response['availabilityZoneInfo'] << @availability_zone
|
17
|
-
@availability_zone = {}
|
17
|
+
@availability_zone = { 'messageSet' => [] }
|
18
|
+
when 'message'
|
19
|
+
@availability_zone['messageSet'] << @value
|
18
20
|
when 'regionName', 'zoneName', 'zoneState'
|
19
21
|
@availability_zone[name] = @value
|
20
22
|
when 'requestId'
|
@@ -6,26 +6,32 @@ module Fog
|
|
6
6
|
class DescribeImages < Fog::Parsers::Base
|
7
7
|
|
8
8
|
def reset
|
9
|
-
@
|
9
|
+
@block_device_mapping = {}
|
10
|
+
@image = { 'blockDeviceMapping' => [], 'productCodes' => [], 'tagSet' => {} }
|
10
11
|
@response = { 'imagesSet' => [] }
|
12
|
+
@tag = {}
|
11
13
|
end
|
12
14
|
|
13
15
|
def start_element(name, attrs = [])
|
14
16
|
super
|
15
|
-
|
17
|
+
case name
|
18
|
+
when 'productCodes'
|
16
19
|
@in_product_codes = true
|
17
|
-
|
20
|
+
when 'blockDeviceMapping'
|
18
21
|
@in_block_device_mapping = true
|
19
|
-
|
20
|
-
|
21
|
-
@image['blockDeviceMapping'] << {}
|
22
|
+
when 'tagSet'
|
23
|
+
@in_tag_set = true
|
22
24
|
end
|
23
25
|
end
|
24
|
-
|
26
|
+
|
25
27
|
def end_element(name)
|
26
28
|
case name
|
27
29
|
when 'architecture', 'imageId', 'imageLocation', 'imageOwnerId', 'imageState', 'imageType', 'kernelId', 'platform', 'ramdiskId', 'rootDeviceType','rootDeviceName'
|
28
30
|
@image[name] = @value
|
31
|
+
when 'blockDeviceMapping'
|
32
|
+
@in_block_device_mapping = false
|
33
|
+
when 'deviceName', 'virtualName', 'snapshotId', 'deleteOnTermination'
|
34
|
+
@block_device_mapping[name] = @value
|
29
35
|
when 'isPublic'
|
30
36
|
if @value == 'true'
|
31
37
|
@image[name] = true
|
@@ -34,21 +40,25 @@ module Fog
|
|
34
40
|
end
|
35
41
|
when 'item'
|
36
42
|
if @in_block_device_mapping
|
43
|
+
@image['blockDeviceMapping'] << @block_device_mapping
|
44
|
+
@block_device_mapping = {}
|
45
|
+
elsif @in_tag_set
|
46
|
+
@image['tagSet'][@tag['key']] = @tag['value']
|
47
|
+
@tag = {}
|
37
48
|
elsif !@in_product_codes
|
38
49
|
@response['imagesSet'] << @image
|
39
|
-
@image = { 'productCodes' => [] }
|
50
|
+
@image = { 'blockDeviceMapping' => [], 'productCodes' => [], 'tagSet' => {} }
|
40
51
|
end
|
52
|
+
when 'key', 'value'
|
53
|
+
@tag[name] = @value
|
41
54
|
when 'productCode'
|
42
55
|
@image['productCodes'] << @value
|
43
56
|
when 'productCodes'
|
44
57
|
@in_product_codes = false
|
45
|
-
when 'blockDeviceMapping'
|
46
|
-
@in_block_device_mapping = false
|
47
58
|
when 'requestId'
|
48
59
|
@response[name] = @value
|
49
|
-
when '
|
50
|
-
|
51
|
-
@image['blockDeviceMapping'][l-1].store(name,@value)
|
60
|
+
when 'volumeSize'
|
61
|
+
@block_device_mapping[name] = @value.to_i
|
52
62
|
end
|
53
63
|
end
|
54
64
|
|
@@ -7,9 +7,10 @@ module Fog
|
|
7
7
|
|
8
8
|
def reset
|
9
9
|
@block_device_mapping = {}
|
10
|
-
@instance = { 'blockDeviceMapping' => [], 'instanceState' => {}, 'monitoring' => {}, 'placement' => {}, 'productCodes' => [] }
|
10
|
+
@instance = { 'blockDeviceMapping' => [], 'instanceState' => {}, 'monitoring' => {}, 'placement' => {}, 'productCodes' => [], 'stateReason' => {}, 'tagSet' => {} }
|
11
11
|
@reservation = { 'groupSet' => [], 'instancesSet' => [] }
|
12
12
|
@response = { 'reservationSet' => [] }
|
13
|
+
@tag = {}
|
13
14
|
end
|
14
15
|
|
15
16
|
def start_element(name, attrs = [])
|
@@ -21,6 +22,12 @@ module Fog
|
|
21
22
|
@in_subset = true
|
22
23
|
when 'instancesSet'
|
23
24
|
@in_instances_set = true
|
25
|
+
when 'instanceState'
|
26
|
+
@in_instance_state = true
|
27
|
+
when 'stateReason'
|
28
|
+
@in_state_reason = true
|
29
|
+
when 'tagSet'
|
30
|
+
@in_tag_set = true
|
24
31
|
end
|
25
32
|
end
|
26
33
|
|
@@ -30,17 +37,21 @@ module Fog
|
|
30
37
|
@instance[name] = @value.to_i
|
31
38
|
when 'availabilityZone'
|
32
39
|
@instance['placement'][name] = @value
|
33
|
-
when 'architecture', '
|
34
|
-
'
|
35
|
-
'
|
36
|
-
'rootDeviceType'
|
40
|
+
when 'architecture', 'clientToken', 'dnsName', 'imageId',
|
41
|
+
'instanceId', 'instanceType', 'ipAddress', 'kernelId',
|
42
|
+
'keyName', 'privateDnsName', 'privateIpAddress', 'ramdiskId',
|
43
|
+
'reason', 'rootDeviceType'
|
37
44
|
@instance[name] = @value
|
38
45
|
when 'attachTime'
|
39
46
|
@block_device_mapping[name] = Time.parse(@value)
|
40
47
|
when 'blockDeviceMapping'
|
41
48
|
@in_block_device_mapping = false
|
42
49
|
when 'code'
|
43
|
-
|
50
|
+
if @in_instance_state
|
51
|
+
@instance['instanceState'][name] = @value.to_i
|
52
|
+
elsif @in_state_reason
|
53
|
+
@instance['stateReason'][name] = @value.to_i
|
54
|
+
end
|
44
55
|
when 'deleteOnTermination'
|
45
56
|
if @value == 'true'
|
46
57
|
@block_device_mapping[name] = true
|
@@ -55,21 +66,32 @@ module Fog
|
|
55
66
|
@in_subset = false
|
56
67
|
when 'instancesSet'
|
57
68
|
@in_instances_set = false
|
69
|
+
when 'instanceState'
|
70
|
+
@in_instance_state = false
|
58
71
|
when 'item'
|
59
72
|
if @in_block_device_mapping
|
60
73
|
@instance['blockDeviceMapping'] << @block_device_mapping
|
61
74
|
@block_device_mapping = {}
|
75
|
+
elsif @in_tag_set
|
76
|
+
@instance['tagSet'][@tag['key']] = @tag['value']
|
77
|
+
@tag = {}
|
62
78
|
elsif @in_instances_set
|
63
79
|
@reservation['instancesSet'] << @instance
|
64
|
-
@instance = { 'blockDeviceMapping' => [], 'instanceState' => {}, 'monitoring' => {}, 'placement' => {}, 'productCodes' => [] }
|
80
|
+
@instance = { 'blockDeviceMapping' => [], 'instanceState' => {}, 'monitoring' => {}, 'placement' => {}, 'productCodes' => [], 'stateReason' => {}, 'tagSet' => {} }
|
65
81
|
elsif !@in_subset
|
66
82
|
@response['reservationSet'] << @reservation
|
67
83
|
@reservation = { 'groupSet' => [], 'instancesSet' => [] }
|
68
84
|
end
|
85
|
+
when 'key', 'value'
|
86
|
+
@tag[name] = @value
|
69
87
|
when 'launchTime'
|
70
88
|
@instance[name] = Time.parse(@value)
|
71
89
|
when 'name'
|
72
|
-
|
90
|
+
if @in_instance_state
|
91
|
+
@instance['instanceState'][name] = @value
|
92
|
+
elsif @in_state_reason
|
93
|
+
@instance['stateReason'][name] = @value
|
94
|
+
end
|
73
95
|
when 'ownerId', 'reservationId'
|
74
96
|
@reservation[name] = @value
|
75
97
|
when 'requestId'
|
@@ -82,6 +104,10 @@ module Fog
|
|
82
104
|
else
|
83
105
|
@instance['monitoring'][name] = false
|
84
106
|
end
|
107
|
+
when 'stateReason'
|
108
|
+
@in_state_reason = false
|
109
|
+
when 'tagSet'
|
110
|
+
@in_tag_set = false
|
85
111
|
end
|
86
112
|
end
|
87
113
|
|
@@ -15,11 +15,12 @@ module Fog
|
|
15
15
|
|
16
16
|
def start_element(name, attrs = [])
|
17
17
|
super
|
18
|
-
|
18
|
+
case name
|
19
|
+
when 'groups'
|
19
20
|
@in_groups = true
|
20
|
-
|
21
|
+
when 'ipPermissions'
|
21
22
|
@in_ip_permissions = true
|
22
|
-
|
23
|
+
when 'ipRanges'
|
23
24
|
@in_ip_ranges = true
|
24
25
|
end
|
25
26
|
end
|
@@ -7,22 +7,42 @@ module Fog
|
|
7
7
|
|
8
8
|
def reset
|
9
9
|
@response = { 'snapshotSet' => [] }
|
10
|
-
@snapshot = {}
|
10
|
+
@snapshot = { 'tagSet' => {} }
|
11
|
+
@tag = {}
|
12
|
+
end
|
13
|
+
|
14
|
+
def start_element(name, attrs = [])
|
15
|
+
super
|
16
|
+
if name == 'tagSet'
|
17
|
+
@in_tag_set = true
|
18
|
+
end
|
11
19
|
end
|
12
20
|
|
13
21
|
def end_element(name)
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
22
|
+
if @in_tag_set
|
23
|
+
case name
|
24
|
+
when 'item'
|
25
|
+
@snapshot['tagSet'][@tag['key']] = @tag['value']
|
26
|
+
@tag = {}
|
27
|
+
when 'key', 'value'
|
28
|
+
@tag[key] = value
|
29
|
+
when 'tagSet'
|
30
|
+
@in_tag_set = false
|
31
|
+
end
|
32
|
+
else
|
33
|
+
case name
|
34
|
+
when 'item'
|
35
|
+
@response['snapshotSet'] << @snapshot
|
36
|
+
@snapshot = { 'tagSet' => {} }
|
37
|
+
when 'description', 'ownerId', 'progress', 'snapshotId', 'status', 'volumeId'
|
38
|
+
@snapshot[name] ||= @value
|
39
|
+
when 'requestId'
|
40
|
+
@response[name] = @value
|
41
|
+
when 'startTime'
|
42
|
+
@snapshot[name] = Time.parse(@value)
|
43
|
+
when 'volumeSize'
|
44
|
+
@snapshot[name] = @value.to_i
|
45
|
+
end
|
26
46
|
end
|
27
47
|
end
|
28
48
|
|