{-# 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.CreateStackInstances
-- 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)
--
-- Creates stack instances for the specified accounts, within the specified
-- Regions. A stack instance refers to a stack in a specific account and
-- Region. You must specify at least one value for either @Accounts@ or
-- @DeploymentTargets@, and you must specify at least one value for
-- @Regions@.
module Amazonka.CloudFormation.CreateStackInstances
  ( -- * Creating a Request
    CreateStackInstances (..),
    newCreateStackInstances,

    -- * Request Lenses
    createStackInstances_accounts,
    createStackInstances_callAs,
    createStackInstances_operationPreferences,
    createStackInstances_operationId,
    createStackInstances_deploymentTargets,
    createStackInstances_parameterOverrides,
    createStackInstances_stackSetName,
    createStackInstances_regions,

    -- * Destructuring the Response
    CreateStackInstancesResponse (..),
    newCreateStackInstancesResponse,

    -- * Response Lenses
    createStackInstancesResponse_operationId,
    createStackInstancesResponse_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:/ 'newCreateStackInstances' smart constructor.
data CreateStackInstances = CreateStackInstances'
  { -- | [Self-managed permissions] The names of one or more Amazon Web Services
    -- accounts that you want to create stack instances in the specified
    -- Region(s) for.
    --
    -- You can specify @Accounts@ or @DeploymentTargets@, but not both.
    CreateStackInstances -> 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/.
    CreateStackInstances -> Maybe CallAs
callAs :: Prelude.Maybe CallAs,
    -- | Preferences for how CloudFormation performs this stack set operation.
    CreateStackInstances -> 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.
    --
    -- Repeating this stack set operation with a new operation ID retries all
    -- stack instances whose status is @OUTDATED@.
    CreateStackInstances -> Maybe Text
operationId :: Prelude.Maybe Prelude.Text,
    -- | [Service-managed permissions] The Organizations accounts for which to
    -- create stack instances in the specified Regions.
    --
    -- You can specify @Accounts@ or @DeploymentTargets@, but not both.
    CreateStackInstances -> Maybe DeploymentTargets
deploymentTargets :: Prelude.Maybe DeploymentTargets,
    -- | A list of stack set parameters whose values you want to override in the
    -- selected 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 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
    -- <https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_UpdateStackSet.html UpdateStackSet>
    -- to update the stack set template.
    CreateStackInstances -> Maybe [Parameter]
parameterOverrides :: Prelude.Maybe [Parameter],
    -- | The name or unique ID of the stack set that you want to create stack
    -- instances from.
    CreateStackInstances -> Text
stackSetName :: Prelude.Text,
    -- | The names of one or more Regions where you want to create stack
    -- instances using the specified Amazon Web Services accounts.
    CreateStackInstances -> [Text]
regions :: [Prelude.Text]
  }
  deriving (CreateStackInstances -> CreateStackInstances -> Bool
(CreateStackInstances -> CreateStackInstances -> Bool)
-> (CreateStackInstances -> CreateStackInstances -> Bool)
-> Eq CreateStackInstances
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateStackInstances -> CreateStackInstances -> Bool
$c/= :: CreateStackInstances -> CreateStackInstances -> Bool
== :: CreateStackInstances -> CreateStackInstances -> Bool
$c== :: CreateStackInstances -> CreateStackInstances -> Bool
Prelude.Eq, ReadPrec [CreateStackInstances]
ReadPrec CreateStackInstances
Int -> ReadS CreateStackInstances
ReadS [CreateStackInstances]
(Int -> ReadS CreateStackInstances)
-> ReadS [CreateStackInstances]
-> ReadPrec CreateStackInstances
-> ReadPrec [CreateStackInstances]
-> Read CreateStackInstances
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateStackInstances]
$creadListPrec :: ReadPrec [CreateStackInstances]
readPrec :: ReadPrec CreateStackInstances
$creadPrec :: ReadPrec CreateStackInstances
readList :: ReadS [CreateStackInstances]
$creadList :: ReadS [CreateStackInstances]
readsPrec :: Int -> ReadS CreateStackInstances
$creadsPrec :: Int -> ReadS CreateStackInstances
Prelude.Read, Int -> CreateStackInstances -> ShowS
[CreateStackInstances] -> ShowS
CreateStackInstances -> String
(Int -> CreateStackInstances -> ShowS)
-> (CreateStackInstances -> String)
-> ([CreateStackInstances] -> ShowS)
-> Show CreateStackInstances
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateStackInstances] -> ShowS
$cshowList :: [CreateStackInstances] -> ShowS
show :: CreateStackInstances -> String
$cshow :: CreateStackInstances -> String
showsPrec :: Int -> CreateStackInstances -> ShowS
$cshowsPrec :: Int -> CreateStackInstances -> ShowS
Prelude.Show, (forall x. CreateStackInstances -> Rep CreateStackInstances x)
-> (forall x. Rep CreateStackInstances x -> CreateStackInstances)
-> Generic CreateStackInstances
forall x. Rep CreateStackInstances x -> CreateStackInstances
forall x. CreateStackInstances -> Rep CreateStackInstances x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateStackInstances x -> CreateStackInstances
$cfrom :: forall x. CreateStackInstances -> Rep CreateStackInstances x
Prelude.Generic)

