Skip to content
This repository
Browse code

Whitespace and RDS_URL.

  • Loading branch information...
commit fd20977c0bb1f5c9328f0212100ad67f76663f31 1 parent 1e42445
Glenn Rempe authored October 29, 2009
5  lib/AWS.rb
@@ -28,10 +28,11 @@ def method_missing(meth, *args, &block)
28 28
       self[meth.to_s] || self[meth.to_sym]
29 29
     end
30 30
   end
31  
-  
  31
+
32 32
   def has?(key)
33 33
     self[key] && !self[key].to_s.empty?
34 34
   end
  35
+
35 36
   def does_not_have?(key)
36 37
     self[key].nil? || self[key].to_s.empty?
37 38
   end
@@ -221,7 +222,7 @@ def make_request(action, params, data='')
221 222
           req['User-Agent'] = "github-amazon-ec2-ruby-gem"
222 223
 
223 224
           response = @http.request(req, query)
224  
-          
  225
+
225 226
           # Make a call to see if we need to throw an error based on the response given by EC2
226 227
           # All error classes are defined in EC2/exceptions.rb
227 228
           aws_error?(response)
19  lib/AWS/RDS.rb
@@ -2,15 +2,15 @@ module AWS
2 2
   module RDS
3 3
 
4 4
     # Which host FQDN will we connect to for all API calls to AWS?
5  
-    # If ELB_URL is defined in the users ENV we can override the default with that.
6  
-    # 
  5
+    # If RDS_URL is defined in the users ENV we can override the default with that.
  6
+    #
7 7
     # @example
8 8
     #   export RDS_URL='https://rds.amazonaws.com'
9 9
     if ENV['RDS_URL']
10  
-      ELB_URL = ENV['RDS_URL']
  10
+      RDS_URL = ENV['RDS_URL']
11 11
       VALID_HOSTS = ['rds.amazonaws.com']
12  
-      raise ArgumentError, "Invalid ELB_URL environment variable : #{ELB_URL}" unless VALID_HOSTS.include?(ELB_URL)
13  
-      DEFAULT_HOST = URI.parse(ELB_URL).host
  12
+      raise ArgumentError, "Invalid RDS_URL environment variable : #{RDS_URL}" unless VALID_HOSTS.include?(RDS_URL)
  13
+      DEFAULT_HOST = URI.parse(RDS_URL).host
14 14
     else
15 15
       # Default US API endpoint
16 16
       DEFAULT_HOST = 'rds.amazonaws.com'
@@ -26,7 +26,7 @@ def api_version
26 26
       def default_host
27 27
         DEFAULT_HOST
28 28
       end
29  
-      
  29
+
30 30
       # Raises the appropriate error if the specified Net::HTTPResponse object
31 31
       # contains an Amazon EC2 error; returns +false+ otherwise.
32 32
       def aws_error?(response)
@@ -64,9 +64,10 @@ def aws_error?(response)
64 64
         end
65 65
 
66 66
       end
67  
-      
68  
-      
  67
+
69 68
     end
70 69
 
71 70
   end
72  
-end
  71
+
  72
+end
  73
+
214  lib/AWS/RDS/rds.rb
... ...
@@ -1,7 +1,7 @@
1 1
 module AWS
2 2
   module RDS
3 3
     class Base < AWS::Base
4  
-      
  4
+
5 5
       # This API creates a new DB instance. Once the call has completed
6 6
       # successfully, a new DB instance will be created, but it will not be
7 7
       #
@@ -19,7 +19,7 @@ class Base < AWS::Base
19 19
       # @option options [String] :preferred_maintenance_window in format: ddd:hh24:mi-ddd:hh24:mi (nil)
20 20
       # @option options [String] :backend_retention_period is the number of days which automated backups are retained (1)
21 21
       # @option options [String] :preferred_backup_window is the daily time range for which automated backups are created
22  
-      #    
  22
+      #
23 23
       def create_db_instance( options = {})
24 24
         raise ArgumentError, "No :db_instance_identifier provided" if options.does_not_have?(:db_instance_identifier)
25 25
         raise ArgumentError, "No :allocated_storage provided" if options.does_not_have?(:allocated_storage)
@@ -28,7 +28,7 @@ def create_db_instance( options = {})
28 28
         raise ArgumentError, "No :master_username provided" if options.does_not_have?(:master_username)
29 29
         raise ArgumentError, "No :master_user_password provided" if options.does_not_have?(:master_user_password)
30 30
         raise ArgumentError, "No :db_instance_class provided" if options.does_not_have?(:db_instance_class)
31  
-        
  31
+
32 32
         params = {}
33 33
         params['DBInstanceIdentifier'] = options[:db_instance_identifier]
34 34
         params["AllocatedStorage"] = options[:allocated_storage].to_s
@@ -36,7 +36,7 @@ def create_db_instance( options = {})
36 36
         params["Engine"] = options[:engine]
37 37
         params["MasterUsername"] = options[:master_username]
38 38
         params["MasterUserPassword"] = options[:master_user_password]
39  
-        
  39
+
40 40
         params["Port"] = options[:port].to_s if options.has?(:port)
