{-# 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.AssociateSoftwareToken
(
associateSoftwareToken
, AssociateSoftwareToken
, astAccessToken
, astSession
, associateSoftwareTokenResponse
, AssociateSoftwareTokenResponse
, astrsSecretCode
, astrsSession
, astrsResponseStatus
) 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 AssociateSoftwareToken = AssociateSoftwareToken'
{ _astAccessToken :: !(Maybe (Sensitive Text))
, _astSession :: !(Maybe Text)
} deriving (Eq, Show, Data, Typeable, Generic)
associateSoftwareToken
:: AssociateSoftwareToken
associateSoftwareToken =
AssociateSoftwareToken' {_astAccessToken = Nothing, _astSession = Nothing}
astAccessToken :: Lens' AssociateSoftwareToken (Maybe Text)
astAccessToken = lens _astAccessToken (\ s a -> s{_astAccessToken = a}) . mapping _Sensitive
astSession :: Lens' AssociateSoftwareToken (Maybe Text)
astSession = lens _astSession (\ s a -> s{_astSession = a})
instance AWSRequest AssociateSoftwareToken where
type Rs AssociateSoftwareToken =
AssociateSoftwareTokenResponse
request = postJSON cognitoIdentityProvider
response
= receiveJSON
(\ s h x ->
AssociateSoftwareTokenResponse' <$>
(x .?> "SecretCode") <*> (x .?> "Session") <*>
(pure (fromEnum s)))
instance Hashable AssociateSoftwareToken where
instance NFData AssociateSoftwareToken where
instance ToHeaders AssociateSoftwareToken where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AWSCognitoIdentityProviderService.AssociateSoftwareToken"
:: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON AssociateSoftwareToken where
toJSON AssociateSoftwareToken'{..}
= object
(catMaybes
[("AccessToken" .=) <$> _astAccessToken,
("Session" .=) <$> _astSession])
instance ToPath AssociateSoftwareToken where
toPath = const "/"
instance ToQuery AssociateSoftwareToken where
toQuery = const mempty
data AssociateSoftwareTokenResponse = AssociateSoftwareTokenResponse'
{ _astrsSecretCode :: !(Maybe (Sensitive Text))
, _astrsSession :: !(Maybe Text)
, _astrsResponseStatus :: !Int
} deriving (Eq, Show, Data, Typeable, Generic)
associateSoftwareTokenResponse
:: Int
-> AssociateSoftwareTokenResponse
associateSoftwareTokenResponse pResponseStatus_ =
AssociateSoftwareTokenResponse'
{ _astrsSecretCode = Nothing
, _astrsSession = Nothing
, _astrsResponseStatus = pResponseStatus_
}
astrsSecretCode :: Lens' AssociateSoftwareTokenResponse (Maybe Text)
astrsSecretCode = lens _astrsSecretCode (\ s a -> s{_astrsSecretCode = a}) . mapping _Sensitive
astrsSession :: Lens' AssociateSoftwareTokenResponse (Maybe Text)
astrsSession = lens _astrsSession (\ s a -> s{_astrsSession = a})
astrsResponseStatus :: Lens' AssociateSoftwareTokenResponse Int
astrsResponseStatus = lens _astrsResponseStatus (\ s a -> s{_astrsResponseStatus = a})
instance NFData AssociateSoftwareTokenResponse where