{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Glue.Types.JobNodeDetails
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Glue.Types.JobNodeDetails where

import qualified Amazonka.Core as Core
import Amazonka.Glue.Types.JobRun
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The details of a Job node present in the workflow.
--
-- /See:/ 'newJobNodeDetails' smart constructor.
data JobNodeDetails = JobNodeDetails'
  { -- | The information for the job runs represented by the job node.
    JobNodeDetails -> Maybe [JobRun]
jobRuns :: Prelude.Maybe [JobRun]
  }
  deriving (JobNodeDetails -> JobNodeDetails -> Bool
(JobNodeDetails -> JobNodeDetails -> Bool)
-> (JobNodeDetails -> JobNodeDetails -> Bool) -> Eq JobNodeDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: JobNodeDetails -> JobNodeDetails -> Bool
$c/= :: JobNodeDetails -> JobNodeDetails -> Bool
== :: JobNodeDetails -> JobNodeDetails -> Bool
$c== :: JobNodeDetails -> JobNodeDetails -> Bool
Prelude.Eq, ReadPrec [JobNodeDetails]
ReadPrec JobNodeDetails
Int -> ReadS JobNodeDetails
ReadS [JobNodeDetails]
(Int -> ReadS JobNodeDetails)
-> ReadS [JobNodeDetails]
-> ReadPrec JobNodeDetails
-> ReadPrec [JobNodeDetails]
-> Read JobNodeDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [JobNodeDetails]
$creadListPrec :: ReadPrec [JobNodeDetails]
readPrec :: ReadPrec JobNodeDetails
$creadPrec :: ReadPrec JobNodeDetails
readList :: ReadS [JobNodeDetails]
$creadList :: ReadS [JobNodeDetails]
readsPrec :: Int -> ReadS JobNodeDetails
$creadsPrec :: Int -> ReadS JobNodeDetails
Prelude.Read, Int -> JobNodeDetails -> ShowS
[JobNodeDetails] -> ShowS
JobNodeDetails -> String
(Int -> JobNodeDetails -> ShowS)
-> (JobNodeDetails -> String)
-> ([JobNodeDetails] -> ShowS)
-> Show JobNodeDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [JobNodeDetails] -> ShowS
$cshowList :: [JobNodeDetails] -> ShowS
show :: JobNodeDetails -> String
$cshow :: JobNodeDetails -> String
showsPrec :: Int -> JobNodeDetails -> ShowS
$cshowsPrec :: Int -> JobNodeDetails -> ShowS
Prelude.Show, (forall x. JobNodeDetails -> Rep JobNodeDetails x)
-> (forall x. Rep JobNodeDetails x -> JobNodeDetails)
-> Generic JobNodeDetails
forall x. Rep JobNodeDetails x -> JobNodeDetails
forall x. JobNodeDetails -> Rep JobNodeDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep JobNodeDetails x -> JobNodeDetails
$cfrom :: forall x. JobNodeDetails -> Rep JobNodeDetails x
Prelude.Generic)

-- |
-- Create a value of 'JobNodeDetails' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'jobRuns', 'jobNodeDetails_jobRuns' - The information for the job runs represented by the job node.
newJobNodeDetails ::
  JobNodeDetails
newJobNodeDetails :: JobNodeDetails
newJobNodeDetails =
  JobNodeDetails' :: Maybe [JobRun] -> JobNodeDetails
JobNodeDetails' {$sel:jobRuns:JobNodeDetails' :: Maybe [JobRun]
jobRuns = Maybe [JobRun]
forall a. Maybe a
Prelude.Nothing}

-- | The information for the job runs represented by the job node.
jobNodeDetails_jobRuns :: Lens.Lens' JobNodeDetails (Prelude.Maybe [JobRun])
jobNodeDetails_jobRuns :: (Maybe [JobRun] -> f (Maybe [JobRun]))
-> JobNodeDetails -> f JobNodeDetails
jobNodeDetails_jobRuns = (JobNodeDetails -> Maybe [JobRun])
-> (JobNodeDetails -> Maybe [JobRun] -> JobNodeDetails)
-> Lens
     JobNodeDetails JobNodeDetails (Maybe [JobRun]) (Maybe [JobRun])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobNodeDetails' {Maybe [JobRun]
jobRuns :: Maybe [JobRun]
$sel:jobRuns:JobNodeDetails' :: JobNodeDetails -> Maybe [JobRun]
jobRuns} -> Maybe [JobRun]
jobRuns) (\s :: JobNodeDetails
s@JobNodeDetails' {} Maybe [JobRun]
a -> JobNodeDetails
s {$sel:jobRuns:JobNodeDetails' :: Maybe [JobRun]
jobRuns = Maybe [JobRun]
a} :: JobNodeDetails) ((Maybe [JobRun] -> f (Maybe [JobRun]))
 -> JobNodeDetails -> f JobNodeDetails)
-> ((Maybe [JobRun] -> f (Maybe [JobRun]))
    -> Maybe [JobRun] -> f (Maybe [JobRun]))
-> (Maybe [JobRun] -> f (Maybe [JobRun]))
-> JobNodeDetails
-> f JobNodeDetails
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [JobRun] [JobRun] [JobRun] [JobRun]
-> Iso
     (Maybe [JobRun]) (Maybe [JobRun]) (Maybe [JobRun]) (Maybe [JobRun])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [JobRun] [JobRun] [JobRun] [JobRun]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON JobNodeDetails where
  parseJSON :: Value -> Parser JobNodeDetails
parseJSON =
    String
-> (Object -> Parser JobNodeDetails)
-> Value
-> Parser JobNodeDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"JobNodeDetails"
      ( \Object
x ->
          Maybe [JobRun] -> JobNodeDetails
JobNodeDetails'
            (Maybe [JobRun] -> JobNodeDetails)
-> Parser (Maybe [JobRun]) -> Parser JobNodeDetails
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe [JobRun]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"JobRuns" Parser (Maybe (Maybe [JobRun]))
-> Maybe [JobRun] -> Parser (Maybe [JobRun])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [JobRun]
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable JobNodeDetails

instance Prelude.NFData JobNodeDetails