{-# 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.ElastiCache.DeleteCacheSecurityGroup
-- 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 cache security group.
--
-- You cannot delete a cache security group if it is associated with any
-- clusters.
module Amazonka.ElastiCache.DeleteCacheSecurityGroup
  ( -- * Creating a Request
    DeleteCacheSecurityGroup (..),
    newDeleteCacheSecurityGroup,

    -- * Request Lenses
    deleteCacheSecurityGroup_cacheSecurityGroupName,

    -- * Destructuring the Response
    DeleteCacheSecurityGroupResponse (..),
    newDeleteCacheSecurityGroupResponse,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.ElastiCache.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 of a @DeleteCacheSecurityGroup@ operation.
--
-- /See:/ 'newDeleteCacheSecurityGroup' smart constructor.
data DeleteCacheSecurityGroup = DeleteCacheSecurityGroup'
  { -- | The name of the cache security group to delete.
    --
    -- You cannot delete the default security group.
    DeleteCacheSecurityGroup -> Text
cacheSecurityGroupName :: Prelude.Text
  }
  deriving (DeleteCacheSecurityGroup -> DeleteCacheSecurityGroup -> Bool
(DeleteCacheSecurityGroup -> DeleteCacheSecurityGroup -> Bool)
-> (DeleteCacheSecurityGroup -> DeleteCacheSecurityGroup -> Bool)
-> Eq DeleteCacheSecurityGroup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteCacheSecurityGroup -> DeleteCacheSecurityGroup -> Bool
$c/= :: DeleteCacheSecurityGroup -> DeleteCacheSecurityGroup -> Bool
== :: DeleteCacheSecurityGroup -> DeleteCacheSecurityGroup -> Bool
$c== :: DeleteCacheSecurityGroup -> DeleteCacheSecurityGroup -> Bool
Prelude.Eq, ReadPrec [DeleteCacheSecurityGroup]
ReadPrec DeleteCacheSecurityGroup
Int -> ReadS DeleteCacheSecurityGroup
ReadS [DeleteCacheSecurityGroup]
(Int -> ReadS DeleteCacheSecurityGroup)
-> ReadS [DeleteCacheSecurityGroup]
-> ReadPrec DeleteCacheSecurityGroup
-> ReadPrec [DeleteCacheSecurityGroup]
-> Read DeleteCacheSecurityGroup
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteCacheSecurityGroup]
$creadListPrec :: ReadPrec [DeleteCacheSecurityGroup]
readPrec :: ReadPrec DeleteCacheSecurityGroup
$creadPrec :: ReadPrec DeleteCacheSecurityGroup
readList :: ReadS [DeleteCacheSecurityGroup]
$creadList :: ReadS [DeleteCacheSecurityGroup]
readsPrec :: Int -> ReadS DeleteCacheSecurityGroup
$creadsPrec :: Int -> ReadS DeleteCacheSecurityGroup
Prelude.Read, Int -> DeleteCacheSecurityGroup -> ShowS
[DeleteCacheSecurityGroup] -> ShowS
DeleteCacheSecurityGroup -> String
(Int -> DeleteCacheSecurityGroup -> ShowS)
-> (DeleteCacheSecurityGroup -> String)
-> ([DeleteCacheSecurityGroup] -> ShowS)
-> Show DeleteCacheSecurityGroup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteCacheSecurityGroup] -> ShowS
$cshowList :: [DeleteCacheSecurityGroup] -> ShowS
show :: DeleteCacheSecurityGroup -> String
$cshow :: DeleteCacheSecurityGroup -> String
showsPrec :: Int -> DeleteCacheSecurityGroup -> ShowS
$cshowsPrec :: Int -> DeleteCacheSecurityGroup -> ShowS
Prelude.Show, (forall x.
 DeleteCacheSecurityGroup -> Rep DeleteCacheSecurityGroup x)
-> (forall x.
    Rep DeleteCacheSecurityGroup x -> DeleteCacheSecurityGroup)
-> Generic DeleteCacheSecurityGroup
forall x.
Rep DeleteCacheSecurityGroup x -> DeleteCacheSecurityGroup
forall x.
DeleteCacheSecurityGroup -> Rep DeleteCacheSecurityGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteCacheSecurityGroup x -> DeleteCacheSecurityGroup
$cfrom :: forall x.
DeleteCacheSecurityGroup -> Rep DeleteCacheSecurityGroup x
Prelude.Generic)

-- |
-- Create a value of 'DeleteCacheSecurityGroup' 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:
--
-- 'cacheSecurityGroupName', 'deleteCacheSecurityGroup_cacheSecurityGroupName' - The name of the cache security group to delete.
--
-- You cannot delete the default security group.
newDeleteCacheSecurityGroup ::
  -- | 'cacheSecurityGroupName'
  Prelude.Text ->
  DeleteCacheSecurityGroup
newDeleteCacheSecurityGroup :: Text -> DeleteCacheSecurityGroup
newDeleteCacheSecurityGroup Text
pCacheSecurityGroupName_ =
  DeleteCacheSecurityGroup' :: Text -> DeleteCacheSecurityGroup
DeleteCacheSecurityGroup'
    { $sel:cacheSecurityGroupName:DeleteCacheSecurityGroup' :: Text
cacheSecurityGroupName =
        Text
pCacheSecurityGroupName_
    }

-- | The name of the cache security group to delete.
--
-- You cannot delete the default security group.
deleteCacheSecurityGroup_cacheSecurityGroupName :: Lens.Lens' DeleteCacheSecurityGroup Prelude.Text
deleteCacheSecurityGroup_cacheSecurityGroupName :: (Text -> f Text)
-> DeleteCacheSecurityGroup -> f DeleteCacheSecurityGroup
deleteCacheSecurityGroup_cacheSecurityGroupName = (DeleteCacheSecurityGroup -> Text)
-> (DeleteCacheSecurityGroup -> Text -> DeleteCacheSecurityGroup)
-> Lens DeleteCacheSecurityGroup DeleteCacheSecurityGroup Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteCacheSecurityGroup' {Text
cacheSecurityGroupName :: Text
$sel:cacheSecurityGroupName:DeleteCacheSecurityGroup' :: DeleteCacheSecurityGroup -> Text
cacheSecurityGroupName} -> Text
cacheSecurityGroupName) (\s :: DeleteCacheSecurityGroup
s@DeleteCacheSecurityGroup' {} Text
a -> DeleteCacheSecurityGroup
s {$sel:cacheSecurityGroupName:DeleteCacheSecurityGroup' :: Text
cacheSecurityGroupName = Text
a} :: DeleteCacheSecurityGroup)

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

instance Prelude.Hashable DeleteCacheSecurityGroup

instance Prelude.NFData DeleteCacheSecurityGroup

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

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

instance Core.ToQuery DeleteCacheSecurityGroup where
  toQuery :: DeleteCacheSecurityGroup -> QueryString
toQuery DeleteCacheSecurityGroup' {Text
cacheSecurityGroupName :: Text
$sel:cacheSecurityGroupName:DeleteCacheSecurityGroup' :: DeleteCacheSecurityGroup -> 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
"DeleteCacheSecurityGroup" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2015-02-02" :: Prelude.ByteString),
        ByteString
"CacheSecurityGroupName"
          ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
cacheSecurityGroupName
      ]

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

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

instance
  Prelude.NFData
    DeleteCacheSecurityGroupResponse