#[non_exhaustive]pub struct WidgetStyle {
pub palette: Option<String>,
pub additional_properties: BTreeMap<String, Value>,
/* private fields */
}
Expand description
Widget style definition.
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.palette: Option<String>
Color palette to apply to the widget.
additional_properties: BTreeMap<String, Value>
Implementations§
Source§impl WidgetStyle
impl WidgetStyle
Sourcepub fn new() -> WidgetStyle
pub fn new() -> WidgetStyle
Examples found in repository?
examples/v1_dashboards_CreateDashboard_1177423752.rs (line 27)
18async fn main() {
19 let body = Dashboard::new(
20 DashboardLayoutType::FREE,
21 "Example-Dashboard".to_string(),
22 vec![
23 Widget::new(WidgetDefinition::HeatMapWidgetDefinition(Box::new(
24 HeatMapWidgetDefinition::new(
25 vec![HeatMapWidgetRequest::new()
26 .q("avg:system.cpu.user{*} by {service}".to_string())
27 .style(WidgetStyle::new().palette("dog_classic".to_string()))],
28 HeatMapWidgetDefinitionType::HEATMAP,
29 )
30 .time(WidgetTime::WidgetLegacyLiveSpan(Box::new(
31 WidgetLegacyLiveSpan::new(),
32 )))
33 .title("".to_string())
34 .title_align(WidgetTextAlign::LEFT)
35 .title_size("16".to_string()),
36 )))
37 .layout(WidgetLayout::new(15, 47, 0, 0)),
38 ],
39 )
40 .description(None)
41 .notify_list(Some(vec![]))
42 .template_variables(Some(vec![]));
43 let configuration = datadog::Configuration::new();
44 let api = DashboardsAPI::with_config(configuration);
45 let resp = api.create_dashboard(body).await;
46 if let Ok(value) = resp {
47 println!("{:#?}", value);
48 } else {
49 println!("{:#?}", resp.unwrap_err());
50 }
51}
More examples
examples/v1_dashboards_CreateDashboard_2705593938.rs (line 50)
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_3777304439.rs (line 51)
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_252716965.rs (line 49)
24async fn main() {
25 let body =
26 Dashboard::new(
27 DashboardLayoutType::ORDERED,
28 "Example-Dashboard".to_string(),
29 vec![
30 Widget::new(
31 WidgetDefinition::DistributionWidgetDefinition(
32 Box::new(
33 DistributionWidgetDefinition::new(
34 vec![
35 DistributionWidgetRequest::new()
36 .query(
37 DistributionWidgetHistogramRequestQuery
38 ::FormulaAndFunctionMetricQueryDefinition(
39 Box::new(
40 FormulaAndFunctionMetricQueryDefinition::new(
41 FormulaAndFunctionMetricDataSource::METRICS,
42 "query1".to_string(),
43 "histogram:trace.Load{*}".to_string(),
44 ),
45 ),
46 ),
47 )
48 .request_type(DistributionWidgetHistogramRequestType::HISTOGRAM)
49 .style(WidgetStyle::new().palette("dog_classic".to_string()))
50 ],
51 DistributionWidgetDefinitionType::DISTRIBUTION,
52 )
53 .custom_links(
54 vec![
55 WidgetCustomLink::new()
56 .label("Example".to_string())
57 .link("https://example.org/".to_string())
58 ],
59 )
60 .show_legend(false)
61 .title("Metrics HOP".to_string())
62 .title_align(WidgetTextAlign::LEFT)
63 .title_size("16".to_string())
64 .xaxis(
65 DistributionWidgetXAxis::new()
66 .include_zero(true)
67 .max("auto".to_string())
68 .min("auto".to_string())
69 .scale("linear".to_string()),
70 )
71 .yaxis(
72 DistributionWidgetYAxis::new()
73 .include_zero(true)
74 .max("auto".to_string())
75 .min("auto".to_string())
76 .scale("linear".to_string()),
77 ),
78 ),
79 ),
80 ).layout(WidgetLayout::new(2, 4, 0, 0))
81 ],
82 );
83 let configuration = datadog::Configuration::new();
84 let api = DashboardsAPI::with_config(configuration);
85 let resp = api.create_dashboard(body).await;
86 if let Ok(value) = resp {
87 println!("{:#?}", value);
88 } else {
89 println!("{:#?}", resp.unwrap_err());
90 }
91}
examples/v1_dashboards_CreateDashboard_1442588603.rs (line 56)
24async fn main() {
25 let body =
26 Dashboard::new(
27 DashboardLayoutType::ORDERED,
28 "Example-Dashboard".to_string(),
29 vec![
30 Widget::new(
31 WidgetDefinition::DistributionWidgetDefinition(
32 Box::new(
33 DistributionWidgetDefinition::new(
34 vec![
35 DistributionWidgetRequest::new()
36 .query(
37 DistributionWidgetHistogramRequestQuery
38 ::FormulaAndFunctionApmResourceStatsQueryDefinition(
39 Box::new(
40 FormulaAndFunctionApmResourceStatsQueryDefinition::new(
41 FormulaAndFunctionApmResourceStatsDataSource
42 ::APM_RESOURCE_STATS,
43 "staging".to_string(),
44 "query1".to_string(),
45 "azure-bill-import".to_string(),
46 FormulaAndFunctionApmResourceStatName::LATENCY_DISTRIBUTION,
47 )
48 .group_by(vec!["resource_name".to_string()])
49 .operation_name("universal.http.client".to_string())
50 .primary_tag_name("datacenter".to_string())
51 .primary_tag_value("*".to_string()),
52 ),
53 ),
54 )
55 .request_type(DistributionWidgetHistogramRequestType::HISTOGRAM)
56 .style(WidgetStyle::new().palette("dog_classic".to_string()))
57 ],
58 DistributionWidgetDefinitionType::DISTRIBUTION,
59 )
60 .show_legend(false)
61 .title("APM Stats - Request latency HOP".to_string())
62 .title_align(WidgetTextAlign::LEFT)
63 .title_size("16".to_string())
64 .xaxis(
65 DistributionWidgetXAxis::new()
66 .include_zero(true)
67 .max("auto".to_string())
68 .min("auto".to_string())
69 .scale("linear".to_string()),
70 )
71 .yaxis(
72 DistributionWidgetYAxis::new()
73 .include_zero(true)
74 .max("auto".to_string())
75 .min("auto".to_string())
76 .scale("linear".to_string()),
77 ),
78 ),
79 ),
80 ).layout(WidgetLayout::new(2, 4, 8, 0))
81 ],
82 ).description(Some("".to_string()));
83 let configuration = datadog::Configuration::new();
84 let api = DashboardsAPI::with_config(configuration);
85 let resp = api.create_dashboard(body).await;
86 if let Ok(value) = resp {
87 println!("{:#?}", value);
88 } else {
89 println!("{:#?}", resp.unwrap_err());
90 }
91}
Sourcepub fn palette(self, value: String) -> Self
pub fn palette(self, value: String) -> Self
Examples found in repository?
examples/v1_dashboards_CreateDashboard_1177423752.rs (line 27)
18async fn main() {
19 let body = Dashboard::new(
20 DashboardLayoutType::FREE,
21 "Example-Dashboard".to_string(),
22 vec![
23 Widget::new(WidgetDefinition::HeatMapWidgetDefinition(Box::new(
24 HeatMapWidgetDefinition::new(
25 vec![HeatMapWidgetRequest::new()
26 .q("avg:system.cpu.user{*} by {service}".to_string())
27 .style(WidgetStyle::new().palette("dog_classic".to_string()))],
28 HeatMapWidgetDefinitionType::HEATMAP,
29 )
30 .time(WidgetTime::WidgetLegacyLiveSpan(Box::new(
31 WidgetLegacyLiveSpan::new(),
32 )))
33 .title("".to_string())
34 .title_align(WidgetTextAlign::LEFT)
35 .title_size("16".to_string()),
36 )))
37 .layout(WidgetLayout::new(15, 47, 0, 0)),
38 ],
39 )
40 .description(None)
41 .notify_list(Some(vec![]))
42 .template_variables(Some(vec![]));
43 let configuration = datadog::Configuration::new();
44 let api = DashboardsAPI::with_config(configuration);
45 let resp = api.create_dashboard(body).await;
46 if let Ok(value) = resp {
47 println!("{:#?}", value);
48 } else {
49 println!("{:#?}", resp.unwrap_err());
50 }
51}
More examples
examples/v1_dashboards_CreateDashboard_2705593938.rs (line 50)
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_3777304439.rs (line 51)
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_252716965.rs (line 49)
24async fn main() {
25 let body =
26 Dashboard::new(
27 DashboardLayoutType::ORDERED,
28 "Example-Dashboard".to_string(),
29 vec![
30 Widget::new(
31 WidgetDefinition::DistributionWidgetDefinition(
32 Box::new(
33 DistributionWidgetDefinition::new(
34 vec![
35 DistributionWidgetRequest::new()
36 .query(
37 DistributionWidgetHistogramRequestQuery
38 ::FormulaAndFunctionMetricQueryDefinition(
39 Box::new(
40 FormulaAndFunctionMetricQueryDefinition::new(
41 FormulaAndFunctionMetricDataSource::METRICS,
42 "query1".to_string(),
43 "histogram:trace.Load{*}".to_string(),
44 ),
45 ),
46 ),
47 )
48 .request_type(DistributionWidgetHistogramRequestType::HISTOGRAM)
49 .style(WidgetStyle::new().palette("dog_classic".to_string()))
50 ],
51 DistributionWidgetDefinitionType::DISTRIBUTION,
52 )
53 .custom_links(
54 vec![
55 WidgetCustomLink::new()
56 .label("Example".to_string())
57 .link("https://example.org/".to_string())
58 ],
59 )
60 .show_legend(false)
61 .title("Metrics HOP".to_string())
62 .title_align(WidgetTextAlign::LEFT)
63 .title_size("16".to_string())
64 .xaxis(
65 DistributionWidgetXAxis::new()
66 .include_zero(true)
67 .max("auto".to_string())
68 .min("auto".to_string())
69 .scale("linear".to_string()),
70 )
71 .yaxis(
72 DistributionWidgetYAxis::new()
73 .include_zero(true)
74 .max("auto".to_string())
75 .min("auto".to_string())
76 .scale("linear".to_string()),
77 ),
78 ),
79 ),
80 ).layout(WidgetLayout::new(2, 4, 0, 0))
81 ],
82 );
83 let configuration = datadog::Configuration::new();
84 let api = DashboardsAPI::with_config(configuration);
85 let resp = api.create_dashboard(body).await;
86 if let Ok(value) = resp {
87 println!("{:#?}", value);
88 } else {
89 println!("{:#?}", resp.unwrap_err());
90 }
91}
examples/v1_dashboards_CreateDashboard_1442588603.rs (line 56)
24async fn main() {
25 let body =
26 Dashboard::new(
27 DashboardLayoutType::ORDERED,
28 "Example-Dashboard".to_string(),
29 vec![
30 Widget::new(
31 WidgetDefinition::DistributionWidgetDefinition(
32 Box::new(
33 DistributionWidgetDefinition::new(
34 vec![
35 DistributionWidgetRequest::new()
36 .query(
37 DistributionWidgetHistogramRequestQuery
38 ::FormulaAndFunctionApmResourceStatsQueryDefinition(
39 Box::new(
40 FormulaAndFunctionApmResourceStatsQueryDefinition::new(
41 FormulaAndFunctionApmResourceStatsDataSource
42 ::APM_RESOURCE_STATS,
43 "staging".to_string(),
44 "query1".to_string(),
45 "azure-bill-import".to_string(),
46 FormulaAndFunctionApmResourceStatName::LATENCY_DISTRIBUTION,
47 )
48 .group_by(vec!["resource_name".to_string()])
49 .operation_name("universal.http.client".to_string())
50 .primary_tag_name("datacenter".to_string())
51 .primary_tag_value("*".to_string()),
52 ),
53 ),
54 )
55 .request_type(DistributionWidgetHistogramRequestType::HISTOGRAM)
56 .style(WidgetStyle::new().palette("dog_classic".to_string()))
57 ],
58 DistributionWidgetDefinitionType::DISTRIBUTION,
59 )
60 .show_legend(false)
61 .title("APM Stats - Request latency HOP".to_string())
62 .title_align(WidgetTextAlign::LEFT)
63 .title_size("16".to_string())
64 .xaxis(
65 DistributionWidgetXAxis::new()
66 .include_zero(true)
67 .max("auto".to_string())
68 .min("auto".to_string())
69 .scale("linear".to_string()),
70 )
71 .yaxis(
72 DistributionWidgetYAxis::new()
73 .include_zero(true)
74 .max("auto".to_string())
75 .min("auto".to_string())
76 .scale("linear".to_string()),
77 ),
78 ),
79 ),
80 ).layout(WidgetLayout::new(2, 4, 8, 0))
81 ],
82 ).description(Some("".to_string()));
83 let configuration = datadog::Configuration::new();
84 let api = DashboardsAPI::with_config(configuration);
85 let resp = api.create_dashboard(body).await;
86 if let Ok(value) = resp {
87 println!("{:#?}", value);
88 } else {
89 println!("{:#?}", resp.unwrap_err());
90 }
91}
pub fn additional_properties(self, value: BTreeMap<String, Value>) -> Self
Trait Implementations§
Source§impl Clone for WidgetStyle
impl Clone for WidgetStyle
Source§fn clone(&self) -> WidgetStyle
fn clone(&self) -> WidgetStyle
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 WidgetStyle
impl Debug for WidgetStyle
Source§impl Default for WidgetStyle
impl Default for WidgetStyle
Source§impl<'de> Deserialize<'de> for WidgetStyle
impl<'de> Deserialize<'de> for WidgetStyle
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 WidgetStyle
impl PartialEq for WidgetStyle
Source§impl Serialize for WidgetStyle
impl Serialize for WidgetStyle
impl StructuralPartialEq for WidgetStyle
Auto Trait Implementations§
impl Freeze for WidgetStyle
impl RefUnwindSafe for WidgetStyle
impl Send for WidgetStyle
impl Sync for WidgetStyle
impl Unpin for WidgetStyle
impl UnwindSafe for WidgetStyle
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