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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Contains a subset of information about a job execution.
--
-- /See:/ 'newJobExecutionSummary' smart constructor.
data JobExecutionSummary = JobExecutionSummary'
  { -- | The unique identifier you assigned to this job when it was created.
    JobExecutionSummary -> Maybe Text
jobId :: Prelude.Maybe Prelude.Text,
    -- | The time, in milliseconds since the epoch, when the job execution was
    -- last updated.
    JobExecutionSummary -> Maybe Integer
lastUpdatedAt :: Prelude.Maybe Prelude.Integer,
    -- | The time, in milliseconds since the epoch, when the job execution was
    -- enqueued.
    JobExecutionSummary -> Maybe Integer
queuedAt :: Prelude.Maybe Prelude.Integer,
    -- | A number that identifies a particular job execution on a particular
    -- device.
    JobExecutionSummary -> Maybe Integer
executionNumber :: Prelude.Maybe Prelude.Integer,
    -- | The version of the job execution. Job execution versions are incremented
    -- each time AWS IoT Jobs receives an update from a device.
    JobExecutionSummary -> Maybe Integer
versionNumber :: Prelude.Maybe Prelude.Integer,
    -- | The time, in milliseconds since the epoch, when the job execution
    -- started.
    JobExecutionSummary -> Maybe Integer
startedAt :: Prelude.Maybe Prelude.Integer
  }
  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:
--
-- 'jobId', 'jobExecutionSummary_jobId' - The unique identifier you assigned to this job when it was created.
--
-- 'lastUpdatedAt', 'jobExecutionSummary_lastUpdatedAt' - The time, in milliseconds since the epoch, when the job execution was
-- last updated.
--
-- 'queuedAt', 'jobExecutionSummary_queuedAt' - The time, in milliseconds since the epoch, when the job execution was
-- enqueued.
--
-- 'executionNumber', 'jobExecutionSummary_executionNumber' - A number that identifies a particular job execution on a particular
-- device.
--
-- 'versionNumber', 'jobExecutionSummary_versionNumber' - The version of the job execution. Job execution versions are incremented
-- each time AWS IoT Jobs receives an update from a device.
--
-- 'startedAt', 'jobExecutionSummary_startedAt' - The time, in milliseconds since the epoch, when the job execution
-- started.
newJobExecutionSummary ::
  JobExecutionSummary
newJobExecutionSummary :: JobExecutionSummary
newJobExecutionSummary =
  JobExecutionSummary' :: Maybe Text
-> Maybe Integer
-> Maybe Integer
-> Maybe Integer
-> Maybe Integer
-> Maybe Integer
-> JobExecutionSummary
JobExecutionSummary'
    { $sel:jobId:JobExecutionSummary' :: Maybe Text
jobId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdatedAt:JobExecutionSummary' :: Maybe Integer
lastUpdatedAt = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:queuedAt:JobExecutionSummary' :: Maybe Integer
queuedAt = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:executionNumber:JobExecutionSummary' :: Maybe Integer
executionNumber = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:versionNumber:JobExecutionSummary' :: Maybe Integer
versionNumber = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:startedAt:JobExecutionSummary' :: Maybe Integer
startedAt = Maybe Integer
forall a. Maybe a
Prelude.Nothing
    }

-- | The unique identifier you assigned to this job when it was created.
jobExecutionSummary_jobId :: Lens.Lens' JobExecutionSummary (Prelude.Maybe Prelude.Text)
jobExecutionSummary_jobId :: (Maybe Text -> f (Maybe Text))
-> JobExecutionSummary -> f JobExecutionSummary
jobExecutionSummary_jobId = (JobExecutionSummary -> Maybe Text)
-> (JobExecutionSummary -> Maybe Text -> JobExecutionSummary)
-> Lens
     JobExecutionSummary JobExecutionSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobExecutionSummary' {Maybe Text
jobId :: Maybe Text
$sel:jobId:JobExecutionSummary' :: JobExecutionSummary -> Maybe Text
jobId} -> Maybe Text
jobId) (\s :: JobExecutionSummary
s@JobExecutionSummary' {} Maybe Text
a -> JobExecutionSummary
s {$sel:jobId:JobExecutionSummary' :: Maybe Text
jobId = Maybe Text
a} :: JobExecutionSummary)

-- | The time, in milliseconds since the epoch, when the job execution was
-- last updated.
jobExecutionSummary_lastUpdatedAt :: Lens.Lens' JobExecutionSummary (Prelude.Maybe Prelude.Integer)
jobExecutionSummary_lastUpdatedAt :: (Maybe Integer -> f (Maybe Integer))
-> JobExecutionSummary -> f JobExecutionSummary
jobExecutionSummary_lastUpdatedAt = (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
lastUpdatedAt :: Maybe Integer
$sel:lastUpdatedAt:JobExecutionSummary' :: JobExecutionSummary -> Maybe Integer
lastUpdatedAt} -> Maybe Integer
lastUpdatedAt) (\s :: JobExecutionSummary
s@JobExecutionSummary' {} Maybe Integer
a -> JobExecutionSummary
s {$sel:lastUpdatedAt:JobExecutionSummary' :: Maybe Integer
lastUpdatedAt = Maybe Integer
a} :: JobExecutionSummary)

