#[non_exhaustive]pub struct TableWidgetDefinition {
pub custom_links: Option<Vec<WidgetCustomLink>>,
pub has_search_bar: Option<TableWidgetHasSearchBar>,
pub requests: Vec<TableWidgetRequest>,
pub time: Option<WidgetTime>,
pub title: Option<String>,
pub title_align: Option<WidgetTextAlign>,
pub title_size: Option<String>,
pub type_: TableWidgetDefinitionType,
pub additional_properties: BTreeMap<String, Value>,
/* private fields */
}
Expand description
The table visualization is available on timeboards and screenboards. It displays columns of metrics grouped by tag key.
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.custom_links: Option<Vec<WidgetCustomLink>>
List of custom links.
has_search_bar: Option<TableWidgetHasSearchBar>
Controls the display of the search bar.
requests: Vec<TableWidgetRequest>
Widget definition.
time: Option<WidgetTime>
Time setting for the widget.
title: Option<String>
Title of your widget.
title_align: Option<WidgetTextAlign>
How to align the text on the widget.
title_size: Option<String>
Size of the title.
type_: TableWidgetDefinitionType
Type of the table widget.
additional_properties: BTreeMap<String, Value>
Implementations§
Source§impl TableWidgetDefinition
impl TableWidgetDefinition
Sourcepub fn new(
requests: Vec<TableWidgetRequest>,
type_: TableWidgetDefinitionType,
) -> TableWidgetDefinition
pub fn new( requests: Vec<TableWidgetRequest>, type_: TableWidgetDefinitionType, ) -> TableWidgetDefinition
Examples found in repository?
examples/v1_dashboards_CreateDashboard_3669695268.rs (lines 32-65)
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_145494973.rs (lines 29-56)
20async fn main() {
21 let body =
22 Dashboard::new(
23 DashboardLayoutType::ORDERED,
24 "Example-Dashboard".to_string(),
25 vec![
26 Widget::new(
27 WidgetDefinition::TableWidgetDefinition(
28 Box::new(
29 TableWidgetDefinition::new(
30 vec![
31 TableWidgetRequest::new()
32 .queries(
33 vec![
34 FormulaAndFunctionQueryDefinition
35 ::FormulaAndFunctionApmResourceStatsQueryDefinition(
36 Box::new(
37 FormulaAndFunctionApmResourceStatsQueryDefinition::new(
38 FormulaAndFunctionApmResourceStatsDataSource
39 ::APM_RESOURCE_STATS,
40 "ci".to_string(),
41 "query1".to_string(),
42 "cassandra".to_string(),
43 FormulaAndFunctionApmResourceStatName::HITS,
44 )
45 .group_by(vec!["resource_name".to_string()])
46 .operation_name("cassandra.query".to_string())
47 .primary_tag_name("datacenter".to_string())
48 .primary_tag_value("edge-eu1.prod.dog".to_string()),
49 ),
50 )
51 ],
52 )
53 .response_format(FormulaAndFunctionResponseFormat::SCALAR)
54 ],
55 TableWidgetDefinitionType::QUERY_TABLE,
56 )
57 .title("".to_string())
58 .title_align(WidgetTextAlign::LEFT)
59 .title_size("16".to_string()),
60 ),
61 ),
62 ).layout(WidgetLayout::new(4, 4, 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_798168180.rs (lines 29-56)
20async fn main() {
21 let body =
22 Dashboard::new(
23 DashboardLayoutType::ORDERED,
24 "Example-Dashboard".to_string(),
25 vec![
26 Widget::new(
27 WidgetDefinition::TableWidgetDefinition(
28 Box::new(
29 TableWidgetDefinition::new(
30 vec![
31 TableWidgetRequest::new()
32 .queries(
33 vec![
34 FormulaAndFunctionQueryDefinition
35 ::FormulaAndFunctionApmDependencyStatsQueryDefinition(
36 Box::new(
37 FormulaAndFunctionApmDependencyStatsQueryDefinition::new(
38 FormulaAndFunctionApmDependencyStatsDataSource
39 ::APM_DEPENDENCY_STATS,
40 "ci".to_string(),
41 "query1".to_string(),
42 "cassandra.query".to_string(),
43 "DELETE FROM monitor_history.monitor_state_change_history WHERE org_id = ? AND monitor_id IN ? AND group = ?".to_string(),
44 "cassandra".to_string(),
45 FormulaAndFunctionApmDependencyStatName::AVG_DURATION,
46 )
47 .primary_tag_name("datacenter".to_string())
48 .primary_tag_value("edge-eu1.prod.dog".to_string()),
49 ),
50 )
51 ],
52 )
53 .response_format(FormulaAndFunctionResponseFormat::SCALAR)
54 ],
55 TableWidgetDefinitionType::QUERY_TABLE,
56 )
57 .title("".to_string())
58 .title_align(WidgetTextAlign::LEFT)
59 .title_size("16".to_string()),
60 ),
61 ),
62 ).layout(WidgetLayout::new(4, 4, 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_2336428357.rs (lines 39-83)
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 (lines 42-95)
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}
examples/v1_dashboards_CreateDashboard_794302680.rs (lines 37-178)
28async fn main() {
29 let body =
30 Dashboard::new(
31 DashboardLayoutType::FREE,
32 "Example-Dashboard".to_string(),
33 vec![
34 Widget::new(
35 WidgetDefinition::TableWidgetDefinition(
36 Box::new(
37 TableWidgetDefinition::new(
38 vec![
39 TableWidgetRequest::new()
40 .formulas(vec![])
41 .queries(
42 vec![
43 FormulaAndFunctionQueryDefinition
44 ::FormulaAndFunctionMetricQueryDefinition(
45 Box::new(
46 FormulaAndFunctionMetricQueryDefinition::new(
47 FormulaAndFunctionMetricDataSource::METRICS,
48 "query1".to_string(),
49 "avg:aws.stream.globalaccelerator.processed_bytes_in{*} by {aws_account,acceleratoripaddress}".to_string(),
50 ).aggregator(FormulaAndFunctionMetricAggregation::AVG),
51 ),
52 ),
53 FormulaAndFunctionQueryDefinition
54 ::FormulaAndFunctionMetricQueryDefinition(
55 Box::new(
56 FormulaAndFunctionMetricQueryDefinition::new(
57 FormulaAndFunctionMetricDataSource::METRICS,
58 "query2".to_string(),
59 "avg:aws.stream.globalaccelerator.processed_bytes_out{*} by {aws_account,acceleratoripaddress}".to_string(),
60 ).aggregator(FormulaAndFunctionMetricAggregation::AVG),
61 ),
62 )
63 ],
64 )
65 .response_format(FormulaAndFunctionResponseFormat::SCALAR)
66 .text_formats(
67 vec![
68 vec![
69 TableWidgetTextFormatRule::new(
70 TableWidgetTextFormatMatch::new(
71 TableWidgetTextFormatMatchType::IS,
72 "fruit".to_string(),
73 ),
74 )
75 .palette(TableWidgetTextFormatPalette::WHITE_ON_RED)
76 .replace(
77 TableWidgetTextFormatReplace
78 ::TableWidgetTextFormatReplaceAll(
79 Box::new(
80 TableWidgetTextFormatReplaceAll::new(
81 TableWidgetTextFormatReplaceAllType::ALL,
82 "vegetable".to_string(),
83 ),
84 ),
85 ),
86 ),
87 TableWidgetTextFormatRule::new(
88 TableWidgetTextFormatMatch::new(
89 TableWidgetTextFormatMatchType::IS,
90 "animal".to_string(),
91 ),
92 )
93 .custom_bg_color("#632ca6".to_string())
94 .palette(TableWidgetTextFormatPalette::CUSTOM_BG),
95 TableWidgetTextFormatRule::new(
96 TableWidgetTextFormatMatch::new(
97 TableWidgetTextFormatMatchType::IS,
98 "robot".to_string(),
99 ),
100 ).palette(TableWidgetTextFormatPalette::RED_ON_WHITE),
101 TableWidgetTextFormatRule::new(
102 TableWidgetTextFormatMatch::new(
103 TableWidgetTextFormatMatchType::IS,
104 "ai".to_string(),
105 ),
106 ).palette(TableWidgetTextFormatPalette::YELLOW_ON_WHITE)
107 ],
108 vec![
109 TableWidgetTextFormatRule::new(
110 TableWidgetTextFormatMatch::new(
111 TableWidgetTextFormatMatchType::IS_NOT,
112 "xyz".to_string(),
113 ),
114 ).palette(TableWidgetTextFormatPalette::WHITE_ON_YELLOW)
115 ],
116 vec![
117 TableWidgetTextFormatRule::new(
118 TableWidgetTextFormatMatch::new(
119 TableWidgetTextFormatMatchType::CONTAINS,
120 "test".to_string(),
121 ),
122 )
123 .palette(TableWidgetTextFormatPalette::WHITE_ON_GREEN)
124 .replace(
125 TableWidgetTextFormatReplace
126 ::TableWidgetTextFormatReplaceAll(
127 Box::new(
128 TableWidgetTextFormatReplaceAll::new(
129 TableWidgetTextFormatReplaceAllType::ALL,
130 "vegetable".to_string(),
131 ),
132 ),
133 ),
134 )
135 ],
136 vec![
137 TableWidgetTextFormatRule::new(
138 TableWidgetTextFormatMatch::new(
139 TableWidgetTextFormatMatchType::DOES_NOT_CONTAIN,
140 "blah".to_string(),
141 ),
142 ).palette(TableWidgetTextFormatPalette::BLACK_ON_LIGHT_RED)
143 ],
144 vec![
145 TableWidgetTextFormatRule::new(
146 TableWidgetTextFormatMatch::new(
147 TableWidgetTextFormatMatchType::STARTS_WITH,
148 "abc".to_string(),
149 ),
150 ).palette(TableWidgetTextFormatPalette::BLACK_ON_LIGHT_YELLOW)
151 ],
152 vec![
153 TableWidgetTextFormatRule::new(
154 TableWidgetTextFormatMatch::new(
155 TableWidgetTextFormatMatchType::ENDS_WITH,
156 "xyz".to_string(),
157 ),
158 ).palette(TableWidgetTextFormatPalette::BLACK_ON_LIGHT_GREEN),
159 TableWidgetTextFormatRule::new(
160 TableWidgetTextFormatMatch::new(
161 TableWidgetTextFormatMatchType::ENDS_WITH,
162 "zzz".to_string(),
163 ),
164 ).palette(TableWidgetTextFormatPalette::GREEN_ON_WHITE),
165 TableWidgetTextFormatRule::new(
166 TableWidgetTextFormatMatch::new(
167 TableWidgetTextFormatMatchType::IS,
168 "animal".to_string(),
169 ),
170 )
171 .custom_fg_color("#632ca6".to_string())
172 .palette(TableWidgetTextFormatPalette::CUSTOM_TEXT)
173 ]
174 ],
175 )
176 ],
177 TableWidgetDefinitionType::QUERY_TABLE,
178 )
179 .has_search_bar(TableWidgetHasSearchBar::NEVER)
180 .title("".to_string())
181 .title_align(WidgetTextAlign::LEFT)
182 .title_size("16".to_string()),
183 ),
184 ),
185 ).layout(WidgetLayout::new(4, 4, 0, 0))
186 ],
187 )
188 .description(Some("".to_string()))
189 .notify_list(Some(vec![]))
190 .template_variables(Some(vec![]));
191 let configuration = datadog::Configuration::new();
192 let api = DashboardsAPI::with_config(configuration);
193 let resp = api.create_dashboard(body).await;
194 if let Ok(value) = resp {
195 println!("{:#?}", value);
196 } else {
197 println!("{:#?}", resp.unwrap_err());
198 }
199}
pub fn custom_links(self, value: Vec<WidgetCustomLink>) -> Self
Sourcepub fn has_search_bar(self, value: TableWidgetHasSearchBar) -> Self
pub fn has_search_bar(self, value: TableWidgetHasSearchBar) -> Self
Examples found in repository?
examples/v1_dashboards_CreateDashboard_2336428357.rs (line 84)
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}
More examples
examples/v1_dashboards_CreateDashboard_1490099434.rs (line 96)
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}
examples/v1_dashboards_CreateDashboard_794302680.rs (line 179)
28async fn main() {
29 let body =
30 Dashboard::new(
31 DashboardLayoutType::FREE,
32 "Example-Dashboard".to_string(),
33 vec![
34 Widget::new(
35 WidgetDefinition::TableWidgetDefinition(
36 Box::new(
37 TableWidgetDefinition::new(
38 vec![
39 TableWidgetRequest::new()
40 .formulas(vec![])
41 .queries(
42 vec![
43 FormulaAndFunctionQueryDefinition
44 ::FormulaAndFunctionMetricQueryDefinition(
45 Box::new(
46 FormulaAndFunctionMetricQueryDefinition::new(
47 FormulaAndFunctionMetricDataSource::METRICS,
48 "query1".to_string(),
49 "avg:aws.stream.globalaccelerator.processed_bytes_in{*} by {aws_account,acceleratoripaddress}".to_string(),
50 ).aggregator(FormulaAndFunctionMetricAggregation::AVG),
51 ),
52 ),
53 FormulaAndFunctionQueryDefinition
54 ::FormulaAndFunctionMetricQueryDefinition(
55 Box::new(
56 FormulaAndFunctionMetricQueryDefinition::new(
57 FormulaAndFunctionMetricDataSource::METRICS,
58 "query2".to_string(),
59 "avg:aws.stream.globalaccelerator.processed_bytes_out{*} by {aws_account,acceleratoripaddress}".to_string(),
60 ).aggregator(FormulaAndFunctionMetricAggregation::AVG),
61 ),
62 )
63 ],
64 )
65 .response_format(FormulaAndFunctionResponseFormat::SCALAR)
66 .text_formats(
67 vec![
68 vec![
69 TableWidgetTextFormatRule::new(
70 TableWidgetTextFormatMatch::new(
71 TableWidgetTextFormatMatchType::IS,
72 "fruit".to_string(),
73 ),
74 )
75 .palette(TableWidgetTextFormatPalette::WHITE_ON_RED)
76 .replace(
77 TableWidgetTextFormatReplace
78 ::TableWidgetTextFormatReplaceAll(
79 Box::new(
80 TableWidgetTextFormatReplaceAll::new(
81 TableWidgetTextFormatReplaceAllType::ALL,
82 "vegetable".to_string(),
83 ),
84 ),
85 ),
86 ),
87 TableWidgetTextFormatRule::new(
88 TableWidgetTextFormatMatch::new(
89 TableWidgetTextFormatMatchType::IS,
90 "animal".to_string(),
91 ),
92 )
93 .custom_bg_color("#632ca6".to_string())
94 .palette(TableWidgetTextFormatPalette::CUSTOM_BG),
95 TableWidgetTextFormatRule::new(
96 TableWidgetTextFormatMatch::new(
97 TableWidgetTextFormatMatchType::IS,
98 "robot".to_string(),
99 ),
100 ).palette(TableWidgetTextFormatPalette::RED_ON_WHITE),
101 TableWidgetTextFormatRule::new(
102 TableWidgetTextFormatMatch::new(
103 TableWidgetTextFormatMatchType::IS,
104 "ai".to_string(),
105 ),
106 ).palette(TableWidgetTextFormatPalette::YELLOW_ON_WHITE)
107 ],
108 vec![
109 TableWidgetTextFormatRule::new(
110 TableWidgetTextFormatMatch::new(
111 TableWidgetTextFormatMatchType::IS_NOT,
112 "xyz".to_string(),
113 ),
114 ).palette(TableWidgetTextFormatPalette::WHITE_ON_YELLOW)
115 ],
116 vec![
117 TableWidgetTextFormatRule::new(
118 TableWidgetTextFormatMatch::new(
119 TableWidgetTextFormatMatchType::CONTAINS,
120 "test".to_string(),
121 ),
122 )
123 .palette(TableWidgetTextFormatPalette::WHITE_ON_GREEN)
124 .replace(
125 TableWidgetTextFormatReplace
126 ::TableWidgetTextFormatReplaceAll(
127 Box::new(
128 TableWidgetTextFormatReplaceAll::new(
129 TableWidgetTextFormatReplaceAllType::ALL,
130 "vegetable".to_string(),
131 ),
132 ),
133 ),
134 )
135 ],
136 vec![
137 TableWidgetTextFormatRule::new(
138 TableWidgetTextFormatMatch::new(
139 TableWidgetTextFormatMatchType::DOES_NOT_CONTAIN,
140 "blah".to_string(),
141 ),
142 ).palette(TableWidgetTextFormatPalette::BLACK_ON_LIGHT_RED)
143 ],
144 vec![
145 TableWidgetTextFormatRule::new(
146 TableWidgetTextFormatMatch::new(
147 TableWidgetTextFormatMatchType::STARTS_WITH,
148 "abc".to_string(),
149 ),
150 ).palette(TableWidgetTextFormatPalette::BLACK_ON_LIGHT_YELLOW)
151 ],
152 vec![
153 TableWidgetTextFormatRule::new(
154 TableWidgetTextFormatMatch::new(
155 TableWidgetTextFormatMatchType::ENDS_WITH,
156 "xyz".to_string(),
157 ),
158 ).palette(TableWidgetTextFormatPalette::BLACK_ON_LIGHT_GREEN),
159 TableWidgetTextFormatRule::new(
160 TableWidgetTextFormatMatch::new(
161 TableWidgetTextFormatMatchType::ENDS_WITH,
162 "zzz".to_string(),
163 ),
164 ).palette(TableWidgetTextFormatPalette::GREEN_ON_WHITE),
165 TableWidgetTextFormatRule::new(
166 TableWidgetTextFormatMatch::new(
167 TableWidgetTextFormatMatchType::IS,
168 "animal".to_string(),
169 ),
170 )
171 .custom_fg_color("#632ca6".to_string())
172 .palette(TableWidgetTextFormatPalette::CUSTOM_TEXT)
173 ]
174 ],
175 )
176 ],
177 TableWidgetDefinitionType::QUERY_TABLE,
178 )
179 .has_search_bar(TableWidgetHasSearchBar::NEVER)
180 .title("".to_string())
181 .title_align(WidgetTextAlign::LEFT)
182 .title_size("16".to_string()),
183 ),
184 ),
185 ).layout(WidgetLayout::new(4, 4, 0, 0))
186 ],
187 )
188 .description(Some("".to_string()))
189 .notify_list(Some(vec![]))
190 .template_variables(Some(vec![]));
191 let configuration = datadog::Configuration::new();
192 let api = DashboardsAPI::with_config(configuration);
193 let resp = api.create_dashboard(body).await;
194 if let Ok(value) = resp {
195 println!("{:#?}", value);
196 } else {
197 println!("{:#?}", resp.unwrap_err());
198 }
199}
Sourcepub fn time(self, value: WidgetTime) -> Self
pub fn time(self, value: WidgetTime) -> Self
Examples found in repository?
examples/v1_dashboards_CreateDashboard_2336428357.rs (line 85)
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}
More examples
examples/v1_dashboards_CreateDashboard_1490099434.rs (line 97)
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 title(self, value: String) -> Self
pub fn title(self, value: String) -> Self
Examples found in repository?
examples/v1_dashboards_CreateDashboard_145494973.rs (line 57)
20async fn main() {
21 let body =
22 Dashboard::new(
23 DashboardLayoutType::ORDERED,
24 "Example-Dashboard".to_string(),
25 vec![
26 Widget::new(
27 WidgetDefinition::TableWidgetDefinition(
28 Box::new(
29 TableWidgetDefinition::new(
30 vec![
31 TableWidgetRequest::new()
32 .queries(
33 vec![
34 FormulaAndFunctionQueryDefinition
35 ::FormulaAndFunctionApmResourceStatsQueryDefinition(
36 Box::new(
37 FormulaAndFunctionApmResourceStatsQueryDefinition::new(
38 FormulaAndFunctionApmResourceStatsDataSource
39 ::APM_RESOURCE_STATS,
40 "ci".to_string(),
41 "query1".to_string(),
42 "cassandra".to_string(),
43 FormulaAndFunctionApmResourceStatName::HITS,
44 )
45 .group_by(vec!["resource_name".to_string()])
46 .operation_name("cassandra.query".to_string())
47 .primary_tag_name("datacenter".to_string())
48 .primary_tag_value("edge-eu1.prod.dog".to_string()),
49 ),
50 )
51 ],
52 )
53 .response_format(FormulaAndFunctionResponseFormat::SCALAR)
54 ],
55 TableWidgetDefinitionType::QUERY_TABLE,
56 )
57 .title("".to_string())
58 .title_align(WidgetTextAlign::LEFT)
59 .title_size("16".to_string()),
60 ),
61 ),
62 ).layout(WidgetLayout::new(4, 4, 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}
More examples
examples/v1_dashboards_CreateDashboard_798168180.rs (line 57)
20async fn main() {
21 let body =
22 Dashboard::new(
23 DashboardLayoutType::ORDERED,
24 "Example-Dashboard".to_string(),
25 vec![
26 Widget::new(
27 WidgetDefinition::TableWidgetDefinition(
28 Box::new(
29 TableWidgetDefinition::new(
30 vec![
31 TableWidgetRequest::new()
32 .queries(
33 vec![
34 FormulaAndFunctionQueryDefinition
35 ::FormulaAndFunctionApmDependencyStatsQueryDefinition(
36 Box::new(
37 FormulaAndFunctionApmDependencyStatsQueryDefinition::new(
38 FormulaAndFunctionApmDependencyStatsDataSource
39 ::APM_DEPENDENCY_STATS,
40 "ci".to_string(),
41 "query1".to_string(),
42 "cassandra.query".to_string(),
43 "DELETE FROM monitor_history.monitor_state_change_history WHERE org_id = ? AND monitor_id IN ? AND group = ?".to_string(),
44 "cassandra".to_string(),
45 FormulaAndFunctionApmDependencyStatName::AVG_DURATION,
46 )
47 .primary_tag_name("datacenter".to_string())
48 .primary_tag_value("edge-eu1.prod.dog".to_string()),
49 ),
50 )
51 ],
52 )
53 .response_format(FormulaAndFunctionResponseFormat::SCALAR)
54 ],
55 TableWidgetDefinitionType::QUERY_TABLE,
56 )
57 .title("".to_string())
58 .title_align(WidgetTextAlign::LEFT)
59 .title_size("16".to_string()),
60 ),
61 ),
62 ).layout(WidgetLayout::new(4, 4, 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_2336428357.rs (line 86)
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 98)
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}
examples/v1_dashboards_CreateDashboard_794302680.rs (line 180)
28async fn main() {
29 let body =
30 Dashboard::new(
31 DashboardLayoutType::FREE,
32 "Example-Dashboard".to_string(),
33 vec![
34 Widget::new(
35 WidgetDefinition::TableWidgetDefinition(
36 Box::new(
37 TableWidgetDefinition::new(
38 vec![
39 TableWidgetRequest::new()
40 .formulas(vec![])
41 .queries(
42 vec![
43 FormulaAndFunctionQueryDefinition
44 ::FormulaAndFunctionMetricQueryDefinition(
45 Box::new(
46 FormulaAndFunctionMetricQueryDefinition::new(
47 FormulaAndFunctionMetricDataSource::METRICS,
48 "query1".to_string(),
49 "avg:aws.stream.globalaccelerator.processed_bytes_in{*} by {aws_account,acceleratoripaddress}".to_string(),
50 ).aggregator(FormulaAndFunctionMetricAggregation::AVG),
51 ),
52 ),
53 FormulaAndFunctionQueryDefinition
54 ::FormulaAndFunctionMetricQueryDefinition(
55 Box::new(
56 FormulaAndFunctionMetricQueryDefinition::new(
57 FormulaAndFunctionMetricDataSource::METRICS,
58 "query2".to_string(),
59 "avg:aws.stream.globalaccelerator.processed_bytes_out{*} by {aws_account,acceleratoripaddress}".to_string(),
60 ).aggregator(FormulaAndFunctionMetricAggregation::AVG),
61 ),
62 )
63 ],
64 )
65 .response_format(FormulaAndFunctionResponseFormat::SCALAR)
66 .text_formats(
67 vec![
68 vec![
69 TableWidgetTextFormatRule::new(
70 TableWidgetTextFormatMatch::new(
71 TableWidgetTextFormatMatchType::IS,
72 "fruit".to_string(),
73 ),
74 )
75 .palette(TableWidgetTextFormatPalette::WHITE_ON_RED)
76 .replace(
77 TableWidgetTextFormatReplace
78 ::TableWidgetTextFormatReplaceAll(
79 Box::new(
80 TableWidgetTextFormatReplaceAll::new(
81 TableWidgetTextFormatReplaceAllType::ALL,
82 "vegetable".to_string(),
83 ),
84 ),
85 ),
86 ),
87 TableWidgetTextFormatRule::new(
88 TableWidgetTextFormatMatch::new(
89 TableWidgetTextFormatMatchType::IS,
90 "animal".to_string(),
91 ),
92 )
93 .custom_bg_color("#632ca6".to_string())
94 .palette(TableWidgetTextFormatPalette::CUSTOM_BG),
95 TableWidgetTextFormatRule::new(
96 TableWidgetTextFormatMatch::new(
97 TableWidgetTextFormatMatchType::IS,
98 "robot".to_string(),
99 ),
100 ).palette(TableWidgetTextFormatPalette::RED_ON_WHITE),
101 TableWidgetTextFormatRule::new(
102 TableWidgetTextFormatMatch::new(
103 TableWidgetTextFormatMatchType::IS,
104 "ai".to_string(),
105 ),
106 ).palette(TableWidgetTextFormatPalette::YELLOW_ON_WHITE)
107 ],
108 vec![
109 TableWidgetTextFormatRule::new(
110 TableWidgetTextFormatMatch::new(
111 TableWidgetTextFormatMatchType::IS_NOT,
112 "xyz".to_string(),
113 ),
114 ).palette(TableWidgetTextFormatPalette::WHITE_ON_YELLOW)
115 ],
116 vec![
117 TableWidgetTextFormatRule::new(
118 TableWidgetTextFormatMatch::new(
119 TableWidgetTextFormatMatchType::CONTAINS,
120 "test".to_string(),
121 ),
122 )
123 .palette(TableWidgetTextFormatPalette::WHITE_ON_GREEN)
124 .replace(
125 TableWidgetTextFormatReplace
126 ::TableWidgetTextFormatReplaceAll(
127 Box::new(
128 TableWidgetTextFormatReplaceAll::new(
129 TableWidgetTextFormatReplaceAllType::ALL,
130 "vegetable".to_string(),
131 ),
132 ),
133 ),
134 )
135 ],
136 vec![
137 TableWidgetTextFormatRule::new(
138 TableWidgetTextFormatMatch::new(
139 TableWidgetTextFormatMatchType::DOES_NOT_CONTAIN,
140 "blah".to_string(),
141 ),
142 ).palette(TableWidgetTextFormatPalette::BLACK_ON_LIGHT_RED)
143 ],
144 vec![
145 TableWidgetTextFormatRule::new(
146 TableWidgetTextFormatMatch::new(
147 TableWidgetTextFormatMatchType::STARTS_WITH,
148 "abc".to_string(),
149 ),
150 ).palette(TableWidgetTextFormatPalette::BLACK_ON_LIGHT_YELLOW)
151 ],
152 vec![
153 TableWidgetTextFormatRule::new(
154 TableWidgetTextFormatMatch::new(
155 TableWidgetTextFormatMatchType::ENDS_WITH,
156 "xyz".to_string(),
157 ),
158 ).palette(TableWidgetTextFormatPalette::BLACK_ON_LIGHT_GREEN),
159 TableWidgetTextFormatRule::new(
160 TableWidgetTextFormatMatch::new(
161 TableWidgetTextFormatMatchType::ENDS_WITH,
162 "zzz".to_string(),
163 ),
164 ).palette(TableWidgetTextFormatPalette::GREEN_ON_WHITE),
165 TableWidgetTextFormatRule::new(
166 TableWidgetTextFormatMatch::new(
167 TableWidgetTextFormatMatchType::IS,
168 "animal".to_string(),
169 ),
170 )
171 .custom_fg_color("#632ca6".to_string())
172 .palette(TableWidgetTextFormatPalette::CUSTOM_TEXT)
173 ]
174 ],
175 )
176 ],
177 TableWidgetDefinitionType::QUERY_TABLE,
178 )
179 .has_search_bar(TableWidgetHasSearchBar::NEVER)
180 .title("".to_string())
181 .title_align(WidgetTextAlign::LEFT)
182 .title_size("16".to_string()),
183 ),
184 ),
185 ).layout(WidgetLayout::new(4, 4, 0, 0))
186 ],
187 )
188 .description(Some("".to_string()))
189 .notify_list(Some(vec![]))
190 .template_variables(Some(vec![]));
191 let configuration = datadog::Configuration::new();
192 let api = DashboardsAPI::with_config(configuration);
193 let resp = api.create_dashboard(body).await;
194 if let Ok(value) = resp {
195 println!("{:#?}", value);
196 } else {
197 println!("{:#?}", resp.unwrap_err());
198 }
199}
Sourcepub fn title_align(self, value: WidgetTextAlign) -> Self
pub fn title_align(self, value: WidgetTextAlign) -> Self
Examples found in repository?
examples/v1_dashboards_CreateDashboard_145494973.rs (line 58)
20async fn main() {
21 let body =
22 Dashboard::new(
23 DashboardLayoutType::ORDERED,
24 "Example-Dashboard".to_string(),
25 vec![
26 Widget::new(
27 WidgetDefinition::TableWidgetDefinition(
28 Box::new(
29 TableWidgetDefinition::new(
30 vec![
31 TableWidgetRequest::new()
32 .queries(
33 vec![
34 FormulaAndFunctionQueryDefinition
35 ::FormulaAndFunctionApmResourceStatsQueryDefinition(
36 Box::new(
37 FormulaAndFunctionApmResourceStatsQueryDefinition::new(
38 FormulaAndFunctionApmResourceStatsDataSource
39 ::APM_RESOURCE_STATS,
40 "ci".to_string(),
41 "query1".to_string(),
42 "cassandra".to_string(),
43 FormulaAndFunctionApmResourceStatName::HITS,
44 )
45 .group_by(vec!["resource_name".to_string()])
46 .operation_name("cassandra.query".to_string())
47 .primary_tag_name("datacenter".to_string())
48 .primary_tag_value("edge-eu1.prod.dog".to_string()),
49 ),
50 )
51 ],
52 )
53 .response_format(FormulaAndFunctionResponseFormat::SCALAR)
54 ],
55 TableWidgetDefinitionType::QUERY_TABLE,
56 )
57 .title("".to_string())
58 .title_align(WidgetTextAlign::LEFT)
59 .title_size("16".to_string()),
60 ),
61 ),
62 ).layout(WidgetLayout::new(4, 4, 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}
More examples
examples/v1_dashboards_CreateDashboard_798168180.rs (line 58)
20async fn main() {
21 let body =
22 Dashboard::new(
23 DashboardLayoutType::ORDERED,
24 "Example-Dashboard".to_string(),
25 vec![
26 Widget::new(
27 WidgetDefinition::TableWidgetDefinition(
28 Box::new(
29 TableWidgetDefinition::new(
30 vec![
31 TableWidgetRequest::new()
32 .queries(
33 vec![
34 FormulaAndFunctionQueryDefinition
35 ::FormulaAndFunctionApmDependencyStatsQueryDefinition(
36 Box::new(
37 FormulaAndFunctionApmDependencyStatsQueryDefinition::new(
38 FormulaAndFunctionApmDependencyStatsDataSource
39 ::APM_DEPENDENCY_STATS,
40 "ci".to_string(),
41 "query1".to_string(),
42 "cassandra.query".to_string(),
43 "DELETE FROM monitor_history.monitor_state_change_history WHERE org_id = ? AND monitor_id IN ? AND group = ?".to_string(),
44 "cassandra".to_string(),
45 FormulaAndFunctionApmDependencyStatName::AVG_DURATION,
46 )
47 .primary_tag_name("datacenter".to_string())
48 .primary_tag_value("edge-eu1.prod.dog".to_string()),
49 ),
50 )
51 ],
52 )
53 .response_format(FormulaAndFunctionResponseFormat::SCALAR)
54 ],
55 TableWidgetDefinitionType::QUERY_TABLE,
56 )
57 .title("".to_string())
58 .title_align(WidgetTextAlign::LEFT)
59 .title_size("16".to_string()),
60 ),
61 ),
62 ).layout(WidgetLayout::new(4, 4, 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_2336428357.rs (line 87)
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 99)
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}
examples/v1_dashboards_CreateDashboard_794302680.rs (line 181)
28async fn main() {
29 let body =
30 Dashboard::new(
31 DashboardLayoutType::FREE,
32 "Example-Dashboard".to_string(),
33 vec![
34 Widget::new(
35 WidgetDefinition::TableWidgetDefinition(
36 Box::new(
37 TableWidgetDefinition::new(
38 vec![
39 TableWidgetRequest::new()
40 .formulas(vec![])
41 .queries(
42 vec![
43 FormulaAndFunctionQueryDefinition
44 ::FormulaAndFunctionMetricQueryDefinition(
45 Box::new(
46 FormulaAndFunctionMetricQueryDefinition::new(
47 FormulaAndFunctionMetricDataSource::METRICS,
48 "query1".to_string(),
49 "avg:aws.stream.globalaccelerator.processed_bytes_in{*} by {aws_account,acceleratoripaddress}".to_string(),
50 ).aggregator(FormulaAndFunctionMetricAggregation::AVG),
51 ),
52 ),
53 FormulaAndFunctionQueryDefinition
54 ::FormulaAndFunctionMetricQueryDefinition(
55 Box::new(
56 FormulaAndFunctionMetricQueryDefinition::new(
57 FormulaAndFunctionMetricDataSource::METRICS,
58 "query2".to_string(),
59 "avg:aws.stream.globalaccelerator.processed_bytes_out{*} by {aws_account,acceleratoripaddress}".to_string(),
60 ).aggregator(FormulaAndFunctionMetricAggregation::AVG),
61 ),
62 )
63 ],
64 )
65 .response_format(FormulaAndFunctionResponseFormat::SCALAR)
66 .text_formats(
67 vec![
68 vec![
69 TableWidgetTextFormatRule::new(
70 TableWidgetTextFormatMatch::new(
71 TableWidgetTextFormatMatchType::IS,
72 "fruit".to_string(),
73 ),
74 )
75 .palette(TableWidgetTextFormatPalette::WHITE_ON_RED)
76 .replace(
77 TableWidgetTextFormatReplace
78 ::TableWidgetTextFormatReplaceAll(
79 Box::new(
80 TableWidgetTextFormatReplaceAll::new(
81 TableWidgetTextFormatReplaceAllType::ALL,
82 "vegetable".to_string(),
83 ),
84 ),
85 ),
86 ),
87 TableWidgetTextFormatRule::new(
88 TableWidgetTextFormatMatch::new(
89 TableWidgetTextFormatMatchType::IS,
90 "animal".to_string(),
91 ),
92 )
93 .custom_bg_color("#632ca6".to_string())
94 .palette(TableWidgetTextFormatPalette::CUSTOM_BG),
95 TableWidgetTextFormatRule::new(
96 TableWidgetTextFormatMatch::new(
97 TableWidgetTextFormatMatchType::IS,
98 "robot".to_string(),
99 ),
100 ).palette(TableWidgetTextFormatPalette::RED_ON_WHITE),
101 TableWidgetTextFormatRule::new(
102 TableWidgetTextFormatMatch::new(
103 TableWidgetTextFormatMatchType::IS,
104 "ai".to_string(),
105 ),
106 ).palette(TableWidgetTextFormatPalette::YELLOW_ON_WHITE)
107 ],
108 vec![
109 TableWidgetTextFormatRule::new(
110 TableWidgetTextFormatMatch::new(
111 TableWidgetTextFormatMatchType::IS_NOT,
112 "xyz".to_string(),
113 ),
114 ).palette(TableWidgetTextFormatPalette::WHITE_ON_YELLOW)
115 ],
116 vec![
117 TableWidgetTextFormatRule::new(
118 TableWidgetTextFormatMatch::new(
119 TableWidgetTextFormatMatchType::CONTAINS,
120 "test".to_string(),
121 ),
122 )
123 .palette(TableWidgetTextFormatPalette::WHITE_ON_GREEN)
124 .replace(
125 TableWidgetTextFormatReplace
126 ::TableWidgetTextFormatReplaceAll(
127 Box::new(
128 TableWidgetTextFormatReplaceAll::new(
129 TableWidgetTextFormatReplaceAllType::ALL,
130 "vegetable".to_string(),
131 ),
132 ),
133 ),
134 )
135 ],
136 vec![
137 TableWidgetTextFormatRule::new(
138 TableWidgetTextFormatMatch::new(
139 TableWidgetTextFormatMatchType::DOES_NOT_CONTAIN,
140 "blah".to_string(),
141 ),
142 ).palette(TableWidgetTextFormatPalette::BLACK_ON_LIGHT_RED)
143 ],
144 vec![
145 TableWidgetTextFormatRule::new(
146 TableWidgetTextFormatMatch::new(
147 TableWidgetTextFormatMatchType::STARTS_WITH,
148 "abc".to_string(),
149 ),
150 ).palette(TableWidgetTextFormatPalette::BLACK_ON_LIGHT_YELLOW)
151 ],
152 vec![
153 TableWidgetTextFormatRule::new(
154 TableWidgetTextFormatMatch::new(
155 TableWidgetTextFormatMatchType::ENDS_WITH,
156 "xyz".to_string(),
157 ),
158 ).palette(TableWidgetTextFormatPalette::BLACK_ON_LIGHT_GREEN),
159 TableWidgetTextFormatRule::new(
160 TableWidgetTextFormatMatch::new(
161 TableWidgetTextFormatMatchType::ENDS_WITH,
162 "zzz".to_string(),
163 ),
164 ).palette(TableWidgetTextFormatPalette::GREEN_ON_WHITE),
165 TableWidgetTextFormatRule::new(
166 TableWidgetTextFormatMatch::new(
167 TableWidgetTextFormatMatchType::IS,
168 "animal".to_string(),
169 ),
170 )
171 .custom_fg_color("#632ca6".to_string())
172 .palette(TableWidgetTextFormatPalette::CUSTOM_TEXT)
173 ]
174 ],
175 )
176 ],
177 TableWidgetDefinitionType::QUERY_TABLE,
178 )
179 .has_search_bar(TableWidgetHasSearchBar::NEVER)
180 .title("".to_string())
181 .title_align(WidgetTextAlign::LEFT)
182 .title_size("16".to_string()),
183 ),
184 ),
185 ).layout(WidgetLayout::new(4, 4, 0, 0))
186 ],
187 )
188 .description(Some("".to_string()))
189 .notify_list(Some(vec![]))
190 .template_variables(Some(vec![]));
191 let configuration = datadog::Configuration::new();
192 let api = DashboardsAPI::with_config(configuration);
193 let resp = api.create_dashboard(body).await;
194 if let Ok(value) = resp {
195 println!("{:#?}", value);
196 } else {
197 println!("{:#?}", resp.unwrap_err());
198 }
199}
Sourcepub fn title_size(self, value: String) -> Self
pub fn title_size(self, value: String) -> Self
Examples found in repository?
examples/v1_dashboards_CreateDashboard_145494973.rs (line 59)
20async fn main() {
21 let body =
22 Dashboard::new(
23 DashboardLayoutType::ORDERED,
24 "Example-Dashboard".to_string(),
25 vec![
26 Widget::new(
27 WidgetDefinition::TableWidgetDefinition(
28 Box::new(
29 TableWidgetDefinition::new(
30 vec![
31 TableWidgetRequest::new()
32 .queries(
33 vec![
34 FormulaAndFunctionQueryDefinition
35 ::FormulaAndFunctionApmResourceStatsQueryDefinition(
36 Box::new(
37 FormulaAndFunctionApmResourceStatsQueryDefinition::new(
38 FormulaAndFunctionApmResourceStatsDataSource
39 ::APM_RESOURCE_STATS,
40 "ci".to_string(),
41 "query1".to_string(),
42 "cassandra".to_string(),
43 FormulaAndFunctionApmResourceStatName::HITS,
44 )
45 .group_by(vec!["resource_name".to_string()])
46 .operation_name("cassandra.query".to_string())
47 .primary_tag_name("datacenter".to_string())
48 .primary_tag_value("edge-eu1.prod.dog".to_string()),
49 ),
50 )
51 ],
52 )
53 .response_format(FormulaAndFunctionResponseFormat::SCALAR)
54 ],
55 TableWidgetDefinitionType::QUERY_TABLE,
56 )
57 .title("".to_string())
58 .title_align(WidgetTextAlign::LEFT)
59 .title_size("16".to_string()),
60 ),
61 ),
62 ).layout(WidgetLayout::new(4, 4, 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}
More examples
examples/v1_dashboards_CreateDashboard_798168180.rs (line 59)
20async fn main() {
21 let body =
22 Dashboard::new(
23 DashboardLayoutType::ORDERED,
24 "Example-Dashboard".to_string(),
25 vec![
26 Widget::new(
27 WidgetDefinition::TableWidgetDefinition(
28 Box::new(
29 TableWidgetDefinition::new(
30 vec![
31 TableWidgetRequest::new()
32 .queries(
33 vec![
34 FormulaAndFunctionQueryDefinition
35 ::FormulaAndFunctionApmDependencyStatsQueryDefinition(
36 Box::new(
37 FormulaAndFunctionApmDependencyStatsQueryDefinition::new(
38 FormulaAndFunctionApmDependencyStatsDataSource
39 ::APM_DEPENDENCY_STATS,
40 "ci".to_string(),
41 "query1".to_string(),
42 "cassandra.query".to_string(),
43 "DELETE FROM monitor_history.monitor_state_change_history WHERE org_id = ? AND monitor_id IN ? AND group = ?".to_string(),
44 "cassandra".to_string(),
45 FormulaAndFunctionApmDependencyStatName::AVG_DURATION,
46 )
47 .primary_tag_name("datacenter".to_string())
48 .primary_tag_value("edge-eu1.prod.dog".to_string()),
49 ),
50 )
51 ],
52 )
53 .response_format(FormulaAndFunctionResponseFormat::SCALAR)
54 ],
55 TableWidgetDefinitionType::QUERY_TABLE,
56 )
57 .title("".to_string())
58 .title_align(WidgetTextAlign::LEFT)
59 .title_size("16".to_string()),
60 ),
61 ),
62 ).layout(WidgetLayout::new(4, 4, 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_2336428357.rs (line 88)
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 100)
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}
examples/v1_dashboards_CreateDashboard_794302680.rs (line 182)
28async fn main() {
29 let body =
30 Dashboard::new(
31 DashboardLayoutType::FREE,
32 "Example-Dashboard".to_string(),
33 vec![
34 Widget::new(
35 WidgetDefinition::TableWidgetDefinition(
36 Box::new(
37 TableWidgetDefinition::new(
38 vec![
39 TableWidgetRequest::new()
40 .formulas(vec![])
41 .queries(
42 vec![
43 FormulaAndFunctionQueryDefinition
44 ::FormulaAndFunctionMetricQueryDefinition(
45 Box::new(
46 FormulaAndFunctionMetricQueryDefinition::new(
47 FormulaAndFunctionMetricDataSource::METRICS,
48 "query1".to_string(),
49 "avg:aws.stream.globalaccelerator.processed_bytes_in{*} by {aws_account,acceleratoripaddress}".to_string(),
50 ).aggregator(FormulaAndFunctionMetricAggregation::AVG),
51 ),
52 ),
53 FormulaAndFunctionQueryDefinition
54 ::FormulaAndFunctionMetricQueryDefinition(
55 Box::new(
56 FormulaAndFunctionMetricQueryDefinition::new(
57 FormulaAndFunctionMetricDataSource::METRICS,
58 "query2".to_string(),
59 "avg:aws.stream.globalaccelerator.processed_bytes_out{*} by {aws_account,acceleratoripaddress}".to_string(),
60 ).aggregator(FormulaAndFunctionMetricAggregation::AVG),
61 ),
62 )
63 ],
64 )
65 .response_format(FormulaAndFunctionResponseFormat::SCALAR)
66 .text_formats(
67 vec![
68 vec![
69 TableWidgetTextFormatRule::new(
70 TableWidgetTextFormatMatch::new(
71 TableWidgetTextFormatMatchType::IS,
72 "fruit".to_string(),
73 ),
74 )
75 .palette(TableWidgetTextFormatPalette::WHITE_ON_RED)
76 .replace(
77 TableWidgetTextFormatReplace
78 ::TableWidgetTextFormatReplaceAll(
79 Box::new(
80 TableWidgetTextFormatReplaceAll::new(
81 TableWidgetTextFormatReplaceAllType::ALL,
82 "vegetable".to_string(),
83 ),
84 ),
85 ),
86 ),
87 TableWidgetTextFormatRule::new(
88 TableWidgetTextFormatMatch::new(
89 TableWidgetTextFormatMatchType::IS,
90 "animal".to_string(),
91 ),
92 )
93 .custom_bg_color("#632ca6".to_string())
94 .palette(TableWidgetTextFormatPalette::CUSTOM_BG),
95 TableWidgetTextFormatRule::new(
96 TableWidgetTextFormatMatch::new(
97 TableWidgetTextFormatMatchType::IS,
98 "robot".to_string(),
99 ),
100 ).palette(TableWidgetTextFormatPalette::RED_ON_WHITE),
101 TableWidgetTextFormatRule::new(
102 TableWidgetTextFormatMatch::new(
103 TableWidgetTextFormatMatchType::IS,
104 "ai".to_string(),
105 ),
106 ).palette(TableWidgetTextFormatPalette::YELLOW_ON_WHITE)
107 ],
108 vec![
109 TableWidgetTextFormatRule::new(
110 TableWidgetTextFormatMatch::new(
111 TableWidgetTextFormatMatchType::IS_NOT,
112 "xyz".to_string(),
113 ),
114 ).palette(TableWidgetTextFormatPalette::WHITE_ON_YELLOW)
115 ],
116 vec![
117 TableWidgetTextFormatRule::new(
118 TableWidgetTextFormatMatch::new(
119 TableWidgetTextFormatMatchType::CONTAINS,
120 "test".to_string(),
121 ),
122 )
123 .palette(TableWidgetTextFormatPalette::WHITE_ON_GREEN)
124 .replace(
125 TableWidgetTextFormatReplace
126 ::TableWidgetTextFormatReplaceAll(
127 Box::new(
128 TableWidgetTextFormatReplaceAll::new(
129 TableWidgetTextFormatReplaceAllType::ALL,
130 "vegetable".to_string(),
131 ),
132 ),
133 ),
134 )
135 ],
136 vec![
137 TableWidgetTextFormatRule::new(
138 TableWidgetTextFormatMatch::new(
139 TableWidgetTextFormatMatchType::DOES_NOT_CONTAIN,
140 "blah".to_string(),
141 ),
142 ).palette(TableWidgetTextFormatPalette::BLACK_ON_LIGHT_RED)
143 ],
144 vec![
145 TableWidgetTextFormatRule::new(
146 TableWidgetTextFormatMatch::new(
147 TableWidgetTextFormatMatchType::STARTS_WITH,
148 "abc".to_string(),
149 ),
150 ).palette(TableWidgetTextFormatPalette::BLACK_ON_LIGHT_YELLOW)
151 ],
152 vec![
153 TableWidgetTextFormatRule::new(
154 TableWidgetTextFormatMatch::new(
155 TableWidgetTextFormatMatchType::ENDS_WITH,
156 "xyz".to_string(),
157 ),
158 ).palette(TableWidgetTextFormatPalette::BLACK_ON_LIGHT_GREEN),
159 TableWidgetTextFormatRule::new(
160 TableWidgetTextFormatMatch::new(
161 TableWidgetTextFormatMatchType::ENDS_WITH,
162 "zzz".to_string(),
163 ),
164 ).palette(TableWidgetTextFormatPalette::GREEN_ON_WHITE),
165 TableWidgetTextFormatRule::new(
166 TableWidgetTextFormatMatch::new(
167 TableWidgetTextFormatMatchType::IS,
168 "animal".to_string(),
169 ),
170 )
171 .custom_fg_color("#632ca6".to_string())
172 .palette(TableWidgetTextFormatPalette::CUSTOM_TEXT)
173 ]
174 ],
175 )
176 ],
177 TableWidgetDefinitionType::QUERY_TABLE,
178 )
179 .has_search_bar(TableWidgetHasSearchBar::NEVER)
180 .title("".to_string())
181 .title_align(WidgetTextAlign::LEFT)
182 .title_size("16".to_string()),
183 ),
184 ),
185 ).layout(WidgetLayout::new(4, 4, 0, 0))
186 ],
187 )
188 .description(Some("".to_string()))
189 .notify_list(Some(vec![]))
190 .template_variables(Some(vec![]));
191 let configuration = datadog::Configuration::new();
192 let api = DashboardsAPI::with_config(configuration);
193 let resp = api.create_dashboard(body).await;
194 if let Ok(value) = resp {
195 println!("{:#?}", value);
196 } else {
197 println!("{:#?}", resp.unwrap_err());
198 }
199}
pub fn additional_properties(self, value: BTreeMap<String, Value>) -> Self
Trait Implementations§
Source§impl Clone for TableWidgetDefinition
impl Clone for TableWidgetDefinition
Source§fn clone(&self) -> TableWidgetDefinition
fn clone(&self) -> TableWidgetDefinition
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 TableWidgetDefinition
impl Debug for TableWidgetDefinition
Source§impl<'de> Deserialize<'de> for TableWidgetDefinition
impl<'de> Deserialize<'de> for TableWidgetDefinition
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 TableWidgetDefinition
impl PartialEq for TableWidgetDefinition
Source§impl Serialize for TableWidgetDefinition
impl Serialize for TableWidgetDefinition
impl StructuralPartialEq for TableWidgetDefinition
Auto Trait Implementations§
impl Freeze for TableWidgetDefinition
impl RefUnwindSafe for TableWidgetDefinition
impl Send for TableWidgetDefinition
impl Sync for TableWidgetDefinition
impl Unpin for TableWidgetDefinition
impl UnwindSafe for TableWidgetDefinition
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