{-# 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.CodePipeline.Types.PipelineExecution
-- 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.CodePipeline.Types.PipelineExecution where

import Amazonka.CodePipeline.Types.ArtifactRevision
import Amazonka.CodePipeline.Types.PipelineExecutionStatus
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Represents information about an execution of a pipeline.
--
-- /See:/ 'newPipelineExecution' smart constructor.
data PipelineExecution = PipelineExecution'
  { -- | The status of the pipeline execution.
    --
    -- -   Cancelled: The pipeline’s definition was updated before the pipeline
    --     execution could be completed.
    --
    -- -   InProgress: The pipeline execution is currently running.
    --
    -- -   Stopped: The pipeline execution was manually stopped. For more
    --     information, see
    --     <https://docs.aws.amazon.com/codepipeline/latest/userguide/concepts.html#concepts-executions-stopped Stopped Executions>.
    --
    -- -   Stopping: The pipeline execution received a request to be manually
    --     stopped. Depending on the selected stop mode, the execution is
    --     either completing or abandoning in-progress actions. For more
    --     information, see
    --     <https://docs.aws.amazon.com/codepipeline/latest/userguide/concepts.html#concepts-executions-stopped Stopped Executions>.
    --
    -- -   Succeeded: The pipeline execution was completed successfully.
    --
    -- -   Superseded: While this pipeline execution was waiting for the next
    --     stage to be completed, a newer pipeline execution advanced and
    --     continued through the pipeline instead. For more information, see
    --     <https://docs.aws.amazon.com/codepipeline/latest/userguide/concepts.html#concepts-superseded Superseded Executions>.
    --
    -- -   Failed: The pipeline execution was not completed successfully.
    PipelineExecution -> Maybe PipelineExecutionStatus
status :: Prelude.Maybe PipelineExecutionStatus,
    -- | The name of the pipeline with the specified pipeline execution.
    PipelineExecution -> Maybe Text
pipelineName :: Prelude.Maybe Prelude.Text,
    -- | A summary that contains a description of the pipeline execution status.
    PipelineExecution -> Maybe Text
statusSummary :: Prelude.Maybe Prelude.Text,
    -- | The version number of the pipeline with the specified pipeline
    -- execution.
    PipelineExecution -> Maybe Natural
pipelineVersion :: Prelude.Maybe Prelude.Natural,
    -- | The ID of the pipeline execution.
    PipelineExecution -> Maybe Text
pipelineExecutionId :: Prelude.Maybe Prelude.Text,
    -- | A list of @ArtifactRevision@ objects included in a pipeline execution.
    PipelineExecution -> Maybe [ArtifactRevision]
artifactRevisions :: Prelude.Maybe [ArtifactRevision]
  }
  deriving (PipelineExecution -> PipelineExecution -> Bool
(PipelineExecution -> PipelineExecution -> Bool)
-> (PipelineExecution -> PipelineExecution -> Bool)
-> Eq PipelineExecution
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PipelineExecution -> PipelineExecution -> Bool
$c/= :: PipelineExecution -> PipelineExecution -> Bool
== :: PipelineExecution -> PipelineExecution -> Bool
$c== :: PipelineExecution -> PipelineExecution -> Bool
Prelude.Eq, ReadPrec [PipelineExecution]
ReadPrec PipelineExecution
Int -> ReadS PipelineExecution
ReadS [PipelineExecution]
(Int -> ReadS PipelineExecution)
-> ReadS [PipelineExecution]
-> ReadPrec PipelineExecution
-> ReadPrec [PipelineExecution]
-> Read PipelineExecution
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PipelineExecution]
$creadListPrec :: ReadPrec [PipelineExecution]
readPrec :: ReadPrec PipelineExecution
$creadPrec :: ReadPrec PipelineExecution
readList :: ReadS [PipelineExecution]
$creadList :: ReadS [PipelineExecution]
readsPrec :: Int -> ReadS PipelineExecution
$creadsPrec :: Int -> ReadS PipelineExecution
Prelude.Read, Int -> PipelineExecution -> ShowS
[PipelineExecution] -> ShowS
PipelineExecution -> String
(Int -> PipelineExecution -> ShowS)
-> (PipelineExecution -> String)
-> ([PipelineExecution] -> ShowS)
-> Show PipelineExecution
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PipelineExecution] -> ShowS
$cshowList :: [PipelineExecution] -> ShowS
show :: PipelineExecution -> String
$cshow :: PipelineExecution -> String
showsPrec :: Int -> PipelineExecution -> ShowS
$cshowsPrec :: Int -> PipelineExecution -> ShowS
Prelude.Show, (forall x. PipelineExecution -> Rep PipelineExecution x)
-> (forall x. Rep PipelineExecution x -> PipelineExecution)
-> Generic PipelineExecution
forall x. Rep PipelineExecution x -> PipelineExecution
forall x. PipelineExecution -> Rep PipelineExecution x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PipelineExecution x -> PipelineExecution
$cfrom :: forall x. PipelineExecution -> Rep PipelineExecution x
Prelude.Generic)