41 41
         params["DBName"] = options[:db_name] if options.has?(:db_name)
42 42
         params["DBParameterGroup"] = options[:db_parameter_group] if options.has?(:db_parameter_group)
@@ -45,10 +45,10 @@ def create_db_instance( options = {})
45 45
         params["PreferredMaintenanceWindow"] = options[:preferred_backup_window] if options.has?(:preferred_backup_window)
46 46
         params["BackupRetentionPeriod"] = options[:backend_retention_period] if options.has?(:backend_retention_period)
47 47
         params["PreferredBackupWindow"] = options[:preferred_backup_window] if options.has?(:preferred_backup_window)
48  
-        
  48
+
49 49
         return response_generator(:action => "CreateDBInstance", :params => params)
50 50
       end
51  
-      
  51
+
52 52
       # This API method deletes a db instance identifier
53 53
       #
54 54
       # @option options [String] :db_instance_identifier is the instance identifier for the DB instance to be deleted (nil)
@@ -57,13 +57,13 @@ def create_db_instance( options = {})
57 57
       #
58 58
       def delete_db_instance( options = {} )
59 59
         raise ArgumentError, "No :db_instance_identifier provided" if options.does_not_have?(:db_instance_identifier)
60  
-        
  60
+
61 61
         params = {}
62 62
         params['DBInstanceIdentifier'] = options[:db_instance_identifier]
63  
-        
  63
+
64 64
         params["SkipFinalSnapshot"] = options[:skip_final_snapshot].to_s if options.has?(:skip_final_snapshot)
65 65
         params["FinalDBSnapshot­Identifier"] = options[:final_db_snapshot_identifier].to_s if options.has?(:final_db_snapshot_identifier)
66  
-        
  66
+
67 67
         return response_generator(:action => "DeleteDBInstance", :params => params)
68 68
       end
69 69
 
@@ -77,15 +77,15 @@ def create_db_parameter_group( options = {} )
77 77
         raise ArgumentError, "No :db_parameter_group_name provided" if options.does_not_have?(:db_parameter_group_name)
78 78
         raise ArgumentError, "No :engine provided" if options.does_not_have?(:engine)
79 79
         raise ArgumentError, "No :description provided" if options.does_not_have?(:description)
80  
-        
  80
+
81 81
         params = {}
82 82
         params['DBParameterGroupName'] = options[:db_parameter_group_name]
83 83
         params['Engine'] = options[:engine]
84 84
         params['Description'] = options[:description]
85  
-                
  85
+
86 86
         return response_generator(:action => "CreateDBParameterGroup", :params => params)
87 87
       end
88  
-      
  88
+
89 89
       # This API method creates a db security group
90 90
       #
91 91
       # @option options [String] :db_security_group_name is the name of the db security group (nil)
@@ -94,14 +94,14 @@ def create_db_parameter_group( options = {} )
94 94
       def create_db_security_group( options = {} )
95 95
         raise ArgumentError, "No :db_security_group_name provided" if options.does_not_have?(:db_security_group_name)
96 96
         raise ArgumentError, "No :db_security_group_description provided" if options.does_not_have?(:db_security_group_description)
97  
-        
  97
+
98 98
         params = {}
99 99
         params['DBSecurityGroupName'] = options[:db_security_group_name]
100 100
         params['DBSecurityGroupDescription'] = options[:db_security_group_description]
101  
-                
  101
+
102 102
         return response_generator(:action => "CreateDBSecurityGroup", :params => params)
103 103
       end
104  
-      
  104
+
105 105
       # This API method creates a restoreable db snapshot
106 106
       #
107 107
       # @option options [String] :db_snapshot_identifier is the identifier of the db snapshot
@@ -110,14 +110,14 @@ def create_db_security_group( options = {} )
110 110
       def create_db_snapshot( options = {} )
111 111
         raise ArgumentError, "No :db_snapshot_identifier provided" if options.does_not_have?(:db_snapshot_identifier)
112 112
         raise ArgumentError, "No :db_instance_identifier provided" if options.does_not_have?(:db_instance_identifier)
113  
-        
  113
+
114 114
         params = {}
115 115
         params['DBSnapshotIdentifier'] = options[:db_snapshot_identifier]
116 116
         params['DBInstanceIdentifier'] = options[:db_instance_identifier]
117  
-                
  117
+
118 118
         return response_generator(:action => "CreateDBSnapshot", :params => params)
119 119
       end
120  
-      
  120
+
121 121
       # This API method authorizes network ingress for an amazon ec2 group
122 122
       #
123 123
       # @option options [String] :db_security_group_name is the name of the db security group
@@ -127,10 +127,10 @@ def create_db_snapshot( options = {} )
127 127
       #
128 128
       def authorize_db_security_group( options = {} )
129 129
         raise ArgumentError, "No :db_security_group_name provided" if options.does_not_have?(:db_security_group_name)
130  
-        
  130
+
131 131
         params = {}
132 132
         params['DBSecurityGroupName'] = options[:db_security_group_name]
133  
-        
  133
+
134 134
         if options.has?(:cidrip)
135 135
           params['CIDRIP'] = options[:cidrip]
