{-# 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.DeleteCacheSubnetGroup
-- 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 subnet group.
--
-- You cannot delete a default cache subnet group or one that is associated
-- with any clusters.
module Amazonka.ElastiCache.DeleteCacheSubnetGroup
  ( -- * Creating a Request
    DeleteCacheSubnetGroup (..),
    newDeleteCacheSubnetGroup,

    -- * Request Lenses
    deleteCacheSubnetGroup_cacheSubnetGroupName,

    -- * Destructuring the Response
    DeleteCacheSubnetGroupResponse (..),
    newDeleteCacheSubnetGroupResponse,
  )
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 @DeleteCacheSubnetGroup@ operation.
--
-- /See:/ 'newDeleteCacheSubnetGroup' smart constructor.
data DeleteCacheSubnetGroup = DeleteCacheSubnetGroup'
  { -- | The name of the cache subnet group to delete.
    --
    -- Constraints: Must contain no more than 255 alphanumeric characters or
    -- hyphens.
    DeleteCacheSubnetGroup -> Text
cacheSubnetGroupName :: Prelude.Text
  }
  deriving (DeleteCacheSubnetGroup -> DeleteCacheSubnetGroup -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteCacheSubnetGroup -> DeleteCacheSubnetGroup -> Bool
$c/= :: DeleteCacheSubnetGroup -> DeleteCacheSubnetGroup -> Bool
== :: DeleteCacheSubnetGroup -> DeleteCacheSubnetGroup -> Bool
$c== :: DeleteCacheSubnetGroup -> DeleteCacheSubnetGroup -> Bool
Prelude.Eq, ReadPrec [DeleteCacheSubnetGroup]
ReadPrec DeleteCacheSubnetGroup
Int -> ReadS DeleteCacheSubnetGroup
ReadS [DeleteCacheSubnetGroup]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteCacheSubnetGroup]
$creadListPrec :: ReadPrec [DeleteCacheSubnetGroup]
readPrec :: ReadPrec DeleteCacheSubnetGroup
$creadPrec :: ReadPrec DeleteCacheSubnetGroup
readList :: ReadS [DeleteCacheSubnetGroup]
$creadList :: ReadS [DeleteCacheSubnetGroup]
readsPrec :: Int -> ReadS DeleteCacheSubnetGroup
$creadsPrec :: Int -> ReadS DeleteCacheSubnetGroup
Prelude.Read, Int -> DeleteCacheSubnetGroup -> ShowS
[DeleteCacheSubnetGroup] -> ShowS
DeleteCacheSubnetGroup -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteCacheSubnetGroup] -> ShowS
$cshowList :: [DeleteCacheSubnetGroup] -> ShowS
show :: DeleteCacheSubnetGroup -> String
$cshow :: DeleteCacheSubnetGroup -> String
showsPrec :: Int -> DeleteCacheSubnetGroup -> ShowS
$cshowsPrec :: Int -> DeleteCacheSubnetGroup -> ShowS
Prelude.Show, forall x. Rep DeleteCacheSubnetGroup x -> DeleteCacheSubnetGroup
forall x. DeleteCacheSubnetGroup -> Rep DeleteCacheSubnetGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteCacheSubnetGroup x -> DeleteCacheSubnetGroup
$cfrom :: forall x. DeleteCacheSubnetGroup -> Rep DeleteCacheSubnetGroup x
Prelude.Generic)

-- |
-- Create a value of 'DeleteCacheSubnetGroup' 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:
--
-- 'cacheSubnetGroupName', 'deleteCacheSubnetGroup_cacheSubnetGroupName' - The name of the cache subnet group to delete.
--
-- Constraints: Must contain no more than 255 alphanumeric characters or
-- hyphens.
newDeleteCacheSubnetGroup ::
  -- | 'cacheSubnetGroupName'
  Prelude.Text ->
  DeleteCacheSubnetGroup
newDeleteCacheSubnetGroup :: Text -> DeleteCacheSubnetGroup
newDeleteCacheSubnetGroup Text
pCacheSubnetGroupName_ =
  DeleteCacheSubnetGroup'
    { $sel:cacheSubnetGroupName:DeleteCacheSubnetGroup' :: Text
cacheSubnetGroupName =
        Text
pCacheSubnetGroupName_
    }

-- | The name of the cache subnet group to delete.
--
-- Constraints: Must contain no more than 255 alphanumeric characters or
-- hyphens.
deleteCacheSubnetGroup_cacheSubnetGroupName :: Lens.Lens' DeleteCacheSubnetGroup Prelude.Text
deleteCacheSubnetGroup_cacheSubnetGroupName :: Lens' DeleteCacheSubnetGroup Text
deleteCacheSubnetGroup_cacheSubnetGroupName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteCacheSubnetGroup' {Text
cacheSubnetGroupName :: Text
$sel:cacheSubnetGroupName:DeleteCacheSubnetGroup' :: DeleteCacheSubnetGroup -> Text
cacheSubnetGroupName} -> Text
cacheSubnetGroupName) (\s :: DeleteCacheSubnetGroup
s@DeleteCacheSubnetGroup' {} Text
a -> DeleteCacheSubnetGroup
s {$sel:cacheSubnetGroupName:DeleteCacheSubnetGroup' :: Text
cacheSubnetGroupName = Text
a} :: DeleteCacheSubnetGroup)

instance Core.AWSRequest DeleteCacheSubnetGroup where
  type
    AWSResponse DeleteCacheSubnetGroup =
      DeleteCacheSubnetGroupResponse
  request :: (Service -> Service)
-> DeleteCacheSubnetGroup -> Request DeleteCacheSubnetGroup
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 DeleteCacheSubnetGroup
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteCacheSubnetGroup)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull
      DeleteCacheSubnetGroupResponse
DeleteCacheSubnetGroupResponse'

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

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

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

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

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

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

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

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