Skip to content

CloudWatchClient.put_metric_data_query_definition

rboto-cloudwatch==0.4.0 · Service index · Types

Model summary (excerpt): Creates or updates a metric data query definition. A metric data query definition saves a metric query so that you can reuse it later. It includes the query expression, the query language, and a path that names the definition and can organize it into folders. When you save a definition, CloudWatch doesn't validate or run its expression. To create a definition, omit Id . CloudWatch generates...

Install and imports

python -m pip install "rboto[cloudwatch]==0.4.0"
from rboto import CloudWatchClient
from collections.abc import Sequence
from rboto_cloudwatch.types import (
    PutMetricDataQueryDefinitionOutput,
    QueryType,
    Tag,
)

Signature

async def put_metric_data_query_definition(
    *,
    path: str,
    expression: str,
    type: QueryType,
    id: str | None = None,
    tags: Sequence[Tag] | None = None,
) -> PutMetricDataQueryDefinitionOutput: ...

Arguments without defaults are required. None omits an optional request argument. Static types do not validate resource existence, permissions, lengths, ranges, or conditional service requirements.

Arguments

Argument Required Model notes (excerpt)
path Yes The name of the metric data query definition. Use slashes ( / ) to organize definitions into folders, for example team/web/latency . The path must meet the following requirements: It must be unique in your account and Region. It can't start or end with a slash. It can't contain an empty folder name ( // ). It can be at most 1,015 bytes when encoded as UTF-8.
expression Yes The query expression, in the language that Type specifies. CloudWatch doesn't validate or run the expression when you save it.
type Yes The language of the expression. Valid values are the following: PROMQL – A PromQL query. SQL – A CloudWatch Metrics Insights query. METRIC_MATH – A metric math expression.
id No The ID of the metric data query definition to update. Omit this parameter to create a definition. CloudWatch then generates the ID and returns it in the response.
tags No A list of key-value pairs to associate with the metric data query definition. You can use tags to categorize definitions and to control access to them. Tags are applied only when the request creates a definition, that is, when you omit Id . To change the tags of an existing definition, use TagResource and UntagResource .

Output

PutMetricDataQueryDefinitionOutput.

Read-only native attributes, accessed as response.field. Collection getters materialize Python values; to_dict() recursively materializes a mapping. Streams are consumed once.

Field Type Presence References
id str | None Always present —
arn str | None Always present —
path str | None Always present —
expression str | None Always present —
type QueryTypeOutput | None Always present QueryTypeOutput
created_at str | None Always present —
updated_at str | None Always present —

| None means a value can be absent. Output mappings include every declared key; optional input keys may be omitted. Unknown output enum/union variants are not automatically valid inputs.

PutMetricDataQueryDefinitionOutput, QueryType, Tag

Follow these links for nested inputs and outputs; recursive types link back to the same type page.

Pagination and streaming

No generated paginator for this operation.

No output stream.

Errors

Import from rboto_cloudwatch.exceptions:

ConflictError, LimitExceededError, ResourceNotFoundExceptionError.

Other service failures use the service base error; credential, transport and timeout failures use shared errors.

Service guide · Pinned model