v1_dashboards_CreateDashboard_2432046716/
v1_dashboards_CreateDashboard_2432046716.rs1use datadog_api_client::datadog;
3use datadog_api_client::datadogV1::api_dashboards::DashboardsAPI;
4use datadog_api_client::datadogV1::model::Dashboard;
5use datadog_api_client::datadogV1::model::DashboardLayoutType;
6use datadog_api_client::datadogV1::model::ListStreamColumn;
7use datadog_api_client::datadogV1::model::ListStreamColumnWidth;
8use datadog_api_client::datadogV1::model::ListStreamQuery;
9use datadog_api_client::datadogV1::model::ListStreamResponseFormat;
10use datadog_api_client::datadogV1::model::ListStreamSource;
11use datadog_api_client::datadogV1::model::ListStreamWidgetDefinition;
12use datadog_api_client::datadogV1::model::ListStreamWidgetDefinitionType;
13use datadog_api_client::datadogV1::model::ListStreamWidgetRequest;
14use datadog_api_client::datadogV1::model::Widget;
15use datadog_api_client::datadogV1::model::WidgetDefinition;
16use datadog_api_client::datadogV1::model::WidgetEventSize;
17
18#[tokio::main]
19async fn main() {
20 let body = Dashboard::new(
21 DashboardLayoutType::ORDERED,
22 "Example-Dashboard with list_stream widget".to_string(),
23 vec![Widget::new(WidgetDefinition::ListStreamWidgetDefinition(
24 Box::new(ListStreamWidgetDefinition::new(
25 vec![ListStreamWidgetRequest::new(
26 vec![ListStreamColumn::new(
27 "timestamp".to_string(),
28 ListStreamColumnWidth::AUTO,
29 )],
30 ListStreamQuery::new(ListStreamSource::EVENT_STREAM, "".to_string())
31 .event_size(WidgetEventSize::LARGE),
32 ListStreamResponseFormat::EVENT_LIST,
33 )],
34 ListStreamWidgetDefinitionType::LIST_STREAM,
35 )),
36 ))],
37 );
38 let configuration = datadog::Configuration::new();
39 let api = DashboardsAPI::with_config(configuration);
40 let resp = api.create_dashboard(body).await;
41 if let Ok(value) = resp {
42 println!("{:#?}", value);
43 } else {
44 println!("{:#?}", resp.unwrap_err());
45 }
46}