platz_sdk/types/
deployment_status.rs1use rust_decimal::Decimal;
2use serde::Serialize;
3use strum::Display;
4
5#[derive(Debug, Clone, Serialize)]
6pub struct PlatzStatus<SN>
7where
8 SN: Clone + Serialize,
9{
10 pub status: Status<SN>,
11 pub primary_metric: Option<Metric>,
12 pub metrics: Option<Vec<Metric>>,
13 pub notices: Vec<Notice>,
14}
15
16#[derive(Debug, Clone, Serialize, Display)]
17#[serde(rename_all = "lowercase")]
18pub enum StatusColor {
19 #[strum(serialize = "primary")]
20 Primary,
21 #[strum(serialize = "success")]
22 Success,
23 #[strum(serialize = "danger")]
24 Danger,
25 #[strum(serialize = "warning")]
26 Warning,
27 #[strum(serialize = "secondary")]
28 Secondary,
29}
30
31#[derive(Debug, Clone, Serialize)]
32pub struct Status<SN>
33where
34 SN: Clone + Serialize,
35{
36 pub name: SN,
37 pub color: StatusColor,
38}
39
40#[derive(Debug, Clone, Serialize)]
41pub struct Metric {
42 pub value: Decimal,
43 pub unit: String,
44 pub short_description: String,
45 pub color: Option<StatusColor>,
46}
47
48#[derive(Debug, Clone, Serialize, Display)]
49pub enum NoticeLevel {
50 Info,
51 Warning,
52 Danger,
53}
54
55#[derive(Debug, Clone, Serialize)]
56pub struct Notice {
57 pub level: NoticeLevel,
58 pub text: String,
59}