{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.IoTJobsData.Types.JobExecutionSummary where

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

-- | Contains a subset of information about a job execution.
--
-- /See:/ 'newJobExecutionSummary' smart constructor.
data JobExecutionSummary = JobExecutionSummary'
  { -- | A number that identifies a particular job execution on a particular
    -- device.
    JobExecutionSummary -> Maybe Integer
executionNumber :: Prelude.Maybe Prelude.Integer,
    -- | 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,
    -- | The time, in milliseconds since the epoch, when the job execution
    -- started.
    JobExecutionSummary -> Maybe Integer
startedAt :: 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
  }
  deriving (JobExecutionSummary -> JobExecutionSummary -> Bool
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]
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
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. 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:
--
-- 'executionNumber', 'jobExecutionSummary_executionNumber' - A number that identifies a particular job execution on a particular
-- device.
--
-- '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.
--
-- 'startedAt', 'jobExecutionSummary_startedAt' - The time, in milliseconds since the epoch, when the job execution
-- started.
--
-- '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.
newJobExecutionSummary ::
  JobExecutionSummary
newJobExecutionSummary :: JobExecutionSummary
newJobExecutionSummary =
  JobExecutionSummary'
    { $sel:executionNumber:JobExecutionSummary' :: Maybe Integer
executionNumber =
        forall a. Maybe a
Prelude.Nothing,
      $sel:jobId:JobExecutionSummary' :: Maybe Text
jobId = forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdatedAt:JobExecutionSummary' :: Maybe Integer
lastUpdatedAt = forall a. Maybe a
Prelude.Nothing,
      $sel:queuedAt:JobExecutionSummary' :: Maybe Integer
queuedAt = forall a. Maybe a
Prelude.Nothing,
      $sel:startedAt:JobExecutionSummary' :: Maybe Integer
startedAt = forall a. Maybe a
Prelude.Nothing,
      $sel:versionNumber:JobExecutionSummary' :: Maybe Integer
versionNumber = forall a. Maybe a
Prelude.Nothing
    }

-- | A number that identifies a particular job execution on a particular
-- device.
jobExecutionSummary_executionNumber :: Lens.Lens' JobExecutionSummary (Prelude.Maybe Prelude.Integer)
jobExecutionSummary_executionNumber :: Lens' JobExecutionSummary (Maybe Integer)
jobExecutionSummary_executionNumber = 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 unique identifier you assigned to this job when it was created.
jobExecutionSummary_jobId :: Lens.Lens' JobExecutionSummary (Prelude.Maybe Prelude.Text)
jobExecutionSummary_jobId :: Lens' JobExecutionSummary (Maybe Text)
jobExecutionSummary_jobId = 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 :: Lens' JobExecutionSummary (Maybe Integer)
jobExecutionSummary_lastUpdatedAt = 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 :: Lens' JobExecutionSummary (Maybe Integer)
jobExecutionSummary_queuedAt = 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)

-- | The time, in milliseconds since the epoch, when the job execution
-- started.
jobExecutionSummary_startedAt :: Lens.Lens' JobExecutionSummary (Prelude.Maybe Prelude.Integer)
jobExecutionSummary_startedAt :: Lens' JobExecutionSummary (Maybe Integer)
jobExecutionSummary_startedAt = 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)

-- | 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 :: Lens' JobExecutionSummary (Maybe Integer)
jobExecutionSummary_versionNumber = 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)

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

instance Prelude.Hashable JobExecutionSummary where
  hashWithSalt :: Int -> JobExecutionSummary -> Int
hashWithSalt Int
_salt JobExecutionSummary' {Maybe Integer
Maybe Text
versionNumber :: Maybe Integer
startedAt :: Maybe Integer
queuedAt :: Maybe Integer
lastUpdatedAt :: Maybe Integer
jobId :: Maybe Text
executionNumber :: Maybe Integer
$sel:versionNumber:JobExecutionSummary' :: JobExecutionSummary -> Maybe Integer
$sel:startedAt:JobExecutionSummary' :: JobExecutionSummary -> Maybe Integer
$sel:queuedAt:JobExecutionSummary' :: JobExecutionSummary -> Maybe Integer
$sel:lastUpdatedAt:JobExecutionSummary' :: JobExecutionSummary -> Maybe Integer
$sel:jobId:JobExecutionSummary' :: JobExecutionSummary -> Maybe Text
$sel:executionNumber:JobExecutionSummary' :: JobExecutionSummary -> Maybe Integer
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
executionNumber
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
jobId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
lastUpdatedAt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
queuedAt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
startedAt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
versionNumber

instance Prelude.NFData JobExecutionSummary where
  rnf :: JobExecutionSummary -> ()
rnf JobExecutionSummary' {Maybe Integer
Maybe Text
versionNumber :: Maybe Integer
startedAt :: Maybe Integer
queuedAt :: Maybe Integer
lastUpdatedAt :: Maybe Integer
jobId :: Maybe Text
executionNumber :: Maybe Integer
$sel:versionNumber:JobExecutionSummary' :: JobExecutionSummary -> Maybe Integer
$sel:startedAt:JobExecutionSummary' :: JobExecutionSummary -> Maybe Integer
$sel:queuedAt:JobExecutionSummary' :: JobExecutionSummary -> Maybe Integer
$sel:lastUpdatedAt:JobExecutionSummary' :: JobExecutionSummary -> Maybe Integer
$sel:jobId:JobExecutionSummary' :: JobExecutionSummary -> Maybe Text
$sel:executionNumber:JobExecutionSummary' :: JobExecutionSummary -> Maybe Integer
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
executionNumber
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
jobId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
lastUpdatedAt
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
queuedAt
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
startedAt
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
versionNumber