{-# 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.JobExecutionSummary
-- 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.JobExecutionSummary where

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

-- | The job execution summary.
--
-- /See:/ 'newJobExecutionSummary' smart constructor.
data JobExecutionSummary = JobExecutionSummary'
  { -- | The status of the job execution.
    JobExecutionSummary -> Maybe JobExecutionStatus
status :: Prelude.Maybe JobExecutionStatus,
    -- | The time, in seconds since the epoch, when the job execution was last
    -- updated.
    JobExecutionSummary -> Maybe POSIX
lastUpdatedAt :: Prelude.Maybe Core.POSIX,
    -- | The time, in seconds since the epoch, when the job execution was queued.
    JobExecutionSummary -> Maybe POSIX
queuedAt :: Prelude.Maybe Core.POSIX,
    -- | A string (consisting of the digits \"0\" through \"9\") which identifies
    -- this particular job execution on this particular device. It can be used
    -- later in commands which return or update job execution information.
    JobExecutionSummary -> Maybe Integer
executionNumber :: Prelude.Maybe Prelude.Integer,
    -- | The time, in seconds since the epoch, when the job execution started.
    JobExecutionSummary -> Maybe POSIX
startedAt :: Prelude.Maybe Core.POSIX
  }
  deriving (JobExecutionSummary -> JobExecutionSummary -> Bool
(JobExecutionSummary -> JobExecutionSummary -> Bool)
-> (JobExecutionSummary -> JobExecutionSummary -> Bool)
-> Eq JobExecutionSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: JobExecutionSummary -> JobExecutionSummary -> Bool
$c/= :: JobExecutionSummary -> JobExecutionSummary -> Bool
== :: JobExecutionSummary -> JobExecutionSummary -> Bool
$c== :: JobExecutionSummary -> JobExecutionSummary -> Bool
Prelude.Eq, ReadPrec [JobExecutionSummary]
ReadPrec JobExecutionSummary
Int -> ReadS JobExecutionSummary
ReadS [JobExecutionSummary]
(Int -> ReadS JobExecutionSummary)
-> ReadS [JobExecutionSummary]
-> ReadPrec JobExecutionSummary
-> ReadPrec [JobExecutionSummary]
-> Read JobExecutionSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [JobExecutionSummary]
$creadListPrec :: ReadPrec [JobExecutionSummary]
readPrec :: ReadPrec JobExecutionSummary
$creadPrec :: ReadPrec JobExecutionSummary
readList :: ReadS [JobExecutionSummary]
$creadList :: ReadS [JobExecutionSummary]
readsPrec :: Int -> ReadS JobExecutionSummary
$creadsPrec :: Int -> ReadS JobExecutionSummary
Prelude.Read, Int -> JobExecutionSummary -> ShowS
[JobExecutionSummary] -> ShowS
JobExecutionSummary -> String
(Int -> JobExecutionSummary -> ShowS)
-> (JobExecutionSummary -> String)
-> ([JobExecutionSummary] -> ShowS)
-> Show JobExecutionSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [JobExecutionSummary] -> ShowS
$cshowList :: [JobExecutionSummary] -> ShowS
show :: JobExecutionSummary -> String
$cshow :: JobExecutionSummary -> String
showsPrec :: Int -> JobExecutionSummary -> ShowS
$cshowsPrec :: Int -> JobExecutionSummary -> ShowS
Prelude.Show, (forall x. JobExecutionSummary -> Rep JobExecutionSummary x)
-> (forall x. Rep JobExecutionSummary x -> JobExecutionSummary)
-> Generic JobExecutionSummary
forall x. Rep JobExecutionSummary x -> JobExecutionSummary
forall x. JobExecutionSummary -> Rep JobExecutionSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep JobExecutionSummary x -> JobExecutionSummary
$cfrom :: forall x. JobExecutionSummary -> Rep JobExecutionSummary x
Prelude.Generic)

-- |
-- Create a value of 'JobExecutionSummary' 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:
--
-- 'status', 'jobExecutionSummary_status' - The status of the job execution.
--
-- 'lastUpdatedAt', 'jobExecutionSummary_lastUpdatedAt' - The time, in seconds since the epoch, when the job execution was last
-- updated.
--
-- 'queuedAt', 'jobExecutionSummary_queuedAt' - The time, in seconds since the epoch, when the job execution was queued.
--
-- 'executionNumber', 'jobExecutionSummary_executionNumber' - A string (consisting of the digits \"0\" through \"9\") which identifies
-- this particular job execution on this particular device. It can be used
-- later in commands which return or update job execution information.
--
-- 'startedAt', 'jobExecutionSummary_startedAt' - The time, in seconds since the epoch, when the job execution started.
newJobExecutionSummary ::
  JobExecutionSummary
newJobExecutionSummary :: JobExecutionSummary
newJobExecutionSummary =
  JobExecutionSummary' :: Maybe JobExecutionStatus
-> Maybe POSIX
-> Maybe POSIX
-> Maybe Integer
-> Maybe POSIX
-> JobExecutionSummary
JobExecutionSummary'
    { $sel:status:JobExecutionSummary' :: Maybe JobExecutionStatus
status = Maybe JobExecutionStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdatedAt:JobExecutionSummary' :: Maybe POSIX
lastUpdatedAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:queuedAt:JobExecutionSummary' :: Maybe POSIX
queuedAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:executionNumber:JobExecutionSummary' :: Maybe Integer
executionNumber = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:startedAt:JobExecutionSummary' :: Maybe POSIX
startedAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
    }

-- | The status of the job execution.
jobExecutionSummary_status :: Lens.Lens' JobExecutionSummary (Prelude.Maybe JobExecutionStatus)
jobExecutionSummary_status :: (Maybe JobExecutionStatus -> f (Maybe JobExecutionStatus))
-> JobExecutionSummary -> f JobExecutionSummary
jobExecutionSummary_status = (JobExecutionSummary -> Maybe JobExecutionStatus)
-> (JobExecutionSummary
    -> Maybe JobExecutionStatus -> JobExecutionSummary)
-> Lens
     JobExecutionSummary
     JobExecutionSummary
     (Maybe JobExecutionStatus)
     (Maybe JobExecutionStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobExecutionSummary' {Maybe JobExecutionStatus
status :: Maybe JobExecutionStatus
$sel:status:JobExecutionSummary' :: JobExecutionSummary -> Maybe JobExecutionStatus
status} -> Maybe JobExecutionStatus
status) (\s :: JobExecutionSummary
s@JobExecutionSummary' {} Maybe JobExecutionStatus
a -> JobExecutionSummary
s {$sel:status:JobExecutionSummary' :: Maybe JobExecutionStatus
status = Maybe JobExecutionStatus
a} :: JobExecutionSummary)

-- | The time, in seconds since the epoch, when the job execution was last
-- updated.
jobExecutionSummary_lastUpdatedAt :: Lens.Lens' JobExecutionSummary (Prelude.Maybe Prelude.UTCTime)
jobExecutionSummary_lastUpdatedAt :: (Maybe UTCTime -> f (Maybe UTCTime))
-> JobExecutionSummary -> f JobExecutionSummary
jobExecutionSummary_lastUpdatedAt = (JobExecutionSummary -> Maybe POSIX)
-> (JobExecutionSummary -> Maybe POSIX -> JobExecutionSummary)
-> Lens
     JobExecutionSummary JobExecutionSummary (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobExecutionSummary' {Maybe POSIX
lastUpdatedAt :: Maybe POSIX
$sel:lastUpdatedAt:JobExecutionSummary' :: JobExecutionSummary -> Maybe POSIX
lastUpdatedAt} -> Maybe POSIX
lastUpdatedAt) (\s :: JobExecutionSummary
s@JobExecutionSummary' {} Maybe POSIX
a -> JobExecutionSummary
s {$sel:lastUpdatedAt:JobExecutionSummary' :: Maybe POSIX
lastUpdatedAt = Maybe POSIX
a} :: JobExecutionSummary) ((Maybe POSIX -> f (Maybe POSIX))
 -> JobExecutionSummary -> f JobExecutionSummary)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> JobExecutionSummary
-> f JobExecutionSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The time, in seconds since the epoch, when the job execution was queued.
jobExecutionSummary_queuedAt :: Lens.Lens' JobExecutionSummary (Prelude.Maybe Prelude.UTCTime)
jobExecutionSummary_queuedAt :: (Maybe UTCTime -> f (Maybe UTCTime))
-> JobExecutionSummary -> f JobExecutionSummary
jobExecutionSummary_queuedAt = (JobExecutionSummary -> Maybe POSIX)
-> (JobExecutionSummary -> Maybe POSIX -> JobExecutionSummary)
-> Lens
     JobExecutionSummary JobExecutionSummary (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobExecutionSummary' {Maybe POSIX
queuedAt :: Maybe POSIX
$sel:queuedAt:JobExecutionSummary' :: JobExecutionSummary -> Maybe POSIX
queuedAt} -> Maybe POSIX
queuedAt) (\s :: JobExecutionSummary
s@JobExecutionSummary' {} Maybe POSIX
a -> JobExecutionSummary
s {$sel:queuedAt:JobExecutionSummary' :: Maybe POSIX
queuedAt = Maybe POSIX
a} :: JobExecutionSummary) ((Maybe POSIX -> f (Maybe POSIX))
 -> JobExecutionSummary -> f JobExecutionSummary)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> JobExecutionSummary
