{-# 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.CognitoIdentity.DeleteIdentityPool
-- 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 an identity pool. Once a pool is deleted, users will not be able
-- to authenticate with the pool.
--
-- You must use AWS Developer credentials to call this API.
module Amazonka.CognitoIdentity.DeleteIdentityPool
  ( -- * Creating a Request
    DeleteIdentityPool (..),
    newDeleteIdentityPool,

    -- * Request Lenses
    deleteIdentityPool_identityPoolId,

    -- * Destructuring the Response
    DeleteIdentityPoolResponse (..),
    newDeleteIdentityPoolResponse,
  )
where

import Amazonka.CognitoIdentity.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

-- | Input to the DeleteIdentityPool action.
--
-- /See:/ 'newDeleteIdentityPool' smart constructor.
data DeleteIdentityPool = DeleteIdentityPool'
  { -- | An identity pool ID in the format REGION:GUID.
    DeleteIdentityPool -> Text
identityPoolId :: Prelude.Text
  }
  deriving (DeleteIdentityPool -> DeleteIdentityPool -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteIdentityPool -> DeleteIdentityPool -> Bool
$c/= :: DeleteIdentityPool -> DeleteIdentityPool -> Bool
== :: DeleteIdentityPool -> DeleteIdentityPool -> Bool
$c== :: DeleteIdentityPool -> DeleteIdentityPool -> Bool
Prelude.Eq, ReadPrec [DeleteIdentityPool]
ReadPrec DeleteIdentityPool
Int -> ReadS DeleteIdentityPool
ReadS [DeleteIdentityPool]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteIdentityPool]
$creadListPrec :: ReadPrec [DeleteIdentityPool]
readPrec :: ReadPrec DeleteIdentityPool
$creadPrec :: ReadPrec DeleteIdentityPool
readList :: ReadS [DeleteIdentityPool]
$creadList :: ReadS [DeleteIdentityPool]
readsPrec :: Int -> ReadS DeleteIdentityPool
$creadsPrec :: Int -> ReadS DeleteIdentityPool
Prelude.Read, Int -> DeleteIdentityPool -> ShowS
[DeleteIdentityPool] -> ShowS
DeleteIdentityPool -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteIdentityPool] -> ShowS
$cshowList :: [DeleteIdentityPool] -> ShowS
show :: DeleteIdentityPool -> String
$cshow :: DeleteIdentityPool -> String
showsPrec :: Int -> DeleteIdentityPool -> ShowS
$cshowsPrec :: Int -> DeleteIdentityPool -> ShowS
Prelude.Show, forall x. Rep DeleteIdentityPool x -> DeleteIdentityPool
forall x. DeleteIdentityPool -> Rep DeleteIdentityPool x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteIdentityPool x -> DeleteIdentityPool
$cfrom :: forall x. DeleteIdentityPool -> Rep DeleteIdentityPool x
Prelude.Generic)

-- |
-- Create a value of 'DeleteIdentityPool' 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:
--
-- 'identityPoolId', 'deleteIdentityPool_identityPoolId' - An identity pool ID in the format REGION:GUID.
newDeleteIdentityPool ::
  -- | 'identityPoolId'
  Prelude.Text ->
  DeleteIdentityPool
newDeleteIdentityPool :: Text -> DeleteIdentityPool
newDeleteIdentityPool Text
pIdentityPoolId_ =
  DeleteIdentityPool'
    { $sel:identityPoolId:DeleteIdentityPool' :: Text
identityPoolId =
        Text
pIdentityPoolId_
    }

-- | An identity pool ID in the format REGION:GUID.
deleteIdentityPool_identityPoolId :: Lens.Lens' DeleteIdentityPool Prelude.Text
deleteIdentityPool_identityPoolId :: Lens' DeleteIdentityPool Text
deleteIdentityPool_identityPoolId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteIdentityPool' {Text
identityPoolId :: Text
$sel:identityPoolId:DeleteIdentityPool' :: DeleteIdentityPool -> Text
identityPoolId} -> Text
identityPoolId) (\s :: DeleteIdentityPool
s@DeleteIdentityPool' {} Text
a -> DeleteIdentityPool
s {$sel:identityPoolId:DeleteIdentityPool' :: Text
identityPoolId = Text
a} :: DeleteIdentityPool)

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

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

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

instance Data.ToHeaders DeleteIdentityPool where
  toHeaders :: DeleteIdentityPool -> [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
"AWSCognitoIdentityService.DeleteIdentityPool" ::
                          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 DeleteIdentityPool where
  toJSON :: DeleteIdentityPool -> Value
toJSON DeleteIdentityPool' {Text
identityPoolId :: Text
$sel:identityPoolId:DeleteIdentityPool' :: DeleteIdentityPool -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"IdentityPoolId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
identityPoolId)
          ]
      )

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

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

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

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

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