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