google_cloud_api_servicecontrol_v1/
model.rs

1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![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/// Defines the errors to be returned in
37/// [google.api.servicecontrol.v1.CheckResponse.check_errors][google.api.servicecontrol.v1.CheckResponse.check_errors].
38///
39/// [google.api.servicecontrol.v1.CheckResponse.check_errors]: crate::model::CheckResponse::check_errors
40#[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    /// The error code.
46    pub code: crate::model::check_error::Code,
47
48    /// Subject to whom this error applies. See the specific code enum for more
49    /// details on this field. For example:
50    ///
51    /// - "project:\<project-id or project-number\>"
52    /// - "folder:\<folder-id\>"
53    /// - "organization:\<organization-id\>"
54    #[serde(skip_serializing_if = "std::string::String::is_empty")]
55    pub subject: std::string::String,
56
57    /// Free-form text providing details on the error cause of the error.
58    #[serde(skip_serializing_if = "std::string::String::is_empty")]
59    pub detail: std::string::String,
60
61    /// Contains public information about the check error. If available,
62    /// `status.code` will be non zero and client can propagate it out as public
63    /// error.
64    #[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    /// Sets the value of [code][crate::model::CheckError::code].
77    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    /// Sets the value of [subject][crate::model::CheckError::subject].
86    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    /// Sets the value of [detail][crate::model::CheckError::detail].
92    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    /// Sets the value of [status][crate::model::CheckError::status].
98    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
113/// Defines additional types related to [CheckError].
114pub mod check_error {
115    #[allow(unused_imports)]
116    use super::*;
117
118    /// Error codes for Check responses.
119    #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
120    pub struct Code(i32);
121
122    impl Code {
123        /// This is never used in `CheckResponse`.
124        pub const ERROR_CODE_UNSPECIFIED: Code = Code::new(0);
125
126        /// The consumer's project id, network container, or resource container was
127        /// not found. Same as [google.rpc.Code.NOT_FOUND][google.rpc.Code.NOT_FOUND].
128        pub const NOT_FOUND: Code = Code::new(5);
129
130        /// The consumer doesn't have access to the specified resource.
131        /// Same as [google.rpc.Code.PERMISSION_DENIED][google.rpc.Code.PERMISSION_DENIED].
132        pub const PERMISSION_DENIED: Code = Code::new(7);
133
134        /// Quota check failed. Same as [google.rpc.Code.RESOURCE_EXHAUSTED][google.rpc.Code.RESOURCE_EXHAUSTED].
135        pub const RESOURCE_EXHAUSTED: Code = Code::new(8);
136
137        /// The consumer hasn't activated the service.
138        pub const SERVICE_NOT_ACTIVATED: Code = Code::new(104);
139
140        /// The consumer cannot access the service because billing is disabled.
141        pub const BILLING_DISABLED: Code = Code::new(107);
142
143        /// The consumer's project has been marked as deleted (soft deletion).
144        pub const PROJECT_DELETED: Code = Code::new(108);
145
146        /// The consumer's project number or id does not represent a valid project.
147        pub const PROJECT_INVALID: Code = Code::new(114);
148
149        /// The input consumer info does not represent a valid consumer folder or
150        /// organization.
151        pub const CONSUMER_INVALID: Code = Code::new(125);
152
153        /// The IP address of the consumer is invalid for the specific consumer
154        /// project.
155        pub const IP_ADDRESS_BLOCKED: Code = Code::new(109);
156
157        /// The referer address of the consumer request is invalid for the specific
158        /// consumer project.
159        pub const REFERER_BLOCKED: Code = Code::new(110);
160
161        /// The client application of the consumer request is invalid for the
162        /// specific consumer project.
163        pub const CLIENT_APP_BLOCKED: Code = Code::new(111);
164
165        /// The API targeted by this request is invalid for the specified consumer
166        /// project.
167        pub const API_TARGET_BLOCKED: Code = Code::new(122);
168
169        /// The consumer's API key is invalid.
170        pub const API_KEY_INVALID: Code = Code::new(105);
171
172        /// The consumer's API Key has expired.
173        pub const API_KEY_EXPIRED: Code = Code::new(112);
174
175        /// The consumer's API Key was not found in config record.
176        pub const API_KEY_NOT_FOUND: Code = Code::new(113);
177
178        /// The credential in the request can not be verified.
179        pub const INVALID_CREDENTIAL: Code = Code::new(123);
180
181        /// The backend server for looking up project id/number is unavailable.
182        pub const NAMESPACE_LOOKUP_UNAVAILABLE: Code = Code::new(300);
183
184        /// The backend server for checking service status is unavailable.
185        pub const SERVICE_STATUS_UNAVAILABLE: Code = Code::new(301);
186
187        /// The backend server for checking billing status is unavailable.
188        pub const BILLING_STATUS_UNAVAILABLE: Code = Code::new(302);
189
190        /// Cloud Resource Manager backend server is unavailable.
191        pub const CLOUD_RESOURCE_MANAGER_BACKEND_UNAVAILABLE: Code = Code::new(305);
192
193        /// Creates a new Code instance.
194        pub(crate) const fn new(value: i32) -> Self {
195            Self(value)
196        }
197
198        /// Gets the enum value.
199        pub fn value(&self) -> i32 {
200            self.0
201        }
202
203        /// Gets the enum value as a string.
204        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        /// Creates an enum value from the value name.
232        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/// Distribution represents a frequency distribution of double-valued sample
282/// points. It contains the size of the population of sample points plus
283/// additional optional information:
284///
285/// * the arithmetic mean of the samples
286/// * the minimum and maximum of the samples
287/// * the sum-squared-deviation of the samples, used to compute variance
288/// * a histogram of the values of the sample points
289#[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    /// The total number of samples in the distribution. Must be >= 0.
295    #[serde_as(as = "serde_with::DisplayFromStr")]
296    pub count: i64,
297
298    /// The arithmetic mean of the samples in the distribution. If `count` is
299    /// zero then this field must be zero.
300    pub mean: f64,
301
302    /// The minimum of the population of values. Ignored if `count` is zero.
303    pub minimum: f64,
304
305    /// The maximum of the population of values. Ignored if `count` is zero.
306    pub maximum: f64,
307
308    /// The sum of squared deviations from the mean:
309    /// Sum[i=1..count]((x_i - mean)^2)
310    /// where each x_i is a sample values. If `count` is zero then this field
311    /// must be zero, otherwise validation of the request fails.
312    pub sum_of_squared_deviation: f64,
313
314    /// The number of samples in each histogram bucket. `bucket_counts` are
315    /// optional. If present, they must sum to the `count` value.
316    ///
317    /// The buckets are defined below in `bucket_option`. There are N buckets.
318    /// `bucket_counts[0]` is the number of samples in the underflow bucket.
319    /// `bucket_counts[1]` to `bucket_counts[N-1]` are the numbers of samples
320    /// in each of the finite buckets. And `bucket_counts[N] is the number
321    /// of samples in the overflow bucket. See the comments of `bucket_option`
322    /// below for more details.
323    ///
324    /// Any suffix of trailing zeros may be omitted.
325    #[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    /// Example points. Must be in increasing order of `value` field.
330    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
331    pub exemplars: std::vec::Vec<api::model::distribution::Exemplar>,
332
333    /// Defines the buckets in the histogram. `bucket_option` and `bucket_counts`
334    /// must be both set, or both unset.
335    ///
336    /// Buckets are numbered in the range of [0, N], with a total of N+1 buckets.
337    /// There must be at least two buckets (a single-bucket histogram gives
338    /// no information that isn't already provided by `count`).
339    ///
340    /// The first bucket is the underflow bucket which has a lower bound
341    /// of -inf. The last bucket is the overflow bucket which has an
342    /// upper bound of +inf. All other buckets (if any) are called "finite"
343    /// buckets because they have finite lower and upper bounds. As described
344    /// below, there are three ways to define the finite buckets.
345    ///
346    /// (1) Buckets with constant width.
347    /// (2) Buckets with exponentially growing widths.
348    /// (3) Buckets with arbitrary user-provided widths.
349    ///
350    /// In all cases, the buckets cover the entire real number line (-inf,
351    /// +inf). Bucket upper bounds are exclusive and lower bounds are
352    /// inclusive. The upper bound of the underflow bucket is equal to the
353    /// lower bound of the smallest finite bucket; the lower bound of the
354    /// overflow bucket is equal to the upper bound of the largest finite
355    /// bucket.
356    #[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    /// Sets the value of [count][crate::model::Distribution::count].
369    pub fn set_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
370        self.count = v.into();
371        self
372    }
373
374    /// Sets the value of [mean][crate::model::Distribution::mean].
375    pub fn set_mean<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
376        self.mean = v.into();
377        self
378    }
379
380    /// Sets the value of [minimum][crate::model::Distribution::minimum].
381    pub fn set_minimum<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
382        self.minimum = v.into();
383        self
384    }
385
386    /// Sets the value of [maximum][crate::model::Distribution::maximum].
387    pub fn set_maximum<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
388        self.maximum = v.into();
389        self
390    }
391
392    /// Sets the value of [sum_of_squared_deviation][crate::model::Distribution::sum_of_squared_deviation].
393    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    /// Sets the value of [bucket_counts][crate::model::Distribution::bucket_counts].
399    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    /// Sets the value of [exemplars][crate::model::Distribution::exemplars].
410    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    /// Sets the value of [bucket_option][crate::model::Distribution::bucket_option].
421    ///
422    /// Note that all the setters affecting `bucket_option` are mutually
423    /// exclusive.
424    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    /// The value of [bucket_option][crate::model::Distribution::bucket_option]
435    /// if it holds a `LinearBuckets`, `None` if the field is not set or
436    /// holds a different branch.
437    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    /// The value of [bucket_option][crate::model::Distribution::bucket_option]
450    /// if it holds a `ExponentialBuckets`, `None` if the field is not set or
451    /// holds a different branch.
452    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    /// The value of [bucket_option][crate::model::Distribution::bucket_option]
465    /// if it holds a `ExplicitBuckets`, `None` if the field is not set or
466    /// holds a different branch.
467    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    /// Sets the value of [bucket_option][crate::model::Distribution::bucket_option]
480    /// to hold a `LinearBuckets`.
481    ///
482    /// Note that all the setters affecting `bucket_option` are
483    /// mutually exclusive.
484    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    /// Sets the value of [bucket_option][crate::model::Distribution::bucket_option]
497    /// to hold a `ExponentialBuckets`.
498    ///
499    /// Note that all the setters affecting `bucket_option` are
500    /// mutually exclusive.
501    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    /// Sets the value of [bucket_option][crate::model::Distribution::bucket_option]
514    /// to hold a `ExplicitBuckets`.
515    ///
516    /// Note that all the setters affecting `bucket_option` are
517    /// mutually exclusive.
518    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
537/// Defines additional types related to [Distribution].
538pub mod distribution {
539    #[allow(unused_imports)]
540    use super::*;
541
542    /// Describing buckets with constant width.
543    #[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        /// The number of finite buckets. With the underflow and overflow buckets,
549        /// the total number of buckets is `num_finite_buckets` + 2.
550        /// See comments on `bucket_options` for details.
551        pub num_finite_buckets: i32,
552
553        /// The i'th linear bucket covers the interval
554        /// [offset + (i-1) * width, offset + i * width)
555        /// where i ranges from 1 to num_finite_buckets, inclusive.
556        /// Must be strictly positive.
557        pub width: f64,
558
559        /// The i'th linear bucket covers the interval
560        /// [offset + (i-1) * width, offset + i * width)
561        /// where i ranges from 1 to num_finite_buckets, inclusive.
562        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        /// Sets the value of [num_finite_buckets][crate::model::distribution::LinearBuckets::num_finite_buckets].
574        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        /// Sets the value of [width][crate::model::distribution::LinearBuckets::width].
580        pub fn set_width<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
581            self.width = v.into();
582            self
583        }
584
585        /// Sets the value of [offset][crate::model::distribution::LinearBuckets::offset].
586        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    /// Describing buckets with exponentially growing width.
599    #[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        /// The number of finite buckets. With the underflow and overflow buckets,
605        /// the total number of buckets is `num_finite_buckets` + 2.
606        /// See comments on `bucket_options` for details.
607        pub num_finite_buckets: i32,
608
609        /// The i'th exponential bucket covers the interval
610        /// [scale * growth_factor^(i-1), scale * growth_factor^i)
611        /// where i ranges from 1 to num_finite_buckets inclusive.
612        /// Must be larger than 1.0.
613        pub growth_factor: f64,
614
615        /// The i'th exponential bucket covers the interval
616        /// [scale * growth_factor^(i-1), scale * growth_factor^i)
617        /// where i ranges from 1 to num_finite_buckets inclusive.
618        /// Must be > 0.
619        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        /// Sets the value of [num_finite_buckets][crate::model::distribution::ExponentialBuckets::num_finite_buckets].
631        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        /// Sets the value of [growth_factor][crate::model::distribution::ExponentialBuckets::growth_factor].
637        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        /// Sets the value of [scale][crate::model::distribution::ExponentialBuckets::scale].
643        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    /// Describing buckets with arbitrary user-provided width.
656    #[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        /// 'bound' is a list of strictly increasing boundaries between
662        /// buckets. Note that a list of length N-1 defines N buckets because
663        /// of fenceposting. See comments on `bucket_options` for details.
664        ///
665        /// The i'th finite bucket covers the interval
666        /// [bound[i-1], bound[i])
667        /// where i ranges from 1 to bound_size() - 1. Note that there are no
668        /// finite buckets at all if 'bound' only contains a single element; in
669        /// that special case the single bound defines the boundary between the
670        /// underflow and overflow buckets.
671        ///
672        /// bucket number                   lower bound    upper bound
673        /// i == 0 (underflow)              -inf           bound[i]
674        /// 0 < i < bound_size()            bound[i-1]     bound[i]
675        /// i == bound_size() (overflow)    bound[i-1]     +inf
676        #[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        /// Sets the value of [bounds][crate::model::distribution::ExplicitBuckets::bounds].
689        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    /// Defines the buckets in the histogram. `bucket_option` and `bucket_counts`
707    /// must be both set, or both unset.
708    ///
709    /// Buckets are numbered in the range of [0, N], with a total of N+1 buckets.
710    /// There must be at least two buckets (a single-bucket histogram gives
711    /// no information that isn't already provided by `count`).
712    ///
713    /// The first bucket is the underflow bucket which has a lower bound
714    /// of -inf. The last bucket is the overflow bucket which has an
715    /// upper bound of +inf. All other buckets (if any) are called "finite"
716    /// buckets because they have finite lower and upper bounds. As described
717    /// below, there are three ways to define the finite buckets.
718    ///
719    /// (1) Buckets with constant width.
720    /// (2) Buckets with exponentially growing widths.
721    /// (3) Buckets with arbitrary user-provided widths.
722    ///
723    /// In all cases, the buckets cover the entire real number line (-inf,
724    /// +inf). Bucket upper bounds are exclusive and lower bounds are
725    /// inclusive. The upper bound of the underflow bucket is equal to the
726    /// lower bound of the smallest finite bucket; the lower bound of the
727    /// overflow bucket is equal to the upper bound of the largest finite
728    /// bucket.
729    #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
730    #[serde(rename_all = "camelCase")]
731    #[non_exhaustive]
732    pub enum BucketOption {
733        /// Buckets with constant width.
734        LinearBuckets(std::boxed::Box<crate::model::distribution::LinearBuckets>),
735        /// Buckets with exponentially growing width.
736        ExponentialBuckets(std::boxed::Box<crate::model::distribution::ExponentialBuckets>),
737        /// Buckets with arbitrary user-provided width.
738        ExplicitBuckets(std::boxed::Box<crate::model::distribution::ExplicitBuckets>),
739    }
740}
741
742/// A common proto for logging HTTP requests. Only contains semantics
743/// defined by the HTTP specification. Product-specific logging
744/// information MUST be defined in a separate message.
745#[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    /// The request method. Examples: `"GET"`, `"HEAD"`, `"PUT"`, `"POST"`.
751    #[serde(skip_serializing_if = "std::string::String::is_empty")]
752    pub request_method: std::string::String,
753
754    /// The scheme (http, https), the host name, the path, and the query
755    /// portion of the URL that was requested.
756    /// Example: ``http://example.com/some/info?color=red``.
757    #[serde(skip_serializing_if = "std::string::String::is_empty")]
758    pub request_url: std::string::String,
759
760    /// The size of the HTTP request message in bytes, including the request
761    /// headers and the request body.
762    #[serde_as(as = "serde_with::DisplayFromStr")]
763    pub request_size: i64,
764
765    /// The response code indicating the status of the response.
766    /// Examples: 200, 404.
767    pub status: i32,
768
769    /// The size of the HTTP response message sent back to the client, in bytes,
770    /// including the response headers and the response body.
771    #[serde_as(as = "serde_with::DisplayFromStr")]
772    pub response_size: i64,
773
774    /// The user agent sent by the client. Example:
775    /// `"Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Q312461; .NET
776    /// CLR 1.0.3705)"`.
777    #[serde(skip_serializing_if = "std::string::String::is_empty")]
778    pub user_agent: std::string::String,
779
780    /// The IP address (IPv4 or IPv6) of the client that issued the HTTP
781    /// request. Examples: `"192.168.1.1"`, `"FE80::0202:B3FF:FE1E:8329"`.
782    #[serde(skip_serializing_if = "std::string::String::is_empty")]
783    pub remote_ip: std::string::String,
784
785    /// The IP address (IPv4 or IPv6) of the origin server that the request was
786    /// sent to.
787    #[serde(skip_serializing_if = "std::string::String::is_empty")]
788    pub server_ip: std::string::String,
789
790    /// The referer URL of the request, as defined in
791    /// [HTTP/1.1 Header Field
792    /// Definitions](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html).
793    #[serde(skip_serializing_if = "std::string::String::is_empty")]
794    pub referer: std::string::String,
795
796    /// The request processing latency on the server, from the time the request was
797    /// received until the response was sent.
798    #[serde(skip_serializing_if = "std::option::Option::is_none")]
799    pub latency: std::option::Option<wkt::Duration>,
800
801    /// Whether or not a cache lookup was attempted.
802    pub cache_lookup: bool,
803
804    /// Whether or not an entity was served from cache
805    /// (with or without validation).
806    pub cache_hit: bool,
807
808    /// Whether or not the response was validated with the origin server before
809    /// being served from cache. This field is only meaningful if `cache_hit` is
810    /// True.
811    pub cache_validated_with_origin_server: bool,
812
813    /// The number of HTTP response bytes inserted into cache. Set only when a
814    /// cache fill was attempted.
815    #[serde_as(as = "serde_with::DisplayFromStr")]
816    pub cache_fill_bytes: i64,
817
818    /// Protocol used for the request. Examples: "HTTP/1.1", "HTTP/2", "websocket"
819    #[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    /// Sets the value of [request_method][crate::model::HttpRequest::request_method].
832    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    /// Sets the value of [request_url][crate::model::HttpRequest::request_url].
838    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    /// Sets the value of [request_size][crate::model::HttpRequest::request_size].
844    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    /// Sets the value of [status][crate::model::HttpRequest::status].
850    pub fn set_status<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
851        self.status = v.into();
852        self
853    }
854
855    /// Sets the value of [response_size][crate::model::HttpRequest::response_size].
856    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    /// Sets the value of [user_agent][crate::model::HttpRequest::user_agent].
862    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    /// Sets the value of [remote_ip][crate::model::HttpRequest::remote_ip].
868    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    /// Sets the value of [server_ip][crate::model::HttpRequest::server_ip].
874    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    /// Sets the value of [referer][crate::model::HttpRequest::referer].
880    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    /// Sets the value of [latency][crate::model::HttpRequest::latency].
886    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    /// Sets the value of [cache_lookup][crate::model::HttpRequest::cache_lookup].
895    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    /// Sets the value of [cache_hit][crate::model::HttpRequest::cache_hit].
901    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    /// Sets the value of [cache_validated_with_origin_server][crate::model::HttpRequest::cache_validated_with_origin_server].
907    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    /// Sets the value of [cache_fill_bytes][crate::model::HttpRequest::cache_fill_bytes].
916    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    /// Sets the value of [protocol][crate::model::HttpRequest::protocol].
922    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/// An individual log entry.
935#[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    /// Required. The log to which this log entry belongs. Examples: `"syslog"`,
941    /// `"book_log"`.
942    #[serde(skip_serializing_if = "std::string::String::is_empty")]
943    pub name: std::string::String,
944
945    /// The time the event described by the log entry occurred. If
946    /// omitted, defaults to operation start time.
947    #[serde(skip_serializing_if = "std::option::Option::is_none")]
948    pub timestamp: std::option::Option<wkt::Timestamp>,
949
950    /// The severity of the log entry. The default value is
951    /// `LogSeverity.DEFAULT`.
952    pub severity: logging_type::model::LogSeverity,
953
954    /// Optional. Information about the HTTP request associated with this
955    /// log entry, if applicable.
956    #[serde(skip_serializing_if = "std::option::Option::is_none")]
957    pub http_request: std::option::Option<crate::model::HttpRequest>,
958
959    /// Optional. Resource name of the trace associated with the log entry, if any.
960    /// If this field contains a relative resource name, you can assume the name is
961    /// relative to `//tracing.googleapis.com`. Example:
962    /// `projects/my-projectid/traces/06796866738c859f2f19b7cfb3214824`
963    #[serde(skip_serializing_if = "std::string::String::is_empty")]
964    pub trace: std::string::String,
965
966    /// A unique ID for the log entry used for deduplication. If omitted,
967    /// the implementation will generate one based on operation_id.
968    #[serde(skip_serializing_if = "std::string::String::is_empty")]
969    pub insert_id: std::string::String,
970
971    /// A set of user-defined (key, value) data that provides additional
972    /// information about the log entry.
973    #[serde(skip_serializing_if = "std::collections::HashMap::is_empty")]
974    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
975
976    /// Optional. Information about an operation associated with the log entry, if
977    /// applicable.
978    #[serde(skip_serializing_if = "std::option::Option::is_none")]
979    pub operation: std::option::Option<crate::model::LogEntryOperation>,
980
981    /// Optional. Source code location information associated with the log entry,
982    /// if any.
983    #[serde(skip_serializing_if = "std::option::Option::is_none")]
984    pub source_location: std::option::Option<crate::model::LogEntrySourceLocation>,
985
986    /// The log entry payload, which can be one of multiple types.
987    #[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    /// Sets the value of [name][crate::model::LogEntry::name].
1000    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    /// Sets the value of [timestamp][crate::model::LogEntry::timestamp].
1006    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    /// Sets the value of [severity][crate::model::LogEntry::severity].
1015    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    /// Sets the value of [http_request][crate::model::LogEntry::http_request].
1024    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    /// Sets the value of [trace][crate::model::LogEntry::trace].
1035    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    /// Sets the value of [insert_id][crate::model::LogEntry::insert_id].
1041    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    /// Sets the value of [operation][crate::model::LogEntry::operation].
1047    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    /// Sets the value of [source_location][crate::model::LogEntry::source_location].
1058    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    /// Sets the value of [labels][crate::model::LogEntry::labels].
1069    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    /// Sets the value of [payload][crate::model::LogEntry::payload].
1081    ///
1082    /// Note that all the setters affecting `payload` are mutually
1083    /// exclusive.
1084    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    /// The value of [payload][crate::model::LogEntry::payload]
1095    /// if it holds a `ProtoPayload`, `None` if the field is not set or
1096    /// holds a different branch.
1097    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    /// The value of [payload][crate::model::LogEntry::payload]
1106    /// if it holds a `TextPayload`, `None` if the field is not set or
1107    /// holds a different branch.
1108    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    /// The value of [payload][crate::model::LogEntry::payload]
1117    /// if it holds a `StructPayload`, `None` if the field is not set or
1118    /// holds a different branch.
1119    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    /// Sets the value of [payload][crate::model::LogEntry::payload]
1128    /// to hold a `ProtoPayload`.
1129    ///
1130    /// Note that all the setters affecting `payload` are
1131    /// mutually exclusive.
1132    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    /// Sets the value of [payload][crate::model::LogEntry::payload]
1142    /// to hold a `TextPayload`.
1143    ///
1144    /// Note that all the setters affecting `payload` are
1145    /// mutually exclusive.
1146    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    /// Sets the value of [payload][crate::model::LogEntry::payload]
1153    /// to hold a `StructPayload`.
1154    ///
1155    /// Note that all the setters affecting `payload` are
1156    /// mutually exclusive.
1157    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
1173/// Defines additional types related to [LogEntry].
1174pub mod log_entry {
1175    #[allow(unused_imports)]
1176    use super::*;
1177
1178    /// The log entry payload, which can be one of multiple types.
1179    #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
1180    #[serde(rename_all = "camelCase")]
1181    #[non_exhaustive]
1182    pub enum Payload {
1183        /// The log entry payload, represented as a protocol buffer that is
1184        /// expressed as a JSON object. The only accepted type currently is
1185        /// [AuditLog][google.cloud.audit.AuditLog].
1186        ProtoPayload(std::boxed::Box<wkt::Any>),
1187        /// The log entry payload, represented as a Unicode string (UTF-8).
1188        TextPayload(std::string::String),
1189        /// The log entry payload, represented as a structure that
1190        /// is expressed as a JSON object.
1191        StructPayload(std::boxed::Box<wkt::Struct>),
1192    }
1193}
1194
1195/// Additional information about a potentially long-running operation with which
1196/// a log entry is associated.
1197#[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    /// Optional. An arbitrary operation identifier. Log entries with the
1203    /// same identifier are assumed to be part of the same operation.
1204    #[serde(skip_serializing_if = "std::string::String::is_empty")]
1205    pub id: std::string::String,
1206
1207    /// Optional. An arbitrary producer identifier. The combination of
1208    /// `id` and `producer` must be globally unique.  Examples for `producer`:
1209    /// `"MyDivision.MyBigCompany.com"`, `"github.com/MyProject/MyApplication"`.
1210    #[serde(skip_serializing_if = "std::string::String::is_empty")]
1211    pub producer: std::string::String,
1212
1213    /// Optional. Set this to True if this is the first log entry in the operation.
1214    pub first: bool,
1215
1216    /// Optional. Set this to True if this is the last log entry in the operation.
1217    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    /// Sets the value of [id][crate::model::LogEntryOperation::id].
1229    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    /// Sets the value of [producer][crate::model::LogEntryOperation::producer].
1235    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    /// Sets the value of [first][crate::model::LogEntryOperation::first].
1241    pub fn set_first<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1242        self.first = v.into();
1243        self
1244    }
1245
1246    /// Sets the value of [last][crate::model::LogEntryOperation::last].
1247    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/// Additional information about the source code location that produced the log
1260/// entry.
1261#[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    /// Optional. Source file name. Depending on the runtime environment, this
1267    /// might be a simple name or a fully-qualified name.
1268    #[serde(skip_serializing_if = "std::string::String::is_empty")]
1269    pub file: std::string::String,
1270
1271    /// Optional. Line within the source file. 1-based; 0 indicates no line number
1272    /// available.
1273    #[serde_as(as = "serde_with::DisplayFromStr")]
1274    pub line: i64,
1275
1276    /// Optional. Human-readable name of the function or method being invoked, with
1277    /// optional context such as the class or package name. This information may be
1278    /// used in contexts such as the logs viewer, where a file and line number are
1279    /// less meaningful. The format can vary by language. For example:
1280    /// `qual.if.ied.Class.method` (Java), `dir/package.func` (Go), `function`
1281    /// (Python).
1282    #[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    /// Sets the value of [file][crate::model::LogEntrySourceLocation::file].
1295    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    /// Sets the value of [line][crate::model::LogEntrySourceLocation::line].
1301    pub fn set_line<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
1302        self.line = v.into();
1303        self
1304    }
1305
1306    /// Sets the value of [function][crate::model::LogEntrySourceLocation::function].
1307    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/// Represents a single metric value.
1320#[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    /// The labels describing the metric value.
1326    /// See comments on [google.api.servicecontrol.v1.Operation.labels][google.api.servicecontrol.v1.Operation.labels] for
1327    /// the overriding relationship.
1328    /// Note that this map must not contain monitored resource labels.
1329    ///
1330    /// [google.api.servicecontrol.v1.Operation.labels]: crate::model::Operation::labels
1331    #[serde(skip_serializing_if = "std::collections::HashMap::is_empty")]
1332    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
1333
1334    /// The start of the time period over which this metric value's measurement
1335    /// applies. The time period has different semantics for different metric
1336    /// types (cumulative, delta, and gauge). See the metric definition
1337    /// documentation in the service configuration for details. If not specified,
1338    /// [google.api.servicecontrol.v1.Operation.start_time][google.api.servicecontrol.v1.Operation.start_time] will be used.
1339    ///
1340    /// [google.api.servicecontrol.v1.Operation.start_time]: crate::model::Operation::start_time
1341    #[serde(skip_serializing_if = "std::option::Option::is_none")]
1342    pub start_time: std::option::Option<wkt::Timestamp>,
1343
1344    /// The end of the time period over which this metric value's measurement
1345    /// applies.  If not specified,
1346    /// [google.api.servicecontrol.v1.Operation.end_time][google.api.servicecontrol.v1.Operation.end_time] will be used.
1347    ///
1348    /// [google.api.servicecontrol.v1.Operation.end_time]: crate::model::Operation::end_time
1349    #[serde(skip_serializing_if = "std::option::Option::is_none")]
1350    pub end_time: std::option::Option<wkt::Timestamp>,
1351
1352    /// The value. The type of value used in the request must
1353    /// agree with the metric definition in the service configuration, otherwise
1354    /// the MetricValue is rejected.
1355    #[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    /// Sets the value of [start_time][crate::model::MetricValue::start_time].
1368    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    /// Sets the value of [end_time][crate::model::MetricValue::end_time].
1377    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    /// Sets the value of [labels][crate::model::MetricValue::labels].
1386    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    /// Sets the value of [value][crate::model::MetricValue::value].
1398    ///
1399    /// Note that all the setters affecting `value` are mutually
1400    /// exclusive.
1401    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    /// The value of [value][crate::model::MetricValue::value]
1412    /// if it holds a `BoolValue`, `None` if the field is not set or
1413    /// holds a different branch.
1414    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    /// The value of [value][crate::model::MetricValue::value]
1423    /// if it holds a `Int64Value`, `None` if the field is not set or
1424    /// holds a different branch.
1425    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    /// The value of [value][crate::model::MetricValue::value]
1434    /// if it holds a `DoubleValue`, `None` if the field is not set or
1435    /// holds a different branch.
1436    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    /// The value of [value][crate::model::MetricValue::value]
1445    /// if it holds a `StringValue`, `None` if the field is not set or
1446    /// holds a different branch.
1447    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    /// The value of [value][crate::model::MetricValue::value]
1456    /// if it holds a `DistributionValue`, `None` if the field is not set or
1457    /// holds a different branch.
1458    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    /// Sets the value of [value][crate::model::MetricValue::value]
1469    /// to hold a `BoolValue`.
1470    ///
1471    /// Note that all the setters affecting `value` are
1472    /// mutually exclusive.
1473    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    /// Sets the value of [value][crate::model::MetricValue::value]
1480    /// to hold a `Int64Value`.
1481    ///
1482    /// Note that all the setters affecting `value` are
1483    /// mutually exclusive.
1484    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    /// Sets the value of [value][crate::model::MetricValue::value]
1491    /// to hold a `DoubleValue`.
1492    ///
1493    /// Note that all the setters affecting `value` are
1494    /// mutually exclusive.
1495    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    /// Sets the value of [value][crate::model::MetricValue::value]
1502    /// to hold a `StringValue`.
1503    ///
1504    /// Note that all the setters affecting `value` are
1505    /// mutually exclusive.
1506    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    /// Sets the value of [value][crate::model::MetricValue::value]
1513    /// to hold a `DistributionValue`.
1514    ///
1515    /// Note that all the setters affecting `value` are
1516    /// mutually exclusive.
1517    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
1536/// Defines additional types related to [MetricValue].
1537pub mod metric_value {
1538    #[allow(unused_imports)]
1539    use super::*;
1540
1541    /// The value. The type of value used in the request must
1542    /// agree with the metric definition in the service configuration, otherwise
1543    /// the MetricValue is rejected.
1544    #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
1545    #[serde(rename_all = "camelCase")]
1546    #[non_exhaustive]
1547    pub enum Value {
1548        /// A boolean value.
1549        BoolValue(bool),
1550        /// A signed 64-bit integer value.
1551        Int64Value(i64),
1552        /// A double precision floating point value.
1553        DoubleValue(f64),
1554        /// A text string value.
1555        StringValue(std::string::String),
1556        /// A distribution value.
1557        DistributionValue(std::boxed::Box<crate::model::Distribution>),
1558    }
1559}
1560
1561/// Represents a set of metric values in the same metric.
1562/// Each metric value in the set should have a unique combination of start time,
1563/// end time, and label values.
1564#[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    /// The metric name defined in the service configuration.
1570    #[serde(skip_serializing_if = "std::string::String::is_empty")]
1571    pub metric_name: std::string::String,
1572
1573    /// The values in this metric.
1574    #[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    /// Sets the value of [metric_name][crate::model::MetricValueSet::metric_name].
1587    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    /// Sets the value of [metric_values][crate::model::MetricValueSet::metric_values].
1593    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/// Represents information regarding an operation.
1611#[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    /// Identity of the operation. This must be unique within the scope of the
1617    /// service that generated the operation. If the service calls
1618    /// Check() and Report() on the same operation, the two calls should carry
1619    /// the same id.
1620    ///
1621    /// UUID version 4 is recommended, though not required.
1622    /// In scenarios where an operation is computed from existing information
1623    /// and an idempotent id is desirable for deduplication purpose, UUID version 5
1624    /// is recommended. See RFC 4122 for details.
1625    #[serde(skip_serializing_if = "std::string::String::is_empty")]
1626    pub operation_id: std::string::String,
1627
1628    /// Fully qualified name of the operation. Reserved for future use.
1629    #[serde(skip_serializing_if = "std::string::String::is_empty")]
1630    pub operation_name: std::string::String,
1631
1632    /// Identity of the consumer who is using the service.
1633    /// This field should be filled in for the operations initiated by a
1634    /// consumer, but not for service-initiated operations that are
1635    /// not related to a specific consumer.
1636    ///
1637    /// - This can be in one of the following formats:
1638    ///   - project:PROJECT_ID,
1639    ///   - project`_`number:PROJECT_NUMBER,
1640    ///   - projects/PROJECT_ID or PROJECT_NUMBER,
1641    ///   - folders/FOLDER_NUMBER,
1642    ///   - organizations/ORGANIZATION_NUMBER,
1643    ///   - api`_`key:API_KEY.
1644    #[serde(skip_serializing_if = "std::string::String::is_empty")]
1645    pub consumer_id: std::string::String,
1646
1647    /// Required. Start time of the operation.
1648    #[serde(skip_serializing_if = "std::option::Option::is_none")]
1649    pub start_time: std::option::Option<wkt::Timestamp>,
1650
1651    /// End time of the operation.
1652    /// Required when the operation is used in
1653    /// [ServiceController.Report][google.api.servicecontrol.v1.ServiceController.Report],
1654    /// but optional when the operation is used in
1655    /// [ServiceController.Check][google.api.servicecontrol.v1.ServiceController.Check].
1656    ///
1657    /// [google.api.servicecontrol.v1.ServiceController.Check]: crate::client::ServiceController::check
1658    /// [google.api.servicecontrol.v1.ServiceController.Report]: crate::client::ServiceController::report
1659    #[serde(skip_serializing_if = "std::option::Option::is_none")]
1660    pub end_time: std::option::Option<wkt::Timestamp>,
1661
1662    /// Labels describing the operation. Only the following labels are allowed:
1663    ///
1664    /// - Labels describing monitored resources as defined in
1665    ///   the service configuration.
1666    /// - Default labels of metric values. When specified, labels defined in the
1667    ///   metric value override these default.
1668    /// - The following labels defined by Google Cloud Platform:
1669    ///   - `cloud.googleapis.com/location` describing the location where the
1670    ///     operation happened,
1671    ///   - `servicecontrol.googleapis.com/user_agent` describing the user agent
1672    ///     of the API request,
1673    ///   - `servicecontrol.googleapis.com/service_agent` describing the service
1674    ///     used to handle the API request (e.g. ESP),
1675    ///   - `servicecontrol.googleapis.com/platform` describing the platform
1676    ///     where the API is served, such as App Engine, Compute Engine, or
1677    ///     Kubernetes Engine.
1678    #[serde(skip_serializing_if = "std::collections::HashMap::is_empty")]
1679    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
1680
1681    /// Represents information about this operation. Each MetricValueSet
1682    /// corresponds to a metric defined in the service configuration.
1683    /// The data type used in the MetricValueSet must agree with
1684    /// the data type specified in the metric definition.
1685    ///
1686    /// Within a single operation, it is not allowed to have more than one
1687    /// MetricValue instances that have the same metric names and identical
1688    /// label value combinations. If a request has such duplicated MetricValue
1689    /// instances, the entire request is rejected with
1690    /// an invalid argument error.
1691    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
1692    pub metric_value_sets: std::vec::Vec<crate::model::MetricValueSet>,
1693
1694    /// Represents information to be logged.
1695    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
1696    pub log_entries: std::vec::Vec<crate::model::LogEntry>,
1697
1698    /// DO NOT USE. This is an experimental field.
1699    pub importance: crate::model::operation::Importance,
1700
1701    /// Unimplemented.
1702    #[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    /// Sets the value of [operation_id][crate::model::Operation::operation_id].
1715    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    /// Sets the value of [operation_name][crate::model::Operation::operation_name].
1721    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    /// Sets the value of [consumer_id][crate::model::Operation::consumer_id].
1727    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    /// Sets the value of [start_time][crate::model::Operation::start_time].
1733    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    /// Sets the value of [end_time][crate::model::Operation::end_time].
1742    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    /// Sets the value of [importance][crate::model::Operation::importance].
1751    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    /// Sets the value of [metric_value_sets][crate::model::Operation::metric_value_sets].
1760    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    /// Sets the value of [log_entries][crate::model::Operation::log_entries].
1771    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    /// Sets the value of [extensions][crate::model::Operation::extensions].
1782    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    /// Sets the value of [labels][crate::model::Operation::labels].
1793    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
1811/// Defines additional types related to [Operation].
1812pub mod operation {
1813    #[allow(unused_imports)]
1814    use super::*;
1815
1816    /// Defines the importance of the data contained in the operation.
1817    #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
1818    pub struct Importance(i32);
1819
1820    impl Importance {
1821        /// Allows data caching, batching, and aggregation. It provides
1822        /// higher performance with higher data loss risk.
1823        pub const LOW: Importance = Importance::new(0);
1824
1825        /// Disables data aggregation to minimize data loss. It is for operations
1826        /// that contains significant monetary value or audit trail. This feature
1827        /// only applies to the client libraries.
1828        pub const HIGH: Importance = Importance::new(1);
1829
1830        /// Creates a new Importance instance.
1831        pub(crate) const fn new(value: i32) -> Self {
1832            Self(value)
1833        }
1834
1835        /// Gets the enum value.
1836        pub fn value(&self) -> i32 {
1837            self.0
1838        }
1839
1840        /// Gets the enum value as a string.
1841        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        /// Creates an enum value from the value name.
1850        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/// Request message for the AllocateQuota method.
1873#[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    /// Name of the service as specified in the service configuration. For example,
1879    /// `"pubsub.googleapis.com"`.
1880    ///
1881    /// See [google.api.Service][google.api.Service] for the definition of a service name.
1882    #[serde(skip_serializing_if = "std::string::String::is_empty")]
1883    pub service_name: std::string::String,
1884
1885    /// Operation that describes the quota allocation.
1886    #[serde(skip_serializing_if = "std::option::Option::is_none")]
1887    pub allocate_operation: std::option::Option<crate::model::QuotaOperation>,
1888
1889    /// Specifies which version of service configuration should be used to process
1890    /// the request. If unspecified or no matching version can be found, the latest
1891    /// one will be used.
1892    #[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    /// Sets the value of [service_name][crate::model::AllocateQuotaRequest::service_name].
1905    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    /// Sets the value of [allocate_operation][crate::model::AllocateQuotaRequest::allocate_operation].
1911    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    /// Sets the value of [service_config_id][crate::model::AllocateQuotaRequest::service_config_id].
1922    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/// Represents information regarding a quota operation.
1938#[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    /// Identity of the operation. This is expected to be unique within the scope
1944    /// of the service that generated the operation, and guarantees idempotency in
1945    /// case of retries.
1946    ///
1947    /// In order to ensure best performance and latency in the Quota backends,
1948    /// operation_ids are optimally associated with time, so that related
1949    /// operations can be accessed fast in storage. For this reason, the
1950    /// recommended token for services that intend to operate at a high QPS is
1951    /// Unix time in nanos + UUID
1952    #[serde(skip_serializing_if = "std::string::String::is_empty")]
1953    pub operation_id: std::string::String,
1954
1955    /// Fully qualified name of the API method for which this quota operation is
1956    /// requested. This name is used for matching quota rules or metric rules and
1957    /// billing status rules defined in service configuration.
1958    ///
1959    /// This field should not be set if any of the following is true:
1960    /// (1) the quota operation is performed on non-API resources.
1961    /// (2) quota_metrics is set because the caller is doing quota override.
1962    ///
1963    /// Example of an RPC method name:
1964    /// google.example.library.v1.LibraryService.CreateShelf
1965    #[serde(skip_serializing_if = "std::string::String::is_empty")]
1966    pub method_name: std::string::String,
1967
1968    /// Identity of the consumer for whom this quota operation is being performed.
1969    ///
1970    /// This can be in one of the following formats:
1971    /// project:<project_id>,
1972    /// project_number:<project_number>,
1973    /// api_key:<api_key>.
1974    #[serde(skip_serializing_if = "std::string::String::is_empty")]
1975    pub consumer_id: std::string::String,
1976
1977    /// Labels describing the operation.
1978    #[serde(skip_serializing_if = "std::collections::HashMap::is_empty")]
1979    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
1980
1981    /// Represents information about this operation. Each MetricValueSet
1982    /// corresponds to a metric defined in the service configuration.
1983    /// The data type used in the MetricValueSet must agree with
1984    /// the data type specified in the metric definition.
1985    ///
1986    /// Within a single operation, it is not allowed to have more than one
1987    /// MetricValue instances that have the same metric names and identical
1988    /// label value combinations. If a request has such duplicated MetricValue
1989    /// instances, the entire request is rejected with
1990    /// an invalid argument error.
1991    ///
1992    /// This field is mutually exclusive with method_name.
1993    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
1994    pub quota_metrics: std::vec::Vec<crate::model::MetricValueSet>,
1995
1996    /// Quota mode for this operation.
1997    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    /// Sets the value of [operation_id][crate::model::QuotaOperation::operation_id].
2009    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    /// Sets the value of [method_name][crate::model::QuotaOperation::method_name].
2015    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    /// Sets the value of [consumer_id][crate::model::QuotaOperation::consumer_id].
2021    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    /// Sets the value of [quota_mode][crate::model::QuotaOperation::quota_mode].
2027    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    /// Sets the value of [quota_metrics][crate::model::QuotaOperation::quota_metrics].
2036    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    /// Sets the value of [labels][crate::model::QuotaOperation::labels].
2047    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
2065/// Defines additional types related to [QuotaOperation].
2066pub mod quota_operation {
2067    #[allow(unused_imports)]
2068    use super::*;
2069
2070    /// Supported quota modes.
2071    #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
2072    pub struct QuotaMode(i32);
2073
2074    impl QuotaMode {
2075        /// Guard against implicit default. Must not be used.
2076        pub const UNSPECIFIED: QuotaMode = QuotaMode::new(0);
2077
2078        /// For AllocateQuota request, allocates quota for the amount specified in
2079        /// the service configuration or specified using the quota metrics. If the
2080        /// amount is higher than the available quota, allocation error will be
2081        /// returned and no quota will be allocated.
2082        /// If multiple quotas are part of the request, and one fails, none of the
2083        /// quotas are allocated or released.
2084        pub const NORMAL: QuotaMode = QuotaMode::new(1);
2085
2086        /// The operation allocates quota for the amount specified in the service
2087        /// configuration or specified using the quota metrics. If the amount is
2088        /// higher than the available quota, request does not fail but all available
2089        /// quota will be allocated.
2090        /// For rate quota, BEST_EFFORT will continue to deduct from other groups
2091        /// even if one does not have enough quota. For allocation, it will find the
2092        /// minimum available amount across all groups and deduct that amount from
2093        /// all the affected groups.
2094        pub const BEST_EFFORT: QuotaMode = QuotaMode::new(2);
2095
2096        /// For AllocateQuota request, only checks if there is enough quota
2097        /// available and does not change the available quota. No lock is placed on
2098        /// the available quota either.
2099        pub const CHECK_ONLY: QuotaMode = QuotaMode::new(3);
2100
2101        /// Unimplemented. When used in AllocateQuotaRequest, this returns the
2102        /// effective quota limit(s) in the response, and no quota check will be
2103        /// performed. Not supported for other requests, and even for
2104        /// AllocateQuotaRequest, this is currently supported only for allowlisted
2105        /// services.
2106        pub const QUERY_ONLY: QuotaMode = QuotaMode::new(4);
2107
2108        /// The operation allocates quota for the amount specified in the service
2109        /// configuration or specified using the quota metrics. If the requested
2110        /// amount is higher than the available quota, request does not fail and
2111        /// remaining quota would become negative (going over the limit).
2112        /// Not supported for Rate Quota.
2113        pub const ADJUST_ONLY: QuotaMode = QuotaMode::new(5);
2114
2115        /// Creates a new QuotaMode instance.
2116        pub(crate) const fn new(value: i32) -> Self {
2117            Self(value)
2118        }
2119
2120        /// Gets the enum value.
2121        pub fn value(&self) -> i32 {
2122            self.0
2123        }
2124
2125        /// Gets the enum value as a string.
2126        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        /// Creates an enum value from the value name.
2139        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/// Response message for the AllocateQuota method.
2166#[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    /// The same operation_id value used in the AllocateQuotaRequest. Used for
2172    /// logging and diagnostics purposes.
2173    #[serde(skip_serializing_if = "std::string::String::is_empty")]
2174    pub operation_id: std::string::String,
2175
2176    /// Indicates the decision of the allocate.
2177    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
2178    pub allocate_errors: std::vec::Vec<crate::model::QuotaError>,
2179
2180    /// Quota metrics to indicate the result of allocation. Depending on the
2181    /// request, one or more of the following metrics will be included:
2182    ///
2183    /// . Per quota group or per quota metric incremental usage will be specified
2184    ///   using the following delta metric :
2185    ///   "serviceruntime.googleapis.com/api/consumer/quota_used_count"
2186    ///
2187    /// . The quota limit reached condition will be specified using the following
2188    ///   boolean metric :
2189    ///   "serviceruntime.googleapis.com/quota/exceeded"
2190    ///
2191    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
2192    pub quota_metrics: std::vec::Vec<crate::model::MetricValueSet>,
2193
2194    /// ID of the actual config used to process the request.
2195    #[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    /// Sets the value of [operation_id][crate::model::AllocateQuotaResponse::operation_id].
2208    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    /// Sets the value of [service_config_id][crate::model::AllocateQuotaResponse::service_config_id].
2214    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    /// Sets the value of [allocate_errors][crate::model::AllocateQuotaResponse::allocate_errors].
2223    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    /// Sets the value of [quota_metrics][crate::model::AllocateQuotaResponse::quota_metrics].
2234    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/// Represents error information for [QuotaOperation][google.api.servicecontrol.v1.QuotaOperation].
2252///
2253/// [google.api.servicecontrol.v1.QuotaOperation]: crate::model::QuotaOperation
2254#[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    /// Error code.
2260    pub code: crate::model::quota_error::Code,
2261
2262    /// Subject to whom this error applies. See the specific enum for more details
2263    /// on this field. For example, "clientip:\<ip address of client\>" or
2264    /// "project:\<Google developer project id\>".
2265    #[serde(skip_serializing_if = "std::string::String::is_empty")]
2266    pub subject: std::string::String,
2267
2268    /// Free-form text that provides details on the cause of the error.
2269    #[serde(skip_serializing_if = "std::string::String::is_empty")]
2270    pub description: std::string::String,
2271
2272    /// Contains additional information about the quota error.
2273    /// If available, `status.code` will be non zero.
2274    #[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    /// Sets the value of [code][crate::model::QuotaError::code].
2287    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    /// Sets the value of [subject][crate::model::QuotaError::subject].
2296    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    /// Sets the value of [description][crate::model::QuotaError::description].
2302    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    /// Sets the value of [status][crate::model::QuotaError::status].
2308    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
2323/// Defines additional types related to [QuotaError].
2324pub mod quota_error {
2325    #[allow(unused_imports)]
2326    use super::*;
2327
2328    /// Error codes related to project config validations are deprecated since the
2329    /// quota controller methods do not perform these validations. Instead services
2330    /// have to call the Check method, without quota_properties field, to perform
2331    /// these validations before calling the quota controller methods. These
2332    /// methods check only for project deletion to be wipe out compliant.
2333    #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
2334    pub struct Code(i32);
2335
2336    impl Code {
2337        /// This is never used.
2338        pub const UNSPECIFIED: Code = Code::new(0);
2339
2340        /// Quota allocation failed.
2341        /// Same as [google.rpc.Code.RESOURCE_EXHAUSTED][google.rpc.Code.RESOURCE_EXHAUSTED].
2342        pub const RESOURCE_EXHAUSTED: Code = Code::new(8);
2343
2344        /// Consumer cannot access the service because the service requires active
2345        /// billing.
2346        pub const BILLING_NOT_ACTIVE: Code = Code::new(107);
2347
2348        /// Consumer's project has been marked as deleted (soft deletion).
2349        pub const PROJECT_DELETED: Code = Code::new(108);
2350
2351        /// Specified API key is invalid.
2352        pub const API_KEY_INVALID: Code = Code::new(105);
2353
2354        /// Specified API Key has expired.
2355        pub const API_KEY_EXPIRED: Code = Code::new(112);
2356
2357        /// Creates a new Code instance.
2358        pub(crate) const fn new(value: i32) -> Self {
2359            Self(value)
2360        }
2361
2362        /// Gets the enum value.
2363        pub fn value(&self) -> i32 {
2364            self.0
2365        }
2366
2367        /// Gets the enum value as a string.
2368        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        /// Creates an enum value from the value name.
2381        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/// Request message for the Check method.
2408#[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    /// The service name as specified in its service configuration. For example,
2414    /// `"pubsub.googleapis.com"`.
2415    ///
2416    /// See
2417    /// [google.api.Service](https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service)
2418    /// for the definition of a service name.
2419    #[serde(skip_serializing_if = "std::string::String::is_empty")]
2420    pub service_name: std::string::String,
2421
2422    /// The operation to be checked.
2423    #[serde(skip_serializing_if = "std::option::Option::is_none")]
2424    pub operation: std::option::Option<crate::model::Operation>,
2425
2426    /// Specifies which version of service configuration should be used to process
2427    /// the request.
2428    ///
2429    /// If unspecified or no matching version can be found, the
2430    /// latest one will be used.
2431    #[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    /// Sets the value of [service_name][crate::model::CheckRequest::service_name].
2444    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    /// Sets the value of [operation][crate::model::CheckRequest::operation].
2450    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    /// Sets the value of [service_config_id][crate::model::CheckRequest::service_config_id].
2459    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/// Response message for the Check method.
2475#[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    /// The same operation_id value used in the
2481    /// [CheckRequest][google.api.servicecontrol.v1.CheckRequest]. Used for logging
2482    /// and diagnostics purposes.
2483    ///
2484    /// [google.api.servicecontrol.v1.CheckRequest]: crate::model::CheckRequest
2485    #[serde(skip_serializing_if = "std::string::String::is_empty")]
2486    pub operation_id: std::string::String,
2487
2488    /// Indicate the decision of the check.
2489    ///
2490    /// If no check errors are present, the service should process the operation.
2491    /// Otherwise the service should use the list of errors to determine the
2492    /// appropriate action.
2493    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
2494    pub check_errors: std::vec::Vec<crate::model::CheckError>,
2495
2496    /// The actual config id used to process the request.
2497    #[serde(skip_serializing_if = "std::string::String::is_empty")]
2498    pub service_config_id: std::string::String,
2499
2500    /// The current service rollout id used to process the request.
2501    #[serde(skip_serializing_if = "std::string::String::is_empty")]
2502    pub service_rollout_id: std::string::String,
2503
2504    /// Feedback data returned from the server during processing a Check request.
2505    #[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    /// Sets the value of [operation_id][crate::model::CheckResponse::operation_id].
2518    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    /// Sets the value of [service_config_id][crate::model::CheckResponse::service_config_id].
2524    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    /// Sets the value of [service_rollout_id][crate::model::CheckResponse::service_rollout_id].
2533    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    /// Sets the value of [check_info][crate::model::CheckResponse::check_info].
2542    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    /// Sets the value of [check_errors][crate::model::CheckResponse::check_errors].
2553    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
2570/// Defines additional types related to [CheckResponse].
2571pub mod check_response {
2572    #[allow(unused_imports)]
2573    use super::*;
2574
2575    /// Contains additional information about the check operation.
2576    #[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        /// A list of fields and label keys that are ignored by the server.
2582        /// The client doesn't need to send them for following requests to improve
2583        /// performance and allow better aggregation.
2584        #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
2585        pub unused_arguments: std::vec::Vec<std::string::String>,
2586
2587        /// Consumer info of this check.
2588        #[serde(skip_serializing_if = "std::option::Option::is_none")]
2589        pub consumer_info: std::option::Option<crate::model::check_response::ConsumerInfo>,
2590
2591        /// The unique id of the api key in the format of "apikey:\<UID\>".
2592        /// This field will be populated when the consumer passed to Service Control
2593        /// is an API key and all the API key related validations are successful.
2594        #[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        /// Sets the value of [consumer_info][crate::model::check_response::CheckInfo::consumer_info].
2607        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        /// Sets the value of [api_key_uid][crate::model::check_response::CheckInfo::api_key_uid].
2618        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        /// Sets the value of [unused_arguments][crate::model::check_response::CheckInfo::unused_arguments].
2624        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    /// `ConsumerInfo` provides information about the consumer.
2642    #[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        /// The Google cloud project number, e.g. 1234567890. A value of 0 indicates
2648        /// no project number is found.
2649        ///
2650        /// NOTE: This field is deprecated after we support flexible consumer
2651        /// id. New code should not depend on this field anymore.
2652        #[serde_as(as = "serde_with::DisplayFromStr")]
2653        pub project_number: i64,
2654
2655        /// The type of the consumer which should have been defined in
2656        /// [Google Resource Manager](https://cloud.google.com/resource-manager/).
2657        #[serde(rename = "type")]
2658        pub r#type: crate::model::check_response::consumer_info::ConsumerType,
2659
2660        /// The consumer identity number, can be Google cloud project number, folder
2661        /// number or organization number e.g. 1234567890. A value of 0 indicates no
2662        /// consumer number is found.
2663        #[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        /// Sets the value of [project_number][crate::model::check_response::ConsumerInfo::project_number].
2676        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        /// Sets the value of [r#type][crate::model::check_response::ConsumerInfo::type].
2682        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        /// Sets the value of [consumer_number][crate::model::check_response::ConsumerInfo::consumer_number].
2693        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    /// Defines additional types related to [ConsumerInfo].
2706    pub mod consumer_info {
2707        #[allow(unused_imports)]
2708        use super::*;
2709
2710        /// The type of the consumer as defined in
2711        /// [Google Resource Manager](https://cloud.google.com/resource-manager/).
2712        #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
2713        pub struct ConsumerType(i32);
2714
2715        impl ConsumerType {
2716            /// This is never used.
2717            pub const CONSUMER_TYPE_UNSPECIFIED: ConsumerType = ConsumerType::new(0);
2718
2719            /// The consumer is a Google Cloud Project.
2720            pub const PROJECT: ConsumerType = ConsumerType::new(1);
2721
2722            /// The consumer is a Google Cloud Folder.
2723            pub const FOLDER: ConsumerType = ConsumerType::new(2);
2724
2725            /// The consumer is a Google Cloud Organization.
2726            pub const ORGANIZATION: ConsumerType = ConsumerType::new(3);
2727
2728            /// Service-specific resource container which is defined by the service
2729            /// producer to offer their users the ability to manage service control
2730            /// functionalities at a finer level of granularity than the PROJECT.
2731            pub const SERVICE_SPECIFIC: ConsumerType = ConsumerType::new(4);
2732
2733            /// Creates a new ConsumerType instance.
2734            pub(crate) const fn new(value: i32) -> Self {
2735                Self(value)
2736            }
2737
2738            /// Gets the enum value.
2739            pub fn value(&self) -> i32 {
2740                self.0
2741            }
2742
2743            /// Gets the enum value as a string.
2744            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            /// Creates an enum value from the value name.
2756            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/// Request message for the Report method.
2785#[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    /// The service name as specified in its service configuration. For example,
2791    /// `"pubsub.googleapis.com"`.
2792    ///
2793    /// See
2794    /// [google.api.Service](https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service)
2795    /// for the definition of a service name.
2796    #[serde(skip_serializing_if = "std::string::String::is_empty")]
2797    pub service_name: std::string::String,
2798
2799    /// Operations to be reported.
2800    ///
2801    /// Typically the service should report one operation per request.
2802    /// Putting multiple operations into a single request is allowed, but should
2803    /// be used only when multiple operations are natually available at the time
2804    /// of the report.
2805    ///
2806    /// There is no limit on the number of operations in the same ReportRequest,
2807    /// however the ReportRequest size should be no larger than 1MB. See
2808    /// [ReportResponse.report_errors][google.api.servicecontrol.v1.ReportResponse.report_errors]
2809    /// for partial failure behavior.
2810    ///
2811    /// [google.api.servicecontrol.v1.ReportResponse.report_errors]: crate::model::ReportResponse::report_errors
2812    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
2813    pub operations: std::vec::Vec<crate::model::Operation>,
2814
2815    /// Specifies which version of service config should be used to process the
2816    /// request.
2817    ///
2818    /// If unspecified or no matching version can be found, the
2819    /// latest one will be used.
2820    #[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    /// Sets the value of [service_name][crate::model::ReportRequest::service_name].
2833    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    /// Sets the value of [service_config_id][crate::model::ReportRequest::service_config_id].
2839    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    /// Sets the value of [operations][crate::model::ReportRequest::operations].
2848    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/// Response message for the Report method.
2866#[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    /// Partial failures, one for each `Operation` in the request that failed
2872    /// processing. There are three possible combinations of the RPC status:
2873    ///
2874    /// . The combination of a successful RPC status and an empty `report_errors`
2875    ///   list indicates a complete success where all `Operations` in the
2876    ///   request are processed successfully.
2877    /// . The combination of a successful RPC status and a non-empty
2878    ///   `report_errors` list indicates a partial success where some
2879    ///   `Operations` in the request succeeded. Each
2880    ///   `Operation` that failed processing has a corresponding item
2881    ///   in this list.
2882    /// . A failed RPC status indicates a general non-deterministic failure.
2883    ///   When this happens, it's impossible to know which of the
2884    ///   'Operations' in the request succeeded or failed.
2885    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
2886    pub report_errors: std::vec::Vec<crate::model::report_response::ReportError>,
2887
2888    /// The actual config id used to process the request.
2889    #[serde(skip_serializing_if = "std::string::String::is_empty")]
2890    pub service_config_id: std::string::String,
2891
2892    /// The current service rollout id used to process the request.
2893    #[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    /// Sets the value of [service_config_id][crate::model::ReportResponse::service_config_id].
2906    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    /// Sets the value of [service_rollout_id][crate::model::ReportResponse::service_rollout_id].
2915    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    /// Sets the value of [report_errors][crate::model::ReportResponse::report_errors].
2924    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
2941/// Defines additional types related to [ReportResponse].
2942pub mod report_response {
2943    #[allow(unused_imports)]
2944    use super::*;
2945
2946    /// Represents the processing error of one
2947    /// [Operation][google.api.servicecontrol.v1.Operation] in the request.
2948    ///
2949    /// [google.api.servicecontrol.v1.Operation]: crate::model::Operation
2950    #[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        /// The
2956        /// [Operation.operation_id][google.api.servicecontrol.v1.Operation.operation_id]
2957        /// value from the request.
2958        ///
2959        /// [google.api.servicecontrol.v1.Operation.operation_id]: crate::model::Operation::operation_id
2960        #[serde(skip_serializing_if = "std::string::String::is_empty")]
2961        pub operation_id: std::string::String,
2962
2963        /// Details of the error when processing the
2964        /// [Operation][google.api.servicecontrol.v1.Operation].
2965        ///
2966        /// [google.api.servicecontrol.v1.Operation]: crate::model::Operation
2967        #[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        /// Sets the value of [operation_id][crate::model::report_response::ReportError::operation_id].
2980        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        /// Sets the value of [status][crate::model::report_response::ReportError::status].
2989        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}