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
33mod debug;
34mod deserialize;
35mod serialize;
36
37#[derive(Clone, Default, PartialEq)]
41#[non_exhaustive]
42pub struct ListLocationsRequest {
43 pub name: std::string::String,
45
46 pub filter: std::string::String,
48
49 pub page_size: i32,
51
52 pub page_token: std::string::String,
54
55 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
56}
57
58impl ListLocationsRequest {
59 pub fn new() -> Self {
60 std::default::Default::default()
61 }
62
63 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
65 self.name = v.into();
66 self
67 }
68
69 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
71 self.filter = v.into();
72 self
73 }
74
75 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
77 self.page_size = v.into();
78 self
79 }
80
81 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
83 self.page_token = v.into();
84 self
85 }
86}
87
88impl wkt::message::Message for ListLocationsRequest {
89 fn typename() -> &'static str {
90 "type.googleapis.com/google.cloud.location.ListLocationsRequest"
91 }
92}
93
94#[derive(Clone, Default, PartialEq)]
98#[non_exhaustive]
99pub struct ListLocationsResponse {
100 pub locations: std::vec::Vec<crate::model::Location>,
102
103 pub next_page_token: std::string::String,
105
106 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
107}
108
109impl ListLocationsResponse {
110 pub fn new() -> Self {
111 std::default::Default::default()
112 }
113
114 pub fn set_locations<T, V>(mut self, v: T) -> Self
116 where
117 T: std::iter::IntoIterator<Item = V>,
118 V: std::convert::Into<crate::model::Location>,
119 {
120 use std::iter::Iterator;
121 self.locations = v.into_iter().map(|i| i.into()).collect();
122 self
123 }
124
125 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
127 self.next_page_token = v.into();
128 self
129 }
130}
131
132impl wkt::message::Message for ListLocationsResponse {
133 fn typename() -> &'static str {
134 "type.googleapis.com/google.cloud.location.ListLocationsResponse"
135 }
136}
137
138#[doc(hidden)]
139impl gax::paginator::internal::PageableResponse for ListLocationsResponse {
140 type PageItem = crate::model::Location;
141
142 fn items(self) -> std::vec::Vec<Self::PageItem> {
143 self.locations
144 }
145
146 fn next_page_token(&self) -> std::string::String {
147 use std::clone::Clone;
148 self.next_page_token.clone()
149 }
150}
151
152#[derive(Clone, Default, PartialEq)]
156#[non_exhaustive]
157pub struct GetLocationRequest {
158 pub name: std::string::String,
160
161 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
162}
163
164impl GetLocationRequest {
165 pub fn new() -> Self {
166 std::default::Default::default()
167 }
168
169 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
171 self.name = v.into();
172 self
173 }
174}
175
176impl wkt::message::Message for GetLocationRequest {
177 fn typename() -> &'static str {
178 "type.googleapis.com/google.cloud.location.GetLocationRequest"
179 }
180}
181
182#[derive(Clone, Default, PartialEq)]
184#[non_exhaustive]
185pub struct Location {
186 pub name: std::string::String,
189
190 pub location_id: std::string::String,
192
193 pub display_name: std::string::String,
196
197 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
203
204 pub metadata: std::option::Option<wkt::Any>,
207
208 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
209}
210
211impl Location {
212 pub fn new() -> Self {
213 std::default::Default::default()
214 }
215
216 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
218 self.name = v.into();
219 self
220 }
221
222 pub fn set_location_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
224 self.location_id = v.into();
225 self
226 }
227
228 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
230 self.display_name = v.into();
231 self
232 }
233
234 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
236 where
237 T: std::iter::IntoIterator<Item = (K, V)>,
238 K: std::convert::Into<std::string::String>,
239 V: std::convert::Into<std::string::String>,
240 {
241 use std::iter::Iterator;
242 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
243 self
244 }
245
246 pub fn set_metadata<T>(mut self, v: T) -> Self
248 where
249 T: std::convert::Into<wkt::Any>,
250 {
251 self.metadata = std::option::Option::Some(v.into());
252 self
253 }
254
255 pub fn set_or_clear_metadata<T>(mut self, v: std::option::Option<T>) -> Self
257 where
258 T: std::convert::Into<wkt::Any>,
259 {
260 self.metadata = v.map(|x| x.into());
261 self
262 }
263}
264
265impl wkt::message::Message for Location {
266 fn typename() -> &'static str {
267 "type.googleapis.com/google.cloud.location.Location"
268 }
269}