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