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

import Amazonka.CodePipeline.Types.ActionExecutionResult
import Amazonka.CodePipeline.Types.ArtifactDetail
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Output details listed for an action execution, such as the action
-- execution result.
--
-- /See:/ 'newActionExecutionOutput' smart constructor.
data ActionExecutionOutput = ActionExecutionOutput'
  { -- | The outputVariables field shows the key-value pairs that were output as
    -- part of that execution.
    ActionExecutionOutput -> Maybe (HashMap Text Text)
outputVariables :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | Details of output artifacts of the action that correspond to the action
    -- execution.
    ActionExecutionOutput -> Maybe [ArtifactDetail]
outputArtifacts :: Prelude.Maybe [ArtifactDetail],
    -- | Execution result information listed in the output details for an action
    -- execution.
    ActionExecutionOutput -> Maybe ActionExecutionResult
executionResult :: Prelude.Maybe ActionExecutionResult
  }
  deriving (ActionExecutionOutput -> ActionExecutionOutput -> Bool
(ActionExecutionOutput -> ActionExecutionOutput -> Bool)
-> (ActionExecutionOutput -> ActionExecutionOutput -> Bool)
-> Eq ActionExecutionOutput
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ActionExecutionOutput -> ActionExecutionOutput -> Bool
$c/= :: ActionExecutionOutput -> ActionExecutionOutput -> Bool
== :: ActionExecutionOutput -> ActionExecutionOutput -> Bool
$c== :: ActionExecutionOutput -> ActionExecutionOutput -> Bool
Prelude.Eq, ReadPrec [ActionExecutionOutput]
ReadPrec ActionExecutionOutput
Int -> ReadS ActionExecutionOutput
ReadS [ActionExecutionOutput]
(Int -> ReadS ActionExecutionOutput)
-> ReadS [ActionExecutionOutput]
-> ReadPrec ActionExecutionOutput
-> ReadPrec [ActionExecutionOutput]
-> Read ActionExecutionOutput
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ActionExecutionOutput]
$creadListPrec :: ReadPrec [ActionExecutionOutput]
readPrec :: ReadPrec ActionExecutionOutput
$creadPrec :: ReadPrec ActionExecutionOutput
readList :: ReadS [ActionExecutionOutput]
$creadList :: ReadS [ActionExecutionOutput]
readsPrec :: Int -> ReadS ActionExecutionOutput
$creadsPrec :: Int -> ReadS ActionExecutionOutput
Prelude.Read, Int -> ActionExecutionOutput -> ShowS
[ActionExecutionOutput] -> ShowS
ActionExecutionOutput -> String
(Int -> ActionExecutionOutput -> ShowS)
-> (ActionExecutionOutput -> String)
-> ([ActionExecutionOutput] -> ShowS)
-> Show ActionExecutionOutput
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ActionExecutionOutput] -> ShowS
$cshowList :: [ActionExecutionOutput] -> ShowS
show :: ActionExecutionOutput -> String
$cshow :: ActionExecutionOutput -> String
showsPrec :: Int -> ActionExecutionOutput -> ShowS
$cshowsPrec :: Int -> ActionExecutionOutput -> ShowS
Prelude.Show, (forall x. ActionExecutionOutput -> Rep ActionExecutionOutput x)
-> (forall x. Rep ActionExecutionOutput x -> ActionExecutionOutput)
-> Generic ActionExecutionOutput
forall x. Rep ActionExecutionOutput x -> ActionExecutionOutput
forall x. ActionExecutionOutput -> Rep ActionExecutionOutput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ActionExecutionOutput x -> ActionExecutionOutput
$cfrom :: forall x. ActionExecutionOutput -> Rep ActionExecutionOutput x
Prelude.Generic)

-- |
-- Create a value of 'ActionExecutionOutput' 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:
--
-- 'outputVariables', 'actionExecutionOutput_outputVariables' - The outputVariables field shows the key-value pairs that were output as
-- part of that execution.
--
-- 'outputArtifacts', 'actionExecutionOutput_outputArtifacts' - Details of output artifacts of the action that correspond to the action
-- execution.
--
-- 'executionResult', 'actionExecutionOutput_executionResult' - Execution result information listed in the output details for an action
-- execution.
newActionExecutionOutput ::
  ActionExecutionOutput
