{-# 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.GetOpenIdTokenForDeveloperIdentity
-- 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)
--
-- Registers (or retrieves) a Cognito @IdentityId@ and an OpenID Connect
-- token for a user authenticated by your backend authentication process.
-- Supplying multiple logins will create an implicit linked account. You
-- can only specify one developer provider as part of the @Logins@ map,
-- which is linked to the identity pool. The developer provider is the
-- \"domain\" by which Cognito will refer to your users.
--
-- You can use @GetOpenIdTokenForDeveloperIdentity@ to create a new
-- identity and to link new logins (that is, user credentials issued by a
-- public provider or developer provider) to an existing identity. When you
-- want to create a new identity, the @IdentityId@ should be null. When you
-- want to associate a new login with an existing
-- authenticated\/unauthenticated identity, you can do so by providing the
-- existing @IdentityId@. This API will create the identity in the
-- specified @IdentityPoolId@.
--
-- You must use AWS Developer credentials to call this API.
module Amazonka.CognitoIdentity.GetOpenIdTokenForDeveloperIdentity
  ( -- * Creating a Request
    GetOpenIdTokenForDeveloperIdentity (..),
    newGetOpenIdTokenForDeveloperIdentity,

    -- * Request Lenses
    getOpenIdTokenForDeveloperIdentity_tokenDuration,
    getOpenIdTokenForDeveloperIdentity_principalTags,
    getOpenIdTokenForDeveloperIdentity_identityId,
    getOpenIdTokenForDeveloperIdentity_identityPoolId,
    getOpenIdTokenForDeveloperIdentity_logins,

    -- * Destructuring the Response
    GetOpenIdTokenForDeveloperIdentityResponse (..),
    newGetOpenIdTokenForDeveloperIdentityResponse,

    -- * Response Lenses
    getOpenIdTokenForDeveloperIdentityResponse_token,
    getOpenIdTokenForDeveloperIdentityResponse_identityId,
    getOpenIdTokenForDeveloperIdentityResponse_httpStatus,
  )
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 @GetOpenIdTokenForDeveloperIdentity@ action.
--
-- /See:/ 'newGetOpenIdTokenForDeveloperIdentity' smart constructor.
data GetOpenIdTokenForDeveloperIdentity = GetOpenIdTokenForDeveloperIdentity'
  { -- | The expiration time of the token, in seconds. You can specify a custom
    -- expiration time for the token so that you can cache it. If you don\'t
    -- provide an expiration time, the token is valid for 15 minutes. You can
    -- exchange the token with Amazon STS for temporary AWS credentials, which
    -- are valid for a maximum of one hour. The maximum token duration you can
    -- set is 24 hours. You should take care in setting the expiration time for
    -- a token, as there are significant security implications: an attacker
    -- could use a leaked token to access your AWS resources for the token\'s
    -- duration.
    --
    -- Please provide for a small grace period, usually no more than 5 minutes,
    -- to account for clock skew.
    GetOpenIdTokenForDeveloperIdentity -> Maybe Natural
tokenDuration :: Prelude.Maybe Prelude.Natural,
    -- | Use this operation to configure attribute mappings for custom providers.
    GetOpenIdTokenForDeveloperIdentity -> Maybe (HashMap Text Text)
principalTags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | A unique identifier in the format REGION:GUID.
    GetOpenIdTokenForDeveloperIdentity -> Maybe Text
identityId :: Prelude.Maybe Prelude.Text,
    -- | An identity pool ID in the format REGION:GUID.
    GetOpenIdTokenForDeveloperIdentity -> Text
identityPoolId :: Prelude.Text,
    -- | A set of optional name-value pairs that map provider names to provider
    -- tokens. Each name-value pair represents a user from a public provider or
    -- developer provider. If the user is from a developer provider, the
    -- name-value pair will follow the syntax
    -- @\"developer_provider_name\": \"developer_user_identifier\"@. The
    -- developer provider is the \"domain\" by which Cognito will refer to your
    -- users; you provided this domain while creating\/updating the identity
    -- pool. The developer user identifier is an identifier from your backend
    -- that uniquely identifies a user. When you create an identity pool, you
    -- can specify the supported logins.
    GetOpenIdTokenForDeveloperIdentity -> HashMap Text Text
logins :: Prelude.HashMap Prelude.Text Prelude.Text
  }
  deriving (GetOpenIdTokenForDeveloperIdentity
-> GetOpenIdTokenForDeveloperIdentity -> Bool
(GetOpenIdTokenForDeveloperIdentity
 -> GetOpenIdTokenForDeveloperIdentity -> Bool)
-> (GetOpenIdTokenForDeveloperIdentity
    -> GetOpenIdTokenForDeveloperIdentity -> Bool)
-> Eq GetOpenIdTokenForDeveloperIdentity
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetOpenIdTokenForDeveloperIdentity
-> GetOpenIdTokenForDeveloperIdentity -> Bool
$c/= :: GetOpenIdTokenForDeveloperIdentity
-> GetOpenIdTokenForDeveloperIdentity -> Bool
== :: GetOpenIdTokenForDeveloperIdentity
-> GetOpenIdTokenForDeveloperIdentity -> Bool
$c== :: GetOpenIdTokenForDeveloperIdentity
-> GetOpenIdTokenForDeveloperIdentity -> Bool
Prelude.Eq, ReadPrec [GetOpenIdTokenForDeveloperIdentity]
ReadPrec GetOpenIdTokenForDeveloperIdentity
Int -> ReadS GetOpenIdTokenForDeveloperIdentity
ReadS [GetOpenIdTokenForDeveloperIdentity]
(Int -> ReadS GetOpenIdTokenForDeveloperIdentity)
-> ReadS [GetOpenIdTokenForDeveloperIdentity]
-> ReadPrec GetOpenIdTokenForDeveloperIdentity
-> ReadPrec [GetOpenIdTokenForDeveloperIdentity]
-> Read GetOpenIdTokenForDeveloperIdentity
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetOpenIdTokenForDeveloperIdentity]
$creadListPrec :: ReadPrec [GetOpenIdTokenForDeveloperIdentity]
readPrec :: ReadPrec GetOpenIdTokenForDeveloperIdentity
$creadPrec :: ReadPrec GetOpenIdTokenForDeveloperIdentity
readList :: ReadS [GetOpenIdTokenForDeveloperIdentity]
$creadList :: ReadS [GetOpenIdTokenForDeveloperIdentity]
readsPrec :: Int -> ReadS GetOpenIdTokenForDeveloperIdentity
$creadsPrec :: Int -> ReadS GetOpenIdTokenForDeveloperIdentity
Prelude.Read, Int -> GetOpenIdTokenForDeveloperIdentity -> ShowS
[GetOpenIdTokenForDeveloperIdentity] -> ShowS
GetOpenIdTokenForDeveloperIdentity -> String
(Int -> GetOpenIdTokenForDeveloperIdentity -> ShowS)
-> (GetOpenIdTokenForDeveloperIdentity -> String)
-> ([GetOpenIdTokenForDeveloperIdentity] -> ShowS)
-> Show GetOpenIdTokenForDeveloperIdentity
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetOpenIdTokenForDeveloperIdentity] -> ShowS
$cshowList :: [GetOpenIdTokenForDeveloperIdentity] -> ShowS
show :: GetOpenIdTokenForDeveloperIdentity -> String
$cshow :: GetOpenIdTokenForDeveloperIdentity -> String
showsPrec :: Int -> GetOpenIdTokenForDeveloperIdentity -> ShowS
$cshowsPrec :: Int -> GetOpenIdTokenForDeveloperIdentity -> ShowS
Prelude.Show, (forall x.
 GetOpenIdTokenForDeveloperIdentity
 -> Rep GetOpenIdTokenForDeveloperIdentity x)
