deleteStackInstances method

Future<DeleteStackInstancesOutput> deleteStackInstances({
  1. required List<String> regions,
  2. required bool retainStacks,
  3. required String stackSetName,
  4. List<String>? accounts,
  5. DeploymentTargets? deploymentTargets,
  6. String? operationId,
  7. StackSetOperationPreferences? operationPreferences,
})

Deletes stack instances for the specified accounts, in the specified Regions.

May throw StackSetNotFoundException. May throw OperationInProgressException. May throw OperationIdAlreadyExistsException. May throw StaleRequestException. May throw InvalidOperationException.

Parameter regions : The Regions where you want to delete stack set instances.

Parameter 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 Stack set operation options.

Parameter stackSetName : The name or unique ID of the stack set that you want to delete stack instances for.

Parameter accounts : <code>Self-managed</code> permissions The names of the AWS accounts that you want to delete stack instances for.

You can specify Accounts or DeploymentTargets, but not both.

Parameter deploymentTargets : <code>Service-managed</code> permissions The AWS Organizations accounts from which to delete stack instances.

You can specify Accounts or DeploymentTargets, but not both.

Parameter 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 AWS 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 AWS CloudFormation successfully received them.

Repeating this stack set operation with a new operation ID retries all stack instances whose status is OUTDATED.

Parameter operationPreferences : Preferences for how AWS CloudFormation performs this stack set operation.

Implementation

Future<DeleteStackInstancesOutput> deleteStackInstances({
  required List<String> regions,
  required bool retainStacks,
  required String stackSetName,
  List<String>? accounts,
  DeploymentTargets? deploymentTargets,
  String? operationId,
  StackSetOperationPreferences? operationPreferences,
}) async {
  ArgumentError.checkNotNull(regions, 'regions');
  ArgumentError.checkNotNull(retainStacks, 'retainStacks');
  ArgumentError.checkNotNull(stackSetName, 'stackSetName');
  _s.validateStringLength(
    'operationId',
    operationId,
    1,
    128,
  );
  final $request = <String, dynamic>{};
  $request['Regions'] = regions;
  $request['RetainStacks'] = retainStacks;
  $request['StackSetName'] = stackSetName;
  accounts?.also((arg) => $request['Accounts'] = arg);
  deploymentTargets?.also((arg) => $request['DeploymentTargets'] = arg);
  $request['OperationId'] = operationId ?? _s.generateIdempotencyToken();
  operationPreferences?.also((arg) => $request['OperationPreferences'] = arg);
  final $result = await _protocol.send(
    $request,
    action: 'DeleteStackInstances',
    version: '2010-05-15',
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    shape: shapes['DeleteStackInstancesInput'],
    shapes: shapes,
    resultWrapper: 'DeleteStackInstancesResult',
  );
  return DeleteStackInstancesOutput.fromXml($result);
}