google_cloud_location/
model.rs1#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate async_trait;
21extern crate bytes;
22extern crate gax;
23extern crate gaxi;
24extern crate lazy_static;
25extern crate reqwest;
26extern crate serde;
27extern crate serde_json;
28extern crate serde_with;
29extern crate std;
30extern crate tracing;
31extern crate wkt;
32
33#[serde_with::serde_as]
37#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
38#[serde(default, rename_all = "camelCase")]
39#[non_exhaustive]
40pub struct ListLocationsRequest {
41 #[serde(skip_serializing_if = "std::string::String::is_empty")]
43 pub name: std::string::String,
44
45 #[serde(skip_serializing_if = "std::string::String::is_empty")]
47 pub filter: std::string::String,
48
49 #[serde(skip_serializing_if = "wkt::internal::is_default")]
51 pub page_size: i32,
52
53 #[serde(skip_serializing_if = "std::string::String::is_empty")]
55 pub page_token: std::string::String,
56
57 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
58 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
59}
60
61impl ListLocationsRequest {
62 pub fn new() -> Self {
63 std::default::Default::default()
64 }
65
66 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
68 self.name = v.into();
69 self
70 }
71
72 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
74 self.filter = v.into();
75 self
76 }
77
78 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
80 self.page_size = v.into();
81 self
82 }
83
84 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
86 self.page_token = v.into();
87 self
88 }
89}
90
91impl wkt::message::Message for ListLocationsRequest {
92 fn typename() -> &'static str {
93 "type.googleapis.com/google.cloud.location.ListLocationsRequest"
94 }
95}
96
97#[serde_with::serde_as]
101#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
102#[serde(default, rename_all = "camelCase")]
103#[non_exhaustive]
104pub struct ListLocationsResponse {
105 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
107 pub locations: std::vec::Vec<crate::model::Location>,
108
109 #[serde(skip_serializing_if = "std::string::String::is_empty")]
111 pub next_page_token: std::string::String,
112
113 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
114 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
115}
116
117impl ListLocationsResponse {
118 pub fn new() -> Self {
119 std::default::Default::default()
120 }
121
122 pub fn set_locations<T, V>(mut self, v: T) -> Self
124 where
125 T: std::iter::IntoIterator<Item = V>,
126 V: std::convert::Into<crate::model::Location>,
127 {
128 use std::iter::Iterator;
129 self.locations = v.into_iter().map(|i| i.into()).collect();
130 self
131 }
132
133 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
135 self.next_page_token = v.into();
136 self
137 }
138}
139
140impl wkt::message::Message for ListLocationsResponse {
141 fn typename() -> &'static str {
142 "type.googleapis.com/google.cloud.location.ListLocationsResponse"
143 }
144}
145
146#[doc(hidden)]
147impl gax::paginator::internal::PageableResponse for ListLocationsResponse {
148 type PageItem = crate::model::Location;
149
150 fn items(self) -> std::vec::Vec<Self::PageItem> {
151 self.locations
152 }
153
154 fn next_page_token(&self) -> std::string::String {
155 use std::clone::Clone;
156 self.next_page_token.clone()
157 }
158}
159
160#[serde_with::serde_as]
164#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
165#[serde(default, rename_all = "camelCase")]
166#[non_exhaustive]
167pub struct GetLocationRequest {
168 #[serde(skip_serializing_if = "std::string::String::is_empty")]
170 pub name: std::string::String,
171
172 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
173 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
174}
175
176impl GetLocationRequest {
177 pub fn new() -> Self {
178 std::default::Default::default()
179 }
180
181 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
183 self.name = v.into();
184 self
185 }
186}
187
188impl wkt::message::Message for GetLocationRequest {
189 fn typename() -> &'static str {
190 "type.googleapis.com/google.cloud.location.GetLocationRequest"
191 }
192}
193
194#[serde_with::serde_as]
196#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
197#[serde(default, rename_all = "camelCase")]
198#[non_exhaustive]
199pub struct Location {
200 #[serde(skip_serializing_if = "std::string::String::is_empty")]
203 pub name: std::string::String,
204
205 #[serde(skip_serializing_if = "std::string::String::is_empty")]
207 pub location_id: std::string::String,
208
209 #[serde(skip_serializing_if = "std::string::String::is_empty")]
212 pub display_name: std::string::String,
213
214 #[serde(skip_serializing_if = "std::collections::HashMap::is_empty")]
220 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
221
222 #[serde(skip_serializing_if = "std::option::Option::is_none")]
225 pub metadata: std::option::Option<wkt::Any>,
226
227 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
228 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
229}
230
231impl Location {
232 pub fn new() -> Self {
233 std::default::Default::default()
234 }
235
236 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
238 self.name = v.into();
239 self
240 }
241
242 pub fn set_location_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
244 self.location_id = v.into();
245 self
246 }
247
248 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
250 self.display_name = v.into();
251 self
252 }
253
254 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
256 where
257 T: std::iter::IntoIterator<Item = (K, V)>,
258 K: std::convert::Into<std::string::String>,
259 V: std::convert::Into<std::string::String>,
260 {
261 use std::iter::Iterator;
262 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
263 self
264 }
265
266 pub fn set_metadata<T: std::convert::Into<std::option::Option<wkt::Any>>>(
268 mut self,
269 v: T,
270 ) -> Self {
271 self.metadata = v.into();
272 self
273 }
274}
275
276impl wkt::message::Message for Location {
277 fn typename() -> &'static str {
278 "type.googleapis.com/google.cloud.location.Location"
279 }
280}