-> (forall x.
    Rep GetOpenIdTokenForDeveloperIdentity x
    -> GetOpenIdTokenForDeveloperIdentity)
-> Generic GetOpenIdTokenForDeveloperIdentity
forall x.
Rep GetOpenIdTokenForDeveloperIdentity x
-> GetOpenIdTokenForDeveloperIdentity
forall x.
GetOpenIdTokenForDeveloperIdentity
-> Rep GetOpenIdTokenForDeveloperIdentity x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetOpenIdTokenForDeveloperIdentity x
-> GetOpenIdTokenForDeveloperIdentity
$cfrom :: forall x.
GetOpenIdTokenForDeveloperIdentity
-> Rep GetOpenIdTokenForDeveloperIdentity x
Prelude.Generic)

-- |
-- Create a value of 'GetOpenIdTokenForDeveloperIdentity' 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:
--
-- 'tokenDuration', 'getOpenIdTokenForDeveloperIdentity_tokenDuration' - The expiration time of the token, in seconds. You can specify a custom
-- expiration time for the token so that you can cache it. If you don\'t
-- provide an expiration time, the token is valid for 15 minutes. You can
-- exchange the token with Amazon STS for temporary AWS credentials, which
-- are valid for a maximum of one hour. The maximum token duration you can
-- set is 24 hours. You should take care in setting the expiration time for
-- a token, as there are significant security implications: an attacker
-- could use a leaked token to access your AWS resources for the token\'s
-- duration.
--
-- Please provide for a small grace period, usually no more than 5 minutes,
-- to account for clock skew.
--
-- 'principalTags', 'getOpenIdTokenForDeveloperIdentity_principalTags' - Use this operation to configure attribute mappings for custom providers.
--
-- 'identityId', 'getOpenIdTokenForDeveloperIdentity_identityId' - A unique identifier in the format REGION:GUID.
--
-- 'identityPoolId', 'getOpenIdTokenForDeveloperIdentity_identityPoolId' - An identity pool ID in the format REGION:GUID.
--
-- 'logins', 'getOpenIdTokenForDeveloperIdentity_logins' - A set of optional name-value pairs that map provider names to provider
-- tokens. Each name-value pair represents a user from a public provider or
-- developer provider. If the user is from a developer provider, the
-- name-value pair will follow the syntax
-- @\"developer_provider_name\": \"developer_user_identifier\"@. The
-- developer provider is the \"domain\" by which Cognito will refer to your
-- users; you provided this domain while creating\/updating the identity
-- pool. The developer user identifier is an identifier from your backend
-- that uniquely identifies a user. When you create an identity pool, you
-- can specify the supported logins.
newGetOpenIdTokenForDeveloperIdentity ::
  -- | 'identityPoolId'
  Prelude.Text ->
  GetOpenIdTokenForDeveloperIdentity
