WidgetAxis

Struct WidgetAxis 

Source
#[non_exhaustive]
pub struct WidgetAxis { pub include_zero: Option<bool>, pub label: Option<String>, pub max: Option<String>, pub min: Option<String>, pub scale: Option<String>, pub additional_properties: BTreeMap<String, Value>, /* private fields */ }
Expand description

Axis controls for the widget.

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.
§include_zero: Option<bool>

Set to true to include zero.

§label: Option<String>

The label of the axis to display on the graph. Only usable on Scatterplot Widgets.

§max: Option<String>

Specifies maximum numeric value to show on the axis. Defaults to auto.

§min: Option<String>

Specifies minimum numeric value to show on the axis. Defaults to auto.

§scale: Option<String>

Specifies the scale type. Possible values are linear, log, sqrt, and pow## (for example pow2 or pow0.5).

§additional_properties: BTreeMap<String, Value>

Implementations§

Source§

impl WidgetAxis

Source

pub fn new() -> WidgetAxis

Examples found in repository?
examples/v1_notebooks_CreateNotebook.rs (line 68)
31async fn main() {
32    let body = NotebookCreateRequest::new(NotebookCreateData::new(
33        NotebookCreateDataAttributes::new(
34            vec![
35                NotebookCellCreateRequest::new(
36                    NotebookCellCreateRequestAttributes::NotebookMarkdownCellAttributes(Box::new(
37                        NotebookMarkdownCellAttributes::new(NotebookMarkdownCellDefinition::new(
38                            r#"## Some test markdown
39
40```js
41var x, y;
42x = 5;
43y = 6;
44```"#
45                                .to_string(),
46                            NotebookMarkdownCellDefinitionType::MARKDOWN,
47                        )),
48                    )),
49                    NotebookCellResourceType::NOTEBOOK_CELLS,
50                ),
51                NotebookCellCreateRequest::new(
52                    NotebookCellCreateRequestAttributes::NotebookTimeseriesCellAttributes(
53                        Box::new(
54                            NotebookTimeseriesCellAttributes::new(
55                                TimeseriesWidgetDefinition::new(
56                                    vec![TimeseriesWidgetRequest::new()
57                                        .display_type(WidgetDisplayType::LINE)
58                                        .q("avg:system.load.1{*}".to_string())
59                                        .style(
60                                            WidgetRequestStyle::new()
61                                                .line_type(WidgetLineType::SOLID)
62                                                .line_width(WidgetLineWidth::NORMAL)
63                                                .palette("dog_classic".to_string()),
64                                        )],
65                                    TimeseriesWidgetDefinitionType::TIMESERIES,
66                                )
67                                .show_legend(true)
68                                .yaxis(WidgetAxis::new().scale("linear".to_string())),
69                            )
70                            .graph_size(NotebookGraphSize::MEDIUM)
71                            .split_by(NotebookSplitBy::new(vec![], vec![]))
72                            .time(None),
73                        ),
74                    ),
75                    NotebookCellResourceType::NOTEBOOK_CELLS,
76                ),
77            ],
78            "Example-Notebook".to_string(),
79            NotebookGlobalTime::NotebookRelativeTime(Box::new(NotebookRelativeTime::new(
80                WidgetLiveSpan::PAST_ONE_HOUR,
81            ))),
82        )
83        .status(NotebookStatus::PUBLISHED),
84        NotebookResourceType::NOTEBOOKS,
85    ));
86    let configuration = datadog::Configuration::new();
87    let api = NotebooksAPI::with_config(configuration);
88    let resp = api.create_notebook(body).await;
89    if let Ok(value) = resp {
90        println!("{:#?}", value);
91    } else {
92        println!("{:#?}", resp.unwrap_err());
93    }
94}
More examples
Hide additional examples
examples/v1_dashboards_CreateDashboard_765140092.rs (line 63)
26async fn main() {
27    let body =
28        Dashboard::new(
29            DashboardLayoutType::ORDERED,
30            "Example-Dashboard with QVW Timeseries Background".to_string(),
31            vec![
32                Widget::new(
33                    WidgetDefinition::QueryValueWidgetDefinition(
34                        Box::new(
35                            QueryValueWidgetDefinition::new(
36                                vec![
37                                    QueryValueWidgetRequest::new()
38                                        .formulas(vec![WidgetFormula::new("query1".to_string())])
39                                        .queries(
40                                            vec![
41                                                FormulaAndFunctionQueryDefinition
42                                                ::FormulaAndFunctionMetricQueryDefinition(
43                                                    Box::new(
44                                                        FormulaAndFunctionMetricQueryDefinition::new(
45                                                            FormulaAndFunctionMetricDataSource::METRICS,
46                                                            "query1".to_string(),
47                                                            "sum:my.cool.count.metric{*}".to_string(),
48                                                        ).aggregator(FormulaAndFunctionMetricAggregation::PERCENTILE),
49                                                    ),
50                                                )
51                                            ],
52                                        )
53                                        .response_format(FormulaAndFunctionResponseFormat::SCALAR)
54                                ],
55                                QueryValueWidgetDefinitionType::QUERY_VALUE,
56                            )
57                                .autoscale(true)
58                                .precision(2)
59                                .time(WidgetTime::WidgetLegacyLiveSpan(Box::new(WidgetLegacyLiveSpan::new())))
60                                .timeseries_background(
61                                    TimeseriesBackground::new(
62                                        TimeseriesBackgroundType::AREA,
63                                    ).yaxis(WidgetAxis::new().include_zero(true)),
64                                )
65                                .title("".to_string())
66                                .title_align(WidgetTextAlign::LEFT)
67                                .title_size("16".to_string()),
68                        ),
69                    ),
70                ).layout(WidgetLayout::new(2, 2, 0, 0))
71            ],
72        );
73    let configuration = datadog::Configuration::new();
74    let api = DashboardsAPI::with_config(configuration);
75    let resp = api.create_dashboard(body).await;
76    if let Ok(value) = resp {
77        println!("{:#?}", value);
78    } else {
79        println!("{:#?}", resp.unwrap_err());
80    }
81}
examples/v1_notebooks_UpdateNotebook.rs (line 76)
32async fn main() {
33    // there is a valid "notebook" in the system
34    let notebook_data_id: i64 = std::env::var("NOTEBOOK_DATA_ID").unwrap().parse().unwrap();
35    let body = NotebookUpdateRequest::new(NotebookUpdateData::new(
36        NotebookUpdateDataAttributes::new(
37            vec![
38                NotebookUpdateCell::NotebookCellCreateRequest(Box::new(
39                    NotebookCellCreateRequest::new(
40                        NotebookCellCreateRequestAttributes::NotebookMarkdownCellAttributes(
41                            Box::new(NotebookMarkdownCellAttributes::new(
42                                NotebookMarkdownCellDefinition::new(
43                                    r#"## Some test markdown
44
45```js
46var x, y;
47x = 5;
48y = 6;
49```"#
50                                        .to_string(),
51                                    NotebookMarkdownCellDefinitionType::MARKDOWN,
52                                ),
53                            )),
54                        ),
55                        NotebookCellResourceType::NOTEBOOK_CELLS,
56                    ),
57                )),
58                NotebookUpdateCell::NotebookCellCreateRequest(Box::new(
59                    NotebookCellCreateRequest::new(
60                        NotebookCellCreateRequestAttributes::NotebookTimeseriesCellAttributes(
61                            Box::new(
62                                NotebookTimeseriesCellAttributes::new(
63                                    TimeseriesWidgetDefinition::new(
64                                        vec![TimeseriesWidgetRequest::new()
65                                            .display_type(WidgetDisplayType::LINE)
66                                            .q("avg:system.load.1{*}".to_string())
67                                            .style(
68                                                WidgetRequestStyle::new()
69                                                    .line_type(WidgetLineType::SOLID)
70                                                    .line_width(WidgetLineWidth::NORMAL)
71                                                    .palette("dog_classic".to_string()),
72                                            )],
73                                        TimeseriesWidgetDefinitionType::TIMESERIES,
74                                    )
75                                    .show_legend(true)
76                                    .yaxis(WidgetAxis::new().scale("linear".to_string())),
77                                )
78                                .graph_size(NotebookGraphSize::MEDIUM)
79                                .split_by(NotebookSplitBy::new(vec![], vec![]))
80                                .time(None),
81                            ),
82                        ),
83                        NotebookCellResourceType::NOTEBOOK_CELLS,
84                    ),
85                )),
86            ],
87            "Example-Notebook-updated".to_string(),
88            NotebookGlobalTime::NotebookRelativeTime(Box::new(NotebookRelativeTime::new(
89                WidgetLiveSpan::PAST_ONE_HOUR,
90            ))),
91        )
92        .status(NotebookStatus::PUBLISHED),
93        NotebookResourceType::NOTEBOOKS,
94    ));
95    let configuration = datadog::Configuration::new();
96    let api = NotebooksAPI::with_config(configuration);
97    let resp = api.update_notebook(notebook_data_id.clone(), body).await;
98    if let Ok(value) = resp {
99        println!("{:#?}", value);
100    } else {
101        println!("{:#?}", resp.unwrap_err());
102    }
103}
examples/v1_dashboards_CreateDashboard_2342457693.rs (line 85)
26async fn main() {
27    let body =
28        Dashboard::new(
29            DashboardLayoutType::FREE,
30            "Example-Dashboard".to_string(),
31            vec![
32                Widget::new(
33                    WidgetDefinition::ScatterPlotWidgetDefinition(
34                        Box::new(
35                            ScatterPlotWidgetDefinition::new(
36                                ScatterPlotWidgetDefinitionRequests
37                                ::new().table(
38                                    ScatterplotTableRequest::new()
39                                        .formulas(
40                                            vec![
41                                                ScatterplotWidgetFormula::new(
42                                                    ScatterplotDimension::X,
43                                                    "query1".to_string(),
44                                                ).alias("".to_string()),
45                                                ScatterplotWidgetFormula::new(
46                                                    ScatterplotDimension::Y,
47                                                    "query2".to_string(),
48                                                ).alias("".to_string())
49                                            ],
50                                        )
51                                        .queries(
52                                            vec![
53                                                FormulaAndFunctionQueryDefinition
54                                                ::FormulaAndFunctionMetricQueryDefinition(
55                                                    Box::new(
56                                                        FormulaAndFunctionMetricQueryDefinition::new(
57                                                            FormulaAndFunctionMetricDataSource::METRICS,
58                                                            "query1".to_string(),
59                                                            "avg:system.cpu.user{*} by {service}".to_string(),
60                                                        ).aggregator(FormulaAndFunctionMetricAggregation::AVG),
61                                                    ),
62                                                ),
63                                                FormulaAndFunctionQueryDefinition
64                                                ::FormulaAndFunctionMetricQueryDefinition(
65                                                    Box::new(
66                                                        FormulaAndFunctionMetricQueryDefinition::new(
67                                                            FormulaAndFunctionMetricDataSource::METRICS,
68                                                            "query2".to_string(),
69                                                            "avg:system.mem.used{*} by {service}".to_string(),
70                                                        ).aggregator(FormulaAndFunctionMetricAggregation::AVG),
71                                                    ),
72                                                )
73                                            ],
74                                        )
75                                        .response_format(FormulaAndFunctionResponseFormat::SCALAR),
76                                ),
77                                ScatterPlotWidgetDefinitionType::SCATTERPLOT,
78                            )
79                                .color_by_groups(vec![])
80                                .time(WidgetTime::WidgetLegacyLiveSpan(Box::new(WidgetLegacyLiveSpan::new())))
81                                .title("".to_string())
82                                .title_align(WidgetTextAlign::LEFT)
83                                .title_size("16".to_string())
84                                .xaxis(
85                                    WidgetAxis::new()
86                                        .include_zero(true)
87                                        .max("auto".to_string())
88                                        .min("auto".to_string())
89                                        .scale("linear".to_string()),
90                                )
91                                .yaxis(
92                                    WidgetAxis::new()
93                                        .include_zero(true)
94                                        .max("auto".to_string())
95                                        .min("auto".to_string())
96                                        .scale("linear".to_string()),
97                                ),
98                        ),
99                    ),
100                ).layout(WidgetLayout::new(15, 47, 0, 0))
101            ],
102        )
103            .description(Some("".to_string()))
104            .notify_list(Some(vec![]))
105            .template_variables(Some(vec![]));
106    let configuration = datadog::Configuration::new();
107    let api = DashboardsAPI::with_config(configuration);
108    let resp = api.create_dashboard(body).await;
109    if let Ok(value) = resp {
110        println!("{:#?}", value);
111    } else {
112        println!("{:#?}", resp.unwrap_err());
113    }
114}
Source

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

