{-# 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.AppFlow.Types.TriggerProperties where
import Amazonka.AppFlow.Types.ScheduledTriggerProperties
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data TriggerProperties = TriggerProperties'
{
TriggerProperties -> Maybe ScheduledTriggerProperties
scheduled :: Prelude.Maybe ScheduledTriggerProperties
}
deriving (TriggerProperties -> TriggerProperties -> Bool
(TriggerProperties -> TriggerProperties -> Bool)
-> (TriggerProperties -> TriggerProperties -> Bool)
-> Eq TriggerProperties
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TriggerProperties -> TriggerProperties -> Bool
$c/= :: TriggerProperties -> TriggerProperties -> Bool
== :: TriggerProperties -> TriggerProperties -> Bool
$c== :: TriggerProperties -> TriggerProperties -> Bool
Prelude.Eq, ReadPrec [TriggerProperties]
ReadPrec TriggerProperties
Int -> ReadS TriggerProperties
ReadS [TriggerProperties]
(Int -> ReadS TriggerProperties)
-> ReadS [TriggerProperties]
-> ReadPrec TriggerProperties
-> ReadPrec [TriggerProperties]
-> Read TriggerProperties
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TriggerProperties]
$creadListPrec :: ReadPrec [TriggerProperties]
readPrec :: ReadPrec TriggerProperties
$creadPrec :: ReadPrec TriggerProperties
readList :: ReadS [TriggerProperties]
$creadList :: ReadS [TriggerProperties]
readsPrec :: Int -> ReadS TriggerProperties
$creadsPrec :: Int -> ReadS TriggerProperties
Prelude.Read, Int -> TriggerProperties -> ShowS
[TriggerProperties] -> ShowS
TriggerProperties -> String
(Int -> TriggerProperties -> ShowS)
-> (TriggerProperties -> String)
-> ([TriggerProperties] -> ShowS)
-> Show TriggerProperties
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TriggerProperties] -> ShowS
$cshowList :: [TriggerProperties] -> ShowS
show :: TriggerProperties -> String
$cshow :: TriggerProperties -> String
showsPrec :: Int -> TriggerProperties -> ShowS
$cshowsPrec :: Int -> TriggerProperties -> ShowS
Prelude.Show, (forall x. TriggerProperties -> Rep TriggerProperties x)
-> (forall x. Rep TriggerProperties x -> TriggerProperties)
-> Generic TriggerProperties
forall x. Rep TriggerProperties x -> TriggerProperties
forall x. TriggerProperties -> Rep TriggerProperties x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TriggerProperties x -> TriggerProperties
$cfrom :: forall x. TriggerProperties -> Rep TriggerProperties x
Prelude.Generic)
newTriggerProperties ::
TriggerProperties
newTriggerProperties :: TriggerProperties
newTriggerProperties =
TriggerProperties' :: Maybe ScheduledTriggerProperties -> TriggerProperties
TriggerProperties' {$sel:scheduled:TriggerProperties' :: Maybe ScheduledTriggerProperties
scheduled = Maybe ScheduledTriggerProperties
forall a. Maybe a
Prelude.Nothing}
triggerProperties_scheduled :: Lens.Lens' TriggerProperties (Prelude.Maybe ScheduledTriggerProperties)
triggerProperties_scheduled :: (Maybe ScheduledTriggerProperties
-> f (Maybe ScheduledTriggerProperties))
-> TriggerProperties -> f TriggerProperties
triggerProperties_scheduled = (TriggerProperties -> Maybe ScheduledTriggerProperties)
-> (TriggerProperties
-> Maybe ScheduledTriggerProperties -> TriggerProperties)
-> Lens
TriggerProperties
TriggerProperties
(Maybe ScheduledTriggerProperties)
(Maybe ScheduledTriggerProperties)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TriggerProperties' {Maybe ScheduledTriggerProperties
scheduled :: Maybe ScheduledTriggerProperties
$sel:scheduled:TriggerProperties' :: TriggerProperties -> Maybe ScheduledTriggerProperties
scheduled} -> Maybe ScheduledTriggerProperties
scheduled) (\s :: TriggerProperties
s@TriggerProperties' {} Maybe ScheduledTriggerProperties
a -> TriggerProperties
s {$sel:scheduled:TriggerProperties' :: Maybe ScheduledTriggerProperties
scheduled = Maybe ScheduledTriggerProperties
a} :: TriggerProperties)
instance Core.FromJSON TriggerProperties where
parseJSON :: Value -> Parser TriggerProperties
parseJSON =
String
-> (Object -> Parser TriggerProperties)
-> Value
-> Parser TriggerProperties
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"TriggerProperties"
( \Object
x ->
Maybe ScheduledTriggerProperties -> TriggerProperties
TriggerProperties'
(Maybe ScheduledTriggerProperties -> TriggerProperties)
-> Parser (Maybe ScheduledTriggerProperties)
-> Parser TriggerProperties
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ScheduledTriggerProperties)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Scheduled")
)
instance Prelude.Hashable TriggerProperties
instance Prelude.NFData TriggerProperties
instance Core.ToJSON TriggerProperties where
toJSON :: TriggerProperties -> Value
toJSON TriggerProperties' {Maybe ScheduledTriggerProperties
scheduled :: Maybe ScheduledTriggerProperties
$sel:scheduled:TriggerProperties' :: TriggerProperties -> Maybe ScheduledTriggerProperties
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[(Text
"Scheduled" Text -> ScheduledTriggerProperties -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ScheduledTriggerProperties -> Pair)
-> Maybe ScheduledTriggerProperties -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ScheduledTriggerProperties
scheduled]
)