diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index ed984a56d0ee..87a6ec938020 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: @@ -133778,6 +134029,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. @@ -201794,6 +202270,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/examples/v2/ddsql/ExecuteDdsqlTabularQuery.rb b/examples/v2/ddsql/ExecuteDdsqlTabularQuery.rb new file mode 100644 index 000000000000..d91423d21c3c --- /dev/null +++ b/examples/v2/ddsql/ExecuteDdsqlTabularQuery.rb @@ -0,0 +1,22 @@ +# Execute a tabular DDSQL query returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.execute_ddsql_tabular_query".to_sym] = true +end +api_instance = DatadogAPIClient::V2::DDSQLAPI.new + +body = DatadogAPIClient::V2::DdsqlTabularQueryRequest.new({ + data: DatadogAPIClient::V2::DdsqlTabularQueryRequestData.new({ + attributes: DatadogAPIClient::V2::DdsqlTabularQueryRequestAttributes.new({ + query: "SELECT cloud_provider, count(*) FROM dd.hosts group by cloud_provider", + row_limit: 1000, + time: DatadogAPIClient::V2::DdsqlTabularQueryTimeWindow.new({ + from_timestamp: 1736942400000, + to_timestamp: 1736946000000, + }), + }), + type: DatadogAPIClient::V2::DdsqlTabularQueryRequestType::DDSQL_QUERY_REQUEST, + }), +}) +p api_instance.execute_ddsql_tabular_query(body) diff --git a/examples/v2/ddsql/FetchDdsqlTabularQuery.rb b/examples/v2/ddsql/FetchDdsqlTabularQuery.rb new file mode 100644 index 000000000000..5706bb238b93 --- /dev/null +++ b/examples/v2/ddsql/FetchDdsqlTabularQuery.rb @@ -0,0 +1,17 @@ +# Fetch the result of a DDSQL query returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.fetch_ddsql_tabular_query".to_sym] = true +end +api_instance = DatadogAPIClient::V2::DDSQLAPI.new + +body = DatadogAPIClient::V2::DdsqlTabularQueryFetchRequest.new({ + data: DatadogAPIClient::V2::DdsqlTabularQueryFetchRequestData.new({ + attributes: DatadogAPIClient::V2::DdsqlTabularQueryFetchRequestAttributes.new({ + query_id: "eyJxdWVyeSI6ICJTRUxFQ1QgKiBGUk9NIGxvZ3MifQ==", + }), + type: DatadogAPIClient::V2::DdsqlTabularQueryFetchRequestType::DDSQL_QUERY_FETCH_REQUEST, + }), +}) +p api_instance.fetch_ddsql_tabular_query(body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 1dd48326e4fb..c69c88b24015 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -3109,6 +3109,12 @@ "dataset_id" => "String", "body" => "DatasetUpdateRequest", }, + "v2.ExecuteDdsqlTabularQuery" => { + "body" => "DdsqlTabularQueryRequest", + }, + "v2.FetchDdsqlTabularQuery" => { + "body" => "DdsqlTabularQueryFetchRequest", + }, "v2.CreateDataDeletionRequest" => { "product" => "String", "body" => "CreateDataDeletionRequestBody", diff --git a/features/v2/ddsql.feature b/features/v2/ddsql.feature new file mode 100644 index 000000000000..69d646eb2a03 --- /dev/null +++ b/features/v2/ddsql.feature @@ -0,0 +1,44 @@ +@endpoint(ddsql) @endpoint(ddsql-v2) +Feature: DDSQL + 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. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "DDSQL" API + + @generated @skip @team:DataDog/query-apis + Scenario: Execute a tabular DDSQL query returns "Bad Request" response + Given operation "ExecuteDdsqlTabularQuery" enabled + And new "ExecuteDdsqlTabularQuery" request + And body with 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"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/query-apis + Scenario: Execute a tabular DDSQL query returns "OK" response + Given operation "ExecuteDdsqlTabularQuery" enabled + And new "ExecuteDdsqlTabularQuery" request + And body with 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"}} + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/query-apis + Scenario: Fetch the result of a DDSQL query returns "Bad Request" response + Given operation "FetchDdsqlTabularQuery" enabled + And new "FetchDdsqlTabularQuery" request + And body with value {"data": {"attributes": {"query_id": "eyJxdWVyeSI6ICJTRUxFQ1QgKiBGUk9NIGxvZ3MifQ=="}, "type": "ddsql_query_fetch_request"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/query-apis + Scenario: Fetch the result of a DDSQL query returns "OK" response + Given operation "FetchDdsqlTabularQuery" enabled + And new "FetchDdsqlTabularQuery" request + And body with value {"data": {"attributes": {"query_id": "eyJxdWVyeSI6ICJTRUxFQ1QgKiBGUk9NIGxvZ3MifQ=="}, "type": "ddsql_query_fetch_request"}} + When the request is sent + Then the response status is 200 OK diff --git a/features/v2/undo.json b/features/v2/undo.json index f7316aecda2c..57e16ea1a64a 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -2285,6 +2285,18 @@ "type": "idempotent" } }, + "ExecuteDdsqlTabularQuery": { + "tag": "DDSQL", + "undo": { + "type": "idempotent" + } + }, + "FetchDdsqlTabularQuery": { + "tag": "DDSQL", + "undo": { + "type": "safe" + } + }, "CreateDataDeletionRequest": { "tag": "Data Deletion", "undo": { diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index 5871db98c921..fb9832d3cdd8 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -467,6 +467,8 @@ def initialize "v2.get_all_datasets": false, "v2.get_dataset": false, "v2.update_dataset": false, + "v2.execute_ddsql_tabular_query": false, + "v2.fetch_ddsql_tabular_query": false, "v2.cancel_data_deletion_request": false, "v2.create_data_deletion_request": false, "v2.get_data_deletion_requests": false, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 66e0a09efc1b..6f3fc87951cd 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -2829,6 +2829,22 @@ def overrides "v2.data_transform" => "DataTransform", "v2.data_transform_properties" => "DataTransformProperties", "v2.data_transform_type" => "DataTransformType", + "v2.ddsql_tabular_query_column" => "DdsqlTabularQueryColumn", + "v2.ddsql_tabular_query_fetch_request" => "DdsqlTabularQueryFetchRequest", + "v2.ddsql_tabular_query_fetch_request_attributes" => "DdsqlTabularQueryFetchRequestAttributes", + "v2.ddsql_tabular_query_fetch_request_data" => "DdsqlTabularQueryFetchRequestData", + "v2.ddsql_tabular_query_fetch_request_type" => "DdsqlTabularQueryFetchRequestType", + "v2.ddsql_tabular_query_request" => "DdsqlTabularQueryRequest", + "v2.ddsql_tabular_query_request_attributes" => "DdsqlTabularQueryRequestAttributes", + "v2.ddsql_tabular_query_request_data" => "DdsqlTabularQueryRequestData", + "v2.ddsql_tabular_query_request_type" => "DdsqlTabularQueryRequestType", + "v2.ddsql_tabular_query_response" => "DdsqlTabularQueryResponse", + "v2.ddsql_tabular_query_response_attributes" => "DdsqlTabularQueryResponseAttributes", + "v2.ddsql_tabular_query_response_data" => "DdsqlTabularQueryResponseData", + "v2.ddsql_tabular_query_response_meta" => "DdsqlTabularQueryResponseMeta", + "v2.ddsql_tabular_query_response_type" => "DdsqlTabularQueryResponseType", + "v2.ddsql_tabular_query_state" => "DdsqlTabularQueryState", + "v2.ddsql_tabular_query_time_window" => "DdsqlTabularQueryTimeWindow", "v2.default_rulesets_per_language_data" => "DefaultRulesetsPerLanguageData", "v2.default_rulesets_per_language_data_attributes" => "DefaultRulesetsPerLanguageDataAttributes", "v2.default_rulesets_per_language_data_type" => "DefaultRulesetsPerLanguageDataType", @@ -8146,6 +8162,7 @@ def overrides "v2.data_deletion_api" => "DataDeletionAPI", "v2.data_observability_api" => "DataObservabilityAPI", "v2.datasets_api" => "DatasetsAPI", + "v2.ddsql_api" => "DDSQLAPI", "v2.deployment_gates_api" => "DeploymentGatesAPI", "v2.domain_allowlist_api" => "DomainAllowlistAPI", "v2.dora_metrics_api" => "DORAMetricsAPI", diff --git a/lib/datadog_api_client/v2/api/ddsql_api.rb b/lib/datadog_api_client/v2/api/ddsql_api.rb new file mode 100644 index 000000000000..fbe77f4c1ddd --- /dev/null +++ b/lib/datadog_api_client/v2/api/ddsql_api.rb @@ -0,0 +1,177 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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. + +=end + +require 'cgi' + +module DatadogAPIClient::V2 + class DDSQLAPI + attr_accessor :api_client + + def initialize(api_client = DatadogAPIClient::APIClient.default) + @api_client = api_client + end + + # Execute a tabular DDSQL query. + # + # @see #execute_ddsql_tabular_query_with_http_info + def execute_ddsql_tabular_query(body, opts = {}) + data, _status_code, _headers = execute_ddsql_tabular_query_with_http_info(body, opts) + data + end + + # Execute a tabular DDSQL query. + # + # 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 body [DdsqlTabularQueryRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(DdsqlTabularQueryResponse, Integer, Hash)>] DdsqlTabularQueryResponse data, response status code and response headers + def execute_ddsql_tabular_query_with_http_info(body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.execute_ddsql_tabular_query".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.execute_ddsql_tabular_query") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.execute_ddsql_tabular_query")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DDSQLAPI.execute_ddsql_tabular_query ...' + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling DDSQLAPI.execute_ddsql_tabular_query" + end + # resource path + local_var_path = '/api/v2/ddsql/query/tabular' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'DdsqlTabularQueryResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :execute_ddsql_tabular_query, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DDSQLAPI#execute_ddsql_tabular_query\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Fetch the result of a DDSQL query. + # + # @see #fetch_ddsql_tabular_query_with_http_info + def fetch_ddsql_tabular_query(body, opts = {}) + data, _status_code, _headers = fetch_ddsql_tabular_query_with_http_info(body, opts) + data + end + + # Fetch the result of a DDSQL query. + # + # 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 body [DdsqlTabularQueryFetchRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(DdsqlTabularQueryResponse, Integer, Hash)>] DdsqlTabularQueryResponse data, response status code and response headers + def fetch_ddsql_tabular_query_with_http_info(body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.fetch_ddsql_tabular_query".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.fetch_ddsql_tabular_query") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.fetch_ddsql_tabular_query")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DDSQLAPI.fetch_ddsql_tabular_query ...' + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling DDSQLAPI.fetch_ddsql_tabular_query" + end + # resource path + local_var_path = '/api/v2/ddsql/query/tabular/fetch' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'DdsqlTabularQueryResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :fetch_ddsql_tabular_query, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DDSQLAPI#fetch_ddsql_tabular_query\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/datadog_api_client/v2/models/ddsql_tabular_query_column.rb b/lib/datadog_api_client/v2/models/ddsql_tabular_query_column.rb new file mode 100644 index 000000000000..2fc6d124f076 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ddsql_tabular_query_column.rb @@ -0,0 +1,173 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A single column of a DDSQL tabular query result. + class DdsqlTabularQueryColumn + include BaseGenericModel + + # Name of the column as projected by the SQL statement. + attr_reader :name + + # 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. + attr_reader :type + + # 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. + attr_reader :values + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'name' => :'name', + :'type' => :'type', + :'values' => :'values' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'name' => :'String', + :'type' => :'String', + :'values' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::DdsqlTabularQueryColumn` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'values') + if (value = attributes[:'values']).is_a?(Array) + self.values = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @name.nil? + return false if @type.nil? + return false if @values.nil? + true + end + + # Custom attribute writer method with validation + # @param name [Object] Object to be assigned + # @!visibility private + def name=(name) + if name.nil? + fail ArgumentError, 'invalid value for "name", name cannot be nil.' + end + @name = name + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Custom attribute writer method with validation + # @param values [Object] Object to be assigned + # @!visibility private + def values=(values) + if values.nil? + fail ArgumentError, 'invalid value for "values", values cannot be nil.' + end + @values = values + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + name == o.name && + type == o.type && + values == o.values && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [name, type, values, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ddsql_tabular_query_fetch_request.rb b/lib/datadog_api_client/v2/models/ddsql_tabular_query_fetch_request.rb new file mode 100644 index 000000000000..4342561c163d --- /dev/null +++ b/lib/datadog_api_client/v2/models/ddsql_tabular_query_fetch_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Wrapper for a DDSQL tabular query fetch request. + class DdsqlTabularQueryFetchRequest + include BaseGenericModel + + # JSON:API resource object for a DDSQL tabular query fetch request. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'DdsqlTabularQueryFetchRequestData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::DdsqlTabularQueryFetchRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ddsql_tabular_query_fetch_request_attributes.rb b/lib/datadog_api_client/v2/models/ddsql_tabular_query_fetch_request_attributes.rb new file mode 100644 index 000000000000..b2331444a29c --- /dev/null +++ b/lib/datadog_api_client/v2/models/ddsql_tabular_query_fetch_request_attributes.rb @@ -0,0 +1,124 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes describing which previously submitted DDSQL query to fetch. + class DdsqlTabularQueryFetchRequestAttributes + include BaseGenericModel + + # Opaque token returned by an earlier execute or fetch response that carried + # `state: running`. Identifies the query to poll for results. + attr_reader :query_id + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'query_id' => :'query_id' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'query_id' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::DdsqlTabularQueryFetchRequestAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'query_id') + self.query_id = attributes[:'query_id'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @query_id.nil? + true + end + + # Custom attribute writer method with validation + # @param query_id [Object] Object to be assigned + # @!visibility private + def query_id=(query_id) + if query_id.nil? + fail ArgumentError, 'invalid value for "query_id", query_id cannot be nil.' + end + @query_id = query_id + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + query_id == o.query_id && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [query_id, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ddsql_tabular_query_fetch_request_data.rb b/lib/datadog_api_client/v2/models/ddsql_tabular_query_fetch_request_data.rb new file mode 100644 index 000000000000..64cde5772f91 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ddsql_tabular_query_fetch_request_data.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # JSON:API resource object for a DDSQL tabular query fetch request. + class DdsqlTabularQueryFetchRequestData + include BaseGenericModel + + # Attributes describing which previously submitted DDSQL query to fetch. + attr_reader :attributes + + # JSON:API resource type for a DDSQL tabular query fetch request. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'DdsqlTabularQueryFetchRequestAttributes', + :'type' => :'DdsqlTabularQueryFetchRequestType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::DdsqlTabularQueryFetchRequestData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ddsql_tabular_query_fetch_request_type.rb b/lib/datadog_api_client/v2/models/ddsql_tabular_query_fetch_request_type.rb new file mode 100644 index 000000000000..47960595480d --- /dev/null +++ b/lib/datadog_api_client/v2/models/ddsql_tabular_query_fetch_request_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # JSON:API resource type for a DDSQL tabular query fetch request. + class DdsqlTabularQueryFetchRequestType + include BaseEnumModel + + DDSQL_QUERY_FETCH_REQUEST = "ddsql_query_fetch_request".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/ddsql_tabular_query_request.rb b/lib/datadog_api_client/v2/models/ddsql_tabular_query_request.rb new file mode 100644 index 000000000000..d0befefa0915 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ddsql_tabular_query_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Wrapper for a DDSQL tabular query execution request. + class DdsqlTabularQueryRequest + include BaseGenericModel + + # JSON:API resource object for a DDSQL tabular query execution request. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'DdsqlTabularQueryRequestData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::DdsqlTabularQueryRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ddsql_tabular_query_request_attributes.rb b/lib/datadog_api_client/v2/models/ddsql_tabular_query_request_attributes.rb new file mode 100644 index 000000000000..297474ebdc7e --- /dev/null +++ b/lib/datadog_api_client/v2/models/ddsql_tabular_query_request_attributes.rb @@ -0,0 +1,174 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes describing the DDSQL query to execute. + class DdsqlTabularQueryRequestAttributes + include BaseGenericModel + + # The DDSQL statement to execute. DDSQL is Datadog's SQL dialect, which is a subset + # of PostgreSQL, scoped to Datadog data sources. + attr_reader :query + + # 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. + attr_reader :row_limit + + # 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. + attr_reader :time + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'query' => :'query', + :'row_limit' => :'row_limit', + :'time' => :'time' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'query' => :'String', + :'row_limit' => :'Integer', + :'time' => :'DdsqlTabularQueryTimeWindow' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::DdsqlTabularQueryRequestAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'query') + self.query = attributes[:'query'] + end + + if attributes.key?(:'row_limit') + self.row_limit = attributes[:'row_limit'] + end + + if attributes.key?(:'time') + self.time = attributes[:'time'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @query.nil? + return false if !@row_limit.nil? && @row_limit > 10000 + return false if !@row_limit.nil? && @row_limit < 1 + return false if @time.nil? + true + end + + # Custom attribute writer method with validation + # @param query [Object] Object to be assigned + # @!visibility private + def query=(query) + if query.nil? + fail ArgumentError, 'invalid value for "query", query cannot be nil.' + end + @query = query + end + + # Custom attribute writer method with validation + # @param row_limit [Object] Object to be assigned + # @!visibility private + def row_limit=(row_limit) + if !row_limit.nil? && row_limit > 10000 + fail ArgumentError, 'invalid value for "row_limit", must be smaller than or equal to 10000.' + end + if !row_limit.nil? && row_limit < 1 + fail ArgumentError, 'invalid value for "row_limit", must be greater than or equal to 1.' + end + @row_limit = row_limit + end + + # Custom attribute writer method with validation + # @param time [Object] Object to be assigned + # @!visibility private + def time=(time) + if time.nil? + fail ArgumentError, 'invalid value for "time", time cannot be nil.' + end + @time = time + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + query == o.query && + row_limit == o.row_limit && + time == o.time && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [query, row_limit, time, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ddsql_tabular_query_request_data.rb b/lib/datadog_api_client/v2/models/ddsql_tabular_query_request_data.rb new file mode 100644 index 000000000000..cc2c987bb8a4 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ddsql_tabular_query_request_data.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # JSON:API resource object for a DDSQL tabular query execution request. + class DdsqlTabularQueryRequestData + include BaseGenericModel + + # Attributes describing the DDSQL query to execute. + attr_reader :attributes + + # JSON:API resource type for a DDSQL tabular query request. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'DdsqlTabularQueryRequestAttributes', + :'type' => :'DdsqlTabularQueryRequestType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::DdsqlTabularQueryRequestData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ddsql_tabular_query_request_type.rb b/lib/datadog_api_client/v2/models/ddsql_tabular_query_request_type.rb new file mode 100644 index 000000000000..061ae943a09f --- /dev/null +++ b/lib/datadog_api_client/v2/models/ddsql_tabular_query_request_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # JSON:API resource type for a DDSQL tabular query request. + class DdsqlTabularQueryRequestType + include BaseEnumModel + + DDSQL_QUERY_REQUEST = "ddsql_query_request".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/ddsql_tabular_query_response.rb b/lib/datadog_api_client/v2/models/ddsql_tabular_query_response.rb new file mode 100644 index 000000000000..9ce4874e4881 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ddsql_tabular_query_response.rb @@ -0,0 +1,147 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # 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. + class DdsqlTabularQueryResponse + include BaseGenericModel + + # JSON:API resource object for a DDSQL tabular query response. + attr_reader :data + + # Top-level JSON:API meta block accompanying every DDSQL tabular query response. + # Carries standard observability handles for client-side correlation. + attr_reader :meta + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data', + :'meta' => :'meta' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'DdsqlTabularQueryResponseData', + :'meta' => :'DdsqlTabularQueryResponseMeta' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::DdsqlTabularQueryResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + + if attributes.key?(:'meta') + self.meta = attributes[:'meta'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + return false if @meta.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Custom attribute writer method with validation + # @param meta [Object] Object to be assigned + # @!visibility private + def meta=(meta) + if meta.nil? + fail ArgumentError, 'invalid value for "meta", meta cannot be nil.' + end + @meta = meta + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + meta == o.meta && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, meta, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ddsql_tabular_query_response_attributes.rb b/lib/datadog_api_client/v2/models/ddsql_tabular_query_response_attributes.rb new file mode 100644 index 000000000000..22df1b827415 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ddsql_tabular_query_response_attributes.rb @@ -0,0 +1,163 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes of a DDSQL tabular query response. `query_id` is set when + # `state` is `running`; `columns` is set when `state` is `completed`. + class DdsqlTabularQueryResponseAttributes + include BaseGenericModel + + # 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`. + attr_accessor :columns + + # Opaque token to pass to the fetch endpoint to poll for results. + # Set when `state` is `running` and absent when `state` is `completed`. + attr_accessor :query_id + + # 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. + attr_reader :state + + # Non-fatal messages emitted by the query engine while serving this response. + attr_accessor :warnings + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'columns' => :'columns', + :'query_id' => :'query_id', + :'state' => :'state', + :'warnings' => :'warnings' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'columns' => :'Array', + :'query_id' => :'String', + :'state' => :'DdsqlTabularQueryState', + :'warnings' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::DdsqlTabularQueryResponseAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'columns') + if (value = attributes[:'columns']).is_a?(Array) + self.columns = value + end + end + + if attributes.key?(:'query_id') + self.query_id = attributes[:'query_id'] + end + + if attributes.key?(:'state') + self.state = attributes[:'state'] + end + + if attributes.key?(:'warnings') + if (value = attributes[:'warnings']).is_a?(Array) + self.warnings = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @state.nil? + true + end + + # Custom attribute writer method with validation + # @param state [Object] Object to be assigned + # @!visibility private + def state=(state) + if state.nil? + fail ArgumentError, 'invalid value for "state", state cannot be nil.' + end + @state = state + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + columns == o.columns && + query_id == o.query_id && + state == o.state && + warnings == o.warnings && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [columns, query_id, state, warnings, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ddsql_tabular_query_response_data.rb b/lib/datadog_api_client/v2/models/ddsql_tabular_query_response_data.rb new file mode 100644 index 000000000000..b51221ac2cb5 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ddsql_tabular_query_response_data.rb @@ -0,0 +1,166 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # JSON:API resource object for a DDSQL tabular query response. + class DdsqlTabularQueryResponseData + include BaseGenericModel + + # Attributes of a DDSQL tabular query response. `query_id` is set when + # `state` is `running`; `columns` is set when `state` is `completed`. + attr_reader :attributes + + # Stable identifier for the query response resource. + attr_reader :id + + # JSON:API resource type for a DDSQL tabular query response. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'DdsqlTabularQueryResponseAttributes', + :'id' => :'String', + :'type' => :'DdsqlTabularQueryResponseType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::DdsqlTabularQueryResponseData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ddsql_tabular_query_response_meta.rb b/lib/datadog_api_client/v2/models/ddsql_tabular_query_response_meta.rb new file mode 100644 index 000000000000..5cae9adc74d0 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ddsql_tabular_query_response_meta.rb @@ -0,0 +1,146 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Top-level JSON:API meta block accompanying every DDSQL tabular query response. + # Carries standard observability handles for client-side correlation. + class DdsqlTabularQueryResponseMeta + include BaseGenericModel + + # Server-side time spent serving this request, in milliseconds. + attr_reader :elapsed + + # Echo of the `DD-Request-ID` header assigned by Datadog's edge to this request, + # for support correlation. + attr_reader :request_id + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'elapsed' => :'elapsed', + :'request_id' => :'request_id' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'elapsed' => :'Integer', + :'request_id' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::DdsqlTabularQueryResponseMeta` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'elapsed') + self.elapsed = attributes[:'elapsed'] + end + + if attributes.key?(:'request_id') + self.request_id = attributes[:'request_id'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @elapsed.nil? + return false if @request_id.nil? + true + end + + # Custom attribute writer method with validation + # @param elapsed [Object] Object to be assigned + # @!visibility private + def elapsed=(elapsed) + if elapsed.nil? + fail ArgumentError, 'invalid value for "elapsed", elapsed cannot be nil.' + end + @elapsed = elapsed + end + + # Custom attribute writer method with validation + # @param request_id [Object] Object to be assigned + # @!visibility private + def request_id=(request_id) + if request_id.nil? + fail ArgumentError, 'invalid value for "request_id", request_id cannot be nil.' + end + @request_id = request_id + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + elapsed == o.elapsed && + request_id == o.request_id && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [elapsed, request_id, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ddsql_tabular_query_response_type.rb b/lib/datadog_api_client/v2/models/ddsql_tabular_query_response_type.rb new file mode 100644 index 000000000000..08498dbb75d4 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ddsql_tabular_query_response_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # JSON:API resource type for a DDSQL tabular query response. + class DdsqlTabularQueryResponseType + include BaseEnumModel + + DDSQL_QUERY_RESPONSE = "ddsql_query_response".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/ddsql_tabular_query_state.rb b/lib/datadog_api_client/v2/models/ddsql_tabular_query_state.rb new file mode 100644 index 000000000000..83255f160335 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ddsql_tabular_query_state.rb @@ -0,0 +1,30 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # 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. + class DdsqlTabularQueryState + include BaseEnumModel + + RUNNING = "running".freeze + COMPLETED = "completed".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/ddsql_tabular_query_time_window.rb b/lib/datadog_api_client/v2/models/ddsql_tabular_query_time_window.rb new file mode 100644 index 000000000000..745cc9114d7c --- /dev/null +++ b/lib/datadog_api_client/v2/models/ddsql_tabular_query_time_window.rb @@ -0,0 +1,147 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # 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. + class DdsqlTabularQueryTimeWindow + include BaseGenericModel + + # Start of the query window (inclusive), in Unix milliseconds since the epoch. + attr_reader :from_timestamp + + # End of the query window (exclusive), in Unix milliseconds since the epoch. + attr_reader :to_timestamp + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'from_timestamp' => :'from_timestamp', + :'to_timestamp' => :'to_timestamp' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'from_timestamp' => :'Integer', + :'to_timestamp' => :'Integer' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::DdsqlTabularQueryTimeWindow` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'from_timestamp') + self.from_timestamp = attributes[:'from_timestamp'] + end + + if attributes.key?(:'to_timestamp') + self.to_timestamp = attributes[:'to_timestamp'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @from_timestamp.nil? + return false if @to_timestamp.nil? + true + end + + # Custom attribute writer method with validation + # @param from_timestamp [Object] Object to be assigned + # @!visibility private + def from_timestamp=(from_timestamp) + if from_timestamp.nil? + fail ArgumentError, 'invalid value for "from_timestamp", from_timestamp cannot be nil.' + end + @from_timestamp = from_timestamp + end + + # Custom attribute writer method with validation + # @param to_timestamp [Object] Object to be assigned + # @!visibility private + def to_timestamp=(to_timestamp) + if to_timestamp.nil? + fail ArgumentError, 'invalid value for "to_timestamp", to_timestamp cannot be nil.' + end + @to_timestamp = to_timestamp + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + from_timestamp == o.from_timestamp && + to_timestamp == o.to_timestamp && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [from_timestamp, to_timestamp, additional_properties].hash + end + end +end