Skip to content

untag_resource

untag_resource(
    *,
    config_overrides: Optional[CloudWatchClientConfig] = None,
    resource_arn: Optional[AmazonResourceName] = None,
    tag_keys: Optional[TagKeyList] = None,
) -> UntagResourceOutput

Removes one or more tags from the specified resource. Currently, alarms, dashboards, metric streams and Contributor Insights rules support tagging.

Parameters:

  • resource_arn (Optional[AmazonResourceName], default: None ) –

    The ARN of the CloudWatch resource that you're removing tags from.

    The ARN format of an alarm is arn:aws:cloudwatch:Region:account-id:alarm:alarm-name

    The ARN format of a Contributor Insights rule is arn:aws:cloudwatch:Region:account-id:insight-rule/insight-rule-name

    The ARN format of a dashboard is arn:aws:cloudwatch::account-id:dashboard/dashboard-name

    The ARN format of a metric stream is arn:aws:cloudwatch:Region:account-id:metric-stream/metric-stream-name

    For more information about ARN format, see Resource Types Defined by Amazon CloudWatch in the Amazon Web Services General Reference.

  • tag_keys (Optional[TagKeyList], default: None ) –

    The list of tag keys to remove from the resource.

Raises:

Source code in docs_src/capo_cloudwatch/_services/cloud_watch.py
def untag_resource(
    self,
    *,
    config_overrides: Optional[CloudWatchClientConfig] = None,
    resource_arn: Optional[
        "capo_cloudwatch.types.amazon_resource_name.AmazonResourceName"
    ] = None,
    tag_keys: Optional["capo_cloudwatch.types.tag_key_list.TagKeyList"] = None,
) -> "capo_cloudwatch.types.untag_resource_output.UntagResourceOutput":
    """<p>Removes one or more tags from the specified resource. Currently, alarms, dashboards, metric streams and Contributor Insights rules support tagging.</p>

    Args:
        resource_arn: <p>The ARN of the CloudWatch resource that you're removing tags from.</p> <p>The ARN format of an alarm is <code>arn:aws:cloudwatch:<i>Region</i>:<i>account-id</i>:alarm:<i>alarm-name</i> </code> </p> <p>The ARN format of a Contributor Insights rule is <code>arn:aws:cloudwatch:<i>Region</i>:<i>account-id</i>:insight-rule/<i>insight-rule-name</i> </code> </p> <p>The ARN format of a dashboard is <code>arn:aws:cloudwatch::<i>account-id</i>:dashboard/<i>dashboard-name</i> </code> </p> <p>The ARN format of a metric stream is <code>arn:aws:cloudwatch:<i>Region</i>:<i>account-id</i>:metric-stream/<i>metric-stream-name</i> </code> </p> <p>For more information about ARN format, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/list_amazoncloudwatch.html#amazoncloudwatch-resources-for-iam-policies"> Resource Types Defined by Amazon CloudWatch</a> in the <i>Amazon Web Services General Reference</i>.</p>
        tag_keys: <p>The list of tag keys to remove from the resource.</p>

    Raises:
        capo_cloudwatch.errors.concurrent_modification_exception.ConcurrentModificationException: <p>More than one process tried to modify a resource at the same time.</p>
        capo_cloudwatch.errors.conflict_exception.ConflictException: <p>This operation attempted to create a resource that already exists.</p>
        capo_cloudwatch.errors.internal_service_fault.InternalServiceFault: <p>Request processing has failed due to some unknown error, exception, or failure.</p>
        capo_cloudwatch.errors.invalid_parameter_value_exception.InvalidParameterValueException: <p>The value of an input parameter is bad or out-of-range.</p>
        capo_cloudwatch.errors.resource_not_found_exception.ResourceNotFoundException: <p>The named resource does not exist.</p>
        capo_cloudwatch.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_cloudwatch.types.untag_resource_input.UntagResourceInput]",
    ) -> OperationResponse[
        "capo_cloudwatch.types.untag_resource_output.UntagResourceOutput"
    ]:
        import capo_cloudwatch._operations.granite_service_version20100801.untag_resource

        output, http_response = (
            capo_cloudwatch._operations.granite_service_version20100801.untag_resource.untag_resource(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UntagResource")
    )
    input_: capo_cloudwatch.types.untag_resource_input.UntagResourceInput = {}
    if resource_arn is not None:
        input_["resource_arn"] = resource_arn
    if tag_keys is not None:
        input_["tag_keys"] = tag_keys

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