-- |
-- Create a value of 'PipelineExecution' 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:
--
-- 'status', 'pipelineExecution_status' - The status of the pipeline execution.
--
-- -   Cancelled: The pipeline’s definition was updated before the pipeline
--     execution could be completed.
--
-- -   InProgress: The pipeline execution is currently running.
--
-- -   Stopped: The pipeline execution was manually stopped. For more
--     information, see
--     <https://docs.aws.amazon.com/codepipeline/latest/userguide/concepts.html#concepts-executions-stopped Stopped Executions>.
--
-- -   Stopping: The pipeline execution received a request to be manually
--     stopped. Depending on the selected stop mode, the execution is
--     either completing or abandoning in-progress actions. For more
--     information, see
--     <https://docs.aws.amazon.com/codepipeline/latest/userguide/concepts.html#concepts-executions-stopped Stopped Executions>.
--
-- -   Succeeded: The pipeline execution was completed successfully.
--
-- -   Superseded: While this pipeline execution was waiting for the next
--     stage to be completed, a newer pipeline execution advanced and
--     continued through the pipeline instead. For more information, see
--     <https://docs.aws.amazon.com/codepipeline/latest/userguide/concepts.html#concepts-superseded Superseded Executions>.
--
-- -   Failed: The pipeline execution was not completed successfully.
--
-- 'pipelineName', 'pipelineExecution_pipelineName' - The name of the pipeline with the specified pipeline execution.
--
-- 'statusSummary', 'pipelineExecution_statusSummary' - A summary that contains a description of the pipeline execution status.
--
-- 'pipelineVersion', 'pipelineExecution_pipelineVersion' - The version number of the pipeline with the specified pipeline
-- execution.
--
-- 'pipelineExecutionId', 'pipelineExecution_pipelineExecutionId' - The ID of the pipeline execution.
--
-- 'artifactRevisions', 'pipelineExecution_artifactRevisions' - A list of @ArtifactRevision@ objects included in a pipeline execution.
newPipelineExecution ::
  PipelineExecution
newPipelineExecution :: PipelineExecution
newPipelineExecution =
  PipelineExecution' :: Maybe PipelineExecutionStatus
-> Maybe Text
-> Maybe Text
-> Maybe Natural
-> Maybe Text
-> Maybe [ArtifactRevision]
-> PipelineExecution
PipelineExecution'
    { $sel:status:PipelineExecution' :: Maybe PipelineExecutionStatus
status = Maybe PipelineExecutionStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:pipelineName:PipelineExecution' :: Maybe Text
pipelineName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:statusSummary:PipelineExecution' :: Maybe Text
statusSummary = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:pipelineVersion:PipelineExecution' :: Maybe Natural
pipelineVersion = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:pipelineExecutionId:PipelineExecution' :: Maybe Text
pipelineExecutionId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:artifactRevisions:PipelineExecution' :: Maybe [ArtifactRevision]
artifactRevisions = Maybe [ArtifactRevision]
forall a. Maybe a
Prelude.Nothing
    }

