updateTerminationProtection method

Future<UpdateTerminationProtectionOutput> updateTerminationProtection({
  1. required bool enableTerminationProtection,
  2. required String stackName,
})

Updates termination protection for the specified stack. If a user attempts to delete a stack with termination protection enabled, the operation fails and the stack remains unchanged. For more information, see Protecting a Stack From Being Deleted in the AWS CloudFormation User Guide.

For nested stacks, termination protection is set on the root stack and cannot be changed directly on the nested stack.

Parameter enableTerminationProtection : Whether to enable termination protection on the specified stack.

Parameter stackName : The name or unique ID of the stack for which you want to set termination protection.

Implementation

Future<UpdateTerminationProtectionOutput> updateTerminationProtection({
  required bool enableTerminationProtection,
  required String stackName,
}) async {
  ArgumentError.checkNotNull(
      enableTerminationProtection, 'enableTerminationProtection');
  ArgumentError.checkNotNull(stackName, 'stackName');
  _s.validateStringLength(
    'stackName',
    stackName,
    1,
    1152921504606846976,
    isRequired: true,
  );
  final $request = <String, dynamic>{};
  $request['EnableTerminationProtection'] = enableTerminationProtection;
  $request['StackName'] = stackName;
  final $result = await _protocol.send(
    $request,
    action: 'UpdateTerminationProtection',
    version: '2010-05-15',
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    shape: shapes['UpdateTerminationProtectionInput'],
    shapes: shapes,
    resultWrapper: 'UpdateTerminationProtectionResult',
  );
  return UpdateTerminationProtectionOutput.fromXml($result);
}