{-# 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-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 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.Lens as Lens
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
(DeleteUserPool -> DeleteUserPool -> Bool)
-> (DeleteUserPool -> DeleteUserPool -> Bool) -> Eq DeleteUserPool
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]
(Int -> ReadS DeleteUserPool)
-> ReadS [DeleteUserPool]
-> ReadPrec DeleteUserPool
-> ReadPrec [DeleteUserPool]
-> Read 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
(Int -> DeleteUserPool -> ShowS)
-> (DeleteUserPool -> String)
-> ([DeleteUserPool] -> ShowS)
-> Show DeleteUserPool
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. DeleteUserPool -> Rep DeleteUserPool x)
-> (forall x. Rep DeleteUserPool x -> DeleteUserPool)
-> Generic DeleteUserPool
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' :: Text -> DeleteUserPool
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 :: (Text -> f Text) -> DeleteUserPool -> f DeleteUserPool
deleteUserPool_userPoolId = (DeleteUserPool -> Text)
-> (DeleteUserPool -> Text -> DeleteUserPool)
-> Lens DeleteUserPool DeleteUserPool Text Text
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 :: DeleteUserPool -> Request DeleteUserPool
request = Service -> DeleteUserPool -> Request DeleteUserPool
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteUserPool
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteUserPool)))
response =
    AWSResponse DeleteUserPool
-> Logger
-> Service
-> Proxy DeleteUserPool
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteUserPool)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse DeleteUserPool
DeleteUserPoolResponse
DeleteUserPoolResponse'

instance Prelude.Hashable DeleteUserPool

instance Prelude.NFData DeleteUserPool

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

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

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

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

-- | /See:/ 'newDeleteUserPoolResponse' smart constructor.
data DeleteUserPoolResponse = DeleteUserPoolResponse'
  {
  }
  deriving (DeleteUserPoolResponse -> DeleteUserPoolResponse -> Bool
(DeleteUserPoolResponse -> DeleteUserPoolResponse -> Bool)
-> (DeleteUserPoolResponse -> DeleteUserPoolResponse -> Bool)
-> Eq DeleteUserPoolResponse
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]
(Int -> ReadS DeleteUserPoolResponse)
-> ReadS [DeleteUserPoolResponse]
-> ReadPrec DeleteUserPoolResponse
-> ReadPrec [DeleteUserPoolResponse]
-> Read 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
(Int -> DeleteUserPoolResponse -> ShowS)
-> (DeleteUserPoolResponse -> String)
-> ([DeleteUserPoolResponse] -> ShowS)
-> Show DeleteUserPoolResponse
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. DeleteUserPoolResponse -> Rep DeleteUserPoolResponse x)
-> (forall x.
    Rep DeleteUserPoolResponse x -> DeleteUserPoolResponse)
-> Generic DeleteUserPoolResponse
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