{-# 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.AdminListDevices
(
adminListDevices
, AdminListDevices
, aldPaginationToken
, aldLimit
, aldUserPoolId
, aldUsername
, adminListDevicesResponse
, AdminListDevicesResponse
, aldrsPaginationToken
, aldrsDevices
, aldrsResponseStatus
) 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 AdminListDevices = AdminListDevices'
{ _aldPaginationToken :: !(Maybe Text)
, _aldLimit :: !(Maybe Nat)
, _aldUserPoolId :: !Text
, _aldUsername :: !(Sensitive Text)
} deriving (Eq, Show, Data, Typeable, Generic)
adminListDevices
:: Text
-> Text
-> AdminListDevices
adminListDevices pUserPoolId_ pUsername_ =
AdminListDevices'
{ _aldPaginationToken = Nothing
, _aldLimit = Nothing
, _aldUserPoolId = pUserPoolId_
, _aldUsername = _Sensitive # pUsername_
}
aldPaginationToken :: Lens' AdminListDevices (Maybe Text)
aldPaginationToken = lens _aldPaginationToken (\ s a -> s{_aldPaginationToken = a})
aldLimit :: Lens' AdminListDevices (Maybe Natural)
aldLimit = lens _aldLimit (\ s a -> s{_aldLimit = a}) . mapping _Nat
aldUserPoolId :: Lens' AdminListDevices Text
aldUserPoolId = lens _aldUserPoolId (\ s a -> s{_aldUserPoolId = a})
aldUsername :: Lens' AdminListDevices Text
aldUsername = lens _aldUsername (\ s a -> s{_aldUsername = a}) . _Sensitive
instance AWSRequest AdminListDevices where
type Rs AdminListDevices = AdminListDevicesResponse
request = postJSON cognitoIdentityProvider
response
= receiveJSON
(\ s h x ->
AdminListDevicesResponse' <$>
(x .?> "PaginationToken") <*>
(x .?> "Devices" .!@ mempty)
<*> (pure (fromEnum s)))
instance Hashable AdminListDevices where
instance NFData AdminListDevices where
instance ToHeaders AdminListDevices where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AWSCognitoIdentityProviderService.AdminListDevices"
:: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON AdminListDevices where
toJSON AdminListDevices'{..}
= object
(catMaybes
[("PaginationToken" .=) <$> _aldPaginationToken,
("Limit" .=) <$> _aldLimit,
Just ("UserPoolId" .= _aldUserPoolId),
Just ("Username" .= _aldUsername)])
instance ToPath AdminListDevices where
toPath = const "/"
instance ToQuery AdminListDevices where
toQuery = const mempty
data AdminListDevicesResponse = AdminListDevicesResponse'
{ _aldrsPaginationToken :: !(Maybe Text)
, _aldrsDevices :: !(Maybe [DeviceType])
, _aldrsResponseStatus :: !Int
} deriving (Eq, Show, Data, Typeable, Generic)
adminListDevicesResponse
:: Int
-> AdminListDevicesResponse
adminListDevicesResponse pResponseStatus_ =
AdminListDevicesResponse'
{ _aldrsPaginationToken = Nothing
, _aldrsDevices = Nothing
, _aldrsResponseStatus = pResponseStatus_
}
aldrsPaginationToken :: Lens' AdminListDevicesResponse (Maybe Text)
aldrsPaginationToken = lens _aldrsPaginationToken (\ s a -> s{_aldrsPaginationToken = a})
aldrsDevices :: Lens' AdminListDevicesResponse [DeviceType]
aldrsDevices = lens _aldrsDevices (\ s a -> s{_aldrsDevices = a}) . _Default . _Coerce
aldrsResponseStatus :: Lens' AdminListDevicesResponse Int
aldrsResponseStatus = lens _aldrsResponseStatus (\ s a -> s{_aldrsResponseStatus = a})
instance NFData AdminListDevicesResponse where