{-# 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.CloudWatchEvents.PutPermission
(
PutPermission (..),
newPutPermission,
putPermission_action,
putPermission_eventBusName,
putPermission_principal,
putPermission_policy,
putPermission_statementId,
putPermission_condition,
PutPermissionResponse (..),
newPutPermissionResponse,
)
where
import Amazonka.CloudWatchEvents.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 PutPermission = PutPermission'
{
PutPermission -> Maybe Text
action :: Prelude.Maybe Prelude.Text,
PutPermission -> Maybe Text
eventBusName :: Prelude.Maybe Prelude.Text,
PutPermission -> Maybe Text
principal :: Prelude.Maybe Prelude.Text,
PutPermission -> Maybe Text
policy :: Prelude.Maybe Prelude.Text,
PutPermission -> Maybe Text
statementId :: Prelude.Maybe Prelude.Text,
PutPermission -> Maybe Condition
condition :: Prelude.Maybe Condition
}
deriving (PutPermission -> PutPermission -> Bool
(PutPermission -> PutPermission -> Bool)
-> (PutPermission -> PutPermission -> Bool) -> Eq PutPermission
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutPermission -> PutPermission -> Bool
$c/= :: PutPermission -> PutPermission -> Bool
== :: PutPermission -> PutPermission -> Bool
$c== :: PutPermission -> PutPermission -> Bool
Prelude.Eq, ReadPrec [PutPermission]
ReadPrec PutPermission
Int -> ReadS PutPermission
ReadS [PutPermission]
(Int -> ReadS PutPermission)
-> ReadS [PutPermission]
-> ReadPrec PutPermission
-> ReadPrec [PutPermission]
-> Read PutPermission
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutPermission]
$creadListPrec :: ReadPrec [PutPermission]
readPrec :: ReadPrec PutPermission
$creadPrec :: ReadPrec PutPermission
readList :: ReadS [PutPermission]
$creadList :: ReadS [PutPermission]
readsPrec :: Int -> ReadS PutPermission
$creadsPrec :: Int -> ReadS PutPermission
Prelude.Read, Int -> PutPermission -> ShowS
[PutPermission] -> ShowS
PutPermission -> String
(Int -> PutPermission -> ShowS)
-> (PutPermission -> String)
-> ([PutPermission] -> ShowS)
-> Show PutPermission
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutPermission] -> ShowS
$cshowList :: [PutPermission] -> ShowS
show :: PutPermission -> String
$cshow :: PutPermission -> String
showsPrec :: Int -> PutPermission -> ShowS
$cshowsPrec :: Int -> PutPermission -> ShowS
Prelude.Show, (forall x. PutPermission -> Rep PutPermission x)
-> (forall x. Rep PutPermission x -> PutPermission)
-> Generic PutPermission
forall x. Rep PutPermission x -> PutPermission
forall x. PutPermission -> Rep PutPermission x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutPermission x -> PutPermission
$cfrom :: forall x. PutPermission -> Rep PutPermission x
Prelude.Generic)
newPutPermission ::
PutPermission
newPutPermission :: PutPermission
newPutPermission =
PutPermission' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Condition
-> PutPermission
PutPermission'
{ $sel:action:PutPermission' :: Maybe Text
action = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:eventBusName:PutPermission' :: Maybe Text
eventBusName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:principal:PutPermission' :: Maybe Text
principal = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:policy:PutPermission' :: Maybe Text
policy = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:statementId:PutPermission' :: Maybe Text
statementId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:condition:PutPermission' :: Maybe Condition
condition = Maybe Condition
forall a. Maybe a
Prelude.Nothing
}
putPermission_action :: Lens.Lens' PutPermission (Prelude.Maybe Prelude.Text)
putPermission_action :: (Maybe Text -> f (Maybe Text)) -> PutPermission -> f PutPermission
putPermission_action = (PutPermission -> Maybe Text)
-> (PutPermission -> Maybe Text -> PutPermission)
-> Lens PutPermission PutPermission (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutPermission' {Maybe Text
action :: Maybe Text
$sel:action:PutPermission' :: PutPermission -> Maybe Text
action} -> Maybe Text
action) (\s :: PutPermission
s@PutPermission' {} Maybe Text
a -> PutPermission
s {$sel:action:PutPermission' :: Maybe Text
action = Maybe Text
a} :: PutPermission)
putPermission_eventBusName :: Lens.Lens' PutPermission (Prelude.Maybe Prelude.Text)
putPermission_eventBusName :: (Maybe Text -> f (Maybe Text)) -> PutPermission -> f PutPermission
putPermission_eventBusName = (PutPermission -> Maybe Text)
-> (PutPermission -> Maybe Text -> PutPermission)
-> Lens PutPermission PutPermission (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutPermission' {Maybe Text
eventBusName :: Maybe Text
$sel:eventBusName:PutPermission' :: PutPermission -> Maybe Text
eventBusName} -> Maybe Text
eventBusName) (\s :: PutPermission
s@PutPermission' {} Maybe Text
a -> PutPermission
s {$sel:eventBusName:PutPermission' :: Maybe Text
eventBusName = Maybe Text
a} :: PutPermission)
putPermission_principal :: Lens.Lens' PutPermission (Prelude.Maybe Prelude.Text)
putPermission_principal :: (Maybe Text -> f (Maybe Text)) -> PutPermission -> f PutPermission
putPermission_principal = (PutPermission -> Maybe Text)
-> (PutPermission -> Maybe Text -> PutPermission)
-> Lens PutPermission PutPermission (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutPermission' {Maybe Text
principal :: Maybe Text
$sel:principal:PutPermission' :: PutPermission -> Maybe Text
principal} -> Maybe Text
principal) (\s :: PutPermission
s@PutPermission' {} Maybe Text
a -> PutPermission
s {$sel:principal:PutPermission' :: Maybe Text
principal = Maybe Text
a} :: PutPermission)
putPermission_policy :: Lens.Lens' PutPermission (Prelude.Maybe Prelude.Text)
putPermission_policy :: (Maybe Text -> f (Maybe Text)) -> PutPermission -> f PutPermission
putPermission_policy = (PutPermission -> Maybe Text)
-> (PutPermission -> Maybe Text -> PutPermission)
-> Lens PutPermission PutPermission (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutPermission' {Maybe Text
policy :: Maybe Text
$sel:policy:PutPermission' :: PutPermission -> Maybe Text
policy} -> Maybe Text
policy) (\s :: PutPermission
s@PutPermission' {} Maybe Text
a -> PutPermission
s {$sel:policy:PutPermission' :: Maybe Text
policy = Maybe Text
a} :: PutPermission)
putPermission_statementId :: Lens.Lens' PutPermission (Prelude.Maybe Prelude.Text)
putPermission_statementId :: (Maybe Text -> f (Maybe Text)) -> PutPermission -> f PutPermission
putPermission_statementId = (PutPermission -> Maybe Text)
-> (PutPermission -> Maybe Text -> PutPermission)
-> Lens PutPermission PutPermission (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutPermission' {Maybe Text
statementId :: Maybe Text
$sel:statementId:PutPermission' :: PutPermission -> Maybe Text
statementId} -> Maybe Text
statementId) (\s :: PutPermission
s@PutPermission' {} Maybe Text
a -> PutPermission
s {$sel:statementId:PutPermission' :: Maybe Text
statementId = Maybe Text
a} :: PutPermission)
putPermission_condition :: Lens.Lens' PutPermission (Prelude.Maybe Condition)
putPermission_condition :: (Maybe Condition -> f (Maybe Condition))
-> PutPermission -> f PutPermission
putPermission_condition = (PutPermission -> Maybe Condition)
-> (PutPermission -> Maybe Condition -> PutPermission)
-> Lens
PutPermission PutPermission (Maybe Condition) (Maybe Condition)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutPermission' {Maybe Condition
condition :: Maybe Condition
$sel:condition:PutPermission' :: PutPermission -> Maybe Condition
condition} -> Maybe Condition
condition) (\s :: PutPermission
s@PutPermission' {} Maybe Condition
a -> PutPermission
s {$sel:condition:PutPermission' :: Maybe Condition
condition = Maybe Condition
a} :: PutPermission)
instance Core.AWSRequest PutPermission where
type
AWSResponse PutPermission =
PutPermissionResponse
request :: PutPermission -> Request PutPermission
request = Service -> PutPermission -> Request PutPermission
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy PutPermission
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PutPermission)))
response =
AWSResponse PutPermission
-> Logger
-> Service
-> Proxy PutPermission
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PutPermission)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse PutPermission
PutPermissionResponse
PutPermissionResponse'
instance Prelude.Hashable PutPermission
instance Prelude.NFData PutPermission
instance Core.ToHeaders PutPermission where
toHeaders :: PutPermission -> [Header]
toHeaders =
[Header] -> PutPermission -> [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
"AWSEvents.PutPermission" :: 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 PutPermission where
toJSON :: PutPermission -> Value
toJSON PutPermission' {Maybe Text
Maybe Condition
condition :: Maybe Condition
statementId :: Maybe Text
policy :: Maybe Text
principal :: Maybe Text
eventBusName :: Maybe Text
action :: Maybe Text
$sel:condition:PutPermission' :: PutPermission -> Maybe Condition
$sel:statementId:PutPermission' :: PutPermission -> Maybe Text
$sel:policy:PutPermission' :: PutPermission -> Maybe Text
$sel:principal:PutPermission' :: PutPermission -> Maybe Text
$sel:eventBusName:PutPermission' :: PutPermission -> Maybe Text
$sel:action:PutPermission' :: PutPermission -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Action" 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
action,
(Text
"EventBusName" 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
eventBusName,
(Text
"Principal" 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
principal,
(Text
"Policy" 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
policy,
(Text
"StatementId" 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
statementId,
(Text
"Condition" Text -> Condition -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Condition -> Pair) -> Maybe Condition -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Condition
condition
]
)
instance Core.ToPath PutPermission where
toPath :: PutPermission -> ByteString
toPath = ByteString -> PutPermission -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery PutPermission where
toQuery :: PutPermission -> QueryString
toQuery = QueryString -> PutPermission -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data PutPermissionResponse = PutPermissionResponse'
{
}
deriving (PutPermissionResponse -> PutPermissionResponse -> Bool
(PutPermissionResponse -> PutPermissionResponse -> Bool)
-> (PutPermissionResponse -> PutPermissionResponse -> Bool)
-> Eq PutPermissionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutPermissionResponse -> PutPermissionResponse -> Bool
$c/= :: PutPermissionResponse -> PutPermissionResponse -> Bool
== :: PutPermissionResponse -> PutPermissionResponse -> Bool
$c== :: PutPermissionResponse -> PutPermissionResponse -> Bool
Prelude.Eq, ReadPrec [PutPermissionResponse]
ReadPrec PutPermissionResponse
Int -> ReadS PutPermissionResponse
ReadS [PutPermissionResponse]
(Int -> ReadS PutPermissionResponse)
-> ReadS [PutPermissionResponse]
-> ReadPrec PutPermissionResponse
-> ReadPrec [PutPermissionResponse]
-> Read PutPermissionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutPermissionResponse]
$creadListPrec :: ReadPrec [PutPermissionResponse]
readPrec :: ReadPrec PutPermissionResponse
$creadPrec :: ReadPrec PutPermissionResponse
readList :: ReadS [PutPermissionResponse]
$creadList :: ReadS [PutPermissionResponse]
readsPrec :: Int -> ReadS PutPermissionResponse
$creadsPrec :: Int -> ReadS PutPermissionResponse
Prelude.Read, Int -> PutPermissionResponse -> ShowS
[PutPermissionResponse] -> ShowS
PutPermissionResponse -> String
(Int -> PutPermissionResponse -> ShowS)
-> (PutPermissionResponse -> String)
-> ([PutPermissionResponse] -> ShowS)
-> Show PutPermissionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutPermissionResponse] -> ShowS
$cshowList :: [PutPermissionResponse] -> ShowS
show :: PutPermissionResponse -> String
$cshow :: PutPermissionResponse -> String
showsPrec :: Int -> PutPermissionResponse -> ShowS
$cshowsPrec :: Int -> PutPermissionResponse -> ShowS
Prelude.Show, (forall x. PutPermissionResponse -> Rep PutPermissionResponse x)
-> (forall x. Rep PutPermissionResponse x -> PutPermissionResponse)
-> Generic PutPermissionResponse
forall x. Rep PutPermissionResponse x -> PutPermissionResponse
forall x. PutPermissionResponse -> Rep PutPermissionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutPermissionResponse x -> PutPermissionResponse
$cfrom :: forall x. PutPermissionResponse -> Rep PutPermissionResponse x
Prelude.Generic)
newPutPermissionResponse ::
PutPermissionResponse
newPutPermissionResponse :: PutPermissionResponse
newPutPermissionResponse = PutPermissionResponse
PutPermissionResponse'
instance Prelude.NFData PutPermissionResponse