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

import Amazonka.CodePipeline.Types.ActionTypeId
import Amazonka.CodePipeline.Types.InputArtifact
import Amazonka.CodePipeline.Types.OutputArtifact
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Represents information about an action declaration.
--
-- /See:/ 'newActionDeclaration' smart constructor.
data ActionDeclaration = ActionDeclaration'
  { -- | The name or ID of the result of the action declaration, such as a test
    -- or build artifact.
    ActionDeclaration -> Maybe [OutputArtifact]
outputArtifacts :: Prelude.Maybe [OutputArtifact],
    -- | The variable namespace associated with the action. All variables
    -- produced as output by this action fall under this namespace.
    ActionDeclaration -> Maybe Text
namespace :: Prelude.Maybe Prelude.Text,
    -- | The order in which actions are run.
    ActionDeclaration -> Maybe Natural
runOrder :: Prelude.Maybe Prelude.Natural,
    -- | The action declaration\'s AWS Region, such as us-east-1.
    ActionDeclaration -> Maybe Text
region :: Prelude.Maybe Prelude.Text,
    -- | The action\'s configuration. These are key-value pairs that specify
    -- input values for an action. For more information, see
    -- <https://docs.aws.amazon.com/codepipeline/latest/userguide/reference-pipeline-structure.html#action-requirements Action Structure Requirements in CodePipeline>.
    -- For the list of configuration properties for the AWS CloudFormation
    -- action type in CodePipeline, see
    -- <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/continuous-delivery-codepipeline-action-reference.html Configuration Properties Reference>
    -- in the /AWS CloudFormation User Guide/. For template snippets with
    -- examples, see
    -- <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/continuous-delivery-codepipeline-parameter-override-functions.html Using Parameter Override Functions with CodePipeline Pipelines>
    -- in the /AWS CloudFormation User Guide/.
    --
    -- The values can be represented in either JSON or YAML format. For
    -- example, the JSON configuration item format is as follows:
    --
    -- /JSON:/
    --
    -- @\"Configuration\" : { Key : Value },@
    ActionDeclaration -> Maybe (HashMap Text Text)
configuration :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The name or ID of the artifact consumed by the action, such as a test or
    -- build artifact.
    ActionDeclaration -> Maybe [InputArtifact]
inputArtifacts :: Prelude.Maybe [InputArtifact],
    -- | The ARN of the IAM service role that performs the declared action. This
    -- is assumed through the roleArn for the pipeline.
    ActionDeclaration -> Maybe Text
roleArn :: Prelude.Maybe Prelude.Text,
    -- | The action declaration\'s name.
    ActionDeclaration -> Text
name :: Prelude.Text,
    -- | Specifies the action type and the provider of the action.
    ActionDeclaration -> ActionTypeId
actionTypeId :: ActionTypeId
  }
  deriving (ActionDeclaration -> ActionDeclaration -> Bool
(ActionDeclaration -> ActionDeclaration -> Bool)
-> (ActionDeclaration -> ActionDeclaration -> Bool)
-> Eq ActionDeclaration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ActionDeclaration -> ActionDeclaration -> Bool
$c/= :: ActionDeclaration -> ActionDeclaration -> Bool
== :: ActionDeclaration -> ActionDeclaration -> Bool
$c== :: ActionDeclaration -> ActionDeclaration -> Bool
Prelude.Eq, ReadPrec [ActionDeclaration]
ReadPrec ActionDeclaration
Int -> ReadS ActionDeclaration
ReadS [ActionDeclaration]
(Int -> ReadS ActionDeclaration)
-> ReadS [ActionDeclaration]
-> ReadPrec ActionDeclaration
-> ReadPrec [ActionDeclaration]
-> Read ActionDeclaration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ActionDeclaration]
$creadListPrec :: ReadPrec [ActionDeclaration]
readPrec :: ReadPrec ActionDeclaration
$creadPrec :: ReadPrec ActionDeclaration
readList :: ReadS [ActionDeclaration]
$creadList :: ReadS [ActionDeclaration]
readsPrec :: Int -> ReadS ActionDeclaration
$creadsPrec :: Int -> ReadS ActionDeclaration
Prelude.Read, Int -> ActionDeclaration -> ShowS
[ActionDeclaration] -> ShowS
ActionDeclaration -> String
(Int -> ActionDeclaration -> ShowS)
-> (ActionDeclaration -> String)
-> ([ActionDeclaration] -> ShowS)
-> Show ActionDeclaration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ActionDeclaration] -> ShowS
$cshowList :: [ActionDeclaration] -> ShowS
show :: ActionDeclaration -> String
$cshow :: ActionDeclaration -> String
showsPrec :: Int -> ActionDeclaration -> ShowS
$cshowsPrec :: Int -> ActionDeclaration -> ShowS
Prelude.Show, (forall x. ActionDeclaration -> Rep ActionDeclaration x)
-> (forall x. Rep ActionDeclaration x -> ActionDeclaration)
-> Generic ActionDeclaration
forall x. Rep ActionDeclaration x -> ActionDeclaration
forall x. ActionDeclaration -> Rep ActionDeclaration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ActionDeclaration x -> ActionDeclaration
$cfrom :: forall x. ActionDeclaration -> Rep ActionDeclaration x
Prelude.Generic)

