{-# 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.CloudFormation.Types.StackSetOperationResultSummary
-- 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.CloudFormation.Types.StackSetOperationResultSummary where

import Amazonka.CloudFormation.Types.AccountGateResult
import Amazonka.CloudFormation.Types.StackSetOperationResultStatus
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The structure that contains information about a specified operation\'s
-- results for a given account in a given Region.
--
-- /See:/ 'newStackSetOperationResultSummary' smart constructor.
data StackSetOperationResultSummary = StackSetOperationResultSummary'
  { -- | The result status of the stack set operation for the given account in
    -- the given Region.
    --
    -- -   @CANCELLED@: The operation in the specified account and Region has
    --     been cancelled. This is either because a user has stopped the stack
    --     set operation, or because the failure tolerance of the stack set
    --     operation has been exceeded.
    --
    -- -   @FAILED@: The operation in the specified account and Region failed.
    --
    --     If the stack set operation fails in enough accounts within a Region,
    --     the failure tolerance for the stack set operation as a whole might
    --     be exceeded.
    --
    -- -   @RUNNING@: The operation in the specified account and Region is
    --     currently in progress.
    --
    -- -   @PENDING@: The operation in the specified account and Region has yet
    --     to start.
    --
    -- -   @SUCCEEDED@: The operation in the specified account and Region
    --     completed successfully.
    StackSetOperationResultSummary
-> Maybe StackSetOperationResultStatus
status :: Prelude.Maybe StackSetOperationResultStatus,
    -- | [Self-managed permissions] The name of the Amazon Web Services account
    -- for this operation result.
    StackSetOperationResultSummary -> Maybe Text
account :: Prelude.Maybe Prelude.Text,
    -- | The results of the account gate function CloudFormation invokes, if
    -- present, before proceeding with stack set operations in an account
    StackSetOperationResultSummary -> Maybe AccountGateResult
accountGateResult :: Prelude.Maybe AccountGateResult,
    -- | [Service-managed permissions] The organization root ID or organizational
    -- unit (OU) IDs that you specified for
    -- <https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_DeploymentTargets.html DeploymentTargets>.
    StackSetOperationResultSummary -> Maybe Text
organizationalUnitId :: Prelude.Maybe Prelude.Text,
    -- | The name of the Amazon Web Services Region for this operation result.
    StackSetOperationResultSummary -> Maybe Text
region :: Prelude.Maybe Prelude.Text,
    -- | The reason for the assigned result status.
    StackSetOperationResultSummary -> Maybe Text
statusReason :: Prelude.Maybe Prelude.Text
  }
  deriving (StackSetOperationResultSummary
-> StackSetOperationResultSummary -> Bool
(StackSetOperationResultSummary
 -> StackSetOperationResultSummary -> Bool)
-> (StackSetOperationResultSummary
    -> StackSetOperationResultSummary -> Bool)
-> Eq StackSetOperationResultSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StackSetOperationResultSummary
-> StackSetOperationResultSummary -> Bool
$c/= :: StackSetOperationResultSummary
-> StackSetOperationResultSummary -> Bool
== :: StackSetOperationResultSummary
-> StackSetOperationResultSummary -> Bool
$c== :: StackSetOperationResultSummary
-> StackSetOperationResultSummary -> Bool
Prelude.Eq, ReadPrec [StackSetOperationResultSummary]
ReadPrec StackSetOperationResultSummary
Int -> ReadS StackSetOperationResultSummary
ReadS [StackSetOperationResultSummary]
(Int -> ReadS StackSetOperationResultSummary)
-> ReadS [StackSetOperationResultSummary]
-> ReadPrec StackSetOperationResultSummary
-> ReadPrec [StackSetOperationResultSummary]
-> Read StackSetOperationResultSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StackSetOperationResultSummary]
$creadListPrec :: ReadPrec [StackSetOperationResultSummary]
readPrec :: ReadPrec StackSetOperationResultSummary
$creadPrec :: ReadPrec StackSetOperationResultSummary
readList :: ReadS [StackSetOperationResultSummary]
$creadList :: ReadS [StackSetOperationResultSummary]
readsPrec :: Int -> ReadS StackSetOperationResultSummary
$creadsPrec :: Int -> ReadS StackSetOperationResultSummary
Prelude.Read, Int -> StackSetOperationResultSummary -> ShowS
[StackSetOperationResultSummary] -> ShowS
StackSetOperationResultSummary -> String
(Int -> StackSetOperationResultSummary -> ShowS)
-> (StackSetOperationResultSummary -> String)
-> ([StackSetOperationResultSummary] -> ShowS)
-> Show StackSetOperationResultSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StackSetOperationResultSummary] -> ShowS
$cshowList :: [StackSetOperationResultSummary] -> ShowS
show :: StackSetOperationResultSummary -> String
$cshow :: StackSetOperationResultSummary -> String
showsPrec :: Int -> StackSetOperationResultSummary -> ShowS
$cshowsPrec :: Int -> StackSetOperationResultSummary -> ShowS
Prelude.Show, (forall x.
 StackSetOperationResultSummary
 -> Rep StackSetOperationResultSummary x)
