{-# 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.CloudWatchLogs.PutDestination
(
putDestination
, PutDestination
, pdDestinationName
, pdTargetARN
, pdRoleARN
, putDestinationResponse
, PutDestinationResponse
, pdrsDestination
, pdrsResponseStatus
) where
import Network.AWS.CloudWatchLogs.Types
import Network.AWS.CloudWatchLogs.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data PutDestination = PutDestination'
{ _pdDestinationName :: !Text
, _pdTargetARN :: !Text
, _pdRoleARN :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
putDestination
:: Text
-> Text
-> Text
-> PutDestination
putDestination pDestinationName_ pTargetARN_ pRoleARN_ =
PutDestination'
{ _pdDestinationName = pDestinationName_
, _pdTargetARN = pTargetARN_
, _pdRoleARN = pRoleARN_
}
pdDestinationName :: Lens' PutDestination Text
pdDestinationName = lens _pdDestinationName (\ s a -> s{_pdDestinationName = a})
pdTargetARN :: Lens' PutDestination Text
pdTargetARN = lens _pdTargetARN (\ s a -> s{_pdTargetARN = a})
pdRoleARN :: Lens' PutDestination Text
pdRoleARN = lens _pdRoleARN (\ s a -> s{_pdRoleARN = a})
instance AWSRequest PutDestination where
type Rs PutDestination = PutDestinationResponse
request = postJSON cloudWatchLogs
response
= receiveJSON
(\ s h x ->
PutDestinationResponse' <$>
(x .?> "destination") <*> (pure (fromEnum s)))
instance Hashable PutDestination where
instance NFData PutDestination where
instance ToHeaders PutDestination where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("Logs_20140328.PutDestination" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON PutDestination where
toJSON PutDestination'{..}
= object
(catMaybes
[Just ("destinationName" .= _pdDestinationName),
Just ("targetArn" .= _pdTargetARN),
Just ("roleArn" .= _pdRoleARN)])
instance ToPath PutDestination where
toPath = const "/"
instance ToQuery PutDestination where
toQuery = const mempty
data PutDestinationResponse = PutDestinationResponse'
{ _pdrsDestination :: !(Maybe Destination)
, _pdrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
putDestinationResponse
:: Int
-> PutDestinationResponse
putDestinationResponse pResponseStatus_ =
PutDestinationResponse'
{_pdrsDestination = Nothing, _pdrsResponseStatus = pResponseStatus_}
pdrsDestination :: Lens' PutDestinationResponse (Maybe Destination)
pdrsDestination = lens _pdrsDestination (\ s a -> s{_pdrsDestination = a})
pdrsResponseStatus :: Lens' PutDestinationResponse Int
pdrsResponseStatus = lens _pdrsResponseStatus (\ s a -> s{_pdrsResponseStatus = a})
instance NFData PutDestinationResponse where