Struct Dashboard

Source
#[non_exhaustive]
pub struct Dashboard {
Show 18 fields pub author_handle: Option<String>, pub author_name: Option<Option<String>>, pub created_at: Option<DateTime<Utc>>, pub description: Option<Option<String>>, pub id: Option<String>, pub is_read_only: Option<bool>, pub layout_type: DashboardLayoutType, pub modified_at: Option<DateTime<Utc>>, pub notify_list: Option<Option<Vec<String>>>, pub reflow_type: Option<DashboardReflowType>, pub restricted_roles: Option<Vec<String>>, pub tags: Option<Option<Vec<String>>>, pub template_variable_presets: Option<Option<Vec<DashboardTemplateVariablePreset>>>, pub template_variables: Option<Option<Vec<DashboardTemplateVariable>>>, pub title: String, pub url: Option<String>, pub widgets: Vec<Widget>, pub additional_properties: BTreeMap<String, Value>, /* private fields */
}
Expand description

A dashboard is Datadog’s tool for visually tracking, analyzing, and displaying key performance metrics, which enable you to monitor the health of your infrastructure.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§author_handle: Option<String>

Identifier of the dashboard author.

§author_name: Option<Option<String>>

Name of the dashboard author.

§created_at: Option<DateTime<Utc>>

Creation date of the dashboard.

§description: Option<Option<String>>

Description of the dashboard.

§id: Option<String>

ID of the dashboard.

§is_read_only: Option<bool>
👎Deprecated

Whether this dashboard is read-only. If True, only the author and admins can make changes to it.

This property is deprecated; please use the Restriction Policies API instead to manage write authorization for individual dashboards.

§layout_type: DashboardLayoutType

Layout type of the dashboard.

§modified_at: Option<DateTime<Utc>>

Modification date of the dashboard.

§notify_list: Option<Option<Vec<String>>>

List of handles of users to notify when changes are made to this dashboard.

§reflow_type: Option<DashboardReflowType>

Reflow type for a new dashboard layout dashboard. Set this only when layout type is ‘ordered’. If set to ‘fixed’, the dashboard expects all widgets to have a layout, and if it’s set to ‘auto’, widgets should not have layouts.

§restricted_roles: Option<Vec<String>>

A list of role identifiers. Only the author and users associated with at least one of these roles can edit this dashboard.

§tags: Option<Option<Vec<String>>>

List of team names representing ownership of a dashboard.

§template_variable_presets: Option<Option<Vec<DashboardTemplateVariablePreset>>>

Array of template variables saved views.

§template_variables: Option<Option<Vec<DashboardTemplateVariable>>>

List of template variables for this dashboard.

§title: String

Title of the dashboard.

§url: Option<String>

The URL of the dashboard.

§widgets: Vec<Widget>

List of widgets to display on the dashboard.

§additional_properties: BTreeMap<String, Value>

Implementations§

Source§

impl Dashboard

Source

pub fn new( layout_type: DashboardLayoutType, title: String, widgets: Vec<Widget>, ) -> Dashboard

Examples found in repository?
examples/v1_dashboards_CreateDashboard_417992286.rs (lines 14-21)
13async fn main() {
14    let body = Dashboard::new(
15        DashboardLayoutType::FREE,
16        "Example-Dashboard".to_string(),
17        vec![Widget::new(WidgetDefinition::NoteWidgetDefinition(Box::new(
18            NoteWidgetDefinition::new("# Example Note".to_string(), NoteWidgetDefinitionType::NOTE),
19        )))
20        .layout(WidgetLayout::new(24, 18, 0, 0))],
21    )
22    .description(Some("".to_string()))
23    .notify_list(Some(vec![]))
24    .template_variables(Some(vec![]));
25    let configuration = datadog::Configuration::new();
26    let api = DashboardsAPI::with_config(configuration);
27    let resp = api.create_dashboard(body).await;
28    if let Ok(value) = resp {
29        println!("{:#?}", value);
30    } else {
31        println!("{:#?}", resp.unwrap_err());
32    }
33}
More examples
Hide additional examples
examples/v1_dashboards_CreateDashboard_927141680.rs (lines 17-29)
16async fn main() {
17    let body = Dashboard::new(
18        DashboardLayoutType::ORDERED,
19        "Example-Dashboard with funnel widget".to_string(),
20        vec![Widget::new(WidgetDefinition::FunnelWidgetDefinition(
21            Box::new(FunnelWidgetDefinition::new(
22                vec![FunnelWidgetRequest::new(
23                    FunnelQuery::new(FunnelSource::RUM, "".to_string(), vec![]),
24                    FunnelRequestType::FUNNEL,
25                )],
26                FunnelWidgetDefinitionType::FUNNEL,
27            )),
28        ))],
29    );
30    let configuration = datadog::Configuration::new();
31    let api = DashboardsAPI::with_config(configuration);
32    let resp = api.create_dashboard(body).await;
33    if let Ok(value) = resp {
34        println!("{:#?}", value);
35    } else {
36        println!("{:#?}", resp.unwrap_err());
37    }
38}
examples/v1_dashboards_CreateDashboard_913313564.rs (lines 14-26)
13async fn main() {
14    let body = Dashboard::new(
15        DashboardLayoutType::FREE,
16        "Example-Dashboard".to_string(),
17        vec![
18            Widget::new(WidgetDefinition::IFrameWidgetDefinition(Box::new(
19                IFrameWidgetDefinition::new(
20                    IFrameWidgetDefinitionType::IFRAME,
21                    "https://docs.datadoghq.com/api/latest/".to_string(),
22                ),
23            )))
24            .layout(WidgetLayout::new(12, 12, 0, 0)),
25        ],
26    )
27    .description(Some("".to_string()))
28    .notify_list(Some(vec![]))
29    .template_variables(Some(vec![]));
30    let configuration = datadog::Configuration::new();
31    let api = DashboardsAPI::with_config(configuration);
32    let resp = api.create_dashboard(body).await;
33    if let Ok(value) = resp {
34        println!("{:#?}", value);
35    } else {
36        println!("{:#?}", resp.unwrap_err());
37    }
38}
examples/v1_dashboards_CreateDashboard_651038379.rs (lines 15-28)
14async fn main() {
15    let body = Dashboard::new(
16        DashboardLayoutType::FREE,
17        "Example-Dashboard".to_string(),
18        vec![
19            Widget::new(WidgetDefinition::ImageWidgetDefinition(Box::new(
20                ImageWidgetDefinition::new(
21                    ImageWidgetDefinitionType::IMAGE,
22                    "https://example.com/image.png".to_string(),
23                )
24                .sizing(WidgetImageSizing::COVER),
25            )))
26            .layout(WidgetLayout::new(12, 12, 0, 0)),
27        ],
28    )
29    .description(Some("".to_string()))
30    .notify_list(Some(vec![]))
31    .template_variables(Some(vec![]));
32    let configuration = datadog::Configuration::new();
33    let api = DashboardsAPI::with_config(configuration);
34    let resp = api.create_dashboard(body).await;
35    if let Ok(value) = resp {
36        println!("{:#?}", value);
37    } else {
38        println!("{:#?}", resp.unwrap_err());
39    }
40}
examples/v1_dashboards_CreateDashboard_1738608750.rs (lines 15-30)
14async fn main() {
15    let body = Dashboard::new(
16        DashboardLayoutType::FREE,
17        "Example-Dashboard".to_string(),
18        vec![
19            Widget::new(WidgetDefinition::FreeTextWidgetDefinition(Box::new(
20                FreeTextWidgetDefinition::new(
21                    "Example free text".to_string(),
22                    FreeTextWidgetDefinitionType::FREE_TEXT,
23                )
24                .color("#4d4d4d".to_string())
25                .font_size("auto".to_string())
26                .text_align(WidgetTextAlign::LEFT),
27            )))
28            .layout(WidgetLayout::new(6, 24, 0, 0)),
29        ],
30    )
31    .description(None)
32    .notify_list(Some(vec![]))
33    .template_variables(Some(vec![]));
34    let configuration = datadog::Configuration::new();
35    let api = DashboardsAPI::with_config(configuration);
36    let resp = api.create_dashboard(body).await;
37    if let Ok(value) = resp {
38        println!("{:#?}", value);
39    } else {
40        println!("{:#?}", resp.unwrap_err());
41    }
42}
examples/v1_dashboards_CreateDashboard_2338918735.rs (lines 19-35)
18async fn main() {
19    let body = Dashboard::new(
20        DashboardLayoutType::ORDERED,
21        "Example-Dashboard with list_stream widget".to_string(),
22        vec![Widget::new(WidgetDefinition::ListStreamWidgetDefinition(
23            Box::new(ListStreamWidgetDefinition::new(
24                vec![ListStreamWidgetRequest::new(
25                    vec![ListStreamColumn::new(
26                        "timestamp".to_string(),
27                        ListStreamColumnWidth::AUTO,
28                    )],
29                    ListStreamQuery::new(ListStreamSource::APM_ISSUE_STREAM, "".to_string()),
30                    ListStreamResponseFormat::EVENT_LIST,
31                )],
32                ListStreamWidgetDefinitionType::LIST_STREAM,
33            )),
34        ))],
35    );
36    let configuration = datadog::Configuration::new();
37    let api = DashboardsAPI::with_config(configuration);
38    let resp = api.create_dashboard(body).await;
39    if let Ok(value) = resp {
40        println!("{:#?}", value);
41    } else {
42        println!("{:#?}", resp.unwrap_err());
43    }
44}
Source