-> (forall x.
    Rep StackSetOperationResultSummary x
    -> StackSetOperationResultSummary)
-> Generic StackSetOperationResultSummary
forall x.
Rep StackSetOperationResultSummary x
-> StackSetOperationResultSummary
forall x.
StackSetOperationResultSummary
-> Rep StackSetOperationResultSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StackSetOperationResultSummary x
-> StackSetOperationResultSummary
$cfrom :: forall x.
StackSetOperationResultSummary
-> Rep StackSetOperationResultSummary x
Prelude.Generic)

-- |
-- Create a value of 'StackSetOperationResultSummary' 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:
--
-- 'status', 'stackSetOperationResultSummary_status' - The result status of the stack set operation for the given account in
-- the given Region.
--
-- -   @CANCELLED@: The operation in the specified account and Region has
--     been cancelled. This is either because a user has stopped the stack
--     set operation, or because the failure tolerance of the stack set
--     operation has been exceeded.
--
-- -   @FAILED@: The operation in the specified account and Region failed.
--
--     If the stack set operation fails in enough accounts within a Region,
--     the failure tolerance for the stack set operation as a whole might
--     be exceeded.
--
-- -   @RUNNING@: The operation in the specified account and Region is
--     currently in progress.
--
-- -   @PENDING@: The operation in the specified account and Region has yet
--     to start.
--
-- -   @SUCCEEDED@: The operation in the specified account and Region
--     completed successfully.
--
-- 'account', 'stackSetOperationResultSummary_account' - [Self-managed permissions] The name of the Amazon Web Services account
-- for this operation result.
--
-- 'accountGateResult', 'stackSetOperationResultSummary_accountGateResult' - The results of the account gate function CloudFormation invokes, if
-- present, before proceeding with stack set operations in an account
--
-- 'organizationalUnitId', 'stackSetOperationResultSummary_organizationalUnitId' - [Service-managed permissions] The organization root ID or organizational
-- unit (OU) IDs that you specified for
-- <https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_DeploymentTargets.html DeploymentTargets>.
--
-- 'region', 'stackSetOperationResultSummary_region' - The name of the Amazon Web Services Region for this operation result.
--
-- 'statusReason', 'stackSetOperationResultSummary_statusReason' - The reason for the assigned result status.
newStackSetOperationResultSummary ::
  StackSetOperationResultSummary
newStackSetOperationResultSummary :: StackSetOperationResultSummary
newStackSetOperationResultSummary =
  StackSetOperationResultSummary' :: Maybe StackSetOperationResultStatus
-> Maybe Text
-> Maybe AccountGateResult
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> StackSetOperationResultSummary
StackSetOperationResultSummary'
    { $sel:status:StackSetOperationResultSummary' :: Maybe StackSetOperationResultStatus
status =
        Maybe StackSetOperationResultStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:account:StackSetOperationResultSummary' :: Maybe Text
account = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:accountGateResult:StackSetOperationResultSummary' :: Maybe AccountGateResult
accountGateResult = Maybe AccountGateResult
forall a. Maybe a
Prelude.Nothing,
      $sel:organizationalUnitId:StackSetOperationResultSummary' :: Maybe Text
organizationalUnitId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:region:StackSetOperationResultSummary' :: Maybe Text
region = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:statusReason:StackSetOperationResultSummary' :: Maybe Text
statusReason = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The result status of the stack set operation for the given account in
-- the given Region.
--
-- -   @CANCELLED@: The operation in the specified account and Region has
--     been cancelled. This is either because a user has stopped the stack
--     set operation, or because the failure tolerance of the stack set
--     operation has been exceeded.
--
-- -   @FAILED@: The operation in the specified account and Region failed.
--
--     If the stack set operation fails in enough accounts within a Region,
--     the failure tolerance for the stack set operation as a whole might
--     be exceeded.
--
-- -   @RUNNING@: The operation in the specified account and Region is
--     currently in progress.
--
-- -   @PENDING@: The operation in the specified account and Region has yet
--     to start.
--
-- -   @SUCCEEDED@: The operation in the specified account and Region
--     completed successfully.
stackSetOperationResultSummary_status :: Lens.Lens' StackSetOperationResultSummary (Prelude.Maybe StackSetOperationResultStatus)
stackSetOperationResultSummary_status :: (Maybe StackSetOperationResultStatus
 -> f (Maybe StackSetOperationResultStatus))
-> StackSetOperationResultSummary
-> f StackSetOperationResultSummary
stackSetOperationResultSummary_status = (StackSetOperationResultSummary
 -> Maybe StackSetOperationResultStatus)
-> (StackSetOperationResultSummary
    -> Maybe StackSetOperationResultStatus
    -> StackSetOperationResultSummary)
-> Lens
     StackSetOperationResultSummary
     StackSetOperationResultSummary
     (Maybe StackSetOperationResultStatus)
     (Maybe StackSetOperationResultStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StackSetOperationResultSummary' {Maybe StackSetOperationResultStatus
status :: Maybe StackSetOperationResultStatus
$sel:status:StackSetOperationResultSummary' :: StackSetOperationResultSummary
-> Maybe StackSetOperationResultStatus
status} -> Maybe StackSetOperationResultStatus
status) (\s :: StackSetOperationResultSummary
s@StackSetOperationResultSummary' {} Maybe StackSetOperationResultStatus
a -> StackSetOperationResultSummary
s {$sel:status:StackSetOperationResultSummary' :: Maybe StackSetOperationResultStatus
status = Maybe StackSetOperationResultStatus
a} :: StackSetOperationResultSummary)

