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