{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.CloudWatchEvents.Types.Rule where
import Amazonka.CloudWatchEvents.Types.RuleState
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Rule = Rule'
{
Rule -> Maybe Text
eventPattern :: Prelude.Maybe Prelude.Text,
Rule -> Maybe RuleState
state :: Prelude.Maybe RuleState,
Rule -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
Rule -> Maybe Text
eventBusName :: Prelude.Maybe Prelude.Text,
Rule -> Maybe Text
scheduleExpression :: Prelude.Maybe Prelude.Text,
Rule -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
Rule -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
Rule -> Maybe Text
managedBy :: Prelude.Maybe Prelude.Text,
Rule -> Maybe Text
roleArn :: Prelude.Maybe Prelude.Text
}
deriving (Rule -> Rule -> Bool
(Rule -> Rule -> Bool) -> (Rule -> Rule -> Bool) -> Eq Rule
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Rule -> Rule -> Bool
$c/= :: Rule -> Rule -> Bool
== :: Rule -> Rule -> Bool
$c== :: Rule -> Rule -> Bool
Prelude.Eq, ReadPrec [Rule]
ReadPrec Rule
Int -> ReadS Rule
ReadS [Rule]
(Int -> ReadS Rule)
-> ReadS [Rule] -> ReadPrec Rule -> ReadPrec [Rule] -> Read Rule
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Rule]
$creadListPrec :: ReadPrec [Rule]
readPrec :: ReadPrec Rule
$creadPrec :: ReadPrec Rule
readList :: ReadS [Rule]
$creadList :: ReadS [Rule]
readsPrec :: Int -> ReadS Rule
$creadsPrec :: Int -> ReadS Rule
Prelude.Read, Int -> Rule -> ShowS
[Rule] -> ShowS
Rule -> String
(Int -> Rule -> ShowS)
-> (Rule -> String) -> ([Rule] -> ShowS) -> Show Rule
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Rule] -> ShowS
$cshowList :: [Rule] -> ShowS
show :: Rule -> String
$cshow :: Rule -> String
showsPrec :: Int -> Rule -> ShowS
$cshowsPrec :: Int -> Rule -> ShowS
Prelude.Show, (forall x. Rule -> Rep Rule x)
-> (forall x. Rep Rule x -> Rule) -> Generic Rule
forall x. Rep Rule x -> Rule
forall x. Rule -> Rep Rule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Rule x -> Rule
$cfrom :: forall x. Rule -> Rep Rule x
Prelude.Generic)
newRule ::
Rule
newRule :: Rule
newRule =
Rule' :: Maybe Text
-> Maybe RuleState
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Rule
Rule'
{ $sel:eventPattern:Rule' :: Maybe Text
eventPattern = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:state:Rule' :: Maybe RuleState
state = Maybe RuleState
forall a. Maybe a
Prelude.Nothing,
$sel:arn:Rule' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:eventBusName:Rule' :: Maybe Text
eventBusName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:scheduleExpression:Rule' :: Maybe Text
scheduleExpression = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:name:Rule' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:description:Rule' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:managedBy:Rule' :: Maybe Text
managedBy = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:roleArn:Rule' :: Maybe Text
roleArn = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
rule_eventPattern :: Lens.Lens' Rule (Prelude.Maybe Prelude.Text)
rule_eventPattern :: (Maybe Text -> f (Maybe Text)) -> Rule -> f Rule
rule_eventPattern = (Rule -> Maybe Text)
-> (Rule -> Maybe Text -> Rule)
-> Lens Rule Rule (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Rule' {Maybe Text
eventPattern :: Maybe Text
$sel:eventPattern:Rule' :: Rule -> Maybe Text
eventPattern} -> Maybe Text
eventPattern) (\s :: Rule
s@Rule' {} Maybe Text
a -> Rule
s {$sel:eventPattern:Rule' :: Maybe Text
eventPattern = Maybe Text
a} :: Rule)
rule_state :: Lens.Lens' Rule (Prelude.Maybe RuleState)
rule_state :: (Maybe RuleState -> f (Maybe RuleState)) -> Rule -> f Rule
rule_state = (Rule -> Maybe RuleState)
-> (Rule -> Maybe RuleState -> Rule)
-> Lens Rule Rule (Maybe RuleState) (Maybe RuleState)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Rule' {Maybe RuleState
state :: Maybe RuleState
$sel:state:Rule' :: Rule -> Maybe RuleState
state} -> Maybe RuleState
state) (\s :: Rule
s@Rule' {} Maybe RuleState
a -> Rule
s {$sel:state:Rule' :: Maybe RuleState
state = Maybe RuleState
a} :: Rule)
rule_arn :: Lens.Lens' Rule (Prelude.Maybe Prelude.Text)
rule_arn :: (Maybe Text -> f (Maybe Text)) -> Rule -> f Rule
rule_arn = (Rule -> Maybe Text)
-> (Rule -> Maybe Text -> Rule)
-> Lens Rule Rule (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Rule' {Maybe Text
arn :: Maybe Text
$sel:arn:Rule' :: Rule -> Maybe Text
arn} -> Maybe Text
arn) (\s :: Rule
s@Rule' {} Maybe Text
a -> Rule
s {$sel:arn:Rule' :: Maybe Text
arn = Maybe Text
a} :: Rule)
rule_eventBusName :: Lens.Lens' Rule (Prelude.Maybe Prelude.Text)
rule_eventBusName :: (Maybe Text -> f (Maybe Text)) -> Rule -> f Rule
rule_eventBusName = (Rule -> Maybe Text)
-> (Rule -> Maybe Text -> Rule)
-> Lens Rule Rule (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Rule' {Maybe Text
eventBusName :: Maybe Text
$sel:eventBusName:Rule' :: Rule -> Maybe Text
eventBusName} -> Maybe Text
eventBusName) (\s :: Rule
s@Rule' {} Maybe Text
a -> Rule
s {$sel:eventBusName:Rule' :: Maybe Text
eventBusName = Maybe Text
a} :: Rule)
rule_scheduleExpression :: Lens.Lens' Rule (Prelude.Maybe Prelude.Text)
rule_scheduleExpression :: (Maybe Text -> f (Maybe Text)) -> Rule -> f Rule
rule_scheduleExpression = (Rule -> Maybe Text)
-> (Rule -> Maybe Text -> Rule)
-> Lens Rule Rule (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Rule' {Maybe Text
scheduleExpression :: Maybe Text
$sel:scheduleExpression:Rule' :: Rule -> Maybe Text
scheduleExpression} -> Maybe Text
scheduleExpression) (\s :: Rule
s@Rule' {} Maybe Text
a -> Rule
s {$sel:scheduleExpression:Rule' :: Maybe Text
scheduleExpression = Maybe Text
a} :: Rule)
rule_name :: Lens.Lens' Rule (Prelude.Maybe Prelude.Text)
rule_name :: (Maybe Text -> f (Maybe Text)) -> Rule -> f Rule
rule_name = (Rule -> Maybe Text)
-> (Rule -> Maybe Text -> Rule)
-> Lens Rule Rule (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Rule' {Maybe Text
name :: Maybe Text
$sel:name:Rule' :: Rule -> Maybe Text
name} -> Maybe Text
name) (\s :: Rule
s@Rule' {} Maybe Text
a -> Rule
s {$sel:name:Rule' :: Maybe Text
name = Maybe Text
a} :: Rule)
rule_description :: Lens.Lens' Rule (Prelude.Maybe Prelude.Text)
rule_description :: (Maybe Text -> f (Maybe Text)) -> Rule -> f Rule
rule_description = (Rule -> Maybe Text)
-> (Rule -> Maybe Text -> Rule)
-> Lens Rule Rule (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Rule' {Maybe Text
description :: Maybe Text
$sel:description:Rule' :: Rule -> Maybe Text
description} -> Maybe Text
description) (\s :: Rule
s@Rule' {} Maybe Text
a -> Rule
s {$sel:description:Rule' :: Maybe Text
description = Maybe Text
a} :: Rule)
rule_managedBy :: Lens.Lens' Rule (Prelude.Maybe Prelude.Text)
rule_managedBy :: (Maybe Text -> f (Maybe Text)) -> Rule -> f Rule
rule_managedBy = (Rule -> Maybe Text)
-> (Rule -> Maybe Text -> Rule)
-> Lens Rule Rule (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Rule' {Maybe Text
managedBy :: Maybe Text
$sel:managedBy:Rule' :: Rule -> Maybe Text
managedBy} -> Maybe Text
managedBy) (\s :: Rule
s@Rule' {} Maybe Text
a -> Rule
s {$sel:managedBy:Rule' :: Maybe Text
managedBy = Maybe Text
a} :: Rule)
rule_roleArn :: Lens.Lens' Rule (Prelude.Maybe Prelude.Text)
rule_roleArn :: (Maybe Text -> f (Maybe Text)) -> Rule -> f Rule
rule_roleArn = (Rule -> Maybe Text)
-> (Rule -> Maybe Text -> Rule)
-> Lens Rule Rule (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Rule' {Maybe Text
roleArn :: Maybe Text
$sel:roleArn:Rule' :: Rule -> Maybe Text
roleArn} -> Maybe Text
roleArn) (\s :: Rule
s@Rule' {} Maybe Text
a -> Rule
s {$sel:roleArn:Rule' :: Maybe Text
roleArn = Maybe Text
a} :: Rule)
instance Core.FromJSON Rule where
parseJSON :: Value -> Parser Rule
parseJSON =
String -> (Object -> Parser Rule) -> Value -> Parser Rule
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Rule"
( \Object
x ->
Maybe Text
-> Maybe RuleState
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Rule
Rule'
(Maybe Text
-> Maybe RuleState
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Rule)
-> Parser (Maybe Text)
-> Parser
(Maybe RuleState
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Rule)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"EventPattern")
Parser
(Maybe RuleState
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Rule)
-> Parser (Maybe RuleState)
-> Parser
(Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Rule)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe RuleState)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"State")
Parser
(Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Rule)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Rule)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Arn")
Parser
(Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Rule)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Text -> Maybe Text -> Rule)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"EventBusName")
Parser
(Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Text -> Maybe Text -> Rule)
-> Parser (Maybe Text)
-> Parser
(Maybe Text -> Maybe Text -> Maybe Text -> Maybe Text -> Rule)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ScheduleExpression")
Parser
(Maybe Text -> Maybe Text -> Maybe Text -> Maybe Text -> Rule)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> Maybe Text -> Rule)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Name")
Parser (Maybe Text -> Maybe Text -> Maybe Text -> Rule)
-> Parser (Maybe Text) -> Parser (Maybe Text -> Maybe Text -> Rule)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Description")
Parser (Maybe Text -> Maybe Text -> Rule)
-> Parser (Maybe Text) -> Parser (Maybe Text -> Rule)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ManagedBy")
Parser (Maybe Text -> Rule) -> Parser (Maybe Text) -> Parser Rule
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"RoleArn")
)
instance Prelude.Hashable Rule
instance Prelude.NFData Rule