1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
use serde::{Deserialize, Serialize};
use crate::client_internals::{Name, Path, Result};
use crate::Jenkins;
pub mod computer;
pub mod monitor;
#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ComputerSet {
pub display_name: String,
pub busy_executors: u32,
pub total_executors: u32,
#[serde(rename = "computer")]
pub computers: Vec<computer::CommonComputer>,
}
impl Jenkins {
pub fn get_nodes(&self) -> Result<ComputerSet> {
Ok(self.get(&Path::Computers)?.json()?)
}
pub fn get_node<'a, C>(&self, computer_name: C) -> Result<computer::CommonComputer>
where
C: Into<computer::ComputerName<'a>>,
{
Ok(self
.get(&Path::Computer {
name: Name::Name(&computer_name.into().0),
})?
.json()?)
}
pub fn get_master_node(&self) -> Result<computer::MasterComputer> {
Ok(self
.get(&Path::Computer {
name: Name::Name("(master)"),
})?
.json()?)
}
}