Skip to content

list_scrapers

list_scrapers(
    *,
    config_overrides: Optional[ampClientConfig] = None,
    filters: Optional[ScraperFilters] = None,
    next_token: Optional[PaginationToken] = None,
    max_results: Optional[int] = None,
) -> ListScrapersResponse

The ListScrapers operation lists all of the scrapers in your account. This includes scrapers being created or deleted. You can optionally filter the returned list.

Parameters:

  • filters (Optional[ScraperFilters], default: None ) –

    (Optional) A list of key-value pairs to filter the list of scrapers returned. Keys include status, sourceArn, destinationArn, and alias.

    Filters on the same key are OR'd together, and filters on different keys are AND'd together. For example, status=ACTIVE&status=CREATING&alias=Test, will return all scrapers that have the alias Test, and are either in status ACTIVE or CREATING.

    To find all active scrapers that are sending metrics to a specific Amazon Managed Service for Prometheus workspace, you would use the ARN of the workspace in a query:

    status=ACTIVE&destinationArn=arn:aws:aps:us-east-1:123456789012:workspace/ws-example1-1234-abcd-56ef-123456789012

    If this is included, it filters the results to only the scrapers that match the filter.

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

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

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

    Optional) The maximum number of scrapers to return in one ListScrapers operation. The range is 1-1000.

    If you omit this parameter, the default of 100 is used.

Raises:

Examples:

ListScrapers, with a max result of 2, using a pagination token from a previous call to ListScrapers

>>> client.list_scrapers(max_results=2, next_token='previouslyGeneratedToken')
ListScrapers, with filters
>>> client.list_scrapers(filters={'status': ['ACTIVE'], 'sourceArn': ['arn:aws:eks:us-west-2:123456789012:cluster/example1'], 'alias': ['alias1']})
Source code in docs_src/capo_amp/_services/amp.py
def list_scrapers(
    self,
    *,
    config_overrides: Optional[ampClientConfig] = None,
    filters: Optional["capo_amp.types.scraper_filters.ScraperFilters"] = None,
    next_token: Optional["capo_amp.types.pagination_token.PaginationToken"] = None,
    max_results: Optional[int] = None,
) -> "capo_amp.types.list_scrapers_response.ListScrapersResponse":
    """<p>The <code>ListScrapers</code> operation lists all of the scrapers in your account. This includes scrapers being created or deleted. You can optionally filter the returned list.</p>

    Args:
        filters: <p>(Optional) A list of key-value pairs to filter the list of scrapers returned. Keys include <code>status</code>, <code>sourceArn</code>, <code>destinationArn</code>, and <code>alias</code>.</p> <p>Filters on the same key are <code>OR</code>'d together, and filters on different keys are <code>AND</code>'d together. For example, <code>status=ACTIVE&amp;status=CREATING&amp;alias=Test</code>, will return all scrapers that have the alias Test, and are either in status ACTIVE or CREATING.</p> <p>To find all active scrapers that are sending metrics to a specific Amazon Managed Service for Prometheus workspace, you would use the ARN of the workspace in a query:</p> <p> <code>status=ACTIVE&amp;destinationArn=arn:aws:aps:us-east-1:123456789012:workspace/ws-example1-1234-abcd-56ef-123456789012</code> </p> <p>If this is included, it filters the results to only the scrapers that match the filter.</p>
        next_token: <p>(Optional) The token for the next set of items to return. (You received this token from a previous call.)</p>
        max_results: <p>Optional) The maximum number of scrapers to return in one <code>ListScrapers</code> operation. The range is 1-1000.</p> <p>If you omit this parameter, the default of 100 is used.</p>

    Raises:
        capo_amp.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_amp.errors.internal_server_exception.InternalServerException: <p>An unexpected error occurred during the processing of the request.</p>
        capo_amp.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
        capo_amp.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints specified by an Amazon Web Services service.</p>
        capo_amp.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        ListScrapers, with a max result of 2, using a pagination token from a previous call to ListScrapers

        >>> client.list_scrapers(max_results=2, next_token='previouslyGeneratedToken')
        ListScrapers, with filters

        >>> client.list_scrapers(filters={'status': ['ACTIVE'], 'sourceArn': ['arn:aws:eks:us-west-2:123456789012:cluster/example1'], 'alias': ['alias1']})
    """

    def _handler(
        req: "OperationRequest[capo_amp.types.list_scrapers_request.ListScrapersRequest]",
    ) -> OperationResponse[
        "capo_amp.types.list_scrapers_response.ListScrapersResponse"
    ]:
        import capo_amp._operations.amazon_prometheus_service.list_scrapers

        output, http_response = (
            capo_amp._operations.amazon_prometheus_service.list_scrapers.list_scrapers(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListScrapers")
    )
    input_: capo_amp.types.list_scrapers_request.ListScrapersRequest = {}
    if filters is not None:
        input_["filters"] = filters
    if next_token is not None:
        input_["next_token"] = next_token
    if max_results is not None:
        input_["max_results"] = max_results

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