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
53
use failure::Error;
use client_internals::Path;
use job::ShortJob;
use view::ShortView;
use Jenkins;
#[derive(Debug, Deserialize, Clone, Copy)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
pub enum Mode {
Normal,
Exclusive,
}
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Home {
pub mode: Mode,
pub node_description: String,
pub node_name: String,
pub num_executors: u32,
pub description: Option<String>,
pub jobs: Vec<ShortJob>,
pub quieting_down: bool,
pub slave_agent_port: u32,
pub use_crumbs: bool,
pub use_security: bool,
pub views: Vec<ShortView>,
}
impl Jenkins {
pub fn get_home(&self) -> Result<Home, Error> {
Ok(self.get(&Path::Home)?.json()?)
}
}