Adds or updates tags for a specified resource.
Parameters:
-
resource_arn
(TaggableArn)
–
The Amazon Resource Name (ARN) of the resource to tag.
-
tags
(TagList)
–
Key-value pairs to associate with the resource.
Raises:
Examples:
Example for TagResource
>>> client.tag_resource(resource_arn='arn:aws:partnercentral:us-east-1:123456789012:catalog/AWS/program-management-account/pma-u8ic702rtzng8/relationship/rs-l9o4fj3b5zb91', tags=[{'key': 'ExampleKey', 'value': 'ExampleValue'}])
Source code in docs_src/capo_partnercentral_channel/_services/partner_central_channel.py
| def tag_resource(
self,
resource_arn: "capo_partnercentral_channel.types.taggable_arn.TaggableArn",
tags: "capo_partnercentral_channel.types.tag_list.TagList",
*,
config_overrides: Optional[PartnerCentralChannelClientConfig] = None,
) -> "capo_partnercentral_channel.types.tag_resource_response.TagResourceResponse":
"""<p>Adds or updates tags for a specified resource.</p>
Args:
resource_arn: <p>The Amazon Resource Name (ARN) of the resource to tag.</p>
tags: <p>Key-value pairs to associate with the resource.</p>
Raises:
capo_partnercentral_channel.errors.access_denied_exception.AccessDeniedException: <p>The request was denied due to insufficient permissions.</p>
capo_partnercentral_channel.errors.internal_server_exception.InternalServerException: <p>An internal server error occurred while processing the request.</p>
capo_partnercentral_channel.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource was not found.</p>
capo_partnercentral_channel.errors.throttling_exception.ThrottlingException: <p>The request was throttled due to too many requests being sent in a short period.</p>
capo_partnercentral_channel.errors.validation_exception.ValidationException: <p>The request failed validation due to invalid input parameters.</p>
capo_partnercentral_channel.errors.conflict_exception.ConflictException: <p>The request could not be completed due to a conflict with the current state of the resource.</p>
capo_partnercentral_channel.errors.UnknownServiceError: The service returned an error code this client does not model.
Examples:
Example for TagResource
>>> client.tag_resource(resource_arn='arn:aws:partnercentral:us-east-1:123456789012:catalog/AWS/program-management-account/pma-u8ic702rtzng8/relationship/rs-l9o4fj3b5zb91', tags=[{'key': 'ExampleKey', 'value': 'ExampleValue'}])
"""
def _handler(
req: "OperationRequest[capo_partnercentral_channel.types.tag_resource_request.TagResourceRequest]",
) -> OperationResponse[
"capo_partnercentral_channel.types.tag_resource_response.TagResourceResponse"
]:
import capo_partnercentral_channel._operations.partner_central_channel.tag_resource
output, http_response = (
capo_partnercentral_channel._operations.partner_central_channel.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_partnercentral_channel.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
|