{-# 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.ListSamples
(
listSamples
, ListSamples
, lsNextToken
, lsArn
, listSamplesResponse
, ListSamplesResponse
, lrsNextToken
, lrsSamples
, lrsResponseStatus
) 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 ListSamples = ListSamples'
{ _lsNextToken :: !(Maybe Text)
, _lsArn :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
listSamples
:: Text
-> ListSamples
listSamples pArn_ =
ListSamples'
{ _lsNextToken = Nothing
, _lsArn = pArn_
}
lsNextToken :: Lens' ListSamples (Maybe Text)
lsNextToken = lens _lsNextToken (\ s a -> s{_lsNextToken = a});
lsArn :: Lens' ListSamples Text
lsArn = lens _lsArn (\ s a -> s{_lsArn = a});
instance AWSPager ListSamples where
page rq rs
| stop (rs ^. lrsNextToken) = Nothing
| stop (rs ^. lrsSamples) = Nothing
| otherwise =
Just $ rq & lsNextToken .~ rs ^. lrsNextToken
instance AWSRequest ListSamples where
type Rs ListSamples = ListSamplesResponse
request = postJSON deviceFarm
response
= receiveJSON
(\ s h x ->
ListSamplesResponse' <$>
(x .?> "nextToken") <*> (x .?> "samples" .!@ mempty)
<*> (pure (fromEnum s)))
instance Hashable ListSamples
instance NFData ListSamples
instance ToHeaders ListSamples where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("DeviceFarm_20150623.ListSamples" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON ListSamples where
toJSON ListSamples'{..}
= object
(catMaybes
[("nextToken" .=) <$> _lsNextToken,
Just ("arn" .= _lsArn)])
instance ToPath ListSamples where
toPath = const "/"
instance ToQuery ListSamples where
toQuery = const mempty
data ListSamplesResponse = ListSamplesResponse'
{ _lrsNextToken :: !(Maybe Text)
, _lrsSamples :: !(Maybe [Sample])
, _lrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
listSamplesResponse
:: Int
-> ListSamplesResponse
listSamplesResponse pResponseStatus_ =
ListSamplesResponse'
{ _lrsNextToken = Nothing
, _lrsSamples = Nothing
, _lrsResponseStatus = pResponseStatus_
}
lrsNextToken :: Lens' ListSamplesResponse (Maybe Text)
lrsNextToken = lens _lrsNextToken (\ s a -> s{_lrsNextToken = a});
lrsSamples :: Lens' ListSamplesResponse [Sample]
lrsSamples = lens _lrsSamples (\ s a -> s{_lrsSamples = a}) . _Default . _Coerce;
lrsResponseStatus :: Lens' ListSamplesResponse Int
lrsResponseStatus = lens _lrsResponseStatus (\ s a -> s{_lrsResponseStatus = a});
instance NFData ListSamplesResponse