From 6cfee0903d43b6df21413d0a4543762af4f0c340 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Tue, 21 Jul 2026 09:41:09 +0000 Subject: [PATCH] Regenerate client from commit 86a61b6 of spec repo --- .generator/schemas/v2/openapi.yaml | 482 ++++++++++++++++++ features/support/scenarios_model_mapping.ts | 14 + .../configuration.ts | 2 + .../datadog-api-client-v2/apis/DDSQLApi.ts | 374 ++++++++++++++ packages/datadog-api-client-v2/index.ts | 22 + .../models/DdsqlTabularQueryColumn.ts | 77 +++ .../models/DdsqlTabularQueryFetchRequest.ts | 54 ++ ...DdsqlTabularQueryFetchRequestAttributes.ts | 54 ++ .../DdsqlTabularQueryFetchRequestData.ts | 64 +++ .../DdsqlTabularQueryFetchRequestType.ts | 16 + .../models/DdsqlTabularQueryRequest.ts | 54 ++ .../DdsqlTabularQueryRequestAttributes.ts | 77 +++ .../models/DdsqlTabularQueryRequestData.ts | 64 +++ .../models/DdsqlTabularQueryRequestType.ts | 16 + .../models/DdsqlTabularQueryResponse.ts | 67 +++ .../DdsqlTabularQueryResponseAttributes.ts | 85 +++ .../models/DdsqlTabularQueryResponseData.ts | 74 +++ .../models/DdsqlTabularQueryResponseMeta.ts | 65 +++ .../models/DdsqlTabularQueryResponseType.ts | 16 + .../models/DdsqlTabularQueryState.ts | 21 + .../models/DdsqlTabularQueryTimeWindow.ts | 67 +++ .../models/ObjectSerializer.ts | 29 ++ 22 files changed, 1794 insertions(+) create mode 100644 packages/datadog-api-client-v2/apis/DDSQLApi.ts create mode 100644 packages/datadog-api-client-v2/models/DdsqlTabularQueryColumn.ts create mode 100644 packages/datadog-api-client-v2/models/DdsqlTabularQueryFetchRequest.ts create mode 100644 packages/datadog-api-client-v2/models/DdsqlTabularQueryFetchRequestAttributes.ts create mode 100644 packages/datadog-api-client-v2/models/DdsqlTabularQueryFetchRequestData.ts create mode 100644 packages/datadog-api-client-v2/models/DdsqlTabularQueryFetchRequestType.ts create mode 100644 packages/datadog-api-client-v2/models/DdsqlTabularQueryRequest.ts create mode 100644 packages/datadog-api-client-v2/models/DdsqlTabularQueryRequestAttributes.ts create mode 100644 packages/datadog-api-client-v2/models/DdsqlTabularQueryRequestData.ts create mode 100644 packages/datadog-api-client-v2/models/DdsqlTabularQueryRequestType.ts create mode 100644 packages/datadog-api-client-v2/models/DdsqlTabularQueryResponse.ts create mode 100644 packages/datadog-api-client-v2/models/DdsqlTabularQueryResponseAttributes.ts create mode 100644 packages/datadog-api-client-v2/models/DdsqlTabularQueryResponseData.ts create mode 100644 packages/datadog-api-client-v2/models/DdsqlTabularQueryResponseMeta.ts create mode 100644 packages/datadog-api-client-v2/models/DdsqlTabularQueryResponseType.ts create mode 100644 packages/datadog-api-client-v2/models/DdsqlTabularQueryState.ts create mode 100644 packages/datadog-api-client-v2/models/DdsqlTabularQueryTimeWindow.ts diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 61320cadad6b..dc7fca455901 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -30970,6 +30970,257 @@ components: example: 1722439510282 format: int64 type: integer + DdsqlTabularQueryColumn: + description: A single column of a DDSQL tabular query result. + properties: + name: + description: Name of the column as projected by the SQL statement. + example: service + type: string + type: + description: |- + DDSQL data type of the column's values, for example `VARCHAR`, `BIGINT`, + `DECIMAL`, `BOOLEAN`, `TIMESTAMP`, `JSON`, or an array variant such as + `VARCHAR[]`. See the + [DDSQL data-types reference](https://docs.datadoghq.com/ddsql_reference/#data-types) + for the full, up-to-date list. + example: VARCHAR + type: string + values: + description: |- + Column values in row order. The element type matches the column's `type`; + for example a `VARCHAR` column carries strings, a `TIMESTAMP` column carries + Unix-millisecond integers. `null` is allowed for missing values. + example: + - web-store + - checkout + items: {} + type: array + required: + - name + - type + - values + type: object + DdsqlTabularQueryColumns: + description: |- + Column-major result set. Each element carries one column's name, type, and values, + with one value per row of the result. Set when `state` is `completed`. + items: + $ref: "#/components/schemas/DdsqlTabularQueryColumn" + type: array + DdsqlTabularQueryFetchRequest: + description: Wrapper for a DDSQL tabular query fetch request. + properties: + data: + $ref: "#/components/schemas/DdsqlTabularQueryFetchRequestData" + required: + - data + type: object + DdsqlTabularQueryFetchRequestAttributes: + description: Attributes describing which previously submitted DDSQL query to fetch. + properties: + query_id: + description: |- + Opaque token returned by an earlier execute or fetch response that carried + `state: running`. Identifies the query to poll for results. + example: "eyJxdWVyeSI6ICJTRUxFQ1QgKiBGUk9NIGxvZ3MifQ==" + type: string + required: + - query_id + type: object + DdsqlTabularQueryFetchRequestData: + description: JSON:API resource object for a DDSQL tabular query fetch request. + properties: + attributes: + $ref: "#/components/schemas/DdsqlTabularQueryFetchRequestAttributes" + type: + $ref: "#/components/schemas/DdsqlTabularQueryFetchRequestType" + required: + - type + - attributes + type: object + DdsqlTabularQueryFetchRequestType: + default: ddsql_query_fetch_request + description: JSON:API resource type for a DDSQL tabular query fetch request. + enum: + - ddsql_query_fetch_request + example: ddsql_query_fetch_request + type: string + x-enum-varnames: + - DDSQL_QUERY_FETCH_REQUEST + DdsqlTabularQueryRequest: + description: Wrapper for a DDSQL tabular query execution request. + properties: + data: + $ref: "#/components/schemas/DdsqlTabularQueryRequestData" + required: + - data + type: object + DdsqlTabularQueryRequestAttributes: + description: Attributes describing the DDSQL query to execute. + properties: + query: + description: |- + The DDSQL statement to execute. DDSQL is Datadog's SQL dialect, which is a subset + of PostgreSQL, scoped to Datadog data sources. + example: "SELECT cloud_provider, count(*) FROM dd.hosts group by cloud_provider" + type: string + row_limit: + description: |- + Cap on the number of rows returned. Defaults to 5,000 when omitted. Must be + between 1 and 10,000 inclusive; values outside this range are rejected with 400. + example: 1000 + format: int64 + maximum: 10000 + minimum: 1 + type: integer + time: + $ref: "#/components/schemas/DdsqlTabularQueryTimeWindow" + required: + - query + - time + type: object + DdsqlTabularQueryRequestData: + description: JSON:API resource object for a DDSQL tabular query execution request. + properties: + attributes: + $ref: "#/components/schemas/DdsqlTabularQueryRequestAttributes" + type: + $ref: "#/components/schemas/DdsqlTabularQueryRequestType" + required: + - type + - attributes + type: object + DdsqlTabularQueryRequestType: + default: ddsql_query_request + description: JSON:API resource type for a DDSQL tabular query request. + enum: + - ddsql_query_request + example: ddsql_query_request + type: string + x-enum-varnames: + - DDSQL_QUERY_REQUEST + DdsqlTabularQueryResponse: + description: |- + Response envelope for both the execute and fetch DDSQL tabular query endpoints. + Carries the JSON:API primary resource and a top-level `meta` block with + request-scoped observability handles. + properties: + data: + $ref: "#/components/schemas/DdsqlTabularQueryResponseData" + meta: + $ref: "#/components/schemas/DdsqlTabularQueryResponseMeta" + required: + - data + - meta + type: object + DdsqlTabularQueryResponseAttributes: + description: |- + Attributes of a DDSQL tabular query response. `query_id` is set when + `state` is `running`; `columns` is set when `state` is `completed`. + properties: + columns: + $ref: "#/components/schemas/DdsqlTabularQueryColumns" + query_id: + description: |- + Opaque token to pass to the fetch endpoint to poll for results. + Set when `state` is `running` and absent when `state` is `completed`. + example: "eyJxdWVyeSI6ICJTRUxFQ1QgKiBGUk9NIGxvZ3MifQ==" + type: string + state: + $ref: "#/components/schemas/DdsqlTabularQueryState" + warnings: + $ref: "#/components/schemas/DdsqlTabularQueryWarnings" + required: + - state + type: object + DdsqlTabularQueryResponseData: + description: JSON:API resource object for a DDSQL tabular query response. + properties: + attributes: + $ref: "#/components/schemas/DdsqlTabularQueryResponseAttributes" + id: + description: Stable identifier for the query response resource. + example: "00000000-0000-0000-0000-000000000000" + type: string + type: + $ref: "#/components/schemas/DdsqlTabularQueryResponseType" + required: + - id + - type + - attributes + type: object + DdsqlTabularQueryResponseMeta: + description: |- + Top-level JSON:API meta block accompanying every DDSQL tabular query response. + Carries standard observability handles for client-side correlation. + properties: + elapsed: + description: Server-side time spent serving this request, in milliseconds. + example: 87 + format: int64 + type: integer + request_id: + description: |- + Echo of the `DD-Request-ID` header assigned by Datadog's edge to this request, + for support correlation. + example: "req-7f3e7d2c-1a0b-4d3e-9b2a-3c4d5e6f7082" + type: string + required: + - elapsed + - request_id + type: object + DdsqlTabularQueryResponseType: + default: ddsql_query_response + description: JSON:API resource type for a DDSQL tabular query response. + enum: + - ddsql_query_response + example: ddsql_query_response + type: string + x-enum-varnames: + - DDSQL_QUERY_RESPONSE + DdsqlTabularQueryState: + description: |- + Lifecycle state of a DDSQL tabular query response. + `running` means the query is still executing and the client should poll + the fetch endpoint with the returned `query_id`. `completed` means the + result set is inlined in `columns` and no further polling is required. + enum: + - running + - completed + example: completed + type: string + x-enum-varnames: + - RUNNING + - COMPLETED + DdsqlTabularQueryTimeWindow: + description: |- + Time window scoping the underlying data sources, expressed in Unix milliseconds + since the epoch. Inclusive on `from_timestamp`, exclusive on `to_timestamp`. + Results from static tables (for example, `dd.hosts`) are not affected by the + time window, but the field must still be provided. + properties: + from_timestamp: + description: Start of the query window (inclusive), in Unix milliseconds since the epoch. + example: 1736942400000 + format: int64 + type: integer + to_timestamp: + description: End of the query window (exclusive), in Unix milliseconds since the epoch. + example: 1736946000000 + format: int64 + type: integer + required: + - from_timestamp + - to_timestamp + type: object + DdsqlTabularQueryWarnings: + description: Non-fatal messages emitted by the query engine while serving this response. + items: + description: A single non-fatal warning message. + example: "Query result was truncated at the configured row_limit." + type: string + type: array DefaultRulesetsPerLanguageData: description: The primary data object in the default rulesets per language response. properties: @@ -133799,6 +134050,231 @@ paths: x-unstable: |- **Note: Data Access is in preview. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).** + /api/v2/ddsql/query/tabular: + post: + description: |- + Submit a DDSQL statement and return either a `running` state with an opaque `query_id` + for the client to poll, or a `completed` state with the column-major result set inlined + when the query finishes quickly enough to be served synchronously. + operationId: ExecuteDdsqlTabularQuery + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + query: "SELECT cloud_provider, count(*) FROM dd.hosts group by cloud_provider" + row_limit: 1000 + time: + from_timestamp: 1736942400000 + to_timestamp: 1736946000000 + type: ddsql_query_request + schema: + $ref: "#/components/schemas/DdsqlTabularQueryRequest" + required: true + responses: + "200": + content: + application/json: + examples: + completed: + summary: Query finished synchronously + value: + data: + attributes: + columns: + - name: service + type: VARCHAR + values: + - web-store + - checkout + - name: count + type: BIGINT + values: + - 1024 + - 512 + state: completed + id: "00000000-0000-0000-0000-000000000000" + type: ddsql_query_response + meta: + elapsed: 318 + request_id: "req-7f3e7d2c-1a0b-4d3e-9b2a-3c4d5e6f7081" + default: + summary: Query finished synchronously + value: + data: + attributes: + columns: + - name: service + type: VARCHAR + values: + - web-store + - checkout + - name: count + type: BIGINT + values: + - 1024 + - 512 + state: completed + id: "00000000-0000-0000-0000-000000000000" + type: ddsql_query_response + meta: + elapsed: 318 + request_id: "req-7f3e7d2c-1a0b-4d3e-9b2a-3c4d5e6f7081" + running: + summary: Query still executing + value: + data: + attributes: + query_id: "eyJxdWVyeSI6ICJTRUxFQ1QgKiBGUk9NIGxvZ3MifQ==" + state: running + id: "00000000-0000-0000-0000-000000000000" + type: ddsql_query_response + meta: + elapsed: 42 + request_id: "req-7f3e7d2c-1a0b-4d3e-9b2a-3c4d5e6f7081" + schema: + $ref: "#/components/schemas/DdsqlTabularQueryResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + "500": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Internal Server Error + summary: Execute a tabular DDSQL query + tags: + - DDSQL + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/ddsql/query/tabular/fetch: + post: + description: |- + Poll a previously submitted DDSQL query for results. Pass the opaque `query_id` returned + by a prior `ExecuteDdsqlTabularQuery` (or by a prior `FetchDdsqlTabularQuery` that + returned `state: running`) and the server returns either a `running` state to poll again + or a `completed` state with the column-major result set inlined. + operationId: FetchDdsqlTabularQuery + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + query_id: "eyJxdWVyeSI6ICJTRUxFQ1QgKiBGUk9NIGxvZ3MifQ==" + type: ddsql_query_fetch_request + schema: + $ref: "#/components/schemas/DdsqlTabularQueryFetchRequest" + required: true + responses: + "200": + content: + application/json: + examples: + completed: + summary: Query finished + value: + data: + attributes: + columns: + - name: service + type: VARCHAR + values: + - web-store + - checkout + - name: count + type: BIGINT + values: + - 1024 + - 512 + state: completed + id: "00000000-0000-0000-0000-000000000000" + type: ddsql_query_response + meta: + elapsed: 87 + request_id: "req-7f3e7d2c-1a0b-4d3e-9b2a-3c4d5e6f7082" + default: + summary: Query finished + value: + data: + attributes: + columns: + - name: service + type: VARCHAR + values: + - web-store + - checkout + - name: count + type: BIGINT + values: + - 1024 + - 512 + state: completed + id: "00000000-0000-0000-0000-000000000000" + type: ddsql_query_response + meta: + elapsed: 87 + request_id: "req-7f3e7d2c-1a0b-4d3e-9b2a-3c4d5e6f7082" + running: + summary: Query still executing + value: + data: + attributes: + query_id: "eyJxdWVyeSI6ICJTRUxFQ1QgKiBGUk9NIGxvZ3MifQ==" + state: running + id: "00000000-0000-0000-0000-000000000000" + type: ddsql_query_response + meta: + elapsed: 12 + request_id: "req-7f3e7d2c-1a0b-4d3e-9b2a-3c4d5e6f7082" + schema: + $ref: "#/components/schemas/DdsqlTabularQueryResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + "500": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Internal Server Error + summary: Fetch the result of a DDSQL query + tags: + - DDSQL + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/deletion/data/{product}: post: description: Creates a data deletion request by providing a query and a timeframe targeting the proper data. @@ -201815,6 +202291,12 @@ tags: Programmatic management of a customer's Datadog organization. Use this API to perform self-service organization lifecycle actions such as disabling the authenticated org. name: Customer Org + - description: |- + Execute DDSQL queries against the Datadog data catalog and poll for their results. + Queries are dispatched asynchronously: the initial request may return a `running` state with + a `query_id`, and clients poll the fetch endpoint until the response transitions to + `completed` with a column-major result set. + name: DDSQL - description: |- Search, send, or delete events for DORA Metrics to measure and improve your software delivery performance. See the [DORA Metrics page](https://docs.datadoghq.com/dora_metrics/) for more information. diff --git a/features/support/scenarios_model_mapping.ts b/features/support/scenarios_model_mapping.ts index e5cef5aef058..11381048dacf 100644 --- a/features/support/scenarios_model_mapping.ts +++ b/features/support/scenarios_model_mapping.ts @@ -8854,6 +8854,20 @@ export const ScenariosModelMappings: {[key: string]: {[key: string]: any}} = { }, "operationResponseType": "{}", }, + "v2.ExecuteDdsqlTabularQuery": { + "body": { + "type": "DdsqlTabularQueryRequest", + "format": "", + }, + "operationResponseType": "DdsqlTabularQueryResponse", + }, + "v2.FetchDdsqlTabularQuery": { + "body": { + "type": "DdsqlTabularQueryFetchRequest", + "format": "", + }, + "operationResponseType": "DdsqlTabularQueryResponse", + }, "v2.CreateDataDeletionRequest": { "product": { "type": "string", diff --git a/packages/datadog-api-client-common/configuration.ts b/packages/datadog-api-client-common/configuration.ts index 6e452c64c2df..a426a22e53ba 100644 --- a/packages/datadog-api-client-common/configuration.ts +++ b/packages/datadog-api-client-common/configuration.ts @@ -500,6 +500,8 @@ export function createConfiguration( "v2.getAllDatasets": false, "v2.getDataset": false, "v2.updateDataset": false, + "v2.executeDdsqlTabularQuery": false, + "v2.fetchDdsqlTabularQuery": false, "v2.cancelDataDeletionRequest": false, "v2.createDataDeletionRequest": false, "v2.getDataDeletionRequests": false, diff --git a/packages/datadog-api-client-v2/apis/DDSQLApi.ts b/packages/datadog-api-client-v2/apis/DDSQLApi.ts new file mode 100644 index 000000000000..4b771bb87cb7 --- /dev/null +++ b/packages/datadog-api-client-v2/apis/DDSQLApi.ts @@ -0,0 +1,374 @@ +import { + BaseAPIRequestFactory, + RequiredError, +} from "../../datadog-api-client-common/baseapi"; +import { + Configuration, + applySecurityAuthentication, +} from "../../datadog-api-client-common/configuration"; +import { + RequestContext, + HttpMethod, + ResponseContext, +} from "../../datadog-api-client-common/http/http"; + +import { logger } from "../../../logger"; +import { ObjectSerializer } from "../models/ObjectSerializer"; +import { ApiException } from "../../datadog-api-client-common/exception"; + +import { APIErrorResponse } from "../models/APIErrorResponse"; +import { DdsqlTabularQueryFetchRequest } from "../models/DdsqlTabularQueryFetchRequest"; +import { DdsqlTabularQueryRequest } from "../models/DdsqlTabularQueryRequest"; +import { DdsqlTabularQueryResponse } from "../models/DdsqlTabularQueryResponse"; +import { JSONAPIErrorResponse } from "../models/JSONAPIErrorResponse"; + +export class DDSQLApiRequestFactory extends BaseAPIRequestFactory { + public async executeDdsqlTabularQuery( + body: DdsqlTabularQueryRequest, + _options?: Configuration + ): Promise { + const _config = _options || this.configuration; + + logger.warn("Using unstable operation 'executeDdsqlTabularQuery'"); + if (!_config.unstableOperations["v2.executeDdsqlTabularQuery"]) { + throw new Error( + "Unstable operation 'executeDdsqlTabularQuery' is disabled" + ); + } + + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError("body", "executeDdsqlTabularQuery"); + } + + // Path Params + const localVarPath = "/api/v2/ddsql/query/tabular"; + + // Make Request Context + const requestContext = _config + .getServer("v2.DDSQLApi.executeDdsqlTabularQuery") + .makeRequestContext(localVarPath, HttpMethod.POST); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Body Params + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json", + ]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = ObjectSerializer.stringify( + ObjectSerializer.serialize(body, "DdsqlTabularQueryRequest", ""), + contentType + ); + requestContext.setBody(serializedBody); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } + + public async fetchDdsqlTabularQuery( + body: DdsqlTabularQueryFetchRequest, + _options?: Configuration + ): Promise { + const _config = _options || this.configuration; + + logger.warn("Using unstable operation 'fetchDdsqlTabularQuery'"); + if (!_config.unstableOperations["v2.fetchDdsqlTabularQuery"]) { + throw new Error( + "Unstable operation 'fetchDdsqlTabularQuery' is disabled" + ); + } + + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError("body", "fetchDdsqlTabularQuery"); + } + + // Path Params + const localVarPath = "/api/v2/ddsql/query/tabular/fetch"; + + // Make Request Context + const requestContext = _config + .getServer("v2.DDSQLApi.fetchDdsqlTabularQuery") + .makeRequestContext(localVarPath, HttpMethod.POST); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Body Params + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json", + ]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = ObjectSerializer.stringify( + ObjectSerializer.serialize(body, "DdsqlTabularQueryFetchRequest", ""), + contentType + ); + requestContext.setBody(serializedBody); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } +} + +export class DDSQLApiResponseProcessor { + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to executeDdsqlTabularQuery + * @throws ApiException if the response code was not in [200, 299] + */ + public async executeDdsqlTabularQuery( + response: ResponseContext + ): Promise { + const contentType = ObjectSerializer.normalizeMediaType( + response.headers["content-type"] + ); + if (response.httpStatusCode === 200) { + const body: DdsqlTabularQueryResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "DdsqlTabularQueryResponse" + ) as DdsqlTabularQueryResponse; + return body; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 403 || + response.httpStatusCode === 500 + ) { + const bodyText = ObjectSerializer.parse( + await response.body.text(), + contentType + ); + let body: JSONAPIErrorResponse; + try { + body = ObjectSerializer.deserialize( + bodyText, + "JSONAPIErrorResponse" + ) as JSONAPIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText + ); + } + throw new ApiException( + response.httpStatusCode, + body + ); + } + if (response.httpStatusCode === 429) { + const bodyText = ObjectSerializer.parse( + await response.body.text(), + contentType + ); + let body: APIErrorResponse; + try { + body = ObjectSerializer.deserialize( + bodyText, + "APIErrorResponse" + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: DdsqlTabularQueryResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "DdsqlTabularQueryResponse", + "" + ) as DdsqlTabularQueryResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"' + ); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to fetchDdsqlTabularQuery + * @throws ApiException if the response code was not in [200, 299] + */ + public async fetchDdsqlTabularQuery( + response: ResponseContext + ): Promise { + const contentType = ObjectSerializer.normalizeMediaType( + response.headers["content-type"] + ); + if (response.httpStatusCode === 200) { + const body: DdsqlTabularQueryResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "DdsqlTabularQueryResponse" + ) as DdsqlTabularQueryResponse; + return body; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 403 || + response.httpStatusCode === 500 + ) { + const bodyText = ObjectSerializer.parse( + await response.body.text(), + contentType + ); + let body: JSONAPIErrorResponse; + try { + body = ObjectSerializer.deserialize( + bodyText, + "JSONAPIErrorResponse" + ) as JSONAPIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText + ); + } + throw new ApiException( + response.httpStatusCode, + body + ); + } + if (response.httpStatusCode === 429) { + const bodyText = ObjectSerializer.parse( + await response.body.text(), + contentType + ); + let body: APIErrorResponse; + try { + body = ObjectSerializer.deserialize( + bodyText, + "APIErrorResponse" + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: DdsqlTabularQueryResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "DdsqlTabularQueryResponse", + "" + ) as DdsqlTabularQueryResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"' + ); + } +} + +export interface DDSQLApiExecuteDdsqlTabularQueryRequest { + /** + * @type DdsqlTabularQueryRequest + */ + body: DdsqlTabularQueryRequest; +} + +export interface DDSQLApiFetchDdsqlTabularQueryRequest { + /** + * @type DdsqlTabularQueryFetchRequest + */ + body: DdsqlTabularQueryFetchRequest; +} + +export class DDSQLApi { + private requestFactory: DDSQLApiRequestFactory; + private responseProcessor: DDSQLApiResponseProcessor; + private configuration: Configuration; + + public constructor( + configuration: Configuration, + requestFactory?: DDSQLApiRequestFactory, + responseProcessor?: DDSQLApiResponseProcessor + ) { + this.configuration = configuration; + this.requestFactory = + requestFactory || new DDSQLApiRequestFactory(configuration); + this.responseProcessor = + responseProcessor || new DDSQLApiResponseProcessor(); + } + + /** + * Submit a DDSQL statement and return either a `running` state with an opaque `query_id` + * for the client to poll, or a `completed` state with the column-major result set inlined + * when the query finishes quickly enough to be served synchronously. + * @param param The request object + */ + public executeDdsqlTabularQuery( + param: DDSQLApiExecuteDdsqlTabularQueryRequest, + options?: Configuration + ): Promise { + const requestContextPromise = this.requestFactory.executeDdsqlTabularQuery( + param.body, + options + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.executeDdsqlTabularQuery( + responseContext + ); + }); + }); + } + + /** + * Poll a previously submitted DDSQL query for results. Pass the opaque `query_id` returned + * by a prior `ExecuteDdsqlTabularQuery` (or by a prior `FetchDdsqlTabularQuery` that + * returned `state: running`) and the server returns either a `running` state to poll again + * or a `completed` state with the column-major result set inlined. + * @param param The request object + */ + public fetchDdsqlTabularQuery( + param: DDSQLApiFetchDdsqlTabularQueryRequest, + options?: Configuration + ): Promise { + const requestContextPromise = this.requestFactory.fetchDdsqlTabularQuery( + param.body, + options + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.fetchDdsqlTabularQuery(responseContext); + }); + }); + } +} diff --git a/packages/datadog-api-client-v2/index.ts b/packages/datadog-api-client-v2/index.ts index 6364ae4d03f6..3efced6a0a95 100644 --- a/packages/datadog-api-client-v2/index.ts +++ b/packages/datadog-api-client-v2/index.ts @@ -434,6 +434,12 @@ export { CustomerOrgApi, } from "./apis/CustomerOrgApi"; +export { + DDSQLApiExecuteDdsqlTabularQueryRequest, + DDSQLApiFetchDdsqlTabularQueryRequest, + DDSQLApi, +} from "./apis/DDSQLApi"; + export { DORAMetricsApiCreateDORADeploymentRequest, DORAMetricsApiCreateDORAFailureRequest, @@ -3512,6 +3518,22 @@ export { DatastoreTriggerWrapper } from "./models/DatastoreTriggerWrapper"; export { DataTransform } from "./models/DataTransform"; export { DataTransformProperties } from "./models/DataTransformProperties"; export { DataTransformType } from "./models/DataTransformType"; +export { DdsqlTabularQueryColumn } from "./models/DdsqlTabularQueryColumn"; +export { DdsqlTabularQueryFetchRequest } from "./models/DdsqlTabularQueryFetchRequest"; +export { DdsqlTabularQueryFetchRequestAttributes } from "./models/DdsqlTabularQueryFetchRequestAttributes"; +export { DdsqlTabularQueryFetchRequestData } from "./models/DdsqlTabularQueryFetchRequestData"; +export { DdsqlTabularQueryFetchRequestType } from "./models/DdsqlTabularQueryFetchRequestType"; +export { DdsqlTabularQueryRequest } from "./models/DdsqlTabularQueryRequest"; +export { DdsqlTabularQueryRequestAttributes } from "./models/DdsqlTabularQueryRequestAttributes"; +export { DdsqlTabularQueryRequestData } from "./models/DdsqlTabularQueryRequestData"; +export { DdsqlTabularQueryRequestType } from "./models/DdsqlTabularQueryRequestType"; +export { DdsqlTabularQueryResponse } from "./models/DdsqlTabularQueryResponse"; +export { DdsqlTabularQueryResponseAttributes } from "./models/DdsqlTabularQueryResponseAttributes"; +export { DdsqlTabularQueryResponseData } from "./models/DdsqlTabularQueryResponseData"; +export { DdsqlTabularQueryResponseMeta } from "./models/DdsqlTabularQueryResponseMeta"; +export { DdsqlTabularQueryResponseType } from "./models/DdsqlTabularQueryResponseType"; +export { DdsqlTabularQueryState } from "./models/DdsqlTabularQueryState"; +export { DdsqlTabularQueryTimeWindow } from "./models/DdsqlTabularQueryTimeWindow"; export { DefaultRulesetsPerLanguageData } from "./models/DefaultRulesetsPerLanguageData"; export { DefaultRulesetsPerLanguageDataAttributes } from "./models/DefaultRulesetsPerLanguageDataAttributes"; export { DefaultRulesetsPerLanguageDataType } from "./models/DefaultRulesetsPerLanguageDataType"; diff --git a/packages/datadog-api-client-v2/models/DdsqlTabularQueryColumn.ts b/packages/datadog-api-client-v2/models/DdsqlTabularQueryColumn.ts new file mode 100644 index 000000000000..4b1c1395944a --- /dev/null +++ b/packages/datadog-api-client-v2/models/DdsqlTabularQueryColumn.ts @@ -0,0 +1,77 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * A single column of a DDSQL tabular query result. + */ +export class DdsqlTabularQueryColumn { + /** + * Name of the column as projected by the SQL statement. + */ + "name": string; + /** + * DDSQL data type of the column's values, for example `VARCHAR`, `BIGINT`, + * `DECIMAL`, `BOOLEAN`, `TIMESTAMP`, `JSON`, or an array variant such as + * `VARCHAR[]`. See the + * [DDSQL data-types reference](https://docs.datadoghq.com/ddsql_reference/#data-types) + * for the full, up-to-date list. + */ + "type": string; + /** + * Column values in row order. The element type matches the column's `type`; + * for example a `VARCHAR` column carries strings, a `TIMESTAMP` column carries + * Unix-millisecond integers. `null` is allowed for missing values. + */ + "values": Array; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + name: { + baseName: "name", + type: "string", + required: true, + }, + type: { + baseName: "type", + type: "string", + required: true, + }, + values: { + baseName: "values", + type: "Array", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return DdsqlTabularQueryColumn.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/DdsqlTabularQueryFetchRequest.ts b/packages/datadog-api-client-v2/models/DdsqlTabularQueryFetchRequest.ts new file mode 100644 index 000000000000..2f70e99accd8 --- /dev/null +++ b/packages/datadog-api-client-v2/models/DdsqlTabularQueryFetchRequest.ts @@ -0,0 +1,54 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ +import { DdsqlTabularQueryFetchRequestData } from "./DdsqlTabularQueryFetchRequestData"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Wrapper for a DDSQL tabular query fetch request. + */ +export class DdsqlTabularQueryFetchRequest { + /** + * JSON:API resource object for a DDSQL tabular query fetch request. + */ + "data": DdsqlTabularQueryFetchRequestData; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "DdsqlTabularQueryFetchRequestData", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return DdsqlTabularQueryFetchRequest.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/DdsqlTabularQueryFetchRequestAttributes.ts b/packages/datadog-api-client-v2/models/DdsqlTabularQueryFetchRequestAttributes.ts new file mode 100644 index 000000000000..39409d2e0d4b --- /dev/null +++ b/packages/datadog-api-client-v2/models/DdsqlTabularQueryFetchRequestAttributes.ts @@ -0,0 +1,54 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Attributes describing which previously submitted DDSQL query to fetch. + */ +export class DdsqlTabularQueryFetchRequestAttributes { + /** + * Opaque token returned by an earlier execute or fetch response that carried + * `state: running`. Identifies the query to poll for results. + */ + "queryId": string; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + queryId: { + baseName: "query_id", + type: "string", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return DdsqlTabularQueryFetchRequestAttributes.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/DdsqlTabularQueryFetchRequestData.ts b/packages/datadog-api-client-v2/models/DdsqlTabularQueryFetchRequestData.ts new file mode 100644 index 000000000000..472f36966903 --- /dev/null +++ b/packages/datadog-api-client-v2/models/DdsqlTabularQueryFetchRequestData.ts @@ -0,0 +1,64 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ +import { DdsqlTabularQueryFetchRequestAttributes } from "./DdsqlTabularQueryFetchRequestAttributes"; +import { DdsqlTabularQueryFetchRequestType } from "./DdsqlTabularQueryFetchRequestType"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * JSON:API resource object for a DDSQL tabular query fetch request. + */ +export class DdsqlTabularQueryFetchRequestData { + /** + * Attributes describing which previously submitted DDSQL query to fetch. + */ + "attributes": DdsqlTabularQueryFetchRequestAttributes; + /** + * JSON:API resource type for a DDSQL tabular query fetch request. + */ + "type": DdsqlTabularQueryFetchRequestType; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attributes: { + baseName: "attributes", + type: "DdsqlTabularQueryFetchRequestAttributes", + required: true, + }, + type: { + baseName: "type", + type: "DdsqlTabularQueryFetchRequestType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return DdsqlTabularQueryFetchRequestData.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/DdsqlTabularQueryFetchRequestType.ts b/packages/datadog-api-client-v2/models/DdsqlTabularQueryFetchRequestType.ts new file mode 100644 index 000000000000..243a31f4e505 --- /dev/null +++ b/packages/datadog-api-client-v2/models/DdsqlTabularQueryFetchRequestType.ts @@ -0,0 +1,16 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ + +import { UnparsedObject } from "../../datadog-api-client-common/util"; + +/** + * JSON:API resource type for a DDSQL tabular query fetch request. + */ + +export type DdsqlTabularQueryFetchRequestType = + | typeof DDSQL_QUERY_FETCH_REQUEST + | UnparsedObject; +export const DDSQL_QUERY_FETCH_REQUEST = "ddsql_query_fetch_request"; diff --git a/packages/datadog-api-client-v2/models/DdsqlTabularQueryRequest.ts b/packages/datadog-api-client-v2/models/DdsqlTabularQueryRequest.ts new file mode 100644 index 000000000000..954e9ce930af --- /dev/null +++ b/packages/datadog-api-client-v2/models/DdsqlTabularQueryRequest.ts @@ -0,0 +1,54 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ +import { DdsqlTabularQueryRequestData } from "./DdsqlTabularQueryRequestData"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Wrapper for a DDSQL tabular query execution request. + */ +export class DdsqlTabularQueryRequest { + /** + * JSON:API resource object for a DDSQL tabular query execution request. + */ + "data": DdsqlTabularQueryRequestData; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "DdsqlTabularQueryRequestData", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return DdsqlTabularQueryRequest.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/DdsqlTabularQueryRequestAttributes.ts b/packages/datadog-api-client-v2/models/DdsqlTabularQueryRequestAttributes.ts new file mode 100644 index 000000000000..a10b639437fe --- /dev/null +++ b/packages/datadog-api-client-v2/models/DdsqlTabularQueryRequestAttributes.ts @@ -0,0 +1,77 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ +import { DdsqlTabularQueryTimeWindow } from "./DdsqlTabularQueryTimeWindow"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Attributes describing the DDSQL query to execute. + */ +export class DdsqlTabularQueryRequestAttributes { + /** + * The DDSQL statement to execute. DDSQL is Datadog's SQL dialect, which is a subset + * of PostgreSQL, scoped to Datadog data sources. + */ + "query": string; + /** + * Cap on the number of rows returned. Defaults to 5,000 when omitted. Must be + * between 1 and 10,000 inclusive; values outside this range are rejected with 400. + */ + "rowLimit"?: number; + /** + * Time window scoping the underlying data sources, expressed in Unix milliseconds + * since the epoch. Inclusive on `from_timestamp`, exclusive on `to_timestamp`. + * Results from static tables (for example, `dd.hosts`) are not affected by the + * time window, but the field must still be provided. + */ + "time": DdsqlTabularQueryTimeWindow; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + query: { + baseName: "query", + type: "string", + required: true, + }, + rowLimit: { + baseName: "row_limit", + type: "number", + format: "int64", + }, + time: { + baseName: "time", + type: "DdsqlTabularQueryTimeWindow", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return DdsqlTabularQueryRequestAttributes.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/DdsqlTabularQueryRequestData.ts b/packages/datadog-api-client-v2/models/DdsqlTabularQueryRequestData.ts new file mode 100644 index 000000000000..0887d34a2f00 --- /dev/null +++ b/packages/datadog-api-client-v2/models/DdsqlTabularQueryRequestData.ts @@ -0,0 +1,64 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ +import { DdsqlTabularQueryRequestAttributes } from "./DdsqlTabularQueryRequestAttributes"; +import { DdsqlTabularQueryRequestType } from "./DdsqlTabularQueryRequestType"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * JSON:API resource object for a DDSQL tabular query execution request. + */ +export class DdsqlTabularQueryRequestData { + /** + * Attributes describing the DDSQL query to execute. + */ + "attributes": DdsqlTabularQueryRequestAttributes; + /** + * JSON:API resource type for a DDSQL tabular query request. + */ + "type": DdsqlTabularQueryRequestType; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attributes: { + baseName: "attributes", + type: "DdsqlTabularQueryRequestAttributes", + required: true, + }, + type: { + baseName: "type", + type: "DdsqlTabularQueryRequestType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return DdsqlTabularQueryRequestData.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/DdsqlTabularQueryRequestType.ts b/packages/datadog-api-client-v2/models/DdsqlTabularQueryRequestType.ts new file mode 100644 index 000000000000..37ad7b602e88 --- /dev/null +++ b/packages/datadog-api-client-v2/models/DdsqlTabularQueryRequestType.ts @@ -0,0 +1,16 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ + +import { UnparsedObject } from "../../datadog-api-client-common/util"; + +/** + * JSON:API resource type for a DDSQL tabular query request. + */ + +export type DdsqlTabularQueryRequestType = + | typeof DDSQL_QUERY_REQUEST + | UnparsedObject; +export const DDSQL_QUERY_REQUEST = "ddsql_query_request"; diff --git a/packages/datadog-api-client-v2/models/DdsqlTabularQueryResponse.ts b/packages/datadog-api-client-v2/models/DdsqlTabularQueryResponse.ts new file mode 100644 index 000000000000..24f1cd06ef15 --- /dev/null +++ b/packages/datadog-api-client-v2/models/DdsqlTabularQueryResponse.ts @@ -0,0 +1,67 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ +import { DdsqlTabularQueryResponseData } from "./DdsqlTabularQueryResponseData"; +import { DdsqlTabularQueryResponseMeta } from "./DdsqlTabularQueryResponseMeta"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Response envelope for both the execute and fetch DDSQL tabular query endpoints. + * Carries the JSON:API primary resource and a top-level `meta` block with + * request-scoped observability handles. + */ +export class DdsqlTabularQueryResponse { + /** + * JSON:API resource object for a DDSQL tabular query response. + */ + "data": DdsqlTabularQueryResponseData; + /** + * Top-level JSON:API meta block accompanying every DDSQL tabular query response. + * Carries standard observability handles for client-side correlation. + */ + "meta": DdsqlTabularQueryResponseMeta; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "DdsqlTabularQueryResponseData", + required: true, + }, + meta: { + baseName: "meta", + type: "DdsqlTabularQueryResponseMeta", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return DdsqlTabularQueryResponse.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/DdsqlTabularQueryResponseAttributes.ts b/packages/datadog-api-client-v2/models/DdsqlTabularQueryResponseAttributes.ts new file mode 100644 index 000000000000..a545337b1fde --- /dev/null +++ b/packages/datadog-api-client-v2/models/DdsqlTabularQueryResponseAttributes.ts @@ -0,0 +1,85 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ +import { DdsqlTabularQueryColumn } from "./DdsqlTabularQueryColumn"; +import { DdsqlTabularQueryState } from "./DdsqlTabularQueryState"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Attributes of a DDSQL tabular query response. `query_id` is set when + * `state` is `running`; `columns` is set when `state` is `completed`. + */ +export class DdsqlTabularQueryResponseAttributes { + /** + * Column-major result set. Each element carries one column's name, type, and values, + * with one value per row of the result. Set when `state` is `completed`. + */ + "columns"?: Array; + /** + * Opaque token to pass to the fetch endpoint to poll for results. + * Set when `state` is `running` and absent when `state` is `completed`. + */ + "queryId"?: string; + /** + * Lifecycle state of a DDSQL tabular query response. + * `running` means the query is still executing and the client should poll + * the fetch endpoint with the returned `query_id`. `completed` means the + * result set is inlined in `columns` and no further polling is required. + */ + "state": DdsqlTabularQueryState; + /** + * Non-fatal messages emitted by the query engine while serving this response. + */ + "warnings"?: Array; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + columns: { + baseName: "columns", + type: "Array", + }, + queryId: { + baseName: "query_id", + type: "string", + }, + state: { + baseName: "state", + type: "DdsqlTabularQueryState", + required: true, + }, + warnings: { + baseName: "warnings", + type: "Array", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return DdsqlTabularQueryResponseAttributes.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/DdsqlTabularQueryResponseData.ts b/packages/datadog-api-client-v2/models/DdsqlTabularQueryResponseData.ts new file mode 100644 index 000000000000..ac3c1ec75793 --- /dev/null +++ b/packages/datadog-api-client-v2/models/DdsqlTabularQueryResponseData.ts @@ -0,0 +1,74 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ +import { DdsqlTabularQueryResponseAttributes } from "./DdsqlTabularQueryResponseAttributes"; +import { DdsqlTabularQueryResponseType } from "./DdsqlTabularQueryResponseType"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * JSON:API resource object for a DDSQL tabular query response. + */ +export class DdsqlTabularQueryResponseData { + /** + * Attributes of a DDSQL tabular query response. `query_id` is set when + * `state` is `running`; `columns` is set when `state` is `completed`. + */ + "attributes": DdsqlTabularQueryResponseAttributes; + /** + * Stable identifier for the query response resource. + */ + "id": string; + /** + * JSON:API resource type for a DDSQL tabular query response. + */ + "type": DdsqlTabularQueryResponseType; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attributes: { + baseName: "attributes", + type: "DdsqlTabularQueryResponseAttributes", + required: true, + }, + id: { + baseName: "id", + type: "string", + required: true, + }, + type: { + baseName: "type", + type: "DdsqlTabularQueryResponseType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return DdsqlTabularQueryResponseData.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/DdsqlTabularQueryResponseMeta.ts b/packages/datadog-api-client-v2/models/DdsqlTabularQueryResponseMeta.ts new file mode 100644 index 000000000000..256f17a147b0 --- /dev/null +++ b/packages/datadog-api-client-v2/models/DdsqlTabularQueryResponseMeta.ts @@ -0,0 +1,65 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Top-level JSON:API meta block accompanying every DDSQL tabular query response. + * Carries standard observability handles for client-side correlation. + */ +export class DdsqlTabularQueryResponseMeta { + /** + * Server-side time spent serving this request, in milliseconds. + */ + "elapsed": number; + /** + * Echo of the `DD-Request-ID` header assigned by Datadog's edge to this request, + * for support correlation. + */ + "requestId": string; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + elapsed: { + baseName: "elapsed", + type: "number", + required: true, + format: "int64", + }, + requestId: { + baseName: "request_id", + type: "string", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return DdsqlTabularQueryResponseMeta.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/DdsqlTabularQueryResponseType.ts b/packages/datadog-api-client-v2/models/DdsqlTabularQueryResponseType.ts new file mode 100644 index 000000000000..eed79c41b57b --- /dev/null +++ b/packages/datadog-api-client-v2/models/DdsqlTabularQueryResponseType.ts @@ -0,0 +1,16 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ + +import { UnparsedObject } from "../../datadog-api-client-common/util"; + +/** + * JSON:API resource type for a DDSQL tabular query response. + */ + +export type DdsqlTabularQueryResponseType = + | typeof DDSQL_QUERY_RESPONSE + | UnparsedObject; +export const DDSQL_QUERY_RESPONSE = "ddsql_query_response"; diff --git a/packages/datadog-api-client-v2/models/DdsqlTabularQueryState.ts b/packages/datadog-api-client-v2/models/DdsqlTabularQueryState.ts new file mode 100644 index 000000000000..f6c0880f5eb9 --- /dev/null +++ b/packages/datadog-api-client-v2/models/DdsqlTabularQueryState.ts @@ -0,0 +1,21 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ + +import { UnparsedObject } from "../../datadog-api-client-common/util"; + +/** + * Lifecycle state of a DDSQL tabular query response. + * `running` means the query is still executing and the client should poll + * the fetch endpoint with the returned `query_id`. `completed` means the + * result set is inlined in `columns` and no further polling is required. + */ + +export type DdsqlTabularQueryState = + | typeof RUNNING + | typeof COMPLETED + | UnparsedObject; +export const RUNNING = "running"; +export const COMPLETED = "completed"; diff --git a/packages/datadog-api-client-v2/models/DdsqlTabularQueryTimeWindow.ts b/packages/datadog-api-client-v2/models/DdsqlTabularQueryTimeWindow.ts new file mode 100644 index 000000000000..2e83f8e5d944 --- /dev/null +++ b/packages/datadog-api-client-v2/models/DdsqlTabularQueryTimeWindow.ts @@ -0,0 +1,67 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Time window scoping the underlying data sources, expressed in Unix milliseconds + * since the epoch. Inclusive on `from_timestamp`, exclusive on `to_timestamp`. + * Results from static tables (for example, `dd.hosts`) are not affected by the + * time window, but the field must still be provided. + */ +export class DdsqlTabularQueryTimeWindow { + /** + * Start of the query window (inclusive), in Unix milliseconds since the epoch. + */ + "fromTimestamp": number; + /** + * End of the query window (exclusive), in Unix milliseconds since the epoch. + */ + "toTimestamp": number; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + fromTimestamp: { + baseName: "from_timestamp", + type: "number", + required: true, + format: "int64", + }, + toTimestamp: { + baseName: "to_timestamp", + type: "number", + required: true, + format: "int64", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return DdsqlTabularQueryTimeWindow.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/ObjectSerializer.ts b/packages/datadog-api-client-v2/models/ObjectSerializer.ts index 5f4990408a85..fd5865ce55c6 100644 --- a/packages/datadog-api-client-v2/models/ObjectSerializer.ts +++ b/packages/datadog-api-client-v2/models/ObjectSerializer.ts @@ -1321,6 +1321,18 @@ import { DatastoreData } from "./DatastoreData"; import { DatastoreDataAttributes } from "./DatastoreDataAttributes"; import { DatastoreTrigger } from "./DatastoreTrigger"; import { DatastoreTriggerWrapper } from "./DatastoreTriggerWrapper"; +import { DdsqlTabularQueryColumn } from "./DdsqlTabularQueryColumn"; +import { DdsqlTabularQueryFetchRequest } from "./DdsqlTabularQueryFetchRequest"; +import { DdsqlTabularQueryFetchRequestAttributes } from "./DdsqlTabularQueryFetchRequestAttributes"; +import { DdsqlTabularQueryFetchRequestData } from "./DdsqlTabularQueryFetchRequestData"; +import { DdsqlTabularQueryRequest } from "./DdsqlTabularQueryRequest"; +import { DdsqlTabularQueryRequestAttributes } from "./DdsqlTabularQueryRequestAttributes"; +import { DdsqlTabularQueryRequestData } from "./DdsqlTabularQueryRequestData"; +import { DdsqlTabularQueryResponse } from "./DdsqlTabularQueryResponse"; +import { DdsqlTabularQueryResponseAttributes } from "./DdsqlTabularQueryResponseAttributes"; +import { DdsqlTabularQueryResponseData } from "./DdsqlTabularQueryResponseData"; +import { DdsqlTabularQueryResponseMeta } from "./DdsqlTabularQueryResponseMeta"; +import { DdsqlTabularQueryTimeWindow } from "./DdsqlTabularQueryTimeWindow"; import { DefaultRulesetsPerLanguageData } from "./DefaultRulesetsPerLanguageData"; import { DefaultRulesetsPerLanguageDataAttributes } from "./DefaultRulesetsPerLanguageDataAttributes"; import { DefaultRulesetsPerLanguageResponse } from "./DefaultRulesetsPerLanguageResponse"; @@ -6036,6 +6048,10 @@ const enumsMap: { [key: string]: any[] } = { DatastoreItemConflictMode: ["fail_on_conflict", "overwrite_on_conflict"], DatastoreItemsDataType: ["items"], DatastorePrimaryKeyGenerationStrategy: ["none", "uuid"], + DdsqlTabularQueryFetchRequestType: ["ddsql_query_fetch_request"], + DdsqlTabularQueryRequestType: ["ddsql_query_request"], + DdsqlTabularQueryResponseType: ["ddsql_query_response"], + DdsqlTabularQueryState: ["running", "completed"], DefaultRulesetsPerLanguageDataType: ["defaultRulesetsPerLanguage"], DegradationDataAttributesSourceType: ["incident"], DeletedSuitesRequestType: ["delete_suites_request"], @@ -9862,6 +9878,19 @@ const typeMap: { [index: string]: any } = { DatastoreDataAttributes: DatastoreDataAttributes, DatastoreTrigger: DatastoreTrigger, DatastoreTriggerWrapper: DatastoreTriggerWrapper, + DdsqlTabularQueryColumn: DdsqlTabularQueryColumn, + DdsqlTabularQueryFetchRequest: DdsqlTabularQueryFetchRequest, + DdsqlTabularQueryFetchRequestAttributes: + DdsqlTabularQueryFetchRequestAttributes, + DdsqlTabularQueryFetchRequestData: DdsqlTabularQueryFetchRequestData, + DdsqlTabularQueryRequest: DdsqlTabularQueryRequest, + DdsqlTabularQueryRequestAttributes: DdsqlTabularQueryRequestAttributes, + DdsqlTabularQueryRequestData: DdsqlTabularQueryRequestData, + DdsqlTabularQueryResponse: DdsqlTabularQueryResponse, + DdsqlTabularQueryResponseAttributes: DdsqlTabularQueryResponseAttributes, + DdsqlTabularQueryResponseData: DdsqlTabularQueryResponseData, + DdsqlTabularQueryResponseMeta: DdsqlTabularQueryResponseMeta, + DdsqlTabularQueryTimeWindow: DdsqlTabularQueryTimeWindow, DefaultRulesetsPerLanguageData: DefaultRulesetsPerLanguageData, DefaultRulesetsPerLanguageDataAttributes: DefaultRulesetsPerLanguageDataAttributes,