-- |
-- Create a value of 'CreateStackInstances' 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', 'createStackInstances_accounts' - [Self-managed permissions] The names of one or more Amazon Web Services
-- accounts that you want to create stack instances in the specified
-- Region(s) for.
--
-- You can specify @Accounts@ or @DeploymentTargets@, but not both.
--
-- 'callAs', 'createStackInstances_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', 'createStackInstances_operationPreferences' - Preferences for how CloudFormation performs this stack set operation.
--
-- 'operationId', 'createStackInstances_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.
--
-- Repeating this stack set operation with a new operation ID retries all
-- stack instances whose status is @OUTDATED@.
--
-- 'deploymentTargets', 'createStackInstances_deploymentTargets' - [Service-managed permissions] The Organizations accounts for which to
-- create stack instances in the specified Regions.
--
-- You can specify @Accounts@ or @DeploymentTargets@, but not both.
--
-- 'parameterOverrides', 'createStackInstances_parameterOverrides' - A list of stack set parameters whose values you want to override in the
-- selected 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 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
-- <https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_UpdateStackSet.html UpdateStackSet>
-- to update the stack set template.
--
-- 'stackSetName', 'createStackInstances_stackSetName' - The name or unique ID of the stack set that you want to create stack
-- instances from.
--
-- 'regions', 'createStackInstances_regions' - The names of one or more Regions where you want to create stack
-- instances using the specified Amazon Web Services accounts.
newCreateStackInstances ::
  -- | 'stackSetName'
  Prelude.Text ->
  CreateStackInstances
newCreateStackInstances :: Text -> CreateStackInstances
newCreateStackInstances Text
pStackSetName_ =
  CreateStackInstances' :: Maybe [Text]
-> Maybe CallAs
-> Maybe StackSetOperationPreferences
-> Maybe Text
-> Maybe DeploymentTargets
-> Maybe [Parameter]
-> Text
-> [Text]
-> CreateStackInstances
CreateStackInstances'
    { $sel:accounts:CreateStackInstances' :: Maybe [Text]
accounts = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:callAs:CreateStackInstances' :: Maybe CallAs
callAs = Maybe CallAs
forall a. Maybe a
Prelude.Nothing,
      $sel:operationPreferences:CreateStackInstances' :: Maybe StackSetOperationPreferences
operationPreferences = Maybe StackSetOperationPreferences
forall a. Maybe a
Prelude.Nothing,
      $sel:operationId:CreateStackInstances' :: Maybe Text
operationId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:deploymentTargets:CreateStackInstances' :: Maybe DeploymentTargets
deploymentTargets = Maybe DeploymentTargets
forall a. Maybe a
Prelude.Nothing,
      $sel:parameterOverrides:CreateStackInstances' :: Maybe [Parameter]
parameterOverrides = Maybe [Parameter]
forall a. Maybe a
Prelude.Nothing,
      $sel:stackSetName:CreateStackInstances' :: Text
stackSetName = Text
pStackSetName_,
      $sel:regions:CreateStackInstances' :: [Text]
regions = [Text]
forall a. Monoid a => a
Prelude.mempty
    }

