{-# 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.IoT.Types.JobExecutionSummaryForJob
-- 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.IoT.Types.JobExecutionSummaryForJob where

import qualified Amazonka.Core as Core
import Amazonka.IoT.Types.JobExecutionSummary
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Contains a summary of information about job executions for a specific
-- job.
--
-- /See:/ 'newJobExecutionSummaryForJob' smart constructor.
data JobExecutionSummaryForJob = JobExecutionSummaryForJob'
  { -- | Contains a subset of information about a job execution.
    JobExecutionSummaryForJob -> Maybe JobExecutionSummary
jobExecutionSummary :: Prelude.Maybe JobExecutionSummary,
    -- | The ARN of the thing on which the job execution is running.
    JobExecutionSummaryForJob -> Maybe Text
thingArn :: Prelude.Maybe Prelude.Text
  }
  deriving (JobExecutionSummaryForJob -> JobExecutionSummaryForJob -> Bool
(JobExecutionSummaryForJob -> JobExecutionSummaryForJob -> Bool)
-> (JobExecutionSummaryForJob -> JobExecutionSummaryForJob -> Bool)
-> Eq JobExecutionSummaryForJob
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: JobExecutionSummaryForJob -> JobExecutionSummaryForJob -> Bool
$c/= :: JobExecutionSummaryForJob -> JobExecutionSummaryForJob -> Bool
== :: JobExecutionSummaryForJob -> JobExecutionSummaryForJob -> Bool
$c== :: JobExecutionSummaryForJob -> JobExecutionSummaryForJob -> Bool
Prelude.Eq, ReadPrec [JobExecutionSummaryForJob]
ReadPrec JobExecutionSummaryForJob
Int -> ReadS JobExecutionSummaryForJob
ReadS [JobExecutionSummaryForJob]
(Int -> ReadS JobExecutionSummaryForJob)
-> ReadS [JobExecutionSummaryForJob]
-> ReadPrec JobExecutionSummaryForJob
-> ReadPrec [JobExecutionSummaryForJob]
-> Read JobExecutionSummaryForJob
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [JobExecutionSummaryForJob]
$creadListPrec :: ReadPrec [JobExecutionSummaryForJob]
readPrec :: ReadPrec JobExecutionSummaryForJob
$creadPrec :: ReadPrec JobExecutionSummaryForJob
readList :: ReadS [JobExecutionSummaryForJob]
$creadList :: ReadS [JobExecutionSummaryForJob]
readsPrec :: Int -> ReadS JobExecutionSummaryForJob
$creadsPrec :: Int -> ReadS JobExecutionSummaryForJob
Prelude.Read, Int -> JobExecutionSummaryForJob -> ShowS
[JobExecutionSummaryForJob] -> ShowS
JobExecutionSummaryForJob -> String
(Int -> JobExecutionSummaryForJob -> ShowS)
-> (JobExecutionSummaryForJob -> String)
-> ([JobExecutionSummaryForJob] -> ShowS)
-> Show JobExecutionSummaryForJob
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [JobExecutionSummaryForJob] -> ShowS
$cshowList :: [JobExecutionSummaryForJob] -> ShowS
show :: JobExecutionSummaryForJob -> String
$cshow :: JobExecutionSummaryForJob -> String
showsPrec :: Int -> JobExecutionSummaryForJob -> ShowS
$cshowsPrec :: Int -> JobExecutionSummaryForJob -> ShowS
Prelude.Show, (forall x.
 JobExecutionSummaryForJob -> Rep JobExecutionSummaryForJob x)
-> (forall x.
    Rep JobExecutionSummaryForJob x -> JobExecutionSummaryForJob)
-> Generic JobExecutionSummaryForJob
forall x.
Rep JobExecutionSummaryForJob x -> JobExecutionSummaryForJob
forall x.
JobExecutionSummaryForJob -> Rep JobExecutionSummaryForJob x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep JobExecutionSummaryForJob x -> JobExecutionSummaryForJob
$cfrom :: forall x.
JobExecutionSummaryForJob -> Rep JobExecutionSummaryForJob x
Prelude.Generic)

-- |
-- Create a value of 'JobExecutionSummaryForJob' 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:
--
-- 'jobExecutionSummary', 'jobExecutionSummaryForJob_jobExecutionSummary' - Contains a subset of information about a job execution.
--
-- 'thingArn', 'jobExecutionSummaryForJob_thingArn' - The ARN of the thing on which the job execution is running.
newJobExecutionSummaryForJob ::
  JobExecutionSummaryForJob
newJobExecutionSummaryForJob :: JobExecutionSummaryForJob
newJobExecutionSummaryForJob =
  JobExecutionSummaryForJob' :: Maybe JobExecutionSummary
-> Maybe Text -> JobExecutionSummaryForJob
JobExecutionSummaryForJob'
    { $sel:jobExecutionSummary:JobExecutionSummaryForJob' :: Maybe JobExecutionSummary
jobExecutionSummary =
        Maybe JobExecutionSummary
forall a. Maybe a
Prelude.Nothing,
      $sel:thingArn:JobExecutionSummaryForJob' :: Maybe Text
thingArn = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Contains a subset of information about a job execution.
jobExecutionSummaryForJob_jobExecutionSummary :: Lens.Lens' JobExecutionSummaryForJob (Prelude.Maybe JobExecutionSummary)
jobExecutionSummaryForJob_jobExecutionSummary :: (Maybe JobExecutionSummary -> f (Maybe JobExecutionSummary))
-> JobExecutionSummaryForJob -> f JobExecutionSummaryForJob
jobExecutionSummaryForJob_jobExecutionSummary = (JobExecutionSummaryForJob -> Maybe JobExecutionSummary)
-> (JobExecutionSummaryForJob
    -> Maybe JobExecutionSummary -> JobExecutionSummaryForJob)
-> Lens
     JobExecutionSummaryForJob
     JobExecutionSummaryForJob
     (Maybe JobExecutionSummary)
     (Maybe JobExecutionSummary)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobExecutionSummaryForJob' {Maybe JobExecutionSummary
jobExecutionSummary :: Maybe JobExecutionSummary
$sel:jobExecutionSummary:JobExecutionSummaryForJob' :: JobExecutionSummaryForJob -> Maybe JobExecutionSummary
jobExecutionSummary} -> Maybe JobExecutionSummary
jobExecutionSummary) (\s :: JobExecutionSummaryForJob
s@JobExecutionSummaryForJob' {} Maybe JobExecutionSummary
a -> JobExecutionSummaryForJob
s {$sel:jobExecutionSummary:JobExecutionSummaryForJob' :: Maybe JobExecutionSummary
jobExecutionSummary = Maybe JobExecutionSummary
a} :: JobExecutionSummaryForJob)

