Adds tags to a function, event source mapping, or code signing configuration.
Parameters:
-
resource
(TaggableResource)
–
The resource's Amazon Resource Name (ARN).
-
tags
(Tags)
–
A list of tags to apply to the resource.
Raises:
Examples:
To add tags to an existing Lambda function
The following example adds a tag with the key name DEPARTMENT and a value of 'Department A' to the specified Lambda function.
>>> client.tag_resource(resource='arn:aws:lambda:us-west-2:123456789012:function:my-function', tags={'DEPARTMENT': 'Department A'})
Source code in docs_src/capo_lambda/_services/_lambda.py
| def tag_resource(
self,
resource: "capo_lambda.types.taggable_resource.TaggableResource",
tags: "capo_lambda.types.tags.Tags",
*,
config_overrides: Optional[LambdaClientConfig] = None,
) -> None:
"""<p>Adds <a href="https://docs.aws.amazon.com/lambda/latest/dg/tagging.html">tags</a> to a function, event source mapping, or code signing configuration.</p>
Args:
resource: <p>The resource's Amazon Resource Name (ARN).</p>
tags: <p>A list of tags to apply to the resource.</p>
Raises:
capo_lambda.errors.invalid_parameter_value_exception.InvalidParameterValueException: <p>One of the parameters in the request is not valid.</p>
capo_lambda.errors.resource_conflict_exception.ResourceConflictException: <p>The resource already exists, or another operation is in progress.</p>
capo_lambda.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource specified in the request does not exist.</p>
capo_lambda.errors.service_exception.ServiceException: <p>The Lambda service encountered an internal error.</p>
capo_lambda.errors.too_many_requests_exception.TooManyRequestsException: <p>The request throughput limit was exceeded. For more information, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-limits.html#api-requests">Lambda quotas</a>.</p>
capo_lambda.errors.UnknownServiceError: The service returned an error code this client does not model.
Examples:
To add tags to an existing Lambda function
The following example adds a tag with the key name DEPARTMENT and a value of 'Department A' to the specified Lambda function.
>>> client.tag_resource(resource='arn:aws:lambda:us-west-2:123456789012:function:my-function', tags={'DEPARTMENT': 'Department A'})
"""
def _handler(
req: "OperationRequest[capo_lambda.types.tag_resource_request.TagResourceRequest]",
) -> OperationResponse[None]:
import capo_lambda._operations.aws_gir_api_service.tag_resource
output, http_response = (
capo_lambda._operations.aws_gir_api_service.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_lambda.types.tag_resource_request.TagResourceRequest = {
"resource": resource,
"tags": tags,
}
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|