1#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate bytes;
21extern crate serde;
22extern crate serde_json;
23extern crate serde_with;
24extern crate std;
25extern crate wkt;
26
27#[derive(Clone, Debug, Default, PartialEq)]
56#[non_exhaustive]
57pub struct ErrorInfo {
58 pub reason: std::string::String,
64
65 pub domain: std::string::String,
72
73 pub metadata: std::collections::HashMap<std::string::String, std::string::String>,
83
84 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
85}
86
87impl ErrorInfo {
88 pub fn new() -> Self {
89 std::default::Default::default()
90 }
91
92 pub fn set_reason<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
94 self.reason = v.into();
95 self
96 }
97
98 pub fn set_domain<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
100 self.domain = v.into();
101 self
102 }
103
104 pub fn set_metadata<T, K, V>(mut self, v: T) -> Self
106 where
107 T: std::iter::IntoIterator<Item = (K, V)>,
108 K: std::convert::Into<std::string::String>,
109 V: std::convert::Into<std::string::String>,
110 {
111 use std::iter::Iterator;
112 self.metadata = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
113 self
114 }
115}
116
117impl wkt::message::Message for ErrorInfo {
118 fn typename() -> &'static str {
119 "type.googleapis.com/google.rpc.ErrorInfo"
120 }
121}
122
123#[doc(hidden)]
124impl<'de> serde::de::Deserialize<'de> for ErrorInfo {
125 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
126 where
127 D: serde::Deserializer<'de>,
128 {
129 #[allow(non_camel_case_types)]
130 #[doc(hidden)]
131 #[derive(PartialEq, Eq, Hash)]
132 enum __FieldTag {
133 __reason,
134 __domain,
135 __metadata,
136 Unknown(std::string::String),
137 }
138 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
139 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
140 where
141 D: serde::Deserializer<'de>,
142 {
143 struct Visitor;
144 impl<'de> serde::de::Visitor<'de> for Visitor {
145 type Value = __FieldTag;
146 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
147 formatter.write_str("a field name for ErrorInfo")
148 }
149 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
150 where
151 E: serde::de::Error,
152 {
153 use std::result::Result::Ok;
154 use std::string::ToString;
155 match value {
156 "reason" => Ok(__FieldTag::__reason),
157 "domain" => Ok(__FieldTag::__domain),
158 "metadata" => Ok(__FieldTag::__metadata),
159 _ => Ok(__FieldTag::Unknown(value.to_string())),
160 }
161 }
162 }
163 deserializer.deserialize_identifier(Visitor)
164 }
165 }
166 struct Visitor;
167 impl<'de> serde::de::Visitor<'de> for Visitor {
168 type Value = ErrorInfo;
169 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
170 formatter.write_str("struct ErrorInfo")
171 }
172 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
173 where
174 A: serde::de::MapAccess<'de>,
175 {
176 #[allow(unused_imports)]
177 use serde::de::Error;
178 use std::option::Option::Some;
179 let mut fields = std::collections::HashSet::new();
180 let mut result = Self::Value::new();
181 while let Some(tag) = map.next_key::<__FieldTag>()? {
182 #[allow(clippy::match_single_binding)]
183 match tag {
184 __FieldTag::__reason => {
185 if !fields.insert(__FieldTag::__reason) {
186 return std::result::Result::Err(A::Error::duplicate_field(
187 "multiple values for reason",
188 ));
189 }
190 result.reason = map
191 .next_value::<std::option::Option<std::string::String>>()?
192 .unwrap_or_default();
193 }
194 __FieldTag::__domain => {
195 if !fields.insert(__FieldTag::__domain) {
196 return std::result::Result::Err(A::Error::duplicate_field(
197 "multiple values for domain",
198 ));
199 }
200 result.domain = map
201 .next_value::<std::option::Option<std::string::String>>()?
202 .unwrap_or_default();
203 }
204 __FieldTag::__metadata => {
205 if !fields.insert(__FieldTag::__metadata) {
206 return std::result::Result::Err(A::Error::duplicate_field(
207 "multiple values for metadata",
208 ));
209 }
210 result.metadata = map
211 .next_value::<std::option::Option<
212 std::collections::HashMap<
213 std::string::String,
214 std::string::String,
215 >,
216 >>()?
217 .unwrap_or_default();
218 }
219 __FieldTag::Unknown(key) => {
220 let value = map.next_value::<serde_json::Value>()?;
221 result._unknown_fields.insert(key, value);
222 }
223 }
224 }
225 std::result::Result::Ok(result)
226 }
227 }
228 deserializer.deserialize_any(Visitor)
229 }
230}
231
232#[doc(hidden)]
233impl serde::ser::Serialize for ErrorInfo {
234 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
235 where
236 S: serde::ser::Serializer,
237 {
238 use serde::ser::SerializeMap;
239 #[allow(unused_imports)]
240 use std::option::Option::Some;
241 let mut state = serializer.serialize_map(std::option::Option::None)?;
242 if !self.reason.is_empty() {
243 state.serialize_entry("reason", &self.reason)?;
244 }
245 if !self.domain.is_empty() {
246 state.serialize_entry("domain", &self.domain)?;
247 }
248 if !self.metadata.is_empty() {
249 state.serialize_entry("metadata", &self.metadata)?;
250 }
251 if !self._unknown_fields.is_empty() {
252 for (key, value) in self._unknown_fields.iter() {
253 state.serialize_entry(key, &value)?;
254 }
255 }
256 state.end()
257 }
258}
259
260#[derive(Clone, Debug, Default, PartialEq)]
274#[non_exhaustive]
275pub struct RetryInfo {
276 pub retry_delay: std::option::Option<wkt::Duration>,
278
279 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
280}
281
282impl RetryInfo {
283 pub fn new() -> Self {
284 std::default::Default::default()
285 }
286
287 pub fn set_retry_delay<T>(mut self, v: T) -> Self
289 where
290 T: std::convert::Into<wkt::Duration>,
291 {
292 self.retry_delay = std::option::Option::Some(v.into());
293 self
294 }
295
296 pub fn set_or_clear_retry_delay<T>(mut self, v: std::option::Option<T>) -> Self
298 where
299 T: std::convert::Into<wkt::Duration>,
300 {
301 self.retry_delay = v.map(|x| x.into());
302 self
303 }
304}
305
306impl wkt::message::Message for RetryInfo {
307 fn typename() -> &'static str {
308 "type.googleapis.com/google.rpc.RetryInfo"
309 }
310}
311
312#[doc(hidden)]
313impl<'de> serde::de::Deserialize<'de> for RetryInfo {
314 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
315 where
316 D: serde::Deserializer<'de>,
317 {
318 #[allow(non_camel_case_types)]
319 #[doc(hidden)]
320 #[derive(PartialEq, Eq, Hash)]
321 enum __FieldTag {
322 __retry_delay,
323 Unknown(std::string::String),
324 }
325 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
326 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
327 where
328 D: serde::Deserializer<'de>,
329 {
330 struct Visitor;
331 impl<'de> serde::de::Visitor<'de> for Visitor {
332 type Value = __FieldTag;
333 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
334 formatter.write_str("a field name for RetryInfo")
335 }
336 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
337 where
338 E: serde::de::Error,
339 {
340 use std::result::Result::Ok;
341 use std::string::ToString;
342 match value {
343 "retryDelay" => Ok(__FieldTag::__retry_delay),
344 "retry_delay" => Ok(__FieldTag::__retry_delay),
345 _ => Ok(__FieldTag::Unknown(value.to_string())),
346 }
347 }
348 }
349 deserializer.deserialize_identifier(Visitor)
350 }
351 }
352 struct Visitor;
353 impl<'de> serde::de::Visitor<'de> for Visitor {
354 type Value = RetryInfo;
355 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
356 formatter.write_str("struct RetryInfo")
357 }
358 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
359 where
360 A: serde::de::MapAccess<'de>,
361 {
362 #[allow(unused_imports)]
363 use serde::de::Error;
364 use std::option::Option::Some;
365 let mut fields = std::collections::HashSet::new();
366 let mut result = Self::Value::new();
367 while let Some(tag) = map.next_key::<__FieldTag>()? {
368 #[allow(clippy::match_single_binding)]
369 match tag {
370 __FieldTag::__retry_delay => {
371 if !fields.insert(__FieldTag::__retry_delay) {
372 return std::result::Result::Err(A::Error::duplicate_field(
373 "multiple values for retry_delay",
374 ));
375 }
376 result.retry_delay =
377 map.next_value::<std::option::Option<wkt::Duration>>()?;
378 }
379 __FieldTag::Unknown(key) => {
380 let value = map.next_value::<serde_json::Value>()?;
381 result._unknown_fields.insert(key, value);
382 }
383 }
384 }
385 std::result::Result::Ok(result)
386 }
387 }
388 deserializer.deserialize_any(Visitor)
389 }
390}
391
392#[doc(hidden)]
393impl serde::ser::Serialize for RetryInfo {
394 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
395 where
396 S: serde::ser::Serializer,
397 {
398 use serde::ser::SerializeMap;
399 #[allow(unused_imports)]
400 use std::option::Option::Some;
401 let mut state = serializer.serialize_map(std::option::Option::None)?;
402 if self.retry_delay.is_some() {
403 state.serialize_entry("retryDelay", &self.retry_delay)?;
404 }
405 if !self._unknown_fields.is_empty() {
406 for (key, value) in self._unknown_fields.iter() {
407 state.serialize_entry(key, &value)?;
408 }
409 }
410 state.end()
411 }
412}
413
414#[derive(Clone, Debug, Default, PartialEq)]
416#[non_exhaustive]
417pub struct DebugInfo {
418 pub stack_entries: std::vec::Vec<std::string::String>,
420
421 pub detail: std::string::String,
423
424 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
425}
426
427impl DebugInfo {
428 pub fn new() -> Self {
429 std::default::Default::default()
430 }
431
432 pub fn set_stack_entries<T, V>(mut self, v: T) -> Self
434 where
435 T: std::iter::IntoIterator<Item = V>,
436 V: std::convert::Into<std::string::String>,
437 {
438 use std::iter::Iterator;
439 self.stack_entries = v.into_iter().map(|i| i.into()).collect();
440 self
441 }
442
443 pub fn set_detail<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
445 self.detail = v.into();
446 self
447 }
448}
449
450impl wkt::message::Message for DebugInfo {
451 fn typename() -> &'static str {
452 "type.googleapis.com/google.rpc.DebugInfo"
453 }
454}
455
456#[doc(hidden)]
457impl<'de> serde::de::Deserialize<'de> for DebugInfo {
458 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
459 where
460 D: serde::Deserializer<'de>,
461 {
462 #[allow(non_camel_case_types)]
463 #[doc(hidden)]
464 #[derive(PartialEq, Eq, Hash)]
465 enum __FieldTag {
466 __stack_entries,
467 __detail,
468 Unknown(std::string::String),
469 }
470 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
471 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
472 where
473 D: serde::Deserializer<'de>,
474 {
475 struct Visitor;
476 impl<'de> serde::de::Visitor<'de> for Visitor {
477 type Value = __FieldTag;
478 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
479 formatter.write_str("a field name for DebugInfo")
480 }
481 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
482 where
483 E: serde::de::Error,
484 {
485 use std::result::Result::Ok;
486 use std::string::ToString;
487 match value {
488 "stackEntries" => Ok(__FieldTag::__stack_entries),
489 "stack_entries" => Ok(__FieldTag::__stack_entries),
490 "detail" => Ok(__FieldTag::__detail),
491 _ => Ok(__FieldTag::Unknown(value.to_string())),
492 }
493 }
494 }
495 deserializer.deserialize_identifier(Visitor)
496 }
497 }
498 struct Visitor;
499 impl<'de> serde::de::Visitor<'de> for Visitor {
500 type Value = DebugInfo;
501 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
502 formatter.write_str("struct DebugInfo")
503 }
504 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
505 where
506 A: serde::de::MapAccess<'de>,
507 {
508 #[allow(unused_imports)]
509 use serde::de::Error;
510 use std::option::Option::Some;
511 let mut fields = std::collections::HashSet::new();
512 let mut result = Self::Value::new();
513 while let Some(tag) = map.next_key::<__FieldTag>()? {
514 #[allow(clippy::match_single_binding)]
515 match tag {
516 __FieldTag::__stack_entries => {
517 if !fields.insert(__FieldTag::__stack_entries) {
518 return std::result::Result::Err(A::Error::duplicate_field(
519 "multiple values for stack_entries",
520 ));
521 }
522 result.stack_entries = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
523 }
524 __FieldTag::__detail => {
525 if !fields.insert(__FieldTag::__detail) {
526 return std::result::Result::Err(A::Error::duplicate_field(
527 "multiple values for detail",
528 ));
529 }
530 result.detail = map
531 .next_value::<std::option::Option<std::string::String>>()?
532 .unwrap_or_default();
533 }
534 __FieldTag::Unknown(key) => {
535 let value = map.next_value::<serde_json::Value>()?;
536 result._unknown_fields.insert(key, value);
537 }
538 }
539 }
540 std::result::Result::Ok(result)
541 }
542 }
543 deserializer.deserialize_any(Visitor)
544 }
545}
546
547#[doc(hidden)]
548impl serde::ser::Serialize for DebugInfo {
549 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
550 where
551 S: serde::ser::Serializer,
552 {
553 use serde::ser::SerializeMap;
554 #[allow(unused_imports)]
555 use std::option::Option::Some;
556 let mut state = serializer.serialize_map(std::option::Option::None)?;
557 if !self.stack_entries.is_empty() {
558 state.serialize_entry("stackEntries", &self.stack_entries)?;
559 }
560 if !self.detail.is_empty() {
561 state.serialize_entry("detail", &self.detail)?;
562 }
563 if !self._unknown_fields.is_empty() {
564 for (key, value) in self._unknown_fields.iter() {
565 state.serialize_entry(key, &value)?;
566 }
567 }
568 state.end()
569 }
570}
571
572#[derive(Clone, Debug, Default, PartialEq)]
584#[non_exhaustive]
585pub struct QuotaFailure {
586 pub violations: std::vec::Vec<crate::model::quota_failure::Violation>,
588
589 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
590}
591
592impl QuotaFailure {
593 pub fn new() -> Self {
594 std::default::Default::default()
595 }
596
597 pub fn set_violations<T, V>(mut self, v: T) -> Self
599 where
600 T: std::iter::IntoIterator<Item = V>,
601 V: std::convert::Into<crate::model::quota_failure::Violation>,
602 {
603 use std::iter::Iterator;
604 self.violations = v.into_iter().map(|i| i.into()).collect();
605 self
606 }
607}
608
609impl wkt::message::Message for QuotaFailure {
610 fn typename() -> &'static str {
611 "type.googleapis.com/google.rpc.QuotaFailure"
612 }
613}
614
615#[doc(hidden)]
616impl<'de> serde::de::Deserialize<'de> for QuotaFailure {
617 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
618 where
619 D: serde::Deserializer<'de>,
620 {
621 #[allow(non_camel_case_types)]
622 #[doc(hidden)]
623 #[derive(PartialEq, Eq, Hash)]
624 enum __FieldTag {
625 __violations,
626 Unknown(std::string::String),
627 }
628 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
629 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
630 where
631 D: serde::Deserializer<'de>,
632 {
633 struct Visitor;
634 impl<'de> serde::de::Visitor<'de> for Visitor {
635 type Value = __FieldTag;
636 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
637 formatter.write_str("a field name for QuotaFailure")
638 }
639 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
640 where
641 E: serde::de::Error,
642 {
643 use std::result::Result::Ok;
644 use std::string::ToString;
645 match value {
646 "violations" => Ok(__FieldTag::__violations),
647 _ => Ok(__FieldTag::Unknown(value.to_string())),
648 }
649 }
650 }
651 deserializer.deserialize_identifier(Visitor)
652 }
653 }
654 struct Visitor;
655 impl<'de> serde::de::Visitor<'de> for Visitor {
656 type Value = QuotaFailure;
657 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
658 formatter.write_str("struct QuotaFailure")
659 }
660 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
661 where
662 A: serde::de::MapAccess<'de>,
663 {
664 #[allow(unused_imports)]
665 use serde::de::Error;
666 use std::option::Option::Some;
667 let mut fields = std::collections::HashSet::new();
668 let mut result = Self::Value::new();
669 while let Some(tag) = map.next_key::<__FieldTag>()? {
670 #[allow(clippy::match_single_binding)]
671 match tag {
672 __FieldTag::__violations => {
673 if !fields.insert(__FieldTag::__violations) {
674 return std::result::Result::Err(A::Error::duplicate_field(
675 "multiple values for violations",
676 ));
677 }
678 result.violations = map
679 .next_value::<std::option::Option<
680 std::vec::Vec<crate::model::quota_failure::Violation>,
681 >>()?
682 .unwrap_or_default();
683 }
684 __FieldTag::Unknown(key) => {
685 let value = map.next_value::<serde_json::Value>()?;
686 result._unknown_fields.insert(key, value);
687 }
688 }
689 }
690 std::result::Result::Ok(result)
691 }
692 }
693 deserializer.deserialize_any(Visitor)
694 }
695}
696
697#[doc(hidden)]
698impl serde::ser::Serialize for QuotaFailure {
699 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
700 where
701 S: serde::ser::Serializer,
702 {
703 use serde::ser::SerializeMap;
704 #[allow(unused_imports)]
705 use std::option::Option::Some;
706 let mut state = serializer.serialize_map(std::option::Option::None)?;
707 if !self.violations.is_empty() {
708 state.serialize_entry("violations", &self.violations)?;
709 }
710 if !self._unknown_fields.is_empty() {
711 for (key, value) in self._unknown_fields.iter() {
712 state.serialize_entry(key, &value)?;
713 }
714 }
715 state.end()
716 }
717}
718
719pub mod quota_failure {
721 #[allow(unused_imports)]
722 use super::*;
723
724 #[derive(Clone, Debug, Default, PartialEq)]
727 #[non_exhaustive]
728 pub struct Violation {
729 pub subject: std::string::String,
733
734 pub description: std::string::String,
742
743 pub api_service: std::string::String,
757
758 pub quota_metric: std::string::String,
766
767 pub quota_id: std::string::String,
772
773 pub quota_dimensions: std::collections::HashMap<std::string::String, std::string::String>,
790
791 pub quota_value: i64,
797
798 pub future_quota_value: std::option::Option<i64>,
807
808 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
809 }
810
811 impl Violation {
812 pub fn new() -> Self {
813 std::default::Default::default()
814 }
815
816 pub fn set_subject<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
818 self.subject = v.into();
819 self
820 }
821
822 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
824 self.description = v.into();
825 self
826 }
827
828 pub fn set_api_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
830 self.api_service = v.into();
831 self
832 }
833
834 pub fn set_quota_metric<T: std::convert::Into<std::string::String>>(
836 mut self,
837 v: T,
838 ) -> Self {
839 self.quota_metric = v.into();
840 self
841 }
842
843 pub fn set_quota_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
845 self.quota_id = v.into();
846 self
847 }
848
849 pub fn set_quota_dimensions<T, K, V>(mut self, v: T) -> Self
851 where
852 T: std::iter::IntoIterator<Item = (K, V)>,
853 K: std::convert::Into<std::string::String>,
854 V: std::convert::Into<std::string::String>,
855 {
856 use std::iter::Iterator;
857 self.quota_dimensions = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
858 self
859 }
860
861 pub fn set_quota_value<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
863 self.quota_value = v.into();
864 self
865 }
866
867 pub fn set_future_quota_value<T>(mut self, v: T) -> Self
869 where
870 T: std::convert::Into<i64>,
871 {
872 self.future_quota_value = std::option::Option::Some(v.into());
873 self
874 }
875
876 pub fn set_or_clear_future_quota_value<T>(mut self, v: std::option::Option<T>) -> Self
878 where
879 T: std::convert::Into<i64>,
880 {
881 self.future_quota_value = v.map(|x| x.into());
882 self
883 }
884 }
885
886 impl wkt::message::Message for Violation {
887 fn typename() -> &'static str {
888 "type.googleapis.com/google.rpc.QuotaFailure.Violation"
889 }
890 }
891
892 #[doc(hidden)]
893 impl<'de> serde::de::Deserialize<'de> for Violation {
894 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
895 where
896 D: serde::Deserializer<'de>,
897 {
898 #[allow(non_camel_case_types)]
899 #[doc(hidden)]
900 #[derive(PartialEq, Eq, Hash)]
901 enum __FieldTag {
902 __subject,
903 __description,
904 __api_service,
905 __quota_metric,
906 __quota_id,
907 __quota_dimensions,
908 __quota_value,
909 __future_quota_value,
910 Unknown(std::string::String),
911 }
912 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
913 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
914 where
915 D: serde::Deserializer<'de>,
916 {
917 struct Visitor;
918 impl<'de> serde::de::Visitor<'de> for Visitor {
919 type Value = __FieldTag;
920 fn expecting(
921 &self,
922 formatter: &mut std::fmt::Formatter,
923 ) -> std::fmt::Result {
924 formatter.write_str("a field name for Violation")
925 }
926 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
927 where
928 E: serde::de::Error,
929 {
930 use std::result::Result::Ok;
931 use std::string::ToString;
932 match value {
933 "subject" => Ok(__FieldTag::__subject),
934 "description" => Ok(__FieldTag::__description),
935 "apiService" => Ok(__FieldTag::__api_service),
936 "api_service" => Ok(__FieldTag::__api_service),
937 "quotaMetric" => Ok(__FieldTag::__quota_metric),
938 "quota_metric" => Ok(__FieldTag::__quota_metric),
939 "quotaId" => Ok(__FieldTag::__quota_id),
940 "quota_id" => Ok(__FieldTag::__quota_id),
941 "quotaDimensions" => Ok(__FieldTag::__quota_dimensions),
942 "quota_dimensions" => Ok(__FieldTag::__quota_dimensions),
943 "quotaValue" => Ok(__FieldTag::__quota_value),
944 "quota_value" => Ok(__FieldTag::__quota_value),
945 "futureQuotaValue" => Ok(__FieldTag::__future_quota_value),
946 "future_quota_value" => Ok(__FieldTag::__future_quota_value),
947 _ => Ok(__FieldTag::Unknown(value.to_string())),
948 }
949 }
950 }
951 deserializer.deserialize_identifier(Visitor)
952 }
953 }
954 struct Visitor;
955 impl<'de> serde::de::Visitor<'de> for Visitor {
956 type Value = Violation;
957 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
958 formatter.write_str("struct Violation")
959 }
960 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
961 where
962 A: serde::de::MapAccess<'de>,
963 {
964 #[allow(unused_imports)]
965 use serde::de::Error;
966 use std::option::Option::Some;
967 let mut fields = std::collections::HashSet::new();
968 let mut result = Self::Value::new();
969 while let Some(tag) = map.next_key::<__FieldTag>()? {
970 #[allow(clippy::match_single_binding)]
971 match tag {
972 __FieldTag::__subject => {
973 if !fields.insert(__FieldTag::__subject) {
974 return std::result::Result::Err(A::Error::duplicate_field(
975 "multiple values for subject",
976 ));
977 }
978 result.subject = map
979 .next_value::<std::option::Option<std::string::String>>()?
980 .unwrap_or_default();
981 }
982 __FieldTag::__description => {
983 if !fields.insert(__FieldTag::__description) {
984 return std::result::Result::Err(A::Error::duplicate_field(
985 "multiple values for description",
986 ));
987 }
988 result.description = map
989 .next_value::<std::option::Option<std::string::String>>()?
990 .unwrap_or_default();
991 }
992 __FieldTag::__api_service => {
993 if !fields.insert(__FieldTag::__api_service) {
994 return std::result::Result::Err(A::Error::duplicate_field(
995 "multiple values for api_service",
996 ));
997 }
998 result.api_service = map
999 .next_value::<std::option::Option<std::string::String>>()?
1000 .unwrap_or_default();
1001 }
1002 __FieldTag::__quota_metric => {
1003 if !fields.insert(__FieldTag::__quota_metric) {
1004 return std::result::Result::Err(A::Error::duplicate_field(
1005 "multiple values for quota_metric",
1006 ));
1007 }
1008 result.quota_metric = map
1009 .next_value::<std::option::Option<std::string::String>>()?
1010 .unwrap_or_default();
1011 }
1012 __FieldTag::__quota_id => {
1013 if !fields.insert(__FieldTag::__quota_id) {
1014 return std::result::Result::Err(A::Error::duplicate_field(
1015 "multiple values for quota_id",
1016 ));
1017 }
1018 result.quota_id = map
1019 .next_value::<std::option::Option<std::string::String>>()?
1020 .unwrap_or_default();
1021 }
1022 __FieldTag::__quota_dimensions => {
1023 if !fields.insert(__FieldTag::__quota_dimensions) {
1024 return std::result::Result::Err(A::Error::duplicate_field(
1025 "multiple values for quota_dimensions",
1026 ));
1027 }
1028 result.quota_dimensions = map
1029 .next_value::<std::option::Option<
1030 std::collections::HashMap<
1031 std::string::String,
1032 std::string::String,
1033 >,
1034 >>()?
1035 .unwrap_or_default();
1036 }
1037 __FieldTag::__quota_value => {
1038 if !fields.insert(__FieldTag::__quota_value) {
1039 return std::result::Result::Err(A::Error::duplicate_field(
1040 "multiple values for quota_value",
1041 ));
1042 }
1043 struct __With(std::option::Option<i64>);
1044 impl<'de> serde::de::Deserialize<'de> for __With {
1045 fn deserialize<D>(
1046 deserializer: D,
1047 ) -> std::result::Result<Self, D::Error>
1048 where
1049 D: serde::de::Deserializer<'de>,
1050 {
1051 serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
1052 }
1053 }
1054 result.quota_value =
1055 map.next_value::<__With>()?.0.unwrap_or_default();
1056 }
1057 __FieldTag::__future_quota_value => {
1058 if !fields.insert(__FieldTag::__future_quota_value) {
1059 return std::result::Result::Err(A::Error::duplicate_field(
1060 "multiple values for future_quota_value",
1061 ));
1062 }
1063 struct __With(std::option::Option<i64>);
1064 impl<'de> serde::de::Deserialize<'de> for __With {
1065 fn deserialize<D>(
1066 deserializer: D,
1067 ) -> std::result::Result<Self, D::Error>
1068 where
1069 D: serde::de::Deserializer<'de>,
1070 {
1071 serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
1072 }
1073 }
1074 result.future_quota_value = map.next_value::<__With>()?.0;
1075 }
1076 __FieldTag::Unknown(key) => {
1077 let value = map.next_value::<serde_json::Value>()?;
1078 result._unknown_fields.insert(key, value);
1079 }
1080 }
1081 }
1082 std::result::Result::Ok(result)
1083 }
1084 }
1085 deserializer.deserialize_any(Visitor)
1086 }
1087 }
1088
1089 #[doc(hidden)]
1090 impl serde::ser::Serialize for Violation {
1091 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1092 where
1093 S: serde::ser::Serializer,
1094 {
1095 use serde::ser::SerializeMap;
1096 #[allow(unused_imports)]
1097 use std::option::Option::Some;
1098 let mut state = serializer.serialize_map(std::option::Option::None)?;
1099 if !self.subject.is_empty() {
1100 state.serialize_entry("subject", &self.subject)?;
1101 }
1102 if !self.description.is_empty() {
1103 state.serialize_entry("description", &self.description)?;
1104 }
1105 if !self.api_service.is_empty() {
1106 state.serialize_entry("apiService", &self.api_service)?;
1107 }
1108 if !self.quota_metric.is_empty() {
1109 state.serialize_entry("quotaMetric", &self.quota_metric)?;
1110 }
1111 if !self.quota_id.is_empty() {
1112 state.serialize_entry("quotaId", &self.quota_id)?;
1113 }
1114 if !self.quota_dimensions.is_empty() {
1115 state.serialize_entry("quotaDimensions", &self.quota_dimensions)?;
1116 }
1117 if !wkt::internal::is_default(&self.quota_value) {
1118 struct __With<'a>(&'a i64);
1119 impl<'a> serde::ser::Serialize for __With<'a> {
1120 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1121 where
1122 S: serde::ser::Serializer,
1123 {
1124 serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
1125 }
1126 }
1127 state.serialize_entry("quotaValue", &__With(&self.quota_value))?;
1128 }
1129 if self.future_quota_value.is_some() {
1130 struct __With<'a>(&'a std::option::Option<i64>);
1131 impl<'a> serde::ser::Serialize for __With<'a> {
1132 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1133 where
1134 S: serde::ser::Serializer,
1135 {
1136 serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
1137 self.0, serializer,
1138 )
1139 }
1140 }
1141 state.serialize_entry("futureQuotaValue", &__With(&self.future_quota_value))?;
1142 }
1143 if !self._unknown_fields.is_empty() {
1144 for (key, value) in self._unknown_fields.iter() {
1145 state.serialize_entry(key, &value)?;
1146 }
1147 }
1148 state.end()
1149 }
1150 }
1151}
1152
1153#[derive(Clone, Debug, Default, PartialEq)]
1159#[non_exhaustive]
1160pub struct PreconditionFailure {
1161 pub violations: std::vec::Vec<crate::model::precondition_failure::Violation>,
1163
1164 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1165}
1166
1167impl PreconditionFailure {
1168 pub fn new() -> Self {
1169 std::default::Default::default()
1170 }
1171
1172 pub fn set_violations<T, V>(mut self, v: T) -> Self
1174 where
1175 T: std::iter::IntoIterator<Item = V>,
1176 V: std::convert::Into<crate::model::precondition_failure::Violation>,
1177 {
1178 use std::iter::Iterator;
1179 self.violations = v.into_iter().map(|i| i.into()).collect();
1180 self
1181 }
1182}
1183
1184impl wkt::message::Message for PreconditionFailure {
1185 fn typename() -> &'static str {
1186 "type.googleapis.com/google.rpc.PreconditionFailure"
1187 }
1188}
1189
1190#[doc(hidden)]
1191impl<'de> serde::de::Deserialize<'de> for PreconditionFailure {
1192 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1193 where
1194 D: serde::Deserializer<'de>,
1195 {
1196 #[allow(non_camel_case_types)]
1197 #[doc(hidden)]
1198 #[derive(PartialEq, Eq, Hash)]
1199 enum __FieldTag {
1200 __violations,
1201 Unknown(std::string::String),
1202 }
1203 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1204 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1205 where
1206 D: serde::Deserializer<'de>,
1207 {
1208 struct Visitor;
1209 impl<'de> serde::de::Visitor<'de> for Visitor {
1210 type Value = __FieldTag;
1211 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1212 formatter.write_str("a field name for PreconditionFailure")
1213 }
1214 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1215 where
1216 E: serde::de::Error,
1217 {
1218 use std::result::Result::Ok;
1219 use std::string::ToString;
1220 match value {
1221 "violations" => Ok(__FieldTag::__violations),
1222 _ => Ok(__FieldTag::Unknown(value.to_string())),
1223 }
1224 }
1225 }
1226 deserializer.deserialize_identifier(Visitor)
1227 }
1228 }
1229 struct Visitor;
1230 impl<'de> serde::de::Visitor<'de> for Visitor {
1231 type Value = PreconditionFailure;
1232 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1233 formatter.write_str("struct PreconditionFailure")
1234 }
1235 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1236 where
1237 A: serde::de::MapAccess<'de>,
1238 {
1239 #[allow(unused_imports)]
1240 use serde::de::Error;
1241 use std::option::Option::Some;
1242 let mut fields = std::collections::HashSet::new();
1243 let mut result = Self::Value::new();
1244 while let Some(tag) = map.next_key::<__FieldTag>()? {
1245 #[allow(clippy::match_single_binding)]
1246 match tag {
1247 __FieldTag::__violations => {
1248 if !fields.insert(__FieldTag::__violations) {
1249 return std::result::Result::Err(A::Error::duplicate_field(
1250 "multiple values for violations",
1251 ));
1252 }
1253 result.violations = map
1254 .next_value::<std::option::Option<
1255 std::vec::Vec<crate::model::precondition_failure::Violation>,
1256 >>()?
1257 .unwrap_or_default();
1258 }
1259 __FieldTag::Unknown(key) => {
1260 let value = map.next_value::<serde_json::Value>()?;
1261 result._unknown_fields.insert(key, value);
1262 }
1263 }
1264 }
1265 std::result::Result::Ok(result)
1266 }
1267 }
1268 deserializer.deserialize_any(Visitor)
1269 }
1270}
1271
1272#[doc(hidden)]
1273impl serde::ser::Serialize for PreconditionFailure {
1274 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1275 where
1276 S: serde::ser::Serializer,
1277 {
1278 use serde::ser::SerializeMap;
1279 #[allow(unused_imports)]
1280 use std::option::Option::Some;
1281 let mut state = serializer.serialize_map(std::option::Option::None)?;
1282 if !self.violations.is_empty() {
1283 state.serialize_entry("violations", &self.violations)?;
1284 }
1285 if !self._unknown_fields.is_empty() {
1286 for (key, value) in self._unknown_fields.iter() {
1287 state.serialize_entry(key, &value)?;
1288 }
1289 }
1290 state.end()
1291 }
1292}
1293
1294pub mod precondition_failure {
1296 #[allow(unused_imports)]
1297 use super::*;
1298
1299 #[derive(Clone, Debug, Default, PartialEq)]
1301 #[non_exhaustive]
1302 pub struct Violation {
1303 pub r#type: std::string::String,
1307
1308 pub subject: std::string::String,
1312
1313 pub description: std::string::String,
1318
1319 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1320 }
1321
1322 impl Violation {
1323 pub fn new() -> Self {
1324 std::default::Default::default()
1325 }
1326
1327 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1329 self.r#type = v.into();
1330 self
1331 }
1332
1333 pub fn set_subject<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1335 self.subject = v.into();
1336 self
1337 }
1338
1339 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1341 self.description = v.into();
1342 self
1343 }
1344 }
1345
1346 impl wkt::message::Message for Violation {
1347 fn typename() -> &'static str {
1348 "type.googleapis.com/google.rpc.PreconditionFailure.Violation"
1349 }
1350 }
1351
1352 #[doc(hidden)]
1353 impl<'de> serde::de::Deserialize<'de> for Violation {
1354 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1355 where
1356 D: serde::Deserializer<'de>,
1357 {
1358 #[allow(non_camel_case_types)]
1359 #[doc(hidden)]
1360 #[derive(PartialEq, Eq, Hash)]
1361 enum __FieldTag {
1362 __type,
1363 __subject,
1364 __description,
1365 Unknown(std::string::String),
1366 }
1367 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1368 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1369 where
1370 D: serde::Deserializer<'de>,
1371 {
1372 struct Visitor;
1373 impl<'de> serde::de::Visitor<'de> for Visitor {
1374 type Value = __FieldTag;
1375 fn expecting(
1376 &self,
1377 formatter: &mut std::fmt::Formatter,
1378 ) -> std::fmt::Result {
1379 formatter.write_str("a field name for Violation")
1380 }
1381 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1382 where
1383 E: serde::de::Error,
1384 {
1385 use std::result::Result::Ok;
1386 use std::string::ToString;
1387 match value {
1388 "type" => Ok(__FieldTag::__type),
1389 "subject" => Ok(__FieldTag::__subject),
1390 "description" => Ok(__FieldTag::__description),
1391 _ => Ok(__FieldTag::Unknown(value.to_string())),
1392 }
1393 }
1394 }
1395 deserializer.deserialize_identifier(Visitor)
1396 }
1397 }
1398 struct Visitor;
1399 impl<'de> serde::de::Visitor<'de> for Visitor {
1400 type Value = Violation;
1401 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1402 formatter.write_str("struct Violation")
1403 }
1404 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1405 where
1406 A: serde::de::MapAccess<'de>,
1407 {
1408 #[allow(unused_imports)]
1409 use serde::de::Error;
1410 use std::option::Option::Some;
1411 let mut fields = std::collections::HashSet::new();
1412 let mut result = Self::Value::new();
1413 while let Some(tag) = map.next_key::<__FieldTag>()? {
1414 #[allow(clippy::match_single_binding)]
1415 match tag {
1416 __FieldTag::__type => {
1417 if !fields.insert(__FieldTag::__type) {
1418 return std::result::Result::Err(A::Error::duplicate_field(
1419 "multiple values for type",
1420 ));
1421 }
1422 result.r#type = map
1423 .next_value::<std::option::Option<std::string::String>>()?
1424 .unwrap_or_default();
1425 }
1426 __FieldTag::__subject => {
1427 if !fields.insert(__FieldTag::__subject) {
1428 return std::result::Result::Err(A::Error::duplicate_field(
1429 "multiple values for subject",
1430 ));
1431 }
1432 result.subject = map
1433 .next_value::<std::option::Option<std::string::String>>()?
1434 .unwrap_or_default();
1435 }
1436 __FieldTag::__description => {
1437 if !fields.insert(__FieldTag::__description) {
1438 return std::result::Result::Err(A::Error::duplicate_field(
1439 "multiple values for description",
1440 ));
1441 }
1442 result.description = map
1443 .next_value::<std::option::Option<std::string::String>>()?
1444 .unwrap_or_default();
1445 }
1446 __FieldTag::Unknown(key) => {
1447 let value = map.next_value::<serde_json::Value>()?;
1448 result._unknown_fields.insert(key, value);
1449 }
1450 }
1451 }
1452 std::result::Result::Ok(result)
1453 }
1454 }
1455 deserializer.deserialize_any(Visitor)
1456 }
1457 }
1458
1459 #[doc(hidden)]
1460 impl serde::ser::Serialize for Violation {
1461 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1462 where
1463 S: serde::ser::Serializer,
1464 {
1465 use serde::ser::SerializeMap;
1466 #[allow(unused_imports)]
1467 use std::option::Option::Some;
1468 let mut state = serializer.serialize_map(std::option::Option::None)?;
1469 if !self.r#type.is_empty() {
1470 state.serialize_entry("type", &self.r#type)?;
1471 }
1472 if !self.subject.is_empty() {
1473 state.serialize_entry("subject", &self.subject)?;
1474 }
1475 if !self.description.is_empty() {
1476 state.serialize_entry("description", &self.description)?;
1477 }
1478 if !self._unknown_fields.is_empty() {
1479 for (key, value) in self._unknown_fields.iter() {
1480 state.serialize_entry(key, &value)?;
1481 }
1482 }
1483 state.end()
1484 }
1485 }
1486}
1487
1488#[derive(Clone, Debug, Default, PartialEq)]
1491#[non_exhaustive]
1492pub struct BadRequest {
1493 pub field_violations: std::vec::Vec<crate::model::bad_request::FieldViolation>,
1495
1496 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1497}
1498
1499impl BadRequest {
1500 pub fn new() -> Self {
1501 std::default::Default::default()
1502 }
1503
1504 pub fn set_field_violations<T, V>(mut self, v: T) -> Self
1506 where
1507 T: std::iter::IntoIterator<Item = V>,
1508 V: std::convert::Into<crate::model::bad_request::FieldViolation>,
1509 {
1510 use std::iter::Iterator;
1511 self.field_violations = v.into_iter().map(|i| i.into()).collect();
1512 self
1513 }
1514}
1515
1516impl wkt::message::Message for BadRequest {
1517 fn typename() -> &'static str {
1518 "type.googleapis.com/google.rpc.BadRequest"
1519 }
1520}
1521
1522#[doc(hidden)]
1523impl<'de> serde::de::Deserialize<'de> for BadRequest {
1524 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1525 where
1526 D: serde::Deserializer<'de>,
1527 {
1528 #[allow(non_camel_case_types)]
1529 #[doc(hidden)]
1530 #[derive(PartialEq, Eq, Hash)]
1531 enum __FieldTag {
1532 __field_violations,
1533 Unknown(std::string::String),
1534 }
1535 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1536 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1537 where
1538 D: serde::Deserializer<'de>,
1539 {
1540 struct Visitor;
1541 impl<'de> serde::de::Visitor<'de> for Visitor {
1542 type Value = __FieldTag;
1543 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1544 formatter.write_str("a field name for BadRequest")
1545 }
1546 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1547 where
1548 E: serde::de::Error,
1549 {
1550 use std::result::Result::Ok;
1551 use std::string::ToString;
1552 match value {
1553 "fieldViolations" => Ok(__FieldTag::__field_violations),
1554 "field_violations" => Ok(__FieldTag::__field_violations),
1555 _ => Ok(__FieldTag::Unknown(value.to_string())),
1556 }
1557 }
1558 }
1559 deserializer.deserialize_identifier(Visitor)
1560 }
1561 }
1562 struct Visitor;
1563 impl<'de> serde::de::Visitor<'de> for Visitor {
1564 type Value = BadRequest;
1565 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1566 formatter.write_str("struct BadRequest")
1567 }
1568 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1569 where
1570 A: serde::de::MapAccess<'de>,
1571 {
1572 #[allow(unused_imports)]
1573 use serde::de::Error;
1574 use std::option::Option::Some;
1575 let mut fields = std::collections::HashSet::new();
1576 let mut result = Self::Value::new();
1577 while let Some(tag) = map.next_key::<__FieldTag>()? {
1578 #[allow(clippy::match_single_binding)]
1579 match tag {
1580 __FieldTag::__field_violations => {
1581 if !fields.insert(__FieldTag::__field_violations) {
1582 return std::result::Result::Err(A::Error::duplicate_field(
1583 "multiple values for field_violations",
1584 ));
1585 }
1586 result.field_violations = map
1587 .next_value::<std::option::Option<
1588 std::vec::Vec<crate::model::bad_request::FieldViolation>,
1589 >>()?
1590 .unwrap_or_default();
1591 }
1592 __FieldTag::Unknown(key) => {
1593 let value = map.next_value::<serde_json::Value>()?;
1594 result._unknown_fields.insert(key, value);
1595 }
1596 }
1597 }
1598 std::result::Result::Ok(result)
1599 }
1600 }
1601 deserializer.deserialize_any(Visitor)
1602 }
1603}
1604
1605#[doc(hidden)]
1606impl serde::ser::Serialize for BadRequest {
1607 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1608 where
1609 S: serde::ser::Serializer,
1610 {
1611 use serde::ser::SerializeMap;
1612 #[allow(unused_imports)]
1613 use std::option::Option::Some;
1614 let mut state = serializer.serialize_map(std::option::Option::None)?;
1615 if !self.field_violations.is_empty() {
1616 state.serialize_entry("fieldViolations", &self.field_violations)?;
1617 }
1618 if !self._unknown_fields.is_empty() {
1619 for (key, value) in self._unknown_fields.iter() {
1620 state.serialize_entry(key, &value)?;
1621 }
1622 }
1623 state.end()
1624 }
1625}
1626
1627pub mod bad_request {
1629 #[allow(unused_imports)]
1630 use super::*;
1631
1632 #[derive(Clone, Debug, Default, PartialEq)]
1634 #[non_exhaustive]
1635 pub struct FieldViolation {
1636 pub field: std::string::String,
1676
1677 pub description: std::string::String,
1679
1680 pub reason: std::string::String,
1687
1688 pub localized_message: std::option::Option<crate::model::LocalizedMessage>,
1691
1692 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1693 }
1694
1695 impl FieldViolation {
1696 pub fn new() -> Self {
1697 std::default::Default::default()
1698 }
1699
1700 pub fn set_field<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1702 self.field = v.into();
1703 self
1704 }
1705
1706 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1708 self.description = v.into();
1709 self
1710 }
1711
1712 pub fn set_reason<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1714 self.reason = v.into();
1715 self
1716 }
1717
1718 pub fn set_localized_message<T>(mut self, v: T) -> Self
1720 where
1721 T: std::convert::Into<crate::model::LocalizedMessage>,
1722 {
1723 self.localized_message = std::option::Option::Some(v.into());
1724 self
1725 }
1726
1727 pub fn set_or_clear_localized_message<T>(mut self, v: std::option::Option<T>) -> Self
1729 where
1730 T: std::convert::Into<crate::model::LocalizedMessage>,
1731 {
1732 self.localized_message = v.map(|x| x.into());
1733 self
1734 }
1735 }
1736
1737 impl wkt::message::Message for FieldViolation {
1738 fn typename() -> &'static str {
1739 "type.googleapis.com/google.rpc.BadRequest.FieldViolation"
1740 }
1741 }
1742
1743 #[doc(hidden)]
1744 impl<'de> serde::de::Deserialize<'de> for FieldViolation {
1745 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1746 where
1747 D: serde::Deserializer<'de>,
1748 {
1749 #[allow(non_camel_case_types)]
1750 #[doc(hidden)]
1751 #[derive(PartialEq, Eq, Hash)]
1752 enum __FieldTag {
1753 __field,
1754 __description,
1755 __reason,
1756 __localized_message,
1757 Unknown(std::string::String),
1758 }
1759 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1760 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1761 where
1762 D: serde::Deserializer<'de>,
1763 {
1764 struct Visitor;
1765 impl<'de> serde::de::Visitor<'de> for Visitor {
1766 type Value = __FieldTag;
1767 fn expecting(
1768 &self,
1769 formatter: &mut std::fmt::Formatter,
1770 ) -> std::fmt::Result {
1771 formatter.write_str("a field name for FieldViolation")
1772 }
1773 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1774 where
1775 E: serde::de::Error,
1776 {
1777 use std::result::Result::Ok;
1778 use std::string::ToString;
1779 match value {
1780 "field" => Ok(__FieldTag::__field),
1781 "description" => Ok(__FieldTag::__description),
1782 "reason" => Ok(__FieldTag::__reason),
1783 "localizedMessage" => Ok(__FieldTag::__localized_message),
1784 "localized_message" => Ok(__FieldTag::__localized_message),
1785 _ => Ok(__FieldTag::Unknown(value.to_string())),
1786 }
1787 }
1788 }
1789 deserializer.deserialize_identifier(Visitor)
1790 }
1791 }
1792 struct Visitor;
1793 impl<'de> serde::de::Visitor<'de> for Visitor {
1794 type Value = FieldViolation;
1795 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1796 formatter.write_str("struct FieldViolation")
1797 }
1798 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1799 where
1800 A: serde::de::MapAccess<'de>,
1801 {
1802 #[allow(unused_imports)]
1803 use serde::de::Error;
1804 use std::option::Option::Some;
1805 let mut fields = std::collections::HashSet::new();
1806 let mut result = Self::Value::new();
1807 while let Some(tag) = map.next_key::<__FieldTag>()? {
1808 #[allow(clippy::match_single_binding)]
1809 match tag {
1810 __FieldTag::__field => {
1811 if !fields.insert(__FieldTag::__field) {
1812 return std::result::Result::Err(A::Error::duplicate_field(
1813 "multiple values for field",
1814 ));
1815 }
1816 result.field = map
1817 .next_value::<std::option::Option<std::string::String>>()?
1818 .unwrap_or_default();
1819 }
1820 __FieldTag::__description => {
1821 if !fields.insert(__FieldTag::__description) {
1822 return std::result::Result::Err(A::Error::duplicate_field(
1823 "multiple values for description",
1824 ));
1825 }
1826 result.description = map
1827 .next_value::<std::option::Option<std::string::String>>()?
1828 .unwrap_or_default();
1829 }
1830 __FieldTag::__reason => {
1831 if !fields.insert(__FieldTag::__reason) {
1832 return std::result::Result::Err(A::Error::duplicate_field(
1833 "multiple values for reason",
1834 ));
1835 }
1836 result.reason = map
1837 .next_value::<std::option::Option<std::string::String>>()?
1838 .unwrap_or_default();
1839 }
1840 __FieldTag::__localized_message => {
1841 if !fields.insert(__FieldTag::__localized_message) {
1842 return std::result::Result::Err(A::Error::duplicate_field(
1843 "multiple values for localized_message",
1844 ));
1845 }
1846 result.localized_message = map.next_value::<std::option::Option<crate::model::LocalizedMessage>>()?
1847 ;
1848 }
1849 __FieldTag::Unknown(key) => {
1850 let value = map.next_value::<serde_json::Value>()?;
1851 result._unknown_fields.insert(key, value);
1852 }
1853 }
1854 }
1855 std::result::Result::Ok(result)
1856 }
1857 }
1858 deserializer.deserialize_any(Visitor)
1859 }
1860 }
1861
1862 #[doc(hidden)]
1863 impl serde::ser::Serialize for FieldViolation {
1864 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1865 where
1866 S: serde::ser::Serializer,
1867 {
1868 use serde::ser::SerializeMap;
1869 #[allow(unused_imports)]
1870 use std::option::Option::Some;
1871 let mut state = serializer.serialize_map(std::option::Option::None)?;
1872 if !self.field.is_empty() {
1873 state.serialize_entry("field", &self.field)?;
1874 }
1875 if !self.description.is_empty() {
1876 state.serialize_entry("description", &self.description)?;
1877 }
1878 if !self.reason.is_empty() {
1879 state.serialize_entry("reason", &self.reason)?;
1880 }
1881 if self.localized_message.is_some() {
1882 state.serialize_entry("localizedMessage", &self.localized_message)?;
1883 }
1884 if !self._unknown_fields.is_empty() {
1885 for (key, value) in self._unknown_fields.iter() {
1886 state.serialize_entry(key, &value)?;
1887 }
1888 }
1889 state.end()
1890 }
1891 }
1892}
1893
1894#[derive(Clone, Debug, Default, PartialEq)]
1897#[non_exhaustive]
1898pub struct RequestInfo {
1899 pub request_id: std::string::String,
1902
1903 pub serving_data: std::string::String,
1906
1907 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1908}
1909
1910impl RequestInfo {
1911 pub fn new() -> Self {
1912 std::default::Default::default()
1913 }
1914
1915 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1917 self.request_id = v.into();
1918 self
1919 }
1920
1921 pub fn set_serving_data<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1923 self.serving_data = v.into();
1924 self
1925 }
1926}
1927
1928impl wkt::message::Message for RequestInfo {
1929 fn typename() -> &'static str {
1930 "type.googleapis.com/google.rpc.RequestInfo"
1931 }
1932}
1933
1934#[doc(hidden)]
1935impl<'de> serde::de::Deserialize<'de> for RequestInfo {
1936 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1937 where
1938 D: serde::Deserializer<'de>,
1939 {
1940 #[allow(non_camel_case_types)]
1941 #[doc(hidden)]
1942 #[derive(PartialEq, Eq, Hash)]
1943 enum __FieldTag {
1944 __request_id,
1945 __serving_data,
1946 Unknown(std::string::String),
1947 }
1948 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1949 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1950 where
1951 D: serde::Deserializer<'de>,
1952 {
1953 struct Visitor;
1954 impl<'de> serde::de::Visitor<'de> for Visitor {
1955 type Value = __FieldTag;
1956 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1957 formatter.write_str("a field name for RequestInfo")
1958 }
1959 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1960 where
1961 E: serde::de::Error,
1962 {
1963 use std::result::Result::Ok;
1964 use std::string::ToString;
1965 match value {
1966 "requestId" => Ok(__FieldTag::__request_id),
1967 "request_id" => Ok(__FieldTag::__request_id),
1968 "servingData" => Ok(__FieldTag::__serving_data),
1969 "serving_data" => Ok(__FieldTag::__serving_data),
1970 _ => Ok(__FieldTag::Unknown(value.to_string())),
1971 }
1972 }
1973 }
1974 deserializer.deserialize_identifier(Visitor)
1975 }
1976 }
1977 struct Visitor;
1978 impl<'de> serde::de::Visitor<'de> for Visitor {
1979 type Value = RequestInfo;
1980 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1981 formatter.write_str("struct RequestInfo")
1982 }
1983 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1984 where
1985 A: serde::de::MapAccess<'de>,
1986 {
1987 #[allow(unused_imports)]
1988 use serde::de::Error;
1989 use std::option::Option::Some;
1990 let mut fields = std::collections::HashSet::new();
1991 let mut result = Self::Value::new();
1992 while let Some(tag) = map.next_key::<__FieldTag>()? {
1993 #[allow(clippy::match_single_binding)]
1994 match tag {
1995 __FieldTag::__request_id => {
1996 if !fields.insert(__FieldTag::__request_id) {
1997 return std::result::Result::Err(A::Error::duplicate_field(
1998 "multiple values for request_id",
1999 ));
2000 }
2001 result.request_id = map
2002 .next_value::<std::option::Option<std::string::String>>()?
2003 .unwrap_or_default();
2004 }
2005 __FieldTag::__serving_data => {
2006 if !fields.insert(__FieldTag::__serving_data) {
2007 return std::result::Result::Err(A::Error::duplicate_field(
2008 "multiple values for serving_data",
2009 ));
2010 }
2011 result.serving_data = map
2012 .next_value::<std::option::Option<std::string::String>>()?
2013 .unwrap_or_default();
2014 }
2015 __FieldTag::Unknown(key) => {
2016 let value = map.next_value::<serde_json::Value>()?;
2017 result._unknown_fields.insert(key, value);
2018 }
2019 }
2020 }
2021 std::result::Result::Ok(result)
2022 }
2023 }
2024 deserializer.deserialize_any(Visitor)
2025 }
2026}
2027
2028#[doc(hidden)]
2029impl serde::ser::Serialize for RequestInfo {
2030 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2031 where
2032 S: serde::ser::Serializer,
2033 {
2034 use serde::ser::SerializeMap;
2035 #[allow(unused_imports)]
2036 use std::option::Option::Some;
2037 let mut state = serializer.serialize_map(std::option::Option::None)?;
2038 if !self.request_id.is_empty() {
2039 state.serialize_entry("requestId", &self.request_id)?;
2040 }
2041 if !self.serving_data.is_empty() {
2042 state.serialize_entry("servingData", &self.serving_data)?;
2043 }
2044 if !self._unknown_fields.is_empty() {
2045 for (key, value) in self._unknown_fields.iter() {
2046 state.serialize_entry(key, &value)?;
2047 }
2048 }
2049 state.end()
2050 }
2051}
2052
2053#[derive(Clone, Debug, Default, PartialEq)]
2055#[non_exhaustive]
2056pub struct ResourceInfo {
2057 pub resource_type: std::string::String,
2061
2062 pub resource_name: std::string::String,
2069
2070 pub owner: std::string::String,
2074
2075 pub description: std::string::String,
2079
2080 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2081}
2082
2083impl ResourceInfo {
2084 pub fn new() -> Self {
2085 std::default::Default::default()
2086 }
2087
2088 pub fn set_resource_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2090 self.resource_type = v.into();
2091 self
2092 }
2093
2094 pub fn set_resource_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2096 self.resource_name = v.into();
2097 self
2098 }
2099
2100 pub fn set_owner<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2102 self.owner = v.into();
2103 self
2104 }
2105
2106 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2108 self.description = v.into();
2109 self
2110 }
2111}
2112
2113impl wkt::message::Message for ResourceInfo {
2114 fn typename() -> &'static str {
2115 "type.googleapis.com/google.rpc.ResourceInfo"
2116 }
2117}
2118
2119#[doc(hidden)]
2120impl<'de> serde::de::Deserialize<'de> for ResourceInfo {
2121 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2122 where
2123 D: serde::Deserializer<'de>,
2124 {
2125 #[allow(non_camel_case_types)]
2126 #[doc(hidden)]
2127 #[derive(PartialEq, Eq, Hash)]
2128 enum __FieldTag {
2129 __resource_type,
2130 __resource_name,
2131 __owner,
2132 __description,
2133 Unknown(std::string::String),
2134 }
2135 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2136 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2137 where
2138 D: serde::Deserializer<'de>,
2139 {
2140 struct Visitor;
2141 impl<'de> serde::de::Visitor<'de> for Visitor {
2142 type Value = __FieldTag;
2143 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2144 formatter.write_str("a field name for ResourceInfo")
2145 }
2146 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2147 where
2148 E: serde::de::Error,
2149 {
2150 use std::result::Result::Ok;
2151 use std::string::ToString;
2152 match value {
2153 "resourceType" => Ok(__FieldTag::__resource_type),
2154 "resource_type" => Ok(__FieldTag::__resource_type),
2155 "resourceName" => Ok(__FieldTag::__resource_name),
2156 "resource_name" => Ok(__FieldTag::__resource_name),
2157 "owner" => Ok(__FieldTag::__owner),
2158 "description" => Ok(__FieldTag::__description),
2159 _ => Ok(__FieldTag::Unknown(value.to_string())),
2160 }
2161 }
2162 }
2163 deserializer.deserialize_identifier(Visitor)
2164 }
2165 }
2166 struct Visitor;
2167 impl<'de> serde::de::Visitor<'de> for Visitor {
2168 type Value = ResourceInfo;
2169 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2170 formatter.write_str("struct ResourceInfo")
2171 }
2172 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2173 where
2174 A: serde::de::MapAccess<'de>,
2175 {
2176 #[allow(unused_imports)]
2177 use serde::de::Error;
2178 use std::option::Option::Some;
2179 let mut fields = std::collections::HashSet::new();
2180 let mut result = Self::Value::new();
2181 while let Some(tag) = map.next_key::<__FieldTag>()? {
2182 #[allow(clippy::match_single_binding)]
2183 match tag {
2184 __FieldTag::__resource_type => {
2185 if !fields.insert(__FieldTag::__resource_type) {
2186 return std::result::Result::Err(A::Error::duplicate_field(
2187 "multiple values for resource_type",
2188 ));
2189 }
2190 result.resource_type = map
2191 .next_value::<std::option::Option<std::string::String>>()?
2192 .unwrap_or_default();
2193 }
2194 __FieldTag::__resource_name => {
2195 if !fields.insert(__FieldTag::__resource_name) {
2196 return std::result::Result::Err(A::Error::duplicate_field(
2197 "multiple values for resource_name",
2198 ));
2199 }
2200 result.resource_name = map
2201 .next_value::<std::option::Option<std::string::String>>()?
2202 .unwrap_or_default();
2203 }
2204 __FieldTag::__owner => {
2205 if !fields.insert(__FieldTag::__owner) {
2206 return std::result::Result::Err(A::Error::duplicate_field(
2207 "multiple values for owner",
2208 ));
2209 }
2210 result.owner = map
2211 .next_value::<std::option::Option<std::string::String>>()?
2212 .unwrap_or_default();
2213 }
2214 __FieldTag::__description => {
2215 if !fields.insert(__FieldTag::__description) {
2216 return std::result::Result::Err(A::Error::duplicate_field(
2217 "multiple values for description",
2218 ));
2219 }
2220 result.description = map
2221 .next_value::<std::option::Option<std::string::String>>()?
2222 .unwrap_or_default();
2223 }
2224 __FieldTag::Unknown(key) => {
2225 let value = map.next_value::<serde_json::Value>()?;
2226 result._unknown_fields.insert(key, value);
2227 }
2228 }
2229 }
2230 std::result::Result::Ok(result)
2231 }
2232 }
2233 deserializer.deserialize_any(Visitor)
2234 }
2235}
2236
2237#[doc(hidden)]
2238impl serde::ser::Serialize for ResourceInfo {
2239 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2240 where
2241 S: serde::ser::Serializer,
2242 {
2243 use serde::ser::SerializeMap;
2244 #[allow(unused_imports)]
2245 use std::option::Option::Some;
2246 let mut state = serializer.serialize_map(std::option::Option::None)?;
2247 if !self.resource_type.is_empty() {
2248 state.serialize_entry("resourceType", &self.resource_type)?;
2249 }
2250 if !self.resource_name.is_empty() {
2251 state.serialize_entry("resourceName", &self.resource_name)?;
2252 }
2253 if !self.owner.is_empty() {
2254 state.serialize_entry("owner", &self.owner)?;
2255 }
2256 if !self.description.is_empty() {
2257 state.serialize_entry("description", &self.description)?;
2258 }
2259 if !self._unknown_fields.is_empty() {
2260 for (key, value) in self._unknown_fields.iter() {
2261 state.serialize_entry(key, &value)?;
2262 }
2263 }
2264 state.end()
2265 }
2266}
2267
2268#[derive(Clone, Debug, Default, PartialEq)]
2274#[non_exhaustive]
2275pub struct Help {
2276 pub links: std::vec::Vec<crate::model::help::Link>,
2278
2279 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2280}
2281
2282impl Help {
2283 pub fn new() -> Self {
2284 std::default::Default::default()
2285 }
2286
2287 pub fn set_links<T, V>(mut self, v: T) -> Self
2289 where
2290 T: std::iter::IntoIterator<Item = V>,
2291 V: std::convert::Into<crate::model::help::Link>,
2292 {
2293 use std::iter::Iterator;
2294 self.links = v.into_iter().map(|i| i.into()).collect();
2295 self
2296 }
2297}
2298
2299impl wkt::message::Message for Help {
2300 fn typename() -> &'static str {
2301 "type.googleapis.com/google.rpc.Help"
2302 }
2303}
2304
2305#[doc(hidden)]
2306impl<'de> serde::de::Deserialize<'de> for Help {
2307 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2308 where
2309 D: serde::Deserializer<'de>,
2310 {
2311 #[allow(non_camel_case_types)]
2312 #[doc(hidden)]
2313 #[derive(PartialEq, Eq, Hash)]
2314 enum __FieldTag {
2315 __links,
2316 Unknown(std::string::String),
2317 }
2318 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2319 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2320 where
2321 D: serde::Deserializer<'de>,
2322 {
2323 struct Visitor;
2324 impl<'de> serde::de::Visitor<'de> for Visitor {
2325 type Value = __FieldTag;
2326 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2327 formatter.write_str("a field name for Help")
2328 }
2329 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2330 where
2331 E: serde::de::Error,
2332 {
2333 use std::result::Result::Ok;
2334 use std::string::ToString;
2335 match value {
2336 "links" => Ok(__FieldTag::__links),
2337 _ => Ok(__FieldTag::Unknown(value.to_string())),
2338 }
2339 }
2340 }
2341 deserializer.deserialize_identifier(Visitor)
2342 }
2343 }
2344 struct Visitor;
2345 impl<'de> serde::de::Visitor<'de> for Visitor {
2346 type Value = Help;
2347 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2348 formatter.write_str("struct Help")
2349 }
2350 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2351 where
2352 A: serde::de::MapAccess<'de>,
2353 {
2354 #[allow(unused_imports)]
2355 use serde::de::Error;
2356 use std::option::Option::Some;
2357 let mut fields = std::collections::HashSet::new();
2358 let mut result = Self::Value::new();
2359 while let Some(tag) = map.next_key::<__FieldTag>()? {
2360 #[allow(clippy::match_single_binding)]
2361 match tag {
2362 __FieldTag::__links => {
2363 if !fields.insert(__FieldTag::__links) {
2364 return std::result::Result::Err(A::Error::duplicate_field(
2365 "multiple values for links",
2366 ));
2367 }
2368 result.links = map.next_value::<std::option::Option<std::vec::Vec<crate::model::help::Link>>>()?.unwrap_or_default();
2369 }
2370 __FieldTag::Unknown(key) => {
2371 let value = map.next_value::<serde_json::Value>()?;
2372 result._unknown_fields.insert(key, value);
2373 }
2374 }
2375 }
2376 std::result::Result::Ok(result)
2377 }
2378 }
2379 deserializer.deserialize_any(Visitor)
2380 }
2381}
2382
2383#[doc(hidden)]
2384impl serde::ser::Serialize for Help {
2385 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2386 where
2387 S: serde::ser::Serializer,
2388 {
2389 use serde::ser::SerializeMap;
2390 #[allow(unused_imports)]
2391 use std::option::Option::Some;
2392 let mut state = serializer.serialize_map(std::option::Option::None)?;
2393 if !self.links.is_empty() {
2394 state.serialize_entry("links", &self.links)?;
2395 }
2396 if !self._unknown_fields.is_empty() {
2397 for (key, value) in self._unknown_fields.iter() {
2398 state.serialize_entry(key, &value)?;
2399 }
2400 }
2401 state.end()
2402 }
2403}
2404
2405pub mod help {
2407 #[allow(unused_imports)]
2408 use super::*;
2409
2410 #[derive(Clone, Debug, Default, PartialEq)]
2412 #[non_exhaustive]
2413 pub struct Link {
2414 pub description: std::string::String,
2416
2417 pub url: std::string::String,
2419
2420 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2421 }
2422
2423 impl Link {
2424 pub fn new() -> Self {
2425 std::default::Default::default()
2426 }
2427
2428 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2430 self.description = v.into();
2431 self
2432 }
2433
2434 pub fn set_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2436 self.url = v.into();
2437 self
2438 }
2439 }
2440
2441 impl wkt::message::Message for Link {
2442 fn typename() -> &'static str {
2443 "type.googleapis.com/google.rpc.Help.Link"
2444 }
2445 }
2446
2447 #[doc(hidden)]
2448 impl<'de> serde::de::Deserialize<'de> for Link {
2449 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2450 where
2451 D: serde::Deserializer<'de>,
2452 {
2453 #[allow(non_camel_case_types)]
2454 #[doc(hidden)]
2455 #[derive(PartialEq, Eq, Hash)]
2456 enum __FieldTag {
2457 __description,
2458 __url,
2459 Unknown(std::string::String),
2460 }
2461 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2462 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2463 where
2464 D: serde::Deserializer<'de>,
2465 {
2466 struct Visitor;
2467 impl<'de> serde::de::Visitor<'de> for Visitor {
2468 type Value = __FieldTag;
2469 fn expecting(
2470 &self,
2471 formatter: &mut std::fmt::Formatter,
2472 ) -> std::fmt::Result {
2473 formatter.write_str("a field name for Link")
2474 }
2475 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2476 where
2477 E: serde::de::Error,
2478 {
2479 use std::result::Result::Ok;
2480 use std::string::ToString;
2481 match value {
2482 "description" => Ok(__FieldTag::__description),
2483 "url" => Ok(__FieldTag::__url),
2484 _ => Ok(__FieldTag::Unknown(value.to_string())),
2485 }
2486 }
2487 }
2488 deserializer.deserialize_identifier(Visitor)
2489 }
2490 }
2491 struct Visitor;
2492 impl<'de> serde::de::Visitor<'de> for Visitor {
2493 type Value = Link;
2494 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2495 formatter.write_str("struct Link")
2496 }
2497 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2498 where
2499 A: serde::de::MapAccess<'de>,
2500 {
2501 #[allow(unused_imports)]
2502 use serde::de::Error;
2503 use std::option::Option::Some;
2504 let mut fields = std::collections::HashSet::new();
2505 let mut result = Self::Value::new();
2506 while let Some(tag) = map.next_key::<__FieldTag>()? {
2507 #[allow(clippy::match_single_binding)]
2508 match tag {
2509 __FieldTag::__description => {
2510 if !fields.insert(__FieldTag::__description) {
2511 return std::result::Result::Err(A::Error::duplicate_field(
2512 "multiple values for description",
2513 ));
2514 }
2515 result.description = map
2516 .next_value::<std::option::Option<std::string::String>>()?
2517 .unwrap_or_default();
2518 }
2519 __FieldTag::__url => {
2520 if !fields.insert(__FieldTag::__url) {
2521 return std::result::Result::Err(A::Error::duplicate_field(
2522 "multiple values for url",
2523 ));
2524 }
2525 result.url = map
2526 .next_value::<std::option::Option<std::string::String>>()?
2527 .unwrap_or_default();
2528 }
2529 __FieldTag::Unknown(key) => {
2530 let value = map.next_value::<serde_json::Value>()?;
2531 result._unknown_fields.insert(key, value);
2532 }
2533 }
2534 }
2535 std::result::Result::Ok(result)
2536 }
2537 }
2538 deserializer.deserialize_any(Visitor)
2539 }
2540 }
2541
2542 #[doc(hidden)]
2543 impl serde::ser::Serialize for Link {
2544 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2545 where
2546 S: serde::ser::Serializer,
2547 {
2548 use serde::ser::SerializeMap;
2549 #[allow(unused_imports)]
2550 use std::option::Option::Some;
2551 let mut state = serializer.serialize_map(std::option::Option::None)?;
2552 if !self.description.is_empty() {
2553 state.serialize_entry("description", &self.description)?;
2554 }
2555 if !self.url.is_empty() {
2556 state.serialize_entry("url", &self.url)?;
2557 }
2558 if !self._unknown_fields.is_empty() {
2559 for (key, value) in self._unknown_fields.iter() {
2560 state.serialize_entry(key, &value)?;
2561 }
2562 }
2563 state.end()
2564 }
2565 }
2566}
2567
2568#[derive(Clone, Debug, Default, PartialEq)]
2571#[non_exhaustive]
2572pub struct LocalizedMessage {
2573 pub locale: std::string::String,
2577
2578 pub message: std::string::String,
2580
2581 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2582}
2583
2584impl LocalizedMessage {
2585 pub fn new() -> Self {
2586 std::default::Default::default()
2587 }
2588
2589 pub fn set_locale<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2591 self.locale = v.into();
2592 self
2593 }
2594
2595 pub fn set_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2597 self.message = v.into();
2598 self
2599 }
2600}
2601
2602impl wkt::message::Message for LocalizedMessage {
2603 fn typename() -> &'static str {
2604 "type.googleapis.com/google.rpc.LocalizedMessage"
2605 }
2606}
2607
2608#[doc(hidden)]
2609impl<'de> serde::de::Deserialize<'de> for LocalizedMessage {
2610 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2611 where
2612 D: serde::Deserializer<'de>,
2613 {
2614 #[allow(non_camel_case_types)]
2615 #[doc(hidden)]
2616 #[derive(PartialEq, Eq, Hash)]
2617 enum __FieldTag {
2618 __locale,
2619 __message,
2620 Unknown(std::string::String),
2621 }
2622 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2623 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2624 where
2625 D: serde::Deserializer<'de>,
2626 {
2627 struct Visitor;
2628 impl<'de> serde::de::Visitor<'de> for Visitor {
2629 type Value = __FieldTag;
2630 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2631 formatter.write_str("a field name for LocalizedMessage")
2632 }
2633 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2634 where
2635 E: serde::de::Error,
2636 {
2637 use std::result::Result::Ok;
2638 use std::string::ToString;
2639 match value {
2640 "locale" => Ok(__FieldTag::__locale),
2641 "message" => Ok(__FieldTag::__message),
2642 _ => Ok(__FieldTag::Unknown(value.to_string())),
2643 }
2644 }
2645 }
2646 deserializer.deserialize_identifier(Visitor)
2647 }
2648 }
2649 struct Visitor;
2650 impl<'de> serde::de::Visitor<'de> for Visitor {
2651 type Value = LocalizedMessage;
2652 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2653 formatter.write_str("struct LocalizedMessage")
2654 }
2655 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2656 where
2657 A: serde::de::MapAccess<'de>,
2658 {
2659 #[allow(unused_imports)]
2660 use serde::de::Error;
2661 use std::option::Option::Some;
2662 let mut fields = std::collections::HashSet::new();
2663 let mut result = Self::Value::new();
2664 while let Some(tag) = map.next_key::<__FieldTag>()? {
2665 #[allow(clippy::match_single_binding)]
2666 match tag {
2667 __FieldTag::__locale => {
2668 if !fields.insert(__FieldTag::__locale) {
2669 return std::result::Result::Err(A::Error::duplicate_field(
2670 "multiple values for locale",
2671 ));
2672 }
2673 result.locale = map
2674 .next_value::<std::option::Option<std::string::String>>()?
2675 .unwrap_or_default();
2676 }
2677 __FieldTag::__message => {
2678 if !fields.insert(__FieldTag::__message) {
2679 return std::result::Result::Err(A::Error::duplicate_field(
2680 "multiple values for message",
2681 ));
2682 }
2683 result.message = map
2684 .next_value::<std::option::Option<std::string::String>>()?
2685 .unwrap_or_default();
2686 }
2687 __FieldTag::Unknown(key) => {
2688 let value = map.next_value::<serde_json::Value>()?;
2689 result._unknown_fields.insert(key, value);
2690 }
2691 }
2692 }
2693 std::result::Result::Ok(result)
2694 }
2695 }
2696 deserializer.deserialize_any(Visitor)
2697 }
2698}
2699
2700#[doc(hidden)]
2701impl serde::ser::Serialize for LocalizedMessage {
2702 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2703 where
2704 S: serde::ser::Serializer,
2705 {
2706 use serde::ser::SerializeMap;
2707 #[allow(unused_imports)]
2708 use std::option::Option::Some;
2709 let mut state = serializer.serialize_map(std::option::Option::None)?;
2710 if !self.locale.is_empty() {
2711 state.serialize_entry("locale", &self.locale)?;
2712 }
2713 if !self.message.is_empty() {
2714 state.serialize_entry("message", &self.message)?;
2715 }
2716 if !self._unknown_fields.is_empty() {
2717 for (key, value) in self._unknown_fields.iter() {
2718 state.serialize_entry(key, &value)?;
2719 }
2720 }
2721 state.end()
2722 }
2723}
2724
2725#[derive(Clone, Debug, Default, PartialEq)]
2727#[non_exhaustive]
2728pub struct HttpRequest {
2729 pub method: std::string::String,
2731
2732 pub uri: std::string::String,
2734
2735 pub headers: std::vec::Vec<crate::model::HttpHeader>,
2738
2739 pub body: ::bytes::Bytes,
2741
2742 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2743}
2744
2745impl HttpRequest {
2746 pub fn new() -> Self {
2747 std::default::Default::default()
2748 }
2749
2750 pub fn set_method<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2752 self.method = v.into();
2753 self
2754 }
2755
2756 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2758 self.uri = v.into();
2759 self
2760 }
2761
2762 pub fn set_headers<T, V>(mut self, v: T) -> Self
2764 where
2765 T: std::iter::IntoIterator<Item = V>,
2766 V: std::convert::Into<crate::model::HttpHeader>,
2767 {
2768 use std::iter::Iterator;
2769 self.headers = v.into_iter().map(|i| i.into()).collect();
2770 self
2771 }
2772
2773 pub fn set_body<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
2775 self.body = v.into();
2776 self
2777 }
2778}
2779
2780impl wkt::message::Message for HttpRequest {
2781 fn typename() -> &'static str {
2782 "type.googleapis.com/google.rpc.HttpRequest"
2783 }
2784}
2785
2786#[doc(hidden)]
2787impl<'de> serde::de::Deserialize<'de> for HttpRequest {
2788 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2789 where
2790 D: serde::Deserializer<'de>,
2791 {
2792 #[allow(non_camel_case_types)]
2793 #[doc(hidden)]
2794 #[derive(PartialEq, Eq, Hash)]
2795 enum __FieldTag {
2796 __method,
2797 __uri,
2798 __headers,
2799 __body,
2800 Unknown(std::string::String),
2801 }
2802 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2803 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2804 where
2805 D: serde::Deserializer<'de>,
2806 {
2807 struct Visitor;
2808 impl<'de> serde::de::Visitor<'de> for Visitor {
2809 type Value = __FieldTag;
2810 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2811 formatter.write_str("a field name for HttpRequest")
2812 }
2813 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2814 where
2815 E: serde::de::Error,
2816 {
2817 use std::result::Result::Ok;
2818 use std::string::ToString;
2819 match value {
2820 "method" => Ok(__FieldTag::__method),
2821 "uri" => Ok(__FieldTag::__uri),
2822 "headers" => Ok(__FieldTag::__headers),
2823 "body" => Ok(__FieldTag::__body),
2824 _ => Ok(__FieldTag::Unknown(value.to_string())),
2825 }
2826 }
2827 }
2828 deserializer.deserialize_identifier(Visitor)
2829 }
2830 }
2831 struct Visitor;
2832 impl<'de> serde::de::Visitor<'de> for Visitor {
2833 type Value = HttpRequest;
2834 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2835 formatter.write_str("struct HttpRequest")
2836 }
2837 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2838 where
2839 A: serde::de::MapAccess<'de>,
2840 {
2841 #[allow(unused_imports)]
2842 use serde::de::Error;
2843 use std::option::Option::Some;
2844 let mut fields = std::collections::HashSet::new();
2845 let mut result = Self::Value::new();
2846 while let Some(tag) = map.next_key::<__FieldTag>()? {
2847 #[allow(clippy::match_single_binding)]
2848 match tag {
2849 __FieldTag::__method => {
2850 if !fields.insert(__FieldTag::__method) {
2851 return std::result::Result::Err(A::Error::duplicate_field(
2852 "multiple values for method",
2853 ));
2854 }
2855 result.method = map
2856 .next_value::<std::option::Option<std::string::String>>()?
2857 .unwrap_or_default();
2858 }
2859 __FieldTag::__uri => {
2860 if !fields.insert(__FieldTag::__uri) {
2861 return std::result::Result::Err(A::Error::duplicate_field(
2862 "multiple values for uri",
2863 ));
2864 }
2865 result.uri = map
2866 .next_value::<std::option::Option<std::string::String>>()?
2867 .unwrap_or_default();
2868 }
2869 __FieldTag::__headers => {
2870 if !fields.insert(__FieldTag::__headers) {
2871 return std::result::Result::Err(A::Error::duplicate_field(
2872 "multiple values for headers",
2873 ));
2874 }
2875 result.headers = map.next_value::<std::option::Option<std::vec::Vec<crate::model::HttpHeader>>>()?.unwrap_or_default();
2876 }
2877 __FieldTag::__body => {
2878 if !fields.insert(__FieldTag::__body) {
2879 return std::result::Result::Err(A::Error::duplicate_field(
2880 "multiple values for body",
2881 ));
2882 }
2883 struct __With(std::option::Option<::bytes::Bytes>);
2884 impl<'de> serde::de::Deserialize<'de> for __With {
2885 fn deserialize<D>(
2886 deserializer: D,
2887 ) -> std::result::Result<Self, D::Error>
2888 where
2889 D: serde::de::Deserializer<'de>,
2890 {
2891 serde_with::As::< std::option::Option<serde_with::base64::Base64> >::deserialize(deserializer).map(__With)
2892 }
2893 }
2894 result.body = map.next_value::<__With>()?.0.unwrap_or_default();
2895 }
2896 __FieldTag::Unknown(key) => {
2897 let value = map.next_value::<serde_json::Value>()?;
2898 result._unknown_fields.insert(key, value);
2899 }
2900 }
2901 }
2902 std::result::Result::Ok(result)
2903 }
2904 }
2905 deserializer.deserialize_any(Visitor)
2906 }
2907}
2908
2909#[doc(hidden)]
2910impl serde::ser::Serialize for HttpRequest {
2911 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2912 where
2913 S: serde::ser::Serializer,
2914 {
2915 use serde::ser::SerializeMap;
2916 #[allow(unused_imports)]
2917 use std::option::Option::Some;
2918 let mut state = serializer.serialize_map(std::option::Option::None)?;
2919 if !self.method.is_empty() {
2920 state.serialize_entry("method", &self.method)?;
2921 }
2922 if !self.uri.is_empty() {
2923 state.serialize_entry("uri", &self.uri)?;
2924 }
2925 if !self.headers.is_empty() {
2926 state.serialize_entry("headers", &self.headers)?;
2927 }
2928 if !self.body.is_empty() {
2929 struct __With<'a>(&'a ::bytes::Bytes);
2930 impl<'a> serde::ser::Serialize for __With<'a> {
2931 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2932 where
2933 S: serde::ser::Serializer,
2934 {
2935 serde_with::As::<serde_with::base64::Base64>::serialize(self.0, serializer)
2936 }
2937 }
2938 state.serialize_entry("body", &__With(&self.body))?;
2939 }
2940 if !self._unknown_fields.is_empty() {
2941 for (key, value) in self._unknown_fields.iter() {
2942 state.serialize_entry(key, &value)?;
2943 }
2944 }
2945 state.end()
2946 }
2947}
2948
2949#[derive(Clone, Debug, Default, PartialEq)]
2951#[non_exhaustive]
2952pub struct HttpResponse {
2953 pub status: i32,
2955
2956 pub reason: std::string::String,
2958
2959 pub headers: std::vec::Vec<crate::model::HttpHeader>,
2962
2963 pub body: ::bytes::Bytes,
2965
2966 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2967}
2968
2969impl HttpResponse {
2970 pub fn new() -> Self {
2971 std::default::Default::default()
2972 }
2973
2974 pub fn set_status<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2976 self.status = v.into();
2977 self
2978 }
2979
2980 pub fn set_reason<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2982 self.reason = v.into();
2983 self
2984 }
2985
2986 pub fn set_headers<T, V>(mut self, v: T) -> Self
2988 where
2989 T: std::iter::IntoIterator<Item = V>,
2990 V: std::convert::Into<crate::model::HttpHeader>,
2991 {
2992 use std::iter::Iterator;
2993 self.headers = v.into_iter().map(|i| i.into()).collect();
2994 self
2995 }
2996
2997 pub fn set_body<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
2999 self.body = v.into();
3000 self
3001 }
3002}
3003
3004impl wkt::message::Message for HttpResponse {
3005 fn typename() -> &'static str {
3006 "type.googleapis.com/google.rpc.HttpResponse"
3007 }
3008}
3009
3010#[doc(hidden)]
3011impl<'de> serde::de::Deserialize<'de> for HttpResponse {
3012 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3013 where
3014 D: serde::Deserializer<'de>,
3015 {
3016 #[allow(non_camel_case_types)]
3017 #[doc(hidden)]
3018 #[derive(PartialEq, Eq, Hash)]
3019 enum __FieldTag {
3020 __status,
3021 __reason,
3022 __headers,
3023 __body,
3024 Unknown(std::string::String),
3025 }
3026 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3027 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3028 where
3029 D: serde::Deserializer<'de>,
3030 {
3031 struct Visitor;
3032 impl<'de> serde::de::Visitor<'de> for Visitor {
3033 type Value = __FieldTag;
3034 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3035 formatter.write_str("a field name for HttpResponse")
3036 }
3037 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3038 where
3039 E: serde::de::Error,
3040 {
3041 use std::result::Result::Ok;
3042 use std::string::ToString;
3043 match value {
3044 "status" => Ok(__FieldTag::__status),
3045 "reason" => Ok(__FieldTag::__reason),
3046 "headers" => Ok(__FieldTag::__headers),
3047 "body" => Ok(__FieldTag::__body),
3048 _ => Ok(__FieldTag::Unknown(value.to_string())),
3049 }
3050 }
3051 }
3052 deserializer.deserialize_identifier(Visitor)
3053 }
3054 }
3055 struct Visitor;
3056 impl<'de> serde::de::Visitor<'de> for Visitor {
3057 type Value = HttpResponse;
3058 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3059 formatter.write_str("struct HttpResponse")
3060 }
3061 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3062 where
3063 A: serde::de::MapAccess<'de>,
3064 {
3065 #[allow(unused_imports)]
3066 use serde::de::Error;
3067 use std::option::Option::Some;
3068 let mut fields = std::collections::HashSet::new();
3069 let mut result = Self::Value::new();
3070 while let Some(tag) = map.next_key::<__FieldTag>()? {
3071 #[allow(clippy::match_single_binding)]
3072 match tag {
3073 __FieldTag::__status => {
3074 if !fields.insert(__FieldTag::__status) {
3075 return std::result::Result::Err(A::Error::duplicate_field(
3076 "multiple values for status",
3077 ));
3078 }
3079 struct __With(std::option::Option<i32>);
3080 impl<'de> serde::de::Deserialize<'de> for __With {
3081 fn deserialize<D>(
3082 deserializer: D,
3083 ) -> std::result::Result<Self, D::Error>
3084 where
3085 D: serde::de::Deserializer<'de>,
3086 {
3087 serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
3088 }
3089 }
3090 result.status = map.next_value::<__With>()?.0.unwrap_or_default();
3091 }
3092 __FieldTag::__reason => {
3093 if !fields.insert(__FieldTag::__reason) {
3094 return std::result::Result::Err(A::Error::duplicate_field(
3095 "multiple values for reason",
3096 ));
3097 }
3098 result.reason = map
3099 .next_value::<std::option::Option<std::string::String>>()?
3100 .unwrap_or_default();
3101 }
3102 __FieldTag::__headers => {
3103 if !fields.insert(__FieldTag::__headers) {
3104 return std::result::Result::Err(A::Error::duplicate_field(
3105 "multiple values for headers",
3106 ));
3107 }
3108 result.headers = map.next_value::<std::option::Option<std::vec::Vec<crate::model::HttpHeader>>>()?.unwrap_or_default();
3109 }
3110 __FieldTag::__body => {
3111 if !fields.insert(__FieldTag::__body) {
3112 return std::result::Result::Err(A::Error::duplicate_field(
3113 "multiple values for body",
3114 ));
3115 }
3116 struct __With(std::option::Option<::bytes::Bytes>);
3117 impl<'de> serde::de::Deserialize<'de> for __With {
3118 fn deserialize<D>(
3119 deserializer: D,
3120 ) -> std::result::Result<Self, D::Error>
3121 where
3122 D: serde::de::Deserializer<'de>,
3123 {
3124 serde_with::As::< std::option::Option<serde_with::base64::Base64> >::deserialize(deserializer).map(__With)
3125 }
3126 }
3127 result.body = map.next_value::<__With>()?.0.unwrap_or_default();
3128 }
3129 __FieldTag::Unknown(key) => {
3130 let value = map.next_value::<serde_json::Value>()?;
3131 result._unknown_fields.insert(key, value);
3132 }
3133 }
3134 }
3135 std::result::Result::Ok(result)
3136 }
3137 }
3138 deserializer.deserialize_any(Visitor)
3139 }
3140}
3141
3142#[doc(hidden)]
3143impl serde::ser::Serialize for HttpResponse {
3144 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3145 where
3146 S: serde::ser::Serializer,
3147 {
3148 use serde::ser::SerializeMap;
3149 #[allow(unused_imports)]
3150 use std::option::Option::Some;
3151 let mut state = serializer.serialize_map(std::option::Option::None)?;
3152 if !wkt::internal::is_default(&self.status) {
3153 struct __With<'a>(&'a i32);
3154 impl<'a> serde::ser::Serialize for __With<'a> {
3155 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3156 where
3157 S: serde::ser::Serializer,
3158 {
3159 serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
3160 }
3161 }
3162 state.serialize_entry("status", &__With(&self.status))?;
3163 }
3164 if !self.reason.is_empty() {
3165 state.serialize_entry("reason", &self.reason)?;
3166 }
3167 if !self.headers.is_empty() {
3168 state.serialize_entry("headers", &self.headers)?;
3169 }
3170 if !self.body.is_empty() {
3171 struct __With<'a>(&'a ::bytes::Bytes);
3172 impl<'a> serde::ser::Serialize for __With<'a> {
3173 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3174 where
3175 S: serde::ser::Serializer,
3176 {
3177 serde_with::As::<serde_with::base64::Base64>::serialize(self.0, serializer)
3178 }
3179 }
3180 state.serialize_entry("body", &__With(&self.body))?;
3181 }
3182 if !self._unknown_fields.is_empty() {
3183 for (key, value) in self._unknown_fields.iter() {
3184 state.serialize_entry(key, &value)?;
3185 }
3186 }
3187 state.end()
3188 }
3189}
3190
3191#[derive(Clone, Debug, Default, PartialEq)]
3193#[non_exhaustive]
3194pub struct HttpHeader {
3195 pub key: std::string::String,
3197
3198 pub value: std::string::String,
3200
3201 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3202}
3203
3204impl HttpHeader {
3205 pub fn new() -> Self {
3206 std::default::Default::default()
3207 }
3208
3209 pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3211 self.key = v.into();
3212 self
3213 }
3214
3215 pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3217 self.value = v.into();
3218 self
3219 }
3220}
3221
3222impl wkt::message::Message for HttpHeader {
3223 fn typename() -> &'static str {
3224 "type.googleapis.com/google.rpc.HttpHeader"
3225 }
3226}
3227
3228#[doc(hidden)]
3229impl<'de> serde::de::Deserialize<'de> for HttpHeader {
3230 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3231 where
3232 D: serde::Deserializer<'de>,
3233 {
3234 #[allow(non_camel_case_types)]
3235 #[doc(hidden)]
3236 #[derive(PartialEq, Eq, Hash)]
3237 enum __FieldTag {
3238 __key,
3239 __value,
3240 Unknown(std::string::String),
3241 }
3242 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3243 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3244 where
3245 D: serde::Deserializer<'de>,
3246 {
3247 struct Visitor;
3248 impl<'de> serde::de::Visitor<'de> for Visitor {
3249 type Value = __FieldTag;
3250 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3251 formatter.write_str("a field name for HttpHeader")
3252 }
3253 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3254 where
3255 E: serde::de::Error,
3256 {
3257 use std::result::Result::Ok;
3258 use std::string::ToString;
3259 match value {
3260 "key" => Ok(__FieldTag::__key),
3261 "value" => Ok(__FieldTag::__value),
3262 _ => Ok(__FieldTag::Unknown(value.to_string())),
3263 }
3264 }
3265 }
3266 deserializer.deserialize_identifier(Visitor)
3267 }
3268 }
3269 struct Visitor;
3270 impl<'de> serde::de::Visitor<'de> for Visitor {
3271 type Value = HttpHeader;
3272 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3273 formatter.write_str("struct HttpHeader")
3274 }
3275 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3276 where
3277 A: serde::de::MapAccess<'de>,
3278 {
3279 #[allow(unused_imports)]
3280 use serde::de::Error;
3281 use std::option::Option::Some;
3282 let mut fields = std::collections::HashSet::new();
3283 let mut result = Self::Value::new();
3284 while let Some(tag) = map.next_key::<__FieldTag>()? {
3285 #[allow(clippy::match_single_binding)]
3286 match tag {
3287 __FieldTag::__key => {
3288 if !fields.insert(__FieldTag::__key) {
3289 return std::result::Result::Err(A::Error::duplicate_field(
3290 "multiple values for key",
3291 ));
3292 }
3293 result.key = map
3294 .next_value::<std::option::Option<std::string::String>>()?
3295 .unwrap_or_default();
3296 }
3297 __FieldTag::__value => {
3298 if !fields.insert(__FieldTag::__value) {
3299 return std::result::Result::Err(A::Error::duplicate_field(
3300 "multiple values for value",
3301 ));
3302 }
3303 result.value = map
3304 .next_value::<std::option::Option<std::string::String>>()?
3305 .unwrap_or_default();
3306 }
3307 __FieldTag::Unknown(key) => {
3308 let value = map.next_value::<serde_json::Value>()?;
3309 result._unknown_fields.insert(key, value);
3310 }
3311 }
3312 }
3313 std::result::Result::Ok(result)
3314 }
3315 }
3316 deserializer.deserialize_any(Visitor)
3317 }
3318}
3319
3320#[doc(hidden)]
3321impl serde::ser::Serialize for HttpHeader {
3322 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3323 where
3324 S: serde::ser::Serializer,
3325 {
3326 use serde::ser::SerializeMap;
3327 #[allow(unused_imports)]
3328 use std::option::Option::Some;
3329 let mut state = serializer.serialize_map(std::option::Option::None)?;
3330 if !self.key.is_empty() {
3331 state.serialize_entry("key", &self.key)?;
3332 }
3333 if !self.value.is_empty() {
3334 state.serialize_entry("value", &self.value)?;
3335 }
3336 if !self._unknown_fields.is_empty() {
3337 for (key, value) in self._unknown_fields.iter() {
3338 state.serialize_entry(key, &value)?;
3339 }
3340 }
3341 state.end()
3342 }
3343}
3344
3345#[derive(Clone, Debug, Default, PartialEq)]
3353#[non_exhaustive]
3354pub struct Status {
3355 pub code: i32,
3360
3361 pub message: std::string::String,
3368
3369 pub details: std::vec::Vec<wkt::Any>,
3372
3373 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3374}
3375
3376impl Status {
3377 pub fn new() -> Self {
3378 std::default::Default::default()
3379 }
3380
3381 pub fn set_code<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3383 self.code = v.into();
3384 self
3385 }
3386
3387 pub fn set_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3389 self.message = v.into();
3390 self
3391 }
3392
3393 pub fn set_details<T, V>(mut self, v: T) -> Self
3395 where
3396 T: std::iter::IntoIterator<Item = V>,
3397 V: std::convert::Into<wkt::Any>,
3398 {
3399 use std::iter::Iterator;
3400 self.details = v.into_iter().map(|i| i.into()).collect();
3401 self
3402 }
3403}
3404
3405impl wkt::message::Message for Status {
3406 fn typename() -> &'static str {
3407 "type.googleapis.com/google.rpc.Status"
3408 }
3409}
3410
3411#[doc(hidden)]
3412impl<'de> serde::de::Deserialize<'de> for Status {
3413 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3414 where
3415 D: serde::Deserializer<'de>,
3416 {
3417 #[allow(non_camel_case_types)]
3418 #[doc(hidden)]
3419 #[derive(PartialEq, Eq, Hash)]
3420 enum __FieldTag {
3421 __code,
3422 __message,
3423 __details,
3424 Unknown(std::string::String),
3425 }
3426 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3427 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3428 where
3429 D: serde::Deserializer<'de>,
3430 {
3431 struct Visitor;
3432 impl<'de> serde::de::Visitor<'de> for Visitor {
3433 type Value = __FieldTag;
3434 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3435 formatter.write_str("a field name for Status")
3436 }
3437 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3438 where
3439 E: serde::de::Error,
3440 {
3441 use std::result::Result::Ok;
3442 use std::string::ToString;
3443 match value {
3444 "code" => Ok(__FieldTag::__code),
3445 "message" => Ok(__FieldTag::__message),
3446 "details" => Ok(__FieldTag::__details),
3447 _ => Ok(__FieldTag::Unknown(value.to_string())),
3448 }
3449 }
3450 }
3451 deserializer.deserialize_identifier(Visitor)
3452 }
3453 }
3454 struct Visitor;
3455 impl<'de> serde::de::Visitor<'de> for Visitor {
3456 type Value = Status;
3457 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3458 formatter.write_str("struct Status")
3459 }
3460 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3461 where
3462 A: serde::de::MapAccess<'de>,
3463 {
3464 #[allow(unused_imports)]
3465 use serde::de::Error;
3466 use std::option::Option::Some;
3467 let mut fields = std::collections::HashSet::new();
3468 let mut result = Self::Value::new();
3469 while let Some(tag) = map.next_key::<__FieldTag>()? {
3470 #[allow(clippy::match_single_binding)]
3471 match tag {
3472 __FieldTag::__code => {
3473 if !fields.insert(__FieldTag::__code) {
3474 return std::result::Result::Err(A::Error::duplicate_field(
3475 "multiple values for code",
3476 ));
3477 }
3478 struct __With(std::option::Option<i32>);
3479 impl<'de> serde::de::Deserialize<'de> for __With {
3480 fn deserialize<D>(
3481 deserializer: D,
3482 ) -> std::result::Result<Self, D::Error>
3483 where
3484 D: serde::de::Deserializer<'de>,
3485 {
3486 serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
3487 }
3488 }
3489 result.code = map.next_value::<__With>()?.0.unwrap_or_default();
3490 }
3491 __FieldTag::__message => {
3492 if !fields.insert(__FieldTag::__message) {
3493 return std::result::Result::Err(A::Error::duplicate_field(
3494 "multiple values for message",
3495 ));
3496 }
3497 result.message = map
3498 .next_value::<std::option::Option<std::string::String>>()?
3499 .unwrap_or_default();
3500 }
3501 __FieldTag::__details => {
3502 if !fields.insert(__FieldTag::__details) {
3503 return std::result::Result::Err(A::Error::duplicate_field(
3504 "multiple values for details",
3505 ));
3506 }
3507 result.details = map
3508 .next_value::<std::option::Option<std::vec::Vec<wkt::Any>>>()?
3509 .unwrap_or_default();
3510 }
3511 __FieldTag::Unknown(key) => {
3512 let value = map.next_value::<serde_json::Value>()?;
3513 result._unknown_fields.insert(key, value);
3514 }
3515 }
3516 }
3517 std::result::Result::Ok(result)
3518 }
3519 }
3520 deserializer.deserialize_any(Visitor)
3521 }
3522}
3523
3524#[doc(hidden)]
3525impl serde::ser::Serialize for Status {
3526 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3527 where
3528 S: serde::ser::Serializer,
3529 {
3530 use serde::ser::SerializeMap;
3531 #[allow(unused_imports)]
3532 use std::option::Option::Some;
3533 let mut state = serializer.serialize_map(std::option::Option::None)?;
3534 if !wkt::internal::is_default(&self.code) {
3535 struct __With<'a>(&'a i32);
3536 impl<'a> serde::ser::Serialize for __With<'a> {
3537 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3538 where
3539 S: serde::ser::Serializer,
3540 {
3541 serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
3542 }
3543 }
3544 state.serialize_entry("code", &__With(&self.code))?;
3545 }
3546 if !self.message.is_empty() {
3547 state.serialize_entry("message", &self.message)?;
3548 }
3549 if !self.details.is_empty() {
3550 state.serialize_entry("details", &self.details)?;
3551 }
3552 if !self._unknown_fields.is_empty() {
3553 for (key, value) in self._unknown_fields.iter() {
3554 state.serialize_entry(key, &value)?;
3555 }
3556 }
3557 state.end()
3558 }
3559}
3560
3561#[derive(Clone, Debug, PartialEq)]
3582#[non_exhaustive]
3583pub enum Code {
3584 Ok,
3588 Cancelled,
3592 Unknown,
3600 InvalidArgument,
3607 DeadlineExceeded,
3615 NotFound,
3625 AlreadyExists,
3630 PermissionDenied,
3641 Unauthenticated,
3646 ResourceExhausted,
3651 FailedPrecondition,
3670 Aborted,
3678 OutOfRange,
3696 Unimplemented,
3701 Internal,
3707 Unavailable,
3717 DataLoss,
3721 UnknownValue(code::UnknownValue),
3726}
3727
3728#[doc(hidden)]
3729pub mod code {
3730 #[allow(unused_imports)]
3731 use super::*;
3732 #[derive(Clone, Debug, PartialEq)]
3733 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3734}
3735
3736impl Code {
3737 pub fn value(&self) -> std::option::Option<i32> {
3742 match self {
3743 Self::Ok => std::option::Option::Some(0),
3744 Self::Cancelled => std::option::Option::Some(1),
3745 Self::Unknown => std::option::Option::Some(2),
3746 Self::InvalidArgument => std::option::Option::Some(3),
3747 Self::DeadlineExceeded => std::option::Option::Some(4),
3748 Self::NotFound => std::option::Option::Some(5),
3749 Self::AlreadyExists => std::option::Option::Some(6),
3750 Self::PermissionDenied => std::option::Option::Some(7),
3751 Self::Unauthenticated => std::option::Option::Some(16),
3752 Self::ResourceExhausted => std::option::Option::Some(8),
3753 Self::FailedPrecondition => std::option::Option::Some(9),
3754 Self::Aborted => std::option::Option::Some(10),
3755 Self::OutOfRange => std::option::Option::Some(11),
3756 Self::Unimplemented => std::option::Option::Some(12),
3757 Self::Internal => std::option::Option::Some(13),
3758 Self::Unavailable => std::option::Option::Some(14),
3759 Self::DataLoss => std::option::Option::Some(15),
3760 Self::UnknownValue(u) => u.0.value(),
3761 }
3762 }
3763
3764 pub fn name(&self) -> std::option::Option<&str> {
3769 match self {
3770 Self::Ok => std::option::Option::Some("OK"),
3771 Self::Cancelled => std::option::Option::Some("CANCELLED"),
3772 Self::Unknown => std::option::Option::Some("UNKNOWN"),
3773 Self::InvalidArgument => std::option::Option::Some("INVALID_ARGUMENT"),
3774 Self::DeadlineExceeded => std::option::Option::Some("DEADLINE_EXCEEDED"),
3775 Self::NotFound => std::option::Option::Some("NOT_FOUND"),
3776 Self::AlreadyExists => std::option::Option::Some("ALREADY_EXISTS"),
3777 Self::PermissionDenied => std::option::Option::Some("PERMISSION_DENIED"),
3778 Self::Unauthenticated => std::option::Option::Some("UNAUTHENTICATED"),
3779 Self::ResourceExhausted => std::option::Option::Some("RESOURCE_EXHAUSTED"),
3780 Self::FailedPrecondition => std::option::Option::Some("FAILED_PRECONDITION"),
3781 Self::Aborted => std::option::Option::Some("ABORTED"),
3782 Self::OutOfRange => std::option::Option::Some("OUT_OF_RANGE"),
3783 Self::Unimplemented => std::option::Option::Some("UNIMPLEMENTED"),
3784 Self::Internal => std::option::Option::Some("INTERNAL"),
3785 Self::Unavailable => std::option::Option::Some("UNAVAILABLE"),
3786 Self::DataLoss => std::option::Option::Some("DATA_LOSS"),
3787 Self::UnknownValue(u) => u.0.name(),
3788 }
3789 }
3790}
3791
3792impl std::default::Default for Code {
3793 fn default() -> Self {
3794 use std::convert::From;
3795 Self::from(0)
3796 }
3797}
3798
3799impl std::fmt::Display for Code {
3800 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3801 wkt::internal::display_enum(f, self.name(), self.value())
3802 }
3803}
3804
3805impl std::convert::From<i32> for Code {
3806 fn from(value: i32) -> Self {
3807 match value {
3808 0 => Self::Ok,
3809 1 => Self::Cancelled,
3810 2 => Self::Unknown,
3811 3 => Self::InvalidArgument,
3812 4 => Self::DeadlineExceeded,
3813 5 => Self::NotFound,
3814 6 => Self::AlreadyExists,
3815 7 => Self::PermissionDenied,
3816 8 => Self::ResourceExhausted,
3817 9 => Self::FailedPrecondition,
3818 10 => Self::Aborted,
3819 11 => Self::OutOfRange,
3820 12 => Self::Unimplemented,
3821 13 => Self::Internal,
3822 14 => Self::Unavailable,
3823 15 => Self::DataLoss,
3824 16 => Self::Unauthenticated,
3825 _ => Self::UnknownValue(code::UnknownValue(
3826 wkt::internal::UnknownEnumValue::Integer(value),
3827 )),
3828 }
3829 }
3830}
3831
3832impl std::convert::From<&str> for Code {
3833 fn from(value: &str) -> Self {
3834 use std::string::ToString;
3835 match value {
3836 "OK" => Self::Ok,
3837 "CANCELLED" => Self::Cancelled,
3838 "UNKNOWN" => Self::Unknown,
3839 "INVALID_ARGUMENT" => Self::InvalidArgument,
3840 "DEADLINE_EXCEEDED" => Self::DeadlineExceeded,
3841 "NOT_FOUND" => Self::NotFound,
3842 "ALREADY_EXISTS" => Self::AlreadyExists,
3843 "PERMISSION_DENIED" => Self::PermissionDenied,
3844 "UNAUTHENTICATED" => Self::Unauthenticated,
3845 "RESOURCE_EXHAUSTED" => Self::ResourceExhausted,
3846 "FAILED_PRECONDITION" => Self::FailedPrecondition,
3847 "ABORTED" => Self::Aborted,
3848 "OUT_OF_RANGE" => Self::OutOfRange,
3849 "UNIMPLEMENTED" => Self::Unimplemented,
3850 "INTERNAL" => Self::Internal,
3851 "UNAVAILABLE" => Self::Unavailable,
3852 "DATA_LOSS" => Self::DataLoss,
3853 _ => Self::UnknownValue(code::UnknownValue(wkt::internal::UnknownEnumValue::String(
3854 value.to_string(),
3855 ))),
3856 }
3857 }
3858}
3859
3860impl serde::ser::Serialize for Code {
3861 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3862 where
3863 S: serde::Serializer,
3864 {
3865 match self {
3866 Self::Ok => serializer.serialize_i32(0),
3867 Self::Cancelled => serializer.serialize_i32(1),
3868 Self::Unknown => serializer.serialize_i32(2),
3869 Self::InvalidArgument => serializer.serialize_i32(3),
3870 Self::DeadlineExceeded => serializer.serialize_i32(4),
3871 Self::NotFound => serializer.serialize_i32(5),
3872 Self::AlreadyExists => serializer.serialize_i32(6),
3873 Self::PermissionDenied => serializer.serialize_i32(7),
3874 Self::Unauthenticated => serializer.serialize_i32(16),
3875 Self::ResourceExhausted => serializer.serialize_i32(8),
3876 Self::FailedPrecondition => serializer.serialize_i32(9),
3877 Self::Aborted => serializer.serialize_i32(10),
3878 Self::OutOfRange => serializer.serialize_i32(11),
3879 Self::Unimplemented => serializer.serialize_i32(12),
3880 Self::Internal => serializer.serialize_i32(13),
3881 Self::Unavailable => serializer.serialize_i32(14),
3882 Self::DataLoss => serializer.serialize_i32(15),
3883 Self::UnknownValue(u) => u.0.serialize(serializer),
3884 }
3885 }
3886}
3887
3888impl<'de> serde::de::Deserialize<'de> for Code {
3889 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3890 where
3891 D: serde::Deserializer<'de>,
3892 {
3893 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Code>::new(".google.rpc.Code"))
3894 }
3895}