Applies one or more user-defined tags to an Amazon S3 Vectors resource or updates existing tags. Each tag is a label consisting of a key and value pair. Tags can help you organize, track costs for, and control access to your resources. You can add up to 50 tags for each resource.
For a list of S3 resources that support tagging, see Managing tags for Amazon S3 resources.
- Permissions
-
For vector buckets and vector indexes, you must have the s3vectors:TagResource permission to use this operation.
Parameters:
-
resource_arn
(ResourceARN)
–
The Amazon Resource Name (ARN) of the Amazon S3 Vectors resource that you're applying tags to. The tagged resource can be a vector bucket or a vector index.
-
tags
(TagsMap)
–
Raises:
-
AccessDeniedException
–
-
InternalServerException
–
The request failed due to an internal server error.
-
RequestTimeoutException
–
The request timed out. Retry your request.
-
TooManyRequestsException
–
The request was denied due to request throttling.
-
ValidationException
–
The requested action isn't valid.
-
ConflictException
–
The request failed because a vector bucket name or a vector index name already exists. Vector bucket names must be unique within your Amazon Web Services account for each Amazon Web Services Region. Vector index names must be unique within your vector bucket. Choose a different vector bucket name or vector index name, and try again.
-
NotFoundException
–
The request was rejected because the specified resource can't be found.
-
ServiceUnavailableException
–
The service is unavailable. Wait briefly and retry your request. If it continues to fail, increase your waiting time between retries.
-
UnknownServiceError
–
The service returned an error code this client does not model.
Source code in docs_src/capo_s3vectors/_services/async_s3_vectors.py
| async def tag_resource(
self,
resource_arn: "capo_s3vectors.types.resource_arn.ResourceARN",
tags: "capo_s3vectors.types.tags_map.TagsMap",
*,
config_overrides: Optional[AsyncS3VectorsClientConfig] = None,
) -> "capo_s3vectors.types.tag_resource_output.TagResourceOutput":
"""<p>Applies one or more user-defined tags to an Amazon S3 Vectors resource or updates existing tags. Each tag is a label consisting of a key and value pair. Tags can help you organize, track costs for, and control access to your resources. You can add up to 50 tags for each resource.</p> <note> <p>For a list of S3 resources that support tagging, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/tagging.html#manage-tags">Managing tags for Amazon S3 resources</a>.</p> </note> <dl> <dt>Permissions</dt> <dd> <p>For vector buckets and vector indexes, you must have the <code>s3vectors:TagResource</code> permission to use this operation.</p> </dd> </dl>
Args:
resource_arn: <p>The Amazon Resource Name (ARN) of the Amazon S3 Vectors resource that you're applying tags to. The tagged resource can be a vector bucket or a vector index. </p>
tags: <p>The user-defined tag that you want to add to the specified S3 Vectors resource. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/tagging.html">Tagging for cost allocation or attribute-based access control (ABAC)</a>.</p>
Raises:
capo_s3vectors.errors.access_denied_exception.AccessDeniedException: <p>Access denied.</p>
capo_s3vectors.errors.internal_server_exception.InternalServerException: <p>The request failed due to an internal server error.</p>
capo_s3vectors.errors.request_timeout_exception.RequestTimeoutException: <p>The request timed out. Retry your request.</p>
capo_s3vectors.errors.too_many_requests_exception.TooManyRequestsException: <p>The request was denied due to request throttling.</p>
capo_s3vectors.errors.validation_exception.ValidationException: <p>The requested action isn't valid.</p>
capo_s3vectors.errors.conflict_exception.ConflictException: <p>The request failed because a vector bucket name or a vector index name already exists. Vector bucket names must be unique within your Amazon Web Services account for each Amazon Web Services Region. Vector index names must be unique within your vector bucket. Choose a different vector bucket name or vector index name, and try again.</p>
capo_s3vectors.errors.not_found_exception.NotFoundException: <p>The request was rejected because the specified resource can't be found.</p>
capo_s3vectors.errors.service_unavailable_exception.ServiceUnavailableException: <p>The service is unavailable. Wait briefly and retry your request. If it continues to fail, increase your waiting time between retries.</p>
capo_s3vectors.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_s3vectors.types.tag_resource_input.TagResourceInput]",
) -> AsyncOperationResponse[
"capo_s3vectors.types.tag_resource_output.TagResourceOutput"
]:
import capo_s3vectors._operations.s3_vectors.tag_resource
(
output,
http_response,
) = await capo_s3vectors._operations.s3_vectors.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_s3vectors.types.tag_resource_input.TagResourceInput = {
"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
|