{-# 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.Amplify.Types.JobSummary
-- 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.Amplify.Types.JobSummary where

import Amazonka.Amplify.Types.JobStatus
import Amazonka.Amplify.Types.JobType
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

-- | Describes the summary for an execution job for an Amplify app.
--
-- /See:/ 'newJobSummary' smart constructor.
data JobSummary = JobSummary'
  { -- | The end date and time for the job.
    JobSummary -> Maybe POSIX
endTime :: Prelude.Maybe Data.POSIX,
    -- | The Amazon Resource Name (ARN) for the job.
    JobSummary -> Text
jobArn :: Prelude.Text,
    -- | The unique ID for the job.
    JobSummary -> Text
jobId :: Prelude.Text,
    -- | The commit ID from a third-party repository provider for the job.
    JobSummary -> Text
commitId :: Prelude.Text,
    -- | The commit message from a third-party repository provider for the job.
    JobSummary -> Text
commitMessage :: Prelude.Text,
    -- | The commit date and time for the job.
    JobSummary -> POSIX
commitTime :: Data.POSIX,
    -- | The start date and time for the job.
    JobSummary -> POSIX
startTime :: Data.POSIX,
    -- | The current status for the job.
    JobSummary -> JobStatus
status :: JobStatus,
    -- | The type for the job. If the value is @RELEASE@, the job was manually
    -- released from its source by using the @StartJob@ API. If the value is
    -- @RETRY@, the job was manually retried using the @StartJob@ API. If the
    -- value is @WEB_HOOK@, the job was automatically triggered by webhooks.
    JobSummary -> JobType
jobType :: JobType
  }
  deriving (JobSummary -> JobSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: JobSummary -> JobSummary -> Bool
$c/= :: JobSummary -> JobSummary -> Bool
== :: JobSummary -> JobSummary -> Bool
$c== :: JobSummary -> JobSummary -> Bool
Prelude.Eq, ReadPrec [JobSummary]
ReadPrec JobSummary
Int -> ReadS JobSummary
ReadS [JobSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [JobSummary]
$creadListPrec :: ReadPrec [JobSummary]
readPrec :: ReadPrec JobSummary
$creadPrec :: ReadPrec JobSummary
readList :: ReadS [JobSummary]
$creadList :: ReadS [JobSummary]
readsPrec :: Int -> ReadS JobSummary
$creadsPrec :: Int -> ReadS JobSummary
Prelude.Read, Int -> JobSummary -> ShowS
[JobSummary] -> ShowS
JobSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [JobSummary] -> ShowS
$cshowList :: [JobSummary] -> ShowS
show :: JobSummary -> String
$cshow :: JobSummary -> String
showsPrec :: Int -> JobSummary -> ShowS
$cshowsPrec :: Int -> JobSummary -> ShowS
Prelude.Show, forall x. Rep JobSummary x -> JobSummary
forall x. JobSummary -> Rep JobSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep JobSummary x -> JobSummary
$cfrom :: forall x. JobSummary -> Rep JobSummary x
Prelude.Generic)

-- |
-- Create a value of 'JobSummary' 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', 'jobSummary_endTime' - The end date and time for the job.
--
-- 'jobArn', 'jobSummary_jobArn' - The Amazon Resource Name (ARN) for the job.
--
-- 'jobId', 'jobSummary_jobId' - The unique ID for the job.
--
-- 'commitId', 'jobSummary_commitId' - The commit ID from a third-party repository provider for the job.
--
-- 'commitMessage', 'jobSummary_commitMessage' - The commit message from a third-party repository provider for the job.
--
-- 'commitTime', 'jobSummary_commitTime' - The commit date and time for the job.
--
-- 'startTime', 'jobSummary_startTime' - The start date and time for the job.
--
-- 'status', 'jobSummary_status' - The current status for the job.
--
-- 'jobType', 'jobSummary_jobType' - The type for the job. If the value is @RELEASE@, the job was manually
-- released from its source by using the @StartJob@ API. If the value is
-- @RETRY@, the job was manually retried using the @StartJob@ API. If the
-- value is @WEB_HOOK@, the job was automatically triggered by webhooks.
newJobSummary ::
  -- | 'jobArn'
  Prelude.Text ->
  -- | 'jobId'
  Prelude.Text ->
  -- | 'commitId'
  Prelude.Text ->
  -- | 'commitMessage'
  Prelude.Text ->
  -- | 'commitTime'
  Prelude.UTCTime ->
  -- | 'startTime'
  Prelude.UTCTime ->
  -- | 'status'
  JobStatus ->
  -- | 'jobType'
  JobType ->
  JobSummary
newJobSummary :: Text
-> Text
-> Text
-> Text
-> UTCTime
-> UTCTime
-> JobStatus
-> JobType
-> JobSummary
newJobSummary
  Text
pJobArn_
  Text
pJobId_
  Text
pCommitId_
  Text
pCommitMessage_
  UTCTime
pCommitTime_
  UTCTime
pStartTime_
  JobStatus
pStatus_
  JobType
pJobType_ =
    JobSummary'
      { $sel:endTime:JobSummary' :: Maybe POSIX
endTime = forall a. Maybe a
Prelude.Nothing,
        $sel:jobArn:JobSummary' :: Text
jobArn = Text
pJobArn_,
        $sel:jobId:JobSummary' :: Text
jobId = Text
pJobId_,
        $sel:commitId:JobSummary' :: Text
commitId = Text
pCommitId_,
        $sel:commitMessage:JobSummary' :: Text
commitMessage = Text
pCommitMessage_,
        $sel:commitTime:JobSummary' :: POSIX
commitTime = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pCommitTime_,
        $sel:startTime:JobSummary' :: POSIX
startTime = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pStartTime_,
        $sel:status:JobSummary' :: JobStatus
status = JobStatus
pStatus_,
        $sel:jobType:JobSummary' :: JobType
jobType = JobType
pJobType_
      }

-- | The end date and time for the job.
jobSummary_endTime :: Lens.Lens' JobSummary (Prelude.Maybe Prelude.UTCTime)
jobSummary_endTime :: Lens' JobSummary (Maybe UTCTime)
jobSummary_endTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobSummary' {Maybe POSIX
endTime :: Maybe POSIX
$sel:endTime:JobSummary' :: JobSummary -> Maybe POSIX
endTime} -> Maybe POSIX
endTime) (\s :: JobSummary
s@JobSummary' {} Maybe POSIX
a -> JobSummary
s {$sel:endTime:JobSummary' :: Maybe POSIX
endTime = Maybe POSIX
a} :: JobSummary) 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 Amazon Resource Name (ARN) for the job.
jobSummary_jobArn :: Lens.Lens' JobSummary Prelude.Text
jobSummary_jobArn :: Lens' JobSummary Text
jobSummary_jobArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobSummary' {Text
jobArn :: Text
$sel:jobArn:JobSummary' :: JobSummary -> Text
jobArn} -> Text
jobArn) (\s :: JobSummary
s@JobSummary' {} Text
a -> JobSummary
s {$sel:jobArn:JobSummary' :: Text
jobArn = Text
a} :: JobSummary)

