{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
data Rule = Rule'
{
Rule -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
Rule -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
Rule -> Maybe Text
eventBusName :: Prelude.Maybe Prelude.Text,
Rule -> Maybe Text
eventPattern :: Prelude.Maybe Prelude.Text,
Rule -> Maybe Text
managedBy :: Prelude.Maybe Prelude.Text,
Rule -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
Rule -> Maybe Text
roleArn :: Prelude.Maybe Prelude.Text,
Rule -> Maybe Text
scheduleExpression :: Prelude.Maybe Prelude.Text,
Rule -> Maybe RuleState
state :: Prelude.Maybe RuleState
}
deriving (Rule -> Rule -> Bool
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]
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
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. 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'
{ $sel:arn:Rule' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
$sel:description:Rule' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
$sel:eventBusName:Rule' :: Maybe Text
eventBusName = forall a. Maybe a
Prelude.Nothing,
$sel:eventPattern:Rule' :: Maybe Text
eventPattern = forall a. Maybe a
Prelude.Nothing,
$sel:managedBy:Rule' :: Maybe Text
managedBy = forall a. Maybe a
Prelude.Nothing,
$sel:name:Rule' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
$sel:roleArn:Rule' :: Maybe Text
roleArn = forall a. Maybe a
Prelude.Nothing,
$sel:scheduleExpression:Rule' :: Maybe Text
scheduleExpression = forall a. Maybe a
Prelude.Nothing,
$sel:state:Rule' :: Maybe RuleState
state = forall a. Maybe a
Prelude.Nothing
}
rule_arn :: Lens.Lens' Rule (Prelude.Maybe Prelude.Text)
rule_arn :: Lens' Rule (Maybe Text)
rule_arn = 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_description :: Lens.Lens' Rule (Prelude.Maybe Prelude.Text)
rule_description :: Lens' Rule (Maybe Text)
rule_description = 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_eventBusName :: Lens.Lens' Rule (Prelude.Maybe Prelude.Text)
rule_eventBusName :: Lens' Rule (Maybe Text)
rule_eventBusName = 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_eventPattern :: Lens.Lens' Rule (Prelude.Maybe Prelude.Text)
rule_eventPattern :: Lens' Rule (Maybe Text)
rule_eventPattern = 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_managedBy :: Lens.Lens' Rule (Prelude.Maybe Prelude.Text)
rule_managedBy :: Lens' Rule (Maybe Text)
rule_managedBy = 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_name :: Lens.Lens' Rule (Prelude.Maybe Prelude.Text)
rule_name :: Lens' Rule (Maybe Text)
rule_name = 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_roleArn :: Lens.Lens' Rule (Prelude.Maybe Prelude.Text)
rule_roleArn :: Lens' Rule (Maybe Text)
rule_roleArn = 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)
rule_scheduleExpression :: Lens.Lens' Rule (Prelude.Maybe Prelude.Text)
rule_scheduleExpression :: Lens' Rule (Maybe Text)
rule_scheduleExpression = 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_state :: Lens.Lens' Rule (Prelude.Maybe RuleState)
rule_state :: Lens' Rule (Maybe RuleState)
rule_state = 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)
instance Data.FromJSON Rule where
parseJSON :: Value -> Parser Rule
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"Rule"
( \Object
x ->
Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe RuleState
-> Rule
Rule'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Arn")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Description")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"EventBusName")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"EventPattern")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ManagedBy")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Name")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"RoleArn")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ScheduleExpression")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"State")
)
instance Prelude.Hashable Rule where
hashWithSalt :: Int -> Rule -> Int
hashWithSalt Int
_salt Rule' {Maybe Text
Maybe RuleState
state :: Maybe RuleState
scheduleExpression :: Maybe Text
roleArn :: Maybe Text
name :: Maybe Text
managedBy :: Maybe Text
eventPattern :: Maybe Text
eventBusName :: Maybe Text
description :: Maybe Text
arn :: Maybe Text
$sel:state:Rule' :: Rule -> Maybe RuleState
$sel:scheduleExpression:Rule' :: Rule -> Maybe Text
$sel:roleArn:Rule' :: Rule -> Maybe Text
$sel:name:Rule' :: Rule -> Maybe Text
$sel:managedBy:Rule' :: Rule -> Maybe Text
$sel:eventPattern:Rule' :: Rule -> Maybe Text
$sel:eventBusName:Rule' :: Rule -> Maybe Text
$sel:description:Rule' :: Rule -> Maybe Text
$sel:arn:Rule' :: Rule -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
arn
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
eventBusName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
eventPattern
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
managedBy
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
roleArn
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
scheduleExpression
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe RuleState
state
instance Prelude.NFData Rule where
rnf :: Rule -> ()
rnf Rule' {Maybe Text
Maybe RuleState
state :: Maybe RuleState
scheduleExpression :: Maybe Text
roleArn :: Maybe Text
name :: Maybe Text
managedBy :: Maybe Text
eventPattern :: Maybe Text
eventBusName :: Maybe Text
description :: Maybe Text
arn :: Maybe Text
$sel:state:Rule' :: Rule -> Maybe RuleState
$sel:scheduleExpression:Rule' :: Rule -> Maybe Text
$sel:roleArn:Rule' :: Rule -> Maybe Text
$sel:name:Rule' :: Rule -> Maybe Text
$sel:managedBy:Rule' :: Rule -> Maybe Text
$sel:eventPattern:Rule' :: Rule -> Maybe Text
$sel:eventBusName:Rule' :: Rule -> Maybe Text
$sel:description:Rule' :: Rule -> Maybe Text
$sel:arn:Rule' :: Rule -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
eventBusName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
eventPattern
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
managedBy
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
roleArn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
scheduleExpression
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe RuleState
state