module Network.AWS.Redshift.DescribeEventSubscriptions
(
describeEventSubscriptions
, DescribeEventSubscriptions
, dessSubscriptionName
, dessMarker
, dessMaxRecords
, describeEventSubscriptionsResponse
, DescribeEventSubscriptionsResponse
, desrsEventSubscriptionsList
, desrsMarker
, desrsResponseStatus
) where
import Network.AWS.Pager
import Network.AWS.Prelude
import Network.AWS.Redshift.Types
import Network.AWS.Redshift.Types.Product
import Network.AWS.Request
import Network.AWS.Response
data DescribeEventSubscriptions = DescribeEventSubscriptions'
{ _dessSubscriptionName :: !(Maybe Text)
, _dessMarker :: !(Maybe Text)
, _dessMaxRecords :: !(Maybe Int)
} deriving (Eq,Read,Show,Data,Typeable,Generic)
describeEventSubscriptions
:: DescribeEventSubscriptions
describeEventSubscriptions =
DescribeEventSubscriptions'
{ _dessSubscriptionName = Nothing
, _dessMarker = Nothing
, _dessMaxRecords = Nothing
}
dessSubscriptionName :: Lens' DescribeEventSubscriptions (Maybe Text)
dessSubscriptionName = lens _dessSubscriptionName (\ s a -> s{_dessSubscriptionName = a});
dessMarker :: Lens' DescribeEventSubscriptions (Maybe Text)
dessMarker = lens _dessMarker (\ s a -> s{_dessMarker = a});
dessMaxRecords :: Lens' DescribeEventSubscriptions (Maybe Int)
dessMaxRecords = lens _dessMaxRecords (\ s a -> s{_dessMaxRecords = a});
instance AWSPager DescribeEventSubscriptions where
page rq rs
| stop (rs ^. desrsMarker) = Nothing
| stop (rs ^. desrsEventSubscriptionsList) = Nothing
| otherwise =
Just $ rq & dessMarker .~ rs ^. desrsMarker
instance AWSRequest DescribeEventSubscriptions where
type Rs DescribeEventSubscriptions =
DescribeEventSubscriptionsResponse
request = postQuery redshift
response
= receiveXMLWrapper
"DescribeEventSubscriptionsResult"
(\ s h x ->
DescribeEventSubscriptionsResponse' <$>
(x .@? "EventSubscriptionsList" .!@ mempty >>=
may (parseXMLList "EventSubscription"))
<*> (x .@? "Marker")
<*> (pure (fromEnum s)))
instance ToHeaders DescribeEventSubscriptions where
toHeaders = const mempty
instance ToPath DescribeEventSubscriptions where
toPath = const "/"
instance ToQuery DescribeEventSubscriptions where
toQuery DescribeEventSubscriptions'{..}
= mconcat
["Action" =:
("DescribeEventSubscriptions" :: ByteString),
"Version" =: ("2012-12-01" :: ByteString),
"SubscriptionName" =: _dessSubscriptionName,
"Marker" =: _dessMarker,
"MaxRecords" =: _dessMaxRecords]
data DescribeEventSubscriptionsResponse = DescribeEventSubscriptionsResponse'
{ _desrsEventSubscriptionsList :: !(Maybe [EventSubscription])
, _desrsMarker :: !(Maybe Text)
, _desrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
describeEventSubscriptionsResponse
:: Int
-> DescribeEventSubscriptionsResponse
describeEventSubscriptionsResponse pResponseStatus_ =
DescribeEventSubscriptionsResponse'
{ _desrsEventSubscriptionsList = Nothing
, _desrsMarker = Nothing
, _desrsResponseStatus = pResponseStatus_
}
desrsEventSubscriptionsList :: Lens' DescribeEventSubscriptionsResponse [EventSubscription]
desrsEventSubscriptionsList = lens _desrsEventSubscriptionsList (\ s a -> s{_desrsEventSubscriptionsList = a}) . _Default . _Coerce;
desrsMarker :: Lens' DescribeEventSubscriptionsResponse (Maybe Text)
desrsMarker = lens _desrsMarker (\ s a -> s{_desrsMarker = a});
desrsResponseStatus :: Lens' DescribeEventSubscriptionsResponse Int
desrsResponseStatus = lens _desrsResponseStatus (\ s a -> s{_desrsResponseStatus = a});