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, Default, PartialEq)]
45#[non_exhaustive]
46pub struct AttributeContext {
47 pub origin: std::option::Option<crate::model::attribute_context::Peer>,
51
52 pub source: std::option::Option<crate::model::attribute_context::Peer>,
56
57 pub destination: std::option::Option<crate::model::attribute_context::Peer>,
61
62 pub request: std::option::Option<crate::model::attribute_context::Request>,
64
65 pub response: std::option::Option<crate::model::attribute_context::Response>,
67
68 pub resource: std::option::Option<crate::model::attribute_context::Resource>,
72
73 pub api: std::option::Option<crate::model::attribute_context::Api>,
75
76 pub extensions: std::vec::Vec<wkt::Any>,
78
79 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
80}
81
82impl AttributeContext {
83 pub fn new() -> Self {
84 std::default::Default::default()
85 }
86
87 pub fn set_origin<T>(mut self, v: T) -> Self
89 where
90 T: std::convert::Into<crate::model::attribute_context::Peer>,
91 {
92 self.origin = std::option::Option::Some(v.into());
93 self
94 }
95
96 pub fn set_or_clear_origin<T>(mut self, v: std::option::Option<T>) -> Self
98 where
99 T: std::convert::Into<crate::model::attribute_context::Peer>,
100 {
101 self.origin = v.map(|x| x.into());
102 self
103 }
104
105 pub fn set_source<T>(mut self, v: T) -> Self
107 where
108 T: std::convert::Into<crate::model::attribute_context::Peer>,
109 {
110 self.source = std::option::Option::Some(v.into());
111 self
112 }
113
114 pub fn set_or_clear_source<T>(mut self, v: std::option::Option<T>) -> Self
116 where
117 T: std::convert::Into<crate::model::attribute_context::Peer>,
118 {
119 self.source = v.map(|x| x.into());
120 self
121 }
122
123 pub fn set_destination<T>(mut self, v: T) -> Self
125 where
126 T: std::convert::Into<crate::model::attribute_context::Peer>,
127 {
128 self.destination = std::option::Option::Some(v.into());
129 self
130 }
131
132 pub fn set_or_clear_destination<T>(mut self, v: std::option::Option<T>) -> Self
134 where
135 T: std::convert::Into<crate::model::attribute_context::Peer>,
136 {
137 self.destination = v.map(|x| x.into());
138 self
139 }
140
141 pub fn set_request<T>(mut self, v: T) -> Self
143 where
144 T: std::convert::Into<crate::model::attribute_context::Request>,
145 {
146 self.request = std::option::Option::Some(v.into());
147 self
148 }
149
150 pub fn set_or_clear_request<T>(mut self, v: std::option::Option<T>) -> Self
152 where
153 T: std::convert::Into<crate::model::attribute_context::Request>,
154 {
155 self.request = v.map(|x| x.into());
156 self
157 }
158
159 pub fn set_response<T>(mut self, v: T) -> Self
161 where
162 T: std::convert::Into<crate::model::attribute_context::Response>,
163 {
164 self.response = std::option::Option::Some(v.into());
165 self
166 }
167
168 pub fn set_or_clear_response<T>(mut self, v: std::option::Option<T>) -> Self
170 where
171 T: std::convert::Into<crate::model::attribute_context::Response>,
172 {
173 self.response = v.map(|x| x.into());
174 self
175 }
176
177 pub fn set_resource<T>(mut self, v: T) -> Self
179 where
180 T: std::convert::Into<crate::model::attribute_context::Resource>,
181 {
182 self.resource = std::option::Option::Some(v.into());
183 self
184 }
185
186 pub fn set_or_clear_resource<T>(mut self, v: std::option::Option<T>) -> Self
188 where
189 T: std::convert::Into<crate::model::attribute_context::Resource>,
190 {
191 self.resource = v.map(|x| x.into());
192 self
193 }
194
195 pub fn set_api<T>(mut self, v: T) -> Self
197 where
198 T: std::convert::Into<crate::model::attribute_context::Api>,
199 {
200 self.api = std::option::Option::Some(v.into());
201 self
202 }
203
204 pub fn set_or_clear_api<T>(mut self, v: std::option::Option<T>) -> Self
206 where
207 T: std::convert::Into<crate::model::attribute_context::Api>,
208 {
209 self.api = v.map(|x| x.into());
210 self
211 }
212
213 pub fn set_extensions<T, V>(mut self, v: T) -> Self
215 where
216 T: std::iter::IntoIterator<Item = V>,
217 V: std::convert::Into<wkt::Any>,
218 {
219 use std::iter::Iterator;
220 self.extensions = v.into_iter().map(|i| i.into()).collect();
221 self
222 }
223}
224
225impl wkt::message::Message for AttributeContext {
226 fn typename() -> &'static str {
227 "type.googleapis.com/google.rpc.context.AttributeContext"
228 }
229}
230
231#[doc(hidden)]
232impl<'de> serde::de::Deserialize<'de> for AttributeContext {
233 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
234 where
235 D: serde::Deserializer<'de>,
236 {
237 #[allow(non_camel_case_types)]
238 #[doc(hidden)]
239 #[derive(PartialEq, Eq, Hash)]
240 enum __FieldTag {
241 __origin,
242 __source,
243 __destination,
244 __request,
245 __response,
246 __resource,
247 __api,
248 __extensions,
249 Unknown(std::string::String),
250 }
251 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
252 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
253 where
254 D: serde::Deserializer<'de>,
255 {
256 struct Visitor;
257 impl<'de> serde::de::Visitor<'de> for Visitor {
258 type Value = __FieldTag;
259 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
260 formatter.write_str("a field name for AttributeContext")
261 }
262 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
263 where
264 E: serde::de::Error,
265 {
266 use std::result::Result::Ok;
267 use std::string::ToString;
268 match value {
269 "origin" => Ok(__FieldTag::__origin),
270 "source" => Ok(__FieldTag::__source),
271 "destination" => Ok(__FieldTag::__destination),
272 "request" => Ok(__FieldTag::__request),
273 "response" => Ok(__FieldTag::__response),
274 "resource" => Ok(__FieldTag::__resource),
275 "api" => Ok(__FieldTag::__api),
276 "extensions" => Ok(__FieldTag::__extensions),
277 _ => Ok(__FieldTag::Unknown(value.to_string())),
278 }
279 }
280 }
281 deserializer.deserialize_identifier(Visitor)
282 }
283 }
284 struct Visitor;
285 impl<'de> serde::de::Visitor<'de> for Visitor {
286 type Value = AttributeContext;
287 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
288 formatter.write_str("struct AttributeContext")
289 }
290 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
291 where
292 A: serde::de::MapAccess<'de>,
293 {
294 #[allow(unused_imports)]
295 use serde::de::Error;
296 use std::option::Option::Some;
297 let mut fields = std::collections::HashSet::new();
298 let mut result = Self::Value::new();
299 while let Some(tag) = map.next_key::<__FieldTag>()? {
300 #[allow(clippy::match_single_binding)]
301 match tag {
302 __FieldTag::__origin => {
303 if !fields.insert(__FieldTag::__origin) {
304 return std::result::Result::Err(A::Error::duplicate_field(
305 "multiple values for origin",
306 ));
307 }
308 result.origin = map.next_value::<std::option::Option<crate::model::attribute_context::Peer>>()?
309 ;
310 }
311 __FieldTag::__source => {
312 if !fields.insert(__FieldTag::__source) {
313 return std::result::Result::Err(A::Error::duplicate_field(
314 "multiple values for source",
315 ));
316 }
317 result.source = map.next_value::<std::option::Option<crate::model::attribute_context::Peer>>()?
318 ;
319 }
320 __FieldTag::__destination => {
321 if !fields.insert(__FieldTag::__destination) {
322 return std::result::Result::Err(A::Error::duplicate_field(
323 "multiple values for destination",
324 ));
325 }
326 result.destination = map.next_value::<std::option::Option<crate::model::attribute_context::Peer>>()?
327 ;
328 }
329 __FieldTag::__request => {
330 if !fields.insert(__FieldTag::__request) {
331 return std::result::Result::Err(A::Error::duplicate_field(
332 "multiple values for request",
333 ));
334 }
335 result.request = map.next_value::<std::option::Option<crate::model::attribute_context::Request>>()?
336 ;
337 }
338 __FieldTag::__response => {
339 if !fields.insert(__FieldTag::__response) {
340 return std::result::Result::Err(A::Error::duplicate_field(
341 "multiple values for response",
342 ));
343 }
344 result.response = map.next_value::<std::option::Option<crate::model::attribute_context::Response>>()?
345 ;
346 }
347 __FieldTag::__resource => {
348 if !fields.insert(__FieldTag::__resource) {
349 return std::result::Result::Err(A::Error::duplicate_field(
350 "multiple values for resource",
351 ));
352 }
353 result.resource = map.next_value::<std::option::Option<crate::model::attribute_context::Resource>>()?
354 ;
355 }
356 __FieldTag::__api => {
357 if !fields.insert(__FieldTag::__api) {
358 return std::result::Result::Err(A::Error::duplicate_field(
359 "multiple values for api",
360 ));
361 }
362 result.api = map.next_value::<std::option::Option<crate::model::attribute_context::Api>>()?
363 ;
364 }
365 __FieldTag::__extensions => {
366 if !fields.insert(__FieldTag::__extensions) {
367 return std::result::Result::Err(A::Error::duplicate_field(
368 "multiple values for extensions",
369 ));
370 }
371 result.extensions = map
372 .next_value::<std::option::Option<std::vec::Vec<wkt::Any>>>()?
373 .unwrap_or_default();
374 }
375 __FieldTag::Unknown(key) => {
376 let value = map.next_value::<serde_json::Value>()?;
377 result._unknown_fields.insert(key, value);
378 }
379 }
380 }
381 std::result::Result::Ok(result)
382 }
383 }
384 deserializer.deserialize_any(Visitor)
385 }
386}
387
388#[doc(hidden)]
389impl serde::ser::Serialize for AttributeContext {
390 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
391 where
392 S: serde::ser::Serializer,
393 {
394 use serde::ser::SerializeMap;
395 #[allow(unused_imports)]
396 use std::option::Option::Some;
397 let mut state = serializer.serialize_map(std::option::Option::None)?;
398 if self.origin.is_some() {
399 state.serialize_entry("origin", &self.origin)?;
400 }
401 if self.source.is_some() {
402 state.serialize_entry("source", &self.source)?;
403 }
404 if self.destination.is_some() {
405 state.serialize_entry("destination", &self.destination)?;
406 }
407 if self.request.is_some() {
408 state.serialize_entry("request", &self.request)?;
409 }
410 if self.response.is_some() {
411 state.serialize_entry("response", &self.response)?;
412 }
413 if self.resource.is_some() {
414 state.serialize_entry("resource", &self.resource)?;
415 }
416 if self.api.is_some() {
417 state.serialize_entry("api", &self.api)?;
418 }
419 if !self.extensions.is_empty() {
420 state.serialize_entry("extensions", &self.extensions)?;
421 }
422 if !self._unknown_fields.is_empty() {
423 for (key, value) in self._unknown_fields.iter() {
424 state.serialize_entry(key, &value)?;
425 }
426 }
427 state.end()
428 }
429}
430
431impl std::fmt::Debug for AttributeContext {
432 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
433 let mut debug_struct = f.debug_struct("AttributeContext");
434 debug_struct.field("origin", &self.origin);
435 debug_struct.field("source", &self.source);
436 debug_struct.field("destination", &self.destination);
437 debug_struct.field("request", &self.request);
438 debug_struct.field("response", &self.response);
439 debug_struct.field("resource", &self.resource);
440 debug_struct.field("api", &self.api);
441 debug_struct.field("extensions", &self.extensions);
442 if !self._unknown_fields.is_empty() {
443 debug_struct.field("_unknown_fields", &self._unknown_fields);
444 }
445 debug_struct.finish()
446 }
447}
448
449pub mod attribute_context {
451 #[allow(unused_imports)]
452 use super::*;
453
454 #[derive(Clone, Default, PartialEq)]
459 #[non_exhaustive]
460 pub struct Peer {
461 pub ip: std::string::String,
463
464 pub port: i64,
466
467 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
469
470 pub principal: std::string::String,
474
475 pub region_code: std::string::String,
479
480 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
481 }
482
483 impl Peer {
484 pub fn new() -> Self {
485 std::default::Default::default()
486 }
487
488 pub fn set_ip<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
490 self.ip = v.into();
491 self
492 }
493
494 pub fn set_port<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
496 self.port = v.into();
497 self
498 }
499
500 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
502 where
503 T: std::iter::IntoIterator<Item = (K, V)>,
504 K: std::convert::Into<std::string::String>,
505 V: std::convert::Into<std::string::String>,
506 {
507 use std::iter::Iterator;
508 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
509 self
510 }
511
512 pub fn set_principal<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
514 self.principal = v.into();
515 self
516 }
517
518 pub fn set_region_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
520 self.region_code = v.into();
521 self
522 }
523 }
524
525 impl wkt::message::Message for Peer {
526 fn typename() -> &'static str {
527 "type.googleapis.com/google.rpc.context.AttributeContext.Peer"
528 }
529 }
530
531 #[doc(hidden)]
532 impl<'de> serde::de::Deserialize<'de> for Peer {
533 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
534 where
535 D: serde::Deserializer<'de>,
536 {
537 #[allow(non_camel_case_types)]
538 #[doc(hidden)]
539 #[derive(PartialEq, Eq, Hash)]
540 enum __FieldTag {
541 __ip,
542 __port,
543 __labels,
544 __principal,
545 __region_code,
546 Unknown(std::string::String),
547 }
548 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
549 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
550 where
551 D: serde::Deserializer<'de>,
552 {
553 struct Visitor;
554 impl<'de> serde::de::Visitor<'de> for Visitor {
555 type Value = __FieldTag;
556 fn expecting(
557 &self,
558 formatter: &mut std::fmt::Formatter,
559 ) -> std::fmt::Result {
560 formatter.write_str("a field name for Peer")
561 }
562 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
563 where
564 E: serde::de::Error,
565 {
566 use std::result::Result::Ok;
567 use std::string::ToString;
568 match value {
569 "ip" => Ok(__FieldTag::__ip),
570 "port" => Ok(__FieldTag::__port),
571 "labels" => Ok(__FieldTag::__labels),
572 "principal" => Ok(__FieldTag::__principal),
573 "regionCode" => Ok(__FieldTag::__region_code),
574 "region_code" => Ok(__FieldTag::__region_code),
575 _ => Ok(__FieldTag::Unknown(value.to_string())),
576 }
577 }
578 }
579 deserializer.deserialize_identifier(Visitor)
580 }
581 }
582 struct Visitor;
583 impl<'de> serde::de::Visitor<'de> for Visitor {
584 type Value = Peer;
585 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
586 formatter.write_str("struct Peer")
587 }
588 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
589 where
590 A: serde::de::MapAccess<'de>,
591 {
592 #[allow(unused_imports)]
593 use serde::de::Error;
594 use std::option::Option::Some;
595 let mut fields = std::collections::HashSet::new();
596 let mut result = Self::Value::new();
597 while let Some(tag) = map.next_key::<__FieldTag>()? {
598 #[allow(clippy::match_single_binding)]
599 match tag {
600 __FieldTag::__ip => {
601 if !fields.insert(__FieldTag::__ip) {
602 return std::result::Result::Err(A::Error::duplicate_field(
603 "multiple values for ip",
604 ));
605 }
606 result.ip = map
607 .next_value::<std::option::Option<std::string::String>>()?
608 .unwrap_or_default();
609 }
610 __FieldTag::__port => {
611 if !fields.insert(__FieldTag::__port) {
612 return std::result::Result::Err(A::Error::duplicate_field(
613 "multiple values for port",
614 ));
615 }
616 struct __With(std::option::Option<i64>);
617 impl<'de> serde::de::Deserialize<'de> for __With {
618 fn deserialize<D>(
619 deserializer: D,
620 ) -> std::result::Result<Self, D::Error>
621 where
622 D: serde::de::Deserializer<'de>,
623 {
624 serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
625 }
626 }
627 result.port = map.next_value::<__With>()?.0.unwrap_or_default();
628 }
629 __FieldTag::__labels => {
630 if !fields.insert(__FieldTag::__labels) {
631 return std::result::Result::Err(A::Error::duplicate_field(
632 "multiple values for labels",
633 ));
634 }
635 result.labels = map
636 .next_value::<std::option::Option<
637 std::collections::HashMap<
638 std::string::String,
639 std::string::String,
640 >,
641 >>()?
642 .unwrap_or_default();
643 }
644 __FieldTag::__principal => {
645 if !fields.insert(__FieldTag::__principal) {
646 return std::result::Result::Err(A::Error::duplicate_field(
647 "multiple values for principal",
648 ));
649 }
650 result.principal = map
651 .next_value::<std::option::Option<std::string::String>>()?
652 .unwrap_or_default();
653 }
654 __FieldTag::__region_code => {
655 if !fields.insert(__FieldTag::__region_code) {
656 return std::result::Result::Err(A::Error::duplicate_field(
657 "multiple values for region_code",
658 ));
659 }
660 result.region_code = map
661 .next_value::<std::option::Option<std::string::String>>()?
662 .unwrap_or_default();
663 }
664 __FieldTag::Unknown(key) => {
665 let value = map.next_value::<serde_json::Value>()?;
666 result._unknown_fields.insert(key, value);
667 }
668 }
669 }
670 std::result::Result::Ok(result)
671 }
672 }
673 deserializer.deserialize_any(Visitor)
674 }
675 }
676
677 #[doc(hidden)]
678 impl serde::ser::Serialize for Peer {
679 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
680 where
681 S: serde::ser::Serializer,
682 {
683 use serde::ser::SerializeMap;
684 #[allow(unused_imports)]
685 use std::option::Option::Some;
686 let mut state = serializer.serialize_map(std::option::Option::None)?;
687 if !self.ip.is_empty() {
688 state.serialize_entry("ip", &self.ip)?;
689 }
690 if !wkt::internal::is_default(&self.port) {
691 struct __With<'a>(&'a i64);
692 impl<'a> serde::ser::Serialize for __With<'a> {
693 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
694 where
695 S: serde::ser::Serializer,
696 {
697 serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
698 }
699 }
700 state.serialize_entry("port", &__With(&self.port))?;
701 }
702 if !self.labels.is_empty() {
703 state.serialize_entry("labels", &self.labels)?;
704 }
705 if !self.principal.is_empty() {
706 state.serialize_entry("principal", &self.principal)?;
707 }
708 if !self.region_code.is_empty() {
709 state.serialize_entry("regionCode", &self.region_code)?;
710 }
711 if !self._unknown_fields.is_empty() {
712 for (key, value) in self._unknown_fields.iter() {
713 state.serialize_entry(key, &value)?;
714 }
715 }
716 state.end()
717 }
718 }
719
720 impl std::fmt::Debug for Peer {
721 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
722 let mut debug_struct = f.debug_struct("Peer");
723 debug_struct.field("ip", &self.ip);
724 debug_struct.field("port", &self.port);
725 debug_struct.field("labels", &self.labels);
726 debug_struct.field("principal", &self.principal);
727 debug_struct.field("region_code", &self.region_code);
728 if !self._unknown_fields.is_empty() {
729 debug_struct.field("_unknown_fields", &self._unknown_fields);
730 }
731 debug_struct.finish()
732 }
733 }
734
735 #[derive(Clone, Default, PartialEq)]
739 #[non_exhaustive]
740 pub struct Api {
741 pub service: std::string::String,
745
746 pub operation: std::string::String,
750
751 pub protocol: std::string::String,
754
755 pub version: std::string::String,
758
759 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
760 }
761
762 impl Api {
763 pub fn new() -> Self {
764 std::default::Default::default()
765 }
766
767 pub fn set_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
769 self.service = v.into();
770 self
771 }
772
773 pub fn set_operation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
775 self.operation = v.into();
776 self
777 }
778
779 pub fn set_protocol<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
781 self.protocol = v.into();
782 self
783 }
784
785 pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
787 self.version = v.into();
788 self
789 }
790 }
791
792 impl wkt::message::Message for Api {
793 fn typename() -> &'static str {
794 "type.googleapis.com/google.rpc.context.AttributeContext.Api"
795 }
796 }
797
798 #[doc(hidden)]
799 impl<'de> serde::de::Deserialize<'de> for Api {
800 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
801 where
802 D: serde::Deserializer<'de>,
803 {
804 #[allow(non_camel_case_types)]
805 #[doc(hidden)]
806 #[derive(PartialEq, Eq, Hash)]
807 enum __FieldTag {
808 __service,
809 __operation,
810 __protocol,
811 __version,
812 Unknown(std::string::String),
813 }
814 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
815 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
816 where
817 D: serde::Deserializer<'de>,
818 {
819 struct Visitor;
820 impl<'de> serde::de::Visitor<'de> for Visitor {
821 type Value = __FieldTag;
822 fn expecting(
823 &self,
824 formatter: &mut std::fmt::Formatter,
825 ) -> std::fmt::Result {
826 formatter.write_str("a field name for Api")
827 }
828 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
829 where
830 E: serde::de::Error,
831 {
832 use std::result::Result::Ok;
833 use std::string::ToString;
834 match value {
835 "service" => Ok(__FieldTag::__service),
836 "operation" => Ok(__FieldTag::__operation),
837 "protocol" => Ok(__FieldTag::__protocol),
838 "version" => Ok(__FieldTag::__version),
839 _ => Ok(__FieldTag::Unknown(value.to_string())),
840 }
841 }
842 }
843 deserializer.deserialize_identifier(Visitor)
844 }
845 }
846 struct Visitor;
847 impl<'de> serde::de::Visitor<'de> for Visitor {
848 type Value = Api;
849 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
850 formatter.write_str("struct Api")
851 }
852 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
853 where
854 A: serde::de::MapAccess<'de>,
855 {
856 #[allow(unused_imports)]
857 use serde::de::Error;
858 use std::option::Option::Some;
859 let mut fields = std::collections::HashSet::new();
860 let mut result = Self::Value::new();
861 while let Some(tag) = map.next_key::<__FieldTag>()? {
862 #[allow(clippy::match_single_binding)]
863 match tag {
864 __FieldTag::__service => {
865 if !fields.insert(__FieldTag::__service) {
866 return std::result::Result::Err(A::Error::duplicate_field(
867 "multiple values for service",
868 ));
869 }
870 result.service = map
871 .next_value::<std::option::Option<std::string::String>>()?
872 .unwrap_or_default();
873 }
874 __FieldTag::__operation => {
875 if !fields.insert(__FieldTag::__operation) {
876 return std::result::Result::Err(A::Error::duplicate_field(
877 "multiple values for operation",
878 ));
879 }
880 result.operation = map
881 .next_value::<std::option::Option<std::string::String>>()?
882 .unwrap_or_default();
883 }
884 __FieldTag::__protocol => {
885 if !fields.insert(__FieldTag::__protocol) {
886 return std::result::Result::Err(A::Error::duplicate_field(
887 "multiple values for protocol",
888 ));
889 }
890 result.protocol = map
891 .next_value::<std::option::Option<std::string::String>>()?
892 .unwrap_or_default();
893 }
894 __FieldTag::__version => {
895 if !fields.insert(__FieldTag::__version) {
896 return std::result::Result::Err(A::Error::duplicate_field(
897 "multiple values for version",
898 ));
899 }
900 result.version = map
901 .next_value::<std::option::Option<std::string::String>>()?
902 .unwrap_or_default();
903 }
904 __FieldTag::Unknown(key) => {
905 let value = map.next_value::<serde_json::Value>()?;
906 result._unknown_fields.insert(key, value);
907 }
908 }
909 }
910 std::result::Result::Ok(result)
911 }
912 }
913 deserializer.deserialize_any(Visitor)
914 }
915 }
916
917 #[doc(hidden)]
918 impl serde::ser::Serialize for Api {
919 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
920 where
921 S: serde::ser::Serializer,
922 {
923 use serde::ser::SerializeMap;
924 #[allow(unused_imports)]
925 use std::option::Option::Some;
926 let mut state = serializer.serialize_map(std::option::Option::None)?;
927 if !self.service.is_empty() {
928 state.serialize_entry("service", &self.service)?;
929 }
930 if !self.operation.is_empty() {
931 state.serialize_entry("operation", &self.operation)?;
932 }
933 if !self.protocol.is_empty() {
934 state.serialize_entry("protocol", &self.protocol)?;
935 }
936 if !self.version.is_empty() {
937 state.serialize_entry("version", &self.version)?;
938 }
939 if !self._unknown_fields.is_empty() {
940 for (key, value) in self._unknown_fields.iter() {
941 state.serialize_entry(key, &value)?;
942 }
943 }
944 state.end()
945 }
946 }
947
948 impl std::fmt::Debug for Api {
949 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
950 let mut debug_struct = f.debug_struct("Api");
951 debug_struct.field("service", &self.service);
952 debug_struct.field("operation", &self.operation);
953 debug_struct.field("protocol", &self.protocol);
954 debug_struct.field("version", &self.version);
955 if !self._unknown_fields.is_empty() {
956 debug_struct.field("_unknown_fields", &self._unknown_fields);
957 }
958 debug_struct.finish()
959 }
960 }
961
962 #[derive(Clone, Default, PartialEq)]
966 #[non_exhaustive]
967 pub struct Auth {
968 pub principal: std::string::String,
974
975 pub audiences: std::vec::Vec<std::string::String>,
990
991 pub presenter: std::string::String,
996
997 pub claims: std::option::Option<wkt::Struct>,
1013
1014 pub access_levels: std::vec::Vec<std::string::String>,
1022
1023 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1024 }
1025
1026 impl Auth {
1027 pub fn new() -> Self {
1028 std::default::Default::default()
1029 }
1030
1031 pub fn set_principal<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1033 self.principal = v.into();
1034 self
1035 }
1036
1037 pub fn set_audiences<T, V>(mut self, v: T) -> Self
1039 where
1040 T: std::iter::IntoIterator<Item = V>,
1041 V: std::convert::Into<std::string::String>,
1042 {
1043 use std::iter::Iterator;
1044 self.audiences = v.into_iter().map(|i| i.into()).collect();
1045 self
1046 }
1047
1048 pub fn set_presenter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1050 self.presenter = v.into();
1051 self
1052 }
1053
1054 pub fn set_claims<T>(mut self, v: T) -> Self
1056 where
1057 T: std::convert::Into<wkt::Struct>,
1058 {
1059 self.claims = std::option::Option::Some(v.into());
1060 self
1061 }
1062
1063 pub fn set_or_clear_claims<T>(mut self, v: std::option::Option<T>) -> Self
1065 where
1066 T: std::convert::Into<wkt::Struct>,
1067 {
1068 self.claims = v.map(|x| x.into());
1069 self
1070 }
1071
1072 pub fn set_access_levels<T, V>(mut self, v: T) -> Self
1074 where
1075 T: std::iter::IntoIterator<Item = V>,
1076 V: std::convert::Into<std::string::String>,
1077 {
1078 use std::iter::Iterator;
1079 self.access_levels = v.into_iter().map(|i| i.into()).collect();
1080 self
1081 }
1082 }
1083
1084 impl wkt::message::Message for Auth {
1085 fn typename() -> &'static str {
1086 "type.googleapis.com/google.rpc.context.AttributeContext.Auth"
1087 }
1088 }
1089
1090 #[doc(hidden)]
1091 impl<'de> serde::de::Deserialize<'de> for Auth {
1092 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1093 where
1094 D: serde::Deserializer<'de>,
1095 {
1096 #[allow(non_camel_case_types)]
1097 #[doc(hidden)]
1098 #[derive(PartialEq, Eq, Hash)]
1099 enum __FieldTag {
1100 __principal,
1101 __audiences,
1102 __presenter,
1103 __claims,
1104 __access_levels,
1105 Unknown(std::string::String),
1106 }
1107 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1108 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1109 where
1110 D: serde::Deserializer<'de>,
1111 {
1112 struct Visitor;
1113 impl<'de> serde::de::Visitor<'de> for Visitor {
1114 type Value = __FieldTag;
1115 fn expecting(
1116 &self,
1117 formatter: &mut std::fmt::Formatter,
1118 ) -> std::fmt::Result {
1119 formatter.write_str("a field name for Auth")
1120 }
1121 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1122 where
1123 E: serde::de::Error,
1124 {
1125 use std::result::Result::Ok;
1126 use std::string::ToString;
1127 match value {
1128 "principal" => Ok(__FieldTag::__principal),
1129 "audiences" => Ok(__FieldTag::__audiences),
1130 "presenter" => Ok(__FieldTag::__presenter),
1131 "claims" => Ok(__FieldTag::__claims),
1132 "accessLevels" => Ok(__FieldTag::__access_levels),
1133 "access_levels" => Ok(__FieldTag::__access_levels),
1134 _ => Ok(__FieldTag::Unknown(value.to_string())),
1135 }
1136 }
1137 }
1138 deserializer.deserialize_identifier(Visitor)
1139 }
1140 }
1141 struct Visitor;
1142 impl<'de> serde::de::Visitor<'de> for Visitor {
1143 type Value = Auth;
1144 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1145 formatter.write_str("struct Auth")
1146 }
1147 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1148 where
1149 A: serde::de::MapAccess<'de>,
1150 {
1151 #[allow(unused_imports)]
1152 use serde::de::Error;
1153 use std::option::Option::Some;
1154 let mut fields = std::collections::HashSet::new();
1155 let mut result = Self::Value::new();
1156 while let Some(tag) = map.next_key::<__FieldTag>()? {
1157 #[allow(clippy::match_single_binding)]
1158 match tag {
1159 __FieldTag::__principal => {
1160 if !fields.insert(__FieldTag::__principal) {
1161 return std::result::Result::Err(A::Error::duplicate_field(
1162 "multiple values for principal",
1163 ));
1164 }
1165 result.principal = map
1166 .next_value::<std::option::Option<std::string::String>>()?
1167 .unwrap_or_default();
1168 }
1169 __FieldTag::__audiences => {
1170 if !fields.insert(__FieldTag::__audiences) {
1171 return std::result::Result::Err(A::Error::duplicate_field(
1172 "multiple values for audiences",
1173 ));
1174 }
1175 result.audiences = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
1176 }
1177 __FieldTag::__presenter => {
1178 if !fields.insert(__FieldTag::__presenter) {
1179 return std::result::Result::Err(A::Error::duplicate_field(
1180 "multiple values for presenter",
1181 ));
1182 }
1183 result.presenter = map
1184 .next_value::<std::option::Option<std::string::String>>()?
1185 .unwrap_or_default();
1186 }
1187 __FieldTag::__claims => {
1188 if !fields.insert(__FieldTag::__claims) {
1189 return std::result::Result::Err(A::Error::duplicate_field(
1190 "multiple values for claims",
1191 ));
1192 }
1193 result.claims =
1194 map.next_value::<std::option::Option<wkt::Struct>>()?;
1195 }
1196 __FieldTag::__access_levels => {
1197 if !fields.insert(__FieldTag::__access_levels) {
1198 return std::result::Result::Err(A::Error::duplicate_field(
1199 "multiple values for access_levels",
1200 ));
1201 }
1202 result.access_levels = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
1203 }
1204 __FieldTag::Unknown(key) => {
1205 let value = map.next_value::<serde_json::Value>()?;
1206 result._unknown_fields.insert(key, value);
1207 }
1208 }
1209 }
1210 std::result::Result::Ok(result)
1211 }
1212 }
1213 deserializer.deserialize_any(Visitor)
1214 }
1215 }
1216
1217 #[doc(hidden)]
1218 impl serde::ser::Serialize for Auth {
1219 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1220 where
1221 S: serde::ser::Serializer,
1222 {
1223 use serde::ser::SerializeMap;
1224 #[allow(unused_imports)]
1225 use std::option::Option::Some;
1226 let mut state = serializer.serialize_map(std::option::Option::None)?;
1227 if !self.principal.is_empty() {
1228 state.serialize_entry("principal", &self.principal)?;
1229 }
1230 if !self.audiences.is_empty() {
1231 state.serialize_entry("audiences", &self.audiences)?;
1232 }
1233 if !self.presenter.is_empty() {
1234 state.serialize_entry("presenter", &self.presenter)?;
1235 }
1236 if self.claims.is_some() {
1237 state.serialize_entry("claims", &self.claims)?;
1238 }
1239 if !self.access_levels.is_empty() {
1240 state.serialize_entry("accessLevels", &self.access_levels)?;
1241 }
1242 if !self._unknown_fields.is_empty() {
1243 for (key, value) in self._unknown_fields.iter() {
1244 state.serialize_entry(key, &value)?;
1245 }
1246 }
1247 state.end()
1248 }
1249 }
1250
1251 impl std::fmt::Debug for Auth {
1252 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1253 let mut debug_struct = f.debug_struct("Auth");
1254 debug_struct.field("principal", &self.principal);
1255 debug_struct.field("audiences", &self.audiences);
1256 debug_struct.field("presenter", &self.presenter);
1257 debug_struct.field("claims", &self.claims);
1258 debug_struct.field("access_levels", &self.access_levels);
1259 if !self._unknown_fields.is_empty() {
1260 debug_struct.field("_unknown_fields", &self._unknown_fields);
1261 }
1262 debug_struct.finish()
1263 }
1264 }
1265
1266 #[derive(Clone, Default, PartialEq)]
1270 #[non_exhaustive]
1271 pub struct Request {
1272 pub id: std::string::String,
1276
1277 pub method: std::string::String,
1279
1280 pub headers: std::collections::HashMap<std::string::String, std::string::String>,
1284
1285 pub path: std::string::String,
1287
1288 pub host: std::string::String,
1290
1291 pub scheme: std::string::String,
1293
1294 pub query: std::string::String,
1297
1298 pub time: std::option::Option<wkt::Timestamp>,
1301
1302 pub size: i64,
1304
1305 pub protocol: std::string::String,
1310
1311 pub reason: std::string::String,
1314
1315 pub auth: std::option::Option<crate::model::attribute_context::Auth>,
1318
1319 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1320 }
1321
1322 impl Request {
1323 pub fn new() -> Self {
1324 std::default::Default::default()
1325 }
1326
1327 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1329 self.id = v.into();
1330 self
1331 }
1332
1333 pub fn set_method<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1335 self.method = v.into();
1336 self
1337 }
1338
1339 pub fn set_headers<T, K, V>(mut self, v: T) -> Self
1341 where
1342 T: std::iter::IntoIterator<Item = (K, V)>,
1343 K: std::convert::Into<std::string::String>,
1344 V: std::convert::Into<std::string::String>,
1345 {
1346 use std::iter::Iterator;
1347 self.headers = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1348 self
1349 }
1350
1351 pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1353 self.path = v.into();
1354 self
1355 }
1356
1357 pub fn set_host<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1359 self.host = v.into();
1360 self
1361 }
1362
1363 pub fn set_scheme<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1365 self.scheme = v.into();
1366 self
1367 }
1368
1369 pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1371 self.query = v.into();
1372 self
1373 }
1374
1375 pub fn set_time<T>(mut self, v: T) -> Self
1377 where
1378 T: std::convert::Into<wkt::Timestamp>,
1379 {
1380 self.time = std::option::Option::Some(v.into());
1381 self
1382 }
1383
1384 pub fn set_or_clear_time<T>(mut self, v: std::option::Option<T>) -> Self
1386 where
1387 T: std::convert::Into<wkt::Timestamp>,
1388 {
1389 self.time = v.map(|x| x.into());
1390 self
1391 }
1392
1393 pub fn set_size<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
1395 self.size = v.into();
1396 self
1397 }
1398
1399 pub fn set_protocol<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1401 self.protocol = v.into();
1402 self
1403 }
1404
1405 pub fn set_reason<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1407 self.reason = v.into();
1408 self
1409 }
1410
1411 pub fn set_auth<T>(mut self, v: T) -> Self
1413 where
1414 T: std::convert::Into<crate::model::attribute_context::Auth>,
1415 {
1416 self.auth = std::option::Option::Some(v.into());
1417 self
1418 }
1419
1420 pub fn set_or_clear_auth<T>(mut self, v: std::option::Option<T>) -> Self
1422 where
1423 T: std::convert::Into<crate::model::attribute_context::Auth>,
1424 {
1425 self.auth = v.map(|x| x.into());
1426 self
1427 }
1428 }
1429
1430 impl wkt::message::Message for Request {
1431 fn typename() -> &'static str {
1432 "type.googleapis.com/google.rpc.context.AttributeContext.Request"
1433 }
1434 }
1435
1436 #[doc(hidden)]
1437 impl<'de> serde::de::Deserialize<'de> for Request {
1438 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1439 where
1440 D: serde::Deserializer<'de>,
1441 {
1442 #[allow(non_camel_case_types)]
1443 #[doc(hidden)]
1444 #[derive(PartialEq, Eq, Hash)]
1445 enum __FieldTag {
1446 __id,
1447 __method,
1448 __headers,
1449 __path,
1450 __host,
1451 __scheme,
1452 __query,
1453 __time,
1454 __size,
1455 __protocol,
1456 __reason,
1457 __auth,
1458 Unknown(std::string::String),
1459 }
1460 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1461 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1462 where
1463 D: serde::Deserializer<'de>,
1464 {
1465 struct Visitor;
1466 impl<'de> serde::de::Visitor<'de> for Visitor {
1467 type Value = __FieldTag;
1468 fn expecting(
1469 &self,
1470 formatter: &mut std::fmt::Formatter,
1471 ) -> std::fmt::Result {
1472 formatter.write_str("a field name for Request")
1473 }
1474 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1475 where
1476 E: serde::de::Error,
1477 {
1478 use std::result::Result::Ok;
1479 use std::string::ToString;
1480 match value {
1481 "id" => Ok(__FieldTag::__id),
1482 "method" => Ok(__FieldTag::__method),
1483 "headers" => Ok(__FieldTag::__headers),
1484 "path" => Ok(__FieldTag::__path),
1485 "host" => Ok(__FieldTag::__host),
1486 "scheme" => Ok(__FieldTag::__scheme),
1487 "query" => Ok(__FieldTag::__query),
1488 "time" => Ok(__FieldTag::__time),
1489 "size" => Ok(__FieldTag::__size),
1490 "protocol" => Ok(__FieldTag::__protocol),
1491 "reason" => Ok(__FieldTag::__reason),
1492 "auth" => Ok(__FieldTag::__auth),
1493 _ => Ok(__FieldTag::Unknown(value.to_string())),
1494 }
1495 }
1496 }
1497 deserializer.deserialize_identifier(Visitor)
1498 }
1499 }
1500 struct Visitor;
1501 impl<'de> serde::de::Visitor<'de> for Visitor {
1502 type Value = Request;
1503 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1504 formatter.write_str("struct Request")
1505 }
1506 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1507 where
1508 A: serde::de::MapAccess<'de>,
1509 {
1510 #[allow(unused_imports)]
1511 use serde::de::Error;
1512 use std::option::Option::Some;
1513 let mut fields = std::collections::HashSet::new();
1514 let mut result = Self::Value::new();
1515 while let Some(tag) = map.next_key::<__FieldTag>()? {
1516 #[allow(clippy::match_single_binding)]
1517 match tag {
1518 __FieldTag::__id => {
1519 if !fields.insert(__FieldTag::__id) {
1520 return std::result::Result::Err(A::Error::duplicate_field(
1521 "multiple values for id",
1522 ));
1523 }
1524 result.id = map
1525 .next_value::<std::option::Option<std::string::String>>()?
1526 .unwrap_or_default();
1527 }
1528 __FieldTag::__method => {
1529 if !fields.insert(__FieldTag::__method) {
1530 return std::result::Result::Err(A::Error::duplicate_field(
1531 "multiple values for method",
1532 ));
1533 }
1534 result.method = map
1535 .next_value::<std::option::Option<std::string::String>>()?
1536 .unwrap_or_default();
1537 }
1538 __FieldTag::__headers => {
1539 if !fields.insert(__FieldTag::__headers) {
1540 return std::result::Result::Err(A::Error::duplicate_field(
1541 "multiple values for headers",
1542 ));
1543 }
1544 result.headers = map
1545 .next_value::<std::option::Option<
1546 std::collections::HashMap<
1547 std::string::String,
1548 std::string::String,
1549 >,
1550 >>()?
1551 .unwrap_or_default();
1552 }
1553 __FieldTag::__path => {
1554 if !fields.insert(__FieldTag::__path) {
1555 return std::result::Result::Err(A::Error::duplicate_field(
1556 "multiple values for path",
1557 ));
1558 }
1559 result.path = map
1560 .next_value::<std::option::Option<std::string::String>>()?
1561 .unwrap_or_default();
1562 }
1563 __FieldTag::__host => {
1564 if !fields.insert(__FieldTag::__host) {
1565 return std::result::Result::Err(A::Error::duplicate_field(
1566 "multiple values for host",
1567 ));
1568 }
1569 result.host = map
1570 .next_value::<std::option::Option<std::string::String>>()?
1571 .unwrap_or_default();
1572 }
1573 __FieldTag::__scheme => {
1574 if !fields.insert(__FieldTag::__scheme) {
1575 return std::result::Result::Err(A::Error::duplicate_field(
1576 "multiple values for scheme",
1577 ));
1578 }
1579 result.scheme = map
1580 .next_value::<std::option::Option<std::string::String>>()?
1581 .unwrap_or_default();
1582 }
1583 __FieldTag::__query => {
1584 if !fields.insert(__FieldTag::__query) {
1585 return std::result::Result::Err(A::Error::duplicate_field(
1586 "multiple values for query",
1587 ));
1588 }
1589 result.query = map
1590 .next_value::<std::option::Option<std::string::String>>()?
1591 .unwrap_or_default();
1592 }
1593 __FieldTag::__time => {
1594 if !fields.insert(__FieldTag::__time) {
1595 return std::result::Result::Err(A::Error::duplicate_field(
1596 "multiple values for time",
1597 ));
1598 }
1599 result.time =
1600 map.next_value::<std::option::Option<wkt::Timestamp>>()?;
1601 }
1602 __FieldTag::__size => {
1603 if !fields.insert(__FieldTag::__size) {
1604 return std::result::Result::Err(A::Error::duplicate_field(
1605 "multiple values for size",
1606 ));
1607 }
1608 struct __With(std::option::Option<i64>);
1609 impl<'de> serde::de::Deserialize<'de> for __With {
1610 fn deserialize<D>(
1611 deserializer: D,
1612 ) -> std::result::Result<Self, D::Error>
1613 where
1614 D: serde::de::Deserializer<'de>,
1615 {
1616 serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
1617 }
1618 }
1619 result.size = map.next_value::<__With>()?.0.unwrap_or_default();
1620 }
1621 __FieldTag::__protocol => {
1622 if !fields.insert(__FieldTag::__protocol) {
1623 return std::result::Result::Err(A::Error::duplicate_field(
1624 "multiple values for protocol",
1625 ));
1626 }
1627 result.protocol = map
1628 .next_value::<std::option::Option<std::string::String>>()?
1629 .unwrap_or_default();
1630 }
1631 __FieldTag::__reason => {
1632 if !fields.insert(__FieldTag::__reason) {
1633 return std::result::Result::Err(A::Error::duplicate_field(
1634 "multiple values for reason",
1635 ));
1636 }
1637 result.reason = map
1638 .next_value::<std::option::Option<std::string::String>>()?
1639 .unwrap_or_default();
1640 }
1641 __FieldTag::__auth => {
1642 if !fields.insert(__FieldTag::__auth) {
1643 return std::result::Result::Err(A::Error::duplicate_field(
1644 "multiple values for auth",
1645 ));
1646 }
1647 result.auth = map.next_value::<std::option::Option<crate::model::attribute_context::Auth>>()?
1648 ;
1649 }
1650 __FieldTag::Unknown(key) => {
1651 let value = map.next_value::<serde_json::Value>()?;
1652 result._unknown_fields.insert(key, value);
1653 }
1654 }
1655 }
1656 std::result::Result::Ok(result)
1657 }
1658 }
1659 deserializer.deserialize_any(Visitor)
1660 }
1661 }
1662
1663 #[doc(hidden)]
1664 impl serde::ser::Serialize for Request {
1665 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1666 where
1667 S: serde::ser::Serializer,
1668 {
1669 use serde::ser::SerializeMap;
1670 #[allow(unused_imports)]
1671 use std::option::Option::Some;
1672 let mut state = serializer.serialize_map(std::option::Option::None)?;
1673 if !self.id.is_empty() {
1674 state.serialize_entry("id", &self.id)?;
1675 }
1676 if !self.method.is_empty() {
1677 state.serialize_entry("method", &self.method)?;
1678 }
1679 if !self.headers.is_empty() {
1680 state.serialize_entry("headers", &self.headers)?;
1681 }
1682 if !self.path.is_empty() {
1683 state.serialize_entry("path", &self.path)?;
1684 }
1685 if !self.host.is_empty() {
1686 state.serialize_entry("host", &self.host)?;
1687 }
1688 if !self.scheme.is_empty() {
1689 state.serialize_entry("scheme", &self.scheme)?;
1690 }
1691 if !self.query.is_empty() {
1692 state.serialize_entry("query", &self.query)?;
1693 }
1694 if self.time.is_some() {
1695 state.serialize_entry("time", &self.time)?;
1696 }
1697 if !wkt::internal::is_default(&self.size) {
1698 struct __With<'a>(&'a i64);
1699 impl<'a> serde::ser::Serialize for __With<'a> {
1700 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1701 where
1702 S: serde::ser::Serializer,
1703 {
1704 serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
1705 }
1706 }
1707 state.serialize_entry("size", &__With(&self.size))?;
1708 }
1709 if !self.protocol.is_empty() {
1710 state.serialize_entry("protocol", &self.protocol)?;
1711 }
1712 if !self.reason.is_empty() {
1713 state.serialize_entry("reason", &self.reason)?;
1714 }
1715 if self.auth.is_some() {
1716 state.serialize_entry("auth", &self.auth)?;
1717 }
1718 if !self._unknown_fields.is_empty() {
1719 for (key, value) in self._unknown_fields.iter() {
1720 state.serialize_entry(key, &value)?;
1721 }
1722 }
1723 state.end()
1724 }
1725 }
1726
1727 impl std::fmt::Debug for Request {
1728 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1729 let mut debug_struct = f.debug_struct("Request");
1730 debug_struct.field("id", &self.id);
1731 debug_struct.field("method", &self.method);
1732 debug_struct.field("headers", &self.headers);
1733 debug_struct.field("path", &self.path);
1734 debug_struct.field("host", &self.host);
1735 debug_struct.field("scheme", &self.scheme);
1736 debug_struct.field("query", &self.query);
1737 debug_struct.field("time", &self.time);
1738 debug_struct.field("size", &self.size);
1739 debug_struct.field("protocol", &self.protocol);
1740 debug_struct.field("reason", &self.reason);
1741 debug_struct.field("auth", &self.auth);
1742 if !self._unknown_fields.is_empty() {
1743 debug_struct.field("_unknown_fields", &self._unknown_fields);
1744 }
1745 debug_struct.finish()
1746 }
1747 }
1748
1749 #[derive(Clone, Default, PartialEq)]
1752 #[non_exhaustive]
1753 pub struct Response {
1754 pub code: i64,
1756
1757 pub size: i64,
1759
1760 pub headers: std::collections::HashMap<std::string::String, std::string::String>,
1764
1765 pub time: std::option::Option<wkt::Timestamp>,
1768
1769 pub backend_latency: std::option::Option<wkt::Duration>,
1774
1775 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1776 }
1777
1778 impl Response {
1779 pub fn new() -> Self {
1780 std::default::Default::default()
1781 }
1782
1783 pub fn set_code<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
1785 self.code = v.into();
1786 self
1787 }
1788
1789 pub fn set_size<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
1791 self.size = v.into();
1792 self
1793 }
1794
1795 pub fn set_headers<T, K, V>(mut self, v: T) -> Self
1797 where
1798 T: std::iter::IntoIterator<Item = (K, V)>,
1799 K: std::convert::Into<std::string::String>,
1800 V: std::convert::Into<std::string::String>,
1801 {
1802 use std::iter::Iterator;
1803 self.headers = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1804 self
1805 }
1806
1807 pub fn set_time<T>(mut self, v: T) -> Self
1809 where
1810 T: std::convert::Into<wkt::Timestamp>,
1811 {
1812 self.time = std::option::Option::Some(v.into());
1813 self
1814 }
1815
1816 pub fn set_or_clear_time<T>(mut self, v: std::option::Option<T>) -> Self
1818 where
1819 T: std::convert::Into<wkt::Timestamp>,
1820 {
1821 self.time = v.map(|x| x.into());
1822 self
1823 }
1824
1825 pub fn set_backend_latency<T>(mut self, v: T) -> Self
1827 where
1828 T: std::convert::Into<wkt::Duration>,
1829 {
1830 self.backend_latency = std::option::Option::Some(v.into());
1831 self
1832 }
1833
1834 pub fn set_or_clear_backend_latency<T>(mut self, v: std::option::Option<T>) -> Self
1836 where
1837 T: std::convert::Into<wkt::Duration>,
1838 {
1839 self.backend_latency = v.map(|x| x.into());
1840 self
1841 }
1842 }
1843
1844 impl wkt::message::Message for Response {
1845 fn typename() -> &'static str {
1846 "type.googleapis.com/google.rpc.context.AttributeContext.Response"
1847 }
1848 }
1849
1850 #[doc(hidden)]
1851 impl<'de> serde::de::Deserialize<'de> for Response {
1852 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1853 where
1854 D: serde::Deserializer<'de>,
1855 {
1856 #[allow(non_camel_case_types)]
1857 #[doc(hidden)]
1858 #[derive(PartialEq, Eq, Hash)]
1859 enum __FieldTag {
1860 __code,
1861 __size,
1862 __headers,
1863 __time,
1864 __backend_latency,
1865 Unknown(std::string::String),
1866 }
1867 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1868 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1869 where
1870 D: serde::Deserializer<'de>,
1871 {
1872 struct Visitor;
1873 impl<'de> serde::de::Visitor<'de> for Visitor {
1874 type Value = __FieldTag;
1875 fn expecting(
1876 &self,
1877 formatter: &mut std::fmt::Formatter,
1878 ) -> std::fmt::Result {
1879 formatter.write_str("a field name for Response")
1880 }
1881 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1882 where
1883 E: serde::de::Error,
1884 {
1885 use std::result::Result::Ok;
1886 use std::string::ToString;
1887 match value {
1888 "code" => Ok(__FieldTag::__code),
1889 "size" => Ok(__FieldTag::__size),
1890 "headers" => Ok(__FieldTag::__headers),
1891 "time" => Ok(__FieldTag::__time),
1892 "backendLatency" => Ok(__FieldTag::__backend_latency),
1893 "backend_latency" => Ok(__FieldTag::__backend_latency),
1894 _ => Ok(__FieldTag::Unknown(value.to_string())),
1895 }
1896 }
1897 }
1898 deserializer.deserialize_identifier(Visitor)
1899 }
1900 }
1901 struct Visitor;
1902 impl<'de> serde::de::Visitor<'de> for Visitor {
1903 type Value = Response;
1904 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1905 formatter.write_str("struct Response")
1906 }
1907 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1908 where
1909 A: serde::de::MapAccess<'de>,
1910 {
1911 #[allow(unused_imports)]
1912 use serde::de::Error;
1913 use std::option::Option::Some;
1914 let mut fields = std::collections::HashSet::new();
1915 let mut result = Self::Value::new();
1916 while let Some(tag) = map.next_key::<__FieldTag>()? {
1917 #[allow(clippy::match_single_binding)]
1918 match tag {
1919 __FieldTag::__code => {
1920 if !fields.insert(__FieldTag::__code) {
1921 return std::result::Result::Err(A::Error::duplicate_field(
1922 "multiple values for code",
1923 ));
1924 }
1925 struct __With(std::option::Option<i64>);
1926 impl<'de> serde::de::Deserialize<'de> for __With {
1927 fn deserialize<D>(
1928 deserializer: D,
1929 ) -> std::result::Result<Self, D::Error>
1930 where
1931 D: serde::de::Deserializer<'de>,
1932 {
1933 serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
1934 }
1935 }
1936 result.code = map.next_value::<__With>()?.0.unwrap_or_default();
1937 }
1938 __FieldTag::__size => {
1939 if !fields.insert(__FieldTag::__size) {
1940 return std::result::Result::Err(A::Error::duplicate_field(
1941 "multiple values for size",
1942 ));
1943 }
1944 struct __With(std::option::Option<i64>);
1945 impl<'de> serde::de::Deserialize<'de> for __With {
1946 fn deserialize<D>(
1947 deserializer: D,
1948 ) -> std::result::Result<Self, D::Error>
1949 where
1950 D: serde::de::Deserializer<'de>,
1951 {
1952 serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
1953 }
1954 }
1955 result.size = map.next_value::<__With>()?.0.unwrap_or_default();
1956 }
1957 __FieldTag::__headers => {
1958 if !fields.insert(__FieldTag::__headers) {
1959 return std::result::Result::Err(A::Error::duplicate_field(
1960 "multiple values for headers",
1961 ));
1962 }
1963 result.headers = map
1964 .next_value::<std::option::Option<
1965 std::collections::HashMap<
1966 std::string::String,
1967 std::string::String,
1968 >,
1969 >>()?
1970 .unwrap_or_default();
1971 }
1972 __FieldTag::__time => {
1973 if !fields.insert(__FieldTag::__time) {
1974 return std::result::Result::Err(A::Error::duplicate_field(
1975 "multiple values for time",
1976 ));
1977 }
1978 result.time =
1979 map.next_value::<std::option::Option<wkt::Timestamp>>()?;
1980 }
1981 __FieldTag::__backend_latency => {
1982 if !fields.insert(__FieldTag::__backend_latency) {
1983 return std::result::Result::Err(A::Error::duplicate_field(
1984 "multiple values for backend_latency",
1985 ));
1986 }
1987 result.backend_latency =
1988 map.next_value::<std::option::Option<wkt::Duration>>()?;
1989 }
1990 __FieldTag::Unknown(key) => {
1991 let value = map.next_value::<serde_json::Value>()?;
1992 result._unknown_fields.insert(key, value);
1993 }
1994 }
1995 }
1996 std::result::Result::Ok(result)
1997 }
1998 }
1999 deserializer.deserialize_any(Visitor)
2000 }
2001 }
2002
2003 #[doc(hidden)]
2004 impl serde::ser::Serialize for Response {
2005 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2006 where
2007 S: serde::ser::Serializer,
2008 {
2009 use serde::ser::SerializeMap;
2010 #[allow(unused_imports)]
2011 use std::option::Option::Some;
2012 let mut state = serializer.serialize_map(std::option::Option::None)?;
2013 if !wkt::internal::is_default(&self.code) {
2014 struct __With<'a>(&'a i64);
2015 impl<'a> serde::ser::Serialize for __With<'a> {
2016 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2017 where
2018 S: serde::ser::Serializer,
2019 {
2020 serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
2021 }
2022 }
2023 state.serialize_entry("code", &__With(&self.code))?;
2024 }
2025 if !wkt::internal::is_default(&self.size) {
2026 struct __With<'a>(&'a i64);
2027 impl<'a> serde::ser::Serialize for __With<'a> {
2028 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2029 where
2030 S: serde::ser::Serializer,
2031 {
2032 serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
2033 }
2034 }
2035 state.serialize_entry("size", &__With(&self.size))?;
2036 }
2037 if !self.headers.is_empty() {
2038 state.serialize_entry("headers", &self.headers)?;
2039 }
2040 if self.time.is_some() {
2041 state.serialize_entry("time", &self.time)?;
2042 }
2043 if self.backend_latency.is_some() {
2044 state.serialize_entry("backendLatency", &self.backend_latency)?;
2045 }
2046 if !self._unknown_fields.is_empty() {
2047 for (key, value) in self._unknown_fields.iter() {
2048 state.serialize_entry(key, &value)?;
2049 }
2050 }
2051 state.end()
2052 }
2053 }
2054
2055 impl std::fmt::Debug for Response {
2056 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2057 let mut debug_struct = f.debug_struct("Response");
2058 debug_struct.field("code", &self.code);
2059 debug_struct.field("size", &self.size);
2060 debug_struct.field("headers", &self.headers);
2061 debug_struct.field("time", &self.time);
2062 debug_struct.field("backend_latency", &self.backend_latency);
2063 if !self._unknown_fields.is_empty() {
2064 debug_struct.field("_unknown_fields", &self._unknown_fields);
2065 }
2066 debug_struct.finish()
2067 }
2068 }
2069
2070 #[derive(Clone, Default, PartialEq)]
2074 #[non_exhaustive]
2075 pub struct Resource {
2076 pub service: std::string::String,
2080
2081 pub name: std::string::String,
2094
2095 pub r#type: std::string::String,
2101
2102 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
2105
2106 pub uid: std::string::String,
2112
2113 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
2120
2121 pub display_name: std::string::String,
2123
2124 pub create_time: std::option::Option<wkt::Timestamp>,
2127
2128 pub update_time: std::option::Option<wkt::Timestamp>,
2132
2133 pub delete_time: std::option::Option<wkt::Timestamp>,
2136
2137 pub etag: std::string::String,
2141
2142 pub location: std::string::String,
2151
2152 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2153 }
2154
2155 impl Resource {
2156 pub fn new() -> Self {
2157 std::default::Default::default()
2158 }
2159
2160 pub fn set_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2162 self.service = v.into();
2163 self
2164 }
2165
2166 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2168 self.name = v.into();
2169 self
2170 }
2171
2172 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2174 self.r#type = v.into();
2175 self
2176 }
2177
2178 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
2180 where
2181 T: std::iter::IntoIterator<Item = (K, V)>,
2182 K: std::convert::Into<std::string::String>,
2183 V: std::convert::Into<std::string::String>,
2184 {
2185 use std::iter::Iterator;
2186 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2187 self
2188 }
2189
2190 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2192 self.uid = v.into();
2193 self
2194 }
2195
2196 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
2198 where
2199 T: std::iter::IntoIterator<Item = (K, V)>,
2200 K: std::convert::Into<std::string::String>,
2201 V: std::convert::Into<std::string::String>,
2202 {
2203 use std::iter::Iterator;
2204 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2205 self
2206 }
2207
2208 pub fn set_display_name<T: std::convert::Into<std::string::String>>(
2210 mut self,
2211 v: T,
2212 ) -> Self {
2213 self.display_name = v.into();
2214 self
2215 }
2216
2217 pub fn set_create_time<T>(mut self, v: T) -> Self
2219 where
2220 T: std::convert::Into<wkt::Timestamp>,
2221 {
2222 self.create_time = std::option::Option::Some(v.into());
2223 self
2224 }
2225
2226 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
2228 where
2229 T: std::convert::Into<wkt::Timestamp>,
2230 {
2231 self.create_time = v.map(|x| x.into());
2232 self
2233 }
2234
2235 pub fn set_update_time<T>(mut self, v: T) -> Self
2237 where
2238 T: std::convert::Into<wkt::Timestamp>,
2239 {
2240 self.update_time = std::option::Option::Some(v.into());
2241 self
2242 }
2243
2244 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
2246 where
2247 T: std::convert::Into<wkt::Timestamp>,
2248 {
2249 self.update_time = v.map(|x| x.into());
2250 self
2251 }
2252
2253 pub fn set_delete_time<T>(mut self, v: T) -> Self
2255 where
2256 T: std::convert::Into<wkt::Timestamp>,
2257 {
2258 self.delete_time = std::option::Option::Some(v.into());
2259 self
2260 }
2261
2262 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
2264 where
2265 T: std::convert::Into<wkt::Timestamp>,
2266 {
2267 self.delete_time = v.map(|x| x.into());
2268 self
2269 }
2270
2271 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2273 self.etag = v.into();
2274 self
2275 }
2276
2277 pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2279 self.location = v.into();
2280 self
2281 }
2282 }
2283
2284 impl wkt::message::Message for Resource {
2285 fn typename() -> &'static str {
2286 "type.googleapis.com/google.rpc.context.AttributeContext.Resource"
2287 }
2288 }
2289
2290 #[doc(hidden)]
2291 impl<'de> serde::de::Deserialize<'de> for Resource {
2292 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2293 where
2294 D: serde::Deserializer<'de>,
2295 {
2296 #[allow(non_camel_case_types)]
2297 #[doc(hidden)]
2298 #[derive(PartialEq, Eq, Hash)]
2299 enum __FieldTag {
2300 __service,
2301 __name,
2302 __type,
2303 __labels,
2304 __uid,
2305 __annotations,
2306 __display_name,
2307 __create_time,
2308 __update_time,
2309 __delete_time,
2310 __etag,
2311 __location,
2312 Unknown(std::string::String),
2313 }
2314 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2315 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2316 where
2317 D: serde::Deserializer<'de>,
2318 {
2319 struct Visitor;
2320 impl<'de> serde::de::Visitor<'de> for Visitor {
2321 type Value = __FieldTag;
2322 fn expecting(
2323 &self,
2324 formatter: &mut std::fmt::Formatter,
2325 ) -> std::fmt::Result {
2326 formatter.write_str("a field name for Resource")
2327 }
2328 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2329 where
2330 E: serde::de::Error,
2331 {
2332 use std::result::Result::Ok;
2333 use std::string::ToString;
2334 match value {
2335 "service" => Ok(__FieldTag::__service),
2336 "name" => Ok(__FieldTag::__name),
2337 "type" => Ok(__FieldTag::__type),
2338 "labels" => Ok(__FieldTag::__labels),
2339 "uid" => Ok(__FieldTag::__uid),
2340 "annotations" => Ok(__FieldTag::__annotations),
2341 "displayName" => Ok(__FieldTag::__display_name),
2342 "display_name" => Ok(__FieldTag::__display_name),
2343 "createTime" => Ok(__FieldTag::__create_time),
2344 "create_time" => Ok(__FieldTag::__create_time),
2345 "updateTime" => Ok(__FieldTag::__update_time),
2346 "update_time" => Ok(__FieldTag::__update_time),
2347 "deleteTime" => Ok(__FieldTag::__delete_time),
2348 "delete_time" => Ok(__FieldTag::__delete_time),
2349 "etag" => Ok(__FieldTag::__etag),
2350 "location" => Ok(__FieldTag::__location),
2351 _ => Ok(__FieldTag::Unknown(value.to_string())),
2352 }
2353 }
2354 }
2355 deserializer.deserialize_identifier(Visitor)
2356 }
2357 }
2358 struct Visitor;
2359 impl<'de> serde::de::Visitor<'de> for Visitor {
2360 type Value = Resource;
2361 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2362 formatter.write_str("struct Resource")
2363 }
2364 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2365 where
2366 A: serde::de::MapAccess<'de>,
2367 {
2368 #[allow(unused_imports)]
2369 use serde::de::Error;
2370 use std::option::Option::Some;
2371 let mut fields = std::collections::HashSet::new();
2372 let mut result = Self::Value::new();
2373 while let Some(tag) = map.next_key::<__FieldTag>()? {
2374 #[allow(clippy::match_single_binding)]
2375 match tag {
2376 __FieldTag::__service => {
2377 if !fields.insert(__FieldTag::__service) {
2378 return std::result::Result::Err(A::Error::duplicate_field(
2379 "multiple values for service",
2380 ));
2381 }
2382 result.service = map
2383 .next_value::<std::option::Option<std::string::String>>()?
2384 .unwrap_or_default();
2385 }
2386 __FieldTag::__name => {
2387 if !fields.insert(__FieldTag::__name) {
2388 return std::result::Result::Err(A::Error::duplicate_field(
2389 "multiple values for name",
2390 ));
2391 }
2392 result.name = map
2393 .next_value::<std::option::Option<std::string::String>>()?
2394 .unwrap_or_default();
2395 }
2396 __FieldTag::__type => {
2397 if !fields.insert(__FieldTag::__type) {
2398 return std::result::Result::Err(A::Error::duplicate_field(
2399 "multiple values for type",
2400 ));
2401 }
2402 result.r#type = map
2403 .next_value::<std::option::Option<std::string::String>>()?
2404 .unwrap_or_default();
2405 }
2406 __FieldTag::__labels => {
2407 if !fields.insert(__FieldTag::__labels) {
2408 return std::result::Result::Err(A::Error::duplicate_field(
2409 "multiple values for labels",
2410 ));
2411 }
2412 result.labels = map
2413 .next_value::<std::option::Option<
2414 std::collections::HashMap<
2415 std::string::String,
2416 std::string::String,
2417 >,
2418 >>()?
2419 .unwrap_or_default();
2420 }
2421 __FieldTag::__uid => {
2422 if !fields.insert(__FieldTag::__uid) {
2423 return std::result::Result::Err(A::Error::duplicate_field(
2424 "multiple values for uid",
2425 ));
2426 }
2427 result.uid = map
2428 .next_value::<std::option::Option<std::string::String>>()?
2429 .unwrap_or_default();
2430 }
2431 __FieldTag::__annotations => {
2432 if !fields.insert(__FieldTag::__annotations) {
2433 return std::result::Result::Err(A::Error::duplicate_field(
2434 "multiple values for annotations",
2435 ));
2436 }
2437 result.annotations = map
2438 .next_value::<std::option::Option<
2439 std::collections::HashMap<
2440 std::string::String,
2441 std::string::String,
2442 >,
2443 >>()?
2444 .unwrap_or_default();
2445 }
2446 __FieldTag::__display_name => {
2447 if !fields.insert(__FieldTag::__display_name) {
2448 return std::result::Result::Err(A::Error::duplicate_field(
2449 "multiple values for display_name",
2450 ));
2451 }
2452 result.display_name = map
2453 .next_value::<std::option::Option<std::string::String>>()?
2454 .unwrap_or_default();
2455 }
2456 __FieldTag::__create_time => {
2457 if !fields.insert(__FieldTag::__create_time) {
2458 return std::result::Result::Err(A::Error::duplicate_field(
2459 "multiple values for create_time",
2460 ));
2461 }
2462 result.create_time =
2463 map.next_value::<std::option::Option<wkt::Timestamp>>()?;
2464 }
2465 __FieldTag::__update_time => {
2466 if !fields.insert(__FieldTag::__update_time) {
2467 return std::result::Result::Err(A::Error::duplicate_field(
2468 "multiple values for update_time",
2469 ));
2470 }
2471 result.update_time =
2472 map.next_value::<std::option::Option<wkt::Timestamp>>()?;
2473 }
2474 __FieldTag::__delete_time => {
2475 if !fields.insert(__FieldTag::__delete_time) {
2476 return std::result::Result::Err(A::Error::duplicate_field(
2477 "multiple values for delete_time",
2478 ));
2479 }
2480 result.delete_time =
2481 map.next_value::<std::option::Option<wkt::Timestamp>>()?;
2482 }
2483 __FieldTag::__etag => {
2484 if !fields.insert(__FieldTag::__etag) {
2485 return std::result::Result::Err(A::Error::duplicate_field(
2486 "multiple values for etag",
2487 ));
2488 }
2489 result.etag = map
2490 .next_value::<std::option::Option<std::string::String>>()?
2491 .unwrap_or_default();
2492 }
2493 __FieldTag::__location => {
2494 if !fields.insert(__FieldTag::__location) {
2495 return std::result::Result::Err(A::Error::duplicate_field(
2496 "multiple values for location",
2497 ));
2498 }
2499 result.location = map
2500 .next_value::<std::option::Option<std::string::String>>()?
2501 .unwrap_or_default();
2502 }
2503 __FieldTag::Unknown(key) => {
2504 let value = map.next_value::<serde_json::Value>()?;
2505 result._unknown_fields.insert(key, value);
2506 }
2507 }
2508 }
2509 std::result::Result::Ok(result)
2510 }
2511 }
2512 deserializer.deserialize_any(Visitor)
2513 }
2514 }
2515
2516 #[doc(hidden)]
2517 impl serde::ser::Serialize for Resource {
2518 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2519 where
2520 S: serde::ser::Serializer,
2521 {
2522 use serde::ser::SerializeMap;
2523 #[allow(unused_imports)]
2524 use std::option::Option::Some;
2525 let mut state = serializer.serialize_map(std::option::Option::None)?;
2526 if !self.service.is_empty() {
2527 state.serialize_entry("service", &self.service)?;
2528 }
2529 if !self.name.is_empty() {
2530 state.serialize_entry("name", &self.name)?;
2531 }
2532 if !self.r#type.is_empty() {
2533 state.serialize_entry("type", &self.r#type)?;
2534 }
2535 if !self.labels.is_empty() {
2536 state.serialize_entry("labels", &self.labels)?;
2537 }
2538 if !self.uid.is_empty() {
2539 state.serialize_entry("uid", &self.uid)?;
2540 }
2541 if !self.annotations.is_empty() {
2542 state.serialize_entry("annotations", &self.annotations)?;
2543 }
2544 if !self.display_name.is_empty() {
2545 state.serialize_entry("displayName", &self.display_name)?;
2546 }
2547 if self.create_time.is_some() {
2548 state.serialize_entry("createTime", &self.create_time)?;
2549 }
2550 if self.update_time.is_some() {
2551 state.serialize_entry("updateTime", &self.update_time)?;
2552 }
2553 if self.delete_time.is_some() {
2554 state.serialize_entry("deleteTime", &self.delete_time)?;
2555 }
2556 if !self.etag.is_empty() {
2557 state.serialize_entry("etag", &self.etag)?;
2558 }
2559 if !self.location.is_empty() {
2560 state.serialize_entry("location", &self.location)?;
2561 }
2562 if !self._unknown_fields.is_empty() {
2563 for (key, value) in self._unknown_fields.iter() {
2564 state.serialize_entry(key, &value)?;
2565 }
2566 }
2567 state.end()
2568 }
2569 }
2570
2571 impl std::fmt::Debug for Resource {
2572 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2573 let mut debug_struct = f.debug_struct("Resource");
2574 debug_struct.field("service", &self.service);
2575 debug_struct.field("name", &self.name);
2576 debug_struct.field("r#type", &self.r#type);
2577 debug_struct.field("labels", &self.labels);
2578 debug_struct.field("uid", &self.uid);
2579 debug_struct.field("annotations", &self.annotations);
2580 debug_struct.field("display_name", &self.display_name);
2581 debug_struct.field("create_time", &self.create_time);
2582 debug_struct.field("update_time", &self.update_time);
2583 debug_struct.field("delete_time", &self.delete_time);
2584 debug_struct.field("etag", &self.etag);
2585 debug_struct.field("location", &self.location);
2586 if !self._unknown_fields.is_empty() {
2587 debug_struct.field("_unknown_fields", &self._unknown_fields);
2588 }
2589 debug_struct.finish()
2590 }
2591 }
2592}
2593
2594#[derive(Clone, Default, PartialEq)]
2596#[non_exhaustive]
2597pub struct AuditContext {
2598 pub audit_log: ::bytes::Bytes,
2600
2601 pub scrubbed_request: std::option::Option<wkt::Struct>,
2606
2607 pub scrubbed_response: std::option::Option<wkt::Struct>,
2612
2613 pub scrubbed_response_item_count: i32,
2615
2616 pub target_resource: std::string::String,
2618
2619 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2620}
2621
2622impl AuditContext {
2623 pub fn new() -> Self {
2624 std::default::Default::default()
2625 }
2626
2627 pub fn set_audit_log<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
2629 self.audit_log = v.into();
2630 self
2631 }
2632
2633 pub fn set_scrubbed_request<T>(mut self, v: T) -> Self
2635 where
2636 T: std::convert::Into<wkt::Struct>,
2637 {
2638 self.scrubbed_request = std::option::Option::Some(v.into());
2639 self
2640 }
2641
2642 pub fn set_or_clear_scrubbed_request<T>(mut self, v: std::option::Option<T>) -> Self
2644 where
2645 T: std::convert::Into<wkt::Struct>,
2646 {
2647 self.scrubbed_request = v.map(|x| x.into());
2648 self
2649 }
2650
2651 pub fn set_scrubbed_response<T>(mut self, v: T) -> Self
2653 where
2654 T: std::convert::Into<wkt::Struct>,
2655 {
2656 self.scrubbed_response = std::option::Option::Some(v.into());
2657 self
2658 }
2659
2660 pub fn set_or_clear_scrubbed_response<T>(mut self, v: std::option::Option<T>) -> Self
2662 where
2663 T: std::convert::Into<wkt::Struct>,
2664 {
2665 self.scrubbed_response = v.map(|x| x.into());
2666 self
2667 }
2668
2669 pub fn set_scrubbed_response_item_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2671 self.scrubbed_response_item_count = v.into();
2672 self
2673 }
2674
2675 pub fn set_target_resource<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2677 self.target_resource = v.into();
2678 self
2679 }
2680}
2681
2682impl wkt::message::Message for AuditContext {
2683 fn typename() -> &'static str {
2684 "type.googleapis.com/google.rpc.context.AuditContext"
2685 }
2686}
2687
2688#[doc(hidden)]
2689impl<'de> serde::de::Deserialize<'de> for AuditContext {
2690 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2691 where
2692 D: serde::Deserializer<'de>,
2693 {
2694 #[allow(non_camel_case_types)]
2695 #[doc(hidden)]
2696 #[derive(PartialEq, Eq, Hash)]
2697 enum __FieldTag {
2698 __audit_log,
2699 __scrubbed_request,
2700 __scrubbed_response,
2701 __scrubbed_response_item_count,
2702 __target_resource,
2703 Unknown(std::string::String),
2704 }
2705 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2706 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2707 where
2708 D: serde::Deserializer<'de>,
2709 {
2710 struct Visitor;
2711 impl<'de> serde::de::Visitor<'de> for Visitor {
2712 type Value = __FieldTag;
2713 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2714 formatter.write_str("a field name for AuditContext")
2715 }
2716 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2717 where
2718 E: serde::de::Error,
2719 {
2720 use std::result::Result::Ok;
2721 use std::string::ToString;
2722 match value {
2723 "auditLog" => Ok(__FieldTag::__audit_log),
2724 "audit_log" => Ok(__FieldTag::__audit_log),
2725 "scrubbedRequest" => Ok(__FieldTag::__scrubbed_request),
2726 "scrubbed_request" => Ok(__FieldTag::__scrubbed_request),
2727 "scrubbedResponse" => Ok(__FieldTag::__scrubbed_response),
2728 "scrubbed_response" => Ok(__FieldTag::__scrubbed_response),
2729 "scrubbedResponseItemCount" => {
2730 Ok(__FieldTag::__scrubbed_response_item_count)
2731 }
2732 "scrubbed_response_item_count" => {
2733 Ok(__FieldTag::__scrubbed_response_item_count)
2734 }
2735 "targetResource" => Ok(__FieldTag::__target_resource),
2736 "target_resource" => Ok(__FieldTag::__target_resource),
2737 _ => Ok(__FieldTag::Unknown(value.to_string())),
2738 }
2739 }
2740 }
2741 deserializer.deserialize_identifier(Visitor)
2742 }
2743 }
2744 struct Visitor;
2745 impl<'de> serde::de::Visitor<'de> for Visitor {
2746 type Value = AuditContext;
2747 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2748 formatter.write_str("struct AuditContext")
2749 }
2750 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2751 where
2752 A: serde::de::MapAccess<'de>,
2753 {
2754 #[allow(unused_imports)]
2755 use serde::de::Error;
2756 use std::option::Option::Some;
2757 let mut fields = std::collections::HashSet::new();
2758 let mut result = Self::Value::new();
2759 while let Some(tag) = map.next_key::<__FieldTag>()? {
2760 #[allow(clippy::match_single_binding)]
2761 match tag {
2762 __FieldTag::__audit_log => {
2763 if !fields.insert(__FieldTag::__audit_log) {
2764 return std::result::Result::Err(A::Error::duplicate_field(
2765 "multiple values for audit_log",
2766 ));
2767 }
2768 struct __With(std::option::Option<::bytes::Bytes>);
2769 impl<'de> serde::de::Deserialize<'de> for __With {
2770 fn deserialize<D>(
2771 deserializer: D,
2772 ) -> std::result::Result<Self, D::Error>
2773 where
2774 D: serde::de::Deserializer<'de>,
2775 {
2776 serde_with::As::< std::option::Option<serde_with::base64::Base64> >::deserialize(deserializer).map(__With)
2777 }
2778 }
2779 result.audit_log = map.next_value::<__With>()?.0.unwrap_or_default();
2780 }
2781 __FieldTag::__scrubbed_request => {
2782 if !fields.insert(__FieldTag::__scrubbed_request) {
2783 return std::result::Result::Err(A::Error::duplicate_field(
2784 "multiple values for scrubbed_request",
2785 ));
2786 }
2787 result.scrubbed_request =
2788 map.next_value::<std::option::Option<wkt::Struct>>()?;
2789 }
2790 __FieldTag::__scrubbed_response => {
2791 if !fields.insert(__FieldTag::__scrubbed_response) {
2792 return std::result::Result::Err(A::Error::duplicate_field(
2793 "multiple values for scrubbed_response",
2794 ));
2795 }
2796 result.scrubbed_response =
2797 map.next_value::<std::option::Option<wkt::Struct>>()?;
2798 }
2799 __FieldTag::__scrubbed_response_item_count => {
2800 if !fields.insert(__FieldTag::__scrubbed_response_item_count) {
2801 return std::result::Result::Err(A::Error::duplicate_field(
2802 "multiple values for scrubbed_response_item_count",
2803 ));
2804 }
2805 struct __With(std::option::Option<i32>);
2806 impl<'de> serde::de::Deserialize<'de> for __With {
2807 fn deserialize<D>(
2808 deserializer: D,
2809 ) -> std::result::Result<Self, D::Error>
2810 where
2811 D: serde::de::Deserializer<'de>,
2812 {
2813 serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
2814 }
2815 }
2816 result.scrubbed_response_item_count =
2817 map.next_value::<__With>()?.0.unwrap_or_default();
2818 }
2819 __FieldTag::__target_resource => {
2820 if !fields.insert(__FieldTag::__target_resource) {
2821 return std::result::Result::Err(A::Error::duplicate_field(
2822 "multiple values for target_resource",
2823 ));
2824 }
2825 result.target_resource = map
2826 .next_value::<std::option::Option<std::string::String>>()?
2827 .unwrap_or_default();
2828 }
2829 __FieldTag::Unknown(key) => {
2830 let value = map.next_value::<serde_json::Value>()?;
2831 result._unknown_fields.insert(key, value);
2832 }
2833 }
2834 }
2835 std::result::Result::Ok(result)
2836 }
2837 }
2838 deserializer.deserialize_any(Visitor)
2839 }
2840}
2841
2842#[doc(hidden)]
2843impl serde::ser::Serialize for AuditContext {
2844 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2845 where
2846 S: serde::ser::Serializer,
2847 {
2848 use serde::ser::SerializeMap;
2849 #[allow(unused_imports)]
2850 use std::option::Option::Some;
2851 let mut state = serializer.serialize_map(std::option::Option::None)?;
2852 if !self.audit_log.is_empty() {
2853 struct __With<'a>(&'a ::bytes::Bytes);
2854 impl<'a> serde::ser::Serialize for __With<'a> {
2855 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2856 where
2857 S: serde::ser::Serializer,
2858 {
2859 serde_with::As::<serde_with::base64::Base64>::serialize(self.0, serializer)
2860 }
2861 }
2862 state.serialize_entry("auditLog", &__With(&self.audit_log))?;
2863 }
2864 if self.scrubbed_request.is_some() {
2865 state.serialize_entry("scrubbedRequest", &self.scrubbed_request)?;
2866 }
2867 if self.scrubbed_response.is_some() {
2868 state.serialize_entry("scrubbedResponse", &self.scrubbed_response)?;
2869 }
2870 if !wkt::internal::is_default(&self.scrubbed_response_item_count) {
2871 struct __With<'a>(&'a i32);
2872 impl<'a> serde::ser::Serialize for __With<'a> {
2873 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2874 where
2875 S: serde::ser::Serializer,
2876 {
2877 serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
2878 }
2879 }
2880 state.serialize_entry(
2881 "scrubbedResponseItemCount",
2882 &__With(&self.scrubbed_response_item_count),
2883 )?;
2884 }
2885 if !self.target_resource.is_empty() {
2886 state.serialize_entry("targetResource", &self.target_resource)?;
2887 }
2888 if !self._unknown_fields.is_empty() {
2889 for (key, value) in self._unknown_fields.iter() {
2890 state.serialize_entry(key, &value)?;
2891 }
2892 }
2893 state.end()
2894 }
2895}
2896
2897impl std::fmt::Debug for AuditContext {
2898 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2899 let mut debug_struct = f.debug_struct("AuditContext");
2900 debug_struct.field("audit_log", &self.audit_log);
2901 debug_struct.field("scrubbed_request", &self.scrubbed_request);
2902 debug_struct.field("scrubbed_response", &self.scrubbed_response);
2903 debug_struct.field(
2904 "scrubbed_response_item_count",
2905 &self.scrubbed_response_item_count,
2906 );
2907 debug_struct.field("target_resource", &self.target_resource);
2908 if !self._unknown_fields.is_empty() {
2909 debug_struct.field("_unknown_fields", &self._unknown_fields);
2910 }
2911 debug_struct.finish()
2912 }
2913}