-- | [Self-managed permissions] The name of the Amazon Web Services account
-- for this operation result.
stackSetOperationResultSummary_account :: Lens.Lens' StackSetOperationResultSummary (Prelude.Maybe Prelude.Text)
stackSetOperationResultSummary_account :: (Maybe Text -> f (Maybe Text))
-> StackSetOperationResultSummary
-> f StackSetOperationResultSummary
stackSetOperationResultSummary_account = (StackSetOperationResultSummary -> Maybe Text)
-> (StackSetOperationResultSummary
    -> Maybe Text -> StackSetOperationResultSummary)
-> Lens
     StackSetOperationResultSummary
     StackSetOperationResultSummary
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StackSetOperationResultSummary' {Maybe Text
account :: Maybe Text
$sel:account:StackSetOperationResultSummary' :: StackSetOperationResultSummary -> Maybe Text
account} -> Maybe Text
account) (\s :: StackSetOperationResultSummary
s@StackSetOperationResultSummary' {} Maybe Text
a -> StackSetOperationResultSummary
s {$sel:account:StackSetOperationResultSummary' :: Maybe Text
account = Maybe Text
a} :: StackSetOperationResultSummary)

-- | The results of the account gate function CloudFormation invokes, if
-- present, before proceeding with stack set operations in an account
stackSetOperationResultSummary_accountGateResult :: Lens.Lens' StackSetOperationResultSummary (Prelude.Maybe AccountGateResult)
stackSetOperationResultSummary_accountGateResult :: (Maybe AccountGateResult -> f (Maybe AccountGateResult))
-> StackSetOperationResultSummary
-> f StackSetOperationResultSummary
stackSetOperationResultSummary_accountGateResult = (StackSetOperationResultSummary -> Maybe AccountGateResult)
-> (StackSetOperationResultSummary
    -> Maybe AccountGateResult -> StackSetOperationResultSummary)
-> Lens
     StackSetOperationResultSummary
     StackSetOperationResultSummary
     (Maybe AccountGateResult)
     (Maybe AccountGateResult)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StackSetOperationResultSummary' {Maybe AccountGateResult
accountGateResult :: Maybe AccountGateResult
$sel:accountGateResult:StackSetOperationResultSummary' :: StackSetOperationResultSummary -> Maybe AccountGateResult
accountGateResult} -> Maybe AccountGateResult
accountGateResult) (\s :: StackSetOperationResultSummary
s@StackSetOperationResultSummary' {} Maybe AccountGateResult
a -> StackSetOperationResultSummary
s {$sel:accountGateResult:StackSetOperationResultSummary' :: Maybe AccountGateResult
accountGateResult = Maybe AccountGateResult
a} :: StackSetOperationResultSummary)

-- | [Service-managed permissions] The organization root ID or organizational
-- unit (OU) IDs that you specified for
-- <https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_DeploymentTargets.html DeploymentTargets>.
stackSetOperationResultSummary_organizationalUnitId :: Lens.Lens' StackSetOperationResultSummary (Prelude.Maybe Prelude.Text)
stackSetOperationResultSummary_organizationalUnitId :: (Maybe Text -> f (Maybe Text))
-> StackSetOperationResultSummary
-> f StackSetOperationResultSummary
stackSetOperationResultSummary_organizationalUnitId = (StackSetOperationResultSummary -> Maybe Text)
-> (StackSetOperationResultSummary
    -> Maybe Text -> StackSetOperationResultSummary)
