Skip to content

list_collections async

list_collections(
    *,
    config_overrides: Optional[AsyncRekognitionClientConfig] = None,
    next_token: Optional[PaginationToken] = None,
    max_results: Optional[PageSize] = None,
) -> ListCollectionsResponse

Returns list of collection IDs in your account. If the result is truncated, the response also provides a NextToken that you can use in the subsequent request to fetch the next set of collection IDs.

For an example, see Listing collections in the Amazon Rekognition Developer Guide.

This operation requires permissions to perform the rekognition:ListCollections action.

Parameters:

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

    Pagination token from the previous response.

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

    Maximum number of collection IDs to return.

Raises:

Examples:

To list the collections This operation returns a list of Rekognition collections.

>>> await client.list_collections()
Source code in docs_src/capo_rekognition/_services/async_rekognition.py
async def list_collections(
    self,
    *,
    config_overrides: Optional[AsyncRekognitionClientConfig] = None,
    next_token: Optional[
        "capo_rekognition.types.pagination_token.PaginationToken"
    ] = None,
    max_results: Optional["capo_rekognition.types.page_size.PageSize"] = None,
) -> "capo_rekognition.types.list_collections_response.ListCollectionsResponse":
    """<p>Returns list of collection IDs in your account. If the result is truncated, the response also provides a <code>NextToken</code> that you can use in the subsequent request to fetch the next set of collection IDs.</p> <p>For an example, see Listing collections in the Amazon Rekognition Developer Guide.</p> <p>This operation requires permissions to perform the <code>rekognition:ListCollections</code> action.</p>

    Args:
        next_token: <p>Pagination token from the previous response.</p>
        max_results: <p>Maximum number of collection IDs to return. </p>

    Raises:
        capo_rekognition.errors.access_denied_exception.AccessDeniedException: <p>You are not authorized to perform the action.</p>
        capo_rekognition.errors.internal_server_error.InternalServerError: <p>Amazon Rekognition experienced a service issue. Try your call again.</p>
        capo_rekognition.errors.invalid_pagination_token_exception.InvalidPaginationTokenException: <p>Pagination token in the request is not valid.</p>
        capo_rekognition.errors.invalid_parameter_exception.InvalidParameterException: <p>Input parameter violated a constraint. Validate your parameter before calling the API operation again.</p>
        capo_rekognition.errors.provisioned_throughput_exceeded_exception.ProvisionedThroughputExceededException: <p>The number of requests exceeded your throughput limit. If you want to increase this limit, contact Amazon Rekognition.</p>
        capo_rekognition.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource specified in the request cannot be found.</p>
        capo_rekognition.errors.throttling_exception.ThrottlingException: <p>Amazon Rekognition is temporarily unable to process the request. Try your call again.</p>
        capo_rekognition.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To list the collections
        This operation returns a list of Rekognition collections.

        >>> await client.list_collections()
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_rekognition.types.list_collections_request.ListCollectionsRequest]",
    ) -> AsyncOperationResponse[
        "capo_rekognition.types.list_collections_response.ListCollectionsResponse"
    ]:
        import capo_rekognition._operations.rekognition_service.list_collections

        (
            output,
            http_response,
        ) = await capo_rekognition._operations.rekognition_service.list_collections.async_list_collections(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListCollections")
    )
    input_: capo_rekognition.types.list_collections_request.ListCollectionsRequest = {}
    if next_token is not None:
        input_["next_token"] = next_token
    if max_results is not None:
        input_["max_results"] = max_results

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output