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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
use serde::Deserialize;

use super::image::{ScalewayImage, ScalewayImageBootscript, ScalewayImageExtraVolumes};

#[derive(Deserialize, Debug)]
pub struct ScalewayInstancesRoot {
    pub servers: Vec<ScalewayInstance>,
}

#[derive(Deserialize, Debug)]
pub struct ScalewayInstanceRoot {
    pub server: ScalewayInstance,
}

#[derive(Deserialize, Debug)]
pub struct ScalewayInstance {
    pub id: String,
    pub name: String,
    pub organization: String,
    pub project: String,
    pub allowed_actions: Vec<String>,
    pub tags: Vec<String>,
    pub commercial_type: String,
    pub creation_date: Option<String>,
    pub dynamic_ip_required: bool,
    pub routed_ip_enabled: bool,
    pub enable_ipv6: bool,
    pub hostname: String,
    pub image: ScalewayImage,
    pub protected: bool,
    pub private_ip: Option<String>,
    pub public_ip: Option<ScalewayPublicIP>,
    pub public_ips: Vec<ScalewayPublicIP>,
    pub mac_address: String,
    pub modification_date: Option<String>,
    pub state: String,
    pub location: Option<ScalewayInstanceLocation>,
    pub ipv6: Option<ScalewayIpv6>,
    pub bootscript: ScalewayImageBootscript,
    pub boot_type: String,
    pub volumes: ScalewayImageExtraVolumes,
    pub security_group: ScalewaySecurityGroup,
    pub maintenances: Vec<ScalewayMaintenance>,
    pub state_detail: String,
    pub arch: String,
    pub placement_group: Option<ScalewayPlacementGroup>,
    pub private_nics: Vec<ScalewayPrivateNic>,
    pub zone: String,
}

#[derive(Deserialize, Debug)]
pub struct ScalewayPublicIP {
    pub id: String,
    pub address: String,
    pub gateway: String,
    pub netmask: String,
    pub family: String,
    pub dynamic: bool,
    pub provisioning_mode: String,
    pub tags: Vec<String>,
    pub state: String,
}

#[derive(Deserialize, Debug)]
pub struct ScalewayInstanceLocation {
    pub cluster_id: String,
    pub hypervisor_id: String,
    pub node_id: String,
    pub platform_id: String,
    pub zone_id: String,
}

#[derive(Deserialize, Debug)]
pub struct ScalewayIpv6 {
    pub address: String,
    pub gateway: String,
    pub netmask: String,
}

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

#[derive(Deserialize, Debug)]
pub struct ScalewayMaintenance {
    pub reason: String,
}

#[derive(Deserialize, Debug)]
pub struct ScalewayPlacementGroup {
    pub id: String,
    pub name: String,
    pub organization: String,
    pub project: String,
    pub tags: Vec<String>,
    pub policy_mode: String,
    pub policy_type: String,
    pub policy_respected: bool,
    pub zone: String,
}

#[derive(Deserialize, Debug)]
pub struct ScalewayPrivateNic {
    pub id: String,
    pub server_id: String,
    pub private_network_id: String,
    pub mac_address: String,
    pub state: String,
    pub tags: Vec<String>,
}