136 136
         elsif options.has?(:ec2_security_group_name) && options.has?(:ec2_security_group_owner_id)
@@ -139,20 +139,20 @@ def authorize_db_security_group( options = {} )
139 139
         else
140 140
           raise ArgumentError, "No :cidrip or :ec2_security_group_name and :ec2_security_group_owner_id provided"
141 141
         end
142  
-                
  142
+
143 143
         return response_generator(:action => "AuthorizeDBSecurityGroupIngress", :params => params)
144 144
       end
145  
-      
  145
+
146 146
       # This API method deletes a db paramter group
147 147
       #
148 148
       # @option options [String] :db_parameter_group_name is the name of the db paramter group to be deleted (nil)
149 149
       #
150 150
       def delete_db_parameter_group( options = {} )
151 151
         raise ArgumentError, "No :db_parameter_group_name provided" if options.does_not_have?(:db_parameter_group_name)
152  
-        
  152
+
153 153
         params = {}
154 154
         params['DBParameterGroupName'] = options[:db_parameter_group_name]
155  
-                
  155
+
156 156
         return response_generator(:action => "DeleteDBParameterGroup", :params => params)
157 157
       end
158 158
 
@@ -162,10 +162,10 @@ def delete_db_parameter_group( options = {} )
162 162
       #
163 163
       def delete_db_security_group( options = {} )
164 164
         raise ArgumentError, "No :db_security_group_name provided" if options.does_not_have?(:db_security_group_name)
165  
-        
  165
+
166 166
         params = {}
167 167
         params['DBSecurityGroupName'] = options[:db_security_group_name]
168  
-                
  168
+
169 169
         return response_generator(:action => "DeleteDBSecurityGroup", :params => params)
170 170
       end
171 171
 
@@ -175,25 +175,25 @@ def delete_db_security_group( options = {} )
175 175
       #
176 176
       def delete_db_snapshot( options = {} )
177 177
         raise ArgumentError, "No :db_snapshot_identifier provided" if options.does_not_have?(:db_snapshot_identifier)
178  
-        
  178
+
179 179
         params = {}
180 180
         params['DBSnapshotIdentifier'] = options[:db_snapshot_identifier]
181  
-                
  181
+
182 182
         return response_generator(:action => "DeleteDBSnapshot", :params => params)
183 183
       end
184  
-      
  184
+
185 185
       # This API method describes the db instances
186 186
       #
187 187
       # @option options [String] :db_instance_identifier if passed, only the description for the db instance matching this identifier is returned
188 188
       # @option options [String] :max_records is the maximum number of records to include in the response
189 189
       # @option options [String] :marker provided in the previous request
190 190
       #
191  
-      def describe_db_instances( options = {} )        
  191
+      def describe_db_instances( options = {} )
192 192
         params = {}
193 193
         params['DBInstanceIdentifier'] = options[:db_instance_identifier] if options.has?(:db_instance_identifier)
194 194
         params['MaxRecords'] = options[:max_records].to_s if options.has?(:max_records)
195 195
         params['Marker'] = options[:marker] if options.has?(:marker)
196  
-                
  196
+
197 197
         return response_generator(:action => "DescribeDBInstances", :params => params)
198 198
       end
199 199
 
@@ -203,38 +203,38 @@ def describe_db_instances( options = {} )
203 203
       # @option options [String] :max_records is the maximum number of records to include in the response
204 204
       # @option options [String] :marker provided in the previous request
205 205
       #
206  
-      def describe_engine_default_parameters( options = {} )        
  206
+      def describe_engine_default_parameters( options = {} )
207 207
         raise ArgumentError, "No :engine provided" if options.does_not_have?(:engine)
208  
-        
  208
+
209 209
         params = {}
210 210
         params['Engine'] = options[:engine]
211 211
         params['MaxRecords'] = options[:max_records].to_s if options.has?(:max_records)
212 212
         params['Marker'] = options[:marker] if options.has?(:marker)
213  
-                
  213
+
214 214
         return response_generator(:action => "DescribeEngineDefaultParameters", :params => params)
215 215
       end
216 216
 
217  
-      # This API method returns information about all DB Parameter Groups for an account if no 
218  
-      # DB Parameter Group name is supplied, or displays information about a specific named DB Parameter Group. 
  217
+      # This API method returns information about all DB Parameter Groups for an account if no
  218
+      # DB Parameter Group name is supplied, or displays information about a specific named DB Parameter Group.
219 219
       # You can call this operation recursively using the Marker parameter.
220  
-      # 
  220
+      #
221 221
       # @option options [String] :db_parameter_group_name is the name of the parameter group
222 222
       # @option options [String] :max_records is the maximum number of records to include in the response
223 223
       # @option options [String] :marker provided in the previous request
224 224
       #
225  
-      def describe_db_parameter_groups( options = {} )        
  225
+      def describe_db_parameter_groups( options = {} )
226 226
         params = {}
227 227
         params['DBParameterGroupName'] = options[:db_parameter_group_name] if options.has?(:db_parameter_group_name)
228 228
         params['MaxRecords'] = options[:max_records].to_s if options.has?(:max_records)
