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