1#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate api;
21extern crate async_trait;
22extern crate bytes;
23extern crate gax;
24extern crate gaxi;
25extern crate lazy_static;
26extern crate logging_type;
27extern crate reqwest;
28extern crate rpc;
29extern crate serde;
30extern crate serde_json;
31extern crate serde_with;
32extern crate std;
33extern crate tracing;
34extern crate wkt;
35
36#[serde_with::serde_as]
41#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
42#[serde(default, rename_all = "camelCase")]
43#[non_exhaustive]
44pub struct CheckError {
45 pub code: crate::model::check_error::Code,
47
48 #[serde(skip_serializing_if = "std::string::String::is_empty")]
55 pub subject: std::string::String,
56
57 #[serde(skip_serializing_if = "std::string::String::is_empty")]
59 pub detail: std::string::String,
60
61 #[serde(skip_serializing_if = "std::option::Option::is_none")]
65 pub status: std::option::Option<rpc::model::Status>,
66
67 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
68 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
69}
70
71impl CheckError {
72 pub fn new() -> Self {
73 std::default::Default::default()
74 }
75
76 pub fn set_code<T: std::convert::Into<crate::model::check_error::Code>>(
78 mut self,
79 v: T,
80 ) -> Self {
81 self.code = v.into();
82 self
83 }
84
85 pub fn set_subject<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
87 self.subject = v.into();
88 self
89 }
90
91 pub fn set_detail<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
93 self.detail = v.into();
94 self
95 }
96
97 pub fn set_status<T: std::convert::Into<std::option::Option<rpc::model::Status>>>(
99 mut self,
100 v: T,
101 ) -> Self {
102 self.status = v.into();
103 self
104 }
105}
106
107impl wkt::message::Message for CheckError {
108 fn typename() -> &'static str {
109 "type.googleapis.com/google.api.servicecontrol.v1.CheckError"
110 }
111}
112
113pub mod check_error {
115 #[allow(unused_imports)]
116 use super::*;
117
118 #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
120 pub struct Code(i32);
121
122 impl Code {
123 pub const ERROR_CODE_UNSPECIFIED: Code = Code::new(0);
125
126 pub const NOT_FOUND: Code = Code::new(5);
129
130 pub const PERMISSION_DENIED: Code = Code::new(7);
133
134 pub const RESOURCE_EXHAUSTED: Code = Code::new(8);
136
137 pub const SERVICE_NOT_ACTIVATED: Code = Code::new(104);
139
140 pub const BILLING_DISABLED: Code = Code::new(107);
142
143 pub const PROJECT_DELETED: Code = Code::new(108);
145
146 pub const PROJECT_INVALID: Code = Code::new(114);
148
149 pub const CONSUMER_INVALID: Code = Code::new(125);
152
153 pub const IP_ADDRESS_BLOCKED: Code = Code::new(109);
156
157 pub const REFERER_BLOCKED: Code = Code::new(110);
160
161 pub const CLIENT_APP_BLOCKED: Code = Code::new(111);
164
165 pub const API_TARGET_BLOCKED: Code = Code::new(122);
168
169 pub const API_KEY_INVALID: Code = Code::new(105);
171
172 pub const API_KEY_EXPIRED: Code = Code::new(112);
174
175 pub const API_KEY_NOT_FOUND: Code = Code::new(113);
177
178 pub const INVALID_CREDENTIAL: Code = Code::new(123);
180
181 pub const NAMESPACE_LOOKUP_UNAVAILABLE: Code = Code::new(300);
183
184 pub const SERVICE_STATUS_UNAVAILABLE: Code = Code::new(301);
186
187 pub const BILLING_STATUS_UNAVAILABLE: Code = Code::new(302);
189
190 pub const CLOUD_RESOURCE_MANAGER_BACKEND_UNAVAILABLE: Code = Code::new(305);
192
193 pub(crate) const fn new(value: i32) -> Self {
195 Self(value)
196 }
197
198 pub fn value(&self) -> i32 {
200 self.0
201 }
202
203 pub fn as_str_name(&self) -> std::borrow::Cow<'static, str> {
205 match self.0 {
206 0 => std::borrow::Cow::Borrowed("ERROR_CODE_UNSPECIFIED"),
207 5 => std::borrow::Cow::Borrowed("NOT_FOUND"),
208 7 => std::borrow::Cow::Borrowed("PERMISSION_DENIED"),
209 8 => std::borrow::Cow::Borrowed("RESOURCE_EXHAUSTED"),
210 104 => std::borrow::Cow::Borrowed("SERVICE_NOT_ACTIVATED"),
211 105 => std::borrow::Cow::Borrowed("API_KEY_INVALID"),
212 107 => std::borrow::Cow::Borrowed("BILLING_DISABLED"),
213 108 => std::borrow::Cow::Borrowed("PROJECT_DELETED"),
214 109 => std::borrow::Cow::Borrowed("IP_ADDRESS_BLOCKED"),
215 110 => std::borrow::Cow::Borrowed("REFERER_BLOCKED"),
216 111 => std::borrow::Cow::Borrowed("CLIENT_APP_BLOCKED"),
217 112 => std::borrow::Cow::Borrowed("API_KEY_EXPIRED"),
218 113 => std::borrow::Cow::Borrowed("API_KEY_NOT_FOUND"),
219 114 => std::borrow::Cow::Borrowed("PROJECT_INVALID"),
220 122 => std::borrow::Cow::Borrowed("API_TARGET_BLOCKED"),
221 123 => std::borrow::Cow::Borrowed("INVALID_CREDENTIAL"),
222 125 => std::borrow::Cow::Borrowed("CONSUMER_INVALID"),
223 300 => std::borrow::Cow::Borrowed("NAMESPACE_LOOKUP_UNAVAILABLE"),
224 301 => std::borrow::Cow::Borrowed("SERVICE_STATUS_UNAVAILABLE"),
225 302 => std::borrow::Cow::Borrowed("BILLING_STATUS_UNAVAILABLE"),
226 305 => std::borrow::Cow::Borrowed("CLOUD_RESOURCE_MANAGER_BACKEND_UNAVAILABLE"),
227 _ => std::borrow::Cow::Owned(std::format!("UNKNOWN-VALUE:{}", self.0)),
228 }
229 }
230
231 pub fn from_str_name(name: &str) -> std::option::Option<Self> {
233 match name {
234 "ERROR_CODE_UNSPECIFIED" => std::option::Option::Some(Self::ERROR_CODE_UNSPECIFIED),
235 "NOT_FOUND" => std::option::Option::Some(Self::NOT_FOUND),
236 "PERMISSION_DENIED" => std::option::Option::Some(Self::PERMISSION_DENIED),
237 "RESOURCE_EXHAUSTED" => std::option::Option::Some(Self::RESOURCE_EXHAUSTED),
238 "SERVICE_NOT_ACTIVATED" => std::option::Option::Some(Self::SERVICE_NOT_ACTIVATED),
239 "BILLING_DISABLED" => std::option::Option::Some(Self::BILLING_DISABLED),
240 "PROJECT_DELETED" => std::option::Option::Some(Self::PROJECT_DELETED),
241 "PROJECT_INVALID" => std::option::Option::Some(Self::PROJECT_INVALID),
242 "CONSUMER_INVALID" => std::option::Option::Some(Self::CONSUMER_INVALID),
243 "IP_ADDRESS_BLOCKED" => std::option::Option::Some(Self::IP_ADDRESS_BLOCKED),
244 "REFERER_BLOCKED" => std::option::Option::Some(Self::REFERER_BLOCKED),
245 "CLIENT_APP_BLOCKED" => std::option::Option::Some(Self::CLIENT_APP_BLOCKED),
246 "API_TARGET_BLOCKED" => std::option::Option::Some(Self::API_TARGET_BLOCKED),
247 "API_KEY_INVALID" => std::option::Option::Some(Self::API_KEY_INVALID),
248 "API_KEY_EXPIRED" => std::option::Option::Some(Self::API_KEY_EXPIRED),
249 "API_KEY_NOT_FOUND" => std::option::Option::Some(Self::API_KEY_NOT_FOUND),
250 "INVALID_CREDENTIAL" => std::option::Option::Some(Self::INVALID_CREDENTIAL),
251 "NAMESPACE_LOOKUP_UNAVAILABLE" => {
252 std::option::Option::Some(Self::NAMESPACE_LOOKUP_UNAVAILABLE)
253 }
254 "SERVICE_STATUS_UNAVAILABLE" => {
255 std::option::Option::Some(Self::SERVICE_STATUS_UNAVAILABLE)
256 }
257 "BILLING_STATUS_UNAVAILABLE" => {
258 std::option::Option::Some(Self::BILLING_STATUS_UNAVAILABLE)
259 }
260 "CLOUD_RESOURCE_MANAGER_BACKEND_UNAVAILABLE" => {
261 std::option::Option::Some(Self::CLOUD_RESOURCE_MANAGER_BACKEND_UNAVAILABLE)
262 }
263 _ => std::option::Option::None,
264 }
265 }
266 }
267
268 impl std::convert::From<i32> for Code {
269 fn from(value: i32) -> Self {
270 Self::new(value)
271 }
272 }
273
274 impl std::default::Default for Code {
275 fn default() -> Self {
276 Self::new(0)
277 }
278 }
279}
280
281#[serde_with::serde_as]
290#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
291#[serde(default, rename_all = "camelCase")]
292#[non_exhaustive]
293pub struct Distribution {
294 #[serde_as(as = "serde_with::DisplayFromStr")]
296 pub count: i64,
297
298 pub mean: f64,
301
302 pub minimum: f64,
304
305 pub maximum: f64,
307
308 pub sum_of_squared_deviation: f64,
313
314 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
326 #[serde_as(as = "std::vec::Vec<serde_with::DisplayFromStr>")]
327 pub bucket_counts: std::vec::Vec<i64>,
328
329 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
331 pub exemplars: std::vec::Vec<api::model::distribution::Exemplar>,
332
333 #[serde(flatten, skip_serializing_if = "std::option::Option::is_none")]
357 pub bucket_option: std::option::Option<crate::model::distribution::BucketOption>,
358
359 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
360 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
361}
362
363impl Distribution {
364 pub fn new() -> Self {
365 std::default::Default::default()
366 }
367
368 pub fn set_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
370 self.count = v.into();
371 self
372 }
373
374 pub fn set_mean<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
376 self.mean = v.into();
377 self
378 }
379
380 pub fn set_minimum<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
382 self.minimum = v.into();
383 self
384 }
385
386 pub fn set_maximum<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
388 self.maximum = v.into();
389 self
390 }
391
392 pub fn set_sum_of_squared_deviation<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
394 self.sum_of_squared_deviation = v.into();
395 self
396 }
397
398 pub fn set_bucket_counts<T, V>(mut self, v: T) -> Self
400 where
401 T: std::iter::IntoIterator<Item = V>,
402 V: std::convert::Into<i64>,
403 {
404 use std::iter::Iterator;
405 self.bucket_counts = v.into_iter().map(|i| i.into()).collect();
406 self
407 }
408
409 pub fn set_exemplars<T, V>(mut self, v: T) -> Self
411 where
412 T: std::iter::IntoIterator<Item = V>,
413 V: std::convert::Into<api::model::distribution::Exemplar>,
414 {
415 use std::iter::Iterator;
416 self.exemplars = v.into_iter().map(|i| i.into()).collect();
417 self
418 }
419
420 pub fn set_bucket_option<
425 T: std::convert::Into<std::option::Option<crate::model::distribution::BucketOption>>,
426 >(
427 mut self,
428 v: T,
429 ) -> Self {
430 self.bucket_option = v.into();
431 self
432 }
433
434 pub fn linear_buckets(
438 &self,
439 ) -> std::option::Option<&std::boxed::Box<crate::model::distribution::LinearBuckets>> {
440 #[allow(unreachable_patterns)]
441 self.bucket_option.as_ref().and_then(|v| match v {
442 crate::model::distribution::BucketOption::LinearBuckets(v) => {
443 std::option::Option::Some(v)
444 }
445 _ => std::option::Option::None,
446 })
447 }
448
449 pub fn exponential_buckets(
453 &self,
454 ) -> std::option::Option<&std::boxed::Box<crate::model::distribution::ExponentialBuckets>> {
455 #[allow(unreachable_patterns)]
456 self.bucket_option.as_ref().and_then(|v| match v {
457 crate::model::distribution::BucketOption::ExponentialBuckets(v) => {
458 std::option::Option::Some(v)
459 }
460 _ => std::option::Option::None,
461 })
462 }
463
464 pub fn explicit_buckets(
468 &self,
469 ) -> std::option::Option<&std::boxed::Box<crate::model::distribution::ExplicitBuckets>> {
470 #[allow(unreachable_patterns)]
471 self.bucket_option.as_ref().and_then(|v| match v {
472 crate::model::distribution::BucketOption::ExplicitBuckets(v) => {
473 std::option::Option::Some(v)
474 }
475 _ => std::option::Option::None,
476 })
477 }
478
479 pub fn set_linear_buckets<
485 T: std::convert::Into<std::boxed::Box<crate::model::distribution::LinearBuckets>>,
486 >(
487 mut self,
488 v: T,
489 ) -> Self {
490 self.bucket_option = std::option::Option::Some(
491 crate::model::distribution::BucketOption::LinearBuckets(v.into()),
492 );
493 self
494 }
495
496 pub fn set_exponential_buckets<
502 T: std::convert::Into<std::boxed::Box<crate::model::distribution::ExponentialBuckets>>,
503 >(
504 mut self,
505 v: T,
506 ) -> Self {
507 self.bucket_option = std::option::Option::Some(
508 crate::model::distribution::BucketOption::ExponentialBuckets(v.into()),
509 );
510 self
511 }
512
513 pub fn set_explicit_buckets<
519 T: std::convert::Into<std::boxed::Box<crate::model::distribution::ExplicitBuckets>>,
520 >(
521 mut self,
522 v: T,
523 ) -> Self {
524 self.bucket_option = std::option::Option::Some(
525 crate::model::distribution::BucketOption::ExplicitBuckets(v.into()),
526 );
527 self
528 }
529}
530
531impl wkt::message::Message for Distribution {
532 fn typename() -> &'static str {
533 "type.googleapis.com/google.api.servicecontrol.v1.Distribution"
534 }
535}
536
537pub mod distribution {
539 #[allow(unused_imports)]
540 use super::*;
541
542 #[serde_with::serde_as]
544 #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
545 #[serde(default, rename_all = "camelCase")]
546 #[non_exhaustive]
547 pub struct LinearBuckets {
548 pub num_finite_buckets: i32,
552
553 pub width: f64,
558
559 pub offset: f64,
563
564 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
565 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
566 }
567
568 impl LinearBuckets {
569 pub fn new() -> Self {
570 std::default::Default::default()
571 }
572
573 pub fn set_num_finite_buckets<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
575 self.num_finite_buckets = v.into();
576 self
577 }
578
579 pub fn set_width<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
581 self.width = v.into();
582 self
583 }
584
585 pub fn set_offset<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
587 self.offset = v.into();
588 self
589 }
590 }
591
592 impl wkt::message::Message for LinearBuckets {
593 fn typename() -> &'static str {
594 "type.googleapis.com/google.api.servicecontrol.v1.Distribution.LinearBuckets"
595 }
596 }
597
598 #[serde_with::serde_as]
600 #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
601 #[serde(default, rename_all = "camelCase")]
602 #[non_exhaustive]
603 pub struct ExponentialBuckets {
604 pub num_finite_buckets: i32,
608
609 pub growth_factor: f64,
614
615 pub scale: f64,
620
621 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
622 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
623 }
624
625 impl ExponentialBuckets {
626 pub fn new() -> Self {
627 std::default::Default::default()
628 }
629
630 pub fn set_num_finite_buckets<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
632 self.num_finite_buckets = v.into();
633 self
634 }
635
636 pub fn set_growth_factor<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
638 self.growth_factor = v.into();
639 self
640 }
641
642 pub fn set_scale<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
644 self.scale = v.into();
645 self
646 }
647 }
648
649 impl wkt::message::Message for ExponentialBuckets {
650 fn typename() -> &'static str {
651 "type.googleapis.com/google.api.servicecontrol.v1.Distribution.ExponentialBuckets"
652 }
653 }
654
655 #[serde_with::serde_as]
657 #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
658 #[serde(default, rename_all = "camelCase")]
659 #[non_exhaustive]
660 pub struct ExplicitBuckets {
661 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
677 pub bounds: std::vec::Vec<f64>,
678
679 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
680 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
681 }
682
683 impl ExplicitBuckets {
684 pub fn new() -> Self {
685 std::default::Default::default()
686 }
687
688 pub fn set_bounds<T, V>(mut self, v: T) -> Self
690 where
691 T: std::iter::IntoIterator<Item = V>,
692 V: std::convert::Into<f64>,
693 {
694 use std::iter::Iterator;
695 self.bounds = v.into_iter().map(|i| i.into()).collect();
696 self
697 }
698 }
699
700 impl wkt::message::Message for ExplicitBuckets {
701 fn typename() -> &'static str {
702 "type.googleapis.com/google.api.servicecontrol.v1.Distribution.ExplicitBuckets"
703 }
704 }
705
706 #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
730 #[serde(rename_all = "camelCase")]
731 #[non_exhaustive]
732 pub enum BucketOption {
733 LinearBuckets(std::boxed::Box<crate::model::distribution::LinearBuckets>),
735 ExponentialBuckets(std::boxed::Box<crate::model::distribution::ExponentialBuckets>),
737 ExplicitBuckets(std::boxed::Box<crate::model::distribution::ExplicitBuckets>),
739 }
740}
741
742#[serde_with::serde_as]
746#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
747#[serde(default, rename_all = "camelCase")]
748#[non_exhaustive]
749pub struct HttpRequest {
750 #[serde(skip_serializing_if = "std::string::String::is_empty")]
752 pub request_method: std::string::String,
753
754 #[serde(skip_serializing_if = "std::string::String::is_empty")]
758 pub request_url: std::string::String,
759
760 #[serde_as(as = "serde_with::DisplayFromStr")]
763 pub request_size: i64,
764
765 pub status: i32,
768
769 #[serde_as(as = "serde_with::DisplayFromStr")]
772 pub response_size: i64,
773
774 #[serde(skip_serializing_if = "std::string::String::is_empty")]
778 pub user_agent: std::string::String,
779
780 #[serde(skip_serializing_if = "std::string::String::is_empty")]
783 pub remote_ip: std::string::String,
784
785 #[serde(skip_serializing_if = "std::string::String::is_empty")]
788 pub server_ip: std::string::String,
789
790 #[serde(skip_serializing_if = "std::string::String::is_empty")]
794 pub referer: std::string::String,
795
796 #[serde(skip_serializing_if = "std::option::Option::is_none")]
799 pub latency: std::option::Option<wkt::Duration>,
800
801 pub cache_lookup: bool,
803
804 pub cache_hit: bool,
807
808 pub cache_validated_with_origin_server: bool,
812
813 #[serde_as(as = "serde_with::DisplayFromStr")]
816 pub cache_fill_bytes: i64,
817
818 #[serde(skip_serializing_if = "std::string::String::is_empty")]
820 pub protocol: std::string::String,
821
822 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
823 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
824}
825
826impl HttpRequest {
827 pub fn new() -> Self {
828 std::default::Default::default()
829 }
830
831 pub fn set_request_method<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
833 self.request_method = v.into();
834 self
835 }
836
837 pub fn set_request_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
839 self.request_url = v.into();
840 self
841 }
842
843 pub fn set_request_size<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
845 self.request_size = v.into();
846 self
847 }
848
849 pub fn set_status<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
851 self.status = v.into();
852 self
853 }
854
855 pub fn set_response_size<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
857 self.response_size = v.into();
858 self
859 }
860
861 pub fn set_user_agent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
863 self.user_agent = v.into();
864 self
865 }
866
867 pub fn set_remote_ip<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
869 self.remote_ip = v.into();
870 self
871 }
872
873 pub fn set_server_ip<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
875 self.server_ip = v.into();
876 self
877 }
878
879 pub fn set_referer<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
881 self.referer = v.into();
882 self
883 }
884
885 pub fn set_latency<T: std::convert::Into<std::option::Option<wkt::Duration>>>(
887 mut self,
888 v: T,
889 ) -> Self {
890 self.latency = v.into();
891 self
892 }
893
894 pub fn set_cache_lookup<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
896 self.cache_lookup = v.into();
897 self
898 }
899
900 pub fn set_cache_hit<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
902 self.cache_hit = v.into();
903 self
904 }
905
906 pub fn set_cache_validated_with_origin_server<T: std::convert::Into<bool>>(
908 mut self,
909 v: T,
910 ) -> Self {
911 self.cache_validated_with_origin_server = v.into();
912 self
913 }
914
915 pub fn set_cache_fill_bytes<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
917 self.cache_fill_bytes = v.into();
918 self
919 }
920
921 pub fn set_protocol<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
923 self.protocol = v.into();
924 self
925 }
926}
927
928impl wkt::message::Message for HttpRequest {
929 fn typename() -> &'static str {
930 "type.googleapis.com/google.api.servicecontrol.v1.HttpRequest"
931 }
932}
933
934#[serde_with::serde_as]
936#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
937#[serde(default, rename_all = "camelCase")]
938#[non_exhaustive]
939pub struct LogEntry {
940 #[serde(skip_serializing_if = "std::string::String::is_empty")]
943 pub name: std::string::String,
944
945 #[serde(skip_serializing_if = "std::option::Option::is_none")]
948 pub timestamp: std::option::Option<wkt::Timestamp>,
949
950 pub severity: logging_type::model::LogSeverity,
953
954 #[serde(skip_serializing_if = "std::option::Option::is_none")]
957 pub http_request: std::option::Option<crate::model::HttpRequest>,
958
959 #[serde(skip_serializing_if = "std::string::String::is_empty")]
964 pub trace: std::string::String,
965
966 #[serde(skip_serializing_if = "std::string::String::is_empty")]
969 pub insert_id: std::string::String,
970
971 #[serde(skip_serializing_if = "std::collections::HashMap::is_empty")]
974 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
975
976 #[serde(skip_serializing_if = "std::option::Option::is_none")]
979 pub operation: std::option::Option<crate::model::LogEntryOperation>,
980
981 #[serde(skip_serializing_if = "std::option::Option::is_none")]
984 pub source_location: std::option::Option<crate::model::LogEntrySourceLocation>,
985
986 #[serde(flatten, skip_serializing_if = "std::option::Option::is_none")]
988 pub payload: std::option::Option<crate::model::log_entry::Payload>,
989
990 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
991 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
992}
993
994impl LogEntry {
995 pub fn new() -> Self {
996 std::default::Default::default()
997 }
998
999 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1001 self.name = v.into();
1002 self
1003 }
1004
1005 pub fn set_timestamp<T: std::convert::Into<std::option::Option<wkt::Timestamp>>>(
1007 mut self,
1008 v: T,
1009 ) -> Self {
1010 self.timestamp = v.into();
1011 self
1012 }
1013
1014 pub fn set_severity<T: std::convert::Into<logging_type::model::LogSeverity>>(
1016 mut self,
1017 v: T,
1018 ) -> Self {
1019 self.severity = v.into();
1020 self
1021 }
1022
1023 pub fn set_http_request<
1025 T: std::convert::Into<std::option::Option<crate::model::HttpRequest>>,
1026 >(
1027 mut self,
1028 v: T,
1029 ) -> Self {
1030 self.http_request = v.into();
1031 self
1032 }
1033
1034 pub fn set_trace<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1036 self.trace = v.into();
1037 self
1038 }
1039
1040 pub fn set_insert_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1042 self.insert_id = v.into();
1043 self
1044 }
1045
1046 pub fn set_operation<
1048 T: std::convert::Into<std::option::Option<crate::model::LogEntryOperation>>,
1049 >(
1050 mut self,
1051 v: T,
1052 ) -> Self {
1053 self.operation = v.into();
1054 self
1055 }
1056
1057 pub fn set_source_location<
1059 T: std::convert::Into<std::option::Option<crate::model::LogEntrySourceLocation>>,
1060 >(
1061 mut self,
1062 v: T,
1063 ) -> Self {
1064 self.source_location = v.into();
1065 self
1066 }
1067
1068 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
1070 where
1071 T: std::iter::IntoIterator<Item = (K, V)>,
1072 K: std::convert::Into<std::string::String>,
1073 V: std::convert::Into<std::string::String>,
1074 {
1075 use std::iter::Iterator;
1076 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1077 self
1078 }
1079
1080 pub fn set_payload<
1085 T: std::convert::Into<std::option::Option<crate::model::log_entry::Payload>>,
1086 >(
1087 mut self,
1088 v: T,
1089 ) -> Self {
1090 self.payload = v.into();
1091 self
1092 }
1093
1094 pub fn proto_payload(&self) -> std::option::Option<&std::boxed::Box<wkt::Any>> {
1098 #[allow(unreachable_patterns)]
1099 self.payload.as_ref().and_then(|v| match v {
1100 crate::model::log_entry::Payload::ProtoPayload(v) => std::option::Option::Some(v),
1101 _ => std::option::Option::None,
1102 })
1103 }
1104
1105 pub fn text_payload(&self) -> std::option::Option<&std::string::String> {
1109 #[allow(unreachable_patterns)]
1110 self.payload.as_ref().and_then(|v| match v {
1111 crate::model::log_entry::Payload::TextPayload(v) => std::option::Option::Some(v),
1112 _ => std::option::Option::None,
1113 })
1114 }
1115
1116 pub fn struct_payload(&self) -> std::option::Option<&std::boxed::Box<wkt::Struct>> {
1120 #[allow(unreachable_patterns)]
1121 self.payload.as_ref().and_then(|v| match v {
1122 crate::model::log_entry::Payload::StructPayload(v) => std::option::Option::Some(v),
1123 _ => std::option::Option::None,
1124 })
1125 }
1126
1127 pub fn set_proto_payload<T: std::convert::Into<std::boxed::Box<wkt::Any>>>(
1133 mut self,
1134 v: T,
1135 ) -> Self {
1136 self.payload =
1137 std::option::Option::Some(crate::model::log_entry::Payload::ProtoPayload(v.into()));
1138 self
1139 }
1140
1141 pub fn set_text_payload<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1147 self.payload =
1148 std::option::Option::Some(crate::model::log_entry::Payload::TextPayload(v.into()));
1149 self
1150 }
1151
1152 pub fn set_struct_payload<T: std::convert::Into<std::boxed::Box<wkt::Struct>>>(
1158 mut self,
1159 v: T,
1160 ) -> Self {
1161 self.payload =
1162 std::option::Option::Some(crate::model::log_entry::Payload::StructPayload(v.into()));
1163 self
1164 }
1165}
1166
1167impl wkt::message::Message for LogEntry {
1168 fn typename() -> &'static str {
1169 "type.googleapis.com/google.api.servicecontrol.v1.LogEntry"
1170 }
1171}
1172
1173pub mod log_entry {
1175 #[allow(unused_imports)]
1176 use super::*;
1177
1178 #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
1180 #[serde(rename_all = "camelCase")]
1181 #[non_exhaustive]
1182 pub enum Payload {
1183 ProtoPayload(std::boxed::Box<wkt::Any>),
1187 TextPayload(std::string::String),
1189 StructPayload(std::boxed::Box<wkt::Struct>),
1192 }
1193}
1194
1195#[serde_with::serde_as]
1198#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
1199#[serde(default, rename_all = "camelCase")]
1200#[non_exhaustive]
1201pub struct LogEntryOperation {
1202 #[serde(skip_serializing_if = "std::string::String::is_empty")]
1205 pub id: std::string::String,
1206
1207 #[serde(skip_serializing_if = "std::string::String::is_empty")]
1211 pub producer: std::string::String,
1212
1213 pub first: bool,
1215
1216 pub last: bool,
1218
1219 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1220 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1221}
1222
1223impl LogEntryOperation {
1224 pub fn new() -> Self {
1225 std::default::Default::default()
1226 }
1227
1228 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1230 self.id = v.into();
1231 self
1232 }
1233
1234 pub fn set_producer<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1236 self.producer = v.into();
1237 self
1238 }
1239
1240 pub fn set_first<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1242 self.first = v.into();
1243 self
1244 }
1245
1246 pub fn set_last<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1248 self.last = v.into();
1249 self
1250 }
1251}
1252
1253impl wkt::message::Message for LogEntryOperation {
1254 fn typename() -> &'static str {
1255 "type.googleapis.com/google.api.servicecontrol.v1.LogEntryOperation"
1256 }
1257}
1258
1259#[serde_with::serde_as]
1262#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
1263#[serde(default, rename_all = "camelCase")]
1264#[non_exhaustive]
1265pub struct LogEntrySourceLocation {
1266 #[serde(skip_serializing_if = "std::string::String::is_empty")]
1269 pub file: std::string::String,
1270
1271 #[serde_as(as = "serde_with::DisplayFromStr")]
1274 pub line: i64,
1275
1276 #[serde(skip_serializing_if = "std::string::String::is_empty")]
1283 pub function: std::string::String,
1284
1285 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1286 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1287}
1288
1289impl LogEntrySourceLocation {
1290 pub fn new() -> Self {
1291 std::default::Default::default()
1292 }
1293
1294 pub fn set_file<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1296 self.file = v.into();
1297 self
1298 }
1299
1300 pub fn set_line<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
1302 self.line = v.into();
1303 self
1304 }
1305
1306 pub fn set_function<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1308 self.function = v.into();
1309 self
1310 }
1311}
1312
1313impl wkt::message::Message for LogEntrySourceLocation {
1314 fn typename() -> &'static str {
1315 "type.googleapis.com/google.api.servicecontrol.v1.LogEntrySourceLocation"
1316 }
1317}
1318
1319#[serde_with::serde_as]
1321#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
1322#[serde(default, rename_all = "camelCase")]
1323#[non_exhaustive]
1324pub struct MetricValue {
1325 #[serde(skip_serializing_if = "std::collections::HashMap::is_empty")]
1332 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
1333
1334 #[serde(skip_serializing_if = "std::option::Option::is_none")]
1342 pub start_time: std::option::Option<wkt::Timestamp>,
1343
1344 #[serde(skip_serializing_if = "std::option::Option::is_none")]
1350 pub end_time: std::option::Option<wkt::Timestamp>,
1351
1352 #[serde(flatten, skip_serializing_if = "std::option::Option::is_none")]
1356 pub value: std::option::Option<crate::model::metric_value::Value>,
1357
1358 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1359 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1360}
1361
1362impl MetricValue {
1363 pub fn new() -> Self {
1364 std::default::Default::default()
1365 }
1366
1367 pub fn set_start_time<T: std::convert::Into<std::option::Option<wkt::Timestamp>>>(
1369 mut self,
1370 v: T,
1371 ) -> Self {
1372 self.start_time = v.into();
1373 self
1374 }
1375
1376 pub fn set_end_time<T: std::convert::Into<std::option::Option<wkt::Timestamp>>>(
1378 mut self,
1379 v: T,
1380 ) -> Self {
1381 self.end_time = v.into();
1382 self
1383 }
1384
1385 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
1387 where
1388 T: std::iter::IntoIterator<Item = (K, V)>,
1389 K: std::convert::Into<std::string::String>,
1390 V: std::convert::Into<std::string::String>,
1391 {
1392 use std::iter::Iterator;
1393 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1394 self
1395 }
1396
1397 pub fn set_value<
1402 T: std::convert::Into<std::option::Option<crate::model::metric_value::Value>>,
1403 >(
1404 mut self,
1405 v: T,
1406 ) -> Self {
1407 self.value = v.into();
1408 self
1409 }
1410
1411 pub fn bool_value(&self) -> std::option::Option<&bool> {
1415 #[allow(unreachable_patterns)]
1416 self.value.as_ref().and_then(|v| match v {
1417 crate::model::metric_value::Value::BoolValue(v) => std::option::Option::Some(v),
1418 _ => std::option::Option::None,
1419 })
1420 }
1421
1422 pub fn int64_value(&self) -> std::option::Option<&i64> {
1426 #[allow(unreachable_patterns)]
1427 self.value.as_ref().and_then(|v| match v {
1428 crate::model::metric_value::Value::Int64Value(v) => std::option::Option::Some(v),
1429 _ => std::option::Option::None,
1430 })
1431 }
1432
1433 pub fn double_value(&self) -> std::option::Option<&f64> {
1437 #[allow(unreachable_patterns)]
1438 self.value.as_ref().and_then(|v| match v {
1439 crate::model::metric_value::Value::DoubleValue(v) => std::option::Option::Some(v),
1440 _ => std::option::Option::None,
1441 })
1442 }
1443
1444 pub fn string_value(&self) -> std::option::Option<&std::string::String> {
1448 #[allow(unreachable_patterns)]
1449 self.value.as_ref().and_then(|v| match v {
1450 crate::model::metric_value::Value::StringValue(v) => std::option::Option::Some(v),
1451 _ => std::option::Option::None,
1452 })
1453 }
1454
1455 pub fn distribution_value(
1459 &self,
1460 ) -> std::option::Option<&std::boxed::Box<crate::model::Distribution>> {
1461 #[allow(unreachable_patterns)]
1462 self.value.as_ref().and_then(|v| match v {
1463 crate::model::metric_value::Value::DistributionValue(v) => std::option::Option::Some(v),
1464 _ => std::option::Option::None,
1465 })
1466 }
1467
1468 pub fn set_bool_value<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1474 self.value =
1475 std::option::Option::Some(crate::model::metric_value::Value::BoolValue(v.into()));
1476 self
1477 }
1478
1479 pub fn set_int64_value<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
1485 self.value =
1486 std::option::Option::Some(crate::model::metric_value::Value::Int64Value(v.into()));
1487 self
1488 }
1489
1490 pub fn set_double_value<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
1496 self.value =
1497 std::option::Option::Some(crate::model::metric_value::Value::DoubleValue(v.into()));
1498 self
1499 }
1500
1501 pub fn set_string_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1507 self.value =
1508 std::option::Option::Some(crate::model::metric_value::Value::StringValue(v.into()));
1509 self
1510 }
1511
1512 pub fn set_distribution_value<
1518 T: std::convert::Into<std::boxed::Box<crate::model::Distribution>>,
1519 >(
1520 mut self,
1521 v: T,
1522 ) -> Self {
1523 self.value = std::option::Option::Some(
1524 crate::model::metric_value::Value::DistributionValue(v.into()),
1525 );
1526 self
1527 }
1528}
1529
1530impl wkt::message::Message for MetricValue {
1531 fn typename() -> &'static str {
1532 "type.googleapis.com/google.api.servicecontrol.v1.MetricValue"
1533 }
1534}
1535
1536pub mod metric_value {
1538 #[allow(unused_imports)]
1539 use super::*;
1540
1541 #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
1545 #[serde(rename_all = "camelCase")]
1546 #[non_exhaustive]
1547 pub enum Value {
1548 BoolValue(bool),
1550 Int64Value(i64),
1552 DoubleValue(f64),
1554 StringValue(std::string::String),
1556 DistributionValue(std::boxed::Box<crate::model::Distribution>),
1558 }
1559}
1560
1561#[serde_with::serde_as]
1565#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
1566#[serde(default, rename_all = "camelCase")]
1567#[non_exhaustive]
1568pub struct MetricValueSet {
1569 #[serde(skip_serializing_if = "std::string::String::is_empty")]
1571 pub metric_name: std::string::String,
1572
1573 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
1575 pub metric_values: std::vec::Vec<crate::model::MetricValue>,
1576
1577 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1578 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1579}
1580
1581impl MetricValueSet {
1582 pub fn new() -> Self {
1583 std::default::Default::default()
1584 }
1585
1586 pub fn set_metric_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1588 self.metric_name = v.into();
1589 self
1590 }
1591
1592 pub fn set_metric_values<T, V>(mut self, v: T) -> Self
1594 where
1595 T: std::iter::IntoIterator<Item = V>,
1596 V: std::convert::Into<crate::model::MetricValue>,
1597 {
1598 use std::iter::Iterator;
1599 self.metric_values = v.into_iter().map(|i| i.into()).collect();
1600 self
1601 }
1602}
1603
1604impl wkt::message::Message for MetricValueSet {
1605 fn typename() -> &'static str {
1606 "type.googleapis.com/google.api.servicecontrol.v1.MetricValueSet"
1607 }
1608}
1609
1610#[serde_with::serde_as]
1612#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
1613#[serde(default, rename_all = "camelCase")]
1614#[non_exhaustive]
1615pub struct Operation {
1616 #[serde(skip_serializing_if = "std::string::String::is_empty")]
1626 pub operation_id: std::string::String,
1627
1628 #[serde(skip_serializing_if = "std::string::String::is_empty")]
1630 pub operation_name: std::string::String,
1631
1632 #[serde(skip_serializing_if = "std::string::String::is_empty")]
1645 pub consumer_id: std::string::String,
1646
1647 #[serde(skip_serializing_if = "std::option::Option::is_none")]
1649 pub start_time: std::option::Option<wkt::Timestamp>,
1650
1651 #[serde(skip_serializing_if = "std::option::Option::is_none")]
1660 pub end_time: std::option::Option<wkt::Timestamp>,
1661
1662 #[serde(skip_serializing_if = "std::collections::HashMap::is_empty")]
1679 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
1680
1681 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
1692 pub metric_value_sets: std::vec::Vec<crate::model::MetricValueSet>,
1693
1694 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
1696 pub log_entries: std::vec::Vec<crate::model::LogEntry>,
1697
1698 pub importance: crate::model::operation::Importance,
1700
1701 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
1703 pub extensions: std::vec::Vec<wkt::Any>,
1704
1705 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1706 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1707}
1708
1709impl Operation {
1710 pub fn new() -> Self {
1711 std::default::Default::default()
1712 }
1713
1714 pub fn set_operation_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1716 self.operation_id = v.into();
1717 self
1718 }
1719
1720 pub fn set_operation_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1722 self.operation_name = v.into();
1723 self
1724 }
1725
1726 pub fn set_consumer_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1728 self.consumer_id = v.into();
1729 self
1730 }
1731
1732 pub fn set_start_time<T: std::convert::Into<std::option::Option<wkt::Timestamp>>>(
1734 mut self,
1735 v: T,
1736 ) -> Self {
1737 self.start_time = v.into();
1738 self
1739 }
1740
1741 pub fn set_end_time<T: std::convert::Into<std::option::Option<wkt::Timestamp>>>(
1743 mut self,
1744 v: T,
1745 ) -> Self {
1746 self.end_time = v.into();
1747 self
1748 }
1749
1750 pub fn set_importance<T: std::convert::Into<crate::model::operation::Importance>>(
1752 mut self,
1753 v: T,
1754 ) -> Self {
1755 self.importance = v.into();
1756 self
1757 }
1758
1759 pub fn set_metric_value_sets<T, V>(mut self, v: T) -> Self
1761 where
1762 T: std::iter::IntoIterator<Item = V>,
1763 V: std::convert::Into<crate::model::MetricValueSet>,
1764 {
1765 use std::iter::Iterator;
1766 self.metric_value_sets = v.into_iter().map(|i| i.into()).collect();
1767 self
1768 }
1769
1770 pub fn set_log_entries<T, V>(mut self, v: T) -> Self
1772 where
1773 T: std::iter::IntoIterator<Item = V>,
1774 V: std::convert::Into<crate::model::LogEntry>,
1775 {
1776 use std::iter::Iterator;
1777 self.log_entries = v.into_iter().map(|i| i.into()).collect();
1778 self
1779 }
1780
1781 pub fn set_extensions<T, V>(mut self, v: T) -> Self
1783 where
1784 T: std::iter::IntoIterator<Item = V>,
1785 V: std::convert::Into<wkt::Any>,
1786 {
1787 use std::iter::Iterator;
1788 self.extensions = v.into_iter().map(|i| i.into()).collect();
1789 self
1790 }
1791
1792 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
1794 where
1795 T: std::iter::IntoIterator<Item = (K, V)>,
1796 K: std::convert::Into<std::string::String>,
1797 V: std::convert::Into<std::string::String>,
1798 {
1799 use std::iter::Iterator;
1800 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1801 self
1802 }
1803}
1804
1805impl wkt::message::Message for Operation {
1806 fn typename() -> &'static str {
1807 "type.googleapis.com/google.api.servicecontrol.v1.Operation"
1808 }
1809}
1810
1811pub mod operation {
1813 #[allow(unused_imports)]
1814 use super::*;
1815
1816 #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
1818 pub struct Importance(i32);
1819
1820 impl Importance {
1821 pub const LOW: Importance = Importance::new(0);
1824
1825 pub const HIGH: Importance = Importance::new(1);
1829
1830 pub(crate) const fn new(value: i32) -> Self {
1832 Self(value)
1833 }
1834
1835 pub fn value(&self) -> i32 {
1837 self.0
1838 }
1839
1840 pub fn as_str_name(&self) -> std::borrow::Cow<'static, str> {
1842 match self.0 {
1843 0 => std::borrow::Cow::Borrowed("LOW"),
1844 1 => std::borrow::Cow::Borrowed("HIGH"),
1845 _ => std::borrow::Cow::Owned(std::format!("UNKNOWN-VALUE:{}", self.0)),
1846 }
1847 }
1848
1849 pub fn from_str_name(name: &str) -> std::option::Option<Self> {
1851 match name {
1852 "LOW" => std::option::Option::Some(Self::LOW),
1853 "HIGH" => std::option::Option::Some(Self::HIGH),
1854 _ => std::option::Option::None,
1855 }
1856 }
1857 }
1858
1859 impl std::convert::From<i32> for Importance {
1860 fn from(value: i32) -> Self {
1861 Self::new(value)
1862 }
1863 }
1864
1865 impl std::default::Default for Importance {
1866 fn default() -> Self {
1867 Self::new(0)
1868 }
1869 }
1870}
1871
1872#[serde_with::serde_as]
1874#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
1875#[serde(default, rename_all = "camelCase")]
1876#[non_exhaustive]
1877pub struct AllocateQuotaRequest {
1878 #[serde(skip_serializing_if = "std::string::String::is_empty")]
1883 pub service_name: std::string::String,
1884
1885 #[serde(skip_serializing_if = "std::option::Option::is_none")]
1887 pub allocate_operation: std::option::Option<crate::model::QuotaOperation>,
1888
1889 #[serde(skip_serializing_if = "std::string::String::is_empty")]
1893 pub service_config_id: std::string::String,
1894
1895 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1896 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1897}
1898
1899impl AllocateQuotaRequest {
1900 pub fn new() -> Self {
1901 std::default::Default::default()
1902 }
1903
1904 pub fn set_service_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1906 self.service_name = v.into();
1907 self
1908 }
1909
1910 pub fn set_allocate_operation<
1912 T: std::convert::Into<std::option::Option<crate::model::QuotaOperation>>,
1913 >(
1914 mut self,
1915 v: T,
1916 ) -> Self {
1917 self.allocate_operation = v.into();
1918 self
1919 }
1920
1921 pub fn set_service_config_id<T: std::convert::Into<std::string::String>>(
1923 mut self,
1924 v: T,
1925 ) -> Self {
1926 self.service_config_id = v.into();
1927 self
1928 }
1929}
1930
1931impl wkt::message::Message for AllocateQuotaRequest {
1932 fn typename() -> &'static str {
1933 "type.googleapis.com/google.api.servicecontrol.v1.AllocateQuotaRequest"
1934 }
1935}
1936
1937#[serde_with::serde_as]
1939#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
1940#[serde(default, rename_all = "camelCase")]
1941#[non_exhaustive]
1942pub struct QuotaOperation {
1943 #[serde(skip_serializing_if = "std::string::String::is_empty")]
1953 pub operation_id: std::string::String,
1954
1955 #[serde(skip_serializing_if = "std::string::String::is_empty")]
1966 pub method_name: std::string::String,
1967
1968 #[serde(skip_serializing_if = "std::string::String::is_empty")]
1975 pub consumer_id: std::string::String,
1976
1977 #[serde(skip_serializing_if = "std::collections::HashMap::is_empty")]
1979 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
1980
1981 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
1994 pub quota_metrics: std::vec::Vec<crate::model::MetricValueSet>,
1995
1996 pub quota_mode: crate::model::quota_operation::QuotaMode,
1998
1999 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
2000 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2001}
2002
2003impl QuotaOperation {
2004 pub fn new() -> Self {
2005 std::default::Default::default()
2006 }
2007
2008 pub fn set_operation_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2010 self.operation_id = v.into();
2011 self
2012 }
2013
2014 pub fn set_method_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2016 self.method_name = v.into();
2017 self
2018 }
2019
2020 pub fn set_consumer_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2022 self.consumer_id = v.into();
2023 self
2024 }
2025
2026 pub fn set_quota_mode<T: std::convert::Into<crate::model::quota_operation::QuotaMode>>(
2028 mut self,
2029 v: T,
2030 ) -> Self {
2031 self.quota_mode = v.into();
2032 self
2033 }
2034
2035 pub fn set_quota_metrics<T, V>(mut self, v: T) -> Self
2037 where
2038 T: std::iter::IntoIterator<Item = V>,
2039 V: std::convert::Into<crate::model::MetricValueSet>,
2040 {
2041 use std::iter::Iterator;
2042 self.quota_metrics = v.into_iter().map(|i| i.into()).collect();
2043 self
2044 }
2045
2046 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
2048 where
2049 T: std::iter::IntoIterator<Item = (K, V)>,
2050 K: std::convert::Into<std::string::String>,
2051 V: std::convert::Into<std::string::String>,
2052 {
2053 use std::iter::Iterator;
2054 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2055 self
2056 }
2057}
2058
2059impl wkt::message::Message for QuotaOperation {
2060 fn typename() -> &'static str {
2061 "type.googleapis.com/google.api.servicecontrol.v1.QuotaOperation"
2062 }
2063}
2064
2065pub mod quota_operation {
2067 #[allow(unused_imports)]
2068 use super::*;
2069
2070 #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
2072 pub struct QuotaMode(i32);
2073
2074 impl QuotaMode {
2075 pub const UNSPECIFIED: QuotaMode = QuotaMode::new(0);
2077
2078 pub const NORMAL: QuotaMode = QuotaMode::new(1);
2085
2086 pub const BEST_EFFORT: QuotaMode = QuotaMode::new(2);
2095
2096 pub const CHECK_ONLY: QuotaMode = QuotaMode::new(3);
2100
2101 pub const QUERY_ONLY: QuotaMode = QuotaMode::new(4);
2107
2108 pub const ADJUST_ONLY: QuotaMode = QuotaMode::new(5);
2114
2115 pub(crate) const fn new(value: i32) -> Self {
2117 Self(value)
2118 }
2119
2120 pub fn value(&self) -> i32 {
2122 self.0
2123 }
2124
2125 pub fn as_str_name(&self) -> std::borrow::Cow<'static, str> {
2127 match self.0 {
2128 0 => std::borrow::Cow::Borrowed("UNSPECIFIED"),
2129 1 => std::borrow::Cow::Borrowed("NORMAL"),
2130 2 => std::borrow::Cow::Borrowed("BEST_EFFORT"),
2131 3 => std::borrow::Cow::Borrowed("CHECK_ONLY"),
2132 4 => std::borrow::Cow::Borrowed("QUERY_ONLY"),
2133 5 => std::borrow::Cow::Borrowed("ADJUST_ONLY"),
2134 _ => std::borrow::Cow::Owned(std::format!("UNKNOWN-VALUE:{}", self.0)),
2135 }
2136 }
2137
2138 pub fn from_str_name(name: &str) -> std::option::Option<Self> {
2140 match name {
2141 "UNSPECIFIED" => std::option::Option::Some(Self::UNSPECIFIED),
2142 "NORMAL" => std::option::Option::Some(Self::NORMAL),
2143 "BEST_EFFORT" => std::option::Option::Some(Self::BEST_EFFORT),
2144 "CHECK_ONLY" => std::option::Option::Some(Self::CHECK_ONLY),
2145 "QUERY_ONLY" => std::option::Option::Some(Self::QUERY_ONLY),
2146 "ADJUST_ONLY" => std::option::Option::Some(Self::ADJUST_ONLY),
2147 _ => std::option::Option::None,
2148 }
2149 }
2150 }
2151
2152 impl std::convert::From<i32> for QuotaMode {
2153 fn from(value: i32) -> Self {
2154 Self::new(value)
2155 }
2156 }
2157
2158 impl std::default::Default for QuotaMode {
2159 fn default() -> Self {
2160 Self::new(0)
2161 }
2162 }
2163}
2164
2165#[serde_with::serde_as]
2167#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
2168#[serde(default, rename_all = "camelCase")]
2169#[non_exhaustive]
2170pub struct AllocateQuotaResponse {
2171 #[serde(skip_serializing_if = "std::string::String::is_empty")]
2174 pub operation_id: std::string::String,
2175
2176 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
2178 pub allocate_errors: std::vec::Vec<crate::model::QuotaError>,
2179
2180 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
2192 pub quota_metrics: std::vec::Vec<crate::model::MetricValueSet>,
2193
2194 #[serde(skip_serializing_if = "std::string::String::is_empty")]
2196 pub service_config_id: std::string::String,
2197
2198 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
2199 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2200}
2201
2202impl AllocateQuotaResponse {
2203 pub fn new() -> Self {
2204 std::default::Default::default()
2205 }
2206
2207 pub fn set_operation_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2209 self.operation_id = v.into();
2210 self
2211 }
2212
2213 pub fn set_service_config_id<T: std::convert::Into<std::string::String>>(
2215 mut self,
2216 v: T,
2217 ) -> Self {
2218 self.service_config_id = v.into();
2219 self
2220 }
2221
2222 pub fn set_allocate_errors<T, V>(mut self, v: T) -> Self
2224 where
2225 T: std::iter::IntoIterator<Item = V>,
2226 V: std::convert::Into<crate::model::QuotaError>,
2227 {
2228 use std::iter::Iterator;
2229 self.allocate_errors = v.into_iter().map(|i| i.into()).collect();
2230 self
2231 }
2232
2233 pub fn set_quota_metrics<T, V>(mut self, v: T) -> Self
2235 where
2236 T: std::iter::IntoIterator<Item = V>,
2237 V: std::convert::Into<crate::model::MetricValueSet>,
2238 {
2239 use std::iter::Iterator;
2240 self.quota_metrics = v.into_iter().map(|i| i.into()).collect();
2241 self
2242 }
2243}
2244
2245impl wkt::message::Message for AllocateQuotaResponse {
2246 fn typename() -> &'static str {
2247 "type.googleapis.com/google.api.servicecontrol.v1.AllocateQuotaResponse"
2248 }
2249}
2250
2251#[serde_with::serde_as]
2255#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
2256#[serde(default, rename_all = "camelCase")]
2257#[non_exhaustive]
2258pub struct QuotaError {
2259 pub code: crate::model::quota_error::Code,
2261
2262 #[serde(skip_serializing_if = "std::string::String::is_empty")]
2266 pub subject: std::string::String,
2267
2268 #[serde(skip_serializing_if = "std::string::String::is_empty")]
2270 pub description: std::string::String,
2271
2272 #[serde(skip_serializing_if = "std::option::Option::is_none")]
2275 pub status: std::option::Option<rpc::model::Status>,
2276
2277 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
2278 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2279}
2280
2281impl QuotaError {
2282 pub fn new() -> Self {
2283 std::default::Default::default()
2284 }
2285
2286 pub fn set_code<T: std::convert::Into<crate::model::quota_error::Code>>(
2288 mut self,
2289 v: T,
2290 ) -> Self {
2291 self.code = v.into();
2292 self
2293 }
2294
2295 pub fn set_subject<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2297 self.subject = v.into();
2298 self
2299 }
2300
2301 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2303 self.description = v.into();
2304 self
2305 }
2306
2307 pub fn set_status<T: std::convert::Into<std::option::Option<rpc::model::Status>>>(
2309 mut self,
2310 v: T,
2311 ) -> Self {
2312 self.status = v.into();
2313 self
2314 }
2315}
2316
2317impl wkt::message::Message for QuotaError {
2318 fn typename() -> &'static str {
2319 "type.googleapis.com/google.api.servicecontrol.v1.QuotaError"
2320 }
2321}
2322
2323pub mod quota_error {
2325 #[allow(unused_imports)]
2326 use super::*;
2327
2328 #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
2334 pub struct Code(i32);
2335
2336 impl Code {
2337 pub const UNSPECIFIED: Code = Code::new(0);
2339
2340 pub const RESOURCE_EXHAUSTED: Code = Code::new(8);
2343
2344 pub const BILLING_NOT_ACTIVE: Code = Code::new(107);
2347
2348 pub const PROJECT_DELETED: Code = Code::new(108);
2350
2351 pub const API_KEY_INVALID: Code = Code::new(105);
2353
2354 pub const API_KEY_EXPIRED: Code = Code::new(112);
2356
2357 pub(crate) const fn new(value: i32) -> Self {
2359 Self(value)
2360 }
2361
2362 pub fn value(&self) -> i32 {
2364 self.0
2365 }
2366
2367 pub fn as_str_name(&self) -> std::borrow::Cow<'static, str> {
2369 match self.0 {
2370 0 => std::borrow::Cow::Borrowed("UNSPECIFIED"),
2371 8 => std::borrow::Cow::Borrowed("RESOURCE_EXHAUSTED"),
2372 105 => std::borrow::Cow::Borrowed("API_KEY_INVALID"),
2373 107 => std::borrow::Cow::Borrowed("BILLING_NOT_ACTIVE"),
2374 108 => std::borrow::Cow::Borrowed("PROJECT_DELETED"),
2375 112 => std::borrow::Cow::Borrowed("API_KEY_EXPIRED"),
2376 _ => std::borrow::Cow::Owned(std::format!("UNKNOWN-VALUE:{}", self.0)),
2377 }
2378 }
2379
2380 pub fn from_str_name(name: &str) -> std::option::Option<Self> {
2382 match name {
2383 "UNSPECIFIED" => std::option::Option::Some(Self::UNSPECIFIED),
2384 "RESOURCE_EXHAUSTED" => std::option::Option::Some(Self::RESOURCE_EXHAUSTED),
2385 "BILLING_NOT_ACTIVE" => std::option::Option::Some(Self::BILLING_NOT_ACTIVE),
2386 "PROJECT_DELETED" => std::option::Option::Some(Self::PROJECT_DELETED),
2387 "API_KEY_INVALID" => std::option::Option::Some(Self::API_KEY_INVALID),
2388 "API_KEY_EXPIRED" => std::option::Option::Some(Self::API_KEY_EXPIRED),
2389 _ => std::option::Option::None,
2390 }
2391 }
2392 }
2393
2394 impl std::convert::From<i32> for Code {
2395 fn from(value: i32) -> Self {
2396 Self::new(value)
2397 }
2398 }
2399
2400 impl std::default::Default for Code {
2401 fn default() -> Self {
2402 Self::new(0)
2403 }
2404 }
2405}
2406
2407#[serde_with::serde_as]
2409#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
2410#[serde(default, rename_all = "camelCase")]
2411#[non_exhaustive]
2412pub struct CheckRequest {
2413 #[serde(skip_serializing_if = "std::string::String::is_empty")]
2420 pub service_name: std::string::String,
2421
2422 #[serde(skip_serializing_if = "std::option::Option::is_none")]
2424 pub operation: std::option::Option<crate::model::Operation>,
2425
2426 #[serde(skip_serializing_if = "std::string::String::is_empty")]
2432 pub service_config_id: std::string::String,
2433
2434 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
2435 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2436}
2437
2438impl CheckRequest {
2439 pub fn new() -> Self {
2440 std::default::Default::default()
2441 }
2442
2443 pub fn set_service_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2445 self.service_name = v.into();
2446 self
2447 }
2448
2449 pub fn set_operation<T: std::convert::Into<std::option::Option<crate::model::Operation>>>(
2451 mut self,
2452 v: T,
2453 ) -> Self {
2454 self.operation = v.into();
2455 self
2456 }
2457
2458 pub fn set_service_config_id<T: std::convert::Into<std::string::String>>(
2460 mut self,
2461 v: T,
2462 ) -> Self {
2463 self.service_config_id = v.into();
2464 self
2465 }
2466}
2467
2468impl wkt::message::Message for CheckRequest {
2469 fn typename() -> &'static str {
2470 "type.googleapis.com/google.api.servicecontrol.v1.CheckRequest"
2471 }
2472}
2473
2474#[serde_with::serde_as]
2476#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
2477#[serde(default, rename_all = "camelCase")]
2478#[non_exhaustive]
2479pub struct CheckResponse {
2480 #[serde(skip_serializing_if = "std::string::String::is_empty")]
2486 pub operation_id: std::string::String,
2487
2488 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
2494 pub check_errors: std::vec::Vec<crate::model::CheckError>,
2495
2496 #[serde(skip_serializing_if = "std::string::String::is_empty")]
2498 pub service_config_id: std::string::String,
2499
2500 #[serde(skip_serializing_if = "std::string::String::is_empty")]
2502 pub service_rollout_id: std::string::String,
2503
2504 #[serde(skip_serializing_if = "std::option::Option::is_none")]
2506 pub check_info: std::option::Option<crate::model::check_response::CheckInfo>,
2507
2508 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
2509 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2510}
2511
2512impl CheckResponse {
2513 pub fn new() -> Self {
2514 std::default::Default::default()
2515 }
2516
2517 pub fn set_operation_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2519 self.operation_id = v.into();
2520 self
2521 }
2522
2523 pub fn set_service_config_id<T: std::convert::Into<std::string::String>>(
2525 mut self,
2526 v: T,
2527 ) -> Self {
2528 self.service_config_id = v.into();
2529 self
2530 }
2531
2532 pub fn set_service_rollout_id<T: std::convert::Into<std::string::String>>(
2534 mut self,
2535 v: T,
2536 ) -> Self {
2537 self.service_rollout_id = v.into();
2538 self
2539 }
2540
2541 pub fn set_check_info<
2543 T: std::convert::Into<std::option::Option<crate::model::check_response::CheckInfo>>,
2544 >(
2545 mut self,
2546 v: T,
2547 ) -> Self {
2548 self.check_info = v.into();
2549 self
2550 }
2551
2552 pub fn set_check_errors<T, V>(mut self, v: T) -> Self
2554 where
2555 T: std::iter::IntoIterator<Item = V>,
2556 V: std::convert::Into<crate::model::CheckError>,
2557 {
2558 use std::iter::Iterator;
2559 self.check_errors = v.into_iter().map(|i| i.into()).collect();
2560 self
2561 }
2562}
2563
2564impl wkt::message::Message for CheckResponse {
2565 fn typename() -> &'static str {
2566 "type.googleapis.com/google.api.servicecontrol.v1.CheckResponse"
2567 }
2568}
2569
2570pub mod check_response {
2572 #[allow(unused_imports)]
2573 use super::*;
2574
2575 #[serde_with::serde_as]
2577 #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
2578 #[serde(default, rename_all = "camelCase")]
2579 #[non_exhaustive]
2580 pub struct CheckInfo {
2581 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
2585 pub unused_arguments: std::vec::Vec<std::string::String>,
2586
2587 #[serde(skip_serializing_if = "std::option::Option::is_none")]
2589 pub consumer_info: std::option::Option<crate::model::check_response::ConsumerInfo>,
2590
2591 #[serde(skip_serializing_if = "std::string::String::is_empty")]
2595 pub api_key_uid: std::string::String,
2596
2597 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
2598 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2599 }
2600
2601 impl CheckInfo {
2602 pub fn new() -> Self {
2603 std::default::Default::default()
2604 }
2605
2606 pub fn set_consumer_info<
2608 T: std::convert::Into<std::option::Option<crate::model::check_response::ConsumerInfo>>,
2609 >(
2610 mut self,
2611 v: T,
2612 ) -> Self {
2613 self.consumer_info = v.into();
2614 self
2615 }
2616
2617 pub fn set_api_key_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2619 self.api_key_uid = v.into();
2620 self
2621 }
2622
2623 pub fn set_unused_arguments<T, V>(mut self, v: T) -> Self
2625 where
2626 T: std::iter::IntoIterator<Item = V>,
2627 V: std::convert::Into<std::string::String>,
2628 {
2629 use std::iter::Iterator;
2630 self.unused_arguments = v.into_iter().map(|i| i.into()).collect();
2631 self
2632 }
2633 }
2634
2635 impl wkt::message::Message for CheckInfo {
2636 fn typename() -> &'static str {
2637 "type.googleapis.com/google.api.servicecontrol.v1.CheckResponse.CheckInfo"
2638 }
2639 }
2640
2641 #[serde_with::serde_as]
2643 #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
2644 #[serde(default, rename_all = "camelCase")]
2645 #[non_exhaustive]
2646 pub struct ConsumerInfo {
2647 #[serde_as(as = "serde_with::DisplayFromStr")]
2653 pub project_number: i64,
2654
2655 #[serde(rename = "type")]
2658 pub r#type: crate::model::check_response::consumer_info::ConsumerType,
2659
2660 #[serde_as(as = "serde_with::DisplayFromStr")]
2664 pub consumer_number: i64,
2665
2666 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
2667 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2668 }
2669
2670 impl ConsumerInfo {
2671 pub fn new() -> Self {
2672 std::default::Default::default()
2673 }
2674
2675 pub fn set_project_number<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
2677 self.project_number = v.into();
2678 self
2679 }
2680
2681 pub fn set_type<
2683 T: std::convert::Into<crate::model::check_response::consumer_info::ConsumerType>,
2684 >(
2685 mut self,
2686 v: T,
2687 ) -> Self {
2688 self.r#type = v.into();
2689 self
2690 }
2691
2692 pub fn set_consumer_number<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
2694 self.consumer_number = v.into();
2695 self
2696 }
2697 }
2698
2699 impl wkt::message::Message for ConsumerInfo {
2700 fn typename() -> &'static str {
2701 "type.googleapis.com/google.api.servicecontrol.v1.CheckResponse.ConsumerInfo"
2702 }
2703 }
2704
2705 pub mod consumer_info {
2707 #[allow(unused_imports)]
2708 use super::*;
2709
2710 #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
2713 pub struct ConsumerType(i32);
2714
2715 impl ConsumerType {
2716 pub const CONSUMER_TYPE_UNSPECIFIED: ConsumerType = ConsumerType::new(0);
2718
2719 pub const PROJECT: ConsumerType = ConsumerType::new(1);
2721
2722 pub const FOLDER: ConsumerType = ConsumerType::new(2);
2724
2725 pub const ORGANIZATION: ConsumerType = ConsumerType::new(3);
2727
2728 pub const SERVICE_SPECIFIC: ConsumerType = ConsumerType::new(4);
2732
2733 pub(crate) const fn new(value: i32) -> Self {
2735 Self(value)
2736 }
2737
2738 pub fn value(&self) -> i32 {
2740 self.0
2741 }
2742
2743 pub fn as_str_name(&self) -> std::borrow::Cow<'static, str> {
2745 match self.0 {
2746 0 => std::borrow::Cow::Borrowed("CONSUMER_TYPE_UNSPECIFIED"),
2747 1 => std::borrow::Cow::Borrowed("PROJECT"),
2748 2 => std::borrow::Cow::Borrowed("FOLDER"),
2749 3 => std::borrow::Cow::Borrowed("ORGANIZATION"),
2750 4 => std::borrow::Cow::Borrowed("SERVICE_SPECIFIC"),
2751 _ => std::borrow::Cow::Owned(std::format!("UNKNOWN-VALUE:{}", self.0)),
2752 }
2753 }
2754
2755 pub fn from_str_name(name: &str) -> std::option::Option<Self> {
2757 match name {
2758 "CONSUMER_TYPE_UNSPECIFIED" => {
2759 std::option::Option::Some(Self::CONSUMER_TYPE_UNSPECIFIED)
2760 }
2761 "PROJECT" => std::option::Option::Some(Self::PROJECT),
2762 "FOLDER" => std::option::Option::Some(Self::FOLDER),
2763 "ORGANIZATION" => std::option::Option::Some(Self::ORGANIZATION),
2764 "SERVICE_SPECIFIC" => std::option::Option::Some(Self::SERVICE_SPECIFIC),
2765 _ => std::option::Option::None,
2766 }
2767 }
2768 }
2769
2770 impl std::convert::From<i32> for ConsumerType {
2771 fn from(value: i32) -> Self {
2772 Self::new(value)
2773 }
2774 }
2775
2776 impl std::default::Default for ConsumerType {
2777 fn default() -> Self {
2778 Self::new(0)
2779 }
2780 }
2781 }
2782}
2783
2784#[serde_with::serde_as]
2786#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
2787#[serde(default, rename_all = "camelCase")]
2788#[non_exhaustive]
2789pub struct ReportRequest {
2790 #[serde(skip_serializing_if = "std::string::String::is_empty")]
2797 pub service_name: std::string::String,
2798
2799 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
2813 pub operations: std::vec::Vec<crate::model::Operation>,
2814
2815 #[serde(skip_serializing_if = "std::string::String::is_empty")]
2821 pub service_config_id: std::string::String,
2822
2823 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
2824 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2825}
2826
2827impl ReportRequest {
2828 pub fn new() -> Self {
2829 std::default::Default::default()
2830 }
2831
2832 pub fn set_service_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2834 self.service_name = v.into();
2835 self
2836 }
2837
2838 pub fn set_service_config_id<T: std::convert::Into<std::string::String>>(
2840 mut self,
2841 v: T,
2842 ) -> Self {
2843 self.service_config_id = v.into();
2844 self
2845 }
2846
2847 pub fn set_operations<T, V>(mut self, v: T) -> Self
2849 where
2850 T: std::iter::IntoIterator<Item = V>,
2851 V: std::convert::Into<crate::model::Operation>,
2852 {
2853 use std::iter::Iterator;
2854 self.operations = v.into_iter().map(|i| i.into()).collect();
2855 self
2856 }
2857}
2858
2859impl wkt::message::Message for ReportRequest {
2860 fn typename() -> &'static str {
2861 "type.googleapis.com/google.api.servicecontrol.v1.ReportRequest"
2862 }
2863}
2864
2865#[serde_with::serde_as]
2867#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
2868#[serde(default, rename_all = "camelCase")]
2869#[non_exhaustive]
2870pub struct ReportResponse {
2871 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
2886 pub report_errors: std::vec::Vec<crate::model::report_response::ReportError>,
2887
2888 #[serde(skip_serializing_if = "std::string::String::is_empty")]
2890 pub service_config_id: std::string::String,
2891
2892 #[serde(skip_serializing_if = "std::string::String::is_empty")]
2894 pub service_rollout_id: std::string::String,
2895
2896 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
2897 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2898}
2899
2900impl ReportResponse {
2901 pub fn new() -> Self {
2902 std::default::Default::default()
2903 }
2904
2905 pub fn set_service_config_id<T: std::convert::Into<std::string::String>>(
2907 mut self,
2908 v: T,
2909 ) -> Self {
2910 self.service_config_id = v.into();
2911 self
2912 }
2913
2914 pub fn set_service_rollout_id<T: std::convert::Into<std::string::String>>(
2916 mut self,
2917 v: T,
2918 ) -> Self {
2919 self.service_rollout_id = v.into();
2920 self
2921 }
2922
2923 pub fn set_report_errors<T, V>(mut self, v: T) -> Self
2925 where
2926 T: std::iter::IntoIterator<Item = V>,
2927 V: std::convert::Into<crate::model::report_response::ReportError>,
2928 {
2929 use std::iter::Iterator;
2930 self.report_errors = v.into_iter().map(|i| i.into()).collect();
2931 self
2932 }
2933}
2934
2935impl wkt::message::Message for ReportResponse {
2936 fn typename() -> &'static str {
2937 "type.googleapis.com/google.api.servicecontrol.v1.ReportResponse"
2938 }
2939}
2940
2941pub mod report_response {
2943 #[allow(unused_imports)]
2944 use super::*;
2945
2946 #[serde_with::serde_as]
2951 #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
2952 #[serde(default, rename_all = "camelCase")]
2953 #[non_exhaustive]
2954 pub struct ReportError {
2955 #[serde(skip_serializing_if = "std::string::String::is_empty")]
2961 pub operation_id: std::string::String,
2962
2963 #[serde(skip_serializing_if = "std::option::Option::is_none")]
2968 pub status: std::option::Option<rpc::model::Status>,
2969
2970 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
2971 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2972 }
2973
2974 impl ReportError {
2975 pub fn new() -> Self {
2976 std::default::Default::default()
2977 }
2978
2979 pub fn set_operation_id<T: std::convert::Into<std::string::String>>(
2981 mut self,
2982 v: T,
2983 ) -> Self {
2984 self.operation_id = v.into();
2985 self
2986 }
2987
2988 pub fn set_status<T: std::convert::Into<std::option::Option<rpc::model::Status>>>(
2990 mut self,
2991 v: T,
2992 ) -> Self {
2993 self.status = v.into();
2994 self
2995 }
2996 }
2997
2998 impl wkt::message::Message for ReportError {
2999 fn typename() -> &'static str {
3000 "type.googleapis.com/google.api.servicecontrol.v1.ReportResponse.ReportError"
3001 }
3002 }
3003}