229 229
         params['Marker'] = options[:marker] if options.has?(:marker)
230  
-                
  230
+
231 231
         return response_generator(:action => "DescribeDBParameterGroups", :params => params)
232 232
       end
233 233
 
234  
-      # This API method returns information about parameters that are part of a parameter group. 
235  
-      # You can optionally request only parameters from a specific source. 
  234
+      # This API method returns information about parameters that are part of a parameter group.
  235
+      # You can optionally request only parameters from a specific source.
236 236
       # You can call this operation recursively using the Marker parameter.
237  
-      # 
  237
+      #
238 238
       # @option options [String] :db_parameter_group_name is the name parameter group
239 239
       # @option options [String] :source is the type of parameter to return
240 240
       # @option options [String] :max_records is the maximum number of records to include in the response
@@ -242,66 +242,66 @@ def describe_db_parameter_groups( options = {} )
242 242
       #
243 243
       def describe_db_parameters( options = {} )
244 244
         raise ArgumentError, "No :db_parameter_group_name provided" if options.does_not_have?(:db_parameter_group_name)
245  
-        
  245
+
246 246
         params = {}
247 247
         params['DBParameterGroupName'] = options[:db_parameter_group_name]
248 248
         params['Source'] = options[:source] if options.has?(:source)
249 249
         params['MaxRecords'] = options[:max_records].to_s if options.has?(:max_records)
250 250
         params['Marker'] = options[:marker] if options.has?(:marker)
251  
-                
  251
+
252 252
         return response_generator(:action => "DescribeDBParameters", :params => params)
253 253
       end
254 254
 
255  
-      # This API method returns all the DB Security Group details for a particular AWS account, 
256  
-      # or for a particular DB Security Group if a name is specified. 
  255
+      # This API method returns all the DB Security Group details for a particular AWS account,
  256
+      # or for a particular DB Security Group if a name is specified.
257 257
       # You can call this operation recursively using the Marker parameter.
258  
-      # 
  258
+      #
259 259
       # @option options [String] :db_security_group_name is the name of the security group
260 260
       # @option options [String] :max_records is the maximum number of records to include in the response
261 261
       # @option options [String] :marker provided in the previous request
262 262
       #
263  
-      def describe_db_security_groups( options = {} )        
  263
+      def describe_db_security_groups( options = {} )
264 264
         params = {}
265 265
         params['DBSecurityGroupName'] = options[:db_security_group_name] if options.has?(:db_security_group_name)
266 266
         params['MaxRecords'] = options[:max_records].to_s if options.has?(:max_records)
267 267
         params['Marker'] = options[:marker] if options.has?(:marker)
268  
-                
  268
+
269 269
         return response_generator(:action => "DescribeDBSecurityGroups", :params => params)
270 270
       end
271 271
 
272  
-      # This API method returns information about the DB Snapshots for this account. 
273  
-      # If you pass in a DBInstanceIdentifier, it returns information only about DB Snapshots taken for that DB Instance. 
274  
-      # If you pass in a DBSnapshotIdentifier,it will return information only about the specified snapshot. 
275  
-      # If you omit both DBInstanceIdentifier and DBSnapshotIdentifier, it returns all snapshot information for all 
276  
-      # database instances, up to the maximum number of records specified. Passing both DBInstanceIdentifier and 
  272
+      # This API method returns information about the DB Snapshots for this account.
  273
+      # If you pass in a DBInstanceIdentifier, it returns information only about DB Snapshots taken for that DB Instance.
  274
+      # If you pass in a DBSnapshotIdentifier,it will return information only about the specified snapshot.
  275
+      # If you omit both DBInstanceIdentifier and DBSnapshotIdentifier, it returns all snapshot information for all
  276
+      # database instances, up to the maximum number of records specified. Passing both DBInstanceIdentifier and
277 277
       # DBSnapshotIdentifier results in an error.
278  
-      # 
  278
+      #
279 279
       # @option options [String] :db_instance_identifier is the unique identifier that identifies a DB instance
280 280
       # @option options [String] :db_snapshot_identifier is a unique identifier for an amazon RDS snapshot
281 281
       # @option options [String] :max_records is the maximum number of records to include in the response
282 282
       # @option options [String] :marker provided in the previous request
283 283
       #
284  
-      def describe_db_snapshots( options = {} )        
  284
+      def describe_db_snapshots( options = {} )
285 285
         raise ArgumentError, "No :db_instance_identifier provided" if options.does_not_have?(:db_instance_identifier)
286  
-        
  286
+
287 287
         params = {}
288 288
         params['DBInstanceIdentifier'] = options[:db_instance_identifier]
289  
-        
  289
+
290 290
         params['DBSnapshotIdentifier'] = options[:db_snapshot_identifier] if options.has?(:db_snapshot_identifier)
291 291
         params['MaxRecords'] = options[:max_records].to_s if options.has?(:max_records)
292 292
         params['Marker'] = options[:marker] if options.has?(:marker)
293  
-                
  293
+
294 294
         return response_generator(:action => "DescribeDBSnapshots", :params => params)
295 295
       end
296 296
 