-- | The status of the pipeline execution.
--
-- -   Cancelled: The pipeline’s definition was updated before the pipeline
--     execution could be completed.
--
-- -   InProgress: The pipeline execution is currently running.
--
-- -   Stopped: The pipeline execution was manually stopped. For more
--     information, see
--     <https://docs.aws.amazon.com/codepipeline/latest/userguide/concepts.html#concepts-executions-stopped Stopped Executions>.
--
-- -   Stopping: The pipeline execution received a request to be manually
--     stopped. Depending on the selected stop mode, the execution is
--     either completing or abandoning in-progress actions. For more
--     information, see
--     <https://docs.aws.amazon.com/codepipeline/latest/userguide/concepts.html#concepts-executions-stopped Stopped Executions>.
--
-- -   Succeeded: The pipeline execution was completed successfully.
--
-- -   Superseded: While this pipeline execution was waiting for the next
--     stage to be completed, a newer pipeline execution advanced and
--     continued through the pipeline instead. For more information, see
--     <https://docs.aws.amazon.com/codepipeline/latest/userguide/concepts.html#concepts-superseded Superseded Executions>.
--
-- -   Failed: The pipeline execution was not completed successfully.
pipelineExecution_status :: Lens.Lens' PipelineExecution (Prelude.Maybe PipelineExecutionStatus)
pipelineExecution_status :: (Maybe PipelineExecutionStatus
 -> f (Maybe PipelineExecutionStatus))
-> PipelineExecution -> f PipelineExecution
pipelineExecution_status = (PipelineExecution -> Maybe PipelineExecutionStatus)
-> (PipelineExecution
    -> Maybe PipelineExecutionStatus -> PipelineExecution)
-> Lens
     PipelineExecution
     PipelineExecution
     (Maybe PipelineExecutionStatus)
     (Maybe PipelineExecutionStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PipelineExecution' {Maybe PipelineExecutionStatus
status :: Maybe PipelineExecutionStatus
$sel:status:PipelineExecution' :: PipelineExecution -> Maybe PipelineExecutionStatus
status} -> Maybe PipelineExecutionStatus
status) (\s :: PipelineExecution
s@PipelineExecution' {} Maybe PipelineExecutionStatus
a -> PipelineExecution
s {$sel:status:PipelineExecution' :: Maybe PipelineExecutionStatus
status = Maybe PipelineExecutionStatus
a} :: PipelineExecution)

-- | The name of the pipeline with the specified pipeline execution.
pipelineExecution_pipelineName :: Lens.Lens' PipelineExecution (Prelude.Maybe Prelude.Text)
pipelineExecution_pipelineName :: (Maybe Text -> f (Maybe Text))
-> PipelineExecution -> f PipelineExecution
pipelineExecution_pipelineName = (PipelineExecution -> Maybe Text)
-> (PipelineExecution -> Maybe Text -> PipelineExecution)
-> Lens
     PipelineExecution PipelineExecution (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PipelineExecution' {Maybe Text
pipelineName :: Maybe Text
$sel:pipelineName:PipelineExecution' :: PipelineExecution -> Maybe Text
pipelineName} -> Maybe Text
pipelineName) (\s :: PipelineExecution
s@PipelineExecution' {} Maybe Text
a -> PipelineExecution
s {$sel:pipelineName:PipelineExecution' :: Maybe Text
pipelineName = Maybe Text
a} :: PipelineExecution)

