{-# 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.PutSubscriptionFilter
(
putSubscriptionFilter
, PutSubscriptionFilter
, psfRoleARN
, psfLogGroupName
, psfFilterName
, psfFilterPattern
, psfDestinationARN
, putSubscriptionFilterResponse
, PutSubscriptionFilterResponse
) 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 PutSubscriptionFilter = PutSubscriptionFilter'
{ _psfRoleARN :: !(Maybe Text)
, _psfLogGroupName :: !Text
, _psfFilterName :: !Text
, _psfFilterPattern :: !Text
, _psfDestinationARN :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
putSubscriptionFilter
:: Text
-> Text
-> Text
-> Text
-> PutSubscriptionFilter
putSubscriptionFilter pLogGroupName_ pFilterName_ pFilterPattern_ pDestinationARN_ =
PutSubscriptionFilter'
{ _psfRoleARN = Nothing
, _psfLogGroupName = pLogGroupName_
, _psfFilterName = pFilterName_
, _psfFilterPattern = pFilterPattern_
, _psfDestinationARN = pDestinationARN_
}
psfRoleARN :: Lens' PutSubscriptionFilter (Maybe Text)
psfRoleARN = lens _psfRoleARN (\ s a -> s{_psfRoleARN = a});
psfLogGroupName :: Lens' PutSubscriptionFilter Text
psfLogGroupName = lens _psfLogGroupName (\ s a -> s{_psfLogGroupName = a});
psfFilterName :: Lens' PutSubscriptionFilter Text
psfFilterName = lens _psfFilterName (\ s a -> s{_psfFilterName = a});
psfFilterPattern :: Lens' PutSubscriptionFilter Text
psfFilterPattern = lens _psfFilterPattern (\ s a -> s{_psfFilterPattern = a});
psfDestinationARN :: Lens' PutSubscriptionFilter Text
psfDestinationARN = lens _psfDestinationARN (\ s a -> s{_psfDestinationARN = a});
instance AWSRequest PutSubscriptionFilter where
type Rs PutSubscriptionFilter =
PutSubscriptionFilterResponse
request = postJSON cloudWatchLogs
response = receiveNull PutSubscriptionFilterResponse'
instance Hashable PutSubscriptionFilter
instance NFData PutSubscriptionFilter
instance ToHeaders PutSubscriptionFilter where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("Logs_20140328.PutSubscriptionFilter" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON PutSubscriptionFilter where
toJSON PutSubscriptionFilter'{..}
= object
(catMaybes
[("roleArn" .=) <$> _psfRoleARN,
Just ("logGroupName" .= _psfLogGroupName),
Just ("filterName" .= _psfFilterName),
Just ("filterPattern" .= _psfFilterPattern),
Just ("destinationArn" .= _psfDestinationARN)])
instance ToPath PutSubscriptionFilter where
toPath = const "/"
instance ToQuery PutSubscriptionFilter where
toQuery = const mempty
data PutSubscriptionFilterResponse =
PutSubscriptionFilterResponse'
deriving (Eq,Read,Show,Data,Typeable,Generic)
putSubscriptionFilterResponse
:: PutSubscriptionFilterResponse
putSubscriptionFilterResponse = PutSubscriptionFilterResponse'
instance NFData PutSubscriptionFilterResponse