newGetOpenIdTokenForDeveloperIdentity :: Text -> GetOpenIdTokenForDeveloperIdentity
newGetOpenIdTokenForDeveloperIdentity
  Text
pIdentityPoolId_ =
    GetOpenIdTokenForDeveloperIdentity' :: Maybe Natural
-> Maybe (HashMap Text Text)
-> Maybe Text
-> Text
-> HashMap Text Text
-> GetOpenIdTokenForDeveloperIdentity
GetOpenIdTokenForDeveloperIdentity'
      { $sel:tokenDuration:GetOpenIdTokenForDeveloperIdentity' :: Maybe Natural
tokenDuration =
          Maybe Natural
forall a. Maybe a
Prelude.Nothing,
        $sel:principalTags:GetOpenIdTokenForDeveloperIdentity' :: Maybe (HashMap Text Text)
principalTags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:identityId:GetOpenIdTokenForDeveloperIdentity' :: Maybe Text
identityId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:identityPoolId:GetOpenIdTokenForDeveloperIdentity' :: Text
identityPoolId = Text
pIdentityPoolId_,
        $sel:logins:GetOpenIdTokenForDeveloperIdentity' :: HashMap Text Text
logins = HashMap Text Text
forall a. Monoid a => a
Prelude.mempty
      }

