right_aws 3.0.5 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -340,7 +340,6 @@ the source key.
340
340
  - S3 Content-Type not set in Ruby 1.9.2
341
341
  - error in rds_interface describe_db_snapshots in Ruby 1.9.2
342
342
 
343
-
344
343
  === 3.0.4
345
344
  Release Notes:
346
345
  - Fixed:
@@ -356,3 +355,18 @@ the source key.
356
355
  - Support for "ami_version" added in emr interface (https://github.com/rightscale/right_aws/pull/129)
357
356
  - S3: Added block references to several methods (https://github.com/rightscale/right_aws/pull/130)
358
357
  - Some other minor changes
358
+
359
+ === 3.1.0
360
+ Release Notes:
361
+ - Added:
362
+ - EC2:
363
+ - hs1.8xlarge, cr1.8xlarge instance types
364
+ - API version '2012-10-01' support for ReservedInstances and ReservedInstancesOfferings
365
+ - API version '2012-10-15' for some of VPC calls (including new DescribeAccountAttributes)
366
+ - Removed: UUID dependency
367
+ - Fixed:
368
+ - EC2:
369
+ - describe_reserved_instances_offerings was fixed to support pagination
370
+ - typo in create_vpc
371
+ - RDS: instances types list
372
+ - Some other minor bugs
data/README.txt CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  Published by RightScale, Inc. under the MIT License.
4
4
  For information about RightScale, see http://www.rightscale.com
5
+ Maintained by the RightScale “Orange_team”
6
+
7
+ Maintained by the RightScale "Orange_team"
5
8
 
6
9
  == DESCRIPTION:
7
10
 
@@ -141,7 +144,7 @@ sudo gem install right_aws
141
144
 
142
145
  == LICENSE:
143
146
 
144
- Copyright (c) 2007-2009 RightScale, Inc.
147
+ Copyright (c) 2007-2013 RightScale, Inc.
145
148
 
146
149
  Permission is hereby granted, free of charge, to any person obtaining
147
150
  a copy of this software and associated documentation files (the
@@ -1,8 +1,8 @@
1
1
  module RightAws #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 3 unless defined?(MAJOR)
4
- MINOR = 0 unless defined?(MINOR)
5
- TINY = 5 unless defined?(TINY)
4
+ MINOR = 1 unless defined?(MINOR)
5
+ TINY = 0 unless defined?(TINY)
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.') unless defined?(STRING)
8
8
  end
@@ -93,10 +93,13 @@ module RightAws
93
93
  'm2.4xlarge',
94
94
  'm3.xlarge' ,
95
95
  'm3.2xlarge',
96
- 'cc1.4xlarge',
97
- 'cg1.4xlarge',
98
- 'cc2.8xlarge',
99
- 'hi1.4xlarge' ]
96
+ 'cc1.4xlarge',
97
+ 'cg1.4xlarge',
98
+ 'cc2.8xlarge',
99
+ 'hi1.4xlarge',
100
+ 'hs1.8xlarge',
101
+ 'cr1.8xlarge'
102
+ ]
100
103
 
101
104
  @@bench = AwsBenchmarkingBlock.new
102
105
  def self.bench_xml
@@ -180,6 +183,30 @@ module RightAws
180
183
  on_exception
181
184
  end
182
185
 
186
+ # Incrementally lists given API call.
187
+ #
188
+ # All params are the same as for describe_resources_with_list_and_options call.
189
+ #
190
+ # Block is called on every chunk of resources received. If you need to stop the loop
191
+ # just make the block to return nil or false.
192
+ #
193
+ # The API call should support 'NextToken' parameter and the response should return :next_token
194
+ # as well.
195
+ #
196
+ # Returns the last response from the cloud.
197
+ #
198
+ def incrementally_list_items(remote_function_name, remote_item_name, parser_class, list_and_options, &block) # :nodoc:
199
+ last_response = nil
200
+ loop do
201
+ last_response = describe_resources_with_list_and_options(remote_function_name, remote_item_name, parser_class, list_and_options)
202
+ break unless block && block.call(last_response) && !last_response[:next_token].right_blank?
203
+ list, options = AwsUtils::split_items_and_params(list_and_options)
204
+ options[:next_token] = last_response[:next_token]
205
+ list_and_options = list + [options]
206
+ end
207
+ last_response
208
+ end
209
+
183
210
  def merge_new_options_into_list_and_options(list_and_options, new_options)
184
211
  list, options = AwsUtils::split_items_and_params(list_and_options)
185
212
  list << options.merge(new_options)
@@ -418,6 +445,27 @@ module RightAws
418
445
  describe_resources_with_list_and_options('DescribeRegions', 'RegionName', QEc2DescribeRegionsParser, list_and_options)
419
446
  end
420
447
 
448
+ #-----------------------------------------------------------------
449
+ # Accounts
450
+ #-----------------------------------------------------------------
451
+
452
+ # Describe the specified attribute of your AWS account.
453
+ #
454
+ # ec2.describe_account_attributes(:attribute_name => ['default-vpc','supported-platforms']) #=>
455
+ # {"default-vpc" => "vpc-8c3b00e7",
456
+ # "supported-platforms" => "VPC"}
457
+ #
458
+ # ec2.describe_account_attributes #=>
459
+ # {"vpc-max-security-groups-per-interface" => "5",
460
+ # "max-instances" => "150",
461
+ # "supported-platforms" => ["EC2", "VPC"],
462
+ # "default-vpc" => "none"}
463
+ #
464
+ def describe_account_attributes(*list_and_options)
465
+ list_and_options = merge_new_options_into_list_and_options(list_and_options, :options => {:api_version => VPC_API_VERSION})
466
+ describe_resources_with_list_and_options('DescribeAccountAttributes', 'accountAttributeValues', QEc2DescribeAccountAttributesParser, list_and_options)
467
+ end
468
+
421
469
  #-----------------------------------------------------------------
422
470
  # PARSERS: Key Pair
423
471
  #-----------------------------------------------------------------
@@ -557,7 +605,29 @@ module RightAws
557
605
  @result = []
558
606
  end
559
607
  end
560
-
608
+
609
+ #-----------------------------------------------------------------
610
+ # PARSERS: Account
611
+ #-----------------------------------------------------------------
612
+
613
+ class QEc2DescribeAccountAttributesParser < RightAWSParser #:nodoc:
614
+ def tagstart(name, attributes)
615
+ case name
616
+ when 'attributeValueSet' then @values = []
617
+ end
618
+ end
619
+ def tagend(name)
620
+ case name
621
+ when 'attributeName' then @name = @text
622
+ when 'attributeValue' then @values << @text
623
+ when 'attributeValueSet' then @result[@name] = (@values.size == 1) ? @values.first : @values
624
+ end
625
+ end
626
+ def reset
627
+ @result = {}
628
+ end
629
+ end
630
+
561
631
  end
562
632
 
563
633
  end
@@ -25,6 +25,8 @@ module RightAws
25
25
 
26
26
  class Ec2
27
27
 
28
+ RESERVED_INSTANCE_API_VERSION = (API_VERSION > '2012-10-01') ? API_VERSION : '2012-10-01'
29
+
28
30
  #-----------------------------------------------------------------
29
31
  # Reserved instances
30
32
  #-----------------------------------------------------------------
@@ -37,25 +39,27 @@ module RightAws
37
39
  # reserved-instances-id, start, state, tag-key, tag-value, tag:key, usage-price
38
40
  #
39
41
  # ec2.describe_reserved_instances #=>
40
- # [{:currency_code=>"USD",
41
- # :aws_fixed_price=>350.0,
42
- # :aws_availability_zone=>"us-east-1c",
43
- # :aws_instance_count=>1,
44
- # :tags=>{},
45
- # :aws_id=>"4357912c-ad94-4f57-8625-15ca71a8e66d",
46
- # :aws_product_description=>"Linux/UNIX",
47
- # :aws_state=>"active",
48
- # :aws_start=>"2010-03-18T20:39:39.569Z",
49
- # :aws_duration=>94608000,
50
- # :aws_instance_type=>"m1.small",
51
- # :instance_tenancy=>"default",
52
- # :aws_usage_price=>0.03}]
42
+ # [{:tags=>{},
43
+ # :aws_id=>"4357912c-0000-0000-0000-15ca71a8e66d",
44
+ # :aws_instance_type=>"m1.small",
45
+ # :aws_availability_zone=>"us-east-1c",
46
+ # :aws_start=>"2010-03-18T20:39:39.569Z",
47
+ # :aws_duration=>94608000,
48
+ # :aws_fixed_price=>350.0,
49
+ # :aws_usage_price=>0.03,
50
+ # :aws_instance_count=>1,
51
+ # :aws_product_description=>"Linux/UNIX",
52
+ # :aws_state=>"active",
53
+ # :instance_tenancy=>"default",
54
+ # :currency_code=>"USD",
55
+ # :offering_type=>"Medium Utilization"}]
53
56
  #
54
57
  # ec2.describe_reserved_instances(:filters => {'availability-zone' => 'us-east-1a'})
55
58
  #
56
59
  # P.S. filters: http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/index.html?ApiReference-query-DescribeReservedInstances.html
57
60
  #
58
61
  def describe_reserved_instances(*list_and_options)
62
+ list_and_options = merge_new_options_into_list_and_options(list_and_options, :options => {:api_version => RESERVED_INSTANCE_API_VERSION})
59
63
  describe_resources_with_list_and_options('DescribeReservedInstances', 'ReservedInstancesId', QEc2DescribeReservedInstancesParser, list_and_options)
60
64
  end
61
65
 
@@ -66,31 +70,60 @@ module RightAws
66
70
  # Filters: availability-zone, duration, fixed-price, instance-type, product-description, reserved-instances-offering-id, usage-price
67
71
  #
68
72
  # ec2.describe_reserved_instances_offerings #=>
69
- # [{:currency_code=>"USD",
70
- # :aws_fixed_price=>700.0,
71
- # :aws_id=>"248e7b75-933c-451b-b126-be25865e02a5",
72
- # :aws_product_description=>"Linux/UNIX",
73
+ # [{:recurring_charges=>[{:frequency=>"Hourly", :amount=>"0.095"}],
74
+ # :pricing_details_set=>[],
75
+ # :aws_id=>"438012d3-4031-43ff-9241-2964d1bf71d8",
73
76
  # :aws_instance_type=>"c1.medium",
77
+ # :aws_availability_zone=>"us-east-1e",
74
78
  # :aws_duration=>94608000,
79
+ # :aws_fixed_price=>775.0,
80
+ # :aws_usage_price=>0.0,
81
+ # :aws_product_description=>"Red Hat Enterprise Linux",
75
82
  # :instance_tenancy=>"default",
76
- # :aws_usage_price=>0.06,
77
- # :aws_availability_zone=>"us-east-1a"},
78
- # {:currency_code=>"USD",
79
- # :aws_fixed_price=>700.0,
80
- # :aws_id=>"c48ab04c-7e03-46b2-891a-2df1116e51a3",
81
- # :aws_product_description=>"Linux/UNIX (Amazon VPC)",
83
+ # :currency_code=>"USD",
84
+ # :offering_type=>"Heavy Utilization",
85
+ # :marketplace=>false},
86
+ # { :recurring_charges=>[{:frequency=>"Hourly", :amount=>"0.095"}],
87
+ # :pricing_details_set=>[],
88
+ # :aws_id=>"649fd0c8-6cb4-47bf-83db-7a844016afa7",
82
89
  # :aws_instance_type=>"c1.medium",
90
+ # :aws_availability_zone=>"us-east-1e",
83
91
  # :aws_duration=>94608000,
92
+ # :aws_fixed_price=>775.0,
93
+ # :aws_usage_price=>0.0,
94
+ # :aws_product_description=>"Red Hat Enterprise Linux (Amazon VPC)",
84
95
  # :instance_tenancy=>"default",
85
- # :aws_usage_price=>0.06,
86
- # :aws_availability_zone=>"us-east-1a"}, ... ]
87
- #
96
+ # :currency_code=>"USD",
97
+ # :offering_type=>"Heavy Utilization",
98
+ # :marketplace=>false}, ... ]
99
+ #
88
100
  # ec2.describe_reserved_instances_offerings(:filters => {'availability-zone' => 'us-east-1c'})
89
101
  #
102
+ # # Get all ReservedInstancesOfferings (list by 50 items)
103
+ # result = ec2.describe_reserved_instances_offerings(:max_results => 50) do |response|
104
+ # puts response[:items].count
105
+ # true
106
+ # end
107
+ #
108
+ # # Get first 400 ReservedInstancesOfferings.
109
+ # # P.S. it stops making calls one the block below returns false.
110
+ # max_count_to_get = 400
111
+ # counter = 0
112
+ # result = ec2.describe_reserved_instances_offerings do |response|
113
+ # counter += response[:items].count
114
+ # max_count_to_get <= counter
115
+ # end
116
+ #
90
117
  # P.S. filters: http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/index.html?ApiReference-query-DescribeReservedInstancesOfferings.html
91
118
  #
92
- def describe_reserved_instances_offerings(*list_and_options)
93
- describe_resources_with_list_and_options('DescribeReservedInstancesOfferings', 'ReservedInstancesOfferingId', QEc2DescribeReservedInstancesOfferingsParser, list_and_options)
119
+ def describe_reserved_instances_offerings(*list_and_options, &block)
120
+ result = []
121
+ list_and_options = merge_new_options_into_list_and_options(list_and_options, :options => {:api_version => RESERVED_INSTANCE_API_VERSION})
122
+ incrementally_list_items('DescribeReservedInstancesOfferings', 'ReservedInstancesOfferingId', QEc2DescribeReservedInstancesOfferingsParser, list_and_options) do |response|
123
+ result += response[:items]
124
+ block ? block.call(response) : true
125
+ end
126
+ result
94
127
  end
95
128
 
96
129
  # Purchase a Reserved Instance.
@@ -98,9 +131,14 @@ module RightAws
98
131
  #
99
132
  # ec2.purchase_reserved_instances_offering('e5a2ff3b-f6eb-4b4e-83f8-b879d7060257', 3) # => '4b2293b4-5813-4cc8-9ce3-1957fc1dcfc8'
100
133
  #
101
- def purchase_reserved_instances_offering(reserved_instances_offering_id, instance_count=1)
102
- link = generate_request("PurchaseReservedInstancesOffering", { 'ReservedInstancesOfferingId' => reserved_instances_offering_id,
103
- 'InstanceCount' => instance_count })
134
+ def purchase_reserved_instances_offering(reserved_instances_offering_id, instance_count=1, options={})
135
+ options[:options] ||= {}
136
+ options[:options][:api_version] ||= RESERVED_INSTANCE_API_VERSION
137
+
138
+ api_params = { 'ReservedInstancesOfferingId' => reserved_instances_offering_id,
139
+ 'InstanceCount' => instance_count }
140
+
141
+ link = generate_request("PurchaseReservedInstancesOffering", api_params, options)
104
142
  request_info(link, QEc2PurchaseReservedInstancesOfferingParser.new)
105
143
  rescue Exception
106
144
  on_exception
@@ -113,8 +151,9 @@ module RightAws
113
151
  class QEc2DescribeReservedInstancesParser < RightAWSParser #:nodoc:
114
152
  def tagstart(name, attributes)
115
153
  case full_tag_name
116
- when %r{/reservedInstancesSet/item$} then @item = { :tags => {} }
117
- when %r{/tagSet/item$} then @aws_tag = {}
154
+ when %r{/recurringCharges/item$} then @recurring_charge = {}
155
+ when %r{/tagSet/item$} then @aws_tag = {}
156
+ when %r{/reservedInstancesSet/item$} then @item = { :tags=> {} }
118
157
  end
119
158
  end
120
159
  def tagend(name)
@@ -131,12 +170,16 @@ module RightAws
131
170
  when 'start' then @item[:aws_start] = @text
132
171
  when 'instanceTenancy' then @item[:instance_tenancy] = @text
133
172
  when 'currencyCode' then @item[:currency_code] = @text
173
+ when 'offeringType' then @item[:offering_type] = @text
134
174
  else
135
175
  case full_tag_name
136
- when %r{/tagSet/item/key$} then @aws_tag[:key] = @text
137
- when %r{/tagSet/item/value$} then @aws_tag[:value] = @text
138
- when %r{/tagSet/item$} then @item[:tags][@aws_tag[:key]] = @aws_tag[:value]
139
- when %r{/reservedInstancesSet/item$} then @result << @item
176
+ when %r{/tagSet/item/key$} then @aws_tag[:key] = @text
177
+ when %r{/tagSet/item/value$} then @aws_tag[:value] = @text
178
+ when %r{/tagSet/item$} then @item[:tags][@aws_tag[:key]] = @aws_tag[:value]
179
+ when %r{/recurringCharges/item/frequency$} then @recurring_charge[:frequency] = @text
180
+ when %r{/recurringCharges/item/amount$} then @recurring_charge[:amount] = @text
181
+ when %r{/recurringCharges/item$} then (@item[:recurring_charges] ||= []) << @recurring_charge
182
+ when %r{/reservedInstancesSet/item$} then @result << @item
140
183
  end
141
184
  end
142
185
  end
@@ -147,10 +190,15 @@ module RightAws
147
190
 
148
191
  class QEc2DescribeReservedInstancesOfferingsParser < RightAWSParser #:nodoc:
149
192
  def tagstart(name, attributes)
150
- @item = {} if name == 'item'
193
+ case full_tag_name
194
+ when %r{/pricingDetailsSet/item$} then @pricing_details = {}
195
+ when %r{/recurringCharges/item$} then @recurring_charge = {}
196
+ when %r{/reservedInstancesOfferingsSet/item$} then @item = {}
151
197
  end
198
+ end
152
199
  def tagend(name)
153
200
  case name
201
+ when 'nextToken' then @result[:next_token] = @text
154
202
  when 'reservedInstancesOfferingId' then @item[:aws_id] = @text
155
203
  when 'instanceType' then @item[:aws_instance_type] = @text
156
204
  when 'availabilityZone' then @item[:aws_availability_zone] = @text
@@ -160,11 +208,22 @@ module RightAws
160
208
  when 'instanceTenancy' then @item[:instance_tenancy] = @text
161
209
  when 'currencyCode' then @item[:currency_code] = @text
162
210
  when 'productDescription' then @item[:aws_product_description] = @text
163
- when 'item' then @result << @item
164
- end
211
+ when 'offeringType' then @item[:offering_type] = @text
212
+ when 'marketplace' then @item[:marketplace] = (@text == 'true')
213
+ else
214
+ case full_tag_name
215
+ when %r{/recurringCharges/item/frequency$} then @recurring_charge[:frequency] = @text
216
+ when %r{/recurringCharges/item/amount$} then @recurring_charge[:amount] = @text
217
+ when %r{/recurringCharges/item$} then (@item[:recurring_charges] ||= []) << @recurring_charge
218
+ when %r{/pricingDetailsSet/item/price$} then @pricing_details[:price] = @text
219
+ when %r{/pricingDetailsSet/item/count$} then @pricing_details[:count] = @text
220
+ when %r{/pricingDetailsSet/item$} then (@item[:pricing_details_set] ||= []) << @pricing_details
221
+ when %r{/reservedInstancesOfferingsSet/item$} then @result[:items] << @item
222
+ end
165
223
  end
224
+ end
166
225
  def reset
167
- @result = []
226
+ @result = { :items => [] }
168
227
  end
169
228
  end
170
229
 
@@ -25,6 +25,9 @@ module RightAws
25
25
 
26
26
  class Ec2
27
27
 
28
+
29
+ VPC_API_VERSION = (API_VERSION > '2012-10-15') ? API_VERSION : '2012-10-15'
30
+
28
31
  public
29
32
 
30
33
  #-----------------
@@ -54,6 +57,7 @@ module RightAws
54
57
  # P.S. filters: http://docs.amazonwebservices.com/AmazonVPC/latest/APIReference/index.html?ApiReference-query-DescribeVpcs.html
55
58
  #
56
59
  def describe_vpcs(*list_and_options)
60
+ list_and_options = merge_new_options_into_list_and_options(list_and_options, :options => {:api_version => VPC_API_VERSION})
57
61
  describe_resources_with_list_and_options('DescribeVpcs', 'VpcId', QEc2DescribeVpcsParser, list_and_options)
58
62
  end
59
63
 
@@ -67,7 +71,7 @@ module RightAws
67
71
  #
68
72
  def create_vpc(cidr_block, options = {})
69
73
  request_hash = {'CidrBlock' => cidr_block}
70
- request_hash['instanceTenancy'] = options[:instance_tenancy] unless options[:instance_tenancy].right_blank?
74
+ request_hash['InstanceTenancy'] = options[:instance_tenancy] unless options[:instance_tenancy].right_blank?
71
75
  link = generate_request("CreateVpc", request_hash )
72
76
  request_info(link, QEc2DescribeVpcsParser.new(:logger => @logger)).first
73
77
  rescue Exception
@@ -108,6 +112,7 @@ module RightAws
108
112
  # P.S. filters: http://docs.amazonwebservices.com/AmazonVPC/latest/APIReference/index.html?ApiReference-query-DescribeSubnets.html
109
113
  #
110
114
  def describe_subnets(*list_and_options)
115
+ list_and_options = merge_new_options_into_list_and_options(list_and_options, :options => {:api_version => VPC_API_VERSION})
111
116
  describe_resources_with_list_and_options('DescribeSubnets', 'SubnetId', QEc2DescribeSubnetsParser, list_and_options)
112
117
  end
113
118
 
@@ -418,6 +423,7 @@ module RightAws
418
423
  when 'dhcpOptionsId' then @item[:dhcp_options_id] = @text
419
424
  when 'cidrBlock' then @item[:cidr_block] = @text
420
425
  when 'instanceTenancy' then @item[:instance_tenancy] = @text
426
+ when 'isDefault' then @item[:is_default] = @text == 'true'
421
427
  else
422
428
  case full_tag_name
423
429
  when %r{/tagSet/item/key$} then @aws_tag[:key] = @text
@@ -447,6 +453,8 @@ module RightAws
447
453
  when 'cidrBlock' then @item[:cidr_block] = @text
448
454
  when 'availabilityZone' then @item[:availability_zone] = @text
449
455
  when 'availableIpAddressCount' then @item[:available_ip_address_count] = @text
456
+ when 'defaultForAz' then @item[:default_for_az] = @text == 'true'
457
+ when 'mapPublicIpOnLaunch' then @item[:map_public_ip_on_launch] = @text == 'true'
450
458
  else
451
459
  case full_tag_name
452
460
  when %r{/tagSet/item/key$} then @aws_tag[:key] = @text
@@ -27,14 +27,21 @@ module RightAws
27
27
 
28
28
  include RightAwsBaseInterface
29
29
 
30
- API_VERSION = "2011-04-01"
30
+ API_VERSION = "2012-09-17"
31
31
  DEFAULT_HOST = 'rds.amazonaws.com'
32
32
  DEFAULT_PORT = 443
33
33
  DEFAULT_PROTOCOL = 'https'
34
34
  DEFAULT_PATH = '/'
35
35
 
36
36
  DEFAULT_INSTANCE_CLASS = 'db.m1.small'
37
- INSTANCE_CLASSES = ['db.m1.small', 'db.m1.large', 'db.m1.xlarge', 'db.m2.2xlarge', 'db.m2.2xlarge', 'db.m2.4xlarge']
37
+ INSTANCE_CLASSES = [ 'db.t1.micro',
38
+ 'db.m1.small',
39
+ 'db.m1.medium',
40
+ 'db.m1.large',
41
+ 'db.m1.xlarge',
42
+ 'db.m2.xlarge',
43
+ 'db.m2.2xlarge',
44
+ 'db.m2.4xlarge']
38
45
  LICENSE_MODELS = ['bring-your-own-license', 'license-included', 'general-public-license']
39
46
 
40
47
  @@bench = AwsBenchmarkingBlock.new
@@ -177,7 +184,7 @@ module RightAws
177
184
  # Optional params: +:allocated_storage+ (25 by def), +:instance_class+, +:engine+ ('MySQL' by def),
178
185
  # +:endpoint_port+, +:db_name+, +:db_security_groups+, +:db_parameter_group+, +:availability_zone+, +:preferred_maintenance_window+
179
186
  # +:backup_retention_period+, +:preferred_backup_window+, +:multi_az+, +:engine_version+, +:auto_minor_version_upgrade+,
180
- # +:license_model+
187
+ # +:license_model+, +:iops+, +:db_subnet_group_name+, +:character_set_name+, +:option_group_name+
181
188
  #
182
189
  # rds.create_db_instance('kd-delete-me-01', 'username', 'password',
183
190
  # :instance_class => 'db.m1.small',
@@ -222,6 +229,10 @@ module RightAws
222
229
  request_hash['EngineVersion'] = params[:engine_version] unless params[:engine_version].right_blank?
223
230
  request_hash['AutoMinorVersionUpgrade'] = params[:auto_minor_version_upgrade].to_s unless params[:auto_minor_version_upgrade].nil?
224
231
  request_hash['LicenseModel'] = params[:license_model] unless params[:license_model].right_blank?
232
+ request_hash['CharacterSetName'] = params[:character_set_name] unless params[:character_set_name].right_blank?
233
+ request_hash['DBSubnetGroupName'] = params[:db_subnet_group_name] unless params[:db_subnet_group_name].right_blank?
234
+ request_hash['Iops'] = params[:iops] unless params[:iops].right_blank?
235
+ request_hash['OptionGroupName'] = params[:option_group_name] unless params[:option_group_name].right_blank?
225
236
  request_hash.merge!(amazonize_list('DBSecurityGroups.member', params[:db_security_groups]))
226
237
  link = generate_request('CreateDBInstance', request_hash)
227
238
  request_info(link, DescribeDbInstancesParser.new(:logger => @logger))[:db_instances].first
@@ -233,7 +244,7 @@ module RightAws
233
244
  # Optional params: +:master_user_password+, +:instance_class+, +:db_security_groups+,
234
245
  # +:db_parameter_group+, +:preferred_maintenance_window+, +:allocated_storage+, +:apply_immediately+,
235
246
  # +:backup_retention_period+, +:preferred_backup_window+, +:multi_az+, +:engine_version+,
236
- # +:auto_minor_version_upgrade+, +:allow_major_version_upgrade+
247
+ # +:auto_minor_version_upgrade+, +:allow_major_version_upgrade+, +:iops+, +::option_group_name+
237
248
  #
238
249
  # rds.modify_db_instance('kd-delete-me-01',
239
250
  # :master_user_password => 'newpassword',
@@ -286,12 +297,16 @@ module RightAws
286
297
  request_hash['ApplyImmediately'] = params[:apply_immediately].to_s unless params[:apply_immediately].right_blank?
287
298
  request_hash.merge!(amazonize_list('DBSecurityGroups.member', params[:db_security_groups]))
288
299
  request_hash['DBParameterGroupName'] = params[:db_parameter_group] unless params[:db_parameter_group].right_blank?
300
+ request_hash['Iops'] = params[:iops] unless params[:iops].right_blank?
301
+ request_hash['OptionGroupName'] = params[:option_group_name] unless params[:option_group_name].right_blank?
289
302
  link = generate_request('ModifyDBInstance', request_hash)
290
303
  request_info(link, DescribeDbInstancesParser.new(:logger => @logger))[:db_instances].first
291
304
  end
292
305
 
293
306
  # Reboot Db instance.
294
307
  #
308
+ # Options: +:force_failover+
309
+ #
295
310
  # rds.reboot_db_instance('kd-my-awesome-db') #=>
296
311
  # {:status=>"rebooting",
297
312
  # :pending_modified_values=>{},
@@ -305,9 +320,12 @@ module RightAws
305
320
  # :engine=>"MySQL5.1",
306
321
  # :preferred_maintenance_window=>"Sun:05:00-Sun:09:00"}
307
322
  #
323
+ # P.S. http://docs.amazonwebservices.com/AmazonRDS/latest/APIReference/API_RebootDBInstance.html
324
+ #
308
325
  def reboot_db_instance(aws_id, params={})
309
326
  params = params.dup
310
327
  params['DBInstanceIdentifier'] = aws_id
328
+ params['ForceFailover'] = !!params[:force_failover] if params.has_key?(:force_failover)
311
329
  link = generate_request('RebootDBInstance', params)
312
330
  request_info(link, DescribeDbInstancesParser.new(:logger => @logger))[:db_instances].first
313
331
  end
@@ -382,6 +400,8 @@ module RightAws
382
400
  # Create a database security group so that ingress to an RDS Instance can be controlled.
383
401
  # A new security group cannot have the same name as an existing group.
384
402
  #
403
+ # Options: :vpc_id
404
+ #
385
405
  # ds.create_db_security_group('kd3', 'kd') #=>
386
406
  # {:ec2_security_groups=>[],
387
407
  # :description=>"kd",
@@ -389,9 +409,11 @@ module RightAws
389
409
  # :name=>"kd3",
390
410
  # :owner_id=>"82...25"}
391
411
  #
392
- def create_db_security_group(db_security_group_name, db_security_group_description)
393
- link = generate_request('CreateDBSecurityGroup', 'DBSecurityGroupName' => db_security_group_name,
394
- 'DBSecurityGroupDescription' => db_security_group_description)
412
+ def create_db_security_group(db_security_group_name, db_security_group_description, params={})
413
+ request_hash = { 'DBSecurityGroupName' => db_security_group_name,
414
+ 'DBSecurityGroupDescription' => db_security_group_description }
415
+ request_hash['EC2VpcId'] = params[:vpc_id] unless params[:vpc_id].right_blank?
416
+ link = generate_request('CreateDBSecurityGroup', request_hash)
395
417
  request_info(link, DescribeDbSecurityGroupsParser.new(:logger => @logger))[:db_security_groups].first
396
418
  end
397
419
 
@@ -400,6 +422,7 @@ module RightAws
400
422
  request_hash['CIDRIP'] = params[:cidrip] unless params[:cidrip].right_blank?
401
423
  request_hash['EC2SecurityGroupName'] = params[:ec2_security_group_name] unless params[:ec2_security_group_name].right_blank?
402
424
  request_hash['EC2SecurityGroupOwnerId'] = params[:ec2_security_group_owner] unless params[:ec2_security_group_owner].right_blank?
425
+ request_hash['EC2SecurityGroupId'] = params[:ec2_security_group_id] unless params[:ec2_security_group_id].right_blank?
403
426
  link = generate_request(action, request_hash)
404
427
  request_info(link, DescribeDbSecurityGroupsParser.new(:logger => @logger))[:db_security_groups].first
405
428
  end
@@ -640,7 +663,7 @@ module RightAws
640
663
  end
641
664
 
642
665
  # Describe a list of orderable DB Instance options for the specified engine.
643
- # Optionals: +:instance_class+, +:engine_version+ , +:license_model+
666
+ # Optionals: +:instance_class+, +:engine_version+ , +:license_model+, +:vpc+
644
667
  #
645
668
  # rds.describe_orderable_db_instance_options('oracle-ee', :engine_version => '11.2.0.2.v2') #=>
646
669
  # [{:read_replica_capable=>false,
@@ -654,8 +677,9 @@ module RightAws
654
677
  def describe_orderable_db_instance_options(engine, params={}, &block)
655
678
  request_hash = { 'Engine' => engine }
656
679
  request_hash['DBInstanceClass'] = params[:instance_class] unless params[:instance_class].right_blank?
657
- request_hash['EngineVersion'] = params[:engine_version] unless params[:engine_version].right_blank?
658
- request_hash['LicenseModel'] = params[:license_model] unless params[:license_model].right_blank?
680
+ request_hash['EngineVersion'] = params[:engine_version] unless params[:engine_version].right_blank?
681
+ request_hash['LicenseModel'] = params[:license_model] unless params[:license_model].right_blank?
682
+ request_hash['Vpc'] = !!params[:vpc] if params.has_key?(:vpc)
659
683
  result = []
660
684
  incrementally_list_items('DescribeOrderableDBInstanceOptions', DescribeOrderableDBInstanceOptionsParser, request_hash) do |response|
661
685
  result += response[:items]
@@ -745,7 +769,8 @@ module RightAws
745
769
  # in the "Available" state. The new RDS instance is created with the Default security group.
746
770
  #
747
771
  # Optional params: +:instance_class+, +:endpoint_port+, +:availability_zone+, +:multi_az+,
748
- # +:auto_minor_version_upgrade+, +:license_model+, +:db_name+, +:engine+
772
+ # +:auto_minor_version_upgrade+, +:license_model+, +:db_name+, +:engine+, +:db_subnet_group_name+,
773
+ # +:iops+, +:option_group_name+
749
774
  #
750
775
  # rds.restore_db_instance_from_db_snapshot('ahahahaha-final-snapshot-20090828081159', 'q1') #=>
751
776
  # {:status=>"creating",
@@ -772,6 +797,9 @@ module RightAws
772
797
  request_hash['LicenseModel'] = params[:license_model] unless params[:license_model].right_blank?
773
798
  request_hash['DBName'] = params[:db_name] unless params[:db_name].right_blank?
774
799
  request_hash['Engine'] = params[:engine] unless params[:enginel].right_blank?
800
+ request_hash['DBSubnetGroupName'] = params[:db_subnet_group_name] unless params[:db_subnet_group_name].right_blank?
801
+ request_hash['Iops'] = params[:iops] unless params[:iops].right_blank?
802
+ request_hash['OptionGroupName'] = params[:option_group_name] unless params[:option_group_name].right_blank?
775
803
  link = generate_request('RestoreDBInstanceFromDBSnapshot', request_hash)
776
804
  request_info(link, DescribeDbInstancesParser.new(:logger => @logger))[:db_instances].first
777
805
  end
@@ -783,6 +811,7 @@ module RightAws
783
811
  #
784
812
  # Optional params: +:instance_class+, +:endpoint_port+, +:availability_zone+, +:multi_az+, +:restore_time+,
785
813
  # +:auto_minor_version_upgrade+, +:use_latest_restorable_time+, +:license_model+, +:db_name+, +:engine+
814
+ # +:db_subnet_group_name+, +:iops+, +:option_group_name+
786
815
  #
787
816
  def restore_db_instance_to_point_in_time(instance_aws_id, new_instance_aws_id, params={})
788
817
  request_hash = { 'SourceDBInstanceIdentifier' => instance_aws_id,
@@ -797,6 +826,9 @@ module RightAws
797
826
  request_hash['LicenseModel'] = params[:license_model] unless params[:license_model].right_blank?
798
827
  request_hash['DBName'] = params[:db_name] unless params[:db_name].right_blank?
799
828
  request_hash['Engine'] = params[:engine] unless params[:enginel].right_blank?
829
+ request_hash['DBSubnetGroupName'] = params[:db_subnet_group_name] unless params[:db_subnet_group_name].right_blank?
830
+ request_hash['Iops'] = params[:iops] unless params[:iops].right_blank?
831
+ request_hash['OptionGroupName'] = params[:option_group_name] unless params[:option_group_name].right_blank?
800
832
  link = generate_request('RestoreDBInstanceToPointInTime', request_hash)
801
833
  request_info(link, DescribeDbInstancesParser.new(:logger => @logger))[:db_instances].first
802
834
  end
@@ -875,7 +907,7 @@ module RightAws
875
907
  # --------------------------------------------
876
908
 
877
909
  # Get a list of the available DB engines.
878
- # Optional params: +:db_parameter_group_family+, +:default_only+, +:engine+, +:engine_version+
910
+ # Optional params: +:db_parameter_group_family+, +:default_only+, +:engine+, +:engine_version+. +:engine_version+
879
911
  #
880
912
  # rds.describe_db_engine_versions #=>
881
913
  # [{:db_parameter_group_family=>"mysql5.1",
@@ -890,12 +922,41 @@ module RightAws
890
922
  # "Oracle Standard Edition One - DB Engine Version 11.2.0.2.v2",
891
923
  # :engine_version=>"11.2.0.2.v2"}]
892
924
  #
925
+ # rds.describe_db_engine_versions(:list_supported_character_sets => true) #=>
926
+ # [{:db_parameter_group_family=>"mysql5.1",
927
+ # :engine=>"mysql",
928
+ # :db_engine_description=>"MySQL Community Edition",
929
+ # :engine_version=>"5.1.45",
930
+ # :db_engine_version_description=>"MySQL 5.1.45"},
931
+ # {:db_parameter_group_family=>"oracle-ee-11.2",
932
+ # :engine=>"oracle-ee",
933
+ # :supported_character_sets=>
934
+ # [{:name=>"AL32UTF8",
935
+ # :description=>"Unicode 5.0 UTF-8 Universal character set"},
936
+ # {:name=>"JA16EUC", :description=>"EUC 24-bit Japanese"},
937
+ # {:name=>"JA16EUCTILDE",
938
+ # :description=>
939
+ # "The same as JA16EUC except for the way that the wave dash and the tilde are mapped to and from Unicode."},
940
+ # {:name=>"JA16SJIS", :description=>"Shift-JIS 16-bit Japanese"},
941
+ # {:name=>"WE8ISO8859P9",
942
+ # :description=>"ISO 8859-9 West European and Turkish"},
943
+ # {:name=>"US7ASCII", :description=>"ASCII 7-bit American"}],
944
+ # :db_engine_description=>"Oracle Database Enterprise Edition",
945
+ # :default_character_set=>
946
+ # {:name=>"AL32UTF8",
947
+ # :description=>"Unicode 5.0 UTF-8 Universal character set"},
948
+ # :engine_version=>"11.2.0.2.v3",
949
+ # :db_engine_version_description=>"Oracle 11.2.0.2.v3"}, ... ]
950
+ #
951
+ # P.S. http://docs.amazonwebservices.com/AmazonRDS/latest/APIReference/API_DescribeDBEngineVersions.html
952
+ #
893
953
  def describe_db_engine_versions(params={}, &block)
894
954
  params = params.dup
895
955
  params['DBParameterGroupFamily'] = params.delete(:db_parameter_group_family) unless params[:db_parameter_group_family].right_blank?
896
956
  params['DefaultOnly'] = params.delete(:default_only).to_s unless params[:default_only].nil?
897
957
  params['Engine'] = params.delete(:engine) unless params[:engine].right_blank?
898
958
  params['EngineVersion'] = params.delete(:engine_version) unless params[:engine_version].right_blank?
959
+ params['ListSupportedCharacterSets'] = !!params.delete(:list_supported_character_sets) if params.has_key?(:list_supported_character_sets)
899
960
  result = []
900
961
  incrementally_list_items('DescribeDBEngineVersions', DescribeDBEngineVersionsParser, params) do |response|
901
962
  result += response[:db_engine_versions]
@@ -910,7 +971,8 @@ module RightAws
910
971
 
911
972
  # Create a DB Instance that acts as a Read Replica of a source DB Instance.
912
973
  #
913
- # Optional params: +:endpoint_port+, +:availability_zone+, +:instance_class+, +:auto_minor_version_upgrade+
974
+ # Optional params: +:endpoint_port+, +:availability_zone+, +:instance_class+, +:auto_minor_version_upgrade+,
975
+ # +:iops+, +:option_group_name+
914
976
  #
915
977
  # rds.create_db_instance_read_replica('kd-delete-me-01-replica-01', 'kd-delete-me-01',
916
978
  # :instance_class => 'db.m1.small',
@@ -941,6 +1003,8 @@ module RightAws
941
1003
  request_hash['AvailabilityZone'] = params[:availability_zone] unless params[:availability_zone].right_blank?
942
1004
  request_hash['DBInstanceClass'] = params[:instance_class] unless params[:instance_class].right_blank?
943
1005
  request_hash['AutoMinorVersionUpgrade'] = params[:auto_minor_version_upgrade].to_s unless params[:auto_minor_version_upgrade].nil?
1006
+ request_hash['Iops'] = params[:iops] unless params[:iops].right_blank?
1007
+ request_hash['OptionGroupName'] = params[:option_group_name] unless params[:option_group_name].right_blank?
944
1008
  link = generate_request('CreateDBInstanceReadReplica', request_hash)
945
1009
  request_info(link, DescribeDbInstancesParser.new(:logger => @logger))[:db_instances].first
946
1010
  end
@@ -954,22 +1018,26 @@ module RightAws
954
1018
  # Options: :aws_id, :instance_class, :duration, :product_description, :multi_az
955
1019
  #
956
1020
  # rds.describe_reserved_db_instances_offerings #=>
957
- # [{:usage_price=>0.262,
958
- # :offering_aws_id=>"248e7b75-2451-4381-9025-b5553d421c7b",
959
- # :multi_az=>false,
960
- # :duration=>31536000,
961
- # :currency_code=>"USD",
962
- # :instance_class=>"db.m2.xlarge",
963
- # :product_description=>"mysql",
964
- # :fixed_price=>1325.0},
965
- # {:usage_price=>0.092,
966
- # :offering_aws_id=>"248e7b75-49a7-4cd7-9a9b-354f4906a9b1",
967
- # :multi_az=>true,
968
- # :duration=>94608000,
969
- # :currency_code=>"USD",
970
- # :instance_class=>"db.m1.small",
971
- # :product_description=>"mysql",
972
- # :fixed_price=>700.0}, ...]
1021
+ # [{:recurring_charges=>[],
1022
+ # :offering_type=>"Medium Utilization",
1023
+ # :duration=>94608000,
1024
+ # :currency_code=>"USD",
1025
+ # :fixed_price=>82.0,
1026
+ # :product_description=>"oracle-se(byol)",
1027
+ # :usage_price=>0.01,
1028
+ # :aws_id=>"248e7b75-01ff-4f1d-8fad-918b76337c13",
1029
+ # :multi_az=>false,
1030
+ # :instance_class=>"db.t1.micro"},
1031
+ # {:recurring_charges=>[{:frequency=>"Hourly", :amount=>"0.24"}],
1032
+ # :offering_type=>"Heavy Utilization",
1033
+ # :duration=>31536000,
1034
+ # :currency_code=>"USD",
1035
+ # :fixed_price=>1040.0,
1036
+ # :product_description=>"sqlserver-web(li)",
1037
+ # :usage_price=>0.0,
1038
+ # :aws_id=>"248e7b75-05eb-46df-a7b8-4117b5001667",
1039
+ # :multi_az=>false,
1040
+ # :instance_class=>"db.m2.xlarge"}, ... ]
973
1041
  #
974
1042
  # rds.describe_reserved_db_instances_offerings(:aws_id => "248e7b75-49a7-4cd7-9a9b-354f4906a9b1") #=>
975
1043
  # [{:duration=>94608000,
@@ -1038,7 +1106,124 @@ module RightAws
1038
1106
  link = generate_request('PurchaseReservedDBInstancesOffering', request_hash)
1039
1107
  request_info(link, DescribeReservedDBInstancesParser.new(:logger => @logger))[:reserved_db_instances].first
1040
1108
  end
1041
-
1109
+
1110
+ #---------------------------------------------
1111
+ # Subnet Groups
1112
+ #---------------------------------------------
1113
+
1114
+ # Lists available DB Subnet Groups.
1115
+ # Options: :name, :max_records, :marker
1116
+ #
1117
+ # rds.describe_db_subnet_groups #=>
1118
+ # [{:subnets=>
1119
+ # [{:availability_zone=>
1120
+ # {:name=>"us-east-1d", :provisioned_iops_capable=>false},
1121
+ # :status=>"Active",
1122
+ # :subnet_id=>"subnet-5259d03a"},
1123
+ # {:availability_zone=>
1124
+ # {:name=>"us-east-1a", :provisioned_iops_capable=>false},
1125
+ # :status=>"Active",
1126
+ # :subnet_id=>"subnet-eb518f83"}],
1127
+ # :vpc_id=>"vpc-10518f78",
1128
+ # :status=>"Complete",
1129
+ # :description=>"delete me please",
1130
+ # :name=>"kd-subnet-group"},
1131
+ # {:subnets=>
1132
+ # [{:availability_zone=>
1133
+ # {:name=>"us-east-1a", :provisioned_iops_capable=>false},
1134
+ # :status=>"Active",
1135
+ # :subnet_id=>"subnet-eb518f83"},
1136
+ # {:availability_zone=>
1137
+ # {:name=>"us-east-1d", :provisioned_iops_capable=>false},
1138
+ # :status=>"Active",
1139
+ # :subnet_id=>"subnet-5259d03a"}],
1140
+ # :vpc_id=>"vpc-10518f78",
1141
+ # :status=>"Complete",
1142
+ # :description=>"delete me please",
1143
+ # :name=>"kd-subnet-group-1"}]
1144
+ #
1145
+ # P.S. http://docs.amazonwebservices.com/AmazonRDS/latest/APIReference/API_DescribeDBSubnetGroups.html
1146
+ #
1147
+ def describe_db_subnet_groups(params={}, &block)
1148
+ params = params.dup
1149
+ params['DBSubnetGroupName'] = params.delete(:name) unless params[:name].right_blank?
1150
+ result = []
1151
+ incrementally_list_items('DescribeDBSubnetGroups', DescribeDBSubnetGroupsParser, params) do |response|
1152
+ result += response[:subnet_groups]
1153
+ block ? block.call(response) : true
1154
+ end
1155
+ result
1156
+ end
1157
+
1158
+ def get_db_subnet_group(group_name, &block)
1159
+ describe_db_subnet_groups(:name => group_name, &block)
1160
+ end
1161
+
1162
+ # Create a new DB Subnet Group.
1163
+ #
1164
+ # rds.create_db_subnet_group('kd-subnet-group-1', ['subnet-5259d03a', 'subnet-eb518f83'], 'delete me please') #=>
1165
+ # {:subnets=>
1166
+ # [{:availability_zone=>
1167
+ # {:name=>"us-east-1a", :provisioned_iops_capable=>false},
1168
+ # :status=>"Active",
1169
+ # :subnet_id=>"subnet-eb518f83"},
1170
+ # {:availability_zone=>
1171
+ # {:name=>"us-east-1d", :provisioned_iops_capable=>false},
1172
+ # :status=>"Active",
1173
+ # :subnet_id=>"subnet-5259d03a"}],
1174
+ # :vpc_id=>"vpc-10518f78",
1175
+ # :status=>"Complete",
1176
+ # :description=>"delete me please",
1177
+ # :name=>"kd-subnet-group-1"}
1178
+ #
1179
+ # P.S. http://docs.amazonwebservices.com/AmazonRDS/latest/APIReference/API_CreateDBSubnetGroup.html
1180
+ #
1181
+ def create_db_subnet_group(subnet_group_name, subnets, subnet_group_description = '-')
1182
+ request_hash = { 'DBSubnetGroupName' => subnet_group_name,
1183
+ 'DBSubnetGroupDescription' => subnet_group_description }
1184
+ request_hash.merge!(amazonize_list('SubnetIds.member', subnets))
1185
+ link = generate_request('CreateDBSubnetGroup', request_hash)
1186
+ request_info(link, DescribeDBSubnetGroupsParser.new(:logger => @logger))[:subnet_groups].first
1187
+ end
1188
+
1189
+ # Modify an existing DB Subnet Group.
1190
+ #
1191
+ # rds.modify_db_subnet_group('kd-subnet-group', ['subnet-5259d03a', 'subnet-eb518f83'], 'hahaha!') #=>
1192
+ # {:subnets=>
1193
+ # [{:availability_zone=>
1194
+ # {:name=>"us-east-1d", :provisioned_iops_capable=>false},
1195
+ # :status=>"Active",
1196
+ # :subnet_id=>"subnet-5259d03a"},
1197
+ # {:availability_zone=>
1198
+ # {:name=>"us-east-1a", :provisioned_iops_capable=>false},
1199
+ # :status=>"Active",
1200
+ # :subnet_id=>"subnet-eb518f83"}],
1201
+ # :vpc_id=>"vpc-10518f78",
1202
+ # :status=>"Complete",
1203
+ # :description=>"hahaha!",
1204
+ # :name=>"kd-subnet-group"}
1205
+ #
1206
+ # P.S. http://docs.amazonwebservices.com/AmazonRDS/latest/APIReference/API_ModifyDBSubnetGroup.html
1207
+ #
1208
+ def modify_db_subnet_group(subnet_group_name, subnets, subnet_group_description = '')
1209
+ request_hash = { 'DBSubnetGroupName' => subnet_group_name}
1210
+ request_hash['DBSubnetGroupDescription'] = subnet_group_description unless subnet_group_description.right_blank?
1211
+ request_hash.merge!(amazonize_list('SubnetIds.member', subnets))
1212
+ link = generate_request('ModifyDBSubnetGroup', request_hash)
1213
+ request_info(link, DescribeDBSubnetGroupsParser.new(:logger => @logger))[:subnet_groups].first
1214
+ end
1215
+
1216
+ # Delete a DB Subnet Group.
1217
+ #
1218
+ # rds.delete_db_subnet_group("kd-subnet-group-1") #=> true
1219
+ #
1220
+ # P.S. http://docs.amazonwebservices.com/AmazonRDS/latest/APIReference/API_DeleteDBSubnetGroup.html
1221
+ #
1222
+ def delete_db_subnet_group(name)
1223
+ link = generate_request('DeleteDBSubnetGroup', 'DBSubnetGroupName' => name)
1224
+ request_info(link, RightHttp2xxParser.new(:logger => @logger))
1225
+ end
1226
+
1042
1227
  # --------------------------------------------
1043
1228
  # Parsers
1044
1229
  # --------------------------------------------
@@ -1053,8 +1238,13 @@ module RightAws
1053
1238
  end
1054
1239
  def tagstart(name, attributes)
1055
1240
  case name
1056
- when 'DBInstance' then @item = { :db_security_groups => [], :pending_modified_values => {}, :read_replica_db_instance_identifiers => [] }
1241
+ when 'DBInstance' then @item = { :db_security_groups => [],
1242
+ :pending_modified_values => {},
1243
+ :read_replica_db_instance_identifiers => [],
1244
+ :option_group_membership => {} }
1057
1245
  when 'DBSecurityGroup' then @db_security_group = {}
1246
+ when 'DBSubnetGroup' then @item[:db_subnet_group] = {}
1247
+ when 'Subnet' then @subnet = { :availability_zone => {} }
1058
1248
  when 'DBParameterGroup',
1059
1249
  'DBParameterGroupStatus' then @db_parameter_group = {}
1060
1250
  end
@@ -1074,10 +1264,10 @@ module RightAws
1074
1264
  when 'LatestRestorableTime' then @item[:latest_restorable_time] = @text
1075
1265
  when 'LicenseModel' then @item[:license_model] = @text
1076
1266
  when 'DBName' then @item[:db_name] = @text
1267
+ when 'Iops' then @item[:iops] = @text
1268
+ when 'CharacterSetName' then @item[:character_set_name] = @text
1077
1269
  when 'ReadReplicaSourceDBInstanceIdentifier' then @item[:read_replica_source_db_instance_identifier] = @text
1078
1270
  when 'ReadReplicaDBInstanceIdentifier' then @item[:read_replica_db_instance_identifiers] << @text
1079
- when 'DBSecurityGroupName' then @db_security_group[:name] = @text
1080
- when 'Status' then @db_security_group[:status] = @text
1081
1271
  when 'DBParameterGroupName' then @db_parameter_group[:name] = @text
1082
1272
  when 'ParameterApplyStatus' then @db_parameter_group[:status] = @text
1083
1273
  when 'DBSecurityGroup' then @item[:db_security_groups] << @db_security_group
@@ -1105,6 +1295,19 @@ module RightAws
1105
1295
  when %r{PendingModifiedValues/EngineVersion$} then @item[:pending_modified_values][:engine_version] = @text
1106
1296
  when %r{PendingModifiedValues/AutoMinorVersionUpgrade$} then @item[:pending_modified_values][:auto_minor_version_upgrade] = (@text == 'true')
1107
1297
  when %r{PendingModifiedValues/AllowMajorVersionUpgrade$} then @item[:pending_modified_values][:allow_major_version_upgrade] = (@text == 'true')
1298
+ when %r{OptionGroupMembership/Status$} then @item[:option_group_membership][:status] = @text
1299
+ when %r{OptionGroupMembership/OptionGroupName$} then @item[:option_group_membership][:name] = @text
1300
+ when %r{DBSecurityGroup/Status$} then @db_security_group[:status] = @text
1301
+ when %r{DBSecurityGroup/DBSecurityGroupName$} then @db_security_group[:name] = @text
1302
+ when %r{DBSubnetGroup/DBSubnetGroupDescription$} then @item[:db_subnet_group][:description] = @text
1303
+ when %r{DBSubnetGroup/DBSubnetGroupName$} then @item[:db_subnet_group][:name] = @text
1304
+ when %r{DBSubnetGroup/SubnetGroupStatus$} then @item[:db_subnet_group][:status] = @text
1305
+ when %r{Subnet/SubnetIdentifier$} then @subnet[:subnet_id] = @text
1306
+ when %r{Subnet/SubnetStatus$} then @subnet[:status] = @text
1307
+ when %r{Subnet/AvailabilityZone/Name$} then @subnet[:availability_zone][:name] = @text
1308
+ when %r{Subnet/AvailabilityZone/ProvisionedIopsCapable$} then @subnet[:availability_zone][:provisioned_iops_capable] = @text == 'true'
1309
+ when %r{DBSubnetGroup/Subnet$} then (@item[:db_subnet_group][:subnets] ||= []) << @subnet
1310
+ when %r{DBSubnetGroup/VpcId$} then @item[:db_subnet_group][:vpc_id] = @text
1108
1311
  end
1109
1312
  end
1110
1313
  end
@@ -1129,6 +1332,7 @@ module RightAws
1129
1332
  when 'LicenseModel' then @item[:license_model] = @text
1130
1333
  when 'MultiAZCapable' then @item[:multi_az_capable] = @text
1131
1334
  when 'ReadReplicaCapable' then @item[:read_replica_capable] = @text == 'true'
1335
+ when 'Vpc' then @item[:vpc] = @text == 'true'
1132
1336
  when 'Name' then @item[:availability_zones] << @text
1133
1337
  when 'OrderableDBInstanceOption' then @result[:items] << @item
1134
1338
  end
@@ -1157,11 +1361,13 @@ module RightAws
1157
1361
  when 'DBSecurityGroupDescription' then @item[:description ] = @text
1158
1362
  when 'OwnerId' then @item[:owner_id] = @text
1159
1363
  when 'DBSecurityGroupName' then @item[:name] = @text
1364
+ when 'EC2SecurityGroupId' then @ec2_security_group[:group_id] = @text
1160
1365
  when 'EC2SecurityGroupName' then @ec2_security_group[:name] = @text
1161
1366
  when 'EC2SecurityGroupOwnerId' then @ec2_security_group[:owner_id] = @text
1162
1367
  when 'CIDRIP' then @ip_range[:cidrip] = @text
1163
1368
  when 'IPRange' then @item[:ip_ranges] << @ip_range
1164
1369
  when 'EC2SecurityGroup' then @item[:ec2_security_groups] << @ec2_security_group
1370
+ when 'VpcId' then @item[:vpc_id] = @text
1165
1371
  when 'DBSecurityGroup'
1166
1372
  # Sort the ip_ranges and ec2_security_groups
1167
1373
  @item[:ip_ranges].sort!{ |i1,i2| "#{i1[:cidrip]}" <=> "#{i2[:cidrip]}" }
@@ -1262,6 +1468,9 @@ module RightAws
1262
1468
  when 'DBInstanceIdentifier' then @item[:instance_aws_id] = @text
1263
1469
  when 'DBSnapshotIdentifier' then @item[:aws_id] = @text
1264
1470
  when 'LicenseModel' then @item[:license_model] = @text
1471
+ when 'Iops' then @item[:iops] = @text
1472
+ when 'SnapshotType' then @item[:snapshot_type] = @text
1473
+ when 'VpcId' then @item[:vpc_id] = @text
1265
1474
  when 'DBSnapshot' then @result[:db_snapshots] << @item
1266
1475
  end
1267
1476
  end
@@ -1294,7 +1503,7 @@ module RightAws
1294
1503
  end
1295
1504
 
1296
1505
  # --------------------------------------------
1297
- # DB Events
1506
+ # DB Engine Versions
1298
1507
  # --------------------------------------------
1299
1508
 
1300
1509
  class DescribeDBEngineVersionsParser < RightAWSParser # :nodoc:
@@ -1304,6 +1513,11 @@ module RightAws
1304
1513
  def tagstart(name, attributes)
1305
1514
  case name
1306
1515
  when 'DBEngineVersion' then @item = {}
1516
+ else
1517
+ case full_tag_name
1518
+ when %r{DefaultCharacterSet$} then @item[:default_character_set] = {}
1519
+ when %r{SupportedCharacterSets/CharacterSet$} then @set = {}
1520
+ end
1307
1521
  end
1308
1522
  end
1309
1523
  def tagend(name)
@@ -1316,6 +1530,14 @@ module RightAws
1316
1530
  when 'DBEngineDescription' then @item[:db_engine_description] = @text
1317
1531
  when 'DBEngineVersionDescription' then @item[:db_engine_version_description] = @text
1318
1532
  when 'DBEngineVersion' then @result[:db_engine_versions] << @item
1533
+ else
1534
+ case full_tag_name
1535
+ when %r{DefaultCharacterSet/CharacterSetDescription$} then @item[:default_character_set][:description] = @text
1536
+ when %r{DefaultCharacterSet/CharacterSetName$} then @item[:default_character_set][:name] = @text
1537
+ when %r{SupportedCharacterSets/CharacterSet/CharacterSetDescription$} then @set[:description] = @text
1538
+ when %r{SupportedCharacterSets/CharacterSet/CharacterSetName$} then @set[:name] = @text
1539
+ when %r{SupportedCharacterSets/CharacterSet$} then (@item[:supported_character_sets] ||= []) << @set
1540
+ end
1319
1541
  end
1320
1542
  end
1321
1543
  end
@@ -1330,7 +1552,8 @@ module RightAws
1330
1552
  end
1331
1553
  def tagstart(name, attributes)
1332
1554
  case name
1333
- when 'ReservedDBInstancesOffering' then @item = {}
1555
+ when 'ReservedDBInstancesOffering' then @item = { :recurring_charges => [] }
1556
+ when 'RecurringCharge' then @recurring_charge = {}
1334
1557
  end
1335
1558
  end
1336
1559
  def tagend(name)
@@ -1344,8 +1567,15 @@ module RightAws
1344
1567
  when 'UsagePrice' then @item[:usage_price] = @text.to_f
1345
1568
  when 'MultiAZ' then @item[:multi_az] = (@text == 'true')
1346
1569
  when 'ProductDescription' then @item[:product_description] = @text
1570
+ when 'OfferingType' then @item[:offering_type] = @text
1347
1571
  when 'ReservedDBInstancesOfferingId' then @item[:aws_id] = @text
1572
+ when 'RecurringCharge' then @item[:recurring_charges] << @recurring_charge
1348
1573
  when 'ReservedDBInstancesOffering' then @result[:reserved_db_instances_offerings] << @item
1574
+ else
1575
+ case full_tag_name
1576
+ when %r{RecurringCharge/RecurringChargeAmount$} then @recurring_charge[:amount] = @text
1577
+ when %r{RecurringCharge/RecurringChargeFrequency$} then @recurring_charge[:frequency] = @text
1578
+ end
1349
1579
  end
1350
1580
  end
1351
1581
  end
@@ -1356,7 +1586,8 @@ module RightAws
1356
1586
  end
1357
1587
  def tagstart(name, attributes)
1358
1588
  case name
1359
- when 'ReservedDBInstance' then @item = {}
1589
+ when 'ReservedDBInstance' then @item = { :recurring_charges => [] }
1590
+ when 'RecurringCharge' then @recurring_charge = {}
1360
1591
  end
1361
1592
  end
1362
1593
  def tagend(name)
@@ -1375,7 +1606,49 @@ module RightAws
1375
1606
  when 'State' then @item[:state] = @text
1376
1607
  when 'DBInstanceCount' then @item[:instance_count] = @text.to_i
1377
1608
  when 'StartTime' then @item[:start_time] = @text
1609
+ when 'OfferingType' then @item[:offering_type] = @text
1610
+ when 'RecurringCharge' then @item[:recurring_charges] << @recurring_charge
1378
1611
  when 'ReservedDBInstance' then @result[:reserved_db_instances] << @item
1612
+ else
1613
+ case full_tag_name
1614
+ when %r{RecurringCharge/RecurringChargeAmount$} then @recurring_charge[:amount] = @text
1615
+ when %r{RecurringCharge/RecurringChargeFrequency$} then @recurring_charge[:frequency] = @text
1616
+ end
1617
+ end
1618
+ end
1619
+ end
1620
+
1621
+ # --------------------------------------------
1622
+ # DB Subnet Groups
1623
+ # --------------------------------------------
1624
+
1625
+ class DescribeDBSubnetGroupsParser < RightAWSParser # :nodoc:
1626
+ def reset
1627
+ @result = { :subnet_groups => [] }
1628
+ end
1629
+ def tagstart(name, attributes)
1630
+ case name
1631
+ when 'DBSubnetGroup' then @item = { :subnets => [] }
1632
+ when 'Subnet' then @subnet = { :availability_zone => {}}
1633
+ end
1634
+ end
1635
+ def tagend(name)
1636
+ case name
1637
+ when 'Marker' then @result[:marker] = @text
1638
+ when 'MaxRecords' then @result[:max_records] = @text.to_i
1639
+ when 'DBSubnetGroupName' then @item[:name] = @text
1640
+ when 'DBSubnetGroupDescription' then @item[:description] = @text
1641
+ when 'SubnetGroupStatus' then @item[:status] = @text
1642
+ when 'Subnet' then @item[:subnets] << @subnet
1643
+ when 'VpcId' then @item[:vpc_id] = @text
1644
+ when 'DBSubnetGroup' then @result[:subnet_groups] << @item
1645
+ else
1646
+ case full_tag_name
1647
+ when %r{Subnet/SubnetIdentifier$} then @subnet[:subnet_id] = @text
1648
+ when %r{Subnet/SubnetStatus$} then @subnet[:status] = @text
1649
+ when %r{AvailabilityZone/Name$} then @subnet[:availability_zone][:name] = @text
1650
+ when %r{AvailabilityZone/ProvisionedIopsCapable$} then @subnet[:availability_zone][:provisioned_iops_capable] = @text == 'true'
1651
+ end
1379
1652
  end
1380
1653
  end
1381
1654
  end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: right_aws
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
4
+ hash: 3
5
+ prerelease:
5
6
  segments:
6
7
  - 3
8
+ - 1
7
9
  - 0
8
- - 5
9
- version: 3.0.5
10
+ version: 3.1.0
10
11
  platform: ruby
11
12
  authors:
12
13
  - RightScale, Inc.
@@ -14,16 +15,17 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2013-03-05 00:00:00 -08:00
18
- default_executable:
18
+ date: 2013-06-13 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: right_http_connection
22
22
  prerelease: false
23
23
  requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
24
25
  requirements:
25
26
  - - ">="
26
27
  - !ruby/object:Gem::Version
28
+ hash: 21
27
29
  segments:
28
30
  - 1
29
31
  - 2
@@ -35,9 +37,11 @@ dependencies:
35
37
  name: rake
36
38
  prerelease: false
37
39
  requirement: &id002 !ruby/object:Gem::Requirement
40
+ none: false
38
41
  requirements:
39
42
  - - ">="
40
43
  - !ruby/object:Gem::Version
44
+ hash: 3
41
45
  segments:
42
46
  - 0
43
47
  version: "0"
@@ -47,9 +51,11 @@ dependencies:
47
51
  name: rcov
48
52
  prerelease: false
49
53
  requirement: &id003 !ruby/object:Gem::Requirement
54
+ none: false
50
55
  requirements:
51
56
  - - ">="
52
57
  - !ruby/object:Gem::Version
58
+ hash: 3
53
59
  segments:
54
60
  - 0
55
61
  version: "0"
@@ -180,7 +186,6 @@ files:
180
186
  - test/sqs/test_right_sqs_gen2.rb
181
187
  - test/test_credentials.rb
182
188
  - test/ts_right_aws.rb
183
- has_rdoc: true
184
189
  homepage:
185
190
  licenses: []
186
191
 
@@ -193,25 +198,29 @@ rdoc_options:
193
198
  require_paths:
194
199
  - lib
195
200
  required_ruby_version: !ruby/object:Gem::Requirement
201
+ none: false
196
202
  requirements:
197
203
  - - ">="
198
204
  - !ruby/object:Gem::Version
205
+ hash: 57
199
206
  segments:
200
207
  - 1
201
208
  - 8
202
209
  - 7
203
210
  version: 1.8.7
204
211
  required_rubygems_version: !ruby/object:Gem::Requirement
212
+ none: false
205
213
  requirements:
206
214
  - - ">="
207
215
  - !ruby/object:Gem::Version
216
+ hash: 3
208
217
  segments:
209
218
  - 0
210
219
  version: "0"
211
220
  requirements:
212
221
  - libxml-ruby >= 0.5.2.0 is encouraged
213
222
  rubyforge_project: rightaws
214
- rubygems_version: 1.3.6
223
+ rubygems_version: 1.8.5
215
224
  signing_key:
216
225
  specification_version: 3
217
226
  summary: The RightScale AWS gems have been designed to provide a robust, fast, and secure interface to Amazon EC2, EBS, S3, SQS, SDB, and CloudFront.