{-# 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.ActivityType where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data ActivityType = ActivityType'
{
ActivityType -> Text
name :: Prelude.Text,
ActivityType -> Text
version :: Prelude.Text
}
deriving (ActivityType -> ActivityType -> Bool
(ActivityType -> ActivityType -> Bool)
-> (ActivityType -> ActivityType -> Bool) -> Eq ActivityType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ActivityType -> ActivityType -> Bool
$c/= :: ActivityType -> ActivityType -> Bool
== :: ActivityType -> ActivityType -> Bool
$c== :: ActivityType -> ActivityType -> Bool
Prelude.Eq, ReadPrec [ActivityType]
ReadPrec ActivityType
Int -> ReadS ActivityType
ReadS [ActivityType]
(Int -> ReadS ActivityType)
-> ReadS [ActivityType]
-> ReadPrec ActivityType
-> ReadPrec [ActivityType]
-> Read ActivityType
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ActivityType]
$creadListPrec :: ReadPrec [ActivityType]
readPrec :: ReadPrec ActivityType
$creadPrec :: ReadPrec ActivityType
readList :: ReadS [ActivityType]
$creadList :: ReadS [ActivityType]
readsPrec :: Int -> ReadS ActivityType
$creadsPrec :: Int -> ReadS ActivityType
Prelude.Read, Int -> ActivityType -> ShowS
[ActivityType] -> ShowS
ActivityType -> String
(Int -> ActivityType -> ShowS)
-> (ActivityType -> String)
-> ([ActivityType] -> ShowS)
-> Show ActivityType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ActivityType] -> ShowS
$cshowList :: [ActivityType] -> ShowS
show :: ActivityType -> String
$cshow :: ActivityType -> String
showsPrec :: Int -> ActivityType -> ShowS
$cshowsPrec :: Int -> ActivityType -> ShowS
Prelude.Show, (forall x. ActivityType -> Rep ActivityType x)
-> (forall x. Rep ActivityType x -> ActivityType)
-> Generic ActivityType
forall x. Rep ActivityType x -> ActivityType
forall x. ActivityType -> Rep ActivityType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ActivityType x -> ActivityType
$cfrom :: forall x. ActivityType -> Rep ActivityType x
Prelude.Generic)
newActivityType ::
Prelude.Text ->
Prelude.Text ->
ActivityType
newActivityType :: Text -> Text -> ActivityType
newActivityType Text
pName_ Text
pVersion_ =
ActivityType' :: Text -> Text -> ActivityType
ActivityType' {$sel:name:ActivityType' :: Text
name = Text
pName_, $sel:version:ActivityType' :: Text
version = Text
pVersion_}
activityType_name :: Lens.Lens' ActivityType Prelude.Text
activityType_name :: (Text -> f Text) -> ActivityType -> f ActivityType
activityType_name = (ActivityType -> Text)
-> (ActivityType -> Text -> ActivityType)
-> Lens ActivityType ActivityType Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActivityType' {Text
name :: Text
$sel:name:ActivityType' :: ActivityType -> Text
name} -> Text
name) (\s :: ActivityType
s@ActivityType' {} Text
a -> ActivityType
s {$sel:name:ActivityType' :: Text
name = Text
a} :: ActivityType)
activityType_version :: Lens.Lens' ActivityType Prelude.Text
activityType_version :: (Text -> f Text) -> ActivityType -> f ActivityType
activityType_version = (ActivityType -> Text)
-> (ActivityType -> Text -> ActivityType)
-> Lens ActivityType ActivityType Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActivityType' {Text
version :: Text
$sel:version:ActivityType' :: ActivityType -> Text
version} -> Text
version) (\s :: ActivityType
s@ActivityType' {} Text
a -> ActivityType
s {$sel:version:ActivityType' :: Text
version = Text
a} :: ActivityType)
instance Core.FromJSON ActivityType where
parseJSON :: Value -> Parser ActivityType
parseJSON =
String
-> (Object -> Parser ActivityType) -> Value -> Parser ActivityType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ActivityType"
( \Object
x ->
Text -> Text -> ActivityType
ActivityType'
(Text -> Text -> ActivityType)
-> Parser Text -> Parser (Text -> ActivityType)
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 -> ActivityType) -> Parser Text -> Parser ActivityType
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 ActivityType
instance Prelude.NFData ActivityType
instance Core.ToJSON ActivityType where
toJSON :: ActivityType -> Value
toJSON ActivityType' {Text
version :: Text
name :: Text
$sel:version:ActivityType' :: ActivityType -> Text
$sel:name:ActivityType' :: ActivityType -> 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)
]
)