-- | A summary that contains a description of the pipeline execution status.
pipelineExecution_statusSummary :: Lens.Lens' PipelineExecution (Prelude.Maybe Prelude.Text)
pipelineExecution_statusSummary :: (Maybe Text -> f (Maybe Text))
-> PipelineExecution -> f PipelineExecution
pipelineExecution_statusSummary = (PipelineExecution -> Maybe Text)
-> (PipelineExecution -> Maybe Text -> PipelineExecution)
-> Lens
     PipelineExecution PipelineExecution (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PipelineExecution' {Maybe Text
statusSummary :: Maybe Text
$sel:statusSummary:PipelineExecution' :: PipelineExecution -> Maybe Text
statusSummary} -> Maybe Text
statusSummary) (\s :: PipelineExecution
s@PipelineExecution' {} Maybe Text
a -> PipelineExecution
s {$sel:statusSummary:PipelineExecution' :: Maybe Text
statusSummary = Maybe Text
a} :: PipelineExecution)

-- | The version number of the pipeline with the specified pipeline
-- execution.
pipelineExecution_pipelineVersion :: Lens.Lens' PipelineExecution (Prelude.Maybe Prelude.Natural)
pipelineExecution_pipelineVersion :: (Maybe Natural -> f (Maybe Natural))
-> PipelineExecution -> f PipelineExecution
pipelineExecution_pipelineVersion = (PipelineExecution -> Maybe Natural)
-> (PipelineExecution -> Maybe Natural -> PipelineExecution)
-> Lens
     PipelineExecution PipelineExecution (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PipelineExecution' {Maybe Natural
pipelineVersion :: Maybe Natural
$sel:pipelineVersion:PipelineExecution' :: PipelineExecution -> Maybe Natural
pipelineVersion} -> Maybe Natural
pipelineVersion) (\s :: PipelineExecution
s@PipelineExecution' {} Maybe Natural
a -> PipelineExecution
s {$sel:pipelineVersion:PipelineExecution' :: Maybe Natural
pipelineVersion = Maybe Natural
a} :: PipelineExecution)

-- | The ID of the pipeline execution.
pipelineExecution_pipelineExecutionId :: Lens.Lens' PipelineExecution (Prelude.Maybe Prelude.Text)
pipelineExecution_pipelineExecutionId :: (Maybe Text -> f (Maybe Text))
-> PipelineExecution -> f PipelineExecution
pipelineExecution_pipelineExecutionId = (PipelineExecution -> Maybe Text)
-> (PipelineExecution -> Maybe Text -> PipelineExecution)
-> Lens
     PipelineExecution PipelineExecution (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PipelineExecution' {Maybe Text
pipelineExecutionId :: Maybe Text
$sel:pipelineExecutionId:PipelineExecution' :: PipelineExecution -> Maybe Text
pipelineExecutionId} -> Maybe Text
pipelineExecutionId) (\s :: PipelineExecution
s@PipelineExecution' {} Maybe Text
a -> PipelineExecution
s {$sel:pipelineExecutionId:PipelineExecution' :: Maybe Text
pipelineExecutionId = Maybe Text
a} :: PipelineExecution)

-- | A list of @ArtifactRevision@ objects included in a pipeline execution.
pipelineExecution_artifactRevisions :: Lens.Lens' PipelineExecution (Prelude.Maybe [ArtifactRevision])
pipelineExecution_artifactRevisions :: (Maybe [ArtifactRevision] -> f (Maybe [ArtifactRevision]))
-> PipelineExecution -> f PipelineExecution
pipelineExecution_artifactRevisions = (PipelineExecution -> Maybe [ArtifactRevision])
-> (PipelineExecution
    -> Maybe [ArtifactRevision] -> PipelineExecution)
-> Lens
     PipelineExecution
     PipelineExecution
     (Maybe [ArtifactRevision])
     (Maybe [ArtifactRevision])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PipelineExecution' {Maybe [ArtifactRevision]
