Skip to main content

canic_host/deployment_truth/model/lifecycle/authority/
mod.rs

1use super::super::CanisterControlClassV1;
2use serde::{Deserialize, Serialize};
3
4///
5/// LifecycleAuthorityReportV1
6///
7#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
8pub struct LifecycleAuthorityReportV1 {
9    pub schema_version: u32,
10    pub report_id: String,
11    pub report_digest: String,
12    pub check_id: String,
13    pub plan_id: String,
14    pub inventory_id: String,
15    pub authorities: Vec<LifecycleAuthorityV1>,
16    pub external_action_required_count: usize,
17    pub blocked_count: usize,
18}
19
20///
21/// LifecycleAuthorityV1
22///
23#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
24pub struct LifecycleAuthorityV1 {
25    pub subject: String,
26    pub canister_id: Option<String>,
27    pub role: Option<String>,
28    pub control_class: CanisterControlClassV1,
29    pub lifecycle_mode: LifecycleModeV1,
30    pub observed_controllers: Vec<String>,
31    pub expected_deployment_controllers: Vec<String>,
32    pub external_controllers: Vec<String>,
33    pub required_controllers: Vec<String>,
34    pub consent_requirements: Vec<ConsentRequirementV1>,
35    pub allowed_upgrade_modes: Vec<LifecycleUpgradeModeV1>,
36    pub verification_requirements: Vec<LifecycleVerificationRequirementV1>,
37    pub external_action_required: bool,
38    pub blocked: bool,
39    pub blockers: Vec<String>,
40    pub warnings: Vec<String>,
41    pub reason: String,
42}
43
44///
45/// LifecycleModeV1
46///
47#[derive(Clone, Copy, Debug, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize)]
48pub enum LifecycleModeV1 {
49    DirectDeploymentAuthority,
50    ProposalRequired,
51    DelegatedInstallRequired,
52    ExternalCompletionOnly,
53    VerifyOnly,
54    MustNotTouch,
55    UnknownUnsafeBlocked,
56}
57
58///
59/// LifecycleUpgradeModeV1
60///
61#[derive(Clone, Copy, Debug, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize)]
62pub enum LifecycleUpgradeModeV1 {
63    DirectByDeploymentAuthority,
64    ExternalProposal,
65    ExternalExecution,
66    VerifyExternalCompletion,
67    ObserveOnly,
68    Blocked,
69}
70
71///
72/// LifecycleVerificationRequirementV1
73///
74#[derive(Clone, Copy, Debug, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize)]
75pub enum LifecycleVerificationRequirementV1 {
76    LiveInventory,
77    ControllerObservation,
78    ModuleHash,
79    CanonicalEmbeddedConfig,
80    ProtectedCallReadiness,
81}
82
83///
84/// ConsentRequirementV1
85///
86#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
87pub struct ConsentRequirementV1 {
88    pub consent_subject_kind: ConsentSubjectKindV1,
89    pub required_principals: Vec<String>,
90    pub required_controller_set_digest: Option<String>,
91    pub consent_channel_kind: ConsentChannelKindV1,
92    pub required_action: ExternalUpgradeAuthorizationModeV1,
93}
94
95///
96/// ConsentSubjectKindV1
97///
98#[derive(Clone, Copy, Debug, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize)]
99pub enum ConsentSubjectKindV1 {
100    UserPrincipal,
101    ProjectHub,
102    GovernanceCanister,
103    CustomerController,
104    DelegatedInstallCanister,
105    MultisigAuthority,
106    UnknownExternalController,
107}
108
109///
110/// ConsentChannelKindV1
111///
112#[derive(Clone, Copy, Debug, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize)]
113pub enum ConsentChannelKindV1 {
114    OutOfBand,
115    GeneratedCommand,
116    DelegatedInstall,
117    GovernanceProposal,
118    ApplicationSpecific,
119}
120
121///
122/// ExternalUpgradeAuthorizationModeV1
123///
124#[derive(Clone, Copy, Debug, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize)]
125pub enum ExternalUpgradeAuthorizationModeV1 {
126    ConsentForDirectInstall,
127    DelegatedInstallAuthority,
128    ExternalControllerExecution,
129    ObserveAndVerifyOnly,
130}