#[non_exhaustive]pub struct WidgetFormulaStyle {
pub palette: Option<String>,
pub palette_index: Option<i64>,
pub additional_properties: BTreeMap<String, Value>,
/* private fields */
}Expand description
Styling options for widget formulas.
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>The color palette used to display the formula. A guide to the available color palettes can be found at https://docs.datadoghq.com/dashboards/guide/widget_colors
palette_index: Option<i64>Index specifying which color to use within the palette.
additional_properties: BTreeMap<String, Value>Implementations§
source§impl WidgetFormulaStyle
impl WidgetFormulaStyle
sourcepub fn new() -> WidgetFormulaStyle
pub fn new() -> WidgetFormulaStyle
Examples found in repository?
examples/v1_dashboards_CreateDashboard_41622531.rs (line 46)
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
async fn main() {
let body =
Dashboard::new(
DashboardLayoutType::ORDERED,
"Example-Dashboard with formula style".to_string(),
vec![
Widget::new(
WidgetDefinition::TimeseriesWidgetDefinition(
Box::new(
TimeseriesWidgetDefinition::new(
vec![
TimeseriesWidgetRequest::new()
.display_type(WidgetDisplayType::LINE)
.formulas(
vec![
WidgetFormula::new(
"query1".to_string(),
).style(
WidgetFormulaStyle::new()
.palette("classic".to_string())
.palette_index(4),
)
],
)
.queries(
vec![
FormulaAndFunctionQueryDefinition
::FormulaAndFunctionMetricQueryDefinition(
Box::new(
FormulaAndFunctionMetricQueryDefinition::new(
FormulaAndFunctionMetricDataSource::METRICS,
"query1".to_string(),
"avg:system.cpu.user{*}".to_string(),
),
),
)
],
)
.response_format(FormulaAndFunctionResponseFormat::TIMESERIES)
.style(
WidgetRequestStyle::new()
.line_type(WidgetLineType::SOLID)
.line_width(WidgetLineWidth::NORMAL)
.palette("dog_classic".to_string()),
)
],
TimeseriesWidgetDefinitionType::TIMESERIES,
)
.legend_columns(
vec![
TimeseriesWidgetLegendColumn::AVG,
TimeseriesWidgetLegendColumn::MIN,
TimeseriesWidgetLegendColumn::MAX,
TimeseriesWidgetLegendColumn::VALUE,
TimeseriesWidgetLegendColumn::SUM
],
)
.legend_layout(TimeseriesWidgetLegendLayout::AUTO)
.show_legend(true)
.time(WidgetTime::WidgetLegacyLiveSpan(Box::new(WidgetLegacyLiveSpan::new())))
.title("styled timeseries".to_string()),
),
),
)
],
).reflow_type(DashboardReflowType::AUTO);
let configuration = datadog::Configuration::new();
let api = DashboardsAPI::with_config(configuration);
let resp = api.create_dashboard(body).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}sourcepub fn palette(self, value: String) -> Self
pub fn palette(self, value: String) -> Self
Examples found in repository?
examples/v1_dashboards_CreateDashboard_41622531.rs (line 47)
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
async fn main() {
let body =
Dashboard::new(
DashboardLayoutType::ORDERED,
"Example-Dashboard with formula style".to_string(),
vec![
Widget::new(
WidgetDefinition::TimeseriesWidgetDefinition(
Box::new(
TimeseriesWidgetDefinition::new(
vec![
TimeseriesWidgetRequest::new()
.display_type(WidgetDisplayType::LINE)
.formulas(
vec![
WidgetFormula::new(
"query1".to_string(),
).style(
WidgetFormulaStyle::new()
.palette("classic".to_string())
.palette_index(4),
)
],
)
.queries(
vec![
FormulaAndFunctionQueryDefinition
::FormulaAndFunctionMetricQueryDefinition(
Box::new(
FormulaAndFunctionMetricQueryDefinition::new(
FormulaAndFunctionMetricDataSource::METRICS,
"query1".to_string(),
"avg:system.cpu.user{*}".to_string(),
),
),
)
],
)
.response_format(FormulaAndFunctionResponseFormat::TIMESERIES)
.style(
WidgetRequestStyle::new()
.line_type(WidgetLineType::SOLID)
.line_width(WidgetLineWidth::NORMAL)
.palette("dog_classic".to_string()),
)
],
TimeseriesWidgetDefinitionType::TIMESERIES,
)
.legend_columns(
vec![
TimeseriesWidgetLegendColumn::AVG,
TimeseriesWidgetLegendColumn::MIN,
TimeseriesWidgetLegendColumn::MAX,
TimeseriesWidgetLegendColumn::VALUE,
TimeseriesWidgetLegendColumn::SUM
],
)
.legend_layout(TimeseriesWidgetLegendLayout::AUTO)
.show_legend(true)
.time(WidgetTime::WidgetLegacyLiveSpan(Box::new(WidgetLegacyLiveSpan::new())))
.title("styled timeseries".to_string()),
),
),
)
],
).reflow_type(DashboardReflowType::AUTO);
let configuration = datadog::Configuration::new();
let api = DashboardsAPI::with_config(configuration);
let resp = api.create_dashboard(body).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}sourcepub fn palette_index(self, value: i64) -> Self
pub fn palette_index(self, value: i64) -> Self
Examples found in repository?
examples/v1_dashboards_CreateDashboard_41622531.rs (line 48)
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
async fn main() {
let body =
Dashboard::new(
DashboardLayoutType::ORDERED,
"Example-Dashboard with formula style".to_string(),
vec![
Widget::new(
WidgetDefinition::TimeseriesWidgetDefinition(
Box::new(
TimeseriesWidgetDefinition::new(
vec![
TimeseriesWidgetRequest::new()
.display_type(WidgetDisplayType::LINE)
.formulas(
vec![
WidgetFormula::new(
"query1".to_string(),
).style(
WidgetFormulaStyle::new()
.palette("classic".to_string())
.palette_index(4),
)
],
)
.queries(
vec![
FormulaAndFunctionQueryDefinition
::FormulaAndFunctionMetricQueryDefinition(
Box::new(
FormulaAndFunctionMetricQueryDefinition::new(
FormulaAndFunctionMetricDataSource::METRICS,
"query1".to_string(),
"avg:system.cpu.user{*}".to_string(),
),
),
)
],
)
.response_format(FormulaAndFunctionResponseFormat::TIMESERIES)
.style(
WidgetRequestStyle::new()
.line_type(WidgetLineType::SOLID)
.line_width(WidgetLineWidth::NORMAL)
.palette("dog_classic".to_string()),
)
],
TimeseriesWidgetDefinitionType::TIMESERIES,
)
.legend_columns(
vec![
TimeseriesWidgetLegendColumn::AVG,
TimeseriesWidgetLegendColumn::MIN,
TimeseriesWidgetLegendColumn::MAX,
TimeseriesWidgetLegendColumn::VALUE,
TimeseriesWidgetLegendColumn::SUM
],
)
.legend_layout(TimeseriesWidgetLegendLayout::AUTO)
.show_legend(true)
.time(WidgetTime::WidgetLegacyLiveSpan(Box::new(WidgetLegacyLiveSpan::new())))
.title("styled timeseries".to_string()),
),
),
)
],
).reflow_type(DashboardReflowType::AUTO);
let configuration = datadog::Configuration::new();
let api = DashboardsAPI::with_config(configuration);
let resp = api.create_dashboard(body).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}pub fn additional_properties(self, value: BTreeMap<String, Value>) -> Self
Trait Implementations§
source§impl Clone for WidgetFormulaStyle
impl Clone for WidgetFormulaStyle
source§fn clone(&self) -> WidgetFormulaStyle
fn clone(&self) -> WidgetFormulaStyle
Returns a copy 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 WidgetFormulaStyle
impl Debug for WidgetFormulaStyle
source§impl Default for WidgetFormulaStyle
impl Default for WidgetFormulaStyle
source§impl<'de> Deserialize<'de> for WidgetFormulaStyle
impl<'de> Deserialize<'de> for WidgetFormulaStyle
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 WidgetFormulaStyle
impl PartialEq for WidgetFormulaStyle
source§impl Serialize for WidgetFormulaStyle
impl Serialize for WidgetFormulaStyle
impl StructuralPartialEq for WidgetFormulaStyle
Auto Trait Implementations§
impl Freeze for WidgetFormulaStyle
impl RefUnwindSafe for WidgetFormulaStyle
impl Send for WidgetFormulaStyle
impl Sync for WidgetFormulaStyle
impl Unpin for WidgetFormulaStyle
impl UnwindSafe for WidgetFormulaStyle
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)