pub fn author_handle(self, value: String) -> Self

Source

pub fn author_name(self, value: Option<String>) -> Self

Source

pub fn created_at(self, value: DateTime<Utc>) -> Self

Source

pub fn description(self, value: Option<String>) -> Self

Examples found in repository?
examples/v1_dashboards_CreateDashboard_417992286.rs (line 22)
13async fn main() {
14    let body = Dashboard::new(
15        DashboardLayoutType::FREE,
16        "Example-Dashboard".to_string(),
17        vec![Widget::new(WidgetDefinition::NoteWidgetDefinition(Box::new(
18            NoteWidgetDefinition::new("# Example Note".to_string(), NoteWidgetDefinitionType::NOTE),
19        )))
20        .layout(WidgetLayout::new(24, 18, 0, 0))],
21    )
22    .description(Some("".to_string()))
23    .notify_list(Some(vec![]))
24    .template_variables(Some(vec![]));
25    let configuration = datadog::Configuration::new();
26    let api = DashboardsAPI::with_config(configuration);
27    let resp = api.create_dashboard(body).await;
28    if let Ok(value) = resp {
29        println!("{:#?}", value);
30    } else {
31        println!("{:#?}", resp.unwrap_err());
32    }
33}
More examples
Hide additional examples
examples/v1_dashboards_CreateDashboard_913313564.rs (line 27)
13async fn main() {
14    let body = Dashboard::new(
15        DashboardLayoutType::FREE,
16        "Example-Dashboard".to_string(),
17        vec![
18            Widget::new(WidgetDefinition::IFrameWidgetDefinition(Box::new(
19                IFrameWidgetDefinition::new(
20                    IFrameWidgetDefinitionType::IFRAME,
21                    "https://docs.datadoghq.com/api/latest/".to_string(),
22                ),
23            )))
24            .layout(WidgetLayout::new(12, 12, 0, 0)),
25        ],
26    )
27    .description(Some("".to_string()))
28    .notify_list(Some(vec![]))
29    .template_variables(Some(vec![]));
30    let configuration = datadog::Configuration::new();
31    let api = DashboardsAPI::with_config(configuration);
32    let resp = api.create_dashboard(body).await;
33    if let Ok(value) = resp {
34        println!("{:#?}", value);
35    } else {
36        println!("{:#?}", resp.unwrap_err());
37    }
38}
examples/v1_dashboards_CreateDashboard_651038379.rs (line 29)
14async fn main() {
15    let body = Dashboard::new(
16        DashboardLayoutType::FREE,
17        "Example-Dashboard".to_string(),
18        vec![
19            Widget::new(WidgetDefinition::ImageWidgetDefinition(Box::new(
20                ImageWidgetDefinition::new(
21                    ImageWidgetDefinitionType::IMAGE,
22                    "https://example.com/image.png".to_string(),
23                )
24                .sizing(WidgetImageSizing::COVER),
25            )))
26            .layout(WidgetLayout::new(12, 12, 0, 0)),
27        ],
28    )
29    .description(Some("".to_string()))
30    .notify_list(Some(vec![]))
31    .template_variables(Some(vec![]));
32    let configuration = datadog::Configuration::new();
33    let api = DashboardsAPI::with_config(configuration);
34    let resp = api.create_dashboard(body).await;
35    if let Ok(value) = resp {
36        println!("{:#?}", value);
37    } else {
38        println!("{:#?}", resp.unwrap_err());
39    }
40}
examples/v1_dashboards_CreateDashboard_1738608750.rs (line 31)
14async fn main() {
15    let body = Dashboard::new(
16        DashboardLayoutType::FREE,
17        "Example-Dashboard".to_string(),
18        vec![
19            Widget::new(WidgetDefinition::FreeTextWidgetDefinition(Box::new(
20                FreeTextWidgetDefinition::new(
21                    "Example free text".to_string(),
22                    FreeTextWidgetDefinitionType::FREE_TEXT,
23                )
24                .color("#4d4d4d".to_string())
25                .font_size("auto".to_string())
26                .text_align(WidgetTextAlign::LEFT),
27            )))
28            .layout(WidgetLayout::new(6, 24, 0, 0)),
29        ],
30    )
31    .description(None)
32    .notify_list(Some(vec![]))
33    .template_variables(Some(vec![]));
34    let configuration = datadog::Configuration::new();
35    let api = DashboardsAPI::with_config(configuration);
36    let resp = api.create_dashboard(body).await;
37    if let Ok(value) = resp {
38        println!("{:#?}", value);
39    } else {
40        println!("{:#?}", resp.unwrap_err());
41    }
42}
examples/v1_dashboards_CreateDashboard_2607944105.rs (line 33)
15async fn main() {
16    let body = Dashboard::new(
17        DashboardLayoutType::FREE,
18        "Example-Dashboard".to_string(),
19        vec![
20            Widget::new(WidgetDefinition::CheckStatusWidgetDefinition(Box::new(
21                CheckStatusWidgetDefinition::new(
22                    "datadog.agent.up".to_string(),
23                    WidgetGrouping::CHECK,
24                    CheckStatusWidgetDefinitionType::CHECK_STATUS,
25                )
26                .tags(vec!["*".to_string()])
27                .title_align(WidgetTextAlign::LEFT)
28                .title_size("16".to_string()),
29            )))
30            .layout(WidgetLayout::new(8, 15, 0, 0)),
31        ],
32    )
33    .description(Some("".to_string()))
34    .notify_list(Some(vec![]))
35    .template_variables(Some(vec![]));
36    let configuration = datadog::Configuration::new();
37    let api = DashboardsAPI::with_config(configuration);
38    let resp = api.create_dashboard(body).await;
39    if let Ok(value) = resp {
40        println!("{:#?}", value);
41    } else {
42        println!("{:#?}", resp.unwrap_err());
43    }
44}
examples/v1_dashboards_CreateDashboard_3250131584.rs (line 32)
14async fn main() {
15    let body = Dashboard::new(
16        DashboardLayoutType::FREE,
17        "Example-Dashboard".to_string(),
18        vec![
19            Widget::new(WidgetDefinition::EventTimelineWidgetDefinition(Box::new(
20                EventTimelineWidgetDefinition::new(
21                    "status:error priority:all".to_string(),
22                    EventTimelineWidgetDefinitionType::EVENT_TIMELINE,
23                )
24                .tags_execution("and".to_string())
25                .title("".to_string())
26                .title_align(WidgetTextAlign::LEFT)
27                .title_size("16".to_string()),
28            )))
29            .layout(WidgetLayout::new(9, 47, 0, 0)),
30        ],
31    )
32    .description(None)
33    .notify_list(Some(vec![]))
34    .template_variables(Some(vec![]));
35    let configuration = datadog::Configuration::new();
36    let api = DashboardsAPI::with_config(configuration);
37    let resp = api.create_dashboard(body).await;
38    if let Ok(value) = resp {
39        println!("{:#?}", value);
40    } else {
41        println!("{:#?}", resp.unwrap_err());
42    }
43}
Source

