Skip to content

create_repository_creation_template async

create_repository_creation_template(
    prefix: Prefix,
    applied_for: RCTAppliedForList,
    *,
    config_overrides: Optional[AsyncECRClientConfig] = None,
    description: Optional[RepositoryTemplateDescription] = None,
    encryption_configuration: Optional[
        EncryptionConfigurationForRepositoryCreationTemplate
    ] = None,
    resource_tags: Optional[TagList] = None,
    image_tag_mutability: Optional[ImageTagMutability] = None,
    image_tag_mutability_exclusion_filters: Optional[
        ImageTagMutabilityExclusionFilters
    ] = None,
    repository_policy: Optional[RepositoryPolicyText] = None,
    lifecycle_policy: Optional[LifecyclePolicyTextForRepositoryCreationTemplate] = None,
    custom_role_arn: Optional[CustomRoleArn] = None,
) -> CreateRepositoryCreationTemplateResponse

Creates a repository creation template. This template is used to define the settings for repositories created by Amazon ECR on your behalf. For example, repositories created through pull through cache actions. For more information, see Private repository creation templates in the Amazon Elastic Container Registry User Guide.

Parameters:

  • prefix (Prefix) –

    The repository namespace prefix to associate with the template. All repositories created using this namespace prefix will have the settings defined in this template applied. For example, a prefix of prod would apply to all repositories beginning with prod/. Similarly, a prefix of prod/team would apply to all repositories beginning with prod/team/.

    To apply a template to all repositories in your registry that don't have an associated creation template, you can use ROOT as the prefix.

    There is always an assumed / applied to the end of the prefix. If you specify ecr-public as the prefix, Amazon ECR treats that as ecr-public/. When using a pull through cache rule, the repository prefix you specify during rule creation is what you should specify as your repository creation template prefix as well.

  • description (Optional[RepositoryTemplateDescription], default: None ) –

    A description for the repository creation template.

  • encryption_configuration (Optional[EncryptionConfigurationForRepositoryCreationTemplate], default: None ) –

    The encryption configuration to use for repositories created using the template.

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

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

  • image_tag_mutability (Optional[ImageTagMutability], default: None ) –

    The tag mutability setting for the repository. If this parameter is omitted, the default setting of MUTABLE will be used which will allow image tags to be overwritten. If IMMUTABLE is specified, all image tags within the repository will be immutable which will prevent them from being overwritten.

  • image_tag_mutability_exclusion_filters (Optional[ImageTagMutabilityExclusionFilters], default: None ) –

    A list of filters that specify which image tags should be excluded from the repository creation template's image tag mutability setting.

  • repository_policy (Optional[RepositoryPolicyText], default: None ) –

    The repository policy to apply to repositories created using the template. A repository policy is a permissions policy associated with a repository to control access permissions.

  • lifecycle_policy (Optional[LifecyclePolicyTextForRepositoryCreationTemplate], default: None ) –

    The lifecycle policy to use for repositories created using the template.

  • applied_for (RCTAppliedForList) –

    A list of enumerable strings representing the Amazon ECR repository creation scenarios that this template will apply towards. The supported scenarios are PULL_THROUGH_CACHE, REPLICATION, and CREATE_ON_PUSH

  • custom_role_arn (Optional[CustomRoleArn], default: None ) –

    The ARN of the role to be assumed by Amazon ECR. This role must be in the same account as the registry that you are configuring. Amazon ECR will assume your supplied role when the customRoleArn is specified. When this field isn't specified, Amazon ECR will use the service-linked role for the repository creation template.

Raises:

