Skip to content

count_closed_workflow_executions

count_closed_workflow_executions(
    domain: DomainName,
    *,
    config_overrides: Optional[SWFClientConfig] = None,
    start_time_filter: Optional[ExecutionTimeFilter] = None,
    close_time_filter: Optional[ExecutionTimeFilter] = None,
    execution_filter: Optional[WorkflowExecutionFilter] = None,
    type_filter: Optional[WorkflowTypeFilter] = None,
    tag_filter: Optional[TagFilter] = None,
    close_status_filter: Optional[CloseStatusFilter] = None,
) -> WorkflowExecutionCount

Returns the number of closed workflow executions within the given domain that meet the specified filtering criteria.

This operation is eventually consistent. The results are best effort and may not exactly reflect recent updates and changes.

Access Control

You can use IAM policies to control this action's access to Amazon SWF resources as follows:

  • Use a Resource element with the domain name to limit the action to only specified domains.

  • Use an Action element to allow or deny permission to call this action.

  • Constrain the following parameters by using a Condition element with the appropriate keys.

    • tagFilter.tag: String constraint. The key is swf:tagFilter.tag.

    • typeFilter.name: String constraint. The key is swf:typeFilter.name.

    • typeFilter.version: String constraint. The key is swf:typeFilter.version.

If the caller doesn't have sufficient permissions to invoke the action, or the parameter values fall outside the specified constraints, the action fails. The associated event attribute's cause parameter is set to OPERATION_NOT_PERMITTED. For details and example IAM policies, see Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide.

Parameters:

  • domain (DomainName) –

    The name of the domain containing the workflow executions to count.

  • start_time_filter (Optional[ExecutionTimeFilter], default: None ) –

    If specified, only workflow executions that meet the start time criteria of the filter are counted.

    startTimeFilter and closeTimeFilter are mutually exclusive. You must specify one of these in a request but not both.

  • close_time_filter (Optional[ExecutionTimeFilter], default: None ) –

    If specified, only workflow executions that meet the close time criteria of the filter are counted.

    startTimeFilter and closeTimeFilter are mutually exclusive. You must specify one of these in a request but not both.

  • execution_filter (Optional[WorkflowExecutionFilter], default: None ) –

    If specified, only workflow executions matching the WorkflowId in the filter are counted.

    closeStatusFilter, executionFilter, typeFilter and tagFilter are mutually exclusive. You can specify at most one of these in a request.

  • type_filter (Optional[WorkflowTypeFilter], default: None ) –

    If specified, indicates the type of the workflow executions to be counted.

    closeStatusFilter, executionFilter, typeFilter and tagFilter are mutually exclusive. You can specify at most one of these in a request.

  • tag_filter (Optional[TagFilter], default: None ) –

    If specified, only executions that have a tag that matches the filter are counted.

    closeStatusFilter, executionFilter, typeFilter and tagFilter are mutually exclusive. You can specify at most one of these in a request.

  • close_status_filter (Optional[CloseStatusFilter], default: None ) –

    If specified, only workflow executions that match this close status are counted. This filter has an affect only if executionStatus is specified as CLOSED.

    closeStatusFilter, executionFilter, typeFilter and tagFilter are mutually exclusive. You can specify at most one of these in a request.

Raises:

  • OperationNotPermittedFault –

    Returned when the caller doesn't have sufficient permissions to invoke the action.

  • UnknownResourceFault –

    Returned when the named resource cannot be found with in the scope of this operation (region or domain). This could happen if the named resource was never created or is no longer available for this operation.

  • UnknownServiceError –

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

