diff --git a/lib/AWS/RDS/rds.rb b/lib/AWS/RDS/rds.rb index 3347767..e861709 100644 --- a/lib/AWS/RDS/rds.rb +++ b/lib/AWS/RDS/rds.rb @@ -66,6 +66,26 @@ def delete_db_instance( options = {} ) return response_generator(:action => "DeleteDBInstance", :params => params) end + + # This API method creates a db parameter group + # + # @option options [String] :db_parameter_group_name is the name of the parameter group (nil) + # @option options [String] :engine is the engine the db parameter group can be used with (nil) + # @option options [String] :description is the description of the paramter group + # + def create_db_parameter_group( options = {} ) + raise ArgumentError, "No :db_parameter_group_name provided" if options.does_not_have?(:db_parameter_group_name) + raise ArgumentError, "No :engine provided" if options.does_not_have?(:engine) + raise ArgumentError, "No :description provided" if options.does_not_have?(:description) + + params = {} + params['DBParameterGroupName'] = options[:db_parameter_group_name] + params['Engine'] = options[:engine] + params['Description'] = options[:description] + + return response_generator(:action => "CreateDBParameterGroup", :params => params) + end + # This API method creates a db security group # diff --git a/test/test_RDS.rb b/test/test_RDS.rb index 9f07deb..d6c41bd 100644 --- a/test/test_RDS.rb +++ b/test/test_RDS.rb @@ -48,7 +48,7 @@ RESPONSE end - specify "should be able to be create a db_isntance" do + specify "should be able to be create a db_instance" do @rds.stubs(:make_request).with('CreateDBInstance', {'Engine' => 'MySQL5.1', 'MasterUsername' => 'master', 'DBInstanceClass' => 'db.m1.large', @@ -83,4 +83,34 @@ assert_equal response.CreateDBSecurityGroupResult.DBSecurityGroup.DBSecurityGroupName, "mydbsecuritygroup4" end + specify "should be able to create_db_parameter_group" do + body =<<-EOE + + + + mysql5.1 + My new DBParameterGroup + mydbparametergroup3 + + + + 0b447b66-bf36-11de-a88b-7b5b3d23b3a7 + + + EOE + @rds.stubs(:make_request).with('CreateDBParameterGroup', {'Engine' => 'MySQL5.1', + 'DBParameterGroupName' => 'mydbsecuritygroup', + 'Description' => 'My test DBSecurity group'}). + returns stub(:body => body, :is_a? => true) + response = @rds.create_db_parameter_group( + :db_parameter_group_name => "mydbsecuritygroup", + :description => "My test DBSecurity group", + :engine => "MySQL5.1" + ) + response.should.be.an.instance_of Hash + + assert_equal response.CreateDBParameterGroupResult.DBParameterGroup.DBParameterGroupName, "mydbparametergroup3" + end + + end \ No newline at end of file