File: delete_db_subnet_group.rb

package info (click to toggle)
ruby-fog-aws 3.8.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 8,092 kB
  • sloc: ruby: 72,795; javascript: 14; makefile: 9; sh: 4
file content (40 lines) | stat: -rw-r--r-- 1,405 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
module Fog
  module AWS
    class RDS
      class Real
        require 'fog/aws/parsers/rds/delete_db_subnet_group'

        # Deletes a db subnet group
        # http://docs.aws.amazon.com/AmazonRDS/2013-09-09/APIReference/API_DeleteDBSubnetGroup.html
        # ==== Parameters
        # * DBSubnetGroupName <~String> - The name for the DB Subnet Group. This value is stored as a lowercase string. Must contain no more than 255 alphanumeric characters or hyphens. Must not be "Default".
        # ==== Returns
        # * response<~Excon::Response>:
        #   * body<~Hash>:
        def delete_db_subnet_group(name)
          params = { 'Action'  => 'DeleteDBSubnetGroup',
            'DBSubnetGroupName' => name,
            :parser   => Fog::Parsers::AWS::RDS::DeleteDBSubnetGroup.new }
          request(params)
        end
      end

      class Mock
        def delete_db_subnet_group(name)
          response = Excon::Response.new
          unless self.data[:subnet_groups] && self.data[:subnet_groups][name]
            raise Fog::AWS::RDS::NotFound.new("DBSubnetGroupNotFound => The subnet group '#{name}' doesn't exists")
          end

          self.data[:subnet_groups].delete(name)

          response.body = {
            'ResponseMetadata'=>{ 'RequestId'=> Fog::AWS::Mock.request_id },
            'return' => true,
          }
          response
        end
      end
    end
  end
end