Examples found in repository?
examples/v1_dashboards_CreateDashboard_765140092.rs (line 63)
26async fn main() {
27    let body =
28        Dashboard::new(
29            DashboardLayoutType::ORDERED,
30            "Example-Dashboard with QVW Timeseries Background".to_string(),
31            vec![
32                Widget::new(
33                    WidgetDefinition::QueryValueWidgetDefinition(
34                        Box::new(
35                            QueryValueWidgetDefinition::new(
36                                vec![
37                                    QueryValueWidgetRequest::new()
38                                        .formulas(vec![WidgetFormula::new("query1".to_string())])
39                                        .queries(
40                                            vec![
41                                                FormulaAndFunctionQueryDefinition
42                                                ::FormulaAndFunctionMetricQueryDefinition(
43                                                    Box::new(
44                                                        FormulaAndFunctionMetricQueryDefinition::new(
45                                                            FormulaAndFunctionMetricDataSource::METRICS,
46                                                            "query1".to_string(),
47                                                            "sum:my.cool.count.metric{*}".to_string(),
48                                                        ).aggregator(FormulaAndFunctionMetricAggregation::PERCENTILE),
49                                                    ),
50                                                )
51                                            ],
52                                        )
53                                        .response_format(FormulaAndFunctionResponseFormat::SCALAR)
54                                ],
55                                QueryValueWidgetDefinitionType::QUERY_VALUE,
56                            )
57                                .autoscale(true)
58                                .precision(2)
59                                .time(WidgetTime::WidgetLegacyLiveSpan(Box::new(WidgetLegacyLiveSpan::new())))
60                                .timeseries_background(
61                                    TimeseriesBackground::new(
62                                        TimeseriesBackgroundType::AREA,
63                                    ).yaxis(WidgetAxis::new().include_zero(true)),
64                                )
65                                .title("".to_string())
66                                .title_align(WidgetTextAlign::LEFT)
67                                .title_size("16".to_string()),
68                        ),
69                    ),
70                ).layout(WidgetLayout::new(2, 2, 0, 0))
71            ],
72        );
73    let configuration = datadog::Configuration::new();
74    let api = DashboardsAPI::with_config(configuration);
75    let resp = api.create_dashboard(body).await;
76    if let Ok(value) = resp {
77        println!("{:#?}", value);
78    } else {
79        println!("{:#?}", resp.unwrap_err());
80    }
81}
More examples
Hide additional examples
examples/v1_dashboards_CreateDashboard_2342457693.rs (line 86)
26async fn main() {
27    let body =
28        Dashboard::new(
29            DashboardLayoutType::FREE,
30            "Example-Dashboard".to_string(),
31            vec![
32                Widget::new(
33                    WidgetDefinition::ScatterPlotWidgetDefinition(
34                        Box::new(
35                            ScatterPlotWidgetDefinition::new(
36                                ScatterPlotWidgetDefinitionRequests
37                                ::new().table(
38                                    ScatterplotTableRequest::new()
39                                        .formulas(
40                                            vec![
41                                                ScatterplotWidgetFormula::new(
42                                                    ScatterplotDimension::X,
43                                                    "query1".to_string(),
44                                                ).alias("".to_string()),
45                                                ScatterplotWidgetFormula::new(
46                                                    ScatterplotDimension::Y,
47                                                    "query2".to_string(),
48                                                ).alias("".to_string())
49                                            ],
50                                        )
51                                        .queries(
52                                            vec![
53                                                FormulaAndFunctionQueryDefinition
54                                                ::FormulaAndFunctionMetricQueryDefinition(
55                                                    Box::new(
56                                                        FormulaAndFunctionMetricQueryDefinition::new(
57                                                            FormulaAndFunctionMetricDataSource::METRICS,
58                                                            "query1".to_string(),
59                                                            "avg:system.cpu.user{*} by {service}".to_string(),
60                                                        ).aggregator(FormulaAndFunctionMetricAggregation::AVG),
61                                                    ),
62                                                ),
63                                                FormulaAndFunctionQueryDefinition
64                                                ::FormulaAndFunctionMetricQueryDefinition(
65                                                    Box::new(
66                                                        FormulaAndFunctionMetricQueryDefinition::new(
67                                                            FormulaAndFunctionMetricDataSource::METRICS,
68                                                            "query2".to_string(),
69                                                            "avg:system.mem.used{*} by {service}".to_string(),
70                                                        ).aggregator(FormulaAndFunctionMetricAggregation::AVG),
71                                                    ),
72                                                )
73                                            ],
74                                        )
75                                        .response_format(FormulaAndFunctionResponseFormat::SCALAR),
76                                ),
77                                ScatterPlotWidgetDefinitionType::SCATTERPLOT,
78                            )
79                                .color_by_groups(vec![])
80                                .time(WidgetTime::WidgetLegacyLiveSpan(Box::new(WidgetLegacyLiveSpan::new())))
81                                .title("".to_string())
82                                .title_align(WidgetTextAlign::LEFT)
83                                .title_size("16".to_string())
84                                .xaxis(
85                                    WidgetAxis::new()
86                                        .include_zero(true)
87                                        .max("auto".to_string())
88                                        .min("auto".to_string())
89                                        .scale("linear".to_string()),
90                                )
91                                .yaxis(
92                                    WidgetAxis::new()
93                                        .include_zero(true)
94                                        .max("auto".to_string())
95                                        .min("auto".to_string())
96                                        .scale("linear".to_string()),
97                                ),
98                        ),
99                    ),
100                ).layout(WidgetLayout::new(15, 47, 0, 0))
101            ],
102        )
103            .description(Some("".to_string()))
104            .notify_list(Some(vec![]))
105            .template_variables(Some(vec![]));
106    let configuration = datadog::Configuration::new();
107    let api = DashboardsAPI::with_config(configuration);
108    let resp = api.create_dashboard(body).await;
109    if let Ok(value) = resp {
110        println!("{:#?}", value);
111    } else {
112        println!("{:#?}", resp.unwrap_err());
113    }
114}
Source

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

