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

instance Prelude.Hashable DeleteIdentityPool

instance Prelude.NFData DeleteIdentityPool

instance Core.ToHeaders DeleteIdentityPool where
  toHeaders :: DeleteIdentityPool -> [Header]
toHeaders =
    [Header] -> DeleteIdentityPool -> [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
"AWSCognitoIdentityService.DeleteIdentityPool" ::
                          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 DeleteIdentityPool where
  toJSON :: DeleteIdentityPool -> Value
toJSON DeleteIdentityPool' {Text
identityPoolId :: Text
$sel:identityPoolId:DeleteIdentityPool' :: DeleteIdentityPool -> 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
"IdentityPoolId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
identityPoolId)
          ]
      )

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

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

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