-- | [Self-managed permissions] The names of one or more Amazon Web Services
-- accounts that you want to create stack instances in the specified
-- Region(s) for.
--
-- You can specify @Accounts@ or @DeploymentTargets@, but not both.
createStackInstances_accounts :: Lens.Lens' CreateStackInstances (Prelude.Maybe [Prelude.Text])
createStackInstances_accounts :: (Maybe [Text] -> f (Maybe [Text]))
-> CreateStackInstances -> f CreateStackInstances
createStackInstances_accounts = (CreateStackInstances -> Maybe [Text])
-> (CreateStackInstances -> Maybe [Text] -> CreateStackInstances)
-> Lens
     CreateStackInstances
     CreateStackInstances
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStackInstances' {Maybe [Text]
accounts :: Maybe [Text]
$sel:accounts:CreateStackInstances' :: CreateStackInstances -> Maybe [Text]
accounts} -> Maybe [Text]
accounts) (\s :: CreateStackInstances
s@CreateStackInstances' {} Maybe [Text]
a -> CreateStackInstances
s {$sel:accounts:CreateStackInstances' :: Maybe [Text]
accounts = Maybe [Text]
a} :: CreateStackInstances) ((Maybe [Text] -> f (Maybe [Text]))
 -> CreateStackInstances -> f CreateStackInstances)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> CreateStackInstances
-> f CreateStackInstances
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/.
createStackInstances_callAs :: Lens.Lens' CreateStackInstances (Prelude.Maybe CallAs)
createStackInstances_callAs :: (Maybe CallAs -> f (Maybe CallAs))
-> CreateStackInstances -> f CreateStackInstances
createStackInstances_callAs = (CreateStackInstances -> Maybe CallAs)
-> (CreateStackInstances -> Maybe CallAs -> CreateStackInstances)
-> Lens
     CreateStackInstances
     CreateStackInstances
     (Maybe CallAs)
     (Maybe CallAs)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStackInstances' {Maybe CallAs
callAs :: Maybe CallAs
$sel:callAs:CreateStackInstances' :: CreateStackInstances -> Maybe CallAs
callAs} -> Maybe CallAs
callAs) (\s :: CreateStackInstances
s@CreateStackInstances' {} Maybe CallAs
a -> CreateStackInstances
s {$sel:callAs:CreateStackInstances' :: Maybe CallAs
callAs = Maybe CallAs
a} :: CreateStackInstances)

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

-- | 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.
--
-- Repeating this stack set operation with a new operation ID retries all
-- stack instances whose status is @OUTDATED@.
createStackInstances_operationId :: Lens.Lens' CreateStackInstances (Prelude.Maybe Prelude.Text)
createStackInstances_operationId :: (Maybe Text -> f (Maybe Text))
-> CreateStackInstances -> f CreateStackInstances
createStackInstances_operationId = (CreateStackInstances -> Maybe Text)
-> (CreateStackInstances -> Maybe Text -> CreateStackInstances)
-> Lens
     CreateStackInstances CreateStackInstances (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStackInstances' {Maybe Text
operationId :: Maybe Text
$sel:operationId:CreateStackInstances' :: CreateStackInstances -> Maybe Text
operationId} -> Maybe Text
operationId) (\s :: CreateStackInstances
s@CreateStackInstances' {} Maybe Text
a -> CreateStackInstances
s {$sel:operationId:CreateStackInstances' :: Maybe Text
operationId = Maybe Text
a} :: CreateStackInstances)

-- | [Service-managed permissions] The Organizations accounts for which to
-- create stack instances in the specified Regions.
--
-- You can specify @Accounts@ or @DeploymentTargets@, but not both.
createStackInstances_deploymentTargets :: Lens.Lens' CreateStackInstances (Prelude.Maybe DeploymentTargets)
createStackInstances_deploymentTargets :: (Maybe DeploymentTargets -> f (Maybe DeploymentTargets))
-> CreateStackInstances -> f CreateStackInstances
createStackInstances_deploymentTargets = (CreateStackInstances -> Maybe DeploymentTargets)
-> (CreateStackInstances
    -> Maybe DeploymentTargets -> CreateStackInstances)
-> Lens
     CreateStackInstances
     CreateStackInstances
     (Maybe DeploymentTargets)
     (Maybe DeploymentTargets)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStackInstances' {Maybe DeploymentTargets
deploymentTargets :: Maybe DeploymentTargets
$sel:deploymentTargets:CreateStackInstances' :: CreateStackInstances -> Maybe DeploymentTargets
deploymentTargets} -> Maybe DeploymentTargets
deploymentTargets) (\s :: CreateStackInstances
s@CreateStackInstances' {} Maybe DeploymentTargets
a -> CreateStackInstances
s {$sel:deploymentTargets:CreateStackInstances' :: Maybe DeploymentTargets
deploymentTargets = Maybe DeploymentTargets
a} :: CreateStackInstances)

