Skip to content

tag_resource

tag_resource(
    resource: TaggableResource,
    tags: Tags,
    *,
    config_overrides: Optional[LambdaMicrovmsClientConfig] = None,
) -> None

Adds tags to a Lambda MicroVM resource.

Parameters:

  • resource (TaggableResource) –

    The ARN of the resource to tag.

  • tags (Tags) –

    The key-value pairs of tags to add to the resource.

Raises:

Source code in docs_src/capo_lambda_microvms/_services/lambda_microvms.py
def tag_resource(
    self,
    resource: "capo_lambda_microvms.types.taggable_resource.TaggableResource",
    tags: "capo_lambda_microvms.types.tags.Tags",
    *,
    config_overrides: Optional[LambdaMicrovmsClientConfig] = None,
) -> None:
    """<p>Adds tags to a Lambda MicroVM resource.</p>

    Args:
        resource: <p>The ARN of the resource to tag.</p>
        tags: <p>The key-value pairs of tags to add to the resource.</p>

    Raises:
        capo_lambda_microvms.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_lambda_microvms.errors.internal_server_exception.InternalServerException: <p>An internal server error occurred. Retry the request later.</p>
        capo_lambda_microvms.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling. Retry the request later.</p>
        capo_lambda_microvms.errors.validation_exception.ValidationException: <p>The input does not satisfy the constraints specified by the service.</p>
        capo_lambda_microvms.errors.invalid_parameter_value_exception.InvalidParameterValueException: <p>One of the parameters in the request is not valid.</p>
        capo_lambda_microvms.errors.resource_conflict_exception.ResourceConflictException: <p>The resource already exists, or another operation is in progress.</p>
        capo_lambda_microvms.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource does not exist.</p>
        capo_lambda_microvms.errors.service_exception.ServiceException: <p>The AWS Lambda MicroVMs service encountered an internal error.</p>
        capo_lambda_microvms.errors.too_many_requests_exception.TooManyRequestsException: <p>The request throughput limit was exceeded. Retry the request later.</p>
        capo_lambda_microvms.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_lambda_microvms.types.tag_resource_request.TagResourceRequest]",
    ) -> OperationResponse[None]:
        import capo_lambda_microvms._operations.lambda_microvms.tag_resource

        output, http_response = (
            capo_lambda_microvms._operations.lambda_microvms.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_microvms.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