1use super::*;
2
3use chrono::{DateTime, Utc};
4use serde::{Deserialize, Serialize};
5
6#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7pub struct Environment {
8 pub id: String,
9 pub name: String,
10 pub username: String,
11 pub image_id: String,
12 pub image_tag: String,
13 pub image_digest: String,
14 pub organization_id: String,
15 pub user_id: String,
16 pub last_built_at: DateTime<Utc>,
17 pub cpu_cores: f64,
18 pub memory_gb: i64,
19 pub disk_gb: i64,
20 pub gpus: i64,
21 pub latest_stat: EnvironmentStat,
22 pub updating: bool,
23 pub rebuild_messages: Vec<RebuildMessage>,
24 pub last_opened_at: DateTime<Utc>,
25 pub last_connection_at: DateTime<Utc>,
26 pub auto_off_threshold: Duration,
27 pub service_ids: Vec<String>,
28 pub created_at: DateTime<Utc>,
29 pub updated_at: DateTime<Utc>,
30}
31
32#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
33pub struct RebuildMessage {
34 pub text: String,
35 pub required: bool,
36}
37
38#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
39pub struct EnvironmentStat {
40 pub time: DateTime<Utc>,
41 pub last_online: String,
42 pub container_status: ContainerStatus,
43 pub stat_error: String,
44 pub cpu_usage: f32,
45 pub memory_total: i64,
46 pub memory_usage: f32,
47 pub disk_total: i64,
48 pub disk_used: i64,
49 pub service_stat: Vec<ServiceStat>,
50}
51
52#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
53pub enum ContainerStatus {
54 CREATING,
55 OFF,
56 ON,
57 FAILED,
58 UNKNOWN,
59}