-- | The expiration time of the token, in seconds. You can specify a custom
-- expiration time for the token so that you can cache it. If you don\'t
-- provide an expiration time, the token is valid for 15 minutes. You can
-- exchange the token with Amazon STS for temporary AWS credentials, which
-- are valid for a maximum of one hour. The maximum token duration you can
-- set is 24 hours. You should take care in setting the expiration time for
-- a token, as there are significant security implications: an attacker
-- could use a leaked token to access your AWS resources for the token\'s
-- duration.
--
-- Please provide for a small grace period, usually no more than 5 minutes,
-- to account for clock skew.
getOpenIdTokenForDeveloperIdentity_tokenDuration :: Lens.Lens' GetOpenIdTokenForDeveloperIdentity (Prelude.Maybe Prelude.Natural)
getOpenIdTokenForDeveloperIdentity_tokenDuration :: (Maybe Natural -> f (Maybe Natural))
-> GetOpenIdTokenForDeveloperIdentity
-> f GetOpenIdTokenForDeveloperIdentity
getOpenIdTokenForDeveloperIdentity_tokenDuration = (GetOpenIdTokenForDeveloperIdentity -> Maybe Natural)
-> (GetOpenIdTokenForDeveloperIdentity
    -> Maybe Natural -> GetOpenIdTokenForDeveloperIdentity)
-> Lens
     GetOpenIdTokenForDeveloperIdentity
     GetOpenIdTokenForDeveloperIdentity
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetOpenIdTokenForDeveloperIdentity' {Maybe Natural
tokenDuration :: Maybe Natural
$sel:tokenDuration:GetOpenIdTokenForDeveloperIdentity' :: GetOpenIdTokenForDeveloperIdentity -> Maybe Natural
tokenDuration} -> Maybe Natural
tokenDuration) (\s :: GetOpenIdTokenForDeveloperIdentity
s@GetOpenIdTokenForDeveloperIdentity' {} Maybe Natural
a -> GetOpenIdTokenForDeveloperIdentity
s {$sel:tokenDuration:GetOpenIdTokenForDeveloperIdentity' :: Maybe Natural
tokenDuration = Maybe Natural
a} :: GetOpenIdTokenForDeveloperIdentity)

-- | Use this operation to configure attribute mappings for custom providers.
getOpenIdTokenForDeveloperIdentity_principalTags :: Lens.Lens' GetOpenIdTokenForDeveloperIdentity (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
getOpenIdTokenForDeveloperIdentity_principalTags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> GetOpenIdTokenForDeveloperIdentity
-> f GetOpenIdTokenForDeveloperIdentity
getOpenIdTokenForDeveloperIdentity_principalTags = (GetOpenIdTokenForDeveloperIdentity -> Maybe (HashMap Text Text))
-> (GetOpenIdTokenForDeveloperIdentity
    -> Maybe (HashMap Text Text) -> GetOpenIdTokenForDeveloperIdentity)
-> Lens
     GetOpenIdTokenForDeveloperIdentity
     GetOpenIdTokenForDeveloperIdentity
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetOpenIdTokenForDeveloperIdentity' {Maybe (HashMap Text Text)
principalTags :: Maybe (HashMap Text Text)
$sel:principalTags:GetOpenIdTokenForDeveloperIdentity' :: GetOpenIdTokenForDeveloperIdentity -> Maybe (HashMap Text Text)
principalTags} -> Maybe (HashMap Text Text)
principalTags) (\s :: GetOpenIdTokenForDeveloperIdentity
s@GetOpenIdTokenForDeveloperIdentity' {} Maybe (HashMap Text Text)
a -> GetOpenIdTokenForDeveloperIdentity
s {$sel:principalTags:GetOpenIdTokenForDeveloperIdentity' :: Maybe (HashMap Text Text)
principalTags = Maybe (HashMap Text Text)
a} :: GetOpenIdTokenForDeveloperIdentity) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> GetOpenIdTokenForDeveloperIdentity
 -> f GetOpenIdTokenForDeveloperIdentity)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> GetOpenIdTokenForDeveloperIdentity
