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