alien_core/deployment/
status.rs1use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7#[cfg_attr(feature = "openapi", derive(utoipa::ToSchema))]
8#[serde(rename_all = "kebab-case")]
9pub enum DeploymentStatus {
10 Pending,
11 PreflightsFailed,
12 InitialSetup,
13 InitialSetupFailed,
14 Provisioning,
15 ProvisioningFailed,
16 Running,
17 RefreshFailed,
18 UpdatePending,
19 Updating,
20 UpdateFailed,
21 DeletePending,
22 Deleting,
23 DeleteFailed,
24 TeardownRequired,
25 TeardownFailed,
26 Deleted,
27 Error,
28}
29
30impl DeploymentStatus {
31 pub fn is_synced(&self) -> bool {
41 matches!(
42 self,
43 DeploymentStatus::Running
44 | DeploymentStatus::PreflightsFailed
45 | DeploymentStatus::InitialSetupFailed
46 | DeploymentStatus::ProvisioningFailed
47 | DeploymentStatus::UpdateFailed
48 | DeploymentStatus::DeleteFailed
49 | DeploymentStatus::TeardownRequired
50 | DeploymentStatus::TeardownFailed
51 | DeploymentStatus::RefreshFailed
52 | DeploymentStatus::Deleted
53 | DeploymentStatus::Error
54 )
55 }
56
57 pub fn is_failed(&self) -> bool {
59 matches!(
60 self,
61 DeploymentStatus::PreflightsFailed
62 | DeploymentStatus::InitialSetupFailed
63 | DeploymentStatus::ProvisioningFailed
64 | DeploymentStatus::UpdateFailed
65 | DeploymentStatus::DeleteFailed
66 | DeploymentStatus::TeardownFailed
67 | DeploymentStatus::RefreshFailed
68 | DeploymentStatus::Error
69 )
70 }
71}