Skip to content

delete_stack_set

delete_stack_set(
    *,
    config_overrides: Optional[CloudFormationClientConfig] = None,
    stack_set_name: Optional[StackSetName] = None,
    call_as: Optional[CallAs] = None,
) -> DeleteStackSetOutput

Deletes a StackSet. Before you can delete a StackSet, all its member stack instances must be deleted. For more information about how to complete this, see DeleteStackInstances.

Parameters:

  • stack_set_name (Optional[StackSetName], default: None ) –

    The name or unique ID of the StackSet that you're deleting. You can obtain this value by running ListStackSets.

  • call_as (Optional[CallAs], default: None ) –

    [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 StackSets 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 Register a delegated administrator in the CloudFormation User Guide.

Raises:

  • OperationInProgressException –

    Another operation is currently in progress for this StackSet. Only one operation can be performed for a stack set at a given time.

  • StackSetNotEmptyException –

    You can't yet delete this StackSet, because it still contains one or more stack instances. Delete all stack instances from the StackSet before deleting the StackSet.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_cloudformation/_services/cloud_formation.py
def delete_stack_set(
    self,
    *,
    config_overrides: Optional[CloudFormationClientConfig] = None,
    stack_set_name: Optional[
        "capo_cloudformation.types.stack_set_name.StackSetName"
    ] = None,
    call_as: Optional["capo_cloudformation.types.call_as.CallAs"] = None,
) -> "capo_cloudformation.types.delete_stack_set_output.DeleteStackSetOutput":
    """<p>Deletes a StackSet. Before you can delete a StackSet, all its member stack instances must be deleted. For more information about how to complete this, see <a>DeleteStackInstances</a>.</p>

    Args:
        stack_set_name: <p>The name or unique ID of the StackSet that you're deleting. You can obtain this value by running <a>ListStackSets</a>.</p>
        call_as: <p>[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.</p> <p>By default, <code>SELF</code> is specified. Use <code>SELF</code> for StackSets with self-managed permissions.</p> <ul> <li> <p>If you are signed in to the management account, specify <code>SELF</code>.</p> </li> <li> <p>If you are signed in to a delegated administrator account, specify <code>DELEGATED_ADMIN</code>.</p> <p>Your Amazon Web Services account must be registered as a delegated administrator in the management account. For more information, see <a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-orgs-delegated-admin.html">Register a delegated administrator</a> in the <i>CloudFormation User Guide</i>.</p> </li> </ul>

    Raises:
        capo_cloudformation.errors.operation_in_progress_exception.OperationInProgressException: <p>Another operation is currently in progress for this StackSet. Only one operation can be performed for a stack set at a given time.</p>
        capo_cloudformation.errors.stack_set_not_empty_exception.StackSetNotEmptyException: <p>You can't yet delete this StackSet, because it still contains one or more stack instances. Delete all stack instances from the StackSet before deleting the StackSet.</p>
        capo_cloudformation.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_cloudformation.types.delete_stack_set_input.DeleteStackSetInput]",
    ) -> OperationResponse[
        "capo_cloudformation.types.delete_stack_set_output.DeleteStackSetOutput"
    ]:
        import capo_cloudformation._operations.cloud_formation.delete_stack_set

        output, http_response = (
            capo_cloudformation._operations.cloud_formation.delete_stack_set.delete_stack_set(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteStackSet")
    )
    input_: capo_cloudformation.types.delete_stack_set_input.DeleteStackSetInput = {}
    if stack_set_name is not None:
        input_["stack_set_name"] = stack_set_name
    if call_as is not None:
        input_["call_as"] = call_as

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output