fastly_api/models/
dashboard_item_property_visualization_property_config.rs

1/*
2 * Fastly API
3 *
4 * Via the Fastly API you can perform any of the operations that are possible within the management console,  including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/) 
5 *
6 */
7
8/// DashboardItemPropertyVisualizationPropertyConfig : [Configuration options](#visualization-config) for the given visualization.
9
10
11
12#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
13pub struct DashboardItemPropertyVisualizationPropertyConfig {
14    /// The type of chart to display. 
15    #[serde(rename = "plot_type")]
16    pub plot_type: PlotType,
17    /// (Optional) The units to use to format the data. 
18    #[serde(rename = "format", skip_serializing_if = "Option::is_none")]
19    pub format: Option<Format>,
20    /// (Optional) The aggregation function to apply to the dataset. 
21    #[serde(rename = "calculation_method", skip_serializing_if = "Option::is_none")]
22    pub calculation_method: Option<CalculationMethod>,
23}
24
25impl DashboardItemPropertyVisualizationPropertyConfig {
26    /// [Configuration options](#visualization-config) for the given visualization.
27    pub fn new(plot_type: PlotType) -> DashboardItemPropertyVisualizationPropertyConfig {
28        DashboardItemPropertyVisualizationPropertyConfig {
29            plot_type,
30            format: None,
31            calculation_method: None,
32        }
33    }
34}
35
36/// The type of chart to display. 
37#[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/// (Optional) The units to use to format the data. 
55#[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/// (Optional) The aggregation function to apply to the dataset. 
83#[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