{-# 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.AdminGetDevice
(
adminGetDevice
, AdminGetDevice
, agdDeviceKey
, agdUserPoolId
, agdUsername
, adminGetDeviceResponse
, AdminGetDeviceResponse
, agdrsResponseStatus
, agdrsDevice
) 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 AdminGetDevice = AdminGetDevice'
{ _agdDeviceKey :: !Text
, _agdUserPoolId :: !Text
, _agdUsername :: !(Sensitive Text)
} deriving (Eq, Show, Data, Typeable, Generic)
adminGetDevice
:: Text
-> Text
-> Text
-> AdminGetDevice
adminGetDevice pDeviceKey_ pUserPoolId_ pUsername_ =
AdminGetDevice'
{ _agdDeviceKey = pDeviceKey_
, _agdUserPoolId = pUserPoolId_
, _agdUsername = _Sensitive # pUsername_
}
agdDeviceKey :: Lens' AdminGetDevice Text
agdDeviceKey = lens _agdDeviceKey (\ s a -> s{_agdDeviceKey = a})
agdUserPoolId :: Lens' AdminGetDevice Text
agdUserPoolId = lens _agdUserPoolId (\ s a -> s{_agdUserPoolId = a})
agdUsername :: Lens' AdminGetDevice Text
agdUsername = lens _agdUsername (\ s a -> s{_agdUsername = a}) . _Sensitive
instance AWSRequest AdminGetDevice where
type Rs AdminGetDevice = AdminGetDeviceResponse
request = postJSON cognitoIdentityProvider
response
= receiveJSON
(\ s h x ->
AdminGetDeviceResponse' <$>
(pure (fromEnum s)) <*> (x .:> "Device"))
instance Hashable AdminGetDevice where
instance NFData AdminGetDevice where
instance ToHeaders AdminGetDevice where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AWSCognitoIdentityProviderService.AdminGetDevice"
:: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON AdminGetDevice where
toJSON AdminGetDevice'{..}
= object
(catMaybes
[Just ("DeviceKey" .= _agdDeviceKey),
Just ("UserPoolId" .= _agdUserPoolId),
Just ("Username" .= _agdUsername)])
instance ToPath AdminGetDevice where
toPath = const "/"
instance ToQuery AdminGetDevice where
toQuery = const mempty
data AdminGetDeviceResponse = AdminGetDeviceResponse'
{ _agdrsResponseStatus :: !Int
, _agdrsDevice :: !DeviceType
} deriving (Eq, Show, Data, Typeable, Generic)
adminGetDeviceResponse
:: Int
-> DeviceType
-> AdminGetDeviceResponse
adminGetDeviceResponse pResponseStatus_ pDevice_ =
AdminGetDeviceResponse'
{_agdrsResponseStatus = pResponseStatus_, _agdrsDevice = pDevice_}
agdrsResponseStatus :: Lens' AdminGetDeviceResponse Int
agdrsResponseStatus = lens _agdrsResponseStatus (\ s a -> s{_agdrsResponseStatus = a})
agdrsDevice :: Lens' AdminGetDeviceResponse DeviceType
agdrsDevice = lens _agdrsDevice (\ s a -> s{_agdrsDevice = a})
instance NFData AdminGetDeviceResponse where