{-# 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.DeleteStackInstances
-- 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)
--
-- Deletes stack instances for the specified accounts, in the specified
-- Regions.
module Amazonka.CloudFormation.DeleteStackInstances
  ( -- * Creating a Request
    DeleteStackInstances (..),
    newDeleteStackInstances,

    -- * Request Lenses
    deleteStackInstances_accounts,
    deleteStackInstances_callAs,
    deleteStackInstances_operationPreferences,
    deleteStackInstances_operationId,
    deleteStackInstances_deploymentTargets,
    deleteStackInstances_stackSetName,
    deleteStackInstances_regions,
    deleteStackInstances_retainStacks,

    -- * Destructuring the Response
    DeleteStackInstancesResponse (..),
    newDeleteStackInstancesResponse,

    -- * Response Lenses
    deleteStackInstancesResponse_operationId,
    deleteStackInstancesResponse_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:/ 'newDeleteStackInstances' smart constructor.
data DeleteStackInstances = DeleteStackInstances'
  { -- | [Self-managed permissions] The names of the Amazon Web Services accounts
    -- that you want to delete stack instances for.
    --
    -- You can specify @Accounts@ or @DeploymentTargets@, but not both.
    DeleteStackInstances -> 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/.
    DeleteStackInstances -> Maybe CallAs
callAs :: Prelude.Maybe CallAs,
    -- | Preferences for how CloudFormation performs this stack set operation.
    DeleteStackInstances -> Maybe StackSetOperationPreferences
operationPreferences :: Prelude.Maybe StackSetOperationPreferences,
    -- | The unique identifier for this stack set operation.
    --
    -- If you don\'t specify an operation ID, the SDK generates one
    -- automatically.
    --
    -- 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 can retry stack set operation
    -- requests to ensure that CloudFormation successfully received them.
    --
    -- Repeating this stack set operation with a new operation ID retries all
    -- stack instances whose status is @OUTDATED@.
    DeleteStackInstances -> Maybe Text
operationId :: Prelude.Maybe Prelude.Text,
    -- | [Service-managed permissions] The Organizations accounts from which to
    -- delete stack instances.
    --
    -- You can specify @Accounts@ or @DeploymentTargets@, but not both.
    DeleteStackInstances -> Maybe DeploymentTargets
deploymentTargets :: Prelude.Maybe DeploymentTargets,
    -- | The name or unique ID of the stack set that you want to delete stack
    -- instances for.
    DeleteStackInstances -> Text
stackSetName :: Prelude.Text,
    -- | The Regions where you want to delete stack set instances.
    DeleteStackInstances -> [Text]
regions :: [Prelude.Text],
    -- | Removes the stack instances from the specified stack set, but doesn\'t
    -- delete the stacks. You can\'t reassociate a retained stack or add an
    -- existing, saved stack to a new stack set.
    --
    -- For more information, see
    -- <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-concepts.html#stackset-ops-options Stack set operation options>.
    DeleteStackInstances -> Bool
retainStacks :: Prelude.Bool
  }
  deriving (DeleteStackInstances -> DeleteStackInstances -> Bool
(DeleteStackInstances -> DeleteStackInstances -> Bool)
-> (DeleteStackInstances -> DeleteStackInstances -> Bool)
-> Eq DeleteStackInstances
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteStackInstances -> DeleteStackInstances -> Bool
$c/= :: DeleteStackInstances -> DeleteStackInstances -> Bool
== :: DeleteStackInstances -> DeleteStackInstances -> Bool
$c== :: DeleteStackInstances -> DeleteStackInstances -> Bool
Prelude.Eq, ReadPrec [DeleteStackInstances]
ReadPrec DeleteStackInstances
Int -> ReadS DeleteStackInstances
ReadS [DeleteStackInstances]
(Int -> ReadS DeleteStackInstances)
-> ReadS [DeleteStackInstances]
-> ReadPrec DeleteStackInstances
-> ReadPrec [DeleteStackInstances]
-> Read DeleteStackInstances
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteStackInstances]
$creadListPrec :: ReadPrec [DeleteStackInstances]
readPrec :: ReadPrec DeleteStackInstances
$creadPrec :: ReadPrec DeleteStackInstances
readList :: ReadS [DeleteStackInstances]
$creadList :: ReadS [DeleteStackInstances]
readsPrec :: Int -> ReadS DeleteStackInstances
$creadsPrec :: Int -> ReadS DeleteStackInstances
Prelude.Read, Int -> DeleteStackInstances -> ShowS
[DeleteStackInstances] -> ShowS
DeleteStackInstances -> String
(Int -> DeleteStackInstances -> ShowS)
-> (DeleteStackInstances -> String)
-> ([DeleteStackInstances] -> ShowS)
-> Show DeleteStackInstances
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteStackInstances] -> ShowS
$cshowList :: [DeleteStackInstances] -> ShowS
show :: DeleteStackInstances -> String
$cshow :: DeleteStackInstances -> String
showsPrec :: Int -> DeleteStackInstances -> ShowS
$cshowsPrec :: Int -> DeleteStackInstances -> ShowS
Prelude.Show, (forall x. DeleteStackInstances -> Rep DeleteStackInstances x)
-> (forall x. Rep DeleteStackInstances x -> DeleteStackInstances)
-> Generic DeleteStackInstances
forall x. Rep DeleteStackInstances x -> DeleteStackInstances
forall x. DeleteStackInstances -> Rep DeleteStackInstances x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteStackInstances x -> DeleteStackInstances
$cfrom :: forall x. DeleteStackInstances -> Rep DeleteStackInstances x
Prelude.Generic)

