ic_query/nns/node/report/model/
request.rs1use crate::nns::{NnsInventoryCacheRequest, NnsInventoryListRequest};
2use crate::subnet_catalog::SubnetKind;
3
4#[derive(Clone, Debug, Eq, PartialEq)]
11pub struct NnsNodeListRequest {
12 pub inventory: NnsInventoryListRequest,
14 pub filters: NnsNodeListFilters,
15}
16
17impl NnsNodeListRequest {
18 #[must_use]
19 pub fn new(
20 cache: NnsInventoryCacheRequest,
21 source_endpoint: impl Into<String>,
22 now_unix_secs: u64,
23 ) -> Self {
24 Self {
25 inventory: NnsInventoryListRequest::new(cache, source_endpoint, now_unix_secs),
26 filters: NnsNodeListFilters::default(),
27 }
28 }
29}
30
31#[derive(Clone, Debug, Default, Eq, PartialEq)]
38pub struct NnsNodeListFilters {
39 pub subnet: Option<String>,
40 pub subnet_kind: Option<SubnetKind>,
41 pub data_center: Option<String>,
42 pub node_provider: Option<String>,
43 pub node_operator: Option<String>,
44}
45
46impl NnsNodeListFilters {
47 #[must_use]
48 pub const fn is_empty(&self) -> bool {
49 self.subnet.is_none()
50 && self.subnet_kind.is_none()
51 && self.data_center.is_none()
52 && self.node_provider.is_none()
53 && self.node_operator.is_none()
54 }
55}