297  
-      # This API method Returns information about events related to your DB Instances, DB Security Groups, 
298  
-      # and DB Parameter Groups for up to the past 14 days. 
299  
-      # You can get events specific to a particular DB Instance or DB Security Group by providing the name as a parameter. 
  297
+      # This API method Returns information about events related to your DB Instances, DB Security Groups,
  298
+      # and DB Parameter Groups for up to the past 14 days.
  299
+      # You can get events specific to a particular DB Instance or DB Security Group by providing the name as a parameter.
300 300
       # By default, the past hour of events are returned.
301  
-      # 
302  
-      # If neither DBInstanceIdentifier or DBSecurityGroupName are provided, 
  301
+      #
  302
+      # If neither DBInstanceIdentifier or DBSecurityGroupName are provided,
303 303
       # all events are be retrieved for DB Instances and DB Security Groups.
304  
-      # 
  304
+      #
305 305
       # @option options [String] :source_identifier is the identifier for the source for which events will be included
306 306
       # @option options [String] :source_type is the type of event sources to return
307 307
       # @option options [String] :start_time is the beginning of the time interval to return records for (ISO 8601 format)
@@ -310,7 +310,7 @@ def describe_db_snapshots( options = {} )
310 310
       # @option options [String] :max_records is the maximum number of records to include in the response
311 311
       # @option options [String] :marker provided in the previous request
312 312
       #
313  
-      def describe_events( options = {} )        
  313
+      def describe_events( options = {} )
314 314
         params = {}
315 315
         params['SourceIdentifier'] = options[:source_identifier] if options.has?(:source_identifier)
316 316
         params['SourceType'] = options[:source_type] if options.has?(:source_type)
@@ -319,17 +319,17 @@ def describe_events( options = {} )
319 319
         params['Duration'] = options[:duration] if options.has?(:duration)
320 320
         params['MaxRecords'] = options[:max_records].to_s if options.has?(:max_records)
321 321
         params['Marker'] = options[:marker] if options.has?(:marker)
322  
-                
  322
+
323 323
         return response_generator(:action => "DescribeEvents", :params => params)
324 324
       end
325 325
 
326 326
       # This API changes the settings of an existing DB Instance.
327  
-      # 
328  
-      # Changes are applied in the following manner: A ModifyDBInstance API call to modify security groups or to 
329  
-      # change the maintenance windows results in immediate action. Modification of the DB Parameter Group applies 
330  
-      # immediate parameters as soon as possible and pending-reboot parameters only when the RDS instance is rebooted. 
  327
+      #
  328
+      # Changes are applied in the following manner: A ModifyDBInstance API call to modify security groups or to
  329
+      # change the maintenance windows results in immediate action. Modification of the DB Parameter Group applies
  330
+      # immediate parameters as soon as possible and pending-reboot parameters only when the RDS instance is rebooted.
331 331
       # A request to scale the DB Instance class results puts the database instance into the modifying state.
332  
-      # 
  332
+      #
333 333
       # The DB Instance must be in available or modifying state for this API to accept changes.
334 334
       #
335 335
       # @option options [String] :db_instance_identifier (nil) the name of the db_instance
@@ -346,13 +346,13 @@ def describe_events( options = {} )
346 346
       # @option options [String] :preferred_maintenance_window in format: ddd:hh24:mi-ddd:hh24:mi (nil)
347 347
       # @option options [String] :backend_retention_period is the number of days which automated backups are retained (1)
348 348
       # @option options [String] :preferred_backup_window is the daily time range for which automated backups are created
349  
-      #    
  349
+      #
350 350
       def modify_db_instance( options = {})
351 351
         raise ArgumentError, "No :db_instance_identifier provided" if options.does_not_have?(:db_instance_identifier)
352  
-        
  352
+
353 353
         params = {}
354 354
         params['DBInstanceIdentifier'] = options[:db_instance_identifier]
355  
-        
  355
+
356 356
         params["AllocatedStorage"] = options[:allocated_storage].to_s if options.has?(:allocated_storage)
357 357
         params["DBInstanceClass"] = options[:db_instance_class] if options.has?(:db_instance_class)
358 358
         params["Engine"] = options[:engine] if options.has?(:engine)
@@ -366,13 +366,13 @@ def modify_db_instance( options = {})
366 366
         params["PreferredMaintenanceWindow"] = options[:preferred_backup_window] if options.has?(:preferred_backup_window)
367 367
         params["BackupRetentionPeriod"] = options[:backend_retention_period] if options.has?(:backend_retention_period)
368 368
         params["PreferredBackupWindow"] = options[:preferred_backup_window] if options.has?(:preferred_backup_window)
369  
-        
  369
+
370 370
         return response_generator(:action => "ModifyDBInstance", :params => params)
371 371
       end
372 372
 
373  
-      # This API method modifies the parameters of a DB Parameter Group. 
374  
-      # To modify more than one parameter, submit a list of the following: ParameterName, ParameterValue, and ApplyMethod. 
375  
-      # You can modify a maximum of 20 parameters in a single request.      
  373
+      # This API method modifies the parameters of a DB Parameter Group.
  374
