{-# 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.ListTests
(
listTests
, ListTests
, ltNextToken
, ltArn
, listTestsResponse
, ListTestsResponse
, ltrsTests
, ltrsNextToken
, ltrsResponseStatus
) 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 ListTests = ListTests'
{ _ltNextToken :: !(Maybe Text)
, _ltArn :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
listTests
:: Text
-> ListTests
listTests pArn_ = ListTests' {_ltNextToken = Nothing, _ltArn = pArn_}
ltNextToken :: Lens' ListTests (Maybe Text)
ltNextToken = lens _ltNextToken (\ s a -> s{_ltNextToken = a})
ltArn :: Lens' ListTests Text
ltArn = lens _ltArn (\ s a -> s{_ltArn = a})
instance AWSPager ListTests where
page rq rs
| stop (rs ^. ltrsNextToken) = Nothing
| stop (rs ^. ltrsTests) = Nothing
| otherwise =
Just $ rq & ltNextToken .~ rs ^. ltrsNextToken
instance AWSRequest ListTests where
type Rs ListTests = ListTestsResponse
request = postJSON deviceFarm
response
= receiveJSON
(\ s h x ->
ListTestsResponse' <$>
(x .?> "tests" .!@ mempty) <*> (x .?> "nextToken")
<*> (pure (fromEnum s)))
instance Hashable ListTests where
instance NFData ListTests where
instance ToHeaders ListTests where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("DeviceFarm_20150623.ListTests" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON ListTests where
toJSON ListTests'{..}
= object
(catMaybes
[("nextToken" .=) <$> _ltNextToken,
Just ("arn" .= _ltArn)])
instance ToPath ListTests where
toPath = const "/"
instance ToQuery ListTests where
toQuery = const mempty
data ListTestsResponse = ListTestsResponse'
{ _ltrsTests :: !(Maybe [Test])
, _ltrsNextToken :: !(Maybe Text)
, _ltrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
listTestsResponse
:: Int
-> ListTestsResponse
listTestsResponse pResponseStatus_ =
ListTestsResponse'
{ _ltrsTests = Nothing
, _ltrsNextToken = Nothing
, _ltrsResponseStatus = pResponseStatus_
}
ltrsTests :: Lens' ListTestsResponse [Test]
ltrsTests = lens _ltrsTests (\ s a -> s{_ltrsTests = a}) . _Default . _Coerce
ltrsNextToken :: Lens' ListTestsResponse (Maybe Text)
ltrsNextToken = lens _ltrsNextToken (\ s a -> s{_ltrsNextToken = a})
ltrsResponseStatus :: Lens' ListTestsResponse Int
ltrsResponseStatus = lens _ltrsResponseStatus (\ s a -> s{_ltrsResponseStatus = a})
instance NFData ListTestsResponse where