{-# 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.M2.Types.BatchJobExecutionSummary
-- 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.M2.Types.BatchJobExecutionSummary where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.M2.Types.BatchJobExecutionStatus
import Amazonka.M2.Types.BatchJobType
import qualified Amazonka.Prelude as Prelude

-- | A subset of the possible batch job attributes. Used in the batch job
-- list.
--
-- /See:/ 'newBatchJobExecutionSummary' smart constructor.
data BatchJobExecutionSummary = BatchJobExecutionSummary'
  { -- | The timestamp when this batch job execution ended.
    BatchJobExecutionSummary -> Maybe POSIX
endTime :: Prelude.Maybe Data.POSIX,
    -- | The unique identifier of a particular batch job.
    BatchJobExecutionSummary -> Maybe Text
jobId :: Prelude.Maybe Prelude.Text,
    -- | The name of a particular batch job.
    BatchJobExecutionSummary -> Maybe Text
jobName :: Prelude.Maybe Prelude.Text,
    -- | The type of a particular batch job execution.
    BatchJobExecutionSummary -> Maybe BatchJobType
jobType :: Prelude.Maybe BatchJobType,
    -- | The unique identifier of the application that hosts this batch job.
    BatchJobExecutionSummary -> Text
applicationId :: Prelude.Text,
    -- | The unique identifier of this execution of the batch job.
    BatchJobExecutionSummary -> Text
executionId :: Prelude.Text,
    -- | The timestamp when a particular batch job execution started.
    BatchJobExecutionSummary -> POSIX
startTime :: Data.POSIX,
    -- | The status of a particular batch job execution.
    BatchJobExecutionSummary -> BatchJobExecutionStatus
status :: BatchJobExecutionStatus
  }
  deriving (BatchJobExecutionSummary -> BatchJobExecutionSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchJobExecutionSummary -> BatchJobExecutionSummary -> Bool
$c/= :: BatchJobExecutionSummary -> BatchJobExecutionSummary -> Bool
== :: BatchJobExecutionSummary -> BatchJobExecutionSummary -> Bool
$c== :: BatchJobExecutionSummary -> BatchJobExecutionSummary -> Bool
Prelude.Eq, ReadPrec [BatchJobExecutionSummary]
ReadPrec BatchJobExecutionSummary
Int -> ReadS BatchJobExecutionSummary
ReadS [BatchJobExecutionSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchJobExecutionSummary]
$creadListPrec :: ReadPrec [BatchJobExecutionSummary]
readPrec :: ReadPrec BatchJobExecutionSummary
$creadPrec :: ReadPrec BatchJobExecutionSummary
readList :: ReadS [BatchJobExecutionSummary]
$creadList :: ReadS [BatchJobExecutionSummary]
readsPrec :: Int -> ReadS BatchJobExecutionSummary
$creadsPrec :: Int -> ReadS BatchJobExecutionSummary
Prelude.Read, Int -> BatchJobExecutionSummary -> ShowS
[BatchJobExecutionSummary] -> ShowS
BatchJobExecutionSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchJobExecutionSummary] -> ShowS
$cshowList :: [BatchJobExecutionSummary] -> ShowS
show :: BatchJobExecutionSummary -> String
$cshow :: BatchJobExecutionSummary -> String
showsPrec :: Int -> BatchJobExecutionSummary -> ShowS
$cshowsPrec :: Int -> BatchJobExecutionSummary -> ShowS
Prelude.Show, forall x.
Rep BatchJobExecutionSummary x -> BatchJobExecutionSummary
forall x.
BatchJobExecutionSummary -> Rep BatchJobExecutionSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchJobExecutionSummary x -> BatchJobExecutionSummary
$cfrom :: forall x.
BatchJobExecutionSummary -> Rep BatchJobExecutionSummary x
Prelude.Generic)

