{-# 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.ExecutionDetails
-- 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.ExecutionDetails where

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

-- | The details of the actions taken and results produced on an artifact as
-- it passes through stages in the pipeline.
--
-- /See:/ 'newExecutionDetails' smart constructor.
data ExecutionDetails = ExecutionDetails'
  { -- | The summary of the current status of the actions.
    ExecutionDetails -> Maybe Text
summary :: Prelude.Maybe Prelude.Text,
    -- | The system-generated unique ID of this action used to identify this job
    -- worker in any external systems, such as AWS CodeDeploy.
    ExecutionDetails -> Maybe Text
externalExecutionId :: Prelude.Maybe Prelude.Text,
    -- | The percentage of work completed on the action, represented on a scale
    -- of 0 to 100 percent.
    ExecutionDetails -> Maybe Natural
percentComplete :: Prelude.Maybe Prelude.Natural
  }
  deriving (ExecutionDetails -> ExecutionDetails -> Bool
(ExecutionDetails -> ExecutionDetails -> Bool)
-> (ExecutionDetails -> ExecutionDetails -> Bool)
-> Eq ExecutionDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExecutionDetails -> ExecutionDetails -> Bool
$c/= :: ExecutionDetails -> ExecutionDetails -> Bool
== :: ExecutionDetails -> ExecutionDetails -> Bool
$c== :: ExecutionDetails -> ExecutionDetails -> Bool
Prelude.Eq, ReadPrec [ExecutionDetails]
ReadPrec ExecutionDetails
Int -> ReadS ExecutionDetails
ReadS [ExecutionDetails]
(Int -> ReadS ExecutionDetails)
-> ReadS [ExecutionDetails]
-> ReadPrec ExecutionDetails
-> ReadPrec [ExecutionDetails]
-> Read ExecutionDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ExecutionDetails]
$creadListPrec :: ReadPrec [ExecutionDetails]
readPrec :: ReadPrec ExecutionDetails
$creadPrec :: ReadPrec ExecutionDetails
readList :: ReadS [ExecutionDetails]
$creadList :: ReadS [ExecutionDetails]
readsPrec :: Int -> ReadS ExecutionDetails
$creadsPrec :: Int -> ReadS ExecutionDetails
Prelude.Read, Int -> ExecutionDetails -> ShowS
[ExecutionDetails] -> ShowS
ExecutionDetails -> String
(Int -> ExecutionDetails -> ShowS)
-> (ExecutionDetails -> String)
-> ([ExecutionDetails] -> ShowS)
-> Show ExecutionDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExecutionDetails] -> ShowS
$cshowList :: [ExecutionDetails] -> ShowS
show :: ExecutionDetails -> String
$cshow :: ExecutionDetails -> String
showsPrec :: Int -> ExecutionDetails -> ShowS
$cshowsPrec :: Int -> ExecutionDetails -> ShowS
Prelude.Show, (forall x. ExecutionDetails -> Rep ExecutionDetails x)
-> (forall x. Rep ExecutionDetails x -> ExecutionDetails)
-> Generic ExecutionDetails
forall x. Rep ExecutionDetails x -> ExecutionDetails
forall x. ExecutionDetails -> Rep ExecutionDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ExecutionDetails x -> ExecutionDetails
$cfrom :: forall x. ExecutionDetails -> Rep ExecutionDetails x
Prelude.Generic)

-- |
-- Create a value of 'ExecutionDetails' 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:
--
-- 'summary', 'executionDetails_summary' - The summary of the current status of the actions.
--
-- 'externalExecutionId', 'executionDetails_externalExecutionId' - The system-generated unique ID of this action used to identify this job
-- worker in any external systems, such as AWS CodeDeploy.
--
-- 'percentComplete', 'executionDetails_percentComplete' - The percentage of work completed on the action, represented on a scale
-- of 0 to 100 percent.
newExecutionDetails ::
  ExecutionDetails
newExecutionDetails :: ExecutionDetails
newExecutionDetails =
  ExecutionDetails' :: Maybe Text -> Maybe Text -> Maybe Natural -> ExecutionDetails
