{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# 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.UpdateStackInstances
-- 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)
--
-- Updates the parameter values for stack instances for the specified
-- accounts, within the specified Regions. A stack instance refers to a
-- stack in a specific account and Region.
--
-- You can only update stack instances in Regions and accounts where they
-- already exist; to create additional stack instances, use
-- <https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_CreateStackInstances.html CreateStackInstances>.
--
-- During stack set updates, any parameters overridden for a stack instance
-- are not updated, but retain their overridden value.
--
-- You can only update the parameter /values/ that are specified in the
-- stack set; to add or delete a parameter itself, use
-- <https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_UpdateStackSet.html UpdateStackSet>
-- to update the stack set template. If you add a parameter to a template,
-- before you can override the parameter value specified in the stack set
-- you must first use
-- <https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_UpdateStackSet.html UpdateStackSet>
-- to update all stack instances with the updated template and parameter
-- value specified in the stack set. Once a stack instance has been updated
-- with the new parameter, you can then override the parameter value using
-- @UpdateStackInstances@.
module Amazonka.CloudFormation.UpdateStackInstances
  ( -- * Creating a Request
    UpdateStackInstances (..),
    newUpdateStackInstances,

    -- * Request Lenses
    updateStackInstances_accounts,
    updateStackInstances_callAs,
    updateStackInstances_operationPreferences,
    updateStackInstances_operationId,
    updateStackInstances_deploymentTargets,
    updateStackInstances_parameterOverrides,
    updateStackInstances_stackSetName,
    updateStackInstances_regions,

    -- * Destructuring the Response
    UpdateStackInstancesResponse (..),
    newUpdateStackInstancesResponse,

    -- * Response Lenses
    updateStackInstancesResponse_operationId,
    updateStackInstancesResponse_httpStatus,
  )
where

