upload_things/
region.rs

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
#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, Eq, Debug, Hash)]
pub enum UploadRegion {
    AsiaMumbai,
    AsiaSeoul,
    AsiaSydney,
    CanadaCentral,
    EuCentralFrankfurt,
    EuCentralZurich,
    EuWestDublin,
    UsEastOhio,
    UsWestSanFrancisco,
    UsWestSeattle,
}
impl Default for UploadRegion {
    fn default() -> Self {
        Self::UsWestSeattle
    }
}
impl UploadRegion {
    pub fn alias(&self) -> &'static str {
        match self {
            Self::AsiaMumbai => "bom1",
            Self::AsiaSeoul => "icn1",
            Self::AsiaSydney => "syd1",
            Self::CanadaCentral => "can1",
            Self::EuCentralFrankfurt => "fra1",
            Self::EuCentralZurich => "zrh1",
            Self::EuWestDublin => "dub1",
            Self::UsEastOhio => "cle1",
            Self::UsWestSanFrancisco => "sfo1",
            Self::UsWestSeattle => "sea1",
        }
    }
}

impl Into<&str> for UploadRegion {
    fn into(self) -> &'static str {
        match self {
            Self::AsiaMumbai => "asia-mumbai",
            Self::AsiaSeoul => "asia-seoul",
            Self::AsiaSydney => "asia-sydney",
            Self::CanadaCentral => "canada-central",
            Self::EuCentralFrankfurt => "eu-central-frankfurt",
            Self::EuCentralZurich => "eu-central-zurich",
            Self::EuWestDublin => "eu-west-dublin",
            Self::UsEastOhio => "us-east-ohio",
            Self::UsWestSanFrancisco => "us-west-san-francisco",
            Self::UsWestSeattle => "us-west-seattle",
        }
    }
}