Skip to content

Commit b12cf8f

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 2ee2e70 of spec repo
1 parent 8b6e2d5 commit b12cf8f

26 files changed

+2197
-34
lines changed

.generator/schemas/v1/openapi.yaml

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -895,6 +895,172 @@ components:
895895
items:
896896
$ref: '#/components/schemas/AzureAccount'
897897
type: array
898+
BarChartWidgetDefinition:
899+
description: The bar chart visualization displays categorical data using vertical
900+
bars, allowing you to compare values across different groups.
901+
properties:
902+
custom_links:
903+
description: List of custom links.
904+
items:
905+
$ref: '#/components/schemas/WidgetCustomLink'
906+
type: array
907+
requests:
908+
description: List of bar chart widget requests.
909+
example:
910+
- q: system.load.1
911+
items:
912+
$ref: '#/components/schemas/BarChartWidgetRequest'
913+
type: array
914+
style:
915+
$ref: '#/components/schemas/BarChartWidgetStyle'
916+
time:
917+
$ref: '#/components/schemas/WidgetTime'
918+
title:
919+
description: Title of your widget.
920+
type: string
921+
title_align:
922+
$ref: '#/components/schemas/WidgetTextAlign'
923+
title_size:
924+
description: Size of the title.
925+
type: string
926+
type:
927+
$ref: '#/components/schemas/BarChartWidgetDefinitionType'
928+
required:
929+
- type
930+
- requests
931+
type: object
932+
BarChartWidgetDefinitionType:
933+
default: bar_chart
934+
description: Type of the bar chart widget.
935+
enum:
936+
- bar_chart
937+
example: bar_chart
938+
type: string
939+
x-enum-varnames:
940+
- BAR_CHART
941+
BarChartWidgetDisplay:
942+
description: Bar chart widget display options.
943+
oneOf:
944+
- $ref: '#/components/schemas/BarChartWidgetStacked'
945+
- $ref: '#/components/schemas/BarChartWidgetFlat'
946+
BarChartWidgetFlat:
947+
description: Bar chart widget flat display.
948+
properties:
949+
type:
950+
$ref: '#/components/schemas/BarChartWidgetFlatType'
951+
required:
952+
- type
953+
type: object
954+
BarChartWidgetFlatType:
955+
default: flat
956+
description: Bar chart widget flat display type.
957+
enum:
958+
- flat
959+
example: flat
960+
type: string
961+
x-enum-varnames:
962+
- FLAT
963+
BarChartWidgetLegend:
964+
description: Bar chart widget stacked legend behavior.
965+
enum:
966+
- automatic
967+
- inline
968+
- none
969+
example: automatic
970+
type: string
971+
x-enum-varnames:
972+
- AUTOMATIC
973+
- INLINE
974+
- NONE
975+
BarChartWidgetRequest:
976+
description: Updated bar chart widget.
977+
properties:
978+
apm_query:
979+
$ref: '#/components/schemas/LogQueryDefinition'
980+
audit_query:
981+
$ref: '#/components/schemas/LogQueryDefinition'
982+
conditional_formats:
983+
description: List of conditional formats.
984+
example:
985+
- comparator: '>='
986+
palette: blue
987+
value: 1.0
988+
items:
989+
$ref: '#/components/schemas/WidgetConditionalFormat'
990+
type: array
991+
event_query:
992+
$ref: '#/components/schemas/LogQueryDefinition'
993+
formulas:
994+
description: List of formulas that operate on queries.
995+
items:
996+
$ref: '#/components/schemas/WidgetFormula'
997+
type: array
998+
log_query:
999+
$ref: '#/components/schemas/LogQueryDefinition'
1000+
network_query:
1001+
$ref: '#/components/schemas/LogQueryDefinition'
1002+
process_query:
1003+
$ref: '#/components/schemas/ProcessQueryDefinition'
1004+
profile_metrics_query:
1005+
$ref: '#/components/schemas/LogQueryDefinition'
1006+
q:
1007+
description: Widget query.
1008+
type: string
1009+
queries:
1010+
description: List of queries that can be returned directly or used in formulas.
1011+
items:
1012+
$ref: '#/components/schemas/FormulaAndFunctionQueryDefinition'
1013+
type: array
1014+
response_format:
1015+
$ref: '#/components/schemas/FormulaAndFunctionResponseFormat'
1016+
rum_query:
1017+
$ref: '#/components/schemas/LogQueryDefinition'
1018+
security_query:
1019+
$ref: '#/components/schemas/LogQueryDefinition'
1020+
sort:
1021+
$ref: '#/components/schemas/WidgetSortBy'
1022+
style:
1023+
$ref: '#/components/schemas/WidgetRequestStyle'
1024+
type: object
1025+
BarChartWidgetScaling:
1026+
description: Bar chart widget scaling definition.
1027+
enum:
1028+
- absolute
1029+
- relative
1030+
type: string
1031+
x-enum-varnames:
1032+
- ABSOLUTE
1033+
- RELATIVE
1034+
BarChartWidgetStacked:
1035+
description: Bar chart widget stacked display options.
1036+
properties:
1037+
legend:
1038+
$ref: '#/components/schemas/BarChartWidgetLegend'
1039+
type:
1040+
$ref: '#/components/schemas/BarChartWidgetStackedType'
1041+
required:
1042+
- type
1043+
type: object
1044+
BarChartWidgetStackedType:
1045+
default: stacked
1046+
description: Bar chart widget stacked display type.
1047+
enum:
1048+
- stacked
1049+
example: stacked
1050+
type: string
1051+
x-enum-varnames:
1052+
- STACKED
1053+
BarChartWidgetStyle:
1054+
description: Style customization for a bar chart widget.
1055+
properties:
1056+
display:
1057+
$ref: '#/components/schemas/BarChartWidgetDisplay'
1058+
palette:
1059+
description: Color palette to apply to the widget.
1060+
type: string
1061+
scaling:
1062+
$ref: '#/components/schemas/BarChartWidgetScaling'
1063+
type: object
8981064
CancelDowntimesByScopeRequest:
8991065
description: Cancel downtimes according to scope.
9001066
properties:
@@ -14300,6 +14466,7 @@ components:
1430014466
SplitGraphSourceWidgetDefinition:
1430114467
description: The original widget we are splitting on.
1430214468
oneOf:
14469+
- $ref: '#/components/schemas/BarChartWidgetDefinition'
1430314470
- $ref: '#/components/schemas/ChangeWidgetDefinition'
1430414471
- $ref: '#/components/schemas/GeomapWidgetDefinition'
1430514472
- $ref: '#/components/schemas/QueryValueWidgetDefinition'
@@ -24731,6 +24898,7 @@ components:
2473124898
oneOf:
2473224899
- $ref: '#/components/schemas/AlertGraphWidgetDefinition'
2473324900
- $ref: '#/components/schemas/AlertValueWidgetDefinition'
24901+
- $ref: '#/components/schemas/BarChartWidgetDefinition'
2473424902
- $ref: '#/components/schemas/ChangeWidgetDefinition'
2473524903
- $ref: '#/components/schemas/CheckStatusWidgetDefinition'
2473624904
- $ref: '#/components/schemas/DistributionWidgetDefinition'
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
// Create a new dashboard with bar_chart widget
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV1::api_dashboards::DashboardsAPI;
4+
use datadog_api_client::datadogV1::model::BarChartWidgetDefinition;
5+
use datadog_api_client::datadogV1::model::BarChartWidgetDefinitionType;
6+
use datadog_api_client::datadogV1::model::BarChartWidgetDisplay;
7+
use datadog_api_client::datadogV1::model::BarChartWidgetLegend;
8+
use datadog_api_client::datadogV1::model::BarChartWidgetRequest;
9+
use datadog_api_client::datadogV1::model::BarChartWidgetScaling;
10+
use datadog_api_client::datadogV1::model::BarChartWidgetStacked;
11+
use datadog_api_client::datadogV1::model::BarChartWidgetStackedType;
12+
use datadog_api_client::datadogV1::model::BarChartWidgetStyle;
13+
use datadog_api_client::datadogV1::model::Dashboard;
14+
use datadog_api_client::datadogV1::model::DashboardLayoutType;
15+
use datadog_api_client::datadogV1::model::FormulaAndFunctionMetricAggregation;
16+
use datadog_api_client::datadogV1::model::FormulaAndFunctionMetricDataSource;
17+
use datadog_api_client::datadogV1::model::FormulaAndFunctionMetricQueryDefinition;
18+
use datadog_api_client::datadogV1::model::FormulaAndFunctionQueryDefinition;
19+
use datadog_api_client::datadogV1::model::FormulaAndFunctionResponseFormat;
20+
use datadog_api_client::datadogV1::model::FormulaType;
21+
use datadog_api_client::datadogV1::model::Widget;
22+
use datadog_api_client::datadogV1::model::WidgetDefinition;
23+
use datadog_api_client::datadogV1::model::WidgetFormula;
24+
use datadog_api_client::datadogV1::model::WidgetFormulaSort;
25+
use datadog_api_client::datadogV1::model::WidgetLayout;
26+
use datadog_api_client::datadogV1::model::WidgetLegacyLiveSpan;
27+
use datadog_api_client::datadogV1::model::WidgetSort;
28+
use datadog_api_client::datadogV1::model::WidgetSortBy;
29+
use datadog_api_client::datadogV1::model::WidgetSortOrderBy;
30+
use datadog_api_client::datadogV1::model::WidgetTextAlign;
31+
use datadog_api_client::datadogV1::model::WidgetTime;
32+
33+
#[tokio::main]
34+
async fn main() {
35+
let body =
36+
Dashboard::new(
37+
DashboardLayoutType::FREE,
38+
"Example-Dashboard".to_string(),
39+
vec![
40+
Widget::new(
41+
WidgetDefinition::BarChartWidgetDefinition(
42+
Box::new(
43+
BarChartWidgetDefinition::new(
44+
vec![
45+
BarChartWidgetRequest::new()
46+
.formulas(vec![WidgetFormula::new("query1".to_string())])
47+
.queries(
48+
vec![
49+
FormulaAndFunctionQueryDefinition
50+
::FormulaAndFunctionMetricQueryDefinition(
51+
Box::new(
52+
FormulaAndFunctionMetricQueryDefinition::new(
53+
FormulaAndFunctionMetricDataSource::METRICS,
54+
"query1".to_string(),
55+
"avg:system.cpu.user{*} by {service}".to_string(),
56+
).aggregator(FormulaAndFunctionMetricAggregation::AVG),
57+
),
58+
)
59+
],
60+
)
61+
.response_format(FormulaAndFunctionResponseFormat::SCALAR)
62+
.sort(
63+
WidgetSortBy::new()
64+
.count(10)
65+
.order_by(
66+
vec![
67+
WidgetSortOrderBy::WidgetFormulaSort(
68+
Box::new(
69+
WidgetFormulaSort::new(
70+
0,
71+
WidgetSort::DESCENDING,
72+
FormulaType::FORMULA,
73+
),
74+
),
75+
)
76+
],
77+
),
78+
)
79+
],
80+
BarChartWidgetDefinitionType::BAR_CHART,
81+
)
82+
.style(
83+
BarChartWidgetStyle::new()
84+
.display(
85+
BarChartWidgetDisplay::BarChartWidgetStacked(
86+
Box::new(
87+
BarChartWidgetStacked::new(
88+
BarChartWidgetStackedType::STACKED,
89+
).legend(BarChartWidgetLegend::INLINE),
90+
),
91+
),
92+
)
93+
.palette("dog_classic".to_string())
94+
.scaling(BarChartWidgetScaling::RELATIVE),
95+
)
96+
.time(WidgetTime::WidgetLegacyLiveSpan(Box::new(WidgetLegacyLiveSpan::new())))
97+
.title("".to_string())
98+
.title_align(WidgetTextAlign::LEFT)
99+
.title_size("16".to_string()),
100+
),
101+
),
102+
).layout(WidgetLayout::new(15, 47, 0, 0))
103+
],
104+
)
105+
.description(Some("".to_string()))
106+
.notify_list(Some(vec![]))
107+
.template_variables(Some(vec![]));
108+
let configuration = datadog::Configuration::new();
109+
let api = DashboardsAPI::with_config(configuration);
110+
let resp = api.create_dashboard(body).await;
111+
if let Ok(value) = resp {
112+
println!("{:#?}", value);
113+
} else {
114+
println!("{:#?}", resp.unwrap_err());
115+
}
116+
}

0 commit comments

Comments
 (0)