import Amazonka.CloudFormation.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newUpdateStackInstances' smart constructor.
data UpdateStackInstances = UpdateStackInstances'
  { -- | [Self-managed permissions] The names of one or more Amazon Web Services
    -- accounts for which you want to update parameter values for stack
    -- instances. The overridden parameter values will be applied to all stack
    -- instances in the specified accounts and Regions.
    --
    -- You can specify @Accounts@ or @DeploymentTargets@, but not both.
    UpdateStackInstances -> Maybe [Text]
accounts :: Prelude.Maybe [Prelude.Text],
    -- | [Service-managed permissions] Specifies whether you are acting as an
    -- account administrator in the organization\'s management account or as a
    -- delegated administrator in a member account.
    --
    -- By default, @SELF@ is specified. Use @SELF@ for stack sets with
    -- self-managed permissions.
    --
    -- -   If you are signed in to the management account, specify @SELF@.
    --
    -- -   If you are signed in to a delegated administrator account, specify
    --     @DELEGATED_ADMIN@.
    --
    --     Your Amazon Web Services account must be registered as a delegated
    --     administrator in the management account. For more information, see
    --     <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-orgs-delegated-admin.html Register a delegated administrator>
    --     in the /CloudFormation User Guide/.
    UpdateStackInstances -> Maybe CallAs
callAs :: Prelude.Maybe CallAs,
    -- | Preferences for how CloudFormation performs this stack set operation.
    UpdateStackInstances -> Maybe StackSetOperationPreferences
operationPreferences :: Prelude.Maybe StackSetOperationPreferences,
    -- | The unique identifier for this stack set operation.
    --
    -- The operation ID also functions as an idempotency token, to ensure that
    -- CloudFormation performs the stack set operation only once, even if you
    -- retry the request multiple times. You might retry stack set operation
    -- requests to ensure that CloudFormation successfully received them.
    --
    -- If you don\'t specify an operation ID, the SDK generates one
    -- automatically.
    UpdateStackInstances -> Maybe Text
operationId :: Prelude.Maybe Prelude.Text,
    -- | [Service-managed permissions] The Organizations accounts for which you
    -- want to update parameter values for stack instances. If your update
    -- targets OUs, the overridden parameter values only apply to the accounts
    -- that are currently in the target OUs and their child OUs. Accounts added
    -- to the target OUs and their child OUs in the future won\'t use the
    -- overridden values.
    --
    -- You can specify @Accounts@ or @DeploymentTargets@, but not both.
    UpdateStackInstances -> Maybe DeploymentTargets
deploymentTargets :: Prelude.Maybe DeploymentTargets,
    -- | A list of input parameters whose values you want to update for the
    -- specified stack instances.
    --
    -- Any overridden parameter values will be applied to all stack instances
    -- in the specified accounts and Regions. When specifying parameters and
    -- their values, be aware of how CloudFormation sets parameter values
    -- during stack instance update operations:
    --
    -- -   To override the current value for a parameter, include the parameter
    --     and specify its value.
    --
    -- -   To leave an overridden parameter set to its present value, include
    --     the parameter and specify @UsePreviousValue@ as @true@. (You cannot
    --     specify both a value and set @UsePreviousValue@ to @true@.)
    --
    -- -   To set an overridden parameter back to the value specified in the
    --     stack set, specify a parameter list but do not include the parameter
    --     in the list.
    --
    -- -   To leave all parameters set to their present values, do not specify
    --     this property at all.
    --
    -- During stack set updates, any parameter values overridden for a stack
    -- instance are not updated, but retain their overridden value.
    --
    -- You can only override the parameter /values/ that are specified in the
    -- stack set; to add or delete a parameter itself, use @UpdateStackSet@ to
    -- update the stack set template. If you add a parameter to a template,
    -- before you can override the parameter value specified in the stack set
    -- you must first use
    -- <https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_UpdateStackSet.html UpdateStackSet>
    -- to update all stack instances with the updated template and parameter
    -- value specified in the stack set. Once a stack instance has been updated
    -- with the new parameter, you can then override the parameter value using
    -- @UpdateStackInstances@.
    UpdateStackInstances -> Maybe [Parameter]
parameterOverrides :: Prelude.Maybe [Parameter],
    -- | The name or unique ID of the stack set associated with the stack
    -- instances.
    UpdateStackInstances -> Text
stackSetName :: Prelude.Text,
    -- | The names of one or more Regions in which you want to update parameter
    -- values for stack instances. The overridden parameter values will be
    -- applied to all stack instances in the specified accounts and Regions.
    UpdateStackInstances -> [Text]
regions :: [Prelude.Text]
  }
  deriving (UpdateStackInstances -> UpdateStackInstances -> Bool
(UpdateStackInstances -> UpdateStackInstances -> Bool)
-> (UpdateStackInstances -> UpdateStackInstances -> Bool)
-> Eq UpdateStackInstances
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateStackInstances -> UpdateStackInstances -> Bool
$c/= :: UpdateStackInstances -> UpdateStackInstances -> Bool
== :: UpdateStackInstances -> UpdateStackInstances -> Bool
$c== :: UpdateStackInstances -> UpdateStackInstances -> Bool
Prelude.Eq, ReadPrec [UpdateStackInstances]
ReadPrec UpdateStackInstances
Int -> ReadS UpdateStackInstances
ReadS [UpdateStackInstances]
(Int -> ReadS UpdateStackInstances)
-> ReadS [UpdateStackInstances]
-> ReadPrec UpdateStackInstances
-> ReadPrec [UpdateStackInstances]
-> Read UpdateStackInstances
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateStackInstances]
$creadListPrec :: ReadPrec [UpdateStackInstances]
readPrec :: ReadPrec UpdateStackInstances
$creadPrec :: ReadPrec UpdateStackInstances
readList :: ReadS [UpdateStackInstances]
$creadList :: ReadS [UpdateStackInstances]
readsPrec :: Int -> ReadS UpdateStackInstances
$creadsPrec :: Int -> ReadS UpdateStackInstances
Prelude.Read, Int -> UpdateStackInstances -> ShowS
[UpdateStackInstances] -> ShowS
UpdateStackInstances -> String
(Int -> UpdateStackInstances -> ShowS)
-> (UpdateStackInstances -> String)
-> ([UpdateStackInstances] -> ShowS)
-> Show UpdateStackInstances
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateStackInstances] -> ShowS
$cshowList :: [UpdateStackInstances] -> ShowS
show :: UpdateStackInstances -> String
$cshow :: UpdateStackInstances -> String
showsPrec :: Int -> UpdateStackInstances -> ShowS
$cshowsPrec :: Int -> UpdateStackInstances -> ShowS
Prelude.Show, (forall x. UpdateStackInstances -> Rep UpdateStackInstances x)
-> (forall x. Rep UpdateStackInstances x -> UpdateStackInstances)
-> Generic UpdateStackInstances
forall x. Rep UpdateStackInstances x -> UpdateStackInstances
forall x. UpdateStackInstances -> Rep UpdateStackInstances x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateStackInstances x -> UpdateStackInstances
$cfrom :: forall x. UpdateStackInstances -> Rep UpdateStackInstances x
Prelude.Generic)