-- |
-- Create a value of 'ActionDeclaration' 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:
--
-- 'outputArtifacts', 'actionDeclaration_outputArtifacts' - The name or ID of the result of the action declaration, such as a test
-- or build artifact.
--
-- 'namespace', 'actionDeclaration_namespace' - The variable namespace associated with the action. All variables
-- produced as output by this action fall under this namespace.
--
-- 'runOrder', 'actionDeclaration_runOrder' - The order in which actions are run.
--
-- 'region', 'actionDeclaration_region' - The action declaration\'s AWS Region, such as us-east-1.
--
-- 'configuration', 'actionDeclaration_configuration' - The action\'s configuration. These are key-value pairs that specify
-- input values for an action. For more information, see
-- <https://docs.aws.amazon.com/codepipeline/latest/userguide/reference-pipeline-structure.html#action-requirements Action Structure Requirements in CodePipeline>.
-- For the list of configuration properties for the AWS CloudFormation
-- action type in CodePipeline, see
-- <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/continuous-delivery-codepipeline-action-reference.html Configuration Properties Reference>
-- in the /AWS CloudFormation User Guide/. For template snippets with
-- examples, see
-- <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/continuous-delivery-codepipeline-parameter-override-functions.html Using Parameter Override Functions with CodePipeline Pipelines>
-- in the /AWS CloudFormation User Guide/.
--
-- The values can be represented in either JSON or YAML format. For
-- example, the JSON configuration item format is as follows:
--
-- /JSON:/
--
-- @\"Configuration\" : { Key : Value },@
--
-- 'inputArtifacts', 'actionDeclaration_inputArtifacts' - The name or ID of the artifact consumed by the action, such as a test or
-- build artifact.
--
-- 'roleArn', 'actionDeclaration_roleArn' - The ARN of the IAM service role that performs the declared action. This
-- is assumed through the roleArn for the pipeline.
--
-- 'name', 'actionDeclaration_name' - The action declaration\'s name.
--
-- 'actionTypeId', 'actionDeclaration_actionTypeId' - Specifies the action type and the provider of the action.
newActionDeclaration ::
  -- | 'name'
  Prelude.Text ->
  -- | 'actionTypeId'
  ActionTypeId ->
  ActionDeclaration
newActionDeclaration :: Text -> ActionTypeId -> ActionDeclaration
newActionDeclaration Text
pName_ ActionTypeId
pActionTypeId_ =
  ActionDeclaration' :: Maybe [OutputArtifact]
-> Maybe Text
-> Maybe Natural
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe [InputArtifact]
-> Maybe Text
-> Text
-> ActionTypeId
-> ActionDeclaration
ActionDeclaration'
    { $sel:outputArtifacts:ActionDeclaration' :: Maybe [OutputArtifact]
outputArtifacts =
        Maybe [OutputArtifact]
forall a. Maybe a
Prelude.Nothing,
      $sel:namespace:ActionDeclaration' :: Maybe Text
namespace = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:runOrder:ActionDeclaration' :: Maybe Natural
runOrder = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:region:ActionDeclaration' :: Maybe Text
region = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:configuration:ActionDeclaration' :: Maybe (HashMap Text Text)
configuration = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:inputArtifacts:ActionDeclaration' :: Maybe [InputArtifact]
inputArtifacts = Maybe [InputArtifact]
forall a. Maybe a
Prelude.Nothing,
      $sel:roleArn:ActionDeclaration' :: Maybe Text
roleArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:ActionDeclaration' :: Text
name = Text
pName_,
      $sel:actionTypeId:ActionDeclaration' :: ActionTypeId
actionTypeId = ActionTypeId
pActionTypeId_
    }

-- | The name or ID of the result of the action declaration, such as a test
-- or build artifact.
actionDeclaration_outputArtifacts :: Lens.Lens' ActionDeclaration (Prelude.Maybe [OutputArtifact])
actionDeclaration_outputArtifacts :: (Maybe [OutputArtifact] -> f (Maybe [OutputArtifact]))
-> ActionDeclaration -> f ActionDeclaration
actionDeclaration_outputArtifacts = (ActionDeclaration -> Maybe [OutputArtifact])
-> (ActionDeclaration
    -> Maybe [OutputArtifact] -> ActionDeclaration)
-> Lens
     ActionDeclaration
     ActionDeclaration
     (Maybe [OutputArtifact])
     (Maybe [OutputArtifact])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionDeclaration' {Maybe [OutputArtifact]
outputArtifacts :: Maybe [OutputArtifact]
$sel:outputArtifacts:ActionDeclaration' :: ActionDeclaration -> Maybe [OutputArtifact]
outputArtifacts} -> Maybe [OutputArtifact]
outputArtifacts) (\s :: ActionDeclaration
s@ActionDeclaration' {} Maybe [OutputArtifact]
a -> ActionDeclaration
s {$sel:outputArtifacts:ActionDeclaration' :: Maybe [OutputArtifact]
outputArtifacts = Maybe [OutputArtifact]
a} :: ActionDeclaration) ((Maybe [OutputArtifact] -> f (Maybe [OutputArtifact]))
 -> ActionDeclaration -> f ActionDeclaration)
-> ((Maybe [OutputArtifact] -> f (Maybe [OutputArtifact]))
    -> Maybe [OutputArtifact] -> f (Maybe [OutputArtifact]))
-> (Maybe [OutputArtifact] -> f (Maybe [OutputArtifact]))
-> ActionDeclaration
-> f ActionDeclaration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [OutputArtifact] [OutputArtifact] [OutputArtifact] [OutputArtifact]
-> Iso
     (Maybe [OutputArtifact])
     (Maybe [OutputArtifact])
     (Maybe [OutputArtifact])
     (Maybe [OutputArtifact])
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
  [OutputArtifact] [OutputArtifact] [OutputArtifact] [OutputArtifact]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The variable namespace associated with the action. All variables
-- produced as output by this action fall under this namespace.
actionDeclaration_namespace :: Lens.Lens' ActionDeclaration (Prelude.Maybe Prelude.Text)
actionDeclaration_namespace :: (Maybe Text -> f (Maybe Text))
-> ActionDeclaration -> f ActionDeclaration
actionDeclaration_namespace = (ActionDeclaration -> Maybe Text)
-> (ActionDeclaration -> Maybe Text -> ActionDeclaration)
-> Lens
     ActionDeclaration ActionDeclaration (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionDeclaration' {Maybe Text
namespace :: Maybe Text
$sel:namespace:ActionDeclaration' :: ActionDeclaration -> Maybe Text
namespace} -> Maybe Text
namespace) (\s :: ActionDeclaration
s@ActionDeclaration' {} Maybe Text
a -> ActionDeclaration
s {$sel:namespace:ActionDeclaration' :: Maybe Text
namespace = Maybe Text
a} :: ActionDeclaration)

-- | The order in which actions are run.
actionDeclaration_runOrder :: Lens.Lens' ActionDeclaration (Prelude.Maybe Prelude.Natural)
actionDeclaration_runOrder :: (Maybe Natural -> f (Maybe Natural))
-> ActionDeclaration -> f ActionDeclaration
actionDeclaration_runOrder = (ActionDeclaration -> Maybe Natural)
-> (ActionDeclaration -> Maybe Natural -> ActionDeclaration)
-> Lens
     ActionDeclaration ActionDeclaration (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionDeclaration' {Maybe Natural
runOrder :: Maybe Natural
$sel:runOrder:ActionDeclaration' :: ActionDeclaration -> Maybe Natural
runOrder} -> Maybe Natural
runOrder) (\s :: ActionDeclaration
s@ActionDeclaration' {} Maybe Natural
a -> ActionDeclaration
s {$sel:runOrder:ActionDeclaration' :: Maybe Natural
runOrder = Maybe Natural
a} :: ActionDeclaration)

-- | The action declaration\'s AWS Region, such as us-east-1.
actionDeclaration_region :: Lens.Lens' ActionDeclaration (Prelude.Maybe Prelude.Text)
actionDeclaration_region :: (Maybe Text -> f (Maybe Text))
-> ActionDeclaration -> f ActionDeclaration
actionDeclaration_region = (ActionDeclaration -> Maybe Text)
-> (ActionDeclaration -> Maybe Text -> ActionDeclaration)
-> Lens
     ActionDeclaration ActionDeclaration (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionDeclaration' {Maybe Text
region :: Maybe Text
$sel:region:ActionDeclaration' :: ActionDeclaration -> Maybe Text
region} -> Maybe Text
region) (\s :: ActionDeclaration
s@ActionDeclaration' {} Maybe Text
a -> ActionDeclaration
s {$sel:region:ActionDeclaration' :: Maybe Text
region = Maybe Text
a} :: ActionDeclaration)

-- | The action\'s configuration. These are key-value pairs that specify
-- input values for an action. For more information, see
-- <https://docs.aws.amazon.com/codepipeline/latest/userguide/reference-pipeline-structure.html#action-requirements Action Structure Requirements in CodePipeline>.
-- For the list of configuration properties for the AWS CloudFormation
-- action type in CodePipeline, see
-- <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/continuous-delivery-codepipeline-action-reference.html Configuration Properties Reference>
-- in the /AWS CloudFormation User Guide/. For template snippets with
-- examples, see
-- <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/continuous-delivery-codepipeline-parameter-override-functions.html Using Parameter Override Functions with CodePipeline Pipelines>
-- in the /AWS CloudFormation User Guide/.
--
-- The values can be represented in either JSON or YAML format. For
-- example, the JSON configuration item format is as follows:
--
-- /JSON:/
--
-- @\"Configuration\" : { Key : Value },@
actionDeclaration_configuration :: Lens.Lens' ActionDeclaration (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
actionDeclaration_configuration :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> ActionDeclaration -> f ActionDeclaration
actionDeclaration_configuration = (ActionDeclaration -> Maybe (HashMap Text Text))
-> (ActionDeclaration
    -> Maybe (HashMap Text Text) -> ActionDeclaration)
-> Lens
     ActionDeclaration
     ActionDeclaration
     (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 (\ActionDeclaration' {Maybe (HashMap Text Text)
configuration :: Maybe (HashMap Text Text)
$sel:configuration:ActionDeclaration' :: ActionDeclaration -> Maybe (HashMap Text Text)
configuration} -> Maybe (HashMap Text Text)
configuration) (\s :: ActionDeclaration
s@ActionDeclaration' {} Maybe (HashMap Text Text)
a -> ActionDeclaration
s {$sel:configuration:ActionDeclaration' :: Maybe (HashMap Text Text)
configuration = Maybe (HashMap Text Text)
a} :: ActionDeclaration) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> ActionDeclaration -> f ActionDeclaration)
-> ((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)))
-> ActionDeclaration
-> f ActionDeclaration
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

