module Network.AWS.CloudWatchLogs.PutMetricFilter
(
putMetricFilter
, PutMetricFilter
, pmfLogGroupName
, pmfFilterName
, pmfFilterPattern
, pmfMetricTransformations
, putMetricFilterResponse
, PutMetricFilterResponse
) 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 PutMetricFilter = PutMetricFilter'
{ _pmfLogGroupName :: !Text
, _pmfFilterName :: !Text
, _pmfFilterPattern :: !Text
, _pmfMetricTransformations :: !(List1 MetricTransformation)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
putMetricFilter
:: Text
-> Text
-> Text
-> NonEmpty MetricTransformation
-> PutMetricFilter
putMetricFilter pLogGroupName_ pFilterName_ pFilterPattern_ pMetricTransformations_ =
PutMetricFilter'
{ _pmfLogGroupName = pLogGroupName_
, _pmfFilterName = pFilterName_
, _pmfFilterPattern = pFilterPattern_
, _pmfMetricTransformations = _List1 # pMetricTransformations_
}
pmfLogGroupName :: Lens' PutMetricFilter Text
pmfLogGroupName = lens _pmfLogGroupName (\ s a -> s{_pmfLogGroupName = a});
pmfFilterName :: Lens' PutMetricFilter Text
pmfFilterName = lens _pmfFilterName (\ s a -> s{_pmfFilterName = a});
pmfFilterPattern :: Lens' PutMetricFilter Text
pmfFilterPattern = lens _pmfFilterPattern (\ s a -> s{_pmfFilterPattern = a});
pmfMetricTransformations :: Lens' PutMetricFilter (NonEmpty MetricTransformation)
pmfMetricTransformations = lens _pmfMetricTransformations (\ s a -> s{_pmfMetricTransformations = a}) . _List1;
instance AWSRequest PutMetricFilter where
type Rs PutMetricFilter = PutMetricFilterResponse
request = postJSON cloudWatchLogs
response = receiveNull PutMetricFilterResponse'
instance Hashable PutMetricFilter where
instance NFData PutMetricFilter where
instance ToHeaders PutMetricFilter where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("Logs_20140328.PutMetricFilter" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON PutMetricFilter where
toJSON PutMetricFilter'{..}
= object
(catMaybes
[Just ("logGroupName" .= _pmfLogGroupName),
Just ("filterName" .= _pmfFilterName),
Just ("filterPattern" .= _pmfFilterPattern),
Just
("metricTransformations" .=
_pmfMetricTransformations)])
instance ToPath PutMetricFilter where
toPath = const "/"
instance ToQuery PutMetricFilter where
toQuery = const mempty
data PutMetricFilterResponse =
PutMetricFilterResponse'
deriving (Eq, Read, Show, Data, Typeable, Generic)
putMetricFilterResponse
:: PutMetricFilterResponse
putMetricFilterResponse = PutMetricFilterResponse'
instance NFData PutMetricFilterResponse where