{-# 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.UnlinkDeveloperIdentity
-- 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)
--
-- Unlinks a @DeveloperUserIdentifier@ from an existing identity. Unlinked
-- developer users will be considered new identities next time they are
-- seen. If, for a given Cognito identity, you remove all federated
-- identities as well as the developer user identifier, the Cognito
-- identity becomes inaccessible.
--
-- You must use AWS Developer credentials to call this API.
module Amazonka.CognitoIdentity.UnlinkDeveloperIdentity
  ( -- * Creating a Request
    UnlinkDeveloperIdentity (..),
    newUnlinkDeveloperIdentity,

    -- * Request Lenses
    unlinkDeveloperIdentity_identityId,
    unlinkDeveloperIdentity_identityPoolId,
    unlinkDeveloperIdentity_developerProviderName,
    unlinkDeveloperIdentity_developerUserIdentifier,

    -- * Destructuring the Response
    UnlinkDeveloperIdentityResponse (..),
    newUnlinkDeveloperIdentityResponse,
  )
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 @UnlinkDeveloperIdentity@ action.
--
-- /See:/ 'newUnlinkDeveloperIdentity' smart constructor.
data UnlinkDeveloperIdentity = UnlinkDeveloperIdentity'
  { -- | A unique identifier in the format REGION:GUID.
    UnlinkDeveloperIdentity -> Text
identityId :: Prelude.Text,
    -- | An identity pool ID in the format REGION:GUID.
    UnlinkDeveloperIdentity -> Text
identityPoolId :: Prelude.Text,
    -- | The \"domain\" by which Cognito will refer to your users.
    UnlinkDeveloperIdentity -> Text
developerProviderName :: Prelude.Text,
    -- | A unique ID used by your backend authentication process to identify a
    -- user.
    UnlinkDeveloperIdentity -> Text
developerUserIdentifier :: Prelude.Text
  }
  deriving (UnlinkDeveloperIdentity -> UnlinkDeveloperIdentity -> Bool
(UnlinkDeveloperIdentity -> UnlinkDeveloperIdentity -> Bool)
-> (UnlinkDeveloperIdentity -> UnlinkDeveloperIdentity -> Bool)
-> Eq UnlinkDeveloperIdentity
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UnlinkDeveloperIdentity -> UnlinkDeveloperIdentity -> Bool
$c/= :: UnlinkDeveloperIdentity -> UnlinkDeveloperIdentity -> Bool
== :: UnlinkDeveloperIdentity -> UnlinkDeveloperIdentity -> Bool
$c== :: UnlinkDeveloperIdentity -> UnlinkDeveloperIdentity -> Bool
Prelude.Eq, ReadPrec [UnlinkDeveloperIdentity]
ReadPrec UnlinkDeveloperIdentity
Int -> ReadS UnlinkDeveloperIdentity
ReadS [UnlinkDeveloperIdentity]
(Int -> ReadS UnlinkDeveloperIdentity)
-> ReadS [UnlinkDeveloperIdentity]
-> ReadPrec UnlinkDeveloperIdentity
-> ReadPrec [UnlinkDeveloperIdentity]
-> Read UnlinkDeveloperIdentity
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UnlinkDeveloperIdentity]
$creadListPrec :: ReadPrec [UnlinkDeveloperIdentity]
readPrec :: ReadPrec UnlinkDeveloperIdentity
$creadPrec :: ReadPrec UnlinkDeveloperIdentity
readList :: ReadS [UnlinkDeveloperIdentity]
$creadList :: ReadS [UnlinkDeveloperIdentity]
readsPrec :: Int -> ReadS UnlinkDeveloperIdentity
$creadsPrec :: Int -> ReadS UnlinkDeveloperIdentity
Prelude.Read, Int -> UnlinkDeveloperIdentity -> ShowS
[UnlinkDeveloperIdentity] -> ShowS
UnlinkDeveloperIdentity -> String
(Int -> UnlinkDeveloperIdentity -> ShowS)
-> (UnlinkDeveloperIdentity -> String)
-> ([UnlinkDeveloperIdentity] -> ShowS)
-> Show UnlinkDeveloperIdentity
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UnlinkDeveloperIdentity] -> ShowS
$cshowList :: [UnlinkDeveloperIdentity] -> ShowS
show :: UnlinkDeveloperIdentity -> String
$cshow :: UnlinkDeveloperIdentity -> String
showsPrec :: Int -> UnlinkDeveloperIdentity -> ShowS
$cshowsPrec :: Int -> UnlinkDeveloperIdentity -> ShowS
Prelude.Show, (forall x.
 UnlinkDeveloperIdentity -> Rep UnlinkDeveloperIdentity x)
