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    super::super::COLLECTION,
27    node_count,
28    nodes,
29    |_report: &NnsNodeListReport| None,
30);
31
32///
33/// NnsNodeRow
34///
35/// One node row projected from the NNS registry inventory.
36///
37
38#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
39pub struct NnsNodeRow {
40    pub node_principal: String,
41    pub node_operator_principal: String,
42    pub node_provider_principal: String,
43    pub subnet_principal: String,
44    pub subnet_kind: SubnetKind,
45    pub data_center_id: String,
46}
47
48///
49/// NnsNodeInfoReport
50///
51/// Detailed report for one resolved NNS node.
52///
53
54#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
55pub struct NnsNodeInfoReport {
56    pub schema_version: u32,
57    pub input: String,
58    pub resolved_from: String,
59    /// Registry acquisition metadata, flattened in JSON.
60    #[serde(flatten)]
61    pub provenance: crate::nns::registry::NnsRegistryInventoryProvenance,
62    /// Resolved inventory row.
63    #[serde(flatten)]
64    pub node: NnsNodeRow,
65}