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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
use serde::Deserialize;
use crate::client::{self, Result};
use crate::client_internals::path::Path;
use crate::Jenkins;
#[derive(Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct Artifact {
pub artifact_id: String,
pub canonical_name: String,
pub classifier: Option<String>,
pub file_name: String,
pub group_id: String,
pub md5sum: String,
#[serde(rename = "type")]
pub artifact_type: String,
pub version: String,
}
#[derive(Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct ShortMavenArtifactRecord {
pub url: String,
}
impl ShortMavenArtifactRecord {
pub fn get_full_artifact_record(
&self,
jenkins_client: &Jenkins,
) -> Result<MavenArtifactRecord> {
let path = jenkins_client.url_to_path(&self.url);
if let Path::MavenArtifactRecord { .. } = path {
Ok(jenkins_client.get(&path)?.json()?)
} else {
Err(client::Error::InvalidUrl {
url: self.url.clone(),
expected: client::error::ExpectedType::MavenArtifactRecord,
}
.into())
}
}
}
#[derive(Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct MavenArtifactRecord {
pub url: String,
pub attached_artifacts: Vec<Artifact>,
pub main_artifact: Artifact,
pub parent: crate::build::ShortBuild,
pub pom_artifact: Artifact,
}