ExecutionDetails'
    { $sel:summary:ExecutionDetails' :: Maybe Text
summary = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:externalExecutionId:ExecutionDetails' :: Maybe Text
externalExecutionId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:percentComplete:ExecutionDetails' :: Maybe Natural
percentComplete = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | The summary of the current status of the actions.
executionDetails_summary :: Lens.Lens' ExecutionDetails (Prelude.Maybe Prelude.Text)
executionDetails_summary :: (Maybe Text -> f (Maybe Text))
-> ExecutionDetails -> f ExecutionDetails
executionDetails_summary = (ExecutionDetails -> Maybe Text)
-> (ExecutionDetails -> Maybe Text -> ExecutionDetails)
-> Lens ExecutionDetails ExecutionDetails (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExecutionDetails' {Maybe Text
summary :: Maybe Text
$sel:summary:ExecutionDetails' :: ExecutionDetails -> Maybe Text
summary} -> Maybe Text
summary) (\s :: ExecutionDetails
s@ExecutionDetails' {} Maybe Text
a -> ExecutionDetails
s {$sel:summary:ExecutionDetails' :: Maybe Text
summary = Maybe Text
a} :: ExecutionDetails)

-- | The system-generated unique ID of this action used to identify this job
-- worker in any external systems, such as AWS CodeDeploy.
executionDetails_externalExecutionId :: Lens.Lens' ExecutionDetails (Prelude.Maybe Prelude.Text)
executionDetails_externalExecutionId :: (Maybe Text -> f (Maybe Text))
-> ExecutionDetails -> f ExecutionDetails
executionDetails_externalExecutionId = (ExecutionDetails -> Maybe Text)
-> (ExecutionDetails -> Maybe Text -> ExecutionDetails)
-> Lens ExecutionDetails ExecutionDetails (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExecutionDetails' {Maybe Text
externalExecutionId :: Maybe Text
$sel:externalExecutionId:ExecutionDetails' :: ExecutionDetails -> Maybe Text
externalExecutionId} -> Maybe Text
externalExecutionId) (\s :: ExecutionDetails
s@ExecutionDetails' {} Maybe Text
a -> ExecutionDetails
s {$sel:externalExecutionId:ExecutionDetails' :: Maybe Text
externalExecutionId = Maybe Text
a} :: ExecutionDetails)

-- | The percentage of work completed on the action, represented on a scale
-- of 0 to 100 percent.
executionDetails_percentComplete :: Lens.Lens' ExecutionDetails (Prelude.Maybe Prelude.Natural)
executionDetails_percentComplete :: (Maybe Natural -> f (Maybe Natural))
-> ExecutionDetails -> f ExecutionDetails
executionDetails_percentComplete = (ExecutionDetails -> Maybe Natural)
-> (ExecutionDetails -> Maybe Natural -> ExecutionDetails)
-> Lens
     ExecutionDetails ExecutionDetails (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExecutionDetails' {Maybe Natural
percentComplete :: Maybe Natural
$sel:percentComplete:ExecutionDetails' :: ExecutionDetails -> Maybe Natural
percentComplete} -> Maybe Natural
percentComplete) (\s :: ExecutionDetails
s@ExecutionDetails' {} Maybe Natural
a -> ExecutionDetails
s {$sel:percentComplete:ExecutionDetails' :: Maybe Natural
percentComplete = Maybe Natural
a} :: ExecutionDetails)

instance Prelude.Hashable ExecutionDetails

instance Prelude.NFData ExecutionDetails

instance Core.ToJSON ExecutionDetails where
  toJSON :: ExecutionDetails -> Value
toJSON ExecutionDetails' {Maybe Natural
Maybe Text
percentComplete :: Maybe Natural
externalExecutionId :: Maybe Text
summary :: Maybe Text
$sel:percentComplete:ExecutionDetails' :: ExecutionDetails -> Maybe Natural
$sel:externalExecutionId:ExecutionDetails' :: ExecutionDetails -> Maybe Text
$sel:summary:ExecutionDetails' :: ExecutionDetails -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"summary" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
summary,
            (Text
"externalExecutionId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
externalExecutionId,
            (Text
"percentComplete" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
percentComplete
          ]
      )