{-# 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.CustomerProfiles.Types.FlowDefinition where
import qualified Amazonka.Core as Core
import Amazonka.CustomerProfiles.Types.SourceFlowConfig
import Amazonka.CustomerProfiles.Types.Task
import Amazonka.CustomerProfiles.Types.TriggerConfig
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data FlowDefinition = FlowDefinition'
{
FlowDefinition -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
FlowDefinition -> Text
flowName :: Prelude.Text,
FlowDefinition -> Text
kmsArn :: Prelude.Text,
FlowDefinition -> SourceFlowConfig
sourceFlowConfig :: SourceFlowConfig,
FlowDefinition -> [Task]
tasks :: [Task],
FlowDefinition -> TriggerConfig
triggerConfig :: TriggerConfig
}
deriving (FlowDefinition -> FlowDefinition -> Bool
(FlowDefinition -> FlowDefinition -> Bool)
-> (FlowDefinition -> FlowDefinition -> Bool) -> Eq FlowDefinition
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FlowDefinition -> FlowDefinition -> Bool
$c/= :: FlowDefinition -> FlowDefinition -> Bool
== :: FlowDefinition -> FlowDefinition -> Bool
$c== :: FlowDefinition -> FlowDefinition -> Bool
Prelude.Eq, ReadPrec [FlowDefinition]
ReadPrec FlowDefinition
Int -> ReadS FlowDefinition
ReadS [FlowDefinition]
(Int -> ReadS FlowDefinition)
-> ReadS [FlowDefinition]
-> ReadPrec FlowDefinition
-> ReadPrec [FlowDefinition]
-> Read FlowDefinition
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FlowDefinition]
$creadListPrec :: ReadPrec [FlowDefinition]
readPrec :: ReadPrec FlowDefinition
$creadPrec :: ReadPrec FlowDefinition
readList :: ReadS [FlowDefinition]
$creadList :: ReadS [FlowDefinition]
readsPrec :: Int -> ReadS FlowDefinition
$creadsPrec :: Int -> ReadS FlowDefinition
Prelude.Read, Int -> FlowDefinition -> ShowS
[FlowDefinition] -> ShowS
FlowDefinition -> String
(Int -> FlowDefinition -> ShowS)
-> (FlowDefinition -> String)
-> ([FlowDefinition] -> ShowS)
-> Show FlowDefinition
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FlowDefinition] -> ShowS
$cshowList :: [FlowDefinition] -> ShowS
show :: FlowDefinition -> String
$cshow :: FlowDefinition -> String
showsPrec :: Int -> FlowDefinition -> ShowS
$cshowsPrec :: Int -> FlowDefinition -> ShowS
Prelude.Show, (forall x. FlowDefinition -> Rep FlowDefinition x)
-> (forall x. Rep FlowDefinition x -> FlowDefinition)
-> Generic FlowDefinition
forall x. Rep FlowDefinition x -> FlowDefinition
forall x. FlowDefinition -> Rep FlowDefinition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FlowDefinition x -> FlowDefinition
$cfrom :: forall x. FlowDefinition -> Rep FlowDefinition x
Prelude.Generic)
newFlowDefinition ::
Prelude.Text ->
Prelude.Text ->
SourceFlowConfig ->
TriggerConfig ->
FlowDefinition
newFlowDefinition :: Text -> Text -> SourceFlowConfig -> TriggerConfig -> FlowDefinition
newFlowDefinition
Text
pFlowName_
Text
pKmsArn_
SourceFlowConfig
pSourceFlowConfig_
TriggerConfig
pTriggerConfig_ =
FlowDefinition' :: Maybe Text
-> Text
-> Text
-> SourceFlowConfig
-> [Task]
-> TriggerConfig
-> FlowDefinition
FlowDefinition'
{ $sel:description:FlowDefinition' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:flowName:FlowDefinition' :: Text
flowName = Text
pFlowName_,
$sel:kmsArn:FlowDefinition' :: Text
kmsArn = Text
pKmsArn_,
$sel:sourceFlowConfig:FlowDefinition' :: SourceFlowConfig
sourceFlowConfig = SourceFlowConfig
pSourceFlowConfig_,
$sel:tasks:FlowDefinition' :: [Task]
tasks = [Task]
forall a. Monoid a => a
Prelude.mempty,
$sel:triggerConfig:FlowDefinition' :: TriggerConfig
triggerConfig = TriggerConfig
pTriggerConfig_
}
flowDefinition_description :: Lens.Lens' FlowDefinition (Prelude.Maybe Prelude.Text)
flowDefinition_description :: (Maybe Text -> f (Maybe Text))
-> FlowDefinition -> f FlowDefinition
flowDefinition_description = (FlowDefinition -> Maybe Text)
-> (FlowDefinition -> Maybe Text -> FlowDefinition)
-> Lens FlowDefinition FlowDefinition (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FlowDefinition' {Maybe Text
description :: Maybe Text
$sel:description:FlowDefinition' :: FlowDefinition -> Maybe Text
description} -> Maybe Text
description) (\s :: FlowDefinition
s@FlowDefinition' {} Maybe Text
a -> FlowDefinition
s {$sel:description:FlowDefinition' :: Maybe Text
description = Maybe Text
a} :: FlowDefinition)
flowDefinition_flowName :: Lens.Lens' FlowDefinition Prelude.Text
flowDefinition_flowName :: (Text -> f Text) -> FlowDefinition -> f FlowDefinition
flowDefinition_flowName = (FlowDefinition -> Text)
-> (FlowDefinition -> Text -> FlowDefinition)
-> Lens FlowDefinition FlowDefinition Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FlowDefinition' {Text
flowName :: Text
$sel:flowName:FlowDefinition' :: FlowDefinition -> Text
flowName} -> Text
flowName) (\s :: FlowDefinition
s@FlowDefinition' {} Text
a -> FlowDefinition
s {$sel:flowName:FlowDefinition' :: Text
flowName = Text
a} :: FlowDefinition)
flowDefinition_kmsArn :: Lens.Lens' FlowDefinition Prelude.Text
flowDefinition_kmsArn :: (Text -> f Text) -> FlowDefinition -> f FlowDefinition
flowDefinition_kmsArn = (FlowDefinition -> Text)
-> (FlowDefinition -> Text -> FlowDefinition)
-> Lens FlowDefinition FlowDefinition Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FlowDefinition' {Text
kmsArn :: Text
$sel:kmsArn:FlowDefinition' :: FlowDefinition -> Text
kmsArn} -> Text
kmsArn) (\s :: FlowDefinition
s@FlowDefinition' {} Text
a -> FlowDefinition
s {$sel:kmsArn:FlowDefinition' :: Text
kmsArn = Text
a} :: FlowDefinition)
flowDefinition_sourceFlowConfig :: Lens.Lens' FlowDefinition SourceFlowConfig
flowDefinition_sourceFlowConfig :: (SourceFlowConfig -> f SourceFlowConfig)
-> FlowDefinition -> f FlowDefinition
flowDefinition_sourceFlowConfig = (FlowDefinition -> SourceFlowConfig)
-> (FlowDefinition -> SourceFlowConfig -> FlowDefinition)
-> Lens
FlowDefinition FlowDefinition SourceFlowConfig SourceFlowConfig
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FlowDefinition' {SourceFlowConfig
sourceFlowConfig :: SourceFlowConfig
$sel:sourceFlowConfig:FlowDefinition' :: FlowDefinition -> SourceFlowConfig
sourceFlowConfig} -> SourceFlowConfig
sourceFlowConfig) (\s :: FlowDefinition
s@FlowDefinition' {} SourceFlowConfig
a -> FlowDefinition
s {$sel:sourceFlowConfig:FlowDefinition' :: SourceFlowConfig
sourceFlowConfig = SourceFlowConfig
a} :: FlowDefinition)
flowDefinition_tasks :: Lens.Lens' FlowDefinition [Task]
flowDefinition_tasks :: ([Task] -> f [Task]) -> FlowDefinition -> f FlowDefinition
flowDefinition_tasks = (FlowDefinition -> [Task])
-> (FlowDefinition -> [Task] -> FlowDefinition)
-> Lens FlowDefinition FlowDefinition [Task] [Task]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FlowDefinition' {[Task]
tasks :: [Task]
$sel:tasks:FlowDefinition' :: FlowDefinition -> [Task]
tasks} -> [Task]
tasks) (\s :: FlowDefinition
s@FlowDefinition' {} [Task]
a -> FlowDefinition
s {$sel:tasks:FlowDefinition' :: [Task]
tasks = [Task]
a} :: FlowDefinition) (([Task] -> f [Task]) -> FlowDefinition -> f FlowDefinition)
-> (([Task] -> f [Task]) -> [Task] -> f [Task])
-> ([Task] -> f [Task])
-> FlowDefinition
-> f FlowDefinition
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Task] -> f [Task]) -> [Task] -> f [Task]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
flowDefinition_triggerConfig :: Lens.Lens' FlowDefinition TriggerConfig
flowDefinition_triggerConfig :: (TriggerConfig -> f TriggerConfig)
-> FlowDefinition -> f FlowDefinition
flowDefinition_triggerConfig = (FlowDefinition -> TriggerConfig)
-> (FlowDefinition -> TriggerConfig -> FlowDefinition)
-> Lens FlowDefinition FlowDefinition TriggerConfig TriggerConfig
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FlowDefinition' {TriggerConfig
triggerConfig :: TriggerConfig
$sel:triggerConfig:FlowDefinition' :: FlowDefinition -> TriggerConfig
triggerConfig} -> TriggerConfig
triggerConfig) (\s :: FlowDefinition
s@FlowDefinition' {} TriggerConfig
a -> FlowDefinition
s {$sel:triggerConfig:FlowDefinition' :: TriggerConfig
triggerConfig = TriggerConfig
a} :: FlowDefinition)
instance Prelude.Hashable FlowDefinition
instance Prelude.NFData FlowDefinition
instance Core.ToJSON FlowDefinition where
toJSON :: FlowDefinition -> Value
toJSON FlowDefinition' {[Task]
Maybe Text
Text
TriggerConfig
SourceFlowConfig
triggerConfig :: TriggerConfig
tasks :: [Task]
sourceFlowConfig :: SourceFlowConfig
kmsArn :: Text
flowName :: Text
description :: Maybe Text
$sel:triggerConfig:FlowDefinition' :: FlowDefinition -> TriggerConfig
$sel:tasks:FlowDefinition' :: FlowDefinition -> [Task]
$sel:sourceFlowConfig:FlowDefinition' :: FlowDefinition -> SourceFlowConfig
$sel:kmsArn:FlowDefinition' :: FlowDefinition -> Text
$sel:flowName:FlowDefinition' :: FlowDefinition -> Text
$sel:description:FlowDefinition' :: FlowDefinition -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Description" 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
description,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"FlowName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
flowName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"KmsArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
kmsArn),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"SourceFlowConfig" Text -> SourceFlowConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= SourceFlowConfig
sourceFlowConfig),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Tasks" Text -> [Task] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Task]
tasks),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"TriggerConfig" Text -> TriggerConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= TriggerConfig
triggerConfig)
]
)