-- |
-- Create a value of 'BatchJobExecutionSummary' 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:
--
-- 'endTime', 'batchJobExecutionSummary_endTime' - The timestamp when this batch job execution ended.
--
-- 'jobId', 'batchJobExecutionSummary_jobId' - The unique identifier of a particular batch job.
--
-- 'jobName', 'batchJobExecutionSummary_jobName' - The name of a particular batch job.
--
-- 'jobType', 'batchJobExecutionSummary_jobType' - The type of a particular batch job execution.
--
-- 'applicationId', 'batchJobExecutionSummary_applicationId' - The unique identifier of the application that hosts this batch job.
--
-- 'executionId', 'batchJobExecutionSummary_executionId' - The unique identifier of this execution of the batch job.
--
-- 'startTime', 'batchJobExecutionSummary_startTime' - The timestamp when a particular batch job execution started.
--
-- 'status', 'batchJobExecutionSummary_status' - The status of a particular batch job execution.
newBatchJobExecutionSummary ::
  -- | 'applicationId'
  Prelude.Text ->
  -- | 'executionId'
  Prelude.Text ->
  -- | 'startTime'
  Prelude.UTCTime ->
  -- | 'status'
  BatchJobExecutionStatus ->
  BatchJobExecutionSummary
newBatchJobExecutionSummary :: Text
-> Text
-> UTCTime
-> BatchJobExecutionStatus
-> BatchJobExecutionSummary
newBatchJobExecutionSummary
  Text
pApplicationId_
  Text
pExecutionId_
  UTCTime
pStartTime_
  BatchJobExecutionStatus
pStatus_ =
    BatchJobExecutionSummary'
      { $sel:endTime:BatchJobExecutionSummary' :: Maybe POSIX
endTime =
          forall a. Maybe a
Prelude.Nothing,
        $sel:jobId:BatchJobExecutionSummary' :: Maybe Text
jobId = forall a. Maybe a
Prelude.Nothing,
        $sel:jobName:BatchJobExecutionSummary' :: Maybe Text
jobName = forall a. Maybe a
Prelude.Nothing,
        $sel:jobType:BatchJobExecutionSummary' :: Maybe BatchJobType
jobType = forall a. Maybe a
Prelude.Nothing,
        $sel:applicationId:BatchJobExecutionSummary' :: Text
applicationId = Text
pApplicationId_,
        $sel:executionId:BatchJobExecutionSummary' :: Text
executionId = Text
pExecutionId_,
        $sel:startTime:BatchJobExecutionSummary' :: POSIX
startTime = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pStartTime_,
        $sel:status:BatchJobExecutionSummary' :: BatchJobExecutionStatus
status = BatchJobExecutionStatus
pStatus_
      }

-- | The timestamp when this batch job execution ended.
batchJobExecutionSummary_endTime :: Lens.Lens' BatchJobExecutionSummary (Prelude.Maybe Prelude.UTCTime)
batchJobExecutionSummary_endTime :: Lens' BatchJobExecutionSummary (Maybe UTCTime)
batchJobExecutionSummary_endTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchJobExecutionSummary' {Maybe POSIX
endTime :: Maybe POSIX
$sel:endTime:BatchJobExecutionSummary' :: BatchJobExecutionSummary -> Maybe POSIX
endTime} -> Maybe POSIX
endTime) (\s :: BatchJobExecutionSummary
s@BatchJobExecutionSummary' {} Maybe POSIX
a -> BatchJobExecutionSummary
s {$sel:endTime:BatchJobExecutionSummary' :: Maybe POSIX
endTime = Maybe POSIX
a} :: BatchJobExecutionSummary) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The unique identifier of a particular batch job.
batchJobExecutionSummary_jobId :: Lens.Lens' BatchJobExecutionSummary (Prelude.Maybe Prelude.Text)
batchJobExecutionSummary_jobId :: Lens' BatchJobExecutionSummary (Maybe Text)
batchJobExecutionSummary_jobId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchJobExecutionSummary' {Maybe Text
jobId :: Maybe Text
$sel:jobId:BatchJobExecutionSummary' :: BatchJobExecutionSummary -> Maybe Text
jobId} -> Maybe Text
jobId) (\s :: BatchJobExecutionSummary
s@BatchJobExecutionSummary' {} Maybe Text
a -> BatchJobExecutionSummary
s {$sel:jobId:BatchJobExecutionSummary' :: Maybe Text
jobId = Maybe Text
a} :: BatchJobExecutionSummary)

