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
//! Properties of an object (Build, Job, ...)

use serde;
use serde_json;

use helpers::Class;

/// Trait implemented by specialization of property
pub trait Property {}

/// A Jenkins `Property`
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct CommonProperty {
    /// _class provided by Jenkins
    #[serde(rename = "_class")]
    pub class: Option<String>,
    #[serde(flatten)]
    other_fields: serde_json::Value,
}
specialize!(CommonProperty => Property);
impl Property for CommonProperty {}

/// Job is a GitHub project
#[derive(Deserialize, Debug, Copy, Clone)]
#[serde(rename_all = "camelCase")]
pub struct GithubProjectProperty {}
register_class!("com.coravy.hudson.plugins.github.GithubProjectProperty" => GithubProjectProperty);
impl Property for GithubProjectProperty {}

/// Job is limited in number of concurrent builds
#[derive(Deserialize, Debug, Copy, Clone)]
#[serde(rename_all = "camelCase")]
pub struct RateLimitBranchProperty {}
register_class!("jenkins.branch.RateLimitBranchProperty$JobPropertyImpl" => RateLimitBranchProperty);
impl Property for RateLimitBranchProperty {}

/// Old builds of job are discarded
#[derive(Deserialize, Debug, Copy, Clone)]
#[serde(rename_all = "camelCase")]
pub struct BuildDiscarderProperty {}
register_class!("jenkins.model.BuildDiscarderProperty" => BuildDiscarderProperty);
impl Property for BuildDiscarderProperty {}