From 924ccba0c72845f1e4aef70a2b03930a2e615c45 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Fri, 10 Jul 2026 14:32:33 +0000 Subject: [PATCH] Regenerate client from commit 492dc21 of spec repo --- .generator/schemas/v1/openapi.yaml | 78 ++++++++++ features/v1/dashboards.feature | 6 +- lib/datadog_api_client/inflector.rb | 6 + ...ard_available_values_events_data_source.rb | 28 ++++ ...dashboard_available_values_events_query.rb | 142 ++++++++++++++++++ ...able_values_events_query_group_by_items.rb | 98 ++++++++++++ ...rd_available_values_events_query_search.rb | 98 ++++++++++++ ...ashboard_available_values_metrics_query.rb | 119 +++++++++++++++ .../v1/models/dashboard_template_variable.rb | 22 ++- ...emplate_variable_available_values_query.rb | 63 ++++++++ 10 files changed, 656 insertions(+), 4 deletions(-) create mode 100644 lib/datadog_api_client/v1/models/dashboard_available_values_events_data_source.rb create mode 100644 lib/datadog_api_client/v1/models/dashboard_available_values_events_query.rb create mode 100644 lib/datadog_api_client/v1/models/dashboard_available_values_events_query_group_by_items.rb create mode 100644 lib/datadog_api_client/v1/models/dashboard_available_values_events_query_search.rb create mode 100644 lib/datadog_api_client/v1/models/dashboard_available_values_metrics_query.rb create mode 100644 lib/datadog_api_client/v1/models/dashboard_template_variable_available_values_query.rb diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index b41f414fd369..05258906e676 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -1530,6 +1530,72 @@ components: - layout_type - widgets type: object + DashboardAvailableValuesEventsDataSource: + description: The events-based data source for the query. + enum: + - spans + - logs + - rum + example: spans + type: string + x-enum-varnames: + - SPANS + - LOGS + - RUM + DashboardAvailableValuesEventsQuery: + additionalProperties: false + description: Query for available values using an events-based data source (spans, logs, or rum). + properties: + data_source: + $ref: "#/components/schemas/DashboardAvailableValuesEventsDataSource" + group_by: + description: The fields to group by in the query. + items: + $ref: "#/components/schemas/DashboardAvailableValuesEventsQueryGroupByItems" + type: array + search: + $ref: "#/components/schemas/DashboardAvailableValuesEventsQuerySearch" + required: + - data_source + - search + - group_by + type: object + DashboardAvailableValuesEventsQueryGroupByItems: + additionalProperties: false + description: A field to group by in the available values query. + properties: + facet: + description: The facet to group by. + example: "" + type: string + required: + - facet + type: object + DashboardAvailableValuesEventsQuerySearch: + additionalProperties: false + description: The search filter for the query. + properties: + query: + description: The search query string. + example: "" + type: string + required: + - query + type: object + DashboardAvailableValuesMetricsQuery: + additionalProperties: false + description: Query for available values using the metrics data source. + properties: + data_source: + $ref: "#/components/schemas/FormulaAndFunctionMetricDataSource" + query: + description: The metrics query string. + example: "" + type: string + required: + - data_source + - query + type: object DashboardBulkActionData: description: Dashboard bulk action request data. example: {"id": "123-abc-456", "type": "dashboard"} @@ -1800,6 +1866,13 @@ components: type: string nullable: true type: array + available_values_query: + $ref: "#/components/schemas/DashboardTemplateVariableAvailableValuesQuery" + data_source_mappings: + additionalProperties: + type: string + description: A mapping from data source type to the variable value to use for that data source. + type: object default: deprecated: true description: (deprecated) The default value for the template variable on dashboard load. Cannot be used in conjunction with `defaults`. @@ -1831,6 +1904,11 @@ components: required: - name type: object + DashboardTemplateVariableAvailableValuesQuery: + description: A query that dynamically computes the list of values available for this template variable. + oneOf: + - $ref: "#/components/schemas/DashboardAvailableValuesEventsQuery" + - $ref: "#/components/schemas/DashboardAvailableValuesMetricsQuery" DashboardTemplateVariablePreset: description: Template variables saved views. properties: diff --git a/features/v1/dashboards.feature b/features/v1/dashboards.feature index 28e57ec5e2a7..404e2f6d342b 100644 --- a/features/v1/dashboards.feature +++ b/features/v1/dashboards.feature @@ -90,7 +90,7 @@ Feature: Dashboards @generated @skip @team:DataDog/dashboards-backend Scenario: Create a new dashboard returns "Bad Request" response Given new "CreateDashboard" request - And body with value {"description": null, "is_read_only": false, "layout_type": "ordered", "notify_list": [], "reflow_type": "auto", "restricted_roles": [], "tabs": [{"id": "", "name": "L", "widget_ids": [0]}], "tags": [], "template_variable_presets": [{"template_variables": [{"values": []}]}], "template_variables": [{"available_values": ["my-host", "host1", "host2"], "default": "my-host", "defaults": ["my-host-1", "my-host-2"], "name": "host1", "prefix": "host", "type": "group"}], "title": "", "widgets": [{"definition": {"requests": {"fill": {"q": "avg:system.cpu.user{*}"}}, "type": "hostmap"}}]} + And body with value {"description": null, "is_read_only": false, "layout_type": "ordered", "notify_list": [], "reflow_type": "auto", "restricted_roles": [], "tabs": [{"id": "", "name": "L", "widget_ids": [0]}], "tags": [], "template_variable_presets": [{"template_variables": [{"values": []}]}], "template_variables": [{"available_values": ["my-host", "host1", "host2"], "available_values_query": {"data_source": "spans", "group_by": [{"facet": ""}], "search": {"query": ""}}, "default": "my-host", "defaults": ["my-host-1", "my-host-2"], "name": "host1", "prefix": "host", "type": "group"}], "title": "", "widgets": [{"definition": {"requests": {"fill": {"q": "avg:system.cpu.user{*}"}}, "type": "hostmap"}}]} When the request is sent Then the response status is 400 Bad Request @@ -1481,7 +1481,7 @@ Feature: Dashboards Scenario: Update a dashboard returns "Bad Request" response Given new "UpdateDashboard" request And request contains "dashboard_id" parameter from "REPLACE.ME" - And body with value {"description": null, "is_read_only": false, "layout_type": "ordered", "notify_list": [], "reflow_type": "auto", "restricted_roles": [], "tabs": [{"id": "", "name": "L", "widget_ids": [0]}], "tags": [], "template_variable_presets": [{"template_variables": [{"values": []}]}], "template_variables": [{"available_values": ["my-host", "host1", "host2"], "default": "my-host", "defaults": ["my-host-1", "my-host-2"], "name": "host1", "prefix": "host", "type": "group"}], "title": "", "widgets": [{"definition": {"requests": {"fill": {"q": "avg:system.cpu.user{*}"}}, "type": "hostmap"}}]} + And body with value {"description": null, "is_read_only": false, "layout_type": "ordered", "notify_list": [], "reflow_type": "auto", "restricted_roles": [], "tabs": [{"id": "", "name": "L", "widget_ids": [0]}], "tags": [], "template_variable_presets": [{"template_variables": [{"values": []}]}], "template_variables": [{"available_values": ["my-host", "host1", "host2"], "available_values_query": {"data_source": "spans", "group_by": [{"facet": ""}], "search": {"query": ""}}, "default": "my-host", "defaults": ["my-host-1", "my-host-2"], "name": "host1", "prefix": "host", "type": "group"}], "title": "", "widgets": [{"definition": {"requests": {"fill": {"q": "avg:system.cpu.user{*}"}}, "type": "hostmap"}}]} When the request is sent Then the response status is 400 Bad Request @@ -1489,7 +1489,7 @@ Feature: Dashboards Scenario: Update a dashboard returns "Item Not Found" response Given new "UpdateDashboard" request And request contains "dashboard_id" parameter from "REPLACE.ME" - And body with value {"description": null, "is_read_only": false, "layout_type": "ordered", "notify_list": [], "reflow_type": "auto", "restricted_roles": [], "tabs": [{"id": "", "name": "L", "widget_ids": [0]}], "tags": [], "template_variable_presets": [{"template_variables": [{"values": []}]}], "template_variables": [{"available_values": ["my-host", "host1", "host2"], "default": "my-host", "defaults": ["my-host-1", "my-host-2"], "name": "host1", "prefix": "host", "type": "group"}], "title": "", "widgets": [{"definition": {"requests": {"fill": {"q": "avg:system.cpu.user{*}"}}, "type": "hostmap"}}]} + And body with value {"description": null, "is_read_only": false, "layout_type": "ordered", "notify_list": [], "reflow_type": "auto", "restricted_roles": [], "tabs": [{"id": "", "name": "L", "widget_ids": [0]}], "tags": [], "template_variable_presets": [{"template_variables": [{"values": []}]}], "template_variables": [{"available_values": ["my-host", "host1", "host2"], "available_values_query": {"data_source": "spans", "group_by": [{"facet": ""}], "search": {"query": ""}}, "default": "my-host", "defaults": ["my-host-1", "my-host-2"], "name": "host1", "prefix": "host", "type": "group"}], "title": "", "widgets": [{"definition": {"requests": {"fill": {"q": "avg:system.cpu.user{*}"}}, "type": "hostmap"}}]} When the request is sent Then the response status is 404 Item Not Found diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index bb489f2e6b16..a1d4d6db1c48 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -85,6 +85,11 @@ def overrides "v1.content_encoding" => "ContentEncoding", "v1.creator" => "Creator", "v1.dashboard" => "Dashboard", + "v1.dashboard_available_values_events_data_source" => "DashboardAvailableValuesEventsDataSource", + "v1.dashboard_available_values_events_query" => "DashboardAvailableValuesEventsQuery", + "v1.dashboard_available_values_events_query_group_by_items" => "DashboardAvailableValuesEventsQueryGroupByItems", + "v1.dashboard_available_values_events_query_search" => "DashboardAvailableValuesEventsQuerySearch", + "v1.dashboard_available_values_metrics_query" => "DashboardAvailableValuesMetricsQuery", "v1.dashboard_bulk_action_data" => "DashboardBulkActionData", "v1.dashboard_bulk_delete_request" => "DashboardBulkDeleteRequest", "v1.dashboard_delete_response" => "DashboardDeleteResponse", @@ -103,6 +108,7 @@ def overrides "v1.dashboard_summary_definition" => "DashboardSummaryDefinition", "v1.dashboard_tab" => "DashboardTab", "v1.dashboard_template_variable" => "DashboardTemplateVariable", + "v1.dashboard_template_variable_available_values_query" => "DashboardTemplateVariableAvailableValuesQuery", "v1.dashboard_template_variable_preset" => "DashboardTemplateVariablePreset", "v1.dashboard_template_variable_preset_value" => "DashboardTemplateVariablePresetValue", "v1.dashboard_type" => "DashboardType", diff --git a/lib/datadog_api_client/v1/models/dashboard_available_values_events_data_source.rb b/lib/datadog_api_client/v1/models/dashboard_available_values_events_data_source.rb new file mode 100644 index 000000000000..0d1a7c61cb2e --- /dev/null +++ b/lib/datadog_api_client/v1/models/dashboard_available_values_events_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 + # The events-based data source for the query. + class DashboardAvailableValuesEventsDataSource + include BaseEnumModel + + SPANS = "spans".freeze + LOGS = "logs".freeze + RUM = "rum".freeze + end +end diff --git a/lib/datadog_api_client/v1/models/dashboard_available_values_events_query.rb b/lib/datadog_api_client/v1/models/dashboard_available_values_events_query.rb new file mode 100644 index 000000000000..1b88cb578dc8 --- /dev/null +++ b/lib/datadog_api_client/v1/models/dashboard_available_values_events_query.rb @@ -0,0 +1,142 @@ +=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 + # Query for available values using an events-based data source (spans, logs, or rum). + class DashboardAvailableValuesEventsQuery + include BaseGenericModel + + # The events-based data source for the query. + attr_reader :data_source + + # The fields to group by in the query. + attr_reader :group_by + + # The search filter for the query. + attr_reader :search + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data_source' => :'data_source', + :'group_by' => :'group_by', + :'search' => :'search' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data_source' => :'DashboardAvailableValuesEventsDataSource', + :'group_by' => :'Array', + :'search' => :'DashboardAvailableValuesEventsQuerySearch' + } + 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::DashboardAvailableValuesEventsQuery` 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::DashboardAvailableValuesEventsQuery`. 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?(:'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?(:'search') + self.search = attributes[:'search'] + 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 @group_by.nil? + return false if @search.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 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 search [Object] Object to be assigned + # @!visibility private + def search=(search) + if search.nil? + fail ArgumentError, 'invalid value for "search", search cannot be nil.' + end + @search = search + 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_source == o.data_source && + group_by == o.group_by && + search == o.search + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data_source, group_by, search].hash + end + end +end diff --git a/lib/datadog_api_client/v1/models/dashboard_available_values_events_query_group_by_items.rb b/lib/datadog_api_client/v1/models/dashboard_available_values_events_query_group_by_items.rb new file mode 100644 index 000000000000..5e3cd11d413e --- /dev/null +++ b/lib/datadog_api_client/v1/models/dashboard_available_values_events_query_group_by_items.rb @@ -0,0 +1,98 @@ +=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 field to group by in the available values query. + class DashboardAvailableValuesEventsQueryGroupByItems + include BaseGenericModel + + # The facet to group by. + attr_reader :facet + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'facet' => :'facet' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'facet' => :'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::DashboardAvailableValuesEventsQueryGroupByItems` 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::DashboardAvailableValuesEventsQueryGroupByItems`. 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?(:'facet') + self.facet = attributes[:'facet'] + 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 @facet.nil? + true + end + + # Custom attribute writer method with validation + # @param facet [Object] Object to be assigned + # @!visibility private + def facet=(facet) + if facet.nil? + fail ArgumentError, 'invalid value for "facet", facet cannot be nil.' + end + @facet = facet + 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 && + facet == o.facet + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [facet].hash + end + end +end diff --git a/lib/datadog_api_client/v1/models/dashboard_available_values_events_query_search.rb b/lib/datadog_api_client/v1/models/dashboard_available_values_events_query_search.rb new file mode 100644 index 000000000000..833d4e935519 --- /dev/null +++ b/lib/datadog_api_client/v1/models/dashboard_available_values_events_query_search.rb @@ -0,0 +1,98 @@ +=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 + # The search filter for the query. + class DashboardAvailableValuesEventsQuerySearch + include BaseGenericModel + + # The search query string. + attr_reader :query + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'query' => :'query' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'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::DashboardAvailableValuesEventsQuerySearch` 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::DashboardAvailableValuesEventsQuerySearch`. 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?(:'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 @query.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 + + # 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 + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [query].hash + end + end +end diff --git a/lib/datadog_api_client/v1/models/dashboard_available_values_metrics_query.rb b/lib/datadog_api_client/v1/models/dashboard_available_values_metrics_query.rb new file mode 100644 index 000000000000..127515ddb1ba --- /dev/null +++ b/lib/datadog_api_client/v1/models/dashboard_available_values_metrics_query.rb @@ -0,0 +1,119 @@ +=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 + # Query for available values using the metrics data source. + class DashboardAvailableValuesMetricsQuery + include BaseGenericModel + + # Data source for metrics queries. + attr_reader :data_source + + # The metrics query string. + attr_reader :query + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data_source' => :'data_source', + :'query' => :'query' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data_source' => :'FormulaAndFunctionMetricDataSource', + :'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::DashboardAvailableValuesMetricsQuery` 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::DashboardAvailableValuesMetricsQuery`. 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?(:'data_source') + self.data_source = attributes[:'data_source'] + 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 && + data_source == o.data_source && + query == o.query + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data_source, query].hash + end + end +end diff --git a/lib/datadog_api_client/v1/models/dashboard_template_variable.rb b/lib/datadog_api_client/v1/models/dashboard_template_variable.rb index 97c70feb5f6c..af80a93cbd5a 100644 --- a/lib/datadog_api_client/v1/models/dashboard_template_variable.rb +++ b/lib/datadog_api_client/v1/models/dashboard_template_variable.rb @@ -24,6 +24,12 @@ class DashboardTemplateVariable # The list of values that the template variable drop-down is limited to. attr_accessor :available_values + # A query that dynamically computes the list of values available for this template variable. + attr_accessor :available_values_query + + # A mapping from data source type to the variable value to use for that data source. + attr_accessor :data_source_mappings + # (deprecated) The default value for the template variable on dashboard load. Cannot be used in conjunction with `defaults`. attr_accessor :default @@ -46,6 +52,8 @@ class DashboardTemplateVariable def self.attribute_map { :'available_values' => :'available_values', + :'available_values_query' => :'available_values_query', + :'data_source_mappings' => :'data_source_mappings', :'default' => :'default', :'defaults' => :'defaults', :'name' => :'name', @@ -59,6 +67,8 @@ def self.attribute_map def self.openapi_types { :'available_values' => :'Array', + :'available_values_query' => :'DashboardTemplateVariableAvailableValuesQuery', + :'data_source_mappings' => :'Hash', :'default' => :'String', :'defaults' => :'Array', :'name' => :'String', @@ -102,6 +112,14 @@ def initialize(attributes = {}) end end + if attributes.key?(:'available_values_query') + self.available_values_query = attributes[:'available_values_query'] + end + + if attributes.key?(:'data_source_mappings') + self.data_source_mappings = attributes[:'data_source_mappings'] + end + if attributes.key?(:'default') self.default = attributes[:'default'] end @@ -170,6 +188,8 @@ def ==(o) return true if self.equal?(o) self.class == o.class && available_values == o.available_values && + available_values_query == o.available_values_query && + data_source_mappings == o.data_source_mappings && default == o.default && defaults == o.defaults && name == o.name && @@ -182,7 +202,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [available_values, default, defaults, name, prefix, type, additional_properties].hash + [available_values, available_values_query, data_source_mappings, default, defaults, name, prefix, type, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v1/models/dashboard_template_variable_available_values_query.rb b/lib/datadog_api_client/v1/models/dashboard_template_variable_available_values_query.rb new file mode 100644 index 000000000000..1448edd06e82 --- /dev/null +++ b/lib/datadog_api_client/v1/models/dashboard_template_variable_available_values_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 + # A query that dynamically computes the list of values available for this template variable. + module DashboardTemplateVariableAvailableValuesQuery + class << self + include BaseOneOfModel + include BaseOneOfModelNoDiscriminator + + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'DashboardAvailableValuesEventsQuery', + :'DashboardAvailableValuesMetricsQuery' + ] + 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