-> f GetOpenIdTokenForDeveloperIdentity
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

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

-- | A set of optional name-value pairs that map provider names to provider
-- tokens. Each name-value pair represents a user from a public provider or
-- developer provider. If the user is from a developer provider, the
-- name-value pair will follow the syntax
-- @\"developer_provider_name\": \"developer_user_identifier\"@. The
-- developer provider is the \"domain\" by which Cognito will refer to your
-- users; you provided this domain while creating\/updating the identity
-- pool. The developer user identifier is an identifier from your backend
-- that uniquely identifies a user. When you create an identity pool, you
-- can specify the supported logins.
getOpenIdTokenForDeveloperIdentity_logins :: Lens.Lens' GetOpenIdTokenForDeveloperIdentity (Prelude.HashMap Prelude.Text Prelude.Text)
getOpenIdTokenForDeveloperIdentity_logins :: (HashMap Text Text -> f (HashMap Text Text))
-> GetOpenIdTokenForDeveloperIdentity
-> f GetOpenIdTokenForDeveloperIdentity
getOpenIdTokenForDeveloperIdentity_logins = (GetOpenIdTokenForDeveloperIdentity -> HashMap Text Text)
-> (GetOpenIdTokenForDeveloperIdentity
    -> HashMap Text Text -> GetOpenIdTokenForDeveloperIdentity)
-> Lens
     GetOpenIdTokenForDeveloperIdentity
     GetOpenIdTokenForDeveloperIdentity
     (HashMap Text Text)
     (HashMap Text Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetOpenIdTokenForDeveloperIdentity' {HashMap Text Text
logins :: HashMap Text Text
$sel:logins:GetOpenIdTokenForDeveloperIdentity' :: GetOpenIdTokenForDeveloperIdentity -> HashMap Text Text
logins} -> HashMap Text Text
logins) (\s :: GetOpenIdTokenForDeveloperIdentity
s@GetOpenIdTokenForDeveloperIdentity' {} HashMap Text Text
a -> GetOpenIdTokenForDeveloperIdentity
s {$sel:logins:GetOpenIdTokenForDeveloperIdentity' :: HashMap Text Text
logins = HashMap Text Text
a} :: GetOpenIdTokenForDeveloperIdentity) ((HashMap Text Text -> f (HashMap Text Text))
 -> GetOpenIdTokenForDeveloperIdentity
 -> f GetOpenIdTokenForDeveloperIdentity)
-> ((HashMap Text Text -> f (HashMap Text Text))
    -> HashMap Text Text -> f (HashMap Text Text))