-- | The time, in milliseconds since the epoch, when the job execution was
-- enqueued.
jobExecutionSummary_queuedAt :: Lens.Lens' JobExecutionSummary (Prelude.Maybe Prelude.Integer)
jobExecutionSummary_queuedAt :: (Maybe Integer -> f (Maybe Integer))
-> JobExecutionSummary -> f JobExecutionSummary
jobExecutionSummary_queuedAt = (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
queuedAt :: Maybe Integer
$sel:queuedAt:JobExecutionSummary' :: JobExecutionSummary -> Maybe Integer
queuedAt} -> Maybe Integer
queuedAt) (\s :: JobExecutionSummary
s@JobExecutionSummary' {} Maybe Integer
a -> JobExecutionSummary
s {$sel:queuedAt:JobExecutionSummary' :: Maybe Integer
queuedAt = Maybe Integer
a} :: JobExecutionSummary)

-- | A number that identifies a particular job execution on a particular
-- device.
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 version of the job execution. Job execution versions are incremented
-- each time AWS IoT Jobs receives an update from a device.
jobExecutionSummary_versionNumber :: Lens.Lens' JobExecutionSummary (Prelude.Maybe Prelude.Integer)
jobExecutionSummary_versionNumber :: (Maybe Integer -> f (Maybe Integer))
-> JobExecutionSummary -> f JobExecutionSummary
jobExecutionSummary_versionNumber = (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
versionNumber :: Maybe Integer
$sel:versionNumber:JobExecutionSummary' :: JobExecutionSummary -> Maybe Integer
versionNumber} -> Maybe Integer
versionNumber) (\s :: JobExecutionSummary
s@JobExecutionSummary' {} Maybe Integer
a -> JobExecutionSummary
s {$sel:versionNumber:JobExecutionSummary' :: Maybe Integer
versionNumber = Maybe Integer
a} :: JobExecutionSummary)

-- | The time, in milliseconds since the epoch, when the job execution
-- started.
jobExecutionSummary_startedAt :: Lens.Lens' JobExecutionSummary (Prelude.Maybe Prelude.Integer)
jobExecutionSummary_startedAt :: (Maybe Integer -> f (Maybe Integer))
-> JobExecutionSummary -> f JobExecutionSummary
jobExecutionSummary_startedAt = (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
startedAt :: Maybe Integer
$sel:startedAt:JobExecutionSummary' :: JobExecutionSummary -> Maybe Integer
startedAt} -> Maybe Integer
startedAt) (\s :: JobExecutionSummary
s@JobExecutionSummary' {} Maybe Integer
a -> JobExecutionSummary
s {$sel:startedAt:JobExecutionSummary' :: Maybe Integer
startedAt = Maybe Integer
a} :: JobExecutionSummary)

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 Text
-> Maybe Integer
-> Maybe Integer
-> Maybe Integer
-> Maybe Integer
-> Maybe Integer
-> JobExecutionSummary
JobExecutionSummary'
            (Maybe Text
 -> Maybe Integer
 -> Maybe Integer
 -> Maybe Integer
 -> Maybe Integer
 -> Maybe Integer
 -> JobExecutionSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe Integer
      -> Maybe Integer
      -> Maybe Integer
      -> Maybe Integer
      -> Maybe Integer
      -> JobExecutionSummary)
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 Integer
   -> Maybe Integer
   -> Maybe Integer
   -> Maybe Integer
   -> Maybe Integer
   -> JobExecutionSummary)
-> Parser (Maybe Integer)
-> Parser
     (Maybe Integer
      -> Maybe Integer
      -> Maybe Integer
      -> Maybe Integer
      -> 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
"lastUpdatedAt")
            Parser
  (Maybe Integer
   -> Maybe Integer
   -> Maybe Integer
   -> Maybe Integer
   -> JobExecutionSummary)
-> Parser (Maybe Integer)
-> Parser
     (Maybe Integer
      -> Maybe Integer -> Maybe Integer -> 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
"queuedAt")
            Parser
  (Maybe Integer
   -> Maybe Integer -> Maybe Integer -> JobExecutionSummary)
-> Parser (Maybe Integer)
-> Parser (Maybe Integer -> Maybe Integer -> 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 Integer -> Maybe Integer -> JobExecutionSummary)
-> Parser (Maybe Integer)
-> Parser (Maybe Integer -> 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
"versionNumber")
            Parser (Maybe Integer -> JobExecutionSummary)
-> Parser (Maybe Integer) -> Parser 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
"startedAt")
      )

instance Prelude.Hashable JobExecutionSummary

instance Prelude.NFData JobExecutionSummary