v1_dashboards_UpdateDashboard_3454865944/
v1_dashboards_UpdateDashboard_3454865944.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;
16
17#[tokio::main]
18async fn main() {
19 let dashboard_id = std::env::var("DASHBOARD_ID").unwrap();
21 let body = Dashboard::new(
22 DashboardLayoutType::ORDERED,
23 "Example-Dashboard with list_stream widget".to_string(),
24 vec![Widget::new(WidgetDefinition::ListStreamWidgetDefinition(
25 Box::new(ListStreamWidgetDefinition::new(
26 vec![ListStreamWidgetRequest::new(
27 vec![ListStreamColumn::new(
28 "timestamp".to_string(),
29 ListStreamColumnWidth::AUTO,
30 )],
31 ListStreamQuery::new(ListStreamSource::APM_ISSUE_STREAM, "".to_string()),
32 ListStreamResponseFormat::EVENT_LIST,
33 )],
34 ListStreamWidgetDefinitionType::LIST_STREAM,
35 )),
36 ))],
37 )
38 .description(Some("Updated description".to_string()))
39 .tags(Some(vec!["team:foo".to_string(), "team:bar".to_string()]));
40 let configuration = datadog::Configuration::new();
41 let api = DashboardsAPI::with_config(configuration);
42 let resp = api.update_dashboard(dashboard_id.clone(), body).await;
43 if let Ok(value) = resp {
44 println!("{:#?}", value);
45 } else {
46 println!("{:#?}", resp.unwrap_err());
47 }
48}