{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Network.AWS.CognitoIdentityProvider.AdminRespondToAuthChallenge
(
adminRespondToAuthChallenge
, AdminRespondToAuthChallenge
, artacChallengeResponses
, artacSession
, artacUserPoolId
, artacClientId
, artacChallengeName
, adminRespondToAuthChallengeResponse
, AdminRespondToAuthChallengeResponse
, artacrsChallengeName
, artacrsChallengeParameters
, artacrsAuthenticationResult
, artacrsSession
, artacrsResponseStatus
) where
import Network.AWS.CognitoIdentityProvider.Types
import Network.AWS.CognitoIdentityProvider.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data AdminRespondToAuthChallenge = AdminRespondToAuthChallenge'
{ _artacChallengeResponses :: !(Maybe (Map Text Text))
, _artacSession :: !(Maybe Text)
, _artacUserPoolId :: !Text
, _artacClientId :: !(Sensitive Text)
, _artacChallengeName :: !ChallengeNameType
} deriving (Eq,Read,Show,Data,Typeable,Generic)
adminRespondToAuthChallenge
:: Text
-> Text
-> ChallengeNameType
-> AdminRespondToAuthChallenge
adminRespondToAuthChallenge pUserPoolId_ pClientId_ pChallengeName_ =
AdminRespondToAuthChallenge'
{ _artacChallengeResponses = Nothing
, _artacSession = Nothing
, _artacUserPoolId = pUserPoolId_
, _artacClientId = _Sensitive # pClientId_
, _artacChallengeName = pChallengeName_
}
artacChallengeResponses :: Lens' AdminRespondToAuthChallenge (HashMap Text Text)
artacChallengeResponses = lens _artacChallengeResponses (\ s a -> s{_artacChallengeResponses = a}) . _Default . _Map;
artacSession :: Lens' AdminRespondToAuthChallenge (Maybe Text)
artacSession = lens _artacSession (\ s a -> s{_artacSession = a});
artacUserPoolId :: Lens' AdminRespondToAuthChallenge Text
artacUserPoolId = lens _artacUserPoolId (\ s a -> s{_artacUserPoolId = a});
artacClientId :: Lens' AdminRespondToAuthChallenge Text
artacClientId = lens _artacClientId (\ s a -> s{_artacClientId = a}) . _Sensitive;
artacChallengeName :: Lens' AdminRespondToAuthChallenge ChallengeNameType
artacChallengeName = lens _artacChallengeName (\ s a -> s{_artacChallengeName = a});
instance AWSRequest AdminRespondToAuthChallenge where
type Rs AdminRespondToAuthChallenge =
AdminRespondToAuthChallengeResponse
request = postJSON cognitoIdentityProvider
response
= receiveJSON
(\ s h x ->
AdminRespondToAuthChallengeResponse' <$>
(x .?> "ChallengeName") <*>
(x .?> "ChallengeParameters" .!@ mempty)
<*> (x .?> "AuthenticationResult")
<*> (x .?> "Session")
<*> (pure (fromEnum s)))
instance Hashable AdminRespondToAuthChallenge
instance NFData AdminRespondToAuthChallenge
instance ToHeaders AdminRespondToAuthChallenge where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AWSCognitoIdentityProviderService.AdminRespondToAuthChallenge"
:: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON AdminRespondToAuthChallenge where
toJSON AdminRespondToAuthChallenge'{..}
= object
(catMaybes
[("ChallengeResponses" .=) <$>
_artacChallengeResponses,
("Session" .=) <$> _artacSession,
Just ("UserPoolId" .= _artacUserPoolId),
Just ("ClientId" .= _artacClientId),
Just ("ChallengeName" .= _artacChallengeName)])
instance ToPath AdminRespondToAuthChallenge where
toPath = const "/"
instance ToQuery AdminRespondToAuthChallenge where
toQuery = const mempty
data AdminRespondToAuthChallengeResponse = AdminRespondToAuthChallengeResponse'
{ _artacrsChallengeName :: !(Maybe ChallengeNameType)
, _artacrsChallengeParameters :: !(Maybe (Map Text Text))
, _artacrsAuthenticationResult :: !(Maybe AuthenticationResultType)
, _artacrsSession :: !(Maybe Text)
, _artacrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
adminRespondToAuthChallengeResponse
:: Int
-> AdminRespondToAuthChallengeResponse
adminRespondToAuthChallengeResponse pResponseStatus_ =
AdminRespondToAuthChallengeResponse'
{ _artacrsChallengeName = Nothing
, _artacrsChallengeParameters = Nothing
, _artacrsAuthenticationResult = Nothing
, _artacrsSession = Nothing
, _artacrsResponseStatus = pResponseStatus_
}
artacrsChallengeName :: Lens' AdminRespondToAuthChallengeResponse (Maybe ChallengeNameType)
artacrsChallengeName = lens _artacrsChallengeName (\ s a -> s{_artacrsChallengeName = a});
artacrsChallengeParameters :: Lens' AdminRespondToAuthChallengeResponse (HashMap Text Text)
artacrsChallengeParameters = lens _artacrsChallengeParameters (\ s a -> s{_artacrsChallengeParameters = a}) . _Default . _Map;
artacrsAuthenticationResult :: Lens' AdminRespondToAuthChallengeResponse (Maybe AuthenticationResultType)
artacrsAuthenticationResult = lens _artacrsAuthenticationResult (\ s a -> s{_artacrsAuthenticationResult = a});
artacrsSession :: Lens' AdminRespondToAuthChallengeResponse (Maybe Text)
artacrsSession = lens _artacrsSession (\ s a -> s{_artacrsSession = a});
artacrsResponseStatus :: Lens' AdminRespondToAuthChallengeResponse Int
artacrsResponseStatus = lens _artacrsResponseStatus (\ s a -> s{_artacrsResponseStatus = a});
instance NFData AdminRespondToAuthChallengeResponse