Skip to content

list_project_policies async

list_project_policies(
    project_arn: ProjectArn,
    *,
    config_overrides: Optional[AsyncRekognitionClientConfig] = None,
    next_token: Optional[ExtendedPaginationToken] = None,
    max_results: Optional[ListProjectPoliciesPageSize] = None,
) -> ListProjectPoliciesResponse

This operation applies only to Amazon Rekognition Custom Labels.

Gets a list of the project policies attached to a project.

To attach a project policy to a project, call PutProjectPolicy. To remove a project policy from a project, call DeleteProjectPolicy.

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

Parameters:

  • project_arn (ProjectArn) –

    The ARN of the project for which you want to list the project policies.

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

    If the previous response was incomplete (because there is more results to retrieve), Amazon Rekognition Custom Labels returns a pagination token in the response. You can use this pagination token to retrieve the next set of results.

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

    The maximum number of results to return per paginated call. The largest value you can specify is 5. If you specify a value greater than 5, a ValidationException error occurs. The default value is 5.

Raises:

Source code in docs_src/capo_rekognition/_services/async_rekognition.py
async def list_project_policies(
    self,
    project_arn: "capo_rekognition.types.project_arn.ProjectArn",
    *,
    config_overrides: Optional[AsyncRekognitionClientConfig] = None,
    next_token: Optional[
        "capo_rekognition.types.extended_pagination_token.ExtendedPaginationToken"
    ] = None,
    max_results: Optional[
        "capo_rekognition.types.list_project_policies_page_size.ListProjectPoliciesPageSize"
    ] = None,
) -> "capo_rekognition.types.list_project_policies_response.ListProjectPoliciesResponse":
    """<note> <p>This operation applies only to Amazon Rekognition Custom Labels.</p> </note> <p>Gets a list of the project policies attached to a project.</p> <p>To attach a project policy to a project, call <a>PutProjectPolicy</a>. To remove a project policy from a project, call <a>DeleteProjectPolicy</a>.</p> <p>This operation requires permissions to perform the <code>rekognition:ListProjectPolicies</code> action.</p>

    Args:
        project_arn: <p>The ARN of the project for which you want to list the project policies.</p>
        next_token: <p>If the previous response was incomplete (because there is more results to retrieve), Amazon Rekognition Custom Labels returns a pagination token in the response. You can use this pagination token to retrieve the next set of results. </p>
        max_results: <p>The maximum number of results to return per paginated call. The largest value you can specify is 5. If you specify a value greater than 5, a ValidationException error occurs. The default value is 5. </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.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_rekognition.types.list_project_policies_request.ListProjectPoliciesRequest]",
    ) -> AsyncOperationResponse[
        "capo_rekognition.types.list_project_policies_response.ListProjectPoliciesResponse"
    ]:
        import capo_rekognition._operations.rekognition_service.list_project_policies

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListProjectPolicies")
    )
    input_: capo_rekognition.types.list_project_policies_request.ListProjectPoliciesRequest = {
        "project_arn": project_arn
    }
    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