Skip to main content

ic_query/nns/node/report/model/
report.rs

1use crate::subnet_catalog::SubnetKind;
2use serde::{Deserialize, Serialize};
3
4///
5/// NnsNodeListReport
6///
7/// Filtered NNS node inventory report with source metadata.
8///
9
10#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
11#[serde(deny_unknown_fields)]
12pub struct NnsNodeListReport {
13    pub schema_version: u32,
14    /// Registry acquisition metadata, flattened in JSON.
15    #[serde(flatten)]
16    pub provenance: crate::nns::registry::NnsRegistryInventoryProvenance,
17    pub node_count: usize,
18    pub nodes: Vec<NnsNodeRow>,
19}
20
21#[cfg(feature = "nns-host")]
22impl_nns_inventory_report!(
23    NnsNodeListReport,
24    super::super::NNS_NODE_LIST_REPORT_SCHEMA_VERSION,
25    "node",
26    node_count,
27    nodes,
28    |_report: &NnsNodeListReport| None,
29);
30
31///
32/// NnsNodeRow
33///
34/// One node row projected from the NNS registry inventory.
35///
36
37#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
38pub struct NnsNodeRow {
39    pub node_principal: String,
40    pub node_operator_principal: String,
41    pub node_provider_principal: String,
42    pub subnet_principal: String,
43    pub subnet_kind: SubnetKind,
44    pub data_center_id: String,
45}
46
47///
48/// NnsNodeInfoReport
49///
50/// Detailed report for one resolved NNS node.
51///
52
53#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
54pub struct NnsNodeInfoReport {
55    pub schema_version: u32,
56    pub input: String,
57    pub resolved_from: String,
58    /// Registry acquisition metadata, flattened in JSON.
59    #[serde(flatten)]
60    pub provenance: crate::nns::registry::NnsRegistryInventoryProvenance,
61    /// Resolved inventory row.
62    #[serde(flatten)]
63    pub node: NnsNodeRow,
64}