{-# 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.Glue.Types.Trigger where
import qualified Amazonka.Core as Core
import Amazonka.Glue.Types.Action
import Amazonka.Glue.Types.EventBatchingCondition
import Amazonka.Glue.Types.Predicate
import Amazonka.Glue.Types.TriggerState
import Amazonka.Glue.Types.TriggerType
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Trigger = Trigger'
{
Trigger -> Maybe Text
workflowName :: Prelude.Maybe Prelude.Text,
Trigger -> Maybe TriggerState
state :: Prelude.Maybe TriggerState,
Trigger -> Maybe [Action]
actions :: Prelude.Maybe [Action],
Trigger -> Maybe Text
schedule :: Prelude.Maybe Prelude.Text,
Trigger -> Maybe Predicate
predicate :: Prelude.Maybe Predicate,
Trigger -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
Trigger -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
Trigger -> Maybe TriggerType
type' :: Prelude.Maybe TriggerType,
Trigger -> Maybe EventBatchingCondition
eventBatchingCondition :: Prelude.Maybe EventBatchingCondition,
Trigger -> Maybe Text
description :: Prelude.Maybe Prelude.Text
}
deriving (Trigger -> Trigger -> Bool
(Trigger -> Trigger -> Bool)
-> (Trigger -> Trigger -> Bool) -> Eq Trigger
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Trigger -> Trigger -> Bool
$c/= :: Trigger -> Trigger -> Bool
== :: Trigger -> Trigger -> Bool
$c== :: Trigger -> Trigger -> Bool
Prelude.Eq, ReadPrec [Trigger]
ReadPrec Trigger
Int -> ReadS Trigger
ReadS [Trigger]
(Int -> ReadS Trigger)
-> ReadS [Trigger]
-> ReadPrec Trigger
-> ReadPrec [Trigger]
-> Read Trigger
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Trigger]
$creadListPrec :: ReadPrec [Trigger]
readPrec :: ReadPrec Trigger
$creadPrec :: ReadPrec Trigger
readList :: ReadS [Trigger]
$creadList :: ReadS [Trigger]
readsPrec :: Int -> ReadS Trigger
$creadsPrec :: Int -> ReadS Trigger
Prelude.Read, Int -> Trigger -> ShowS
[Trigger] -> ShowS
Trigger -> String
(Int -> Trigger -> ShowS)
-> (Trigger -> String) -> ([Trigger] -> ShowS) -> Show Trigger
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Trigger] -> ShowS
$cshowList :: [Trigger] -> ShowS
show :: Trigger -> String
$cshow :: Trigger -> String
showsPrec :: Int -> Trigger -> ShowS
$cshowsPrec :: Int -> Trigger -> ShowS
Prelude.Show, (forall x. Trigger -> Rep Trigger x)
-> (forall x. Rep Trigger x -> Trigger) -> Generic Trigger
forall x. Rep Trigger x -> Trigger
forall x. Trigger -> Rep Trigger x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Trigger x -> Trigger
$cfrom :: forall x. Trigger -> Rep Trigger x
Prelude.Generic)
newTrigger ::
Trigger
newTrigger :: Trigger
newTrigger =
Trigger' :: Maybe Text
-> Maybe TriggerState
-> Maybe [Action]
-> Maybe Text
-> Maybe Predicate
-> Maybe Text
-> Maybe Text
-> Maybe TriggerType
-> Maybe EventBatchingCondition
-> Maybe Text
-> Trigger
Trigger'
{ $sel:workflowName:Trigger' :: Maybe Text
workflowName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:state:Trigger' :: Maybe TriggerState
state = Maybe TriggerState
forall a. Maybe a
Prelude.Nothing,
$sel:actions:Trigger' :: Maybe [Action]
actions = Maybe [Action]
forall a. Maybe a
Prelude.Nothing,
$sel:schedule:Trigger' :: Maybe Text
schedule = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:predicate:Trigger' :: Maybe Predicate
predicate = Maybe Predicate
forall a. Maybe a
Prelude.Nothing,
$sel:name:Trigger' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:id:Trigger' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:type':Trigger' :: Maybe TriggerType
type' = Maybe TriggerType
forall a. Maybe a
Prelude.Nothing,
$sel:eventBatchingCondition:Trigger' :: Maybe EventBatchingCondition
eventBatchingCondition = Maybe EventBatchingCondition
forall a. Maybe a
Prelude.Nothing,
$sel:description:Trigger' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
trigger_workflowName :: Lens.Lens' Trigger (Prelude.Maybe Prelude.Text)
trigger_workflowName :: (Maybe Text -> f (Maybe Text)) -> Trigger -> f Trigger
trigger_workflowName = (Trigger -> Maybe Text)
-> (Trigger -> Maybe Text -> Trigger)
-> Lens Trigger Trigger (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Trigger' {Maybe Text
workflowName :: Maybe Text
$sel:workflowName:Trigger' :: Trigger -> Maybe Text
workflowName} -> Maybe Text
workflowName) (\s :: Trigger
s@Trigger' {} Maybe Text
a -> Trigger
s {$sel:workflowName:Trigger' :: Maybe Text
workflowName = Maybe Text
a} :: Trigger)
trigger_state :: Lens.Lens' Trigger (Prelude.Maybe TriggerState)
trigger_state :: (Maybe TriggerState -> f (Maybe TriggerState))
-> Trigger -> f Trigger
trigger_state = (Trigger -> Maybe TriggerState)
-> (Trigger -> Maybe TriggerState -> Trigger)
-> Lens Trigger Trigger (Maybe TriggerState) (Maybe TriggerState)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Trigger' {Maybe TriggerState
state :: Maybe TriggerState
$sel:state:Trigger' :: Trigger -> Maybe TriggerState
state} -> Maybe TriggerState
state) (\s :: Trigger
s@Trigger' {} Maybe TriggerState
a -> Trigger
s {$sel:state:Trigger' :: Maybe TriggerState
state = Maybe TriggerState
a} :: Trigger)
trigger_actions :: Lens.Lens' Trigger (Prelude.Maybe [Action])
trigger_actions :: (Maybe [Action] -> f (Maybe [Action])) -> Trigger -> f Trigger
trigger_actions = (Trigger -> Maybe [Action])
-> (Trigger -> Maybe [Action] -> Trigger)
-> Lens Trigger Trigger (Maybe [Action]) (Maybe [Action])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Trigger' {Maybe [Action]
actions :: Maybe [Action]
$sel:actions:Trigger' :: Trigger -> Maybe [Action]
actions} -> Maybe [Action]
actions) (\s :: Trigger
s@Trigger' {} Maybe [Action]
a -> Trigger
s {$sel:actions:Trigger' :: Maybe [Action]
actions = Maybe [Action]
a} :: Trigger) ((Maybe [Action] -> f (Maybe [Action])) -> Trigger -> f Trigger)
-> ((Maybe [Action] -> f (Maybe [Action]))
-> Maybe [Action] -> f (Maybe [Action]))
-> (Maybe [Action] -> f (Maybe [Action]))
-> Trigger
-> f Trigger
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Action] [Action] [Action] [Action]
-> Iso
(Maybe [Action]) (Maybe [Action]) (Maybe [Action]) (Maybe [Action])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Action] [Action] [Action] [Action]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
trigger_schedule :: Lens.Lens' Trigger (Prelude.Maybe Prelude.Text)
trigger_schedule :: (Maybe Text -> f (Maybe Text)) -> Trigger -> f Trigger
trigger_schedule = (Trigger -> Maybe Text)
-> (Trigger -> Maybe Text -> Trigger)
-> Lens Trigger Trigger (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Trigger' {Maybe Text
schedule :: Maybe Text
$sel:schedule:Trigger' :: Trigger -> Maybe Text
schedule} -> Maybe Text
schedule) (\s :: Trigger
s@Trigger' {} Maybe Text
a -> Trigger
s {$sel:schedule:Trigger' :: Maybe Text
schedule = Maybe Text
a} :: Trigger)
trigger_predicate :: Lens.Lens' Trigger (Prelude.Maybe Predicate)
trigger_predicate :: (Maybe Predicate -> f (Maybe Predicate)) -> Trigger -> f Trigger
trigger_predicate = (Trigger -> Maybe Predicate)
-> (Trigger -> Maybe Predicate -> Trigger)
-> Lens Trigger Trigger (Maybe Predicate) (Maybe Predicate)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Trigger' {Maybe Predicate
predicate :: Maybe Predicate
$sel:predicate:Trigger' :: Trigger -> Maybe Predicate
predicate} -> Maybe Predicate
predicate) (\s :: Trigger
s@Trigger' {} Maybe Predicate
a -> Trigger
s {$sel:predicate:Trigger' :: Maybe Predicate
predicate = Maybe Predicate
a} :: Trigger)
trigger_name :: Lens.Lens' Trigger (Prelude.Maybe Prelude.Text)
trigger_name :: (Maybe Text -> f (Maybe Text)) -> Trigger -> f Trigger
trigger_name = (Trigger -> Maybe Text)
-> (Trigger -> Maybe Text -> Trigger)
-> Lens Trigger Trigger (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Trigger' {Maybe Text
name :: Maybe Text
$sel:name:Trigger' :: Trigger -> Maybe Text
name} -> Maybe Text
name) (\s :: Trigger
s@Trigger' {} Maybe Text
a -> Trigger
s {$sel:name:Trigger' :: Maybe Text
name = Maybe Text
a} :: Trigger)
trigger_id :: Lens.Lens' Trigger (Prelude.Maybe Prelude.Text)
trigger_id :: (Maybe Text -> f (Maybe Text)) -> Trigger -> f Trigger
trigger_id = (Trigger -> Maybe Text)
-> (Trigger -> Maybe Text -> Trigger)
-> Lens Trigger Trigger (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Trigger' {Maybe Text
id :: Maybe Text
$sel:id:Trigger' :: Trigger -> Maybe Text
id} -> Maybe Text
id) (\s :: Trigger
s@Trigger' {} Maybe Text
a -> Trigger
s {$sel:id:Trigger' :: Maybe Text
id = Maybe Text
a} :: Trigger)
trigger_type :: Lens.Lens' Trigger (Prelude.Maybe TriggerType)
trigger_type :: (Maybe TriggerType -> f (Maybe TriggerType))
-> Trigger -> f Trigger
trigger_type = (Trigger -> Maybe TriggerType)
-> (Trigger -> Maybe TriggerType -> Trigger)
-> Lens Trigger Trigger (Maybe TriggerType) (Maybe TriggerType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Trigger' {Maybe TriggerType
type' :: Maybe TriggerType
$sel:type':Trigger' :: Trigger -> Maybe TriggerType
type'} -> Maybe TriggerType
type') (\s :: Trigger
s@Trigger' {} Maybe TriggerType
a -> Trigger
s {$sel:type':Trigger' :: Maybe TriggerType
type' = Maybe TriggerType
a} :: Trigger)
trigger_eventBatchingCondition :: Lens.Lens' Trigger (Prelude.Maybe EventBatchingCondition)
trigger_eventBatchingCondition :: (Maybe EventBatchingCondition -> f (Maybe EventBatchingCondition))
-> Trigger -> f Trigger
trigger_eventBatchingCondition = (Trigger -> Maybe EventBatchingCondition)
-> (Trigger -> Maybe EventBatchingCondition -> Trigger)
-> Lens
Trigger
Trigger
(Maybe EventBatchingCondition)
(Maybe EventBatchingCondition)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Trigger' {Maybe EventBatchingCondition
eventBatchingCondition :: Maybe EventBatchingCondition
$sel:eventBatchingCondition:Trigger' :: Trigger -> Maybe EventBatchingCondition
eventBatchingCondition} -> Maybe EventBatchingCondition
eventBatchingCondition) (\s :: Trigger
s@Trigger' {} Maybe EventBatchingCondition
a -> Trigger
s {$sel:eventBatchingCondition:Trigger' :: Maybe EventBatchingCondition
eventBatchingCondition = Maybe EventBatchingCondition
a} :: Trigger)
trigger_description :: Lens.Lens' Trigger (Prelude.Maybe Prelude.Text)
trigger_description :: (Maybe Text -> f (Maybe Text)) -> Trigger -> f Trigger
trigger_description = (Trigger -> Maybe Text)
-> (Trigger -> Maybe Text -> Trigger)
-> Lens Trigger Trigger (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Trigger' {Maybe Text
description :: Maybe Text
$sel:description:Trigger' :: Trigger -> Maybe Text
description} -> Maybe Text
description) (\s :: Trigger
s@Trigger' {} Maybe Text
a -> Trigger
s {$sel:description:Trigger' :: Maybe Text
description = Maybe Text
a} :: Trigger)
instance Core.FromJSON Trigger where
parseJSON :: Value -> Parser Trigger
parseJSON =
String -> (Object -> Parser Trigger) -> Value -> Parser Trigger
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Trigger"
( \Object
x ->
Maybe Text
-> Maybe TriggerState
-> Maybe [Action]
-> Maybe Text
-> Maybe Predicate
-> Maybe Text
-> Maybe Text
-> Maybe TriggerType
-> Maybe EventBatchingCondition
-> Maybe Text
-> Trigger
Trigger'
(Maybe Text
-> Maybe TriggerState
-> Maybe [Action]
-> Maybe Text
-> Maybe Predicate
-> Maybe Text
-> Maybe Text
-> Maybe TriggerType
-> Maybe EventBatchingCondition
-> Maybe Text
-> Trigger)
-> Parser (Maybe Text)
-> Parser
(Maybe TriggerState
-> Maybe [Action]
-> Maybe Text
-> Maybe Predicate
-> Maybe Text
-> Maybe Text
-> Maybe TriggerType
-> Maybe EventBatchingCondition
-> Maybe Text
-> Trigger)
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
"WorkflowName")
Parser
(Maybe TriggerState
-> Maybe [Action]
-> Maybe Text
-> Maybe Predicate
-> Maybe Text
-> Maybe Text
-> Maybe TriggerType
-> Maybe EventBatchingCondition
-> Maybe Text
-> Trigger)
-> Parser (Maybe TriggerState)
-> Parser
(Maybe [Action]
-> Maybe Text
-> Maybe Predicate
-> Maybe Text
-> Maybe Text
-> Maybe TriggerType
-> Maybe EventBatchingCondition
-> Maybe Text
-> Trigger)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe TriggerState)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"State")
Parser
(Maybe [Action]
-> Maybe Text
-> Maybe Predicate
-> Maybe Text
-> Maybe Text
-> Maybe TriggerType
-> Maybe EventBatchingCondition
-> Maybe Text
-> Trigger)
-> Parser (Maybe [Action])
-> Parser
(Maybe Text
-> Maybe Predicate
-> Maybe Text
-> Maybe Text
-> Maybe TriggerType
-> Maybe EventBatchingCondition
-> Maybe Text
-> Trigger)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Action]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Actions" Parser (Maybe (Maybe [Action]))
-> Maybe [Action] -> Parser (Maybe [Action])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Action]
forall a. Monoid a => a
Prelude.mempty)
Parser
(Maybe Text
-> Maybe Predicate
-> Maybe Text
-> Maybe Text
-> Maybe TriggerType
-> Maybe EventBatchingCondition
-> Maybe Text
-> Trigger)
-> Parser (Maybe Text)
-> Parser
(Maybe Predicate
-> Maybe Text
-> Maybe Text
-> Maybe TriggerType
-> Maybe EventBatchingCondition
-> Maybe Text
-> Trigger)
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
"Schedule")
Parser
(Maybe Predicate
-> Maybe Text
-> Maybe Text
-> Maybe TriggerType
-> Maybe EventBatchingCondition
-> Maybe Text
-> Trigger)
-> Parser (Maybe Predicate)
-> Parser
(Maybe Text
-> Maybe Text
-> Maybe TriggerType
-> Maybe EventBatchingCondition
-> Maybe Text
-> Trigger)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Predicate)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Predicate")
Parser
(Maybe Text
-> Maybe Text
-> Maybe TriggerType
-> Maybe EventBatchingCondition
-> Maybe Text
-> Trigger)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe TriggerType
-> Maybe EventBatchingCondition
-> Maybe Text
-> Trigger)
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 TriggerType
-> Maybe EventBatchingCondition
-> Maybe Text
-> Trigger)
-> Parser (Maybe Text)
-> Parser
(Maybe TriggerType
-> Maybe EventBatchingCondition -> Maybe Text -> Trigger)
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
"Id")
Parser
(Maybe TriggerType
-> Maybe EventBatchingCondition -> Maybe Text -> Trigger)
-> Parser (Maybe TriggerType)
-> Parser (Maybe EventBatchingCondition -> Maybe Text -> Trigger)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe TriggerType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Type")
Parser (Maybe EventBatchingCondition -> Maybe Text -> Trigger)
-> Parser (Maybe EventBatchingCondition)
-> Parser (Maybe Text -> Trigger)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe EventBatchingCondition)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"EventBatchingCondition")
Parser (Maybe Text -> Trigger)
-> Parser (Maybe Text) -> Parser Trigger
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")
)
instance Prelude.Hashable Trigger
instance Prelude.NFData Trigger