Source code in docs_src/capo_swf/_services/swf.py
def count_closed_workflow_executions(
    self,
    domain: "capo_swf.types.domain_name.DomainName",
    *,
    config_overrides: Optional[SWFClientConfig] = None,
    start_time_filter: Optional[
        "capo_swf.types.execution_time_filter.ExecutionTimeFilter"
    ] = None,
    close_time_filter: Optional[
        "capo_swf.types.execution_time_filter.ExecutionTimeFilter"
    ] = None,
    execution_filter: Optional[
        "capo_swf.types.workflow_execution_filter.WorkflowExecutionFilter"
    ] = None,
    type_filter: Optional[
        "capo_swf.types.workflow_type_filter.WorkflowTypeFilter"
    ] = None,
    tag_filter: Optional["capo_swf.types.tag_filter.TagFilter"] = None,
    close_status_filter: Optional[
        "capo_swf.types.close_status_filter.CloseStatusFilter"
    ] = None,
) -> "capo_swf.types.workflow_execution_count.WorkflowExecutionCount":
    """<p>Returns the number of closed workflow executions within the given domain that meet the specified filtering criteria.</p> <note> <p>This operation is eventually consistent. The results are best effort and may not exactly reflect recent updates and changes.</p> </note> <p> <b>Access Control</b> </p> <p>You can use IAM policies to control this action's access to Amazon SWF resources as follows:</p> <ul> <li> <p>Use a <code>Resource</code> element with the domain name to limit the action to only specified domains.</p> </li> <li> <p>Use an <code>Action</code> element to allow or deny permission to call this action.</p> </li> <li> <p>Constrain the following parameters by using a <code>Condition</code> element with the appropriate keys.</p> <ul> <li> <p> <code>tagFilter.tag</code>: String constraint. The key is <code>swf:tagFilter.tag</code>.</p> </li> <li> <p> <code>typeFilter.name</code>: String constraint. The key is <code>swf:typeFilter.name</code>.</p> </li> <li> <p> <code>typeFilter.version</code>: String constraint. The key is <code>swf:typeFilter.version</code>.</p> </li> </ul> </li> </ul> <p>If the caller doesn't have sufficient permissions to invoke the action, or the parameter values fall outside the specified constraints, the action fails. The associated event attribute's <code>cause</code> parameter is set to <code>OPERATION_NOT_PERMITTED</code>. For details and example IAM policies, see <a href="https://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dev-iam.html">Using IAM to Manage Access to Amazon SWF Workflows</a> in the <i>Amazon SWF Developer Guide</i>.</p>

    Args:
        domain: <p>The name of the domain containing the workflow executions to count.</p>
        start_time_filter: <p>If specified, only workflow executions that meet the start time criteria of the filter are counted.</p> <note> <p> <code>startTimeFilter</code> and <code>closeTimeFilter</code> are mutually exclusive. You must specify one of these in a request but not both.</p> </note>
        close_time_filter: <p>If specified, only workflow executions that meet the close time criteria of the filter are counted.</p> <note> <p> <code>startTimeFilter</code> and <code>closeTimeFilter</code> are mutually exclusive. You must specify one of these in a request but not both.</p> </note>
        execution_filter: <p>If specified, only workflow executions matching the <code>WorkflowId</code> in the filter are counted.</p> <note> <p> <code>closeStatusFilter</code>, <code>executionFilter</code>, <code>typeFilter</code> and <code>tagFilter</code> are mutually exclusive. You can specify at most one of these in a request.</p> </note>
        type_filter: <p>If specified, indicates the type of the workflow executions to be counted.</p> <note> <p> <code>closeStatusFilter</code>, <code>executionFilter</code>, <code>typeFilter</code> and <code>tagFilter</code> are mutually exclusive. You can specify at most one of these in a request.</p> </note>
        tag_filter: <p>If specified, only executions that have a tag that matches the filter are counted.</p> <note> <p> <code>closeStatusFilter</code>, <code>executionFilter</code>, <code>typeFilter</code> and <code>tagFilter</code> are mutually exclusive. You can specify at most one of these in a request.</p> </note>
        close_status_filter: <p>If specified, only workflow executions that match this close status are counted. This filter has an affect only if <code>executionStatus</code> is specified as <code>CLOSED</code>.</p> <note> <p> <code>closeStatusFilter</code>, <code>executionFilter</code>, <code>typeFilter</code> and <code>tagFilter</code> are mutually exclusive. You can specify at most one of these in a request.</p> </note>

    Raises:
        capo_swf.errors.operation_not_permitted_fault.OperationNotPermittedFault: <p>Returned when the caller doesn't have sufficient permissions to invoke the action.</p>
        capo_swf.errors.unknown_resource_fault.UnknownResourceFault: <p>Returned when the named resource cannot be found with in the scope of this operation (region or domain). This could happen if the named resource was never created or is no longer available for this operation.</p>
        capo_swf.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_swf.types.count_closed_workflow_executions_input.CountClosedWorkflowExecutionsInput]",
    ) -> OperationResponse[
        "capo_swf.types.workflow_execution_count.WorkflowExecutionCount"
    ]:
        import capo_swf._operations.simple_workflow_service.count_closed_workflow_executions

        output, http_response = (
            capo_swf._operations.simple_workflow_service.count_closed_workflow_executions.count_closed_workflow_executions(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CountClosedWorkflowExecutions")
    )
    input_: capo_swf.types.count_closed_workflow_executions_input.CountClosedWorkflowExecutionsInput = {
        "domain": domain
    }
    if start_time_filter is not None:
        input_["start_time_filter"] = start_time_filter
    if close_time_filter is not None:
        input_["close_time_filter"] = close_time_filter
    if execution_filter is not None:
        input_["execution_filter"] = execution_filter
    if type_filter is not None:
        input_["type_filter"] = type_filter
    if tag_filter is not None:
        input_["tag_filter"] = tag_filter
    if close_status_filter is not None:
        input_["close_status_filter"] = close_status_filter

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