Skip to content

create_repository async

create_repository(
    repository_name: RepositoryName,
    *,
    config_overrides: Optional[AsyncECRPUBLICClientConfig] = None,
    catalog_data: Optional[RepositoryCatalogDataInput] = None,
    tags: Optional[TagList] = None,
) -> CreateRepositoryResponse

Creates a repository in a public registry. For more information, see Amazon ECR repositories in the Amazon Elastic Container Registry User Guide.

Parameters:

  • repository_name (RepositoryName) –

    The name to use for the repository. This appears publicly in the Amazon ECR Public Gallery. The repository name can be specified on its own (for example nginx-web-app) or prepended with a namespace to group the repository into a category (for example project-a/nginx-web-app).

  • catalog_data (Optional[RepositoryCatalogDataInput], default: None ) –

    The details about the repository that are publicly visible in the Amazon ECR Public Gallery.

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

    The metadata that you apply to each repository to help categorize and organize your repositories. Each tag consists of a key and an optional value. You define both of them. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters.

Raises:

Source code in docs_src/capo_ecr_public/_services/async_ecrpublic.py
async def create_repository(
    self,
    repository_name: "capo_ecr_public.types.repository_name.RepositoryName",
    *,
    config_overrides: Optional[AsyncECRPUBLICClientConfig] = None,
    catalog_data: Optional[
        "capo_ecr_public.types.repository_catalog_data_input.RepositoryCatalogDataInput"
    ] = None,
    tags: Optional["capo_ecr_public.types.tag_list.TagList"] = None,
) -> "capo_ecr_public.types.create_repository_response.CreateRepositoryResponse":
    """<p>Creates a repository in a public registry. For more information, see <a href="https://docs.aws.amazon.com/AmazonECR/latest/userguide/Repositories.html">Amazon ECR repositories</a> in the <i>Amazon Elastic Container Registry User Guide</i>.</p>

    Args:
        repository_name: <p>The name to use for the repository. This appears publicly in the Amazon ECR Public Gallery. The repository name can be specified on its own (for example <code>nginx-web-app</code>) or prepended with a namespace to group the repository into a category (for example <code>project-a/nginx-web-app</code>).</p>
        catalog_data: <p>The details about the repository that are publicly visible in the Amazon ECR Public Gallery.</p>
        tags: <p>The metadata that you apply to each repository to help categorize and organize your repositories. Each tag consists of a key and an optional value. You define both of them. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters.</p>

    Raises:
        capo_ecr_public.errors.invalid_parameter_exception.InvalidParameterException: <p>The specified parameter is invalid. Review the available parameters for the API request.</p>
        capo_ecr_public.errors.invalid_tag_parameter_exception.InvalidTagParameterException: <p>An invalid parameter has been specified. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters.</p>
        capo_ecr_public.errors.limit_exceeded_exception.LimitExceededException: <p>The operation didn't succeed because it would have exceeded a service limit for your account. For more information, see <a href="https://docs.aws.amazon.com/AmazonECR/latest/userguide/service-quotas.html">Amazon ECR Service Quotas</a> in the Amazon Elastic Container Registry User Guide.</p>
        capo_ecr_public.errors.repository_already_exists_exception.RepositoryAlreadyExistsException: <p>The specified repository already exists in the specified registry.</p>
        capo_ecr_public.errors.server_exception.ServerException: <p>These errors are usually caused by a server-side issue.</p>
        capo_ecr_public.errors.too_many_tags_exception.TooManyTagsException: <p>The list of tags on the repository is over the limit. The maximum number of tags that can be applied to a repository is 50.</p>
        capo_ecr_public.errors.unsupported_command_exception.UnsupportedCommandException: <p>The action isn't supported in this Region.</p>
        capo_ecr_public.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_ecr_public.types.create_repository_request.CreateRepositoryRequest]",
    ) -> AsyncOperationResponse[
        "capo_ecr_public.types.create_repository_response.CreateRepositoryResponse"
    ]:
        import capo_ecr_public._operations.spencer_frontend_service.create_repository

        (
            output,
            http_response,
        ) = await capo_ecr_public._operations.spencer_frontend_service.create_repository.async_create_repository(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateRepository")
    )
    input_: capo_ecr_public.types.create_repository_request.CreateRepositoryRequest = {
        "repository_name": repository_name
    }
    if catalog_data is not None:
        input_["catalog_data"] = catalog_data
    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