{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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 qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.ElastiCache.Types
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
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]
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
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.
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'
    { $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 :: Lens' DeleteCacheSecurityGroup Text
deleteCacheSecurityGroup_cacheSecurityGroupName = 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 :: (Service -> Service)
-> DeleteCacheSecurityGroup -> Request DeleteCacheSecurityGroup
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 DeleteCacheSecurityGroup
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteCacheSecurityGroup)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull
      DeleteCacheSecurityGroupResponse
DeleteCacheSecurityGroupResponse'

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

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

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

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

instance Data.ToQuery DeleteCacheSecurityGroup where
  toQuery :: DeleteCacheSecurityGroup -> QueryString
toQuery DeleteCacheSecurityGroup' {Text
cacheSecurityGroupName :: Text
$sel:cacheSecurityGroupName:DeleteCacheSecurityGroup' :: DeleteCacheSecurityGroup -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"DeleteCacheSecurityGroup" :: Prelude.ByteString),
        ByteString
"Version"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2015-02-02" :: Prelude.ByteString),
        ByteString
"CacheSecurityGroupName"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
cacheSecurityGroupName
      ]

-- | /See:/ 'newDeleteCacheSecurityGroupResponse' smart constructor.
data DeleteCacheSecurityGroupResponse = DeleteCacheSecurityGroupResponse'
  {
  }
  deriving (DeleteCacheSecurityGroupResponse
-> DeleteCacheSecurityGroupResponse -> Bool
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]
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
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.
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
  where
  rnf :: DeleteCacheSecurityGroupResponse -> ()
rnf DeleteCacheSecurityGroupResponse
_ = ()