Adds the specified tag keys and values to a resource share or managed permission. If you choose a resource share, the tags are attached to only the resource share, not to the resources that are in the resource share.
The tags on a managed permission are the same for all versions of the managed permission.
Parameters:
-
resource_share_arn
(Optional[String], default:
None
)
–
Specifies the Amazon Resource Name (ARN) of the resource share that you want to add tags to. You must specify either resourceShareArn, or resourceArn, but not both.
-
tags
(TagList)
–
A list of one or more tag key and value pairs. The tag key must be present and not be an empty string. The tag value must be present but can be an empty string.
-
resource_arn
(Optional[String], default:
None
)
–
Specifies the Amazon Resource Name (ARN) of the managed permission that you want to add tags to. You must specify either resourceArn, or resourceShareArn, but not both.
Raises:
Source code in docs_src/capo_ram/_services/ram.py
| def tag_resource(
self,
tags: "capo_ram.types.tag_list.TagList",
*,
config_overrides: Optional[RAMClientConfig] = None,
resource_share_arn: Optional["capo_ram.types.string.String"] = None,
resource_arn: Optional["capo_ram.types.string.String"] = None,
) -> "capo_ram.types.tag_resource_response.TagResourceResponse":
"""<p>Adds the specified tag keys and values to a resource share or managed permission. If you choose a resource share, the tags are attached to only the resource share, not to the resources that are in the resource share.</p> <p>The tags on a managed permission are the same for all versions of the managed permission.</p>
Args:
resource_share_arn: <p>Specifies the <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">Amazon Resource Name (ARN)</a> of the resource share that you want to add tags to. You must specify <i>either</i> <code>resourceShareArn</code>, or <code>resourceArn</code>, but not both.</p>
tags: <p>A list of one or more tag key and value pairs. The tag key must be present and not be an empty string. The tag value must be present but can be an empty string.</p>
resource_arn: <p>Specifies the <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">Amazon Resource Name (ARN)</a> of the managed permission that you want to add tags to. You must specify <i>either</i> <code>resourceArn</code>, or <code>resourceShareArn</code>, but not both.</p>
Raises:
capo_ram.errors.invalid_parameter_exception.InvalidParameterException: <p>The operation failed because a parameter you specified isn't valid.</p>
capo_ram.errors.malformed_arn_exception.MalformedArnException: <p>The operation failed because the specified <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">Amazon Resource Name (ARN)</a> has a format that isn't valid.</p>
capo_ram.errors.resource_arn_not_found_exception.ResourceArnNotFoundException: <p>The operation failed because the specified <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">Amazon Resource Name (ARN)</a> was not found.</p>
capo_ram.errors.server_internal_exception.ServerInternalException: <p>The operation failed because the service could not respond to the request due to an internal problem. Try again later.</p>
capo_ram.errors.service_unavailable_exception.ServiceUnavailableException: <p>The operation failed because the service isn't available. Try again later.</p>
capo_ram.errors.tag_limit_exceeded_exception.TagLimitExceededException: <p>The operation failed because it would exceed the limit for tags for your Amazon Web Services account.</p>
capo_ram.errors.tag_policy_violation_exception.TagPolicyViolationException: <p>The operation failed because the specified tag key is a reserved word and can't be used.</p>
capo_ram.errors.unknown_resource_exception.UnknownResourceException: <p>The operation failed because a specified resource couldn't be found.</p>
capo_ram.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_ram.types.tag_resource_request.TagResourceRequest]",
) -> OperationResponse[
"capo_ram.types.tag_resource_response.TagResourceResponse"
]:
import capo_ram._operations.amazon_resource_sharing.tag_resource
output, http_response = (
capo_ram._operations.amazon_resource_sharing.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_ram.types.tag_resource_request.TagResourceRequest = {"tags": tags}
if resource_share_arn is not None:
input_["resource_share_arn"] = resource_share_arn
if resource_arn is not None:
input_["resource_arn"] = resource_arn
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|