-- | The name of a particular batch job.
batchJobExecutionSummary_jobName :: Lens.Lens' BatchJobExecutionSummary (Prelude.Maybe Prelude.Text)
batchJobExecutionSummary_jobName :: Lens' BatchJobExecutionSummary (Maybe Text)
batchJobExecutionSummary_jobName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchJobExecutionSummary' {Maybe Text
jobName :: Maybe Text
$sel:jobName:BatchJobExecutionSummary' :: BatchJobExecutionSummary -> Maybe Text
jobName} -> Maybe Text
jobName) (\s :: BatchJobExecutionSummary
s@BatchJobExecutionSummary' {} Maybe Text
a -> BatchJobExecutionSummary
s {$sel:jobName:BatchJobExecutionSummary' :: Maybe Text
jobName = Maybe Text
a} :: BatchJobExecutionSummary)

-- | The type of a particular batch job execution.
batchJobExecutionSummary_jobType :: Lens.Lens' BatchJobExecutionSummary (Prelude.Maybe BatchJobType)
batchJobExecutionSummary_jobType :: Lens' BatchJobExecutionSummary (Maybe BatchJobType)
batchJobExecutionSummary_jobType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchJobExecutionSummary' {Maybe BatchJobType
jobType :: Maybe BatchJobType
$sel:jobType:BatchJobExecutionSummary' :: BatchJobExecutionSummary -> Maybe BatchJobType
jobType} -> Maybe BatchJobType
jobType) (\s :: BatchJobExecutionSummary
s@BatchJobExecutionSummary' {} Maybe BatchJobType
a -> BatchJobExecutionSummary
s {$sel:jobType:BatchJobExecutionSummary' :: Maybe BatchJobType
jobType = Maybe BatchJobType
a} :: BatchJobExecutionSummary)

-- | The unique identifier of the application that hosts this batch job.
batchJobExecutionSummary_applicationId :: Lens.Lens' BatchJobExecutionSummary Prelude.Text
batchJobExecutionSummary_applicationId :: Lens' BatchJobExecutionSummary Text
batchJobExecutionSummary_applicationId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchJobExecutionSummary' {Text
applicationId :: Text
$sel:applicationId:BatchJobExecutionSummary' :: BatchJobExecutionSummary -> Text
applicationId} -> Text
applicationId) (\s :: BatchJobExecutionSummary
s@BatchJobExecutionSummary' {} Text
a -> BatchJobExecutionSummary
s {$sel:applicationId:BatchJobExecutionSummary' :: Text
applicationId = Text
a} :: BatchJobExecutionSummary)

-- | The unique identifier of this execution of the batch job.
batchJobExecutionSummary_executionId :: Lens.Lens' BatchJobExecutionSummary Prelude.Text
batchJobExecutionSummary_executionId :: Lens' BatchJobExecutionSummary Text
batchJobExecutionSummary_executionId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchJobExecutionSummary' {Text
executionId :: Text
$sel:executionId:BatchJobExecutionSummary' :: BatchJobExecutionSummary -> Text
executionId} -> Text
executionId) (\s :: BatchJobExecutionSummary
s@BatchJobExecutionSummary' {} Text
a -> BatchJobExecutionSummary
s {$sel:executionId:BatchJobExecutionSummary' :: Text
executionId = Text
a} :: BatchJobExecutionSummary)

-- | The timestamp when a particular batch job execution started.
batchJobExecutionSummary_startTime :: Lens.Lens' BatchJobExecutionSummary Prelude.UTCTime
batchJobExecutionSummary_startTime :: Lens' BatchJobExecutionSummary UTCTime
batchJobExecutionSummary_startTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchJobExecutionSummary' {POSIX
startTime :: POSIX
$sel:startTime:BatchJobExecutionSummary' :: BatchJobExecutionSummary -> POSIX
startTime} -> POSIX
startTime) (\s :: BatchJobExecutionSummary
s@BatchJobExecutionSummary' {} POSIX
a -> BatchJobExecutionSummary
s {$sel:startTime:BatchJobExecutionSummary' :: POSIX
startTime = POSIX
a} :: BatchJobExecutionSummary) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The status of a particular batch job execution.
batchJobExecutionSummary_status :: Lens.Lens' BatchJobExecutionSummary BatchJobExecutionStatus
batchJobExecutionSummary_status :: Lens' BatchJobExecutionSummary BatchJobExecutionStatus
batchJobExecutionSummary_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchJobExecutionSummary' {BatchJobExecutionStatus
status :: BatchJobExecutionStatus
$sel:status:BatchJobExecutionSummary' :: BatchJobExecutionSummary -> BatchJobExecutionStatus
status} -> BatchJobExecutionStatus
status) (\s :: BatchJobExecutionSummary
s@BatchJobExecutionSummary' {} BatchJobExecutionStatus
a -> BatchJobExecutionSummary
s {$sel:status:BatchJobExecutionSummary' :: BatchJobExecutionStatus
status = BatchJobExecutionStatus
a} :: BatchJobExecutionSummary)

