{-# 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.CognitoIdentityProvider.DeleteUserPool
-- 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 the specified Amazon Cognito user pool.
module Amazonka.CognitoIdentityProvider.DeleteUserPool
  ( -- * Creating a Request
    DeleteUserPool (..),
    newDeleteUserPool,

    -- * Request Lenses
    deleteUserPool_userPoolId,

    -- * Destructuring the Response
    DeleteUserPoolResponse (..),
    newDeleteUserPoolResponse,
  )
where

import Amazonka.CognitoIdentityProvider.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | Represents the request to delete a user pool.
--
-- /See:/ 'newDeleteUserPool' smart constructor.
data DeleteUserPool = DeleteUserPool'
  { -- | The user pool ID for the user pool you want to delete.
    DeleteUserPool -> Text
userPoolId :: Prelude.Text
  }
  deriving (DeleteUserPool -> DeleteUserPool -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteUserPool -> DeleteUserPool -> Bool
$c/= :: DeleteUserPool -> DeleteUserPool -> Bool
== :: DeleteUserPool -> DeleteUserPool -> Bool
$c== :: DeleteUserPool -> DeleteUserPool -> Bool
Prelude.Eq, ReadPrec [DeleteUserPool]
ReadPrec DeleteUserPool
Int -> ReadS DeleteUserPool
ReadS [DeleteUserPool]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteUserPool]
$creadListPrec :: ReadPrec [DeleteUserPool]
readPrec :: ReadPrec DeleteUserPool
$creadPrec :: ReadPrec DeleteUserPool
readList :: ReadS [DeleteUserPool]
$creadList :: ReadS [DeleteUserPool]
readsPrec :: Int -> ReadS DeleteUserPool
$creadsPrec :: Int -> ReadS DeleteUserPool
Prelude.Read, Int -> DeleteUserPool -> ShowS
[DeleteUserPool] -> ShowS
DeleteUserPool -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteUserPool] -> ShowS
$cshowList :: [DeleteUserPool] -> ShowS
show :: DeleteUserPool -> String
$cshow :: DeleteUserPool -> String
showsPrec :: Int -> DeleteUserPool -> ShowS
$cshowsPrec :: Int -> DeleteUserPool -> ShowS
Prelude.Show, forall x. Rep DeleteUserPool x -> DeleteUserPool
forall x. DeleteUserPool -> Rep DeleteUserPool x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteUserPool x -> DeleteUserPool
$cfrom :: forall x. DeleteUserPool -> Rep DeleteUserPool x
Prelude.Generic)

-- |
-- Create a value of 'DeleteUserPool' 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:
--
-- 'userPoolId', 'deleteUserPool_userPoolId' - The user pool ID for the user pool you want to delete.
newDeleteUserPool ::
  -- | 'userPoolId'
  Prelude.Text ->
  DeleteUserPool
newDeleteUserPool :: Text -> DeleteUserPool
newDeleteUserPool Text
pUserPoolId_ =
  DeleteUserPool' {$sel:userPoolId:DeleteUserPool' :: Text
userPoolId = Text
pUserPoolId_}

-- | The user pool ID for the user pool you want to delete.
deleteUserPool_userPoolId :: Lens.Lens' DeleteUserPool Prelude.Text
deleteUserPool_userPoolId :: Lens' DeleteUserPool Text
deleteUserPool_userPoolId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteUserPool' {Text
userPoolId :: Text
$sel:userPoolId:DeleteUserPool' :: DeleteUserPool -> Text
userPoolId} -> Text
userPoolId) (\s :: DeleteUserPool
s@DeleteUserPool' {} Text
a -> DeleteUserPool
s {$sel:userPoolId:DeleteUserPool' :: Text
userPoolId = Text
a} :: DeleteUserPool)

instance Core.AWSRequest DeleteUserPool where
  type
    AWSResponse DeleteUserPool =
      DeleteUserPoolResponse
  request :: (Service -> Service) -> DeleteUserPool -> Request DeleteUserPool
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeleteUserPool
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteUserPool)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull DeleteUserPoolResponse
DeleteUserPoolResponse'

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

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

instance Data.ToHeaders DeleteUserPool where
  toHeaders :: DeleteUserPool -> [Header]
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> [Header]
Data.=# ( ByteString
"AWSCognitoIdentityProviderService.DeleteUserPool" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> [Header]
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON DeleteUserPool where
  toJSON :: DeleteUserPool -> Value
toJSON DeleteUserPool' {Text
userPoolId :: Text
$sel:userPoolId:DeleteUserPool' :: DeleteUserPool -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"UserPoolId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
userPoolId)]
      )

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

instance Data.ToQuery DeleteUserPool where
  toQuery :: DeleteUserPool -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

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

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

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