Adds tags to an IoT Greengrass resource. If a tag already exists for the resource, this operation updates the tag's value.
Parameters:
-
resource_arn
(GenericV2ARN)
–
The ARN of the resource to tag.
-
tags
(TagMap)
–
A list of key-value pairs that contain metadata for the resource. For more information, see Tag your resources in the IoT Greengrass V2 Developer Guide.
Raises:
Source code in docs_src/capo_greengrassv2/_services/async_greengrass_v2.py
| async def tag_resource(
self,
resource_arn: "capo_greengrassv2.types.generic_v2_arn.GenericV2ARN",
tags: "capo_greengrassv2.types.tag_map.TagMap",
*,
config_overrides: Optional[AsyncGreengrassV2ClientConfig] = None,
) -> "capo_greengrassv2.types.tag_resource_response.TagResourceResponse":
"""<p>Adds tags to an IoT Greengrass resource. If a tag already exists for the resource, this operation updates the tag's value.</p>
Args:
resource_arn: <p>The <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">ARN</a> of the resource to tag.</p>
tags: <p>A list of key-value pairs that contain metadata for the resource. For more information, see <a href="https://docs.aws.amazon.com/greengrass/v2/developerguide/tag-resources.html">Tag your resources</a> in the <i>IoT Greengrass V2 Developer Guide</i>.</p>
Raises:
capo_greengrassv2.errors.internal_server_exception.InternalServerException: <p>IoT Greengrass can't process your request right now. Try again later.</p>
capo_greengrassv2.errors.resource_not_found_exception.ResourceNotFoundException: <p>The requested resource can't be found.</p>
capo_greengrassv2.errors.validation_exception.ValidationException: <p>The request isn't valid. This can occur if your request contains malformed JSON or unsupported characters.</p>
capo_greengrassv2.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_greengrassv2.types.tag_resource_request.TagResourceRequest]",
) -> AsyncOperationResponse[
"capo_greengrassv2.types.tag_resource_response.TagResourceResponse"
]:
import capo_greengrassv2._operations.greengrass_v2.tag_resource
(
output,
http_response,
) = await capo_greengrassv2._operations.greengrass_v2.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_greengrassv2.types.tag_resource_request.TagResourceRequest = {
"resource_arn": resource_arn,
"tags": tags,
}
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|