{-# 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.ListDevices
(
listDevices
, ListDevices
, ldPaginationToken
, ldLimit
, ldAccessToken
, listDevicesResponse
, ListDevicesResponse
, ldrsPaginationToken
, ldrsDevices
, ldrsResponseStatus
) 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 ListDevices = ListDevices'
{ _ldPaginationToken :: !(Maybe Text)
, _ldLimit :: !(Maybe Nat)
, _ldAccessToken :: !(Sensitive Text)
} deriving (Eq, Show, Data, Typeable, Generic)
listDevices
:: Text
-> ListDevices
listDevices pAccessToken_ =
ListDevices'
{ _ldPaginationToken = Nothing
, _ldLimit = Nothing
, _ldAccessToken = _Sensitive # pAccessToken_
}
ldPaginationToken :: Lens' ListDevices (Maybe Text)
ldPaginationToken = lens _ldPaginationToken (\ s a -> s{_ldPaginationToken = a})
ldLimit :: Lens' ListDevices (Maybe Natural)
ldLimit = lens _ldLimit (\ s a -> s{_ldLimit = a}) . mapping _Nat
ldAccessToken :: Lens' ListDevices Text
ldAccessToken = lens _ldAccessToken (\ s a -> s{_ldAccessToken = a}) . _Sensitive
instance AWSRequest ListDevices where
type Rs ListDevices = ListDevicesResponse
request = postJSON cognitoIdentityProvider
response
= receiveJSON
(\ s h x ->
ListDevicesResponse' <$>
(x .?> "PaginationToken") <*>
(x .?> "Devices" .!@ mempty)
<*> (pure (fromEnum s)))
instance Hashable ListDevices where
instance NFData ListDevices where
instance ToHeaders ListDevices where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AWSCognitoIdentityProviderService.ListDevices" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON ListDevices where
toJSON ListDevices'{..}
= object
(catMaybes
[("PaginationToken" .=) <$> _ldPaginationToken,
("Limit" .=) <$> _ldLimit,
Just ("AccessToken" .= _ldAccessToken)])
instance ToPath ListDevices where
toPath = const "/"
instance ToQuery ListDevices where
toQuery = const mempty
data ListDevicesResponse = ListDevicesResponse'
{ _ldrsPaginationToken :: !(Maybe Text)
, _ldrsDevices :: !(Maybe [DeviceType])
, _ldrsResponseStatus :: !Int
} deriving (Eq, Show, Data, Typeable, Generic)
listDevicesResponse
:: Int
-> ListDevicesResponse
listDevicesResponse pResponseStatus_ =
ListDevicesResponse'
{ _ldrsPaginationToken = Nothing
, _ldrsDevices = Nothing
, _ldrsResponseStatus = pResponseStatus_
}
ldrsPaginationToken :: Lens' ListDevicesResponse (Maybe Text)
ldrsPaginationToken = lens _ldrsPaginationToken (\ s a -> s{_ldrsPaginationToken = a})
ldrsDevices :: Lens' ListDevicesResponse [DeviceType]
ldrsDevices = lens _ldrsDevices (\ s a -> s{_ldrsDevices = a}) . _Default . _Coerce
ldrsResponseStatus :: Lens' ListDevicesResponse Int
ldrsResponseStatus = lens _ldrsResponseStatus (\ s a -> s{_ldrsResponseStatus = a})
instance NFData ListDevicesResponse where