Skip to content

Commit 2114e63

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 492dc21 of spec repo
1 parent b314617 commit 2114e63

10 files changed

Lines changed: 617 additions & 5 deletions

.generator/schemas/v1/openapi.yaml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1530,6 +1530,72 @@ components:
15301530
- layout_type
15311531
- widgets
15321532
type: object
1533+
DashboardAvailableValuesEventsDataSource:
1534+
description: The events-based data source for the query.
1535+
enum:
1536+
- spans
1537+
- logs
1538+
- rum
1539+
example: spans
1540+
type: string
1541+
x-enum-varnames:
1542+
- SPANS
1543+
- LOGS
1544+
- RUM
1545+
DashboardAvailableValuesEventsQuery:
1546+
additionalProperties: false
1547+
description: Query for available values using an events-based data source (spans, logs, or rum).
1548+
properties:
1549+
data_source:
1550+
$ref: "#/components/schemas/DashboardAvailableValuesEventsDataSource"
1551+
group_by:
1552+
description: The fields to group by in the query.
1553+
items:
1554+
$ref: "#/components/schemas/DashboardAvailableValuesEventsQueryGroupByItems"
1555+
type: array
1556+
search:
1557+
$ref: "#/components/schemas/DashboardAvailableValuesEventsQuerySearch"
1558+
required:
1559+
- data_source
1560+
- search
1561+
- group_by
1562+
type: object
1563+
DashboardAvailableValuesEventsQueryGroupByItems:
1564+
additionalProperties: false
1565+
description: A field to group by in the available values query.
1566+
properties:
1567+
facet:
1568+
description: The facet to group by.
1569+
example: ""
1570+
type: string
1571+
required:
1572+
- facet
1573+
type: object
1574+
DashboardAvailableValuesEventsQuerySearch:
1575+
additionalProperties: false
1576+
description: The search filter for the query.
1577+
properties:
1578+
query:
1579+
description: The search query string.
1580+
example: ""
1581+
type: string
1582+
required:
1583+
- query
1584+
type: object
1585+
DashboardAvailableValuesMetricsQuery:
1586+
additionalProperties: false
1587+
description: Query for available values using the metrics data source.
1588+
properties:
1589+
data_source:
1590+
$ref: "#/components/schemas/FormulaAndFunctionMetricDataSource"
1591+
query:
1592+
description: The metrics query string.
1593+
example: ""
1594+
type: string
1595+
required:
1596+
- data_source
1597+
- query
1598+
type: object
15331599
DashboardBulkActionData:
15341600
description: Dashboard bulk action request data.
15351601
example: {"id": "123-abc-456", "type": "dashboard"}
@@ -1800,6 +1866,13 @@ components:
18001866
type: string
18011867
nullable: true
18021868
type: array
1869+
available_values_query:
1870+
$ref: "#/components/schemas/DashboardTemplateVariableAvailableValuesQuery"
1871+
data_source_mappings:
1872+
additionalProperties:
1873+
type: string
1874+
description: A mapping from data source type to the variable value to use for that data source.
1875+
type: object
18031876
default:
18041877
deprecated: true
18051878
description: (deprecated) The default value for the template variable on dashboard load. Cannot be used in conjunction with `defaults`.
@@ -1831,6 +1904,11 @@ components:
18311904
required:
18321905
- name
18331906
type: object
1907+
DashboardTemplateVariableAvailableValuesQuery:
1908+
description: A query that dynamically computes the list of values available for this template variable.
1909+
oneOf:
1910+
- $ref: "#/components/schemas/DashboardAvailableValuesEventsQuery"
1911+
- $ref: "#/components/schemas/DashboardAvailableValuesMetricsQuery"
18341912
DashboardTemplateVariablePreset:
18351913
description: Template variables saved views.
18361914
properties:

src/datadogV1/model/mod.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,20 @@ pub mod model_dashboard_template_variable_preset_value;
9898
pub use self::model_dashboard_template_variable_preset_value::DashboardTemplateVariablePresetValue;
9999
pub mod model_dashboard_template_variable;
100100
pub use self::model_dashboard_template_variable::DashboardTemplateVariable;
101+
pub mod model_dashboard_available_values_events_query;
102+
pub use self::model_dashboard_available_values_events_query::DashboardAvailableValuesEventsQuery;
103+
pub mod model_dashboard_available_values_events_data_source;
104+
pub use self::model_dashboard_available_values_events_data_source::DashboardAvailableValuesEventsDataSource;
105+
pub mod model_dashboard_available_values_events_query_group_by_items;
106+
pub use self::model_dashboard_available_values_events_query_group_by_items::DashboardAvailableValuesEventsQueryGroupByItems;
107+
pub mod model_dashboard_available_values_events_query_search;
108+
pub use self::model_dashboard_available_values_events_query_search::DashboardAvailableValuesEventsQuerySearch;
109+
pub mod model_dashboard_available_values_metrics_query;
110+
pub use self::model_dashboard_available_values_metrics_query::DashboardAvailableValuesMetricsQuery;
111+
pub mod model_formula_and_function_metric_data_source;
112+
pub use self::model_formula_and_function_metric_data_source::FormulaAndFunctionMetricDataSource;
113+
pub mod model_dashboard_template_variable_available_values_query;
114+
pub use self::model_dashboard_template_variable_available_values_query::DashboardTemplateVariableAvailableValuesQuery;
101115
pub mod model_widget;
102116
pub use self::model_widget::Widget;
103117
pub mod model_alert_graph_widget_definition;
@@ -188,8 +202,6 @@ pub mod model_formula_and_function_metric_query_definition;
188202
pub use self::model_formula_and_function_metric_query_definition::FormulaAndFunctionMetricQueryDefinition;
189203
pub mod model_formula_and_function_metric_aggregation;
190204
pub use self::model_formula_and_function_metric_aggregation::FormulaAndFunctionMetricAggregation;
191-
pub mod model_formula_and_function_metric_data_source;
192-
pub use self::model_formula_and_function_metric_data_source::FormulaAndFunctionMetricDataSource;
193205
pub mod model_formula_and_function_metric_semantic_mode;
194206
pub use self::model_formula_and_function_metric_semantic_mode::FormulaAndFunctionMetricSemanticMode;
195207
pub mod model_formula_and_function_event_query_definition;
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
2+
// This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
// Copyright 2019-Present Datadog, Inc.
4+
5+
use serde::{Deserialize, Deserializer, Serialize, Serializer};
6+
7+
#[non_exhaustive]
8+
#[derive(Clone, Debug, Eq, PartialEq)]
9+
pub enum DashboardAvailableValuesEventsDataSource {
10+
SPANS,
11+
LOGS,
12+
RUM,
13+
UnparsedObject(crate::datadog::UnparsedObject),
14+
}
15+
16+
impl ToString for DashboardAvailableValuesEventsDataSource {
17+
fn to_string(&self) -> String {
18+
match self {
19+
Self::SPANS => String::from("spans"),
20+
Self::LOGS => String::from("logs"),
21+
Self::RUM => String::from("rum"),
22+
Self::UnparsedObject(v) => v.value.to_string(),
23+
}
24+
}
25+
}
26+
27+
impl Serialize for DashboardAvailableValuesEventsDataSource {
28+
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
29+
where
30+
S: Serializer,
31+
{
32+
match self {
33+
Self::UnparsedObject(v) => v.serialize(serializer),
34+
_ => serializer.serialize_str(self.to_string().as_str()),
35+
}
36+
}
37+
}
38+
39+
impl<'de> Deserialize<'de> for DashboardAvailableValuesEventsDataSource {
40+
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
41+
where
42+
D: Deserializer<'de>,
43+
{
44+
let s: String = String::deserialize(deserializer)?;
45+
Ok(match s.as_str() {
46+
"spans" => Self::SPANS,
47+
"logs" => Self::LOGS,
48+
"rum" => Self::RUM,
49+
_ => Self::UnparsedObject(crate::datadog::UnparsedObject {
50+
value: serde_json::Value::String(s.into()),
51+
}),
52+
})
53+
}
54+
}
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
2+
// This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
// Copyright 2019-Present Datadog, Inc.
4+
use serde::de::{Error, MapAccess, Visitor};
5+
use serde::{Deserialize, Deserializer, Serialize};
6+
use serde_with::skip_serializing_none;
7+
use std::fmt::{self, Formatter};
8+
9+
/// Query for available values using an events-based data source (spans, logs, or rum).
10+
#[non_exhaustive]
11+
#[skip_serializing_none]
12+
#[derive(Clone, Debug, PartialEq, Serialize)]
13+
pub struct DashboardAvailableValuesEventsQuery {
14+
/// The events-based data source for the query.
15+
#[serde(rename = "data_source")]
16+
pub data_source: crate::datadogV1::model::DashboardAvailableValuesEventsDataSource,
17+
/// The fields to group by in the query.
18+
#[serde(rename = "group_by")]
19+
pub group_by: Vec<crate::datadogV1::model::DashboardAvailableValuesEventsQueryGroupByItems>,
20+
/// The search filter for the query.
21+
#[serde(rename = "search")]
22+
pub search: crate::datadogV1::model::DashboardAvailableValuesEventsQuerySearch,
23+
#[serde(skip)]
24+
#[serde(default)]
25+
pub(crate) _unparsed: bool,
26+
}
27+
28+
impl DashboardAvailableValuesEventsQuery {
29+
pub fn new(
30+
data_source: crate::datadogV1::model::DashboardAvailableValuesEventsDataSource,
31+
group_by: Vec<crate::datadogV1::model::DashboardAvailableValuesEventsQueryGroupByItems>,
32+
search: crate::datadogV1::model::DashboardAvailableValuesEventsQuerySearch,
33+
) -> DashboardAvailableValuesEventsQuery {
34+
DashboardAvailableValuesEventsQuery {
35+
data_source,
36+
group_by,
37+
search,
38+
_unparsed: false,
39+
}
40+
}
41+
}
42+
43+
impl<'de> Deserialize<'de> for DashboardAvailableValuesEventsQuery {
44+
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
45+
where
46+
D: Deserializer<'de>,
47+
{
48+
struct DashboardAvailableValuesEventsQueryVisitor;
49+
impl<'a> Visitor<'a> for DashboardAvailableValuesEventsQueryVisitor {
50+
type Value = DashboardAvailableValuesEventsQuery;
51+
52+
fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result {
53+
f.write_str("a mapping")
54+
}
55+
56+
fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
57+
where
58+
M: MapAccess<'a>,
59+
{
60+
let mut data_source: Option<
61+
crate::datadogV1::model::DashboardAvailableValuesEventsDataSource,
62+
> = None;
63+
let mut group_by: Option<
64+
Vec<crate::datadogV1::model::DashboardAvailableValuesEventsQueryGroupByItems>,
65+
> = None;
66+
let mut search: Option<
67+
crate::datadogV1::model::DashboardAvailableValuesEventsQuerySearch,
68+
> = None;
69+
let mut _unparsed = false;
70+
71+
while let Some((k, v)) = map.next_entry::<String, serde_json::Value>()? {
72+
match k.as_str() {
73+
"data_source" => {
74+
data_source =
75+
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
76+
if let Some(ref _data_source) = data_source {
77+
match _data_source {
78+
crate::datadogV1::model::DashboardAvailableValuesEventsDataSource::UnparsedObject(_data_source) => {
79+
_unparsed = true;
80+
},
81+
_ => {}
82+
}
83+
}
84+
}
85+
"group_by" => {
86+
group_by = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
87+
}
88+
"search" => {
89+
search = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
90+
}
91+
&_ => {
92+
return Err(serde::de::Error::custom(
93+
"Additional properties not allowed",
94+
));
95+
}
96+
}
97+
}
98+
let data_source =
99+
data_source.ok_or_else(|| M::Error::missing_field("data_source"))?;
100+
let group_by = group_by.ok_or_else(|| M::Error::missing_field("group_by"))?;
101+
let search = search.ok_or_else(|| M::Error::missing_field("search"))?;
102+
103+
let content = DashboardAvailableValuesEventsQuery {
104+
data_source,
105+
group_by,
106+
search,
107+
_unparsed,
108+
};
109+
110+
Ok(content)
111+
}
112+
}
113+
114+
deserializer.deserialize_any(DashboardAvailableValuesEventsQueryVisitor)
115+
}
116+
}
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
2+
// This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
// Copyright 2019-Present Datadog, Inc.
4+
use serde::de::{Error, MapAccess, Visitor};
5+
use serde::{Deserialize, Deserializer, Serialize};
6+
use serde_with::skip_serializing_none;
7+
use std::fmt::{self, Formatter};
8+
9+
/// A field to group by in the available values query.
10+
#[non_exhaustive]
11+
#[skip_serializing_none]
12+
#[derive(Clone, Debug, PartialEq, Serialize)]
13+
pub struct DashboardAvailableValuesEventsQueryGroupByItems {
14+
/// The facet to group by.
15+
#[serde(rename = "facet")]
16+
pub facet: String,
17+
#[serde(skip)]
18+
#[serde(default)]
19+
pub(crate) _unparsed: bool,
20+
}
21+
22+
impl DashboardAvailableValuesEventsQueryGroupByItems {
23+
pub fn new(facet: String) -> DashboardAvailableValuesEventsQueryGroupByItems {
24+
DashboardAvailableValuesEventsQueryGroupByItems {
25+
facet,
26+
_unparsed: false,
27+
}
28+
}
29+
}
30+
31+
impl<'de> Deserialize<'de> for DashboardAvailableValuesEventsQueryGroupByItems {
32+
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
33+
where
34+
D: Deserializer<'de>,
35+
{
36+
struct DashboardAvailableValuesEventsQueryGroupByItemsVisitor;
37+
impl<'a> Visitor<'a> for DashboardAvailableValuesEventsQueryGroupByItemsVisitor {
38+
type Value = DashboardAvailableValuesEventsQueryGroupByItems;
39+
40+
fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result {
41+
f.write_str("a mapping")
42+
}
43+
44+
fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
45+
where
46+
M: MapAccess<'a>,
47+
{
48+
let mut facet: Option<String> = None;
49+
let mut _unparsed = false;
50+
51+
while let Some((k, v)) = map.next_entry::<String, serde_json::Value>()? {
52+
match k.as_str() {
53+
"facet" => {
54+
facet = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
55+
}
56+
&_ => {
57+
return Err(serde::de::Error::custom(
58+
"Additional properties not allowed",
59+
));
60+
}
61+
}
62+
}
63+
let facet = facet.ok_or_else(|| M::Error::missing_field("facet"))?;
64+
65+
let content = DashboardAvailableValuesEventsQueryGroupByItems { facet, _unparsed };
66+
67+
Ok(content)
68+
}
69+
}
70+
71+
deserializer.deserialize_any(DashboardAvailableValuesEventsQueryGroupByItemsVisitor)
72+
}
73+
}

0 commit comments

Comments
 (0)