-- |
-- Create a value of 'DeleteStackInstances' 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', 'deleteStackInstances_accounts' - [Self-managed permissions] The names of the Amazon Web Services accounts
-- that you want to delete stack instances for.
--
-- You can specify @Accounts@ or @DeploymentTargets@, but not both.
--
-- 'callAs', 'deleteStackInstances_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', 'deleteStackInstances_operationPreferences' - Preferences for how CloudFormation performs this stack set operation.
--
-- 'operationId', 'deleteStackInstances_operationId' - The unique identifier for this stack set operation.
--
-- If you don\'t specify an operation ID, the SDK generates one
-- automatically.
--
-- 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 can retry stack set operation
-- requests to ensure that CloudFormation successfully received them.
--
-- Repeating this stack set operation with a new operation ID retries all
-- stack instances whose status is @OUTDATED@.
--
-- 'deploymentTargets', 'deleteStackInstances_deploymentTargets' - [Service-managed permissions] The Organizations accounts from which to
-- delete stack instances.
--
-- You can specify @Accounts@ or @DeploymentTargets@, but not both.
--
-- 'stackSetName', 'deleteStackInstances_stackSetName' - The name or unique ID of the stack set that you want to delete stack
-- instances for.
--
-- 'regions', 'deleteStackInstances_regions' - The Regions where you want to delete stack set instances.
--
-- 'retainStacks', 'deleteStackInstances_retainStacks' - Removes the stack instances from the specified stack set, but doesn\'t
-- delete the stacks. You can\'t reassociate a retained stack or add an
-- existing, saved stack to a new stack set.
--
-- For more information, see
-- <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-concepts.html#stackset-ops-options Stack set operation options>.
newDeleteStackInstances ::
  -- | 'stackSetName'
  Prelude.Text ->
  -- | 'retainStacks'
  Prelude.Bool ->
  DeleteStackInstances
newDeleteStackInstances :: Text -> Bool -> DeleteStackInstances
newDeleteStackInstances Text
pStackSetName_ Bool
pRetainStacks_ =
  DeleteStackInstances' :: Maybe [Text]