+      # To modify more than one parameter, submit a list of the following: ParameterName, ParameterValue, and ApplyMethod.
  375
+      # You can modify a maximum of 20 parameters in a single request.
376 376
       #
377 377
       # @option options [String] :db_parameter_group_name is the name of the parameter group to modify
378 378
       # @option options [String] :parameters is the array of parameters to update in a hash format
@@ -381,7 +381,7 @@ def modify_db_instance( options = {})
381 381
       def modify_db_parameter_group( options = {} )
382 382
         raise ArgumentError, "No :db_parameter_group_name provided" if options.does_not_have?(:db_parameter_group_name)
383 383
         raise ArgumentError, "No :parameters provided" if options.does_not_have?(:parameters)
384  
-        
  384
+
385 385
         params = {}
386 386
         params['DBParameterGroupName'] = options[:db_parameter_group_name]
387 387
         params.merge!(pathhashlist('Parameters.member', [options[:parameters]].flatten, {
@@ -389,13 +389,13 @@ def modify_db_parameter_group( options = {} )
389 389
           :value => 'ParameterValue',
390 390
           :apply_method => "ApplyMethod"
391 391
         }))
392  
-        
  392
+
393 393
         return response_generator(:action => "ModifyDBParameterGroup", :params => params)
394 394
       end
395 395
 
396  
-      # This API method reboots a DB Instance. 
  396
+      # This API method reboots a DB Instance.
397 397
       # Once started, the process cannot be stopped, and the database instance will be unavailable until the reboot completes.
398  
-      # 
  398
+      #
399 399
       # @option options [String] :db_instance_identifier is the identifier for the db instance to restart
400 400
       #
401 401
       def reboot_db_instance( options = {} )
@@ -403,13 +403,13 @@ def reboot_db_instance( options = {} )
403 403
         )
404 404
         params = {}
405 405
         params['DBInstanceIdentifier'] = options[:db_instance_identifier] if options.has?(:db_instance_identifier)
406  
-                
  406
+
407 407
         return response_generator(:action => "RebootDBInstance", :params => params)
408 408
       end
409 409
 
410  
-      # This API method modifies the parameters of a DB Parameter Group. 
411  
-      # To modify more than one parameter, submit a list of the following: ParameterName, ParameterValue, and ApplyMethod. 
412  
-      # You can modify a maximum of 20 parameters in a single request.      
  410
+      # This API method modifies the parameters of a DB Parameter Group.
  411
+      # To modify more than one parameter, submit a list of the following: ParameterName, ParameterValue, and ApplyMethod.
  412
+      # You can modify a maximum of 20 parameters in a single request.
413 413
       #
414 414
       # @option options [String] :db_parameter_group_name is the name of the parameter group to modify
415 415
       # @option options [String] :reset_all_parameters specified whether to reset all the db parameters
@@ -419,7 +419,7 @@ def reboot_db_instance( options = {} )
419 419
       def reset_db_parameter_group( options = {} )
420 420
         raise ArgumentError, "No :db_parameter_group_name provided" if options.does_not_have?(:db_parameter_group_name)
421 421
         raise ArgumentError, "No :parameters provided" if options.does_not_have?(:parameters)
422  
-        
  422
+
423 423
         params = {}
424 424
         params['DBParameterGroupName'] = options[:db_parameter_group_name]
425 425
         params.merge!(pathhashlist('Parameters.member', [options[:parameters]].flatten, {
@@ -427,7 +427,7 @@ def reset_db_parameter_group( options = {} )
427 427
           :apply_method => "ApplyMethod"
428 428
         }))
429 429
         params['ResetAllParameters'] = options[:reset_all_parameters] if options.has?(:reset_all_parameters)
430  
-        
  430
+
431 431
         return response_generator(:action => "ResetDBParameterGroup", :params => params)
432 432
       end
433 433
 
@@ -439,26 +439,26 @@ def reset_db_parameter_group( options = {} )
439 439
       # @option options [String] :port is the port which the db can accept connections on
440 440
       # @option options [String] :availability_zone is the EC2 zone which the db instance will be created
441 441
       #
442  
-      def restore_db_instance_from_snapshot( options = {} )        
  442
+      def restore_db_instance_from_snapshot( options = {} )
443 443
         raise ArgumentError, "No :db_snapshot_identifier provided" if options.does_not_have?(:db_snapshot_identifier)
444 444
         raise ArgumentError, "No :db_instance_identifier provided" if options.does_not_have?(:db_instance_identifier)
445 445
         raise ArgumentError, "No :db_instance_class provided" if options.does_not_have?(:db_instance_class)
446  
-        
  446
+
447 447
         params = {}
448 448
         params['DBSnapshotIdentifier'] = options[:db_snapshot_identifier]
449 449
         params['DBInstanceIdentifier'] = options[:db_instance_identifier]
450 450
         params['DBInstanceClass'] = options[:db_instance_class]
451  
-        
  451
+
452 452
         params['Port'] = options[:port].to_s if options.has?(:port)
453 453
         params['AvailabilityZone'] = options[:availability_zone] if options.has?(:availability_zone)
454  
-                
  454