-- |
-- Create a value of 'UpdateStackInstances' 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:
--
-- 'accounts', 'updateStackInstances_accounts' - [Self-managed permissions] The names of one or more Amazon Web Services
-- accounts for which you want to update parameter values for stack
-- instances. The overridden parameter values will be applied to all stack
-- instances in the specified accounts and Regions.
--
-- You can specify @Accounts@ or @DeploymentTargets@, but not both.
--
-- 'callAs', 'updateStackInstances_callAs' - [Service-managed permissions] Specifies whether you are acting as an
-- account administrator in the organization\'s management account or as a
-- delegated administrator in a member account.
--
-- By default, @SELF@ is specified. Use @SELF@ for stack sets with
-- self-managed permissions.
--
-- -   If you are signed in to the management account, specify @SELF@.
--
-- -   If you are signed in to a delegated administrator account, specify
--     @DELEGATED_ADMIN@.
--
--     Your Amazon Web Services account must be registered as a delegated
--     administrator in the management account. For more information, see
--     <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-orgs-delegated-admin.html Register a delegated administrator>
--     in the /CloudFormation User Guide/.
--
-- 'operationPreferences', 'updateStackInstances_operationPreferences' - Preferences for how CloudFormation performs this stack set operation.
--
-- 'operationId', 'updateStackInstances_operationId' - The unique identifier for this stack set operation.
--
-- The operation ID also functions as an idempotency token, to ensure that
-- CloudFormation performs the stack set operation only once, even if you
-- retry the request multiple times. You might retry stack set operation
-- requests to ensure that CloudFormation successfully received them.
--
-- If you don\'t specify an operation ID, the SDK generates one
-- automatically.
--
-- 'deploymentTargets', 'updateStackInstances_deploymentTargets' - [Service-managed permissions] The Organizations accounts for which you
-- want to update parameter values for stack instances. If your update
-- targets OUs, the overridden parameter values only apply to the accounts
-- that are currently in the target OUs and their child OUs. Accounts added
-- to the target OUs and their child OUs in the future won\'t use the
-- overridden values.
--
-- You can specify @Accounts@ or @DeploymentTargets@, but not both.
--
-- 'parameterOverrides', 'updateStackInstances_parameterOverrides' - A list of input parameters whose values you want to update for the
-- specified stack instances.
--
-- Any overridden parameter values will be applied to all stack instances
-- in the specified accounts and Regions. When specifying parameters and
-- their values, be aware of how CloudFormation sets parameter values
-- during stack instance update operations:
--
-- -   To override the current value for a parameter, include the parameter
--     and specify its value.
--
-- -   To leave an overridden parameter set to its present value, include
--     the parameter and specify @UsePreviousValue@ as @true@. (You cannot
--     specify both a value and set @UsePreviousValue@ to @true@.)
--
-- -   To set an overridden parameter back to the value specified in the
--     stack set, specify a parameter list but do not include the parameter
--     in the list.
--
-- -   To leave all parameters set to their present values, do not specify
--     this property at all.
--
-- During stack set updates, any parameter values overridden for a stack
-- instance are not updated, but retain their overridden value.
--
-- You can only override the parameter /values/ that are specified in the
-- stack set; to add or delete a parameter itself, use @UpdateStackSet@ to
-- update the stack set template. If you add a parameter to a template,
-- before you can override the parameter value specified in the stack set
-- you must first use
-- <https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_UpdateStackSet.html UpdateStackSet>
-- to update all stack instances with the updated template and parameter
-- value specified in the stack set. Once a stack instance has been updated
-- with the new parameter, you can then override the parameter value using
-- @UpdateStackInstances@.
--
-- 'stackSetName', 'updateStackInstances_stackSetName' - The name or unique ID of the stack set associated with the stack
-- instances.
--
-- 'regions', 'updateStackInstances_regions' - The names of one or more Regions in which you want to update parameter
-- values for stack instances. The overridden parameter values will be
-- applied to all stack instances in the specified accounts and Regions.
newUpdateStackInstances ::
  -- | 'stackSetName'
  Prelude.Text ->
  UpdateStackInstances
newUpdateStackInstances :: Text -> UpdateStackInstances
newUpdateStackInstances Text
pStackSetName_ =
  UpdateStackInstances' :: Maybe [Text]
-> Maybe CallAs
-> Maybe StackSetOperationPreferences
-> Maybe Text
-> Maybe DeploymentTargets
-> Maybe [Parameter]
-> Text
-> [Text]
-> UpdateStackInstances
UpdateStackInstances'
    { $sel:accounts:UpdateStackInstances' :: Maybe [Text]
accounts = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:callAs:UpdateStackInstances' :: Maybe CallAs
callAs = Maybe CallAs
forall a. Maybe a
Prelude.Nothing,
      $sel:operationPreferences:UpdateStackInstances' :: Maybe StackSetOperationPreferences
operationPreferences = Maybe StackSetOperationPreferences
forall a. Maybe a
Prelude.Nothing,
      $sel:operationId:UpdateStackInstances' :: Maybe Text
operationId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:deploymentTargets:UpdateStackInstances' :: Maybe DeploymentTargets
deploymentTargets = Maybe DeploymentTargets
forall a. Maybe a
Prelude.Nothing,
      $sel:parameterOverrides:UpdateStackInstances' :: Maybe [Parameter]
parameterOverrides = Maybe [Parameter]
forall a. Maybe a
Prelude.Nothing,
      $sel:stackSetName:UpdateStackInstances' :: Text
stackSetName = Text
pStackSetName_,
      $sel:regions:UpdateStackInstances' :: [Text]
regions = [Text]
forall a. Monoid a => a
Prelude.mempty
    }

