Skip to main content

canic_host/deployment_truth/model/promotion/identity/
mod.rs

1use super::super::{SafetyFindingV1, VerifiedPostconditionV1};
2use super::source::{
3    ArtifactTransportV1, PromotionArtifactLevelV1, PromotionReadinessStatusV1,
4    RoleArtifactSourceKindV1,
5};
6use serde::{Deserialize, Serialize};
7
8///
9/// PromotionArtifactIdentityReportV1
10///
11#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
12pub struct PromotionArtifactIdentityReportV1 {
13    pub schema_version: u32,
14    pub report_id: String,
15    pub artifact_identity_report_digest: String,
16    pub status: PromotionReadinessStatusV1,
17    pub summary: PromotionArtifactIdentitySummaryV1,
18    pub roles: Vec<RolePromotionArtifactIdentityV1>,
19    pub identity_groups: Vec<PromotionArtifactIdentityGroupV1>,
20    pub blockers: Vec<SafetyFindingV1>,
21}
22
23///
24/// PromotionArtifactIdentitySummaryV1
25///
26#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
27pub struct PromotionArtifactIdentitySummaryV1 {
28    pub role_count: usize,
29    pub identity_group_count: usize,
30    pub shared_identity_group_count: usize,
31    pub digest_pinned_role_count: usize,
32    pub source_build_role_count: usize,
33    pub deferred_identity_role_count: usize,
34}
35
36///
37/// PromotionWasmStoreIdentityReportV1
38///
39#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
40pub struct PromotionWasmStoreIdentityReportV1 {
41    pub schema_version: u32,
42    pub report_id: String,
43    pub wasm_store_identity_report_digest: String,
44    pub status: PromotionReadinessStatusV1,
45    pub roles: Vec<RolePromotionWasmStoreIdentityV1>,
46    pub blockers: Vec<SafetyFindingV1>,
47}
48
49///
50/// RolePromotionWasmStoreIdentityV1
51///
52#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
53pub struct RolePromotionWasmStoreIdentityV1 {
54    pub role: String,
55    pub artifact_identity: String,
56    pub transport: ArtifactTransportV1,
57    pub wasm_store_locator: Option<String>,
58    pub prepared_chunk_hashes: Vec<String>,
59    pub published_chunk_count: usize,
60    pub verified_postcondition: VerifiedPostconditionV1,
61}
62
63///
64/// PromotionWasmStoreCatalogEntryV1
65///
66#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
67pub struct PromotionWasmStoreCatalogEntryV1 {
68    pub locator: String,
69    pub artifact_identity: String,
70    pub published_chunk_count: usize,
71}
72
73///
74/// PromotionWasmStoreCatalogVerificationV1
75///
76#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
77pub struct PromotionWasmStoreCatalogVerificationV1 {
78    pub schema_version: u32,
79    pub verification_id: String,
80    pub wasm_store_catalog_verification_digest: String,
81    pub wasm_store_identity_report_id: String,
82    pub status: PromotionReadinessStatusV1,
83    pub roles: Vec<RolePromotionWasmStoreCatalogVerificationV1>,
84    pub blockers: Vec<SafetyFindingV1>,
85}
86
87///
88/// RolePromotionWasmStoreCatalogVerificationV1
89///
90#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
91pub struct RolePromotionWasmStoreCatalogVerificationV1 {
92    pub role: String,
93    pub wasm_store_locator: String,
94    pub expected_artifact_identity: String,
95    pub observed_artifact_identity: Option<String>,
96    pub expected_published_chunk_count: usize,
97    pub observed_published_chunk_count: Option<usize>,
98    pub catalog_entry_present: bool,
99    pub catalog_matches: bool,
100    pub catalog_observation_digest: String,
101}
102
103///
104/// PromotionArtifactIdentityGroupV1
105///
106#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
107pub struct PromotionArtifactIdentityGroupV1 {
108    pub identity_key: String,
109    pub identity_kind: PromotionArtifactIdentityKindV1,
110    pub roles: Vec<String>,
111    pub source_kinds: Vec<RoleArtifactSourceKindV1>,
112    pub source_locators: Vec<String>,
113    pub digest_pinned: bool,
114    pub wasm_sha256: Option<String>,
115    pub wasm_gz_sha256: Option<String>,
116    pub candid_sha256: Option<String>,
117    pub canonical_embedded_config_sha256: Option<String>,
118}
119
120///
121/// RolePromotionArtifactIdentityV1
122///
123#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
124pub struct RolePromotionArtifactIdentityV1 {
125    pub role: String,
126    pub promotion_level: PromotionArtifactLevelV1,
127    pub source_kind: RoleArtifactSourceKindV1,
128    pub source_locator: Option<String>,
129    pub identity_kind: PromotionArtifactIdentityKindV1,
130    pub digest_pinned: bool,
131    pub wasm_sha256: Option<String>,
132    pub wasm_gz_sha256: Option<String>,
133    pub candid_sha256: Option<String>,
134    pub canonical_embedded_config_sha256: Option<String>,
135}
136
137///
138/// PromotionArtifactIdentityKindV1
139///
140#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
141pub enum PromotionArtifactIdentityKindV1 {
142    SealedWasm,
143    SealedCompressedWasm,
144    SealedWasmAndCompressedWasm,
145    SourceBuild,
146    Deferred,
147}