diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index b41f414fd..05258906e 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/src/datadogV1/model/mod.rs b/src/datadogV1/model/mod.rs index f0f4f83c6..1b75db9f0 100644 --- a/src/datadogV1/model/mod.rs +++ b/src/datadogV1/model/mod.rs @@ -98,6 +98,20 @@ pub mod model_dashboard_template_variable_preset_value; pub use self::model_dashboard_template_variable_preset_value::DashboardTemplateVariablePresetValue; pub mod model_dashboard_template_variable; pub use self::model_dashboard_template_variable::DashboardTemplateVariable; +pub mod model_dashboard_available_values_events_query; +pub use self::model_dashboard_available_values_events_query::DashboardAvailableValuesEventsQuery; +pub mod model_dashboard_available_values_events_data_source; +pub use self::model_dashboard_available_values_events_data_source::DashboardAvailableValuesEventsDataSource; +pub mod model_dashboard_available_values_events_query_group_by_items; +pub use self::model_dashboard_available_values_events_query_group_by_items::DashboardAvailableValuesEventsQueryGroupByItems; +pub mod model_dashboard_available_values_events_query_search; +pub use self::model_dashboard_available_values_events_query_search::DashboardAvailableValuesEventsQuerySearch; +pub mod model_dashboard_available_values_metrics_query; +pub use self::model_dashboard_available_values_metrics_query::DashboardAvailableValuesMetricsQuery; +pub mod model_formula_and_function_metric_data_source; +pub use self::model_formula_and_function_metric_data_source::FormulaAndFunctionMetricDataSource; +pub mod model_dashboard_template_variable_available_values_query; +pub use self::model_dashboard_template_variable_available_values_query::DashboardTemplateVariableAvailableValuesQuery; pub mod model_widget; pub use self::model_widget::Widget; pub mod model_alert_graph_widget_definition; @@ -188,8 +202,6 @@ pub mod model_formula_and_function_metric_query_definition; pub use self::model_formula_and_function_metric_query_definition::FormulaAndFunctionMetricQueryDefinition; pub mod model_formula_and_function_metric_aggregation; pub use self::model_formula_and_function_metric_aggregation::FormulaAndFunctionMetricAggregation; -pub mod model_formula_and_function_metric_data_source; -pub use self::model_formula_and_function_metric_data_source::FormulaAndFunctionMetricDataSource; pub mod model_formula_and_function_metric_semantic_mode; pub use self::model_formula_and_function_metric_semantic_mode::FormulaAndFunctionMetricSemanticMode; pub mod model_formula_and_function_event_query_definition; diff --git a/src/datadogV1/model/model_dashboard_available_values_events_data_source.rs b/src/datadogV1/model/model_dashboard_available_values_events_data_source.rs new file mode 100644 index 000000000..0a2aece41 --- /dev/null +++ b/src/datadogV1/model/model_dashboard_available_values_events_data_source.rs @@ -0,0 +1,54 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum DashboardAvailableValuesEventsDataSource { + SPANS, + LOGS, + RUM, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for DashboardAvailableValuesEventsDataSource { + fn to_string(&self) -> String { + match self { + Self::SPANS => String::from("spans"), + Self::LOGS => String::from("logs"), + Self::RUM => String::from("rum"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for DashboardAvailableValuesEventsDataSource { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for DashboardAvailableValuesEventsDataSource { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "spans" => Self::SPANS, + "logs" => Self::LOGS, + "rum" => Self::RUM, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV1/model/model_dashboard_available_values_events_query.rs b/src/datadogV1/model/model_dashboard_available_values_events_query.rs new file mode 100644 index 000000000..463ea4d09 --- /dev/null +++ b/src/datadogV1/model/model_dashboard_available_values_events_query.rs @@ -0,0 +1,116 @@ +// 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 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Query for available values using an events-based data source (spans, logs, or rum). +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DashboardAvailableValuesEventsQuery { + /// The events-based data source for the query. + #[serde(rename = "data_source")] + pub data_source: crate::datadogV1::model::DashboardAvailableValuesEventsDataSource, + /// The fields to group by in the query. + #[serde(rename = "group_by")] + pub group_by: Vec, + /// The search filter for the query. + #[serde(rename = "search")] + pub search: crate::datadogV1::model::DashboardAvailableValuesEventsQuerySearch, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DashboardAvailableValuesEventsQuery { + pub fn new( + data_source: crate::datadogV1::model::DashboardAvailableValuesEventsDataSource, + group_by: Vec, + search: crate::datadogV1::model::DashboardAvailableValuesEventsQuerySearch, + ) -> DashboardAvailableValuesEventsQuery { + DashboardAvailableValuesEventsQuery { + data_source, + group_by, + search, + _unparsed: false, + } + } +} + +impl<'de> Deserialize<'de> for DashboardAvailableValuesEventsQuery { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DashboardAvailableValuesEventsQueryVisitor; + impl<'a> Visitor<'a> for DashboardAvailableValuesEventsQueryVisitor { + type Value = DashboardAvailableValuesEventsQuery; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data_source: Option< + crate::datadogV1::model::DashboardAvailableValuesEventsDataSource, + > = None; + let mut group_by: Option< + Vec, + > = None; + let mut search: Option< + crate::datadogV1::model::DashboardAvailableValuesEventsQuerySearch, + > = None; + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data_source" => { + data_source = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _data_source) = data_source { + match _data_source { + crate::datadogV1::model::DashboardAvailableValuesEventsDataSource::UnparsedObject(_data_source) => { + _unparsed = true; + }, + _ => {} + } + } + } + "group_by" => { + group_by = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "search" => { + search = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + return Err(serde::de::Error::custom( + "Additional properties not allowed", + )); + } + } + } + let data_source = + data_source.ok_or_else(|| M::Error::missing_field("data_source"))?; + let group_by = group_by.ok_or_else(|| M::Error::missing_field("group_by"))?; + let search = search.ok_or_else(|| M::Error::missing_field("search"))?; + + let content = DashboardAvailableValuesEventsQuery { + data_source, + group_by, + search, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DashboardAvailableValuesEventsQueryVisitor) + } +} diff --git a/src/datadogV1/model/model_dashboard_available_values_events_query_group_by_items.rs b/src/datadogV1/model/model_dashboard_available_values_events_query_group_by_items.rs new file mode 100644 index 000000000..54627e1dc --- /dev/null +++ b/src/datadogV1/model/model_dashboard_available_values_events_query_group_by_items.rs @@ -0,0 +1,73 @@ +// 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 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// A field to group by in the available values query. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DashboardAvailableValuesEventsQueryGroupByItems { + /// The facet to group by. + #[serde(rename = "facet")] + pub facet: String, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DashboardAvailableValuesEventsQueryGroupByItems { + pub fn new(facet: String) -> DashboardAvailableValuesEventsQueryGroupByItems { + DashboardAvailableValuesEventsQueryGroupByItems { + facet, + _unparsed: false, + } + } +} + +impl<'de> Deserialize<'de> for DashboardAvailableValuesEventsQueryGroupByItems { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DashboardAvailableValuesEventsQueryGroupByItemsVisitor; + impl<'a> Visitor<'a> for DashboardAvailableValuesEventsQueryGroupByItemsVisitor { + type Value = DashboardAvailableValuesEventsQueryGroupByItems; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut facet: Option = None; + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "facet" => { + facet = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + return Err(serde::de::Error::custom( + "Additional properties not allowed", + )); + } + } + } + let facet = facet.ok_or_else(|| M::Error::missing_field("facet"))?; + + let content = DashboardAvailableValuesEventsQueryGroupByItems { facet, _unparsed }; + + Ok(content) + } + } + + deserializer.deserialize_any(DashboardAvailableValuesEventsQueryGroupByItemsVisitor) + } +} diff --git a/src/datadogV1/model/model_dashboard_available_values_events_query_search.rs b/src/datadogV1/model/model_dashboard_available_values_events_query_search.rs new file mode 100644 index 000000000..3a98bf9a4 --- /dev/null +++ b/src/datadogV1/model/model_dashboard_available_values_events_query_search.rs @@ -0,0 +1,73 @@ +// 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 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The search filter for the query. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DashboardAvailableValuesEventsQuerySearch { + /// The search query string. + #[serde(rename = "query")] + pub query: String, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DashboardAvailableValuesEventsQuerySearch { + pub fn new(query: String) -> DashboardAvailableValuesEventsQuerySearch { + DashboardAvailableValuesEventsQuerySearch { + query, + _unparsed: false, + } + } +} + +impl<'de> Deserialize<'de> for DashboardAvailableValuesEventsQuerySearch { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DashboardAvailableValuesEventsQuerySearchVisitor; + impl<'a> Visitor<'a> for DashboardAvailableValuesEventsQuerySearchVisitor { + type Value = DashboardAvailableValuesEventsQuerySearch; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut query: Option = None; + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "query" => { + query = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + return Err(serde::de::Error::custom( + "Additional properties not allowed", + )); + } + } + } + let query = query.ok_or_else(|| M::Error::missing_field("query"))?; + + let content = DashboardAvailableValuesEventsQuerySearch { query, _unparsed }; + + Ok(content) + } + } + + deserializer.deserialize_any(DashboardAvailableValuesEventsQuerySearchVisitor) + } +} diff --git a/src/datadogV1/model/model_dashboard_available_values_metrics_query.rs b/src/datadogV1/model/model_dashboard_available_values_metrics_query.rs new file mode 100644 index 000000000..7ba190213 --- /dev/null +++ b/src/datadogV1/model/model_dashboard_available_values_metrics_query.rs @@ -0,0 +1,101 @@ +// 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 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Query for available values using the metrics data source. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DashboardAvailableValuesMetricsQuery { + /// Data source for metrics queries. + #[serde(rename = "data_source")] + pub data_source: crate::datadogV1::model::FormulaAndFunctionMetricDataSource, + /// The metrics query string. + #[serde(rename = "query")] + pub query: String, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DashboardAvailableValuesMetricsQuery { + pub fn new( + data_source: crate::datadogV1::model::FormulaAndFunctionMetricDataSource, + query: String, + ) -> DashboardAvailableValuesMetricsQuery { + DashboardAvailableValuesMetricsQuery { + data_source, + query, + _unparsed: false, + } + } +} + +impl<'de> Deserialize<'de> for DashboardAvailableValuesMetricsQuery { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DashboardAvailableValuesMetricsQueryVisitor; + impl<'a> Visitor<'a> for DashboardAvailableValuesMetricsQueryVisitor { + type Value = DashboardAvailableValuesMetricsQuery; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data_source: Option< + crate::datadogV1::model::FormulaAndFunctionMetricDataSource, + > = None; + let mut query: Option = None; + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data_source" => { + data_source = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _data_source) = data_source { + match _data_source { + crate::datadogV1::model::FormulaAndFunctionMetricDataSource::UnparsedObject(_data_source) => { + _unparsed = true; + }, + _ => {} + } + } + } + "query" => { + query = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + return Err(serde::de::Error::custom( + "Additional properties not allowed", + )); + } + } + } + let data_source = + data_source.ok_or_else(|| M::Error::missing_field("data_source"))?; + let query = query.ok_or_else(|| M::Error::missing_field("query"))?; + + let content = DashboardAvailableValuesMetricsQuery { + data_source, + query, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DashboardAvailableValuesMetricsQueryVisitor) + } +} diff --git a/src/datadogV1/model/model_dashboard_template_variable.rs b/src/datadogV1/model/model_dashboard_template_variable.rs index d6aa81f5d..33c80fad9 100644 --- a/src/datadogV1/model/model_dashboard_template_variable.rs +++ b/src/datadogV1/model/model_dashboard_template_variable.rs @@ -18,6 +18,13 @@ pub struct DashboardTemplateVariable { with = "::serde_with::rust::double_option" )] pub available_values: Option>>, + /// A query that dynamically computes the list of values available for this template variable. + #[serde(rename = "available_values_query")] + pub available_values_query: + Option, + /// A mapping from data source type to the variable value to use for that data source. + #[serde(rename = "data_source_mappings")] + pub data_source_mappings: Option>, /// (deprecated) The default value for the template variable on dashboard load. Cannot be used in conjunction with `defaults`. #[deprecated] #[serde( @@ -50,6 +57,8 @@ impl DashboardTemplateVariable { #[allow(deprecated)] DashboardTemplateVariable { available_values: None, + available_values_query: None, + data_source_mappings: None, default: None, defaults: None, name, @@ -66,6 +75,24 @@ impl DashboardTemplateVariable { self } + #[allow(deprecated)] + pub fn available_values_query( + mut self, + value: crate::datadogV1::model::DashboardTemplateVariableAvailableValuesQuery, + ) -> Self { + self.available_values_query = Some(value); + self + } + + #[allow(deprecated)] + pub fn data_source_mappings( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.data_source_mappings = Some(value); + self + } + #[allow(deprecated)] pub fn default(mut self, value: Option) -> Self { self.default = Some(value); @@ -117,6 +144,11 @@ impl<'de> Deserialize<'de> for DashboardTemplateVariable { M: MapAccess<'a>, { let mut available_values: Option>> = None; + let mut available_values_query: Option< + crate::datadogV1::model::DashboardTemplateVariableAvailableValuesQuery, + > = None; + let mut data_source_mappings: Option> = + None; let mut default: Option> = None; let mut defaults: Option> = None; let mut name: Option = None; @@ -134,6 +166,28 @@ impl<'de> Deserialize<'de> for DashboardTemplateVariable { available_values = Some(serde_json::from_value(v).map_err(M::Error::custom)?); } + "available_values_query" => { + if v.is_null() { + continue; + } + available_values_query = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _available_values_query) = available_values_query { + match _available_values_query { + crate::datadogV1::model::DashboardTemplateVariableAvailableValuesQuery::UnparsedObject(_available_values_query) => { + _unparsed = true; + }, + _ => {} + } + } + } + "data_source_mappings" => { + if v.is_null() { + continue; + } + data_source_mappings = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } "default" => { default = Some(serde_json::from_value(v).map_err(M::Error::custom)?); } @@ -164,6 +218,8 @@ impl<'de> Deserialize<'de> for DashboardTemplateVariable { #[allow(deprecated)] let content = DashboardTemplateVariable { available_values, + available_values_query, + data_source_mappings, default, defaults, name, diff --git a/src/datadogV1/model/model_dashboard_template_variable_available_values_query.rs b/src/datadogV1/model/model_dashboard_template_variable_available_values_query.rs new file mode 100644 index 000000000..277876b75 --- /dev/null +++ b/src/datadogV1/model/model_dashboard_template_variable_available_values_query.rs @@ -0,0 +1,49 @@ +// 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 2019-Present Datadog, Inc. +use serde::{Deserialize, Deserializer, Serialize}; + +/// A query that dynamically computes the list of values available for this template variable. +#[non_exhaustive] +#[derive(Clone, Debug, PartialEq, Serialize)] +#[serde(untagged)] +pub enum DashboardTemplateVariableAvailableValuesQuery { + DashboardAvailableValuesEventsQuery( + Box, + ), + DashboardAvailableValuesMetricsQuery( + Box, + ), + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl<'de> Deserialize<'de> for DashboardTemplateVariableAvailableValuesQuery { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let value: serde_json::Value = Deserialize::deserialize(deserializer)?; + if let Ok(_v) = serde_json::from_value::< + Box, + >(value.clone()) + { + if !_v._unparsed { + return Ok(DashboardTemplateVariableAvailableValuesQuery::DashboardAvailableValuesEventsQuery(_v)); + } + } + if let Ok(_v) = serde_json::from_value::< + Box, + >(value.clone()) + { + if !_v._unparsed { + return Ok(DashboardTemplateVariableAvailableValuesQuery::DashboardAvailableValuesMetricsQuery(_v)); + } + } + + return Ok( + DashboardTemplateVariableAvailableValuesQuery::UnparsedObject( + crate::datadog::UnparsedObject { value }, + ), + ); + } +} diff --git a/tests/scenarios/features/v1/dashboards.feature b/tests/scenarios/features/v1/dashboards.feature index 28e57ec5e..404e2f6d3 100644 --- a/tests/scenarios/features/v1/dashboards.feature +++ b/tests/scenarios/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