-- | [Self-managed permissions] The names of one or more Amazon Web Services
-- accounts for which you want to update parameter values for stack
-- instances. The overridden parameter values will be applied to all stack
-- instances in the specified accounts and Regions.
--
-- You can specify @Accounts@ or @DeploymentTargets@, but not both.
updateStackInstances_accounts :: Lens.Lens' UpdateStackInstances (Prelude.Maybe [Prelude.Text])
updateStackInstances_accounts :: (Maybe [Text] -> f (Maybe [Text]))
-> UpdateStackInstances -> f UpdateStackInstances
updateStackInstances_accounts = (UpdateStackInstances -> Maybe [Text])
-> (UpdateStackInstances -> Maybe [Text] -> UpdateStackInstances)
-> Lens
     UpdateStackInstances
     UpdateStackInstances
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateStackInstances' {Maybe [Text]
accounts :: Maybe [Text]
$sel:accounts:UpdateStackInstances' :: UpdateStackInstances -> Maybe [Text]
accounts} -> Maybe [Text]
accounts) (\s :: UpdateStackInstances
s@UpdateStackInstances' {} Maybe [Text]
a -> UpdateStackInstances
s {$sel:accounts:UpdateStackInstances' :: Maybe [Text]
accounts = Maybe [Text]
a} :: UpdateStackInstances) ((Maybe [Text] -> f (Maybe [Text]))
 -> UpdateStackInstances -> f UpdateStackInstances)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> UpdateStackInstances
-> f UpdateStackInstances
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | [Service-managed permissions] Specifies whether you are acting as an
-- account administrator in the organization\'s management account or as a
-- delegated administrator in a member account.
--
-- By default, @SELF@ is specified. Use @SELF@ for stack sets with
-- self-managed permissions.
--
-- -   If you are signed in to the management account, specify @SELF@.
--
-- -   If you are signed in to a delegated administrator account, specify
--     @DELEGATED_ADMIN@.
--
--     Your Amazon Web Services account must be registered as a delegated
--     administrator in the management account. For more information, see
--     <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-orgs-delegated-admin.html Register a delegated administrator>
--     in the /CloudFormation User Guide/.
updateStackInstances_callAs :: Lens.Lens' UpdateStackInstances (Prelude.Maybe CallAs)
updateStackInstances_callAs :: (Maybe CallAs -> f (Maybe CallAs))
-> UpdateStackInstances -> f UpdateStackInstances
updateStackInstances_callAs = (UpdateStackInstances -> Maybe CallAs)
-> (UpdateStackInstances -> Maybe CallAs -> UpdateStackInstances)
-> Lens
     UpdateStackInstances
     UpdateStackInstances
     (Maybe CallAs)
     (Maybe CallAs)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateStackInstances' {Maybe CallAs
callAs :: Maybe CallAs
$sel:callAs:UpdateStackInstances' :: UpdateStackInstances -> Maybe CallAs
callAs} -> Maybe CallAs
callAs) (\s :: UpdateStackInstances
s@UpdateStackInstances' {} Maybe CallAs
a -> UpdateStackInstances
s {$sel:callAs:UpdateStackInstances' :: Maybe CallAs
callAs = Maybe CallAs
a} :: UpdateStackInstances)

-- | Preferences for how CloudFormation performs this stack set operation.
updateStackInstances_operationPreferences :: Lens.Lens' UpdateStackInstances (Prelude.Maybe StackSetOperationPreferences)
updateStackInstances_operationPreferences :: (Maybe StackSetOperationPreferences
 -> f (Maybe StackSetOperationPreferences))
-> UpdateStackInstances -> f UpdateStackInstances
updateStackInstances_operationPreferences = (UpdateStackInstances -> Maybe StackSetOperationPreferences)
-> (UpdateStackInstances
    -> Maybe StackSetOperationPreferences -> UpdateStackInstances)
-> Lens
     UpdateStackInstances
     UpdateStackInstances
     (Maybe StackSetOperationPreferences)
     (Maybe StackSetOperationPreferences)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateStackInstances' {Maybe StackSetOperationPreferences