-- | A list of stack set parameters whose values you want to override in the
-- selected 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 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
-- <https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_UpdateStackSet.html UpdateStackSet>
-- to update the stack set template.
createStackInstances_parameterOverrides :: Lens.Lens' CreateStackInstances (Prelude.Maybe [Parameter])
createStackInstances_parameterOverrides :: (Maybe [Parameter] -> f (Maybe [Parameter]))
-> CreateStackInstances -> f CreateStackInstances
createStackInstances_parameterOverrides = (CreateStackInstances -> Maybe [Parameter])
-> (CreateStackInstances
    -> Maybe [Parameter] -> CreateStackInstances)
-> Lens
     CreateStackInstances
     CreateStackInstances
     (Maybe [Parameter])
     (Maybe [Parameter])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStackInstances' {Maybe [Parameter]
parameterOverrides :: Maybe [Parameter]
$sel:parameterOverrides:CreateStackInstances' :: CreateStackInstances -> Maybe [Parameter]
parameterOverrides} -> Maybe [Parameter]
parameterOverrides) (\s :: CreateStackInstances
s@CreateStackInstances' {} Maybe [Parameter]
a -> CreateStackInstances
s {$sel:parameterOverrides:CreateStackInstances' :: Maybe [Parameter]
parameterOverrides = Maybe [Parameter]
a} :: CreateStackInstances) ((Maybe [Parameter] -> f (Maybe [Parameter]))
 -> CreateStackInstances -> f CreateStackInstances)
-> ((Maybe [Parameter] -> f (Maybe [Parameter]))
    -> Maybe [Parameter] -> f (Maybe [Parameter]))
-> (Maybe [Parameter] -> f (Maybe [Parameter]))
-> CreateStackInstances
-> f CreateStackInstances
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 that you want to create stack
-- instances from.
createStackInstances_stackSetName :: Lens.Lens' CreateStackInstances Prelude.Text
createStackInstances_stackSetName :: (Text -> f Text) -> CreateStackInstances -> f CreateStackInstances
createStackInstances_stackSetName = (CreateStackInstances -> Text)
-> (CreateStackInstances -> Text -> CreateStackInstances)
-> Lens CreateStackInstances CreateStackInstances Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStackInstances' {Text
stackSetName :: Text
$sel:stackSetName:CreateStackInstances' :: CreateStackInstances -> Text
stackSetName} -> Text
stackSetName) (\s :: CreateStackInstances
s@CreateStackInstances' {} Text
a -> CreateStackInstances
s {$sel:stackSetName:CreateStackInstances' :: Text
stackSetName = Text
a} :: CreateStackInstances)

-- | The names of one or more Regions where you want to create stack
-- instances using the specified Amazon Web Services accounts.
createStackInstances_regions :: Lens.Lens' CreateStackInstances [Prelude.Text]
createStackInstances_regions :: ([Text] -> f [Text])
-> CreateStackInstances -> f CreateStackInstances
createStackInstances_regions = (CreateStackInstances -> [Text])
-> (CreateStackInstances -> [Text] -> CreateStackInstances)
-> Lens CreateStackInstances CreateStackInstances [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStackInstances' {[Text]
regions :: [Text]
$sel:regions:CreateStackInstances' :: CreateStackInstances -> [Text]
regions} -> [Text]
regions) (\s :: CreateStackInstances
s@CreateStackInstances' {} [Text]
a -> CreateStackInstances
s {$sel:regions:CreateStackInstances' :: [Text]
regions = [Text]
a} :: CreateStackInstances) (([Text] -> f [Text])
 -> CreateStackInstances -> f CreateStackInstances)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> CreateStackInstances
-> f CreateStackInstances
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 CreateStackInstances where
  type
    AWSResponse CreateStackInstances =
      CreateStackInstancesResponse
  request :: CreateStackInstances -> Request CreateStackInstances
request = Service -> CreateStackInstances -> Request CreateStackInstances
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateStackInstances
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateStackInstances)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse CreateStackInstances))
-> Logger
-> Service
-> Proxy CreateStackInstances
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateStackInstances)))
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
"CreateStackInstancesResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe Text -> Int -> CreateStackInstancesResponse
CreateStackInstancesResponse'
            (Maybe Text -> Int -> CreateStackInstancesResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateStackInstancesResponse)
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 -> CreateStackInstancesResponse)
-> Either String Int -> Either String CreateStackInstancesResponse
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 CreateStackInstances

