{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.CloudWatchLogs.PutSubscriptionFilter
(
PutSubscriptionFilter (..),
newPutSubscriptionFilter,
putSubscriptionFilter_distribution,
putSubscriptionFilter_roleArn,
putSubscriptionFilter_logGroupName,
putSubscriptionFilter_filterName,
putSubscriptionFilter_filterPattern,
putSubscriptionFilter_destinationArn,
PutSubscriptionFilterResponse (..),
newPutSubscriptionFilterResponse,
)
where
import Amazonka.CloudWatchLogs.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data PutSubscriptionFilter = PutSubscriptionFilter'
{
PutSubscriptionFilter -> Maybe Distribution
distribution :: Prelude.Maybe Distribution,
PutSubscriptionFilter -> Maybe Text
roleArn :: Prelude.Maybe Prelude.Text,
PutSubscriptionFilter -> Text
logGroupName :: Prelude.Text,
PutSubscriptionFilter -> Text
filterName :: Prelude.Text,
PutSubscriptionFilter -> Text
filterPattern :: Prelude.Text,
PutSubscriptionFilter -> Text
destinationArn :: Prelude.Text
}
deriving (PutSubscriptionFilter -> PutSubscriptionFilter -> Bool
(PutSubscriptionFilter -> PutSubscriptionFilter -> Bool)
-> (PutSubscriptionFilter -> PutSubscriptionFilter -> Bool)
-> Eq PutSubscriptionFilter
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutSubscriptionFilter -> PutSubscriptionFilter -> Bool
$c/= :: PutSubscriptionFilter -> PutSubscriptionFilter -> Bool
== :: PutSubscriptionFilter -> PutSubscriptionFilter -> Bool
$c== :: PutSubscriptionFilter -> PutSubscriptionFilter -> Bool
Prelude.Eq, ReadPrec [PutSubscriptionFilter]
ReadPrec PutSubscriptionFilter
Int -> ReadS PutSubscriptionFilter
ReadS [PutSubscriptionFilter]
(Int -> ReadS PutSubscriptionFilter)
-> ReadS [PutSubscriptionFilter]
-> ReadPrec PutSubscriptionFilter
-> ReadPrec [PutSubscriptionFilter]
-> Read PutSubscriptionFilter
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutSubscriptionFilter]
$creadListPrec :: ReadPrec [PutSubscriptionFilter]
readPrec :: ReadPrec PutSubscriptionFilter
$creadPrec :: ReadPrec PutSubscriptionFilter
readList :: ReadS [PutSubscriptionFilter]
$creadList :: ReadS [PutSubscriptionFilter]
readsPrec :: Int -> ReadS PutSubscriptionFilter
$creadsPrec :: Int -> ReadS PutSubscriptionFilter
Prelude.Read, Int -> PutSubscriptionFilter -> ShowS
[PutSubscriptionFilter] -> ShowS
PutSubscriptionFilter -> String
(Int -> PutSubscriptionFilter -> ShowS)
-> (PutSubscriptionFilter -> String)
-> ([PutSubscriptionFilter] -> ShowS)
-> Show PutSubscriptionFilter
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutSubscriptionFilter] -> ShowS
$cshowList :: [PutSubscriptionFilter] -> ShowS
show :: PutSubscriptionFilter -> String
$cshow :: PutSubscriptionFilter -> String
showsPrec :: Int -> PutSubscriptionFilter -> ShowS
$cshowsPrec :: Int -> PutSubscriptionFilter -> ShowS
Prelude.Show, (forall x. PutSubscriptionFilter -> Rep PutSubscriptionFilter x)
-> (forall x. Rep PutSubscriptionFilter x -> PutSubscriptionFilter)
-> Generic PutSubscriptionFilter
forall x. Rep PutSubscriptionFilter x -> PutSubscriptionFilter
forall x. PutSubscriptionFilter -> Rep PutSubscriptionFilter x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutSubscriptionFilter x -> PutSubscriptionFilter
$cfrom :: forall x. PutSubscriptionFilter -> Rep PutSubscriptionFilter x
Prelude.Generic)
newPutSubscriptionFilter ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
PutSubscriptionFilter
newPutSubscriptionFilter :: Text -> Text -> Text -> Text -> PutSubscriptionFilter
newPutSubscriptionFilter
Text
pLogGroupName_
Text
pFilterName_
Text
pFilterPattern_
Text
pDestinationArn_ =
PutSubscriptionFilter' :: Maybe Distribution
-> Maybe Text
-> Text
-> Text
-> Text
-> Text
-> PutSubscriptionFilter
PutSubscriptionFilter'
{ $sel:distribution:PutSubscriptionFilter' :: Maybe Distribution
distribution =
Maybe Distribution
forall a. Maybe a
Prelude.Nothing,
$sel:roleArn:PutSubscriptionFilter' :: Maybe Text
roleArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:logGroupName:PutSubscriptionFilter' :: Text
logGroupName = Text
pLogGroupName_,
$sel:filterName:PutSubscriptionFilter' :: Text
filterName = Text
pFilterName_,
$sel:filterPattern:PutSubscriptionFilter' :: Text
filterPattern = Text
pFilterPattern_,
$sel:destinationArn:PutSubscriptionFilter' :: Text
destinationArn = Text
pDestinationArn_
}
putSubscriptionFilter_distribution :: Lens.Lens' PutSubscriptionFilter (Prelude.Maybe Distribution)
putSubscriptionFilter_distribution :: (Maybe Distribution -> f (Maybe Distribution))
-> PutSubscriptionFilter -> f PutSubscriptionFilter
putSubscriptionFilter_distribution = (PutSubscriptionFilter -> Maybe Distribution)
-> (PutSubscriptionFilter
-> Maybe Distribution -> PutSubscriptionFilter)
-> Lens
PutSubscriptionFilter
PutSubscriptionFilter
(Maybe Distribution)
(Maybe Distribution)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutSubscriptionFilter' {Maybe Distribution
distribution :: Maybe Distribution
$sel:distribution:PutSubscriptionFilter' :: PutSubscriptionFilter -> Maybe Distribution
distribution} -> Maybe Distribution
distribution) (\s :: PutSubscriptionFilter
s@PutSubscriptionFilter' {} Maybe Distribution
a -> PutSubscriptionFilter
s {$sel:distribution:PutSubscriptionFilter' :: Maybe Distribution
distribution = Maybe Distribution
a} :: PutSubscriptionFilter)
putSubscriptionFilter_roleArn :: Lens.Lens' PutSubscriptionFilter (Prelude.Maybe Prelude.Text)
putSubscriptionFilter_roleArn :: (Maybe Text -> f (Maybe Text))
-> PutSubscriptionFilter -> f PutSubscriptionFilter
putSubscriptionFilter_roleArn = (PutSubscriptionFilter -> Maybe Text)
-> (PutSubscriptionFilter -> Maybe Text -> PutSubscriptionFilter)
-> Lens
PutSubscriptionFilter
PutSubscriptionFilter
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutSubscriptionFilter' {Maybe Text
roleArn :: Maybe Text
$sel:roleArn:PutSubscriptionFilter' :: PutSubscriptionFilter -> Maybe Text
roleArn} -> Maybe Text
roleArn) (\s :: PutSubscriptionFilter
s@PutSubscriptionFilter' {} Maybe Text
a -> PutSubscriptionFilter
s {$sel:roleArn:PutSubscriptionFilter' :: Maybe Text
roleArn = Maybe Text
a} :: PutSubscriptionFilter)
putSubscriptionFilter_logGroupName :: Lens.Lens' PutSubscriptionFilter Prelude.Text
putSubscriptionFilter_logGroupName :: (Text -> f Text)
-> PutSubscriptionFilter -> f PutSubscriptionFilter
putSubscriptionFilter_logGroupName = (PutSubscriptionFilter -> Text)
-> (PutSubscriptionFilter -> Text -> PutSubscriptionFilter)
-> Lens PutSubscriptionFilter PutSubscriptionFilter Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutSubscriptionFilter' {Text
logGroupName :: Text
$sel:logGroupName:PutSubscriptionFilter' :: PutSubscriptionFilter -> Text
logGroupName} -> Text
logGroupName) (\s :: PutSubscriptionFilter
s@PutSubscriptionFilter' {} Text
a -> PutSubscriptionFilter
s {$sel:logGroupName:PutSubscriptionFilter' :: Text
logGroupName = Text
a} :: PutSubscriptionFilter)
putSubscriptionFilter_filterName :: Lens.Lens' PutSubscriptionFilter Prelude.Text
putSubscriptionFilter_filterName :: (Text -> f Text)
-> PutSubscriptionFilter -> f PutSubscriptionFilter
putSubscriptionFilter_filterName = (PutSubscriptionFilter -> Text)
-> (PutSubscriptionFilter -> Text -> PutSubscriptionFilter)
-> Lens PutSubscriptionFilter PutSubscriptionFilter Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutSubscriptionFilter' {Text
filterName :: Text
$sel:filterName:PutSubscriptionFilter' :: PutSubscriptionFilter -> Text
filterName} -> Text
filterName) (\s :: PutSubscriptionFilter
s@PutSubscriptionFilter' {} Text
a -> PutSubscriptionFilter
s {$sel:filterName:PutSubscriptionFilter' :: Text
filterName = Text
a} :: PutSubscriptionFilter)
putSubscriptionFilter_filterPattern :: Lens.Lens' PutSubscriptionFilter Prelude.Text
putSubscriptionFilter_filterPattern :: (Text -> f Text)
-> PutSubscriptionFilter -> f PutSubscriptionFilter
putSubscriptionFilter_filterPattern = (PutSubscriptionFilter -> Text)
-> (PutSubscriptionFilter -> Text -> PutSubscriptionFilter)
-> Lens PutSubscriptionFilter PutSubscriptionFilter Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutSubscriptionFilter' {Text
filterPattern :: Text
$sel:filterPattern:PutSubscriptionFilter' :: PutSubscriptionFilter -> Text
filterPattern} -> Text
filterPattern) (\s :: PutSubscriptionFilter
s@PutSubscriptionFilter' {} Text
a -> PutSubscriptionFilter
s {$sel:filterPattern:PutSubscriptionFilter' :: Text
filterPattern = Text
a} :: PutSubscriptionFilter)
putSubscriptionFilter_destinationArn :: Lens.Lens' PutSubscriptionFilter Prelude.Text
putSubscriptionFilter_destinationArn :: (Text -> f Text)
-> PutSubscriptionFilter -> f PutSubscriptionFilter
putSubscriptionFilter_destinationArn = (PutSubscriptionFilter -> Text)
-> (PutSubscriptionFilter -> Text -> PutSubscriptionFilter)
-> Lens PutSubscriptionFilter PutSubscriptionFilter Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutSubscriptionFilter' {Text
destinationArn :: Text
$sel:destinationArn:PutSubscriptionFilter' :: PutSubscriptionFilter -> Text
destinationArn} -> Text
destinationArn) (\s :: PutSubscriptionFilter
s@PutSubscriptionFilter' {} Text
a -> PutSubscriptionFilter
s {$sel:destinationArn:PutSubscriptionFilter' :: Text
destinationArn = Text
a} :: PutSubscriptionFilter)
instance Core.AWSRequest PutSubscriptionFilter where
type
AWSResponse PutSubscriptionFilter =
PutSubscriptionFilterResponse
request :: PutSubscriptionFilter -> Request PutSubscriptionFilter
request = Service -> PutSubscriptionFilter -> Request PutSubscriptionFilter
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy PutSubscriptionFilter
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutSubscriptionFilter)))
response =
AWSResponse PutSubscriptionFilter
-> Logger
-> Service
-> Proxy PutSubscriptionFilter
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutSubscriptionFilter)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse PutSubscriptionFilter
PutSubscriptionFilterResponse
PutSubscriptionFilterResponse'
instance Prelude.Hashable PutSubscriptionFilter
instance Prelude.NFData PutSubscriptionFilter
instance Core.ToHeaders PutSubscriptionFilter where
toHeaders :: PutSubscriptionFilter -> [Header]
toHeaders =
[Header] -> PutSubscriptionFilter -> [Header]
forall a b. a -> b -> a
Prelude.const
( [[Header]] -> [Header]
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"Logs_20140328.PutSubscriptionFilter" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON PutSubscriptionFilter where
toJSON :: PutSubscriptionFilter -> Value
toJSON PutSubscriptionFilter' {Maybe Text
Maybe Distribution
Text
destinationArn :: Text
filterPattern :: Text
filterName :: Text
logGroupName :: Text
roleArn :: Maybe Text
distribution :: Maybe Distribution
$sel:destinationArn:PutSubscriptionFilter' :: PutSubscriptionFilter -> Text
$sel:filterPattern:PutSubscriptionFilter' :: PutSubscriptionFilter -> Text
$sel:filterName:PutSubscriptionFilter' :: PutSubscriptionFilter -> Text
$sel:logGroupName:PutSubscriptionFilter' :: PutSubscriptionFilter -> Text
$sel:roleArn:PutSubscriptionFilter' :: PutSubscriptionFilter -> Maybe Text
$sel:distribution:PutSubscriptionFilter' :: PutSubscriptionFilter -> Maybe Distribution
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"distribution" Text -> Distribution -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Distribution -> Pair) -> Maybe Distribution -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Distribution
distribution,
(Text
"roleArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
roleArn,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"logGroupName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
logGroupName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"filterName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
filterName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"filterPattern" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
filterPattern),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"destinationArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
destinationArn)
]
)
instance Core.ToPath PutSubscriptionFilter where
toPath :: PutSubscriptionFilter -> ByteString
toPath = ByteString -> PutSubscriptionFilter -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery PutSubscriptionFilter where
toQuery :: PutSubscriptionFilter -> QueryString
toQuery = QueryString -> PutSubscriptionFilter -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data PutSubscriptionFilterResponse = PutSubscriptionFilterResponse'
{
}
deriving (PutSubscriptionFilterResponse
-> PutSubscriptionFilterResponse -> Bool
(PutSubscriptionFilterResponse
-> PutSubscriptionFilterResponse -> Bool)
-> (PutSubscriptionFilterResponse
-> PutSubscriptionFilterResponse -> Bool)
-> Eq PutSubscriptionFilterResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutSubscriptionFilterResponse
-> PutSubscriptionFilterResponse -> Bool
$c/= :: PutSubscriptionFilterResponse
-> PutSubscriptionFilterResponse -> Bool
== :: PutSubscriptionFilterResponse
-> PutSubscriptionFilterResponse -> Bool
$c== :: PutSubscriptionFilterResponse
-> PutSubscriptionFilterResponse -> Bool
Prelude.Eq, ReadPrec [PutSubscriptionFilterResponse]
ReadPrec PutSubscriptionFilterResponse
Int -> ReadS PutSubscriptionFilterResponse
ReadS [PutSubscriptionFilterResponse]
(Int -> ReadS PutSubscriptionFilterResponse)
-> ReadS [PutSubscriptionFilterResponse]
-> ReadPrec PutSubscriptionFilterResponse
-> ReadPrec [PutSubscriptionFilterResponse]
-> Read PutSubscriptionFilterResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutSubscriptionFilterResponse]
$creadListPrec :: ReadPrec [PutSubscriptionFilterResponse]
readPrec :: ReadPrec PutSubscriptionFilterResponse
$creadPrec :: ReadPrec PutSubscriptionFilterResponse
readList :: ReadS [PutSubscriptionFilterResponse]
$creadList :: ReadS [PutSubscriptionFilterResponse]
readsPrec :: Int -> ReadS PutSubscriptionFilterResponse
$creadsPrec :: Int -> ReadS PutSubscriptionFilterResponse
Prelude.Read, Int -> PutSubscriptionFilterResponse -> ShowS
[PutSubscriptionFilterResponse] -> ShowS
PutSubscriptionFilterResponse -> String
(Int -> PutSubscriptionFilterResponse -> ShowS)
-> (PutSubscriptionFilterResponse -> String)
-> ([PutSubscriptionFilterResponse] -> ShowS)
-> Show PutSubscriptionFilterResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutSubscriptionFilterResponse] -> ShowS
$cshowList :: [PutSubscriptionFilterResponse] -> ShowS
show :: PutSubscriptionFilterResponse -> String
$cshow :: PutSubscriptionFilterResponse -> String
showsPrec :: Int -> PutSubscriptionFilterResponse -> ShowS
$cshowsPrec :: Int -> PutSubscriptionFilterResponse -> ShowS
Prelude.Show, (forall x.
PutSubscriptionFilterResponse
-> Rep PutSubscriptionFilterResponse x)
-> (forall x.
Rep PutSubscriptionFilterResponse x
-> PutSubscriptionFilterResponse)
-> Generic PutSubscriptionFilterResponse
forall x.
Rep PutSubscriptionFilterResponse x
-> PutSubscriptionFilterResponse
forall x.
PutSubscriptionFilterResponse
-> Rep PutSubscriptionFilterResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutSubscriptionFilterResponse x
-> PutSubscriptionFilterResponse
$cfrom :: forall x.
PutSubscriptionFilterResponse
-> Rep PutSubscriptionFilterResponse x
Prelude.Generic)
newPutSubscriptionFilterResponse ::
PutSubscriptionFilterResponse
newPutSubscriptionFilterResponse :: PutSubscriptionFilterResponse
newPutSubscriptionFilterResponse =
PutSubscriptionFilterResponse
PutSubscriptionFilterResponse'
instance Prelude.NFData PutSubscriptionFilterResponse