-> f JobExecutionSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | A string (consisting of the digits \"0\" through \"9\") which identifies
-- this particular job execution on this particular device. It can be used
-- later in commands which return or update job execution information.
jobExecutionSummary_executionNumber :: Lens.Lens' JobExecutionSummary (Prelude.Maybe Prelude.Integer)
jobExecutionSummary_executionNumber :: (Maybe Integer -> f (Maybe Integer))
-> JobExecutionSummary -> f JobExecutionSummary
jobExecutionSummary_executionNumber = (JobExecutionSummary -> Maybe Integer)
-> (JobExecutionSummary -> Maybe Integer -> JobExecutionSummary)
-> Lens
     JobExecutionSummary
     JobExecutionSummary
     (Maybe Integer)
     (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobExecutionSummary' {Maybe Integer
executionNumber :: Maybe Integer
$sel:executionNumber:JobExecutionSummary' :: JobExecutionSummary -> Maybe Integer
executionNumber} -> Maybe Integer
executionNumber) (\s :: JobExecutionSummary
s@JobExecutionSummary' {} Maybe Integer
a -> JobExecutionSummary
s {$sel:executionNumber:JobExecutionSummary' :: Maybe Integer
executionNumber = Maybe Integer
a} :: JobExecutionSummary)

-- | The time, in seconds since the epoch, when the job execution started.
jobExecutionSummary_startedAt :: Lens.Lens' JobExecutionSummary (Prelude.Maybe Prelude.UTCTime)
jobExecutionSummary_startedAt :: (Maybe UTCTime -> f (Maybe UTCTime))
-> JobExecutionSummary -> f JobExecutionSummary
jobExecutionSummary_startedAt = (JobExecutionSummary -> Maybe POSIX)
-> (JobExecutionSummary -> Maybe POSIX -> JobExecutionSummary)
-> Lens
     JobExecutionSummary JobExecutionSummary (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobExecutionSummary' {Maybe POSIX
startedAt :: Maybe POSIX
$sel:startedAt:JobExecutionSummary' :: JobExecutionSummary -> Maybe POSIX
startedAt} -> Maybe POSIX
startedAt) (\s :: JobExecutionSummary
s@JobExecutionSummary' {} Maybe POSIX
a -> JobExecutionSummary
s {$sel:startedAt:JobExecutionSummary' :: Maybe POSIX
startedAt = Maybe POSIX
a} :: JobExecutionSummary) ((Maybe POSIX -> f (Maybe POSIX))
 -> JobExecutionSummary -> f JobExecutionSummary)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> JobExecutionSummary
