Skip to content

create_repository

create_repository(
    repository_name: RepositoryName,
    *,
    config_overrides: Optional[CodeCommitClientConfig] = None,
    repository_description: Optional[RepositoryDescription] = None,
    tags: Optional[TagsMap] = None,
    kms_key_id: Optional[KmsKeyId] = None,
) -> CreateRepositoryOutput

Creates a new, empty repository.

Parameters:

  • repository_name (RepositoryName) –

    The name of the new repository to be created.

    The repository name must be unique across the calling Amazon Web Services account. Repository names are limited to 100 alphanumeric, dash, and underscore characters, and cannot include certain characters. For more information about the limits on repository names, see Quotas in the CodeCommit User Guide. The suffix .git is prohibited.

  • repository_description (Optional[RepositoryDescription], default: None ) –

    A comment or description about the new repository.

    The description field for a repository accepts all HTML characters and all valid Unicode characters. Applications that do not HTML-encode the description and display it in a webpage can expose users to potentially malicious code. Make sure that you HTML-encode the description field in any application that uses this API to display the repository description on a webpage.

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

    One or more tag key-value pairs to use when tagging this repository.

  • kms_key_id (Optional[KmsKeyId], default: None ) –

    The ID of the encryption key. You can view the ID of an encryption key in the KMS console, or use the KMS APIs to programmatically retrieve a key ID. For more information about acceptable values for kmsKeyID, see KeyId in the Decrypt API description in the Key Management Service API Reference.

    If no key is specified, the default aws/codecommit Amazon Web Services managed key is used.

Raises:

Source code in docs_src/capo_codecommit/_services/code_commit.py
def create_repository(
    self,
    repository_name: "capo_codecommit.types.repository_name.RepositoryName",
    *,
    config_overrides: Optional[CodeCommitClientConfig] = None,
    repository_description: Optional[
        "capo_codecommit.types.repository_description.RepositoryDescription"
    ] = None,
    tags: Optional["capo_codecommit.types.tags_map.TagsMap"] = None,
    kms_key_id: Optional["capo_codecommit.types.kms_key_id.KmsKeyId"] = None,
) -> "capo_codecommit.types.create_repository_output.CreateRepositoryOutput":
    """<p>Creates a new, empty repository.</p>

    Args:
        repository_name: <p>The name of the new repository to be created.</p> <note> <p>The repository name must be unique across the calling Amazon Web Services account. Repository names are limited to 100 alphanumeric, dash, and underscore characters, and cannot include certain characters. For more information about the limits on repository names, see <a href="https://docs.aws.amazon.com/codecommit/latest/userguide/limits.html">Quotas</a> in the <i>CodeCommit User Guide</i>. The suffix .git is prohibited.</p> </note>
        repository_description: <p>A comment or description about the new repository.</p> <note> <p>The description field for a repository accepts all HTML characters and all valid Unicode characters. Applications that do not HTML-encode the description and display it in a webpage can expose users to potentially malicious code. Make sure that you HTML-encode the description field in any application that uses this API to display the repository description on a webpage.</p> </note>
        tags: <p>One or more tag key-value pairs to use when tagging this repository.</p>
        kms_key_id: <p>The ID of the encryption key. You can view the ID of an encryption key in the KMS console, or use the KMS APIs to programmatically retrieve a key ID. For more information about acceptable values for kmsKeyID, see <a href="https://docs.aws.amazon.com/kms/latest/APIReference/API_Decrypt.html#KMS-Decrypt-request-KeyId">KeyId</a> in the Decrypt API description in the <i>Key Management Service API Reference</i>.</p> <p>If no key is specified, the default <code>aws/codecommit</code> Amazon Web Services managed key is used.</p>

    Raises:
        capo_codecommit.errors.encryption_integrity_checks_failed_exception.EncryptionIntegrityChecksFailedException: <p>An encryption integrity check failed.</p>
        capo_codecommit.errors.encryption_key_access_denied_exception.EncryptionKeyAccessDeniedException: <p>An encryption key could not be accessed.</p>
        capo_codecommit.errors.encryption_key_disabled_exception.EncryptionKeyDisabledException: <p>The encryption key is disabled.</p>
        capo_codecommit.errors.encryption_key_invalid_id_exception.EncryptionKeyInvalidIdException: <p>The Key Management Service encryption key is not valid.</p>
        capo_codecommit.errors.encryption_key_invalid_usage_exception.EncryptionKeyInvalidUsageException: <p>A KMS encryption key was used to try and encrypt or decrypt a repository, but either the repository or the key was not in a valid state to support the operation.</p>
        capo_codecommit.errors.encryption_key_not_found_exception.EncryptionKeyNotFoundException: <p>No encryption key was found.</p>
        capo_codecommit.errors.encryption_key_unavailable_exception.EncryptionKeyUnavailableException: <p>The encryption key is not available.</p>
        capo_codecommit.errors.invalid_repository_description_exception.InvalidRepositoryDescriptionException: <p>The specified repository description is not valid.</p>
        capo_codecommit.errors.invalid_repository_name_exception.InvalidRepositoryNameException: <p>A specified repository name is not valid.</p> <note> <p>This exception occurs only when a specified repository name is not valid. Other exceptions occur when a required repository parameter is missing, or when a specified repository does not exist.</p> </note>
        capo_codecommit.errors.invalid_system_tag_usage_exception.InvalidSystemTagUsageException: <p>The specified tag is not valid. Key names cannot be prefixed with aws:.</p>
        capo_codecommit.errors.invalid_tags_map_exception.InvalidTagsMapException: <p>The map of tags is not valid.</p>
        capo_codecommit.errors.operation_not_allowed_exception.OperationNotAllowedException: <p>The requested action is not allowed.</p>
        capo_codecommit.errors.repository_limit_exceeded_exception.RepositoryLimitExceededException: <p>A repository resource limit was exceeded.</p>
        capo_codecommit.errors.repository_name_exists_exception.RepositoryNameExistsException: <p>The specified repository name already exists.</p>
        capo_codecommit.errors.repository_name_required_exception.RepositoryNameRequiredException: <p>A repository name is required, but was not specified.</p>
        capo_codecommit.errors.tag_policy_exception.TagPolicyException: <p>The tag policy is not valid.</p>
        capo_codecommit.errors.too_many_tags_exception.TooManyTagsException: <p>The maximum number of tags for an CodeCommit resource has been exceeded.</p>
        capo_codecommit.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_codecommit.types.create_repository_input.CreateRepositoryInput]",
    ) -> OperationResponse[
        "capo_codecommit.types.create_repository_output.CreateRepositoryOutput"
    ]:
        import capo_codecommit._operations.code_commit_20150413.create_repository

        output, http_response = (
            capo_codecommit._operations.code_commit_20150413.create_repository.create_repository(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateRepository")
    )
    input_: capo_codecommit.types.create_repository_input.CreateRepositoryInput = {
        "repository_name": repository_name
    }
    if repository_description is not None:
        input_["repository_description"] = repository_description
    if tags is not None:
        input_["tags"] = tags
    if kms_key_id is not None:
        input_["kms_key_id"] = kms_key_id

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