Skip to content

Commit 804b321

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit e27e19e of spec repo
1 parent 1638c53 commit 804b321

10 files changed

+460
-27
lines changed

.generator/schemas/v1/openapi.yaml

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3435,9 +3435,10 @@ components:
34353435
$ref: '#/components/schemas/WidgetCustomLink'
34363436
type: array
34373437
requests:
3438-
description: 'Array of one request object to display in the widget. The
3439-
request must contain a `group-by` tag whose value is a country ISO code.
3440-
3438+
description: 'Array of request objects to display in the widget. The array
3439+
may have one optional request object for region layer and/or one optional
3440+
request object for points layer. The request for region layer must contain
3441+
a `group-by` tag whose value is a country ISO code.
34413442

34423443
See the [Request JSON schema documentation](https://docs.datadoghq.com/dashboards/graphing_json/request_json)
34433444

@@ -3448,7 +3449,7 @@ components:
34483449
query: <METRIC_1>{<SCOPE_1>}
34493450
items:
34503451
$ref: '#/components/schemas/GeomapWidgetRequest'
3451-
maxItems: 1
3452+
maxItems: 2
34523453
minItems: 1
34533454
type: array
34543455
style:
@@ -3506,8 +3507,9 @@ components:
35063507
focus: WORLD
35073508
properties:
35083509
focus:
3509-
description: The 2-letter ISO code of a country to focus the map on. Or
3510-
`WORLD`.
3510+
description: The 2-letter ISO code of a country to focus the map on, or
3511+
`WORLD` for global view, or a region (`EMEA`, `APAC`, `LATAM`), or a continent
3512+
(`NORTH_AMERICA`, `SOUTH_AMERICA`, `EUROPE`, `AFRICA`, `ASIA`, `OCEANIA`).
35113513
example: WORLD
35123514
type: string
35133515
required:
@@ -3526,6 +3528,12 @@ components:
35263528
items:
35273529
$ref: '#/components/schemas/ListStreamColumn'
35283530
type: array
3531+
conditional_formats:
3532+
description: Threshold (numeric) conditional formatting rules may be used
3533+
by the regions layer.
3534+
items:
3535+
$ref: '#/components/schemas/WidgetConditionalFormat'
3536+
type: array
35293537
formulas:
35303538
description: List of formulas that operate on queries.
35313539
items:
@@ -3551,6 +3559,25 @@ components:
35513559
$ref: '#/components/schemas/LogQueryDefinition'
35523560
sort:
35533561
$ref: '#/components/schemas/WidgetSortBy'
3562+
style:
3563+
$ref: '#/components/schemas/GeomapWidgetRequestStyle'
3564+
text_formats:
3565+
description: Text formatting rules may be used by the points layer.
3566+
items:
3567+
$ref: '#/components/schemas/TableWidgetTextFormatRule'
3568+
type: array
3569+
type: object
3570+
GeomapWidgetRequestStyle:
3571+
description: The style to apply to the request for points layer.
3572+
example:
3573+
color_by: status
3574+
properties:
3575+
color_by:
3576+
description: The category to color the points by.
3577+
example: status
3578+
type: string
3579+
required:
3580+
- color_by
35543581
type: object
35553582
GraphSnapshot:
35563583
description: Object representing a graph snapshot.
Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
// Create a geomap widget with conditional formats and text formats
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV1::api_dashboards::DashboardsAPI;
4+
use datadog_api_client::datadogV1::model::Dashboard;
5+
use datadog_api_client::datadogV1::model::DashboardLayoutType;
6+
use datadog_api_client::datadogV1::model::DashboardReflowType;
7+
use datadog_api_client::datadogV1::model::FormulaAndFunctionEventAggregation;
8+
use datadog_api_client::datadogV1::model::FormulaAndFunctionEventQueryDefinition;
9+
use datadog_api_client::datadogV1::model::FormulaAndFunctionEventQueryDefinitionCompute;
10+
use datadog_api_client::datadogV1::model::FormulaAndFunctionEventQueryDefinitionSearch;
11+
use datadog_api_client::datadogV1::model::FormulaAndFunctionEventsDataSource;
12+
use datadog_api_client::datadogV1::model::FormulaAndFunctionQueryDefinition;
13+
use datadog_api_client::datadogV1::model::FormulaAndFunctionResponseFormat;
14+
use datadog_api_client::datadogV1::model::FormulaType;
15+
use datadog_api_client::datadogV1::model::GeomapWidgetDefinition;
16+
use datadog_api_client::datadogV1::model::GeomapWidgetDefinitionStyle;
17+
use datadog_api_client::datadogV1::model::GeomapWidgetDefinitionType;
18+
use datadog_api_client::datadogV1::model::GeomapWidgetDefinitionView;
19+
use datadog_api_client::datadogV1::model::GeomapWidgetRequest;
20+
use datadog_api_client::datadogV1::model::GeomapWidgetRequestStyle;
21+
use datadog_api_client::datadogV1::model::ListStreamColumn;
22+
use datadog_api_client::datadogV1::model::ListStreamColumnWidth;
23+
use datadog_api_client::datadogV1::model::ListStreamQuery;
24+
use datadog_api_client::datadogV1::model::ListStreamSource;
25+
use datadog_api_client::datadogV1::model::TableWidgetTextFormatMatch;
26+
use datadog_api_client::datadogV1::model::TableWidgetTextFormatMatchType;
27+
use datadog_api_client::datadogV1::model::TableWidgetTextFormatPalette;
28+
use datadog_api_client::datadogV1::model::TableWidgetTextFormatRule;
29+
use datadog_api_client::datadogV1::model::Widget;
30+
use datadog_api_client::datadogV1::model::WidgetComparator;
31+
use datadog_api_client::datadogV1::model::WidgetConditionalFormat;
32+
use datadog_api_client::datadogV1::model::WidgetDefinition;
33+
use datadog_api_client::datadogV1::model::WidgetFormula;
34+
use datadog_api_client::datadogV1::model::WidgetFormulaSort;
35+
use datadog_api_client::datadogV1::model::WidgetLayout;
36+
use datadog_api_client::datadogV1::model::WidgetPalette;
37+
use datadog_api_client::datadogV1::model::WidgetSort;
38+
use datadog_api_client::datadogV1::model::WidgetSortBy;
39+
use datadog_api_client::datadogV1::model::WidgetSortOrderBy;
40+
41+
#[tokio::main]
42+
async fn main() {
43+
let body =
44+
Dashboard::new(
45+
DashboardLayoutType::ORDERED,
46+
"Example-Dashboard".to_string(),
47+
vec![
48+
Widget::new(
49+
WidgetDefinition::GeomapWidgetDefinition(
50+
Box::new(
51+
GeomapWidgetDefinition::new(
52+
vec![
53+
GeomapWidgetRequest::new()
54+
.conditional_formats(
55+
vec![
56+
WidgetConditionalFormat::new(
57+
WidgetComparator::GREATER_THAN,
58+
WidgetPalette::WHITE_ON_GREEN,
59+
1000.0,
60+
)
61+
],
62+
)
63+
.formulas(vec![WidgetFormula::new("query1".to_string())])
64+
.queries(
65+
vec![
66+
FormulaAndFunctionQueryDefinition
67+
::FormulaAndFunctionEventQueryDefinition(
68+
Box::new(
69+
FormulaAndFunctionEventQueryDefinition::new(
70+
FormulaAndFunctionEventQueryDefinitionCompute::new(
71+
FormulaAndFunctionEventAggregation::COUNT,
72+
),
73+
FormulaAndFunctionEventsDataSource::RUM,
74+
"query1".to_string(),
75+
)
76+
.group_by(vec![])
77+
.indexes(vec!["*".to_string()])
78+
.search(
79+
FormulaAndFunctionEventQueryDefinitionSearch::new(
80+
"@type:session".to_string(),
81+
),
82+
),
83+
),
84+
)
85+
],
86+
)
87+
.response_format(FormulaAndFunctionResponseFormat::SCALAR)
88+
.sort(
89+
WidgetSortBy::new()
90+
.count(250)
91+
.order_by(
92+
vec![
93+
WidgetSortOrderBy::WidgetFormulaSort(
94+
Box::new(
95+
WidgetFormulaSort::new(
96+
0,
97+
WidgetSort::DESCENDING,
98+
FormulaType::FORMULA,
99+
),
100+
),
101+
)
102+
],
103+
),
104+
),
105+
GeomapWidgetRequest::new()
106+
.columns(
107+
vec![
108+
ListStreamColumn::new(
109+
"@network.client.geoip.location.latitude".to_string(),
110+
ListStreamColumnWidth::AUTO,
111+
),
112+
ListStreamColumn::new(
113+
"@network.client.geoip.location.longitude".to_string(),
114+
ListStreamColumnWidth::AUTO,
115+
),
116+
ListStreamColumn::new(
117+
"@network.client.geoip.country.iso_code".to_string(),
118+
ListStreamColumnWidth::AUTO,
119+
),
120+
ListStreamColumn::new(
121+
"@network.client.geoip.subdivision.name".to_string(),
122+
ListStreamColumnWidth::AUTO,
123+
)
124+
],
125+
)
126+
.query(
127+
ListStreamQuery::new(ListStreamSource::LOGS_STREAM, "".to_string())
128+
.indexes(vec![])
129+
.storage("hot".to_string()),
130+
)
131+
.response_format(FormulaAndFunctionResponseFormat::EVENT_LIST)
132+
.style(GeomapWidgetRequestStyle::new("status".to_string()))
133+
.text_formats(
134+
vec![
135+
TableWidgetTextFormatRule::new(
136+
TableWidgetTextFormatMatch::new(
137+
TableWidgetTextFormatMatchType::IS,
138+
"error".to_string(),
139+
),
140+
).palette(TableWidgetTextFormatPalette::WHITE_ON_RED)
141+
],
142+
)
143+
],
144+
GeomapWidgetDefinitionStyle::new("hostmap_blues".to_string(), false),
145+
GeomapWidgetDefinitionType::GEOMAP,
146+
GeomapWidgetDefinitionView::new("NORTH_AMERICA".to_string()),
147+
).title("Log Count by Service and Source".to_string()),
148+
),
149+
),
150+
).layout(WidgetLayout::new(6, 12, 0, 0))
151+
],
152+
)
153+
.description(Some("Example-Dashboard".to_string()))
154+
.notify_list(Some(vec![]))
155+
.reflow_type(DashboardReflowType::FIXED)
156+
.tags(Some(vec![]))
157+
.template_variables(Some(vec![]));
158+
let configuration = datadog::Configuration::new();
159+
let api = DashboardsAPI::with_config(configuration);
160+
let resp = api.create_dashboard(body).await;
161+
if let Ok(value) = resp {
162+
println!("{:#?}", value);
163+
} else {
164+
println!("{:#?}", resp.unwrap_err());
165+
}
166+
}

src/datadogV1/model/mod.rs

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,26 @@ pub mod model_group_type;
336336
pub use self::model_group_type::GroupType;
337337
pub mod model_widget_sort_order_by;
338338
pub use self::model_widget_sort_order_by::WidgetSortOrderBy;
339+
pub mod model_geomap_widget_request_style;
340+
pub use self::model_geomap_widget_request_style::GeomapWidgetRequestStyle;
341+
pub mod model_table_widget_text_format_rule;
342+
pub use self::model_table_widget_text_format_rule::TableWidgetTextFormatRule;
343+
pub mod model_table_widget_text_format_match;
344+
pub use self::model_table_widget_text_format_match::TableWidgetTextFormatMatch;
345+
pub mod model_table_widget_text_format_match_type;
346+
pub use self::model_table_widget_text_format_match_type::TableWidgetTextFormatMatchType;
347+
pub mod model_table_widget_text_format_palette;
348+
pub use self::model_table_widget_text_format_palette::TableWidgetTextFormatPalette;
349+
pub mod model_table_widget_text_format_replace_all;
350+
pub use self::model_table_widget_text_format_replace_all::TableWidgetTextFormatReplaceAll;
351+
pub mod model_table_widget_text_format_replace_all_type;
352+
pub use self::model_table_widget_text_format_replace_all_type::TableWidgetTextFormatReplaceAllType;
353+
pub mod model_table_widget_text_format_replace_substring;
354+
pub use self::model_table_widget_text_format_replace_substring::TableWidgetTextFormatReplaceSubstring;
355+
pub mod model_table_widget_text_format_replace_substring_type;
356+
pub use self::model_table_widget_text_format_replace_substring_type::TableWidgetTextFormatReplaceSubstringType;
357+
pub mod model_table_widget_text_format_replace;
358+
pub use self::model_table_widget_text_format_replace::TableWidgetTextFormatReplace;
339359
pub mod model_geomap_widget_definition_style;
340360
pub use self::model_geomap_widget_definition_style::GeomapWidgetDefinitionStyle;
341361
pub mod model_geomap_widget_definition_type;
@@ -516,24 +536,6 @@ pub mod model_table_widget_has_search_bar;
516536
pub use self::model_table_widget_has_search_bar::TableWidgetHasSearchBar;
517537
pub mod model_table_widget_request;
518538
pub use self::model_table_widget_request::TableWidgetRequest;
519-
pub mod model_table_widget_text_format_rule;
520-
pub use self::model_table_widget_text_format_rule::TableWidgetTextFormatRule;
521-
pub mod model_table_widget_text_format_match;
522-
pub use self::model_table_widget_text_format_match::TableWidgetTextFormatMatch;
523-
pub mod model_table_widget_text_format_match_type;
524-
pub use self::model_table_widget_text_format_match_type::TableWidgetTextFormatMatchType;
525-
pub mod model_table_widget_text_format_palette;
526-
pub use self::model_table_widget_text_format_palette::TableWidgetTextFormatPalette;
527-
pub mod model_table_widget_text_format_replace_all;
528-
pub use self::model_table_widget_text_format_replace_all::TableWidgetTextFormatReplaceAll;
529-
pub mod model_table_widget_text_format_replace_all_type;
530-
pub use self::model_table_widget_text_format_replace_all_type::TableWidgetTextFormatReplaceAllType;
531-
pub mod model_table_widget_text_format_replace_substring;
532-
pub use self::model_table_widget_text_format_replace_substring::TableWidgetTextFormatReplaceSubstring;
533-
pub mod model_table_widget_text_format_replace_substring_type;
534-
pub use self::model_table_widget_text_format_replace_substring_type::TableWidgetTextFormatReplaceSubstringType;
535-
pub mod model_table_widget_text_format_replace;
536-
pub use self::model_table_widget_text_format_replace::TableWidgetTextFormatReplace;
537539
pub mod model_table_widget_definition_type;
538540
pub use self::model_table_widget_definition_type::TableWidgetDefinitionType;
539541
pub mod model_timeseries_widget_definition;

src/datadogV1/model/model_geomap_widget_definition.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ pub struct GeomapWidgetDefinition {
1414
/// A list of custom links.
1515
#[serde(rename = "custom_links")]
1616
pub custom_links: Option<Vec<crate::datadogV1::model::WidgetCustomLink>>,
17-
/// Array of one request object to display in the widget. The request must contain a `group-by` tag whose value is a country ISO code.
18-
///
17+
/// Array of request objects to display in the widget. The array may have one optional request object for region layer and/or one optional request object for points layer. The request for region layer must contain a `group-by` tag whose value is a country ISO code.
1918
/// See the [Request JSON schema documentation](<https://docs.datadoghq.com/dashboards/graphing_json/request_json>)
2019
/// for information about building the `REQUEST_SCHEMA`.
2120
#[serde(rename = "requests")]

src/datadogV1/model/model_geomap_widget_definition_view.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use std::fmt::{self, Formatter};
1111
#[skip_serializing_none]
1212
#[derive(Clone, Debug, PartialEq, Serialize)]
1313
pub struct GeomapWidgetDefinitionView {
14-
/// The 2-letter ISO code of a country to focus the map on. Or `WORLD`.
14+
/// The 2-letter ISO code of a country to focus the map on, or `WORLD` for global view, or a region (`EMEA`, `APAC`, `LATAM`), or a continent (`NORTH_AMERICA`, `SOUTH_AMERICA`, `EUROPE`, `AFRICA`, `ASIA`, `OCEANIA`).
1515
#[serde(rename = "focus")]
1616
pub focus: String,
1717
#[serde(flatten)]

0 commit comments

Comments
 (0)