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