cloud_storage/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#[allow(clippy::upper_case_acronyms)]
37#[derive(Debug, PartialEq, serde::Serialize, serde::Deserialize)]
38pub enum NALocation {
39    /// Store the files in Montréal.
40    #[serde(rename = "NORTHAMERICA-NORTHEAST1")]
41    Montreal,
42    /// Store the files in Iowa.
43    #[serde(rename = "US-CENTRAL1")]
44    Iowa,
45    /// Store the files in South Carolina.
46    #[serde(rename = "US-EAST1")]
47    SouthCarolina,
48    /// Store the files in Northern Virginia.
49    #[serde(rename = "US-EAST4")]
50    NorthernVirginia,
51    /// Store the files in Oregon.
52    #[serde(rename = "US-WEST1")]
53    Oregon,
54    /// Store the files in Los Angeles.
55    #[serde(rename = "US-WEST2")]
56    LosAngeles,
57}
58
59/// All options in South America.
60#[allow(clippy::upper_case_acronyms)]
61#[derive(Debug, PartialEq, serde::Serialize, serde::Deserialize)]
62pub enum SALocation {
63    /// Store the files in Soa Paulo.
64    #[serde(rename = "SOUTHAMERICA-EAST1")]
65    SaoPaulo,
66}
67
68/// All options in Europe.
69#[derive(Debug, PartialEq, serde::Serialize, serde::Deserialize)]
70pub enum EuropeLocation {
71    /// Store the files in Finland.
72    #[serde(rename = "EUROPE-NORTH1")]
73    Finland,
74    /// Store the files in Belgium.
75    #[serde(rename = "EUROPE-WEST1")]
76    Belgium,
77    /// Store the files in London.
78    #[serde(rename = "EUROPE-WEST2")]
79    London,
80    /// Store the files in Frankfurt.
81    #[serde(rename = "EUROPE-WEST3")]
82    Frankfurt,
83    /// Store the files in the Netherlands.
84    #[serde(rename = "EUROPE-WEST4")]
85    Netherlands,
86    /// Store the files in Zurich.
87    #[serde(rename = "EUROPE-WEST6")]
88    Zurich,
89}
90
91/// ALl options in Asia.
92#[derive(Debug, PartialEq, serde::Serialize, serde::Deserialize)]
93pub enum AsiaLocation {
94    /// Store the files in Taiwan.
95    #[serde(rename = "ASIA-EAST1")]
96    Taiwan,
97    /// Store the files in Hong Kong.
98    #[serde(rename = "ASIA-EAST2")]
99    HongKong,
100    /// Store the files in Tokyo.
101    #[serde(rename = "ASIA-NORTHEAST1")]
102    Tokyo,
103    /// Store the files in Osaka.
104    #[serde(rename = "ASIA-NORTHEAST2")]
105    Osaka,
106    /// Store the files in Mumbai.
107    #[serde(rename = "ASIA-SOUTH1")]
108    Mumbai,
109    /// Store the files in Singapore.
110    #[serde(rename = "ASIA-SOUTHEAST1")]
111    Singapore,
112}
113
114/// All options in Australia.
115#[derive(Debug, PartialEq, serde::Serialize, serde::Deserialize)]
116pub enum AusLocation {
117    /// Store the files in Sydney.
118    #[serde(rename = "AUSTRALIA-SOUTHEAST1")]
119    Sydney,
120}
121
122/// The possible options for multi-region storage.
123#[derive(Debug, PartialEq, serde::Serialize, serde::Deserialize)]
124#[serde(rename_all = "UPPERCASE")]
125pub enum MultiRegion {
126    /// Data centers in Asia
127    Asia,
128    /// Data centers in the European Union
129    ///
130    /// Object data added to a bucket in the EU multi-region is not stored in the EUROPE-WEST2 or
131    /// EUROPE-WEST6 data center.
132    Eu,
133    /// Data centers in the United States
134    Us,
135}
136
137/// The possible options for dual-region storage
138#[derive(Debug, PartialEq, serde::Serialize, serde::Deserialize)]
139#[serde(rename_all = "UPPERCASE")]
140pub enum DualRegion {
141    /// EUROPE-NORTH1 and EUROPE-WEST4. Additionally, object metadata may be stored in EUROPE-WEST1.
142    Eur4,
143    /// US-CENTRAL1 and US-EAST1. Additionally, object metadata may be stored in Tulsa, Oklahoma.
144    Nam4,
145}