{-# 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 #-}
module Amazonka.CognitoIdentity.GetCredentialsForIdentity
(
GetCredentialsForIdentity (..),
newGetCredentialsForIdentity,
getCredentialsForIdentity_customRoleArn,
getCredentialsForIdentity_logins,
getCredentialsForIdentity_identityId,
GetCredentialsForIdentityResponse (..),
newGetCredentialsForIdentityResponse,
getCredentialsForIdentityResponse_credentials,
getCredentialsForIdentityResponse_identityId,
getCredentialsForIdentityResponse_httpStatus,
)
where
import Amazonka.CognitoIdentity.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetCredentialsForIdentity = GetCredentialsForIdentity'
{
GetCredentialsForIdentity -> Maybe Text
customRoleArn :: Prelude.Maybe Prelude.Text,
GetCredentialsForIdentity -> Maybe (HashMap Text Text)
logins :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
GetCredentialsForIdentity -> Text
identityId :: Prelude.Text
}
deriving (GetCredentialsForIdentity -> GetCredentialsForIdentity -> Bool
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]
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
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.
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)
newGetCredentialsForIdentity ::
Prelude.Text ->
GetCredentialsForIdentity
newGetCredentialsForIdentity :: Text -> GetCredentialsForIdentity
newGetCredentialsForIdentity Text
pIdentityId_ =
GetCredentialsForIdentity'
{ $sel:customRoleArn:GetCredentialsForIdentity' :: Maybe Text
customRoleArn =
forall a. Maybe a
Prelude.Nothing,
$sel:logins:GetCredentialsForIdentity' :: Maybe (HashMap Text Text)
logins = forall a. Maybe a
Prelude.Nothing,
$sel:identityId:GetCredentialsForIdentity' :: Text
identityId = Text
pIdentityId_
}
getCredentialsForIdentity_customRoleArn :: Lens.Lens' GetCredentialsForIdentity (Prelude.Maybe Prelude.Text)
getCredentialsForIdentity_customRoleArn :: Lens' GetCredentialsForIdentity (Maybe Text)
getCredentialsForIdentity_customRoleArn = 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)
getCredentialsForIdentity_logins :: Lens.Lens' GetCredentialsForIdentity (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
getCredentialsForIdentity_logins :: Lens' GetCredentialsForIdentity (Maybe (HashMap Text Text))
getCredentialsForIdentity_logins = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getCredentialsForIdentity_identityId :: Lens.Lens' GetCredentialsForIdentity Prelude.Text
getCredentialsForIdentity_identityId :: Lens' GetCredentialsForIdentity Text
getCredentialsForIdentity_identityId = 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 :: (Service -> Service)
-> GetCredentialsForIdentity -> Request GetCredentialsForIdentity
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetCredentialsForIdentity
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetCredentialsForIdentity)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> 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'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Credentials")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"IdentityId")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable GetCredentialsForIdentity where
hashWithSalt :: Int -> GetCredentialsForIdentity -> Int
hashWithSalt Int
_salt 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
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
customRoleArn
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
logins
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
identityId
instance Prelude.NFData GetCredentialsForIdentity where
rnf :: GetCredentialsForIdentity -> ()
rnf 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
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
customRoleArn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
logins
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
identityId
instance Data.ToHeaders GetCredentialsForIdentity where
toHeaders :: GetCredentialsForIdentity -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"AWSCognitoIdentityService.GetCredentialsForIdentity" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.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
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"CustomRoleArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
customRoleArn,
(Key
"Logins" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
logins,
forall a. a -> Maybe a
Prelude.Just (Key
"IdentityId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
identityId)
]
)
instance Data.ToPath GetCredentialsForIdentity where
toPath :: GetCredentialsForIdentity -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery GetCredentialsForIdentity where
toQuery :: GetCredentialsForIdentity -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data GetCredentialsForIdentityResponse = GetCredentialsForIdentityResponse'
{
GetCredentialsForIdentityResponse -> Maybe Credentials
credentials :: Prelude.Maybe Credentials,
GetCredentialsForIdentityResponse -> Maybe Text
identityId :: Prelude.Maybe Prelude.Text,
GetCredentialsForIdentityResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetCredentialsForIdentityResponse
-> GetCredentialsForIdentityResponse -> Bool
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]
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
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.
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)
newGetCredentialsForIdentityResponse ::
Prelude.Int ->
GetCredentialsForIdentityResponse
newGetCredentialsForIdentityResponse :: Int -> GetCredentialsForIdentityResponse
newGetCredentialsForIdentityResponse Int
pHttpStatus_ =
GetCredentialsForIdentityResponse'
{ $sel:credentials:GetCredentialsForIdentityResponse' :: Maybe Credentials
credentials =
forall a. Maybe a
Prelude.Nothing,
$sel:identityId:GetCredentialsForIdentityResponse' :: Maybe Text
identityId = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetCredentialsForIdentityResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getCredentialsForIdentityResponse_credentials :: Lens.Lens' GetCredentialsForIdentityResponse (Prelude.Maybe Credentials)
getCredentialsForIdentityResponse_credentials :: Lens' GetCredentialsForIdentityResponse (Maybe Credentials)
getCredentialsForIdentityResponse_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)
getCredentialsForIdentityResponse_identityId :: Lens.Lens' GetCredentialsForIdentityResponse (Prelude.Maybe Prelude.Text)
getCredentialsForIdentityResponse_identityId :: Lens' GetCredentialsForIdentityResponse (Maybe Text)
getCredentialsForIdentityResponse_identityId = 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)
getCredentialsForIdentityResponse_httpStatus :: Lens.Lens' GetCredentialsForIdentityResponse Prelude.Int
getCredentialsForIdentityResponse_httpStatus :: Lens' GetCredentialsForIdentityResponse Int
getCredentialsForIdentityResponse_httpStatus = 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
where
rnf :: GetCredentialsForIdentityResponse -> ()
rnf GetCredentialsForIdentityResponse' {Int
Maybe Text
Maybe Credentials
httpStatus :: Int
identityId :: Maybe Text
credentials :: Maybe Credentials
$sel:httpStatus:GetCredentialsForIdentityResponse' :: GetCredentialsForIdentityResponse -> Int
$sel:identityId:GetCredentialsForIdentityResponse' :: GetCredentialsForIdentityResponse -> Maybe Text
$sel:credentials:GetCredentialsForIdentityResponse' :: GetCredentialsForIdentityResponse -> Maybe Credentials
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Credentials
credentials
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
identityId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus