{-# 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.AppConfig.Types.ActionInvocation
-- 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.AppConfig.Types.ActionInvocation where

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

-- | An extension that was invoked as part of a deployment event.
--
-- /See:/ 'newActionInvocation' smart constructor.
data ActionInvocation = ActionInvocation'
  { -- | The name of the action.
    ActionInvocation -> Maybe Text
actionName :: Prelude.Maybe Prelude.Text,
    -- | The error code when an extension invocation fails.
    ActionInvocation -> Maybe Text
errorCode :: Prelude.Maybe Prelude.Text,
    -- | The error message when an extension invocation fails.
    ActionInvocation -> Maybe Text
errorMessage :: Prelude.Maybe Prelude.Text,
    -- | The name, the ID, or the Amazon Resource Name (ARN) of the extension.
    ActionInvocation -> Maybe Text
extensionIdentifier :: Prelude.Maybe Prelude.Text,
    -- | A system-generated ID for this invocation.
    ActionInvocation -> Maybe Text
invocationId :: Prelude.Maybe Prelude.Text,
    -- | An Amazon Resource Name (ARN) for an Identity and Access Management
    -- assume role.
    ActionInvocation -> Maybe Text
roleArn :: Prelude.Maybe Prelude.Text,
    -- | The extension URI associated to the action point in the extension
    -- definition. The URI can be an Amazon Resource Name (ARN) for one of the
    -- following: an Lambda function, an Amazon Simple Queue Service queue, an
    -- Amazon Simple Notification Service topic, or the Amazon EventBridge
    -- default event bus.
    ActionInvocation -> Maybe Text
uri :: Prelude.Maybe Prelude.Text
  }
  deriving (ActionInvocation -> ActionInvocation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ActionInvocation -> ActionInvocation -> Bool
$c/= :: ActionInvocation -> ActionInvocation -> Bool
== :: ActionInvocation -> ActionInvocation -> Bool
$c== :: ActionInvocation -> ActionInvocation -> Bool
Prelude.Eq, ReadPrec [ActionInvocation]
ReadPrec ActionInvocation
Int -> ReadS ActionInvocation
ReadS [ActionInvocation]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ActionInvocation]
$creadListPrec :: ReadPrec [ActionInvocation]
readPrec :: ReadPrec ActionInvocation
$creadPrec :: ReadPrec ActionInvocation
readList :: ReadS [ActionInvocation]
$creadList :: ReadS [ActionInvocation]
readsPrec :: Int -> ReadS ActionInvocation
$creadsPrec :: Int -> ReadS ActionInvocation
Prelude.Read, Int -> ActionInvocation -> ShowS
[ActionInvocation] -> ShowS
ActionInvocation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ActionInvocation] -> ShowS
$cshowList :: [ActionInvocation] -> ShowS
show :: ActionInvocation -> String
$cshow :: ActionInvocation -> String
showsPrec :: Int -> ActionInvocation -> ShowS
$cshowsPrec :: Int -> ActionInvocation -> ShowS
Prelude.Show, forall x. Rep ActionInvocation x -> ActionInvocation
forall x. ActionInvocation -> Rep ActionInvocation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ActionInvocation x -> ActionInvocation
$cfrom :: forall x. ActionInvocation -> Rep ActionInvocation x
Prelude.Generic)

-- |
-- Create a value of 'ActionInvocation' 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:
--
-- 'actionName', 'actionInvocation_actionName' - The name of the action.
--
-- 'errorCode', 'actionInvocation_errorCode' - The error code when an extension invocation fails.
--
-- 'errorMessage', 'actionInvocation_errorMessage' - The error message when an extension invocation fails.
--
-- 'extensionIdentifier', 'actionInvocation_extensionIdentifier' - The name, the ID, or the Amazon Resource Name (ARN) of the extension.
--
-- 'invocationId', 'actionInvocation_invocationId' - A system-generated ID for this invocation.
--
-- 'roleArn', 'actionInvocation_roleArn' - An Amazon Resource Name (ARN) for an Identity and Access Management
-- assume role.
--
-- 'uri', 'actionInvocation_uri' - The extension URI associated to the action point in the extension
-- definition. The URI can be an Amazon Resource Name (ARN) for one of the
-- following: an Lambda function, an Amazon Simple Queue Service queue, an
-- Amazon Simple Notification Service topic, or the Amazon EventBridge
-- default event bus.
newActionInvocation ::
  ActionInvocation
newActionInvocation :: ActionInvocation
newActionInvocation =
  ActionInvocation'
    { $sel:actionName:ActionInvocation' :: Maybe Text
actionName = forall a. Maybe a
Prelude.Nothing,
      $sel:errorCode:ActionInvocation' :: Maybe Text
errorCode = forall a. Maybe a
Prelude.Nothing,
      $sel:errorMessage:ActionInvocation' :: Maybe Text
errorMessage = forall a. Maybe a
Prelude.Nothing,
      $sel:extensionIdentifier:ActionInvocation' :: Maybe Text
extensionIdentifier = forall a. Maybe a
Prelude.Nothing,
      $sel:invocationId:ActionInvocation' :: Maybe Text
invocationId = forall a. Maybe a
Prelude.Nothing,
      $sel:roleArn:ActionInvocation' :: Maybe Text
roleArn = forall a. Maybe a
Prelude.Nothing,
      $sel:uri:ActionInvocation' :: Maybe Text
uri = forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the action.
actionInvocation_actionName :: Lens.Lens' ActionInvocation (Prelude.Maybe Prelude.Text)
actionInvocation_actionName :: Lens' ActionInvocation (Maybe Text)
actionInvocation_actionName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionInvocation' {Maybe Text
actionName :: Maybe Text
$sel:actionName:ActionInvocation' :: ActionInvocation -> Maybe Text
actionName} -> Maybe Text
actionName) (\s :: ActionInvocation
s@ActionInvocation' {} Maybe Text
a -> ActionInvocation
s {$sel:actionName:ActionInvocation' :: Maybe Text
actionName = Maybe Text
a} :: ActionInvocation)

-- | The error code when an extension invocation fails.
actionInvocation_errorCode :: Lens.Lens' ActionInvocation (Prelude.Maybe Prelude.Text)
actionInvocation_errorCode :: Lens' ActionInvocation (Maybe Text)
actionInvocation_errorCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionInvocation' {Maybe Text
errorCode :: Maybe Text
$sel:errorCode:ActionInvocation' :: ActionInvocation -> Maybe Text
errorCode} -> Maybe Text
errorCode) (\s :: ActionInvocation
s@ActionInvocation' {} Maybe Text
a -> ActionInvocation
s {$sel:errorCode:ActionInvocation' :: Maybe Text
errorCode = Maybe Text
a} :: ActionInvocation)

-- | The error message when an extension invocation fails.
actionInvocation_errorMessage :: Lens.Lens' ActionInvocation (Prelude.Maybe Prelude.Text)
actionInvocation_errorMessage :: Lens' ActionInvocation (Maybe Text)
actionInvocation_errorMessage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionInvocation' {Maybe Text
errorMessage :: Maybe Text
$sel:errorMessage:ActionInvocation' :: ActionInvocation -> Maybe Text
errorMessage} -> Maybe Text
errorMessage) (\s :: ActionInvocation
s@ActionInvocation' {} Maybe Text
a -> ActionInvocation
s {$sel:errorMessage:ActionInvocation' :: Maybe Text
errorMessage = Maybe Text
a} :: ActionInvocation)

-- | The name, the ID, or the Amazon Resource Name (ARN) of the extension.
actionInvocation_extensionIdentifier :: Lens.Lens' ActionInvocation (Prelude.Maybe Prelude.Text)
actionInvocation_extensionIdentifier :: Lens' ActionInvocation (Maybe Text)
actionInvocation_extensionIdentifier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionInvocation' {Maybe Text
extensionIdentifier :: Maybe Text
$sel:extensionIdentifier:ActionInvocation' :: ActionInvocation -> Maybe Text
extensionIdentifier} -> Maybe Text
extensionIdentifier) (\s :: ActionInvocation
s@ActionInvocation' {} Maybe Text
a -> ActionInvocation
s {$sel:extensionIdentifier:ActionInvocation' :: Maybe Text
extensionIdentifier = Maybe Text
a} :: ActionInvocation)

-- | A system-generated ID for this invocation.
actionInvocation_invocationId :: Lens.Lens' ActionInvocation (Prelude.Maybe Prelude.Text)
actionInvocation_invocationId :: Lens' ActionInvocation (Maybe Text)
actionInvocation_invocationId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionInvocation' {Maybe Text
invocationId :: Maybe Text
$sel:invocationId:ActionInvocation' :: ActionInvocation -> Maybe Text
invocationId} -> Maybe Text
invocationId) (\s :: ActionInvocation
s@ActionInvocation' {} Maybe Text
a -> ActionInvocation
s {$sel:invocationId:ActionInvocation' :: Maybe Text
invocationId = Maybe Text
a} :: ActionInvocation)

