Attaches tags to a resource.
Required permissions: rolesanywhere:TagResource.
Parameters:
Raises:
Source code in docs_src/capo_rolesanywhere/_services/roles_anywhere.py
| def tag_resource(
self,
resource_arn: "capo_rolesanywhere.types.amazon_resource_name.AmazonResourceName",
tags: "capo_rolesanywhere.types.tag_list.TagList",
*,
config_overrides: Optional[RolesAnywhereClientConfig] = None,
) -> "capo_rolesanywhere.types.tag_resource_response.TagResourceResponse":
"""<p>Attaches tags to a resource.</p> <p> <b>Required permissions: </b> <code>rolesanywhere:TagResource</code>. </p>
Args:
resource_arn: <p>The ARN of the resource.</p>
tags: <p>The tags to attach to the resource.</p>
Raises:
capo_rolesanywhere.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
capo_rolesanywhere.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource could not be found.</p>
capo_rolesanywhere.errors.too_many_tags_exception.TooManyTagsException: <p>Too many tags.</p>
capo_rolesanywhere.errors.validation_exception.ValidationException: <p>Validation exception error.</p>
capo_rolesanywhere.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_rolesanywhere.types.tag_resource_request.TagResourceRequest]",
) -> OperationResponse[
"capo_rolesanywhere.types.tag_resource_response.TagResourceResponse"
]:
import capo_rolesanywhere._operations.roles_anywhere.tag_resource
output, http_response = (
capo_rolesanywhere._operations.roles_anywhere.tag_resource.tag_resource(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
def _redact_input(
input_: "capo_rolesanywhere.types.tag_resource_request.TagResourceRequest",
) -> dict[str, Any]:
import capo_rolesanywhere.types.tag_resource_request
return capo_rolesanywhere.types.tag_resource_request.redact_sensitive(
input_
)
interceptors_, options_ = self.operation_options(
config_overrides,
OperationLogging("TagResource", redact_input=_redact_input),
)
input_: capo_rolesanywhere.types.tag_resource_request.TagResourceRequest = {
"resource_arn": resource_arn,
"tags": tags,
}
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|