-- | The ARN of the thing on which the job execution is running.
jobExecutionSummaryForJob_thingArn :: Lens.Lens' JobExecutionSummaryForJob (Prelude.Maybe Prelude.Text)
jobExecutionSummaryForJob_thingArn :: (Maybe Text -> f (Maybe Text))
-> JobExecutionSummaryForJob -> f JobExecutionSummaryForJob
jobExecutionSummaryForJob_thingArn = (JobExecutionSummaryForJob -> Maybe Text)
-> (JobExecutionSummaryForJob
    -> Maybe Text -> JobExecutionSummaryForJob)
-> Lens
     JobExecutionSummaryForJob
     JobExecutionSummaryForJob
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobExecutionSummaryForJob' {Maybe Text
thingArn :: Maybe Text
$sel:thingArn:JobExecutionSummaryForJob' :: JobExecutionSummaryForJob -> Maybe Text
thingArn} -> Maybe Text
thingArn) (\s :: JobExecutionSummaryForJob
s@JobExecutionSummaryForJob' {} Maybe Text
a -> JobExecutionSummaryForJob
s {$sel:thingArn:JobExecutionSummaryForJob' :: Maybe Text
thingArn = Maybe Text
a} :: JobExecutionSummaryForJob)

instance Core.FromJSON JobExecutionSummaryForJob where
  parseJSON :: Value -> Parser JobExecutionSummaryForJob
parseJSON =
    String
-> (Object -> Parser JobExecutionSummaryForJob)
-> Value
-> Parser JobExecutionSummaryForJob
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"JobExecutionSummaryForJob"
      ( \Object
x ->
          Maybe JobExecutionSummary
-> Maybe Text -> JobExecutionSummaryForJob
JobExecutionSummaryForJob'
            (Maybe JobExecutionSummary
 -> Maybe Text -> JobExecutionSummaryForJob)
-> Parser (Maybe JobExecutionSummary)
-> Parser (Maybe Text -> JobExecutionSummaryForJob)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe JobExecutionSummary)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"jobExecutionSummary")
            Parser (Maybe Text -> JobExecutionSummaryForJob)
-> Parser (Maybe Text) -> Parser JobExecutionSummaryForJob
forall (f :: * -> *) a b. Applicative f => 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
"thingArn")
      )

instance Prelude.Hashable JobExecutionSummaryForJob

instance Prelude.NFData JobExecutionSummaryForJob