-- | An Amazon Resource Name (ARN) for an Identity and Access Management
-- assume role.
actionInvocation_roleArn :: Lens.Lens' ActionInvocation (Prelude.Maybe Prelude.Text)
actionInvocation_roleArn :: Lens' ActionInvocation (Maybe Text)
actionInvocation_roleArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionInvocation' {Maybe Text
roleArn :: Maybe Text
$sel:roleArn:ActionInvocation' :: ActionInvocation -> Maybe Text
roleArn} -> Maybe Text
roleArn) (\s :: ActionInvocation
s@ActionInvocation' {} Maybe Text
a -> ActionInvocation
s {$sel:roleArn:ActionInvocation' :: Maybe Text
roleArn = Maybe Text
a} :: ActionInvocation)

-- | The extension URI associated to the action point in the extension
-- definition. The URI can be an Amazon Resource Name (ARN) for one of the
-- following: an Lambda function, an Amazon Simple Queue Service queue, an
-- Amazon Simple Notification Service topic, or the Amazon EventBridge
-- default event bus.
actionInvocation_uri :: Lens.Lens' ActionInvocation (Prelude.Maybe Prelude.Text)
actionInvocation_uri :: Lens' ActionInvocation (Maybe Text)
actionInvocation_uri = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionInvocation' {Maybe Text
uri :: Maybe Text
$sel:uri:ActionInvocation' :: ActionInvocation -> Maybe Text
uri} -> Maybe Text
uri) (\s :: ActionInvocation
s@ActionInvocation' {} Maybe Text
a -> ActionInvocation
s {$sel:uri:ActionInvocation' :: Maybe Text
uri = Maybe Text
a} :: ActionInvocation)

instance Data.FromJSON ActionInvocation where
  parseJSON :: Value -> Parser ActionInvocation
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ActionInvocation"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> ActionInvocation
ActionInvocation'
            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
"ActionName")
            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
"ErrorCode")
            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
"ErrorMessage")
            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
"ExtensionIdentifier")
            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
"InvocationId")
            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
"RoleArn")
            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
"Uri")
      )

instance Prelude.Hashable ActionInvocation where
  hashWithSalt :: Int -> ActionInvocation -> Int
hashWithSalt Int
_salt ActionInvocation' {Maybe Text
uri :: Maybe Text
roleArn :: Maybe Text
invocationId :: Maybe Text
extensionIdentifier :: Maybe Text
errorMessage :: Maybe Text
errorCode :: Maybe Text
actionName :: Maybe Text
$sel:uri:ActionInvocation' :: ActionInvocation -> Maybe Text
$sel:roleArn:ActionInvocation' :: ActionInvocation -> Maybe Text
$sel:invocationId:ActionInvocation' :: ActionInvocation -> Maybe Text
$sel:extensionIdentifier:ActionInvocation' :: ActionInvocation -> Maybe Text
$sel:errorMessage:ActionInvocation' :: ActionInvocation -> Maybe Text
$sel:errorCode:ActionInvocation' :: ActionInvocation -> Maybe Text
$sel:actionName:ActionInvocation' :: ActionInvocation -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
actionName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
errorCode
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
errorMessage
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
extensionIdentifier
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
invocationId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
roleArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
uri

instance Prelude.NFData ActionInvocation where
  rnf :: ActionInvocation -> ()
rnf ActionInvocation' {Maybe Text
uri :: Maybe Text
roleArn :: Maybe Text
invocationId :: Maybe Text
extensionIdentifier :: Maybe Text
errorMessage :: Maybe Text
errorCode :: Maybe Text
actionName :: Maybe Text
$sel:uri:ActionInvocation' :: ActionInvocation -> Maybe Text
$sel:roleArn:ActionInvocation' :: ActionInvocation -> Maybe Text
$sel:invocationId:ActionInvocation' :: ActionInvocation -> Maybe Text
$sel:extensionIdentifier:ActionInvocation' :: ActionInvocation -> Maybe Text
$sel:errorMessage:ActionInvocation' :: ActionInvocation -> Maybe Text
$sel:errorCode:ActionInvocation' :: ActionInvocation -> Maybe Text
$sel:actionName:ActionInvocation' :: ActionInvocation -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
actionName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
errorCode
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
errorMessage
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
extensionIdentifier
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
invocationId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
roleArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
uri