pub fn id(self, value: String) -> Self

Source

pub fn is_read_only(self, value: bool) -> Self

Source

pub fn modified_at(self, value: DateTime<Utc>) -> Self

Source

pub fn notify_list(self, value: Option<Vec<String>>) -> Self

Examples found in repository?
examples/v1_dashboards_CreateDashboard_417992286.rs (line 23)
13async fn main() {
14    let body = Dashboard::new(
15        DashboardLayoutType::FREE,
16        "Example-Dashboard".to_string(),
17        vec![Widget::new(WidgetDefinition::NoteWidgetDefinition(Box::new(
18            NoteWidgetDefinition::new("# Example Note".to_string(), NoteWidgetDefinitionType::NOTE),
19        )))
20        .layout(WidgetLayout::new(24, 18, 0, 0))],
21    )
22    .description(Some("".to_string()))
23    .notify_list(Some(vec![]))
24    .template_variables(Some(vec![]));
25    let configuration = datadog::Configuration::new();
26    let api = DashboardsAPI::with_config(configuration);
27    let resp = api.create_dashboard(body).await;
28    if let Ok(value) = resp {
29        println!("{:#?}", value);
30    } else {
31        println!("{:#?}", resp.unwrap_err());
32    }
33}
More examples
Hide additional examples
examples/v1_dashboards_CreateDashboard_913313564.rs (line 28)
13async fn main() {
14    let body = Dashboard::new(
15        DashboardLayoutType::FREE,
16        "Example-Dashboard".to_string(),
17        vec![
18            Widget::new(WidgetDefinition::IFrameWidgetDefinition(Box::new(
19                IFrameWidgetDefinition::new(
20                    IFrameWidgetDefinitionType::IFRAME,
21                    "https://docs.datadoghq.com/api/latest/".to_string(),
22                ),
23            )))
24            .layout(WidgetLayout::new(12, 12, 0, 0)),
25        ],
26    )
27    .description(Some("".to_string()))
28    .notify_list(Some(vec![]))
29    .template_variables(Some(vec![]));
30    let configuration = datadog::Configuration::new();
31    let api = DashboardsAPI::with_config(configuration);
32    let resp = api.create_dashboard(body).await;
33    if let Ok(value) = resp {
34        println!("{:#?}", value);
35    } else {
36        println!("{:#?}", resp.unwrap_err());
37    }
38}
examples/v1_dashboards_CreateDashboard_651038379.rs (line 30)
14async fn main() {
15    let body = Dashboard::new(
16        DashboardLayoutType::FREE,
17        "Example-Dashboard".to_string(),
18        vec![
19            Widget::new(WidgetDefinition::ImageWidgetDefinition(Box::new(
20                ImageWidgetDefinition::new(
21                    ImageWidgetDefinitionType::IMAGE,
22                    "https://example.com/image.png".to_string(),
23                )
24                .sizing(WidgetImageSizing::COVER),
25            )))
26            .layout(WidgetLayout::new(12, 12, 0, 0)),
27        ],
28    )
29    .description(Some("".to_string()))
30    .notify_list(Some(vec![]))
31    .template_variables(Some(vec![]));
32    let configuration = datadog::Configuration::new();
33    let api = DashboardsAPI::with_config(configuration);
34    let resp = api.create_dashboard(body).await;
35    if let Ok(value) = resp {
36        println!("{:#?}", value);
37    } else {
38        println!("{:#?}", resp.unwrap_err());
39    }
40}
examples/v1_dashboards_CreateDashboard_1738608750.rs (line 32)
14async fn main() {
15    let body = Dashboard::new(
16        DashboardLayoutType::FREE,
17        "Example-Dashboard".to_string(),
18        vec![
19            Widget::new(WidgetDefinition::FreeTextWidgetDefinition(Box::new(
20                FreeTextWidgetDefinition::new(
21                    "Example free text".to_string(),
22                    FreeTextWidgetDefinitionType::FREE_TEXT,
23                )
24                .color("#4d4d4d".to_string())
25                .font_size("auto".to_string())
26                .text_align(WidgetTextAlign::LEFT),
27            )))
28            .layout(WidgetLayout::new(6, 24, 0, 0)),
29        ],
30    )
31    .description(None)
32    .notify_list(Some(vec![]))
33    .template_variables(Some(vec![]));
34    let configuration = datadog::Configuration::new();
35    let api = DashboardsAPI::with_config(configuration);
36    let resp = api.create_dashboard(body).await;
37    if let Ok(value) = resp {
38        println!("{:#?}", value);
39    } else {
40        println!("{:#?}", resp.unwrap_err());
41    }
42}
examples/v1_dashboards_CreateDashboard_2607944105.rs (line 34)
15async fn main() {
16    let body = Dashboard::new(
17        DashboardLayoutType::FREE,
18        "Example-Dashboard".to_string(),
19        vec![
20            Widget::new(WidgetDefinition::CheckStatusWidgetDefinition(Box::new(
21                CheckStatusWidgetDefinition::new(
22                    "datadog.agent.up".to_string(),
23                    WidgetGrouping::CHECK,
24                    CheckStatusWidgetDefinitionType::CHECK_STATUS,
25                )
26                .tags(vec!["*".to_string()])
27                .title_align(WidgetTextAlign::LEFT)
28                .title_size("16".to_string()),
29            )))
30            .layout(WidgetLayout::new(8, 15, 0, 0)),
31        ],
32    )
33    .description(Some("".to_string()))
34    .notify_list(Some(vec![]))
35    .template_variables(Some(vec![]));
36    let configuration = datadog::Configuration::new();
37    let api = DashboardsAPI::with_config(configuration);
38    let resp = api.create_dashboard(body).await;
39    if let Ok(value) = resp {
40        println!("{:#?}", value);
41    } else {
42        println!("{:#?}", resp.unwrap_err());
43    }
44}
examples/v1_dashboards_CreateDashboard_3250131584.rs (line 33)
14async fn main() {
15    let body = Dashboard::new(
16        DashboardLayoutType::FREE,
17        "Example-Dashboard".to_string(),
18        vec![
19            Widget::new(WidgetDefinition::EventTimelineWidgetDefinition(Box::new(
20                EventTimelineWidgetDefinition::new(
21                    "status:error priority:all".to_string(),
22                    EventTimelineWidgetDefinitionType::EVENT_TIMELINE,
23                )
24                .tags_execution("and".to_string())
25                .title("".to_string())
26                .title_align(WidgetTextAlign::LEFT)
27                .title_size("16".to_string()),
28            )))
29            .layout(WidgetLayout::new(9, 47, 0, 0)),
30        ],
31    )
32    .description(None)
33    .notify_list(Some(vec![]))
34    .template_variables(Some(vec![]));
35    let configuration = datadog::Configuration::new();
36    let api = DashboardsAPI::with_config(configuration);
37    let resp = api.create_dashboard(body).await;
38    if let Ok(value) = resp {
39        println!("{:#?}", value);
40    } else {
41        println!("{:#?}", resp.unwrap_err());
42    }
43}
Source

