{-# 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.GetCredentialsForIdentity
-- 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)
--
-- Returns credentials for the provided identity ID. Any provided logins
-- will be validated against supported login providers. If the token is for
-- cognito-identity.amazonaws.com, it will be passed through to AWS
-- Security Token Service with the appropriate role for the token.
--
-- This is a public API. You do not need any credentials to call this API.
module Amazonka.CognitoIdentity.GetCredentialsForIdentity
  ( -- * Creating a Request
    GetCredentialsForIdentity (..),
    newGetCredentialsForIdentity,

    -- * Request Lenses
    getCredentialsForIdentity_customRoleArn,
    getCredentialsForIdentity_logins,
    getCredentialsForIdentity_identityId,

    -- * Destructuring the Response
    GetCredentialsForIdentityResponse (..),
    newGetCredentialsForIdentityResponse,

    -- * Response Lenses
    getCredentialsForIdentityResponse_credentials,
    getCredentialsForIdentityResponse_identityId,
    getCredentialsForIdentityResponse_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 @GetCredentialsForIdentity@ action.
--
-- /See:/ 'newGetCredentialsForIdentity' smart constructor.
data GetCredentialsForIdentity = GetCredentialsForIdentity'
  { -- | The Amazon Resource Name (ARN) of the role to be assumed when multiple
    -- roles were received in the token from the identity provider. For
    -- example, a SAML-based identity provider. This parameter is optional for
    -- identity providers that do not support role customization.
    GetCredentialsForIdentity -> Maybe Text
customRoleArn :: Prelude.Maybe Prelude.Text,
    -- | A set of optional name-value pairs that map provider names to provider
    -- tokens. The name-value pair will follow the syntax \"provider_name\":
    -- \"provider_user_identifier\".
    --
    -- Logins should not be specified when trying to get credentials for an
    -- unauthenticated identity.
    --
    -- The Logins parameter is required when using identities associated with
    -- external identity providers such as Facebook. For examples of @Logins@
    -- maps, see the code examples in the
    -- <https://docs.aws.amazon.com/cognito/latest/developerguide/external-identity-providers.html External Identity Providers>
    -- section of the Amazon Cognito Developer Guide.
    GetCredentialsForIdentity -> Maybe (HashMap Text Text)
logins :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | A unique identifier in the format REGION:GUID.
    GetCredentialsForIdentity -> Text
identityId :: Prelude.Text
  }
  deriving (GetCredentialsForIdentity -> GetCredentialsForIdentity -> Bool
(GetCredentialsForIdentity -> GetCredentialsForIdentity -> Bool)
-> (GetCredentialsForIdentity -> GetCredentialsForIdentity -> Bool)
-> Eq GetCredentialsForIdentity
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetCredentialsForIdentity -> GetCredentialsForIdentity -> Bool
$c/= :: GetCredentialsForIdentity -> GetCredentialsForIdentity -> Bool
== :: GetCredentialsForIdentity -> GetCredentialsForIdentity -> Bool
$c== :: GetCredentialsForIdentity -> GetCredentialsForIdentity -> Bool
Prelude.Eq, ReadPrec [GetCredentialsForIdentity]
ReadPrec GetCredentialsForIdentity
Int -> ReadS GetCredentialsForIdentity
ReadS [GetCredentialsForIdentity]
(Int -> ReadS GetCredentialsForIdentity)
-> ReadS [GetCredentialsForIdentity]
-> ReadPrec GetCredentialsForIdentity
-> ReadPrec [GetCredentialsForIdentity]
-> Read GetCredentialsForIdentity
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetCredentialsForIdentity]
$creadListPrec :: ReadPrec [GetCredentialsForIdentity]
readPrec :: ReadPrec GetCredentialsForIdentity
$creadPrec :: ReadPrec GetCredentialsForIdentity
readList :: ReadS [GetCredentialsForIdentity]
$creadList :: ReadS [GetCredentialsForIdentity]
readsPrec :: Int -> ReadS GetCredentialsForIdentity
$creadsPrec :: Int -> ReadS GetCredentialsForIdentity
Prelude.Read, Int -> GetCredentialsForIdentity -> ShowS
[GetCredentialsForIdentity] -> ShowS
GetCredentialsForIdentity -> String
(Int -> GetCredentialsForIdentity -> ShowS)
-> (GetCredentialsForIdentity -> String)
-> ([GetCredentialsForIdentity] -> ShowS)
-> Show GetCredentialsForIdentity
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetCredentialsForIdentity] -> ShowS
$cshowList :: [GetCredentialsForIdentity] -> ShowS
show :: GetCredentialsForIdentity -> String
$cshow :: GetCredentialsForIdentity -> String
showsPrec :: Int -> GetCredentialsForIdentity -> ShowS
$cshowsPrec :: Int -> GetCredentialsForIdentity -> ShowS
Prelude.Show, (forall x.
 GetCredentialsForIdentity -> Rep GetCredentialsForIdentity x)
