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 sns_count: usize,
36 pub metadata_error_count: usize,
37 pub lifecycle_error_count: usize,
39 pub sns_instances: Vec<SnsListRow>,
40}
41
42#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, Serialize)]
49#[serde(tag = "status", rename_all = "snake_case", deny_unknown_fields)]
50pub enum SnsLifecycleOutcome {
51 NotCollected,
53 Value {
55 code: i32,
57 },
58 Failed {
60 error: String,
62 },
63}
64
65impl SnsLifecycleOutcome {
66 #[must_use]
68 pub const fn value(&self) -> Option<i32> {
69 match self {
70 Self::Value { code } => Some(*code),
71 Self::NotCollected | Self::Failed { .. } => None,
72 }
73 }
74
75 #[must_use]
77 pub fn error(&self) -> Option<&str> {
78 match self {
79 Self::Failed { error } => Some(error),
80 Self::NotCollected | Self::Value { .. } => None,
81 }
82 }
83}
84
85#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
92pub struct SnsListRow {
93 pub id: usize,
94 pub name: String,
95 #[serde(flatten)]
97 pub canisters: MainnetSnsCanisters,
98 pub metadata_error: Option<String>,
99 pub lifecycle: SnsLifecycleOutcome,
101}
102
103#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
110pub struct SnsInfoReport {
111 pub schema_version: u32,
112 pub network: String,
113 pub sns_wasm_canister_id: String,
114 pub fetched_at: String,
115 pub source_endpoint: String,
116 pub fetched_by: String,
117 pub id: usize,
118 pub name: String,
119 pub description: Option<String>,
120 pub url: Option<String>,
121 #[serde(flatten)]
123 pub canisters: MainnetSnsCanisters,
124 pub metadata_error: Option<String>,
125}