{-# 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.DeleteDBSecurityGroup
-- 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 DB security group.
--
-- The specified DB security group must not be associated with any DB
-- instances.
module Amazonka.RDS.DeleteDBSecurityGroup
  ( -- * Creating a Request
    DeleteDBSecurityGroup (..),
    newDeleteDBSecurityGroup,

    -- * Request Lenses
    deleteDBSecurityGroup_dbSecurityGroupName,

    -- * Destructuring the Response
    DeleteDBSecurityGroupResponse (..),
    newDeleteDBSecurityGroupResponse,
  )
where

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

-- |
--
-- /See:/ 'newDeleteDBSecurityGroup' smart constructor.
data DeleteDBSecurityGroup = DeleteDBSecurityGroup'
  { -- | The name of the DB security group to delete.
    --
    -- You can\'t delete the default DB security group.
    --
    -- Constraints:
    --
    -- -   Must be 1 to 255 letters, numbers, or hyphens.
    --
    -- -   First character must be a letter
    --
    -- -   Can\'t end with a hyphen or contain two consecutive hyphens
    --
    -- -   Must not be \"Default\"
    DeleteDBSecurityGroup -> Text
dbSecurityGroupName :: Prelude.Text
  }
  deriving (DeleteDBSecurityGroup -> DeleteDBSecurityGroup -> Bool
(DeleteDBSecurityGroup -> DeleteDBSecurityGroup -> Bool)
-> (DeleteDBSecurityGroup -> DeleteDBSecurityGroup -> Bool)
-> Eq DeleteDBSecurityGroup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteDBSecurityGroup -> DeleteDBSecurityGroup -> Bool
$c/= :: DeleteDBSecurityGroup -> DeleteDBSecurityGroup -> Bool
== :: DeleteDBSecurityGroup -> DeleteDBSecurityGroup -> Bool
$c== :: DeleteDBSecurityGroup -> DeleteDBSecurityGroup -> Bool
Prelude.Eq, ReadPrec [DeleteDBSecurityGroup]
ReadPrec DeleteDBSecurityGroup
Int -> ReadS DeleteDBSecurityGroup
ReadS [DeleteDBSecurityGroup]
(Int -> ReadS DeleteDBSecurityGroup)
-> ReadS [DeleteDBSecurityGroup]
-> ReadPrec DeleteDBSecurityGroup
-> ReadPrec [DeleteDBSecurityGroup]
-> Read DeleteDBSecurityGroup
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteDBSecurityGroup]
$creadListPrec :: ReadPrec [DeleteDBSecurityGroup]
readPrec :: ReadPrec DeleteDBSecurityGroup
$creadPrec :: ReadPrec DeleteDBSecurityGroup
readList :: ReadS [DeleteDBSecurityGroup]
$creadList :: ReadS [DeleteDBSecurityGroup]
readsPrec :: Int -> ReadS DeleteDBSecurityGroup
$creadsPrec :: Int -> ReadS DeleteDBSecurityGroup
Prelude.Read, Int -> DeleteDBSecurityGroup -> ShowS
[DeleteDBSecurityGroup] -> ShowS
DeleteDBSecurityGroup -> String
(Int -> DeleteDBSecurityGroup -> ShowS)
-> (DeleteDBSecurityGroup -> String)
-> ([DeleteDBSecurityGroup] -> ShowS)
-> Show DeleteDBSecurityGroup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteDBSecurityGroup] -> ShowS
$cshowList :: [DeleteDBSecurityGroup] -> ShowS
show :: DeleteDBSecurityGroup -> String
$cshow :: DeleteDBSecurityGroup -> String
showsPrec :: Int -> DeleteDBSecurityGroup -> ShowS
$cshowsPrec :: Int -> DeleteDBSecurityGroup -> ShowS
Prelude.Show, (forall x. DeleteDBSecurityGroup -> Rep DeleteDBSecurityGroup x)
-> (forall x. Rep DeleteDBSecurityGroup x -> DeleteDBSecurityGroup)
-> Generic DeleteDBSecurityGroup
forall x. Rep DeleteDBSecurityGroup x -> DeleteDBSecurityGroup
forall x. DeleteDBSecurityGroup -> Rep DeleteDBSecurityGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteDBSecurityGroup x -> DeleteDBSecurityGroup
$cfrom :: forall x. DeleteDBSecurityGroup -> Rep DeleteDBSecurityGroup x
Prelude.Generic)