+
455 455
         return response_generator(:action => "RestoreDBInstanceFromDBSnapshot", :params => params)
456 456
       end
457 457
 
458 458
       # This API method restores a DB Instance to a specified time, creating a new DB Instance.
459  
-      # 
460  
-      # Some characteristics of the new DB Instance can be modified using optional parameters. 
461  
-      # If these options are omitted, the new DB Instance defaults to the characteristics of the DB Instance from which the 
  459
+      #
  460
+      # Some characteristics of the new DB Instance can be modified using optional parameters.
  461
+      # If these options are omitted, the new DB Instance defaults to the characteristics of the DB Instance from which the
462 462
       # DB Snapshot was created.
463 463
       #
464 464
       # @option options [String] :source_db_instance_identifier the identifier of the source DB Instance from which to restore.
@@ -469,25 +469,25 @@ def restore_db_instance_from_snapshot( options = {} )
469 469
       # @option options [String] :port is the port which the db can accept connections on
470 470
       # @option options [String] :availability_zone is the EC2 zone which the db instance will be created
471 471
       #
472  
-      def restore_db_instance_to_point_in_time( options = {} )        
  472
+      def restore_db_instance_to_point_in_time( options = {} )
473 473
         raise ArgumentError, "No :db_snapshot_identifier provided" if options.does_not_have?(:db_snapshot_identifier)
474 474
         raise ArgumentError, "No :db_instance_identifier provided" if options.does_not_have?(:db_instance_identifier)
475 475
         raise ArgumentError, "No :db_instance_class provided" if options.does_not_have?(:db_instance_class)
476  
-        
  476
+
477 477
         params = {}
478 478
         params['SourceDBInstanceIdentifier'] = options[:source_db_instance_identifier]
479 479
         params['TargetDBInstanceIdentifier'] = options[:target_db_instance_identifier]
480  
-        
  480
+
481 481
         if options[:use_latest_restorable_time]
482 482
           params['UseLatestRestorableTime'] = options[:use_latest_restorable_time]
483 483
         elsif options[:restore_time]
484 484
           params['RestoreTime'] = options[:restore_time]
485 485
         end
486  
-        
  486
+
487 487
         params['DBInstanceClass'] = options[:db_instance_class] if options.has?(:db_instance_class)
488 488
         params['Port'] = options[:port].to_s if options.has?(:port)
489 489
         params['AvailabilityZone'] = options[:availability_zone] if options.has?(:availability_zone)
490  
-        
  490
+
491 491
         return response_generator(:action => "RestoreDBInstanceToPointInTime", :params => params)
492 492
       end
493 493
 
@@ -500,10 +500,10 @@ def restore_db_instance_to_point_in_time( options = {} )
500 500
       #
501 501
       def revoke_db_security_group( options = {} )
502 502
         raise ArgumentError, "No :db_security_group_name provided" if options.does_not_have?(:db_security_group_name)
503  
-        
  503
+
504 504
         params = {}
505 505
         params['DBSecurityGroupName'] = options[:db_security_group_name]
506  
-        
  506
+
507 507
         if options.has?(:cidrip)
508 508
           params['CIDRIP'] = options[:cidrip]
509 509
         elsif options.has?(:ec2_security_group_name) && options.has?(:ec2_security_group_owner_id)
@@ -512,11 +512,11 @@ def revoke_db_security_group( options = {} )
512 512
         else
513 513
           raise ArgumentError, "No :cidrip or :ec2_security_group_name and :ec2_security_group_owner_id provided"
514 514
         end
515  
-                
  515
+
516 516
         return response_generator(:action => "RevokeDBSecurityGroupIngress", :params => params)
517 517
       end
518  
-      
519  
-      
  518
+
520 519
     end
521 520
   end
522  
-end
  521
+end
  522
+
46  test/test_RDS.rb
... ...
@@ -1,6 +1,6 @@
1 1
 require File.dirname(__FILE__) + '/test_helper.rb'
2 2
 
3  
-context "elb load balancers " do
  3
+context "rds databases " do
4 4
   before do
5 5
     @rds = AWS::RDS::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" )
6 6
 
@@ -47,17 +47,17 @@
47 47
     </CreateDBSecurityGroupResponse>
48 48
     RESPONSE
49 49
   end
50  
-  
  50
+
51 51
   specify "should be able to be create a db_instance" do
