setStackPolicy method

Future<void> setStackPolicy({
  1. required String stackName,
  2. String? stackPolicyBody,
  3. String? stackPolicyURL,
})

Sets a stack policy for a specified stack.

Parameter stackName : The name or unique stack ID that you want to associate a policy with.

Parameter stackPolicyBody : Structure that contains the stack policy body. For more information, see Prevent updates to stack resources in the CloudFormation User Guide. You can specify either the StackPolicyBody or the StackPolicyURL parameter, but not both.

Parameter stackPolicyURL : Location of a file that contains the stack policy. The URL must point to a policy (maximum size: 16 KB) located in an Amazon S3 bucket in the same Amazon Web Services Region as the stack. The location for an Amazon S3 bucket must start with https://. URLs from S3 static websites are not supported.

You can specify either the StackPolicyBody or the StackPolicyURL parameter, but not both.

Implementation

Future<void> setStackPolicy({
  required String stackName,
  String? stackPolicyBody,
  String? stackPolicyURL,
}) async {
  final $request = <String, String>{
    'StackName': stackName,
    if (stackPolicyBody != null) 'StackPolicyBody': stackPolicyBody,
    if (stackPolicyURL != null) 'StackPolicyURL': stackPolicyURL,
  };
  await _protocol.send(
    $request,
    action: 'SetStackPolicy',
    version: '2010-05-15',
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
  );
}