-> (forall x.
    Rep GetCredentialsForIdentity x -> GetCredentialsForIdentity)
-> Generic GetCredentialsForIdentity
forall x.
Rep GetCredentialsForIdentity x -> GetCredentialsForIdentity
forall x.
GetCredentialsForIdentity -> Rep GetCredentialsForIdentity x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetCredentialsForIdentity x -> GetCredentialsForIdentity
$cfrom :: forall x.
GetCredentialsForIdentity -> Rep GetCredentialsForIdentity x
Prelude.Generic)

-- |
-- Create a value of 'GetCredentialsForIdentity' 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:
--
-- 'customRoleArn', 'getCredentialsForIdentity_customRoleArn' - The Amazon Resource Name (ARN) of the role to be assumed when multiple
-- roles were received in the token from the identity provider. For
-- example, a SAML-based identity provider. This parameter is optional for
-- identity providers that do not support role customization.
--
-- 'logins', 'getCredentialsForIdentity_logins' - A set of optional name-value pairs that map provider names to provider
-- tokens. The name-value pair will follow the syntax \"provider_name\":
-- \"provider_user_identifier\".
--
-- Logins should not be specified when trying to get credentials for an
-- unauthenticated identity.
--
-- The Logins parameter is required when using identities associated with
-- external identity providers such as Facebook. For examples of @Logins@
-- maps, see the code examples in the
-- <https://docs.aws.amazon.com/cognito/latest/developerguide/external-identity-providers.html External Identity Providers>
-- section of the Amazon Cognito Developer Guide.
--
-- 'identityId', 'getCredentialsForIdentity_identityId' - A unique identifier in the format REGION:GUID.
newGetCredentialsForIdentity ::
  -- | 'identityId'
  Prelude.Text ->
  GetCredentialsForIdentity
newGetCredentialsForIdentity :: Text -> GetCredentialsForIdentity
newGetCredentialsForIdentity Text
pIdentityId_ =
  GetCredentialsForIdentity' :: Maybe Text
-> Maybe (HashMap Text Text) -> Text -> GetCredentialsForIdentity
GetCredentialsForIdentity'
    { $sel:customRoleArn:GetCredentialsForIdentity' :: Maybe Text
customRoleArn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:logins:GetCredentialsForIdentity' :: Maybe (HashMap Text Text)
logins = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:identityId:GetCredentialsForIdentity' :: Text
identityId = Text
pIdentityId_
    }

-- | The Amazon Resource Name (ARN) of the role to be assumed when multiple
-- roles were received in the token from the identity provider. For
-- example, a SAML-based identity provider. This parameter is optional for
-- identity providers that do not support role customization.
getCredentialsForIdentity_customRoleArn :: Lens.Lens' GetCredentialsForIdentity (Prelude.Maybe Prelude.Text)
getCredentialsForIdentity_customRoleArn :: (Maybe Text -> f (Maybe Text))
-> GetCredentialsForIdentity -> f GetCredentialsForIdentity
getCredentialsForIdentity_customRoleArn = (GetCredentialsForIdentity -> Maybe Text)
-> (GetCredentialsForIdentity
    -> Maybe Text -> GetCredentialsForIdentity)
