1#![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#[derive(Clone, Default, PartialEq)]
37#[non_exhaustive]
38pub struct ListLocationsRequest {
39 pub name: std::string::String,
41
42 pub filter: std::string::String,
44
45 pub page_size: i32,
47
48 pub page_token: std::string::String,
50
51 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
52}
53
54impl ListLocationsRequest {
55 pub fn new() -> Self {
56 std::default::Default::default()
57 }
58
59 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
61 self.name = v.into();
62 self
63 }
64
65 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
67 self.filter = v.into();
68 self
69 }
70
71 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
73 self.page_size = v.into();
74 self
75 }
76
77 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
79 self.page_token = v.into();
80 self
81 }
82}
83
84impl wkt::message::Message for ListLocationsRequest {
85 fn typename() -> &'static str {
86 "type.googleapis.com/google.cloud.location.ListLocationsRequest"
87 }
88}
89
90#[doc(hidden)]
91impl<'de> serde::de::Deserialize<'de> for ListLocationsRequest {
92 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
93 where
94 D: serde::Deserializer<'de>,
95 {
96 #[allow(non_camel_case_types)]
97 #[doc(hidden)]
98 #[derive(PartialEq, Eq, Hash)]
99 enum __FieldTag {
100 __name,
101 __filter,
102 __page_size,
103 __page_token,
104 Unknown(std::string::String),
105 }
106 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
107 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
108 where
109 D: serde::Deserializer<'de>,
110 {
111 struct Visitor;
112 impl<'de> serde::de::Visitor<'de> for Visitor {
113 type Value = __FieldTag;
114 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
115 formatter.write_str("a field name for ListLocationsRequest")
116 }
117 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
118 where
119 E: serde::de::Error,
120 {
121 use std::result::Result::Ok;
122 use std::string::ToString;
123 match value {
124 "name" => Ok(__FieldTag::__name),
125 "filter" => Ok(__FieldTag::__filter),
126 "pageSize" => Ok(__FieldTag::__page_size),
127 "page_size" => Ok(__FieldTag::__page_size),
128 "pageToken" => Ok(__FieldTag::__page_token),
129 "page_token" => Ok(__FieldTag::__page_token),
130 _ => Ok(__FieldTag::Unknown(value.to_string())),
131 }
132 }
133 }
134 deserializer.deserialize_identifier(Visitor)
135 }
136 }
137 struct Visitor;
138 impl<'de> serde::de::Visitor<'de> for Visitor {
139 type Value = ListLocationsRequest;
140 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
141 formatter.write_str("struct ListLocationsRequest")
142 }
143 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
144 where
145 A: serde::de::MapAccess<'de>,
146 {
147 #[allow(unused_imports)]
148 use serde::de::Error;
149 use std::option::Option::Some;
150 let mut fields = std::collections::HashSet::new();
151 let mut result = Self::Value::new();
152 while let Some(tag) = map.next_key::<__FieldTag>()? {
153 #[allow(clippy::match_single_binding)]
154 match tag {
155 __FieldTag::__name => {
156 if !fields.insert(__FieldTag::__name) {
157 return std::result::Result::Err(A::Error::duplicate_field(
158 "multiple values for name",
159 ));
160 }
161 result.name = map
162 .next_value::<std::option::Option<std::string::String>>()?
163 .unwrap_or_default();
164 }
165 __FieldTag::__filter => {
166 if !fields.insert(__FieldTag::__filter) {
167 return std::result::Result::Err(A::Error::duplicate_field(
168 "multiple values for filter",
169 ));
170 }
171 result.filter = map
172 .next_value::<std::option::Option<std::string::String>>()?
173 .unwrap_or_default();
174 }
175 __FieldTag::__page_size => {
176 if !fields.insert(__FieldTag::__page_size) {
177 return std::result::Result::Err(A::Error::duplicate_field(
178 "multiple values for page_size",
179 ));
180 }
181 struct __With(std::option::Option<i32>);
182 impl<'de> serde::de::Deserialize<'de> for __With {
183 fn deserialize<D>(
184 deserializer: D,
185 ) -> std::result::Result<Self, D::Error>
186 where
187 D: serde::de::Deserializer<'de>,
188 {
189 serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
190 }
191 }
192 result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
193 }
194 __FieldTag::__page_token => {
195 if !fields.insert(__FieldTag::__page_token) {
196 return std::result::Result::Err(A::Error::duplicate_field(
197 "multiple values for page_token",
198 ));
199 }
200 result.page_token = map
201 .next_value::<std::option::Option<std::string::String>>()?
202 .unwrap_or_default();
203 }
204 __FieldTag::Unknown(key) => {
205 let value = map.next_value::<serde_json::Value>()?;
206 result._unknown_fields.insert(key, value);
207 }
208 }
209 }
210 std::result::Result::Ok(result)
211 }
212 }
213 deserializer.deserialize_any(Visitor)
214 }
215}
216
217#[doc(hidden)]
218impl serde::ser::Serialize for ListLocationsRequest {
219 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
220 where
221 S: serde::ser::Serializer,
222 {
223 use serde::ser::SerializeMap;
224 #[allow(unused_imports)]
225 use std::option::Option::Some;
226 let mut state = serializer.serialize_map(std::option::Option::None)?;
227 if !self.name.is_empty() {
228 state.serialize_entry("name", &self.name)?;
229 }
230 if !self.filter.is_empty() {
231 state.serialize_entry("filter", &self.filter)?;
232 }
233 if !wkt::internal::is_default(&self.page_size) {
234 struct __With<'a>(&'a i32);
235 impl<'a> serde::ser::Serialize for __With<'a> {
236 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
237 where
238 S: serde::ser::Serializer,
239 {
240 serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
241 }
242 }
243 state.serialize_entry("pageSize", &__With(&self.page_size))?;
244 }
245 if !self.page_token.is_empty() {
246 state.serialize_entry("pageToken", &self.page_token)?;
247 }
248 if !self._unknown_fields.is_empty() {
249 for (key, value) in self._unknown_fields.iter() {
250 state.serialize_entry(key, &value)?;
251 }
252 }
253 state.end()
254 }
255}
256
257impl std::fmt::Debug for ListLocationsRequest {
258 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
259 let mut debug_struct = f.debug_struct("ListLocationsRequest");
260 debug_struct.field("name", &self.name);
261 debug_struct.field("filter", &self.filter);
262 debug_struct.field("page_size", &self.page_size);
263 debug_struct.field("page_token", &self.page_token);
264 if !self._unknown_fields.is_empty() {
265 debug_struct.field("_unknown_fields", &self._unknown_fields);
266 }
267 debug_struct.finish()
268 }
269}
270
271#[derive(Clone, Default, PartialEq)]
275#[non_exhaustive]
276pub struct ListLocationsResponse {
277 pub locations: std::vec::Vec<crate::model::Location>,
279
280 pub next_page_token: std::string::String,
282
283 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
284}
285
286impl ListLocationsResponse {
287 pub fn new() -> Self {
288 std::default::Default::default()
289 }
290
291 pub fn set_locations<T, V>(mut self, v: T) -> Self
293 where
294 T: std::iter::IntoIterator<Item = V>,
295 V: std::convert::Into<crate::model::Location>,
296 {
297 use std::iter::Iterator;
298 self.locations = v.into_iter().map(|i| i.into()).collect();
299 self
300 }
301
302 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
304 self.next_page_token = v.into();
305 self
306 }
307}
308
309impl wkt::message::Message for ListLocationsResponse {
310 fn typename() -> &'static str {
311 "type.googleapis.com/google.cloud.location.ListLocationsResponse"
312 }
313}
314
315#[doc(hidden)]
316impl gax::paginator::internal::PageableResponse for ListLocationsResponse {
317 type PageItem = crate::model::Location;
318
319 fn items(self) -> std::vec::Vec<Self::PageItem> {
320 self.locations
321 }
322
323 fn next_page_token(&self) -> std::string::String {
324 use std::clone::Clone;
325 self.next_page_token.clone()
326 }
327}
328
329#[doc(hidden)]
330impl<'de> serde::de::Deserialize<'de> for ListLocationsResponse {
331 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
332 where
333 D: serde::Deserializer<'de>,
334 {
335 #[allow(non_camel_case_types)]
336 #[doc(hidden)]
337 #[derive(PartialEq, Eq, Hash)]
338 enum __FieldTag {
339 __locations,
340 __next_page_token,
341 Unknown(std::string::String),
342 }
343 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
344 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
345 where
346 D: serde::Deserializer<'de>,
347 {
348 struct Visitor;
349 impl<'de> serde::de::Visitor<'de> for Visitor {
350 type Value = __FieldTag;
351 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
352 formatter.write_str("a field name for ListLocationsResponse")
353 }
354 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
355 where
356 E: serde::de::Error,
357 {
358 use std::result::Result::Ok;
359 use std::string::ToString;
360 match value {
361 "locations" => Ok(__FieldTag::__locations),
362 "nextPageToken" => Ok(__FieldTag::__next_page_token),
363 "next_page_token" => Ok(__FieldTag::__next_page_token),
364 _ => Ok(__FieldTag::Unknown(value.to_string())),
365 }
366 }
367 }
368 deserializer.deserialize_identifier(Visitor)
369 }
370 }
371 struct Visitor;
372 impl<'de> serde::de::Visitor<'de> for Visitor {
373 type Value = ListLocationsResponse;
374 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
375 formatter.write_str("struct ListLocationsResponse")
376 }
377 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
378 where
379 A: serde::de::MapAccess<'de>,
380 {
381 #[allow(unused_imports)]
382 use serde::de::Error;
383 use std::option::Option::Some;
384 let mut fields = std::collections::HashSet::new();
385 let mut result = Self::Value::new();
386 while let Some(tag) = map.next_key::<__FieldTag>()? {
387 #[allow(clippy::match_single_binding)]
388 match tag {
389 __FieldTag::__locations => {
390 if !fields.insert(__FieldTag::__locations) {
391 return std::result::Result::Err(A::Error::duplicate_field(
392 "multiple values for locations",
393 ));
394 }
395 result.locations = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Location>>>()?.unwrap_or_default();
396 }
397 __FieldTag::__next_page_token => {
398 if !fields.insert(__FieldTag::__next_page_token) {
399 return std::result::Result::Err(A::Error::duplicate_field(
400 "multiple values for next_page_token",
401 ));
402 }
403 result.next_page_token = map
404 .next_value::<std::option::Option<std::string::String>>()?
405 .unwrap_or_default();
406 }
407 __FieldTag::Unknown(key) => {
408 let value = map.next_value::<serde_json::Value>()?;
409 result._unknown_fields.insert(key, value);
410 }
411 }
412 }
413 std::result::Result::Ok(result)
414 }
415 }
416 deserializer.deserialize_any(Visitor)
417 }
418}
419
420#[doc(hidden)]
421impl serde::ser::Serialize for ListLocationsResponse {
422 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
423 where
424 S: serde::ser::Serializer,
425 {
426 use serde::ser::SerializeMap;
427 #[allow(unused_imports)]
428 use std::option::Option::Some;
429 let mut state = serializer.serialize_map(std::option::Option::None)?;
430 if !self.locations.is_empty() {
431 state.serialize_entry("locations", &self.locations)?;
432 }
433 if !self.next_page_token.is_empty() {
434 state.serialize_entry("nextPageToken", &self.next_page_token)?;
435 }
436 if !self._unknown_fields.is_empty() {
437 for (key, value) in self._unknown_fields.iter() {
438 state.serialize_entry(key, &value)?;
439 }
440 }
441 state.end()
442 }
443}
444
445impl std::fmt::Debug for ListLocationsResponse {
446 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
447 let mut debug_struct = f.debug_struct("ListLocationsResponse");
448 debug_struct.field("locations", &self.locations);
449 debug_struct.field("next_page_token", &self.next_page_token);
450 if !self._unknown_fields.is_empty() {
451 debug_struct.field("_unknown_fields", &self._unknown_fields);
452 }
453 debug_struct.finish()
454 }
455}
456
457#[derive(Clone, Default, PartialEq)]
461#[non_exhaustive]
462pub struct GetLocationRequest {
463 pub name: std::string::String,
465
466 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
467}
468
469impl GetLocationRequest {
470 pub fn new() -> Self {
471 std::default::Default::default()
472 }
473
474 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
476 self.name = v.into();
477 self
478 }
479}
480
481impl wkt::message::Message for GetLocationRequest {
482 fn typename() -> &'static str {
483 "type.googleapis.com/google.cloud.location.GetLocationRequest"
484 }
485}
486
487#[doc(hidden)]
488impl<'de> serde::de::Deserialize<'de> for GetLocationRequest {
489 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
490 where
491 D: serde::Deserializer<'de>,
492 {
493 #[allow(non_camel_case_types)]
494 #[doc(hidden)]
495 #[derive(PartialEq, Eq, Hash)]
496 enum __FieldTag {
497 __name,
498 Unknown(std::string::String),
499 }
500 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
501 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
502 where
503 D: serde::Deserializer<'de>,
504 {
505 struct Visitor;
506 impl<'de> serde::de::Visitor<'de> for Visitor {
507 type Value = __FieldTag;
508 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
509 formatter.write_str("a field name for GetLocationRequest")
510 }
511 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
512 where
513 E: serde::de::Error,
514 {
515 use std::result::Result::Ok;
516 use std::string::ToString;
517 match value {
518 "name" => Ok(__FieldTag::__name),
519 _ => Ok(__FieldTag::Unknown(value.to_string())),
520 }
521 }
522 }
523 deserializer.deserialize_identifier(Visitor)
524 }
525 }
526 struct Visitor;
527 impl<'de> serde::de::Visitor<'de> for Visitor {
528 type Value = GetLocationRequest;
529 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
530 formatter.write_str("struct GetLocationRequest")
531 }
532 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
533 where
534 A: serde::de::MapAccess<'de>,
535 {
536 #[allow(unused_imports)]
537 use serde::de::Error;
538 use std::option::Option::Some;
539 let mut fields = std::collections::HashSet::new();
540 let mut result = Self::Value::new();
541 while let Some(tag) = map.next_key::<__FieldTag>()? {
542 #[allow(clippy::match_single_binding)]
543 match tag {
544 __FieldTag::__name => {
545 if !fields.insert(__FieldTag::__name) {
546 return std::result::Result::Err(A::Error::duplicate_field(
547 "multiple values for name",
548 ));
549 }
550 result.name = map
551 .next_value::<std::option::Option<std::string::String>>()?
552 .unwrap_or_default();
553 }
554 __FieldTag::Unknown(key) => {
555 let value = map.next_value::<serde_json::Value>()?;
556 result._unknown_fields.insert(key, value);
557 }
558 }
559 }
560 std::result::Result::Ok(result)
561 }
562 }
563 deserializer.deserialize_any(Visitor)
564 }
565}
566
567#[doc(hidden)]
568impl serde::ser::Serialize for GetLocationRequest {
569 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
570 where
571 S: serde::ser::Serializer,
572 {
573 use serde::ser::SerializeMap;
574 #[allow(unused_imports)]
575 use std::option::Option::Some;
576 let mut state = serializer.serialize_map(std::option::Option::None)?;
577 if !self.name.is_empty() {
578 state.serialize_entry("name", &self.name)?;
579 }
580 if !self._unknown_fields.is_empty() {
581 for (key, value) in self._unknown_fields.iter() {
582 state.serialize_entry(key, &value)?;
583 }
584 }
585 state.end()
586 }
587}
588
589impl std::fmt::Debug for GetLocationRequest {
590 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
591 let mut debug_struct = f.debug_struct("GetLocationRequest");
592 debug_struct.field("name", &self.name);
593 if !self._unknown_fields.is_empty() {
594 debug_struct.field("_unknown_fields", &self._unknown_fields);
595 }
596 debug_struct.finish()
597 }
598}
599
600#[derive(Clone, Default, PartialEq)]
602#[non_exhaustive]
603pub struct Location {
604 pub name: std::string::String,
607
608 pub location_id: std::string::String,
610
611 pub display_name: std::string::String,
614
615 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
621
622 pub metadata: std::option::Option<wkt::Any>,
625
626 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
627}
628
629impl Location {
630 pub fn new() -> Self {
631 std::default::Default::default()
632 }
633
634 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
636 self.name = v.into();
637 self
638 }
639
640 pub fn set_location_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
642 self.location_id = v.into();
643 self
644 }
645
646 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
648 self.display_name = v.into();
649 self
650 }
651
652 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
654 where
655 T: std::iter::IntoIterator<Item = (K, V)>,
656 K: std::convert::Into<std::string::String>,
657 V: std::convert::Into<std::string::String>,
658 {
659 use std::iter::Iterator;
660 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
661 self
662 }
663
664 pub fn set_metadata<T>(mut self, v: T) -> Self
666 where
667 T: std::convert::Into<wkt::Any>,
668 {
669 self.metadata = std::option::Option::Some(v.into());
670 self
671 }
672
673 pub fn set_or_clear_metadata<T>(mut self, v: std::option::Option<T>) -> Self
675 where
676 T: std::convert::Into<wkt::Any>,
677 {
678 self.metadata = v.map(|x| x.into());
679 self
680 }
681}
682
683impl wkt::message::Message for Location {
684 fn typename() -> &'static str {
685 "type.googleapis.com/google.cloud.location.Location"
686 }
687}
688
689#[doc(hidden)]
690impl<'de> serde::de::Deserialize<'de> for Location {
691 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
692 where
693 D: serde::Deserializer<'de>,
694 {
695 #[allow(non_camel_case_types)]
696 #[doc(hidden)]
697 #[derive(PartialEq, Eq, Hash)]
698 enum __FieldTag {
699 __name,
700 __location_id,
701 __display_name,
702 __labels,
703 __metadata,
704 Unknown(std::string::String),
705 }
706 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
707 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
708 where
709 D: serde::Deserializer<'de>,
710 {
711 struct Visitor;
712 impl<'de> serde::de::Visitor<'de> for Visitor {
713 type Value = __FieldTag;
714 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
715 formatter.write_str("a field name for Location")
716 }
717 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
718 where
719 E: serde::de::Error,
720 {
721 use std::result::Result::Ok;
722 use std::string::ToString;
723 match value {
724 "name" => Ok(__FieldTag::__name),
725 "locationId" => Ok(__FieldTag::__location_id),
726 "location_id" => Ok(__FieldTag::__location_id),
727 "displayName" => Ok(__FieldTag::__display_name),
728 "display_name" => Ok(__FieldTag::__display_name),
729 "labels" => Ok(__FieldTag::__labels),
730 "metadata" => Ok(__FieldTag::__metadata),
731 _ => Ok(__FieldTag::Unknown(value.to_string())),
732 }
733 }
734 }
735 deserializer.deserialize_identifier(Visitor)
736 }
737 }
738 struct Visitor;
739 impl<'de> serde::de::Visitor<'de> for Visitor {
740 type Value = Location;
741 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
742 formatter.write_str("struct Location")
743 }
744 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
745 where
746 A: serde::de::MapAccess<'de>,
747 {
748 #[allow(unused_imports)]
749 use serde::de::Error;
750 use std::option::Option::Some;
751 let mut fields = std::collections::HashSet::new();
752 let mut result = Self::Value::new();
753 while let Some(tag) = map.next_key::<__FieldTag>()? {
754 #[allow(clippy::match_single_binding)]
755 match tag {
756 __FieldTag::__name => {
757 if !fields.insert(__FieldTag::__name) {
758 return std::result::Result::Err(A::Error::duplicate_field(
759 "multiple values for name",
760 ));
761 }
762 result.name = map
763 .next_value::<std::option::Option<std::string::String>>()?
764 .unwrap_or_default();
765 }
766 __FieldTag::__location_id => {
767 if !fields.insert(__FieldTag::__location_id) {
768 return std::result::Result::Err(A::Error::duplicate_field(
769 "multiple values for location_id",
770 ));
771 }
772 result.location_id = map
773 .next_value::<std::option::Option<std::string::String>>()?
774 .unwrap_or_default();
775 }
776 __FieldTag::__display_name => {
777 if !fields.insert(__FieldTag::__display_name) {
778 return std::result::Result::Err(A::Error::duplicate_field(
779 "multiple values for display_name",
780 ));
781 }
782 result.display_name = map
783 .next_value::<std::option::Option<std::string::String>>()?
784 .unwrap_or_default();
785 }
786 __FieldTag::__labels => {
787 if !fields.insert(__FieldTag::__labels) {
788 return std::result::Result::Err(A::Error::duplicate_field(
789 "multiple values for labels",
790 ));
791 }
792 result.labels = map
793 .next_value::<std::option::Option<
794 std::collections::HashMap<
795 std::string::String,
796 std::string::String,
797 >,
798 >>()?
799 .unwrap_or_default();
800 }
801 __FieldTag::__metadata => {
802 if !fields.insert(__FieldTag::__metadata) {
803 return std::result::Result::Err(A::Error::duplicate_field(
804 "multiple values for metadata",
805 ));
806 }
807 result.metadata = map.next_value::<std::option::Option<wkt::Any>>()?;
808 }
809 __FieldTag::Unknown(key) => {
810 let value = map.next_value::<serde_json::Value>()?;
811 result._unknown_fields.insert(key, value);
812 }
813 }
814 }
815 std::result::Result::Ok(result)
816 }
817 }
818 deserializer.deserialize_any(Visitor)
819 }
820}
821
822#[doc(hidden)]
823impl serde::ser::Serialize for Location {
824 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
825 where
826 S: serde::ser::Serializer,
827 {
828 use serde::ser::SerializeMap;
829 #[allow(unused_imports)]
830 use std::option::Option::Some;
831 let mut state = serializer.serialize_map(std::option::Option::None)?;
832 if !self.name.is_empty() {
833 state.serialize_entry("name", &self.name)?;
834 }
835 if !self.location_id.is_empty() {
836 state.serialize_entry("locationId", &self.location_id)?;
837 }
838 if !self.display_name.is_empty() {
839 state.serialize_entry("displayName", &self.display_name)?;
840 }
841 if !self.labels.is_empty() {
842 state.serialize_entry("labels", &self.labels)?;
843 }
844 if self.metadata.is_some() {
845 state.serialize_entry("metadata", &self.metadata)?;
846 }
847 if !self._unknown_fields.is_empty() {
848 for (key, value) in self._unknown_fields.iter() {
849 state.serialize_entry(key, &value)?;
850 }
851 }
852 state.end()
853 }
854}
855
856impl std::fmt::Debug for Location {
857 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
858 let mut debug_struct = f.debug_struct("Location");
859 debug_struct.field("name", &self.name);
860 debug_struct.field("location_id", &self.location_id);
861 debug_struct.field("display_name", &self.display_name);
862 debug_struct.field("labels", &self.labels);
863 debug_struct.field("metadata", &self.metadata);
864 if !self._unknown_fields.is_empty() {
865 debug_struct.field("_unknown_fields", &self._unknown_fields);
866 }
867 debug_struct.finish()
868 }
869}