-- | The name or ID of the artifact consumed by the action, such as a test or
-- build artifact.
actionDeclaration_inputArtifacts :: Lens.Lens' ActionDeclaration (Prelude.Maybe [InputArtifact])
actionDeclaration_inputArtifacts :: (Maybe [InputArtifact] -> f (Maybe [InputArtifact]))
-> ActionDeclaration -> f ActionDeclaration
actionDeclaration_inputArtifacts = (ActionDeclaration -> Maybe [InputArtifact])
-> (ActionDeclaration
    -> Maybe [InputArtifact] -> ActionDeclaration)
-> Lens
     ActionDeclaration
     ActionDeclaration
     (Maybe [InputArtifact])
     (Maybe [InputArtifact])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionDeclaration' {Maybe [InputArtifact]
inputArtifacts :: Maybe [InputArtifact]
$sel:inputArtifacts:ActionDeclaration' :: ActionDeclaration -> Maybe [InputArtifact]
inputArtifacts} -> Maybe [InputArtifact]
inputArtifacts) (\s :: ActionDeclaration
s@ActionDeclaration' {} Maybe [InputArtifact]
a -> ActionDeclaration
s {$sel:inputArtifacts:ActionDeclaration' :: Maybe [InputArtifact]
inputArtifacts = Maybe [InputArtifact]
a} :: ActionDeclaration) ((Maybe [InputArtifact] -> f (Maybe [InputArtifact]))
 -> ActionDeclaration -> f ActionDeclaration)
-> ((Maybe [InputArtifact] -> f (Maybe [InputArtifact]))
    -> Maybe [InputArtifact] -> f (Maybe [InputArtifact]))
-> (Maybe [InputArtifact] -> f (Maybe [InputArtifact]))
-> ActionDeclaration
-> f ActionDeclaration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [InputArtifact] [InputArtifact] [InputArtifact] [InputArtifact]
-> Iso
     (Maybe [InputArtifact])
     (Maybe [InputArtifact])
     (Maybe [InputArtifact])
     (Maybe [InputArtifact])
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
  [InputArtifact] [InputArtifact] [InputArtifact] [InputArtifact]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The ARN of the IAM service role that performs the declared action. This
-- is assumed through the roleArn for the pipeline.
actionDeclaration_roleArn :: Lens.Lens' ActionDeclaration (Prelude.Maybe Prelude.Text)
actionDeclaration_roleArn :: (Maybe Text -> f (Maybe Text))
-> ActionDeclaration -> f ActionDeclaration
actionDeclaration_roleArn = (ActionDeclaration -> Maybe Text)
-> (ActionDeclaration -> Maybe Text -> ActionDeclaration)
-> Lens
     ActionDeclaration ActionDeclaration (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionDeclaration' {Maybe Text
roleArn :: Maybe Text
$sel:roleArn:ActionDeclaration' :: ActionDeclaration -> Maybe Text
roleArn} -> Maybe Text
roleArn) (\s :: ActionDeclaration
s@ActionDeclaration' {} Maybe Text
a -> ActionDeclaration
s {$sel:roleArn:ActionDeclaration' :: Maybe Text
roleArn = Maybe Text
a} :: ActionDeclaration)

-- | The action declaration\'s name.
actionDeclaration_name :: Lens.Lens' ActionDeclaration Prelude.Text
actionDeclaration_name :: (Text -> f Text) -> ActionDeclaration -> f ActionDeclaration
actionDeclaration_name = (ActionDeclaration -> Text)
-> (ActionDeclaration -> Text -> ActionDeclaration)
-> Lens ActionDeclaration ActionDeclaration Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionDeclaration' {Text
name :: Text
$sel:name:ActionDeclaration' :: ActionDeclaration -> Text
name} -> Text
name) (\s :: ActionDeclaration
s@ActionDeclaration' {} Text
a -> ActionDeclaration
s {$sel:name:ActionDeclaration' :: Text
name = Text
a} :: ActionDeclaration)