instance Prelude.NFData CreateStackInstances

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

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

instance Core.ToQuery CreateStackInstances where
  toQuery :: CreateStackInstances -> QueryString
toQuery CreateStackInstances' {[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:CreateStackInstances' :: CreateStackInstances -> [Text]
$sel:stackSetName:CreateStackInstances' :: CreateStackInstances -> Text
$sel:parameterOverrides:CreateStackInstances' :: CreateStackInstances -> Maybe [Parameter]
$sel:deploymentTargets:CreateStackInstances' :: CreateStackInstances -> Maybe DeploymentTargets
$sel:operationId:CreateStackInstances' :: CreateStackInstances -> Maybe Text
$sel:operationPreferences:CreateStackInstances' :: CreateStackInstances -> Maybe StackSetOperationPreferences
$sel:callAs:CreateStackInstances' :: CreateStackInstances -> Maybe CallAs
$sel:accounts:CreateStackInstances' :: CreateStackInstances -> 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
"CreateStackInstances" :: 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:/ 'newCreateStackInstancesResponse' smart constructor.
data CreateStackInstancesResponse = CreateStackInstancesResponse'
  { -- | The unique identifier for this stack set operation.
    CreateStackInstancesResponse -> Maybe Text
operationId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    CreateStackInstancesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateStackInstancesResponse
-> CreateStackInstancesResponse -> Bool
(CreateStackInstancesResponse
 -> CreateStackInstancesResponse -> Bool)
-> (CreateStackInstancesResponse
    -> CreateStackInstancesResponse -> Bool)
-> Eq CreateStackInstancesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateStackInstancesResponse
-> CreateStackInstancesResponse -> Bool
$c/= :: CreateStackInstancesResponse
-> CreateStackInstancesResponse -> Bool
== :: CreateStackInstancesResponse
-> CreateStackInstancesResponse -> Bool
$c== :: CreateStackInstancesResponse
-> CreateStackInstancesResponse -> Bool
Prelude.Eq, ReadPrec [CreateStackInstancesResponse]
ReadPrec CreateStackInstancesResponse
Int -> ReadS CreateStackInstancesResponse
ReadS [CreateStackInstancesResponse]
(Int -> ReadS CreateStackInstancesResponse)
-> ReadS [CreateStackInstancesResponse]
-> ReadPrec CreateStackInstancesResponse
-> ReadPrec [CreateStackInstancesResponse]
-> Read CreateStackInstancesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateStackInstancesResponse]
$creadListPrec :: ReadPrec [CreateStackInstancesResponse]
readPrec :: ReadPrec CreateStackInstancesResponse
$creadPrec :: ReadPrec CreateStackInstancesResponse
readList :: ReadS [CreateStackInstancesResponse]
$creadList :: ReadS [CreateStackInstancesResponse]
readsPrec :: Int -> ReadS CreateStackInstancesResponse
$creadsPrec :: Int -> ReadS CreateStackInstancesResponse
Prelude.Read, Int -> CreateStackInstancesResponse -> ShowS
[CreateStackInstancesResponse] -> ShowS
CreateStackInstancesResponse -> String
(Int -> CreateStackInstancesResponse -> ShowS)
-> (CreateStackInstancesResponse -> String)
-> ([CreateStackInstancesResponse] -> ShowS)
-> Show CreateStackInstancesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateStackInstancesResponse] -> ShowS
$cshowList :: [CreateStackInstancesResponse] -> ShowS
show :: CreateStackInstancesResponse -> String
$cshow :: CreateStackInstancesResponse -> String
showsPrec :: Int -> CreateStackInstancesResponse -> ShowS
$cshowsPrec :: Int -> CreateStackInstancesResponse -> ShowS
Prelude.Show, (forall x.
 CreateStackInstancesResponse -> Rep CreateStackInstancesResponse x)
-> (forall x.
    Rep CreateStackInstancesResponse x -> CreateStackInstancesResponse)
-> Generic CreateStackInstancesResponse
forall x.
Rep CreateStackInstancesResponse x -> CreateStackInstancesResponse
forall x.
CreateStackInstancesResponse -> Rep CreateStackInstancesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateStackInstancesResponse x -> CreateStackInstancesResponse
$cfrom :: forall x.
CreateStackInstancesResponse -> Rep CreateStackInstancesResponse x
Prelude.Generic)

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

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

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

instance Prelude.NFData CreateStackInstancesResponse