{-# 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.ResendConfirmationCode
(
resendConfirmationCode
, ResendConfirmationCode
, rccAnalyticsMetadata
, rccUserContextData
, rccSecretHash
, rccClientId
, rccUsername
, resendConfirmationCodeResponse
, ResendConfirmationCodeResponse
, rccrsCodeDeliveryDetails
, rccrsResponseStatus
) 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 ResendConfirmationCode = ResendConfirmationCode'
{ _rccAnalyticsMetadata :: !(Maybe AnalyticsMetadataType)
, _rccUserContextData :: !(Maybe UserContextDataType)
, _rccSecretHash :: !(Maybe (Sensitive Text))
, _rccClientId :: !(Sensitive Text)
, _rccUsername :: !(Sensitive Text)
} deriving (Eq, Show, Data, Typeable, Generic)
resendConfirmationCode
:: Text
-> Text
-> ResendConfirmationCode
resendConfirmationCode pClientId_ pUsername_ =
ResendConfirmationCode'
{ _rccAnalyticsMetadata = Nothing
, _rccUserContextData = Nothing
, _rccSecretHash = Nothing
, _rccClientId = _Sensitive # pClientId_
, _rccUsername = _Sensitive # pUsername_
}
rccAnalyticsMetadata :: Lens' ResendConfirmationCode (Maybe AnalyticsMetadataType)
rccAnalyticsMetadata = lens _rccAnalyticsMetadata (\ s a -> s{_rccAnalyticsMetadata = a})
rccUserContextData :: Lens' ResendConfirmationCode (Maybe UserContextDataType)
rccUserContextData = lens _rccUserContextData (\ s a -> s{_rccUserContextData = a})
rccSecretHash :: Lens' ResendConfirmationCode (Maybe Text)
rccSecretHash = lens _rccSecretHash (\ s a -> s{_rccSecretHash = a}) . mapping _Sensitive
rccClientId :: Lens' ResendConfirmationCode Text
rccClientId = lens _rccClientId (\ s a -> s{_rccClientId = a}) . _Sensitive
rccUsername :: Lens' ResendConfirmationCode Text
rccUsername = lens _rccUsername (\ s a -> s{_rccUsername = a}) . _Sensitive
instance AWSRequest ResendConfirmationCode where
type Rs ResendConfirmationCode =
ResendConfirmationCodeResponse
request = postJSON cognitoIdentityProvider
response
= receiveJSON
(\ s h x ->
ResendConfirmationCodeResponse' <$>
(x .?> "CodeDeliveryDetails") <*>
(pure (fromEnum s)))
instance Hashable ResendConfirmationCode where
instance NFData ResendConfirmationCode where
instance ToHeaders ResendConfirmationCode where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AWSCognitoIdentityProviderService.ResendConfirmationCode"
:: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON ResendConfirmationCode where
toJSON ResendConfirmationCode'{..}
= object
(catMaybes
[("AnalyticsMetadata" .=) <$> _rccAnalyticsMetadata,
("UserContextData" .=) <$> _rccUserContextData,
("SecretHash" .=) <$> _rccSecretHash,
Just ("ClientId" .= _rccClientId),
Just ("Username" .= _rccUsername)])
instance ToPath ResendConfirmationCode where
toPath = const "/"
instance ToQuery ResendConfirmationCode where
toQuery = const mempty
data ResendConfirmationCodeResponse = ResendConfirmationCodeResponse'
{ _rccrsCodeDeliveryDetails :: !(Maybe CodeDeliveryDetailsType)
, _rccrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
resendConfirmationCodeResponse
:: Int
-> ResendConfirmationCodeResponse
resendConfirmationCodeResponse pResponseStatus_ =
ResendConfirmationCodeResponse'
{ _rccrsCodeDeliveryDetails = Nothing
, _rccrsResponseStatus = pResponseStatus_
}
rccrsCodeDeliveryDetails :: Lens' ResendConfirmationCodeResponse (Maybe CodeDeliveryDetailsType)
rccrsCodeDeliveryDetails = lens _rccrsCodeDeliveryDetails (\ s a -> s{_rccrsCodeDeliveryDetails = a})
rccrsResponseStatus :: Lens' ResendConfirmationCodeResponse Int
rccrsResponseStatus = lens _rccrsResponseStatus (\ s a -> s{_rccrsResponseStatus = a})
instance NFData ResendConfirmationCodeResponse where