1use std::path::PathBuf;
2
3use serde::{Deserialize, Serialize};
4
5pub(super) const LOCAL_ICP_TARGET: &str = "local";
6pub(super) const REQUIRED_ICP_CLI_VERSION: &str = "1.2.0";
7pub(super) const ICP_CLI_SUPPORTED_VERSION_RANGE: &str = ">=1.2.0, <2.0.0";
8
9#[derive(Clone, Debug, Eq, PartialEq)]
12pub struct LocalReplicaTarget {
13 pub url: String,
14 pub root_key: String,
15}
16
17#[derive(Clone, Debug, Eq, PartialEq)]
22pub struct IcpRawOutput {
23 pub success: bool,
24 pub status: String,
25 pub stdout: Vec<u8>,
26 pub stderr: Vec<u8>,
27}
28
29#[derive(Clone, Debug, Eq, PartialEq)]
34pub struct IcpCli {
35 pub(super) executable: String,
36 pub(super) environment: Option<String>,
37 pub(super) cwd: Option<PathBuf>,
38 pub(super) local_replica: Option<LocalReplicaTarget>,
39 pub(super) inherited_fd: Option<i32>,
40 pub(super) identity_password_file: Option<PathBuf>,
41}
42
43#[derive(Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd)]
47pub(super) struct IcpCliVersion {
48 pub(super) major: u64,
49 pub(super) minor: u64,
50 pub(super) patch: u64,
51}
52
53#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
58pub struct IcpSnapshot {
59 pub snapshot_id: String,
60 pub taken_at_timestamp: Option<u64>,
61 pub total_size_bytes: Option<u64>,
62}
63
64#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
69pub struct IcpCanisterStatusReport {
70 #[serde(default, rename = "version", alias = "canister_version")]
71 pub canister_version: Option<u64>,
72 pub id: String,
73 pub name: Option<String>,
74 pub status: String,
75 pub settings: Option<IcpCanisterStatusSettings>,
76 pub module_hash: Option<String>,
77 pub memory_size: Option<String>,
78 pub cycles: Option<String>,
79 pub reserved_cycles: Option<String>,
80 pub idle_cycles_burned_per_day: Option<String>,
81}
82
83#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
88pub struct IcpCanisterStatusSettings {
89 #[serde(default)]
90 pub controllers: Vec<String>,
91 pub compute_allocation: Option<String>,
92 pub memory_allocation: Option<String>,
93 pub freezing_threshold: Option<String>,
94 pub reserved_cycles_limit: Option<String>,
95 pub wasm_memory_limit: Option<String>,
96 pub wasm_memory_threshold: Option<String>,
97 pub log_memory_limit: Option<String>,
98}