Skip to content

create_code_repository async

create_code_repository(
    *,
    config_overrides: Optional[AsyncSageMakerClientConfig] = None,
    code_repository_name: Optional[EntityName] = None,
    git_config: Optional[GitConfig] = None,
    tags: Optional[TagList] = None,
) -> CreateCodeRepositoryOutput

Creates a Git repository as a resource in your SageMaker AI account. You can associate the repository with notebook instances so that you can use Git source control for the notebooks you create. The Git repository is a resource in your SageMaker AI account, so it can be associated with more than one notebook instance, and it persists independently from the lifecycle of any notebook instances it is associated with.

The repository can be hosted either in Amazon Web Services CodeCommit or in any other Git repository.

Parameters:

  • code_repository_name (Optional[EntityName], default: None ) –

    The name of the Git repository. The name must have 1 to 63 characters. Valid characters are a-z, A-Z, 0-9, and - (hyphen).

  • git_config (Optional[GitConfig], default: None ) –

    Specifies details about the repository, including the URL where the repository is located, the default branch, and credentials to use to access the repository.

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

    An array of key-value pairs. You can use tags to categorize your Amazon Web Services resources in different ways, for example, by purpose, owner, or environment. For more information, see Tagging Amazon Web Services Resources.

Raises:

Source code in docs_src/capo_sagemaker/_services/async_sage_maker.py
async def create_code_repository(
    self,
    *,
    config_overrides: Optional[AsyncSageMakerClientConfig] = None,
    code_repository_name: Optional[
        "capo_sagemaker.types.entity_name.EntityName"
    ] = None,
    git_config: Optional["capo_sagemaker.types.git_config.GitConfig"] = None,
    tags: Optional["capo_sagemaker.types.tag_list.TagList"] = None,
) -> (
    "capo_sagemaker.types.create_code_repository_output.CreateCodeRepositoryOutput"
):
    """<p>Creates a Git repository as a resource in your SageMaker AI account. You can associate the repository with notebook instances so that you can use Git source control for the notebooks you create. The Git repository is a resource in your SageMaker AI account, so it can be associated with more than one notebook instance, and it persists independently from the lifecycle of any notebook instances it is associated with.</p> <p>The repository can be hosted either in <a href="https://docs.aws.amazon.com/codecommit/latest/userguide/welcome.html">Amazon Web Services CodeCommit</a> or in any other Git repository.</p>

    Args:
        code_repository_name: <p>The name of the Git repository. The name must have 1 to 63 characters. Valid characters are a-z, A-Z, 0-9, and - (hyphen).</p>
        git_config: <p>Specifies details about the repository, including the URL where the repository is located, the default branch, and credentials to use to access the repository.</p>
        tags: <p>An array of key-value pairs. You can use tags to categorize your Amazon Web Services resources in different ways, for example, by purpose, owner, or environment. For more information, see <a href="https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html">Tagging Amazon Web Services Resources</a>.</p>

    Raises:
        capo_sagemaker.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_sagemaker.types.create_code_repository_input.CreateCodeRepositoryInput]",
    ) -> AsyncOperationResponse[
        "capo_sagemaker.types.create_code_repository_output.CreateCodeRepositoryOutput"
    ]:
        import capo_sagemaker._operations.sage_maker.create_code_repository

        (
            output,
            http_response,
        ) = await capo_sagemaker._operations.sage_maker.create_code_repository.async_create_code_repository(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateCodeRepository")
    )
    input_: capo_sagemaker.types.create_code_repository_input.CreateCodeRepositoryInput = {}
    if code_repository_name is not None:
        input_["code_repository_name"] = code_repository_name
    if git_config is not None:
        input_["git_config"] = git_config
    if tags is not None:
        input_["tags"] = tags

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