Skip to content

create_source_repository

create_source_repository(
    space_name: NameString,
    project_name: NameString,
    name: SourceRepositoryNameString,
    *,
    config_overrides: Optional[CodeCatalystClientConfig] = None,
    description: Optional[SourceRepositoryDescriptionString] = None,
) -> CreateSourceRepositoryResponse

Creates an empty Git-based source repository in a specified project. The repository is created with an initial empty commit with a default branch named main.

Parameters:

Raises:

  • AccessDeniedException –

    The request was denied because you don't have sufficient access to perform this action. Verify that you are a member of a role that allows this action.

  • ConflictException –

    The request was denied because the requested operation would cause a conflict with the current state of a service resource associated with the request. Another user might have updated the resource. Reload, make sure you have the latest data, and then try again.

  • ResourceNotFoundException –

    The request was denied because the specified resource was not found. Verify that the spelling is correct and that you have access to the resource.

  • ServiceQuotaExceededException –

    The request was denied because one or more resources has reached its limits for the tier the space belongs to. Either reduce the number of resources, or change the tier if applicable.

  • ThrottlingException –

    The request was denied due to request throttling.

  • ValidationException –

    The request was denied because an input failed to satisfy the constraints specified by the service. Check the spelling and input requirements, and then try again.

  • UnknownServiceError –

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

Source code in docs_src/capo_codecatalyst/_services/code_catalyst.py
def create_source_repository(
    self,
    space_name: "capo_codecatalyst.types.name_string.NameString",
    project_name: "capo_codecatalyst.types.name_string.NameString",
    name: "capo_codecatalyst.types.source_repository_name_string.SourceRepositoryNameString",
    *,
    config_overrides: Optional[CodeCatalystClientConfig] = None,
    description: Optional[
        "capo_codecatalyst.types.source_repository_description_string.SourceRepositoryDescriptionString"
    ] = None,
) -> "capo_codecatalyst.types.create_source_repository_response.CreateSourceRepositoryResponse":
    """<p>Creates an empty Git-based source repository in a specified project. The repository is created with an initial empty commit with a default branch named <code>main</code>.</p>

    Args:
        space_name: <p>The name of the space.</p>
        project_name: <p>The name of the project in the space.</p>
        name: <p>The name of the source repository. For more information about name requirements, see <a href="https://docs.aws.amazon.com/codecatalyst/latest/userguide/source-quotas.html">Quotas for source repositories</a>.</p>
        description: <p>The description of the source repository.</p>

    Raises:
        capo_codecatalyst.errors.access_denied_exception.AccessDeniedException: <p>The request was denied because you don't have sufficient access to perform this action. Verify that you are a member of a role that allows this action.</p>
        capo_codecatalyst.errors.conflict_exception.ConflictException: <p>The request was denied because the requested operation would cause a conflict with the current state of a service resource associated with the request. Another user might have updated the resource. Reload, make sure you have the latest data, and then try again.</p>
        capo_codecatalyst.errors.resource_not_found_exception.ResourceNotFoundException: <p>The request was denied because the specified resource was not found. Verify that the spelling is correct and that you have access to the resource.</p>
        capo_codecatalyst.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The request was denied because one or more resources has reached its limits for the tier the space belongs to. Either reduce the number of resources, or change the tier if applicable.</p>
        capo_codecatalyst.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
        capo_codecatalyst.errors.validation_exception.ValidationException: <p>The request was denied because an input failed to satisfy the constraints specified by the service. Check the spelling and input requirements, and then try again.</p>
        capo_codecatalyst.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_codecatalyst.types.create_source_repository_request.CreateSourceRepositoryRequest]",
    ) -> OperationResponse[
        "capo_codecatalyst.types.create_source_repository_response.CreateSourceRepositoryResponse"
    ]:
        import capo_codecatalyst._operations.code_catalyst.create_source_repository

        output, http_response = (
            capo_codecatalyst._operations.code_catalyst.create_source_repository.create_source_repository(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateSourceRepository")
    )
    input_: capo_codecatalyst.types.create_source_repository_request.CreateSourceRepositoryRequest = {
        "space_name": space_name,
        "project_name": project_name,
        "name": name,
    }
    if description is not None:
        input_["description"] = description

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