{-# 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.ListDeviceInstances
(
listDeviceInstances
, ListDeviceInstances
, ldiNextToken
, ldiMaxResults
, listDeviceInstancesResponse
, ListDeviceInstancesResponse
, ldirsNextToken
, ldirsDeviceInstances
, ldirsResponseStatus
) where
import Network.AWS.DeviceFarm.Types
import Network.AWS.DeviceFarm.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data ListDeviceInstances = ListDeviceInstances'
{ _ldiNextToken :: !(Maybe Text)
, _ldiMaxResults :: !(Maybe Int)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
listDeviceInstances
:: ListDeviceInstances
listDeviceInstances =
ListDeviceInstances' {_ldiNextToken = Nothing, _ldiMaxResults = Nothing}
ldiNextToken :: Lens' ListDeviceInstances (Maybe Text)
ldiNextToken = lens _ldiNextToken (\ s a -> s{_ldiNextToken = a})
ldiMaxResults :: Lens' ListDeviceInstances (Maybe Int)
ldiMaxResults = lens _ldiMaxResults (\ s a -> s{_ldiMaxResults = a})
instance AWSRequest ListDeviceInstances where
type Rs ListDeviceInstances =
ListDeviceInstancesResponse
request = postJSON deviceFarm
response
= receiveJSON
(\ s h x ->
ListDeviceInstancesResponse' <$>
(x .?> "nextToken") <*>
(x .?> "deviceInstances" .!@ mempty)
<*> (pure (fromEnum s)))
instance Hashable ListDeviceInstances where
instance NFData ListDeviceInstances where
instance ToHeaders ListDeviceInstances where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("DeviceFarm_20150623.ListDeviceInstances" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON ListDeviceInstances where
toJSON ListDeviceInstances'{..}
= object
(catMaybes
[("nextToken" .=) <$> _ldiNextToken,
("maxResults" .=) <$> _ldiMaxResults])
instance ToPath ListDeviceInstances where
toPath = const "/"
instance ToQuery ListDeviceInstances where
toQuery = const mempty
data ListDeviceInstancesResponse = ListDeviceInstancesResponse'
{ _ldirsNextToken :: !(Maybe Text)
, _ldirsDeviceInstances :: !(Maybe [DeviceInstance])
, _ldirsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
listDeviceInstancesResponse
:: Int
-> ListDeviceInstancesResponse
listDeviceInstancesResponse pResponseStatus_ =
ListDeviceInstancesResponse'
{ _ldirsNextToken = Nothing
, _ldirsDeviceInstances = Nothing
, _ldirsResponseStatus = pResponseStatus_
}
ldirsNextToken :: Lens' ListDeviceInstancesResponse (Maybe Text)
ldirsNextToken = lens _ldirsNextToken (\ s a -> s{_ldirsNextToken = a})
ldirsDeviceInstances :: Lens' ListDeviceInstancesResponse [DeviceInstance]
ldirsDeviceInstances = lens _ldirsDeviceInstances (\ s a -> s{_ldirsDeviceInstances = a}) . _Default . _Coerce
ldirsResponseStatus :: Lens' ListDeviceInstancesResponse Int
ldirsResponseStatus = lens _ldirsResponseStatus (\ s a -> s{_ldirsResponseStatus = a})
instance NFData ListDeviceInstancesResponse where