module Network.AWS.CognitoIdentity.GetCredentialsForIdentity
(
GetCredentialsForIdentity
, getCredentialsForIdentity
, gcfiIdentityId
, gcfiLogins
, GetCredentialsForIdentityResponse
, getCredentialsForIdentityResponse
, gcfirCredentials
, gcfirIdentityId
) where
import Network.AWS.Data (Object)
import Network.AWS.Prelude
import Network.AWS.Request.JSON
import Network.AWS.CognitoIdentity.Types
import qualified GHC.Exts
data GetCredentialsForIdentity = GetCredentialsForIdentity
{ _gcfiIdentityId :: Text
, _gcfiLogins :: Map Text Text
} deriving (Eq, Read, Show)
getCredentialsForIdentity :: Text
-> GetCredentialsForIdentity
getCredentialsForIdentity p1 = GetCredentialsForIdentity
{ _gcfiIdentityId = p1
, _gcfiLogins = mempty
}
gcfiIdentityId :: Lens' GetCredentialsForIdentity Text
gcfiIdentityId = lens _gcfiIdentityId (\s a -> s { _gcfiIdentityId = a })
gcfiLogins :: Lens' GetCredentialsForIdentity (HashMap Text Text)
gcfiLogins = lens _gcfiLogins (\s a -> s { _gcfiLogins = a }) . _Map
data GetCredentialsForIdentityResponse = GetCredentialsForIdentityResponse
{ _gcfirCredentials :: Maybe Credentials
, _gcfirIdentityId :: Maybe Text
} deriving (Eq, Read, Show)
getCredentialsForIdentityResponse :: GetCredentialsForIdentityResponse
getCredentialsForIdentityResponse = GetCredentialsForIdentityResponse
{ _gcfirIdentityId = Nothing
, _gcfirCredentials = Nothing
}
gcfirCredentials :: Lens' GetCredentialsForIdentityResponse (Maybe Credentials)
gcfirCredentials = lens _gcfirCredentials (\s a -> s { _gcfirCredentials = a })
gcfirIdentityId :: Lens' GetCredentialsForIdentityResponse (Maybe Text)
gcfirIdentityId = lens _gcfirIdentityId (\s a -> s { _gcfirIdentityId = a })
instance ToPath GetCredentialsForIdentity where
toPath = const "/"
instance ToQuery GetCredentialsForIdentity where
toQuery = const mempty
instance ToHeaders GetCredentialsForIdentity
instance ToJSON GetCredentialsForIdentity where
toJSON GetCredentialsForIdentity{..} = object
[ "IdentityId" .= _gcfiIdentityId
, "Logins" .= _gcfiLogins
]
instance AWSRequest GetCredentialsForIdentity where
type Sv GetCredentialsForIdentity = CognitoIdentity
type Rs GetCredentialsForIdentity = GetCredentialsForIdentityResponse
request = post "GetCredentialsForIdentity"
response = jsonResponse
instance FromJSON GetCredentialsForIdentityResponse where
parseJSON = withObject "GetCredentialsForIdentityResponse" $ \o -> GetCredentialsForIdentityResponse
<$> o .:? "Credentials"
<*> o .:? "IdentityId"