tag_resource(
resource_arn: TagArn,
tags: TagMap,
*,
config_overrides: Optional[AsyncMediaPackageV2ClientConfig] = None,
) -> None
Assigns one of more tags (key-value pairs) to the specified MediaPackage resource.
Tags can help you organize and categorize your resources. You can also use them to scope user permissions, by granting a user permission to access or change only resources with certain tag values. You can use the TagResource operation with a resource that already has tags. If you specify a new tag key for the resource, this tag is appended to the list of tags associated with the resource. If you specify a tag key that is already associated with the resource, the new tag value that you specify replaces the previous value for that tag.
Parameters:
-
resource_arn
(TagArn)
–
The ARN of the MediaPackage resource that you're adding tags to.
-
tags
(TagMap)
–
Contains a map of the key-value pairs for the resource tag or tags assigned to the resource.
Raises:
Examples:
Add tags to a resource
>>> await client.tag_resource(resource_arn='arn:aws:mediapackagev2:us-west-2:123456789012:channelGroup/exampleChannelGroup/channel/exampleChannel', tags={'key3': 'value3', 'key4': 'value4'})
Source code in docs_src/capo_mediapackagev2/_services/async_media_package_v2.py
| async def tag_resource(
self,
resource_arn: "capo_mediapackagev2.types.tag_arn.TagArn",
tags: "capo_mediapackagev2.types.tag_map.TagMap",
*,
config_overrides: Optional[AsyncMediaPackageV2ClientConfig] = None,
) -> None:
"""<p>Assigns one of more tags (key-value pairs) to the specified MediaPackage resource.</p> <p>Tags can help you organize and categorize your resources. You can also use them to scope user permissions, by granting a user permission to access or change only resources with certain tag values. You can use the TagResource operation with a resource that already has tags. If you specify a new tag key for the resource, this tag is appended to the list of tags associated with the resource. If you specify a tag key that is already associated with the resource, the new tag value that you specify replaces the previous value for that tag.</p>
Args:
resource_arn: <p>The ARN of the MediaPackage resource that you're adding tags to.</p>
tags: <p>Contains a map of the key-value pairs for the resource tag or tags assigned to the resource.</p>
Raises:
capo_mediapackagev2.errors.validation_exception.ValidationException: <p>The input failed to meet the constraints specified by the AWS service.</p>
capo_mediapackagev2.errors.UnknownServiceError: The service returned an error code this client does not model.
Examples:
Add tags to a resource
>>> await client.tag_resource(resource_arn='arn:aws:mediapackagev2:us-west-2:123456789012:channelGroup/exampleChannelGroup/channel/exampleChannel', tags={'key3': 'value3', 'key4': 'value4'})
"""
async def _handler(
req: "AsyncOperationRequest[capo_mediapackagev2.types.tag_resource_request.TagResourceRequest]",
) -> AsyncOperationResponse[None]:
import capo_mediapackagev2._operations.mediapackagev2.tag_resource
(
output,
http_response,
) = await capo_mediapackagev2._operations.mediapackagev2.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_mediapackagev2.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
|