icehouse-right_aws 1.11.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +93 -15
- data/Manifest.txt +15 -1
- data/README.txt +0 -4
- data/Rakefile +34 -17
- data/lib/acf/right_acf_interface.rb +260 -124
- data/lib/acf/right_acf_invalidations.rb +144 -0
- data/lib/acf/right_acf_origin_access_identities.rb +230 -0
- data/lib/acf/right_acf_streaming_interface.rb +229 -0
- data/lib/acw/right_acw_interface.rb +4 -5
- data/lib/as/right_as_interface.rb +59 -51
- data/lib/awsbase/benchmark_fix.rb +0 -0
- data/lib/awsbase/right_awsbase.rb +351 -104
- data/lib/awsbase/support.rb +2 -82
- data/lib/awsbase/version.rb +9 -0
- data/lib/ec2/right_ec2.rb +97 -246
- data/lib/ec2/right_ec2_ebs.rb +88 -68
- data/lib/ec2/right_ec2_images.rb +90 -50
- data/lib/ec2/right_ec2_instances.rb +118 -89
- data/lib/ec2/right_ec2_placement_groups.rb +108 -0
- data/lib/ec2/right_ec2_reserved_instances.rb +51 -44
- data/lib/ec2/right_ec2_security_groups.rb +396 -0
- data/lib/ec2/right_ec2_spot_instances.rb +425 -0
- data/lib/ec2/right_ec2_tags.rb +139 -0
- data/lib/ec2/right_ec2_vpc.rb +152 -140
- data/lib/ec2/right_ec2_windows_mobility.rb +84 -0
- data/lib/elb/right_elb_interface.rb +205 -39
- 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 +591 -205
- data/lib/right_aws.rb +16 -12
- data/lib/route_53/right_route_53_interface.rb +640 -0
- data/lib/s3/right_s3.rb +34 -13
- data/lib/s3/right_s3_interface.rb +17 -14
- data/lib/sdb/active_sdb.rb +215 -38
- data/lib/sdb/right_sdb_interface.rb +93 -12
- 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 +9 -9
- data/lib/sqs/right_sqs_interface.rb +6 -7
- data/right_aws.gemspec +91 -0
- data/test/README.mdown +39 -0
- data/test/acf/test_helper.rb +0 -0
- data/test/acf/test_right_acf.rb +10 -18
- data/test/awsbase/test_helper.rb +0 -0
- data/test/awsbase/test_right_awsbase.rb +0 -1
- data/test/ec2/test_helper.rb +0 -0
- data/test/ec2/test_right_ec2.rb +0 -1
- data/test/elb/test_helper.rb +2 -0
- data/test/elb/test_right_elb.rb +43 -0
- data/test/http_connection.rb +0 -0
- data/test/route_53/fixtures/a_record.xml +18 -0
- data/test/route_53/fixtures/alias_record.xml +18 -0
- data/test/route_53/test_helper.rb +2 -0
- data/test/route_53/test_right_route_53.rb +141 -0
- data/test/s3/test_helper.rb +0 -0
- data/test/s3/test_right_s3.rb +11 -9
- data/test/s3/test_right_s3_stubbed.rb +6 -4
- data/test/sdb/test_active_sdb.rb +71 -13
- data/test/sdb/test_batch_put_attributes.rb +54 -0
- data/test/sdb/test_helper.rb +0 -0
- data/test/sdb/test_right_sdb.rb +13 -7
- data/test/sqs/test_helper.rb +0 -0
- data/test/sqs/test_right_sqs.rb +0 -6
- data/test/sqs/test_right_sqs_gen2.rb +22 -34
- data/test/test_credentials.rb +0 -0
- data/test/ts_right_aws.rb +0 -0
- metadata +146 -16
- data/VERSION +0 -1
@@ -0,0 +1,67 @@
|
|
1
|
+
module RightAws
|
2
|
+
|
3
|
+
class IamInterface < RightAwsBase
|
4
|
+
|
5
|
+
#-----------------------------------------------------------------
|
6
|
+
# MFADevices
|
7
|
+
#-----------------------------------------------------------------
|
8
|
+
|
9
|
+
# Lists the MFA devices associated with the specified User name.
|
10
|
+
#
|
11
|
+
# Options: :user_name, :max_items, :marker
|
12
|
+
#
|
13
|
+
def list_mfa_devices(options={}, &block)
|
14
|
+
incrementally_list_iam_resources('ListMFADevices', options, &block)
|
15
|
+
end
|
16
|
+
|
17
|
+
# Enables the specified MFA device and associates it with the specified User name.
|
18
|
+
# Once enabled, the MFA device is required for every subsequent login by the User name associated with the device.
|
19
|
+
#
|
20
|
+
# iam.enable_mfa_device('kd1', 'x12345', '12345', '67890') #=> true
|
21
|
+
#
|
22
|
+
def enable_mfa_device(user_name, serial_number, auth_code1, auth_code2)
|
23
|
+
request_hash = { 'UserName' => user_name,
|
24
|
+
'SerialNumber' => serial_number,
|
25
|
+
'AuthenticationCode1' => auth_code1,
|
26
|
+
'AuthenticationCode2' => auth_code2 }
|
27
|
+
link = generate_request("EnableMFADevice", request_hash)
|
28
|
+
request_info(link, RightHttp2xxParser.new(:logger => @logger))
|
29
|
+
end
|
30
|
+
|
31
|
+
# Synchronizes the specified MFA device with AWS servers.
|
32
|
+
#
|
33
|
+
# iam.resync_mfa_device('kd1', 'x12345', '12345', '67890') #=> true
|
34
|
+
#
|
35
|
+
def resync_mfa_device(user_name, serial_number, auth_code1, auth_code2)
|
36
|
+
request_hash = { 'UserName' => user_name,
|
37
|
+
'SerialNumber' => serial_number,
|
38
|
+
'AuthenticationCode1' => auth_code1,
|
39
|
+
'AuthenticationCode2' => auth_code2 }
|
40
|
+
link = generate_request("ResyncMFADevice", request_hash)
|
41
|
+
request_info(link, RightHttp2xxParser.new(:logger => @logger))
|
42
|
+
end
|
43
|
+
|
44
|
+
# Deactivates the specified MFA device and removes it from association with the User name for which it was originally enabled.
|
45
|
+
#
|
46
|
+
# deactivate_mfa_device('kd1', 'dev1234567890') #=> true
|
47
|
+
#
|
48
|
+
def deactivate_mfa_device(user_name, serial_number)
|
49
|
+
request_hash = { 'UserName' => user_name,
|
50
|
+
'SerialNumber' => serial_number }
|
51
|
+
link = generate_request("DeactivateMFADevice", request_hash)
|
52
|
+
request_info(link, RightHttp2xxParser.new(:logger => @logger))
|
53
|
+
end
|
54
|
+
|
55
|
+
#-----------------------------------------------------------------
|
56
|
+
# PARSERS
|
57
|
+
#-----------------------------------------------------------------
|
58
|
+
|
59
|
+
class ListMFADevicesParser < BasicIamListParser #:nodoc:
|
60
|
+
def reset
|
61
|
+
@expected_tags = %w{ SerialNumber UserName }
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
@@ -0,0 +1,251 @@
|
|
1
|
+
module RightAws
|
2
|
+
|
3
|
+
class IamInterface < RightAwsBase
|
4
|
+
|
5
|
+
#-----------------------------------------------------------------
|
6
|
+
# Users
|
7
|
+
#-----------------------------------------------------------------
|
8
|
+
|
9
|
+
# Lists the Users that have the specified path prefix.
|
10
|
+
#
|
11
|
+
# Options: :path_prefix, :max_items, :marker
|
12
|
+
#
|
13
|
+
# iam.list_users #=>
|
14
|
+
# [{:user_name=>"kd",
|
15
|
+
# :user_id=>"AI000000000000000006A",
|
16
|
+
# :arn=>"arn:aws:iam::640000000037:user/kd",
|
17
|
+
# :path=>"/"}]
|
18
|
+
#
|
19
|
+
def list_users(options={}, &block)
|
20
|
+
incrementally_list_iam_resources('ListUsers', options, &block)
|
21
|
+
end
|
22
|
+
|
23
|
+
# Creates a new User for your AWS Account.
|
24
|
+
#
|
25
|
+
# Options: :path
|
26
|
+
#
|
27
|
+
# iam.create_user('kd') #=>
|
28
|
+
# {:user_name=>"kd",
|
29
|
+
# :user_id=>"AI000000000000000006A",
|
30
|
+
# :arn=>"arn:aws:iam::640000000037:user/kd",
|
31
|
+
# :path=>"/"}
|
32
|
+
#
|
33
|
+
def create_user(user_name, options={})
|
34
|
+
request_hash = { 'UserName' => user_name }
|
35
|
+
request_hash['Path'] = options[:path] unless options[:path]
|
36
|
+
link = generate_request("CreateUser", request_hash)
|
37
|
+
request_info(link, GetUserParser.new(:logger => @logger))
|
38
|
+
end
|
39
|
+
|
40
|
+
# Updates the name and/or the path of the specified User.
|
41
|
+
#
|
42
|
+
# iam.update_user('kd1', :new_user_name => 'kd1', :new_path => '/kd1/') #=> true
|
43
|
+
#
|
44
|
+
def update_user(user_name, options={})
|
45
|
+
request_hash = { 'UserName' => user_name}
|
46
|
+
request_hash['NewUserName'] = options[:new_user_name] unless options[:new_user_name].right_blank?
|
47
|
+
request_hash['NewPath'] = options[:new_path] unless options[:new_path].right_blank?
|
48
|
+
link = generate_request("UpdateUser", request_hash)
|
49
|
+
request_info(link, RightHttp2xxParser.new(:logger => @logger))
|
50
|
+
end
|
51
|
+
|
52
|
+
# Retrieves information about the specified User, including the User's path, GUID, and ARN.
|
53
|
+
#
|
54
|
+
# iam.get_user('kd') #=>
|
55
|
+
# {:user_name=>"kd",
|
56
|
+
# :user_id=>"AI000000000000000006A",
|
57
|
+
# :arn=>"arn:aws:iam::640000000037:user/kd",
|
58
|
+
# :path=>"/"}
|
59
|
+
#
|
60
|
+
def get_user(user_name)
|
61
|
+
request_hash = { 'UserName' => user_name }
|
62
|
+
link = generate_request("GetUser", request_hash)
|
63
|
+
request_info(link, GetUserParser.new(:logger => @logger))
|
64
|
+
end
|
65
|
+
|
66
|
+
# Deletes the specified User. The User must not belong to any groups, have any keys or signing certificates, or have any attached policies.
|
67
|
+
#
|
68
|
+
# iam.delete_user('kd') #=> true
|
69
|
+
#
|
70
|
+
def delete_user(user_name)
|
71
|
+
request_hash = { 'UserName' => user_name }
|
72
|
+
link = generate_request("DeleteUser", request_hash)
|
73
|
+
request_info(link, RightHttp2xxParser.new(:logger => @logger))
|
74
|
+
end
|
75
|
+
|
76
|
+
#-----------------------------------------------------------------
|
77
|
+
# User Policies
|
78
|
+
#-----------------------------------------------------------------
|
79
|
+
|
80
|
+
# Lists the names of the policies associated with the specified User.
|
81
|
+
#
|
82
|
+
# Options: :max_items, :marker
|
83
|
+
#
|
84
|
+
# iam.list_user_policies('kd') #=> ["kd_user_policy_1"]
|
85
|
+
#
|
86
|
+
def list_user_policies(user_name, options={}, &block)
|
87
|
+
options[:user_name] = user_name
|
88
|
+
incrementally_list_iam_resources('ListUserPolicies', options, :parser => BasicIamListParser, &block)
|
89
|
+
end
|
90
|
+
|
91
|
+
# Adds (or updates) a policy document associated with the specified User
|
92
|
+
#
|
93
|
+
# iam.put_user_policy('kd', 'kd_user_policy_1', %Q({"Statement":[{"Effect":"Allow","Action":"*","Resource":"*"}]})) #=> true
|
94
|
+
#
|
95
|
+
def put_user_policy(user_name, policy_name, policy_document)
|
96
|
+
request_hash = { 'UserName' => user_name,
|
97
|
+
'PolicyDocument' => policy_document,
|
98
|
+
'PolicyName' => policy_name }
|
99
|
+
link = generate_request_impl(:post, "PutUserPolicy", request_hash)
|
100
|
+
request_info(link, RightHttp2xxParser.new(:logger => @logger))
|
101
|
+
end
|
102
|
+
|
103
|
+
# Retrieves the specified policy document for the specified User.
|
104
|
+
#
|
105
|
+
# iam.get_user_policy('kd','kd_user_policy_1') #=>
|
106
|
+
# {:user_name=>"kd",
|
107
|
+
# :policy_name=>"kd_user_policy_1",
|
108
|
+
# :policy_document=>"{\"Statement\":[{\"Effect\":\"Allow\",\"Action\":\"*\",\"Resource\":\"*\"}]}"}
|
109
|
+
#
|
110
|
+
def get_user_policy(user_name, policy_name)
|
111
|
+
request_hash = { 'UserName' => user_name,
|
112
|
+
'PolicyName' => policy_name }
|
113
|
+
link = generate_request("GetUserPolicy", request_hash)
|
114
|
+
result = request_info(link, GetUserPolicyParser.new(:logger => @logger))
|
115
|
+
result[:policy_document] = URI::decode(result[:policy_document])
|
116
|
+
result
|
117
|
+
end
|
118
|
+
|
119
|
+
# Deletes the specified policy associated with the specified User.
|
120
|
+
#
|
121
|
+
# iam.delete_user_policy('kd','kd_user_policy_1') #=> true
|
122
|
+
#
|
123
|
+
def delete_user_policy(user_name, policy_name)
|
124
|
+
request_hash = { 'UserName' => user_name,
|
125
|
+
'PolicyName' => policy_name }
|
126
|
+
link = generate_request("DeleteUserPolicy", request_hash)
|
127
|
+
request_info(link, RightHttp2xxParser.new(:logger => @logger))
|
128
|
+
end
|
129
|
+
|
130
|
+
#-----------------------------------------------------------------
|
131
|
+
# User Groups
|
132
|
+
#-----------------------------------------------------------------
|
133
|
+
|
134
|
+
# Lists the names of the policies associated with the specified group. If there are none,
|
135
|
+
# the action returns an empty list.
|
136
|
+
#
|
137
|
+
# Options: :max_items, :marker
|
138
|
+
#
|
139
|
+
# iam.list_groups_for_user('kd') #=>
|
140
|
+
# [{:group_name=>"kd_test_1",
|
141
|
+
# :group_id=>"AGP000000000000000UTY",
|
142
|
+
# :arn=>"arn:aws:iam::640000000037:group/kd1/kd_test_1",
|
143
|
+
# :path=>"/kd1/"}]
|
144
|
+
#
|
145
|
+
def list_groups_for_user(user_name, options={}, &block)
|
146
|
+
options[:user_name] = user_name
|
147
|
+
incrementally_list_iam_resources('ListGroupsForUser', options, :parser => ListGroupsParser, &block)
|
148
|
+
end
|
149
|
+
|
150
|
+
# Adds the specified User to the specified group.
|
151
|
+
#
|
152
|
+
# iam.add_user_to_group('kd', 'kd_test_1') #=> true
|
153
|
+
#
|
154
|
+
def add_user_to_group(user_name, group_name)
|
155
|
+
request_hash = { 'UserName' => user_name,
|
156
|
+
'GroupName' => group_name }
|
157
|
+
link = generate_request("AddUserToGroup", request_hash)
|
158
|
+
request_info(link, RightHttp2xxParser.new(:logger => @logger))
|
159
|
+
end
|
160
|
+
|
161
|
+
# Removes the specified User from the specified group.
|
162
|
+
#
|
163
|
+
# iam.remove_user_from_group('kd', 'kd_test_1') #=> true
|
164
|
+
#
|
165
|
+
def remove_user_from_group(user_name, group_name)
|
166
|
+
request_hash = { 'UserName' => user_name,
|
167
|
+
'GroupName' => group_name }
|
168
|
+
link = generate_request("RemoveUserFromGroup", request_hash)
|
169
|
+
request_info(link, RightHttp2xxParser.new(:logger => @logger))
|
170
|
+
end
|
171
|
+
|
172
|
+
#-----------------------------------------------------------------
|
173
|
+
# User Login Profiles
|
174
|
+
#-----------------------------------------------------------------
|
175
|
+
|
176
|
+
# Creates a login profile for the specified User, giving the User the ability to access
|
177
|
+
# AWS services such as the AWS Management Console.
|
178
|
+
#
|
179
|
+
# iam.create_login_profile('kd','q1w2e3r4t5') #=> { :user_name => 'kd' }
|
180
|
+
#
|
181
|
+
def create_login_profile(user_name, password)
|
182
|
+
request_hash = { 'UserName' => user_name,
|
183
|
+
'Password' => password}
|
184
|
+
link = generate_request("CreateLoginProfile", request_hash)
|
185
|
+
request_info(link, GetLoginProfileParser.new(:logger => @logger))
|
186
|
+
end
|
187
|
+
|
188
|
+
# Updates the login profile for the specified User. Use this API to change the User's password.
|
189
|
+
#
|
190
|
+
# update_login_profile('kd', '00000000') #=> true
|
191
|
+
#
|
192
|
+
def update_login_profile(user_name, options={})
|
193
|
+
request_hash = { 'UserName' => user_name}
|
194
|
+
request_hash['Password'] = options[:password] unless options[:passwrod].right_blank?
|
195
|
+
link = generate_request("UpdateLoginProfile", request_hash)
|
196
|
+
request_info(link, RightHttp2xxParser.new(:logger => @logger))
|
197
|
+
end
|
198
|
+
|
199
|
+
# Retrieves the login profile for the specified User
|
200
|
+
#
|
201
|
+
# iam.create_login_profile('kd','q1w2e3r4t5') #=> { :user_name => 'kd' }
|
202
|
+
#
|
203
|
+
def get_login_profile(user_name)
|
204
|
+
request_hash = { 'UserName' => user_name }
|
205
|
+
link = generate_request("GetLoginProfile", request_hash)
|
206
|
+
request_info(link, GetLoginProfileParser.new(:logger => @logger))
|
207
|
+
end
|
208
|
+
|
209
|
+
# Deletes the login profile for the specified User, which terminates the User's ability to access
|
210
|
+
# AWS services through the IAM login page.
|
211
|
+
#
|
212
|
+
# iam.delete_login_profile('kd') #=> true
|
213
|
+
#
|
214
|
+
def delete_login_profile(user_name)
|
215
|
+
request_hash = { 'UserName' => user_name }
|
216
|
+
link = generate_request("DeleteLoginProfile", request_hash)
|
217
|
+
request_info(link, RightHttp2xxParser.new(:logger => @logger))
|
218
|
+
end
|
219
|
+
|
220
|
+
#-----------------------------------------------------------------
|
221
|
+
# PARSERS
|
222
|
+
#-----------------------------------------------------------------
|
223
|
+
|
224
|
+
class ListUsersParser < BasicIamListParser #:nodoc:
|
225
|
+
def reset
|
226
|
+
@expected_tags = %w{ Arn Path UserId UserName }
|
227
|
+
end
|
228
|
+
end
|
229
|
+
|
230
|
+
class GetUserParser < BasicIamParser #:nodoc:
|
231
|
+
def reset
|
232
|
+
@expected_tags = %w{ Arn Path UserId UserName }
|
233
|
+
end
|
234
|
+
end
|
235
|
+
|
236
|
+
class GetUserPolicyParser < BasicIamParser #:nodoc:
|
237
|
+
def reset
|
238
|
+
@expected_tags = %w{ PolicyDocument PolicyName UserName }
|
239
|
+
end
|
240
|
+
end
|
241
|
+
|
242
|
+
class GetLoginProfileParser < BasicIamParser #:nodoc:
|
243
|
+
def reset
|
244
|
+
@expected_tags = %w{ UserName }
|
245
|
+
end
|
246
|
+
end
|
247
|
+
|
248
|
+
end
|
249
|
+
|
250
|
+
end
|
251
|
+
|
@@ -27,14 +27,15 @@ module RightAws
|
|
27
27
|
|
28
28
|
include RightAwsBaseInterface
|
29
29
|
|
30
|
-
API_VERSION = "
|
30
|
+
API_VERSION = "2011-04-01"
|
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.4xlarge']
|
37
|
+
INSTANCE_CLASSES = ['db.m1.small', 'db.m1.large', 'db.m1.xlarge', 'db.m2.2xlarge', 'db.m2.2xlarge', 'db.m2.4xlarge']
|
38
|
+
LICENSE_MODELS = ['bring-your-own-license', 'license-included', 'general-public-license']
|
38
39
|
|
39
40
|
@@bench = AwsBenchmarkingBlock.new
|
40
41
|
def self.bench_xml
|
@@ -51,7 +52,6 @@ module RightAws
|
|
51
52
|
# * <tt>:server</tt>: RDS service host, default: DEFAULT_HOST
|
52
53
|
# * <tt>:port</tt>: RDS service port, default: DEFAULT_PORT
|
53
54
|
# * <tt>:protocol</tt>: 'http' or 'https', default: DEFAULT_PROTOCOL
|
54
|
-
# * <tt>:multi_thread</tt>: true=HTTP connection per thread, false=per process
|
55
55
|
# * <tt>:logger</tt>: for log messages, default: RAILS_DEFAULT_LOGGER else STDOUT
|
56
56
|
#
|
57
57
|
# rds = RightAws::RdsInterface.new('xxxxxxxxxxxxxxxxxxxxx','xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
|
@@ -94,7 +94,7 @@ module RightAws
|
|
94
94
|
link = generate_request(action, params)
|
95
95
|
last_response = request_info( link, parser_class.new(:logger => @logger))
|
96
96
|
params['Marker'] = last_response[:marker]
|
97
|
-
break unless block && block.call(last_response) && !last_response[:marker].
|
97
|
+
break unless block && block.call(last_response) && !last_response[:marker].right_blank?
|
98
98
|
end
|
99
99
|
last_response
|
100
100
|
end
|
@@ -113,20 +113,23 @@ module RightAws
|
|
113
113
|
#
|
114
114
|
# # Get a list of DB instances. The response is an +Array+ of instances.
|
115
115
|
# rds.describe_db_instances #=>
|
116
|
-
# [{:instance_class=>"
|
116
|
+
# [{:instance_class=>"db.m1.small",
|
117
117
|
# :status=>"creating",
|
118
|
-
# :
|
119
|
-
# :
|
120
|
-
# :pending_modified_values=>{},
|
121
|
-
# :db_parameter_group=>{:status=>"in-sync", :name=>"default.MySQL5.1"},
|
122
|
-
# :db_security_groups=>
|
123
|
-
# [{:status=>"active", :name=>"kd-2-test"},
|
124
|
-
# {:status=>"active", :name=>"default"},
|
125
|
-
# {:status=>"active", :name=>"kd-1-test"}],
|
126
|
-
# :availability_zone=>"us-east-1b",
|
118
|
+
# :backup_retention_period=>1,
|
119
|
+
# :read_replica_db_instance_identifiers=>["kd-delete-me-01-replica-01"],
|
127
120
|
# :master_username=>"username",
|
128
|
-
# :
|
129
|
-
# :
|
121
|
+
# :preferred_maintenance_window=>"sun:05:00-sun:09:00",
|
122
|
+
# :db_parameter_group=>{:status=>"in-sync", :name=>"default.mysql5.1"},
|
123
|
+
# :multi_az=>true,
|
124
|
+
# :engine=>"mysql",
|
125
|
+
# :auto_minor_version_upgrade=>false,
|
126
|
+
# :allocated_storage=>25,
|
127
|
+
# :availability_zone=>"us-east-1d",
|
128
|
+
# :aws_id=>"kd-delete-me-01",
|
129
|
+
# :preferred_backup_window=>"03:00-05:00",
|
130
|
+
# :engine_version=>"5.1.50",
|
131
|
+
# :pending_modified_values=>{:master_user_password=>"****"},
|
132
|
+
# :db_security_groups=>[{:status=>"active", :name=>"default"}]}]
|
130
133
|
#
|
131
134
|
# # Retrieve a custom DB instance.
|
132
135
|
# # The response is an +Array+ with a single instance record.
|
@@ -136,27 +139,30 @@ module RightAws
|
|
136
139
|
# rds.describe_db_instances(:max_records => 30) do |x|
|
137
140
|
# puts x.inspect #=>
|
138
141
|
# {:db_instances=>
|
139
|
-
# [{:instance_class=>"
|
142
|
+
# [{:instance_class=>"db.m1.small",
|
140
143
|
# :status=>"creating",
|
141
|
-
# :
|
142
|
-
# :
|
143
|
-
# :pending_modified_values=>{},
|
144
|
-
# :db_parameter_group=>{:status=>"in-sync", :name=>"default.MySQL5.1"},
|
145
|
-
# :db_security_groups=>
|
146
|
-
# [{:status=>"active", :name=>"kd-2-test"},
|
147
|
-
# {:status=>"active", :name=>"default"},
|
148
|
-
# {:status=>"active", :name=>"kd-1-test"}],
|
149
|
-
# :availability_zone=>"us-east-1b",
|
144
|
+
# :backup_retention_period=>1,
|
145
|
+
# :read_replica_db_instance_identifiers=>["kd-delete-me-01-replica-01"],
|
150
146
|
# :master_username=>"username",
|
151
|
-
# :
|
152
|
-
# :
|
147
|
+
# :preferred_maintenance_window=>"sun:05:00-sun:09:00",
|
148
|
+
# :db_parameter_group=>{:status=>"in-sync", :name=>"default.mysql5.1"},
|
149
|
+
# :multi_az=>true,
|
150
|
+
# :engine=>"mysql",
|
151
|
+
# :auto_minor_version_upgrade=>false,
|
152
|
+
# :allocated_storage=>25,
|
153
|
+
# :availability_zone=>"us-east-1d",
|
154
|
+
# :aws_id=>"kd-delete-me-01",
|
155
|
+
# :preferred_backup_window=>"03:00-05:00",
|
156
|
+
# :engine_version=>"5.1.50",
|
157
|
+
# :pending_modified_values=>{:master_user_password=>"****"},
|
158
|
+
# :db_security_groups=>[{:status=>"active", :name=>"default"}]}]}
|
153
159
|
# true
|
154
160
|
# end
|
155
161
|
#
|
156
|
-
def describe_db_instances(params
|
162
|
+
def describe_db_instances(*params, &block)
|
157
163
|
item, params = AwsUtils::split_items_and_params(params)
|
158
164
|
params = params.dup
|
159
|
-
params['DBInstanceIdentifier'] = item
|
165
|
+
params['DBInstanceIdentifier'] = item.first unless item.right_blank?
|
160
166
|
result = []
|
161
167
|
incrementally_list_items('DescribeDBInstances', DescribeDbInstancesParser, params) do |response|
|
162
168
|
result += response[:db_instances]
|
@@ -168,24 +174,31 @@ module RightAws
|
|
168
174
|
# Create a new RDS instance of the type and size specified by you. The default storage engine for RDS Instances is InnoDB.
|
169
175
|
#
|
170
176
|
# Mandatory arguments: +aws_id+, +master_username+, +master_user_password+
|
171
|
-
# Optional params: +:allocated_storage+ (25 by def), +:instance_class+, +:engine+ ('
|
177
|
+
# Optional params: +:allocated_storage+ (25 by def), +:instance_class+, +:engine+ ('MySQL' by def),
|
172
178
|
# +:endpoint_port+, +:db_name+, +:db_security_groups+, +:db_parameter_group+, +:availability_zone+, +:preferred_maintenance_window+
|
173
|
-
# +:backup_retention_period+, +:preferred_backup_window
|
179
|
+
# +:backup_retention_period+, +:preferred_backup_window+, +:multi_az+, +:engine_version+, +:auto_minor_version_upgrade+,
|
180
|
+
# +:license_model+
|
174
181
|
#
|
175
|
-
#
|
176
|
-
#
|
177
|
-
#
|
178
|
-
#
|
179
|
-
#
|
180
|
-
#
|
181
|
-
#
|
182
|
-
#
|
183
|
-
#
|
184
|
-
#
|
185
|
-
#
|
186
|
-
#
|
187
|
-
#
|
188
|
-
#
|
182
|
+
# rds.create_db_instance('kd-delete-me-01', 'username', 'password',
|
183
|
+
# :instance_class => 'db.m1.small',
|
184
|
+
# :multi_az => true,
|
185
|
+
# :auto_minor_version_upgrade => false ) #=>
|
186
|
+
# {:instance_class=>"db.m1.small",
|
187
|
+
# :multi_az=>true,
|
188
|
+
# :status=>"creating",
|
189
|
+
# :backup_retention_period=>1,
|
190
|
+
# :read_replica_db_instance_identifiers=>[],
|
191
|
+
# :master_username=>"username",
|
192
|
+
# :preferred_maintenance_window=>"sun:05:00-sun:09:00",
|
193
|
+
# :auto_minor_version_upgrade=>false,
|
194
|
+
# :db_parameter_group=>{:status=>"in-sync", :name=>"default.mysql5.1"},
|
195
|
+
# :engine=>"mysql",
|
196
|
+
# :allocated_storage=>25,
|
197
|
+
# :aws_id=>"kd-delete-me-01",
|
198
|
+
# :preferred_backup_window=>"03:00-05:00",
|
199
|
+
# :engine_version=>"5.1.50",
|
200
|
+
# :pending_modified_values=>{:master_user_password=>"****"},
|
201
|
+
# :db_security_groups=>[{:status=>"active", :name=>"default"}]}
|
189
202
|
#
|
190
203
|
def create_db_instance(aws_id, master_username, master_user_password, params={})
|
191
204
|
request_hash = {}
|
@@ -194,19 +207,22 @@ module RightAws
|
|
194
207
|
request_hash['MasterUsername'] = master_username
|
195
208
|
request_hash['MasterUserPassword'] = master_user_password
|
196
209
|
# Mandatory with default values
|
197
|
-
request_hash['DBInstanceClass']
|
198
|
-
request_hash['AllocatedStorage']
|
199
|
-
request_hash['Engine']
|
210
|
+
request_hash['DBInstanceClass'] = params[:instance_class].right_blank? ? DEFAULT_INSTANCE_CLASS : params[:instance_class].to_s
|
211
|
+
request_hash['AllocatedStorage'] = params[:allocated_storage].right_blank? ? 25 : params[:allocated_storage]
|
212
|
+
request_hash['Engine'] = params[:engine].right_blank? ? 'mysql' : params[:engine]
|
200
213
|
# Optional
|
201
|
-
request_hash['
|
202
|
-
request_hash['DBName'] = params[:db_name]
|
203
|
-
request_hash['AvailabilityZone'] = params[:availability_zone]
|
204
|
-
request_hash['
|
205
|
-
request_hash['
|
206
|
-
request_hash['
|
214
|
+
request_hash['Port'] = params[:endpoint_port] unless params[:endpoint_port].right_blank?
|
215
|
+
request_hash['DBName'] = params[:db_name] unless params[:db_name].right_blank?
|
216
|
+
request_hash['AvailabilityZone'] = params[:availability_zone] unless params[:availability_zone].right_blank?
|
217
|
+
request_hash['MultiAZ'] = params[:multi_az].to_s unless params[:multi_az].nil?
|
218
|
+
request_hash['PreferredMaintenanceWindow'] = params[:preferred_maintenance_window] unless params[:preferred_maintenance_window].right_blank?
|
219
|
+
request_hash['BackupRetentionPeriod'] = params[:backup_retention_period] unless params[:backup_retention_period].right_blank?
|
220
|
+
request_hash['PreferredBackupWindow'] = params[:preferred_backup_window] unless params[:preferred_backup_window].right_blank?
|
221
|
+
request_hash['DBParameterGroupName'] = params[:db_parameter_group] unless params[:db_parameter_group].right_blank?
|
222
|
+
request_hash['EngineVersion'] = params[:engine_version] unless params[:engine_version].right_blank?
|
223
|
+
request_hash['AutoMinorVersionUpgrade'] = params[:auto_minor_version_upgrade].to_s unless params[:auto_minor_version_upgrade].nil?
|
224
|
+
request_hash['LicenseModel'] = params[:license_model] unless params[:license_model].right_blank?
|
207
225
|
request_hash.merge!(amazonize_list('DBSecurityGroups.member', params[:db_security_groups]))
|
208
|
-
# request_hash.merge!(amazonize_list('DBParameterGroups.member', params[:db_parameter_groups]))
|
209
|
-
request_hash['DBParameterGroup'] = params[:db_parameter_group] unless params[:db_parameter_group].blank?
|
210
226
|
link = generate_request('CreateDBInstance', request_hash)
|
211
227
|
request_info(link, DescribeDbInstancesParser.new(:logger => @logger))[:db_instances].first
|
212
228
|
end
|
@@ -216,23 +232,60 @@ module RightAws
|
|
216
232
|
# Mandatory arguments: +aws_id+.
|
217
233
|
# Optional params: +:master_user_password+, +:instance_class+, +:db_security_groups+,
|
218
234
|
# +:db_parameter_group+, +:preferred_maintenance_window+, +:allocated_storage+, +:apply_immediately+,
|
219
|
-
# +:backup_retention_period+, +:preferred_backup_window
|
235
|
+
# +:backup_retention_period+, +:preferred_backup_window+, +:multi_az+, +:engine_version+,
|
236
|
+
# +:auto_minor_version_upgrade+, +:allow_major_version_upgrade+
|
237
|
+
#
|
238
|
+
# rds.modify_db_instance('kd-delete-me-01',
|
239
|
+
# :master_user_password => 'newpassword',
|
240
|
+
# :instance_class => 'db.m1.large',
|
241
|
+
# :multi_az => false,
|
242
|
+
# :allocated_storage => 30,
|
243
|
+
# :allow_major_version_upgrade => true,
|
244
|
+
# :auto_minor_version_upgrade => true,
|
245
|
+
# :preferred_maintenance_window => 'sun:06:00-sun:10:00',
|
246
|
+
# :preferred_backup_window => '02:00-04:00',
|
247
|
+
# :apply_immediately => true,
|
248
|
+
# :backup_retention_period => 2) #=>
|
249
|
+
# {:engine_version=>"5.1.50",
|
250
|
+
# :aws_id=>"kd-delete-me-01",
|
251
|
+
# :multi_az=>true,
|
252
|
+
# :status=>"available",
|
253
|
+
# :read_replica_db_instance_identifiers=>[],
|
254
|
+
# :availability_zone=>"us-east-1d",
|
255
|
+
# :auto_minor_version_upgrade=>true,
|
256
|
+
# :master_username=>"username",
|
257
|
+
# :preferred_maintenance_window=>"sun:06:00-sun:10:00",
|
258
|
+
# :db_parameter_group=>{:status=>"in-sync", :name=>"default.mysql5.1"},
|
259
|
+
# :create_time=>"2010-11-17T10:21:59.720Z",
|
260
|
+
# :preferred_backup_window=>"02:00-04:00",
|
261
|
+
# :engine=>"mysql",
|
262
|
+
# :db_security_groups=>[{:status=>"active", :name=>"default"}],
|
263
|
+
# :endpoint_address=>"kd-delete-me-01.chxspydgchoo.us-east-1.rds.amazonaws.com",
|
264
|
+
# :instance_class=>"db.m1.small",
|
265
|
+
# :latest_restorable_time=>"2010-11-17T10:27:17.089Z",
|
266
|
+
# :backup_retention_period=>2,
|
267
|
+
# :pending_modified_values=>
|
268
|
+
# {:multi_az=>false, :master_user_password=>"****", :allocated_storage=>30, :instance_class=>"db.m1.large"},
|
269
|
+
# :allocated_storage=>25}
|
220
270
|
#
|
221
271
|
def modify_db_instance(aws_id, params={})
|
222
272
|
request_hash = {}
|
223
273
|
# Mandatory
|
224
274
|
request_hash['DBInstanceIdentifier'] = aws_id
|
225
275
|
# Optional
|
226
|
-
request_hash['MasterUserPassword'] = params[:master_user_password]
|
227
|
-
request_hash['DBInstanceClass'] = params[:instance_class].to_s.capitalize
|
228
|
-
request_hash['PreferredMaintenanceWindow'] = params[:preferred_maintenance_window]
|
229
|
-
request_hash['BackupRetentionPeriod'] = params[:backup_retention_period]
|
230
|
-
request_hash['PreferredBackupWindow'] = params[:preferred_backup_window]
|
231
|
-
request_hash['AllocatedStorage'] = params[:allocated_storage]
|
232
|
-
request_hash['
|
276
|
+
request_hash['MasterUserPassword'] = params[:master_user_password] unless params[:master_user_password].right_blank?
|
277
|
+
request_hash['DBInstanceClass'] = params[:instance_class].to_s.capitalize unless params[:instance_class].right_blank?
|
278
|
+
request_hash['PreferredMaintenanceWindow'] = params[:preferred_maintenance_window] unless params[:preferred_maintenance_window].right_blank?
|
279
|
+
request_hash['BackupRetentionPeriod'] = params[:backup_retention_period] unless params[:backup_retention_period].right_blank?
|
280
|
+
request_hash['PreferredBackupWindow'] = params[:preferred_backup_window] unless params[:preferred_backup_window].right_blank?
|
281
|
+
request_hash['AllocatedStorage'] = params[:allocated_storage] unless params[:allocated_storage].right_blank?
|
282
|
+
request_hash['MultiAZ'] = params[:multi_az].to_s unless params[:multi_az].nil?
|
283
|
+
request_hash['EngineVersion'] = params[:engine_version] unless params[:engine_version].right_blank?
|
284
|
+
request_hash['AutoMinorVersionUpgrade'] = params[:auto_minor_version_upgrade].to_s unless params[:auto_minor_version_upgrade].nil?
|
285
|
+
request_hash['AllowMajorVersionUpgrade'] = params[:allow_major_version_upgrade].to_s unless params[:allow_major_version_upgrade].nil?
|
286
|
+
request_hash['ApplyImmediately'] = params[:apply_immediately].to_s unless params[:apply_immediately].right_blank?
|
233
287
|
request_hash.merge!(amazonize_list('DBSecurityGroups.member', params[:db_security_groups]))
|
234
|
-
|
235
|
-
request_hash['DBParameterGroupName'] = params[:db_parameter_group] unless params[:db_parameter_group].blank?
|
288
|
+
request_hash['DBParameterGroupName'] = params[:db_parameter_group] unless params[:db_parameter_group].right_blank?
|
236
289
|
link = generate_request('ModifyDBInstance', request_hash)
|
237
290
|
request_info(link, DescribeDbInstancesParser.new(:logger => @logger))[:db_instances].first
|
238
291
|
end
|
@@ -271,11 +324,11 @@ module RightAws
|
|
271
324
|
request_hash = {}
|
272
325
|
request_hash['DBInstanceIdentifier'] = aws_id
|
273
326
|
request_hash['SkipFinalSnapshot'] = params.has_key?(:skip_final_snapshot) ? params[:skip_final_snapshot].to_s : 'false'
|
274
|
-
if request_hash['SkipFinalSnapshot'] == 'false' && params[:snapshot_aws_id].
|
327
|
+
if request_hash['SkipFinalSnapshot'] == 'false' && params[:snapshot_aws_id].right_blank?
|
275
328
|
params = params.dup
|
276
329
|
params[:snapshot_aws_id] = "#{aws_id}-final-snapshot-#{Time.now.utc.strftime('%Y%m%d%H%M%S')}"
|
277
330
|
end
|
278
|
-
request_hash['FinalDBSnapshotIdentifier'] = params[:snapshot_aws_id] unless params[:snapshot_aws_id].
|
331
|
+
request_hash['FinalDBSnapshotIdentifier'] = params[:snapshot_aws_id] unless params[:snapshot_aws_id].right_blank?
|
279
332
|
link = generate_request('DeleteDBInstance', request_hash)
|
280
333
|
request_info(link, DescribeDbInstancesParser.new(:logger => @logger))[:db_instances].first
|
281
334
|
end
|
@@ -316,8 +369,8 @@ module RightAws
|
|
316
369
|
# rds.describe_db_security_groups('kd3')
|
317
370
|
#
|
318
371
|
def describe_db_security_groups(*db_security_group_name, &block)
|
319
|
-
|
320
|
-
params['DBSecurityGroupName'] =
|
372
|
+
items, params = AwsUtils::split_items_and_params(db_security_group_name)
|
373
|
+
params['DBSecurityGroupName'] = items.first unless items.right_blank?
|
321
374
|
result = []
|
322
375
|
incrementally_list_items('DescribeDBSecurityGroups', DescribeDbSecurityGroupsParser, params) do |response|
|
323
376
|
result += response[:db_security_groups]
|
@@ -344,9 +397,9 @@ module RightAws
|
|
344
397
|
|
345
398
|
def modify_db_security_group_ingress(action, db_security_group_name, params={}) # :nodoc:
|
346
399
|
request_hash = { 'DBSecurityGroupName' => db_security_group_name}
|
347
|
-
request_hash['CIDRIP'] = params[:cidrip] unless params[:cidrip].
|
348
|
-
request_hash['EC2SecurityGroupName'] = params[:ec2_security_group_name] unless params[:ec2_security_group_name].
|
349
|
-
request_hash['EC2SecurityGroupOwnerId'] = params[:ec2_security_group_owner] unless params[:ec2_security_group_owner].
|
400
|
+
request_hash['CIDRIP'] = params[:cidrip] unless params[:cidrip].right_blank?
|
401
|
+
request_hash['EC2SecurityGroupName'] = params[:ec2_security_group_name] unless params[:ec2_security_group_name].right_blank?
|
402
|
+
request_hash['EC2SecurityGroupOwnerId'] = params[:ec2_security_group_owner] unless params[:ec2_security_group_owner].right_blank?
|
350
403
|
link = generate_request(action, request_hash)
|
351
404
|
request_info(link, DescribeDbSecurityGroupsParser.new(:logger => @logger))[:db_security_groups].first
|
352
405
|
end
|
@@ -433,8 +486,8 @@ module RightAws
|
|
433
486
|
# end
|
434
487
|
#
|
435
488
|
def describe_db_parameter_groups(*db_parameter_group_name, &block)
|
436
|
-
|
437
|
-
params['DBParameterGroupName'] =
|
489
|
+
items, params = AwsUtils::split_items_and_params(db_parameter_group_name)
|
490
|
+
params['DBParameterGroupName'] = items.first unless items.right_blank?
|
438
491
|
result = []
|
439
492
|
incrementally_list_items('DescribeDBParameterGroups', DescribeDbParameterGroupsParser, params) do |response|
|
440
493
|
result += response[:db_parameter_groups]
|
@@ -449,15 +502,14 @@ module RightAws
|
|
449
502
|
#
|
450
503
|
# TODO: this call returns an empty hash, but should be a parameter group data - ask Amazon guys.
|
451
504
|
#
|
452
|
-
def create_db_parameter_group(db_parameter_group_name, db_parameter_group_description,
|
453
|
-
params['DBParameterGroupName']
|
454
|
-
params['Description']
|
455
|
-
params['
|
505
|
+
def create_db_parameter_group(db_parameter_group_name, db_parameter_group_description, db_parameter_group_family='mysql5.1', params={})
|
506
|
+
params['DBParameterGroupName'] = db_parameter_group_name
|
507
|
+
params['Description'] = db_parameter_group_description
|
508
|
+
params['DBParameterGroupFamily'] = db_parameter_group_family
|
456
509
|
link = generate_request('CreateDBParameterGroup', params )
|
457
510
|
request_info(link, DescribeDbParameterGroupsParser.new(:logger => @logger))[:db_parameter_groups].first
|
458
511
|
end
|
459
512
|
|
460
|
-
|
461
513
|
# Modify DBParameterGroup paramaters. Up to 20 params can be midified at once.
|
462
514
|
#
|
463
515
|
# rds.modify_db_parameter_group('kd1', 'max_allowed_packet' => 2048) #=> true
|
@@ -470,7 +522,7 @@ module RightAws
|
|
470
522
|
params.each do |key, value|
|
471
523
|
method = 'pending-reboot'
|
472
524
|
if value.is_a?(Hash)
|
473
|
-
method = value[:method] unless value[:method].
|
525
|
+
method = value[:method] unless value[:method].right_blank?
|
474
526
|
value = value[:value]
|
475
527
|
end
|
476
528
|
parameters << [key, value, method]
|
@@ -557,7 +609,7 @@ module RightAws
|
|
557
609
|
result
|
558
610
|
end
|
559
611
|
|
560
|
-
# Describe a default parameters for the
|
612
|
+
# Describe a default parameters for the parameter group family.
|
561
613
|
#
|
562
614
|
# rds.describe_engine_default_parameters('MySQL5.1') #=>
|
563
615
|
# [{:is_modifiable=>true,
|
@@ -575,10 +627,10 @@ module RightAws
|
|
575
627
|
# :name=>"auto_increment_increment",
|
576
628
|
# :data_type=>"integer"}, ... ]
|
577
629
|
#
|
578
|
-
def describe_engine_default_parameters(*
|
579
|
-
|
580
|
-
item, params = AwsUtils::split_items_and_params(
|
581
|
-
params['
|
630
|
+
def describe_engine_default_parameters(*db_parameter_group_family, &block)
|
631
|
+
db_parameter_group_family = ['MySQL5.1'] if db_parameter_group_family.right_blank?
|
632
|
+
item, params = AwsUtils::split_items_and_params(db_parameter_group_family)
|
633
|
+
params['DBParameterGroupFamily'] = item if item
|
582
634
|
result = []
|
583
635
|
incrementally_list_items('DescribeEngineDefaultParameters', DescribeDbParametersParser, params) do |response|
|
584
636
|
result += response[:parameters]
|
@@ -587,6 +639,31 @@ module RightAws
|
|
587
639
|
result
|
588
640
|
end
|
589
641
|
|
642
|
+
# Describe a list of orderable DB Instance options for the specified engine.
|
643
|
+
# Optionals: +:instance_class+, +:engine_version+ , +:license_model+
|
644
|
+
#
|
645
|
+
# rds.describe_orderable_db_instance_options('oracle-ee', :engine_version => '11.2.0.2.v2') #=>
|
646
|
+
# [{:read_replica_capable=>false,
|
647
|
+
# :instance_class=>"db.m1.large",
|
648
|
+
# :availability_zones=>["us-east-1a", "us-east-1b", "us-east-1d"],
|
649
|
+
# :engine=>"oracle-ee",
|
650
|
+
# :license_model=>"bring-your-own-license",
|
651
|
+
# :engine_version=>"11.2.0.2.v2",
|
652
|
+
# :multi_az_capable=>"false"}, ... ]
|
653
|
+
#
|
654
|
+
def describe_orderable_db_instance_options(engine, params={}, &block)
|
655
|
+
request_hash = { 'Engine' => engine }
|
656
|
+
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?
|
659
|
+
result = []
|
660
|
+
incrementally_list_items('DescribeOrderableDBInstanceOptions', DescribeOrderableDBInstanceOptionsParser, request_hash) do |response|
|
661
|
+
result += response[:items]
|
662
|
+
block ? block.call(response) : true
|
663
|
+
end
|
664
|
+
result
|
665
|
+
end
|
666
|
+
|
590
667
|
# --------------------------------------------
|
591
668
|
# DB Snapshots
|
592
669
|
# --------------------------------------------
|
@@ -636,7 +713,7 @@ module RightAws
|
|
636
713
|
def describe_db_snapshots(params={}, &block)
|
637
714
|
item, params = AwsUtils::split_items_and_params(params)
|
638
715
|
params['DBSnapshotIdentifier'] = item if item
|
639
|
-
params['DBInstanceIdentifier'] = params.delete(:instance_aws_id) unless params[:instance_aws_id].
|
716
|
+
params['DBInstanceIdentifier'] = params.delete(:instance_aws_id) unless params[:instance_aws_id].right_blank?
|
640
717
|
result = []
|
641
718
|
incrementally_list_items('DescribeDBSnapshots', DescribeDbSnapshotsParser, params) do |response|
|
642
719
|
result += response[:db_snapshots]
|
@@ -667,7 +744,8 @@ module RightAws
|
|
667
744
|
# Create a new RDS instance from a DBSnapshot. The source DBSnapshot must be
|
668
745
|
# in the "Available" state. The new RDS instance is created with the Default security group.
|
669
746
|
#
|
670
|
-
# Optional params: +:instance_class+, +:endpoint_port+, +:availability_zone
|
747
|
+
# Optional params: +:instance_class+, +:endpoint_port+, +:availability_zone+, +:multi_az+,
|
748
|
+
# +:auto_minor_version_upgrade+, +:license_model+, +:db_name+, +:engine+
|
671
749
|
#
|
672
750
|
# rds.restore_db_instance_from_db_snapshot('ahahahaha-final-snapshot-20090828081159', 'q1') #=>
|
673
751
|
# {:status=>"creating",
|
@@ -680,14 +758,20 @@ module RightAws
|
|
680
758
|
# :create_time=>"2009-08-29T18:07:01.510Z",
|
681
759
|
# :instance_class=>"Medium",
|
682
760
|
# :preferred_maintenance_window=>"Sun:05:00-Sun:09:00",
|
683
|
-
# :engine=>"
|
761
|
+
# :engine=>"MySQL",
|
762
|
+
# :engine_version=>"5.1.49"}
|
684
763
|
#
|
685
764
|
def restore_db_instance_from_db_snapshot(snapshot_aws_id, instance_aws_id, params={})
|
686
765
|
request_hash = { 'DBSnapshotIdentifier' => snapshot_aws_id,
|
687
766
|
'DBInstanceIdentifier' => instance_aws_id }
|
688
|
-
request_hash['DBInstanceClass']
|
689
|
-
request_hash['
|
690
|
-
request_hash['AvailabilityZone']
|
767
|
+
request_hash['DBInstanceClass'] = params[:instance_class] unless params[:instance_class].right_blank?
|
768
|
+
request_hash['Port'] = params[:endpoint_port] unless params[:endpoint_port].right_blank?
|
769
|
+
request_hash['AvailabilityZone'] = params[:availability_zone] unless params[:availability_zone].right_blank?
|
770
|
+
request_hash['MultiAZ'] = params[:multi_az] unless params[:multi_az].nil?
|
771
|
+
request_hash['AutoMinorVersionUpgrade'] = params[:auto_minor_version_upgrade] unless params[:auto_minor_version_upgrade].nil?
|
772
|
+
request_hash['LicenseModel'] = params[:license_model] unless params[:license_model].right_blank?
|
773
|
+
request_hash['DBName'] = params[:db_name] unless params[:db_name].right_blank?
|
774
|
+
request_hash['Engine'] = params[:engine] unless params[:enginel].right_blank?
|
691
775
|
link = generate_request('RestoreDBInstanceFromDBSnapshot', request_hash)
|
692
776
|
request_info(link, DescribeDbInstancesParser.new(:logger => @logger))[:db_instances].first
|
693
777
|
end
|
@@ -696,10 +780,23 @@ module RightAws
|
|
696
780
|
# database is created from the source database restore point with the same configuration as
|
697
781
|
# the original source database, except that the new RDS instance is created with the default
|
698
782
|
# security group.
|
699
|
-
|
783
|
+
#
|
784
|
+
# Optional params: +:instance_class+, +:endpoint_port+, +:availability_zone+, +:multi_az+, +:restore_time+,
|
785
|
+
# +:auto_minor_version_upgrade+, +:use_latest_restorable_time+, +:license_model+, +:db_name+, +:engine+
|
786
|
+
#
|
787
|
+
def restore_db_instance_to_point_in_time(instance_aws_id, new_instance_aws_id, params={})
|
700
788
|
request_hash = { 'SourceDBInstanceIdentifier' => instance_aws_id,
|
701
|
-
'TargetDBInstanceIdentifier' => new_instance_aws_id
|
702
|
-
|
789
|
+
'TargetDBInstanceIdentifier' => new_instance_aws_id}
|
790
|
+
request_hash['UseLatestRestorableTime'] = params[:use_latest_restorable_time].to_s unless params[:use_latest_restorable_time].nil?
|
791
|
+
request_hash['RestoreTime'] = params[:restore_time] unless params[:restore_time].right_blank?
|
792
|
+
request_hash['DBInstanceClass'] = params[:instance_class] unless params[:instance_class].right_blank?
|
793
|
+
request_hash['MultiAZ'] = params[:multi_az] unless params[:multi_az].nil?
|
794
|
+
request_hash['Port'] = params[:endpoint_port] unless params[:endpoint_port].right_blank?
|
795
|
+
request_hash['AvailabilityZone'] = params[:availability_zone] unless params[:availability_zone].right_blank?
|
796
|
+
request_hash['AutoMinorVersionUpgrade'] = params[:auto_minor_version_upgrade] unless params[:auto_minor_version_upgrade].nil?
|
797
|
+
request_hash['LicenseModel'] = params[:license_model] unless params[:license_model].right_blank?
|
798
|
+
request_hash['DBName'] = params[:db_name] unless params[:db_name].right_blank?
|
799
|
+
request_hash['Engine'] = params[:engine] unless params[:enginel].right_blank?
|
703
800
|
link = generate_request('RestoreDBInstanceToPointInTime', request_hash)
|
704
801
|
request_info(link, DescribeDbInstancesParser.new(:logger => @logger))[:db_instances].first
|
705
802
|
end
|
@@ -754,11 +851,11 @@ module RightAws
|
|
754
851
|
#
|
755
852
|
def describe_events(params={}, &block)
|
756
853
|
params = params.dup
|
757
|
-
params['SourceIdentifier'] = params.delete(:aws_id) unless params[:aws_id].
|
758
|
-
params['SourceType'] = params.delete(:source_type) unless params[:source_type].
|
759
|
-
params['Duration'] = params.delete(:duration) unless params[:duration].
|
760
|
-
params['StartDate'] = fix_date(params.delete(:start_date)) unless params[:start_date].
|
761
|
-
params['EndDate'] = fix_date(params.delete(:end_date)) unless params[:end_date].
|
854
|
+
params['SourceIdentifier'] = params.delete(:aws_id) unless params[:aws_id].right_blank?
|
855
|
+
params['SourceType'] = params.delete(:source_type) unless params[:source_type].right_blank?
|
856
|
+
params['Duration'] = params.delete(:duration) unless params[:duration].right_blank?
|
857
|
+
params['StartDate'] = fix_date(params.delete(:start_date)) unless params[:start_date].right_blank?
|
858
|
+
params['EndDate'] = fix_date(params.delete(:end_date)) unless params[:end_date].right_blank?
|
762
859
|
result = []
|
763
860
|
incrementally_list_items('DescribeEvents', DescribeEventsParser, params) do |response|
|
764
861
|
result += response[:events]
|
@@ -773,6 +870,175 @@ module RightAws
|
|
773
870
|
date
|
774
871
|
end
|
775
872
|
|
873
|
+
# --------------------------------------------
|
874
|
+
# DB Engine Versions
|
875
|
+
# --------------------------------------------
|
876
|
+
|
877
|
+
# Get a list of the available DB engines.
|
878
|
+
# Optional params: +:db_parameter_group_family+, +:default_only+, +:engine+, +:engine_version+
|
879
|
+
#
|
880
|
+
# rds.describe_db_engine_versions #=>
|
881
|
+
# [{:db_parameter_group_family=>"mysql5.1",
|
882
|
+
# :engine=>"mysql",
|
883
|
+
# :db_engine_description=>"MySQL Community Edition",
|
884
|
+
# :db_engine_version_description=>"Mysql 5.1.45",
|
885
|
+
# :engine_version=>"5.1.45"},
|
886
|
+
# {:db_parameter_group_family=>"oracle-se1-11.2",
|
887
|
+
# :engine=>"oracle-se1",
|
888
|
+
# :db_engine_description=>"Oracle Database Standard Edition One",
|
889
|
+
# :db_engine_version_description=>
|
890
|
+
# "Oracle Standard Edition One - DB Engine Version 11.2.0.2.v2",
|
891
|
+
# :engine_version=>"11.2.0.2.v2"}]
|
892
|
+
#
|
893
|
+
def describe_db_engine_versions(params={}, &block)
|
894
|
+
params = params.dup
|
895
|
+
params['DBParameterGroupFamily'] = params.delete(:db_parameter_group_family) unless params[:db_parameter_group_family].right_blank?
|
896
|
+
params['DefaultOnly'] = params.delete(:default_only).to_s unless params[:default_only].nil?
|
897
|
+
params['Engine'] = params.delete(:engine) unless params[:engine].right_blank?
|
898
|
+
params['EngineVersion'] = params.delete(:engine_version) unless params[:engine_version].right_blank?
|
899
|
+
result = []
|
900
|
+
incrementally_list_items('DescribeDBEngineVersions', DescribeDBEngineVersionsParser, params) do |response|
|
901
|
+
result += response[:db_engine_versions]
|
902
|
+
block ? block.call(response) : true
|
903
|
+
end
|
904
|
+
result
|
905
|
+
end
|
906
|
+
|
907
|
+
# --------------------------------------------
|
908
|
+
# DB Replicas
|
909
|
+
# --------------------------------------------
|
910
|
+
|
911
|
+
# Create a DB Instance that acts as a Read Replica of a source DB Instance.
|
912
|
+
#
|
913
|
+
# Optional params: +:endpoint_port+, +:availability_zone+, +:instance_class+, +:auto_minor_version_upgrade+
|
914
|
+
#
|
915
|
+
# rds.create_db_instance_read_replica('kd-delete-me-01-replica-01', 'kd-delete-me-01',
|
916
|
+
# :instance_class => 'db.m1.small',
|
917
|
+
# :endpoint_port => '11000',
|
918
|
+
# :auto_minor_version_upgrade => false ) #=>
|
919
|
+
# {:auto_minor_version_upgrade=>false,
|
920
|
+
# :read_replica_source_db_instance_identifier=>"kd-delete-me-01",
|
921
|
+
# :status=>"creating",
|
922
|
+
# :backup_retention_period=>0,
|
923
|
+
# :allocated_storage=>30,
|
924
|
+
# :read_replica_db_instance_identifiers=>[],
|
925
|
+
# :engine_version=>"5.1.50",
|
926
|
+
# :aws_id=>"kd-delete-me-01-replica-01",
|
927
|
+
# :multi_az=>false,
|
928
|
+
# :preferred_maintenance_window=>"sun:06:00-sun:10:00",
|
929
|
+
# :master_username=>"username",
|
930
|
+
# :preferred_backup_window=>"02:00-04:00",
|
931
|
+
# :db_parameter_group=>{:status=>"in-sync", :name=>"default.mysql5.1"},
|
932
|
+
# :engine=>"mysql",
|
933
|
+
# :db_security_groups=>[{:status=>"active", :name=>"default"}],
|
934
|
+
# :instance_class=>"db.m1.small",
|
935
|
+
# :pending_modified_values=>{}}
|
936
|
+
#
|
937
|
+
def create_db_instance_read_replica(aws_id, source_db_instance_identifier, params={})
|
938
|
+
request_hash = { 'DBInstanceIdentifier' => aws_id,
|
939
|
+
'SourceDBInstanceIdentifier' => source_db_instance_identifier}
|
940
|
+
request_hash['Port'] = params[:endpoint_port] unless params[:endpoint_port].right_blank?
|
941
|
+
request_hash['AvailabilityZone'] = params[:availability_zone] unless params[:availability_zone].right_blank?
|
942
|
+
request_hash['DBInstanceClass'] = params[:instance_class] unless params[:instance_class].right_blank?
|
943
|
+
request_hash['AutoMinorVersionUpgrade'] = params[:auto_minor_version_upgrade].to_s unless params[:auto_minor_version_upgrade].nil?
|
944
|
+
link = generate_request('CreateDBInstanceReadReplica', request_hash)
|
945
|
+
request_info(link, DescribeDbInstancesParser.new(:logger => @logger))[:db_instances].first
|
946
|
+
end
|
947
|
+
|
948
|
+
|
949
|
+
#---------------------------------------------
|
950
|
+
# Reserved Instances
|
951
|
+
#---------------------------------------------
|
952
|
+
|
953
|
+
# Lists available reserved DB Instance offerings.
|
954
|
+
# Options: :aws_id, :instance_class, :duration, :product_description, :multi_az
|
955
|
+
#
|
956
|
+
# 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}, ...]
|
973
|
+
#
|
974
|
+
# rds.describe_reserved_db_instances_offerings(:aws_id => "248e7b75-49a7-4cd7-9a9b-354f4906a9b1") #=>
|
975
|
+
# [{:duration=>94608000,
|
976
|
+
# :multi_az=>true,
|
977
|
+
# :fixed_price=>700.0,
|
978
|
+
# :usage_price=>0.092,
|
979
|
+
# :currency_code=>"USD",
|
980
|
+
# :aws_id=>"248e7b75-49a7-4cd7-9a9b-354f4906a9b1",
|
981
|
+
# :instance_class=>"db.m1.small",
|
982
|
+
# :product_description=>"mysql"}]
|
983
|
+
#
|
984
|
+
# rds.describe_reserved_db_instances_offerings(:instance_class => "db.m1.small")
|
985
|
+
# rds.describe_reserved_db_instances_offerings(:duration => 31536000)
|
986
|
+
# rds.describe_reserved_db_instances_offerings(:product_description => 'mysql')
|
987
|
+
# rds.describe_reserved_db_instances_offerings(:multi_az => true)
|
988
|
+
#
|
989
|
+
def describe_reserved_db_instances_offerings(params={}, &block)
|
990
|
+
params = params.dup
|
991
|
+
params['ReservedDBInstancesOfferingId'] = params.delete(:aws_id) unless params[:aws_id].right_blank?
|
992
|
+
params['DBInstanceClass'] = params.delete(:instance_class) unless params[:instance_class].right_blank?
|
993
|
+
params['Duration'] = params.delete(:duration) unless params[:duration].right_blank?
|
994
|
+
params['ProductDescription'] = params.delete(:product_description) unless params[:product_description].right_blank?
|
995
|
+
params['MultiAZ'] = params.delete(:multi_az).to_s unless params[:multi_az].nil?
|
996
|
+
result = []
|
997
|
+
incrementally_list_items('DescribeReservedDBInstancesOfferings', DescribeReservedDBInstancesOfferingsParser, params) do |response|
|
998
|
+
result += response[:reserved_db_instances_offerings]
|
999
|
+
block ? block.call(response) : true
|
1000
|
+
end
|
1001
|
+
result
|
1002
|
+
end
|
1003
|
+
|
1004
|
+
# Returns information about reserved DB Instances for this account, or about
|
1005
|
+
# a specified reserved DB Instance.
|
1006
|
+
# Options: :aws_id, :offering_aws_id, :instance_class, :duration, :product_description, :multi_az
|
1007
|
+
#
|
1008
|
+
# rds.describe_reserved_db_instances
|
1009
|
+
# rds.describe_reserved_db_instances(:aws_id => "myreservedinstance")
|
1010
|
+
# rds.describe_reserved_db_instances(:offering_aws_id => "248e7b75-49a7-4cd7-9a9b-354f4906a9b1")
|
1011
|
+
# rds.describe_reserved_db_instances(:instance_class => "db.m1.small")
|
1012
|
+
# rds.describe_reserved_db_instances(:duration => 31536000)
|
1013
|
+
# rds.describe_reserved_db_instances(:product_description => 'mysql')
|
1014
|
+
# rds.describe_reserved_db_instances_offerings(:multi_az => true)
|
1015
|
+
#
|
1016
|
+
def describe_reserved_db_instances(params={}, &block)
|
1017
|
+
params = params.dup
|
1018
|
+
params['ReservedDBInstancesId'] = params.delete(:aws_id) unless params[:aws_id].right_blank?
|
1019
|
+
params['ReservedDBInstancesOfferingId'] = params.delete(:offering_aws_id) unless params[:offering_aws_id].right_blank?
|
1020
|
+
params['DBInstanceClass'] = params.delete(:instance_class) unless params[:instance_class].right_blank?
|
1021
|
+
params['Duration'] = params.delete(:duration) unless params[:duration].right_blank?
|
1022
|
+
params['ProductDescription'] = params.delete(:product_description) unless params[:product_description].right_blank?
|
1023
|
+
params['MultiAZ'] = params.delete(:multi_az).to_s unless params[:multi_az].nil?
|
1024
|
+
result = []
|
1025
|
+
incrementally_list_items('DescribeReservedDBInstances', DescribeReservedDBInstancesParser, params) do |response|
|
1026
|
+
result += response[:reserved_db_instances]
|
1027
|
+
block ? block.call(response) : true
|
1028
|
+
end
|
1029
|
+
result
|
1030
|
+
end
|
1031
|
+
|
1032
|
+
# Purchases a reserved DB Instance offering.
|
1033
|
+
# Options: :aws_id, :count
|
1034
|
+
def purchase_reserved_db_instances_offering(offering_aws_id, params={})
|
1035
|
+
request_hash = { 'ReservedDBInstancesOfferingId' => offering_aws_id }
|
1036
|
+
request_hash['ReservedDBInstanceId'] = params[:aws_id] unless params[:aws_id].right_blank?
|
1037
|
+
request_hash['DBInstanceCount'] = params[:count] unless params[:count].right_blank?
|
1038
|
+
link = generate_request('PurchaseReservedDBInstancesOffering', request_hash)
|
1039
|
+
request_info(link, DescribeReservedDBInstancesParser.new(:logger => @logger))[:reserved_db_instances].first
|
1040
|
+
end
|
1041
|
+
|
776
1042
|
# --------------------------------------------
|
777
1043
|
# Parsers
|
778
1044
|
# --------------------------------------------
|
@@ -783,54 +1049,88 @@ module RightAws
|
|
783
1049
|
|
784
1050
|
class DescribeDbInstancesParser < RightAWSParser # :nodoc:
|
785
1051
|
def reset
|
786
|
-
@m = [ 'DBInstance',
|
787
|
-
'CreateDBInstanceResult',
|
788
|
-
'DeleteDBInstanceResult',
|
789
|
-
'ModifyDBInstanceResult',
|
790
|
-
'RebootDBInstanceResult',
|
791
|
-
'RestoreDBInstanceToPointInTimeResponse',
|
792
|
-
'RestoreDBInstanceFromDBSnapshotResult' ]
|
793
1052
|
@result = { :db_instances => [] }
|
794
1053
|
end
|
795
1054
|
def tagstart(name, attributes)
|
796
1055
|
case name
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
|
1056
|
+
when 'DBInstance' then @item = { :db_security_groups => [], :pending_modified_values => {}, :read_replica_db_instance_identifiers => [] }
|
1057
|
+
when 'DBSecurityGroup' then @db_security_group = {}
|
1058
|
+
when 'DBParameterGroup',
|
1059
|
+
'DBParameterGroupStatus' then @db_parameter_group = {}
|
801
1060
|
end
|
802
1061
|
end
|
803
1062
|
def tagend(name)
|
804
1063
|
case name
|
805
|
-
when 'Marker'
|
806
|
-
when 'MaxRecords'
|
807
|
-
when 'DBInstanceIdentifier'
|
808
|
-
when '
|
809
|
-
when '
|
810
|
-
when '
|
811
|
-
when '
|
812
|
-
when '
|
813
|
-
when '
|
814
|
-
when '
|
815
|
-
when '
|
816
|
-
when '
|
817
|
-
when '
|
818
|
-
when '
|
819
|
-
when '
|
820
|
-
when '
|
821
|
-
|
822
|
-
|
823
|
-
|
1064
|
+
when 'Marker' then @result[:marker] = @text
|
1065
|
+
when 'MaxRecords' then @result[:max_records] = @text.to_i
|
1066
|
+
when 'DBInstanceIdentifier' then @item[:aws_id] = @text
|
1067
|
+
when 'InstanceCreateTime' then @item[:create_time] = @text
|
1068
|
+
when 'Engine' then @item[:engine] = @text
|
1069
|
+
when 'DBInstanceStatus' then @item[:status] = @text
|
1070
|
+
when 'Address' then @item[:endpoint_address] = @text
|
1071
|
+
when 'Port' then @item[:endpoint_port] = @text.to_i
|
1072
|
+
when 'MasterUsername' then @item[:master_username] = @text
|
1073
|
+
when 'AvailabilityZone' then @item[:availability_zone] = @text
|
1074
|
+
when 'LatestRestorableTime' then @item[:latest_restorable_time] = @text
|
1075
|
+
when 'LicenseModel' then @item[:license_model] = @text
|
1076
|
+
when 'DBName' then @item[:db_name] = @text
|
1077
|
+
when 'ReadReplicaSourceDBInstanceIdentifier' then @item[:read_replica_source_db_instance_identifier] = @text
|
1078
|
+
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
|
+
when 'DBParameterGroupName' then @db_parameter_group[:name] = @text
|
1082
|
+
when 'ParameterApplyStatus' then @db_parameter_group[:status] = @text
|
1083
|
+
when 'DBSecurityGroup' then @item[:db_security_groups] << @db_security_group
|
1084
|
+
when 'DBParameterGroup',
|
1085
|
+
'DBParameterGroupStatus' then @item[:db_parameter_group] = @db_parameter_group
|
1086
|
+
when 'DBInstance' then @result[:db_instances] << @item
|
1087
|
+
else
|
1088
|
+
case full_tag_name
|
1089
|
+
when %r{DBInstance/DBInstanceClass$} then @item[:instance_class] = @text
|
1090
|
+
when %r{DBInstance/AllocatedStorage$} then @item[:allocated_storage] = @text.to_i
|
1091
|
+
when %r{DBInstance/MultiAZ$} then @item[:multi_az] = (@text == 'true')
|
1092
|
+
when %r{DBInstance/BackupRetentionPeriod$} then @item[:backup_retention_period] = @text.to_i
|
1093
|
+
when %r{DBInstance/PreferredMaintenanceWindow$} then @item[:preferred_maintenance_window] = @text
|
1094
|
+
when %r{DBInstance/PreferredBackupWindow$} then @item[:preferred_backup_window] = @text
|
1095
|
+
when %r{DBInstance/EngineVersion$} then @item[:engine_version] = @text
|
1096
|
+
when %r{DBInstance/AutoMinorVersionUpgrade$} then @item[:auto_minor_version_upgrade] = (@text == 'true')
|
1097
|
+
when %r{DBInstance/AllowMajorVersionUpgrade$} then @item[:allow_major_version_upgrade] = (@text == 'true')
|
1098
|
+
when %r{PendingModifiedValues/DBInstanceClass$} then @item[:pending_modified_values][:instance_class] = @text
|
1099
|
+
when %r{PendingModifiedValues/AllocatedStorage$} then @item[:pending_modified_values][:allocated_storage] = @text.to_i
|
1100
|
+
when %r{PendingModifiedValues/MasterUserPassword$} then @item[:pending_modified_values][:master_user_password] = @text
|
1101
|
+
when %r{PendingModifiedValues/MultiAZ$} then @item[:pending_modified_values][:multi_az] = (@text == 'true')
|
1102
|
+
when %r{PendingModifiedValues/BackupRetentionPeriod$} then @item[:pending_modified_values][:backup_retention_period] = @text.to_i
|
1103
|
+
when %r{PendingModifiedValues/PreferredMaintenanceWindow$} then @item[:pending_modified_values][:preferred_maintenance_window] = @text
|
1104
|
+
when %r{PendingModifiedValues/PreferredBackupWindow$} then @item[:pending_modified_values][:preferred_backup_window] = @text
|
1105
|
+
when %r{PendingModifiedValues/EngineVersion$} then @item[:pending_modified_values][:engine_version] = @text
|
1106
|
+
when %r{PendingModifiedValues/AutoMinorVersionUpgrade$} then @item[:pending_modified_values][:auto_minor_version_upgrade] = (@text == 'true')
|
1107
|
+
when %r{PendingModifiedValues/AllowMajorVersionUpgrade$} then @item[:pending_modified_values][:allow_major_version_upgrade] = (@text == 'true')
|
824
1108
|
end
|
825
|
-
|
826
|
-
|
827
|
-
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
1109
|
+
end
|
1110
|
+
end
|
1111
|
+
end
|
1112
|
+
|
1113
|
+
class DescribeOrderableDBInstanceOptionsParser < RightAWSParser # :nodoc:
|
1114
|
+
def reset
|
1115
|
+
@result = { :items => [] }
|
1116
|
+
end
|
1117
|
+
def tagstart(name, attributes)
|
1118
|
+
case name
|
1119
|
+
when 'OrderableDBInstanceOption' then @item = { :availability_zones => [] }
|
1120
|
+
end
|
1121
|
+
end
|
1122
|
+
def tagend(name)
|
1123
|
+
case name
|
1124
|
+
when 'Marker' then @result[:marker] = @text
|
1125
|
+
when 'MaxRecords' then @result[:max_records] = @text.to_i
|
1126
|
+
when 'DBInstanceClass' then @item[:instance_class] = @text
|
1127
|
+
when 'Engine' then @item[:engine] = @text
|
1128
|
+
when 'EngineVersion' then @item[:engine_version] = @text
|
1129
|
+
when 'LicenseModel' then @item[:license_model] = @text
|
1130
|
+
when 'MultiAZCapable' then @item[:multi_az_capable] = @text
|
1131
|
+
when 'ReadReplicaCapable' then @item[:read_replica_capable] = @text == 'true'
|
1132
|
+
when 'Name' then @item[:availability_zones] << @text
|
1133
|
+
when 'OrderableDBInstanceOption' then @result[:items] << @item
|
834
1134
|
end
|
835
1135
|
end
|
836
1136
|
end
|
@@ -841,41 +1141,37 @@ module RightAws
|
|
841
1141
|
|
842
1142
|
class DescribeDbSecurityGroupsParser < RightAWSParser # :nodoc:
|
843
1143
|
def reset
|
844
|
-
@m = [ 'DBSecurityGroup',
|
845
|
-
'CreateDBSecurityGroupResult',
|
846
|
-
'AuthorizeDBSecurityGroupIngressResult',
|
847
|
-
'RevokeDBSecurityGroupIngressResult' ]
|
848
1144
|
@result = { :db_security_groups => [] }
|
849
1145
|
end
|
850
1146
|
def tagstart(name, attributes)
|
851
1147
|
case name
|
852
|
-
|
853
|
-
|
854
|
-
|
1148
|
+
when 'DBSecurityGroup' then @item = { :ec2_security_groups => [], :ip_ranges => [] }
|
1149
|
+
when 'IPRange' then @ip_range = {}
|
1150
|
+
when 'EC2SecurityGroup' then @ec2_security_group = {}
|
855
1151
|
end
|
856
1152
|
end
|
857
1153
|
def tagend(name)
|
858
1154
|
case name
|
859
|
-
when 'Marker' then @result[:marker]
|
860
|
-
when 'MaxRecords' then @result[:max_records]
|
861
|
-
when 'DBSecurityGroupDescription' then @item[:description]
|
862
|
-
when 'OwnerId' then @item[:owner_id]
|
863
|
-
when 'DBSecurityGroupName' then @item[:name]
|
864
|
-
when '
|
865
|
-
|
866
|
-
|
867
|
-
|
868
|
-
|
869
|
-
when '
|
870
|
-
when 'EC2SecurityGroupOwnerId' then @ec2_security_group[:owner_id] = @text
|
871
|
-
when 'CIDRIP' then @ip_range[:cidrip] = @text
|
872
|
-
when 'IPRange' then @item[:ip_ranges] << @ip_range
|
873
|
-
when 'EC2SecurityGroup' then @item[:ec2_security_groups] << @ec2_security_group
|
874
|
-
when *@m
|
1155
|
+
when 'Marker' then @result[:marker] = @text
|
1156
|
+
when 'MaxRecords' then @result[:max_records] = @text.to_i
|
1157
|
+
when 'DBSecurityGroupDescription' then @item[:description ] = @text
|
1158
|
+
when 'OwnerId' then @item[:owner_id] = @text
|
1159
|
+
when 'DBSecurityGroupName' then @item[:name] = @text
|
1160
|
+
when 'EC2SecurityGroupName' then @ec2_security_group[:name] = @text
|
1161
|
+
when 'EC2SecurityGroupOwnerId' then @ec2_security_group[:owner_id] = @text
|
1162
|
+
when 'CIDRIP' then @ip_range[:cidrip] = @text
|
1163
|
+
when 'IPRange' then @item[:ip_ranges] << @ip_range
|
1164
|
+
when 'EC2SecurityGroup' then @item[:ec2_security_groups] << @ec2_security_group
|
1165
|
+
when 'DBSecurityGroup'
|
875
1166
|
# Sort the ip_ranges and ec2_security_groups
|
876
1167
|
@item[:ip_ranges].sort!{ |i1,i2| "#{i1[:cidrip]}" <=> "#{i2[:cidrip]}" }
|
877
1168
|
@item[:ec2_security_groups].sort!{ |i1,i2| "#{i1[:owner_id]}#{i1[:name]}" <=> "#{i2[:owner_id]}#{i2[:name]}" }
|
878
1169
|
@result[:db_security_groups] << @item
|
1170
|
+
else
|
1171
|
+
case full_tag_name
|
1172
|
+
when %r{IPRange/Status$} then @ip_range[:status] = @text
|
1173
|
+
when %r{EC2SecurityGroup/Status$} then @ec2_security_group[:status] = @text
|
1174
|
+
end
|
879
1175
|
end
|
880
1176
|
end
|
881
1177
|
end
|
@@ -886,22 +1182,23 @@ module RightAws
|
|
886
1182
|
|
887
1183
|
class DescribeDbParameterGroupsParser < RightAWSParser # :nodoc:
|
888
1184
|
def reset
|
889
|
-
@m = [ 'DBParameterGroup', 'CreateDBParameterGroupResult', 'ModifyDBParameterGroupResult' ]
|
890
1185
|
@result = { :db_parameter_groups => [] }
|
891
1186
|
end
|
892
1187
|
def tagstart(name, attributes)
|
893
1188
|
case name
|
894
|
-
|
1189
|
+
when 'DBParameterGroup',
|
1190
|
+
'ModifyDBParameterGroupResult' then @item = { }
|
895
1191
|
end
|
896
1192
|
end
|
897
1193
|
def tagend(name)
|
898
1194
|
case name
|
899
|
-
when 'Marker'
|
900
|
-
when 'MaxRecords'
|
901
|
-
when 'DBParameterGroupName'
|
902
|
-
when 'Description'
|
903
|
-
when '
|
904
|
-
when
|
1195
|
+
when 'Marker' then @result[:marker] = @text
|
1196
|
+
when 'MaxRecords' then @result[:max_records] = @text.to_i
|
1197
|
+
when 'DBParameterGroupName' then @item[:name] = @text
|
1198
|
+
when 'Description' then @item[:description] = @text
|
1199
|
+
when 'DBParameterGroupFamily' then @item[:db_parameter_group_family] = @text
|
1200
|
+
when 'DBParameterGroup',
|
1201
|
+
'ModifyDBParameterGroupResult' then @result[:db_parameter_groups] << @item
|
905
1202
|
end
|
906
1203
|
end
|
907
1204
|
end
|
@@ -912,24 +1209,26 @@ module RightAws
|
|
912
1209
|
end
|
913
1210
|
def tagstart(name, attributes)
|
914
1211
|
case name
|
915
|
-
|
1212
|
+
when 'Parameter' then @item = {}
|
916
1213
|
end
|
917
1214
|
end
|
918
1215
|
def tagend(name)
|
919
1216
|
case name
|
920
1217
|
when 'Marker' then @result[:marker] = @text
|
921
1218
|
when 'MaxRecords' then @result[:max_records] = @text.to_i
|
922
|
-
when 'DBParameterGroupName'
|
923
|
-
when '
|
924
|
-
when 'DataType'
|
925
|
-
when 'Source'
|
926
|
-
when 'Description'
|
927
|
-
when 'IsModifiable'
|
928
|
-
when 'ApplyType'
|
929
|
-
when '
|
930
|
-
when '
|
931
|
-
when '
|
932
|
-
when '
|
1219
|
+
when 'DBParameterGroupName' then @result[:group_name] = @text # DescribeDbParametersResponse
|
1220
|
+
when 'DBParameterGroupFamily' then @result[:db_parameter_group_family] = @text # DescribeDBEngineDefaultParametersResponse
|
1221
|
+
when 'DataType' then @item[:data_type] = @text
|
1222
|
+
when 'Source' then @item[:source] = @text
|
1223
|
+
when 'Description' then @item[:description] = @text
|
1224
|
+
when 'IsModifiable' then @item[:is_modifiable] = (@text == 'true')
|
1225
|
+
when 'ApplyType' then @item[:apply_type] = @text
|
1226
|
+
when 'ApplyMethod' then @item[:apply_method] = @text
|
1227
|
+
when 'MinimumEngineVersion' then @item[:minimum_engine_version] = @text
|
1228
|
+
when 'AllowedValues' then @item[:allowed_values] = @text
|
1229
|
+
when 'ParameterName' then @item[:name] = @text
|
1230
|
+
when 'ParameterValue' then @item[:value] = @text
|
1231
|
+
when 'Parameter' then @result[:parameters] << @item
|
933
1232
|
end
|
934
1233
|
end
|
935
1234
|
end
|
@@ -940,30 +1239,30 @@ module RightAws
|
|
940
1239
|
|
941
1240
|
class DescribeDbSnapshotsParser < RightAWSParser # :nodoc:
|
942
1241
|
def reset
|
943
|
-
@m = ['DBSnapshot', 'CreateDBSnapshotResult', 'DeleteDBSnapshotResult']
|
944
1242
|
@result = { :db_snapshots => [] }
|
945
1243
|
end
|
946
1244
|
def tagstart(name, attributes)
|
947
1245
|
case name
|
948
|
-
|
949
|
-
@db_snapshot = {}
|
1246
|
+
when 'DBSnapshot' then @item = {}
|
950
1247
|
end
|
951
1248
|
end
|
952
1249
|
def tagend(name)
|
953
1250
|
case name
|
954
|
-
when 'Marker' then @result[:marker]
|
955
|
-
when 'MaxRecords' then @result[:max_records]
|
956
|
-
when 'Engine' then @
|
957
|
-
when '
|
958
|
-
when '
|
959
|
-
when '
|
960
|
-
when '
|
961
|
-
when '
|
962
|
-
when '
|
963
|
-
when '
|
964
|
-
when '
|
965
|
-
when '
|
966
|
-
when
|
1251
|
+
when 'Marker' then @result[:marker] = @text
|
1252
|
+
when 'MaxRecords' then @result[:max_records] = @text.to_i # ?
|
1253
|
+
when 'Engine' then @item[:engine] = @text
|
1254
|
+
when 'EngineVersion' then @item[:engine_version] = @text
|
1255
|
+
when 'InstanceCreateTime' then @item[:instance_create_time] = @text
|
1256
|
+
when 'Port' then @item[:endpoint_port] = @text.to_i
|
1257
|
+
when 'Status' then @item[:status] = @text
|
1258
|
+
when 'AvailabilityZone' then @item[:availability_zone] = @text
|
1259
|
+
when 'MasterUsername' then @item[:master_username] = @text
|
1260
|
+
when 'AllocatedStorage' then @item[:allocated_storage] = @text.to_i
|
1261
|
+
when 'SnapshotCreateTime' then @item[:create_time] = @text
|
1262
|
+
when 'DBInstanceIdentifier' then @item[:instance_aws_id] = @text
|
1263
|
+
when 'DBSnapshotIdentifier' then @item[:aws_id] = @text
|
1264
|
+
when 'LicenseModel' then @item[:license_model] = @text
|
1265
|
+
when 'DBSnapshot' then @result[:db_snapshots] << @item
|
967
1266
|
end
|
968
1267
|
end
|
969
1268
|
end
|
@@ -978,18 +1277,105 @@ module RightAws
|
|
978
1277
|
end
|
979
1278
|
def tagstart(name, attributes)
|
980
1279
|
case name
|
981
|
-
|
1280
|
+
when 'Event' then @item = {}
|
982
1281
|
end
|
983
1282
|
end
|
984
1283
|
def tagend(name)
|
985
1284
|
case name
|
986
1285
|
when 'Marker' then @result[:marker] = @text
|
987
1286
|
when 'MaxRecords' then @result[:max_records] = @text.to_i # ?
|
988
|
-
when 'Date' then @
|
989
|
-
when 'SourceIdentifier' then @
|
990
|
-
when 'SourceType' then @
|
991
|
-
when 'Message' then @
|
992
|
-
when 'Event' then @result[:events] << @
|
1287
|
+
when 'Date' then @item[:date] = @text
|
1288
|
+
when 'SourceIdentifier' then @item[:aws_id] = @text
|
1289
|
+
when 'SourceType' then @item[:source_type] = @text
|
1290
|
+
when 'Message' then @item[:message] = @text
|
1291
|
+
when 'Event' then @result[:events] << @item
|
1292
|
+
end
|
1293
|
+
end
|
1294
|
+
end
|
1295
|
+
|
1296
|
+
# --------------------------------------------
|
1297
|
+
# DB Events
|
1298
|
+
# --------------------------------------------
|
1299
|
+
|
1300
|
+
class DescribeDBEngineVersionsParser < RightAWSParser # :nodoc:
|
1301
|
+
def reset
|
1302
|
+
@result = { :db_engine_versions => [] }
|
1303
|
+
end
|
1304
|
+
def tagstart(name, attributes)
|
1305
|
+
case name
|
1306
|
+
when 'DBEngineVersion' then @item = {}
|
1307
|
+
end
|
1308
|
+
end
|
1309
|
+
def tagend(name)
|
1310
|
+
case name
|
1311
|
+
when 'Marker' then @result[:marker] = @text
|
1312
|
+
when 'MaxRecords' then @result[:max_records] = @text.to_i
|
1313
|
+
when 'DBParameterGroupFamily' then @item[:db_parameter_group_family] = @text
|
1314
|
+
when 'Engine' then @item[:engine] = @text
|
1315
|
+
when 'EngineVersion' then @item[:engine_version] = @text
|
1316
|
+
when 'DBEngineDescription' then @item[:db_engine_description] = @text
|
1317
|
+
when 'DBEngineVersionDescription' then @item[:db_engine_version_description] = @text
|
1318
|
+
when 'DBEngineVersion' then @result[:db_engine_versions] << @item
|
1319
|
+
end
|
1320
|
+
end
|
1321
|
+
end
|
1322
|
+
|
1323
|
+
# --------------------------------------------
|
1324
|
+
# DB Reserved Instances
|
1325
|
+
# --------------------------------------------
|
1326
|
+
|
1327
|
+
class DescribeReservedDBInstancesOfferingsParser < RightAWSParser # :nodoc:
|
1328
|
+
def reset
|
1329
|
+
@result = { :reserved_db_instances_offerings => [] }
|
1330
|
+
end
|
1331
|
+
def tagstart(name, attributes)
|
1332
|
+
case name
|
1333
|
+
when 'ReservedDBInstancesOffering' then @item = {}
|
1334
|
+
end
|
1335
|
+
end
|
1336
|
+
def tagend(name)
|
1337
|
+
case name
|
1338
|
+
when 'Marker' then @result[:marker] = @text
|
1339
|
+
when 'MaxRecords' then @result[:max_records] = @text.to_i
|
1340
|
+
when 'CurrencyCode' then @item[:currency_code] = @text
|
1341
|
+
when 'DBInstanceClass' then @item[:instance_class] = @text
|
1342
|
+
when 'Duration' then @item[:duration] = @text.to_i
|
1343
|
+
when 'FixedPrice' then @item[:fixed_price] = @text.to_f
|
1344
|
+
when 'UsagePrice' then @item[:usage_price] = @text.to_f
|
1345
|
+
when 'MultiAZ' then @item[:multi_az] = (@text == 'true')
|
1346
|
+
when 'ProductDescription' then @item[:product_description] = @text
|
1347
|
+
when 'ReservedDBInstancesOfferingId' then @item[:aws_id] = @text
|
1348
|
+
when 'ReservedDBInstancesOffering' then @result[:reserved_db_instances_offerings] << @item
|
1349
|
+
end
|
1350
|
+
end
|
1351
|
+
end
|
1352
|
+
|
1353
|
+
class DescribeReservedDBInstancesParser < RightAWSParser # :nodoc:
|
1354
|
+
def reset
|
1355
|
+
@result = { :reserved_db_instances => [] }
|
1356
|
+
end
|
1357
|
+
def tagstart(name, attributes)
|
1358
|
+
case name
|
1359
|
+
when 'ReservedDBInstance' then @item = {}
|
1360
|
+
end
|
1361
|
+
end
|
1362
|
+
def tagend(name)
|
1363
|
+
case name
|
1364
|
+
when 'Marker' then @result[:marker] = @text
|
1365
|
+
when 'MaxRecords' then @result[:max_records] = @text.to_i
|
1366
|
+
when 'DBInstanceClass' then @item[:instance_class] = @text
|
1367
|
+
when 'CurrencyCode' then @item[:currency_code] = @text
|
1368
|
+
when 'Duration' then @item[:duration] = @text.to_i
|
1369
|
+
when 'FixedPrice' then @item[:fixed_price] = @text.to_f
|
1370
|
+
when 'UsagePrice' then @item[:usage_price] = @text.to_f
|
1371
|
+
when 'MultiAZ' then @item[:multi_az] = (@text == 'true')
|
1372
|
+
when 'ProductDescription' then @item[:product_description] = @text
|
1373
|
+
when 'ReservedDBInstancesOfferingId' then @item[:offering_aws_id] = @text
|
1374
|
+
when 'ReservedDBInstanceId' then @item[:aws_id] = @text
|
1375
|
+
when 'State' then @item[:state] = @text
|
1376
|
+
when 'DBInstanceCount' then @item[:instance_count] = @text.to_i
|
1377
|
+
when 'StartTime' then @item[:start_time] = @text
|
1378
|
+
when 'ReservedDBInstance' then @result[:reserved_db_instances] << @item
|
993
1379
|
end
|
994
1380
|
end
|
995
1381
|
end
|