From 1019a7f31b412e6a19ea4769fbf58355265d6f83 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Wed, 4 Mar 2026 21:15:19 +0000 Subject: [PATCH] Regenerate client from commit 1ab8955 of spec repo --- .generator/schemas/v1/openapi.yaml | 270 ++++++++++++++++++ ...query-variables-returns-OK-response.frozen | 1 + ...ed-query-variables-returns-OK-response.yml | 52 ++++ ...query-variables-returns-OK-response.frozen | 1 + ...ed-query-variables-returns-OK-response.yml | 52 ++++ .../v1/monitors/CreateMonitor_2082938111.rb | 44 +++ .../v1/monitors/CreateMonitor_2608995690.rb | 60 ++++ features/v1/monitors.feature | 22 +- lib/datadog_api_client/inflector.rb | 16 ++ ...la_and_function_aggregate_augment_query.rb | 63 ++++ ...unction_aggregate_augmented_data_source.rb | 26 ++ ...on_aggregate_augmented_query_definition.rb | 221 ++++++++++++++ ...rmula_and_function_aggregate_base_query.rb | 63 ++++ ...ula_and_function_aggregate_filter_query.rb | 63 ++++ ...function_aggregate_filtered_data_source.rb | 26 ++ ...ion_aggregate_filtered_query_definition.rb | 197 +++++++++++++ ...ula_and_function_aggregate_query_filter.rb | 129 +++++++++ ...function_aggregate_query_join_condition.rb | 140 +++++++++ ..._and_function_aggregate_query_join_type.rb | 27 ++ ...function_event_query_definition_compute.rb | 16 +- ...formula_and_function_metrics_aggregator.rb | 36 +++ ...ormula_and_function_metrics_data_source.rb | 28 ++ ...a_and_function_metrics_query_definition.rb | 139 +++++++++ ...r_formula_and_function_query_definition.rb | 4 +- ...ula_and_function_reference_table_column.rb | 108 +++++++ ...nd_function_reference_table_data_source.rb | 26 ++ ...nction_reference_table_query_definition.rb | 151 ++++++++++ 27 files changed, 1976 insertions(+), 5 deletions(-) create mode 100644 cassettes/features/v1/monitors/Create-a-monitor-with-aggregate-augmented-query-variables-returns-OK-response.frozen create mode 100644 cassettes/features/v1/monitors/Create-a-monitor-with-aggregate-augmented-query-variables-returns-OK-response.yml create mode 100644 cassettes/features/v1/monitors/Create-a-monitor-with-aggregate-filtered-query-variables-returns-OK-response.frozen create mode 100644 cassettes/features/v1/monitors/Create-a-monitor-with-aggregate-filtered-query-variables-returns-OK-response.yml create mode 100644 examples/v1/monitors/CreateMonitor_2082938111.rb create mode 100644 examples/v1/monitors/CreateMonitor_2608995690.rb create mode 100644 lib/datadog_api_client/v1/models/monitor_formula_and_function_aggregate_augment_query.rb create mode 100644 lib/datadog_api_client/v1/models/monitor_formula_and_function_aggregate_augmented_data_source.rb create mode 100644 lib/datadog_api_client/v1/models/monitor_formula_and_function_aggregate_augmented_query_definition.rb create mode 100644 lib/datadog_api_client/v1/models/monitor_formula_and_function_aggregate_base_query.rb create mode 100644 lib/datadog_api_client/v1/models/monitor_formula_and_function_aggregate_filter_query.rb create mode 100644 lib/datadog_api_client/v1/models/monitor_formula_and_function_aggregate_filtered_data_source.rb create mode 100644 lib/datadog_api_client/v1/models/monitor_formula_and_function_aggregate_filtered_query_definition.rb create mode 100644 lib/datadog_api_client/v1/models/monitor_formula_and_function_aggregate_query_filter.rb create mode 100644 lib/datadog_api_client/v1/models/monitor_formula_and_function_aggregate_query_join_condition.rb create mode 100644 lib/datadog_api_client/v1/models/monitor_formula_and_function_aggregate_query_join_type.rb create mode 100644 lib/datadog_api_client/v1/models/monitor_formula_and_function_metrics_aggregator.rb create mode 100644 lib/datadog_api_client/v1/models/monitor_formula_and_function_metrics_data_source.rb create mode 100644 lib/datadog_api_client/v1/models/monitor_formula_and_function_metrics_query_definition.rb create mode 100644 lib/datadog_api_client/v1/models/monitor_formula_and_function_reference_table_column.rb create mode 100644 lib/datadog_api_client/v1/models/monitor_formula_and_function_reference_table_data_source.rb create mode 100644 lib/datadog_api_client/v1/models/monitor_formula_and_function_reference_table_query_definition.rb diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index 0d4728f90057..0af0eb5f67c3 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -7738,6 +7738,161 @@ components: x-enum-varnames: - DRAFT - PUBLISHED + MonitorFormulaAndFunctionAggregateAugmentQuery: + description: Augment query for aggregate augmented queries. Can be an events + query or a reference table query. + oneOf: + - $ref: '#/components/schemas/MonitorFormulaAndFunctionEventQueryDefinition' + - $ref: '#/components/schemas/MonitorFormulaAndFunctionReferenceTableQueryDefinition' + MonitorFormulaAndFunctionAggregateAugmentedDataSource: + description: Data source for aggregate augmented queries. + enum: + - aggregate_augmented_query + example: aggregate_augmented_query + type: string + x-enum-varnames: + - AGGREGATE_AUGMENTED_QUERY + MonitorFormulaAndFunctionAggregateAugmentedQueryDefinition: + additionalProperties: false + description: A formula and functions aggregate augmented query. Used to enrich + base query results with data from a reference table. + properties: + augment_query: + $ref: '#/components/schemas/MonitorFormulaAndFunctionAggregateAugmentQuery' + base_query: + $ref: '#/components/schemas/MonitorFormulaAndFunctionAggregateBaseQuery' + compute: + description: Compute options for the query. + items: + $ref: '#/components/schemas/MonitorFormulaAndFunctionEventQueryDefinitionCompute' + minItems: 1 + type: array + data_source: + $ref: '#/components/schemas/MonitorFormulaAndFunctionAggregateAugmentedDataSource' + group_by: + description: Group by options for the query. + items: + $ref: '#/components/schemas/MonitorFormulaAndFunctionEventQueryGroupBy' + type: array + join_condition: + $ref: '#/components/schemas/MonitorFormulaAndFunctionAggregateQueryJoinCondition' + name: + description: Name of the query for use in formulas. + example: query1 + type: string + required: + - data_source + - base_query + - augment_query + - join_condition + - compute + - group_by + type: object + MonitorFormulaAndFunctionAggregateBaseQuery: + description: Base query for aggregate queries. Can be an events query or a metrics + query. + oneOf: + - $ref: '#/components/schemas/MonitorFormulaAndFunctionEventQueryDefinition' + - $ref: '#/components/schemas/MonitorFormulaAndFunctionMetricsQueryDefinition' + MonitorFormulaAndFunctionAggregateFilterQuery: + description: Filter query for aggregate filtered queries. Can be an events query + or a reference table query. + oneOf: + - $ref: '#/components/schemas/MonitorFormulaAndFunctionEventQueryDefinition' + - $ref: '#/components/schemas/MonitorFormulaAndFunctionReferenceTableQueryDefinition' + MonitorFormulaAndFunctionAggregateFilteredDataSource: + description: Data source for aggregate filtered queries. + enum: + - aggregate_filtered_query + example: aggregate_filtered_query + type: string + x-enum-varnames: + - AGGREGATE_FILTERED_QUERY + MonitorFormulaAndFunctionAggregateFilteredQueryDefinition: + additionalProperties: false + description: A formula and functions aggregate filtered query. Used to filter + base query results using data from another source. + properties: + base_query: + $ref: '#/components/schemas/MonitorFormulaAndFunctionAggregateBaseQuery' + compute: + description: Compute options for the query. + items: + $ref: '#/components/schemas/MonitorFormulaAndFunctionEventQueryDefinitionCompute' + type: array + data_source: + $ref: '#/components/schemas/MonitorFormulaAndFunctionAggregateFilteredDataSource' + filter_query: + $ref: '#/components/schemas/MonitorFormulaAndFunctionAggregateFilterQuery' + filters: + description: Filter conditions for the query. + items: + $ref: '#/components/schemas/MonitorFormulaAndFunctionAggregateQueryFilter' + type: array + group_by: + description: Group by options for the query. + items: + $ref: '#/components/schemas/MonitorFormulaAndFunctionEventQueryGroupBy' + type: array + name: + description: Name of the query for use in formulas. + example: query1 + type: string + required: + - data_source + - base_query + - filter_query + - filters + type: object + MonitorFormulaAndFunctionAggregateQueryFilter: + additionalProperties: false + description: Filter definition for aggregate filtered queries. + properties: + base_attribute: + description: Attribute from the base query to filter on. + example: org_id + type: string + exclude: + default: false + description: Whether to exclude matching records instead of including them. + type: boolean + filter_attribute: + description: Attribute from the filter query to match against. + example: org_id + type: string + required: + - base_attribute + - filter_attribute + type: object + MonitorFormulaAndFunctionAggregateQueryJoinCondition: + additionalProperties: false + description: Join condition for aggregate augmented queries. + properties: + augment_attribute: + description: Attribute from the augment query to join on. + example: org_id + type: string + base_attribute: + description: Attribute from the base query to join on. + example: org_id + type: string + join_type: + $ref: '#/components/schemas/MonitorFormulaAndFunctionAggregateQueryJoinType' + required: + - base_attribute + - augment_attribute + - join_type + type: object + MonitorFormulaAndFunctionAggregateQueryJoinType: + description: Join type for aggregate query join conditions. + enum: + - inner + - left + example: inner + type: string + x-enum-varnames: + - INNER + - LEFT MonitorFormulaAndFunctionCostAggregator: description: Aggregation methods for metric queries. enum: @@ -7971,6 +8126,11 @@ components: description: Measurable attribute to compute. example: '@duration' type: string + name: + description: The name assigned to this aggregation, when multiple aggregations + are defined for a query. + example: compute_result + type: string required: - aggregation type: object @@ -8040,12 +8200,122 @@ components: - DATABASE_QUERIES - NETWORK - NETWORK_PATH + MonitorFormulaAndFunctionMetricsAggregator: + description: Aggregator for metrics queries. + enum: + - avg + - min + - max + - sum + - last + - mean + - area + - l2norm + - percentile + - stddev + - count_unique + example: avg + type: string + x-enum-varnames: + - AVG + - MIN + - MAX + - SUM + - LAST + - MEAN + - AREA + - L2NORM + - PERCENTILE + - STDDEV + - COUNT_UNIQUE + MonitorFormulaAndFunctionMetricsDataSource: + description: Data source for metrics queries. + enum: + - metrics + - cloud_cost + - datadog_usage + example: metrics + type: string + x-enum-varnames: + - METRICS + - CLOUD_COST + - DATADOG_USAGE + MonitorFormulaAndFunctionMetricsQueryDefinition: + additionalProperties: false + description: A formula and functions metrics query for use in aggregate queries. + properties: + aggregator: + $ref: '#/components/schemas/MonitorFormulaAndFunctionMetricsAggregator' + data_source: + $ref: '#/components/schemas/MonitorFormulaAndFunctionMetricsDataSource' + name: + description: Name of the query for use in formulas. + example: query1 + type: string + query: + description: The metrics query definition. + example: avg:system.cpu.user{*} + type: string + required: + - data_source + - query + type: object MonitorFormulaAndFunctionQueryDefinition: description: A formula and function query. oneOf: - $ref: '#/components/schemas/MonitorFormulaAndFunctionEventQueryDefinition' - $ref: '#/components/schemas/MonitorFormulaAndFunctionCostQueryDefinition' - $ref: '#/components/schemas/MonitorFormulaAndFunctionDataQualityQueryDefinition' + - $ref: '#/components/schemas/MonitorFormulaAndFunctionAggregateAugmentedQueryDefinition' + - $ref: '#/components/schemas/MonitorFormulaAndFunctionAggregateFilteredQueryDefinition' + MonitorFormulaAndFunctionReferenceTableColumn: + additionalProperties: false + description: A column definition for reference table queries. + properties: + alias: + description: Optional alias for the column. + type: string + name: + description: Name of the column. + example: org_id + type: string + required: + - name + type: object + MonitorFormulaAndFunctionReferenceTableDataSource: + description: Data source for reference table queries. + enum: + - reference_table + example: reference_table + type: string + x-enum-varnames: + - REFERENCE_TABLE + MonitorFormulaAndFunctionReferenceTableQueryDefinition: + additionalProperties: false + description: A reference table query for use in aggregate queries. + properties: + columns: + description: List of columns to retrieve from the reference table. + items: + $ref: '#/components/schemas/MonitorFormulaAndFunctionReferenceTableColumn' + type: array + data_source: + $ref: '#/components/schemas/MonitorFormulaAndFunctionReferenceTableDataSource' + name: + description: Name of the query. + example: filter_query + type: string + query_filter: + description: Optional filter expression for the reference table query. + type: string + table_name: + description: Name of the reference table. + example: test_table + type: string + required: + - data_source + - table_name + type: object MonitorGroupSearchResponse: description: The response of a monitor group search. example: diff --git a/cassettes/features/v1/monitors/Create-a-monitor-with-aggregate-augmented-query-variables-returns-OK-response.frozen b/cassettes/features/v1/monitors/Create-a-monitor-with-aggregate-augmented-query-variables-returns-OK-response.frozen new file mode 100644 index 000000000000..db745b4fe767 --- /dev/null +++ b/cassettes/features/v1/monitors/Create-a-monitor-with-aggregate-augmented-query-variables-returns-OK-response.frozen @@ -0,0 +1 @@ +2026-03-04T20:59:52.837Z \ No newline at end of file diff --git a/cassettes/features/v1/monitors/Create-a-monitor-with-aggregate-augmented-query-variables-returns-OK-response.yml b/cassettes/features/v1/monitors/Create-a-monitor-with-aggregate-augmented-query-variables-returns-OK-response.yml new file mode 100644 index 000000000000..b62721d038b5 --- /dev/null +++ b/cassettes/features/v1/monitors/Create-a-monitor-with-aggregate-augmented-query-variables-returns-OK-response.yml @@ -0,0 +1,52 @@ +http_interactions: +- recorded_at: Wed, 04 Mar 2026 20:59:52 GMT + request: + body: + encoding: UTF-8 + string: '{"message":"test message","name":"Test-Create_a_monitor_with_aggregate_augmented_query_variables_returns_OK_response-1772657992","options":{"thresholds":{"critical":124},"variables":[{"augment_query":{"columns":[{"name":"org_id"},{"name":"name"}],"data_source":"reference_table","name":"filter_query","table_name":"test_table"},"base_query":{"data_source":"metrics","name":"query1","query":"avg:dd{*} + by {org_id}.as_count()"},"compute":[{"aggregation":"max","name":"compute_result"}],"data_source":"aggregate_augmented_query","group_by":[{"facet":"org_id"},{"facet":"name"}],"join_condition":{"augment_attribute":"org_id","base_attribute":"org_id","join_type":"inner"},"name":"query1"}]},"query":"formula(\"query1\").rollup(\"sum\").last(\"5m\") + > 124","type":"query alert"}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v1/monitor + response: + body: + encoding: UTF-8 + string: '{"id":263469923,"org_id":321813,"type":"metric alert","name":"Test-Create_a_monitor_with_aggregate_augmented_query_variables_returns_OK_response-1772657992","message":"test + message","tags":[],"query":"formula(\"query1\").rollup(\"sum\").last(\"5m\") + > 124","options":{"thresholds":{"critical":124.0},"variables":[{"augment_query":{"columns":[{"name":"org_id"},{"name":"name"}],"data_source":"reference_table","name":"filter_query","table_name":"test_table"},"base_query":{"data_source":"metrics","name":"query1","query":"avg:dd{*} + by {org_id}.as_count()"},"compute":[{"aggregation":"max","name":"compute_result"}],"data_source":"aggregate_augmented_query","group_by":[{"facet":"org_id"},{"facet":"name"}],"join_condition":{"augment_attribute":"org_id","base_attribute":"org_id","join_type":"inner"},"name":"query1"}],"notify_no_data":false,"notify_audit":false,"new_host_delay":300,"include_tags":true,"silenced":{}},"multi":false,"created_at":1772657993000,"created":"2026-03-04T20:59:53.048028+00:00","modified":"2026-03-04T20:59:53.048028+00:00","deleted":null,"priority":null,"restricted_roles":null,"restriction_policy":null,"draft_status":"published","assets":[],"overall_state_modified":null,"overall_state":"No + Data","creator":{"name":"frog","handle":"frog@datadoghq.com","email":"frog@datadoghq.com","id":1445416}} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +- recorded_at: Wed, 04 Mar 2026 20:59:52 GMT + request: + body: null + headers: + Accept: + - application/json + method: DELETE + uri: https://api.datadoghq.com/api/v1/monitor/263469923 + response: + body: + encoding: UTF-8 + string: '{"deleted_monitor_id":263469923} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v1/monitors/Create-a-monitor-with-aggregate-filtered-query-variables-returns-OK-response.frozen b/cassettes/features/v1/monitors/Create-a-monitor-with-aggregate-filtered-query-variables-returns-OK-response.frozen new file mode 100644 index 000000000000..4e8c8fe3115c --- /dev/null +++ b/cassettes/features/v1/monitors/Create-a-monitor-with-aggregate-filtered-query-variables-returns-OK-response.frozen @@ -0,0 +1 @@ +2026-03-03T19:33:24.886Z \ No newline at end of file diff --git a/cassettes/features/v1/monitors/Create-a-monitor-with-aggregate-filtered-query-variables-returns-OK-response.yml b/cassettes/features/v1/monitors/Create-a-monitor-with-aggregate-filtered-query-variables-returns-OK-response.yml new file mode 100644 index 000000000000..a50450cdd296 --- /dev/null +++ b/cassettes/features/v1/monitors/Create-a-monitor-with-aggregate-filtered-query-variables-returns-OK-response.yml @@ -0,0 +1,52 @@ +http_interactions: +- recorded_at: Tue, 03 Mar 2026 19:33:24 GMT + request: + body: + encoding: UTF-8 + string: '{"message":"test message","name":"Test-Create_a_monitor_with_aggregate_filtered_query_variables_returns_OK_response-1772566404","options":{"thresholds":{"critical":100},"variables":[{"base_query":{"data_source":"metrics","name":"query1","query":"max:container.cpu.usage{*} + by {kube_cluster_name}.rollup(max)"},"data_source":"aggregate_filtered_query","filter_query":{"columns":[{"name":"cluster_name"}],"data_source":"reference_table","name":"filter_query","table_name":"test_table"},"filters":[{"base_attribute":"kube_cluster_name","filter_attribute":"cluster_name"}],"name":"query1"}]},"query":"formula(\"query1\").rollup(\"sum\").last(\"5m\") + > 100","type":"query alert"}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v1/monitor + response: + body: + encoding: UTF-8 + string: '{"id":263171329,"org_id":321813,"type":"metric alert","name":"Test-Create_a_monitor_with_aggregate_filtered_query_variables_returns_OK_response-1772566404","message":"test + message","tags":[],"query":"formula(\"query1\").rollup(\"sum\").last(\"5m\") + > 100","options":{"thresholds":{"critical":100.0},"variables":[{"base_query":{"data_source":"metrics","name":"query1","query":"max:container.cpu.usage{*} + by {kube_cluster_name}.rollup(max)"},"data_source":"aggregate_filtered_query","filter_query":{"columns":[{"name":"cluster_name"}],"data_source":"reference_table","name":"filter_query","table_name":"test_table"},"filters":[{"base_attribute":"kube_cluster_name","filter_attribute":"cluster_name"}],"name":"query1"}],"notify_no_data":false,"notify_audit":false,"new_host_delay":300,"include_tags":true,"silenced":{}},"multi":false,"created_at":1772566405000,"created":"2026-03-03T19:33:25.076678+00:00","modified":"2026-03-03T19:33:25.076678+00:00","deleted":null,"priority":null,"restricted_roles":null,"restriction_policy":null,"draft_status":"published","assets":[],"overall_state_modified":null,"overall_state":"No + Data","creator":{"name":"frog","handle":"frog@datadoghq.com","email":"frog@datadoghq.com","id":1445416}} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +- recorded_at: Tue, 03 Mar 2026 19:33:24 GMT + request: + body: null + headers: + Accept: + - application/json + method: DELETE + uri: https://api.datadoghq.com/api/v1/monitor/263171329 + response: + body: + encoding: UTF-8 + string: '{"deleted_monitor_id":263171329} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +recorded_with: VCR 6.0.0 diff --git a/examples/v1/monitors/CreateMonitor_2082938111.rb b/examples/v1/monitors/CreateMonitor_2082938111.rb new file mode 100644 index 000000000000..cd6e1f0bdea0 --- /dev/null +++ b/examples/v1/monitors/CreateMonitor_2082938111.rb @@ -0,0 +1,44 @@ +# Create a monitor with aggregate filtered query variables returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V1::MonitorsAPI.new + +body = DatadogAPIClient::V1::Monitor.new({ + name: "Example-Monitor", + type: DatadogAPIClient::V1::MonitorType::QUERY_ALERT, + query: 'formula("query1").rollup("sum").last("5m") > 100', + message: "test message", + options: DatadogAPIClient::V1::MonitorOptions.new({ + thresholds: DatadogAPIClient::V1::MonitorThresholds.new({ + critical: 100, + }), + variables: [ + DatadogAPIClient::V1::MonitorFormulaAndFunctionAggregateFilteredQueryDefinition.new({ + data_source: DatadogAPIClient::V1::MonitorFormulaAndFunctionAggregateFilteredDataSource::AGGREGATE_FILTERED_QUERY, + name: "query1", + base_query: DatadogAPIClient::V1::MonitorFormulaAndFunctionMetricsQueryDefinition.new({ + data_source: DatadogAPIClient::V1::MonitorFormulaAndFunctionMetricsDataSource::METRICS, + name: "query1", + query: "max:container.cpu.usage{*} by {kube_cluster_name}.rollup(max)", + }), + filter_query: DatadogAPIClient::V1::MonitorFormulaAndFunctionReferenceTableQueryDefinition.new({ + name: "filter_query", + data_source: DatadogAPIClient::V1::MonitorFormulaAndFunctionReferenceTableDataSource::REFERENCE_TABLE, + table_name: "test_table", + columns: [ + DatadogAPIClient::V1::MonitorFormulaAndFunctionReferenceTableColumn.new({ + name: "cluster_name", + }), + ], + }), + filters: [ + DatadogAPIClient::V1::MonitorFormulaAndFunctionAggregateQueryFilter.new({ + base_attribute: "kube_cluster_name", + filter_attribute: "cluster_name", + }), + ], + }), + ], + }), +}) +p api_instance.create_monitor(body) diff --git a/examples/v1/monitors/CreateMonitor_2608995690.rb b/examples/v1/monitors/CreateMonitor_2608995690.rb new file mode 100644 index 000000000000..84c1422fdb49 --- /dev/null +++ b/examples/v1/monitors/CreateMonitor_2608995690.rb @@ -0,0 +1,60 @@ +# Create a monitor with aggregate augmented query variables returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V1::MonitorsAPI.new + +body = DatadogAPIClient::V1::Monitor.new({ + name: "Example-Monitor", + type: DatadogAPIClient::V1::MonitorType::QUERY_ALERT, + query: 'formula("query1").rollup("sum").last("5m") > 124', + message: "test message", + options: DatadogAPIClient::V1::MonitorOptions.new({ + thresholds: DatadogAPIClient::V1::MonitorThresholds.new({ + critical: 124, + }), + variables: [ + DatadogAPIClient::V1::MonitorFormulaAndFunctionAggregateAugmentedQueryDefinition.new({ + data_source: DatadogAPIClient::V1::MonitorFormulaAndFunctionAggregateAugmentedDataSource::AGGREGATE_AUGMENTED_QUERY, + name: "query1", + group_by: [ + DatadogAPIClient::V1::MonitorFormulaAndFunctionEventQueryGroupBy.new({ + facet: "org_id", + }), + DatadogAPIClient::V1::MonitorFormulaAndFunctionEventQueryGroupBy.new({ + facet: "name", + }), + ], + compute: [ + DatadogAPIClient::V1::MonitorFormulaAndFunctionEventQueryDefinitionCompute.new({ + name: "compute_result", + aggregation: DatadogAPIClient::V1::MonitorFormulaAndFunctionEventAggregation::MAX, + }), + ], + augment_query: DatadogAPIClient::V1::MonitorFormulaAndFunctionReferenceTableQueryDefinition.new({ + name: "filter_query", + data_source: DatadogAPIClient::V1::MonitorFormulaAndFunctionReferenceTableDataSource::REFERENCE_TABLE, + table_name: "test_table", + columns: [ + DatadogAPIClient::V1::MonitorFormulaAndFunctionReferenceTableColumn.new({ + name: "org_id", + }), + DatadogAPIClient::V1::MonitorFormulaAndFunctionReferenceTableColumn.new({ + name: "name", + }), + ], + }), + base_query: DatadogAPIClient::V1::MonitorFormulaAndFunctionMetricsQueryDefinition.new({ + data_source: DatadogAPIClient::V1::MonitorFormulaAndFunctionMetricsDataSource::METRICS, + name: "query1", + query: "avg:dd{*} by {org_id}.as_count()", + }), + join_condition: DatadogAPIClient::V1::MonitorFormulaAndFunctionAggregateQueryJoinCondition.new({ + augment_attribute: "org_id", + base_attribute: "org_id", + join_type: DatadogAPIClient::V1::MonitorFormulaAndFunctionAggregateQueryJoinType::INNER, + }), + }), + ], + }), +}) +p api_instance.create_monitor(body) diff --git a/features/v1/monitors.feature b/features/v1/monitors.feature index af8d4522e9b2..63bb9f16b9ab 100644 --- a/features/v1/monitors.feature +++ b/features/v1/monitors.feature @@ -140,6 +140,26 @@ Feature: Monitors And the response "type" is equal to "log alert" And the response "query" is equal to "logs(\"service:foo AND type:error\").index(\"main\").rollup(\"count\").by(\"source\").last(\"5m\") > 2" + @team:DataDog/monitor-app + Scenario: Create a monitor with aggregate augmented query variables returns "OK" response + Given new "CreateMonitor" request + And body with value {"name":"{{ unique }}","type":"query alert","query":"formula(\"query1\").rollup(\"sum\").last(\"5m\") > 124","message":"test message","options":{"thresholds":{"critical":124},"variables":[{"data_source":"aggregate_augmented_query","name":"query1","group_by":[{"facet":"org_id"},{"facet":"name"}],"compute":[{"name":"compute_result","aggregation":"max"}],"augment_query":{"name":"filter_query","data_source":"reference_table","table_name":"test_table","columns":[{"name":"org_id"},{"name":"name"}]},"base_query":{"data_source":"metrics","name":"query1","query":"avg:dd{*} by {org_id}.as_count()"},"join_condition":{"augment_attribute":"org_id","base_attribute":"org_id","join_type":"inner"}}]}} + When the request is sent + Then the response status is 200 OK + And the response "name" is equal to "{{ unique }}" + And the response "options.variables[0].data_source" is equal to "aggregate_augmented_query" + And the response "options.variables[0].join_condition.join_type" is equal to "inner" + + @team:DataDog/monitor-app + Scenario: Create a monitor with aggregate filtered query variables returns "OK" response + Given new "CreateMonitor" request + And body with value {"name":"{{ unique }}","type":"query alert","query":"formula(\"query1\").rollup(\"sum\").last(\"5m\") > 100","message":"test message","options":{"thresholds":{"critical":100},"variables":[{"data_source":"aggregate_filtered_query","name":"query1","base_query":{"data_source":"metrics","name":"query1","query":"max:container.cpu.usage{*} by {kube_cluster_name}.rollup(max)"},"filter_query":{"name":"filter_query","data_source":"reference_table","table_name":"test_table","columns":[{"name":"cluster_name"}]},"filters":[{"base_attribute":"kube_cluster_name","filter_attribute":"cluster_name"}]}]}} + When the request is sent + Then the response status is 200 OK + And the response "name" is equal to "{{ unique }}" + And the response "options.variables[0].data_source" is equal to "aggregate_filtered_query" + And the response "options.variables[0].filters[0].base_attribute" is equal to "kube_cluster_name" + @team:DataDog/monitor-app Scenario: Create a monitor with assets returns "OK" response Given new "CreateMonitor" request @@ -190,7 +210,7 @@ Feature: Monitors Scenario: Edit a monitor returns "Bad Request" response Given new "UpdateMonitor" request And request contains "monitor_id" parameter from "REPLACE.ME" - And body with value {"assets": [{"category": "runbook", "name": "Monitor Runbook", "resource_key": "12345", "resource_type": "notebook", "url": "/notebooks/12345"}], "draft_status": "published", "options": {"evaluation_delay": null, "include_tags": true, "min_failure_duration": 0, "min_location_failed": 1, "new_group_delay": null, "new_host_delay": 300, "no_data_timeframe": null, "notification_preset_name": "show_all", "notify_audit": false, "notify_by": [], "on_missing_data": "default", "renotify_interval": null, "renotify_occurrences": null, "renotify_statuses": ["alert"], "scheduling_options": {"custom_schedule": {"recurrences": [{"rrule": "FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR", "start": "2023-08-31T16:30:00", "timezone": "Europe/Paris"}]}, "evaluation_window": {"day_starts": "04:00", "hour_starts": 0, "month_starts": 1, "timezone": "Europe/Paris"}}, "synthetics_check_id": null, "threshold_windows": {"recovery_window": null, "trigger_window": null}, "thresholds": {"critical_recovery": null, "ok": null, "unknown": null, "warning": null, "warning_recovery": null}, "timeout_h": null, "variables": [{"compute": {"aggregation": "avg", "interval": 60000, "metric": "@duration"}, "data_source": "rum", "group_by": [{"facet": "status", "limit": 10, "sort": {"aggregation": "avg", "order": "desc"}}], "indexes": ["days-3", "days-7"], "name": "query_errors", "search": {"query": "service:query"}}]}, "priority": null, "restricted_roles": [], "tags": [], "type": "query alert"} + And body with value {"assets": [{"category": "runbook", "name": "Monitor Runbook", "resource_key": "12345", "resource_type": "notebook", "url": "/notebooks/12345"}], "draft_status": "published", "options": {"evaluation_delay": null, "include_tags": true, "min_failure_duration": 0, "min_location_failed": 1, "new_group_delay": null, "new_host_delay": 300, "no_data_timeframe": null, "notification_preset_name": "show_all", "notify_audit": false, "notify_by": [], "on_missing_data": "default", "renotify_interval": null, "renotify_occurrences": null, "renotify_statuses": ["alert"], "scheduling_options": {"custom_schedule": {"recurrences": [{"rrule": "FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR", "start": "2023-08-31T16:30:00", "timezone": "Europe/Paris"}]}, "evaluation_window": {"day_starts": "04:00", "hour_starts": 0, "month_starts": 1, "timezone": "Europe/Paris"}}, "synthetics_check_id": null, "threshold_windows": {"recovery_window": null, "trigger_window": null}, "thresholds": {"critical_recovery": null, "ok": null, "unknown": null, "warning": null, "warning_recovery": null}, "timeout_h": null, "variables": [{"compute": {"aggregation": "avg", "interval": 60000, "metric": "@duration", "name": "compute_result"}, "data_source": "rum", "group_by": [{"facet": "status", "limit": 10, "sort": {"aggregation": "avg", "order": "desc"}}], "indexes": ["days-3", "days-7"], "name": "query_errors", "search": {"query": "service:query"}}]}, "priority": null, "restricted_roles": [], "tags": [], "type": "query alert"} When the request is sent Then the response status is 400 Bad Request diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index e1b49d6eeb1c..bcdf392bcf68 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -341,6 +341,16 @@ def overrides "v1.monitor_asset_resource_type" => "MonitorAssetResourceType", "v1.monitor_device_id" => "MonitorDeviceID", "v1.monitor_draft_status" => "MonitorDraftStatus", + "v1.monitor_formula_and_function_aggregate_augmented_data_source" => "MonitorFormulaAndFunctionAggregateAugmentedDataSource", + "v1.monitor_formula_and_function_aggregate_augmented_query_definition" => "MonitorFormulaAndFunctionAggregateAugmentedQueryDefinition", + "v1.monitor_formula_and_function_aggregate_augment_query" => "MonitorFormulaAndFunctionAggregateAugmentQuery", + "v1.monitor_formula_and_function_aggregate_base_query" => "MonitorFormulaAndFunctionAggregateBaseQuery", + "v1.monitor_formula_and_function_aggregate_filtered_data_source" => "MonitorFormulaAndFunctionAggregateFilteredDataSource", + "v1.monitor_formula_and_function_aggregate_filtered_query_definition" => "MonitorFormulaAndFunctionAggregateFilteredQueryDefinition", + "v1.monitor_formula_and_function_aggregate_filter_query" => "MonitorFormulaAndFunctionAggregateFilterQuery", + "v1.monitor_formula_and_function_aggregate_query_filter" => "MonitorFormulaAndFunctionAggregateQueryFilter", + "v1.monitor_formula_and_function_aggregate_query_join_condition" => "MonitorFormulaAndFunctionAggregateQueryJoinCondition", + "v1.monitor_formula_and_function_aggregate_query_join_type" => "MonitorFormulaAndFunctionAggregateQueryJoinType", "v1.monitor_formula_and_function_cost_aggregator" => "MonitorFormulaAndFunctionCostAggregator", "v1.monitor_formula_and_function_cost_data_source" => "MonitorFormulaAndFunctionCostDataSource", "v1.monitor_formula_and_function_cost_query_definition" => "MonitorFormulaAndFunctionCostQueryDefinition", @@ -355,7 +365,13 @@ def overrides "v1.monitor_formula_and_function_event_query_group_by" => "MonitorFormulaAndFunctionEventQueryGroupBy", "v1.monitor_formula_and_function_event_query_group_by_sort" => "MonitorFormulaAndFunctionEventQueryGroupBySort", "v1.monitor_formula_and_function_events_data_source" => "MonitorFormulaAndFunctionEventsDataSource", + "v1.monitor_formula_and_function_metrics_aggregator" => "MonitorFormulaAndFunctionMetricsAggregator", + "v1.monitor_formula_and_function_metrics_data_source" => "MonitorFormulaAndFunctionMetricsDataSource", + "v1.monitor_formula_and_function_metrics_query_definition" => "MonitorFormulaAndFunctionMetricsQueryDefinition", "v1.monitor_formula_and_function_query_definition" => "MonitorFormulaAndFunctionQueryDefinition", + "v1.monitor_formula_and_function_reference_table_column" => "MonitorFormulaAndFunctionReferenceTableColumn", + "v1.monitor_formula_and_function_reference_table_data_source" => "MonitorFormulaAndFunctionReferenceTableDataSource", + "v1.monitor_formula_and_function_reference_table_query_definition" => "MonitorFormulaAndFunctionReferenceTableQueryDefinition", "v1.monitor_group_search_response" => "MonitorGroupSearchResponse", "v1.monitor_group_search_response_counts" => "MonitorGroupSearchResponseCounts", "v1.monitor_group_search_result" => "MonitorGroupSearchResult", diff --git a/lib/datadog_api_client/v1/models/monitor_formula_and_function_aggregate_augment_query.rb b/lib/datadog_api_client/v1/models/monitor_formula_and_function_aggregate_augment_query.rb new file mode 100644 index 000000000000..3b437f3644b7 --- /dev/null +++ b/lib/datadog_api_client/v1/models/monitor_formula_and_function_aggregate_augment_query.rb @@ -0,0 +1,63 @@ +=begin +#Datadog API V1 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::V1 + # Augment query for aggregate augmented queries. Can be an events query or a reference table query. + module MonitorFormulaAndFunctionAggregateAugmentQuery + class << self + include BaseOneOfModel + include BaseOneOfModelNoDiscriminator + + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'MonitorFormulaAndFunctionEventQueryDefinition', + :'MonitorFormulaAndFunctionReferenceTableQueryDefinition' + ] + end + # Builds the object + # @param data [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + # Go through the list of oneOf items and attempt to identify the appropriate one. + # Note: + # - We do not attempt to check whether exactly one item matches. + # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) + # due to the way the deserialization is made in the base_object template (it just casts without verifying). + # - TODO: scalar values are de facto behaving as if they were nullable. + # - TODO: logging when debugging is set. + openapi_one_of.each do |klass| + begin + next if klass == :AnyType # "nullable: true" + typed_data = find_and_cast_into_type(klass, data) + next if typed_data.respond_to?(:_unparsed) && typed_data._unparsed + return typed_data if typed_data + rescue # rescue all errors so we keep iterating even if the current item lookup raises + end + end + + if openapi_one_of.include?(:AnyType) + data + else + self._unparsed = true + DatadogAPIClient::UnparsedObject.new(data) + end + end + end + end +end diff --git a/lib/datadog_api_client/v1/models/monitor_formula_and_function_aggregate_augmented_data_source.rb b/lib/datadog_api_client/v1/models/monitor_formula_and_function_aggregate_augmented_data_source.rb new file mode 100644 index 000000000000..dc77575da6f7 --- /dev/null +++ b/lib/datadog_api_client/v1/models/monitor_formula_and_function_aggregate_augmented_data_source.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V1 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::V1 + # Data source for aggregate augmented queries. + class MonitorFormulaAndFunctionAggregateAugmentedDataSource + include BaseEnumModel + + AGGREGATE_AUGMENTED_QUERY = "aggregate_augmented_query".freeze + end +end diff --git a/lib/datadog_api_client/v1/models/monitor_formula_and_function_aggregate_augmented_query_definition.rb b/lib/datadog_api_client/v1/models/monitor_formula_and_function_aggregate_augmented_query_definition.rb new file mode 100644 index 000000000000..c02811727d1e --- /dev/null +++ b/lib/datadog_api_client/v1/models/monitor_formula_and_function_aggregate_augmented_query_definition.rb @@ -0,0 +1,221 @@ +=begin +#Datadog API V1 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::V1 + # A formula and functions aggregate augmented query. Used to enrich base query results with data from a reference table. + class MonitorFormulaAndFunctionAggregateAugmentedQueryDefinition + include BaseGenericModel + + # Augment query for aggregate augmented queries. Can be an events query or a reference table query. + attr_reader :augment_query + + # Base query for aggregate queries. Can be an events query or a metrics query. + attr_reader :base_query + + # Compute options for the query. + attr_reader :compute + + # Data source for aggregate augmented queries. + attr_reader :data_source + + # Group by options for the query. + attr_reader :group_by + + # Join condition for aggregate augmented queries. + attr_reader :join_condition + + # Name of the query for use in formulas. + attr_accessor :name + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'augment_query' => :'augment_query', + :'base_query' => :'base_query', + :'compute' => :'compute', + :'data_source' => :'data_source', + :'group_by' => :'group_by', + :'join_condition' => :'join_condition', + :'name' => :'name' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'augment_query' => :'MonitorFormulaAndFunctionAggregateAugmentQuery', + :'base_query' => :'MonitorFormulaAndFunctionAggregateBaseQuery', + :'compute' => :'Array', + :'data_source' => :'MonitorFormulaAndFunctionAggregateAugmentedDataSource', + :'group_by' => :'Array', + :'join_condition' => :'MonitorFormulaAndFunctionAggregateQueryJoinCondition', + :'name' => :'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::V1::MonitorFormulaAndFunctionAggregateAugmentedQueryDefinition` initialize method" + end + + # 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)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V1::MonitorFormulaAndFunctionAggregateAugmentedQueryDefinition`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'augment_query') + self.augment_query = attributes[:'augment_query'] + end + + if attributes.key?(:'base_query') + self.base_query = attributes[:'base_query'] + end + + if attributes.key?(:'compute') + if (value = attributes[:'compute']).is_a?(Array) + self.compute = value + end + end + + if attributes.key?(:'data_source') + self.data_source = attributes[:'data_source'] + end + + if attributes.key?(:'group_by') + if (value = attributes[:'group_by']).is_a?(Array) + self.group_by = value + end + end + + if attributes.key?(:'join_condition') + self.join_condition = attributes[:'join_condition'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + 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 @augment_query.nil? + return false if @base_query.nil? + return false if @compute.nil? + return false if @compute.length < 1 + return false if @data_source.nil? + return false if @group_by.nil? + return false if @join_condition.nil? + true + end + + # Custom attribute writer method with validation + # @param augment_query [Object] Object to be assigned + # @!visibility private + def augment_query=(augment_query) + if augment_query.nil? + fail ArgumentError, 'invalid value for "augment_query", augment_query cannot be nil.' + end + @augment_query = augment_query + end + + # Custom attribute writer method with validation + # @param base_query [Object] Object to be assigned + # @!visibility private + def base_query=(base_query) + if base_query.nil? + fail ArgumentError, 'invalid value for "base_query", base_query cannot be nil.' + end + @base_query = base_query + end + + # Custom attribute writer method with validation + # @param compute [Object] Object to be assigned + # @!visibility private + def compute=(compute) + if compute.nil? + fail ArgumentError, 'invalid value for "compute", compute cannot be nil.' + end + if compute.length < 1 + fail ArgumentError, 'invalid value for "compute", number of items must be greater than or equal to 1.' + end + @compute = compute + end + + # Custom attribute writer method with validation + # @param data_source [Object] Object to be assigned + # @!visibility private + def data_source=(data_source) + if data_source.nil? + fail ArgumentError, 'invalid value for "data_source", data_source cannot be nil.' + end + @data_source = data_source + end + + # Custom attribute writer method with validation + # @param group_by [Object] Object to be assigned + # @!visibility private + def group_by=(group_by) + if group_by.nil? + fail ArgumentError, 'invalid value for "group_by", group_by cannot be nil.' + end + @group_by = group_by + end + + # Custom attribute writer method with validation + # @param join_condition [Object] Object to be assigned + # @!visibility private + def join_condition=(join_condition) + if join_condition.nil? + fail ArgumentError, 'invalid value for "join_condition", join_condition cannot be nil.' + end + @join_condition = join_condition + 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 && + augment_query == o.augment_query && + base_query == o.base_query && + compute == o.compute && + data_source == o.data_source && + group_by == o.group_by && + join_condition == o.join_condition && + name == o.name + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [augment_query, base_query, compute, data_source, group_by, join_condition, name].hash + end + end +end diff --git a/lib/datadog_api_client/v1/models/monitor_formula_and_function_aggregate_base_query.rb b/lib/datadog_api_client/v1/models/monitor_formula_and_function_aggregate_base_query.rb new file mode 100644 index 000000000000..a658c78e1bfe --- /dev/null +++ b/lib/datadog_api_client/v1/models/monitor_formula_and_function_aggregate_base_query.rb @@ -0,0 +1,63 @@ +=begin +#Datadog API V1 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::V1 + # Base query for aggregate queries. Can be an events query or a metrics query. + module MonitorFormulaAndFunctionAggregateBaseQuery + class << self + include BaseOneOfModel + include BaseOneOfModelNoDiscriminator + + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'MonitorFormulaAndFunctionEventQueryDefinition', + :'MonitorFormulaAndFunctionMetricsQueryDefinition' + ] + end + # Builds the object + # @param data [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + # Go through the list of oneOf items and attempt to identify the appropriate one. + # Note: + # - We do not attempt to check whether exactly one item matches. + # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) + # due to the way the deserialization is made in the base_object template (it just casts without verifying). + # - TODO: scalar values are de facto behaving as if they were nullable. + # - TODO: logging when debugging is set. + openapi_one_of.each do |klass| + begin + next if klass == :AnyType # "nullable: true" + typed_data = find_and_cast_into_type(klass, data) + next if typed_data.respond_to?(:_unparsed) && typed_data._unparsed + return typed_data if typed_data + rescue # rescue all errors so we keep iterating even if the current item lookup raises + end + end + + if openapi_one_of.include?(:AnyType) + data + else + self._unparsed = true + DatadogAPIClient::UnparsedObject.new(data) + end + end + end + end +end diff --git a/lib/datadog_api_client/v1/models/monitor_formula_and_function_aggregate_filter_query.rb b/lib/datadog_api_client/v1/models/monitor_formula_and_function_aggregate_filter_query.rb new file mode 100644 index 000000000000..38ee4da77b35 --- /dev/null +++ b/lib/datadog_api_client/v1/models/monitor_formula_and_function_aggregate_filter_query.rb @@ -0,0 +1,63 @@ +=begin +#Datadog API V1 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::V1 + # Filter query for aggregate filtered queries. Can be an events query or a reference table query. + module MonitorFormulaAndFunctionAggregateFilterQuery + class << self + include BaseOneOfModel + include BaseOneOfModelNoDiscriminator + + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'MonitorFormulaAndFunctionEventQueryDefinition', + :'MonitorFormulaAndFunctionReferenceTableQueryDefinition' + ] + end + # Builds the object + # @param data [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + # Go through the list of oneOf items and attempt to identify the appropriate one. + # Note: + # - We do not attempt to check whether exactly one item matches. + # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) + # due to the way the deserialization is made in the base_object template (it just casts without verifying). + # - TODO: scalar values are de facto behaving as if they were nullable. + # - TODO: logging when debugging is set. + openapi_one_of.each do |klass| + begin + next if klass == :AnyType # "nullable: true" + typed_data = find_and_cast_into_type(klass, data) + next if typed_data.respond_to?(:_unparsed) && typed_data._unparsed + return typed_data if typed_data + rescue # rescue all errors so we keep iterating even if the current item lookup raises + end + end + + if openapi_one_of.include?(:AnyType) + data + else + self._unparsed = true + DatadogAPIClient::UnparsedObject.new(data) + end + end + end + end +end diff --git a/lib/datadog_api_client/v1/models/monitor_formula_and_function_aggregate_filtered_data_source.rb b/lib/datadog_api_client/v1/models/monitor_formula_and_function_aggregate_filtered_data_source.rb new file mode 100644 index 000000000000..69655bd40b0e --- /dev/null +++ b/lib/datadog_api_client/v1/models/monitor_formula_and_function_aggregate_filtered_data_source.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V1 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::V1 + # Data source for aggregate filtered queries. + class MonitorFormulaAndFunctionAggregateFilteredDataSource + include BaseEnumModel + + AGGREGATE_FILTERED_QUERY = "aggregate_filtered_query".freeze + end +end diff --git a/lib/datadog_api_client/v1/models/monitor_formula_and_function_aggregate_filtered_query_definition.rb b/lib/datadog_api_client/v1/models/monitor_formula_and_function_aggregate_filtered_query_definition.rb new file mode 100644 index 000000000000..e89146c263fb --- /dev/null +++ b/lib/datadog_api_client/v1/models/monitor_formula_and_function_aggregate_filtered_query_definition.rb @@ -0,0 +1,197 @@ +=begin +#Datadog API V1 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::V1 + # A formula and functions aggregate filtered query. Used to filter base query results using data from another source. + class MonitorFormulaAndFunctionAggregateFilteredQueryDefinition + include BaseGenericModel + + # Base query for aggregate queries. Can be an events query or a metrics query. + attr_reader :base_query + + # Compute options for the query. + attr_accessor :compute + + # Data source for aggregate filtered queries. + attr_reader :data_source + + # Filter query for aggregate filtered queries. Can be an events query or a reference table query. + attr_reader :filter_query + + # Filter conditions for the query. + attr_reader :filters + + # Group by options for the query. + attr_accessor :group_by + + # Name of the query for use in formulas. + attr_accessor :name + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'base_query' => :'base_query', + :'compute' => :'compute', + :'data_source' => :'data_source', + :'filter_query' => :'filter_query', + :'filters' => :'filters', + :'group_by' => :'group_by', + :'name' => :'name' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'base_query' => :'MonitorFormulaAndFunctionAggregateBaseQuery', + :'compute' => :'Array', + :'data_source' => :'MonitorFormulaAndFunctionAggregateFilteredDataSource', + :'filter_query' => :'MonitorFormulaAndFunctionAggregateFilterQuery', + :'filters' => :'Array', + :'group_by' => :'Array', + :'name' => :'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::V1::MonitorFormulaAndFunctionAggregateFilteredQueryDefinition` initialize method" + end + + # 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)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V1::MonitorFormulaAndFunctionAggregateFilteredQueryDefinition`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'base_query') + self.base_query = attributes[:'base_query'] + end + + if attributes.key?(:'compute') + if (value = attributes[:'compute']).is_a?(Array) + self.compute = value + end + end + + if attributes.key?(:'data_source') + self.data_source = attributes[:'data_source'] + end + + if attributes.key?(:'filter_query') + self.filter_query = attributes[:'filter_query'] + end + + if attributes.key?(:'filters') + if (value = attributes[:'filters']).is_a?(Array) + self.filters = value + end + end + + if attributes.key?(:'group_by') + if (value = attributes[:'group_by']).is_a?(Array) + self.group_by = value + end + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + 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 @base_query.nil? + return false if @data_source.nil? + return false if @filter_query.nil? + return false if @filters.nil? + true + end + + # Custom attribute writer method with validation + # @param base_query [Object] Object to be assigned + # @!visibility private + def base_query=(base_query) + if base_query.nil? + fail ArgumentError, 'invalid value for "base_query", base_query cannot be nil.' + end + @base_query = base_query + end + + # Custom attribute writer method with validation + # @param data_source [Object] Object to be assigned + # @!visibility private + def data_source=(data_source) + if data_source.nil? + fail ArgumentError, 'invalid value for "data_source", data_source cannot be nil.' + end + @data_source = data_source + end + + # Custom attribute writer method with validation + # @param filter_query [Object] Object to be assigned + # @!visibility private + def filter_query=(filter_query) + if filter_query.nil? + fail ArgumentError, 'invalid value for "filter_query", filter_query cannot be nil.' + end + @filter_query = filter_query + end + + # Custom attribute writer method with validation + # @param filters [Object] Object to be assigned + # @!visibility private + def filters=(filters) + if filters.nil? + fail ArgumentError, 'invalid value for "filters", filters cannot be nil.' + end + @filters = filters + 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 && + base_query == o.base_query && + compute == o.compute && + data_source == o.data_source && + filter_query == o.filter_query && + filters == o.filters && + group_by == o.group_by && + name == o.name + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [base_query, compute, data_source, filter_query, filters, group_by, name].hash + end + end +end diff --git a/lib/datadog_api_client/v1/models/monitor_formula_and_function_aggregate_query_filter.rb b/lib/datadog_api_client/v1/models/monitor_formula_and_function_aggregate_query_filter.rb new file mode 100644 index 000000000000..2bc187ee3a3c --- /dev/null +++ b/lib/datadog_api_client/v1/models/monitor_formula_and_function_aggregate_query_filter.rb @@ -0,0 +1,129 @@ +=begin +#Datadog API V1 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::V1 + # Filter definition for aggregate filtered queries. + class MonitorFormulaAndFunctionAggregateQueryFilter + include BaseGenericModel + + # Attribute from the base query to filter on. + attr_reader :base_attribute + + # Whether to exclude matching records instead of including them. + attr_accessor :exclude + + # Attribute from the filter query to match against. + attr_reader :filter_attribute + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'base_attribute' => :'base_attribute', + :'exclude' => :'exclude', + :'filter_attribute' => :'filter_attribute' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'base_attribute' => :'String', + :'exclude' => :'Boolean', + :'filter_attribute' => :'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::V1::MonitorFormulaAndFunctionAggregateQueryFilter` initialize method" + end + + # 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)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V1::MonitorFormulaAndFunctionAggregateQueryFilter`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'base_attribute') + self.base_attribute = attributes[:'base_attribute'] + end + + if attributes.key?(:'exclude') + self.exclude = attributes[:'exclude'] + end + + if attributes.key?(:'filter_attribute') + self.filter_attribute = attributes[:'filter_attribute'] + 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 @base_attribute.nil? + return false if @filter_attribute.nil? + true + end + + # Custom attribute writer method with validation + # @param base_attribute [Object] Object to be assigned + # @!visibility private + def base_attribute=(base_attribute) + if base_attribute.nil? + fail ArgumentError, 'invalid value for "base_attribute", base_attribute cannot be nil.' + end + @base_attribute = base_attribute + end + + # Custom attribute writer method with validation + # @param filter_attribute [Object] Object to be assigned + # @!visibility private + def filter_attribute=(filter_attribute) + if filter_attribute.nil? + fail ArgumentError, 'invalid value for "filter_attribute", filter_attribute cannot be nil.' + end + @filter_attribute = filter_attribute + 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 && + base_attribute == o.base_attribute && + exclude == o.exclude && + filter_attribute == o.filter_attribute + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [base_attribute, exclude, filter_attribute].hash + end + end +end diff --git a/lib/datadog_api_client/v1/models/monitor_formula_and_function_aggregate_query_join_condition.rb b/lib/datadog_api_client/v1/models/monitor_formula_and_function_aggregate_query_join_condition.rb new file mode 100644 index 000000000000..becabd4f696b --- /dev/null +++ b/lib/datadog_api_client/v1/models/monitor_formula_and_function_aggregate_query_join_condition.rb @@ -0,0 +1,140 @@ +=begin +#Datadog API V1 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::V1 + # Join condition for aggregate augmented queries. + class MonitorFormulaAndFunctionAggregateQueryJoinCondition + include BaseGenericModel + + # Attribute from the augment query to join on. + attr_reader :augment_attribute + + # Attribute from the base query to join on. + attr_reader :base_attribute + + # Join type for aggregate query join conditions. + attr_reader :join_type + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'augment_attribute' => :'augment_attribute', + :'base_attribute' => :'base_attribute', + :'join_type' => :'join_type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'augment_attribute' => :'String', + :'base_attribute' => :'String', + :'join_type' => :'MonitorFormulaAndFunctionAggregateQueryJoinType' + } + 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::V1::MonitorFormulaAndFunctionAggregateQueryJoinCondition` initialize method" + end + + # 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)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V1::MonitorFormulaAndFunctionAggregateQueryJoinCondition`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'augment_attribute') + self.augment_attribute = attributes[:'augment_attribute'] + end + + if attributes.key?(:'base_attribute') + self.base_attribute = attributes[:'base_attribute'] + end + + if attributes.key?(:'join_type') + self.join_type = attributes[:'join_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 @augment_attribute.nil? + return false if @base_attribute.nil? + return false if @join_type.nil? + true + end + + # Custom attribute writer method with validation + # @param augment_attribute [Object] Object to be assigned + # @!visibility private + def augment_attribute=(augment_attribute) + if augment_attribute.nil? + fail ArgumentError, 'invalid value for "augment_attribute", augment_attribute cannot be nil.' + end + @augment_attribute = augment_attribute + end + + # Custom attribute writer method with validation + # @param base_attribute [Object] Object to be assigned + # @!visibility private + def base_attribute=(base_attribute) + if base_attribute.nil? + fail ArgumentError, 'invalid value for "base_attribute", base_attribute cannot be nil.' + end + @base_attribute = base_attribute + end + + # Custom attribute writer method with validation + # @param join_type [Object] Object to be assigned + # @!visibility private + def join_type=(join_type) + if join_type.nil? + fail ArgumentError, 'invalid value for "join_type", join_type cannot be nil.' + end + @join_type = join_type + 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 && + augment_attribute == o.augment_attribute && + base_attribute == o.base_attribute && + join_type == o.join_type + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [augment_attribute, base_attribute, join_type].hash + end + end +end diff --git a/lib/datadog_api_client/v1/models/monitor_formula_and_function_aggregate_query_join_type.rb b/lib/datadog_api_client/v1/models/monitor_formula_and_function_aggregate_query_join_type.rb new file mode 100644 index 000000000000..e32cd6288f0c --- /dev/null +++ b/lib/datadog_api_client/v1/models/monitor_formula_and_function_aggregate_query_join_type.rb @@ -0,0 +1,27 @@ +=begin +#Datadog API V1 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::V1 + # Join type for aggregate query join conditions. + class MonitorFormulaAndFunctionAggregateQueryJoinType + include BaseEnumModel + + INNER = "inner".freeze + LEFT = "left".freeze + end +end diff --git a/lib/datadog_api_client/v1/models/monitor_formula_and_function_event_query_definition_compute.rb b/lib/datadog_api_client/v1/models/monitor_formula_and_function_event_query_definition_compute.rb index 4610ca2d0075..144b9d3cbeb5 100644 --- a/lib/datadog_api_client/v1/models/monitor_formula_and_function_event_query_definition_compute.rb +++ b/lib/datadog_api_client/v1/models/monitor_formula_and_function_event_query_definition_compute.rb @@ -30,6 +30,9 @@ class MonitorFormulaAndFunctionEventQueryDefinitionCompute # Measurable attribute to compute. attr_accessor :metric + # The name assigned to this aggregation, when multiple aggregations are defined for a query. + attr_accessor :name + attr_accessor :additional_properties # Attribute mapping from ruby-style variable name to JSON key. @@ -38,7 +41,8 @@ def self.attribute_map { :'aggregation' => :'aggregation', :'interval' => :'interval', - :'metric' => :'metric' + :'metric' => :'metric', + :'name' => :'name' } end @@ -48,7 +52,8 @@ def self.openapi_types { :'aggregation' => :'MonitorFormulaAndFunctionEventAggregation', :'interval' => :'Integer', - :'metric' => :'String' + :'metric' => :'String', + :'name' => :'String' } end @@ -81,6 +86,10 @@ def initialize(attributes = {}) if attributes.key?(:'metric') self.metric = attributes[:'metric'] end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end end # Check to see if the all the properties in the model are valid @@ -130,6 +139,7 @@ def ==(o) aggregation == o.aggregation && interval == o.interval && metric == o.metric && + name == o.name && additional_properties == o.additional_properties end @@ -137,7 +147,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [aggregation, interval, metric, additional_properties].hash + [aggregation, interval, metric, name, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v1/models/monitor_formula_and_function_metrics_aggregator.rb b/lib/datadog_api_client/v1/models/monitor_formula_and_function_metrics_aggregator.rb new file mode 100644 index 000000000000..5d9944eb4ce8 --- /dev/null +++ b/lib/datadog_api_client/v1/models/monitor_formula_and_function_metrics_aggregator.rb @@ -0,0 +1,36 @@ +=begin +#Datadog API V1 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::V1 + # Aggregator for metrics queries. + class MonitorFormulaAndFunctionMetricsAggregator + include BaseEnumModel + + AVG = "avg".freeze + MIN = "min".freeze + MAX = "max".freeze + SUM = "sum".freeze + LAST = "last".freeze + MEAN = "mean".freeze + AREA = "area".freeze + L2NORM = "l2norm".freeze + PERCENTILE = "percentile".freeze + STDDEV = "stddev".freeze + COUNT_UNIQUE = "count_unique".freeze + end +end diff --git a/lib/datadog_api_client/v1/models/monitor_formula_and_function_metrics_data_source.rb b/lib/datadog_api_client/v1/models/monitor_formula_and_function_metrics_data_source.rb new file mode 100644 index 000000000000..1f98fb232616 --- /dev/null +++ b/lib/datadog_api_client/v1/models/monitor_formula_and_function_metrics_data_source.rb @@ -0,0 +1,28 @@ +=begin +#Datadog API V1 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::V1 + # Data source for metrics queries. + class MonitorFormulaAndFunctionMetricsDataSource + include BaseEnumModel + + METRICS = "metrics".freeze + CLOUD_COST = "cloud_cost".freeze + DATADOG_USAGE = "datadog_usage".freeze + end +end diff --git a/lib/datadog_api_client/v1/models/monitor_formula_and_function_metrics_query_definition.rb b/lib/datadog_api_client/v1/models/monitor_formula_and_function_metrics_query_definition.rb new file mode 100644 index 000000000000..518f259893d8 --- /dev/null +++ b/lib/datadog_api_client/v1/models/monitor_formula_and_function_metrics_query_definition.rb @@ -0,0 +1,139 @@ +=begin +#Datadog API V1 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::V1 + # A formula and functions metrics query for use in aggregate queries. + class MonitorFormulaAndFunctionMetricsQueryDefinition + include BaseGenericModel + + # Aggregator for metrics queries. + attr_accessor :aggregator + + # Data source for metrics queries. + attr_reader :data_source + + # Name of the query for use in formulas. + attr_accessor :name + + # The metrics query definition. + attr_reader :query + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'aggregator' => :'aggregator', + :'data_source' => :'data_source', + :'name' => :'name', + :'query' => :'query' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'aggregator' => :'MonitorFormulaAndFunctionMetricsAggregator', + :'data_source' => :'MonitorFormulaAndFunctionMetricsDataSource', + :'name' => :'String', + :'query' => :'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::V1::MonitorFormulaAndFunctionMetricsQueryDefinition` initialize method" + end + + # 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)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V1::MonitorFormulaAndFunctionMetricsQueryDefinition`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'aggregator') + self.aggregator = attributes[:'aggregator'] + end + + if attributes.key?(:'data_source') + self.data_source = attributes[:'data_source'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'query') + self.query = attributes[:'query'] + 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_source.nil? + return false if @query.nil? + true + end + + # Custom attribute writer method with validation + # @param data_source [Object] Object to be assigned + # @!visibility private + def data_source=(data_source) + if data_source.nil? + fail ArgumentError, 'invalid value for "data_source", data_source cannot be nil.' + end + @data_source = data_source + 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 + + # 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 && + aggregator == o.aggregator && + data_source == o.data_source && + name == o.name && + query == o.query + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [aggregator, data_source, name, query].hash + end + end +end diff --git a/lib/datadog_api_client/v1/models/monitor_formula_and_function_query_definition.rb b/lib/datadog_api_client/v1/models/monitor_formula_and_function_query_definition.rb index 8c1ee496d5cd..a8ca170a5ed3 100644 --- a/lib/datadog_api_client/v1/models/monitor_formula_and_function_query_definition.rb +++ b/lib/datadog_api_client/v1/models/monitor_formula_and_function_query_definition.rb @@ -28,7 +28,9 @@ def openapi_one_of [ :'MonitorFormulaAndFunctionEventQueryDefinition', :'MonitorFormulaAndFunctionCostQueryDefinition', - :'MonitorFormulaAndFunctionDataQualityQueryDefinition' + :'MonitorFormulaAndFunctionDataQualityQueryDefinition', + :'MonitorFormulaAndFunctionAggregateAugmentedQueryDefinition', + :'MonitorFormulaAndFunctionAggregateFilteredQueryDefinition' ] end # Builds the object diff --git a/lib/datadog_api_client/v1/models/monitor_formula_and_function_reference_table_column.rb b/lib/datadog_api_client/v1/models/monitor_formula_and_function_reference_table_column.rb new file mode 100644 index 000000000000..8339f3f6be4c --- /dev/null +++ b/lib/datadog_api_client/v1/models/monitor_formula_and_function_reference_table_column.rb @@ -0,0 +1,108 @@ +=begin +#Datadog API V1 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::V1 + # A column definition for reference table queries. + class MonitorFormulaAndFunctionReferenceTableColumn + include BaseGenericModel + + # Optional alias for the column. + attr_accessor :_alias + + # Name of the column. + attr_reader :name + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'_alias' => :'alias', + :'name' => :'name' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'_alias' => :'String', + :'name' => :'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::V1::MonitorFormulaAndFunctionReferenceTableColumn` initialize method" + end + + # 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)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V1::MonitorFormulaAndFunctionReferenceTableColumn`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'_alias') + self._alias = attributes[:'_alias'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + 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? + 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 + + # 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 && + _alias == o._alias && + name == o.name + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [_alias, name].hash + end + end +end diff --git a/lib/datadog_api_client/v1/models/monitor_formula_and_function_reference_table_data_source.rb b/lib/datadog_api_client/v1/models/monitor_formula_and_function_reference_table_data_source.rb new file mode 100644 index 000000000000..8146ea3a133c --- /dev/null +++ b/lib/datadog_api_client/v1/models/monitor_formula_and_function_reference_table_data_source.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V1 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::V1 + # Data source for reference table queries. + class MonitorFormulaAndFunctionReferenceTableDataSource + include BaseEnumModel + + REFERENCE_TABLE = "reference_table".freeze + end +end diff --git a/lib/datadog_api_client/v1/models/monitor_formula_and_function_reference_table_query_definition.rb b/lib/datadog_api_client/v1/models/monitor_formula_and_function_reference_table_query_definition.rb new file mode 100644 index 000000000000..500b5f43416d --- /dev/null +++ b/lib/datadog_api_client/v1/models/monitor_formula_and_function_reference_table_query_definition.rb @@ -0,0 +1,151 @@ +=begin +#Datadog API V1 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::V1 + # A reference table query for use in aggregate queries. + class MonitorFormulaAndFunctionReferenceTableQueryDefinition + include BaseGenericModel + + # List of columns to retrieve from the reference table. + attr_accessor :columns + + # Data source for reference table queries. + attr_reader :data_source + + # Name of the query. + attr_accessor :name + + # Optional filter expression for the reference table query. + attr_accessor :query_filter + + # Name of the reference table. + attr_reader :table_name + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'columns' => :'columns', + :'data_source' => :'data_source', + :'name' => :'name', + :'query_filter' => :'query_filter', + :'table_name' => :'table_name' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'columns' => :'Array', + :'data_source' => :'MonitorFormulaAndFunctionReferenceTableDataSource', + :'name' => :'String', + :'query_filter' => :'String', + :'table_name' => :'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::V1::MonitorFormulaAndFunctionReferenceTableQueryDefinition` initialize method" + end + + # 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)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V1::MonitorFormulaAndFunctionReferenceTableQueryDefinition`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'columns') + if (value = attributes[:'columns']).is_a?(Array) + self.columns = value + end + end + + if attributes.key?(:'data_source') + self.data_source = attributes[:'data_source'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'query_filter') + self.query_filter = attributes[:'query_filter'] + end + + if attributes.key?(:'table_name') + self.table_name = attributes[:'table_name'] + 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_source.nil? + return false if @table_name.nil? + true + end + + # Custom attribute writer method with validation + # @param data_source [Object] Object to be assigned + # @!visibility private + def data_source=(data_source) + if data_source.nil? + fail ArgumentError, 'invalid value for "data_source", data_source cannot be nil.' + end + @data_source = data_source + end + + # Custom attribute writer method with validation + # @param table_name [Object] Object to be assigned + # @!visibility private + def table_name=(table_name) + if table_name.nil? + fail ArgumentError, 'invalid value for "table_name", table_name cannot be nil.' + end + @table_name = table_name + 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 && + data_source == o.data_source && + name == o.name && + query_filter == o.query_filter && + table_name == o.table_name + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [columns, data_source, name, query_filter, table_name].hash + end + end +end