Skip to content

list_stacks

list_stacks(
    *,
    config_overrides: Optional[CloudFormationClientConfig] = None,
    next_token: Optional[NextToken] = None,
    stack_status_filter: Optional[StackStatusFilter] = None,
) -> ListStacksOutput

Returns the summary information for stacks whose status matches the specified StackStatusFilter. Summary information for stacks that have been deleted is kept for 90 days after the stack is deleted. If no StackStatusFilter is specified, summary information for all stacks is returned (including existing stacks and stacks that have been deleted).

Parameters:

  • next_token (Optional[NextToken], default: None ) –

    The token for the next set of items to return. (You received this token from a previous call.)

  • stack_status_filter (Optional[StackStatusFilter], default: None ) –

    Stack status to use as a filter. Specify one or more stack status codes to list only stacks with the specified status codes. For a complete list of stack status codes, see the StackStatus parameter of the Stack data type.

Raises:

Source code in docs_src/capo_cloudformation/_services/cloud_formation.py
def list_stacks(
    self,
    *,
    config_overrides: Optional[CloudFormationClientConfig] = None,
    next_token: Optional["capo_cloudformation.types.next_token.NextToken"] = None,
    stack_status_filter: Optional[
        "capo_cloudformation.types.stack_status_filter.StackStatusFilter"
    ] = None,
) -> "capo_cloudformation.types.list_stacks_output.ListStacksOutput":
    """<p>Returns the summary information for stacks whose status matches the specified <code>StackStatusFilter</code>. Summary information for stacks that have been deleted is kept for 90 days after the stack is deleted. If no <code>StackStatusFilter</code> is specified, summary information for all stacks is returned (including existing stacks and stacks that have been deleted).</p>

    Args:
        next_token: <p>The token for the next set of items to return. (You received this token from a previous call.)</p>
        stack_status_filter: <p>Stack status to use as a filter. Specify one or more stack status codes to list only stacks with the specified status codes. For a complete list of stack status codes, see the <code>StackStatus</code> parameter of the <a>Stack</a> data type.</p>

    Raises:
        capo_cloudformation.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_cloudformation.types.list_stacks_input.ListStacksInput]",
    ) -> OperationResponse[
        "capo_cloudformation.types.list_stacks_output.ListStacksOutput"
    ]:
        import capo_cloudformation._operations.cloud_formation.list_stacks

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListStacks")
    )
    input_: capo_cloudformation.types.list_stacks_input.ListStacksInput = {}
    if next_token is not None:
        input_["next_token"] = next_token
    if stack_status_filter is not None:
        input_["stack_status_filter"] = stack_status_filter

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