From d1496fa5807fe5b4c6617a3cbccfa59a34a2dc17 Mon Sep 17 00:00:00 2001 From: Jason Stirnaman Date: Thu, 15 Feb 2024 16:09:12 -0600 Subject: [PATCH] fix: OSS API documentation documents InfluxDB Cloud features (https://github.com/influxdata/docs-v2/issues/5320) - Effectively removes property from OSS Query API. - Re-diverges Query schema, removing from OSS and keeping it in Cloud. --- contracts/cloud-diff.yml | 446 ++++++++++++++++++++++++++++++++++++ contracts/cloud.json | 109 ++++++--- contracts/cloud.yml | 155 ++++++++----- contracts/common.yml | 104 +++++---- contracts/oss-diff.yml | 419 +++++++++++++++++++++++++++++++++ contracts/oss.json | 104 ++++++--- contracts/oss.yml | 128 ++++++----- contracts/ref/cloud.yml | 53 ++++- contracts/ref/oss.yml | 80 ++++--- src/cloud.yml | 2 + src/cloud/schemas/Query.yml | 50 ++++ src/common/_schemas.yml | 2 - src/oss.yml | 2 + src/oss/schemas/Query.yml | 23 ++ 14 files changed, 1409 insertions(+), 268 deletions(-) create mode 100644 src/cloud/schemas/Query.yml create mode 100644 src/oss/schemas/Query.yml diff --git a/contracts/cloud-diff.yml b/contracts/cloud-diff.yml index fbf071370..b8924ba69 100644 --- a/contracts/cloud-diff.yml +++ b/contracts/cloud-diff.yml @@ -4328,6 +4328,452 @@ components: type: array items: $ref: '#/components/schemas/MeasurementSchemaColumn' + Query: + description: Query InfluxDB with the Flux language + type: object + required: + - query + properties: + extern: + description: Represents a source from a single file + type: object + properties: + type: + description: Type of AST node + type: string + name: + description: The name of the file. + type: string + package: + description: Defines a package identifier + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + name: + description: A valid Flux identifier + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + name: + type: string + imports: + description: A list of package imports + type: array + items: + description: Declares a package import + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + as: + $ref: '#/components/schemas/Query/properties/extern/properties/package/properties/name' + path: + description: Expressions begin and end with double quote marks + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + value: + type: string + body: + description: List of Flux statements + type: array + items: + oneOf: + - description: A placeholder for statements for which no correct statement nodes can be created + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + text: + description: Raw source text + type: string + - description: Represents the declaration of a variable + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + id: + $ref: '#/components/schemas/Query/properties/extern/properties/package/properties/name' + init: + oneOf: + - description: Used to create and directly specify the elements of an array object + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + elements: + description: Elements of the array + type: array + items: + $ref: '#/components/schemas/Query/properties/extern/properties/body/items/oneOf/1/properties/init' + - description: Used to create and directly specify the elements of a dictionary + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + elements: + description: Elements of the dictionary + type: array + items: + description: A key-value pair in a dictionary. + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + key: + $ref: '#/components/schemas/Query/properties/extern/properties/body/items/oneOf/1/properties/init' + val: + $ref: '#/components/schemas/Query/properties/extern/properties/body/items/oneOf/1/properties/init' + - description: Function expression + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + params: + description: Function parameters + type: array + items: + description: The value associated with a key + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + key: + oneOf: + - $ref: '#/components/schemas/Query/properties/extern/properties/package/properties/name' + - $ref: '#/components/schemas/Query/properties/extern/properties/imports/items/properties/path' + value: + $ref: '#/components/schemas/Query/properties/extern/properties/body/items/oneOf/1/properties/init' + body: + oneOf: + - $ref: '#/components/schemas/Query/properties/extern/properties/body/items/oneOf/1/properties/init' + - description: A set of statements + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + body: + description: Block body + type: array + items: + $ref: '#/components/schemas/Query/properties/extern/properties/body/items' + - description: uses binary operators to act on two operands in an expression + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + operator: + type: string + left: + $ref: '#/components/schemas/Query/properties/extern/properties/body/items/oneOf/1/properties/init' + right: + $ref: '#/components/schemas/Query/properties/extern/properties/body/items/oneOf/1/properties/init' + - description: Represents a function call + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + callee: + $ref: '#/components/schemas/Query/properties/extern/properties/body/items/oneOf/1/properties/init' + arguments: + description: Function arguments + type: array + items: + $ref: '#/components/schemas/Query/properties/extern/properties/body/items/oneOf/1/properties/init' + - description: 'Selects one of two expressions, `Alternate` or `Consequent`, depending on a third boolean expression, `Test`' + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + test: + $ref: '#/components/schemas/Query/properties/extern/properties/body/items/oneOf/1/properties/init' + alternate: + $ref: '#/components/schemas/Query/properties/extern/properties/body/items/oneOf/1/properties/init' + consequent: + $ref: '#/components/schemas/Query/properties/extern/properties/body/items/oneOf/1/properties/init' + - description: Represents the rule conditions that collectively evaluate to either true or false + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + operator: + type: string + left: + $ref: '#/components/schemas/Query/properties/extern/properties/body/items/oneOf/1/properties/init' + right: + $ref: '#/components/schemas/Query/properties/extern/properties/body/items/oneOf/1/properties/init' + - description: Represents accessing a property of an object + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + object: + $ref: '#/components/schemas/Query/properties/extern/properties/body/items/oneOf/1/properties/init' + property: + $ref: '#/components/schemas/Query/properties/extern/properties/body/items/oneOf/1/properties/init/oneOf/0/properties/elements/items/oneOf/1/properties/elements/items/properties/key/oneOf/2/properties/params/items/properties/key' + - description: Represents indexing into an array + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + array: + $ref: '#/components/schemas/Query/properties/extern/properties/body/items/oneOf/1/properties/init' + index: + $ref: '#/components/schemas/Query/properties/extern/properties/body/items/oneOf/1/properties/init' + - description: Allows the declaration of an anonymous object within a declaration + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + properties: + description: Object properties + type: array + items: + $ref: '#/components/schemas/Query/properties/extern/properties/body/items/oneOf/1/properties/init/oneOf/0/properties/elements/items/oneOf/1/properties/elements/items/properties/key/oneOf/2/properties/params/items' + - description: Represents an expression wrapped in parenthesis + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + expression: + $ref: '#/components/schemas/Query/properties/extern/properties/body/items/oneOf/1/properties/init' + - description: Call expression with pipe argument + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + argument: + $ref: '#/components/schemas/Query/properties/extern/properties/body/items/oneOf/1/properties/init' + call: + $ref: '#/components/schemas/Query/properties/extern/properties/body/items/oneOf/1/properties/init/oneOf/4' + - description: Uses operators to act on a single operand in an expression + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + operator: + type: string + argument: + $ref: '#/components/schemas/Query/properties/extern/properties/body/items/oneOf/1/properties/init' + - description: Represents boolean values + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + value: + type: boolean + - description: 'Represents an instant in time with nanosecond precision in [RFC3339Nano date/time format]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#rfc3339nano-timestamp).' + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + value: + type: string + format: date-time + - description: Represents the elapsed time between two instants as an int64 nanosecond count with syntax of golang's time.Duration + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + values: + description: Duration values + type: array + items: + description: A pair consisting of length of time and the unit of time measured. It is the atomic unit from which all duration literals are composed. + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + magnitude: + type: integer + unit: + type: string + - description: Represents floating point numbers according to the double representations defined by the IEEE-754-1985 + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + value: + type: number + - description: Represents integer numbers + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + value: + type: string + - description: 'Represents a specialized literal value, indicating the left hand value of a pipe expression' + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + - description: Expressions begin and end with `/` and are regular expressions with syntax accepted by RE2 + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + value: + type: string + - $ref: '#/components/schemas/Query/properties/extern/properties/imports/items/properties/path' + - description: Represents integer numbers + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + value: + type: string + - $ref: '#/components/schemas/Query/properties/extern/properties/package/properties/name' + - description: Object property assignment + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + member: + $ref: '#/components/schemas/Query/properties/extern/properties/body/items/oneOf/1/properties/init/oneOf/7' + init: + $ref: '#/components/schemas/Query/properties/extern/properties/body/items/oneOf/1/properties/init' + - description: May consist of an expression that doesn't return a value and is executed solely for its side-effects + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + expression: + $ref: '#/components/schemas/Query/properties/extern/properties/body/items/oneOf/1/properties/init' + - description: Defines an expression to return + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + argument: + $ref: '#/components/schemas/Query/properties/extern/properties/body/items/oneOf/1/properties/init' + - description: A single variable declaration + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + assignment: + oneOf: + - $ref: '#/components/schemas/Query/properties/extern/properties/body/items/oneOf/1' + - $ref: '#/components/schemas/Query/properties/extern/properties/body/items/oneOf/2' + - description: Declares a builtin identifier and its type + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + id: + $ref: '#/components/schemas/Query/properties/extern/properties/package/properties/name' + - description: Declares a Flux test case + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + assignment: + $ref: '#/components/schemas/Query/properties/extern/properties/body/items/oneOf/1' + query: + description: The query script to execute. + type: string + type: + description: The type of query. Must be "flux". + type: string + enum: + - flux + params: + type: object + additionalProperties: true + description: | + Key-value pairs passed as parameters during query execution. + + To use parameters in your query, pass a _`query`_ with `params` references (in dot notation)--for example: + + ```json + query: "from(bucket: params.mybucket)\ + |> range(start: params.rangeStart) |> limit(n:1)" + ``` + + and pass _`params`_ with the key-value pairs--for example: + + ```json + params: { + "mybucket": "environment", + "rangeStart": "-30d" + } + ``` + + During query execution, InfluxDB passes _`params`_ to your script and substitutes the values. + + #### Limitations + + - If you use _`params`_, you can't use _`extern`_. + dialect: + description: | + Options for tabular data output. + Default output is [annotated CSV]({{% INFLUXDB_DOCS_URL %}}/reference/syntax/annotated-csv/#csv-response-format) with headers. + + For more information about tabular data **dialect**, + see [W3 metadata vocabulary for tabular data](https://www.w3.org/TR/2015/REC-tabular-metadata-20151217/#dialect-descriptions). + type: object + properties: + header: + description: 'If true, the results contain a header row.' + type: boolean + default: true + delimiter: + description: 'The separator used between cells. Default is a comma (`,`).' + type: string + default: ',' + maxLength: 1 + minLength: 1 + annotations: + description: | + Annotation rows to include in the results. + An _annotation_ is metadata associated with an object (column) in the data model. + + #### Related guides + + - See [Annotated CSV annotations]({{% INFLUXDB_DOCS_URL %}}/reference/syntax/annotated-csv/#annotations) for examples and more information. + + For more information about **annotations** in tabular data, + see [W3 metadata vocabulary for tabular data](https://www.w3.org/TR/2015/REC-tabular-data-model-20151217/#columns). + type: array + uniqueItems: true + items: + type: string + enum: + - group + - datatype + - default + commentPrefix: + description: The character prefixed to comment strings. Default is a number sign (`#`). + type: string + default: '#' + maxLength: 1 + minLength: 0 + dateTimeFormat: + description: | + The format for timestamps in results. + Default is [`RFC3339` date/time format]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#rfc3339-timestamp). + To include nanoseconds in timestamps, use `RFC3339Nano`. + + #### Example formatted date/time values + + | Format | Value | + |:------------|:----------------------------| + | `RFC3339` | `"2006-01-02T15:04:05Z07:00"` | + | `RFC3339Nano` | `"2006-01-02T15:04:05.999999999Z07:00"` | + type: string + default: RFC3339 + enum: + - RFC3339 + - RFC3339Nano + now: + description: | + Specifies the time that should be reported as `now` in the query. + Default is the server `now` time. + type: string + format: date-time Tasks: type: object properties: diff --git a/contracts/cloud.json b/contracts/cloud.json index 25d3b7fc5..9ccbc2742 100644 --- a/contracts/cloud.json +++ b/contracts/cloud.json @@ -5017,7 +5017,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Query" + "$ref": "#/paths/~1query/post/requestBody/content/application~1json/schema" } } } @@ -5196,7 +5196,40 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Query" + "description": "Query InfluxDB with the Flux language", + "type": "object", + "required": [ + "query" + ], + "properties": { + "extern": { + "$ref": "#/components/schemas/File" + }, + "query": { + "description": "The query script to execute.", + "type": "string" + }, + "type": { + "description": "The type of query. Must be \"flux\".", + "type": "string", + "enum": [ + "flux" + ] + }, + "params": { + "type": "object", + "additionalProperties": true, + "description": "Key-value pairs passed as parameters during query execution.\n\nTo use parameters in your query, pass a _`query`_ with `params` references (in dot notation)--for example:\n\n```json\n query: \"from(bucket: params.mybucket)\\\n |> range(start: params.rangeStart) |> limit(n:1)\"\n```\n\nand pass _`params`_ with the key-value pairs--for example:\n\n```json\n params: {\n \"mybucket\": \"environment\",\n \"rangeStart\": \"-30d\"\n }\n```\n\nDuring query execution, InfluxDB passes _`params`_ to your script and substitutes the values.\n\n#### Limitations\n\n- If you use _`params`_, you can't use _`extern`_.\n" + }, + "dialect": { + "$ref": "#/components/schemas/Dialect" + }, + "now": { + "description": "Specifies the time that should be reported as `now` in the query.\nDefault is the server `now` time.\n", + "type": "string", + "format": "date-time" + } + } } }, "application/vnd.flux": { @@ -13599,42 +13632,6 @@ } } }, - "Query": { - "description": "Query InfluxDB with the Flux language", - "type": "object", - "required": [ - "query" - ], - "properties": { - "extern": { - "$ref": "#/components/schemas/File" - }, - "query": { - "description": "The query script to execute.", - "type": "string" - }, - "type": { - "description": "The type of query. Must be \"flux\".", - "type": "string", - "enum": [ - "flux" - ] - }, - "params": { - "type": "object", - "additionalProperties": true, - "description": "Key-value pairs passed as parameters during query execution.\n\nTo use parameters in your query, pass a _`query`_ with `params` references (in dot notation)--for example:\n\n```json\n query: \"from(bucket: params.mybucket)\\\n |> range(start: params.rangeStart) |> limit(n:1)\"\n```\n\nand pass _`params`_ with the key-value pairs--for example:\n\n```json\n params: {\n \"mybucket\": \"environment\",\n \"rangeStart\": \"-30d\"\n }\n```\n\nDuring query execution, InfluxDB passes _`params`_ to your script and substitutes the values.\n\n#### Limitations\n\n- If you use _`params`_, you can't use _`extern`_.\n" - }, - "dialect": { - "$ref": "#/components/schemas/Dialect" - }, - "now": { - "description": "Specifies the time that should be reported as `now` in the query.\nDefault is the server `now` time.\n", - "type": "string", - "format": "date-time" - } - } - }, "Package": { "description": "Represents a complete package source tree.", "type": "object", @@ -21822,6 +21819,42 @@ } } }, + "Query": { + "description": "Query InfluxDB with the Flux language", + "type": "object", + "required": [ + "query" + ], + "properties": { + "extern": { + "$ref": "#/components/schemas/File" + }, + "query": { + "description": "The query script to execute.", + "type": "string" + }, + "type": { + "description": "The type of query. Must be \"flux\".", + "type": "string", + "enum": [ + "flux" + ] + }, + "params": { + "type": "object", + "additionalProperties": true, + "description": "Key-value pairs passed as parameters during query execution.\n\nTo use parameters in your query, pass a _`query`_ with `params` references (in dot notation)--for example:\n\n```json\n query: \"from(bucket: params.mybucket)\\\n |> range(start: params.rangeStart) |> limit(n:1)\"\n```\n\nand pass _`params`_ with the key-value pairs--for example:\n\n```json\n params: {\n \"mybucket\": \"environment\",\n \"rangeStart\": \"-30d\"\n }\n```\n\nDuring query execution, InfluxDB passes _`params`_ to your script and substitutes the values.\n\n#### Limitations\n\n- If you use _`params`_, you can't use _`extern`_.\n" + }, + "dialect": { + "$ref": "#/components/schemas/Dialect" + }, + "now": { + "description": "Specifies the time that should be reported as `now` in the query.\nDefault is the server `now` time.\n", + "type": "string", + "format": "date-time" + } + } + }, "Tasks": { "type": "object", "properties": { diff --git a/contracts/cloud.yml b/contracts/cloud.yml index 5695f8df5..d04f2a88b 100644 --- a/contracts/cloud.yml +++ b/contracts/cloud.yml @@ -4077,7 +4077,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/Query' + $ref: '#/paths/~1query/post/requestBody/content/application~1json/schema' responses: '200': description: | @@ -4263,7 +4263,56 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/Query' + description: Query InfluxDB with the Flux language + type: object + required: + - query + properties: + extern: + $ref: '#/components/schemas/File' + query: + description: The query script to execute. + type: string + type: + description: The type of query. Must be "flux". + type: string + enum: + - flux + params: + type: object + additionalProperties: true + description: | + Key-value pairs passed as parameters during query execution. + + To use parameters in your query, pass a _`query`_ with `params` references (in dot notation)--for example: + + ```json + query: "from(bucket: params.mybucket)\ + |> range(start: params.rangeStart) |> limit(n:1)" + ``` + + and pass _`params`_ with the key-value pairs--for example: + + ```json + params: { + "mybucket": "environment", + "rangeStart": "-30d" + } + ``` + + During query execution, InfluxDB passes _`params`_ to your script and substitutes the values. + + #### Limitations + + - If you use _`params`_, you can't use _`extern`_. + dialect: + $ref: '#/components/schemas/Dialect' + now: + description: | + Specifies the time that should be reported as `now` in the query. + Default is the server `now` time. + type: string + format: date-time application/vnd.flux: schema: type: string @@ -11326,57 +11375,6 @@ components: description: | The Flux query script to be analyzed. type: string - Query: - description: Query InfluxDB with the Flux language - type: object - required: - - query - properties: - extern: - $ref: '#/components/schemas/File' - query: - description: The query script to execute. - type: string - type: - description: The type of query. Must be "flux". - type: string - enum: - - flux - params: - type: object - additionalProperties: true - description: | - Key-value pairs passed as parameters during query execution. - - To use parameters in your query, pass a _`query`_ with `params` references (in dot notation)--for example: - - ```json - query: "from(bucket: params.mybucket)\ - |> range(start: params.rangeStart) |> limit(n:1)" - ``` - - and pass _`params`_ with the key-value pairs--for example: - - ```json - params: { - "mybucket": "environment", - "rangeStart": "-30d" - } - ``` - - During query execution, InfluxDB passes _`params`_ to your script and substitutes the values. - - #### Limitations - - - If you use _`params`_, you can't use _`extern`_. - dialect: - $ref: '#/components/schemas/Dialect' - now: - description: | - Specifies the time that should be reported as `now` in the query. - Default is the server `now` time. - type: string - format: date-time Package: description: Represents a complete package source tree. type: object @@ -17227,6 +17225,57 @@ components: type: array items: $ref: '#/components/schemas/MeasurementSchemaColumn' + Query: + description: Query InfluxDB with the Flux language + type: object + required: + - query + properties: + extern: + $ref: '#/components/schemas/File' + query: + description: The query script to execute. + type: string + type: + description: The type of query. Must be "flux". + type: string + enum: + - flux + params: + type: object + additionalProperties: true + description: | + Key-value pairs passed as parameters during query execution. + + To use parameters in your query, pass a _`query`_ with `params` references (in dot notation)--for example: + + ```json + query: "from(bucket: params.mybucket)\ + |> range(start: params.rangeStart) |> limit(n:1)" + ``` + + and pass _`params`_ with the key-value pairs--for example: + + ```json + params: { + "mybucket": "environment", + "rangeStart": "-30d" + } + ``` + + During query execution, InfluxDB passes _`params`_ to your script and substitutes the values. + + #### Limitations + + - If you use _`params`_, you can't use _`extern`_. + dialect: + $ref: '#/components/schemas/Dialect' + now: + description: | + Specifies the time that should be reported as `now` in the query. + Default is the server `now` time. + type: string + format: date-time Tasks: type: object properties: diff --git a/contracts/common.yml b/contracts/common.yml index 2f96a1370..44b2cc687 100644 --- a/contracts/common.yml +++ b/contracts/common.yml @@ -3786,7 +3786,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/Query' + $ref: '#/paths/~1query/post/requestBody/content/application~1json/schema' responses: '200': description: | @@ -3972,7 +3972,56 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/Query' + description: Query InfluxDB with the Flux language + type: object + required: + - query + properties: + extern: + $ref: '#/components/schemas/File' + query: + description: The query script to execute. + type: string + type: + description: The type of query. Must be "flux". + type: string + enum: + - flux + params: + type: object + additionalProperties: true + description: | + Key-value pairs passed as parameters during query execution. + + To use parameters in your query, pass a _`query`_ with `params` references (in dot notation)--for example: + + ```json + query: "from(bucket: params.mybucket)\ + |> range(start: params.rangeStart) |> limit(n:1)" + ``` + + and pass _`params`_ with the key-value pairs--for example: + + ```json + params: { + "mybucket": "environment", + "rangeStart": "-30d" + } + ``` + + During query execution, InfluxDB passes _`params`_ to your script and substitutes the values. + + #### Limitations + + - If you use _`params`_, you can't use _`extern`_. + dialect: + $ref: '#/components/schemas/Dialect' + now: + description: | + Specifies the time that should be reported as `now` in the query. + Default is the server `now` time. + type: string + format: date-time application/vnd.flux: schema: type: string @@ -9433,57 +9482,6 @@ components: description: | The Flux query script to be analyzed. type: string - Query: - description: Query InfluxDB with the Flux language - type: object - required: - - query - properties: - extern: - $ref: '#/components/schemas/File' - query: - description: The query script to execute. - type: string - type: - description: The type of query. Must be "flux". - type: string - enum: - - flux - params: - type: object - additionalProperties: true - description: | - Key-value pairs passed as parameters during query execution. - - To use parameters in your query, pass a _`query`_ with `params` references (in dot notation)--for example: - - ```json - query: "from(bucket: params.mybucket)\ - |> range(start: params.rangeStart) |> limit(n:1)" - ``` - - and pass _`params`_ with the key-value pairs--for example: - - ```json - params: { - "mybucket": "environment", - "rangeStart": "-30d" - } - ``` - - During query execution, InfluxDB passes _`params`_ to your script and substitutes the values. - - #### Limitations - - - If you use _`params`_, you can't use _`extern`_. - dialect: - $ref: '#/components/schemas/Dialect' - now: - description: | - Specifies the time that should be reported as `now` in the query. - Default is the server `now` time. - type: string - format: date-time Package: description: Represents a complete package source tree. type: object diff --git a/contracts/oss-diff.yml b/contracts/oss-diff.yml index bac1d334b..beeb7beeb 100644 --- a/contracts/oss-diff.yml +++ b/contracts/oss-diff.yml @@ -5882,6 +5882,425 @@ components: - bucketName - defaultRetentionPolicy - retentionPolicies + Query: + description: Query InfluxDB with the Flux language + type: object + required: + - query + properties: + extern: + description: Represents a source from a single file + type: object + properties: + type: + description: Type of AST node + type: string + name: + description: The name of the file. + type: string + package: + description: Defines a package identifier + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + name: + description: A valid Flux identifier + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + name: + type: string + imports: + description: A list of package imports + type: array + items: + description: Declares a package import + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + as: + $ref: '#/components/schemas/Query/properties/extern/properties/package/properties/name' + path: + description: Expressions begin and end with double quote marks + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + value: + type: string + body: + description: List of Flux statements + type: array + items: + oneOf: + - description: A placeholder for statements for which no correct statement nodes can be created + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + text: + description: Raw source text + type: string + - description: Represents the declaration of a variable + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + id: + $ref: '#/components/schemas/Query/properties/extern/properties/package/properties/name' + init: + oneOf: + - description: Used to create and directly specify the elements of an array object + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + elements: + description: Elements of the array + type: array + items: + $ref: '#/components/schemas/Query/properties/extern/properties/body/items/oneOf/1/properties/init' + - description: Used to create and directly specify the elements of a dictionary + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + elements: + description: Elements of the dictionary + type: array + items: + description: A key-value pair in a dictionary. + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + key: + $ref: '#/components/schemas/Query/properties/extern/properties/body/items/oneOf/1/properties/init' + val: + $ref: '#/components/schemas/Query/properties/extern/properties/body/items/oneOf/1/properties/init' + - description: Function expression + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + params: + description: Function parameters + type: array + items: + description: The value associated with a key + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + key: + oneOf: + - $ref: '#/components/schemas/Query/properties/extern/properties/package/properties/name' + - $ref: '#/components/schemas/Query/properties/extern/properties/imports/items/properties/path' + value: + $ref: '#/components/schemas/Query/properties/extern/properties/body/items/oneOf/1/properties/init' + body: + oneOf: + - $ref: '#/components/schemas/Query/properties/extern/properties/body/items/oneOf/1/properties/init' + - description: A set of statements + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + body: + description: Block body + type: array + items: + $ref: '#/components/schemas/Query/properties/extern/properties/body/items' + - description: uses binary operators to act on two operands in an expression + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + operator: + type: string + left: + $ref: '#/components/schemas/Query/properties/extern/properties/body/items/oneOf/1/properties/init' + right: + $ref: '#/components/schemas/Query/properties/extern/properties/body/items/oneOf/1/properties/init' + - description: Represents a function call + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + callee: + $ref: '#/components/schemas/Query/properties/extern/properties/body/items/oneOf/1/properties/init' + arguments: + description: Function arguments + type: array + items: + $ref: '#/components/schemas/Query/properties/extern/properties/body/items/oneOf/1/properties/init' + - description: 'Selects one of two expressions, `Alternate` or `Consequent`, depending on a third boolean expression, `Test`' + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + test: + $ref: '#/components/schemas/Query/properties/extern/properties/body/items/oneOf/1/properties/init' + alternate: + $ref: '#/components/schemas/Query/properties/extern/properties/body/items/oneOf/1/properties/init' + consequent: + $ref: '#/components/schemas/Query/properties/extern/properties/body/items/oneOf/1/properties/init' + - description: Represents the rule conditions that collectively evaluate to either true or false + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + operator: + type: string + left: + $ref: '#/components/schemas/Query/properties/extern/properties/body/items/oneOf/1/properties/init' + right: + $ref: '#/components/schemas/Query/properties/extern/properties/body/items/oneOf/1/properties/init' + - description: Represents accessing a property of an object + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + object: + $ref: '#/components/schemas/Query/properties/extern/properties/body/items/oneOf/1/properties/init' + property: + $ref: '#/components/schemas/Query/properties/extern/properties/body/items/oneOf/1/properties/init/oneOf/0/properties/elements/items/oneOf/1/properties/elements/items/properties/key/oneOf/2/properties/params/items/properties/key' + - description: Represents indexing into an array + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + array: + $ref: '#/components/schemas/Query/properties/extern/properties/body/items/oneOf/1/properties/init' + index: + $ref: '#/components/schemas/Query/properties/extern/properties/body/items/oneOf/1/properties/init' + - description: Allows the declaration of an anonymous object within a declaration + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + properties: + description: Object properties + type: array + items: + $ref: '#/components/schemas/Query/properties/extern/properties/body/items/oneOf/1/properties/init/oneOf/0/properties/elements/items/oneOf/1/properties/elements/items/properties/key/oneOf/2/properties/params/items' + - description: Represents an expression wrapped in parenthesis + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + expression: + $ref: '#/components/schemas/Query/properties/extern/properties/body/items/oneOf/1/properties/init' + - description: Call expression with pipe argument + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + argument: + $ref: '#/components/schemas/Query/properties/extern/properties/body/items/oneOf/1/properties/init' + call: + $ref: '#/components/schemas/Query/properties/extern/properties/body/items/oneOf/1/properties/init/oneOf/4' + - description: Uses operators to act on a single operand in an expression + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + operator: + type: string + argument: + $ref: '#/components/schemas/Query/properties/extern/properties/body/items/oneOf/1/properties/init' + - description: Represents boolean values + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + value: + type: boolean + - description: 'Represents an instant in time with nanosecond precision in [RFC3339Nano date/time format]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#rfc3339nano-timestamp).' + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + value: + type: string + format: date-time + - description: Represents the elapsed time between two instants as an int64 nanosecond count with syntax of golang's time.Duration + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + values: + description: Duration values + type: array + items: + description: A pair consisting of length of time and the unit of time measured. It is the atomic unit from which all duration literals are composed. + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + magnitude: + type: integer + unit: + type: string + - description: Represents floating point numbers according to the double representations defined by the IEEE-754-1985 + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + value: + type: number + - description: Represents integer numbers + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + value: + type: string + - description: 'Represents a specialized literal value, indicating the left hand value of a pipe expression' + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + - description: Expressions begin and end with `/` and are regular expressions with syntax accepted by RE2 + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + value: + type: string + - $ref: '#/components/schemas/Query/properties/extern/properties/imports/items/properties/path' + - description: Represents integer numbers + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + value: + type: string + - $ref: '#/components/schemas/Query/properties/extern/properties/package/properties/name' + - description: Object property assignment + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + member: + $ref: '#/components/schemas/Query/properties/extern/properties/body/items/oneOf/1/properties/init/oneOf/7' + init: + $ref: '#/components/schemas/Query/properties/extern/properties/body/items/oneOf/1/properties/init' + - description: May consist of an expression that doesn't return a value and is executed solely for its side-effects + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + expression: + $ref: '#/components/schemas/Query/properties/extern/properties/body/items/oneOf/1/properties/init' + - description: Defines an expression to return + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + argument: + $ref: '#/components/schemas/Query/properties/extern/properties/body/items/oneOf/1/properties/init' + - description: A single variable declaration + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + assignment: + oneOf: + - $ref: '#/components/schemas/Query/properties/extern/properties/body/items/oneOf/1' + - $ref: '#/components/schemas/Query/properties/extern/properties/body/items/oneOf/2' + - description: Declares a builtin identifier and its type + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + id: + $ref: '#/components/schemas/Query/properties/extern/properties/package/properties/name' + - description: Declares a Flux test case + type: object + properties: + type: + $ref: '#/components/schemas/Query/properties/extern/properties/type' + assignment: + $ref: '#/components/schemas/Query/properties/extern/properties/body/items/oneOf/1' + query: + description: The query script to execute. + type: string + type: + description: The type of query. Must be "flux". + type: string + enum: + - flux + dialect: + description: | + Options for tabular data output. + Default output is [annotated CSV]({{% INFLUXDB_DOCS_URL %}}/reference/syntax/annotated-csv/#csv-response-format) with headers. + + For more information about tabular data **dialect**, + see [W3 metadata vocabulary for tabular data](https://www.w3.org/TR/2015/REC-tabular-metadata-20151217/#dialect-descriptions). + type: object + properties: + header: + description: 'If true, the results contain a header row.' + type: boolean + default: true + delimiter: + description: 'The separator used between cells. Default is a comma (`,`).' + type: string + default: ',' + maxLength: 1 + minLength: 1 + annotations: + description: | + Annotation rows to include in the results. + An _annotation_ is metadata associated with an object (column) in the data model. + + #### Related guides + + - See [Annotated CSV annotations]({{% INFLUXDB_DOCS_URL %}}/reference/syntax/annotated-csv/#annotations) for examples and more information. + + For more information about **annotations** in tabular data, + see [W3 metadata vocabulary for tabular data](https://www.w3.org/TR/2015/REC-tabular-data-model-20151217/#columns). + type: array + uniqueItems: true + items: + type: string + enum: + - group + - datatype + - default + commentPrefix: + description: The character prefixed to comment strings. Default is a number sign (`#`). + type: string + default: '#' + maxLength: 1 + minLength: 0 + dateTimeFormat: + description: | + The format for timestamps in results. + Default is [`RFC3339` date/time format]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#rfc3339-timestamp). + To include nanoseconds in timestamps, use `RFC3339Nano`. + + #### Example formatted date/time values + + | Format | Value | + |:------------|:----------------------------| + | `RFC3339` | `"2006-01-02T15:04:05Z07:00"` | + | `RFC3339Nano` | `"2006-01-02T15:04:05.999999999Z07:00"` | + type: string + default: RFC3339 + enum: + - RFC3339 + - RFC3339Nano + now: + description: | + Specifies the time that should be reported as `now` in the query. + Default is the server `now` time. + type: string + format: date-time RetentionPolicyManifests: type: array items: diff --git a/contracts/oss.json b/contracts/oss.json index 7710ad58e..624f13724 100644 --- a/contracts/oss.json +++ b/contracts/oss.json @@ -5018,7 +5018,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Query" + "$ref": "#/paths/~1query/post/requestBody/content/application~1json/schema" } } } @@ -5197,7 +5197,40 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Query" + "description": "Query InfluxDB with the Flux language", + "type": "object", + "required": [ + "query" + ], + "properties": { + "extern": { + "$ref": "#/components/schemas/File" + }, + "query": { + "description": "The query script to execute.", + "type": "string" + }, + "type": { + "description": "The type of query. Must be \"flux\".", + "type": "string", + "enum": [ + "flux" + ] + }, + "params": { + "type": "object", + "additionalProperties": true, + "description": "Key-value pairs passed as parameters during query execution.\n\nTo use parameters in your query, pass a _`query`_ with `params` references (in dot notation)--for example:\n\n```json\n query: \"from(bucket: params.mybucket)\\\n |> range(start: params.rangeStart) |> limit(n:1)\"\n```\n\nand pass _`params`_ with the key-value pairs--for example:\n\n```json\n params: {\n \"mybucket\": \"environment\",\n \"rangeStart\": \"-30d\"\n }\n```\n\nDuring query execution, InfluxDB passes _`params`_ to your script and substitutes the values.\n\n#### Limitations\n\n- If you use _`params`_, you can't use _`extern`_.\n" + }, + "dialect": { + "$ref": "#/components/schemas/Dialect" + }, + "now": { + "description": "Specifies the time that should be reported as `now` in the query.\nDefault is the server `now` time.\n", + "type": "string", + "format": "date-time" + } + } } }, "application/vnd.flux": { @@ -15981,42 +16014,6 @@ } } }, - "Query": { - "description": "Query InfluxDB with the Flux language", - "type": "object", - "required": [ - "query" - ], - "properties": { - "extern": { - "$ref": "#/components/schemas/File" - }, - "query": { - "description": "The query script to execute.", - "type": "string" - }, - "type": { - "description": "The type of query. Must be \"flux\".", - "type": "string", - "enum": [ - "flux" - ] - }, - "params": { - "type": "object", - "additionalProperties": true, - "description": "Key-value pairs passed as parameters during query execution.\n\nTo use parameters in your query, pass a _`query`_ with `params` references (in dot notation)--for example:\n\n```json\n query: \"from(bucket: params.mybucket)\\\n |> range(start: params.rangeStart) |> limit(n:1)\"\n```\n\nand pass _`params`_ with the key-value pairs--for example:\n\n```json\n params: {\n \"mybucket\": \"environment\",\n \"rangeStart\": \"-30d\"\n }\n```\n\nDuring query execution, InfluxDB passes _`params`_ to your script and substitutes the values.\n\n#### Limitations\n\n- If you use _`params`_, you can't use _`extern`_.\n" - }, - "dialect": { - "$ref": "#/components/schemas/Dialect" - }, - "now": { - "description": "Specifies the time that should be reported as `now` in the query.\nDefault is the server `now` time.\n", - "type": "string", - "format": "date-time" - } - } - }, "Package": { "description": "Represents a complete package source tree.", "type": "object", @@ -24023,6 +24020,37 @@ "retentionPolicies" ] }, + "Query": { + "description": "Query InfluxDB with the Flux language", + "type": "object", + "required": [ + "query" + ], + "properties": { + "extern": { + "$ref": "#/components/schemas/File" + }, + "query": { + "description": "The query script to execute.", + "type": "string" + }, + "type": { + "description": "The type of query. Must be \"flux\".", + "type": "string", + "enum": [ + "flux" + ] + }, + "dialect": { + "$ref": "#/components/schemas/Dialect" + }, + "now": { + "description": "Specifies the time that should be reported as `now` in the query.\nDefault is the server `now` time.\n", + "type": "string", + "format": "date-time" + } + } + }, "RetentionPolicyManifests": { "type": "array", "items": { diff --git a/contracts/oss.yml b/contracts/oss.yml index dd4c129b9..cde12f059 100644 --- a/contracts/oss.yml +++ b/contracts/oss.yml @@ -4065,7 +4065,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/Query' + $ref: '#/paths/~1query/post/requestBody/content/application~1json/schema' responses: '200': description: | @@ -4251,7 +4251,56 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/Query' + description: Query InfluxDB with the Flux language + type: object + required: + - query + properties: + extern: + $ref: '#/components/schemas/File' + query: + description: The query script to execute. + type: string + type: + description: The type of query. Must be "flux". + type: string + enum: + - flux + params: + type: object + additionalProperties: true + description: | + Key-value pairs passed as parameters during query execution. + + To use parameters in your query, pass a _`query`_ with `params` references (in dot notation)--for example: + + ```json + query: "from(bucket: params.mybucket)\ + |> range(start: params.rangeStart) |> limit(n:1)" + ``` + + and pass _`params`_ with the key-value pairs--for example: + + ```json + params: { + "mybucket": "environment", + "rangeStart": "-30d" + } + ``` + + During query execution, InfluxDB passes _`params`_ to your script and substitutes the values. + + #### Limitations + + - If you use _`params`_, you can't use _`extern`_. + dialect: + $ref: '#/components/schemas/Dialect' + now: + description: | + Specifies the time that should be reported as `now` in the query. + Default is the server `now` time. + type: string + format: date-time application/vnd.flux: schema: type: string @@ -12842,57 +12891,6 @@ components: description: | The Flux query script to be analyzed. type: string - Query: - description: Query InfluxDB with the Flux language - type: object - required: - - query - properties: - extern: - $ref: '#/components/schemas/File' - query: - description: The query script to execute. - type: string - type: - description: The type of query. Must be "flux". - type: string - enum: - - flux - params: - type: object - additionalProperties: true - description: | - Key-value pairs passed as parameters during query execution. - - To use parameters in your query, pass a _`query`_ with `params` references (in dot notation)--for example: - - ```json - query: "from(bucket: params.mybucket)\ - |> range(start: params.rangeStart) |> limit(n:1)" - ``` - - and pass _`params`_ with the key-value pairs--for example: - - ```json - params: { - "mybucket": "environment", - "rangeStart": "-30d" - } - ``` - - During query execution, InfluxDB passes _`params`_ to your script and substitutes the values. - - #### Limitations - - - If you use _`params`_, you can't use _`extern`_. - dialect: - $ref: '#/components/schemas/Dialect' - now: - description: | - Specifies the time that should be reported as `now` in the query. - Default is the server `now` time. - type: string - format: date-time Package: description: Represents a complete package source tree. type: object @@ -18621,6 +18619,30 @@ components: - bucketName - defaultRetentionPolicy - retentionPolicies + Query: + description: Query InfluxDB with the Flux language + type: object + required: + - query + properties: + extern: + $ref: '#/components/schemas/File' + query: + description: The query script to execute. + type: string + type: + description: The type of query. Must be "flux". + type: string + enum: + - flux + dialect: + $ref: '#/components/schemas/Dialect' + now: + description: | + Specifies the time that should be reported as `now` in the query. + Default is the server `now` time. + type: string + format: date-time RetentionPolicyManifests: type: array items: diff --git a/contracts/ref/cloud.yml b/contracts/ref/cloud.yml index cbd4ec568..73427a912 100644 --- a/contracts/ref/cloud.yml +++ b/contracts/ref/cloud.yml @@ -12636,7 +12636,56 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/Query' + description: Query InfluxDB with the Flux language + properties: + dialect: + $ref: '#/components/schemas/Dialect' + extern: + $ref: '#/components/schemas/File' + now: + description: | + Specifies the time that should be reported as `now` in the query. + Default is the server `now` time. + format: date-time + type: string + params: + additionalProperties: true + description: | + Key-value pairs passed as parameters during query execution. + + To use parameters in your query, pass a _`query`_ with `params` references (in dot notation)--for example: + + ```json + query: "from(bucket: params.mybucket)\ + |> range(start: params.rangeStart) |> limit(n:1)" + ``` + + and pass _`params`_ with the key-value pairs--for example: + + ```json + params: { + "mybucket": "environment", + "rangeStart": "-30d" + } + ``` + + During query execution, InfluxDB passes _`params`_ to your script and substitutes the values. + + #### Limitations + + - If you use _`params`_, you can't use _`extern`_. + type: object + query: + description: The query script to execute. + type: string + type: + description: The type of query. Must be "flux". + enum: + - flux + type: string + required: + - query + type: object application/vnd.flux: example: | from(bucket: "example-bucket") @@ -12781,7 +12830,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/Query' + $ref: '#/paths/~1query/post/requestBody/content/application~1json/schema' description: Flux query to analyze responses: "200": diff --git a/contracts/ref/oss.yml b/contracts/ref/oss.yml index e55feeab1..364cd4cac 100644 --- a/contracts/ref/oss.yml +++ b/contracts/ref/oss.yml @@ -3556,33 +3556,6 @@ components: Default is the server `now` time. format: date-time type: string - params: - additionalProperties: true - description: | - Key-value pairs passed as parameters during query execution. - - To use parameters in your query, pass a _`query`_ with `params` references (in dot notation)--for example: - - ```json - query: "from(bucket: params.mybucket)\ - |> range(start: params.rangeStart) |> limit(n:1)" - ``` - - and pass _`params`_ with the key-value pairs--for example: - - ```json - params: { - "mybucket": "environment", - "rangeStart": "-30d" - } - ``` - - During query execution, InfluxDB passes _`params`_ to your script and substitutes the values. - - #### Limitations - - - If you use _`params`_, you can't use _`extern`_. - type: object query: description: The query script to execute. type: string @@ -13132,7 +13105,56 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/Query' + description: Query InfluxDB with the Flux language + properties: + dialect: + $ref: '#/components/schemas/Dialect' + extern: + $ref: '#/components/schemas/File' + now: + description: | + Specifies the time that should be reported as `now` in the query. + Default is the server `now` time. + format: date-time + type: string + params: + additionalProperties: true + description: | + Key-value pairs passed as parameters during query execution. + + To use parameters in your query, pass a _`query`_ with `params` references (in dot notation)--for example: + + ```json + query: "from(bucket: params.mybucket)\ + |> range(start: params.rangeStart) |> limit(n:1)" + ``` + + and pass _`params`_ with the key-value pairs--for example: + + ```json + params: { + "mybucket": "environment", + "rangeStart": "-30d" + } + ``` + + During query execution, InfluxDB passes _`params`_ to your script and substitutes the values. + + #### Limitations + + - If you use _`params`_, you can't use _`extern`_. + type: object + query: + description: The query script to execute. + type: string + type: + description: The type of query. Must be "flux". + enum: + - flux + type: string + required: + - query + type: object application/vnd.flux: example: | from(bucket: "example-bucket") @@ -13277,7 +13299,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/Query' + $ref: '#/paths/~1query/post/requestBody/content/application~1json/schema' description: Flux query to analyze responses: "200": diff --git a/src/cloud.yml b/src/cloud.yml index 080c39d7f..8d066c322 100644 --- a/src/cloud.yml +++ b/src/cloud.yml @@ -72,6 +72,8 @@ components: $ref: './cloud/schemas/MeasurementSchemaList.yml' MeasurementSchemaUpdateRequest: $ref: './cloud/schemas/MeasurementSchemaUpdateRequest.yml' + Query: + $ref: './cloud/schemas/Query.yml' Tasks: $ref: "./cloud/schemas/Tasks.yml" Task: diff --git a/src/cloud/schemas/Query.yml b/src/cloud/schemas/Query.yml new file mode 100644 index 000000000..151520c5a --- /dev/null +++ b/src/cloud/schemas/Query.yml @@ -0,0 +1,50 @@ + description: Query InfluxDB with the Flux language + type: object + required: + - query + properties: + extern: + $ref: "../../common/schemas/File.yml" + query: + description: The query script to execute. + type: string + type: + description: The type of query. Must be "flux". + type: string + enum: + - flux + params: + type: object + additionalProperties: true + description: | + Key-value pairs passed as parameters during query execution. + + To use parameters in your query, pass a _`query`_ with `params` references (in dot notation)--for example: + + ```json + query: "from(bucket: params.mybucket)\ + |> range(start: params.rangeStart) |> limit(n:1)" + ``` + + and pass _`params`_ with the key-value pairs--for example: + + ```json + params: { + "mybucket": "environment", + "rangeStart": "-30d" + } + ``` + + During query execution, InfluxDB passes _`params`_ to your script and substitutes the values. + + #### Limitations + + - If you use _`params`_, you can't use _`extern`_. + dialect: + $ref: "../../common/schemas/Dialect.yml" + now: + description: | + Specifies the time that should be reported as `now` in the query. + Default is the server `now` time. + type: string + format: date-time diff --git a/src/common/_schemas.yml b/src/common/_schemas.yml index a532d32f7..7a526f4dc 100644 --- a/src/common/_schemas.yml +++ b/src/common/_schemas.yml @@ -1,7 +1,5 @@ LanguageRequest: $ref: "./common/schemas/LanguageRequest.yml" - Query: - $ref: "./common/schemas/Query.yml" Package: $ref: "./common/schemas/Package.yml" File: diff --git a/src/oss.yml b/src/oss.yml index 59e238276..4803f8f84 100644 --- a/src/oss.yml +++ b/src/oss.yml @@ -140,6 +140,8 @@ components: $ref: "./oss/schemas/BucketMetadataManifests.yml" BucketMetadataManifest: $ref: "./oss/schemas/BucketMetadataManifest.yml" + Query: + $ref: "./oss/schemas/Query.yml" RetentionPolicyManifests: $ref: "./oss/schemas/RetentionPolicyManifests.yml" RetentionPolicyManifest: diff --git a/src/oss/schemas/Query.yml b/src/oss/schemas/Query.yml new file mode 100644 index 000000000..dff4ee1cd --- /dev/null +++ b/src/oss/schemas/Query.yml @@ -0,0 +1,23 @@ + description: Query InfluxDB with the Flux language + type: object + required: + - query + properties: + extern: + $ref: "../../common/schemas/File.yml" + query: + description: The query script to execute. + type: string + type: + description: The type of query. Must be "flux". + type: string + enum: + - flux + dialect: + $ref: "../../common/schemas/Dialect.yml" + now: + description: | + Specifies the time that should be reported as `now` in the query. + Default is the server `now` time. + type: string + format: date-time