Adds or overwrites one or more tags for the specified WorkSpaces Applications resource. You can tag WorkSpaces Applications image builders, images, fleets, and stacks.
Each tag consists of a key and an optional value. If a resource already has a tag with the same key, this operation updates its value.
To list the current tags for your resources, use ListTagsForResource. To disassociate tags from your resources, use UntagResource.
For more information about tags, see Tagging Your Resources in the Amazon WorkSpaces Applications Administration Guide.
Parameters:
-
resource_arn
(Optional[Arn], default:
None
)
–
The Amazon Resource Name (ARN) of the resource.
-
tags
(Optional[Tags], default:
None
)
–
The tags to associate. A tag is a key-value pair, and the value is optional. For example, Environment=Test. If you do not specify a value, Environment=.
If you do not specify a value, the value is set to an empty string.
Generally allowed characters are: letters, numbers, and spaces representable in UTF-8, and the following special characters:
_ . : / = + \ - @
Raises:
Source code in docs_src/capo_appstream/_services/async_app_stream.py
| async def tag_resource(
self,
*,
config_overrides: Optional[AsyncAppStreamClientConfig] = None,
resource_arn: Optional["capo_appstream.types.arn.Arn"] = None,
tags: Optional["capo_appstream.types.tags.Tags"] = None,
) -> "capo_appstream.types.tag_resource_response.TagResourceResponse":
r"""<p>Adds or overwrites one or more tags for the specified WorkSpaces Applications resource. You can tag WorkSpaces Applications image builders, images, fleets, and stacks.</p> <p>Each tag consists of a key and an optional value. If a resource already has a tag with the same key, this operation updates its value.</p> <p>To list the current tags for your resources, use <a>ListTagsForResource</a>. To disassociate tags from your resources, use <a>UntagResource</a>.</p> <p>For more information about tags, see <a href="https://docs.aws.amazon.com/appstream2/latest/developerguide/tagging-basic.html">Tagging Your Resources</a> in the <i>Amazon WorkSpaces Applications Administration Guide</i>.</p>
Args:
resource_arn: <p>The Amazon Resource Name (ARN) of the resource.</p>
tags: <p>The tags to associate. A tag is a key-value pair, and the value is optional. For example, Environment=Test. If you do not specify a value, Environment=. </p> <p>If you do not specify a value, the value is set to an empty string.</p> <p>Generally allowed characters are: letters, numbers, and spaces representable in UTF-8, and the following special characters: </p> <p>_ . : / = + \ - @</p>
Raises:
capo_appstream.errors.invalid_account_status_exception.InvalidAccountStatusException: <p>The resource cannot be created because your AWS account is suspended. For assistance, contact AWS Support. </p>
capo_appstream.errors.limit_exceeded_exception.LimitExceededException: <p>The requested limit exceeds the permitted limit for an account.</p>
capo_appstream.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource was not found.</p>
capo_appstream.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_appstream.types.tag_resource_request.TagResourceRequest]",
) -> AsyncOperationResponse[
"capo_appstream.types.tag_resource_response.TagResourceResponse"
]:
import capo_appstream._operations.photon_admin_proxy_service.tag_resource
(
output,
http_response,
) = await capo_appstream._operations.photon_admin_proxy_service.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_appstream.types.tag_resource_request.TagResourceRequest = {}
if resource_arn is not None:
input_["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
|