pub fn reflow_type(self, value: DashboardReflowType) -> Self

Examples found in repository?
examples/v1_dashboards_CreateDashboard_858397694.rs (line 30)
16async fn main() {
17    let body = Dashboard::new(
18        DashboardLayoutType::ORDERED,
19        "".to_string(),
20        vec![Widget::new(WidgetDefinition::HostMapWidgetDefinition(
21            Box::new(HostMapWidgetDefinition::new(
22                HostMapWidgetDefinitionRequests::new()
23                    .fill(HostMapRequest::new().q("avg:system.cpu.user{*}".to_string())),
24                HostMapWidgetDefinitionType::HOSTMAP,
25            )),
26        ))],
27    )
28    .description(None)
29    .notify_list(Some(vec![]))
30    .reflow_type(DashboardReflowType::AUTO)
31    .restricted_roles(vec![])
32    .template_variables(Some(vec![DashboardTemplateVariable::new(
33        "host1".to_string(),
34    )
35    .available_values(Some(vec![
36        "my-host".to_string(),
37        "host1".to_string(),
38        "host2".to_string(),
39    ]))
40    .defaults(vec!["my-host".to_string()])
41    .prefix(Some("host".to_string()))]));
42    let configuration = datadog::Configuration::new();
43    let api = DashboardsAPI::with_config(configuration);
44    let resp = api.create_dashboard(body).await;
45    if let Ok(value) = resp {
46        println!("{:#?}", value);
47    } else {
48        println!("{:#?}", resp.unwrap_err());
49    }
50}
More examples
Hide additional examples
examples/v1_dashboards_CreateDashboard_1751391372.rs (line 30)
16async fn main() {
17    let body = Dashboard::new(
18        DashboardLayoutType::ORDERED,
19        "".to_string(),
20        vec![Widget::new(WidgetDefinition::HostMapWidgetDefinition(
21            Box::new(HostMapWidgetDefinition::new(
22                HostMapWidgetDefinitionRequests::new()
23                    .fill(HostMapRequest::new().q("avg:system.cpu.user{*}".to_string())),
24                HostMapWidgetDefinitionType::HOSTMAP,
25            )),
26        ))],
27    )
28    .description(None)
29    .notify_list(Some(vec![]))
30    .reflow_type(DashboardReflowType::AUTO)
31    .restricted_roles(vec![])
32    .template_variables(Some(vec![DashboardTemplateVariable::new(
33        "group_by_var".to_string(),
34    )
35    .available_values(Some(vec![
36        "service".to_string(),
37        "datacenter".to_string(),
38        "env".to_string(),
39    ]))
40    .defaults(vec!["service".to_string(), "datacenter".to_string()])
41    .type_(Some("group".to_string()))]));
42    let configuration = datadog::Configuration::new();
43    let api = DashboardsAPI::with_config(configuration);
44    let resp = api.create_dashboard(body).await;
45    if let Ok(value) = resp {
46        println!("{:#?}", value);
47    } else {
48        println!("{:#?}", resp.unwrap_err());
49    }
50}
examples/v1_dashboards_CreateDashboard_2850365602.rs (line 33)
19async fn main() {
20    let body = Dashboard::new(
21        DashboardLayoutType::ORDERED,
22        "".to_string(),
23        vec![Widget::new(WidgetDefinition::HostMapWidgetDefinition(
24            Box::new(HostMapWidgetDefinition::new(
25                HostMapWidgetDefinitionRequests::new()
26                    .fill(HostMapRequest::new().q("avg:system.cpu.user{*}".to_string())),
27                HostMapWidgetDefinitionType::HOSTMAP,
28            )),
29        ))],
30    )
31    .description(None)
32    .notify_list(Some(vec![]))
33    .reflow_type(DashboardReflowType::AUTO)
34    .restricted_roles(vec![])
35    .template_variable_presets(Some(vec![DashboardTemplateVariablePreset::new()
36        .name("my saved view".to_string())
37        .template_variables(vec![DashboardTemplateVariablePresetValue::new()
38            .name("datacenter".to_string())
39            .values(vec!["*".to_string(), "my-host".to_string()])])]))
40    .template_variables(Some(vec![DashboardTemplateVariable::new(
41        "host1".to_string(),
42    )
43    .available_values(Some(vec![
44        "my-host".to_string(),
45        "host1".to_string(),
46        "host2".to_string(),
47    ]))
48    .defaults(vec!["my-host".to_string()])
49    .prefix(Some("host".to_string()))]));
50    let configuration = datadog::Configuration::new();
51    let api = DashboardsAPI::with_config(configuration);
52    let resp = api.create_dashboard(body).await;
53    if let Ok(value) = resp {
54        println!("{:#?}", value);
55    } else {
56        println!("{:#?}", resp.unwrap_err());
57    }
58}
examples/v1_dashboards_CreateDashboard_3513586382.rs (line 72)
23async fn main() {
24    let body = Dashboard::new(
25        DashboardLayoutType::ORDERED,
26        "Example-Dashboard".to_string(),
27        vec![
28            Widget::new(WidgetDefinition::GeomapWidgetDefinition(Box::new(
29                GeomapWidgetDefinition::new(
30                    vec![GeomapWidgetRequest::new()
31                        .columns(vec![
32                            ListStreamColumn::new(
33                                "@network.client.geoip.location.latitude".to_string(),
34                                ListStreamColumnWidth::AUTO,
35                            ),
36                            ListStreamColumn::new(
37                                "@network.client.geoip.location.longitude".to_string(),
38                                ListStreamColumnWidth::AUTO,
39                            ),
40                            ListStreamColumn::new(
41                                "@network.client.geoip.country.iso_code".to_string(),
42                                ListStreamColumnWidth::AUTO,
43                            ),
44                            ListStreamColumn::new(
45                                "@network.client.geoip.subdivision.name".to_string(),
46                                ListStreamColumnWidth::AUTO,
47                            ),
48                            ListStreamColumn::new(
49                                "classic".to_string(),
50                                ListStreamColumnWidth::AUTO,
51                            ),
52                            ListStreamColumn::new("".to_string(), ListStreamColumnWidth::AUTO),
53                        ])
54                        .query(
55                            ListStreamQuery::new(ListStreamSource::LOGS_STREAM, "".to_string())
56                                .indexes(vec![]),
57                        )
58                        .response_format(FormulaAndFunctionResponseFormat::EVENT_LIST)],
59                    GeomapWidgetDefinitionStyle::new("hostmap_blues".to_string(), false),
60                    GeomapWidgetDefinitionType::GEOMAP,
61                    GeomapWidgetDefinitionView::new("WORLD".to_string()),
62                )
63                .title("".to_string())
64                .title_align(WidgetTextAlign::LEFT)
65                .title_size("16".to_string()),
66            )))
67            .layout(WidgetLayout::new(6, 12, 0, 0)),
68        ],
69    )
70    .description(Some("Example-Dashboard".to_string()))
71    .notify_list(Some(vec![]))
72    .reflow_type(DashboardReflowType::FIXED)
73    .tags(Some(vec![]))
74    .template_variables(Some(vec![]));
75    let configuration = datadog::Configuration::new();
76    let api = DashboardsAPI::with_config(configuration);
77    let resp = api.create_dashboard(body).await;
78    if let Ok(value) = resp {
79        println!("{:#?}", value);
80    } else {
81        println!("{:#?}", resp.unwrap_err());
82    }
83}
examples/v1_dashboards_CreateDashboard_41622531.rs (line 93)
28async fn main() {
29    let body =
30        Dashboard::new(
31            DashboardLayoutType::ORDERED,
32            "Example-Dashboard with formula style".to_string(),
33            vec![
34                Widget::new(
35                    WidgetDefinition::TimeseriesWidgetDefinition(
36                        Box::new(
37                            TimeseriesWidgetDefinition::new(
38                                vec![
39                                    TimeseriesWidgetRequest::new()
40                                        .display_type(WidgetDisplayType::LINE)
41                                        .formulas(
42                                            vec![
43                                                WidgetFormula::new(
44                                                    "query1".to_string(),
45                                                ).style(
46                                                    WidgetFormulaStyle::new()
47                                                        .palette("classic".to_string())
48                                                        .palette_index(4),
49                                                )
50                                            ],
51                                        )
52                                        .queries(
53                                            vec![
54                                                FormulaAndFunctionQueryDefinition
55                                                ::FormulaAndFunctionMetricQueryDefinition(
56                                                    Box::new(
57                                                        FormulaAndFunctionMetricQueryDefinition::new(
58                                                            FormulaAndFunctionMetricDataSource::METRICS,
59                                                            "query1".to_string(),
60                                                            "avg:system.cpu.user{*}".to_string(),
61                                                        ),
62                                                    ),
63                                                )
64                                            ],
65                                        )
66                                        .response_format(FormulaAndFunctionResponseFormat::TIMESERIES)
67                                        .style(
68                                            WidgetRequestStyle::new()
69                                                .line_type(WidgetLineType::SOLID)
70                                                .line_width(WidgetLineWidth::NORMAL)
71                                                .palette("dog_classic".to_string()),
72                                        )
73                                ],
74                                TimeseriesWidgetDefinitionType::TIMESERIES,
75                            )
76                                .legend_columns(
77                                    vec![
78                                        TimeseriesWidgetLegendColumn::AVG,
79                                        TimeseriesWidgetLegendColumn::MIN,
80                                        TimeseriesWidgetLegendColumn::MAX,
81                                        TimeseriesWidgetLegendColumn::VALUE,
82                                        TimeseriesWidgetLegendColumn::SUM
83                                    ],
84                                )
85                                .legend_layout(TimeseriesWidgetLegendLayout::AUTO)
86                                .show_legend(true)
87                                .time(WidgetTime::WidgetLegacyLiveSpan(Box::new(WidgetLegacyLiveSpan::new())))
88                                .title("styled timeseries".to_string()),
89                        ),
90                    ),
91                )
92            ],
93        ).reflow_type(DashboardReflowType::AUTO);
94    let configuration = datadog::Configuration::new();
95    let api = DashboardsAPI::with_config(configuration);
96    let resp = api.create_dashboard(body).await;
97    if let Ok(value) = resp {
98        println!("{:#?}", value);
99    } else {
100        println!("{:#?}", resp.unwrap_err());
101    }
102}
examples/v1_dashboards_CreateDashboard_1307120899.rs (line 94)
30async fn main() {
31    let body =
32        Dashboard::new(
33            DashboardLayoutType::ORDERED,
34            "Example-Dashboard with ci_tests datasource".to_string(),
35            vec![
36                Widget::new(
37                    WidgetDefinition::TimeseriesWidgetDefinition(
38                        Box::new(
39                            TimeseriesWidgetDefinition::new(
40                                vec![
41                                    TimeseriesWidgetRequest::new()
42                                        .display_type(WidgetDisplayType::LINE)
43                                        .formulas(vec![WidgetFormula::new("query1".to_string())])
44                                        .queries(
45                                            vec![
46                                                FormulaAndFunctionQueryDefinition
47                                                ::FormulaAndFunctionEventQueryDefinition(
48                                                    Box::new(
49                                                        FormulaAndFunctionEventQueryDefinition::new(
50                                                            FormulaAndFunctionEventQueryDefinitionCompute::new(
51                                                                FormulaAndFunctionEventAggregation::COUNT,
52                                                            ),
53                                                            FormulaAndFunctionEventsDataSource::CI_TESTS,
54                                                            "query1".to_string(),
55                                                        )
56                                                            .group_by(vec![])
57                                                            .indexes(vec!["*".to_string()])
58                                                            .search(
59                                                                FormulaAndFunctionEventQueryDefinitionSearch::new(
60                                                                    "test_level:test".to_string(),
61                                                                ),
62                                                            ),
63                                                    ),
64                                                )
65                                            ],
66                                        )
67                                        .response_format(FormulaAndFunctionResponseFormat::TIMESERIES)
68                                        .style(
69                                            WidgetRequestStyle::new()
70                                                .line_type(WidgetLineType::SOLID)
71                                                .line_width(WidgetLineWidth::NORMAL)
72                                                .palette("dog_classic".to_string()),
73                                        )
74                                ],
75                                TimeseriesWidgetDefinitionType::TIMESERIES,
76                            )
77                                .legend_columns(
78                                    vec![
79                                        TimeseriesWidgetLegendColumn::AVG,
80                                        TimeseriesWidgetLegendColumn::MIN,
81                                        TimeseriesWidgetLegendColumn::MAX,
82                                        TimeseriesWidgetLegendColumn::VALUE,
83                                        TimeseriesWidgetLegendColumn::SUM
84                                    ],
85                                )
86                                .legend_layout(TimeseriesWidgetLegendLayout::AUTO)
87                                .show_legend(true)
88                                .time(WidgetTime::WidgetLegacyLiveSpan(Box::new(WidgetLegacyLiveSpan::new())))
89                                .title("".to_string()),
90                        ),
91                    ),
92                )
93            ],
94        ).reflow_type(DashboardReflowType::AUTO);
95    let configuration = datadog::Configuration::new();
96    let api = DashboardsAPI::with_config(configuration);
97    let resp = api.create_dashboard(body).await;
98    if let Ok(value) = resp {
99        println!("{:#?}", value);
100    } else {
101        println!("{:#?}", resp.unwrap_err());
102    }
103}
Source

