{-# 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.PutDestinationPolicy
(
PutDestinationPolicy (..),
newPutDestinationPolicy,
putDestinationPolicy_destinationName,
putDestinationPolicy_accessPolicy,
PutDestinationPolicyResponse (..),
newPutDestinationPolicyResponse,
)
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 PutDestinationPolicy = PutDestinationPolicy'
{
PutDestinationPolicy -> Text
destinationName :: Prelude.Text,
PutDestinationPolicy -> Text
accessPolicy :: Prelude.Text
}
deriving (PutDestinationPolicy -> PutDestinationPolicy -> Bool
(PutDestinationPolicy -> PutDestinationPolicy -> Bool)
-> (PutDestinationPolicy -> PutDestinationPolicy -> Bool)
-> Eq PutDestinationPolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutDestinationPolicy -> PutDestinationPolicy -> Bool
$c/= :: PutDestinationPolicy -> PutDestinationPolicy -> Bool
== :: PutDestinationPolicy -> PutDestinationPolicy -> Bool
$c== :: PutDestinationPolicy -> PutDestinationPolicy -> Bool
Prelude.Eq, ReadPrec [PutDestinationPolicy]
ReadPrec PutDestinationPolicy
Int -> ReadS PutDestinationPolicy
ReadS [PutDestinationPolicy]
(Int -> ReadS PutDestinationPolicy)
-> ReadS [PutDestinationPolicy]
-> ReadPrec PutDestinationPolicy
-> ReadPrec [PutDestinationPolicy]
-> Read PutDestinationPolicy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutDestinationPolicy]
$creadListPrec :: ReadPrec [PutDestinationPolicy]
readPrec :: ReadPrec PutDestinationPolicy
$creadPrec :: ReadPrec PutDestinationPolicy
readList :: ReadS [PutDestinationPolicy]
$creadList :: ReadS [PutDestinationPolicy]
readsPrec :: Int -> ReadS PutDestinationPolicy
$creadsPrec :: Int -> ReadS PutDestinationPolicy
Prelude.Read, Int -> PutDestinationPolicy -> ShowS
[PutDestinationPolicy] -> ShowS
PutDestinationPolicy -> String
(Int -> PutDestinationPolicy -> ShowS)
-> (PutDestinationPolicy -> String)
-> ([PutDestinationPolicy] -> ShowS)
-> Show PutDestinationPolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutDestinationPolicy] -> ShowS
$cshowList :: [PutDestinationPolicy] -> ShowS
show :: PutDestinationPolicy -> String
$cshow :: PutDestinationPolicy -> String
showsPrec :: Int -> PutDestinationPolicy -> ShowS
$cshowsPrec :: Int -> PutDestinationPolicy -> ShowS
Prelude.Show, (forall x. PutDestinationPolicy -> Rep PutDestinationPolicy x)
-> (forall x. Rep PutDestinationPolicy x -> PutDestinationPolicy)
-> Generic PutDestinationPolicy
forall x. Rep PutDestinationPolicy x -> PutDestinationPolicy
forall x. PutDestinationPolicy -> Rep PutDestinationPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutDestinationPolicy x -> PutDestinationPolicy
$cfrom :: forall x. PutDestinationPolicy -> Rep PutDestinationPolicy x
Prelude.Generic)
newPutDestinationPolicy ::
Prelude.Text ->
Prelude.Text ->
PutDestinationPolicy
newPutDestinationPolicy :: Text -> Text -> PutDestinationPolicy
newPutDestinationPolicy
Text
pDestinationName_
Text
pAccessPolicy_ =
PutDestinationPolicy' :: Text -> Text -> PutDestinationPolicy
PutDestinationPolicy'
{ $sel:destinationName:PutDestinationPolicy' :: Text
destinationName =
Text
pDestinationName_,
$sel:accessPolicy:PutDestinationPolicy' :: Text
accessPolicy = Text
pAccessPolicy_
}
putDestinationPolicy_destinationName :: Lens.Lens' PutDestinationPolicy Prelude.Text
putDestinationPolicy_destinationName :: (Text -> f Text) -> PutDestinationPolicy -> f PutDestinationPolicy
putDestinationPolicy_destinationName = (PutDestinationPolicy -> Text)
-> (PutDestinationPolicy -> Text -> PutDestinationPolicy)
-> Lens PutDestinationPolicy PutDestinationPolicy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutDestinationPolicy' {Text
destinationName :: Text
$sel:destinationName:PutDestinationPolicy' :: PutDestinationPolicy -> Text
destinationName} -> Text
destinationName) (\s :: PutDestinationPolicy
s@PutDestinationPolicy' {} Text
a -> PutDestinationPolicy
s {$sel:destinationName:PutDestinationPolicy' :: Text
destinationName = Text
a} :: PutDestinationPolicy)
putDestinationPolicy_accessPolicy :: Lens.Lens' PutDestinationPolicy Prelude.Text
putDestinationPolicy_accessPolicy :: (Text -> f Text) -> PutDestinationPolicy -> f PutDestinationPolicy
putDestinationPolicy_accessPolicy = (PutDestinationPolicy -> Text)
-> (PutDestinationPolicy -> Text -> PutDestinationPolicy)
-> Lens PutDestinationPolicy PutDestinationPolicy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutDestinationPolicy' {Text
accessPolicy :: Text
$sel:accessPolicy:PutDestinationPolicy' :: PutDestinationPolicy -> Text
accessPolicy} -> Text
accessPolicy) (\s :: PutDestinationPolicy
s@PutDestinationPolicy' {} Text
a -> PutDestinationPolicy
s {$sel:accessPolicy:PutDestinationPolicy' :: Text
accessPolicy = Text
a} :: PutDestinationPolicy)
instance Core.AWSRequest PutDestinationPolicy where
type
AWSResponse PutDestinationPolicy =
PutDestinationPolicyResponse
request :: PutDestinationPolicy -> Request PutDestinationPolicy
request = Service -> PutDestinationPolicy -> Request PutDestinationPolicy
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy PutDestinationPolicy
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutDestinationPolicy)))
response =
AWSResponse PutDestinationPolicy
-> Logger
-> Service
-> Proxy PutDestinationPolicy
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutDestinationPolicy)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse PutDestinationPolicy
PutDestinationPolicyResponse
PutDestinationPolicyResponse'
instance Prelude.Hashable PutDestinationPolicy
instance Prelude.NFData PutDestinationPolicy
instance Core.ToHeaders PutDestinationPolicy where
toHeaders :: PutDestinationPolicy -> [Header]
toHeaders =
[Header] -> PutDestinationPolicy -> [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.PutDestinationPolicy" ::
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 PutDestinationPolicy where
toJSON :: PutDestinationPolicy -> Value
toJSON PutDestinationPolicy' {Text
accessPolicy :: Text
destinationName :: Text
$sel:accessPolicy:PutDestinationPolicy' :: PutDestinationPolicy -> Text
$sel:destinationName:PutDestinationPolicy' :: PutDestinationPolicy -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"destinationName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
destinationName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"accessPolicy" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
accessPolicy)
]
)
instance Core.ToPath PutDestinationPolicy where
toPath :: PutDestinationPolicy -> ByteString
toPath = ByteString -> PutDestinationPolicy -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery PutDestinationPolicy where
toQuery :: PutDestinationPolicy -> QueryString
toQuery = QueryString -> PutDestinationPolicy -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data PutDestinationPolicyResponse = PutDestinationPolicyResponse'
{
}
deriving (PutDestinationPolicyResponse
-> PutDestinationPolicyResponse -> Bool
(PutDestinationPolicyResponse
-> PutDestinationPolicyResponse -> Bool)
-> (PutDestinationPolicyResponse
-> PutDestinationPolicyResponse -> Bool)
-> Eq PutDestinationPolicyResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutDestinationPolicyResponse
-> PutDestinationPolicyResponse -> Bool
$c/= :: PutDestinationPolicyResponse
-> PutDestinationPolicyResponse -> Bool
== :: PutDestinationPolicyResponse
-> PutDestinationPolicyResponse -> Bool
$c== :: PutDestinationPolicyResponse
-> PutDestinationPolicyResponse -> Bool
Prelude.Eq, ReadPrec [PutDestinationPolicyResponse]
ReadPrec PutDestinationPolicyResponse
Int -> ReadS PutDestinationPolicyResponse
ReadS [PutDestinationPolicyResponse]
(Int -> ReadS PutDestinationPolicyResponse)
-> ReadS [PutDestinationPolicyResponse]
-> ReadPrec PutDestinationPolicyResponse
-> ReadPrec [PutDestinationPolicyResponse]
-> Read PutDestinationPolicyResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutDestinationPolicyResponse]
$creadListPrec :: ReadPrec [PutDestinationPolicyResponse]
readPrec :: ReadPrec PutDestinationPolicyResponse
$creadPrec :: ReadPrec PutDestinationPolicyResponse
readList :: ReadS [PutDestinationPolicyResponse]
$creadList :: ReadS [PutDestinationPolicyResponse]
readsPrec :: Int -> ReadS PutDestinationPolicyResponse
$creadsPrec :: Int -> ReadS PutDestinationPolicyResponse
Prelude.Read, Int -> PutDestinationPolicyResponse -> ShowS
[PutDestinationPolicyResponse] -> ShowS
PutDestinationPolicyResponse -> String
(Int -> PutDestinationPolicyResponse -> ShowS)
-> (PutDestinationPolicyResponse -> String)
-> ([PutDestinationPolicyResponse] -> ShowS)
-> Show PutDestinationPolicyResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutDestinationPolicyResponse] -> ShowS
$cshowList :: [PutDestinationPolicyResponse] -> ShowS
show :: PutDestinationPolicyResponse -> String
$cshow :: PutDestinationPolicyResponse -> String
showsPrec :: Int -> PutDestinationPolicyResponse -> ShowS
$cshowsPrec :: Int -> PutDestinationPolicyResponse -> ShowS
Prelude.Show, (forall x.
PutDestinationPolicyResponse -> Rep PutDestinationPolicyResponse x)
-> (forall x.
Rep PutDestinationPolicyResponse x -> PutDestinationPolicyResponse)
-> Generic PutDestinationPolicyResponse
forall x.
Rep PutDestinationPolicyResponse x -> PutDestinationPolicyResponse
forall x.
PutDestinationPolicyResponse -> Rep PutDestinationPolicyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutDestinationPolicyResponse x -> PutDestinationPolicyResponse
$cfrom :: forall x.
PutDestinationPolicyResponse -> Rep PutDestinationPolicyResponse x
Prelude.Generic)
newPutDestinationPolicyResponse ::
PutDestinationPolicyResponse
newPutDestinationPolicyResponse :: PutDestinationPolicyResponse
newPutDestinationPolicyResponse =
PutDestinationPolicyResponse
PutDestinationPolicyResponse'
instance Prelude.NFData PutDestinationPolicyResponse