Source

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

Examples found in repository?
examples/v1_dashboards_CreateDashboard_2342457693.rs (line 87)
26async fn main() {
27    let body =
28        Dashboard::new(
29            DashboardLayoutType::FREE,
30            "Example-Dashboard".to_string(),
31            vec![
32                Widget::new(
33                    WidgetDefinition::ScatterPlotWidgetDefinition(
34                        Box::new(
35                            ScatterPlotWidgetDefinition::new(
36                                ScatterPlotWidgetDefinitionRequests
37                                ::new().table(
38                                    ScatterplotTableRequest::new()
39                                        .formulas(
40                                            vec![
41                                                ScatterplotWidgetFormula::new(
42                                                    ScatterplotDimension::X,
43                                                    "query1".to_string(),
44                                                ).alias("".to_string()),
45                                                ScatterplotWidgetFormula::new(
46                                                    ScatterplotDimension::Y,
47                                                    "query2".to_string(),
48                                                ).alias("".to_string())
49                                            ],
50                                        )
51                                        .queries(
52                                            vec![
53                                                FormulaAndFunctionQueryDefinition
54                                                ::FormulaAndFunctionMetricQueryDefinition(
55                                                    Box::new(
56                                                        FormulaAndFunctionMetricQueryDefinition::new(
57                                                            FormulaAndFunctionMetricDataSource::METRICS,
58                                                            "query1".to_string(),
59                                                            "avg:system.cpu.user{*} by {service}".to_string(),
60                                                        ).aggregator(FormulaAndFunctionMetricAggregation::AVG),
61                                                    ),
62                                                ),
63                                                FormulaAndFunctionQueryDefinition
64                                                ::FormulaAndFunctionMetricQueryDefinition(
65                                                    Box::new(
66                                                        FormulaAndFunctionMetricQueryDefinition::new(
67                                                            FormulaAndFunctionMetricDataSource::METRICS,
68                                                            "query2".to_string(),
69                                                            "avg:system.mem.used{*} by {service}".to_string(),
70                                                        ).aggregator(FormulaAndFunctionMetricAggregation::AVG),
71                                                    ),
72                                                )
73                                            ],
74                                        )
75                                        .response_format(FormulaAndFunctionResponseFormat::SCALAR),
76                                ),
77                                ScatterPlotWidgetDefinitionType::SCATTERPLOT,
78                            )
79                                .color_by_groups(vec![])
80                                .time(WidgetTime::WidgetLegacyLiveSpan(Box::new(WidgetLegacyLiveSpan::new())))
81                                .title("".to_string())
82                                .title_align(WidgetTextAlign::LEFT)
83                                .title_size("16".to_string())
84                                .xaxis(
85                                    WidgetAxis::new()
86                                        .include_zero(true)
87                                        .max("auto".to_string())
88                                        .min("auto".to_string())
89                                        .scale("linear".to_string()),
90                                )
91                                .yaxis(
92                                    WidgetAxis::new()
93                                        .include_zero(true)
94                                        .max("auto".to_string())
95                                        .min("auto".to_string())
96                                        .scale("linear".to_string()),
97                                ),
98                        ),
99                    ),
100                ).layout(WidgetLayout::new(15, 47, 0, 0))
101            ],
102        )
103            .description(Some("".to_string()))
104            .notify_list(Some(vec![]))
105            .template_variables(Some(vec![]));
106    let configuration = datadog::Configuration::new();
107    let api = DashboardsAPI::with_config(configuration);
108    let resp = api.create_dashboard(body).await;
109    if let Ok(value) = resp {
110        println!("{:#?}", value);
111    } else {
112        println!("{:#?}", resp.unwrap_err());
113    }
114}
Source

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