instance Data.FromJSON BatchJobExecutionSummary where
  parseJSON :: Value -> Parser BatchJobExecutionSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"BatchJobExecutionSummary"
      ( \Object
x ->
          Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe BatchJobType
-> Text
-> Text
-> POSIX
-> BatchJobExecutionStatus
-> BatchJobExecutionSummary
BatchJobExecutionSummary'
            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
"endTime")
            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
"jobName")
            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
"jobType")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"applicationId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"executionId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"startTime")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"status")
      )

instance Prelude.Hashable BatchJobExecutionSummary where
  hashWithSalt :: Int -> BatchJobExecutionSummary -> Int
hashWithSalt Int
_salt BatchJobExecutionSummary' {Maybe Text
Maybe POSIX
Maybe BatchJobType
Text
POSIX
BatchJobExecutionStatus
status :: BatchJobExecutionStatus
startTime :: POSIX
executionId :: Text
applicationId :: Text
jobType :: Maybe BatchJobType
jobName :: Maybe Text
jobId :: Maybe Text
endTime :: Maybe POSIX
$sel:status:BatchJobExecutionSummary' :: BatchJobExecutionSummary -> BatchJobExecutionStatus
$sel:startTime:BatchJobExecutionSummary' :: BatchJobExecutionSummary -> POSIX
$sel:executionId:BatchJobExecutionSummary' :: BatchJobExecutionSummary -> Text
$sel:applicationId:BatchJobExecutionSummary' :: BatchJobExecutionSummary -> Text
$sel:jobType:BatchJobExecutionSummary' :: BatchJobExecutionSummary -> Maybe BatchJobType
$sel:jobName:BatchJobExecutionSummary' :: BatchJobExecutionSummary -> Maybe Text
$sel:jobId:BatchJobExecutionSummary' :: BatchJobExecutionSummary -> Maybe Text
$sel:endTime:BatchJobExecutionSummary' :: BatchJobExecutionSummary -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
endTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
jobId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
jobName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe BatchJobType
jobType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
applicationId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
executionId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` POSIX
startTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` BatchJobExecutionStatus
status

instance Prelude.NFData BatchJobExecutionSummary where
  rnf :: BatchJobExecutionSummary -> ()
rnf BatchJobExecutionSummary' {Maybe Text
Maybe POSIX
Maybe BatchJobType
Text
POSIX
BatchJobExecutionStatus
status :: BatchJobExecutionStatus
startTime :: POSIX
executionId :: Text
applicationId :: Text
jobType :: Maybe BatchJobType
jobName :: Maybe Text
jobId :: Maybe Text
endTime :: Maybe POSIX
$sel:status:BatchJobExecutionSummary' :: BatchJobExecutionSummary -> BatchJobExecutionStatus
$sel:startTime:BatchJobExecutionSummary' :: BatchJobExecutionSummary -> POSIX
$sel:executionId:BatchJobExecutionSummary' :: BatchJobExecutionSummary -> Text
$sel:applicationId:BatchJobExecutionSummary' :: BatchJobExecutionSummary -> Text
$sel:jobType:BatchJobExecutionSummary' :: BatchJobExecutionSummary -> Maybe BatchJobType
$sel:jobName:BatchJobExecutionSummary' :: BatchJobExecutionSummary -> Maybe Text
$sel:jobId:BatchJobExecutionSummary' :: BatchJobExecutionSummary -> Maybe Text
$sel:endTime:BatchJobExecutionSummary' :: BatchJobExecutionSummary -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
endTime
      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 Text
jobName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe BatchJobType
jobType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
applicationId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
executionId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf POSIX
startTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf BatchJobExecutionStatus
status