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
73
74
75
76
77
78
79
use std::collections::HashMap;
use serde::Deserialize;

#[derive(Deserialize, Debug)]
pub struct ScalewayImageRoot {
    pub images: Vec<ScalewayImage>,
}

#[derive(Deserialize, Debug)]
pub struct ScalewayImage {
    pub id: String,
    pub name: String,
    pub arch: String,
    pub creation_date: String,
    pub modification_date: String,
    pub from_server: Option<String>,
    pub organization: String,
    pub public: bool,
    pub state: String,
    pub project: String,
    pub tags: Vec<String>,
    pub zone: String,
    pub root_volume: ScalewayImageRootVolume,
    pub default_bootscript: Option<ScalewayImageBootscript>,
    pub extra_volumes: ScalewayImageExtraVolumes,
}

#[derive(Deserialize, Debug)]
pub struct ScalewayImageRootVolume {
    pub id: String,
    pub name: String,
    pub size: u64,
    pub volume_type: String,
}

#[derive(Deserialize, Debug)]
pub struct ScalewayImageBootscript {
    pub bootcmdargs: String,
    pub default: bool,
    pub dtb: String,
    pub id: String,
    pub initrd: String,
    pub kernel: String,
    pub organization: String,
    pub project: String,
    pub public: bool,
    pub title: String,
    pub arch: Option<String>,
    pub zone: String,
}

#[derive(Deserialize, Debug)]
pub struct ScalewayImageExtraVolumes {
    #[serde(flatten)]
    pub volumes: HashMap<String, ScalewayImageExtraVolume>,
}

#[derive(Deserialize, Debug)]
pub struct ScalewayImageExtraVolume {
    pub id: String,
    pub name: String,
    pub export_uri: Option<String>,
    pub size: u64,
    pub volume_type: String,
    pub creation_date: String,
    pub modification_date: String,
    pub organization: String,
    pub project: String,
    pub tags: Vec<String>,
    pub server: ScalewayImageExtraVolumeServer,
    pub state: String,
    pub zone: String,
}

#[derive(Deserialize, Debug)]
pub struct ScalewayImageExtraVolumeServer {
    pub id: String,
    pub name: String,
}