pub fn restricted_roles(self, value: Vec<String>) -> Self

Examples found in repository?
examples/v1_dashboards_CreateDashboard_858397694.rs (line 31)
16async fn main() {
17    let body = Dashboard::new(
18        DashboardLayoutType::ORDERED,
19        "".to_string(),
20        vec![Widget::new(WidgetDefinition::HostMapWidgetDefinition(
21            Box::new(HostMapWidgetDefinition::new(
22                HostMapWidgetDefinitionRequests::new()
23                    .fill(HostMapRequest::new().q("avg:system.cpu.user{*}".to_string())),
24                HostMapWidgetDefinitionType::HOSTMAP,
25            )),
26        ))],
27    )
28    .description(None)
29    .notify_list(Some(vec![]))
30    .reflow_type(DashboardReflowType::AUTO)
31    .restricted_roles(vec![])
32    .template_variables(Some(vec![DashboardTemplateVariable::new(
33        "host1".to_string(),
34    )
35    .available_values(Some(vec![
36        "my-host".to_string(),
37        "host1".to_string(),
38        "host2".to_string(),
39    ]))
40    .defaults(vec!["my-host".to_string()])
41    .prefix(Some("host".to_string()))]));
42    let configuration = datadog::Configuration::new();
43    let api = DashboardsAPI::with_config(configuration);
44    let resp = api.create_dashboard(body).await;
45    if let Ok(value) = resp {
46        println!("{:#?}", value);
47    } else {
48        println!("{:#?}", resp.unwrap_err());
49    }
50}
More examples
Hide additional examples
examples/v1_dashboards_CreateDashboard_1751391372.rs (line 31)
16async fn main() {
17    let body = Dashboard::new(
18        DashboardLayoutType::ORDERED,
19        "".to_string(),
20        vec![Widget::new(WidgetDefinition::HostMapWidgetDefinition(
21            Box::new(HostMapWidgetDefinition::new(
22                HostMapWidgetDefinitionRequests::new()
23                    .fill(HostMapRequest::new().q("avg:system.cpu.user{*}".to_string())),
24                HostMapWidgetDefinitionType::HOSTMAP,
25            )),
26        ))],
27    )
28    .description(None)
29    .notify_list(Some(vec![]))
30    .reflow_type(DashboardReflowType::AUTO)
31    .restricted_roles(vec![])
32    .template_variables(Some(vec![DashboardTemplateVariable::new(
33        "group_by_var".to_string(),
34    )
35    .available_values(Some(vec![
36        "service".to_string(),
37        "datacenter".to_string(),
38        "env".to_string(),
39    ]))
40    .defaults(vec!["service".to_string(), "datacenter".to_string()])
41    .type_(Some("group".to_string()))]));
42    let configuration = datadog::Configuration::new();
43    let api = DashboardsAPI::with_config(configuration);
44    let resp = api.create_dashboard(body).await;
45    if let Ok(value) = resp {
46        println!("{:#?}", value);
47    } else {
48        println!("{:#?}", resp.unwrap_err());
49    }
50}
examples/v1_dashboards_CreateDashboard_2850365602.rs (line 34)
19async fn main() {
20    let body = Dashboard::new(
21        DashboardLayoutType::ORDERED,
22        "".to_string(),
23        vec![Widget::new(WidgetDefinition::HostMapWidgetDefinition(
24            Box::new(HostMapWidgetDefinition::new(
25                HostMapWidgetDefinitionRequests::new()
26                    .fill(HostMapRequest::new().q("avg:system.cpu.user{*}".to_string())),
27                HostMapWidgetDefinitionType::HOSTMAP,
28            )),
29        ))],
30    )
31    .description(None)
32    .notify_list(Some(vec![]))
33    .reflow_type(DashboardReflowType::AUTO)
34    .restricted_roles(vec![])
35    .template_variable_presets(Some(vec![DashboardTemplateVariablePreset::new()
36        .name("my saved view".to_string())
37        .template_variables(vec![DashboardTemplateVariablePresetValue::new()
38            .name("datacenter".to_string())
39            .values(vec!["*".to_string(), "my-host".to_string()])])]))
40    .template_variables(Some(vec![DashboardTemplateVariable::new(
41        "host1".to_string(),
42    )
43    .available_values(Some(vec![
44        "my-host".to_string(),
45        "host1".to_string(),
46        "host2".to_string(),
47    ]))
48    .defaults(vec!["my-host".to_string()])
49    .prefix(Some("host".to_string()))]));
50    let configuration = datadog::Configuration::new();
51    let api = DashboardsAPI::with_config(configuration);
52    let resp = api.create_dashboard(body).await;
53    if let Ok(value) = resp {
54        println!("{:#?}", value);
55    } else {
56        println!("{:#?}", resp.unwrap_err());
57    }
58}
Source