-> (HashMap Text Text -> f (HashMap Text Text))
-> GetOpenIdTokenForDeveloperIdentity
-> f GetOpenIdTokenForDeveloperIdentity
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (HashMap Text Text -> f (HashMap Text Text))
-> HashMap Text Text -> f (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance
  Core.AWSRequest
    GetOpenIdTokenForDeveloperIdentity
  where
  type
    AWSResponse GetOpenIdTokenForDeveloperIdentity =
      GetOpenIdTokenForDeveloperIdentityResponse
  request :: GetOpenIdTokenForDeveloperIdentity
-> Request GetOpenIdTokenForDeveloperIdentity
request = Service
-> GetOpenIdTokenForDeveloperIdentity
-> Request GetOpenIdTokenForDeveloperIdentity
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy GetOpenIdTokenForDeveloperIdentity
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse GetOpenIdTokenForDeveloperIdentity)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetOpenIdTokenForDeveloperIdentity))
-> Logger
-> Service
-> Proxy GetOpenIdTokenForDeveloperIdentity
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse GetOpenIdTokenForDeveloperIdentity)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text
-> Maybe Text -> Int -> GetOpenIdTokenForDeveloperIdentityResponse
GetOpenIdTokenForDeveloperIdentityResponse'
            (Maybe Text
 -> Maybe Text -> Int -> GetOpenIdTokenForDeveloperIdentityResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text -> Int -> GetOpenIdTokenForDeveloperIdentityResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Token")
              Either
  String
  (Maybe Text -> Int -> GetOpenIdTokenForDeveloperIdentityResponse)
-> Either String (Maybe Text)
-> Either
     String (Int -> GetOpenIdTokenForDeveloperIdentityResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"IdentityId")
              Either String (Int -> GetOpenIdTokenForDeveloperIdentityResponse)
-> Either String Int
-> Either String GetOpenIdTokenForDeveloperIdentityResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance
  Prelude.Hashable
    GetOpenIdTokenForDeveloperIdentity

instance
  Prelude.NFData
    GetOpenIdTokenForDeveloperIdentity

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

instance
  Core.ToJSON
    GetOpenIdTokenForDeveloperIdentity
  where
  toJSON :: GetOpenIdTokenForDeveloperIdentity -> Value
toJSON GetOpenIdTokenForDeveloperIdentity' {Maybe Natural
Maybe Text
Maybe (HashMap Text Text)
Text
HashMap Text Text
logins :: HashMap Text Text
identityPoolId :: Text
identityId :: Maybe Text
principalTags :: Maybe (HashMap Text Text)
tokenDuration :: Maybe Natural
$sel:logins:GetOpenIdTokenForDeveloperIdentity' :: GetOpenIdTokenForDeveloperIdentity -> HashMap Text Text
$sel:identityPoolId:GetOpenIdTokenForDeveloperIdentity' :: GetOpenIdTokenForDeveloperIdentity -> Text
$sel:identityId:GetOpenIdTokenForDeveloperIdentity' :: GetOpenIdTokenForDeveloperIdentity -> Maybe Text
$sel:principalTags:GetOpenIdTokenForDeveloperIdentity' :: GetOpenIdTokenForDeveloperIdentity -> Maybe (HashMap Text Text)
$sel:tokenDuration:GetOpenIdTokenForDeveloperIdentity' :: GetOpenIdTokenForDeveloperIdentity -> Maybe Natural
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"TokenDuration" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
tokenDuration,
            (Text
"PrincipalTags" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
principalTags,
            (Text
"IdentityId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe 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
"Logins" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= HashMap Text Text
logins)
          ]
      )

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

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