-- |
-- Create a value of 'DeleteDBSecurityGroup' 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:
--
-- 'dbSecurityGroupName', 'deleteDBSecurityGroup_dbSecurityGroupName' - The name of the DB security group to delete.
--
-- You can\'t delete the default DB security group.
--
-- Constraints:
--
-- -   Must be 1 to 255 letters, numbers, or hyphens.
--
-- -   First character must be a letter
--
-- -   Can\'t end with a hyphen or contain two consecutive hyphens
--
-- -   Must not be \"Default\"
newDeleteDBSecurityGroup ::
  -- | 'dbSecurityGroupName'
  Prelude.Text ->
  DeleteDBSecurityGroup
newDeleteDBSecurityGroup :: Text -> DeleteDBSecurityGroup
newDeleteDBSecurityGroup Text
pDBSecurityGroupName_ =
  DeleteDBSecurityGroup' :: Text -> DeleteDBSecurityGroup
DeleteDBSecurityGroup'
    { $sel:dbSecurityGroupName:DeleteDBSecurityGroup' :: Text
dbSecurityGroupName =
        Text
pDBSecurityGroupName_
    }

-- | The name of the DB security group to delete.
--
-- You can\'t delete the default DB security group.
--
-- Constraints:
--
-- -   Must be 1 to 255 letters, numbers, or hyphens.
--
-- -   First character must be a letter
--
-- -   Can\'t end with a hyphen or contain two consecutive hyphens
--
-- -   Must not be \"Default\"
deleteDBSecurityGroup_dbSecurityGroupName :: Lens.Lens' DeleteDBSecurityGroup Prelude.Text
deleteDBSecurityGroup_dbSecurityGroupName :: (Text -> f Text)
-> DeleteDBSecurityGroup -> f DeleteDBSecurityGroup
deleteDBSecurityGroup_dbSecurityGroupName = (DeleteDBSecurityGroup -> Text)
-> (DeleteDBSecurityGroup -> Text -> DeleteDBSecurityGroup)
-> Lens DeleteDBSecurityGroup DeleteDBSecurityGroup Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDBSecurityGroup' {Text
dbSecurityGroupName :: Text
$sel:dbSecurityGroupName:DeleteDBSecurityGroup' :: DeleteDBSecurityGroup -> Text
dbSecurityGroupName} -> Text
dbSecurityGroupName) (\s :: DeleteDBSecurityGroup
s@DeleteDBSecurityGroup' {} Text
a -> DeleteDBSecurityGroup
s {$sel:dbSecurityGroupName:DeleteDBSecurityGroup' :: Text
dbSecurityGroupName = Text
a} :: DeleteDBSecurityGroup)

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

instance Prelude.Hashable DeleteDBSecurityGroup

instance Prelude.NFData DeleteDBSecurityGroup

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

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

instance Core.ToQuery DeleteDBSecurityGroup where
  toQuery :: DeleteDBSecurityGroup -> QueryString
toQuery DeleteDBSecurityGroup' {Text
dbSecurityGroupName :: Text
$sel:dbSecurityGroupName:DeleteDBSecurityGroup' :: DeleteDBSecurityGroup -> 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
"DeleteDBSecurityGroup" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2014-10-31" :: Prelude.ByteString),
        ByteString
"DBSecurityGroupName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
dbSecurityGroupName
      ]

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

-- |
-- Create a value of 'DeleteDBSecurityGroupResponse' 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.
newDeleteDBSecurityGroupResponse ::
  DeleteDBSecurityGroupResponse
newDeleteDBSecurityGroupResponse :: DeleteDBSecurityGroupResponse
newDeleteDBSecurityGroupResponse =
  DeleteDBSecurityGroupResponse
DeleteDBSecurityGroupResponse'

instance Prelude.NFData DeleteDBSecurityGroupResponse