-- | Specifies the action type and the provider of the action.
actionDeclaration_actionTypeId :: Lens.Lens' ActionDeclaration ActionTypeId
actionDeclaration_actionTypeId :: (ActionTypeId -> f ActionTypeId)
-> ActionDeclaration -> f ActionDeclaration
actionDeclaration_actionTypeId = (ActionDeclaration -> ActionTypeId)
-> (ActionDeclaration -> ActionTypeId -> ActionDeclaration)
-> Lens
     ActionDeclaration ActionDeclaration ActionTypeId ActionTypeId
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionDeclaration' {ActionTypeId
actionTypeId :: ActionTypeId
$sel:actionTypeId:ActionDeclaration' :: ActionDeclaration -> ActionTypeId
actionTypeId} -> ActionTypeId
actionTypeId) (\s :: ActionDeclaration
s@ActionDeclaration' {} ActionTypeId
a -> ActionDeclaration
s {$sel:actionTypeId:ActionDeclaration' :: ActionTypeId
actionTypeId = ActionTypeId
a} :: ActionDeclaration)

instance Core.FromJSON ActionDeclaration where
  parseJSON :: Value -> Parser ActionDeclaration
parseJSON =
    String
-> (Object -> Parser ActionDeclaration)
-> Value
-> Parser ActionDeclaration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ActionDeclaration"
      ( \Object
x ->
          Maybe [OutputArtifact]
-> Maybe Text
-> Maybe Natural
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe [InputArtifact]
-> Maybe Text
-> Text
-> ActionTypeId
-> ActionDeclaration
ActionDeclaration'
            (Maybe [OutputArtifact]
 -> Maybe Text
 -> Maybe Natural
 -> Maybe Text
 -> Maybe (HashMap Text Text)
 -> Maybe [InputArtifact]
 -> Maybe Text
 -> Text
 -> ActionTypeId
 -> ActionDeclaration)
-> Parser (Maybe [OutputArtifact])
-> Parser
     (Maybe Text
      -> Maybe Natural
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> Maybe [InputArtifact]
      -> Maybe Text
      -> Text
      -> ActionTypeId
      -> ActionDeclaration)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Parser (Maybe (Maybe [OutputArtifact]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"outputArtifacts"
                            Parser (Maybe (Maybe [OutputArtifact]))
-> Maybe [OutputArtifact] -> Parser (Maybe [OutputArtifact])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [OutputArtifact]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser
  (Maybe Text
   -> Maybe Natural
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> Maybe [InputArtifact]
   -> Maybe Text
   -> Text
   -> ActionTypeId
   -> ActionDeclaration)
-> Parser (Maybe Text)
-> Parser
     (Maybe Natural
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> Maybe [InputArtifact]
      -> Maybe Text
      -> Text
      -> ActionTypeId
      -> ActionDeclaration)
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
"namespace")
            Parser
  (Maybe Natural
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> Maybe [InputArtifact]
   -> Maybe Text
   -> Text
   -> ActionTypeId
   -> ActionDeclaration)
-> Parser (Maybe Natural)
-> Parser
     (Maybe Text
      -> Maybe (HashMap Text Text)
      -> Maybe [InputArtifact]
      -> Maybe Text
      -> Text
      -> ActionTypeId
      -> ActionDeclaration)
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
"runOrder")
            Parser
  (Maybe Text
   -> Maybe (HashMap Text Text)
   -> Maybe [InputArtifact]
   -> Maybe Text
   -> Text
   -> ActionTypeId
   -> ActionDeclaration)
-> Parser (Maybe Text)
-> Parser
     (Maybe (HashMap Text Text)
      -> Maybe [InputArtifact]
      -> Maybe Text
      -> Text
      -> ActionTypeId
      -> ActionDeclaration)
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
"region")
            Parser
  (Maybe (HashMap Text Text)
   -> Maybe [InputArtifact]
   -> Maybe Text
   -> Text
   -> ActionTypeId
   -> ActionDeclaration)