-- | Returned in response to a successful
-- @GetOpenIdTokenForDeveloperIdentity@ request.
--
-- /See:/ 'newGetOpenIdTokenForDeveloperIdentityResponse' smart constructor.
data GetOpenIdTokenForDeveloperIdentityResponse = GetOpenIdTokenForDeveloperIdentityResponse'
  { -- | An OpenID token.
    GetOpenIdTokenForDeveloperIdentityResponse -> Maybe Text
token :: Prelude.Maybe Prelude.Text,
    -- | A unique identifier in the format REGION:GUID.
    GetOpenIdTokenForDeveloperIdentityResponse -> Maybe Text
identityId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    GetOpenIdTokenForDeveloperIdentityResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetOpenIdTokenForDeveloperIdentityResponse
-> GetOpenIdTokenForDeveloperIdentityResponse -> Bool
(GetOpenIdTokenForDeveloperIdentityResponse
 -> GetOpenIdTokenForDeveloperIdentityResponse -> Bool)
-> (GetOpenIdTokenForDeveloperIdentityResponse
    -> GetOpenIdTokenForDeveloperIdentityResponse -> Bool)
-> Eq GetOpenIdTokenForDeveloperIdentityResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetOpenIdTokenForDeveloperIdentityResponse
-> GetOpenIdTokenForDeveloperIdentityResponse -> Bool
$c/= :: GetOpenIdTokenForDeveloperIdentityResponse
-> GetOpenIdTokenForDeveloperIdentityResponse -> Bool
== :: GetOpenIdTokenForDeveloperIdentityResponse
-> GetOpenIdTokenForDeveloperIdentityResponse -> Bool
$c== :: GetOpenIdTokenForDeveloperIdentityResponse
-> GetOpenIdTokenForDeveloperIdentityResponse -> Bool
Prelude.Eq, ReadPrec [GetOpenIdTokenForDeveloperIdentityResponse]
ReadPrec GetOpenIdTokenForDeveloperIdentityResponse
Int -> ReadS GetOpenIdTokenForDeveloperIdentityResponse
ReadS [GetOpenIdTokenForDeveloperIdentityResponse]
(Int -> ReadS GetOpenIdTokenForDeveloperIdentityResponse)
-> ReadS [GetOpenIdTokenForDeveloperIdentityResponse]
-> ReadPrec GetOpenIdTokenForDeveloperIdentityResponse
-> ReadPrec [GetOpenIdTokenForDeveloperIdentityResponse]
-> Read GetOpenIdTokenForDeveloperIdentityResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetOpenIdTokenForDeveloperIdentityResponse]
$creadListPrec :: ReadPrec [GetOpenIdTokenForDeveloperIdentityResponse]
readPrec :: ReadPrec GetOpenIdTokenForDeveloperIdentityResponse
$creadPrec :: ReadPrec GetOpenIdTokenForDeveloperIdentityResponse
readList :: ReadS [GetOpenIdTokenForDeveloperIdentityResponse]
$creadList :: ReadS [GetOpenIdTokenForDeveloperIdentityResponse]
readsPrec :: Int -> ReadS GetOpenIdTokenForDeveloperIdentityResponse
$creadsPrec :: Int -> ReadS GetOpenIdTokenForDeveloperIdentityResponse
Prelude.Read, Int -> GetOpenIdTokenForDeveloperIdentityResponse -> ShowS
[GetOpenIdTokenForDeveloperIdentityResponse] -> ShowS
GetOpenIdTokenForDeveloperIdentityResponse -> String
(Int -> GetOpenIdTokenForDeveloperIdentityResponse -> ShowS)
-> (GetOpenIdTokenForDeveloperIdentityResponse -> String)
-> ([GetOpenIdTokenForDeveloperIdentityResponse] -> ShowS)
-> Show GetOpenIdTokenForDeveloperIdentityResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetOpenIdTokenForDeveloperIdentityResponse] -> ShowS
$cshowList :: [GetOpenIdTokenForDeveloperIdentityResponse] -> ShowS
show :: GetOpenIdTokenForDeveloperIdentityResponse -> String
$cshow :: GetOpenIdTokenForDeveloperIdentityResponse -> String
showsPrec :: Int -> GetOpenIdTokenForDeveloperIdentityResponse -> ShowS
$cshowsPrec :: Int -> GetOpenIdTokenForDeveloperIdentityResponse -> ShowS
Prelude.Show, (forall x.
 GetOpenIdTokenForDeveloperIdentityResponse
 -> Rep GetOpenIdTokenForDeveloperIdentityResponse x)
-> (forall x.
    Rep GetOpenIdTokenForDeveloperIdentityResponse x
    -> GetOpenIdTokenForDeveloperIdentityResponse)
-> Generic GetOpenIdTokenForDeveloperIdentityResponse
forall x.
Rep GetOpenIdTokenForDeveloperIdentityResponse x
-> GetOpenIdTokenForDeveloperIdentityResponse
forall x.
GetOpenIdTokenForDeveloperIdentityResponse
-> Rep GetOpenIdTokenForDeveloperIdentityResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetOpenIdTokenForDeveloperIdentityResponse x
-> GetOpenIdTokenForDeveloperIdentityResponse
$cfrom :: forall x.
GetOpenIdTokenForDeveloperIdentityResponse
-> Rep GetOpenIdTokenForDeveloperIdentityResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetOpenIdTokenForDeveloperIdentityResponse' 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:
--
-- 'token', 'getOpenIdTokenForDeveloperIdentityResponse_token' - An OpenID token.
--
-- 'identityId', 'getOpenIdTokenForDeveloperIdentityResponse_identityId' - A unique identifier in the format REGION:GUID.
--
-- 'httpStatus', 'getOpenIdTokenForDeveloperIdentityResponse_httpStatus' - The response's http status code.
newGetOpenIdTokenForDeveloperIdentityResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetOpenIdTokenForDeveloperIdentityResponse
newGetOpenIdTokenForDeveloperIdentityResponse :: Int -> GetOpenIdTokenForDeveloperIdentityResponse
newGetOpenIdTokenForDeveloperIdentityResponse
  Int