newActionExecutionOutput :: ActionExecutionOutput
newActionExecutionOutput =
  ActionExecutionOutput' :: Maybe (HashMap Text Text)
-> Maybe [ArtifactDetail]
-> Maybe ActionExecutionResult
-> ActionExecutionOutput
ActionExecutionOutput'
    { $sel:outputVariables:ActionExecutionOutput' :: Maybe (HashMap Text Text)
outputVariables =
        Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:outputArtifacts:ActionExecutionOutput' :: Maybe [ArtifactDetail]
outputArtifacts = Maybe [ArtifactDetail]
forall a. Maybe a
Prelude.Nothing,
      $sel:executionResult:ActionExecutionOutput' :: Maybe ActionExecutionResult
executionResult = Maybe ActionExecutionResult
forall a. Maybe a
Prelude.Nothing
    }

-- | The outputVariables field shows the key-value pairs that were output as
-- part of that execution.
actionExecutionOutput_outputVariables :: Lens.Lens' ActionExecutionOutput (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
actionExecutionOutput_outputVariables :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> ActionExecutionOutput -> f ActionExecutionOutput
actionExecutionOutput_outputVariables = (ActionExecutionOutput -> Maybe (HashMap Text Text))
-> (ActionExecutionOutput
    -> Maybe (HashMap Text Text) -> ActionExecutionOutput)
-> Lens
     ActionExecutionOutput
     ActionExecutionOutput
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionExecutionOutput' {Maybe (HashMap Text Text)
outputVariables :: Maybe (HashMap Text Text)
$sel:outputVariables:ActionExecutionOutput' :: ActionExecutionOutput -> Maybe (HashMap Text Text)
outputVariables} -> Maybe (HashMap Text Text)
outputVariables) (\s :: ActionExecutionOutput
s@ActionExecutionOutput' {} Maybe (HashMap Text Text)
a -> ActionExecutionOutput
s {$sel:outputVariables:ActionExecutionOutput' :: Maybe (HashMap Text Text)
outputVariables = Maybe (HashMap Text Text)
a} :: ActionExecutionOutput) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> ActionExecutionOutput -> f ActionExecutionOutput)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> ActionExecutionOutput
-> f ActionExecutionOutput
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
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
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Details of output artifacts of the action that correspond to the action
-- execution.
actionExecutionOutput_outputArtifacts :: Lens.Lens' ActionExecutionOutput (Prelude.Maybe [ArtifactDetail])
actionExecutionOutput_outputArtifacts :: (Maybe [ArtifactDetail] -> f (Maybe [ArtifactDetail]))
-> ActionExecutionOutput -> f ActionExecutionOutput
actionExecutionOutput_outputArtifacts = (ActionExecutionOutput -> Maybe [ArtifactDetail])
-> (ActionExecutionOutput
    -> Maybe [ArtifactDetail] -> ActionExecutionOutput)
-> Lens
     ActionExecutionOutput
     ActionExecutionOutput
     (Maybe [ArtifactDetail])
     (Maybe [ArtifactDetail])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionExecutionOutput' {Maybe [ArtifactDetail]
outputArtifacts :: Maybe [ArtifactDetail]
$sel:outputArtifacts:ActionExecutionOutput' :: ActionExecutionOutput -> Maybe [ArtifactDetail]
outputArtifacts} -> Maybe [ArtifactDetail]
outputArtifacts) (\s :: ActionExecutionOutput
s@ActionExecutionOutput' {} Maybe [ArtifactDetail]
a -> ActionExecutionOutput
s {$sel:outputArtifacts:ActionExecutionOutput' :: Maybe [ArtifactDetail]
outputArtifacts = Maybe [ArtifactDetail]
a} :: ActionExecutionOutput) ((Maybe [ArtifactDetail] -> f (Maybe [ArtifactDetail]))
 -> ActionExecutionOutput -> f ActionExecutionOutput)
