Skip to content

list_experiments

list_experiments(
    *,
    config_overrides: Optional[CloudWatchOmniClientConfig] = None,
    max_results: Optional[int] = None,
    next_token: Optional[NextToken] = None,
    experiment_type: Optional[ExperimentType] = None,
    target_service_name: Optional[str] = None,
    created_after: Optional[datetime] = None,
    created_before: Optional[datetime] = None,
) -> ListExperimentsOutput

Lists the experiments in the caller's account. Returns a summary for each experiment, newest first. Results can be filtered by experiment type, target service name, and creation time. An experiment is returned only when it matches every specified filter. Use GetExperiment to retrieve a single experiment's full detail. To find experiments by tag, use the Resource Groups Tagging API.

Parameters:

  • max_results (Optional[int], default: None ) –

    The maximum number of experiments to return in one page, from 1 to 100. Defaults to 50.

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

    A token to retrieve the next page of results.

  • experiment_type (Optional[ExperimentType], default: None ) –

    Filter by experiment type.

  • target_service_name (Optional[str], default: None ) –

    Filter by target service name.

  • created_after (Optional[datetime], default: None ) –

    Returns only experiments created after this time.

  • created_before (Optional[datetime], default: None ) –

    Returns only experiments created before this time.

Raises:

Examples:

List DATASET experiments The following example lists the DATASET experiments. One experiment matches, and there are no more pages. Payloads are shown as JSON; on the wire they are CBOR-encoded.

>>> client.list_experiments(max_results=10, experiment_type='DATASET')
Source code in docs_src/capo_cloudwatchomni/_services/cloud_watch_omni.py
def list_experiments(
    self,
    *,
    config_overrides: Optional[CloudWatchOmniClientConfig] = None,
    max_results: Optional[int] = None,
    next_token: Optional["capo_cloudwatchomni.types.next_token.NextToken"] = None,
    experiment_type: Optional[
        "capo_cloudwatchomni.types.experiment_type.ExperimentType"
    ] = None,
    target_service_name: Optional[str] = None,
    created_after: Optional[datetime.datetime] = None,
    created_before: Optional[datetime.datetime] = None,
) -> "capo_cloudwatchomni.types.list_experiments_output.ListExperimentsOutput":
    """Lists the experiments in the caller's account. Returns a summary for each experiment, newest first. Results can be filtered by experiment type, target service name, and creation time. An experiment is returned only when it matches every specified filter. Use GetExperiment to retrieve a single experiment's full detail. To find experiments by tag, use the Resource Groups Tagging API.

    Args:
        max_results: The maximum number of experiments to return in one page, from 1 to 100. Defaults to 50.
        next_token: A token to retrieve the next page of results.
        experiment_type: Filter by experiment type.
        target_service_name: Filter by target service name.
        created_after: Returns only experiments created after this time.
        created_before: Returns only experiments created before this time.

    Raises:
        capo_cloudwatchomni.errors.access_denied_exception.AccessDeniedException: The caller is not authorized to perform this action.
        capo_cloudwatchomni.errors.internal_server_exception.InternalServerException: An unexpected error occurred while processing the request.
        capo_cloudwatchomni.errors.throttling_exception.ThrottlingException: The request was throttled due to exceeding the allowed request rate.
        capo_cloudwatchomni.errors.validation_exception.ValidationException: A parameter is specified incorrectly.
        capo_cloudwatchomni.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        List DATASET experiments
        The following example lists the DATASET experiments. One experiment matches, and there are no more pages. Payloads are shown as JSON; on the wire they are CBOR-encoded.

        >>> client.list_experiments(max_results=10, experiment_type='DATASET')
    """

    def _handler(
        req: "OperationRequest[capo_cloudwatchomni.types.list_experiments_input.ListExperimentsInput]",
    ) -> OperationResponse[
        "capo_cloudwatchomni.types.list_experiments_output.ListExperimentsOutput"
    ]:
        import capo_cloudwatchomni._operations.cloud_watch_omni_frontend.list_experiments

        output, http_response = (
            capo_cloudwatchomni._operations.cloud_watch_omni_frontend.list_experiments.list_experiments(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_output(
        output: "capo_cloudwatchomni.types.list_experiments_output.ListExperimentsOutput",
    ) -> dict[str, Any]:
        import capo_cloudwatchomni.types.list_experiments_output

        return capo_cloudwatchomni.types.list_experiments_output.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("ListExperiments", redact_output=_redact_output),
    )
    input_: capo_cloudwatchomni.types.list_experiments_input.ListExperimentsInput = {}
    if max_results is not None:
        input_["max_results"] = max_results
    if next_token is not None:
        input_["next_token"] = next_token
    if experiment_type is not None:
        input_["experiment_type"] = experiment_type
    if target_service_name is not None:
        input_["target_service_name"] = target_service_name
    if created_after is not None:
        input_["created_after"] = created_after
    if created_before is not None:
        input_["created_before"] = created_before

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