Skip to content

untag_resource async

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

Removes one or more tags from a resource.

Parameters:

  • resource_arn (ResourceArn) –

    The ARN of the resource to remove the tags from.

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

    The tag keys associated with the tags to remove from the resource. You can remove up to 50 tags at a time.

Raises:

Examples:

To remove tags from a resource The following example removes the 'Department' tag from the specified resource.

>>> await client.untag_resource(resource_arn='arn:aws:securityhub:us-west-1:123456789012:hub/default', tag_keys=['Department'])
Source code in docs_src/capo_securityhub/_services/async_security_hub.py
async def untag_resource(
    self,
    resource_arn: "capo_securityhub.types.resource_arn.ResourceArn",
    *,
    config_overrides: Optional[AsyncSecurityHubClientConfig] = None,
    tag_keys: Optional["capo_securityhub.types.tag_key_list.TagKeyList"] = None,
) -> "capo_securityhub.types.untag_resource_response.UntagResourceResponse":
    """<p>Removes one or more tags from a resource.</p>

    Args:
        resource_arn: <p>The ARN of the resource to remove the tags from.</p>
        tag_keys: <p>The tag keys associated with the tags to remove from the resource. You can remove up to 50 tags at a time.</p>

    Raises:
        capo_securityhub.errors.internal_exception.InternalException: <p>Internal server error.</p>
        capo_securityhub.errors.invalid_input_exception.InvalidInputException: <p>The request was rejected because you supplied an invalid or out-of-range value for an input parameter.</p>
        capo_securityhub.errors.resource_not_found_exception.ResourceNotFoundException: <p>The request was rejected because we can't find the specified resource.</p>
        capo_securityhub.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To remove tags from a resource
        The following example removes the 'Department' tag from the specified resource.

        >>> await client.untag_resource(resource_arn='arn:aws:securityhub:us-west-1:123456789012:hub/default', tag_keys=['Department'])
    """

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

        (
            output,
            http_response,
        ) = await capo_securityhub._operations.security_hub_api_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_securityhub.types.untag_resource_request.UntagResourceRequest = {
        "resource_arn": resource_arn
    }
    if tag_keys is not None:
        input_["tag_keys"] = tag_keys

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