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.
>>> await 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/async__lambda.py
| async def tag_resource(
self,
resource: "capo_lambda.types.taggable_resource.TaggableResource",
tags: "capo_lambda.types.tags.Tags",
*,
config_overrides: Optional[AsyncLambdaClientConfig] = 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.
>>> await client.tag_resource(resource='arn:aws:lambda:us-west-2:123456789012:function:my-function', tags={'DEPARTMENT': 'Department A'})
"""
async def _handler(
req: "AsyncOperationRequest[capo_lambda.types.tag_resource_request.TagResourceRequest]",
) -> AsyncOperationResponse[None]:
import capo_lambda._operations.aws_gir_api_service.tag_resource
(
output,
http_response,
) = await capo_lambda._operations.aws_gir_api_service.tag_resource.async_tag_resource(
req.options, req.input
)
return AsyncOperationResponse(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 = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|