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

import Amazonka.Amplify.Types.JobStatus
import Amazonka.Amplify.Types.JobType
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 Core.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 :: Core.POSIX,
    -- | The start date and time for the job.
    JobSummary -> POSIX
startTime :: Core.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
(JobSummary -> JobSummary -> Bool)
-> (JobSummary -> JobSummary -> Bool) -> Eq JobSummary
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]
(Int -> ReadS JobSummary)
-> ReadS [JobSummary]
-> ReadPrec JobSummary
-> ReadPrec [JobSummary]
-> Read 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
(Int -> JobSummary -> ShowS)
-> (JobSummary -> String)
-> ([JobSummary] -> ShowS)
-> Show JobSummary
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. JobSummary -> Rep JobSummary x)
-> (forall x. Rep JobSummary x -> JobSummary) -> Generic JobSummary
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' :: Maybe POSIX
-> Text
-> Text
-> Text
-> Text
-> POSIX
-> POSIX
-> JobStatus
-> JobType
-> JobSummary
JobSummary'
      { $sel:endTime:JobSummary' :: Maybe POSIX
endTime = Maybe POSIX
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 = Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pCommitTime_,
        $sel:startTime:JobSummary' :: POSIX
startTime = Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
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 :: (Maybe UTCTime -> f (Maybe UTCTime)) -> JobSummary -> f JobSummary
jobSummary_endTime = (JobSummary -> Maybe POSIX)
-> (JobSummary -> Maybe POSIX -> JobSummary)
-> Lens JobSummary JobSummary (Maybe POSIX) (Maybe POSIX)
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) ((Maybe POSIX -> f (Maybe POSIX)) -> JobSummary -> f JobSummary)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> JobSummary
-> f JobSummary
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 Amazon Resource Name (ARN) for the job.
jobSummary_jobArn :: Lens.Lens' JobSummary Prelude.Text
jobSummary_jobArn :: (Text -> f Text) -> JobSummary -> f JobSummary
jobSummary_jobArn = (JobSummary -> Text)
-> (JobSummary -> Text -> JobSummary)
-> Lens JobSummary JobSummary Text Text
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 :: (Text -> f Text) -> JobSummary -> f JobSummary
jobSummary_jobId = (JobSummary -> Text)
-> (JobSummary -> Text -> JobSummary)
-> Lens JobSummary JobSummary Text Text
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 :: (Text -> f Text) -> JobSummary -> f JobSummary
jobSummary_commitId = (JobSummary -> Text)
-> (JobSummary -> Text -> JobSummary)
-> Lens JobSummary JobSummary Text Text
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 :: (Text -> f Text) -> JobSummary -> f JobSummary
jobSummary_commitMessage = (JobSummary -> Text)
-> (JobSummary -> Text -> JobSummary)
-> Lens JobSummary JobSummary Text Text
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 :: (UTCTime -> f UTCTime) -> JobSummary -> f JobSummary
jobSummary_commitTime = (JobSummary -> POSIX)
-> (JobSummary -> POSIX -> JobSummary)
-> Lens JobSummary JobSummary POSIX POSIX
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) ((POSIX -> f POSIX) -> JobSummary -> f JobSummary)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> JobSummary
-> f JobSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The start date and time for the job.
jobSummary_startTime :: Lens.Lens' JobSummary Prelude.UTCTime
jobSummary_startTime :: (UTCTime -> f UTCTime) -> JobSummary -> f JobSummary
jobSummary_startTime = (JobSummary -> POSIX)
-> (JobSummary -> POSIX -> JobSummary)
-> Lens JobSummary JobSummary POSIX POSIX
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) ((POSIX -> f POSIX) -> JobSummary -> f JobSummary)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> JobSummary
-> f JobSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The current status for the job.
jobSummary_status :: Lens.Lens' JobSummary JobStatus
jobSummary_status :: (JobStatus -> f JobStatus) -> JobSummary -> f JobSummary
jobSummary_status = (JobSummary -> JobStatus)
-> (JobSummary -> JobStatus -> JobSummary)
-> Lens JobSummary JobSummary JobStatus JobStatus
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 :: (JobType -> f JobType) -> JobSummary -> f JobSummary
jobSummary_jobType = (JobSummary -> JobType)
-> (JobSummary -> JobType -> JobSummary)
-> Lens JobSummary JobSummary JobType 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 Core.FromJSON JobSummary where
  parseJSON :: Value -> Parser JobSummary
parseJSON =
    String
-> (Object -> Parser JobSummary) -> Value -> Parser JobSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"JobSummary"
      ( \Object
x ->
          Maybe POSIX
-> Text
-> Text
-> Text
-> Text
-> POSIX
-> POSIX
-> JobStatus
-> JobType
-> JobSummary
JobSummary'
            (Maybe POSIX
 -> Text
 -> Text
 -> Text
 -> Text
 -> POSIX
 -> POSIX
 -> JobStatus
 -> JobType
 -> JobSummary)
-> Parser (Maybe POSIX)
-> Parser
     (Text
      -> Text
      -> Text
      -> Text
      -> POSIX
      -> POSIX
      -> JobStatus
      -> JobType
      -> JobSummary)
forall (f :: * -> *) a b. Functor 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
"endTime")
            Parser
  (Text
   -> Text
   -> Text
   -> Text
   -> POSIX
   -> POSIX
   -> JobStatus
   -> JobType
   -> JobSummary)
-> Parser Text
-> Parser
     (Text
      -> Text
      -> Text
      -> POSIX
      -> POSIX
      -> JobStatus
      -> JobType
      -> JobSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"jobArn")
            Parser
  (Text
   -> Text
   -> Text
   -> POSIX
   -> POSIX
   -> JobStatus
   -> JobType
   -> JobSummary)
-> Parser Text
-> Parser
     (Text
      -> Text -> POSIX -> POSIX -> JobStatus -> JobType -> JobSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"jobId")
            Parser
  (Text
   -> Text -> POSIX -> POSIX -> JobStatus -> JobType -> JobSummary)
-> Parser Text
-> Parser
     (Text -> POSIX -> POSIX -> JobStatus -> JobType -> JobSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"commitId")
            Parser
  (Text -> POSIX -> POSIX -> JobStatus -> JobType -> JobSummary)
-> Parser Text
-> Parser (POSIX -> POSIX -> JobStatus -> JobType -> JobSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"commitMessage")
            Parser (POSIX -> POSIX -> JobStatus -> JobType -> JobSummary)
-> Parser POSIX
-> Parser (POSIX -> JobStatus -> JobType -> JobSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser POSIX
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"commitTime")
            Parser (POSIX -> JobStatus -> JobType -> JobSummary)
-> Parser POSIX -> Parser (JobStatus -> JobType -> JobSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser POSIX
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"startTime")
            Parser (JobStatus -> JobType -> JobSummary)
-> Parser JobStatus -> Parser (JobType -> JobSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser JobStatus
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"status")
            Parser (JobType -> JobSummary)
-> Parser JobType -> Parser JobSummary
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser JobType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"jobType")
      )

instance Prelude.Hashable JobSummary

instance Prelude.NFData JobSummary