module Network.AWS.CloudWatchLogs.DescribeDestinations
(
describeDestinations
, DescribeDestinations
, ddNextToken
, ddLimit
, ddDestinationNamePrefix
, describeDestinationsResponse
, DescribeDestinationsResponse
, ddrsNextToken
, ddrsDestinations
, ddrsStatus
) where
import Network.AWS.CloudWatchLogs.Types
import Network.AWS.CloudWatchLogs.Types.Product
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data DescribeDestinations = DescribeDestinations'
{ _ddNextToken :: !(Maybe Text)
, _ddLimit :: !(Maybe Nat)
, _ddDestinationNamePrefix :: !(Maybe Text)
} deriving (Eq,Read,Show,Data,Typeable,Generic)
describeDestinations
:: DescribeDestinations
describeDestinations =
DescribeDestinations'
{ _ddNextToken = Nothing
, _ddLimit = Nothing
, _ddDestinationNamePrefix = Nothing
}
ddNextToken :: Lens' DescribeDestinations (Maybe Text)
ddNextToken = lens _ddNextToken (\ s a -> s{_ddNextToken = a});
ddLimit :: Lens' DescribeDestinations (Maybe Natural)
ddLimit = lens _ddLimit (\ s a -> s{_ddLimit = a}) . mapping _Nat;
ddDestinationNamePrefix :: Lens' DescribeDestinations (Maybe Text)
ddDestinationNamePrefix = lens _ddDestinationNamePrefix (\ s a -> s{_ddDestinationNamePrefix = a});
instance AWSRequest DescribeDestinations where
type Sv DescribeDestinations = CloudWatchLogs
type Rs DescribeDestinations =
DescribeDestinationsResponse
request = postJSON
response
= receiveJSON
(\ s h x ->
DescribeDestinationsResponse' <$>
(x .?> "nextToken") <*>
(x .?> "destinations" .!@ mempty)
<*> (pure (fromEnum s)))
instance ToHeaders DescribeDestinations where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("Logs_20140328.DescribeDestinations" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON DescribeDestinations where
toJSON DescribeDestinations'{..}
= object
["nextToken" .= _ddNextToken, "limit" .= _ddLimit,
"DestinationNamePrefix" .= _ddDestinationNamePrefix]
instance ToPath DescribeDestinations where
toPath = const "/"
instance ToQuery DescribeDestinations where
toQuery = const mempty
data DescribeDestinationsResponse = DescribeDestinationsResponse'
{ _ddrsNextToken :: !(Maybe Text)
, _ddrsDestinations :: !(Maybe [Destination])
, _ddrsStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
describeDestinationsResponse
:: Int
-> DescribeDestinationsResponse
describeDestinationsResponse pStatus_ =
DescribeDestinationsResponse'
{ _ddrsNextToken = Nothing
, _ddrsDestinations = Nothing
, _ddrsStatus = pStatus_
}
ddrsNextToken :: Lens' DescribeDestinationsResponse (Maybe Text)
ddrsNextToken = lens _ddrsNextToken (\ s a -> s{_ddrsNextToken = a});
ddrsDestinations :: Lens' DescribeDestinationsResponse [Destination]
ddrsDestinations = lens _ddrsDestinations (\ s a -> s{_ddrsDestinations = a}) . _Default . _Coerce;
ddrsStatus :: Lens' DescribeDestinationsResponse Int
ddrsStatus = lens _ddrsStatus (\ s a -> s{_ddrsStatus = a});