{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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'
  { -- | Execution result information listed in the output details for an action
    -- execution.
    ActionExecutionOutput -> Maybe ActionExecutionResult
executionResult :: Prelude.Maybe ActionExecutionResult,
    -- | Details of output artifacts of the action that correspond to the action
    -- execution.
    ActionExecutionOutput -> Maybe [ArtifactDetail]
outputArtifacts :: Prelude.Maybe [ArtifactDetail],
    -- | 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)
  }
  deriving (ActionExecutionOutput -> ActionExecutionOutput -> Bool
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]
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
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. 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:
--
-- 'executionResult', 'actionExecutionOutput_executionResult' - Execution result information listed in the output details for an action
-- execution.
--
-- 'outputArtifacts', 'actionExecutionOutput_outputArtifacts' - Details of output artifacts of the action that correspond to the action
-- execution.
--
-- 'outputVariables', 'actionExecutionOutput_outputVariables' - The outputVariables field shows the key-value pairs that were output as
-- part of that execution.
newActionExecutionOutput ::
  ActionExecutionOutput
newActionExecutionOutput :: ActionExecutionOutput
newActionExecutionOutput =
  ActionExecutionOutput'
    { $sel:executionResult:ActionExecutionOutput' :: Maybe ActionExecutionResult
executionResult =
        forall a. Maybe a
Prelude.Nothing,
      $sel:outputArtifacts:ActionExecutionOutput' :: Maybe [ArtifactDetail]
outputArtifacts = forall a. Maybe a
Prelude.Nothing,
      $sel:outputVariables:ActionExecutionOutput' :: Maybe (HashMap Text Text)
outputVariables = forall a. Maybe a
Prelude.Nothing
    }

-- | Execution result information listed in the output details for an action
-- execution.
actionExecutionOutput_executionResult :: Lens.Lens' ActionExecutionOutput (Prelude.Maybe ActionExecutionResult)
actionExecutionOutput_executionResult :: Lens' ActionExecutionOutput (Maybe ActionExecutionResult)
actionExecutionOutput_executionResult = 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)

-- | Details of output artifacts of the action that correspond to the action
-- execution.
actionExecutionOutput_outputArtifacts :: Lens.Lens' ActionExecutionOutput (Prelude.Maybe [ArtifactDetail])
actionExecutionOutput_outputArtifacts :: Lens' ActionExecutionOutput (Maybe [ArtifactDetail])
actionExecutionOutput_outputArtifacts = 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) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | 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 :: Lens' ActionExecutionOutput (Maybe (HashMap Text Text))
actionExecutionOutput_outputVariables = 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) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.Hashable ActionExecutionOutput where
  hashWithSalt :: Int -> ActionExecutionOutput -> Int
hashWithSalt Int
_salt ActionExecutionOutput' {Maybe [ArtifactDetail]
Maybe (HashMap Text Text)
Maybe ActionExecutionResult
outputVariables :: Maybe (HashMap Text Text)
outputArtifacts :: Maybe [ArtifactDetail]
executionResult :: Maybe ActionExecutionResult
$sel:outputVariables:ActionExecutionOutput' :: ActionExecutionOutput -> Maybe (HashMap Text Text)
$sel:outputArtifacts:ActionExecutionOutput' :: ActionExecutionOutput -> Maybe [ArtifactDetail]
$sel:executionResult:ActionExecutionOutput' :: ActionExecutionOutput -> Maybe ActionExecutionResult
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ActionExecutionResult
executionResult
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [ArtifactDetail]
outputArtifacts
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
outputVariables

instance Prelude.NFData ActionExecutionOutput where
  rnf :: ActionExecutionOutput -> ()
rnf ActionExecutionOutput' {Maybe [ArtifactDetail]
Maybe (HashMap Text Text)
Maybe ActionExecutionResult
outputVariables :: Maybe (HashMap Text Text)
outputArtifacts :: Maybe [ArtifactDetail]
executionResult :: Maybe ActionExecutionResult
$sel:outputVariables:ActionExecutionOutput' :: ActionExecutionOutput -> Maybe (HashMap Text Text)
$sel:outputArtifacts:ActionExecutionOutput' :: ActionExecutionOutput -> Maybe [ArtifactDetail]
$sel:executionResult:ActionExecutionOutput' :: ActionExecutionOutput -> Maybe ActionExecutionResult
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ActionExecutionResult
executionResult
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [ArtifactDetail]
outputArtifacts
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
outputVariables