{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.RDS.DeleteDBSubnetGroup
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Deletes a DB subnet group.
--
-- The specified database subnet group must not be associated with any DB
-- instances.
module Amazonka.RDS.DeleteDBSubnetGroup
  ( -- * Creating a Request
    DeleteDBSubnetGroup (..),
    newDeleteDBSubnetGroup,

    -- * Request Lenses
    deleteDBSubnetGroup_dbSubnetGroupName,

    -- * Destructuring the Response
    DeleteDBSubnetGroupResponse (..),
    newDeleteDBSubnetGroupResponse,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import Amazonka.RDS.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- |
--
-- /See:/ 'newDeleteDBSubnetGroup' smart constructor.
data DeleteDBSubnetGroup = DeleteDBSubnetGroup'
  { -- | The name of the database subnet group to delete.
    --
    -- You can\'t delete the default subnet group.
    --
    -- Constraints: Must match the name of an existing DBSubnetGroup. Must not
    -- be default.
    --
    -- Example: @mydbsubnetgroup@
    DeleteDBSubnetGroup -> Text
dbSubnetGroupName :: Prelude.Text
  }
  deriving (DeleteDBSubnetGroup -> DeleteDBSubnetGroup -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteDBSubnetGroup -> DeleteDBSubnetGroup -> Bool
$c/= :: DeleteDBSubnetGroup -> DeleteDBSubnetGroup -> Bool
== :: DeleteDBSubnetGroup -> DeleteDBSubnetGroup -> Bool
$c== :: DeleteDBSubnetGroup -> DeleteDBSubnetGroup -> Bool
Prelude.Eq, ReadPrec [DeleteDBSubnetGroup]
ReadPrec DeleteDBSubnetGroup
Int -> ReadS DeleteDBSubnetGroup
ReadS [DeleteDBSubnetGroup]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteDBSubnetGroup]
$creadListPrec :: ReadPrec [DeleteDBSubnetGroup]
readPrec :: ReadPrec DeleteDBSubnetGroup
$creadPrec :: ReadPrec DeleteDBSubnetGroup
readList :: ReadS [DeleteDBSubnetGroup]
$creadList :: ReadS [DeleteDBSubnetGroup]
readsPrec :: Int -> ReadS DeleteDBSubnetGroup
$creadsPrec :: Int -> ReadS DeleteDBSubnetGroup
Prelude.Read, Int -> DeleteDBSubnetGroup -> ShowS
[DeleteDBSubnetGroup] -> ShowS
DeleteDBSubnetGroup -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteDBSubnetGroup] -> ShowS
$cshowList :: [DeleteDBSubnetGroup] -> ShowS
show :: DeleteDBSubnetGroup -> String
$cshow :: DeleteDBSubnetGroup -> String
showsPrec :: Int -> DeleteDBSubnetGroup -> ShowS
$cshowsPrec :: Int -> DeleteDBSubnetGroup -> ShowS
Prelude.Show, forall x. Rep DeleteDBSubnetGroup x -> DeleteDBSubnetGroup
forall x. DeleteDBSubnetGroup -> Rep DeleteDBSubnetGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteDBSubnetGroup x -> DeleteDBSubnetGroup
$cfrom :: forall x. DeleteDBSubnetGroup -> Rep DeleteDBSubnetGroup x
Prelude.Generic)

-- |
-- Create a value of 'DeleteDBSubnetGroup' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'dbSubnetGroupName', 'deleteDBSubnetGroup_dbSubnetGroupName' - The name of the database subnet group to delete.
--
-- You can\'t delete the default subnet group.
--
-- Constraints: Must match the name of an existing DBSubnetGroup. Must not
-- be default.
--
-- Example: @mydbsubnetgroup@
newDeleteDBSubnetGroup ::
  -- | 'dbSubnetGroupName'
  Prelude.Text ->
  DeleteDBSubnetGroup
newDeleteDBSubnetGroup :: Text -> DeleteDBSubnetGroup
newDeleteDBSubnetGroup Text
pDBSubnetGroupName_ =
  DeleteDBSubnetGroup'
    { $sel:dbSubnetGroupName:DeleteDBSubnetGroup' :: Text
dbSubnetGroupName =
        Text
pDBSubnetGroupName_
    }

-- | The name of the database subnet group to delete.
--
-- You can\'t delete the default subnet group.
--
-- Constraints: Must match the name of an existing DBSubnetGroup. Must not
-- be default.
--
-- Example: @mydbsubnetgroup@
deleteDBSubnetGroup_dbSubnetGroupName :: Lens.Lens' DeleteDBSubnetGroup Prelude.Text
deleteDBSubnetGroup_dbSubnetGroupName :: Lens' DeleteDBSubnetGroup Text
deleteDBSubnetGroup_dbSubnetGroupName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDBSubnetGroup' {Text
dbSubnetGroupName :: Text
$sel:dbSubnetGroupName:DeleteDBSubnetGroup' :: DeleteDBSubnetGroup -> Text
dbSubnetGroupName} -> Text
dbSubnetGroupName) (\s :: DeleteDBSubnetGroup
s@DeleteDBSubnetGroup' {} Text
a -> DeleteDBSubnetGroup
s {$sel:dbSubnetGroupName:DeleteDBSubnetGroup' :: Text
dbSubnetGroupName = Text
a} :: DeleteDBSubnetGroup)