-> ((Maybe [ArtifactDetail] -> f (Maybe [ArtifactDetail]))
    -> Maybe [ArtifactDetail] -> f (Maybe [ArtifactDetail]))
-> (Maybe [ArtifactDetail] -> f (Maybe [ArtifactDetail]))
-> ActionExecutionOutput
-> f ActionExecutionOutput
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ArtifactDetail] [ArtifactDetail] [ArtifactDetail] [ArtifactDetail]
-> Iso
     (Maybe [ArtifactDetail])
     (Maybe [ArtifactDetail])
     (Maybe [ArtifactDetail])
     (Maybe [ArtifactDetail])
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
  [ArtifactDetail] [ArtifactDetail] [ArtifactDetail] [ArtifactDetail]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Execution result information listed in the output details for an action
-- execution.
actionExecutionOutput_executionResult :: Lens.Lens' ActionExecutionOutput (Prelude.Maybe ActionExecutionResult)
actionExecutionOutput_executionResult :: (Maybe ActionExecutionResult -> f (Maybe ActionExecutionResult))
-> ActionExecutionOutput -> f ActionExecutionOutput
actionExecutionOutput_executionResult = (ActionExecutionOutput -> Maybe ActionExecutionResult)
-> (ActionExecutionOutput
    -> Maybe ActionExecutionResult -> ActionExecutionOutput)
-> Lens
     ActionExecutionOutput
     ActionExecutionOutput
     (Maybe ActionExecutionResult)
     (Maybe ActionExecutionResult)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionExecutionOutput' {Maybe ActionExecutionResult
executionResult :: Maybe ActionExecutionResult
$sel:executionResult:ActionExecutionOutput' :: ActionExecutionOutput -> Maybe ActionExecutionResult
executionResult} -> Maybe ActionExecutionResult
executionResult) (\s :: ActionExecutionOutput
s@ActionExecutionOutput' {} Maybe ActionExecutionResult
a -> ActionExecutionOutput
s {$sel:executionResult:ActionExecutionOutput' :: Maybe ActionExecutionResult
executionResult = Maybe ActionExecutionResult
a} :: ActionExecutionOutput)

instance Core.FromJSON ActionExecutionOutput where
  parseJSON :: Value -> Parser ActionExecutionOutput
parseJSON =
    String
-> (Object -> Parser ActionExecutionOutput)
-> Value
-> Parser ActionExecutionOutput
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ActionExecutionOutput"
      ( \Object
x ->
          Maybe (HashMap Text Text)
-> Maybe [ArtifactDetail]
-> Maybe ActionExecutionResult
-> ActionExecutionOutput
ActionExecutionOutput'
            (Maybe (HashMap Text Text)
 -> Maybe [ArtifactDetail]
 -> Maybe ActionExecutionResult
 -> ActionExecutionOutput)
-> Parser (Maybe (HashMap Text Text))
-> Parser
     (Maybe [ArtifactDetail]
      -> Maybe ActionExecutionResult -> ActionExecutionOutput)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"outputVariables"
                            Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser
  (Maybe [ArtifactDetail]
   -> Maybe ActionExecutionResult -> ActionExecutionOutput)
-> Parser (Maybe [ArtifactDetail])
-> Parser (Maybe ActionExecutionResult -> ActionExecutionOutput)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [ArtifactDetail]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"outputArtifacts"
                            Parser (Maybe (Maybe [ArtifactDetail]))
-> Maybe [ArtifactDetail] -> Parser (Maybe [ArtifactDetail])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [ArtifactDetail]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser (Maybe ActionExecutionResult -> ActionExecutionOutput)
-> Parser (Maybe ActionExecutionResult)
-> Parser ActionExecutionOutput
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ActionExecutionResult)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"executionResult")
      )

instance Prelude.Hashable ActionExecutionOutput

instance Prelude.NFData ActionExecutionOutput