Skip to content

list_projects

list_projects(
    *,
    config_overrides: Optional[BedrockClientConfig] = None,
    next_token: Optional[PaginationToken] = None,
    max_results: Optional[ProjectMaxResults] = None,
    status_filter: Optional[ProjectStatus] = None,
) -> ListProjectsResponse

Lists the account's projects. Results are paginated: when the response includes nextToken, pass it in the next request to fetch the following page. Page size is 1-100, default 20. By default every project is returned regardless of status; set statusFilter to list only active or only archived projects.

Parameters:

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

    Continuation token from a previous ListProjects response.

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

    The maximum number of projects to return in one response, from 1 to 100. The default is 20.

  • status_filter (Optional[ProjectStatus], default: None ) –

    Returns only the projects in this lifecycle status. When absent, no status filtering is applied and every project is returned. New lifecycle states extend the ProjectStatus enum, and with it this filter, compatibly.

Raises:

Source code in docs_src/capo_bedrock/_services/bedrock.py
def list_projects(
    self,
    *,
    config_overrides: Optional[BedrockClientConfig] = None,
    next_token: Optional[
        "capo_bedrock.types.pagination_token.PaginationToken"
    ] = None,
    max_results: Optional[
        "capo_bedrock.types.project_max_results.ProjectMaxResults"
    ] = None,
    status_filter: Optional[
        "capo_bedrock.types.project_status.ProjectStatus"
    ] = None,
) -> "capo_bedrock.types.list_projects_response.ListProjectsResponse":
    """<p>Lists the account's projects. Results are paginated: when the response includes <code>nextToken</code>, pass it in the next request to fetch the following page. Page size is 1-100, default 20. By default every project is returned regardless of status; set <code>statusFilter</code> to list only active or only archived projects.</p>

    Args:
        next_token: <p>Continuation token from a previous ListProjects response.</p>
        max_results: <p>The maximum number of projects to return in one response, from 1 to 100. The default is 20.</p>
        status_filter: <p>Returns only the projects in this lifecycle status. When absent, no status filtering is applied and every project is returned. New lifecycle states extend the <code>ProjectStatus</code> enum, and with it this filter, compatibly.</p>

    Raises:
        capo_bedrock.errors.access_denied_exception.AccessDeniedException: <p>The request is denied because of missing access permissions.</p>
        capo_bedrock.errors.internal_server_exception.InternalServerException: <p>An internal server error occurred. Retry your request.</p>
        capo_bedrock.errors.throttling_exception.ThrottlingException: <p>The number of requests exceeds the limit. Resubmit your request later.</p>
        capo_bedrock.errors.validation_exception.ValidationException: <p>Input validation failed. Check your request parameters and retry the request.</p>
        capo_bedrock.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_bedrock.types.list_projects_request.ListProjectsRequest]",
    ) -> OperationResponse[
        "capo_bedrock.types.list_projects_response.ListProjectsResponse"
    ]:
        import capo_bedrock._operations.amazon_bedrock_control_plane_service.list_projects

        output, http_response = (
            capo_bedrock._operations.amazon_bedrock_control_plane_service.list_projects.list_projects(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_output(
        output: "capo_bedrock.types.list_projects_response.ListProjectsResponse",
    ) -> dict[str, Any]:
        import capo_bedrock.types.list_projects_response

        return capo_bedrock.types.list_projects_response.redact_sensitive(output)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("ListProjects", redact_output=_redact_output),
    )
    input_: capo_bedrock.types.list_projects_request.ListProjectsRequest = {}
    if next_token is not None:
        input_["next_token"] = next_token
    if max_results is not None:
        input_["max_results"] = max_results
    if status_filter is not None:
        input_["status_filter"] = status_filter

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