Skip to content

update_pull_through_cache_rule

update_pull_through_cache_rule(
    ecr_repository_prefix: PullThroughCacheRuleRepositoryPrefix,
    *,
    config_overrides: Optional[ECRClientConfig] = None,
    registry_id: Optional[RegistryId] = None,
    credential_arn: Optional[CredentialArn] = None,
    custom_role_arn: Optional[CustomRoleArn] = None,
    upstream_role_arn: Optional[CustomRoleArn] = None,
) -> UpdatePullThroughCacheRuleResponse

Updates an existing pull through cache rule.

Parameters:

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

    The Amazon Web Services account ID associated with the registry associated with the pull through cache rule. If you do not specify a registry, the default registry is assumed.

  • ecr_repository_prefix (PullThroughCacheRuleRepositoryPrefix) –

    The repository name prefix to use when caching images from the source registry.

  • credential_arn (Optional[CredentialArn], default: None ) –

    The Amazon Resource Name (ARN) of the Amazon Web Services Secrets Manager secret that identifies the credentials to authenticate to the upstream registry. You can't use this parameter with the Amazon ECR Public Premium upstream registry.

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

    The Amazon Resource Name (ARN) of the IAM role that Amazon ECR assumes to authenticate to the upstream registry. This role must be in the same account as the registry that you are configuring.

    For an Amazon ECR Public Premium upstream registry, specify this role together with upstreamRoleArn. If you specify neither role, Amazon ECR uses its service-linked role.

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

    The Amazon Resource Name (ARN) of the IAM role in the aws partition that Amazon ECR assumes through customRoleArn to authenticate to the Amazon ECR Public Premium upstream registry. You can use this parameter only for the Amazon ECR Public Premium upstream registry, and it requires customRoleArn. If you omit both customRoleArn and upstreamRoleArn, Amazon ECR uses its service-linked role.

Raises:

Source code in docs_src/capo_ecr/_services/ecr.py
def update_pull_through_cache_rule(
    self,
    ecr_repository_prefix: "capo_ecr.types.pull_through_cache_rule_repository_prefix.PullThroughCacheRuleRepositoryPrefix",
    *,
    config_overrides: Optional[ECRClientConfig] = None,
    registry_id: Optional["capo_ecr.types.registry_id.RegistryId"] = None,
    credential_arn: Optional["capo_ecr.types.credential_arn.CredentialArn"] = None,
    custom_role_arn: Optional[
        "capo_ecr.types.custom_role_arn.CustomRoleArn"
    ] = None,
    upstream_role_arn: Optional[
        "capo_ecr.types.custom_role_arn.CustomRoleArn"
    ] = None,
) -> "capo_ecr.types.update_pull_through_cache_rule_response.UpdatePullThroughCacheRuleResponse":
    """<p>Updates an existing pull through cache rule.</p>

    Args:
        registry_id: <p>The Amazon Web Services account ID associated with the registry associated with the pull through cache rule. If you do not specify a registry, the default registry is assumed.</p>
        ecr_repository_prefix: <p>The repository name prefix to use when caching images from the source registry.</p>
        credential_arn: <p>The Amazon Resource Name (ARN) of the Amazon Web Services Secrets Manager secret that identifies the credentials to authenticate to the upstream registry. You can't use this parameter with the Amazon ECR Public Premium upstream registry.</p>
        custom_role_arn: <p>The Amazon Resource Name (ARN) of the IAM role that Amazon ECR assumes to authenticate to the upstream registry. This role must be in the same account as the registry that you are configuring.</p> <p>For an Amazon ECR Public Premium upstream registry, specify this role together with <code>upstreamRoleArn</code>. If you specify neither role, Amazon ECR uses its service-linked role.</p>
        upstream_role_arn: <p>The Amazon Resource Name (ARN) of the IAM role in the <code>aws</code> partition that Amazon ECR assumes through <code>customRoleArn</code> to authenticate to the Amazon ECR Public Premium upstream registry. You can use this parameter only for the Amazon ECR Public Premium upstream registry, and it requires <code>customRoleArn</code>. If you omit both <code>customRoleArn</code> and <code>upstreamRoleArn</code>, Amazon ECR uses its service-linked role.</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.pull_through_cache_rule_not_found_exception.PullThroughCacheRuleNotFoundException: <p>The pull through cache rule was not found. Specify a valid pull through cache rule and try again.</p>
        capo_ecr.errors.secret_not_found_exception.SecretNotFoundException: <p>The ARN of the secret specified in the pull through cache rule was not found. Update the pull through cache rule with a valid secret ARN and try again.</p>
        capo_ecr.errors.server_exception.ServerException: <p>These errors are usually caused by a server-side issue.</p>
        capo_ecr.errors.unable_to_access_secret_exception.UnableToAccessSecretException: <p>The secret is unable to be accessed. Verify the resource permissions for the secret and try again.</p>
        capo_ecr.errors.unable_to_decrypt_secret_value_exception.UnableToDecryptSecretValueException: <p>The secret is accessible but is unable to be decrypted. Verify the resource permisisons 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.
    """

    def _handler(
        req: "OperationRequest[capo_ecr.types.update_pull_through_cache_rule_request.UpdatePullThroughCacheRuleRequest]",
    ) -> OperationResponse[
        "capo_ecr.types.update_pull_through_cache_rule_response.UpdatePullThroughCacheRuleResponse"
    ]:
        import capo_ecr._operations.amazon_ec2_container_registry_v20150921.update_pull_through_cache_rule

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdatePullThroughCacheRule")
    )
    input_: capo_ecr.types.update_pull_through_cache_rule_request.UpdatePullThroughCacheRuleRequest = {
        "ecr_repository_prefix": ecr_repository_prefix
    }
    if registry_id is not None:
        input_["registry_id"] = registry_id
    if credential_arn is not None:
        input_["credential_arn"] = credential_arn
    if custom_role_arn is not None:
        input_["custom_role_arn"] = custom_role_arn
    if upstream_role_arn is not None:
        input_["upstream_role_arn"] = upstream_role_arn

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