Skip to content

untag_resource async

untag_resource(
    resource_arn: RuleArn,
    rule_revision: int,
    tag_keys: TagKeyList,
    *,
    config_overrides: Optional[AsyncComputeOptimizerAutomationClientConfig] = None,
    client_token: Optional[ClientToken] = None,
) -> UntagResourceResponse

Removes tags from the specified resource.

Parameters:

  • resource_arn (RuleArn) –

    The ARN of the resource to untag.

  • rule_revision (int) –

    The revision number of the automation rule to untag. This ensures you're untagging the correct version of the rule.

  • tag_keys (TagKeyList) –

    The keys of the tags to remove from the resource.

  • client_token (Optional[ClientToken], default: None ) –

    A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Must be 1-64 characters long and contain only alphanumeric characters, underscores, and hyphens.

Raises:

Source code in docs_src/capo_compute_optimizer_automation/_services/async_compute_optimizer_automation.py
async def untag_resource(
    self,
    resource_arn: "capo_compute_optimizer_automation.types.rule_arn.RuleArn",
    rule_revision: int,
    tag_keys: "capo_compute_optimizer_automation.types.tag_key_list.TagKeyList",
    *,
    config_overrides: Optional[AsyncComputeOptimizerAutomationClientConfig] = None,
    client_token: Optional[
        "capo_compute_optimizer_automation.types.client_token.ClientToken"
    ] = None,
) -> "capo_compute_optimizer_automation.types.untag_resource_response.UntagResourceResponse":
    """<p> Removes tags from the specified resource. </p>

    Args:
        resource_arn: <p> The ARN of the resource to untag. </p>
        rule_revision: <p>The revision number of the automation rule to untag. This ensures you're untagging the correct version of the rule.</p>
        tag_keys: <p> The keys of the tags to remove from the resource. </p>
        client_token: <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Must be 1-64 characters long and contain only alphanumeric characters, underscores, and hyphens.</p>

    Raises:
        capo_compute_optimizer_automation.errors.access_denied_exception.AccessDeniedException: <p> You do not have sufficient permissions to perform this action. </p>
        capo_compute_optimizer_automation.errors.forbidden_exception.ForbiddenException: <p> You are not authorized to perform this action. </p>
        capo_compute_optimizer_automation.errors.idempotency_token_in_use_exception.IdempotencyTokenInUseException: <p> The specified client token is already in use. </p>
        capo_compute_optimizer_automation.errors.idempotent_parameter_mismatch_exception.IdempotentParameterMismatchException: <p>Exception thrown when the same client token is used with different parameters, indicating a mismatch in idempotent request parameters.</p>
        capo_compute_optimizer_automation.errors.internal_server_exception.InternalServerException: <p> An internal error occurred while processing the request. </p>
        capo_compute_optimizer_automation.errors.invalid_parameter_value_exception.InvalidParameterValueException: <p> One or more parameter values are not valid. </p>
        capo_compute_optimizer_automation.errors.opt_in_required_exception.OptInRequiredException: <p> The account must be opted in to Compute Optimizer Automation before performing this action. </p>
        capo_compute_optimizer_automation.errors.resource_not_found_exception.ResourceNotFoundException: <p> The specified resource was not found. </p>
        capo_compute_optimizer_automation.errors.service_unavailable_exception.ServiceUnavailableException: <p> The service is temporarily unavailable. </p>
        capo_compute_optimizer_automation.errors.throttling_exception.ThrottlingException: <p> The request was denied due to request throttling. </p>
        capo_compute_optimizer_automation.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_compute_optimizer_automation.types.untag_resource_request.UntagResourceRequest]",
    ) -> AsyncOperationResponse[
        "capo_compute_optimizer_automation.types.untag_resource_response.UntagResourceResponse"
    ]:
        import capo_compute_optimizer_automation._operations.compute_optimizer_automation_service.untag_resource

        (
            output,
            http_response,
        ) = await capo_compute_optimizer_automation._operations.compute_optimizer_automation_service.untag_resource.async_untag_resource(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UntagResource")
    )
    input_: capo_compute_optimizer_automation.types.untag_resource_request.UntagResourceRequest = {
        "resource_arn": resource_arn,
        "rule_revision": rule_revision,
        "tag_keys": tag_keys,
    }
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token

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