Cancels an update on the specified stack. If the call completes successfully, the stack rolls back the update and reverts to the previous stack configuration.
You can cancel only stacks that are in the UPDATE_IN_PROGRESS state.
Parameters:
-
stack_name
(Optional[StackName], default:
None
)
–
If you don't pass a parameter to StackName, the API returns a response that describes all resources in the account.
The IAM policy below can be added to IAM policies when you want to limit resource-level permissions and avoid returning a response when no parameter is sent in the request:
{ "Version": "2012-10-17", "Statement": [{ "Effect": "Deny", "Action": "cloudformation:DescribeStacks", "NotResource": "arn:aws:cloudformation:::stack//" }] }
The name or the unique stack ID that's associated with the stack.
-
client_request_token
(Optional[ClientRequestToken], default:
None
)
–
A unique identifier for this CancelUpdateStack request. Specify this token if you plan to retry requests so that CloudFormation knows that you're not attempting to cancel an update on a stack with the same name. You might retry CancelUpdateStack requests to ensure that CloudFormation successfully received them.
Raises:
Source code in docs_src/capo_cloudformation/_services/cloud_formation.py
| def cancel_update_stack(
self,
*,
config_overrides: Optional[CloudFormationClientConfig] = None,
stack_name: Optional["capo_cloudformation.types.stack_name.StackName"] = None,
client_request_token: Optional[
"capo_cloudformation.types.client_request_token.ClientRequestToken"
] = None,
) -> None:
"""<p>Cancels an update on the specified stack. If the call completes successfully, the stack rolls back the update and reverts to the previous stack configuration.</p> <note> <p>You can cancel only stacks that are in the <code>UPDATE_IN_PROGRESS</code> state.</p> </note>
Args:
stack_name: <note> <p>If you don't pass a parameter to <code>StackName</code>, the API returns a response that describes all resources in the account.</p> <p>The IAM policy below can be added to IAM policies when you want to limit resource-level permissions and avoid returning a response when no parameter is sent in the request:</p> <p> <code>{ "Version": "2012-10-17", "Statement": [{ "Effect": "Deny", "Action": "cloudformation:DescribeStacks", "NotResource": "arn:aws:cloudformation:*:*:stack/*/*" }] }</code> </p> </note> <p>The name or the unique stack ID that's associated with the stack.</p>
client_request_token: <p>A unique identifier for this <code>CancelUpdateStack</code> request. Specify this token if you plan to retry requests so that CloudFormation knows that you're not attempting to cancel an update on a stack with the same name. You might retry <code>CancelUpdateStack</code> requests to ensure that CloudFormation successfully received them.</p>
Raises:
capo_cloudformation.errors.token_already_exists_exception.TokenAlreadyExistsException: <p>A client request token already exists.</p>
capo_cloudformation.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_cloudformation.types.cancel_update_stack_input.CancelUpdateStackInput]",
) -> OperationResponse[None]:
import capo_cloudformation._operations.cloud_formation.cancel_update_stack
output, http_response = (
capo_cloudformation._operations.cloud_formation.cancel_update_stack.cancel_update_stack(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("CancelUpdateStack")
)
input_: capo_cloudformation.types.cancel_update_stack_input.CancelUpdateStackInput = {}
if stack_name is not None:
input_["stack_name"] = stack_name
if client_request_token is not None:
input_["client_request_token"] = client_request_token
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|