right_aws 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +22 -1
- data/Manifest.txt +11 -1
- data/README.txt +0 -4
- data/Rakefile +19 -25
- data/lib/acf/right_acf_interface.rb +199 -135
- data/lib/acf/right_acf_invalidations.rb +144 -0
- data/lib/acf/right_acf_origin_access_identities.rb +4 -4
- data/lib/acf/right_acf_streaming_interface.rb +19 -26
- data/lib/acw/right_acw_interface.rb +1 -2
- data/lib/as/right_as_interface.rb +6 -7
- data/lib/awsbase/right_awsbase.rb +287 -91
- data/lib/awsbase/support.rb +2 -82
- data/lib/awsbase/version.rb +9 -0
- data/lib/ec2/right_ec2.rb +101 -38
- data/lib/ec2/right_ec2_ebs.rb +71 -58
- data/lib/ec2/right_ec2_images.rb +82 -42
- data/lib/ec2/right_ec2_instances.rb +74 -44
- data/lib/ec2/right_ec2_placement_groups.rb +108 -0
- data/lib/ec2/right_ec2_reserved_instances.rb +50 -46
- data/lib/ec2/right_ec2_security_groups.rb +148 -32
- data/lib/ec2/right_ec2_spot_instances.rb +53 -27
- data/lib/ec2/right_ec2_tags.rb +139 -0
- data/lib/ec2/right_ec2_vpc.rb +151 -139
- data/lib/ec2/right_ec2_windows_mobility.rb +84 -0
- data/lib/elb/right_elb_interface.rb +93 -18
- data/lib/iam/right_iam_access_keys.rb +71 -0
- data/lib/iam/right_iam_groups.rb +195 -0
- data/lib/iam/right_iam_interface.rb +341 -0
- data/lib/iam/right_iam_mfa_devices.rb +67 -0
- data/lib/iam/right_iam_users.rb +251 -0
- data/lib/rds/right_rds_interface.rb +513 -202
- data/lib/right_aws.rb +12 -12
- data/lib/route_53/right_route_53_interface.rb +630 -0
- data/lib/s3/right_s3.rb +9 -12
- data/lib/s3/right_s3_interface.rb +10 -11
- data/lib/sdb/active_sdb.rb +18 -33
- data/lib/sdb/right_sdb_interface.rb +36 -4
- data/lib/sqs/right_sqs.rb +1 -2
- data/lib/sqs/right_sqs_gen2.rb +0 -1
- data/lib/sqs/right_sqs_gen2_interface.rb +4 -5
- data/lib/sqs/right_sqs_interface.rb +6 -7
- data/right_aws.gemspec +91 -0
- data/test/awsbase/test_helper.rb +2 -0
- data/test/awsbase/test_right_awsbase.rb +12 -0
- data/test/s3/test_right_s3.rb +1 -1
- data/test/sdb/test_active_sdb.rb +1 -1
- data/test/sdb/test_batch_put_attributes.rb +54 -0
- data/test/sqs/test_right_sqs.rb +0 -6
- data/test/sqs/test_right_sqs_gen2.rb +1 -1
- metadata +109 -58
@@ -0,0 +1,139 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (c) 2007-2010 RightScale Inc
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
# a copy of this software and associated documentation files (the
|
6
|
+
# "Software"), to deal in the Software without restriction, including
|
7
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
# the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be
|
13
|
+
# included in all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
#
|
23
|
+
|
24
|
+
module RightAws
|
25
|
+
class Ec2
|
26
|
+
|
27
|
+
#-----------------------------------------------------------------
|
28
|
+
# Tags
|
29
|
+
#-----------------------------------------------------------------
|
30
|
+
|
31
|
+
# Describe tags.
|
32
|
+
#
|
33
|
+
# Accepts set of filters.
|
34
|
+
#
|
35
|
+
# Filters: key, resource-id, resource-type, value
|
36
|
+
#
|
37
|
+
# ec2.describe_tags #=> [{:resource_id => "i-12345678",
|
38
|
+
# :value => "foo",
|
39
|
+
# :resource_type => "instance",
|
40
|
+
# :key => "myKey"}]
|
41
|
+
#
|
42
|
+
# ec2.describe_tags(:filters => { 'resource-id' => "i-12345678"})
|
43
|
+
#
|
44
|
+
# P.S. filters: http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference_query_DescribeTags.html
|
45
|
+
def describe_tags(options={})
|
46
|
+
request_hash = {}
|
47
|
+
request_hash.merge!(amazonize_list(['Filter.?.Name', 'Filter.?.Value.?'], options[:filters])) unless options[:filters].right_blank?
|
48
|
+
cache_for = (options[:filters].right_blank?) ? :describe_tags : nil
|
49
|
+
link = generate_request("DescribeTags", request_hash)
|
50
|
+
request_cache_or_info cache_for, link, QEc2DescribeTagsParser, @@bench, cache_for
|
51
|
+
rescue Exception
|
52
|
+
on_exception
|
53
|
+
end
|
54
|
+
|
55
|
+
# Create tags.
|
56
|
+
# Options:
|
57
|
+
# :default => 'something' : a default value for keys without (or with nil) values.
|
58
|
+
#
|
59
|
+
# Add a single tag with no value to a resource:
|
60
|
+
# ec2.create_tags("i-12345678", "myKey") => true
|
61
|
+
#
|
62
|
+
# Add multiple tags with no values (actually Amazon sets the values to '')
|
63
|
+
# ec2.create_tags("i-12345678", ["myKey1", "myKey2", "myKey3"]) => true
|
64
|
+
#
|
65
|
+
# Add multiple tags with 'true'
|
66
|
+
# ec2.create_tags("i-12345678", ["myKey1", "myKey2", "myKey3"], :default => true ) => true
|
67
|
+
#
|
68
|
+
# Add multiple keys and values to a resource:
|
69
|
+
# ec2.create_tags("i-12345678", {"myKey1" => "foo", "myKey2" => "bar", "myKeyWithoutVal" => nil }) #=> true
|
70
|
+
#
|
71
|
+
# Add a key and value to multiple resources:
|
72
|
+
# ec2.create_tags(["i-12345678","i-86fb3eec","i-86fb3eed"], {"myKey" => "foo"}) #=> true
|
73
|
+
#
|
74
|
+
def create_tags(resources, tags, options={})
|
75
|
+
default = options[:default].nil? ? '' : options[:default]
|
76
|
+
params = amazonize_list("ResourceId", resources)
|
77
|
+
params.merge! amazonize_list(['Tag.?.Key', 'Tag.?.Value'], tags, :default => default)
|
78
|
+
link = generate_request("CreateTags", params)
|
79
|
+
request_info(link, RightBoolResponseParser.new(:logger => @logger))
|
80
|
+
rescue Exception
|
81
|
+
on_exception
|
82
|
+
end
|
83
|
+
|
84
|
+
# Delete tags.
|
85
|
+
# Options:
|
86
|
+
# :default => 'something' : a default value for keys without (or with nil) values.
|
87
|
+
#
|
88
|
+
# Delete a tag from a resource regardless of value:
|
89
|
+
# ec2.delete_tags("i-12345678", "myKey") => true
|
90
|
+
#
|
91
|
+
# Delete multiple tags (regardless of their values)
|
92
|
+
# ec2.delete_tags("i-12345678", ["myKey1", "myKey2", "myKey3"]) => true
|
93
|
+
#
|
94
|
+
# Add multiple tags with value 'true'
|
95
|
+
# ec2.delete_tags("i-12345678", ["myKey1", "myKey2", "myKey3"], :default => true) => true
|
96
|
+
#
|
97
|
+
# Delete multiple keys and values to a resource:
|
98
|
+
# ec2.delete_tags("i-12345678", [{"myKey1" => "foo", "myKey2" => "bar","myKeyForAnyVal" => nil }]) #=> true
|
99
|
+
#
|
100
|
+
# Delete a key and value on multiple resources:
|
101
|
+
# ec2.delete_tags(["i-12345678", "i-a1234567", "i-b1234567"], {"myKey" => "foo"}) #=> true
|
102
|
+
#
|
103
|
+
def delete_tags(resources, tags, options={})
|
104
|
+
default = options[:default].nil? ? :skip_nils : options[:default]
|
105
|
+
params = amazonize_list("ResourceId", resources)
|
106
|
+
params.merge! amazonize_list(['Tag.?.Key', 'Tag.?.Value'], tags, :default => default)
|
107
|
+
link = generate_request("DeleteTags", params)
|
108
|
+
request_info(link, RightBoolResponseParser.new(:logger => @logger))
|
109
|
+
rescue Exception
|
110
|
+
on_exception
|
111
|
+
end
|
112
|
+
|
113
|
+
#-----------------------------------------------------------------
|
114
|
+
# PARSERS: Tags
|
115
|
+
#-----------------------------------------------------------------
|
116
|
+
|
117
|
+
class QEc2DescribeTagsParser < RightAWSParser #:nodoc:
|
118
|
+
def tagstart(name, attributes)
|
119
|
+
@resource_tag = {} if name == 'item'
|
120
|
+
end
|
121
|
+
|
122
|
+
def tagend(name)
|
123
|
+
case name
|
124
|
+
when 'resourceId' then @resource_tag[:resource_id] = @text
|
125
|
+
when 'resourceType' then @resource_tag[:resource_type] = @text
|
126
|
+
when 'key' then @resource_tag[:key] = @text
|
127
|
+
when 'value' then @resource_tag[:value] = @text
|
128
|
+
when 'item' then @result << @resource_tag
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
def reset
|
133
|
+
@result = []
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
end
|
138
|
+
|
139
|
+
end
|
data/lib/ec2/right_ec2_vpc.rb
CHANGED
@@ -25,23 +25,17 @@ module RightAws
|
|
25
25
|
|
26
26
|
class Ec2
|
27
27
|
|
28
|
-
private
|
29
|
-
|
30
|
-
def vpc__split_list_and_filters(*params) # :nodoc:
|
31
|
-
params = params.flatten
|
32
|
-
filters = params.last.is_a?(Hash) ? params.pop : {}
|
33
|
-
# Make values to be arrays.
|
34
|
-
filters.each{|key, values| filters[key] = Array(values) }
|
35
|
-
[params, filters]
|
36
|
-
end
|
37
|
-
|
38
28
|
public
|
39
29
|
|
40
30
|
#-----------------
|
41
31
|
# VPC
|
42
32
|
#-----------------
|
43
33
|
|
44
|
-
# Describe VPCs
|
34
|
+
# Describe VPCs.
|
35
|
+
#
|
36
|
+
# Accepts a list of vpcs and/or a set of filters as the last parameter.
|
37
|
+
#
|
38
|
+
# Filters: cidr, dchp-options-id, state, tag-key, tag-value, tag:key, vpc-id
|
45
39
|
#
|
46
40
|
# ec2.describe_vpcs #=>
|
47
41
|
# [{:vpc_id=>"vpc-890ce2e0",
|
@@ -51,16 +45,14 @@ module RightAws
|
|
51
45
|
#
|
52
46
|
# ec2.describe_vpcs("vpc-890ce2e0")
|
53
47
|
#
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
rescue Exception
|
63
|
-
on_exception
|
48
|
+
# ec2.describe_vpcs( :filters => {'tag:MyTag' => 'MyValue'} )
|
49
|
+
#
|
50
|
+
# ec2.describe_vpcs( :filters => {'cidr' => "192.168.1.0/24"} )
|
51
|
+
#
|
52
|
+
# P.S. filters: http://docs.amazonwebservices.com/AmazonVPC/latest/APIReference/index.html?ApiReference-query-DescribeVpcs.html
|
53
|
+
#
|
54
|
+
def describe_vpcs(*list_and_options)
|
55
|
+
describe_resources_with_list_and_options('DescribeVpcs', 'VpcId', QEc2DescribeVpcsParser, list_and_options)
|
64
56
|
end
|
65
57
|
|
66
58
|
# Create VPC.
|
@@ -95,6 +87,10 @@ module RightAws
|
|
95
87
|
|
96
88
|
# Describe Subnet.
|
97
89
|
#
|
90
|
+
# Accepts a list of subnets and/or a set of filters as the last parameter.
|
91
|
+
#
|
92
|
+
# Filters: availability-zone, available-ip-address-count, cidr, state, subnet-id, tag-key, tag-value, tag:key, vpc-id
|
93
|
+
#
|
98
94
|
# ec2.describe_subnets #=>
|
99
95
|
# [{:available_ip_address_count=>"251",
|
100
96
|
# :vpc_id=>"vpc-890ce2e0",
|
@@ -103,16 +99,12 @@ module RightAws
|
|
103
99
|
# :cidr_block=>"10.0.1.0/24",
|
104
100
|
# :state=>"available"}]
|
105
101
|
#
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
link = generate_request("DescribeSubnets", request_hash)
|
113
|
-
request_cache_or_info cache_for, link, QEc2DescribeSubnetsParser, @@bench, cache_for
|
114
|
-
rescue Exception
|
115
|
-
on_exception
|
102
|
+
# ec2.describe_subnets(:filters => {'cidr' => "192.168.1.128/25"})
|
103
|
+
#
|
104
|
+
# P.S. filters: http://docs.amazonwebservices.com/AmazonVPC/latest/APIReference/index.html?ApiReference-query-DescribeSubnets.html
|
105
|
+
#
|
106
|
+
def describe_subnets(*list_and_options)
|
107
|
+
describe_resources_with_list_and_options('DescribeSubnets', 'SubnetId', QEc2DescribeSubnetsParser, list_and_options)
|
116
108
|
end
|
117
109
|
|
118
110
|
# Create Subnet.
|
@@ -128,7 +120,7 @@ module RightAws
|
|
128
120
|
def create_subnet(vpc_id, cidr_block, availability_zone = nil)
|
129
121
|
request_hash = { 'VpcId' => vpc_id,
|
130
122
|
'CidrBlock' => cidr_block }
|
131
|
-
request_hash['AvailabilityZone'] = availability_zone unless availability_zone.
|
123
|
+
request_hash['AvailabilityZone'] = availability_zone unless availability_zone.right_blank?
|
132
124
|
link = generate_request("CreateSubnet", request_hash)
|
133
125
|
request_info(link, QEc2DescribeSubnetsParser.new(:logger => @logger)).first
|
134
126
|
rescue Exception
|
@@ -151,20 +143,22 @@ module RightAws
|
|
151
143
|
#-----------------
|
152
144
|
|
153
145
|
# Describe DHCP options.
|
146
|
+
#
|
147
|
+
# Accepts a list of DHCP options and/or a set of filters as the last parameter.
|
148
|
+
#
|
149
|
+
# Filters: dchp-options-id, key, value, tag-key, tag-value, tag:key
|
154
150
|
#
|
155
|
-
#
|
151
|
+
# ec2.describe_dhcp_options #=>
|
156
152
|
# [{:dhcp_options_id=>"dopt-cb0de3a2",
|
157
153
|
# :dhcp_configuration_set=>
|
158
154
|
# {"netbios-node-type"=>["1"], "domain-name"=>["my.awesomesite.ru"]}}]
|
159
155
|
#
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
rescue Exception
|
167
|
-
on_exception
|
156
|
+
# ec2.describe_dhcp_options(:filters => {'tag:MyTag' => 'MyValue'})
|
157
|
+
#
|
158
|
+
# P.S. filters: http://docs.amazonwebservices.com/AmazonVPC/latest/APIReference/index.html?ApiReference-query-DescribeDhcpOptions.html
|
159
|
+
#
|
160
|
+
def describe_dhcp_options(*list_and_options)
|
161
|
+
describe_resources_with_list_and_options('DescribeDhcpOptions', 'DhcpOptionsId', QEc2DescribeDhcpOptionsParser, list_and_options)
|
168
162
|
end
|
169
163
|
|
170
164
|
# Create DHCP options.
|
@@ -218,24 +212,23 @@ module RightAws
|
|
218
212
|
|
219
213
|
# Describe customer gateways.
|
220
214
|
#
|
221
|
-
#
|
215
|
+
# Accepts a list of gateways and/or a set of filters as the last parameter.
|
222
216
|
#
|
217
|
+
# Filters: bgp-asn, customer-gateway-id, state, type, tag-key, tag-value, tag:key
|
218
|
+
#
|
219
|
+
# ec2.describe_customer_gateways #=>
|
223
220
|
# [{:type=>"ipsec.1",
|
224
221
|
# :ip_address=>"12.1.2.3",
|
225
222
|
# :bgp_asn=>"65534",
|
226
223
|
# :state=>"available",
|
227
224
|
# :customer_gateway_id=>"cgw-d5a643bc"}]
|
228
225
|
#
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
link = generate_request("DescribeCustomerGateways", request_hash)
|
236
|
-
request_cache_or_info cache_for, link, QEc2DescribeCustomerGatewaysParser, @@bench, cache_for
|
237
|
-
rescue Exception
|
238
|
-
on_exception
|
226
|
+
# ec2.describe_customer_gateways(:filters => {'tag:MyTag' => 'MyValue'})
|
227
|
+
#
|
228
|
+
# P.S. filters: http://docs.amazonwebservices.com/AmazonVPC/latest/APIReference/index.html?ApiReference-query-DescribeCustomerGateways.html
|
229
|
+
#
|
230
|
+
def describe_customer_gateways(*list_and_options)
|
231
|
+
describe_resources_with_list_and_options('DescribeCustomerGateways', 'CustomerGatewayId', QEc2DescribeCustomerGatewaysParser, list_and_options)
|
239
232
|
end
|
240
233
|
|
241
234
|
# Create customer gateway.
|
@@ -273,22 +266,22 @@ module RightAws
|
|
273
266
|
|
274
267
|
# Describe VPN gateways.
|
275
268
|
#
|
269
|
+
# Accepts a list of VPN gateways and/or a set of filters as the last parameter.
|
270
|
+
#
|
271
|
+
# Filters: attachment.state, attachment.vpc-id, availability-zone, state, tag-key, tag-value, tag:key, type, vpn-gateway-id
|
272
|
+
#
|
276
273
|
# ec2.describe_vpn_gateways #=>
|
277
274
|
# [{:type=>"ipsec.1",
|
278
275
|
# :availability_zone=>"us-east-1a",
|
279
276
|
# :attachments=>[{:vpc_id=>"vpc-890ce2e0", :state=>"attached"}],
|
280
277
|
# :vpn_gateway_id=>"vgw-dfa144b6"}]
|
281
278
|
#
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
link = generate_request("DescribeVpnGateways", request_hash)
|
289
|
-
request_cache_or_info cache_for, link, QEc2DescribeVpnGatewaysParser, @@bench, cache_for
|
290
|
-
rescue Exception
|
291
|
-
on_exception
|
279
|
+
# ec2.describe_vpn_gateways(:filters => {'tag:MyTag' => 'MyValue'})
|
280
|
+
#
|
281
|
+
# P.S. filters: http://docs.amazonwebservices.com/AmazonVPC/latest/APIReference/index.html?ApiReference-query-DescribeVpnGateways.html
|
282
|
+
#
|
283
|
+
def describe_vpn_gateways(*list_and_options)
|
284
|
+
describe_resources_with_list_and_options('DescribeVpnGateways', 'VpnGatewayId', QEc2DescribeVpnGatewaysParser, list_and_options)
|
292
285
|
end
|
293
286
|
|
294
287
|
# Create VPN gateway.
|
@@ -301,7 +294,7 @@ module RightAws
|
|
301
294
|
#
|
302
295
|
def create_vpn_gateway(type, availability_zone=nil)
|
303
296
|
request_hash = { 'Type' => type }
|
304
|
-
request_hash['AvailabilityZone'] = availability_zone unless availability_zone.
|
297
|
+
request_hash['AvailabilityZone'] = availability_zone unless availability_zone.right_blank?
|
305
298
|
link = generate_request("CreateVpnGateway", request_hash )
|
306
299
|
request_info(link, QEc2DescribeVpnGatewaysParser.new(:logger => @logger)).first
|
307
300
|
rescue Exception
|
@@ -350,6 +343,11 @@ module RightAws
|
|
350
343
|
|
351
344
|
# Describe VPN connections.
|
352
345
|
#
|
346
|
+
# Accepts a list of VPN gateways and/or a set of filters as the last parameter.
|
347
|
+
#
|
348
|
+
# Filters: customer-gateway-configuration, customer-gateway-id, state, tag-key, tag-value, tag:key,
|
349
|
+
# type, vpn-connection-id, vpn-gateway-id
|
350
|
+
#
|
353
351
|
# ec2.describe_vpn_connections #=>
|
354
352
|
# [{:type=>"ipsec.1",
|
355
353
|
# :vpn_connection_id=>"vpn-a9a643c0",
|
@@ -359,16 +357,12 @@ module RightAws
|
|
359
357
|
# :vpn_gateway_id=>"vgw-dfa144b6",
|
360
358
|
# :customer_gateway_id=>"cgw-81a643e8"}]
|
361
359
|
#
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
link = generate_request("DescribeVpnConnections", request_hash)
|
369
|
-
request_cache_or_info cache_for, link, QEc2DescribeVpnConnectionsParser, @@bench, cache_for
|
370
|
-
rescue Exception
|
371
|
-
on_exception
|
360
|
+
# ec2.describe_vpn_gateways(:filters => {'tag:MyTag' => 'MyValue'})
|
361
|
+
#
|
362
|
+
# P.S. filters: http://docs.amazonwebservices.com/AmazonVPC/latest/APIReference/index.html?ApiReference-query-DescribeVpnConnections.html
|
363
|
+
#
|
364
|
+
def describe_vpn_connections(*list_and_options)
|
365
|
+
describe_resources_with_list_and_options('DescribeVpnConnections', 'VpnConnectionId', QEc2DescribeVpnConnectionsParser, list_and_options)
|
372
366
|
end
|
373
367
|
|
374
368
|
# Create VPN connection.
|
@@ -407,17 +401,24 @@ module RightAws
|
|
407
401
|
|
408
402
|
class QEc2DescribeVpcsParser < RightAWSParser #:nodoc:
|
409
403
|
def tagstart(name, attributes)
|
410
|
-
case
|
411
|
-
when
|
404
|
+
case full_tag_name
|
405
|
+
when %r{/(vpcSet/item|vpc)$} then @item = { :tags => {} }
|
406
|
+
when %r{/tagSet/item$} then @aws_tag = {}
|
412
407
|
end
|
413
408
|
end
|
414
409
|
def tagend(name)
|
415
410
|
case name
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
411
|
+
when 'vpcId' then @item[:vpc_id] = @text
|
412
|
+
when 'state' then @item[:state] = @text
|
413
|
+
when 'dhcpOptionsId' then @item[:dhcp_options_id] = @text
|
414
|
+
when 'cidrBlock' then @item[:cidr_block] = @text
|
415
|
+
else
|
416
|
+
case full_tag_name
|
417
|
+
when %r{/tagSet/item/key$} then @aws_tag[:key] = @text
|
418
|
+
when %r{/tagSet/item/value$} then @aws_tag[:value] = @text
|
419
|
+
when %r{/tagSet/item$} then @item[:tags][@aws_tag[:key]] = @aws_tag[:value]
|
420
|
+
when %r{(vpcSet/item|vpc)$} then @result << @item
|
421
|
+
end
|
421
422
|
end
|
422
423
|
end
|
423
424
|
def reset
|
@@ -427,19 +428,26 @@ module RightAws
|
|
427
428
|
|
428
429
|
class QEc2DescribeSubnetsParser < RightAWSParser #:nodoc:
|
429
430
|
def tagstart(name, attributes)
|
430
|
-
case
|
431
|
-
when
|
431
|
+
case full_tag_name
|
432
|
+
when %r{/(subnetSet/item|subnet)$} then @item = { :tags => {} }
|
433
|
+
when %r{/tagSet/item$} then @aws_tag = {}
|
432
434
|
end
|
433
435
|
end
|
434
436
|
def tagend(name)
|
435
437
|
case name
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
438
|
+
when 'subnetId' then @item[:subnet_id] = @text
|
439
|
+
when 'state' then @item[:state] = @text
|
440
|
+
when 'vpcId' then @item[:vpc_id] = @text
|
441
|
+
when 'cidrBlock' then @item[:cidr_block] = @text
|
442
|
+
when 'availabilityZone' then @item[:availability_zone] = @text
|
443
|
+
when 'availableIpAddressCount' then @item[:available_ip_address_count] = @text
|
444
|
+
else
|
445
|
+
case full_tag_name
|
446
|
+
when %r{/tagSet/item/key$} then @aws_tag[:key] = @text
|
447
|
+
when %r{/tagSet/item/value$} then @aws_tag[:value] = @text
|
448
|
+
when %r{/tagSet/item$} then @item[:tags][@aws_tag[:key]] = @aws_tag[:value]
|
449
|
+
when %r{/(subnetSet/item|subnet)$} then @result << @item
|
450
|
+
end
|
443
451
|
end
|
444
452
|
end
|
445
453
|
def reset
|
@@ -450,43 +458,47 @@ module RightAws
|
|
450
458
|
class QEc2DescribeDhcpOptionsParser < RightAWSParser #:nodoc:
|
451
459
|
def tagstart(name, attributes)
|
452
460
|
case full_tag_name
|
453
|
-
when @
|
454
|
-
|
461
|
+
when %r{/(dhcpOptionsSet/item|dhcpOptions)$} then @item = { :tags => {}, :dhcp_configuration_set => {} }
|
462
|
+
when %r{/tagSet/item$} then @aws_tag = {}
|
455
463
|
end
|
456
464
|
end
|
457
465
|
def tagend(name)
|
458
|
-
case name
|
459
|
-
when 'dhcpOptionsId' then @item[:dhcp_options_id] = @text
|
460
|
-
when 'key' then @conf_item_key = @text
|
461
|
-
when 'value' then (@item[:dhcp_configuration_set][@conf_item_key] ||= []) << @text
|
462
|
-
end
|
463
466
|
case full_tag_name
|
464
|
-
when @
|
465
|
-
|
467
|
+
when %r{/tagSet/item/key$} then @aws_tag[:key] = @text
|
468
|
+
when %r{/tagSet/item/value$} then @aws_tag[:value] = @text
|
469
|
+
when %r{/tagSet/item$} then @item[:tags][@aws_tag[:key]] = @aws_tag[:value]
|
470
|
+
when %r{/dhcpOptionsId$} then @item[:dhcp_options_id] = @text
|
471
|
+
when %r{/dhcpConfigurationSet/item/key$} then @conf_item_key = @text
|
472
|
+
when %r{/dhcpConfigurationSet/item/valueSet/item/value$} then (@item[:dhcp_configuration_set][@conf_item_key] ||= []) << @text
|
473
|
+
when %r{/(dhcpOptionsSet/item|dhcpOptions)$} then @result << @item
|
466
474
|
end
|
467
475
|
end
|
468
476
|
def reset
|
469
|
-
@p1 = 'DescribeDhcpOptionsResponse/dhcpOptionsSet/item'
|
470
|
-
@p2 = 'CreateDhcpOptionsResponse/dhcpOptions'
|
471
477
|
@result = []
|
472
478
|
end
|
473
479
|
end
|
474
480
|
|
475
481
|
class QEc2DescribeCustomerGatewaysParser < RightAWSParser #:nodoc:
|
476
482
|
def tagstart(name, attributes)
|
477
|
-
case
|
478
|
-
when
|
479
|
-
|
483
|
+
case full_tag_name
|
484
|
+
when %r{/(customerGatewaySet/item|customerGateway)$} then @item = { :tags => {} }
|
485
|
+
when %r{/tagSet/item$} then @aws_tag = {}
|
480
486
|
end
|
481
487
|
end
|
482
488
|
def tagend(name)
|
483
489
|
case name
|
484
490
|
when 'customerGatewayId' then @item[:customer_gateway_id] = @text
|
485
|
-
when 'state' then @item[:state]
|
486
|
-
when 'type' then @item[:type]
|
487
|
-
when 'ipAddress' then @item[:ip_address]
|
488
|
-
when 'bgpAsn' then @item[:bgp_asn]
|
489
|
-
|
491
|
+
when 'state' then @item[:state] = @text
|
492
|
+
when 'type' then @item[:type] = @text
|
493
|
+
when 'ipAddress' then @item[:ip_address] = @text
|
494
|
+
when 'bgpAsn' then @item[:bgp_asn] = @text
|
495
|
+
else
|
496
|
+
case full_tag_name
|
497
|
+
when %r{/tagSet/item/key$} then @aws_tag[:key] = @text
|
498
|
+
when %r{/tagSet/item/value$} then @aws_tag[:value] = @text
|
499
|
+
when %r{/tagSet/item$} then @item[:tags][@aws_tag[:key]] = @aws_tag[:value]
|
500
|
+
when %r{/(customerGatewaySet/item|customerGateway)$} then @result << @item
|
501
|
+
end
|
490
502
|
end
|
491
503
|
end
|
492
504
|
def reset
|
@@ -497,37 +509,30 @@ module RightAws
|
|
497
509
|
class QEc2DescribeVpnGatewaysParser < RightAWSParser #:nodoc:
|
498
510
|
def tagstart(name, attributes)
|
499
511
|
case full_tag_name
|
500
|
-
when @
|
501
|
-
|
502
|
-
when
|
503
|
-
"#{@p2}/attachments/item"
|
504
|
-
@attachment = {}
|
512
|
+
when %r{/(vpnGatewaySet/item|vpnGateway)$} then @item = { :tags => {}, :attachments => [] }
|
513
|
+
when %r{/attachments/item$} then @attachment = {}
|
514
|
+
when %r{/tagSet/item$} then @aws_tag = {}
|
505
515
|
end
|
506
516
|
end
|
507
517
|
def tagend(name)
|
508
518
|
case name
|
509
|
-
when 'vpnGatewayId' then @item[:vpn_gateway_id]
|
519
|
+
when 'vpnGatewayId' then @item[:vpn_gateway_id] = @text
|
510
520
|
when 'availabilityZone' then @item[:availability_zone] = @text
|
511
|
-
when 'type' then @item[:type]
|
512
|
-
when 'vpcId' then @attachment[:vpc_id]
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
@item[:
|
518
|
-
|
519
|
-
|
520
|
-
@
|
521
|
-
|
522
|
-
|
523
|
-
@item[:attachments] << @attachment unless @attachment.blank?
|
524
|
-
when @p1, @p2
|
525
|
-
@result << @item
|
521
|
+
when 'type' then @item[:type] = @text
|
522
|
+
when 'vpcId' then @attachment[:vpc_id] = @text
|
523
|
+
else
|
524
|
+
case full_tag_name
|
525
|
+
when %r{/vpnGatewaySet/item/state$} then @item[:state] = @text
|
526
|
+
when %r{/attachments/item/state$} then @attachment[:state] = @text
|
527
|
+
when %r{/attachments/item$} then @item[:attachments] << @attachment unless @attachment.right_blank?
|
528
|
+
when %r{/tagSet/item/key$} then @aws_tag[:key] = @text
|
529
|
+
when %r{/tagSet/item/value$} then @aws_tag[:value] = @text
|
530
|
+
when %r{/tagSet/item$} then @item[:tags][@aws_tag[:key]] = @aws_tag[:value]
|
531
|
+
when %r{/(vpnGatewaySet/item|vpnGateway)$} then @result << @item
|
532
|
+
end
|
526
533
|
end
|
527
534
|
end
|
528
535
|
def reset
|
529
|
-
@p1 = 'DescribeVpnGatewaysResponse/vpnGatewaySet/item'
|
530
|
-
@p2 = 'CreateVpnGatewayResponse/vpnGateway'
|
531
536
|
@result = []
|
532
537
|
end
|
533
538
|
end
|
@@ -547,19 +552,26 @@ module RightAws
|
|
547
552
|
|
548
553
|
class QEc2DescribeVpnConnectionsParser < RightAWSParser #:nodoc:
|
549
554
|
def tagstart(name, attributes)
|
550
|
-
case
|
551
|
-
when
|
555
|
+
case full_tag_name
|
556
|
+
when %r{/(vpnConnectionSet/item|vpnConnection)$} then @item = { :tags => {} }
|
557
|
+
when %r{/tagSet/item$} then @aws_tag = {}
|
552
558
|
end
|
553
559
|
end
|
554
560
|
def tagend(name)
|
555
561
|
case name
|
556
|
-
when 'vpnConnectionId'
|
557
|
-
when 'state'
|
558
|
-
when 'type'
|
559
|
-
when 'vpnGatewayId'
|
560
|
-
when 'customerGatewayId'
|
562
|
+
when 'vpnConnectionId' then @item[:vpn_connection_id] = @text
|
563
|
+
when 'state' then @item[:state] = @text
|
564
|
+
when 'type' then @item[:type] = @text
|
565
|
+
when 'vpnGatewayId' then @item[:vpn_gateway_id] = @text
|
566
|
+
when 'customerGatewayId' then @item[:customer_gateway_id] = @text
|
561
567
|
when 'customerGatewayConfiguration' then @item[:customer_gateway_configuration] = @text
|
562
|
-
|
568
|
+
else
|
569
|
+
case full_tag_name
|
570
|
+
when %r{/tagSet/item/key$} then @aws_tag[:key] = @text
|
571
|
+
when %r{/tagSet/item/value$} then @aws_tag[:value] = @text
|
572
|
+
when %r{/tagSet/item$} then @item[:tags][@aws_tag[:key]] = @aws_tag[:value]
|
573
|
+
when %r{/(vpnConnectionSet/item|vpnConnection)$} then @result << @item
|
574
|
+
end
|
563
575
|
end
|
564
576
|
end
|
565
577
|
def reset
|