operationPreferences :: Maybe StackSetOperationPreferences
$sel:operationPreferences:UpdateStackInstances' :: UpdateStackInstances -> Maybe StackSetOperationPreferences
operationPreferences} -> Maybe StackSetOperationPreferences
operationPreferences) (\s :: UpdateStackInstances
s@UpdateStackInstances' {} Maybe StackSetOperationPreferences
a -> UpdateStackInstances
s {$sel:operationPreferences:UpdateStackInstances' :: Maybe StackSetOperationPreferences
operationPreferences = Maybe StackSetOperationPreferences
a} :: UpdateStackInstances)

-- | The unique identifier for this stack set operation.
--
-- The operation ID also functions as an idempotency token, to ensure that
-- CloudFormation performs the stack set operation only once, even if you
-- retry the request multiple times. You might retry stack set operation
-- requests to ensure that CloudFormation successfully received them.
--
-- If you don\'t specify an operation ID, the SDK generates one
-- automatically.
updateStackInstances_operationId :: Lens.Lens' UpdateStackInstances (Prelude.Maybe Prelude.Text)
updateStackInstances_operationId :: (Maybe Text -> f (Maybe Text))
-> UpdateStackInstances -> f UpdateStackInstances
updateStackInstances_operationId = (UpdateStackInstances -> Maybe Text)
-> (UpdateStackInstances -> Maybe Text -> UpdateStackInstances)
-> Lens
     UpdateStackInstances UpdateStackInstances (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateStackInstances' {Maybe Text
operationId :: Maybe Text
$sel:operationId:UpdateStackInstances' :: UpdateStackInstances -> Maybe Text
operationId} -> Maybe Text
operationId) (\s :: UpdateStackInstances
s@UpdateStackInstances' {} Maybe Text
a -> UpdateStackInstances
s {$sel:operationId:UpdateStackInstances' :: Maybe Text
operationId = Maybe Text
a} :: UpdateStackInstances)

-- | [Service-managed permissions] The Organizations accounts for which you
-- want to update parameter values for stack instances. If your update
-- targets OUs, the overridden parameter values only apply to the accounts
-- that are currently in the target OUs and their child OUs. Accounts added
-- to the target OUs and their child OUs in the future won\'t use the
-- overridden values.
--
-- You can specify @Accounts@ or @DeploymentTargets@, but not both.
updateStackInstances_deploymentTargets :: Lens.Lens' UpdateStackInstances (Prelude.Maybe DeploymentTargets)
updateStackInstances_deploymentTargets :: (Maybe DeploymentTargets -> f (Maybe DeploymentTargets))
-> UpdateStackInstances -> f UpdateStackInstances
updateStackInstances_deploymentTargets = (UpdateStackInstances -> Maybe DeploymentTargets)
-> (UpdateStackInstances
    -> Maybe DeploymentTargets -> UpdateStackInstances)
-> Lens
     UpdateStackInstances
     UpdateStackInstances
     (Maybe DeploymentTargets)
     (Maybe DeploymentTargets)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateStackInstances' {Maybe DeploymentTargets
deploymentTargets :: Maybe DeploymentTargets
$sel:deploymentTargets:UpdateStackInstances' :: UpdateStackInstances -> Maybe DeploymentTargets
deploymentTargets} -> Maybe DeploymentTargets
deploymentTargets) (\s :: UpdateStackInstances
s@UpdateStackInstances' {} Maybe DeploymentTargets
a -> UpdateStackInstances
s {$sel:deploymentTargets:UpdateStackInstances' :: Maybe DeploymentTargets
deploymentTargets = Maybe DeploymentTargets
a} :: UpdateStackInstances)

-- | A list of input parameters whose values you want to update for the
-- specified stack instances.
--
-- Any overridden parameter values will be applied to all stack instances
-- in the specified accounts and Regions. When specifying parameters and
-- their values, be aware of how CloudFormation sets parameter values
-- during stack instance update operations:
--
-- -   To override the current value for a parameter, include the parameter
--     and specify its value.
--
-- -   To leave an overridden parameter set to its present value, include
--     the parameter and specify @UsePreviousValue@ as @true@. (You cannot
--     specify both a value and set @UsePreviousValue@ to @true@.)
--
-- -   To set an overridden parameter back to the value specified in the
--     stack set, specify a parameter list but do not include the parameter
--     in the list.
--
-- -   To leave all parameters set to their present values, do not specify
--     this property at all.
--
-- During stack set updates, any parameter values overridden for a stack
-- instance are not updated, but retain their overridden value.
--
-- You can only override the parameter /values/ that are specified in the
-- stack set; to add or delete a parameter itself, use @UpdateStackSet@ to
-- update the stack set template. If you add a parameter to a template,
-- before you can override the parameter value specified in the stack set
-- you must first use
-- <https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_UpdateStackSet.html UpdateStackSet>
-- to update all stack instances with the updated template and parameter
-- value specified in the stack set. Once a stack instance has been updated
-- with the new parameter, you can then override the parameter value using
-- @UpdateStackInstances@.
updateStackInstances_parameterOverrides :: Lens.Lens' UpdateStackInstances (Prelude.Maybe [Parameter])
updateStackInstances_parameterOverrides :: (Maybe [Parameter] -> f (Maybe [Parameter]))
-> UpdateStackInstances -> f UpdateStackInstances
updateStackInstances_parameterOverrides = (UpdateStackInstances -> Maybe [Parameter])
-> (UpdateStackInstances
    -> Maybe [Parameter] -> UpdateStackInstances)
