module Network.AWS.CloudWatchLogs.PutMetricFilter
(
PutMetricFilter
, putMetricFilter
, pmfFilterName
, pmfFilterPattern
, pmfLogGroupName
, pmfMetricTransformations
, PutMetricFilterResponse
, putMetricFilterResponse
) where
import Network.AWS.Prelude
import Network.AWS.Request.JSON
import Network.AWS.CloudWatchLogs.Types
import qualified GHC.Exts
data PutMetricFilter = PutMetricFilter
{ _pmfFilterName :: Text
, _pmfFilterPattern :: Text
, _pmfLogGroupName :: Text
, _pmfMetricTransformations :: List1 "metricTransformations" MetricTransformation
} deriving (Eq, Show)
putMetricFilter :: Text
-> Text
-> Text
-> NonEmpty MetricTransformation
-> PutMetricFilter
putMetricFilter p1 p2 p3 p4 = PutMetricFilter
{ _pmfLogGroupName = p1
, _pmfFilterName = p2
, _pmfFilterPattern = p3
, _pmfMetricTransformations = withIso _List1 (const id) p4
}
pmfFilterName :: Lens' PutMetricFilter Text
pmfFilterName = lens _pmfFilterName (\s a -> s { _pmfFilterName = a })
pmfFilterPattern :: Lens' PutMetricFilter Text
pmfFilterPattern = lens _pmfFilterPattern (\s a -> s { _pmfFilterPattern = a })
pmfLogGroupName :: Lens' PutMetricFilter Text
pmfLogGroupName = lens _pmfLogGroupName (\s a -> s { _pmfLogGroupName = a })
pmfMetricTransformations :: Lens' PutMetricFilter (NonEmpty MetricTransformation)
pmfMetricTransformations =
lens _pmfMetricTransformations
(\s a -> s { _pmfMetricTransformations = a })
. _List1
data PutMetricFilterResponse = PutMetricFilterResponse
deriving (Eq, Ord, Show, Generic)
putMetricFilterResponse :: PutMetricFilterResponse
putMetricFilterResponse = PutMetricFilterResponse
instance ToPath PutMetricFilter where
toPath = const "/"
instance ToQuery PutMetricFilter where
toQuery = const mempty
instance ToHeaders PutMetricFilter
instance ToJSON PutMetricFilter where
toJSON PutMetricFilter{..} = object
[ "logGroupName" .= _pmfLogGroupName
, "filterName" .= _pmfFilterName
, "filterPattern" .= _pmfFilterPattern
, "metricTransformations" .= _pmfMetricTransformations
]
instance AWSRequest PutMetricFilter where
type Sv PutMetricFilter = CloudWatchLogs
type Rs PutMetricFilter = PutMetricFilterResponse
request = post "PutMetricFilter"
response = nullResponse PutMetricFilterResponse