Skip to content

Commit d8f60ac

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 4ecb86e of spec repo
1 parent 1638c53 commit d8f60ac

26 files changed

+2198
-34
lines changed

.generator/schemas/v1/openapi.yaml

Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -895,6 +895,173 @@ 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+
minItems: 1
991+
type: array
992+
event_query:
993+
$ref: '#/components/schemas/LogQueryDefinition'
994+
formulas:
995+
description: List of formulas that operate on queries.
996+
items:
997+
$ref: '#/components/schemas/WidgetFormula'
998+
type: array
999+
log_query:
1000+
$ref: '#/components/schemas/LogQueryDefinition'
1001+
network_query:
1002+
$ref: '#/components/schemas/LogQueryDefinition'
1003+
process_query:
1004+
$ref: '#/components/schemas/ProcessQueryDefinition'
1005+
profile_metrics_query:
1006+
$ref: '#/components/schemas/LogQueryDefinition'
1007+
q:
1008+
description: Widget query.
1009+
type: string
1010+
queries:
1011+
description: List of queries that can be returned directly or used in formulas.
1012+
items:
1013+
$ref: '#/components/schemas/FormulaAndFunctionQueryDefinition'
1014+
type: array
1015+
response_format:
1016+
$ref: '#/components/schemas/FormulaAndFunctionResponseFormat'
1017+
rum_query:
1018+
$ref: '#/components/schemas/LogQueryDefinition'
1019+
security_query:
1020+
$ref: '#/components/schemas/LogQueryDefinition'
1021+
sort:
1022+
$ref: '#/components/schemas/WidgetSortBy'
1023+
style:
1024+
$ref: '#/components/schemas/WidgetRequestStyle'
1025+
type: object
1026+
BarChartWidgetScaling:
1027+
description: Bar chart widget scaling definition.
1028+
enum:
1029+
- absolute
1030+
- relative
1031+
type: string
1032+
x-enum-varnames:
1033+
- ABSOLUTE
1034+
- RELATIVE
1035+
BarChartWidgetStacked:
1036+
description: Bar chart widget stacked display options.
1037+
properties:
1038+
legend:
1039+
$ref: '#/components/schemas/BarChartWidgetLegend'
1040+
type:
1041+
$ref: '#/components/schemas/BarChartWidgetStackedType'
1042+
required:
1043+
- type
1044+
type: object
1045+
BarChartWidgetStackedType:
1046+
default: stacked
1047+
description: Bar chart widget stacked display type.
1048+
enum:
1049+
- stacked
1050+
example: stacked
1051+
type: string
1052+
x-enum-varnames:
1053+
- STACKED
1054+
BarChartWidgetStyle:
1055+
description: Style customization for a bar chart widget.
1056+
properties:
1057+
display:
1058+
$ref: '#/components/schemas/BarChartWidgetDisplay'
1059+
palette:
1060+
description: Color palette to apply to the widget.
1061+
type: string
1062+
scaling:
1063+
$ref: '#/components/schemas/BarChartWidgetScaling'
1064+
type: object
8981065
CancelDowntimesByScopeRequest:
8991066
description: Cancel downtimes according to scope.
9001067
properties:
@@ -14300,6 +14467,7 @@ components:
1430014467
SplitGraphSourceWidgetDefinition:
1430114468
description: The original widget we are splitting on.
1430214469
oneOf:
14470+
- $ref: '#/components/schemas/BarChartWidgetDefinition'
1430314471
- $ref: '#/components/schemas/ChangeWidgetDefinition'
1430414472
- $ref: '#/components/schemas/GeomapWidgetDefinition'
1430514473
- $ref: '#/components/schemas/QueryValueWidgetDefinition'
@@ -24731,6 +24899,7 @@ components:
2473124899
oneOf:
2473224900
- $ref: '#/components/schemas/AlertGraphWidgetDefinition'
2473324901
- $ref: '#/components/schemas/AlertValueWidgetDefinition'
24902+
- $ref: '#/components/schemas/BarChartWidgetDefinition'
2473424903
- $ref: '#/components/schemas/ChangeWidgetDefinition'
2473524904
- $ref: '#/components/schemas/CheckStatusWidgetDefinition'
2473624905
- $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)