fastly_api/models/
dashboard_item_property_visualization_property_config.rs1#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
13pub struct DashboardItemPropertyVisualizationPropertyConfig {
14 #[serde(rename = "plot_type")]
16 pub plot_type: PlotType,
17 #[serde(rename = "format", skip_serializing_if = "Option::is_none")]
19 pub format: Option<Format>,
20 #[serde(rename = "calculation_method", skip_serializing_if = "Option::is_none")]
22 pub calculation_method: Option<CalculationMethod>,
23}
24
25impl DashboardItemPropertyVisualizationPropertyConfig {
26 pub fn new(plot_type: PlotType) -> DashboardItemPropertyVisualizationPropertyConfig {
28 DashboardItemPropertyVisualizationPropertyConfig {
29 plot_type,
30 format: None,
31 calculation_method: None,
32 }
33 }
34}
35
36#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
38pub enum PlotType {
39 #[serde(rename = "line")]
40 Line,
41 #[serde(rename = "bar")]
42 Bar,
43 #[serde(rename = "single-metric")]
44 SingleMetric,
45 #[serde(rename = "donut")]
46 Donut,
47}
48
49impl Default for PlotType {
50 fn default() -> PlotType {
51 Self::Line
52 }
53}
54#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
56pub enum Format {
57 #[serde(rename = "number")]
58 Number,
59 #[serde(rename = "bytes")]
60 Bytes,
61 #[serde(rename = "percent")]
62 Percent,
63 #[serde(rename = "requests")]
64 Requests,
65 #[serde(rename = "responses")]
66 Responses,
67 #[serde(rename = "seconds")]
68 Seconds,
69 #[serde(rename = "milliseconds")]
70 Milliseconds,
71 #[serde(rename = "ratio")]
72 Ratio,
73 #[serde(rename = "bitrate")]
74 Bitrate,
75}
76
77impl Default for Format {
78 fn default() -> Format {
79 Self::Number
80 }
81}
82#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
84pub enum CalculationMethod {
85 #[serde(rename = "avg")]
86 Avg,
87 #[serde(rename = "sum")]
88 Sum,
89 #[serde(rename = "min")]
90 Min,
91 #[serde(rename = "max")]
92 Max,
93 #[serde(rename = "latest")]
94 Latest,
95 #[serde(rename = "p95")]
96 P95,
97}
98
99impl Default for CalculationMethod {
100 fn default() -> CalculationMethod {
101 Self::Avg
102 }
103}
104