-> Lens
     UpdateStackInstances
     UpdateStackInstances
     (Maybe [Parameter])
     (Maybe [Parameter])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateStackInstances' {Maybe [Parameter]
parameterOverrides :: Maybe [Parameter]
$sel:parameterOverrides:UpdateStackInstances' :: UpdateStackInstances -> Maybe [Parameter]
parameterOverrides} -> Maybe [Parameter]
parameterOverrides) (\s :: UpdateStackInstances
s@UpdateStackInstances' {} Maybe [Parameter]
a -> UpdateStackInstances
s {$sel:parameterOverrides:UpdateStackInstances' :: Maybe [Parameter]
parameterOverrides = Maybe [Parameter]
a} :: UpdateStackInstances) ((Maybe [Parameter] -> f (Maybe [Parameter]))
 -> UpdateStackInstances -> f UpdateStackInstances)
-> ((Maybe [Parameter] -> f (Maybe [Parameter]))
    -> Maybe [Parameter] -> f (Maybe [Parameter]))
-> (Maybe [Parameter] -> f (Maybe [Parameter]))
-> UpdateStackInstances
-> f UpdateStackInstances
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Parameter] [Parameter] [Parameter] [Parameter]
-> Iso
     (Maybe [Parameter])
     (Maybe [Parameter])
     (Maybe [Parameter])
     (Maybe [Parameter])
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 [Parameter] [Parameter] [Parameter] [Parameter]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name or unique ID of the stack set associated with the stack
-- instances.
updateStackInstances_stackSetName :: Lens.Lens' UpdateStackInstances Prelude.Text
updateStackInstances_stackSetName :: (Text -> f Text) -> UpdateStackInstances -> f UpdateStackInstances
updateStackInstances_stackSetName = (UpdateStackInstances -> Text)
-> (UpdateStackInstances -> Text -> UpdateStackInstances)
-> Lens UpdateStackInstances UpdateStackInstances Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateStackInstances' {Text
stackSetName :: Text
$sel:stackSetName:UpdateStackInstances' :: UpdateStackInstances -> Text
stackSetName} -> Text
stackSetName) (\s :: UpdateStackInstances
s@UpdateStackInstances' {} Text
a -> UpdateStackInstances
s {$sel:stackSetName:UpdateStackInstances' :: Text
stackSetName = Text
a} :: UpdateStackInstances)

-- | The names of one or more Regions in which you want to update parameter
-- values for stack instances. The overridden parameter values will be
-- applied to all stack instances in the specified accounts and Regions.
updateStackInstances_regions :: Lens.Lens' UpdateStackInstances [Prelude.Text]
updateStackInstances_regions :: ([Text] -> f [Text])
-> UpdateStackInstances -> f UpdateStackInstances
updateStackInstances_regions = (UpdateStackInstances -> [Text])
-> (UpdateStackInstances -> [Text] -> UpdateStackInstances)
-> Lens UpdateStackInstances UpdateStackInstances [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateStackInstances' {[Text]
regions :: [Text]
$sel:regions:UpdateStackInstances' :: UpdateStackInstances -> [Text]
regions} -> [Text]
regions) (\s :: UpdateStackInstances
s@UpdateStackInstances' {} [Text]
a -> UpdateStackInstances
s {$sel:regions:UpdateStackInstances' :: [Text]
regions = [Text]
a} :: UpdateStackInstances) (([Text] -> f [Text])
 -> UpdateStackInstances -> f UpdateStackInstances)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> UpdateStackInstances
-> f UpdateStackInstances
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.AWSRequest UpdateStackInstances where
  type
    AWSResponse UpdateStackInstances =
      UpdateStackInstancesResponse
  request :: UpdateStackInstances -> Request UpdateStackInstances
request = Service -> UpdateStackInstances -> Request UpdateStackInstances
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy UpdateStackInstances
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateStackInstances)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse UpdateStackInstances))
-> Logger
-> Service
-> Proxy UpdateStackInstances
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateStackInstances)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"UpdateStackInstancesResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe Text -> Int -> UpdateStackInstancesResponse
UpdateStackInstancesResponse'
            (Maybe Text -> Int -> UpdateStackInstancesResponse)
