cloud_storage_rs/resources/
location.rs

1/// Deeply nested enum that represents a location where a bucket might store its files.
2#[derive(Debug, PartialEq, serde::Serialize, serde::Deserialize)]
3#[serde(untagged)]
4pub enum Location {
5    /// Objects are stored in a single location.
6    Single(SingleRegion),
7    /// Objects are stored redundantly across multiple locations.
8    Multi(MultiRegion),
9    /// Objects are stored redundantly accross two locations.
10    Dual(DualRegion),
11}
12
13impl Default for Location {
14    fn default() -> Location {
15        Location::Single(SingleRegion::NorthAmerica(NALocation::SouthCarolina))
16    }
17}
18
19/// The possible options for single regions.
20#[derive(Debug, PartialEq, serde::Serialize, serde::Deserialize)]
21#[serde(untagged)]
22pub enum SingleRegion {
23    /// All options in North America.
24    NorthAmerica(NALocation),
25    /// All options in South America.
26    SouthAmerica(SALocation),
27    /// All options in Europe.
28    Europe(EuropeLocation),
29    /// All options in Asia.
30    Asia(AsiaLocation),
31    /// All options in Australia.
32    Australia(AusLocation),
33}
34
35/// All options in North America.
36#[derive(Debug, PartialEq, serde::Serialize, serde::Deserialize)]
37pub enum NALocation {
38    /// Store the files in Montréal.
39    #[serde(rename = "NORTHAMERICA-NORTHEAST1")]
40    Montreal,
41    /// Store the files in Iowa.
42    #[serde(rename = "US-CENTRAL1")]
43    Iowa,
44    /// Store the files in South Carolina.
45    #[serde(rename = "US-EAST1")]
46    SouthCarolina,
47    /// Store the files in Northern Virginia.
48    #[serde(rename = "US-EAST4")]
49    NorthernVirginia,
50    /// Store the files in Oregon.
51    #[serde(rename = "US-WEST1")]
52    Oregon,
53    /// Store the files in Los Angeles.
54    #[serde(rename = "US-WEST2")]
55    LosAngeles,
56}
57
58/// All options in South America.
59#[derive(Debug, PartialEq, serde::Serialize, serde::Deserialize)]
60pub enum SALocation {
61    /// Store the files in Soa Paulo.
62    #[serde(rename = "SOUTHAMERICA-EAST1")]
63    SaoPaulo,
64}
65
66/// All options in Europe.
67#[derive(Debug, PartialEq, serde::Serialize, serde::Deserialize)]
68pub enum EuropeLocation {
69    /// Store the files in Finland.
70    #[serde(rename = "EUROPE-NORTH1")]
71    Finland,
72    /// Store the files in Belgium.
73    #[serde(rename = "EUROPE-WEST1")]
74    Belgium,
75    /// Store the files in London.
76    #[serde(rename = "EUROPE-WEST2")]
77    London,
78    /// Store the files in Frankfurt.
79    #[serde(rename = "EUROPE-WEST3")]
80    Frankfurt,
81    /// Store the files in the Netherlands.
82    #[serde(rename = "EUROPE-WEST4")]
83    Netherlands,
84    /// Store the files in Zurich.
85    #[serde(rename = "EUROPE-WEST6")]
86    Zurich,
87}
88
89/// ALl options in Asia.
90#[derive(Debug, PartialEq, serde::Serialize, serde::Deserialize)]
91pub enum AsiaLocation {
92    /// Store the files in Taiwan.
93    #[serde(rename = "ASIA-EAST1")]
94    Taiwan,
95    /// Store the files in Hong Kong.
96    #[serde(rename = "ASIA-EAST2")]
97    HongKong,
98    /// Store the files in Tokyo.
99    #[serde(rename = "ASIA-NORTHEAST1")]
100    Tokyo,
101    /// Store the files in Osaka.
102    #[serde(rename = "ASIA-NORTHEAST2")]
103    Osaka,
104    /// Store the files in Mumbai.
105    #[serde(rename = "ASIA-SOUTH1")]
106    Mumbai,
107    /// Store the files in Singapore.
108    #[serde(rename = "ASIA-SOUTHEAST1")]
109    Singapore,
110}
111
112/// All options in Australia.
113#[derive(Debug, PartialEq, serde::Serialize, serde::Deserialize)]
114pub enum AusLocation {
115    /// Store the files in Sydney.
116    #[serde(rename = "AUSTRALIA-SOUTHEAST1")]
117    Sydney,
118}
119
120/// The possible options for multi-region storage.
121#[derive(Debug, PartialEq, serde::Serialize, serde::Deserialize)]
122#[serde(rename_all = "UPPERCASE")]
123pub enum MultiRegion {
124    /// Data centers in Asia
125    Asia,
126    /// Data centers in the European Union
127    ///
128    /// Object data added to a bucket in the EU multi-region is not stored in the EUROPE-WEST2 or
129    /// EUROPE-WEST6 data center.
130    Eu,
131    /// Data centers in the United States
132    Us,
133}
134
135/// The possible options for dual-region storage
136#[derive(Debug, PartialEq, serde::Serialize, serde::Deserialize)]
137#[serde(rename_all = "UPPERCASE")]
138pub enum DualRegion {
139    /// EUROPE-NORTH1 and EUROPE-WEST4. Additionally, object metadata may be stored in EUROPE-WEST1.
140    Eur4,
141    /// US-CENTRAL1 and US-EAST1. Additionally, object metadata may be stored in Tulsa, Oklahoma.
142    Nam4,
143}