Skip to content

create_project async

create_project(
    name: ProjectName,
    *,
    config_overrides: Optional[AsyncBedrockClientConfig] = None,
    tags: Optional[TagList] = None,
    data_retention: Optional[ProjectDataRetention] = None,
) -> CreateProjectResponse

Creates a project: a workload boundary within the account that inference requests can be associated with.

Parameters:

  • name (ProjectName) –

    The display name for the project. Project names do not have to be unique.

  • tags (Optional[TagList], default: None ) –

    The tags to associate with the project.

  • data_retention (Optional[ProjectDataRetention], default: None ) –

    The project's data-retention mode. If you omit this field, Amazon Bedrock sets the mode to inherit. The project then uses the account setting or the model default.

Raises:

  • AccessDeniedException –

    The request is denied because of missing access permissions.

  • ConflictException –

    Error occurred because of a conflict while performing an operation.

  • InternalServerException –

    An internal server error occurred. Retry your request.

  • ServiceQuotaExceededException –

    The number of requests exceeds the service quota. Resubmit your request later.

  • ThrottlingException –

    The number of requests exceeds the limit. Resubmit your request later.

  • TooManyTagsException –

    The request contains more tags than can be associated with a resource (50 tags per resource). The maximum number of tags includes both existing tags and those included in your current request.

  • ValidationException –

    Input validation failed. Check your request parameters and retry the request.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_bedrock/_services/async_bedrock.py
async def create_project(
    self,
    name: "capo_bedrock.types.project_name.ProjectName",
    *,
    config_overrides: Optional[AsyncBedrockClientConfig] = None,
    tags: Optional["capo_bedrock.types.tag_list.TagList"] = None,
    data_retention: Optional[
        "capo_bedrock.types.project_data_retention.ProjectDataRetention"
    ] = None,
) -> "capo_bedrock.types.create_project_response.CreateProjectResponse":
    """<p>Creates a project: a workload boundary within the account that inference requests can be associated with.</p>

    Args:
        name: <p>The display name for the project. Project names do not have to be unique.</p>
        tags: <p>The tags to associate with the project.</p>
        data_retention: <p>The project's data-retention mode. If you omit this field, Amazon Bedrock sets the mode to <code>inherit</code>. The project then uses the account setting or the model default.</p>

    Raises:
        capo_bedrock.errors.access_denied_exception.AccessDeniedException: <p>The request is denied because of missing access permissions.</p>
        capo_bedrock.errors.conflict_exception.ConflictException: <p>Error occurred because of a conflict while performing an operation.</p>
        capo_bedrock.errors.internal_server_exception.InternalServerException: <p>An internal server error occurred. Retry your request.</p>
        capo_bedrock.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The number of requests exceeds the service quota. Resubmit your request later.</p>
        capo_bedrock.errors.throttling_exception.ThrottlingException: <p>The number of requests exceeds the limit. Resubmit your request later.</p>
        capo_bedrock.errors.too_many_tags_exception.TooManyTagsException: <p>The request contains more tags than can be associated with a resource (50 tags per resource). The maximum number of tags includes both existing tags and those included in your current request. </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.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_bedrock.types.create_project_request.CreateProjectRequest]",
    ) -> AsyncOperationResponse[
        "capo_bedrock.types.create_project_response.CreateProjectResponse"
    ]:
        import capo_bedrock._operations.amazon_bedrock_control_plane_service.create_project

        (
            output,
            http_response,
        ) = await capo_bedrock._operations.amazon_bedrock_control_plane_service.create_project.async_create_project(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_bedrock.types.create_project_request.CreateProjectRequest",
    ) -> dict[str, Any]:
        import capo_bedrock.types.create_project_request

        return capo_bedrock.types.create_project_request.redact_sensitive(input_)

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

        return capo_bedrock.types.create_project_response.redact_sensitive(output)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "CreateProject",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_bedrock.types.create_project_request.CreateProjectRequest = {
        "name": name
    }
    if tags is not None:
        input_["tags"] = tags
    if data_retention is not None:
        input_["data_retention"] = data_retention

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