-> Either String (Maybe Text)
-> Either String (Int -> UpdateStackInstancesResponse)
forall (f :: * -> *) a b. Functor 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
"OperationId")
            Either String (Int -> UpdateStackInstancesResponse)
-> Either String Int -> Either String UpdateStackInstancesResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable UpdateStackInstances

instance Prelude.NFData UpdateStackInstances

instance Core.ToHeaders UpdateStackInstances where
  toHeaders :: UpdateStackInstances -> ResponseHeaders
toHeaders = ResponseHeaders -> UpdateStackInstances -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

instance Core.ToPath UpdateStackInstances where
  toPath :: UpdateStackInstances -> ByteString
toPath = ByteString -> UpdateStackInstances -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery UpdateStackInstances where
  toQuery :: UpdateStackInstances -> QueryString
toQuery UpdateStackInstances' {[Text]
Maybe [Text]
Maybe [Parameter]
Maybe Text
Maybe CallAs
Maybe DeploymentTargets
Maybe StackSetOperationPreferences
Text
regions :: [Text]
stackSetName :: Text
parameterOverrides :: Maybe [Parameter]
deploymentTargets :: Maybe DeploymentTargets
operationId :: Maybe Text
operationPreferences :: Maybe StackSetOperationPreferences
callAs :: Maybe CallAs
accounts :: Maybe [Text]
$sel:regions:UpdateStackInstances' :: UpdateStackInstances -> [Text]
$sel:stackSetName:UpdateStackInstances' :: UpdateStackInstances -> Text
$sel:parameterOverrides:UpdateStackInstances' :: UpdateStackInstances -> Maybe [Parameter]
$sel:deploymentTargets:UpdateStackInstances' :: UpdateStackInstances -> Maybe DeploymentTargets
$sel:operationId:UpdateStackInstances' :: UpdateStackInstances -> Maybe Text
$sel:operationPreferences:UpdateStackInstances' :: UpdateStackInstances -> Maybe StackSetOperationPreferences
$sel:callAs:UpdateStackInstances' :: UpdateStackInstances -> Maybe CallAs
$sel:accounts:UpdateStackInstances' :: UpdateStackInstances -> Maybe [Text]
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"UpdateStackInstances" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-05-15" :: Prelude.ByteString),
        ByteString
"Accounts"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
            (ByteString -> [Text] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member" ([Text] -> QueryString) -> Maybe [Text] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
accounts),
        ByteString
"CallAs" ByteString -> Maybe CallAs -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe CallAs
callAs,
        ByteString
"OperationPreferences" ByteString -> Maybe StackSetOperationPreferences -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe StackSetOperationPreferences
operationPreferences,
        ByteString
"OperationId" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
operationId,
        ByteString
"DeploymentTargets" ByteString -> Maybe DeploymentTargets -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe DeploymentTargets
deploymentTargets,
        ByteString
"ParameterOverrides"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
            ( ByteString -> [Parameter] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member"
                ([Parameter] -> QueryString)
-> Maybe [Parameter] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Parameter]
parameterOverrides
            ),
        ByteString
"StackSetName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
stackSetName,
        ByteString
"Regions" ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: ByteString -> [Text] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member" [Text]
regions
      ]

-- | /See:/ 'newUpdateStackInstancesResponse' smart constructor.
data UpdateStackInstancesResponse = UpdateStackInstancesResponse'
  { -- | The unique identifier for this stack set operation.
    UpdateStackInstancesResponse -> Maybe Text
operationId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    UpdateStackInstancesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (UpdateStackInstancesResponse
-> UpdateStackInstancesResponse -> Bool
(UpdateStackInstancesResponse
 -> UpdateStackInstancesResponse -> Bool)
-> (UpdateStackInstancesResponse
    -> UpdateStackInstancesResponse -> Bool)
-> Eq UpdateStackInstancesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateStackInstancesResponse
-> UpdateStackInstancesResponse -> Bool
$c/= :: UpdateStackInstancesResponse
-> UpdateStackInstancesResponse -> Bool
== :: UpdateStackInstancesResponse
-> UpdateStackInstancesResponse -> Bool
$c== :: UpdateStackInstancesResponse
-> UpdateStackInstancesResponse -> Bool
Prelude.Eq, ReadPrec [UpdateStackInstancesResponse]
ReadPrec UpdateStackInstancesResponse
Int -> ReadS UpdateStackInstancesResponse
ReadS [UpdateStackInstancesResponse]
(Int -> ReadS UpdateStackInstancesResponse)
-> ReadS [UpdateStackInstancesResponse]
-> ReadPrec UpdateStackInstancesResponse
-> ReadPrec [UpdateStackInstancesResponse]
-> Read UpdateStackInstancesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateStackInstancesResponse]
$creadListPrec :: ReadPrec [UpdateStackInstancesResponse]
readPrec :: ReadPrec UpdateStackInstancesResponse
$creadPrec :: ReadPrec UpdateStackInstancesResponse
readList :: ReadS [UpdateStackInstancesResponse]
$creadList :: ReadS [UpdateStackInstancesResponse]
readsPrec :: Int -> ReadS UpdateStackInstancesResponse
$creadsPrec :: Int -> ReadS UpdateStackInstancesResponse
Prelude.Read, Int -> UpdateStackInstancesResponse -> ShowS
[UpdateStackInstancesResponse] -> ShowS
UpdateStackInstancesResponse -> String
(Int -> UpdateStackInstancesResponse -> ShowS)
-> (UpdateStackInstancesResponse -> String)
-> ([UpdateStackInstancesResponse] -> ShowS)
-> Show UpdateStackInstancesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateStackInstancesResponse] -> ShowS
$cshowList :: [UpdateStackInstancesResponse] -> ShowS
show :: UpdateStackInstancesResponse -> String
$cshow :: UpdateStackInstancesResponse -> String
showsPrec :: Int -> UpdateStackInstancesResponse -> ShowS
$cshowsPrec :: Int -> UpdateStackInstancesResponse -> ShowS
Prelude.Show, (forall x.
 UpdateStackInstancesResponse -> Rep UpdateStackInstancesResponse x)