instance Core.AWSRequest DeleteDBSubnetGroup where
  type
    AWSResponse DeleteDBSubnetGroup =
      DeleteDBSubnetGroupResponse
  request :: (Service -> Service)
-> DeleteDBSubnetGroup -> Request DeleteDBSubnetGroup
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.postQuery (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeleteDBSubnetGroup
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteDBSubnetGroup)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull DeleteDBSubnetGroupResponse
DeleteDBSubnetGroupResponse'

instance Prelude.Hashable DeleteDBSubnetGroup where
  hashWithSalt :: Int -> DeleteDBSubnetGroup -> Int
hashWithSalt Int
_salt DeleteDBSubnetGroup' {Text
dbSubnetGroupName :: Text
$sel:dbSubnetGroupName:DeleteDBSubnetGroup' :: DeleteDBSubnetGroup -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
dbSubnetGroupName

instance Prelude.NFData DeleteDBSubnetGroup where
  rnf :: DeleteDBSubnetGroup -> ()
rnf DeleteDBSubnetGroup' {Text
dbSubnetGroupName :: Text
$sel:dbSubnetGroupName:DeleteDBSubnetGroup' :: DeleteDBSubnetGroup -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
dbSubnetGroupName

instance Data.ToHeaders DeleteDBSubnetGroup where
  toHeaders :: DeleteDBSubnetGroup -> [Header]
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

instance Data.ToPath DeleteDBSubnetGroup where
  toPath :: DeleteDBSubnetGroup -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Data.ToQuery DeleteDBSubnetGroup where
  toQuery :: DeleteDBSubnetGroup -> QueryString
toQuery DeleteDBSubnetGroup' {Text
dbSubnetGroupName :: Text
$sel:dbSubnetGroupName:DeleteDBSubnetGroup' :: DeleteDBSubnetGroup -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"DeleteDBSubnetGroup" :: Prelude.ByteString),
        ByteString
"Version"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2014-10-31" :: Prelude.ByteString),
        ByteString
"DBSubnetGroupName" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
dbSubnetGroupName
      ]

-- | /See:/ 'newDeleteDBSubnetGroupResponse' smart constructor.
data DeleteDBSubnetGroupResponse = DeleteDBSubnetGroupResponse'
  {
  }
  deriving (DeleteDBSubnetGroupResponse -> DeleteDBSubnetGroupResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteDBSubnetGroupResponse -> DeleteDBSubnetGroupResponse -> Bool
$c/= :: DeleteDBSubnetGroupResponse -> DeleteDBSubnetGroupResponse -> Bool
== :: DeleteDBSubnetGroupResponse -> DeleteDBSubnetGroupResponse -> Bool
$c== :: DeleteDBSubnetGroupResponse -> DeleteDBSubnetGroupResponse -> Bool
Prelude.Eq, ReadPrec [DeleteDBSubnetGroupResponse]
ReadPrec DeleteDBSubnetGroupResponse
Int -> ReadS DeleteDBSubnetGroupResponse
ReadS [DeleteDBSubnetGroupResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteDBSubnetGroupResponse]
$creadListPrec :: ReadPrec [DeleteDBSubnetGroupResponse]
readPrec :: ReadPrec DeleteDBSubnetGroupResponse
$creadPrec :: ReadPrec DeleteDBSubnetGroupResponse
readList :: ReadS [DeleteDBSubnetGroupResponse]
$creadList :: ReadS [DeleteDBSubnetGroupResponse]
readsPrec :: Int -> ReadS DeleteDBSubnetGroupResponse
$creadsPrec :: Int -> ReadS DeleteDBSubnetGroupResponse
Prelude.Read, Int -> DeleteDBSubnetGroupResponse -> ShowS
[DeleteDBSubnetGroupResponse] -> ShowS
DeleteDBSubnetGroupResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteDBSubnetGroupResponse] -> ShowS
$cshowList :: [DeleteDBSubnetGroupResponse] -> ShowS
show :: DeleteDBSubnetGroupResponse -> String
$cshow :: DeleteDBSubnetGroupResponse -> String
showsPrec :: Int -> DeleteDBSubnetGroupResponse -> ShowS
$cshowsPrec :: Int -> DeleteDBSubnetGroupResponse -> ShowS
Prelude.Show, forall x.
Rep DeleteDBSubnetGroupResponse x -> DeleteDBSubnetGroupResponse
forall x.
DeleteDBSubnetGroupResponse -> Rep DeleteDBSubnetGroupResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteDBSubnetGroupResponse x -> DeleteDBSubnetGroupResponse
$cfrom :: forall x.
DeleteDBSubnetGroupResponse -> Rep DeleteDBSubnetGroupResponse x
Prelude.Generic)

-- |
-- Create a value of 'DeleteDBSubnetGroupResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
newDeleteDBSubnetGroupResponse ::
  DeleteDBSubnetGroupResponse
newDeleteDBSubnetGroupResponse :: DeleteDBSubnetGroupResponse
newDeleteDBSubnetGroupResponse =
  DeleteDBSubnetGroupResponse
DeleteDBSubnetGroupResponse'

instance Prelude.NFData DeleteDBSubnetGroupResponse where
  rnf :: DeleteDBSubnetGroupResponse -> ()
rnf DeleteDBSubnetGroupResponse
_ = ()