ic_query/sns/report/model/reports/
list.rs1use crate::report::ReportProvenance;
8use crate::sns::report::model::MainnetSnsCanisters;
9use serde::Serialize;
10
11#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
18pub struct SnsListReport {
19 pub schema_version: u32,
20 pub network: String,
21 pub sns_wasm_canister_id: String,
22 pub fetched_at: String,
23 pub source_endpoint: String,
24 pub fetched_by: String,
25 #[serde(flatten)]
27 pub provenance: ReportProvenance,
28 pub all_lifecycles: bool,
30 pub sort: String,
31 pub catalog_sns_count: usize,
33 pub excluded_sns_count: usize,
35 pub metadata_error_count: usize,
36 pub lifecycle_error_count: usize,
38 pub sns_instances: Vec<SnsListRow>,
39}
40
41#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, Serialize)]
48#[serde(tag = "status", rename_all = "snake_case", deny_unknown_fields)]
49pub enum SnsLifecycleOutcome {
50 NotCollected,
52 Value {
54 code: i32,
56 },
57 Failed {
59 error: String,
61 },
62}
63
64impl SnsLifecycleOutcome {
65 #[must_use]
67 pub const fn value(&self) -> Option<i32> {
68 match self {
69 Self::Value { code } => Some(*code),
70 Self::NotCollected | Self::Failed { .. } => None,
71 }
72 }
73
74 #[must_use]
76 pub fn error(&self) -> Option<&str> {
77 match self {
78 Self::Failed { error } => Some(error),
79 Self::NotCollected | Self::Value { .. } => None,
80 }
81 }
82}
83
84#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
91pub struct SnsListRow {
92 pub id: usize,
93 pub name: String,
94 #[serde(flatten)]
96 pub canisters: MainnetSnsCanisters,
97 pub metadata_error: Option<String>,
98 pub lifecycle: SnsLifecycleOutcome,
100}
101
102#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
109pub struct SnsInfoReport {
110 pub schema_version: u32,
111 pub network: String,
112 pub sns_wasm_canister_id: String,
113 pub fetched_at: String,
114 pub source_endpoint: String,
115 pub fetched_by: String,
116 pub id: usize,
117 pub name: String,
118 pub description: Option<String>,
119 pub url: Option<String>,
120 #[serde(flatten)]
122 pub canisters: MainnetSnsCanisters,
123 pub metadata_error: Option<String>,
124}