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 verbose: bool,
31 pub sort: String,
32 pub catalog_sns_count: usize,
34 pub excluded_sns_count: usize,
36 pub sns_count: usize,
37 pub metadata_error_count: usize,
38 pub lifecycle_error_count: usize,
40 pub sns_instances: Vec<SnsListRow>,
41}
42
43#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, Serialize)]
50#[serde(tag = "status", rename_all = "snake_case", deny_unknown_fields)]
51pub enum SnsLifecycleOutcome {
52 NotCollected,
54 Value {
56 code: i32,
58 },
59 Failed {
61 error: String,
63 },
64}
65
66impl SnsLifecycleOutcome {
67 #[must_use]
69 pub const fn value(&self) -> Option<i32> {
70 match self {
71 Self::Value { code } => Some(*code),
72 Self::NotCollected | Self::Failed { .. } => None,
73 }
74 }
75
76 #[must_use]
78 pub fn error(&self) -> Option<&str> {
79 match self {
80 Self::Failed { error } => Some(error),
81 Self::NotCollected | Self::Value { .. } => None,
82 }
83 }
84}
85
86#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
93pub struct SnsListRow {
94 pub id: usize,
95 pub name: String,
96 #[serde(flatten)]
98 pub canisters: MainnetSnsCanisters,
99 pub metadata_error: Option<String>,
100 pub lifecycle: SnsLifecycleOutcome,
102}
103
104#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
111pub struct SnsInfoReport {
112 pub schema_version: u32,
113 pub network: String,
114 pub sns_wasm_canister_id: String,
115 pub fetched_at: String,
116 pub source_endpoint: String,
117 pub fetched_by: String,
118 pub id: usize,
119 pub name: String,
120 pub description: Option<String>,
121 pub url: Option<String>,
122 #[serde(flatten)]
124 pub canisters: MainnetSnsCanisters,
125 pub metadata_error: Option<String>,
126}