1use serde::Deserialize;
2use std::collections::HashMap;
3
4#[derive(Debug, Clone, Deserialize)]
5#[serde(rename_all = "PascalCase")]
6pub struct AllocationStub {
7 #[serde(rename = "ID")]
8 pub id: String,
9 #[serde(rename = "EvalID")]
10 pub eval_id: String,
11 pub name: String,
12 pub namespace: String,
13 #[serde(rename = "NodeID")]
14 pub node_id: String,
15 pub node_name: String,
16 #[serde(rename = "JobID")]
17 pub job_id: String,
18 pub job_type: String,
19 pub job_version: u64,
20 pub task_group: String,
21 pub desired_status: String,
22 pub desired_description: String,
23 pub client_status: String,
24 pub client_description: String,
25 pub task_states: Option<HashMap<String, AllocationTaskState>>,
26 #[serde(rename = "DeploymentID")]
27 pub deployment_id: Option<String>,
28 pub deployment_status: Option<AllocationDeploymentStatus>,
29 pub followup_eval_id: Option<String>,
30 pub preempted_allocations: Option<Vec<String>>,
31 pub preempted_by_allocation: String,
32 pub create_index: u64,
33 pub modify_index: u64,
34 pub create_time: i64,
35 pub modify_time: i64,
36}
37
38#[derive(Debug, Clone, Deserialize)]
39#[serde(rename_all = "PascalCase")]
40pub struct AllocationTaskState {
41 pub state: String,
42 pub failed: bool,
43 pub restarts: u64,
44 pub last_restart: Option<String>,
45 pub start_at: Option<String>,
46 pub finish_at: Option<String>,
47 pub events: Option<Vec<AllocationTaskEvent>>,
48}
49
50#[derive(Debug, Clone, Deserialize)]
51#[serde(rename_all = "PascalCase")]
52pub struct AllocationTaskEvent {
53 #[serde(rename = "Type")]
54 pub type_: String,
55 pub time: i64,
56 pub display_message: String,
57 pub details: Option<HashMap<String, String>>,
58 pub message: String,
59 pub signal: i32,
60 pub exit_code: i32,
61 pub driver_error: String,
62 pub kill_timeout: u64,
63 pub kill_error: String,
64 pub kill_reason: String,
65 pub restart_reason: String,
66 pub setup_error: String,
67 pub driver_message: String,
68 pub task_signal_reason: String,
69 pub task_signal: String,
70 pub download_error: String,
71 pub validation_error: String,
72 pub disk_limit: i64,
73 pub disk_size: Option<i64>,
74 pub failed_sibling: String,
75 pub vault_error: String,
76 pub generic_source: String,
77}
78
79#[derive(Debug, Clone, Deserialize)]
80#[serde(rename_all = "PascalCase")]
81pub struct AllocationDeploymentStatus {
82 pub healthy: Option<bool>,
83 pub timestamp: String,
84 pub canary: bool,
85 pub modify_index: u64,
86}
87
88#[derive(Debug, Clone, Deserialize)]
89#[serde(rename_all = "PascalCase")]
90pub struct AllocationMetric {
91 pub nodes_evaluated: i32,
92 pub nodes_filtered: i32,
93 pub nodes_available: HashMap<String, i32>,
94 pub class_filtered: Option<HashMap<String, i32>>,
95 pub constraint_filtered: Option<HashMap<String, i32>>,
96 pub nodes_exhausted: i32,
97 pub class_exhausted: Option<HashMap<String, i32>>,
98 pub dimension_exhausted: Option<HashMap<String, i32>>,
99 pub quota_exhausted: Option<Vec<String>>,
100 pub resources_exhausted: Option<HashMap<String, AllocationResourceExhausted>>,
101 pub scores_meta: Option<HashMap<String, f64>>,
102 pub allocation_time: i64,
103 pub coalesced_failures: i32,
104}
105
106#[derive(Debug, Clone, Deserialize)]
107#[serde(rename_all = "PascalCase")]
108pub struct AllocationResourceExhausted {
109 #[serde(rename = "CPU")]
110 pub cpu: i32,
111 #[serde(rename = "MemoryMB")]
112 pub memory_mb: i32,
113 pub disk_mb: i32,
114}