1use crate::dto::prelude::*;
2
3#[derive(CandidType, Clone, Debug, Deserialize, Serialize)]
8pub struct CanisterEntryView {
9 pub role: CanisterRole,
10 pub parent_pid: Option<Principal>,
11 pub module_hash: Option<Vec<u8>>,
12 pub created_at: u64,
13}
14
15#[derive(CandidType, Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
22pub struct CanisterSummaryView {
23 pub role: CanisterRole,
24 pub parent_pid: Option<Principal>,
25}
26
27#[derive(CandidType, Clone, Debug, Deserialize, Serialize)]
32pub struct CanisterMetadataView {
33 pub name: String,
34 pub version: String,
35 pub description: String,
36}
37
38#[derive(CandidType, Clone, Debug, Deserialize, Serialize)]
43pub struct CanisterStatusView {
44 pub status: CanisterStatusTypeView,
45 pub settings: CanisterSettingsView,
46 pub module_hash: Option<Vec<u8>>,
47 pub memory_size: Nat,
48 pub memory_metrics: MemoryMetricsView,
49 pub cycles: Nat,
50 pub reserved_cycles: Nat,
51 pub idle_cycles_burned_per_day: Nat,
52 pub query_stats: QueryStatsView,
53}
54
55#[derive(CandidType, Clone, Copy, Debug, Deserialize, Serialize)]
60pub enum CanisterStatusTypeView {
61 #[serde(rename = "running")]
62 Running,
63 #[serde(rename = "stopping")]
64 Stopping,
65 #[serde(rename = "stopped")]
66 Stopped,
67}
68
69#[derive(CandidType, Clone, Debug, Deserialize, Serialize)]
74pub struct CanisterSettingsView {
75 pub controllers: Vec<Principal>,
76 pub compute_allocation: Nat,
77 pub memory_allocation: Nat,
78 pub freezing_threshold: Nat,
79 pub reserved_cycles_limit: Nat,
80 pub log_visibility: LogVisibilityView,
81 pub wasm_memory_limit: Nat,
82 pub wasm_memory_threshold: Nat,
83 pub environment_variables: Vec<EnvironmentVariableView>,
84}
85
86#[derive(CandidType, Clone, Debug, Deserialize, Serialize)]
91pub enum LogVisibilityView {
92 #[serde(rename = "controllers")]
93 Controllers,
94 #[serde(rename = "public")]
95 Public,
96 #[serde(rename = "allowed_viewers")]
97 AllowedViewers(Vec<Principal>),
98}
99
100#[derive(CandidType, Clone, Debug, Deserialize, Serialize)]
105pub struct EnvironmentVariableView {
106 pub name: String,
107 pub value: String,
108}
109
110#[derive(CandidType, Clone, Debug, Deserialize, Serialize)]
115pub struct MemoryMetricsView {
116 pub wasm_memory_size: Nat,
117 pub stable_memory_size: Nat,
118 pub global_memory_size: Nat,
119 pub wasm_binary_size: Nat,
120 pub custom_sections_size: Nat,
121 pub canister_history_size: Nat,
122 pub wasm_chunk_store_size: Nat,
123 pub snapshots_size: Nat,
124}
125
126#[derive(CandidType, Clone, Debug, Deserialize, Serialize)]
131pub struct QueryStatsView {
132 pub num_calls_total: Nat,
133 pub num_instructions_total: Nat,
134 pub request_payload_bytes_total: Nat,
135 pub response_payload_bytes_total: Nat,
136}