Skip to content

put_image_tag_mutability

put_image_tag_mutability(
    repository_name: RepositoryName,
    image_tag_mutability: ImageTagMutability,
    *,
    config_overrides: Optional[ECRClientConfig] = None,
    registry_id: Optional[RegistryId] = None,
    image_tag_mutability_exclusion_filters: Optional[
        ImageTagMutabilityExclusionFilters
    ] = None,
) -> PutImageTagMutabilityResponse

Updates the image tag mutability settings for the specified repository. For more information, see Image tag mutability in the Amazon Elastic Container Registry User Guide.

Parameters:

  • registry_id (Optional[RegistryId], default: None ) –

    The Amazon Web Services account ID associated with the registry that contains the repository in which to update the image tag mutability settings. If you do not specify a registry, the default registry is assumed.

  • repository_name (RepositoryName) –

    The name of the repository in which to update the image tag mutability settings.

  • image_tag_mutability (ImageTagMutability) –

    The tag mutability setting for the repository. If MUTABLE is specified, image tags can 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 image tag mutability setting being applied.

Raises:

  • InvalidParameterException –

    The specified parameter is invalid. Review the available parameters for the API request.

  • RepositoryNotFoundException –

    The specified repository could not be found. Check the spelling of the specified repository and ensure that you are performing operations on the correct registry.

  • ServerException –

    These errors are usually caused by a server-side issue.

  • UnknownServiceError –

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

Source code in docs_src/capo_ecr/_services/ecr.py
def put_image_tag_mutability(
    self,
    repository_name: "capo_ecr.types.repository_name.RepositoryName",
    image_tag_mutability: "capo_ecr.types.image_tag_mutability.ImageTagMutability",
    *,
    config_overrides: Optional[ECRClientConfig] = None,
    registry_id: Optional["capo_ecr.types.registry_id.RegistryId"] = None,
    image_tag_mutability_exclusion_filters: Optional[
        "capo_ecr.types.image_tag_mutability_exclusion_filters.ImageTagMutabilityExclusionFilters"
    ] = None,
) -> (
    "capo_ecr.types.put_image_tag_mutability_response.PutImageTagMutabilityResponse"
):
    """<p>Updates the image tag mutability settings for the specified repository. For more information, see <a href="https://docs.aws.amazon.com/AmazonECR/latest/userguide/image-tag-mutability.html">Image tag mutability</a> in the <i>Amazon Elastic Container Registry User Guide</i>.</p>

    Args:
        registry_id: <p>The Amazon Web Services account ID associated with the registry that contains the repository in which to update the image tag mutability settings. If you do not specify a registry, the default registry is assumed.</p>
        repository_name: <p>The name of the repository in which to update the image tag mutability settings.</p>
        image_tag_mutability: <p>The tag mutability setting for the repository. If <code>MUTABLE</code> is specified, image tags can 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 image tag mutability setting being applied.</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.repository_not_found_exception.RepositoryNotFoundException: <p>The specified repository could not be found. Check the spelling of the specified repository and ensure that you are performing operations on the correct registry.</p>
        capo_ecr.errors.server_exception.ServerException: <p>These errors are usually caused by a server-side issue.</p>
        capo_ecr.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_ecr.types.put_image_tag_mutability_request.PutImageTagMutabilityRequest]",
    ) -> OperationResponse[
        "capo_ecr.types.put_image_tag_mutability_response.PutImageTagMutabilityResponse"
    ]:
        import capo_ecr._operations.amazon_ec2_container_registry_v20150921.put_image_tag_mutability

        output, http_response = (
            capo_ecr._operations.amazon_ec2_container_registry_v20150921.put_image_tag_mutability.put_image_tag_mutability(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("PutImageTagMutability")
    )
    input_: capo_ecr.types.put_image_tag_mutability_request.PutImageTagMutabilityRequest = {
        "repository_name": repository_name,
        "image_tag_mutability": image_tag_mutability,
    }
    if registry_id is not None:
        input_["registry_id"] = registry_id
    if image_tag_mutability_exclusion_filters is not None:
        input_["image_tag_mutability_exclusion_filters"] = (
            image_tag_mutability_exclusion_filters
        )

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