module Network.AWS.Route53Domains.ListOperations
(
listOperations
, ListOperations
, loMarker
, loMaxItems
, listOperationsResponse
, ListOperationsResponse
, lorsNextPageMarker
, lorsResponseStatus
, lorsOperations
) where
import Network.AWS.Lens
import Network.AWS.Pager
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
import Network.AWS.Route53Domains.Types
import Network.AWS.Route53Domains.Types.Product
data ListOperations = ListOperations'
{ _loMarker :: !(Maybe Text)
, _loMaxItems :: !(Maybe Int)
} deriving (Eq,Read,Show,Data,Typeable,Generic)
listOperations
:: ListOperations
listOperations =
ListOperations'
{ _loMarker = Nothing
, _loMaxItems = Nothing
}
loMarker :: Lens' ListOperations (Maybe Text)
loMarker = lens _loMarker (\ s a -> s{_loMarker = a});
loMaxItems :: Lens' ListOperations (Maybe Int)
loMaxItems = lens _loMaxItems (\ s a -> s{_loMaxItems = a});
instance AWSPager ListOperations where
page rq rs
| stop (rs ^. lorsNextPageMarker) = Nothing
| stop (rs ^. lorsOperations) = Nothing
| otherwise =
Just $ rq & loMarker .~ rs ^. lorsNextPageMarker
instance AWSRequest ListOperations where
type Rs ListOperations = ListOperationsResponse
request = postJSON route53Domains
response
= receiveJSON
(\ s h x ->
ListOperationsResponse' <$>
(x .?> "NextPageMarker") <*> (pure (fromEnum s)) <*>
(x .?> "Operations" .!@ mempty))
instance Hashable ListOperations
instance ToHeaders ListOperations where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("Route53Domains_v20140515.ListOperations" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON ListOperations where
toJSON ListOperations'{..}
= object
(catMaybes
[("Marker" .=) <$> _loMarker,
("MaxItems" .=) <$> _loMaxItems])
instance ToPath ListOperations where
toPath = const "/"
instance ToQuery ListOperations where
toQuery = const mempty
data ListOperationsResponse = ListOperationsResponse'
{ _lorsNextPageMarker :: !(Maybe Text)
, _lorsResponseStatus :: !Int
, _lorsOperations :: ![OperationSummary]
} deriving (Eq,Read,Show,Data,Typeable,Generic)
listOperationsResponse
:: Int
-> ListOperationsResponse
listOperationsResponse pResponseStatus_ =
ListOperationsResponse'
{ _lorsNextPageMarker = Nothing
, _lorsResponseStatus = pResponseStatus_
, _lorsOperations = mempty
}
lorsNextPageMarker :: Lens' ListOperationsResponse (Maybe Text)
lorsNextPageMarker = lens _lorsNextPageMarker (\ s a -> s{_lorsNextPageMarker = a});
lorsResponseStatus :: Lens' ListOperationsResponse Int
lorsResponseStatus = lens _lorsResponseStatus (\ s a -> s{_lorsResponseStatus = a});
lorsOperations :: Lens' ListOperationsResponse [OperationSummary]
lorsOperations = lens _lorsOperations (\ s a -> s{_lorsOperations = a}) . _Coerce;