pHttpStatus_ =
    GetOpenIdTokenForDeveloperIdentityResponse' :: Maybe Text
-> Maybe Text -> Int -> GetOpenIdTokenForDeveloperIdentityResponse
GetOpenIdTokenForDeveloperIdentityResponse'
      { $sel:token:GetOpenIdTokenForDeveloperIdentityResponse' :: Maybe Text
token =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:identityId:GetOpenIdTokenForDeveloperIdentityResponse' :: Maybe Text
identityId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:GetOpenIdTokenForDeveloperIdentityResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | An OpenID token.
getOpenIdTokenForDeveloperIdentityResponse_token :: Lens.Lens' GetOpenIdTokenForDeveloperIdentityResponse (Prelude.Maybe Prelude.Text)
getOpenIdTokenForDeveloperIdentityResponse_token :: (Maybe Text -> f (Maybe Text))
-> GetOpenIdTokenForDeveloperIdentityResponse
-> f GetOpenIdTokenForDeveloperIdentityResponse
getOpenIdTokenForDeveloperIdentityResponse_token = (GetOpenIdTokenForDeveloperIdentityResponse -> Maybe Text)
-> (GetOpenIdTokenForDeveloperIdentityResponse
    -> Maybe Text -> GetOpenIdTokenForDeveloperIdentityResponse)
-> Lens
     GetOpenIdTokenForDeveloperIdentityResponse
     GetOpenIdTokenForDeveloperIdentityResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetOpenIdTokenForDeveloperIdentityResponse' {Maybe Text
token :: Maybe Text
$sel:token:GetOpenIdTokenForDeveloperIdentityResponse' :: GetOpenIdTokenForDeveloperIdentityResponse -> Maybe Text
token} -> Maybe Text
token) (\s :: GetOpenIdTokenForDeveloperIdentityResponse
s@GetOpenIdTokenForDeveloperIdentityResponse' {} Maybe Text
a -> GetOpenIdTokenForDeveloperIdentityResponse
s {$sel:token:GetOpenIdTokenForDeveloperIdentityResponse' :: Maybe Text
token = Maybe Text
a} :: GetOpenIdTokenForDeveloperIdentityResponse)

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

-- | The response's http status code.
getOpenIdTokenForDeveloperIdentityResponse_httpStatus :: Lens.Lens' GetOpenIdTokenForDeveloperIdentityResponse Prelude.Int
getOpenIdTokenForDeveloperIdentityResponse_httpStatus :: (Int -> f Int)
-> GetOpenIdTokenForDeveloperIdentityResponse
-> f GetOpenIdTokenForDeveloperIdentityResponse
getOpenIdTokenForDeveloperIdentityResponse_httpStatus = (GetOpenIdTokenForDeveloperIdentityResponse -> Int)
-> (GetOpenIdTokenForDeveloperIdentityResponse
    -> Int -> GetOpenIdTokenForDeveloperIdentityResponse)
-> Lens
     GetOpenIdTokenForDeveloperIdentityResponse
     GetOpenIdTokenForDeveloperIdentityResponse
     Int
     Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetOpenIdTokenForDeveloperIdentityResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetOpenIdTokenForDeveloperIdentityResponse' :: GetOpenIdTokenForDeveloperIdentityResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetOpenIdTokenForDeveloperIdentityResponse
s@GetOpenIdTokenForDeveloperIdentityResponse' {} Int
a -> GetOpenIdTokenForDeveloperIdentityResponse
s {$sel:httpStatus:GetOpenIdTokenForDeveloperIdentityResponse' :: Int
httpStatus = Int
a} :: GetOpenIdTokenForDeveloperIdentityResponse)

instance
  Prelude.NFData
    GetOpenIdTokenForDeveloperIdentityResponse