ic_query/ic/model/requests/network.rs
1//! Module: ic::model::requests::network
2//!
3//! Responsibility: bounded official Dashboard network-resource request contracts.
4//! Does not own: metrics, canister discovery, transport, or reports.
5//! Boundary: captures daily-statistics bounds and finite boundary-node resource intent.
6
7use serde::Serialize;
8
9///
10/// IcDailyStatsQuery
11///
12/// One explicitly bounded official Dashboard daily-statistics query.
13///
14
15#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
16pub struct IcDailyStatsQuery {
17 /// Inclusive query start as Unix seconds.
18 pub start_unix_secs: u64,
19 /// Inclusive query end as Unix seconds.
20 pub end_unix_secs: u64,
21}
22
23impl IcDailyStatsQuery {
24 /// Construct one explicit daily-statistics query window.
25 #[must_use]
26 pub const fn new(start_unix_secs: u64, end_unix_secs: u64) -> Self {
27 Self {
28 start_unix_secs,
29 end_unix_secs,
30 }
31 }
32}
33
34///
35/// IcDailyStatsRequest
36///
37/// Request accepted by the bounded official Dashboard daily-statistics builder.
38///
39
40#[derive(Clone, Debug, Eq, PartialEq)]
41pub struct IcDailyStatsRequest {
42 /// Dashboard API v3 base endpoint.
43 pub source_endpoint: String,
44 /// Collection time as Unix seconds.
45 pub now_unix_secs: u64,
46 /// Explicitly bounded daily-statistics query.
47 pub query: IcDailyStatsQuery,
48}
49
50impl IcDailyStatsRequest {
51 /// Construct one bounded live Dashboard daily-statistics request.
52 #[must_use]
53 pub fn new(
54 source_endpoint: impl Into<String>,
55 now_unix_secs: u64,
56 query: IcDailyStatsQuery,
57 ) -> Self {
58 Self {
59 source_endpoint: source_endpoint.into(),
60 now_unix_secs,
61 query,
62 }
63 }
64}
65
66///
67/// IcBoundaryNodeDataCentersRequest
68///
69/// Request accepted by the official Dashboard boundary-node data-center builder.
70///
71
72#[derive(Clone, Debug, Eq, PartialEq)]
73pub struct IcBoundaryNodeDataCentersRequest {
74 /// Dashboard API v4 base endpoint.
75 pub source_endpoint: String,
76 /// Collection time as Unix seconds.
77 pub now_unix_secs: u64,
78}
79
80impl IcBoundaryNodeDataCentersRequest {
81 /// Construct one live Dashboard boundary-node data-center request.
82 #[must_use]
83 pub fn new(source_endpoint: impl Into<String>, now_unix_secs: u64) -> Self {
84 Self {
85 source_endpoint: source_endpoint.into(),
86 now_unix_secs,
87 }
88 }
89}