v1_dashboards_UpdateDashboard/
v1_dashboards_UpdateDashboard.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    let configuration = datadog::Configuration::new();
40    let api = DashboardsAPI::with_config(configuration);
41    let resp = api.update_dashboard(dashboard_id.clone(), body).await;
42    if let Ok(value) = resp {
43        println!("{:#?}", value);
44    } else {
45        println!("{:#?}", resp.unwrap_err());
46    }
47}