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 WaitingForSecrets,
23 ProvisioningFailed,
24 Running,
25 RefreshFailed,
26 UpdatePending,
27 Updating,
28 UpdateFailed,
29 DeletePending,
30 Deleting,
31 DeleteFailed,
32 TeardownRequired,
33 TeardownFailed,
34 Deleted,
35 Error,
36}
37
38impl DeploymentStatus {
39 pub fn is_synced(&self) -> bool {
49 matches!(
50 self,
51 DeploymentStatus::Running
52 | DeploymentStatus::PreflightsFailed
53 | DeploymentStatus::InitialSetupFailed
54 | DeploymentStatus::ProvisioningFailed
55 | DeploymentStatus::UpdateFailed
56 | DeploymentStatus::DeleteFailed
57 | DeploymentStatus::TeardownRequired
58 | DeploymentStatus::TeardownFailed
59 | DeploymentStatus::RefreshFailed
60 | DeploymentStatus::Deleted
61 | DeploymentStatus::Error
62 )
63 }
64
65 pub fn is_failed(&self) -> bool {
67 matches!(
68 self,
69 DeploymentStatus::PreflightsFailed
70 | DeploymentStatus::InitialSetupFailed
71 | DeploymentStatus::ProvisioningFailed
72 | DeploymentStatus::UpdateFailed
73 | DeploymentStatus::DeleteFailed
74 | DeploymentStatus::TeardownFailed
75 | DeploymentStatus::RefreshFailed
76 | DeploymentStatus::Error
77 )
78 }
79}