52  
-    @rds.stubs(:make_request).with('CreateDBInstance', {'Engine' => 'MySQL5.1', 
53  
-        'MasterUsername' => 'master', 
54  
-        'DBInstanceClass' => 'db.m1.large', 
55  
-        'DBInstanceIdentifier' => 'testdb', 
56  
-        'AllocatedStorage' => '10', 
  52
+    @rds.stubs(:make_request).with('CreateDBInstance', {'Engine' => 'MySQL5.1',
  53
+        'MasterUsername' => 'master',
  54
+        'DBInstanceClass' => 'db.m1.large',
  55
+        'DBInstanceIdentifier' => 'testdb',
  56
+        'AllocatedStorage' => '10',
57 57
         'MasterUserPassword' => 'SecretPassword01'}).
58 58
       returns stub(:body => @create_db_instance_body, :is_a? => true)
59 59
     response = @rds.create_db_instance(
60  
-      :db_instance_class => "db.m1.large", 
  60
+      :db_instance_class => "db.m1.large",
61 61
       :db_instance_identifier=>"testdb",
62 62
       :allocated_storage => 10,
63 63
       :engine => "MySQL5.1",
@@ -71,7 +71,7 @@
71 71
 
72 72
   specify "should be able to create_db_security_group" do
73 73
     @rds.stubs(:make_request).with('CreateDBSecurityGroup', {
74  
-                      'DBSecurityGroupName' => 'mydbsecuritygroup', 
  74
+                      'DBSecurityGroupName' => 'mydbsecuritygroup',
75 75
                       'DBSecurityGroupDescription' => 'My new DBSecurityGroup'}).
76 76
       returns stub(:body => @create_db_security_group, :is_a? => true)
77 77
     response = @rds.create_db_security_group(
@@ -82,7 +82,7 @@
82 82
 
83 83
     assert_equal response.CreateDBSecurityGroupResult.DBSecurityGroup.DBSecurityGroupName, "mydbsecuritygroup4"
84 84
   end
85  
-  
  85
+
86 86
   specify "should be able to create_db_parameter_group" do
87 87
     body =<<-EOE
88 88
     <CreateDBParameterGroupResponse xmlns="http://rds.amazonaws.com/admin/2009-10-16/">
@@ -98,8 +98,8 @@
98 98
       </ResponseMetadata>
99 99
     </CreateDBParameterGroupResponse>
100 100
     EOE
101  
-    @rds.stubs(:make_request).with('CreateDBParameterGroup', {'Engine' => 'MySQL5.1', 
102  
-                                                  'DBParameterGroupName' => 'mydbsecuritygroup', 
  101
+    @rds.stubs(:make_request).with('CreateDBParameterGroup', {'Engine' => 'MySQL5.1',
  102
+                                                  'DBParameterGroupName' => 'mydbsecuritygroup',
103 103
                                                   'Description' => 'My test DBSecurity group'}).
104 104
       returns stub(:body => body, :is_a? => true)
105 105
     response = @rds.create_db_parameter_group(
@@ -143,7 +143,7 @@
143 143
 
144 144
     assert_equal response.CreateDBSnapshotResult.DBSnapshot.DBSnapshotIdentifier, "mynewdbsnapshot3"
145 145
   end
146  
-  
  146
+
147 147
   specify "should be able to authorize_db_security_group" do
148 148
     body =<<-EOE
149 149
     <AuthorizeDBSecurityGroupIngressResponse xmlns="http://rds.amazonaws.com/admin/2009-10-16/">
@@ -176,7 +176,7 @@
176 176
 
177 177
     assert_equal response.AuthorizeDBSecurityGroupIngressResult.DBSecurityGroup.IPRanges.IPRange.CIDRIP, "192.168.1.1/24"
178 178
   end
179  
-  
  179
+
180 180
   specify "should be able to delete_db_parameter_group" do
181 181
     body =<<-EOE
182 182
     <DeleteDBParameterGroupResponse xmlns="http://rds.amazonaws.com/admin/2009-10-16/">
@@ -192,7 +192,7 @@
192 192
       )
193 193
     response.should.be.an.instance_of Hash
194 194
   end
195  
-  
  195
+
196 196
   specify "should be able to delete_db_security_group" do
197 197
     body =<<-EOE
198 198
     <DeleteDBParameterGroupResponse xmlns="http://rds.amazonaws.com/admin/2009-10-16/">
@@ -329,15 +329,15 @@
329 329
       </ResponseMetadata>
330 330
     </ModifyDBParameterGroupResponse>
331 331
     EOE
332  
-    
  332
+
333 333
     @rds.stubs(:make_request).with('ModifyDBParameterGroup', {
334  
-        'DBParameterGroupName' => 'mytestdb', 
335  
-        'Parameters.member.1.ParameterName' => 'max_user_connections', 
336  
-        'Parameters.member.1.ParameterValue' => '24', 
  334
+        'DBParameterGroupName' => 'mytestdb',
  335
+        'Parameters.member.1.ParameterName' => 'max_user_connections',
  336
+        'Parameters.member.1.ParameterValue' => '24',
337 337
         'Parameters.member.1.ApplyMethod' => 'pending-reboot',
338 338
         'Parameters.member.2.ParameterName' => 'max_allowed_packet',
339  
-        'Parameters.member.2.ParameterValue' => '1024', 
340  
-        'Parameters.member.2.ApplyMethod' => 'immediate', 
  339
+        'Parameters.member.2.ParameterValue' => '1024',
  340
+        'Parameters.member.2.ApplyMethod' => 'immediate',
341 341
         }).
342 342
       returns stub(:body => body, :is_a? => true)
343 343
     response = @rds.modify_db_parameter_group(
@@ -350,5 +350,5 @@
350 350
     response.should.be.an.instance_of Hash
351 351
   end
352 352
 
353  
-  
354  
-end
  353
+end
  354
+

0 notes on commit fd20977

Please sign in to comment.
Something went wrong with that request. Please try again.