-> Lens
     GetCredentialsForIdentity
     GetCredentialsForIdentity
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCredentialsForIdentity' {Maybe Text
customRoleArn :: Maybe Text
$sel:customRoleArn:GetCredentialsForIdentity' :: GetCredentialsForIdentity -> Maybe Text
customRoleArn} -> Maybe Text
customRoleArn) (\s :: GetCredentialsForIdentity
s@GetCredentialsForIdentity' {} Maybe Text
a -> GetCredentialsForIdentity
s {$sel:customRoleArn:GetCredentialsForIdentity' :: Maybe Text
customRoleArn = Maybe Text
a} :: GetCredentialsForIdentity)

-- | A set of optional name-value pairs that map provider names to provider
-- tokens. The name-value pair will follow the syntax \"provider_name\":
-- \"provider_user_identifier\".
--
-- Logins should not be specified when trying to get credentials for an
-- unauthenticated identity.
--
-- The Logins parameter is required when using identities associated with
-- external identity providers such as Facebook. For examples of @Logins@
-- maps, see the code examples in the
-- <https://docs.aws.amazon.com/cognito/latest/developerguide/external-identity-providers.html External Identity Providers>
-- section of the Amazon Cognito Developer Guide.
getCredentialsForIdentity_logins :: Lens.Lens' GetCredentialsForIdentity (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
getCredentialsForIdentity_logins :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> GetCredentialsForIdentity -> f GetCredentialsForIdentity
getCredentialsForIdentity_logins = (GetCredentialsForIdentity -> Maybe (HashMap Text Text))
-> (GetCredentialsForIdentity
    -> Maybe (HashMap Text Text) -> GetCredentialsForIdentity)
-> Lens
     GetCredentialsForIdentity
     GetCredentialsForIdentity
     (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 (\GetCredentialsForIdentity' {Maybe (HashMap Text Text)
logins :: Maybe (HashMap Text Text)
$sel:logins:GetCredentialsForIdentity' :: GetCredentialsForIdentity -> Maybe (HashMap Text Text)
logins} -> Maybe (HashMap Text Text)
logins) (\s :: GetCredentialsForIdentity
s@GetCredentialsForIdentity' {} Maybe (HashMap Text Text)
a -> GetCredentialsForIdentity
s {$sel:logins:GetCredentialsForIdentity' :: Maybe (HashMap Text Text)
logins = Maybe (HashMap Text Text)
a} :: GetCredentialsForIdentity) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> GetCredentialsForIdentity -> f GetCredentialsForIdentity)
-> ((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)))
-> GetCredentialsForIdentity
-> f GetCredentialsForIdentity
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.
getCredentialsForIdentity_identityId :: Lens.Lens' GetCredentialsForIdentity Prelude.Text
getCredentialsForIdentity_identityId :: (Text -> f Text)
-> GetCredentialsForIdentity -> f GetCredentialsForIdentity
getCredentialsForIdentity_identityId = (GetCredentialsForIdentity -> Text)
-> (GetCredentialsForIdentity -> Text -> GetCredentialsForIdentity)
-> Lens
     GetCredentialsForIdentity GetCredentialsForIdentity Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCredentialsForIdentity' {Text
identityId :: Text
$sel:identityId:GetCredentialsForIdentity' :: GetCredentialsForIdentity -> Text
identityId} -> Text
identityId) (\s :: GetCredentialsForIdentity
s@GetCredentialsForIdentity' {} Text
a -> GetCredentialsForIdentity
s {$sel:identityId:GetCredentialsForIdentity' :: Text
identityId = Text
a} :: GetCredentialsForIdentity)

instance Core.AWSRequest GetCredentialsForIdentity where
  type
    AWSResponse GetCredentialsForIdentity =
      GetCredentialsForIdentityResponse
  request :: GetCredentialsForIdentity -> Request GetCredentialsForIdentity
request = Service
-> GetCredentialsForIdentity -> Request GetCredentialsForIdentity
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy GetCredentialsForIdentity
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetCredentialsForIdentity)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetCredentialsForIdentity))
-> Logger
-> Service
-> Proxy GetCredentialsForIdentity
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetCredentialsForIdentity)))
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 Credentials
-> Maybe Text -> Int -> GetCredentialsForIdentityResponse
GetCredentialsForIdentityResponse'
            (Maybe Credentials
 -> Maybe Text -> Int -> GetCredentialsForIdentityResponse)