artifactRevisions :: Maybe [ArtifactRevision]
$sel:artifactRevisions:PipelineExecution' :: PipelineExecution -> Maybe [ArtifactRevision]
artifactRevisions} -> Maybe [ArtifactRevision]
artifactRevisions) (\s :: PipelineExecution
s@PipelineExecution' {} Maybe [ArtifactRevision]
a -> PipelineExecution
s {$sel:artifactRevisions:PipelineExecution' :: Maybe [ArtifactRevision]
artifactRevisions = Maybe [ArtifactRevision]
a} :: PipelineExecution) ((Maybe [ArtifactRevision] -> f (Maybe [ArtifactRevision]))
 -> PipelineExecution -> f PipelineExecution)
-> ((Maybe [ArtifactRevision] -> f (Maybe [ArtifactRevision]))
    -> Maybe [ArtifactRevision] -> f (Maybe [ArtifactRevision]))
-> (Maybe [ArtifactRevision] -> f (Maybe [ArtifactRevision]))
-> PipelineExecution
-> f PipelineExecution
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ArtifactRevision]
  [ArtifactRevision]
  [ArtifactRevision]
  [ArtifactRevision]
-> Iso
     (Maybe [ArtifactRevision])
     (Maybe [ArtifactRevision])
     (Maybe [ArtifactRevision])
     (Maybe [ArtifactRevision])
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
  [ArtifactRevision]
  [ArtifactRevision]
  [ArtifactRevision]
  [ArtifactRevision]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON PipelineExecution where
  parseJSON :: Value -> Parser PipelineExecution
parseJSON =
    String
-> (Object -> Parser PipelineExecution)
-> Value
-> Parser PipelineExecution
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"PipelineExecution"
      ( \Object
x ->
          Maybe PipelineExecutionStatus
-> Maybe Text
-> Maybe Text
-> Maybe Natural
-> Maybe Text
-> Maybe [ArtifactRevision]
-> PipelineExecution
PipelineExecution'
            (Maybe PipelineExecutionStatus
 -> Maybe Text
 -> Maybe Text
 -> Maybe Natural
 -> Maybe Text
 -> Maybe [ArtifactRevision]
 -> PipelineExecution)
-> Parser (Maybe PipelineExecutionStatus)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Natural
      -> Maybe Text
      -> Maybe [ArtifactRevision]
      -> PipelineExecution)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe PipelineExecutionStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"status")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Natural
   -> Maybe Text
   -> Maybe [ArtifactRevision]
   -> PipelineExecution)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Natural
      -> Maybe Text
      -> Maybe [ArtifactRevision]
      -> PipelineExecution)
forall (f :: * -> *) a b. Applicative f => 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
"pipelineName")
            Parser
  (Maybe Text
   -> Maybe Natural
   -> Maybe Text
   -> Maybe [ArtifactRevision]
   -> PipelineExecution)
-> Parser (Maybe Text)
-> Parser
     (Maybe Natural
      -> Maybe Text -> Maybe [ArtifactRevision] -> PipelineExecution)
forall (f :: * -> *) a b. Applicative f => 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
"statusSummary")
            Parser
  (Maybe Natural
   -> Maybe Text -> Maybe [ArtifactRevision] -> PipelineExecution)
-> Parser (Maybe Natural)
-> Parser
     (Maybe Text -> Maybe [ArtifactRevision] -> PipelineExecution)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"pipelineVersion")
            Parser
  (Maybe Text -> Maybe [ArtifactRevision] -> PipelineExecution)
-> Parser (Maybe Text)
-> Parser (Maybe [ArtifactRevision] -> PipelineExecution)
forall (f :: * -> *) a b. Applicative f => 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
"pipelineExecutionId")
            Parser (Maybe [ArtifactRevision] -> PipelineExecution)
-> Parser (Maybe [ArtifactRevision]) -> Parser PipelineExecution
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [ArtifactRevision]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"artifactRevisions"
                            Parser (Maybe (Maybe [ArtifactRevision]))
-> Maybe [ArtifactRevision] -> Parser (Maybe [ArtifactRevision])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [ArtifactRevision]
forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable PipelineExecution

instance Prelude.NFData PipelineExecution