Method: Fog::AWS::RDS::Mock#create_db_security_group

Defined in:
lib/fog/aws/requests/rds/create_db_security_group.rb

#create_db_security_group(name, description = name) ⇒ Object

[View source]

29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/fog/aws/requests/rds/create_db_security_group.rb', line 29

def create_db_security_group(name, description = name)
  response = Excon::Response.new
  if self.data[:security_groups] and self.data[:security_groups][name]
    raise Fog::AWS::RDS::IdentifierTaken.new("DBInstanceAlreadyExists => The security group '#{name}' already exists")
  end
  
  data = {
    'DBSecurityGroupName' => name,
    'DBSecurityGroupDescription' => description,
    'EC2SecurityGroups' => [],
    'IPRanges' => [],
    'OwnerId' => '0123456789'
  }
  self.data[:security_groups][name] = data
  response.body = {
    "ResponseMetadata"=>{ "RequestId"=> Fog::AWS::Mock.request_id },
    'CreateDBSecurityGroupResult' => { 'DBSecurityGroup' => data }
  }
  response
  
end