#[non_exhaustive]pub struct WidgetFormula {
pub alias: Option<String>,
pub cell_display_mode: Option<TableWidgetCellDisplayMode>,
pub cell_display_mode_options: Option<WidgetFormulaCellDisplayModeOptions>,
pub conditional_formats: Option<Vec<WidgetConditionalFormat>>,
pub formula: String,
pub limit: Option<WidgetFormulaLimit>,
pub number_format: Option<WidgetNumberFormat>,
pub style: Option<WidgetFormulaStyle>,
pub additional_properties: BTreeMap<String, Value>,
/* private fields */
}
Expand description
Formula to be used in a widget query.
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.alias: Option<String>
Expression alias.
cell_display_mode: Option<TableWidgetCellDisplayMode>
Define a display mode for the table cell.
cell_display_mode_options: Option<WidgetFormulaCellDisplayModeOptions>
Cell display mode options for the widget formula. (only if cell_display_mode
is set to trend
).
conditional_formats: Option<Vec<WidgetConditionalFormat>>
List of conditional formats.
formula: String
String expression built from queries, formulas, and functions.
limit: Option<WidgetFormulaLimit>
Options for limiting results returned.
number_format: Option<WidgetNumberFormat>
Number format options for the widget.
style: Option<WidgetFormulaStyle>
Styling options for widget formulas.
additional_properties: BTreeMap<String, Value>
Implementations§
Source§impl WidgetFormula
impl WidgetFormula
Sourcepub fn new(formula: String) -> WidgetFormula
pub fn new(formula: String) -> WidgetFormula
Examples found in repository?
examples/v1_dashboards_CreateDashboard_3669695268.rs (line 34)
27async fn main() {
28 let body = Dashboard::new(
29 DashboardLayoutType::ORDERED,
30 "Example-Dashboard with query table widget and storage parameter".to_string(),
31 vec![Widget::new(WidgetDefinition::TableWidgetDefinition(
32 Box::new(TableWidgetDefinition::new(
33 vec![TableWidgetRequest::new()
34 .formulas(vec![WidgetFormula::new("query1".to_string())
35 .cell_display_mode(TableWidgetCellDisplayMode::BAR)
36 .conditional_formats(vec![])])
37 .queries(vec![
38 FormulaAndFunctionQueryDefinition::FormulaAndFunctionEventQueryDefinition(
39 Box::new(
40 FormulaAndFunctionEventQueryDefinition::new(
41 FormulaAndFunctionEventQueryDefinitionCompute::new(
42 FormulaAndFunctionEventAggregation::COUNT,
43 ),
44 FormulaAndFunctionEventsDataSource::LOGS,
45 "query1".to_string(),
46 )
47 .group_by(vec![])
48 .indexes(vec!["*".to_string()])
49 .search(FormulaAndFunctionEventQueryDefinitionSearch::new(
50 "".to_string(),
51 ))
52 .storage("online_archives".to_string()),
53 ),
54 ),
55 ])
56 .response_format(FormulaAndFunctionResponseFormat::SCALAR)
57 .sort(WidgetSortBy::new().count(50).order_by(vec![
58 WidgetSortOrderBy::WidgetFormulaSort(Box::new(WidgetFormulaSort::new(
59 0,
60 WidgetSort::DESCENDING,
61 FormulaType::FORMULA,
62 ))),
63 ]))],
64 TableWidgetDefinitionType::QUERY_TABLE,
65 )),
66 ))],
67 );
68 let configuration = datadog::Configuration::new();
69 let api = DashboardsAPI::with_config(configuration);
70 let resp = api.create_dashboard(body).await;
71 if let Ok(value) = resp {
72 println!("{:#?}", value);
73 } else {
74 println!("{:#?}", resp.unwrap_err());
75 }
76}
More examples
examples/v1_dashboards_CreateDashboard_2705593938.rs (line 34)
22async fn main() {
23 let body =
24 Dashboard::new(
25 DashboardLayoutType::ORDERED,
26 "Example-Dashboard".to_string(),
27 vec![
28 Widget::new(
29 WidgetDefinition::SunburstWidgetDefinition(
30 Box::new(
31 SunburstWidgetDefinition::new(
32 vec![
33 SunburstWidgetRequest::new()
34 .formulas(vec![WidgetFormula::new("query1".to_string())])
35 .queries(
36 vec![
37 FormulaAndFunctionQueryDefinition
38 ::FormulaAndFunctionMetricQueryDefinition(
39 Box::new(
40 FormulaAndFunctionMetricQueryDefinition::new(
41 FormulaAndFunctionMetricDataSource::METRICS,
42 "query1".to_string(),
43 "sum:system.mem.used{*} by {service}".to_string(),
44 ).aggregator(FormulaAndFunctionMetricAggregation::SUM),
45 ),
46 )
47 ],
48 )
49 .response_format(FormulaAndFunctionResponseFormat::SCALAR)
50 .style(WidgetStyle::new().palette("dog_classic".to_string()))
51 ],
52 SunburstWidgetDefinitionType::SUNBURST,
53 )
54 .title("".to_string())
55 .title_align(WidgetTextAlign::LEFT)
56 .title_size("16".to_string()),
57 ),
58 ),
59 ).layout(WidgetLayout::new(4, 4, 0, 0))
60 ],
61 );
62 let configuration = datadog::Configuration::new();
63 let api = DashboardsAPI::with_config(configuration);
64 let resp = api.create_dashboard(body).await;
65 if let Ok(value) = resp {
66 println!("{:#?}", value);
67 } else {
68 println!("{:#?}", resp.unwrap_err());
69 }
70}
examples/v1_dashboards_CreateDashboard_3562282606.rs (line 41)
29async fn main() {
30 // there is a valid "slo" in the system
31 let slo_data_0_id = std::env::var("SLO_DATA_0_ID").unwrap();
32 let body = Dashboard::new(
33 DashboardLayoutType::ORDERED,
34 "Example-Dashboard".to_string(),
35 vec![
36 Widget::new(WidgetDefinition::ChangeWidgetDefinition(Box::new(
37 ChangeWidgetDefinition::new(
38 vec![ChangeWidgetRequest::new()
39 .change_type(WidgetChangeType::ABSOLUTE)
40 .formulas(vec![
41 WidgetFormula::new("hour_before(query1)".to_string()),
42 WidgetFormula::new("query1".to_string()),
43 ])
44 .increase_good(true)
45 .order_by(WidgetOrderBy::CHANGE)
46 .order_dir(WidgetSort::ASCENDING)
47 .queries(vec![
48 FormulaAndFunctionQueryDefinition::FormulaAndFunctionSLOQueryDefinition(
49 Box::new(
50 FormulaAndFunctionSLOQueryDefinition::new(
51 FormulaAndFunctionSLODataSource::SLO,
52 FormulaAndFunctionSLOMeasure::SLO_STATUS,
53 slo_data_0_id.clone(),
54 )
55 .additional_query_filters("*".to_string())
56 .group_mode(FormulaAndFunctionSLOGroupMode::OVERALL)
57 .name("query1".to_string())
58 .slo_query_type(FormulaAndFunctionSLOQueryType::METRIC),
59 ),
60 ),
61 ])
62 .response_format(FormulaAndFunctionResponseFormat::SCALAR)],
63 ChangeWidgetDefinitionType::CHANGE,
64 )
65 .time(WidgetTime::WidgetLegacyLiveSpan(Box::new(
66 WidgetLegacyLiveSpan::new(),
67 )))
68 .title("".to_string())
69 .title_align(WidgetTextAlign::LEFT)
70 .title_size("16".to_string()),
71 )))
72 .layout(WidgetLayout::new(2, 4, 0, 0)),
73 ],
74 );
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_3777304439.rs (line 35)
23async fn main() {
24 let body =
25 Dashboard::new(
26 DashboardLayoutType::FREE,
27 "Example-Dashboard".to_string(),
28 vec![
29 Widget::new(
30 WidgetDefinition::HeatMapWidgetDefinition(
31 Box::new(
32 HeatMapWidgetDefinition::new(
33 vec![
34 HeatMapWidgetRequest::new()
35 .formulas(vec![WidgetFormula::new("query1".to_string())])
36 .queries(
37 vec![
38 FormulaAndFunctionQueryDefinition
39 ::FormulaAndFunctionMetricQueryDefinition(
40 Box::new(
41 FormulaAndFunctionMetricQueryDefinition::new(
42 FormulaAndFunctionMetricDataSource::METRICS,
43 "query1".to_string(),
44 "avg:system.cpu.user{*}".to_string(),
45 ),
46 ),
47 )
48 ],
49 )
50 .response_format(FormulaAndFunctionResponseFormat::TIMESERIES)
51 .style(WidgetStyle::new().palette("dog_classic".to_string()))
52 ],
53 HeatMapWidgetDefinitionType::HEATMAP,
54 )
55 .time(WidgetTime::WidgetLegacyLiveSpan(Box::new(WidgetLegacyLiveSpan::new())))
56 .title("".to_string())
57 .title_align(WidgetTextAlign::LEFT)
58 .title_size("16".to_string()),
59 ),
60 ),
61 ).layout(WidgetLayout::new(15, 47, 0, 0))
62 ],
63 )
64 .notify_list(Some(vec![]))
65 .template_variables(Some(vec![]));
66 let configuration = datadog::Configuration::new();
67 let api = DashboardsAPI::with_config(configuration);
68 let resp = api.create_dashboard(body).await;
69 if let Ok(value) = resp {
70 println!("{:#?}", value);
71 } else {
72 println!("{:#?}", resp.unwrap_err());
73 }
74}
examples/v1_dashboards_CreateDashboard_2644712913.rs (line 35)
23async fn main() {
24 let body =
25 Dashboard::new(
26 DashboardLayoutType::ORDERED,
27 "Example-Dashboard with QVW Percentile Aggregator".to_string(),
28 vec![
29 Widget::new(
30 WidgetDefinition::QueryValueWidgetDefinition(
31 Box::new(
32 QueryValueWidgetDefinition::new(
33 vec![
34 QueryValueWidgetRequest::new()
35 .formulas(vec![WidgetFormula::new("query1".to_string())])
36 .queries(
37 vec![
38 FormulaAndFunctionQueryDefinition
39 ::FormulaAndFunctionMetricQueryDefinition(
40 Box::new(
41 FormulaAndFunctionMetricQueryDefinition::new(
42 FormulaAndFunctionMetricDataSource::METRICS,
43 "query1".to_string(),
44 "p90:dist.dd.dogweb.latency{*}".to_string(),
45 ).aggregator(FormulaAndFunctionMetricAggregation::PERCENTILE),
46 ),
47 )
48 ],
49 )
50 .response_format(FormulaAndFunctionResponseFormat::SCALAR)
51 ],
52 QueryValueWidgetDefinitionType::QUERY_VALUE,
53 )
54 .autoscale(true)
55 .precision(2)
56 .time(WidgetTime::WidgetLegacyLiveSpan(Box::new(WidgetLegacyLiveSpan::new())))
57 .title("".to_string())
58 .title_align(WidgetTextAlign::LEFT)
59 .title_size("16".to_string()),
60 ),
61 ),
62 ).layout(WidgetLayout::new(2, 2, 0, 0))
63 ],
64 );
65 let configuration = datadog::Configuration::new();
66 let api = DashboardsAPI::with_config(configuration);
67 let resp = api.create_dashboard(body).await;
68 if let Ok(value) = resp {
69 println!("{:#?}", value);
70 } else {
71 println!("{:#?}", resp.unwrap_err());
72 }
73}
examples/v1_dashboards_CreateDashboard_765140092.rs (line 38)
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}
Additional examples can be found in:
- examples/v1_dashboards_CreateDashboard_1433408735.rs
- examples/v1_dashboards_CreateDashboard_1284514532.rs
- examples/v1_dashboards_CreateDashboard_1024858348.rs
- examples/v1_dashboards_CreateDashboard_578885732.rs
- examples/v1_dashboards_CreateDashboard_2064651578.rs
- examples/v1_dashboards_CreateDashboard_41622531.rs
- examples/v1_dashboards_CreateDashboard_2336428357.rs
- examples/v1_dashboards_CreateDashboard_1307120899.rs
- examples/v1_dashboards_CreateDashboard_985012506.rs
- examples/v1_dashboards_CreateDashboard_2800096921.rs
- examples/v1_dashboards_CreateDashboard_1413226400.rs
- examples/v1_dashboards_CreateDashboard_4262729673.rs
- examples/v1_dashboards_CreateDashboard_1213075383.rs
- examples/v1_dashboards_CreateDashboard_2563642929.rs
- examples/v1_dashboards_CreateDashboard_3520534424.rs
- examples/v1_dashboards_CreateDashboard_3451918078.rs
- examples/v1_dashboards_CreateDashboard_3066042014.rs
- examples/v1_dashboards_CreateDashboard_1490099434.rs
- examples/v1_dashboards_CreateDashboard_915214113.rs
pub fn alias(self, value: String) -> Self
Sourcepub fn cell_display_mode(self, value: TableWidgetCellDisplayMode) -> Self
pub fn cell_display_mode(self, value: TableWidgetCellDisplayMode) -> Self
Examples found in repository?
examples/v1_dashboards_CreateDashboard_3669695268.rs (line 35)
27async fn main() {
28 let body = Dashboard::new(
29 DashboardLayoutType::ORDERED,
30 "Example-Dashboard with query table widget and storage parameter".to_string(),
31 vec![Widget::new(WidgetDefinition::TableWidgetDefinition(
32 Box::new(TableWidgetDefinition::new(
33 vec![TableWidgetRequest::new()
34 .formulas(vec![WidgetFormula::new("query1".to_string())
35 .cell_display_mode(TableWidgetCellDisplayMode::BAR)
36 .conditional_formats(vec![])])
37 .queries(vec![
38 FormulaAndFunctionQueryDefinition::FormulaAndFunctionEventQueryDefinition(
39 Box::new(
40 FormulaAndFunctionEventQueryDefinition::new(
41 FormulaAndFunctionEventQueryDefinitionCompute::new(
42 FormulaAndFunctionEventAggregation::COUNT,
43 ),
44 FormulaAndFunctionEventsDataSource::LOGS,
45 "query1".to_string(),
46 )
47 .group_by(vec![])
48 .indexes(vec!["*".to_string()])
49 .search(FormulaAndFunctionEventQueryDefinitionSearch::new(
50 "".to_string(),
51 ))
52 .storage("online_archives".to_string()),
53 ),
54 ),
55 ])
56 .response_format(FormulaAndFunctionResponseFormat::SCALAR)
57 .sort(WidgetSortBy::new().count(50).order_by(vec![
58 WidgetSortOrderBy::WidgetFormulaSort(Box::new(WidgetFormulaSort::new(
59 0,
60 WidgetSort::DESCENDING,
61 FormulaType::FORMULA,
62 ))),
63 ]))],
64 TableWidgetDefinitionType::QUERY_TABLE,
65 )),
66 ))],
67 );
68 let configuration = datadog::Configuration::new();
69 let api = DashboardsAPI::with_config(configuration);
70 let resp = api.create_dashboard(body).await;
71 if let Ok(value) = resp {
72 println!("{:#?}", value);
73 } else {
74 println!("{:#?}", resp.unwrap_err());
75 }
76}
More examples
examples/v1_dashboards_CreateDashboard_2336428357.rs (line 45)
30async fn main() {
31 let body =
32 Dashboard::new(
33 DashboardLayoutType::FREE,
34 "Example-Dashboard".to_string(),
35 vec![
36 Widget::new(
37 WidgetDefinition::TableWidgetDefinition(
38 Box::new(
39 TableWidgetDefinition::new(
40 vec![
41 TableWidgetRequest::new()
42 .formulas(
43 vec![
44 WidgetFormula::new("query1".to_string())
45 .cell_display_mode(TableWidgetCellDisplayMode::BAR)
46 .conditional_formats(vec![])
47 ],
48 )
49 .queries(
50 vec![
51 FormulaAndFunctionQueryDefinition
52 ::FormulaAndFunctionMetricQueryDefinition(
53 Box::new(
54 FormulaAndFunctionMetricQueryDefinition::new(
55 FormulaAndFunctionMetricDataSource::METRICS,
56 "query1".to_string(),
57 "avg:system.cpu.user{*} by {host}".to_string(),
58 ).aggregator(FormulaAndFunctionMetricAggregation::AVG),
59 ),
60 )
61 ],
62 )
63 .response_format(FormulaAndFunctionResponseFormat::SCALAR)
64 .sort(
65 WidgetSortBy::new()
66 .count(500)
67 .order_by(
68 vec![
69 WidgetSortOrderBy::WidgetFormulaSort(
70 Box::new(
71 WidgetFormulaSort::new(
72 0,
73 WidgetSort::DESCENDING,
74 FormulaType::FORMULA,
75 ),
76 ),
77 )
78 ],
79 ),
80 )
81 ],
82 TableWidgetDefinitionType::QUERY_TABLE,
83 )
84 .has_search_bar(TableWidgetHasSearchBar::AUTO)
85 .time(WidgetTime::WidgetLegacyLiveSpan(Box::new(WidgetLegacyLiveSpan::new())))
86 .title("".to_string())
87 .title_align(WidgetTextAlign::LEFT)
88 .title_size("16".to_string()),
89 ),
90 ),
91 ).layout(WidgetLayout::new(32, 54, 0, 0))
92 ],
93 )
94 .description(Some("".to_string()))
95 .notify_list(Some(vec![]))
96 .template_variables(Some(vec![]));
97 let configuration = datadog::Configuration::new();
98 let api = DashboardsAPI::with_config(configuration);
99 let resp = api.create_dashboard(body).await;
100 if let Ok(value) = resp {
101 println!("{:#?}", value);
102 } else {
103 println!("{:#?}", resp.unwrap_err());
104 }
105}
examples/v1_dashboards_CreateDashboard_1490099434.rs (line 48)
33async fn main() {
34 let body =
35 Dashboard::new(
36 DashboardLayoutType::FREE,
37 "Example-Dashboard".to_string(),
38 vec![
39 Widget::new(
40 WidgetDefinition::TableWidgetDefinition(
41 Box::new(
42 TableWidgetDefinition::new(
43 vec![
44 TableWidgetRequest::new()
45 .formulas(
46 vec![
47 WidgetFormula::new("query1".to_string())
48 .cell_display_mode(TableWidgetCellDisplayMode::TREND)
49 .cell_display_mode_options(
50 WidgetFormulaCellDisplayModeOptions::new()
51 .trend_type(
52 WidgetFormulaCellDisplayModeOptionsTrendType::LINE,
53 )
54 .y_scale(
55 WidgetFormulaCellDisplayModeOptionsYScale::SHARED,
56 ),
57 )
58 .conditional_formats(vec![])
59 ],
60 )
61 .queries(
62 vec![
63 FormulaAndFunctionQueryDefinition
64 ::FormulaAndFunctionMetricQueryDefinition(
65 Box::new(
66 FormulaAndFunctionMetricQueryDefinition::new(
67 FormulaAndFunctionMetricDataSource::METRICS,
68 "query1".to_string(),
69 "avg:system.cpu.user{*} by {host}".to_string(),
70 ).aggregator(FormulaAndFunctionMetricAggregation::AVG),
71 ),
72 )
73 ],
74 )
75 .response_format(FormulaAndFunctionResponseFormat::SCALAR)
76 .sort(
77 WidgetSortBy::new()
78 .count(500)
79 .order_by(
80 vec![
81 WidgetSortOrderBy::WidgetFormulaSort(
82 Box::new(
83 WidgetFormulaSort::new(
84 0,
85 WidgetSort::DESCENDING,
86 FormulaType::FORMULA,
87 ),
88 ),
89 )
90 ],
91 ),
92 )
93 ],
94 TableWidgetDefinitionType::QUERY_TABLE,
95 )
96 .has_search_bar(TableWidgetHasSearchBar::AUTO)
97 .time(WidgetTime::WidgetLegacyLiveSpan(Box::new(WidgetLegacyLiveSpan::new())))
98 .title("".to_string())
99 .title_align(WidgetTextAlign::LEFT)
100 .title_size("16".to_string()),
101 ),
102 ),
103 ).layout(WidgetLayout::new(32, 54, 0, 0))
104 ],
105 )
106 .description(Some("".to_string()))
107 .notify_list(Some(vec![]))
108 .template_variables(Some(vec![]));
109 let configuration = datadog::Configuration::new();
110 let api = DashboardsAPI::with_config(configuration);
111 let resp = api.create_dashboard(body).await;
112 if let Ok(value) = resp {
113 println!("{:#?}", value);
114 } else {
115 println!("{:#?}", resp.unwrap_err());
116 }
117}
Sourcepub fn cell_display_mode_options(
self,
value: WidgetFormulaCellDisplayModeOptions,
) -> Self
pub fn cell_display_mode_options( self, value: WidgetFormulaCellDisplayModeOptions, ) -> Self
Examples found in repository?
examples/v1_dashboards_CreateDashboard_1490099434.rs (lines 49-57)
33async fn main() {
34 let body =
35 Dashboard::new(
36 DashboardLayoutType::FREE,
37 "Example-Dashboard".to_string(),
38 vec![
39 Widget::new(
40 WidgetDefinition::TableWidgetDefinition(
41 Box::new(
42 TableWidgetDefinition::new(
43 vec![
44 TableWidgetRequest::new()
45 .formulas(
46 vec![
47 WidgetFormula::new("query1".to_string())
48 .cell_display_mode(TableWidgetCellDisplayMode::TREND)
49 .cell_display_mode_options(
50 WidgetFormulaCellDisplayModeOptions::new()
51 .trend_type(
52 WidgetFormulaCellDisplayModeOptionsTrendType::LINE,
53 )
54 .y_scale(
55 WidgetFormulaCellDisplayModeOptionsYScale::SHARED,
56 ),
57 )
58 .conditional_formats(vec![])
59 ],
60 )
61 .queries(
62 vec![
63 FormulaAndFunctionQueryDefinition
64 ::FormulaAndFunctionMetricQueryDefinition(
65 Box::new(
66 FormulaAndFunctionMetricQueryDefinition::new(
67 FormulaAndFunctionMetricDataSource::METRICS,
68 "query1".to_string(),
69 "avg:system.cpu.user{*} by {host}".to_string(),
70 ).aggregator(FormulaAndFunctionMetricAggregation::AVG),
71 ),
72 )
73 ],
74 )
75 .response_format(FormulaAndFunctionResponseFormat::SCALAR)
76 .sort(
77 WidgetSortBy::new()
78 .count(500)
79 .order_by(
80 vec![
81 WidgetSortOrderBy::WidgetFormulaSort(
82 Box::new(
83 WidgetFormulaSort::new(
84 0,
85 WidgetSort::DESCENDING,
86 FormulaType::FORMULA,
87 ),
88 ),
89 )
90 ],
91 ),
92 )
93 ],
94 TableWidgetDefinitionType::QUERY_TABLE,
95 )
96 .has_search_bar(TableWidgetHasSearchBar::AUTO)
97 .time(WidgetTime::WidgetLegacyLiveSpan(Box::new(WidgetLegacyLiveSpan::new())))
98 .title("".to_string())
99 .title_align(WidgetTextAlign::LEFT)
100 .title_size("16".to_string()),
101 ),
102 ),
103 ).layout(WidgetLayout::new(32, 54, 0, 0))
104 ],
105 )
106 .description(Some("".to_string()))
107 .notify_list(Some(vec![]))
108 .template_variables(Some(vec![]));
109 let configuration = datadog::Configuration::new();
110 let api = DashboardsAPI::with_config(configuration);
111 let resp = api.create_dashboard(body).await;
112 if let Ok(value) = resp {
113 println!("{:#?}", value);
114 } else {
115 println!("{:#?}", resp.unwrap_err());
116 }
117}
Sourcepub fn conditional_formats(self, value: Vec<WidgetConditionalFormat>) -> Self
pub fn conditional_formats(self, value: Vec<WidgetConditionalFormat>) -> Self
Examples found in repository?
examples/v1_dashboards_CreateDashboard_3669695268.rs (line 36)
27async fn main() {
28 let body = Dashboard::new(
29 DashboardLayoutType::ORDERED,
30 "Example-Dashboard with query table widget and storage parameter".to_string(),
31 vec![Widget::new(WidgetDefinition::TableWidgetDefinition(
32 Box::new(TableWidgetDefinition::new(
33 vec![TableWidgetRequest::new()
34 .formulas(vec![WidgetFormula::new("query1".to_string())
35 .cell_display_mode(TableWidgetCellDisplayMode::BAR)
36 .conditional_formats(vec![])])
37 .queries(vec![
38 FormulaAndFunctionQueryDefinition::FormulaAndFunctionEventQueryDefinition(
39 Box::new(
40 FormulaAndFunctionEventQueryDefinition::new(
41 FormulaAndFunctionEventQueryDefinitionCompute::new(
42 FormulaAndFunctionEventAggregation::COUNT,
43 ),
44 FormulaAndFunctionEventsDataSource::LOGS,
45 "query1".to_string(),
46 )
47 .group_by(vec![])
48 .indexes(vec!["*".to_string()])
49 .search(FormulaAndFunctionEventQueryDefinitionSearch::new(
50 "".to_string(),
51 ))
52 .storage("online_archives".to_string()),
53 ),
54 ),
55 ])
56 .response_format(FormulaAndFunctionResponseFormat::SCALAR)
57 .sort(WidgetSortBy::new().count(50).order_by(vec![
58 WidgetSortOrderBy::WidgetFormulaSort(Box::new(WidgetFormulaSort::new(
59 0,
60 WidgetSort::DESCENDING,
61 FormulaType::FORMULA,
62 ))),
63 ]))],
64 TableWidgetDefinitionType::QUERY_TABLE,
65 )),
66 ))],
67 );
68 let configuration = datadog::Configuration::new();
69 let api = DashboardsAPI::with_config(configuration);
70 let resp = api.create_dashboard(body).await;
71 if let Ok(value) = resp {
72 println!("{:#?}", value);
73 } else {
74 println!("{:#?}", resp.unwrap_err());
75 }
76}
More examples
examples/v1_dashboards_CreateDashboard_2336428357.rs (line 46)
30async fn main() {
31 let body =
32 Dashboard::new(
33 DashboardLayoutType::FREE,
34 "Example-Dashboard".to_string(),
35 vec![
36 Widget::new(
37 WidgetDefinition::TableWidgetDefinition(
38 Box::new(
39 TableWidgetDefinition::new(
40 vec![
41 TableWidgetRequest::new()
42 .formulas(
43 vec![
44 WidgetFormula::new("query1".to_string())
45 .cell_display_mode(TableWidgetCellDisplayMode::BAR)
46 .conditional_formats(vec![])
47 ],
48 )
49 .queries(
50 vec![
51 FormulaAndFunctionQueryDefinition
52 ::FormulaAndFunctionMetricQueryDefinition(
53 Box::new(
54 FormulaAndFunctionMetricQueryDefinition::new(
55 FormulaAndFunctionMetricDataSource::METRICS,
56 "query1".to_string(),
57 "avg:system.cpu.user{*} by {host}".to_string(),
58 ).aggregator(FormulaAndFunctionMetricAggregation::AVG),
59 ),
60 )
61 ],
62 )
63 .response_format(FormulaAndFunctionResponseFormat::SCALAR)
64 .sort(
65 WidgetSortBy::new()
66 .count(500)
67 .order_by(
68 vec![
69 WidgetSortOrderBy::WidgetFormulaSort(
70 Box::new(
71 WidgetFormulaSort::new(
72 0,
73 WidgetSort::DESCENDING,
74 FormulaType::FORMULA,
75 ),
76 ),
77 )
78 ],
79 ),
80 )
81 ],
82 TableWidgetDefinitionType::QUERY_TABLE,
83 )
84 .has_search_bar(TableWidgetHasSearchBar::AUTO)
85 .time(WidgetTime::WidgetLegacyLiveSpan(Box::new(WidgetLegacyLiveSpan::new())))
86 .title("".to_string())
87 .title_align(WidgetTextAlign::LEFT)
88 .title_size("16".to_string()),
89 ),
90 ),
91 ).layout(WidgetLayout::new(32, 54, 0, 0))
92 ],
93 )
94 .description(Some("".to_string()))
95 .notify_list(Some(vec![]))
96 .template_variables(Some(vec![]));
97 let configuration = datadog::Configuration::new();
98 let api = DashboardsAPI::with_config(configuration);
99 let resp = api.create_dashboard(body).await;
100 if let Ok(value) = resp {
101 println!("{:#?}", value);
102 } else {
103 println!("{:#?}", resp.unwrap_err());
104 }
105}
examples/v1_dashboards_CreateDashboard_1490099434.rs (line 58)
33async fn main() {
34 let body =
35 Dashboard::new(
36 DashboardLayoutType::FREE,
37 "Example-Dashboard".to_string(),
38 vec![
39 Widget::new(
40 WidgetDefinition::TableWidgetDefinition(
41 Box::new(
42 TableWidgetDefinition::new(
43 vec![
44 TableWidgetRequest::new()
45 .formulas(
46 vec![
47 WidgetFormula::new("query1".to_string())
48 .cell_display_mode(TableWidgetCellDisplayMode::TREND)
49 .cell_display_mode_options(
50 WidgetFormulaCellDisplayModeOptions::new()
51 .trend_type(
52 WidgetFormulaCellDisplayModeOptionsTrendType::LINE,
53 )
54 .y_scale(
55 WidgetFormulaCellDisplayModeOptionsYScale::SHARED,
56 ),
57 )
58 .conditional_formats(vec![])
59 ],
60 )
61 .queries(
62 vec![
63 FormulaAndFunctionQueryDefinition
64 ::FormulaAndFunctionMetricQueryDefinition(
65 Box::new(
66 FormulaAndFunctionMetricQueryDefinition::new(
67 FormulaAndFunctionMetricDataSource::METRICS,
68 "query1".to_string(),
69 "avg:system.cpu.user{*} by {host}".to_string(),
70 ).aggregator(FormulaAndFunctionMetricAggregation::AVG),
71 ),
72 )
73 ],
74 )
75 .response_format(FormulaAndFunctionResponseFormat::SCALAR)
76 .sort(
77 WidgetSortBy::new()
78 .count(500)
79 .order_by(
80 vec![
81 WidgetSortOrderBy::WidgetFormulaSort(
82 Box::new(
83 WidgetFormulaSort::new(
84 0,
85 WidgetSort::DESCENDING,
86 FormulaType::FORMULA,
87 ),
88 ),
89 )
90 ],
91 ),
92 )
93 ],
94 TableWidgetDefinitionType::QUERY_TABLE,
95 )
96 .has_search_bar(TableWidgetHasSearchBar::AUTO)
97 .time(WidgetTime::WidgetLegacyLiveSpan(Box::new(WidgetLegacyLiveSpan::new())))
98 .title("".to_string())
99 .title_align(WidgetTextAlign::LEFT)
100 .title_size("16".to_string()),
101 ),
102 ),
103 ).layout(WidgetLayout::new(32, 54, 0, 0))
104 ],
105 )
106 .description(Some("".to_string()))
107 .notify_list(Some(vec![]))
108 .template_variables(Some(vec![]));
109 let configuration = datadog::Configuration::new();
110 let api = DashboardsAPI::with_config(configuration);
111 let resp = api.create_dashboard(body).await;
112 if let Ok(value) = resp {
113 println!("{:#?}", value);
114 } else {
115 println!("{:#?}", resp.unwrap_err());
116 }
117}
pub fn limit(self, value: WidgetFormulaLimit) -> Self
Sourcepub fn number_format(self, value: WidgetNumberFormat) -> Self
pub fn number_format(self, value: WidgetNumberFormat) -> Self
Examples found in repository?
examples/v1_dashboards_CreateDashboard_3520534424.rs (lines 47-67)
30async fn main() {
31 let body =
32 Dashboard::new(
33 DashboardLayoutType::ORDERED,
34 "Example-Dashboard".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(
44 vec![
45 WidgetFormula::new(
46 "query1".to_string(),
47 ).number_format(
48 WidgetNumberFormat::new()
49 .unit(
50 NumberFormatUnit::NumberFormatUnitCanonical(
51 Box::new(
52 NumberFormatUnitCanonical::new()
53 .type_(
54 NumberFormatUnitScaleType::CANONICAL_UNIT,
55 )
56 .unit_name("fraction".to_string()),
57 ),
58 ),
59 )
60 .unit_scale(
61 Some(
62 NumberFormatUnitScale::new()
63 .type_(NumberFormatUnitScaleType::CANONICAL_UNIT)
64 .unit_name("apdex".to_string()),
65 ),
66 ),
67 )
68 ],
69 )
70 .queries(
71 vec![
72 FormulaAndFunctionQueryDefinition
73 ::FormulaAndFunctionMetricQueryDefinition(
74 Box::new(
75 FormulaAndFunctionMetricQueryDefinition::new(
76 FormulaAndFunctionMetricDataSource::METRICS,
77 "query1".to_string(),
78 "avg:system.cpu.user{*}".to_string(),
79 ),
80 ),
81 )
82 ],
83 )
84 .response_format(FormulaAndFunctionResponseFormat::TIMESERIES)
85 ],
86 TimeseriesWidgetDefinitionType::TIMESERIES,
87 )
88 .legend_layout(TimeseriesWidgetLegendLayout::AUTO)
89 .show_legend(true)
90 .time(WidgetTime::WidgetLegacyLiveSpan(Box::new(WidgetLegacyLiveSpan::new())))
91 .title("".to_string())
92 .title_align(WidgetTextAlign::LEFT)
93 .title_size("16".to_string()),
94 ),
95 ),
96 ).layout(WidgetLayout::new(5, 12, 0, 0))
97 ],
98 )
99 .description(Some("".to_string()))
100 .notify_list(Some(vec![]))
101 .reflow_type(DashboardReflowType::FIXED)
102 .template_variables(Some(vec![]));
103 let configuration = datadog::Configuration::new();
104 let api = DashboardsAPI::with_config(configuration);
105 let resp = api.create_dashboard(body).await;
106 if let Ok(value) = resp {
107 println!("{:#?}", value);
108 } else {
109 println!("{:#?}", resp.unwrap_err());
110 }
111}
Sourcepub fn style(self, value: WidgetFormulaStyle) -> Self
pub fn style(self, value: WidgetFormulaStyle) -> Self
Examples found in repository?
examples/v1_dashboards_CreateDashboard_41622531.rs (lines 45-49)
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}
pub fn additional_properties(self, value: BTreeMap<String, Value>) -> Self
Trait Implementations§
Source§impl Clone for WidgetFormula
impl Clone for WidgetFormula
Source§fn clone(&self) -> WidgetFormula
fn clone(&self) -> WidgetFormula
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for WidgetFormula
impl Debug for WidgetFormula
Source§impl<'de> Deserialize<'de> for WidgetFormula
impl<'de> Deserialize<'de> for WidgetFormula
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
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 WidgetFormula
impl PartialEq for WidgetFormula
Source§impl Serialize for WidgetFormula
impl Serialize for WidgetFormula
impl StructuralPartialEq for WidgetFormula
Auto Trait Implementations§
impl Freeze for WidgetFormula
impl RefUnwindSafe for WidgetFormula
impl Send for WidgetFormula
impl Sync for WidgetFormula
impl Unpin for WidgetFormula
impl UnwindSafe for WidgetFormula
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more