-> Lens
     StackSetOperationResultSummary
     StackSetOperationResultSummary
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StackSetOperationResultSummary' {Maybe Text
organizationalUnitId :: Maybe Text
$sel:organizationalUnitId:StackSetOperationResultSummary' :: StackSetOperationResultSummary -> Maybe Text
organizationalUnitId} -> Maybe Text
organizationalUnitId) (\s :: StackSetOperationResultSummary
s@StackSetOperationResultSummary' {} Maybe Text
a -> StackSetOperationResultSummary
s {$sel:organizationalUnitId:StackSetOperationResultSummary' :: Maybe Text
organizationalUnitId = Maybe Text
a} :: StackSetOperationResultSummary)

-- | The name of the Amazon Web Services Region for this operation result.
stackSetOperationResultSummary_region :: Lens.Lens' StackSetOperationResultSummary (Prelude.Maybe Prelude.Text)
stackSetOperationResultSummary_region :: (Maybe Text -> f (Maybe Text))
-> StackSetOperationResultSummary
-> f StackSetOperationResultSummary
stackSetOperationResultSummary_region = (StackSetOperationResultSummary -> Maybe Text)
-> (StackSetOperationResultSummary
    -> Maybe Text -> StackSetOperationResultSummary)
-> Lens
     StackSetOperationResultSummary
     StackSetOperationResultSummary
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StackSetOperationResultSummary' {Maybe Text
region :: Maybe Text
$sel:region:StackSetOperationResultSummary' :: StackSetOperationResultSummary -> Maybe Text
region} -> Maybe Text
region) (\s :: StackSetOperationResultSummary
s@StackSetOperationResultSummary' {} Maybe Text
a -> StackSetOperationResultSummary
s {$sel:region:StackSetOperationResultSummary' :: Maybe Text
region = Maybe Text
a} :: StackSetOperationResultSummary)

-- | The reason for the assigned result status.
stackSetOperationResultSummary_statusReason :: Lens.Lens' StackSetOperationResultSummary (Prelude.Maybe Prelude.Text)
stackSetOperationResultSummary_statusReason :: (Maybe Text -> f (Maybe Text))
-> StackSetOperationResultSummary
-> f StackSetOperationResultSummary
stackSetOperationResultSummary_statusReason = (StackSetOperationResultSummary -> Maybe Text)
-> (StackSetOperationResultSummary
    -> Maybe Text -> StackSetOperationResultSummary)
-> Lens
     StackSetOperationResultSummary
     StackSetOperationResultSummary
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StackSetOperationResultSummary' {Maybe Text
statusReason :: Maybe Text
$sel:statusReason:StackSetOperationResultSummary' :: StackSetOperationResultSummary -> Maybe Text
statusReason} -> Maybe Text
statusReason) (\s :: StackSetOperationResultSummary
s@StackSetOperationResultSummary' {} Maybe Text
a -> StackSetOperationResultSummary
s {$sel:statusReason:StackSetOperationResultSummary' :: Maybe Text
statusReason = Maybe Text
a} :: StackSetOperationResultSummary)

instance Core.FromXML StackSetOperationResultSummary where
  parseXML :: [Node] -> Either String StackSetOperationResultSummary
parseXML [Node]
x =
    Maybe StackSetOperationResultStatus
-> Maybe Text
-> Maybe AccountGateResult
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> StackSetOperationResultSummary
StackSetOperationResultSummary'
      (Maybe StackSetOperationResultStatus
 -> Maybe Text
 -> Maybe AccountGateResult
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> StackSetOperationResultSummary)
-> Either String (Maybe StackSetOperationResultStatus)
-> Either
     String
     (Maybe Text
      -> Maybe AccountGateResult
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> StackSetOperationResultSummary)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node]
-> Text -> Either String (Maybe StackSetOperationResultStatus)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Status")
      Either
  String
  (Maybe Text
   -> Maybe AccountGateResult
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> StackSetOperationResultSummary)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe AccountGateResult
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> StackSetOperationResultSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Account")
      Either
  String
  (Maybe AccountGateResult
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> StackSetOperationResultSummary)
-> Either String (Maybe AccountGateResult)
-> Either
     String
     (Maybe Text
      -> Maybe Text -> Maybe Text -> StackSetOperationResultSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe AccountGateResult)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"AccountGateResult")
      Either
  String
  (Maybe Text
   -> Maybe Text -> Maybe Text -> StackSetOperationResultSummary)
-> Either String (Maybe Text)
-> Either
     String (Maybe Text -> Maybe Text -> StackSetOperationResultSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"OrganizationalUnitId")
      Either
  String (Maybe Text -> Maybe Text -> StackSetOperationResultSummary)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> StackSetOperationResultSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Region")
      Either String (Maybe Text -> StackSetOperationResultSummary)
-> Either String (Maybe Text)
-> Either String StackSetOperationResultSummary
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"StatusReason")

instance
  Prelude.Hashable
    StackSetOperationResultSummary

instance
  Prelude.NFData
    StackSetOperationResultSummary