pub fn tags(self, value: Option<Vec<String>>) -> Self

Examples found in repository?
examples/v1_dashboards_UpdateDashboard_3454865944.rs (line 39)
18async fn main() {
19    // there is a valid "dashboard" in the system
20    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}
More examples
Hide additional examples
examples/v1_dashboards_CreateDashboard_3513586382.rs (line 73)
23async fn main() {
24    let body = Dashboard::new(
25        DashboardLayoutType::ORDERED,
26        "Example-Dashboard".to_string(),
27        vec![
28            Widget::new(WidgetDefinition::GeomapWidgetDefinition(Box::new(
29                GeomapWidgetDefinition::new(
30                    vec![GeomapWidgetRequest::new()
31                        .columns(vec![
32                            ListStreamColumn::new(
33                                "@network.client.geoip.location.latitude".to_string(),
34                                ListStreamColumnWidth::AUTO,
35                            ),
36                            ListStreamColumn::new(
37                                "@network.client.geoip.location.longitude".to_string(),
38                                ListStreamColumnWidth::AUTO,
39                            ),
40                            ListStreamColumn::new(
41                                "@network.client.geoip.country.iso_code".to_string(),
42                                ListStreamColumnWidth::AUTO,
43                            ),
44                            ListStreamColumn::new(
45                                "@network.client.geoip.subdivision.name".to_string(),
46                                ListStreamColumnWidth::AUTO,
47                            ),
48                            ListStreamColumn::new(
49                                "classic".to_string(),
50                                ListStreamColumnWidth::AUTO,
51                            ),
52                            ListStreamColumn::new("".to_string(), ListStreamColumnWidth::AUTO),
53                        ])
54                        .query(
55                            ListStreamQuery::new(ListStreamSource::LOGS_STREAM, "".to_string())
56                                .indexes(vec![]),
57                        )
58                        .response_format(FormulaAndFunctionResponseFormat::EVENT_LIST)],
59                    GeomapWidgetDefinitionStyle::new("hostmap_blues".to_string(), false),
60                    GeomapWidgetDefinitionType::GEOMAP,
61                    GeomapWidgetDefinitionView::new("WORLD".to_string()),
62                )
63                .title("".to_string())
64                .title_align(WidgetTextAlign::LEFT)
65                .title_size("16".to_string()),
66            )))
67            .layout(WidgetLayout::new(6, 12, 0, 0)),
68        ],
69    )
70    .description(Some("Example-Dashboard".to_string()))
71    .notify_list(Some(vec![]))
72    .reflow_type(DashboardReflowType::FIXED)
73    .tags(Some(vec![]))
74    .template_variables(Some(vec![]));
75    let configuration = datadog::Configuration::new();
76    let api = DashboardsAPI::with_config(configuration);
77    let resp = api.create_dashboard(body).await;
78    if let Ok(value) = resp {
79        println!("{:#?}", value);
80    } else {
81        println!("{:#?}", resp.unwrap_err());
82    }
83}
examples/v1_dashboards_CreateDashboard_2064651578.rs (line 87)
29async fn main() {
30    let body =
31        Dashboard::new(
32            DashboardLayoutType::ORDERED,
33            "Example-Dashboard".to_string(),
34            vec![
35                Widget::new(
36                    WidgetDefinition::ChangeWidgetDefinition(
37                        Box::new(
38                            ChangeWidgetDefinition::new(
39                                vec![
40                                    ChangeWidgetRequest::new()
41                                        .change_type(WidgetChangeType::ABSOLUTE)
42                                        .compare_to(WidgetCompareTo::HOUR_BEFORE)
43                                        .formulas(
44                                            vec![
45                                                WidgetFormula::new("hour_before(query1)".to_string()),
46                                                WidgetFormula::new("query1".to_string())
47                                            ],
48                                        )
49                                        .increase_good(true)
50                                        .order_by(WidgetOrderBy::CHANGE)
51                                        .order_dir(WidgetSort::DESCENDING)
52                                        .queries(
53                                            vec![
54                                                FormulaAndFunctionQueryDefinition
55                                                ::FormulaAndFunctionEventQueryDefinition(
56                                                    Box::new(
57                                                        FormulaAndFunctionEventQueryDefinition::new(
58                                                            FormulaAndFunctionEventQueryDefinitionCompute::new(
59                                                                FormulaAndFunctionEventAggregation::COUNT,
60                                                            ),
61                                                            FormulaAndFunctionEventsDataSource::LOGS,
62                                                            "query1".to_string(),
63                                                        )
64                                                            .group_by(vec![])
65                                                            .indexes(vec!["*".to_string()])
66                                                            .search(
67                                                                FormulaAndFunctionEventQueryDefinitionSearch::new(
68                                                                    "".to_string(),
69                                                                ),
70                                                            ),
71                                                    ),
72                                                )
73                                            ],
74                                        )
75                                        .response_format(FormulaAndFunctionResponseFormat::SCALAR)
76                                ],
77                                ChangeWidgetDefinitionType::CHANGE,
78                            )
79                                .time(WidgetTime::WidgetLegacyLiveSpan(Box::new(WidgetLegacyLiveSpan::new())))
80                                .title("".to_string())
81                                .title_align(WidgetTextAlign::LEFT)
82                                .title_size("16".to_string()),
83                        ),
84                    ),
85                ).layout(WidgetLayout::new(4, 4, 0, 0))
86            ],
87        ).tags(Some(vec!["team:foobar".to_string()]));
88    let configuration = datadog::Configuration::new();
89    let api = DashboardsAPI::with_config(configuration);
90    let resp = api.create_dashboard(body).await;
91    if let Ok(value) = resp {
92        println!("{:#?}", value);
93    } else {
94        println!("{:#?}", resp.unwrap_err());
95    }
96}
Source