-> (forall x.
    Rep UpdateStackInstancesResponse x -> UpdateStackInstancesResponse)
-> Generic UpdateStackInstancesResponse
forall x.
Rep UpdateStackInstancesResponse x -> UpdateStackInstancesResponse
forall x.
UpdateStackInstancesResponse -> Rep UpdateStackInstancesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateStackInstancesResponse x -> UpdateStackInstancesResponse
$cfrom :: forall x.
UpdateStackInstancesResponse -> Rep UpdateStackInstancesResponse x
Prelude.Generic)

-- |
-- Create a value of 'UpdateStackInstancesResponse' 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:
--
-- 'operationId', 'updateStackInstancesResponse_operationId' - The unique identifier for this stack set operation.
--
-- 'httpStatus', 'updateStackInstancesResponse_httpStatus' - The response's http status code.
newUpdateStackInstancesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  UpdateStackInstancesResponse
newUpdateStackInstancesResponse :: Int -> UpdateStackInstancesResponse
newUpdateStackInstancesResponse Int
pHttpStatus_ =
  UpdateStackInstancesResponse' :: Maybe Text -> Int -> UpdateStackInstancesResponse
UpdateStackInstancesResponse'
    { $sel:operationId:UpdateStackInstancesResponse' :: Maybe Text
operationId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:UpdateStackInstancesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The unique identifier for this stack set operation.
updateStackInstancesResponse_operationId :: Lens.Lens' UpdateStackInstancesResponse (Prelude.Maybe Prelude.Text)
updateStackInstancesResponse_operationId :: (Maybe Text -> f (Maybe Text))
-> UpdateStackInstancesResponse -> f UpdateStackInstancesResponse
updateStackInstancesResponse_operationId = (UpdateStackInstancesResponse -> Maybe Text)
-> (UpdateStackInstancesResponse
    -> Maybe Text -> UpdateStackInstancesResponse)
-> Lens
     UpdateStackInstancesResponse
     UpdateStackInstancesResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateStackInstancesResponse' {Maybe Text
operationId :: Maybe Text
$sel:operationId:UpdateStackInstancesResponse' :: UpdateStackInstancesResponse -> Maybe Text
operationId} -> Maybe Text
operationId) (\s :: UpdateStackInstancesResponse
s@UpdateStackInstancesResponse' {} Maybe Text
a -> UpdateStackInstancesResponse
s {$sel:operationId:UpdateStackInstancesResponse' :: Maybe Text
operationId = Maybe Text
a} :: UpdateStackInstancesResponse)

-- | The response's http status code.
updateStackInstancesResponse_httpStatus :: Lens.Lens' UpdateStackInstancesResponse Prelude.Int
updateStackInstancesResponse_httpStatus :: (Int -> f Int)
-> UpdateStackInstancesResponse -> f UpdateStackInstancesResponse
updateStackInstancesResponse_httpStatus = (UpdateStackInstancesResponse -> Int)
-> (UpdateStackInstancesResponse
    -> Int -> UpdateStackInstancesResponse)
-> Lens
     UpdateStackInstancesResponse UpdateStackInstancesResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateStackInstancesResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateStackInstancesResponse' :: UpdateStackInstancesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateStackInstancesResponse
s@UpdateStackInstancesResponse' {} Int
a -> UpdateStackInstancesResponse
s {$sel:httpStatus:UpdateStackInstancesResponse' :: Int
httpStatus = Int
a} :: UpdateStackInstancesResponse)

instance Prelude.NFData UpdateStackInstancesResponse