Source code in docs_src/capo_ecr/_services/async_ecr.py
async def create_repository_creation_template(
    self,
    prefix: "capo_ecr.types.prefix.Prefix",
    applied_for: "capo_ecr.types.rct_applied_for_list.RCTAppliedForList",
    *,
    config_overrides: Optional[AsyncECRClientConfig] = None,
    description: Optional[
        "capo_ecr.types.repository_template_description.RepositoryTemplateDescription"
    ] = None,
    encryption_configuration: Optional[
        "capo_ecr.types.encryption_configuration_for_repository_creation_template.EncryptionConfigurationForRepositoryCreationTemplate"
    ] = None,
    resource_tags: Optional["capo_ecr.types.tag_list.TagList"] = None,
    image_tag_mutability: Optional[
        "capo_ecr.types.image_tag_mutability.ImageTagMutability"
    ] = None,
    image_tag_mutability_exclusion_filters: Optional[
        "capo_ecr.types.image_tag_mutability_exclusion_filters.ImageTagMutabilityExclusionFilters"
    ] = None,
    repository_policy: Optional[
        "capo_ecr.types.repository_policy_text.RepositoryPolicyText"
    ] = None,
    lifecycle_policy: Optional[
        "capo_ecr.types.lifecycle_policy_text_for_repository_creation_template.LifecyclePolicyTextForRepositoryCreationTemplate"
    ] = None,
    custom_role_arn: Optional[
        "capo_ecr.types.custom_role_arn.CustomRoleArn"
    ] = None,
) -> "capo_ecr.types.create_repository_creation_template_response.CreateRepositoryCreationTemplateResponse":
    """<p>Creates a repository creation template. This template is used to define the settings for repositories created by Amazon ECR on your behalf. For example, repositories created through pull through cache actions. For more information, see <a href="https://docs.aws.amazon.com/AmazonECR/latest/userguide/repository-creation-templates.html">Private repository creation templates</a> in the <i>Amazon Elastic Container Registry User Guide</i>.</p>

    Args:
        prefix: <p>The repository namespace prefix to associate with the template. All repositories created using this namespace prefix will have the settings defined in this template applied. For example, a prefix of <code>prod</code> would apply to all repositories beginning with <code>prod/</code>. Similarly, a prefix of <code>prod/team</code> would apply to all repositories beginning with <code>prod/team/</code>.</p> <p>To apply a template to all repositories in your registry that don't have an associated creation template, you can use <code>ROOT</code> as the prefix.</p> <important> <p>There is always an assumed <code>/</code> applied to the end of the prefix. If you specify <code>ecr-public</code> as the prefix, Amazon ECR treats that as <code>ecr-public/</code>. When using a pull through cache rule, the repository prefix you specify during rule creation is what you should specify as your repository creation template prefix as well.</p> </important>
        description: <p>A description for the repository creation template.</p>
        encryption_configuration: <p>The encryption configuration to use for repositories created using the template.</p>
        resource_tags: <p>The metadata to apply to the repository to help you categorize and organize. Each tag consists of a key and an optional value, both of which you define. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters.</p>
        image_tag_mutability: <p>The tag mutability setting for the repository. If this parameter is omitted, the default setting of <code>MUTABLE</code> will be used which will allow image tags to be overwritten. If <code>IMMUTABLE</code> is specified, all image tags within the repository will be immutable which will prevent them from being overwritten.</p>
        image_tag_mutability_exclusion_filters: <p>A list of filters that specify which image tags should be excluded from the repository creation template's image tag mutability setting.</p>
        repository_policy: <p>The repository policy to apply to repositories created using the template. A repository policy is a permissions policy associated with a repository to control access permissions. </p>
        lifecycle_policy: <p>The lifecycle policy to use for repositories created using the template.</p>
        applied_for: <p>A list of enumerable strings representing the Amazon ECR repository creation scenarios that this template will apply towards. The supported scenarios are <code>PULL_THROUGH_CACHE</code>, <code>REPLICATION</code>, and <code>CREATE_ON_PUSH</code> </p>
        custom_role_arn: <p>The ARN of the role to be assumed by Amazon ECR. This role must be in the same account as the registry that you are configuring. Amazon ECR will assume your supplied role when the customRoleArn is specified. When this field isn't specified, Amazon ECR will use the service-linked role for the repository creation template.</p>

    Raises:
        capo_ecr.errors.invalid_parameter_exception.InvalidParameterException: <p>The specified parameter is invalid. Review the available parameters for the API request.</p>
        capo_ecr.errors.limit_exceeded_exception.LimitExceededException: <p>The operation did not 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.errors.server_exception.ServerException: <p>These errors are usually caused by a server-side issue.</p>
        capo_ecr.errors.template_already_exists_exception.TemplateAlreadyExistsException: <p>The repository creation template already exists. Specify a unique prefix and try again.</p>
        capo_ecr.errors.validation_exception.ValidationException: <p>There was an exception validating this request.</p>
        capo_ecr.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_ecr.types.create_repository_creation_template_request.CreateRepositoryCreationTemplateRequest]",
    ) -> AsyncOperationResponse[
        "capo_ecr.types.create_repository_creation_template_response.CreateRepositoryCreationTemplateResponse"
    ]:
        import capo_ecr._operations.amazon_ec2_container_registry_v20150921.create_repository_creation_template

        (
            output,
            http_response,
        ) = await capo_ecr._operations.amazon_ec2_container_registry_v20150921.create_repository_creation_template.async_create_repository_creation_template(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateRepositoryCreationTemplate")
    )
    input_: capo_ecr.types.create_repository_creation_template_request.CreateRepositoryCreationTemplateRequest = {
        "prefix": prefix,
        "applied_for": applied_for,
    }
    if description is not None:
        input_["description"] = description
    if encryption_configuration is not None:
        input_["encryption_configuration"] = encryption_configuration
    if resource_tags is not None:
        input_["resource_tags"] = resource_tags
    if image_tag_mutability is not None:
        input_["image_tag_mutability"] = image_tag_mutability
    if image_tag_mutability_exclusion_filters is not None:
        input_["image_tag_mutability_exclusion_filters"] = (
            image_tag_mutability_exclusion_filters
        )
    if repository_policy is not None:
        input_["repository_policy"] = repository_policy
    if lifecycle_policy is not None:
        input_["lifecycle_policy"] = lifecycle_policy
    if custom_role_arn is not None:
        input_["custom_role_arn"] = custom_role_arn

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