-> Maybe CallAs
-> Maybe StackSetOperationPreferences
-> Maybe Text
-> Maybe DeploymentTargets
-> Text
-> [Text]
-> Bool
-> DeleteStackInstances
DeleteStackInstances'
    { $sel:accounts:DeleteStackInstances' :: Maybe [Text]
accounts = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:callAs:DeleteStackInstances' :: Maybe CallAs
callAs = Maybe CallAs
forall a. Maybe a
Prelude.Nothing,
      $sel:operationPreferences:DeleteStackInstances' :: Maybe StackSetOperationPreferences
operationPreferences = Maybe StackSetOperationPreferences
forall a. Maybe a
Prelude.Nothing,
      $sel:operationId:DeleteStackInstances' :: Maybe Text
operationId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:deploymentTargets:DeleteStackInstances' :: Maybe DeploymentTargets
deploymentTargets = Maybe DeploymentTargets
forall a. Maybe a
Prelude.Nothing,
      $sel:stackSetName:DeleteStackInstances' :: Text
stackSetName = Text
pStackSetName_,
      $sel:regions:DeleteStackInstances' :: [Text]
regions = [Text]
forall a. Monoid a => a
Prelude.mempty,
      $sel:retainStacks:DeleteStackInstances' :: Bool
retainStacks = Bool
pRetainStacks_
    }

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

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

-- | The unique identifier for this stack set operation.
--
-- If you don\'t specify an operation ID, the SDK generates one
-- automatically.
--
-- 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 can retry stack set operation
-- requests to ensure that CloudFormation successfully received them.
--
-- Repeating this stack set operation with a new operation ID retries all
-- stack instances whose status is @OUTDATED@.
deleteStackInstances_operationId :: Lens.Lens' DeleteStackInstances (Prelude.Maybe Prelude.Text)
deleteStackInstances_operationId :: (Maybe Text -> f (Maybe Text))
-> DeleteStackInstances -> f DeleteStackInstances
deleteStackInstances_operationId = (DeleteStackInstances -> Maybe Text)
-> (DeleteStackInstances -> Maybe Text -> DeleteStackInstances)
-> Lens
     DeleteStackInstances DeleteStackInstances (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteStackInstances' {Maybe Text
operationId :: Maybe Text
$sel:operationId:DeleteStackInstances' :: DeleteStackInstances -> Maybe Text
operationId} -> Maybe Text
operationId) (\s :: DeleteStackInstances
s@DeleteStackInstances' {} Maybe Text
a -> DeleteStackInstances
s {$sel:operationId:DeleteStackInstances' :: Maybe Text
operationId = Maybe Text
a} :: DeleteStackInstances)

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

-- | The name or unique ID of the stack set that you want to delete stack
-- instances for.
deleteStackInstances_stackSetName :: Lens.Lens' DeleteStackInstances Prelude.Text
deleteStackInstances_stackSetName :: (Text -> f Text) -> DeleteStackInstances -> f DeleteStackInstances
deleteStackInstances_stackSetName = (DeleteStackInstances -> Text)
-> (DeleteStackInstances -> Text -> DeleteStackInstances)
-> Lens DeleteStackInstances DeleteStackInstances Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteStackInstances' {Text
stackSetName :: Text
$sel:stackSetName:DeleteStackInstances' :: DeleteStackInstances -> Text
stackSetName} -> Text
stackSetName) (\s :: DeleteStackInstances
s@DeleteStackInstances' {} Text
a -> DeleteStackInstances
s {$sel:stackSetName:DeleteStackInstances' :: Text
stackSetName = Text
a} :: DeleteStackInstances)

-- | The Regions where you want to delete stack set instances.
deleteStackInstances_regions :: Lens.Lens' DeleteStackInstances [Prelude.Text]
deleteStackInstances_regions :: ([Text] -> f [Text])
-> DeleteStackInstances -> f DeleteStackInstances
deleteStackInstances_regions = (DeleteStackInstances -> [Text])
-> (DeleteStackInstances -> [Text] -> DeleteStackInstances)
-> Lens DeleteStackInstances DeleteStackInstances [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteStackInstances' {[Text]
regions :: [Text]
$sel:regions:DeleteStackInstances' :: DeleteStackInstances -> [Text]
regions} -> [Text]
regions) (\s :: DeleteStackInstances
s@DeleteStackInstances' {} [Text]
a -> DeleteStackInstances
s {$sel:regions:DeleteStackInstances' :: [Text]
regions = [Text]
a} :: DeleteStackInstances) (([Text] -> f [Text])
 -> DeleteStackInstances -> f DeleteStackInstances)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> DeleteStackInstances