-> Parser (Maybe (HashMap Text Text))
-> Parser
     (Maybe [InputArtifact]
      -> Maybe Text -> Text -> ActionTypeId -> ActionDeclaration)
forall (f :: * -> *) a b. Applicative f => 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
"configuration" 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 [InputArtifact]
   -> Maybe Text -> Text -> ActionTypeId -> ActionDeclaration)
-> Parser (Maybe [InputArtifact])
-> Parser (Maybe Text -> Text -> ActionTypeId -> ActionDeclaration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [InputArtifact]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"inputArtifacts" Parser (Maybe (Maybe [InputArtifact]))
-> Maybe [InputArtifact] -> Parser (Maybe [InputArtifact])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [InputArtifact]
forall a. Monoid a => a
Prelude.mempty)
            Parser (Maybe Text -> Text -> ActionTypeId -> ActionDeclaration)
-> Parser (Maybe Text)
-> Parser (Text -> ActionTypeId -> ActionDeclaration)
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
"roleArn")
            Parser (Text -> ActionTypeId -> ActionDeclaration)
-> Parser Text -> Parser (ActionTypeId -> ActionDeclaration)
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
"name")
            Parser (ActionTypeId -> ActionDeclaration)
-> Parser ActionTypeId -> Parser ActionDeclaration
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser ActionTypeId
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"actionTypeId")
      )

instance Prelude.Hashable ActionDeclaration

instance Prelude.NFData ActionDeclaration

instance Core.ToJSON ActionDeclaration where
  toJSON :: ActionDeclaration -> Value
toJSON ActionDeclaration' {Maybe Natural
Maybe [InputArtifact]
Maybe [OutputArtifact]
Maybe Text
Maybe (HashMap Text Text)
Text
ActionTypeId
actionTypeId :: ActionTypeId
name :: Text
roleArn :: Maybe Text
inputArtifacts :: Maybe [InputArtifact]
configuration :: Maybe (HashMap Text Text)
region :: Maybe Text
runOrder :: Maybe Natural
namespace :: Maybe Text
outputArtifacts :: Maybe [OutputArtifact]
$sel:actionTypeId:ActionDeclaration' :: ActionDeclaration -> ActionTypeId
$sel:name:ActionDeclaration' :: ActionDeclaration -> Text
$sel:roleArn:ActionDeclaration' :: ActionDeclaration -> Maybe Text
$sel:inputArtifacts:ActionDeclaration' :: ActionDeclaration -> Maybe [InputArtifact]
$sel:configuration:ActionDeclaration' :: ActionDeclaration -> Maybe (HashMap Text Text)
$sel:region:ActionDeclaration' :: ActionDeclaration -> Maybe Text
$sel:runOrder:ActionDeclaration' :: ActionDeclaration -> Maybe Natural
$sel:namespace:ActionDeclaration' :: ActionDeclaration -> Maybe Text
$sel:outputArtifacts:ActionDeclaration' :: ActionDeclaration -> Maybe [OutputArtifact]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"outputArtifacts" Text -> [OutputArtifact] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([OutputArtifact] -> Pair) -> Maybe [OutputArtifact] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [OutputArtifact]
outputArtifacts,
            (Text
"namespace" 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
namespace,
            (Text
"runOrder" 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
runOrder,
            (Text
"region" 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
region,
            (Text
"configuration" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
configuration,
            (Text
"inputArtifacts" Text -> [InputArtifact] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([InputArtifact] -> Pair) -> Maybe [InputArtifact] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [InputArtifact]
inputArtifacts,
            (Text
"roleArn" 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
roleArn,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"actionTypeId" Text -> ActionTypeId -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ActionTypeId
actionTypeId)
          ]
      )