-- | The unique ID for the job.
jobSummary_jobId :: Lens.Lens' JobSummary Prelude.Text
jobSummary_jobId :: Lens' JobSummary Text
jobSummary_jobId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobSummary' {Text
jobId :: Text
$sel:jobId:JobSummary' :: JobSummary -> Text
jobId} -> Text
jobId) (\s :: JobSummary
s@JobSummary' {} Text
a -> JobSummary
s {$sel:jobId:JobSummary' :: Text
jobId = Text
a} :: JobSummary)

-- | The commit ID from a third-party repository provider for the job.
jobSummary_commitId :: Lens.Lens' JobSummary Prelude.Text
jobSummary_commitId :: Lens' JobSummary Text
jobSummary_commitId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobSummary' {Text
commitId :: Text
$sel:commitId:JobSummary' :: JobSummary -> Text
commitId} -> Text
commitId) (\s :: JobSummary
s@JobSummary' {} Text
a -> JobSummary
s {$sel:commitId:JobSummary' :: Text
commitId = Text
a} :: JobSummary)

-- | The commit message from a third-party repository provider for the job.
jobSummary_commitMessage :: Lens.Lens' JobSummary Prelude.Text
jobSummary_commitMessage :: Lens' JobSummary Text
jobSummary_commitMessage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobSummary' {Text
commitMessage :: Text
$sel:commitMessage:JobSummary' :: JobSummary -> Text
commitMessage} -> Text
commitMessage) (\s :: JobSummary
s@JobSummary' {} Text
a -> JobSummary
s {$sel:commitMessage:JobSummary' :: Text
commitMessage = Text
a} :: JobSummary)