pub fn template_variable_presets( self, value: Option<Vec<DashboardTemplateVariablePreset>>, ) -> Self

Examples found in repository?
examples/v1_dashboards_CreateDashboard_2850365602.rs (lines 35-39)
19async fn main() {
20    let body = Dashboard::new(
21        DashboardLayoutType::ORDERED,
22        "".to_string(),
23        vec![Widget::new(WidgetDefinition::HostMapWidgetDefinition(
24            Box::new(HostMapWidgetDefinition::new(
25                HostMapWidgetDefinitionRequests::new()
26                    .fill(HostMapRequest::new().q("avg:system.cpu.user{*}".to_string())),
27                HostMapWidgetDefinitionType::HOSTMAP,
28            )),
29        ))],
30    )
31    .description(None)
32    .notify_list(Some(vec![]))
33    .reflow_type(DashboardReflowType::AUTO)
34    .restricted_roles(vec![])
35    .template_variable_presets(Some(vec![DashboardTemplateVariablePreset::new()
36        .name("my saved view".to_string())
37        .template_variables(vec![DashboardTemplateVariablePresetValue::new()
38            .name("datacenter".to_string())
39            .values(vec!["*".to_string(), "my-host".to_string()])])]))
40    .template_variables(Some(vec![DashboardTemplateVariable::new(
41        "host1".to_string(),
42    )
43    .available_values(Some(vec![
44        "my-host".to_string(),
45        "host1".to_string(),
46        "host2".to_string(),
47    ]))
48    .defaults(vec!["my-host".to_string()])
49    .prefix(Some("host".to_string()))]));
50    let configuration = datadog::Configuration::new();
51    let api = DashboardsAPI::with_config(configuration);
52    let resp = api.create_dashboard(body).await;
53    if let Ok(value) = resp {
54        println!("{:#?}", value);
55    } else {
56        println!("{:#?}", resp.unwrap_err());
57    }
58}
Source

pub fn template_variables( self, value: Option<Vec<DashboardTemplateVariable>>, ) -> Self