-> f JobExecutionSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

instance Core.FromJSON JobExecutionSummary where
  parseJSON :: Value -> Parser JobExecutionSummary
parseJSON =
    String
-> (Object -> Parser JobExecutionSummary)
-> Value
-> Parser JobExecutionSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"JobExecutionSummary"
      ( \Object
x ->
          Maybe JobExecutionStatus
-> Maybe POSIX
-> Maybe POSIX
-> Maybe Integer
-> Maybe POSIX
-> JobExecutionSummary
JobExecutionSummary'
            (Maybe JobExecutionStatus
 -> Maybe POSIX
 -> Maybe POSIX
 -> Maybe Integer
 -> Maybe POSIX
 -> JobExecutionSummary)
-> Parser (Maybe JobExecutionStatus)
-> Parser
     (Maybe POSIX
      -> Maybe POSIX
      -> Maybe Integer
      -> Maybe POSIX
      -> JobExecutionSummary)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe JobExecutionStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"status")
            Parser
  (Maybe POSIX
   -> Maybe POSIX
   -> Maybe Integer
   -> Maybe POSIX
   -> JobExecutionSummary)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe POSIX
      -> Maybe Integer -> Maybe POSIX -> JobExecutionSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"lastUpdatedAt")
            Parser
  (Maybe POSIX
   -> Maybe Integer -> Maybe POSIX -> JobExecutionSummary)
-> Parser (Maybe POSIX)
-> Parser (Maybe Integer -> Maybe POSIX -> JobExecutionSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"queuedAt")
            Parser (Maybe Integer -> Maybe POSIX -> JobExecutionSummary)
-> Parser (Maybe Integer)
-> Parser (Maybe POSIX -> JobExecutionSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"executionNumber")
            Parser (Maybe POSIX -> JobExecutionSummary)
-> Parser (Maybe POSIX) -> Parser JobExecutionSummary
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"startedAt")
      )

instance Prelude.Hashable JobExecutionSummary

instance Prelude.NFData JobExecutionSummary