Skip to content

untag_resource

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

Removes one or more tags from the specified resource.

Parameters:

  • resource_arn (AmazonResourceName) –

    The Amazon Resource Name (ARN) of the resource that you want to retrieve tags for.

  • tag_keys (TagKeyList) –

    The tag keys to remove from the specified resource.

Raises:

  • InvalidInput –

    One or more specified values aren't valid. For example, a required value might be missing, a numeric value might be outside the allowed range, or a string value might exceed length constraints.

  • ResourceNotFoundException –

    The operation can't be completed because the resource was not found.

  • UnknownServiceError –

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

Examples:

UntagResource example This example removes the "Department" and "Project" tags from a resource.

>>> client.untag_resource(resource_arn='arn:aws:servicediscovery:us-east-1:123456789012:namespace/ns-ylexjili4cdxy3xm', tag_keys=['Project', 'Department'])
Source code in docs_src/capo_servicediscovery/_services/service_discovery.py
def untag_resource(
    self,
    resource_arn: "capo_servicediscovery.types.amazon_resource_name.AmazonResourceName",
    tag_keys: "capo_servicediscovery.types.tag_key_list.TagKeyList",
    *,
    config_overrides: Optional[ServiceDiscoveryClientConfig] = None,
) -> "capo_servicediscovery.types.untag_resource_response.UntagResourceResponse":
    """<p>Removes one or more tags from the specified resource.</p>

    Args:
        resource_arn: <p>The Amazon Resource Name (ARN) of the resource that you want to retrieve tags for.</p>
        tag_keys: <p>The tag keys to remove from the specified resource.</p>

    Raises:
        capo_servicediscovery.errors.invalid_input.InvalidInput: <p>One or more specified values aren't valid. For example, a required value might be missing, a numeric value might be outside the allowed range, or a string value might exceed length constraints.</p>
        capo_servicediscovery.errors.resource_not_found_exception.ResourceNotFoundException: <p>The operation can't be completed because the resource was not found.</p>
        capo_servicediscovery.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        UntagResource example
        This example removes the "Department" and "Project" tags from a resource.

        >>> client.untag_resource(resource_arn='arn:aws:servicediscovery:us-east-1:123456789012:namespace/ns-ylexjili4cdxy3xm', tag_keys=['Project', 'Department'])
    """

    def _handler(
        req: "OperationRequest[capo_servicediscovery.types.untag_resource_request.UntagResourceRequest]",
    ) -> OperationResponse[
        "capo_servicediscovery.types.untag_resource_response.UntagResourceResponse"
    ]:
        import capo_servicediscovery._operations.route53_auto_naming_v20170314.untag_resource

        output, http_response = (
            capo_servicediscovery._operations.route53_auto_naming_v20170314.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_servicediscovery.types.untag_resource_request.UntagResourceRequest = {
        "resource_arn": resource_arn,
        "tag_keys": tag_keys,
    }

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