Examples found in repository?
examples/v1_dashboards_CreateDashboard_417992286.rs (line 24)
13async fn main() {
14    let body = Dashboard::new(
15        DashboardLayoutType::FREE,
16        "Example-Dashboard".to_string(),
17        vec![Widget::new(WidgetDefinition::NoteWidgetDefinition(Box::new(
18            NoteWidgetDefinition::new("# Example Note".to_string(), NoteWidgetDefinitionType::NOTE),
19        )))
20        .layout(WidgetLayout::new(24, 18, 0, 0))],
21    )
22    .description(Some("".to_string()))
23    .notify_list(Some(vec![]))
24    .template_variables(Some(vec![]));
25    let configuration = datadog::Configuration::new();
26    let api = DashboardsAPI::with_config(configuration);
27    let resp = api.create_dashboard(body).await;
28    if let Ok(value) = resp {
29        println!("{:#?}", value);
30    } else {
31        println!("{:#?}", resp.unwrap_err());
32    }
33}
More examples
Hide additional examples
examples/v1_dashboards_CreateDashboard_913313564.rs (line 29)
13async fn main() {
14    let body = Dashboard::new(
15        DashboardLayoutType::FREE,
16        "Example-Dashboard".to_string(),
17        vec![
18            Widget::new(WidgetDefinition::IFrameWidgetDefinition(Box::new(
19                IFrameWidgetDefinition::new(
20                    IFrameWidgetDefinitionType::IFRAME,
21                    "https://docs.datadoghq.com/api/latest/".to_string(),
22                ),
23            )))
24            .layout(WidgetLayout::new(12, 12, 0, 0)),
25        ],
26    )
27    .description(Some("".to_string()))
28    .notify_list(Some(vec![]))
29    .template_variables(Some(vec![]));
30    let configuration = datadog::Configuration::new();
31    let api = DashboardsAPI::with_config(configuration);
32    let resp = api.create_dashboard(body).await;
33    if let Ok(value) = resp {
34        println!("{:#?}", value);
35    } else {
36        println!("{:#?}", resp.unwrap_err());
37    }
38}
examples/v1_dashboards_CreateDashboard_651038379.rs (line 31)
14async fn main() {
15    let body = Dashboard::new(
16        DashboardLayoutType::FREE,
17        "Example-Dashboard".to_string(),
18        vec![
19            Widget::new(WidgetDefinition::ImageWidgetDefinition(Box::new(
20                ImageWidgetDefinition::new(
21                    ImageWidgetDefinitionType::IMAGE,
22                    "https://example.com/image.png".to_string(),
23                )
24                .sizing(WidgetImageSizing::COVER),
25            )))
26            .layout(WidgetLayout::new(12, 12, 0, 0)),
27        ],
28    )
29    .description(Some("".to_string()))
30    .notify_list(Some(vec![]))
31    .template_variables(Some(vec![]));
32    let configuration = datadog::Configuration::new();
33    let api = DashboardsAPI::with_config(configuration);
34    let resp = api.create_dashboard(body).await;
35    if let Ok(value) = resp {
36        println!("{:#?}", value);
37    } else {
38        println!("{:#?}", resp.unwrap_err());
39    }
40}
examples/v1_dashboards_CreateDashboard_1738608750.rs (line 33)
14async fn main() {
15    let body = Dashboard::new(
16        DashboardLayoutType::FREE,
17        "Example-Dashboard".to_string(),
18        vec![
19            Widget::new(WidgetDefinition::FreeTextWidgetDefinition(Box::new(
20                FreeTextWidgetDefinition::new(
21                    "Example free text".to_string(),
22                    FreeTextWidgetDefinitionType::FREE_TEXT,
23                )
24                .color("#4d4d4d".to_string())
25                .font_size("auto".to_string())
26                .text_align(WidgetTextAlign::LEFT),
27            )))
28            .layout(WidgetLayout::new(6, 24, 0, 0)),
29        ],
30    )
31    .description(None)
32    .notify_list(Some(vec![]))
33    .template_variables(Some(vec![]));
34    let configuration = datadog::Configuration::new();
35    let api = DashboardsAPI::with_config(configuration);
36    let resp = api.create_dashboard(body).await;
37    if let Ok(value) = resp {
38        println!("{:#?}", value);
39    } else {
40        println!("{:#?}", resp.unwrap_err());
41    }
42}
examples/v1_dashboards_CreateDashboard_2607944105.rs (line 35)
15async fn main() {
16    let body = Dashboard::new(
17        DashboardLayoutType::FREE,
18        "Example-Dashboard".to_string(),
19        vec![
20            Widget::new(WidgetDefinition::CheckStatusWidgetDefinition(Box::new(
21                CheckStatusWidgetDefinition::new(
22                    "datadog.agent.up".to_string(),
23                    WidgetGrouping::CHECK,
24                    CheckStatusWidgetDefinitionType::CHECK_STATUS,
25                )
26                .tags(vec!["*".to_string()])
27                .title_align(WidgetTextAlign::LEFT)
28                .title_size("16".to_string()),
29            )))
30            .layout(WidgetLayout::new(8, 15, 0, 0)),
31        ],
32    )
33    .description(Some("".to_string()))
34    .notify_list(Some(vec![]))
35    .template_variables(Some(vec![]));
36    let configuration = datadog::Configuration::new();
37    let api = DashboardsAPI::with_config(configuration);
38    let resp = api.create_dashboard(body).await;
39    if let Ok(value) = resp {
40        println!("{:#?}", value);
41    } else {
42        println!("{:#?}", resp.unwrap_err());
43    }
44}
examples/v1_dashboards_CreateDashboard_3250131584.rs (line 34)
14async fn main() {
15    let body = Dashboard::new(
16        DashboardLayoutType::FREE,
17        "Example-Dashboard".to_string(),
18        vec![
19            Widget::new(WidgetDefinition::EventTimelineWidgetDefinition(Box::new(
20                EventTimelineWidgetDefinition::new(
21                    "status:error priority:all".to_string(),
22                    EventTimelineWidgetDefinitionType::EVENT_TIMELINE,
23                )
24                .tags_execution("and".to_string())
25                .title("".to_string())
26                .title_align(WidgetTextAlign::LEFT)
27                .title_size("16".to_string()),
28            )))
29            .layout(WidgetLayout::new(9, 47, 0, 0)),
30        ],
31    )
32    .description(None)
33    .notify_list(Some(vec![]))
34    .template_variables(Some(vec![]));
35    let configuration = datadog::Configuration::new();
36    let api = DashboardsAPI::with_config(configuration);
37    let resp = api.create_dashboard(body).await;
38    if let Ok(value) = resp {
39        println!("{:#?}", value);
40    } else {
41        println!("{:#?}", resp.unwrap_err());
42    }
43}
Source

pub fn url(self, value: String) -> Self

Source

pub fn additional_properties(self, value: BTreeMap<String, Value>) -> Self

Trait Implementations§

Source§

impl Clone for Dashboard

Source§

fn clone(&self) -> Dashboard

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Dashboard

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Dashboard

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Dashboard

Source§

fn eq(&self, other: &Dashboard) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Dashboard

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Dashboard

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,