-> (forall x.
    Rep UnlinkDeveloperIdentity x -> UnlinkDeveloperIdentity)
-> Generic UnlinkDeveloperIdentity
forall x. Rep UnlinkDeveloperIdentity x -> UnlinkDeveloperIdentity
forall x. UnlinkDeveloperIdentity -> Rep UnlinkDeveloperIdentity x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UnlinkDeveloperIdentity x -> UnlinkDeveloperIdentity
$cfrom :: forall x. UnlinkDeveloperIdentity -> Rep UnlinkDeveloperIdentity x
Prelude.Generic)

-- |
-- Create a value of 'UnlinkDeveloperIdentity' 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:
--
-- 'identityId', 'unlinkDeveloperIdentity_identityId' - A unique identifier in the format REGION:GUID.
--
-- 'identityPoolId', 'unlinkDeveloperIdentity_identityPoolId' - An identity pool ID in the format REGION:GUID.
--
-- 'developerProviderName', 'unlinkDeveloperIdentity_developerProviderName' - The \"domain\" by which Cognito will refer to your users.
--
-- 'developerUserIdentifier', 'unlinkDeveloperIdentity_developerUserIdentifier' - A unique ID used by your backend authentication process to identify a
-- user.
newUnlinkDeveloperIdentity ::
  -- | 'identityId'
  Prelude.Text ->
  -- | 'identityPoolId'
  Prelude.Text ->
  -- | 'developerProviderName'
  Prelude.Text ->
  -- | 'developerUserIdentifier'
  Prelude.Text ->
  UnlinkDeveloperIdentity
newUnlinkDeveloperIdentity :: Text -> Text -> Text -> Text -> UnlinkDeveloperIdentity
newUnlinkDeveloperIdentity
  Text
pIdentityId_
  Text
pIdentityPoolId_
  Text
pDeveloperProviderName_
  Text
pDeveloperUserIdentifier_ =
    UnlinkDeveloperIdentity' :: Text -> Text -> Text -> Text -> UnlinkDeveloperIdentity
UnlinkDeveloperIdentity'
      { $sel:identityId:UnlinkDeveloperIdentity' :: Text
identityId = Text
pIdentityId_,
        $sel:identityPoolId:UnlinkDeveloperIdentity' :: Text
identityPoolId = Text
pIdentityPoolId_,
        $sel:developerProviderName:UnlinkDeveloperIdentity' :: Text
developerProviderName = Text
pDeveloperProviderName_,
        $sel:developerUserIdentifier:UnlinkDeveloperIdentity' :: Text
developerUserIdentifier =
          Text
pDeveloperUserIdentifier_
      }

-- | A unique identifier in the format REGION:GUID.
unlinkDeveloperIdentity_identityId :: Lens.Lens' UnlinkDeveloperIdentity Prelude.Text
unlinkDeveloperIdentity_identityId :: (Text -> f Text)
-> UnlinkDeveloperIdentity -> f UnlinkDeveloperIdentity
unlinkDeveloperIdentity_identityId = (UnlinkDeveloperIdentity -> Text)
-> (UnlinkDeveloperIdentity -> Text -> UnlinkDeveloperIdentity)
-> Lens UnlinkDeveloperIdentity UnlinkDeveloperIdentity Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UnlinkDeveloperIdentity' {Text
identityId :: Text
$sel:identityId:UnlinkDeveloperIdentity' :: UnlinkDeveloperIdentity -> Text
identityId} -> Text
identityId) (\s :: UnlinkDeveloperIdentity
s@UnlinkDeveloperIdentity' {} Text
a -> UnlinkDeveloperIdentity
s {$sel:identityId:UnlinkDeveloperIdentity' :: Text
identityId = Text
a} :: UnlinkDeveloperIdentity)

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

