Skip to content

Commit b7616ff

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add description field to widget definition schemas (#1408)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 892565e commit b7616ff

File tree

41 files changed

+765
-14
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+765
-14
lines changed

.generator/schemas/v1/openapi.yaml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,9 @@ components:
481481
description: ID of the alert to use in the widget.
482482
example: ""
483483
type: string
484+
description:
485+
description: The description of the widget.
486+
type: string
484487
time:
485488
$ref: "#/components/schemas/WidgetTime"
486489
title:
@@ -516,6 +519,9 @@ components:
516519
description: ID of the alert to use in the widget.
517520
example: ""
518521
type: string
522+
description:
523+
description: The description of the widget.
524+
type: string
519525
precision:
520526
description: Number of decimal to show. If not defined, will use the raw value.
521527
format: int64
@@ -808,6 +814,9 @@ components:
808814
items:
809815
$ref: "#/components/schemas/WidgetCustomLink"
810816
type: array
817+
description:
818+
description: The description of the widget.
819+
type: string
811820
requests:
812821
description: List of bar chart widget requests.
813822
example: ["q": "system.load.1"]
@@ -1015,6 +1024,9 @@ components:
10151024
items:
10161025
$ref: "#/components/schemas/WidgetCustomLink"
10171026
type: array
1027+
description:
1028+
description: The description of the widget.
1029+
type: string
10181030
requests:
10191031
description: |-
10201032
Array of one request object to display in the widget.
@@ -1177,6 +1189,9 @@ components:
11771189
description: Name of the check to use in the widget.
11781190
example: ""
11791191
type: string
1192+
description:
1193+
description: The description of the widget.
1194+
type: string
11801195
group:
11811196
description: Group reporting a single check.
11821197
type: string
@@ -1815,6 +1830,9 @@ components:
18151830
items:
18161831
$ref: "#/components/schemas/WidgetCustomLink"
18171832
type: array
1833+
description:
1834+
description: The description of the widget.
1835+
type: string
18181836
legend_size:
18191837
deprecated: true
18201838
description: (Deprecated) The widget legend was replaced by a tooltip and sidebar.
@@ -2501,6 +2519,9 @@ components:
25012519
The event stream is a widget version of the stream of events
25022520
on the Event Stream view. Only available on FREE layout dashboards.
25032521
properties:
2522+
description:
2523+
description: The description of the widget.
2524+
type: string
25042525
event_size:
25052526
$ref: "#/components/schemas/WidgetEventSize"
25062527
query:
@@ -2538,6 +2559,9 @@ components:
25382559
EventTimelineWidgetDefinition:
25392560
description: The event timeline is a widget version of the timeline that appears at the top of the Event Stream view. Only available on FREE layout dashboards.
25402561
properties:
2562+
description:
2563+
description: The description of the widget.
2564+
type: string
25412565
query:
25422566
description: Query to filter the event timeline with.
25432567
example: ""
@@ -3273,6 +3297,9 @@ components:
32733297
description: |-
32743298
The funnel visualization displays a funnel of user sessions that maps a sequence of view navigation and user interaction in your application.
32753299
properties:
3300+
description:
3301+
description: The description of the widget.
3302+
type: string
32763303
requests:
32773304
description: Request payload used to query items.
32783305
example: [{"query": {"data_source": "rum", "query_string": "@browser.name:Chrome", "steps": [{"facet": "@view.name", "value": "/logs"}, {"facet": "@view.name", "value": "/apm/home"}]}, "request_type": "funnel"}]
@@ -3468,6 +3495,9 @@ components:
34683495
items:
34693496
$ref: "#/components/schemas/WidgetCustomLink"
34703497
type: array
3498+
description:
3499+
description: The description of the widget.
3500+
type: string
34713501
requests:
34723502
description: |-
34733503
Array of request objects to display in the widget. May include an optional request for the region layer and/or an optional request for the points layer. Region layer requests must contain a `group-by` tag whose value is a country ISO code.
@@ -3734,6 +3764,9 @@ components:
37343764
items:
37353765
$ref: "#/components/schemas/WidgetCustomLink"
37363766
type: array
3767+
description:
3768+
description: The description of the widget.
3769+
type: string
37373770
events:
37383771
deprecated: true
37393772
description: List of widget events. Deprecated - Use `overlay` request type instead.
@@ -3999,6 +4032,9 @@ components:
39994032
items:
40004033
$ref: "#/components/schemas/WidgetCustomLink"
40014034
type: array
4035+
description:
4036+
description: The description of the widget.
4037+
type: string
40024038
group:
40034039
description: List of tag prefixes to group by.
40044040
items:
@@ -4978,6 +5014,9 @@ components:
49785014
The list stream visualization displays a table of recent events in your application that
49795015
match a search criteria using user-defined columns.
49805016
properties:
5017+
description:
5018+
description: The description of the widget.
5019+
type: string
49815020
legend_size:
49825021
$ref: "#/components/schemas/WidgetLegendSize"
49835022
requests:
@@ -5159,6 +5198,9 @@ components:
51595198
description: Column name.
51605199
type: string
51615200
type: array
5201+
description:
5202+
description: The description of the widget.
5203+
type: string
51625204
indexes:
51635205
description: An array of index names to query in the stream. Use [] to query all indexes at once.
51645206
example: ["days-3", "days-7"]
@@ -8572,6 +8614,9 @@ components:
85728614
description: The number of monitors to display.
85738615
format: int64
85748616
type: integer
8617+
description:
8618+
description: The description of the widget.
8619+
type: string
85758620
display_format:
85768621
$ref: "#/components/schemas/WidgetMonitorSummaryDisplayFormat"
85778622
hide_zero_counts:
@@ -10960,6 +11005,9 @@ components:
1096011005
custom_unit:
1096111006
description: Display a unit of your choice on the widget.
1096211007
type: string
11008+
description:
11009+
description: The description of the widget.
11010+
type: string
1096311011
precision:
1096411012
description: Number of decimals to show. If not defined, the widget uses the raw value.
1096511013
format: int64
@@ -11129,6 +11177,9 @@ components:
1112911177
items:
1113011178
$ref: "#/components/schemas/WidgetCustomLink"
1113111179
type: array
11180+
description:
11181+
description: The description of the widget.
11182+
type: string
1113211183
inputs:
1113311184
description: Array of workflow inputs to map to dashboard template variables.
1113411185
items:
@@ -12091,6 +12142,9 @@ components:
1209112142
SLOListWidgetDefinition:
1209212143
description: Use the SLO List widget to track your SLOs (Service Level Objectives) on dashboards.
1209312144
properties:
12145+
description:
12146+
description: The description of the widget.
12147+
type: string
1209412148
requests:
1209512149
description: Array of one request object to display in the widget.
1209612150
items:
@@ -12638,6 +12692,9 @@ components:
1263812692
additional_query_filters:
1263912693
description: Additional filters applied to the SLO query.
1264012694
type: string
12695+
description:
12696+
description: The description of the widget.
12697+
type: string
1264112698
global_time_target:
1264212699
description: Defined global time target.
1264312700
type: string
@@ -12737,6 +12794,9 @@ components:
1273712794
items:
1273812795
$ref: "#/components/schemas/WidgetCustomLink"
1273912796
type: array
12797+
description:
12798+
description: The description of the widget.
12799+
type: string
1274012800
requests:
1274112801
$ref: "#/components/schemas/ScatterPlotWidgetDefinitionRequests"
1274212802
time:
@@ -13555,6 +13615,9 @@ components:
1355513615
items:
1355613616
$ref: "#/components/schemas/WidgetCustomLink"
1355713617
type: array
13618+
description:
13619+
description: The description of the widget.
13620+
type: string
1355813621
filters:
1355913622
description: Your environment and primary tag (or * if enabled for your account).
1356013623
example: ["*"]
@@ -13594,6 +13657,9 @@ components:
1359413657
ServiceSummaryWidgetDefinition:
1359513658
description: The service summary displays the graphs of a chosen service in your screenboard. Only available on FREE layout dashboards.
1359613659
properties:
13660+
description:
13661+
description: The description of the widget.
13662+
type: string
1359713663
display_format:
1359813664
$ref: "#/components/schemas/WidgetServiceSummaryDisplayFormat"
1359913665
env:
@@ -14200,6 +14266,9 @@ components:
1420014266
items:
1420114267
$ref: "#/components/schemas/WidgetCustomLink"
1420214268
type: array
14269+
description:
14270+
description: The description of the widget.
14271+
type: string
1420314272
hide_total:
1420414273
description: Show the total value in this widget.
1420514274
type: boolean
@@ -18142,6 +18211,9 @@ components:
1814218211
items:
1814318212
$ref: "#/components/schemas/WidgetCustomLink"
1814418213
type: array
18214+
description:
18215+
description: The description of the widget.
18216+
type: string
1814518217
has_search_bar:
1814618218
$ref: "#/components/schemas/TableWidgetHasSearchBar"
1814718219
requests:
@@ -18487,6 +18559,9 @@ components:
1848718559
items:
1848818560
$ref: "#/components/schemas/WidgetCustomLink"
1848918561
type: array
18562+
description:
18563+
description: The description of the widget.
18564+
type: string
1849018565
events:
1849118566
deprecated: true
1849218567
description: List of widget events. Deprecated - Use `overlay` request type instead.
@@ -18661,6 +18736,9 @@ components:
1866118736
items:
1866218737
$ref: "#/components/schemas/WidgetCustomLink"
1866318738
type: array
18739+
description:
18740+
description: The description of the widget.
18741+
type: string
1866418742
requests:
1866518743
description: List of top list widget requests.
1866618744
example: ["q": "system.load.1"]
@@ -18842,6 +18920,9 @@ components:
1884218920
items:
1884318921
$ref: "#/components/schemas/WidgetCustomLink"
1884418922
type: array
18923+
description:
18924+
description: The description of the widget.
18925+
type: string
1884518926
requests:
1884618927
description: One or more Topology requests.
1884718928
items:
@@ -18957,6 +19038,9 @@ components:
1895719038
items:
1895819039
$ref: "#/components/schemas/WidgetCustomLink"
1895919040
type: array
19041+
description:
19042+
description: The description of the widget.
19043+
type: string
1896019044
group_by:
1896119045
$ref: "#/components/schemas/TreeMapGroupBy"
1896219046
requests:

examples/v1_dashboards_CreateDashboard_2349863258.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ async fn main() {
5050
QueryValueWidgetDefinitionType::QUERY_VALUE,
5151
)
5252
.autoscale(true)
53+
.description("Example widget description".to_string())
5354
.precision(2)
5455
.time(WidgetTime::WidgetLegacyLiveSpan(Box::new(WidgetLegacyLiveSpan::new())))
5556
.title("".to_string())

examples/v1_dashboards_CreateDashboard_3520534424.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ async fn main() {
8585
],
8686
TimeseriesWidgetDefinitionType::TIMESERIES,
8787
)
88+
.description("Example widget description".to_string())
8889
.legend_layout(TimeseriesWidgetLegendLayout::AUTO)
8990
.show_legend(true)
9091
.time(WidgetTime::WidgetLegacyLiveSpan(Box::new(WidgetLegacyLiveSpan::new())))
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
// Create a new dashboard with a query_value widget containing a description
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::FormulaAndFunctionMetricAggregation;
7+
use datadog_api_client::datadogV1::model::FormulaAndFunctionMetricDataSource;
8+
use datadog_api_client::datadogV1::model::FormulaAndFunctionMetricQueryDefinition;
9+
use datadog_api_client::datadogV1::model::FormulaAndFunctionQueryDefinition;
10+
use datadog_api_client::datadogV1::model::FormulaAndFunctionResponseFormat;
11+
use datadog_api_client::datadogV1::model::QueryValueWidgetDefinition;
12+
use datadog_api_client::datadogV1::model::QueryValueWidgetDefinitionType;
13+
use datadog_api_client::datadogV1::model::QueryValueWidgetRequest;
14+
use datadog_api_client::datadogV1::model::Widget;
15+
use datadog_api_client::datadogV1::model::WidgetDefinition;
16+
use datadog_api_client::datadogV1::model::WidgetLayout;
17+
use datadog_api_client::datadogV1::model::WidgetLegacyLiveSpan;
18+
use datadog_api_client::datadogV1::model::WidgetTextAlign;
19+
use datadog_api_client::datadogV1::model::WidgetTime;
20+
21+
#[tokio::main]
22+
async fn main() {
23+
let body =
24+
Dashboard::new(
25+
DashboardLayoutType::FREE,
26+
"Example-Dashboard".to_string(),
27+
vec![
28+
Widget::new(
29+
WidgetDefinition::QueryValueWidgetDefinition(
30+
Box::new(
31+
QueryValueWidgetDefinition::new(
32+
vec![
33+
QueryValueWidgetRequest::new()
34+
.queries(
35+
vec![
36+
FormulaAndFunctionQueryDefinition
37+
::FormulaAndFunctionMetricQueryDefinition(
38+
Box::new(
39+
FormulaAndFunctionMetricQueryDefinition::new(
40+
FormulaAndFunctionMetricDataSource::METRICS,
41+
"query1".to_string(),
42+
"avg:system.cpu.user{*}".to_string(),
43+
).aggregator(FormulaAndFunctionMetricAggregation::AVG),
44+
),
45+
)
46+
],
47+
)
48+
.response_format(FormulaAndFunctionResponseFormat::SCALAR)
49+
],
50+
QueryValueWidgetDefinitionType::QUERY_VALUE,
51+
)
52+
.autoscale(true)
53+
.description("Example widget description".to_string())
54+
.precision(2)
55+
.time(WidgetTime::WidgetLegacyLiveSpan(Box::new(WidgetLegacyLiveSpan::new())))
56+
.title("".to_string())
57+
.title_align(WidgetTextAlign::LEFT)
58+
.title_size("16".to_string()),
59+
),
60+
),
61+
).layout(WidgetLayout::new(15, 47, 0, 0))
62+
],
63+
)
64+
.description(Some("".to_string()))
65+
.notify_list(Some(vec![]))
66+
.template_variables(Some(vec![]));
67+
let configuration = datadog::Configuration::new();
68+
let api = DashboardsAPI::with_config(configuration);
69+
let resp = api.create_dashboard(body).await;
70+
if let Ok(value) = resp {
71+
println!("{:#?}", value);
72+
} else {
73+
println!("{:#?}", resp.unwrap_err());
74+
}
75+
}

0 commit comments

Comments
 (0)