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.
>>> 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/security_hub.py
| def untag_resource(
self,
resource_arn: "capo_securityhub.types.resource_arn.ResourceArn",
*,
config_overrides: Optional[SecurityHubClientConfig] = 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.
>>> client.untag_resource(resource_arn='arn:aws:securityhub:us-west-1:123456789012:hub/default', tag_keys=['Department'])
"""
def _handler(
req: "OperationRequest[capo_securityhub.types.untag_resource_request.UntagResourceRequest]",
) -> OperationResponse[
"capo_securityhub.types.untag_resource_response.UntagResourceResponse"
]:
import capo_securityhub._operations.security_hub_api_service.untag_resource
output, http_response = (
capo_securityhub._operations.security_hub_api_service.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_securityhub.types.untag_resource_request.UntagResourceRequest = {
"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
|