-- | The \"domain\" by which Cognito will refer to your users.
unlinkDeveloperIdentity_developerProviderName :: Lens.Lens' UnlinkDeveloperIdentity Prelude.Text
unlinkDeveloperIdentity_developerProviderName :: (Text -> f Text)
-> UnlinkDeveloperIdentity -> f UnlinkDeveloperIdentity
unlinkDeveloperIdentity_developerProviderName = (UnlinkDeveloperIdentity -> Text)
-> (UnlinkDeveloperIdentity -> Text -> UnlinkDeveloperIdentity)
-> Lens UnlinkDeveloperIdentity UnlinkDeveloperIdentity Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UnlinkDeveloperIdentity' {Text
developerProviderName :: Text
$sel:developerProviderName:UnlinkDeveloperIdentity' :: UnlinkDeveloperIdentity -> Text
developerProviderName} -> Text
developerProviderName) (\s :: UnlinkDeveloperIdentity
s@UnlinkDeveloperIdentity' {} Text
a -> UnlinkDeveloperIdentity
s {$sel:developerProviderName:UnlinkDeveloperIdentity' :: Text
developerProviderName = Text
a} :: UnlinkDeveloperIdentity)

-- | A unique ID used by your backend authentication process to identify a
-- user.
unlinkDeveloperIdentity_developerUserIdentifier :: Lens.Lens' UnlinkDeveloperIdentity Prelude.Text
unlinkDeveloperIdentity_developerUserIdentifier :: (Text -> f Text)
-> UnlinkDeveloperIdentity -> f UnlinkDeveloperIdentity
unlinkDeveloperIdentity_developerUserIdentifier = (UnlinkDeveloperIdentity -> Text)
-> (UnlinkDeveloperIdentity -> Text -> UnlinkDeveloperIdentity)
-> Lens UnlinkDeveloperIdentity UnlinkDeveloperIdentity Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UnlinkDeveloperIdentity' {Text
developerUserIdentifier :: Text
$sel:developerUserIdentifier:UnlinkDeveloperIdentity' :: UnlinkDeveloperIdentity -> Text
developerUserIdentifier} -> Text
developerUserIdentifier) (\s :: UnlinkDeveloperIdentity
s@UnlinkDeveloperIdentity' {} Text
a -> UnlinkDeveloperIdentity
s {$sel:developerUserIdentifier:UnlinkDeveloperIdentity' :: Text
developerUserIdentifier = Text
a} :: UnlinkDeveloperIdentity)

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

instance Prelude.Hashable UnlinkDeveloperIdentity

instance Prelude.NFData UnlinkDeveloperIdentity

instance Core.ToHeaders UnlinkDeveloperIdentity where
  toHeaders :: UnlinkDeveloperIdentity -> [Header]
toHeaders =
    [Header] -> UnlinkDeveloperIdentity -> [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.UnlinkDeveloperIdentity" ::
                          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 UnlinkDeveloperIdentity where
  toJSON :: UnlinkDeveloperIdentity -> Value
toJSON UnlinkDeveloperIdentity' {Text
developerUserIdentifier :: Text
developerProviderName :: Text
identityPoolId :: Text
identityId :: Text
$sel:developerUserIdentifier:UnlinkDeveloperIdentity' :: UnlinkDeveloperIdentity -> Text
$sel:developerProviderName:UnlinkDeveloperIdentity' :: UnlinkDeveloperIdentity -> Text
$sel:identityPoolId:UnlinkDeveloperIdentity' :: UnlinkDeveloperIdentity -> Text
$sel:identityId:UnlinkDeveloperIdentity' :: UnlinkDeveloperIdentity -> 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
"IdentityId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
identityId),
            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),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"DeveloperProviderName"
                  Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
developerProviderName
              ),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"DeveloperUserIdentifier"
                  Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
developerUserIdentifier
              )
          ]
      )

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

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

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

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

instance
  Prelude.NFData
    UnlinkDeveloperIdentityResponse