module Network.AWS.Redshift.DescribeEventSubscriptions
(
describeEventSubscriptions
, DescribeEventSubscriptions
, dSubscriptionName
, dMaxRecords
, dMarker
, describeEventSubscriptionsResponse
, DescribeEventSubscriptionsResponse
, desrsEventSubscriptionsList
, desrsMarker
, desrsStatus
) 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'
{ _dSubscriptionName :: !(Maybe Text)
, _dMaxRecords :: !(Maybe Int)
, _dMarker :: !(Maybe Text)
} deriving (Eq,Read,Show,Data,Typeable,Generic)
describeEventSubscriptions
:: DescribeEventSubscriptions
describeEventSubscriptions =
DescribeEventSubscriptions'
{ _dSubscriptionName = Nothing
, _dMaxRecords = Nothing
, _dMarker = Nothing
}
dSubscriptionName :: Lens' DescribeEventSubscriptions (Maybe Text)
dSubscriptionName = lens _dSubscriptionName (\ s a -> s{_dSubscriptionName = a});
dMaxRecords :: Lens' DescribeEventSubscriptions (Maybe Int)
dMaxRecords = lens _dMaxRecords (\ s a -> s{_dMaxRecords = a});
dMarker :: Lens' DescribeEventSubscriptions (Maybe Text)
dMarker = lens _dMarker (\ s a -> s{_dMarker = a});
instance AWSPager DescribeEventSubscriptions where
page rq rs
| stop (rs ^. desrsMarker) = Nothing
| stop (rs ^. desrsEventSubscriptionsList) = Nothing
| otherwise =
Just $ rq & dMarker .~ 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" =: _dSubscriptionName,
"MaxRecords" =: _dMaxRecords, "Marker" =: _dMarker]
data DescribeEventSubscriptionsResponse = DescribeEventSubscriptionsResponse'
{ _desrsEventSubscriptionsList :: !(Maybe [EventSubscription])
, _desrsMarker :: !(Maybe Text)
, _desrsStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
describeEventSubscriptionsResponse
:: Int
-> DescribeEventSubscriptionsResponse
describeEventSubscriptionsResponse pStatus_ =
DescribeEventSubscriptionsResponse'
{ _desrsEventSubscriptionsList = Nothing
, _desrsMarker = Nothing
, _desrsStatus = pStatus_
}
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});
desrsStatus :: Lens' DescribeEventSubscriptionsResponse Int
desrsStatus = lens _desrsStatus (\ s a -> s{_desrsStatus = a});