Examples found in repository?
examples/v1_dashboards_CreateDashboard_2342457693.rs (line 88)
26async fn main() {
27    let body =
28        Dashboard::new(
29            DashboardLayoutType::FREE,
30            "Example-Dashboard".to_string(),
31            vec![
32                Widget::new(
33                    WidgetDefinition::ScatterPlotWidgetDefinition(
34                        Box::new(
35                            ScatterPlotWidgetDefinition::new(
36                                ScatterPlotWidgetDefinitionRequests
37                                ::new().table(
38                                    ScatterplotTableRequest::new()
39                                        .formulas(
40                                            vec![
41                                                ScatterplotWidgetFormula::new(
42                                                    ScatterplotDimension::X,
43                                                    "query1".to_string(),
44                                                ).alias("".to_string()),
45                                                ScatterplotWidgetFormula::new(
46                                                    ScatterplotDimension::Y,
47                                                    "query2".to_string(),
48                                                ).alias("".to_string())
49                                            ],
50                                        )
51                                        .queries(
52                                            vec![
53                                                FormulaAndFunctionQueryDefinition
54                                                ::FormulaAndFunctionMetricQueryDefinition(
55                                                    Box::new(
56                                                        FormulaAndFunctionMetricQueryDefinition::new(
57                                                            FormulaAndFunctionMetricDataSource::METRICS,
58                                                            "query1".to_string(),
59                                                            "avg:system.cpu.user{*} by {service}".to_string(),
60                                                        ).aggregator(FormulaAndFunctionMetricAggregation::AVG),
61                                                    ),
62                                                ),
63                                                FormulaAndFunctionQueryDefinition
64                                                ::FormulaAndFunctionMetricQueryDefinition(
65                                                    Box::new(
66                                                        FormulaAndFunctionMetricQueryDefinition::new(
67                                                            FormulaAndFunctionMetricDataSource::METRICS,
68                                                            "query2".to_string(),
69                                                            "avg:system.mem.used{*} by {service}".to_string(),
70                                                        ).aggregator(FormulaAndFunctionMetricAggregation::AVG),
71                                                    ),
72                                                )
73                                            ],
74                                        )
75                                        .response_format(FormulaAndFunctionResponseFormat::SCALAR),
76                                ),
77                                ScatterPlotWidgetDefinitionType::SCATTERPLOT,
78                            )
79                                .color_by_groups(vec![])
80                                .time(WidgetTime::WidgetLegacyLiveSpan(Box::new(WidgetLegacyLiveSpan::new())))
81                                .title("".to_string())
82                                .title_align(WidgetTextAlign::LEFT)
83                                .title_size("16".to_string())
84                                .xaxis(
85                                    WidgetAxis::new()
86                                        .include_zero(true)
87                                        .max("auto".to_string())
88                                        .min("auto".to_string())
89                                        .scale("linear".to_string()),
90                                )
91                                .yaxis(
92                                    WidgetAxis::new()
93                                        .include_zero(true)
94                                        .max("auto".to_string())
95                                        .min("auto".to_string())
96                                        .scale("linear".to_string()),
97                                ),
98                        ),
99                    ),
100                ).layout(WidgetLayout::new(15, 47, 0, 0))
101            ],
102        )
103            .description(Some("".to_string()))
104            .notify_list(Some(vec![]))
105            .template_variables(Some(vec![]));
106    let configuration = datadog::Configuration::new();
107    let api = DashboardsAPI::with_config(configuration);
108    let resp = api.create_dashboard(body).await;
109    if let Ok(value) = resp {
110        println!("{:#?}", value);
111    } else {
112        println!("{:#?}", resp.unwrap_err());
113    }
114}
Source

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

