{-# 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.Route53Domains.ListOperations
(
listOperations
, ListOperations
, loMarker
, loMaxItems
, loSubmittedSince
, 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)
, _loSubmittedSince :: !(Maybe POSIX)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
listOperations
:: ListOperations
listOperations =
ListOperations'
{_loMarker = Nothing, _loMaxItems = Nothing, _loSubmittedSince = 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})
loSubmittedSince :: Lens' ListOperations (Maybe UTCTime)
loSubmittedSince = lens _loSubmittedSince (\ s a -> s{_loSubmittedSince = a}) . mapping _Time
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 where
instance NFData ListOperations where
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,
("SubmittedSince" .=) <$> _loSubmittedSince])
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
instance NFData ListOperationsResponse where