{-# 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.DocumentDB.DeleteDBSubnetGroup
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Deletes a subnet group.
--
-- The specified database subnet group must not be associated with any DB
-- instances.
module Amazonka.DocumentDB.DeleteDBSubnetGroup
  ( -- * Creating a Request
    DeleteDBSubnetGroup (..),
    newDeleteDBSubnetGroup,

    -- * Request Lenses
    deleteDBSubnetGroup_dbSubnetGroupName,

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

import qualified Amazonka.Core as Core
import Amazonka.DocumentDB.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | Represents the input to DeleteDBSubnetGroup.
--
-- /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: @mySubnetgroup@
    DeleteDBSubnetGroup -> Text
dbSubnetGroupName :: Prelude.Text
  }
  deriving (DeleteDBSubnetGroup -> DeleteDBSubnetGroup -> Bool
(DeleteDBSubnetGroup -> DeleteDBSubnetGroup -> Bool)
-> (DeleteDBSubnetGroup -> DeleteDBSubnetGroup -> Bool)
-> Eq DeleteDBSubnetGroup
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]
(Int -> ReadS DeleteDBSubnetGroup)
-> ReadS [DeleteDBSubnetGroup]
-> ReadPrec DeleteDBSubnetGroup
-> ReadPrec [DeleteDBSubnetGroup]
-> Read 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
(Int -> DeleteDBSubnetGroup -> ShowS)
-> (DeleteDBSubnetGroup -> String)
-> ([DeleteDBSubnetGroup] -> ShowS)
-> Show DeleteDBSubnetGroup
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. DeleteDBSubnetGroup -> Rep DeleteDBSubnetGroup x)
-> (forall x. Rep DeleteDBSubnetGroup x -> DeleteDBSubnetGroup)
-> Generic DeleteDBSubnetGroup
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: @mySubnetgroup@
newDeleteDBSubnetGroup ::
  -- | 'dbSubnetGroupName'
  Prelude.Text ->
  DeleteDBSubnetGroup
newDeleteDBSubnetGroup :: Text -> DeleteDBSubnetGroup
newDeleteDBSubnetGroup Text
pDBSubnetGroupName_ =
  DeleteDBSubnetGroup' :: Text -> DeleteDBSubnetGroup
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: @mySubnetgroup@
deleteDBSubnetGroup_dbSubnetGroupName :: Lens.Lens' DeleteDBSubnetGroup Prelude.Text
deleteDBSubnetGroup_dbSubnetGroupName :: (Text -> f Text) -> DeleteDBSubnetGroup -> f DeleteDBSubnetGroup
deleteDBSubnetGroup_dbSubnetGroupName = (DeleteDBSubnetGroup -> Text)
-> (DeleteDBSubnetGroup -> Text -> DeleteDBSubnetGroup)
-> Lens DeleteDBSubnetGroup DeleteDBSubnetGroup Text Text
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 :: DeleteDBSubnetGroup -> Request DeleteDBSubnetGroup
request = Service -> DeleteDBSubnetGroup -> Request DeleteDBSubnetGroup
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteDBSubnetGroup
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteDBSubnetGroup)))
response =
    AWSResponse DeleteDBSubnetGroup
-> Logger
-> Service
-> Proxy DeleteDBSubnetGroup
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteDBSubnetGroup)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse DeleteDBSubnetGroup
DeleteDBSubnetGroupResponse
DeleteDBSubnetGroupResponse'

instance Prelude.Hashable DeleteDBSubnetGroup

instance Prelude.NFData DeleteDBSubnetGroup

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

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

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

-- | /See:/ 'newDeleteDBSubnetGroupResponse' smart constructor.
data DeleteDBSubnetGroupResponse = DeleteDBSubnetGroupResponse'
  {
  }
  deriving (DeleteDBSubnetGroupResponse -> DeleteDBSubnetGroupResponse -> Bool
(DeleteDBSubnetGroupResponse
 -> DeleteDBSubnetGroupResponse -> Bool)
-> (DeleteDBSubnetGroupResponse
    -> DeleteDBSubnetGroupResponse -> Bool)
-> Eq DeleteDBSubnetGroupResponse
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]
(Int -> ReadS DeleteDBSubnetGroupResponse)
-> ReadS [DeleteDBSubnetGroupResponse]
-> ReadPrec DeleteDBSubnetGroupResponse
-> ReadPrec [DeleteDBSubnetGroupResponse]
-> Read 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
(Int -> DeleteDBSubnetGroupResponse -> ShowS)
-> (DeleteDBSubnetGroupResponse -> String)
-> ([DeleteDBSubnetGroupResponse] -> ShowS)
-> Show DeleteDBSubnetGroupResponse
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.
 DeleteDBSubnetGroupResponse -> Rep DeleteDBSubnetGroupResponse x)
-> (forall x.
    Rep DeleteDBSubnetGroupResponse x -> DeleteDBSubnetGroupResponse)
-> Generic DeleteDBSubnetGroupResponse
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