-- | The commit date and time for the job.
jobSummary_commitTime :: Lens.Lens' JobSummary Prelude.UTCTime
jobSummary_commitTime :: Lens' JobSummary UTCTime
jobSummary_commitTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobSummary' {POSIX
commitTime :: POSIX
$sel:commitTime:JobSummary' :: JobSummary -> POSIX
commitTime} -> POSIX
commitTime) (\s :: JobSummary
s@JobSummary' {} POSIX
a -> JobSummary
s {$sel:commitTime:JobSummary' :: POSIX
commitTime = POSIX
a} :: JobSummary) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The start date and time for the job.
jobSummary_startTime :: Lens.Lens' JobSummary Prelude.UTCTime
jobSummary_startTime :: Lens' JobSummary UTCTime
jobSummary_startTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobSummary' {POSIX
startTime :: POSIX
$sel:startTime:JobSummary' :: JobSummary -> POSIX
startTime} -> POSIX
startTime) (\s :: JobSummary
s@JobSummary' {} POSIX
a -> JobSummary
s {$sel:startTime:JobSummary' :: POSIX
startTime = POSIX
a} :: JobSummary) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The current status for the job.
jobSummary_status :: Lens.Lens' JobSummary JobStatus
jobSummary_status :: Lens' JobSummary JobStatus
jobSummary_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobSummary' {JobStatus
status :: JobStatus
$sel:status:JobSummary' :: JobSummary -> JobStatus
status} -> JobStatus
status) (\s :: JobSummary
s@JobSummary' {} JobStatus
a -> JobSummary
s {$sel:status:JobSummary' :: JobStatus
status = JobStatus
a} :: JobSummary)

-- | The type for the job. If the value is @RELEASE@, the job was manually
-- released from its source by using the @StartJob@ API. If the value is
-- @RETRY@, the job was manually retried using the @StartJob@ API. If the
-- value is @WEB_HOOK@, the job was automatically triggered by webhooks.
jobSummary_jobType :: Lens.Lens' JobSummary JobType
jobSummary_jobType :: Lens' JobSummary JobType
jobSummary_jobType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobSummary' {JobType
jobType :: JobType
$sel:jobType:JobSummary' :: JobSummary -> JobType
jobType} -> JobType
jobType) (\s :: JobSummary
s@JobSummary' {} JobType
a -> JobSummary
s {$sel:jobType:JobSummary' :: JobType
jobType = JobType
a} :: JobSummary)

instance Data.FromJSON JobSummary where
  parseJSON :: Value -> Parser JobSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"JobSummary"
      ( \Object
x ->
          Maybe POSIX
-> Text
-> Text
-> Text
-> Text
-> POSIX
-> POSIX
-> JobStatus
-> JobType
-> JobSummary
JobSummary'
            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 a
Data..: Key
"jobArn")
            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
"jobId")
            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
"commitId")
            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
"commitMessage")
            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
"commitTime")
            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")
            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
"jobType")
      )

instance Prelude.Hashable JobSummary where
  hashWithSalt :: Int -> JobSummary -> Int
hashWithSalt Int
_salt JobSummary' {Maybe POSIX
Text
POSIX
JobStatus
JobType
jobType :: JobType
status :: JobStatus
startTime :: POSIX
commitTime :: POSIX
commitMessage :: Text
commitId :: Text
jobId :: Text
jobArn :: Text
endTime :: Maybe POSIX
$sel:jobType:JobSummary' :: JobSummary -> JobType
$sel:status:JobSummary' :: JobSummary -> JobStatus
$sel:startTime:JobSummary' :: JobSummary -> POSIX
$sel:commitTime:JobSummary' :: JobSummary -> POSIX
$sel:commitMessage:JobSummary' :: JobSummary -> Text
$sel:commitId:JobSummary' :: JobSummary -> Text
$sel:jobId:JobSummary' :: JobSummary -> Text
$sel:jobArn:JobSummary' :: JobSummary -> Text
$sel:endTime:JobSummary' :: JobSummary -> 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` Text
jobArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
jobId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
commitId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
commitMessage
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` POSIX
commitTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` POSIX
startTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` JobStatus
status
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` JobType
jobType

instance Prelude.NFData JobSummary where
  rnf :: JobSummary -> ()
rnf JobSummary' {Maybe POSIX
Text
POSIX
JobStatus
JobType
jobType :: JobType
status :: JobStatus
startTime :: POSIX
commitTime :: POSIX
commitMessage :: Text
commitId :: Text
jobId :: Text
jobArn :: Text
endTime :: Maybe POSIX
$sel:jobType:JobSummary' :: JobSummary -> JobType
$sel:status:JobSummary' :: JobSummary -> JobStatus
$sel:startTime:JobSummary' :: JobSummary -> POSIX
$sel:commitTime:JobSummary' :: JobSummary -> POSIX
$sel:commitMessage:JobSummary' :: JobSummary -> Text
$sel:commitId:JobSummary' :: JobSummary -> Text
$sel:jobId:JobSummary' :: JobSummary -> Text
$sel:jobArn:JobSummary' :: JobSummary -> Text
$sel:endTime:JobSummary' :: JobSummary -> 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 Text
jobArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
jobId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
commitId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
commitMessage
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf POSIX
commitTime
      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 JobStatus
status
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf JobType
jobType