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
compute_data = Fog::Compute::AWS::Mock.data[self.region][self.aws_access_key_id]
subnets = subnet_ids.map do |snid|
subnet = compute_data[:subnets].detect { |s| s['subnetId'] == snid }
raise Fog::AWS::RDS::NotFound.new("InvalidSubnet => The subnet '#{snid}' was not found") if subnet.nil?
subnet
end
vpc_id = subnets.first['vpcId']
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