30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/fog/aws/requests/rds/create_db_subnet_group.rb', line 30
def create_db_subnet_group(name, subnet_ids, description = name)
response = Excon::Response.new
if self.data[:subnet_groups] && self.data[:subnet_groups][name]
raise Fog::AWS::RDS::IdentifierTaken.new("DBSubnetGroupAlreadyExists => The subnet group '#{name}' already exists")
end
subnets = subnet_ids.map { |snid| Fog::Compute[:aws].subnets.get(snid) }
vpc_id = subnets.first.vpc_id
data = {
'DBSubnetGroupName' => name,
'DBSubnetGroupDescription' => description,
'SubnetGroupStatus' => 'Complete',
'Subnets' => subnet_ids,
'VpcId' => vpc_id
}
self.data[:subnet_groups][name] = data
response.body = {
"ResponseMetadata"=>{ "RequestId"=> Fog::AWS::Mock.request_id },
'CreateDBSubnetGroupResult' => { 'DBSubnetGroup' => data }
}
response
end
|