-> f DeleteStackInstances
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

-- | Removes the stack instances from the specified stack set, but doesn\'t
-- delete the stacks. You can\'t reassociate a retained stack or add an
-- existing, saved stack to a new stack set.
--
-- For more information, see
-- <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-concepts.html#stackset-ops-options Stack set operation options>.
deleteStackInstances_retainStacks :: Lens.Lens' DeleteStackInstances Prelude.Bool
deleteStackInstances_retainStacks :: (Bool -> f Bool) -> DeleteStackInstances -> f DeleteStackInstances
deleteStackInstances_retainStacks = (DeleteStackInstances -> Bool)
-> (DeleteStackInstances -> Bool -> DeleteStackInstances)
-> Lens DeleteStackInstances DeleteStackInstances Bool Bool
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteStackInstances' {Bool
retainStacks :: Bool
$sel:retainStacks:DeleteStackInstances' :: DeleteStackInstances -> Bool
retainStacks} -> Bool
retainStacks) (\s :: DeleteStackInstances
s@DeleteStackInstances' {} Bool
a -> DeleteStackInstances
s {$sel:retainStacks:DeleteStackInstances' :: Bool
retainStacks = Bool
a} :: DeleteStackInstances)

instance Core.AWSRequest DeleteStackInstances where
  type
    AWSResponse DeleteStackInstances =
      DeleteStackInstancesResponse
  request :: DeleteStackInstances -> Request DeleteStackInstances
request = Service -> DeleteStackInstances -> Request DeleteStackInstances
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteStackInstances
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteStackInstances)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse DeleteStackInstances))
-> Logger
-> Service
-> Proxy DeleteStackInstances
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteStackInstances)))
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
"DeleteStackInstancesResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe Text -> Int -> DeleteStackInstancesResponse
DeleteStackInstancesResponse'
            (Maybe Text -> Int -> DeleteStackInstancesResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DeleteStackInstancesResponse)
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 -> DeleteStackInstancesResponse)
-> Either String Int -> Either String DeleteStackInstancesResponse
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 DeleteStackInstances

instance Prelude.NFData DeleteStackInstances

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

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

instance Core.ToQuery DeleteStackInstances where
  toQuery :: DeleteStackInstances -> QueryString
toQuery DeleteStackInstances' {Bool
[Text]
Maybe [Text]
Maybe Text
Maybe CallAs
Maybe DeploymentTargets
Maybe StackSetOperationPreferences
Text
retainStacks :: Bool
regions :: [Text]
stackSetName :: Text
deploymentTargets :: Maybe DeploymentTargets
operationId :: Maybe Text
operationPreferences :: Maybe StackSetOperationPreferences
callAs :: Maybe CallAs
accounts :: Maybe [Text]
$sel:retainStacks:DeleteStackInstances' :: DeleteStackInstances -> Bool
$sel:regions:DeleteStackInstances' :: DeleteStackInstances -> [Text]
$sel:stackSetName:DeleteStackInstances' :: DeleteStackInstances -> Text
$sel:deploymentTargets:DeleteStackInstances' :: DeleteStackInstances -> Maybe DeploymentTargets
$sel:operationId:DeleteStackInstances' :: DeleteStackInstances -> Maybe Text
$sel:operationPreferences:DeleteStackInstances' :: DeleteStackInstances -> Maybe StackSetOperationPreferences
$sel:callAs:DeleteStackInstances' :: DeleteStackInstances -> Maybe CallAs
$sel:accounts:DeleteStackInstances' :: DeleteStackInstances -> 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
"DeleteStackInstances" :: 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
"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,
        ByteString
"RetainStacks" ByteString -> Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Bool
retainStacks
      ]

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

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

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

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

instance Prelude.NFData DeleteStackInstancesResponse