reduct_base/msg/
server_api.rs1use crate::msg::bucket_api::{BucketInfo, BucketSettings};
7use chrono::{DateTime, Utc};
8use serde::{Deserialize, Serialize};
9use std::fmt::{Display, Formatter};
10
11#[derive(Debug, Clone, Deserialize, Serialize, PartialEq)]
14pub struct License {
15 pub licensee: String,
17 pub invoice: String,
19 pub expiry_date: DateTime<Utc>,
21 pub plan: String,
23 pub device_number: u32,
25 pub disk_quota: i32,
27 #[serde(default)]
29 pub fingerprint: String,
30}
31
32impl Display for License {
33 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
34 write!(
35 f,
36 "\n\tLicensee: {}\n\tInvoice: {}\n\tExpiry Date: {}\n\tPlan: {}\n\tNumber of Devices: {}\n\tDisk Quota: {} TB,\n\tFingerprint: {}",
37 self.licensee, self.invoice, self.expiry_date, self.plan, self.device_number, self.disk_quota, self.fingerprint
38 )
39 }
40}
41
42#[derive(Serialize, Deserialize, Default, Clone, Debug, PartialEq)]
44pub struct ServerInfo {
45 pub version: String,
47 pub bucket_count: u64,
49 pub usage: u64,
51 pub uptime: u64,
53 pub oldest_record: u64,
55 pub latest_record: u64,
57 pub defaults: Defaults,
59 pub license: Option<License>,
61}
62
63#[derive(Serialize, Deserialize, Default, Clone, Debug, PartialEq)]
65pub struct Defaults {
66 pub bucket: BucketSettings,
67}
68
69#[derive(Serialize, Deserialize, Default, Clone, Debug, PartialEq)]
71pub struct BucketInfoList {
72 pub buckets: Vec<BucketInfo>,
73}