-> Either String (Maybe Credentials)
-> Either
     String (Maybe Text -> Int -> GetCredentialsForIdentityResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Credentials)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Credentials")
            Either
  String (Maybe Text -> Int -> GetCredentialsForIdentityResponse)
-> Either String (Maybe Text)
-> Either String (Int -> GetCredentialsForIdentityResponse)
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 -> GetCredentialsForIdentityResponse)
-> Either String Int
-> Either String GetCredentialsForIdentityResponse
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 GetCredentialsForIdentity

instance Prelude.NFData GetCredentialsForIdentity

instance Core.ToHeaders GetCredentialsForIdentity where
  toHeaders :: GetCredentialsForIdentity -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetCredentialsForIdentity -> 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.GetCredentialsForIdentity" ::
                          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 GetCredentialsForIdentity where
  toJSON :: GetCredentialsForIdentity -> Value
toJSON GetCredentialsForIdentity' {Maybe Text
Maybe (HashMap Text Text)
Text
identityId :: Text
logins :: Maybe (HashMap Text Text)
customRoleArn :: Maybe Text
$sel:identityId:GetCredentialsForIdentity' :: GetCredentialsForIdentity -> Text
$sel:logins:GetCredentialsForIdentity' :: GetCredentialsForIdentity -> Maybe (HashMap Text Text)
$sel:customRoleArn:GetCredentialsForIdentity' :: GetCredentialsForIdentity -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"CustomRoleArn" 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
customRoleArn,
            (Text
"Logins" 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)
logins,
            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)
          ]
      )

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

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

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

-- |
-- Create a value of 'GetCredentialsForIdentityResponse' 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:
--
-- 'credentials', 'getCredentialsForIdentityResponse_credentials' - Credentials for the provided identity ID.
--
-- 'identityId', 'getCredentialsForIdentityResponse_identityId' - A unique identifier in the format REGION:GUID.
--
-- 'httpStatus', 'getCredentialsForIdentityResponse_httpStatus' - The response's http status code.
newGetCredentialsForIdentityResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetCredentialsForIdentityResponse
newGetCredentialsForIdentityResponse :: Int -> GetCredentialsForIdentityResponse
newGetCredentialsForIdentityResponse Int
pHttpStatus_ =
  GetCredentialsForIdentityResponse' :: Maybe Credentials
-> Maybe Text -> Int -> GetCredentialsForIdentityResponse
GetCredentialsForIdentityResponse'
    { $sel:credentials:GetCredentialsForIdentityResponse' :: Maybe Credentials
credentials =
        Maybe Credentials
forall a. Maybe a
Prelude.Nothing,
      $sel:identityId:GetCredentialsForIdentityResponse' :: Maybe Text
identityId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetCredentialsForIdentityResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Credentials for the provided identity ID.
getCredentialsForIdentityResponse_credentials :: Lens.Lens' GetCredentialsForIdentityResponse (Prelude.Maybe Credentials)
getCredentialsForIdentityResponse_credentials :: (Maybe Credentials -> f (Maybe Credentials))
-> GetCredentialsForIdentityResponse
-> f GetCredentialsForIdentityResponse
getCredentialsForIdentityResponse_credentials = (GetCredentialsForIdentityResponse -> Maybe Credentials)
-> (GetCredentialsForIdentityResponse
    -> Maybe Credentials -> GetCredentialsForIdentityResponse)
-> Lens
     GetCredentialsForIdentityResponse
     GetCredentialsForIdentityResponse
     (Maybe Credentials)
     (Maybe Credentials)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCredentialsForIdentityResponse' {Maybe Credentials
credentials :: Maybe Credentials
$sel:credentials:GetCredentialsForIdentityResponse' :: GetCredentialsForIdentityResponse -> Maybe Credentials
credentials} -> Maybe Credentials
credentials) (\s :: GetCredentialsForIdentityResponse
s@GetCredentialsForIdentityResponse' {} Maybe Credentials
a -> GetCredentialsForIdentityResponse
s {$sel:credentials:GetCredentialsForIdentityResponse' :: Maybe Credentials
credentials = Maybe Credentials
a} :: GetCredentialsForIdentityResponse)

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

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

instance
  Prelude.NFData
    GetCredentialsForIdentityResponse