Applies tags to a resource. For usage examples, see the Controls Reference Guide .
Parameters:
-
resource_arn
(Arn)
–
The ARN of the resource to be tagged.
-
tags
(TagMap)
–
Tags to be applied to the resource.
Raises:
Source code in docs_src/capo_controltower/_services/control_tower.py
| def tag_resource(
self,
resource_arn: "capo_controltower.types.arn.Arn",
tags: "capo_controltower.types.tag_map.TagMap",
*,
config_overrides: Optional[ControlTowerClientConfig] = None,
) -> "capo_controltower.types.tag_resource_output.TagResourceOutput":
"""<p>Applies tags to a resource. For usage examples, see the <a href="https://docs.aws.amazon.com/controltower/latest/controlreference/control-api-examples-short.html"> <i>Controls Reference Guide</i> </a>.</p>
Args:
resource_arn: <p>The ARN of the resource to be tagged.</p>
tags: <p>Tags to be applied to the resource.</p>
Raises:
capo_controltower.errors.internal_server_exception.InternalServerException: <p>An unexpected error occurred during processing of a request.</p>
capo_controltower.errors.resource_not_found_exception.ResourceNotFoundException: <p>The request references a resource that does not exist.</p>
capo_controltower.errors.validation_exception.ValidationException: <p>The input does not satisfy the constraints specified by an Amazon Web Services service.</p>
capo_controltower.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_controltower.types.tag_resource_input.TagResourceInput]",
) -> OperationResponse[
"capo_controltower.types.tag_resource_output.TagResourceOutput"
]:
import capo_controltower._operations.aws_control_tower_apis.tag_resource
output, http_response = (
capo_controltower._operations.aws_control_tower_apis.tag_resource.tag_resource(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("TagResource")
)
input_: capo_controltower.types.tag_resource_input.TagResourceInput = {
"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
|