Adds or updates one or more tags (keys and values) that are associated with an Amazon Macie resource.
Parameters:
-
resource_arn
(__string)
–
The Amazon Resource Name (ARN) of the resource.
-
tags
(Optional[TagMap], default:
None
)
–
A map of key-value pairs that specifies the tags to associate with the resource.
A resource can have a maximum of 50 tags. Each tag consists of a tag key and an associated tag value. The maximum length of a tag key is 128 characters. The maximum length of a tag value is 256 characters.
Raises:
Source code in docs_src/capo_macie2/_services/async_macie2.py
| async def tag_resource(
self,
resource_arn: "capo_macie2.types.__string.__string",
*,
config_overrides: Optional[AsyncMacie2ClientConfig] = None,
tags: Optional["capo_macie2.types.tag_map.TagMap"] = None,
) -> "capo_macie2.types.tag_resource_response.TagResourceResponse":
"""<p>Adds or updates one or more tags (keys and values) that are associated with an Amazon Macie resource.</p>
Args:
resource_arn: <p>The Amazon Resource Name (ARN) of the resource.</p>
tags: <p>A map of key-value pairs that specifies the tags to associate with the resource.</p> <p>A resource can have a maximum of 50 tags. Each tag consists of a tag key and an associated tag value. The maximum length of a tag key is 128 characters. The maximum length of a tag value is 256 characters.</p>
Raises:
capo_macie2.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_macie2.types.tag_resource_request.TagResourceRequest]",
) -> AsyncOperationResponse[
"capo_macie2.types.tag_resource_response.TagResourceResponse"
]:
import capo_macie2._operations.macie2.tag_resource
(
output,
http_response,
) = await capo_macie2._operations.macie2.tag_resource.async_tag_resource(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("TagResource")
)
input_: capo_macie2.types.tag_resource_request.TagResourceRequest = {
"resource_arn": resource_arn
}
if tags is not None:
input_["tags"] = tags
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|