Associates a set of tags with a Amazon Keyspaces resource. You can then activate these user-defined tags so that they appear on the Cost Management Console for cost allocation tracking. For more information, see Adding tags and labels to Amazon Keyspaces resources in the Amazon Keyspaces Developer Guide.
For IAM policy examples that show how to control access to Amazon Keyspaces resources based on tags, see Amazon Keyspaces resource access based on tags in the Amazon Keyspaces Developer Guide.
Parameters:
-
resource_arn
(ARN)
–
The Amazon Resource Name (ARN) of the Amazon Keyspaces resource to which to add tags.
-
tags
(TagList)
–
The tags to be assigned to the Amazon Keyspaces resource.
Raises:
-
AccessDeniedException
–
You don't have sufficient access permissions to perform this action.
-
ConflictException
–
Amazon Keyspaces couldn't complete the requested action. This error may occur if you try to perform an action and the same or a different action is already in progress, or if you try to create a resource that already exists.
-
InternalServerException
–
Amazon Keyspaces was unable to fully process this request because of an internal server error.
-
ResourceNotFoundException
–
The operation tried to access a keyspace, table, or type that doesn't exist. The resource might not be specified correctly, or its status might not be ACTIVE.
-
ServiceQuotaExceededException
–
The operation exceeded the service quota for this resource. For more information on service quotas, see Quotas in the Amazon Keyspaces Developer Guide.
-
ValidationException
–
The operation failed due to an invalid or malformed request.
-
UnknownServiceError
–
The service returned an error code this client does not model.
Source code in docs_src/capo_keyspaces/_services/async_keyspaces.py
| async def tag_resource(
self,
resource_arn: "capo_keyspaces.types.arn.ARN",
tags: "capo_keyspaces.types.tag_list.TagList",
*,
config_overrides: Optional[AsyncKeyspacesClientConfig] = None,
) -> "capo_keyspaces.types.tag_resource_response.TagResourceResponse":
"""<p>Associates a set of tags with a Amazon Keyspaces resource. You can then activate these user-defined tags so that they appear on the Cost Management Console for cost allocation tracking. For more information, see <a href="https://docs.aws.amazon.com/keyspaces/latest/devguide/tagging-keyspaces.html">Adding tags and labels to Amazon Keyspaces resources</a> in the <i>Amazon Keyspaces Developer Guide</i>.</p> <p>For IAM policy examples that show how to control access to Amazon Keyspaces resources based on tags, see <a href="https://docs.aws.amazon.com/keyspaces/latest/devguide/security_iam_id-based-policy-examples.html#security_iam_id-based-policy-examples-tags">Amazon Keyspaces resource access based on tags</a> in the <i>Amazon Keyspaces Developer Guide</i>.</p>
Args:
resource_arn: <p>The Amazon Resource Name (ARN) of the Amazon Keyspaces resource to which to add tags.</p>
tags: <p>The tags to be assigned to the Amazon Keyspaces resource.</p>
Raises:
capo_keyspaces.errors.access_denied_exception.AccessDeniedException: <p>You don't have sufficient access permissions to perform this action. </p>
capo_keyspaces.errors.conflict_exception.ConflictException: <p>Amazon Keyspaces couldn't complete the requested action. This error may occur if you try to perform an action and the same or a different action is already in progress, or if you try to create a resource that already exists. </p>
capo_keyspaces.errors.internal_server_exception.InternalServerException: <p>Amazon Keyspaces was unable to fully process this request because of an internal server error.</p>
capo_keyspaces.errors.resource_not_found_exception.ResourceNotFoundException: <p>The operation tried to access a keyspace, table, or type that doesn't exist. The resource might not be specified correctly, or its status might not be <code>ACTIVE</code>.</p>
capo_keyspaces.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The operation exceeded the service quota for this resource. For more information on service quotas, see <a href="https://docs.aws.amazon.com/keyspaces/latest/devguide/quotas.html">Quotas</a> in the <i>Amazon Keyspaces Developer Guide</i>.</p>
capo_keyspaces.errors.validation_exception.ValidationException: <p>The operation failed due to an invalid or malformed request.</p>
capo_keyspaces.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_keyspaces.types.tag_resource_request.TagResourceRequest]",
) -> AsyncOperationResponse[
"capo_keyspaces.types.tag_resource_response.TagResourceResponse"
]:
import capo_keyspaces._operations.keyspaces_service.tag_resource
(
output,
http_response,
) = await capo_keyspaces._operations.keyspaces_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_keyspaces.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
|