Associates the specified tags to a resource with the specified resourceArn in the current region. If existing tags on a resource are not specified in the request parameters, they are not changed. When a resource is deleted, the tags associated with that resource are deleted as well.
Parameters:
-
resource_arn
(str)
–
The Amazon Resource Name (ARN) that identifies the MediaConnect resource to which to add tags.
-
tags
(Optional[__mapOfString], default:
None
)
–
A map from tag keys to values. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters.
Raises:
-
BadRequestException
–
This exception is thrown if the request contains a semantic error. The precise meaning depends on the API, and is documented in the error message.
-
InternalServerErrorException
–
The server encountered an internal error and is unable to complete the request.
-
NotFoundException
–
One or more of the resources in the request does not exist in the system.
-
UnknownServiceError
–
The service returned an error code this client does not model.
Source code in docs_src/capo_mediaconnect/_services/async_media_connect.py
| async def tag_resource(
self,
resource_arn: str,
*,
config_overrides: Optional[AsyncMediaConnectClientConfig] = None,
tags: Optional["capo_mediaconnect.types.__map_of_string.__mapOfString"] = None,
) -> None:
"""<p> Associates the specified tags to a resource with the specified <code>resourceArn</code> in the current region. If existing tags on a resource are not specified in the request parameters, they are not changed. When a resource is deleted, the tags associated with that resource are deleted as well.</p>
Args:
resource_arn: <p> The Amazon Resource Name (ARN) that identifies the MediaConnect resource to which to add tags.</p>
tags: <p> A map from tag keys to values. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters.</p>
Raises:
capo_mediaconnect.errors.bad_request_exception.BadRequestException: <p>This exception is thrown if the request contains a semantic error. The precise meaning depends on the API, and is documented in the error message. </p>
capo_mediaconnect.errors.internal_server_error_exception.InternalServerErrorException: <p>The server encountered an internal error and is unable to complete the request. </p>
capo_mediaconnect.errors.not_found_exception.NotFoundException: <p>One or more of the resources in the request does not exist in the system. </p>
capo_mediaconnect.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_mediaconnect.types.tag_resource_request.TagResourceRequest]",
) -> AsyncOperationResponse[None]:
import capo_mediaconnect._operations.media_connect.tag_resource
(
output,
http_response,
) = await capo_mediaconnect._operations.media_connect.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_mediaconnect.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
|