Examples found in repository?
examples/v1_notebooks_CreateNotebook.rs (line 68)
31async fn main() {
32    let body = NotebookCreateRequest::new(NotebookCreateData::new(
33        NotebookCreateDataAttributes::new(
34            vec![
35                NotebookCellCreateRequest::new(
36                    NotebookCellCreateRequestAttributes::NotebookMarkdownCellAttributes(Box::new(
37                        NotebookMarkdownCellAttributes::new(NotebookMarkdownCellDefinition::new(
38                            r#"## Some test markdown
39
40```js
41var x, y;
42x = 5;
43y = 6;
44```"#
45                                .to_string(),
46                            NotebookMarkdownCellDefinitionType::MARKDOWN,
47                        )),
48                    )),
49                    NotebookCellResourceType::NOTEBOOK_CELLS,
50                ),
51                NotebookCellCreateRequest::new(
52                    NotebookCellCreateRequestAttributes::NotebookTimeseriesCellAttributes(
53                        Box::new(
54                            NotebookTimeseriesCellAttributes::new(
55                                TimeseriesWidgetDefinition::new(
56                                    vec![TimeseriesWidgetRequest::new()
57                                        .display_type(WidgetDisplayType::LINE)
58                                        .q("avg:system.load.1{*}".to_string())
59                                        .style(
60                                            WidgetRequestStyle::new()
61                                                .line_type(WidgetLineType::SOLID)
62                                                .line_width(WidgetLineWidth::NORMAL)
63                                                .palette("dog_classic".to_string()),
64                                        )],
65                                    TimeseriesWidgetDefinitionType::TIMESERIES,
66                                )
67                                .show_legend(true)
68                                .yaxis(WidgetAxis::new().scale("linear".to_string())),
69                            )
70                            .graph_size(NotebookGraphSize::MEDIUM)
71                            .split_by(NotebookSplitBy::new(vec![], vec![]))
72                            .time(None),
73                        ),
74                    ),
75                    NotebookCellResourceType::NOTEBOOK_CELLS,
76                ),
77            ],
78            "Example-Notebook".to_string(),
79            NotebookGlobalTime::NotebookRelativeTime(Box::new(NotebookRelativeTime::new(
80                WidgetLiveSpan::PAST_ONE_HOUR,
81            ))),
82        )
83        .status(NotebookStatus::PUBLISHED),
84        NotebookResourceType::NOTEBOOKS,
85    ));
86    let configuration = datadog::Configuration::new();
87    let api = NotebooksAPI::with_config(configuration);
88    let resp = api.create_notebook(body).await;
89    if let Ok(value) = resp {
90        println!("{:#?}", value);
91    } else {
92        println!("{:#?}", resp.unwrap_err());
93    }
94}
More examples
Hide additional examples
examples/v1_notebooks_UpdateNotebook.rs (line 76)
32async fn main() {
33    // there is a valid "notebook" in the system
34    let notebook_data_id: i64 = std::env::var("NOTEBOOK_DATA_ID").unwrap().parse().unwrap();
35    let body = NotebookUpdateRequest::new(NotebookUpdateData::new(
36        NotebookUpdateDataAttributes::new(
37            vec![
38                NotebookUpdateCell::NotebookCellCreateRequest(Box::new(
39                    NotebookCellCreateRequest::new(
40                        NotebookCellCreateRequestAttributes::NotebookMarkdownCellAttributes(
41                            Box::new(NotebookMarkdownCellAttributes::new(
42                                NotebookMarkdownCellDefinition::new(
43                                    r#"## Some test markdown
44
45```js
46var x, y;
47x = 5;
48y = 6;
49```"#
50                                        .to_string(),
51                                    NotebookMarkdownCellDefinitionType::MARKDOWN,
52                                ),
53                            )),
54                        ),
55                        NotebookCellResourceType::NOTEBOOK_CELLS,
56                    ),
57                )),
58                NotebookUpdateCell::NotebookCellCreateRequest(Box::new(
59                    NotebookCellCreateRequest::new(
60                        NotebookCellCreateRequestAttributes::NotebookTimeseriesCellAttributes(
61                            Box::new(
62                                NotebookTimeseriesCellAttributes::new(
63                                    TimeseriesWidgetDefinition::new(
64                                        vec![TimeseriesWidgetRequest::new()
65                                            .display_type(WidgetDisplayType::LINE)
66                                            .q("avg:system.load.1{*}".to_string())
67                                            .style(
68                                                WidgetRequestStyle::new()
69                                                    .line_type(WidgetLineType::SOLID)
70                                                    .line_width(WidgetLineWidth::NORMAL)
71                                                    .palette("dog_classic".to_string()),
72                                            )],
73                                        TimeseriesWidgetDefinitionType::TIMESERIES,
74                                    )
75                                    .show_legend(true)
76                                    .yaxis(WidgetAxis::new().scale("linear".to_string())),
77                                )
78                                .graph_size(NotebookGraphSize::MEDIUM)
79                                .split_by(NotebookSplitBy::new(vec![], vec![]))
80                                .time(None),
81                            ),
82                        ),
83                        NotebookCellResourceType::NOTEBOOK_CELLS,
84                    ),
85                )),
86            ],
87            "Example-Notebook-updated".to_string(),
88            NotebookGlobalTime::NotebookRelativeTime(Box::new(NotebookRelativeTime::new(
89                WidgetLiveSpan::PAST_ONE_HOUR,
90            ))),
91        )
92        .status(NotebookStatus::PUBLISHED),
93        NotebookResourceType::NOTEBOOKS,
94    ));
95    let configuration = datadog::Configuration::new();
96    let api = NotebooksAPI::with_config(configuration);
97    let resp = api.update_notebook(notebook_data_id.clone(), body).await;
98    if let Ok(value) = resp {
99        println!("{:#?}", value);
100    } else {
101        println!("{:#?}", resp.unwrap_err());
102    }
103}
examples/v1_dashboards_CreateDashboard_2342457693.rs (line 89)
26async fn main() {
27    let body =
28        Dashboard::new(
29            DashboardLayoutType::FREE,
30            "Example-Dashboard".to_string(),
31            vec![
32                Widget::new(
33                    WidgetDefinition::ScatterPlotWidgetDefinition(
34                        Box::new(
35                            ScatterPlotWidgetDefinition::new(
36                                ScatterPlotWidgetDefinitionRequests
37                                ::new().table(
38                                    ScatterplotTableRequest::new()
39                                        .formulas(
40                                            vec![
41                                                ScatterplotWidgetFormula::new(
42                                                    ScatterplotDimension::X,
43                                                    "query1".to_string(),
44                                                ).alias("".to_string()),
45                                                ScatterplotWidgetFormula::new(
46                                                    ScatterplotDimension::Y,
47                                                    "query2".to_string(),
48                                                ).alias("".to_string())
49                                            ],
50                                        )
51                                        .queries(
52                                            vec![
53                                                FormulaAndFunctionQueryDefinition
54                                                ::FormulaAndFunctionMetricQueryDefinition(
55                                                    Box::new(
56                                                        FormulaAndFunctionMetricQueryDefinition::new(
57                                                            FormulaAndFunctionMetricDataSource::METRICS,
58                                                            "query1".to_string(),
59                                                            "avg:system.cpu.user{*} by {service}".to_string(),
60                                                        ).aggregator(FormulaAndFunctionMetricAggregation::AVG),
61                                                    ),
62                                                ),
63                                                FormulaAndFunctionQueryDefinition
64                                                ::FormulaAndFunctionMetricQueryDefinition(
65                                                    Box::new(
66                                                        FormulaAndFunctionMetricQueryDefinition::new(
67                                                            FormulaAndFunctionMetricDataSource::METRICS,
68                                                            "query2".to_string(),
69                                                            "avg:system.mem.used{*} by {service}".to_string(),
70                                                        ).aggregator(FormulaAndFunctionMetricAggregation::AVG),
71                                                    ),
72                                                )
73                                            ],
74                                        )
75                                        .response_format(FormulaAndFunctionResponseFormat::SCALAR),
76                                ),
77                                ScatterPlotWidgetDefinitionType::SCATTERPLOT,
78                            )
79                                .color_by_groups(vec![])
80                                .time(WidgetTime::WidgetLegacyLiveSpan(Box::new(WidgetLegacyLiveSpan::new())))
81                                .title("".to_string())
82                                .title_align(WidgetTextAlign::LEFT)
83                                .title_size("16".to_string())
84                                .xaxis(
85                                    WidgetAxis::new()
86                                        .include_zero(true)
87                                        .max("auto".to_string())
88                                        .min("auto".to_string())
89                                        .scale("linear".to_string()),
90                                )
91                                .yaxis(
92                                    WidgetAxis::new()
93                                        .include_zero(true)
94                                        .max("auto".to_string())
95                                        .min("auto".to_string())
96                                        .scale("linear".to_string()),
97                                ),
98                        ),
99                    ),
100                ).layout(WidgetLayout::new(15, 47, 0, 0))
101            ],
102        )
103            .description(Some("".to_string()))
104            .notify_list(Some(vec![]))
105            .template_variables(Some(vec![]));
106    let configuration = datadog::Configuration::new();
107    let api = DashboardsAPI::with_config(configuration);
108    let resp = api.create_dashboard(body).await;
109    if let Ok(value) = resp {
110        println!("{:#?}", value);
111    } else {
112        println!("{:#?}", resp.unwrap_err());
113    }
114}
Source

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

Trait Implementations§

Source§

impl Clone for WidgetAxis

Source§

fn clone(&self) -> WidgetAxis

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 WidgetAxis

Source§

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

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

impl Default for WidgetAxis

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for WidgetAxis

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 WidgetAxis

Source§

fn eq(&self, other: &WidgetAxis) -> 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 WidgetAxis

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 WidgetAxis

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,