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
use std::collections::HashMap;

use serde::Deserialize;

#[derive(Deserialize, Debug)]
pub struct ScalewayServerTypeRoot {
    pub servers: ScalewayServerTypeItem,
}

#[derive(Deserialize, Debug)]
pub struct ScalewayServerTypeItem {
    #[serde(flatten)]
    pub servers: HashMap<String, ScalewayServerType>,
}

#[derive(Deserialize, Debug)]
pub struct ScalewayServerType {
    pub alt_names: Vec<String>,
    pub arch: String,
    pub ncpus: u32,
    pub ram: u64,
    pub gpu: u32,
    pub baremetal: bool,
    pub monthly_price: f32,
    pub hourly_price: f32,
    pub network: ScalewayServerTypeNetwork,
}

#[derive(Deserialize, Debug)]
pub struct ScalewayServerTypeNetwork {
    pub ipv6_support: bool,
    pub sum_internal_bandwidth: u64,
    pub sum_internet_bandwidth: u64,
}

#[derive(Deserialize, Debug)]
pub struct ServerType {
    pub id: String,
    pub location: String,
    
    pub alt_names: Vec<String>,
    pub arch: String,
    pub ncpus: u32,
    pub ram: u64,
    pub gpu: u32,
    pub baremetal: bool,
    pub monthly_price: f32,
    pub hourly_price: f32,
    pub network: ScalewayServerTypeNetwork,
}