{-# 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.DeviceFarm.ListDevicePools
(
listDevicePools
, ListDevicePools
, ldpNextToken
, ldpType
, ldpArn
, listDevicePoolsResponse
, ListDevicePoolsResponse
, ldprsDevicePools
, ldprsNextToken
, ldprsResponseStatus
) where
import Network.AWS.DeviceFarm.Types
import Network.AWS.DeviceFarm.Types.Product
import Network.AWS.Lens
import Network.AWS.Pager
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data ListDevicePools = ListDevicePools'
{ _ldpNextToken :: !(Maybe Text)
, _ldpType :: !(Maybe DevicePoolType)
, _ldpArn :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
listDevicePools
:: Text
-> ListDevicePools
listDevicePools pArn_ =
ListDevicePools'
{_ldpNextToken = Nothing, _ldpType = Nothing, _ldpArn = pArn_}
ldpNextToken :: Lens' ListDevicePools (Maybe Text)
ldpNextToken = lens _ldpNextToken (\ s a -> s{_ldpNextToken = a})
ldpType :: Lens' ListDevicePools (Maybe DevicePoolType)
ldpType = lens _ldpType (\ s a -> s{_ldpType = a})
ldpArn :: Lens' ListDevicePools Text
ldpArn = lens _ldpArn (\ s a -> s{_ldpArn = a})
instance AWSPager ListDevicePools where
page rq rs
| stop (rs ^. ldprsNextToken) = Nothing
| stop (rs ^. ldprsDevicePools) = Nothing
| otherwise =
Just $ rq & ldpNextToken .~ rs ^. ldprsNextToken
instance AWSRequest ListDevicePools where
type Rs ListDevicePools = ListDevicePoolsResponse
request = postJSON deviceFarm
response
= receiveJSON
(\ s h x ->
ListDevicePoolsResponse' <$>
(x .?> "devicePools" .!@ mempty) <*>
(x .?> "nextToken")
<*> (pure (fromEnum s)))
instance Hashable ListDevicePools where
instance NFData ListDevicePools where
instance ToHeaders ListDevicePools where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("DeviceFarm_20150623.ListDevicePools" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON ListDevicePools where
toJSON ListDevicePools'{..}
= object
(catMaybes
[("nextToken" .=) <$> _ldpNextToken,
("type" .=) <$> _ldpType, Just ("arn" .= _ldpArn)])
instance ToPath ListDevicePools where
toPath = const "/"
instance ToQuery ListDevicePools where
toQuery = const mempty
data ListDevicePoolsResponse = ListDevicePoolsResponse'
{ _ldprsDevicePools :: !(Maybe [DevicePool])
, _ldprsNextToken :: !(Maybe Text)
, _ldprsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
listDevicePoolsResponse
:: Int
-> ListDevicePoolsResponse
listDevicePoolsResponse pResponseStatus_ =
ListDevicePoolsResponse'
{ _ldprsDevicePools = Nothing
, _ldprsNextToken = Nothing
, _ldprsResponseStatus = pResponseStatus_
}
ldprsDevicePools :: Lens' ListDevicePoolsResponse [DevicePool]
ldprsDevicePools = lens _ldprsDevicePools (\ s a -> s{_ldprsDevicePools = a}) . _Default . _Coerce
ldprsNextToken :: Lens' ListDevicePoolsResponse (Maybe Text)
ldprsNextToken = lens _ldprsNextToken (\ s a -> s{_ldprsNextToken = a})
ldprsResponseStatus :: Lens' ListDevicePoolsResponse Int
ldprsResponseStatus = lens _ldprsResponseStatus (\ s a -> s{_ldprsResponseStatus = a})
instance NFData ListDevicePoolsResponse where