Skip to main content

google_cloud_api/
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 bytes;
21extern crate serde;
22extern crate serde_json;
23extern crate serde_with;
24extern crate std;
25extern crate wkt;
26
27mod debug;
28mod deserialize;
29mod serialize;
30
31/// `Authentication` defines the authentication configuration for API methods
32/// provided by an API service.
33///
34/// Example:
35///
36/// ```norust
37/// name: calendar.googleapis.com
38/// authentication:
39///   providers:
40///   - id: google_calendar_auth
41///     jwks_uri: https://www.googleapis.com/oauth2/v1/certs
42///     issuer: https://securetoken.google.com
43///   rules:
44///   - selector: "*"
45///     requirements:
46///       provider_id: google_calendar_auth
47///   - selector: google.calendar.Delegate
48///     oauth:
49///       canonical_scopes: https://www.googleapis.com/auth/calendar.read
50/// ```
51#[derive(Clone, Default, PartialEq)]
52#[non_exhaustive]
53pub struct Authentication {
54    /// A list of authentication rules that apply to individual API methods.
55    ///
56    /// **NOTE:** All service configuration rules follow "last one wins" order.
57    pub rules: std::vec::Vec<crate::model::AuthenticationRule>,
58
59    /// Defines a set of authentication providers that a service supports.
60    pub providers: std::vec::Vec<crate::model::AuthProvider>,
61
62    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
63}
64
65impl Authentication {
66    /// Creates a new default instance.
67    pub fn new() -> Self {
68        std::default::Default::default()
69    }
70
71    /// Sets the value of [rules][crate::model::Authentication::rules].
72    ///
73    /// # Example
74    /// ```ignore,no_run
75    /// # use google_cloud_api::model::Authentication;
76    /// use google_cloud_api::model::AuthenticationRule;
77    /// let x = Authentication::new()
78    ///     .set_rules([
79    ///         AuthenticationRule::default()/* use setters */,
80    ///         AuthenticationRule::default()/* use (different) setters */,
81    ///     ]);
82    /// ```
83    pub fn set_rules<T, V>(mut self, v: T) -> Self
84    where
85        T: std::iter::IntoIterator<Item = V>,
86        V: std::convert::Into<crate::model::AuthenticationRule>,
87    {
88        use std::iter::Iterator;
89        self.rules = v.into_iter().map(|i| i.into()).collect();
90        self
91    }
92
93    /// Sets the value of [providers][crate::model::Authentication::providers].
94    ///
95    /// # Example
96    /// ```ignore,no_run
97    /// # use google_cloud_api::model::Authentication;
98    /// use google_cloud_api::model::AuthProvider;
99    /// let x = Authentication::new()
100    ///     .set_providers([
101    ///         AuthProvider::default()/* use setters */,
102    ///         AuthProvider::default()/* use (different) setters */,
103    ///     ]);
104    /// ```
105    pub fn set_providers<T, V>(mut self, v: T) -> Self
106    where
107        T: std::iter::IntoIterator<Item = V>,
108        V: std::convert::Into<crate::model::AuthProvider>,
109    {
110        use std::iter::Iterator;
111        self.providers = v.into_iter().map(|i| i.into()).collect();
112        self
113    }
114}
115
116impl wkt::message::Message for Authentication {
117    fn typename() -> &'static str {
118        "type.googleapis.com/google.api.Authentication"
119    }
120}
121
122/// Authentication rules for the service.
123///
124/// By default, if a method has any authentication requirements, every request
125/// must include a valid credential matching one of the requirements.
126/// It's an error to include more than one kind of credential in a single
127/// request.
128///
129/// If a method doesn't have any auth requirements, request credentials will be
130/// ignored.
131#[derive(Clone, Default, PartialEq)]
132#[non_exhaustive]
133pub struct AuthenticationRule {
134    /// Selects the methods to which this rule applies.
135    ///
136    /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
137    /// details.
138    ///
139    /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
140    pub selector: std::string::String,
141
142    /// The requirements for OAuth credentials.
143    pub oauth: std::option::Option<crate::model::OAuthRequirements>,
144
145    /// If true, the service accepts API keys without any other credential.
146    /// This flag only applies to HTTP and gRPC requests.
147    pub allow_without_credential: bool,
148
149    /// Requirements for additional authentication providers.
150    pub requirements: std::vec::Vec<crate::model::AuthRequirement>,
151
152    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
153}
154
155impl AuthenticationRule {
156    /// Creates a new default instance.
157    pub fn new() -> Self {
158        std::default::Default::default()
159    }
160
161    /// Sets the value of [selector][crate::model::AuthenticationRule::selector].
162    ///
163    /// # Example
164    /// ```ignore,no_run
165    /// # use google_cloud_api::model::AuthenticationRule;
166    /// let x = AuthenticationRule::new().set_selector("example");
167    /// ```
168    pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
169        self.selector = v.into();
170        self
171    }
172
173    /// Sets the value of [oauth][crate::model::AuthenticationRule::oauth].
174    ///
175    /// # Example
176    /// ```ignore,no_run
177    /// # use google_cloud_api::model::AuthenticationRule;
178    /// use google_cloud_api::model::OAuthRequirements;
179    /// let x = AuthenticationRule::new().set_oauth(OAuthRequirements::default()/* use setters */);
180    /// ```
181    pub fn set_oauth<T>(mut self, v: T) -> Self
182    where
183        T: std::convert::Into<crate::model::OAuthRequirements>,
184    {
185        self.oauth = std::option::Option::Some(v.into());
186        self
187    }
188
189    /// Sets or clears the value of [oauth][crate::model::AuthenticationRule::oauth].
190    ///
191    /// # Example
192    /// ```ignore,no_run
193    /// # use google_cloud_api::model::AuthenticationRule;
194    /// use google_cloud_api::model::OAuthRequirements;
195    /// let x = AuthenticationRule::new().set_or_clear_oauth(Some(OAuthRequirements::default()/* use setters */));
196    /// let x = AuthenticationRule::new().set_or_clear_oauth(None::<OAuthRequirements>);
197    /// ```
198    pub fn set_or_clear_oauth<T>(mut self, v: std::option::Option<T>) -> Self
199    where
200        T: std::convert::Into<crate::model::OAuthRequirements>,
201    {
202        self.oauth = v.map(|x| x.into());
203        self
204    }
205
206    /// Sets the value of [allow_without_credential][crate::model::AuthenticationRule::allow_without_credential].
207    ///
208    /// # Example
209    /// ```ignore,no_run
210    /// # use google_cloud_api::model::AuthenticationRule;
211    /// let x = AuthenticationRule::new().set_allow_without_credential(true);
212    /// ```
213    pub fn set_allow_without_credential<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
214        self.allow_without_credential = v.into();
215        self
216    }
217
218    /// Sets the value of [requirements][crate::model::AuthenticationRule::requirements].
219    ///
220    /// # Example
221    /// ```ignore,no_run
222    /// # use google_cloud_api::model::AuthenticationRule;
223    /// use google_cloud_api::model::AuthRequirement;
224    /// let x = AuthenticationRule::new()
225    ///     .set_requirements([
226    ///         AuthRequirement::default()/* use setters */,
227    ///         AuthRequirement::default()/* use (different) setters */,
228    ///     ]);
229    /// ```
230    pub fn set_requirements<T, V>(mut self, v: T) -> Self
231    where
232        T: std::iter::IntoIterator<Item = V>,
233        V: std::convert::Into<crate::model::AuthRequirement>,
234    {
235        use std::iter::Iterator;
236        self.requirements = v.into_iter().map(|i| i.into()).collect();
237        self
238    }
239}
240
241impl wkt::message::Message for AuthenticationRule {
242    fn typename() -> &'static str {
243        "type.googleapis.com/google.api.AuthenticationRule"
244    }
245}
246
247/// Specifies a location to extract JWT from an API request.
248#[derive(Clone, Default, PartialEq)]
249#[non_exhaustive]
250pub struct JwtLocation {
251    /// The value prefix. The value format is "value_prefix{token}"
252    /// Only applies to "in" header type. Must be empty for "in" query type.
253    /// If not empty, the header value has to match (case sensitive) this prefix.
254    /// If not matched, JWT will not be extracted. If matched, JWT will be
255    /// extracted after the prefix is removed.
256    ///
257    /// For example, for "Authorization: Bearer {JWT}",
258    /// value_prefix="Bearer " with a space at the end.
259    pub value_prefix: std::string::String,
260
261    #[allow(missing_docs)]
262    pub r#in: std::option::Option<crate::model::jwt_location::In>,
263
264    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
265}
266
267impl JwtLocation {
268    /// Creates a new default instance.
269    pub fn new() -> Self {
270        std::default::Default::default()
271    }
272
273    /// Sets the value of [value_prefix][crate::model::JwtLocation::value_prefix].
274    ///
275    /// # Example
276    /// ```ignore,no_run
277    /// # use google_cloud_api::model::JwtLocation;
278    /// let x = JwtLocation::new().set_value_prefix("example");
279    /// ```
280    pub fn set_value_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
281        self.value_prefix = v.into();
282        self
283    }
284
285    /// Sets the value of [r#in][crate::model::JwtLocation::in].
286    ///
287    /// Note that all the setters affecting `r#in` are mutually
288    /// exclusive.
289    ///
290    /// # Example
291    /// ```ignore,no_run
292    /// # use google_cloud_api::model::JwtLocation;
293    /// use google_cloud_api::model::jwt_location::In;
294    /// let x = JwtLocation::new().set_in(Some(In::Header("example".to_string())));
295    /// ```
296    pub fn set_in<T: std::convert::Into<std::option::Option<crate::model::jwt_location::In>>>(
297        mut self,
298        v: T,
299    ) -> Self {
300        self.r#in = v.into();
301        self
302    }
303
304    /// The value of [r#in][crate::model::JwtLocation::r#in]
305    /// if it holds a `Header`, `None` if the field is not set or
306    /// holds a different branch.
307    pub fn header(&self) -> std::option::Option<&std::string::String> {
308        #[allow(unreachable_patterns)]
309        self.r#in.as_ref().and_then(|v| match v {
310            crate::model::jwt_location::In::Header(v) => std::option::Option::Some(v),
311            _ => std::option::Option::None,
312        })
313    }
314
315    /// Sets the value of [r#in][crate::model::JwtLocation::r#in]
316    /// to hold a `Header`.
317    ///
318    /// Note that all the setters affecting `r#in` are
319    /// mutually exclusive.
320    ///
321    /// # Example
322    /// ```ignore,no_run
323    /// # use google_cloud_api::model::JwtLocation;
324    /// let x = JwtLocation::new().set_header("example");
325    /// assert!(x.header().is_some());
326    /// assert!(x.query().is_none());
327    /// assert!(x.cookie().is_none());
328    /// ```
329    pub fn set_header<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
330        self.r#in = std::option::Option::Some(crate::model::jwt_location::In::Header(v.into()));
331        self
332    }
333
334    /// The value of [r#in][crate::model::JwtLocation::r#in]
335    /// if it holds a `Query`, `None` if the field is not set or
336    /// holds a different branch.
337    pub fn query(&self) -> std::option::Option<&std::string::String> {
338        #[allow(unreachable_patterns)]
339        self.r#in.as_ref().and_then(|v| match v {
340            crate::model::jwt_location::In::Query(v) => std::option::Option::Some(v),
341            _ => std::option::Option::None,
342        })
343    }
344
345    /// Sets the value of [r#in][crate::model::JwtLocation::r#in]
346    /// to hold a `Query`.
347    ///
348    /// Note that all the setters affecting `r#in` are
349    /// mutually exclusive.
350    ///
351    /// # Example
352    /// ```ignore,no_run
353    /// # use google_cloud_api::model::JwtLocation;
354    /// let x = JwtLocation::new().set_query("example");
355    /// assert!(x.query().is_some());
356    /// assert!(x.header().is_none());
357    /// assert!(x.cookie().is_none());
358    /// ```
359    pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
360        self.r#in = std::option::Option::Some(crate::model::jwt_location::In::Query(v.into()));
361        self
362    }
363
364    /// The value of [r#in][crate::model::JwtLocation::r#in]
365    /// if it holds a `Cookie`, `None` if the field is not set or
366    /// holds a different branch.
367    pub fn cookie(&self) -> std::option::Option<&std::string::String> {
368        #[allow(unreachable_patterns)]
369        self.r#in.as_ref().and_then(|v| match v {
370            crate::model::jwt_location::In::Cookie(v) => std::option::Option::Some(v),
371            _ => std::option::Option::None,
372        })
373    }
374
375    /// Sets the value of [r#in][crate::model::JwtLocation::r#in]
376    /// to hold a `Cookie`.
377    ///
378    /// Note that all the setters affecting `r#in` are
379    /// mutually exclusive.
380    ///
381    /// # Example
382    /// ```ignore,no_run
383    /// # use google_cloud_api::model::JwtLocation;
384    /// let x = JwtLocation::new().set_cookie("example");
385    /// assert!(x.cookie().is_some());
386    /// assert!(x.header().is_none());
387    /// assert!(x.query().is_none());
388    /// ```
389    pub fn set_cookie<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
390        self.r#in = std::option::Option::Some(crate::model::jwt_location::In::Cookie(v.into()));
391        self
392    }
393}
394
395impl wkt::message::Message for JwtLocation {
396    fn typename() -> &'static str {
397        "type.googleapis.com/google.api.JwtLocation"
398    }
399}
400
401/// Defines additional types related to [JwtLocation].
402pub mod jwt_location {
403    #[allow(unused_imports)]
404    use super::*;
405
406    #[allow(missing_docs)]
407    #[derive(Clone, Debug, PartialEq)]
408    #[non_exhaustive]
409    pub enum In {
410        /// Specifies HTTP header name to extract JWT token.
411        Header(std::string::String),
412        /// Specifies URL query parameter name to extract JWT token.
413        Query(std::string::String),
414        /// Specifies cookie name to extract JWT token.
415        Cookie(std::string::String),
416    }
417}
418
419/// Configuration for an authentication provider, including support for
420/// [JSON Web Token
421/// (JWT)](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32).
422#[derive(Clone, Default, PartialEq)]
423#[non_exhaustive]
424pub struct AuthProvider {
425    /// The unique identifier of the auth provider. It will be referred to by
426    /// `AuthRequirement.provider_id`.
427    ///
428    /// Example: "bookstore_auth".
429    pub id: std::string::String,
430
431    /// Identifies the principal that issued the JWT. See
432    /// <https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.1>
433    /// Usually a URL or an email address.
434    ///
435    /// Example: <https://securetoken.google.com>
436    /// Example: 1234567-compute@developer.gserviceaccount.com
437    pub issuer: std::string::String,
438
439    /// URL of the provider's public key set to validate signature of the JWT. See
440    /// [OpenID
441    /// Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata).
442    /// Optional if the key set document:
443    ///
444    /// - can be retrieved from
445    ///   [OpenID
446    ///   Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html)
447    ///   of the issuer.
448    /// - can be inferred from the email domain of the issuer (e.g. a Google
449    ///   service account).
450    ///
451    /// Example: <https://www.googleapis.com/oauth2/v1/certs>
452    pub jwks_uri: std::string::String,
453
454    /// The list of JWT
455    /// [audiences](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.3).
456    /// that are allowed to access. A JWT containing any of these audiences will
457    /// be accepted. When this setting is absent, JWTs with audiences:
458    ///
459    /// - "https://[service.name]/[google.protobuf.Api.name]"
460    /// - "https://[service.name]/"
461    ///   will be accepted.
462    ///   For example, if no audiences are in the setting, LibraryService API will
463    ///   accept JWTs with the following audiences:
464    /// - <https://library-example.googleapis.com/google.example.library.v1.LibraryService>
465    /// - <https://library-example.googleapis.com/>
466    ///
467    /// Example:
468    ///
469    /// ```norust
470    /// audiences: bookstore_android.apps.googleusercontent.com,
471    ///            bookstore_web.apps.googleusercontent.com
472    /// ```
473    pub audiences: std::string::String,
474
475    /// Redirect URL if JWT token is required but not present or is expired.
476    /// Implement authorizationUrl of securityDefinitions in OpenAPI spec.
477    pub authorization_url: std::string::String,
478
479    /// Defines the locations to extract the JWT.  For now it is only used by the
480    /// Cloud Endpoints to store the OpenAPI extension [x-google-jwt-locations]
481    /// (<https://cloud.google.com/endpoints/docs/openapi/openapi-extensions#x-google-jwt-locations>)
482    ///
483    /// JWT locations can be one of HTTP headers, URL query parameters or
484    /// cookies. The rule is that the first match wins.
485    ///
486    /// If not specified,  default to use following 3 locations:
487    ///
488    /// 1. Authorization: Bearer
489    /// 1. x-goog-iap-jwt-assertion
490    /// 1. access_token query parameter
491    ///
492    /// Default locations can be specified as followings:
493    /// jwt_locations:
494    ///
495    /// - header: Authorization
496    ///   value_prefix: "Bearer "
497    /// - header: x-goog-iap-jwt-assertion
498    /// - query: access_token
499    pub jwt_locations: std::vec::Vec<crate::model::JwtLocation>,
500
501    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
502}
503
504impl AuthProvider {
505    /// Creates a new default instance.
506    pub fn new() -> Self {
507        std::default::Default::default()
508    }
509
510    /// Sets the value of [id][crate::model::AuthProvider::id].
511    ///
512    /// # Example
513    /// ```ignore,no_run
514    /// # use google_cloud_api::model::AuthProvider;
515    /// let x = AuthProvider::new().set_id("example");
516    /// ```
517    pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
518        self.id = v.into();
519        self
520    }
521
522    /// Sets the value of [issuer][crate::model::AuthProvider::issuer].
523    ///
524    /// # Example
525    /// ```ignore,no_run
526    /// # use google_cloud_api::model::AuthProvider;
527    /// let x = AuthProvider::new().set_issuer("example");
528    /// ```
529    pub fn set_issuer<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
530        self.issuer = v.into();
531        self
532    }
533
534    /// Sets the value of [jwks_uri][crate::model::AuthProvider::jwks_uri].
535    ///
536    /// # Example
537    /// ```ignore,no_run
538    /// # use google_cloud_api::model::AuthProvider;
539    /// let x = AuthProvider::new().set_jwks_uri("example");
540    /// ```
541    pub fn set_jwks_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
542        self.jwks_uri = v.into();
543        self
544    }
545
546    /// Sets the value of [audiences][crate::model::AuthProvider::audiences].
547    ///
548    /// # Example
549    /// ```ignore,no_run
550    /// # use google_cloud_api::model::AuthProvider;
551    /// let x = AuthProvider::new().set_audiences("example");
552    /// ```
553    pub fn set_audiences<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
554        self.audiences = v.into();
555        self
556    }
557
558    /// Sets the value of [authorization_url][crate::model::AuthProvider::authorization_url].
559    ///
560    /// # Example
561    /// ```ignore,no_run
562    /// # use google_cloud_api::model::AuthProvider;
563    /// let x = AuthProvider::new().set_authorization_url("example");
564    /// ```
565    pub fn set_authorization_url<T: std::convert::Into<std::string::String>>(
566        mut self,
567        v: T,
568    ) -> Self {
569        self.authorization_url = v.into();
570        self
571    }
572
573    /// Sets the value of [jwt_locations][crate::model::AuthProvider::jwt_locations].
574    ///
575    /// # Example
576    /// ```ignore,no_run
577    /// # use google_cloud_api::model::AuthProvider;
578    /// use google_cloud_api::model::JwtLocation;
579    /// let x = AuthProvider::new()
580    ///     .set_jwt_locations([
581    ///         JwtLocation::default()/* use setters */,
582    ///         JwtLocation::default()/* use (different) setters */,
583    ///     ]);
584    /// ```
585    pub fn set_jwt_locations<T, V>(mut self, v: T) -> Self
586    where
587        T: std::iter::IntoIterator<Item = V>,
588        V: std::convert::Into<crate::model::JwtLocation>,
589    {
590        use std::iter::Iterator;
591        self.jwt_locations = v.into_iter().map(|i| i.into()).collect();
592        self
593    }
594}
595
596impl wkt::message::Message for AuthProvider {
597    fn typename() -> &'static str {
598        "type.googleapis.com/google.api.AuthProvider"
599    }
600}
601
602/// OAuth scopes are a way to define data and permissions on data. For example,
603/// there are scopes defined for "Read-only access to Google Calendar" and
604/// "Access to Cloud Platform". Users can consent to a scope for an application,
605/// giving it permission to access that data on their behalf.
606///
607/// OAuth scope specifications should be fairly coarse grained; a user will need
608/// to see and understand the text description of what your scope means.
609///
610/// In most cases: use one or at most two OAuth scopes for an entire family of
611/// products. If your product has multiple APIs, you should probably be sharing
612/// the OAuth scope across all of those APIs.
613///
614/// When you need finer grained OAuth consent screens: talk with your product
615/// management about how developers will use them in practice.
616///
617/// Please note that even though each of the canonical scopes is enough for a
618/// request to be accepted and passed to the backend, a request can still fail
619/// due to the backend requiring additional scopes or permissions.
620#[derive(Clone, Default, PartialEq)]
621#[non_exhaustive]
622pub struct OAuthRequirements {
623    /// The list of publicly documented OAuth scopes that are allowed access. An
624    /// OAuth token containing any of these scopes will be accepted.
625    ///
626    /// Example:
627    ///
628    /// ```norust
629    ///  canonical_scopes: https://www.googleapis.com/auth/calendar,
630    ///                    https://www.googleapis.com/auth/calendar.read
631    /// ```
632    pub canonical_scopes: std::string::String,
633
634    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
635}
636
637impl OAuthRequirements {
638    /// Creates a new default instance.
639    pub fn new() -> Self {
640        std::default::Default::default()
641    }
642
643    /// Sets the value of [canonical_scopes][crate::model::OAuthRequirements::canonical_scopes].
644    ///
645    /// # Example
646    /// ```ignore,no_run
647    /// # use google_cloud_api::model::OAuthRequirements;
648    /// let x = OAuthRequirements::new().set_canonical_scopes("example");
649    /// ```
650    pub fn set_canonical_scopes<T: std::convert::Into<std::string::String>>(
651        mut self,
652        v: T,
653    ) -> Self {
654        self.canonical_scopes = v.into();
655        self
656    }
657}
658
659impl wkt::message::Message for OAuthRequirements {
660    fn typename() -> &'static str {
661        "type.googleapis.com/google.api.OAuthRequirements"
662    }
663}
664
665/// User-defined authentication requirements, including support for
666/// [JSON Web Token
667/// (JWT)](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32).
668#[derive(Clone, Default, PartialEq)]
669#[non_exhaustive]
670pub struct AuthRequirement {
671    /// [id][google.api.AuthProvider.id] from authentication provider.
672    ///
673    /// Example:
674    ///
675    /// ```norust
676    /// provider_id: bookstore_auth
677    /// ```
678    ///
679    /// [google.api.AuthProvider.id]: crate::model::AuthProvider::id
680    pub provider_id: std::string::String,
681
682    /// NOTE: This will be deprecated soon, once AuthProvider.audiences is
683    /// implemented and accepted in all the runtime components.
684    ///
685    /// The list of JWT
686    /// [audiences](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.3).
687    /// that are allowed to access. A JWT containing any of these audiences will
688    /// be accepted. When this setting is absent, only JWTs with audience
689    /// "https://[Service_name][google.api.Service.name]/[API_name][google.protobuf.Api.name]"
690    /// will be accepted. For example, if no audiences are in the setting,
691    /// LibraryService API will only accept JWTs with the following audience
692    /// `https://library-example.googleapis.com/google.example.library.v1.LibraryService`.
693    ///
694    /// Example:
695    ///
696    /// ```norust
697    /// audiences: bookstore_android.apps.googleusercontent.com,
698    ///            bookstore_web.apps.googleusercontent.com
699    /// ```
700    ///
701    /// [google.api.Service.name]: crate::model::Service::name
702    /// [google.protobuf.Api.name]: wkt::Api::name
703    pub audiences: std::string::String,
704
705    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
706}
707
708impl AuthRequirement {
709    /// Creates a new default instance.
710    pub fn new() -> Self {
711        std::default::Default::default()
712    }
713
714    /// Sets the value of [provider_id][crate::model::AuthRequirement::provider_id].
715    ///
716    /// # Example
717    /// ```ignore,no_run
718    /// # use google_cloud_api::model::AuthRequirement;
719    /// let x = AuthRequirement::new().set_provider_id("example");
720    /// ```
721    pub fn set_provider_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
722        self.provider_id = v.into();
723        self
724    }
725
726    /// Sets the value of [audiences][crate::model::AuthRequirement::audiences].
727    ///
728    /// # Example
729    /// ```ignore,no_run
730    /// # use google_cloud_api::model::AuthRequirement;
731    /// let x = AuthRequirement::new().set_audiences("example");
732    /// ```
733    pub fn set_audiences<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
734        self.audiences = v.into();
735        self
736    }
737}
738
739impl wkt::message::Message for AuthRequirement {
740    fn typename() -> &'static str {
741        "type.googleapis.com/google.api.AuthRequirement"
742    }
743}
744
745/// `Backend` defines the backend configuration for a service.
746#[derive(Clone, Default, PartialEq)]
747#[non_exhaustive]
748pub struct Backend {
749    /// A list of API backend rules that apply to individual API methods.
750    ///
751    /// **NOTE:** All service configuration rules follow "last one wins" order.
752    pub rules: std::vec::Vec<crate::model::BackendRule>,
753
754    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
755}
756
757impl Backend {
758    /// Creates a new default instance.
759    pub fn new() -> Self {
760        std::default::Default::default()
761    }
762
763    /// Sets the value of [rules][crate::model::Backend::rules].
764    ///
765    /// # Example
766    /// ```ignore,no_run
767    /// # use google_cloud_api::model::Backend;
768    /// use google_cloud_api::model::BackendRule;
769    /// let x = Backend::new()
770    ///     .set_rules([
771    ///         BackendRule::default()/* use setters */,
772    ///         BackendRule::default()/* use (different) setters */,
773    ///     ]);
774    /// ```
775    pub fn set_rules<T, V>(mut self, v: T) -> Self
776    where
777        T: std::iter::IntoIterator<Item = V>,
778        V: std::convert::Into<crate::model::BackendRule>,
779    {
780        use std::iter::Iterator;
781        self.rules = v.into_iter().map(|i| i.into()).collect();
782        self
783    }
784}
785
786impl wkt::message::Message for Backend {
787    fn typename() -> &'static str {
788        "type.googleapis.com/google.api.Backend"
789    }
790}
791
792/// A backend rule provides configuration for an individual API element.
793#[derive(Clone, Default, PartialEq)]
794#[non_exhaustive]
795pub struct BackendRule {
796    /// Selects the methods to which this rule applies.
797    ///
798    /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
799    /// details.
800    ///
801    /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
802    pub selector: std::string::String,
803
804    /// The address of the API backend.
805    ///
806    /// The scheme is used to determine the backend protocol and security.
807    /// The following schemes are accepted:
808    ///
809    /// SCHEME        PROTOCOL    SECURITY
810    /// http://       HTTP        None
811    /// https://      HTTP        TLS
812    /// grpc://       gRPC        None
813    /// grpcs://      gRPC        TLS
814    ///
815    /// It is recommended to explicitly include a scheme. Leaving out the scheme
816    /// may cause constrasting behaviors across platforms.
817    ///
818    /// If the port is unspecified, the default is:
819    ///
820    /// - 80 for schemes without TLS
821    /// - 443 for schemes with TLS
822    ///
823    /// For HTTP backends, use [protocol][google.api.BackendRule.protocol]
824    /// to specify the protocol version.
825    ///
826    /// [google.api.BackendRule.protocol]: crate::model::BackendRule::protocol
827    pub address: std::string::String,
828
829    /// The number of seconds to wait for a response from a request. The default
830    /// varies based on the request protocol and deployment environment.
831    pub deadline: f64,
832
833    /// Deprecated, do not use.
834    #[deprecated]
835    pub min_deadline: f64,
836
837    /// The number of seconds to wait for the completion of a long running
838    /// operation. The default is no deadline.
839    pub operation_deadline: f64,
840
841    /// Path translation specifies how to combine the backend address with the
842    /// request path in order to produce the appropriate forwarding URL for the
843    /// request. See [PathTranslation][google.api.BackendRule.PathTranslation] for
844    /// more details.
845    ///
846    /// [google.api.BackendRule.PathTranslation]: crate::model::backend_rule::PathTranslation
847    pub path_translation: crate::model::backend_rule::PathTranslation,
848
849    /// The protocol used for sending a request to the backend.
850    /// The supported values are "http/1.1" and "h2".
851    ///
852    /// The default value is inferred from the scheme in the
853    /// [address][google.api.BackendRule.address] field:
854    ///
855    /// SCHEME        PROTOCOL
856    /// http://       http/1.1
857    /// https://      http/1.1
858    /// grpc://       h2
859    /// grpcs://      h2
860    ///
861    /// For secure HTTP backends (https://) that support HTTP/2, set this field
862    /// to "h2" for improved performance.
863    ///
864    /// Configuring this field to non-default values is only supported for secure
865    /// HTTP backends. This field will be ignored for all other backends.
866    ///
867    /// See
868    /// <https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml#alpn-protocol-ids>
869    /// for more details on the supported values.
870    ///
871    /// [google.api.BackendRule.address]: crate::model::BackendRule::address
872    pub protocol: std::string::String,
873
874    /// The map between request protocol and the backend address.
875    pub overrides_by_request_protocol:
876        std::collections::HashMap<std::string::String, crate::model::BackendRule>,
877
878    /// The load balancing policy used for connection to the application backend.
879    ///
880    /// Defined as an arbitrary string to accomondate custom load balancing
881    /// policies supported by the underlying channel, but suggest most users use
882    /// one of the standard policies, such as the default, "RoundRobin".
883    pub load_balancing_policy: std::string::String,
884
885    /// Authentication settings used by the backend.
886    ///
887    /// These are typically used to provide service management functionality to
888    /// a backend served on a publicly-routable URL. The `authentication`
889    /// details should match the authentication behavior used by the backend.
890    ///
891    /// For example, specifying `jwt_audience` implies that the backend expects
892    /// authentication via a JWT.
893    ///
894    /// When authentication is unspecified, the resulting behavior is the same
895    /// as `disable_auth` set to `true`.
896    ///
897    /// Refer to <https://developers.google.com/identity/protocols/OpenIDConnect> for
898    /// JWT ID token.
899    pub authentication: std::option::Option<crate::model::backend_rule::Authentication>,
900
901    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
902}
903
904impl BackendRule {
905    /// Creates a new default instance.
906    pub fn new() -> Self {
907        std::default::Default::default()
908    }
909
910    /// Sets the value of [selector][crate::model::BackendRule::selector].
911    ///
912    /// # Example
913    /// ```ignore,no_run
914    /// # use google_cloud_api::model::BackendRule;
915    /// let x = BackendRule::new().set_selector("example");
916    /// ```
917    pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
918        self.selector = v.into();
919        self
920    }
921
922    /// Sets the value of [address][crate::model::BackendRule::address].
923    ///
924    /// # Example
925    /// ```ignore,no_run
926    /// # use google_cloud_api::model::BackendRule;
927    /// let x = BackendRule::new().set_address("example");
928    /// ```
929    pub fn set_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
930        self.address = v.into();
931        self
932    }
933
934    /// Sets the value of [deadline][crate::model::BackendRule::deadline].
935    ///
936    /// # Example
937    /// ```ignore,no_run
938    /// # use google_cloud_api::model::BackendRule;
939    /// let x = BackendRule::new().set_deadline(42.0);
940    /// ```
941    pub fn set_deadline<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
942        self.deadline = v.into();
943        self
944    }
945
946    /// Sets the value of [min_deadline][crate::model::BackendRule::min_deadline].
947    ///
948    /// # Example
949    /// ```ignore,no_run
950    /// # use google_cloud_api::model::BackendRule;
951    /// let x = BackendRule::new().set_min_deadline(42.0);
952    /// ```
953    #[deprecated]
954    pub fn set_min_deadline<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
955        self.min_deadline = v.into();
956        self
957    }
958
959    /// Sets the value of [operation_deadline][crate::model::BackendRule::operation_deadline].
960    ///
961    /// # Example
962    /// ```ignore,no_run
963    /// # use google_cloud_api::model::BackendRule;
964    /// let x = BackendRule::new().set_operation_deadline(42.0);
965    /// ```
966    pub fn set_operation_deadline<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
967        self.operation_deadline = v.into();
968        self
969    }
970
971    /// Sets the value of [path_translation][crate::model::BackendRule::path_translation].
972    ///
973    /// # Example
974    /// ```ignore,no_run
975    /// # use google_cloud_api::model::BackendRule;
976    /// use google_cloud_api::model::backend_rule::PathTranslation;
977    /// let x0 = BackendRule::new().set_path_translation(PathTranslation::ConstantAddress);
978    /// let x1 = BackendRule::new().set_path_translation(PathTranslation::AppendPathToAddress);
979    /// ```
980    pub fn set_path_translation<
981        T: std::convert::Into<crate::model::backend_rule::PathTranslation>,
982    >(
983        mut self,
984        v: T,
985    ) -> Self {
986        self.path_translation = v.into();
987        self
988    }
989
990    /// Sets the value of [protocol][crate::model::BackendRule::protocol].
991    ///
992    /// # Example
993    /// ```ignore,no_run
994    /// # use google_cloud_api::model::BackendRule;
995    /// let x = BackendRule::new().set_protocol("example");
996    /// ```
997    pub fn set_protocol<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
998        self.protocol = v.into();
999        self
1000    }
1001
1002    /// Sets the value of [overrides_by_request_protocol][crate::model::BackendRule::overrides_by_request_protocol].
1003    ///
1004    /// # Example
1005    /// ```ignore,no_run
1006    /// # use google_cloud_api::model::BackendRule;
1007    /// let x = BackendRule::new().set_overrides_by_request_protocol([
1008    ///     ("key0", BackendRule::default()/* use setters */),
1009    ///     ("key1", BackendRule::default()/* use (different) setters */),
1010    /// ]);
1011    /// ```
1012    pub fn set_overrides_by_request_protocol<T, K, V>(mut self, v: T) -> Self
1013    where
1014        T: std::iter::IntoIterator<Item = (K, V)>,
1015        K: std::convert::Into<std::string::String>,
1016        V: std::convert::Into<crate::model::BackendRule>,
1017    {
1018        use std::iter::Iterator;
1019        self.overrides_by_request_protocol =
1020            v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1021        self
1022    }
1023
1024    /// Sets the value of [load_balancing_policy][crate::model::BackendRule::load_balancing_policy].
1025    ///
1026    /// # Example
1027    /// ```ignore,no_run
1028    /// # use google_cloud_api::model::BackendRule;
1029    /// let x = BackendRule::new().set_load_balancing_policy("example");
1030    /// ```
1031    pub fn set_load_balancing_policy<T: std::convert::Into<std::string::String>>(
1032        mut self,
1033        v: T,
1034    ) -> Self {
1035        self.load_balancing_policy = v.into();
1036        self
1037    }
1038
1039    /// Sets the value of [authentication][crate::model::BackendRule::authentication].
1040    ///
1041    /// Note that all the setters affecting `authentication` are mutually
1042    /// exclusive.
1043    ///
1044    /// # Example
1045    /// ```ignore,no_run
1046    /// # use google_cloud_api::model::BackendRule;
1047    /// use google_cloud_api::model::backend_rule::Authentication;
1048    /// let x = BackendRule::new().set_authentication(Some(Authentication::JwtAudience("example".to_string())));
1049    /// ```
1050    pub fn set_authentication<
1051        T: std::convert::Into<std::option::Option<crate::model::backend_rule::Authentication>>,
1052    >(
1053        mut self,
1054        v: T,
1055    ) -> Self {
1056        self.authentication = v.into();
1057        self
1058    }
1059
1060    /// The value of [authentication][crate::model::BackendRule::authentication]
1061    /// if it holds a `JwtAudience`, `None` if the field is not set or
1062    /// holds a different branch.
1063    pub fn jwt_audience(&self) -> std::option::Option<&std::string::String> {
1064        #[allow(unreachable_patterns)]
1065        self.authentication.as_ref().and_then(|v| match v {
1066            crate::model::backend_rule::Authentication::JwtAudience(v) => {
1067                std::option::Option::Some(v)
1068            }
1069            _ => std::option::Option::None,
1070        })
1071    }
1072
1073    /// Sets the value of [authentication][crate::model::BackendRule::authentication]
1074    /// to hold a `JwtAudience`.
1075    ///
1076    /// Note that all the setters affecting `authentication` are
1077    /// mutually exclusive.
1078    ///
1079    /// # Example
1080    /// ```ignore,no_run
1081    /// # use google_cloud_api::model::BackendRule;
1082    /// let x = BackendRule::new().set_jwt_audience("example");
1083    /// assert!(x.jwt_audience().is_some());
1084    /// assert!(x.disable_auth().is_none());
1085    /// ```
1086    pub fn set_jwt_audience<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1087        self.authentication = std::option::Option::Some(
1088            crate::model::backend_rule::Authentication::JwtAudience(v.into()),
1089        );
1090        self
1091    }
1092
1093    /// The value of [authentication][crate::model::BackendRule::authentication]
1094    /// if it holds a `DisableAuth`, `None` if the field is not set or
1095    /// holds a different branch.
1096    pub fn disable_auth(&self) -> std::option::Option<&bool> {
1097        #[allow(unreachable_patterns)]
1098        self.authentication.as_ref().and_then(|v| match v {
1099            crate::model::backend_rule::Authentication::DisableAuth(v) => {
1100                std::option::Option::Some(v)
1101            }
1102            _ => std::option::Option::None,
1103        })
1104    }
1105
1106    /// Sets the value of [authentication][crate::model::BackendRule::authentication]
1107    /// to hold a `DisableAuth`.
1108    ///
1109    /// Note that all the setters affecting `authentication` are
1110    /// mutually exclusive.
1111    ///
1112    /// # Example
1113    /// ```ignore,no_run
1114    /// # use google_cloud_api::model::BackendRule;
1115    /// let x = BackendRule::new().set_disable_auth(true);
1116    /// assert!(x.disable_auth().is_some());
1117    /// assert!(x.jwt_audience().is_none());
1118    /// ```
1119    pub fn set_disable_auth<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1120        self.authentication = std::option::Option::Some(
1121            crate::model::backend_rule::Authentication::DisableAuth(v.into()),
1122        );
1123        self
1124    }
1125}
1126
1127impl wkt::message::Message for BackendRule {
1128    fn typename() -> &'static str {
1129        "type.googleapis.com/google.api.BackendRule"
1130    }
1131}
1132
1133/// Defines additional types related to [BackendRule].
1134pub mod backend_rule {
1135    #[allow(unused_imports)]
1136    use super::*;
1137
1138    /// Path Translation specifies how to combine the backend address with the
1139    /// request path in order to produce the appropriate forwarding URL for the
1140    /// request.
1141    ///
1142    /// Path Translation is applicable only to HTTP-based backends. Backends which
1143    /// do not accept requests over HTTP/HTTPS should leave `path_translation`
1144    /// unspecified.
1145    ///
1146    /// # Working with unknown values
1147    ///
1148    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1149    /// additional enum variants at any time. Adding new variants is not considered
1150    /// a breaking change. Applications should write their code in anticipation of:
1151    ///
1152    /// - New values appearing in future releases of the client library, **and**
1153    /// - New values received dynamically, without application changes.
1154    ///
1155    /// Please consult the [Working with enums] section in the user guide for some
1156    /// guidelines.
1157    ///
1158    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1159    #[derive(Clone, Debug, PartialEq)]
1160    #[non_exhaustive]
1161    pub enum PathTranslation {
1162        #[allow(missing_docs)]
1163        Unspecified,
1164        /// Use the backend address as-is, with no modification to the path. If the
1165        /// URL pattern contains variables, the variable names and values will be
1166        /// appended to the query string. If a query string parameter and a URL
1167        /// pattern variable have the same name, this may result in duplicate keys in
1168        /// the query string.
1169        ///
1170        /// # Examples
1171        ///
1172        /// Given the following operation config:
1173        ///
1174        /// ```norust
1175        /// Method path:        /api/company/{cid}/user/{uid}
1176        /// Backend address:    https://example.cloudfunctions.net/getUser
1177        /// ```
1178        ///
1179        /// Requests to the following request paths will call the backend at the
1180        /// translated path:
1181        ///
1182        /// ```norust
1183        /// Request path: /api/company/widgetworks/user/johndoe
1184        /// Translated:
1185        /// https://example.cloudfunctions.net/getUser?cid=widgetworks&uid=johndoe
1186        ///
1187        /// Request path: /api/company/widgetworks/user/johndoe?timezone=EST
1188        /// Translated:
1189        /// https://example.cloudfunctions.net/getUser?timezone=EST&cid=widgetworks&uid=johndoe
1190        /// ```
1191        ConstantAddress,
1192        /// The request path will be appended to the backend address.
1193        ///
1194        /// # Examples
1195        ///
1196        /// Given the following operation config:
1197        ///
1198        /// ```norust
1199        /// Method path:        /api/company/{cid}/user/{uid}
1200        /// Backend address:    https://example.appspot.com
1201        /// ```
1202        ///
1203        /// Requests to the following request paths will call the backend at the
1204        /// translated path:
1205        ///
1206        /// ```norust
1207        /// Request path: /api/company/widgetworks/user/johndoe
1208        /// Translated:
1209        /// https://example.appspot.com/api/company/widgetworks/user/johndoe
1210        ///
1211        /// Request path: /api/company/widgetworks/user/johndoe?timezone=EST
1212        /// Translated:
1213        /// https://example.appspot.com/api/company/widgetworks/user/johndoe?timezone=EST
1214        /// ```
1215        AppendPathToAddress,
1216        /// If set, the enum was initialized with an unknown value.
1217        ///
1218        /// Applications can examine the value using [PathTranslation::value] or
1219        /// [PathTranslation::name].
1220        UnknownValue(path_translation::UnknownValue),
1221    }
1222
1223    #[doc(hidden)]
1224    pub mod path_translation {
1225        #[allow(unused_imports)]
1226        use super::*;
1227        #[derive(Clone, Debug, PartialEq)]
1228        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1229    }
1230
1231    impl PathTranslation {
1232        /// Gets the enum value.
1233        ///
1234        /// Returns `None` if the enum contains an unknown value deserialized from
1235        /// the string representation of enums.
1236        pub fn value(&self) -> std::option::Option<i32> {
1237            match self {
1238                Self::Unspecified => std::option::Option::Some(0),
1239                Self::ConstantAddress => std::option::Option::Some(1),
1240                Self::AppendPathToAddress => std::option::Option::Some(2),
1241                Self::UnknownValue(u) => u.0.value(),
1242            }
1243        }
1244
1245        /// Gets the enum value as a string.
1246        ///
1247        /// Returns `None` if the enum contains an unknown value deserialized from
1248        /// the integer representation of enums.
1249        pub fn name(&self) -> std::option::Option<&str> {
1250            match self {
1251                Self::Unspecified => std::option::Option::Some("PATH_TRANSLATION_UNSPECIFIED"),
1252                Self::ConstantAddress => std::option::Option::Some("CONSTANT_ADDRESS"),
1253                Self::AppendPathToAddress => std::option::Option::Some("APPEND_PATH_TO_ADDRESS"),
1254                Self::UnknownValue(u) => u.0.name(),
1255            }
1256        }
1257    }
1258
1259    impl std::default::Default for PathTranslation {
1260        fn default() -> Self {
1261            use std::convert::From;
1262            Self::from(0)
1263        }
1264    }
1265
1266    impl std::fmt::Display for PathTranslation {
1267        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1268            wkt::internal::display_enum(f, self.name(), self.value())
1269        }
1270    }
1271
1272    impl std::convert::From<i32> for PathTranslation {
1273        fn from(value: i32) -> Self {
1274            match value {
1275                0 => Self::Unspecified,
1276                1 => Self::ConstantAddress,
1277                2 => Self::AppendPathToAddress,
1278                _ => Self::UnknownValue(path_translation::UnknownValue(
1279                    wkt::internal::UnknownEnumValue::Integer(value),
1280                )),
1281            }
1282        }
1283    }
1284
1285    impl std::convert::From<&str> for PathTranslation {
1286        fn from(value: &str) -> Self {
1287            use std::string::ToString;
1288            match value {
1289                "PATH_TRANSLATION_UNSPECIFIED" => Self::Unspecified,
1290                "CONSTANT_ADDRESS" => Self::ConstantAddress,
1291                "APPEND_PATH_TO_ADDRESS" => Self::AppendPathToAddress,
1292                _ => Self::UnknownValue(path_translation::UnknownValue(
1293                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1294                )),
1295            }
1296        }
1297    }
1298
1299    impl serde::ser::Serialize for PathTranslation {
1300        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1301        where
1302            S: serde::Serializer,
1303        {
1304            match self {
1305                Self::Unspecified => serializer.serialize_i32(0),
1306                Self::ConstantAddress => serializer.serialize_i32(1),
1307                Self::AppendPathToAddress => serializer.serialize_i32(2),
1308                Self::UnknownValue(u) => u.0.serialize(serializer),
1309            }
1310        }
1311    }
1312
1313    impl<'de> serde::de::Deserialize<'de> for PathTranslation {
1314        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1315        where
1316            D: serde::Deserializer<'de>,
1317        {
1318            deserializer.deserialize_any(wkt::internal::EnumVisitor::<PathTranslation>::new(
1319                ".google.api.BackendRule.PathTranslation",
1320            ))
1321        }
1322    }
1323
1324    /// Authentication settings used by the backend.
1325    ///
1326    /// These are typically used to provide service management functionality to
1327    /// a backend served on a publicly-routable URL. The `authentication`
1328    /// details should match the authentication behavior used by the backend.
1329    ///
1330    /// For example, specifying `jwt_audience` implies that the backend expects
1331    /// authentication via a JWT.
1332    ///
1333    /// When authentication is unspecified, the resulting behavior is the same
1334    /// as `disable_auth` set to `true`.
1335    ///
1336    /// Refer to <https://developers.google.com/identity/protocols/OpenIDConnect> for
1337    /// JWT ID token.
1338    #[derive(Clone, Debug, PartialEq)]
1339    #[non_exhaustive]
1340    pub enum Authentication {
1341        /// The JWT audience is used when generating a JWT ID token for the backend.
1342        /// This ID token will be added in the HTTP "authorization" header, and sent
1343        /// to the backend.
1344        JwtAudience(std::string::String),
1345        /// When disable_auth is true, a JWT ID token won't be generated and the
1346        /// original "Authorization" HTTP header will be preserved. If the header is
1347        /// used to carry the original token and is expected by the backend, this
1348        /// field must be set to true to preserve the header.
1349        DisableAuth(bool),
1350    }
1351}
1352
1353/// Billing related configuration of the service.
1354///
1355/// The following example shows how to configure monitored resources and metrics
1356/// for billing, `consumer_destinations` is the only supported destination and
1357/// the monitored resources need at least one label key
1358/// `cloud.googleapis.com/location` to indicate the location of the billing
1359/// usage, using different monitored resources between monitoring and billing is
1360/// recommended so they can be evolved independently:
1361///
1362/// ```norust
1363/// monitored_resources:
1364/// - type: library.googleapis.com/billing_branch
1365///   labels:
1366///   - key: cloud.googleapis.com/location
1367///     description: |
1368///       Predefined label to support billing location restriction.
1369///   - key: city
1370///     description: |
1371///       Custom label to define the city where the library branch is located
1372///       in.
1373///   - key: name
1374///     description: Custom label to define the name of the library branch.
1375/// metrics:
1376/// - name: library.googleapis.com/book/borrowed_count
1377///   metric_kind: DELTA
1378///   value_type: INT64
1379///   unit: "1"
1380/// billing:
1381///   consumer_destinations:
1382///   - monitored_resource: library.googleapis.com/billing_branch
1383///     metrics:
1384///     - library.googleapis.com/book/borrowed_count
1385/// ```
1386#[derive(Clone, Default, PartialEq)]
1387#[non_exhaustive]
1388pub struct Billing {
1389    /// Billing configurations for sending metrics to the consumer project.
1390    /// There can be multiple consumer destinations per service, each one must have
1391    /// a different monitored resource type. A metric can be used in at most
1392    /// one consumer destination.
1393    pub consumer_destinations: std::vec::Vec<crate::model::billing::BillingDestination>,
1394
1395    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1396}
1397
1398impl Billing {
1399    /// Creates a new default instance.
1400    pub fn new() -> Self {
1401        std::default::Default::default()
1402    }
1403
1404    /// Sets the value of [consumer_destinations][crate::model::Billing::consumer_destinations].
1405    ///
1406    /// # Example
1407    /// ```ignore,no_run
1408    /// # use google_cloud_api::model::Billing;
1409    /// use google_cloud_api::model::billing::BillingDestination;
1410    /// let x = Billing::new()
1411    ///     .set_consumer_destinations([
1412    ///         BillingDestination::default()/* use setters */,
1413    ///         BillingDestination::default()/* use (different) setters */,
1414    ///     ]);
1415    /// ```
1416    pub fn set_consumer_destinations<T, V>(mut self, v: T) -> Self
1417    where
1418        T: std::iter::IntoIterator<Item = V>,
1419        V: std::convert::Into<crate::model::billing::BillingDestination>,
1420    {
1421        use std::iter::Iterator;
1422        self.consumer_destinations = v.into_iter().map(|i| i.into()).collect();
1423        self
1424    }
1425}
1426
1427impl wkt::message::Message for Billing {
1428    fn typename() -> &'static str {
1429        "type.googleapis.com/google.api.Billing"
1430    }
1431}
1432
1433/// Defines additional types related to [Billing].
1434pub mod billing {
1435    #[allow(unused_imports)]
1436    use super::*;
1437
1438    /// Configuration of a specific billing destination (Currently only support
1439    /// bill against consumer project).
1440    #[derive(Clone, Default, PartialEq)]
1441    #[non_exhaustive]
1442    pub struct BillingDestination {
1443        /// The monitored resource type. The type must be defined in
1444        /// [Service.monitored_resources][google.api.Service.monitored_resources]
1445        /// section.
1446        ///
1447        /// [google.api.Service.monitored_resources]: crate::model::Service::monitored_resources
1448        pub monitored_resource: std::string::String,
1449
1450        /// Names of the metrics to report to this billing destination.
1451        /// Each name must be defined in
1452        /// [Service.metrics][google.api.Service.metrics] section.
1453        ///
1454        /// [google.api.Service.metrics]: crate::model::Service::metrics
1455        pub metrics: std::vec::Vec<std::string::String>,
1456
1457        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1458    }
1459
1460    impl BillingDestination {
1461        /// Creates a new default instance.
1462        pub fn new() -> Self {
1463            std::default::Default::default()
1464        }
1465
1466        /// Sets the value of [monitored_resource][crate::model::billing::BillingDestination::monitored_resource].
1467        ///
1468        /// # Example
1469        /// ```ignore,no_run
1470        /// # use google_cloud_api::model::billing::BillingDestination;
1471        /// let x = BillingDestination::new().set_monitored_resource("example");
1472        /// ```
1473        pub fn set_monitored_resource<T: std::convert::Into<std::string::String>>(
1474            mut self,
1475            v: T,
1476        ) -> Self {
1477            self.monitored_resource = v.into();
1478            self
1479        }
1480
1481        /// Sets the value of [metrics][crate::model::billing::BillingDestination::metrics].
1482        ///
1483        /// # Example
1484        /// ```ignore,no_run
1485        /// # use google_cloud_api::model::billing::BillingDestination;
1486        /// let x = BillingDestination::new().set_metrics(["a", "b", "c"]);
1487        /// ```
1488        pub fn set_metrics<T, V>(mut self, v: T) -> Self
1489        where
1490            T: std::iter::IntoIterator<Item = V>,
1491            V: std::convert::Into<std::string::String>,
1492        {
1493            use std::iter::Iterator;
1494            self.metrics = v.into_iter().map(|i| i.into()).collect();
1495            self
1496        }
1497    }
1498
1499    impl wkt::message::Message for BillingDestination {
1500        fn typename() -> &'static str {
1501            "type.googleapis.com/google.api.Billing.BillingDestination"
1502        }
1503    }
1504}
1505
1506/// Required information for every language.
1507#[derive(Clone, Default, PartialEq)]
1508#[non_exhaustive]
1509pub struct CommonLanguageSettings {
1510    /// Link to automatically generated reference documentation.  Example:
1511    /// <https://cloud.google.com/nodejs/docs/reference/asset/latest>
1512    #[deprecated]
1513    pub reference_docs_uri: std::string::String,
1514
1515    /// The destination where API teams want this client library to be published.
1516    pub destinations: std::vec::Vec<crate::model::ClientLibraryDestination>,
1517
1518    /// Configuration for which RPCs should be generated in the GAPIC client.
1519    ///
1520    /// Note: This field should not be used in most cases.
1521    pub selective_gapic_generation: std::option::Option<crate::model::SelectiveGapicGeneration>,
1522
1523    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1524}
1525
1526impl CommonLanguageSettings {
1527    /// Creates a new default instance.
1528    pub fn new() -> Self {
1529        std::default::Default::default()
1530    }
1531
1532    /// Sets the value of [reference_docs_uri][crate::model::CommonLanguageSettings::reference_docs_uri].
1533    ///
1534    /// # Example
1535    /// ```ignore,no_run
1536    /// # use google_cloud_api::model::CommonLanguageSettings;
1537    /// let x = CommonLanguageSettings::new().set_reference_docs_uri("example");
1538    /// ```
1539    #[deprecated]
1540    pub fn set_reference_docs_uri<T: std::convert::Into<std::string::String>>(
1541        mut self,
1542        v: T,
1543    ) -> Self {
1544        self.reference_docs_uri = v.into();
1545        self
1546    }
1547
1548    /// Sets the value of [destinations][crate::model::CommonLanguageSettings::destinations].
1549    ///
1550    /// # Example
1551    /// ```ignore,no_run
1552    /// # use google_cloud_api::model::CommonLanguageSettings;
1553    /// use google_cloud_api::model::ClientLibraryDestination;
1554    /// let x = CommonLanguageSettings::new().set_destinations([
1555    ///     ClientLibraryDestination::Github,
1556    ///     ClientLibraryDestination::PackageManager,
1557    /// ]);
1558    /// ```
1559    pub fn set_destinations<T, V>(mut self, v: T) -> Self
1560    where
1561        T: std::iter::IntoIterator<Item = V>,
1562        V: std::convert::Into<crate::model::ClientLibraryDestination>,
1563    {
1564        use std::iter::Iterator;
1565        self.destinations = v.into_iter().map(|i| i.into()).collect();
1566        self
1567    }
1568
1569    /// Sets the value of [selective_gapic_generation][crate::model::CommonLanguageSettings::selective_gapic_generation].
1570    ///
1571    /// # Example
1572    /// ```ignore,no_run
1573    /// # use google_cloud_api::model::CommonLanguageSettings;
1574    /// use google_cloud_api::model::SelectiveGapicGeneration;
1575    /// let x = CommonLanguageSettings::new().set_selective_gapic_generation(SelectiveGapicGeneration::default()/* use setters */);
1576    /// ```
1577    pub fn set_selective_gapic_generation<T>(mut self, v: T) -> Self
1578    where
1579        T: std::convert::Into<crate::model::SelectiveGapicGeneration>,
1580    {
1581        self.selective_gapic_generation = std::option::Option::Some(v.into());
1582        self
1583    }
1584
1585    /// Sets or clears the value of [selective_gapic_generation][crate::model::CommonLanguageSettings::selective_gapic_generation].
1586    ///
1587    /// # Example
1588    /// ```ignore,no_run
1589    /// # use google_cloud_api::model::CommonLanguageSettings;
1590    /// use google_cloud_api::model::SelectiveGapicGeneration;
1591    /// let x = CommonLanguageSettings::new().set_or_clear_selective_gapic_generation(Some(SelectiveGapicGeneration::default()/* use setters */));
1592    /// let x = CommonLanguageSettings::new().set_or_clear_selective_gapic_generation(None::<SelectiveGapicGeneration>);
1593    /// ```
1594    pub fn set_or_clear_selective_gapic_generation<T>(mut self, v: std::option::Option<T>) -> Self
1595    where
1596        T: std::convert::Into<crate::model::SelectiveGapicGeneration>,
1597    {
1598        self.selective_gapic_generation = v.map(|x| x.into());
1599        self
1600    }
1601}
1602
1603impl wkt::message::Message for CommonLanguageSettings {
1604    fn typename() -> &'static str {
1605        "type.googleapis.com/google.api.CommonLanguageSettings"
1606    }
1607}
1608
1609/// Details about how and where to publish client libraries.
1610#[derive(Clone, Default, PartialEq)]
1611#[non_exhaustive]
1612pub struct ClientLibrarySettings {
1613    /// Version of the API to apply these settings to. This is the full protobuf
1614    /// package for the API, ending in the version element.
1615    /// Examples: "google.cloud.speech.v1" and "google.spanner.admin.database.v1".
1616    pub version: std::string::String,
1617
1618    /// Launch stage of this version of the API.
1619    pub launch_stage: crate::model::LaunchStage,
1620
1621    /// When using transport=rest, the client request will encode enums as
1622    /// numbers rather than strings.
1623    pub rest_numeric_enums: bool,
1624
1625    /// Settings for legacy Java features, supported in the Service YAML.
1626    pub java_settings: std::option::Option<crate::model::JavaSettings>,
1627
1628    /// Settings for C++ client libraries.
1629    pub cpp_settings: std::option::Option<crate::model::CppSettings>,
1630
1631    /// Settings for PHP client libraries.
1632    pub php_settings: std::option::Option<crate::model::PhpSettings>,
1633
1634    /// Settings for Python client libraries.
1635    pub python_settings: std::option::Option<crate::model::PythonSettings>,
1636
1637    /// Settings for Node client libraries.
1638    pub node_settings: std::option::Option<crate::model::NodeSettings>,
1639
1640    /// Settings for .NET client libraries.
1641    pub dotnet_settings: std::option::Option<crate::model::DotnetSettings>,
1642
1643    /// Settings for Ruby client libraries.
1644    pub ruby_settings: std::option::Option<crate::model::RubySettings>,
1645
1646    /// Settings for Go client libraries.
1647    pub go_settings: std::option::Option<crate::model::GoSettings>,
1648
1649    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1650}
1651
1652impl ClientLibrarySettings {
1653    /// Creates a new default instance.
1654    pub fn new() -> Self {
1655        std::default::Default::default()
1656    }
1657
1658    /// Sets the value of [version][crate::model::ClientLibrarySettings::version].
1659    ///
1660    /// # Example
1661    /// ```ignore,no_run
1662    /// # use google_cloud_api::model::ClientLibrarySettings;
1663    /// let x = ClientLibrarySettings::new().set_version("example");
1664    /// ```
1665    pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1666        self.version = v.into();
1667        self
1668    }
1669
1670    /// Sets the value of [launch_stage][crate::model::ClientLibrarySettings::launch_stage].
1671    ///
1672    /// # Example
1673    /// ```ignore,no_run
1674    /// # use google_cloud_api::model::ClientLibrarySettings;
1675    /// use google_cloud_api::model::LaunchStage;
1676    /// let x0 = ClientLibrarySettings::new().set_launch_stage(LaunchStage::Unimplemented);
1677    /// let x1 = ClientLibrarySettings::new().set_launch_stage(LaunchStage::Prelaunch);
1678    /// let x2 = ClientLibrarySettings::new().set_launch_stage(LaunchStage::EarlyAccess);
1679    /// ```
1680    pub fn set_launch_stage<T: std::convert::Into<crate::model::LaunchStage>>(
1681        mut self,
1682        v: T,
1683    ) -> Self {
1684        self.launch_stage = v.into();
1685        self
1686    }
1687
1688    /// Sets the value of [rest_numeric_enums][crate::model::ClientLibrarySettings::rest_numeric_enums].
1689    ///
1690    /// # Example
1691    /// ```ignore,no_run
1692    /// # use google_cloud_api::model::ClientLibrarySettings;
1693    /// let x = ClientLibrarySettings::new().set_rest_numeric_enums(true);
1694    /// ```
1695    pub fn set_rest_numeric_enums<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1696        self.rest_numeric_enums = v.into();
1697        self
1698    }
1699
1700    /// Sets the value of [java_settings][crate::model::ClientLibrarySettings::java_settings].
1701    ///
1702    /// # Example
1703    /// ```ignore,no_run
1704    /// # use google_cloud_api::model::ClientLibrarySettings;
1705    /// use google_cloud_api::model::JavaSettings;
1706    /// let x = ClientLibrarySettings::new().set_java_settings(JavaSettings::default()/* use setters */);
1707    /// ```
1708    pub fn set_java_settings<T>(mut self, v: T) -> Self
1709    where
1710        T: std::convert::Into<crate::model::JavaSettings>,
1711    {
1712        self.java_settings = std::option::Option::Some(v.into());
1713        self
1714    }
1715
1716    /// Sets or clears the value of [java_settings][crate::model::ClientLibrarySettings::java_settings].
1717    ///
1718    /// # Example
1719    /// ```ignore,no_run
1720    /// # use google_cloud_api::model::ClientLibrarySettings;
1721    /// use google_cloud_api::model::JavaSettings;
1722    /// let x = ClientLibrarySettings::new().set_or_clear_java_settings(Some(JavaSettings::default()/* use setters */));
1723    /// let x = ClientLibrarySettings::new().set_or_clear_java_settings(None::<JavaSettings>);
1724    /// ```
1725    pub fn set_or_clear_java_settings<T>(mut self, v: std::option::Option<T>) -> Self
1726    where
1727        T: std::convert::Into<crate::model::JavaSettings>,
1728    {
1729        self.java_settings = v.map(|x| x.into());
1730        self
1731    }
1732
1733    /// Sets the value of [cpp_settings][crate::model::ClientLibrarySettings::cpp_settings].
1734    ///
1735    /// # Example
1736    /// ```ignore,no_run
1737    /// # use google_cloud_api::model::ClientLibrarySettings;
1738    /// use google_cloud_api::model::CppSettings;
1739    /// let x = ClientLibrarySettings::new().set_cpp_settings(CppSettings::default()/* use setters */);
1740    /// ```
1741    pub fn set_cpp_settings<T>(mut self, v: T) -> Self
1742    where
1743        T: std::convert::Into<crate::model::CppSettings>,
1744    {
1745        self.cpp_settings = std::option::Option::Some(v.into());
1746        self
1747    }
1748
1749    /// Sets or clears the value of [cpp_settings][crate::model::ClientLibrarySettings::cpp_settings].
1750    ///
1751    /// # Example
1752    /// ```ignore,no_run
1753    /// # use google_cloud_api::model::ClientLibrarySettings;
1754    /// use google_cloud_api::model::CppSettings;
1755    /// let x = ClientLibrarySettings::new().set_or_clear_cpp_settings(Some(CppSettings::default()/* use setters */));
1756    /// let x = ClientLibrarySettings::new().set_or_clear_cpp_settings(None::<CppSettings>);
1757    /// ```
1758    pub fn set_or_clear_cpp_settings<T>(mut self, v: std::option::Option<T>) -> Self
1759    where
1760        T: std::convert::Into<crate::model::CppSettings>,
1761    {
1762        self.cpp_settings = v.map(|x| x.into());
1763        self
1764    }
1765
1766    /// Sets the value of [php_settings][crate::model::ClientLibrarySettings::php_settings].
1767    ///
1768    /// # Example
1769    /// ```ignore,no_run
1770    /// # use google_cloud_api::model::ClientLibrarySettings;
1771    /// use google_cloud_api::model::PhpSettings;
1772    /// let x = ClientLibrarySettings::new().set_php_settings(PhpSettings::default()/* use setters */);
1773    /// ```
1774    pub fn set_php_settings<T>(mut self, v: T) -> Self
1775    where
1776        T: std::convert::Into<crate::model::PhpSettings>,
1777    {
1778        self.php_settings = std::option::Option::Some(v.into());
1779        self
1780    }
1781
1782    /// Sets or clears the value of [php_settings][crate::model::ClientLibrarySettings::php_settings].
1783    ///
1784    /// # Example
1785    /// ```ignore,no_run
1786    /// # use google_cloud_api::model::ClientLibrarySettings;
1787    /// use google_cloud_api::model::PhpSettings;
1788    /// let x = ClientLibrarySettings::new().set_or_clear_php_settings(Some(PhpSettings::default()/* use setters */));
1789    /// let x = ClientLibrarySettings::new().set_or_clear_php_settings(None::<PhpSettings>);
1790    /// ```
1791    pub fn set_or_clear_php_settings<T>(mut self, v: std::option::Option<T>) -> Self
1792    where
1793        T: std::convert::Into<crate::model::PhpSettings>,
1794    {
1795        self.php_settings = v.map(|x| x.into());
1796        self
1797    }
1798
1799    /// Sets the value of [python_settings][crate::model::ClientLibrarySettings::python_settings].
1800    ///
1801    /// # Example
1802    /// ```ignore,no_run
1803    /// # use google_cloud_api::model::ClientLibrarySettings;
1804    /// use google_cloud_api::model::PythonSettings;
1805    /// let x = ClientLibrarySettings::new().set_python_settings(PythonSettings::default()/* use setters */);
1806    /// ```
1807    pub fn set_python_settings<T>(mut self, v: T) -> Self
1808    where
1809        T: std::convert::Into<crate::model::PythonSettings>,
1810    {
1811        self.python_settings = std::option::Option::Some(v.into());
1812        self
1813    }
1814
1815    /// Sets or clears the value of [python_settings][crate::model::ClientLibrarySettings::python_settings].
1816    ///
1817    /// # Example
1818    /// ```ignore,no_run
1819    /// # use google_cloud_api::model::ClientLibrarySettings;
1820    /// use google_cloud_api::model::PythonSettings;
1821    /// let x = ClientLibrarySettings::new().set_or_clear_python_settings(Some(PythonSettings::default()/* use setters */));
1822    /// let x = ClientLibrarySettings::new().set_or_clear_python_settings(None::<PythonSettings>);
1823    /// ```
1824    pub fn set_or_clear_python_settings<T>(mut self, v: std::option::Option<T>) -> Self
1825    where
1826        T: std::convert::Into<crate::model::PythonSettings>,
1827    {
1828        self.python_settings = v.map(|x| x.into());
1829        self
1830    }
1831
1832    /// Sets the value of [node_settings][crate::model::ClientLibrarySettings::node_settings].
1833    ///
1834    /// # Example
1835    /// ```ignore,no_run
1836    /// # use google_cloud_api::model::ClientLibrarySettings;
1837    /// use google_cloud_api::model::NodeSettings;
1838    /// let x = ClientLibrarySettings::new().set_node_settings(NodeSettings::default()/* use setters */);
1839    /// ```
1840    pub fn set_node_settings<T>(mut self, v: T) -> Self
1841    where
1842        T: std::convert::Into<crate::model::NodeSettings>,
1843    {
1844        self.node_settings = std::option::Option::Some(v.into());
1845        self
1846    }
1847
1848    /// Sets or clears the value of [node_settings][crate::model::ClientLibrarySettings::node_settings].
1849    ///
1850    /// # Example
1851    /// ```ignore,no_run
1852    /// # use google_cloud_api::model::ClientLibrarySettings;
1853    /// use google_cloud_api::model::NodeSettings;
1854    /// let x = ClientLibrarySettings::new().set_or_clear_node_settings(Some(NodeSettings::default()/* use setters */));
1855    /// let x = ClientLibrarySettings::new().set_or_clear_node_settings(None::<NodeSettings>);
1856    /// ```
1857    pub fn set_or_clear_node_settings<T>(mut self, v: std::option::Option<T>) -> Self
1858    where
1859        T: std::convert::Into<crate::model::NodeSettings>,
1860    {
1861        self.node_settings = v.map(|x| x.into());
1862        self
1863    }
1864
1865    /// Sets the value of [dotnet_settings][crate::model::ClientLibrarySettings::dotnet_settings].
1866    ///
1867    /// # Example
1868    /// ```ignore,no_run
1869    /// # use google_cloud_api::model::ClientLibrarySettings;
1870    /// use google_cloud_api::model::DotnetSettings;
1871    /// let x = ClientLibrarySettings::new().set_dotnet_settings(DotnetSettings::default()/* use setters */);
1872    /// ```
1873    pub fn set_dotnet_settings<T>(mut self, v: T) -> Self
1874    where
1875        T: std::convert::Into<crate::model::DotnetSettings>,
1876    {
1877        self.dotnet_settings = std::option::Option::Some(v.into());
1878        self
1879    }
1880
1881    /// Sets or clears the value of [dotnet_settings][crate::model::ClientLibrarySettings::dotnet_settings].
1882    ///
1883    /// # Example
1884    /// ```ignore,no_run
1885    /// # use google_cloud_api::model::ClientLibrarySettings;
1886    /// use google_cloud_api::model::DotnetSettings;
1887    /// let x = ClientLibrarySettings::new().set_or_clear_dotnet_settings(Some(DotnetSettings::default()/* use setters */));
1888    /// let x = ClientLibrarySettings::new().set_or_clear_dotnet_settings(None::<DotnetSettings>);
1889    /// ```
1890    pub fn set_or_clear_dotnet_settings<T>(mut self, v: std::option::Option<T>) -> Self
1891    where
1892        T: std::convert::Into<crate::model::DotnetSettings>,
1893    {
1894        self.dotnet_settings = v.map(|x| x.into());
1895        self
1896    }
1897
1898    /// Sets the value of [ruby_settings][crate::model::ClientLibrarySettings::ruby_settings].
1899    ///
1900    /// # Example
1901    /// ```ignore,no_run
1902    /// # use google_cloud_api::model::ClientLibrarySettings;
1903    /// use google_cloud_api::model::RubySettings;
1904    /// let x = ClientLibrarySettings::new().set_ruby_settings(RubySettings::default()/* use setters */);
1905    /// ```
1906    pub fn set_ruby_settings<T>(mut self, v: T) -> Self
1907    where
1908        T: std::convert::Into<crate::model::RubySettings>,
1909    {
1910        self.ruby_settings = std::option::Option::Some(v.into());
1911        self
1912    }
1913
1914    /// Sets or clears the value of [ruby_settings][crate::model::ClientLibrarySettings::ruby_settings].
1915    ///
1916    /// # Example
1917    /// ```ignore,no_run
1918    /// # use google_cloud_api::model::ClientLibrarySettings;
1919    /// use google_cloud_api::model::RubySettings;
1920    /// let x = ClientLibrarySettings::new().set_or_clear_ruby_settings(Some(RubySettings::default()/* use setters */));
1921    /// let x = ClientLibrarySettings::new().set_or_clear_ruby_settings(None::<RubySettings>);
1922    /// ```
1923    pub fn set_or_clear_ruby_settings<T>(mut self, v: std::option::Option<T>) -> Self
1924    where
1925        T: std::convert::Into<crate::model::RubySettings>,
1926    {
1927        self.ruby_settings = v.map(|x| x.into());
1928        self
1929    }
1930
1931    /// Sets the value of [go_settings][crate::model::ClientLibrarySettings::go_settings].
1932    ///
1933    /// # Example
1934    /// ```ignore,no_run
1935    /// # use google_cloud_api::model::ClientLibrarySettings;
1936    /// use google_cloud_api::model::GoSettings;
1937    /// let x = ClientLibrarySettings::new().set_go_settings(GoSettings::default()/* use setters */);
1938    /// ```
1939    pub fn set_go_settings<T>(mut self, v: T) -> Self
1940    where
1941        T: std::convert::Into<crate::model::GoSettings>,
1942    {
1943        self.go_settings = std::option::Option::Some(v.into());
1944        self
1945    }
1946
1947    /// Sets or clears the value of [go_settings][crate::model::ClientLibrarySettings::go_settings].
1948    ///
1949    /// # Example
1950    /// ```ignore,no_run
1951    /// # use google_cloud_api::model::ClientLibrarySettings;
1952    /// use google_cloud_api::model::GoSettings;
1953    /// let x = ClientLibrarySettings::new().set_or_clear_go_settings(Some(GoSettings::default()/* use setters */));
1954    /// let x = ClientLibrarySettings::new().set_or_clear_go_settings(None::<GoSettings>);
1955    /// ```
1956    pub fn set_or_clear_go_settings<T>(mut self, v: std::option::Option<T>) -> Self
1957    where
1958        T: std::convert::Into<crate::model::GoSettings>,
1959    {
1960        self.go_settings = v.map(|x| x.into());
1961        self
1962    }
1963}
1964
1965impl wkt::message::Message for ClientLibrarySettings {
1966    fn typename() -> &'static str {
1967        "type.googleapis.com/google.api.ClientLibrarySettings"
1968    }
1969}
1970
1971/// This message configures the settings for publishing [Google Cloud Client
1972/// libraries](https://cloud.google.com/apis/docs/cloud-client-libraries)
1973/// generated from the service config.
1974#[derive(Clone, Default, PartialEq)]
1975#[non_exhaustive]
1976pub struct Publishing {
1977    /// A list of API method settings, e.g. the behavior for methods that use the
1978    /// long-running operation pattern.
1979    pub method_settings: std::vec::Vec<crate::model::MethodSettings>,
1980
1981    /// Link to a *public* URI where users can report issues.  Example:
1982    /// <https://issuetracker.google.com/issues/new?component=190865&template=1161103>
1983    pub new_issue_uri: std::string::String,
1984
1985    /// Link to product home page.  Example:
1986    /// <https://cloud.google.com/asset-inventory/docs/overview>
1987    pub documentation_uri: std::string::String,
1988
1989    /// Used as a tracking tag when collecting data about the APIs developer
1990    /// relations artifacts like docs, packages delivered to package managers,
1991    /// etc.  Example: "speech".
1992    pub api_short_name: std::string::String,
1993
1994    /// GitHub label to apply to issues and pull requests opened for this API.
1995    pub github_label: std::string::String,
1996
1997    /// GitHub teams to be added to CODEOWNERS in the directory in GitHub
1998    /// containing source code for the client libraries for this API.
1999    pub codeowner_github_teams: std::vec::Vec<std::string::String>,
2000
2001    /// A prefix used in sample code when demarking regions to be included in
2002    /// documentation.
2003    pub doc_tag_prefix: std::string::String,
2004
2005    /// For whom the client library is being published.
2006    pub organization: crate::model::ClientLibraryOrganization,
2007
2008    /// Client library settings.  If the same version string appears multiple
2009    /// times in this list, then the last one wins.  Settings from earlier
2010    /// settings with the same version string are discarded.
2011    pub library_settings: std::vec::Vec<crate::model::ClientLibrarySettings>,
2012
2013    /// Optional link to proto reference documentation.  Example:
2014    /// <https://cloud.google.com/pubsub/lite/docs/reference/rpc>
2015    pub proto_reference_documentation_uri: std::string::String,
2016
2017    /// Optional link to REST reference documentation.  Example:
2018    /// <https://cloud.google.com/pubsub/lite/docs/reference/rest>
2019    pub rest_reference_documentation_uri: std::string::String,
2020
2021    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2022}
2023
2024impl Publishing {
2025    /// Creates a new default instance.
2026    pub fn new() -> Self {
2027        std::default::Default::default()
2028    }
2029
2030    /// Sets the value of [method_settings][crate::model::Publishing::method_settings].
2031    ///
2032    /// # Example
2033    /// ```ignore,no_run
2034    /// # use google_cloud_api::model::Publishing;
2035    /// use google_cloud_api::model::MethodSettings;
2036    /// let x = Publishing::new()
2037    ///     .set_method_settings([
2038    ///         MethodSettings::default()/* use setters */,
2039    ///         MethodSettings::default()/* use (different) setters */,
2040    ///     ]);
2041    /// ```
2042    pub fn set_method_settings<T, V>(mut self, v: T) -> Self
2043    where
2044        T: std::iter::IntoIterator<Item = V>,
2045        V: std::convert::Into<crate::model::MethodSettings>,
2046    {
2047        use std::iter::Iterator;
2048        self.method_settings = v.into_iter().map(|i| i.into()).collect();
2049        self
2050    }
2051
2052    /// Sets the value of [new_issue_uri][crate::model::Publishing::new_issue_uri].
2053    ///
2054    /// # Example
2055    /// ```ignore,no_run
2056    /// # use google_cloud_api::model::Publishing;
2057    /// let x = Publishing::new().set_new_issue_uri("example");
2058    /// ```
2059    pub fn set_new_issue_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2060        self.new_issue_uri = v.into();
2061        self
2062    }
2063
2064    /// Sets the value of [documentation_uri][crate::model::Publishing::documentation_uri].
2065    ///
2066    /// # Example
2067    /// ```ignore,no_run
2068    /// # use google_cloud_api::model::Publishing;
2069    /// let x = Publishing::new().set_documentation_uri("example");
2070    /// ```
2071    pub fn set_documentation_uri<T: std::convert::Into<std::string::String>>(
2072        mut self,
2073        v: T,
2074    ) -> Self {
2075        self.documentation_uri = v.into();
2076        self
2077    }
2078
2079    /// Sets the value of [api_short_name][crate::model::Publishing::api_short_name].
2080    ///
2081    /// # Example
2082    /// ```ignore,no_run
2083    /// # use google_cloud_api::model::Publishing;
2084    /// let x = Publishing::new().set_api_short_name("example");
2085    /// ```
2086    pub fn set_api_short_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2087        self.api_short_name = v.into();
2088        self
2089    }
2090
2091    /// Sets the value of [github_label][crate::model::Publishing::github_label].
2092    ///
2093    /// # Example
2094    /// ```ignore,no_run
2095    /// # use google_cloud_api::model::Publishing;
2096    /// let x = Publishing::new().set_github_label("example");
2097    /// ```
2098    pub fn set_github_label<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2099        self.github_label = v.into();
2100        self
2101    }
2102
2103    /// Sets the value of [codeowner_github_teams][crate::model::Publishing::codeowner_github_teams].
2104    ///
2105    /// # Example
2106    /// ```ignore,no_run
2107    /// # use google_cloud_api::model::Publishing;
2108    /// let x = Publishing::new().set_codeowner_github_teams(["a", "b", "c"]);
2109    /// ```
2110    pub fn set_codeowner_github_teams<T, V>(mut self, v: T) -> Self
2111    where
2112        T: std::iter::IntoIterator<Item = V>,
2113        V: std::convert::Into<std::string::String>,
2114    {
2115        use std::iter::Iterator;
2116        self.codeowner_github_teams = v.into_iter().map(|i| i.into()).collect();
2117        self
2118    }
2119
2120    /// Sets the value of [doc_tag_prefix][crate::model::Publishing::doc_tag_prefix].
2121    ///
2122    /// # Example
2123    /// ```ignore,no_run
2124    /// # use google_cloud_api::model::Publishing;
2125    /// let x = Publishing::new().set_doc_tag_prefix("example");
2126    /// ```
2127    pub fn set_doc_tag_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2128        self.doc_tag_prefix = v.into();
2129        self
2130    }
2131
2132    /// Sets the value of [organization][crate::model::Publishing::organization].
2133    ///
2134    /// # Example
2135    /// ```ignore,no_run
2136    /// # use google_cloud_api::model::Publishing;
2137    /// use google_cloud_api::model::ClientLibraryOrganization;
2138    /// let x0 = Publishing::new().set_organization(ClientLibraryOrganization::Cloud);
2139    /// let x1 = Publishing::new().set_organization(ClientLibraryOrganization::Ads);
2140    /// let x2 = Publishing::new().set_organization(ClientLibraryOrganization::Photos);
2141    /// ```
2142    pub fn set_organization<T: std::convert::Into<crate::model::ClientLibraryOrganization>>(
2143        mut self,
2144        v: T,
2145    ) -> Self {
2146        self.organization = v.into();
2147        self
2148    }
2149
2150    /// Sets the value of [library_settings][crate::model::Publishing::library_settings].
2151    ///
2152    /// # Example
2153    /// ```ignore,no_run
2154    /// # use google_cloud_api::model::Publishing;
2155    /// use google_cloud_api::model::ClientLibrarySettings;
2156    /// let x = Publishing::new()
2157    ///     .set_library_settings([
2158    ///         ClientLibrarySettings::default()/* use setters */,
2159    ///         ClientLibrarySettings::default()/* use (different) setters */,
2160    ///     ]);
2161    /// ```
2162    pub fn set_library_settings<T, V>(mut self, v: T) -> Self
2163    where
2164        T: std::iter::IntoIterator<Item = V>,
2165        V: std::convert::Into<crate::model::ClientLibrarySettings>,
2166    {
2167        use std::iter::Iterator;
2168        self.library_settings = v.into_iter().map(|i| i.into()).collect();
2169        self
2170    }
2171
2172    /// Sets the value of [proto_reference_documentation_uri][crate::model::Publishing::proto_reference_documentation_uri].
2173    ///
2174    /// # Example
2175    /// ```ignore,no_run
2176    /// # use google_cloud_api::model::Publishing;
2177    /// let x = Publishing::new().set_proto_reference_documentation_uri("example");
2178    /// ```
2179    pub fn set_proto_reference_documentation_uri<T: std::convert::Into<std::string::String>>(
2180        mut self,
2181        v: T,
2182    ) -> Self {
2183        self.proto_reference_documentation_uri = v.into();
2184        self
2185    }
2186
2187    /// Sets the value of [rest_reference_documentation_uri][crate::model::Publishing::rest_reference_documentation_uri].
2188    ///
2189    /// # Example
2190    /// ```ignore,no_run
2191    /// # use google_cloud_api::model::Publishing;
2192    /// let x = Publishing::new().set_rest_reference_documentation_uri("example");
2193    /// ```
2194    pub fn set_rest_reference_documentation_uri<T: std::convert::Into<std::string::String>>(
2195        mut self,
2196        v: T,
2197    ) -> Self {
2198        self.rest_reference_documentation_uri = v.into();
2199        self
2200    }
2201}
2202
2203impl wkt::message::Message for Publishing {
2204    fn typename() -> &'static str {
2205        "type.googleapis.com/google.api.Publishing"
2206    }
2207}
2208
2209/// Settings for Java client libraries.
2210#[derive(Clone, Default, PartialEq)]
2211#[non_exhaustive]
2212pub struct JavaSettings {
2213    /// The package name to use in Java. Clobbers the java_package option
2214    /// set in the protobuf. This should be used **only** by APIs
2215    /// who have already set the language_settings.java.package_name" field
2216    /// in gapic.yaml. API teams should use the protobuf java_package option
2217    /// where possible.
2218    ///
2219    /// Example of a YAML configuration::
2220    ///
2221    /// ```norust
2222    /// publishing:
2223    ///   library_settings:
2224    ///     java_settings:
2225    ///       library_package: com.google.cloud.pubsub.v1
2226    /// ```
2227    pub library_package: std::string::String,
2228
2229    /// Configure the Java class name to use instead of the service's for its
2230    /// corresponding generated GAPIC client. Keys are fully-qualified
2231    /// service names as they appear in the protobuf (including the full
2232    /// the language_settings.java.interface_names" field in gapic.yaml. API
2233    /// teams should otherwise use the service name as it appears in the
2234    /// protobuf.
2235    ///
2236    /// Example of a YAML configuration::
2237    ///
2238    /// ```norust
2239    /// publishing:
2240    ///   java_settings:
2241    ///     service_class_names:
2242    ///       - google.pubsub.v1.Publisher: TopicAdmin
2243    ///       - google.pubsub.v1.Subscriber: SubscriptionAdmin
2244    /// ```
2245    pub service_class_names: std::collections::HashMap<std::string::String, std::string::String>,
2246
2247    /// Some settings.
2248    pub common: std::option::Option<crate::model::CommonLanguageSettings>,
2249
2250    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2251}
2252
2253impl JavaSettings {
2254    /// Creates a new default instance.
2255    pub fn new() -> Self {
2256        std::default::Default::default()
2257    }
2258
2259    /// Sets the value of [library_package][crate::model::JavaSettings::library_package].
2260    ///
2261    /// # Example
2262    /// ```ignore,no_run
2263    /// # use google_cloud_api::model::JavaSettings;
2264    /// let x = JavaSettings::new().set_library_package("example");
2265    /// ```
2266    pub fn set_library_package<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2267        self.library_package = v.into();
2268        self
2269    }
2270
2271    /// Sets the value of [service_class_names][crate::model::JavaSettings::service_class_names].
2272    ///
2273    /// # Example
2274    /// ```ignore,no_run
2275    /// # use google_cloud_api::model::JavaSettings;
2276    /// let x = JavaSettings::new().set_service_class_names([
2277    ///     ("key0", "abc"),
2278    ///     ("key1", "xyz"),
2279    /// ]);
2280    /// ```
2281    pub fn set_service_class_names<T, K, V>(mut self, v: T) -> Self
2282    where
2283        T: std::iter::IntoIterator<Item = (K, V)>,
2284        K: std::convert::Into<std::string::String>,
2285        V: std::convert::Into<std::string::String>,
2286    {
2287        use std::iter::Iterator;
2288        self.service_class_names = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2289        self
2290    }
2291
2292    /// Sets the value of [common][crate::model::JavaSettings::common].
2293    ///
2294    /// # Example
2295    /// ```ignore,no_run
2296    /// # use google_cloud_api::model::JavaSettings;
2297    /// use google_cloud_api::model::CommonLanguageSettings;
2298    /// let x = JavaSettings::new().set_common(CommonLanguageSettings::default()/* use setters */);
2299    /// ```
2300    pub fn set_common<T>(mut self, v: T) -> Self
2301    where
2302        T: std::convert::Into<crate::model::CommonLanguageSettings>,
2303    {
2304        self.common = std::option::Option::Some(v.into());
2305        self
2306    }
2307
2308    /// Sets or clears the value of [common][crate::model::JavaSettings::common].
2309    ///
2310    /// # Example
2311    /// ```ignore,no_run
2312    /// # use google_cloud_api::model::JavaSettings;
2313    /// use google_cloud_api::model::CommonLanguageSettings;
2314    /// let x = JavaSettings::new().set_or_clear_common(Some(CommonLanguageSettings::default()/* use setters */));
2315    /// let x = JavaSettings::new().set_or_clear_common(None::<CommonLanguageSettings>);
2316    /// ```
2317    pub fn set_or_clear_common<T>(mut self, v: std::option::Option<T>) -> Self
2318    where
2319        T: std::convert::Into<crate::model::CommonLanguageSettings>,
2320    {
2321        self.common = v.map(|x| x.into());
2322        self
2323    }
2324}
2325
2326impl wkt::message::Message for JavaSettings {
2327    fn typename() -> &'static str {
2328        "type.googleapis.com/google.api.JavaSettings"
2329    }
2330}
2331
2332/// Settings for C++ client libraries.
2333#[derive(Clone, Default, PartialEq)]
2334#[non_exhaustive]
2335pub struct CppSettings {
2336    /// Some settings.
2337    pub common: std::option::Option<crate::model::CommonLanguageSettings>,
2338
2339    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2340}
2341
2342impl CppSettings {
2343    /// Creates a new default instance.
2344    pub fn new() -> Self {
2345        std::default::Default::default()
2346    }
2347
2348    /// Sets the value of [common][crate::model::CppSettings::common].
2349    ///
2350    /// # Example
2351    /// ```ignore,no_run
2352    /// # use google_cloud_api::model::CppSettings;
2353    /// use google_cloud_api::model::CommonLanguageSettings;
2354    /// let x = CppSettings::new().set_common(CommonLanguageSettings::default()/* use setters */);
2355    /// ```
2356    pub fn set_common<T>(mut self, v: T) -> Self
2357    where
2358        T: std::convert::Into<crate::model::CommonLanguageSettings>,
2359    {
2360        self.common = std::option::Option::Some(v.into());
2361        self
2362    }
2363
2364    /// Sets or clears the value of [common][crate::model::CppSettings::common].
2365    ///
2366    /// # Example
2367    /// ```ignore,no_run
2368    /// # use google_cloud_api::model::CppSettings;
2369    /// use google_cloud_api::model::CommonLanguageSettings;
2370    /// let x = CppSettings::new().set_or_clear_common(Some(CommonLanguageSettings::default()/* use setters */));
2371    /// let x = CppSettings::new().set_or_clear_common(None::<CommonLanguageSettings>);
2372    /// ```
2373    pub fn set_or_clear_common<T>(mut self, v: std::option::Option<T>) -> Self
2374    where
2375        T: std::convert::Into<crate::model::CommonLanguageSettings>,
2376    {
2377        self.common = v.map(|x| x.into());
2378        self
2379    }
2380}
2381
2382impl wkt::message::Message for CppSettings {
2383    fn typename() -> &'static str {
2384        "type.googleapis.com/google.api.CppSettings"
2385    }
2386}
2387
2388/// Settings for Php client libraries.
2389#[derive(Clone, Default, PartialEq)]
2390#[non_exhaustive]
2391pub struct PhpSettings {
2392    /// Some settings.
2393    pub common: std::option::Option<crate::model::CommonLanguageSettings>,
2394
2395    /// The package name to use in Php. Clobbers the php_namespace option
2396    /// set in the protobuf. This should be used **only** by APIs
2397    /// who have already set the language_settings.php.package_name" field
2398    /// in gapic.yaml. API teams should use the protobuf php_namespace option
2399    /// where possible.
2400    ///
2401    /// Example of a YAML configuration::
2402    ///
2403    /// ```norust
2404    /// publishing:
2405    ///   library_settings:
2406    ///     php_settings:
2407    ///       library_package: Google\Cloud\PubSub\V1
2408    /// ```
2409    pub library_package: std::string::String,
2410
2411    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2412}
2413
2414impl PhpSettings {
2415    /// Creates a new default instance.
2416    pub fn new() -> Self {
2417        std::default::Default::default()
2418    }
2419
2420    /// Sets the value of [common][crate::model::PhpSettings::common].
2421    ///
2422    /// # Example
2423    /// ```ignore,no_run
2424    /// # use google_cloud_api::model::PhpSettings;
2425    /// use google_cloud_api::model::CommonLanguageSettings;
2426    /// let x = PhpSettings::new().set_common(CommonLanguageSettings::default()/* use setters */);
2427    /// ```
2428    pub fn set_common<T>(mut self, v: T) -> Self
2429    where
2430        T: std::convert::Into<crate::model::CommonLanguageSettings>,
2431    {
2432        self.common = std::option::Option::Some(v.into());
2433        self
2434    }
2435
2436    /// Sets or clears the value of [common][crate::model::PhpSettings::common].
2437    ///
2438    /// # Example
2439    /// ```ignore,no_run
2440    /// # use google_cloud_api::model::PhpSettings;
2441    /// use google_cloud_api::model::CommonLanguageSettings;
2442    /// let x = PhpSettings::new().set_or_clear_common(Some(CommonLanguageSettings::default()/* use setters */));
2443    /// let x = PhpSettings::new().set_or_clear_common(None::<CommonLanguageSettings>);
2444    /// ```
2445    pub fn set_or_clear_common<T>(mut self, v: std::option::Option<T>) -> Self
2446    where
2447        T: std::convert::Into<crate::model::CommonLanguageSettings>,
2448    {
2449        self.common = v.map(|x| x.into());
2450        self
2451    }
2452
2453    /// Sets the value of [library_package][crate::model::PhpSettings::library_package].
2454    ///
2455    /// # Example
2456    /// ```ignore,no_run
2457    /// # use google_cloud_api::model::PhpSettings;
2458    /// let x = PhpSettings::new().set_library_package("example");
2459    /// ```
2460    pub fn set_library_package<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2461        self.library_package = v.into();
2462        self
2463    }
2464}
2465
2466impl wkt::message::Message for PhpSettings {
2467    fn typename() -> &'static str {
2468        "type.googleapis.com/google.api.PhpSettings"
2469    }
2470}
2471
2472/// Settings for Python client libraries.
2473#[derive(Clone, Default, PartialEq)]
2474#[non_exhaustive]
2475pub struct PythonSettings {
2476    /// Some settings.
2477    pub common: std::option::Option<crate::model::CommonLanguageSettings>,
2478
2479    /// Experimental features to be included during client library generation.
2480    pub experimental_features:
2481        std::option::Option<crate::model::python_settings::ExperimentalFeatures>,
2482
2483    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2484}
2485
2486impl PythonSettings {
2487    /// Creates a new default instance.
2488    pub fn new() -> Self {
2489        std::default::Default::default()
2490    }
2491
2492    /// Sets the value of [common][crate::model::PythonSettings::common].
2493    ///
2494    /// # Example
2495    /// ```ignore,no_run
2496    /// # use google_cloud_api::model::PythonSettings;
2497    /// use google_cloud_api::model::CommonLanguageSettings;
2498    /// let x = PythonSettings::new().set_common(CommonLanguageSettings::default()/* use setters */);
2499    /// ```
2500    pub fn set_common<T>(mut self, v: T) -> Self
2501    where
2502        T: std::convert::Into<crate::model::CommonLanguageSettings>,
2503    {
2504        self.common = std::option::Option::Some(v.into());
2505        self
2506    }
2507
2508    /// Sets or clears the value of [common][crate::model::PythonSettings::common].
2509    ///
2510    /// # Example
2511    /// ```ignore,no_run
2512    /// # use google_cloud_api::model::PythonSettings;
2513    /// use google_cloud_api::model::CommonLanguageSettings;
2514    /// let x = PythonSettings::new().set_or_clear_common(Some(CommonLanguageSettings::default()/* use setters */));
2515    /// let x = PythonSettings::new().set_or_clear_common(None::<CommonLanguageSettings>);
2516    /// ```
2517    pub fn set_or_clear_common<T>(mut self, v: std::option::Option<T>) -> Self
2518    where
2519        T: std::convert::Into<crate::model::CommonLanguageSettings>,
2520    {
2521        self.common = v.map(|x| x.into());
2522        self
2523    }
2524
2525    /// Sets the value of [experimental_features][crate::model::PythonSettings::experimental_features].
2526    ///
2527    /// # Example
2528    /// ```ignore,no_run
2529    /// # use google_cloud_api::model::PythonSettings;
2530    /// use google_cloud_api::model::python_settings::ExperimentalFeatures;
2531    /// let x = PythonSettings::new().set_experimental_features(ExperimentalFeatures::default()/* use setters */);
2532    /// ```
2533    pub fn set_experimental_features<T>(mut self, v: T) -> Self
2534    where
2535        T: std::convert::Into<crate::model::python_settings::ExperimentalFeatures>,
2536    {
2537        self.experimental_features = std::option::Option::Some(v.into());
2538        self
2539    }
2540
2541    /// Sets or clears the value of [experimental_features][crate::model::PythonSettings::experimental_features].
2542    ///
2543    /// # Example
2544    /// ```ignore,no_run
2545    /// # use google_cloud_api::model::PythonSettings;
2546    /// use google_cloud_api::model::python_settings::ExperimentalFeatures;
2547    /// let x = PythonSettings::new().set_or_clear_experimental_features(Some(ExperimentalFeatures::default()/* use setters */));
2548    /// let x = PythonSettings::new().set_or_clear_experimental_features(None::<ExperimentalFeatures>);
2549    /// ```
2550    pub fn set_or_clear_experimental_features<T>(mut self, v: std::option::Option<T>) -> Self
2551    where
2552        T: std::convert::Into<crate::model::python_settings::ExperimentalFeatures>,
2553    {
2554        self.experimental_features = v.map(|x| x.into());
2555        self
2556    }
2557}
2558
2559impl wkt::message::Message for PythonSettings {
2560    fn typename() -> &'static str {
2561        "type.googleapis.com/google.api.PythonSettings"
2562    }
2563}
2564
2565/// Defines additional types related to [PythonSettings].
2566pub mod python_settings {
2567    #[allow(unused_imports)]
2568    use super::*;
2569
2570    /// Experimental features to be included during client library generation.
2571    /// These fields will be deprecated once the feature graduates and is enabled
2572    /// by default.
2573    #[derive(Clone, Default, PartialEq)]
2574    #[non_exhaustive]
2575    pub struct ExperimentalFeatures {
2576        /// Enables generation of asynchronous REST clients if `rest` transport is
2577        /// enabled. By default, asynchronous REST clients will not be generated.
2578        /// This feature will be enabled by default 1 month after launching the
2579        /// feature in preview packages.
2580        pub rest_async_io_enabled: bool,
2581
2582        /// Enables generation of protobuf code using new types that are more
2583        /// Pythonic which are included in `protobuf>=5.29.x`. This feature will be
2584        /// enabled by default 1 month after launching the feature in preview
2585        /// packages.
2586        pub protobuf_pythonic_types_enabled: bool,
2587
2588        /// Disables generation of an unversioned Python package for this client
2589        /// library. This means that the module names will need to be versioned in
2590        /// import statements. For example `import google.cloud.library_v2` instead
2591        /// of `import google.cloud.library`.
2592        pub unversioned_package_disabled: bool,
2593
2594        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2595    }
2596
2597    impl ExperimentalFeatures {
2598        /// Creates a new default instance.
2599        pub fn new() -> Self {
2600            std::default::Default::default()
2601        }
2602
2603        /// Sets the value of [rest_async_io_enabled][crate::model::python_settings::ExperimentalFeatures::rest_async_io_enabled].
2604        ///
2605        /// # Example
2606        /// ```ignore,no_run
2607        /// # use google_cloud_api::model::python_settings::ExperimentalFeatures;
2608        /// let x = ExperimentalFeatures::new().set_rest_async_io_enabled(true);
2609        /// ```
2610        pub fn set_rest_async_io_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2611            self.rest_async_io_enabled = v.into();
2612            self
2613        }
2614
2615        /// Sets the value of [protobuf_pythonic_types_enabled][crate::model::python_settings::ExperimentalFeatures::protobuf_pythonic_types_enabled].
2616        ///
2617        /// # Example
2618        /// ```ignore,no_run
2619        /// # use google_cloud_api::model::python_settings::ExperimentalFeatures;
2620        /// let x = ExperimentalFeatures::new().set_protobuf_pythonic_types_enabled(true);
2621        /// ```
2622        pub fn set_protobuf_pythonic_types_enabled<T: std::convert::Into<bool>>(
2623            mut self,
2624            v: T,
2625        ) -> Self {
2626            self.protobuf_pythonic_types_enabled = v.into();
2627            self
2628        }
2629
2630        /// Sets the value of [unversioned_package_disabled][crate::model::python_settings::ExperimentalFeatures::unversioned_package_disabled].
2631        ///
2632        /// # Example
2633        /// ```ignore,no_run
2634        /// # use google_cloud_api::model::python_settings::ExperimentalFeatures;
2635        /// let x = ExperimentalFeatures::new().set_unversioned_package_disabled(true);
2636        /// ```
2637        pub fn set_unversioned_package_disabled<T: std::convert::Into<bool>>(
2638            mut self,
2639            v: T,
2640        ) -> Self {
2641            self.unversioned_package_disabled = v.into();
2642            self
2643        }
2644    }
2645
2646    impl wkt::message::Message for ExperimentalFeatures {
2647        fn typename() -> &'static str {
2648            "type.googleapis.com/google.api.PythonSettings.ExperimentalFeatures"
2649        }
2650    }
2651}
2652
2653/// Settings for Node client libraries.
2654#[derive(Clone, Default, PartialEq)]
2655#[non_exhaustive]
2656pub struct NodeSettings {
2657    /// Some settings.
2658    pub common: std::option::Option<crate::model::CommonLanguageSettings>,
2659
2660    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2661}
2662
2663impl NodeSettings {
2664    /// Creates a new default instance.
2665    pub fn new() -> Self {
2666        std::default::Default::default()
2667    }
2668
2669    /// Sets the value of [common][crate::model::NodeSettings::common].
2670    ///
2671    /// # Example
2672    /// ```ignore,no_run
2673    /// # use google_cloud_api::model::NodeSettings;
2674    /// use google_cloud_api::model::CommonLanguageSettings;
2675    /// let x = NodeSettings::new().set_common(CommonLanguageSettings::default()/* use setters */);
2676    /// ```
2677    pub fn set_common<T>(mut self, v: T) -> Self
2678    where
2679        T: std::convert::Into<crate::model::CommonLanguageSettings>,
2680    {
2681        self.common = std::option::Option::Some(v.into());
2682        self
2683    }
2684
2685    /// Sets or clears the value of [common][crate::model::NodeSettings::common].
2686    ///
2687    /// # Example
2688    /// ```ignore,no_run
2689    /// # use google_cloud_api::model::NodeSettings;
2690    /// use google_cloud_api::model::CommonLanguageSettings;
2691    /// let x = NodeSettings::new().set_or_clear_common(Some(CommonLanguageSettings::default()/* use setters */));
2692    /// let x = NodeSettings::new().set_or_clear_common(None::<CommonLanguageSettings>);
2693    /// ```
2694    pub fn set_or_clear_common<T>(mut self, v: std::option::Option<T>) -> Self
2695    where
2696        T: std::convert::Into<crate::model::CommonLanguageSettings>,
2697    {
2698        self.common = v.map(|x| x.into());
2699        self
2700    }
2701}
2702
2703impl wkt::message::Message for NodeSettings {
2704    fn typename() -> &'static str {
2705        "type.googleapis.com/google.api.NodeSettings"
2706    }
2707}
2708
2709/// Settings for Dotnet client libraries.
2710#[derive(Clone, Default, PartialEq)]
2711#[non_exhaustive]
2712pub struct DotnetSettings {
2713    /// Some settings.
2714    pub common: std::option::Option<crate::model::CommonLanguageSettings>,
2715
2716    /// Map from original service names to renamed versions.
2717    /// This is used when the default generated types
2718    /// would cause a naming conflict. (Neither name is
2719    /// fully-qualified.)
2720    /// Example: Subscriber to SubscriberServiceApi.
2721    pub renamed_services: std::collections::HashMap<std::string::String, std::string::String>,
2722
2723    /// Map from full resource types to the effective short name
2724    /// for the resource. This is used when otherwise resource
2725    /// named from different services would cause naming collisions.
2726    /// Example entry:
2727    /// "datalabeling.googleapis.com/Dataset": "DataLabelingDataset"
2728    pub renamed_resources: std::collections::HashMap<std::string::String, std::string::String>,
2729
2730    /// List of full resource types to ignore during generation.
2731    /// This is typically used for API-specific Location resources,
2732    /// which should be handled by the generator as if they were actually
2733    /// the common Location resources.
2734    /// Example entry: "documentai.googleapis.com/Location"
2735    pub ignored_resources: std::vec::Vec<std::string::String>,
2736
2737    /// Namespaces which must be aliased in snippets due to
2738    /// a known (but non-generator-predictable) naming collision
2739    pub forced_namespace_aliases: std::vec::Vec<std::string::String>,
2740
2741    /// Method signatures (in the form "service.method(signature)")
2742    /// which are provided separately, so shouldn't be generated.
2743    /// Snippets *calling* these methods are still generated, however.
2744    pub handwritten_signatures: std::vec::Vec<std::string::String>,
2745
2746    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2747}
2748
2749impl DotnetSettings {
2750    /// Creates a new default instance.
2751    pub fn new() -> Self {
2752        std::default::Default::default()
2753    }
2754
2755    /// Sets the value of [common][crate::model::DotnetSettings::common].
2756    ///
2757    /// # Example
2758    /// ```ignore,no_run
2759    /// # use google_cloud_api::model::DotnetSettings;
2760    /// use google_cloud_api::model::CommonLanguageSettings;
2761    /// let x = DotnetSettings::new().set_common(CommonLanguageSettings::default()/* use setters */);
2762    /// ```
2763    pub fn set_common<T>(mut self, v: T) -> Self
2764    where
2765        T: std::convert::Into<crate::model::CommonLanguageSettings>,
2766    {
2767        self.common = std::option::Option::Some(v.into());
2768        self
2769    }
2770
2771    /// Sets or clears the value of [common][crate::model::DotnetSettings::common].
2772    ///
2773    /// # Example
2774    /// ```ignore,no_run
2775    /// # use google_cloud_api::model::DotnetSettings;
2776    /// use google_cloud_api::model::CommonLanguageSettings;
2777    /// let x = DotnetSettings::new().set_or_clear_common(Some(CommonLanguageSettings::default()/* use setters */));
2778    /// let x = DotnetSettings::new().set_or_clear_common(None::<CommonLanguageSettings>);
2779    /// ```
2780    pub fn set_or_clear_common<T>(mut self, v: std::option::Option<T>) -> Self
2781    where
2782        T: std::convert::Into<crate::model::CommonLanguageSettings>,
2783    {
2784        self.common = v.map(|x| x.into());
2785        self
2786    }
2787
2788    /// Sets the value of [renamed_services][crate::model::DotnetSettings::renamed_services].
2789    ///
2790    /// # Example
2791    /// ```ignore,no_run
2792    /// # use google_cloud_api::model::DotnetSettings;
2793    /// let x = DotnetSettings::new().set_renamed_services([
2794    ///     ("key0", "abc"),
2795    ///     ("key1", "xyz"),
2796    /// ]);
2797    /// ```
2798    pub fn set_renamed_services<T, K, V>(mut self, v: T) -> Self
2799    where
2800        T: std::iter::IntoIterator<Item = (K, V)>,
2801        K: std::convert::Into<std::string::String>,
2802        V: std::convert::Into<std::string::String>,
2803    {
2804        use std::iter::Iterator;
2805        self.renamed_services = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2806        self
2807    }
2808
2809    /// Sets the value of [renamed_resources][crate::model::DotnetSettings::renamed_resources].
2810    ///
2811    /// # Example
2812    /// ```ignore,no_run
2813    /// # use google_cloud_api::model::DotnetSettings;
2814    /// let x = DotnetSettings::new().set_renamed_resources([
2815    ///     ("key0", "abc"),
2816    ///     ("key1", "xyz"),
2817    /// ]);
2818    /// ```
2819    pub fn set_renamed_resources<T, K, V>(mut self, v: T) -> Self
2820    where
2821        T: std::iter::IntoIterator<Item = (K, V)>,
2822        K: std::convert::Into<std::string::String>,
2823        V: std::convert::Into<std::string::String>,
2824    {
2825        use std::iter::Iterator;
2826        self.renamed_resources = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2827        self
2828    }
2829
2830    /// Sets the value of [ignored_resources][crate::model::DotnetSettings::ignored_resources].
2831    ///
2832    /// # Example
2833    /// ```ignore,no_run
2834    /// # use google_cloud_api::model::DotnetSettings;
2835    /// let x = DotnetSettings::new().set_ignored_resources(["a", "b", "c"]);
2836    /// ```
2837    pub fn set_ignored_resources<T, V>(mut self, v: T) -> Self
2838    where
2839        T: std::iter::IntoIterator<Item = V>,
2840        V: std::convert::Into<std::string::String>,
2841    {
2842        use std::iter::Iterator;
2843        self.ignored_resources = v.into_iter().map(|i| i.into()).collect();
2844        self
2845    }
2846
2847    /// Sets the value of [forced_namespace_aliases][crate::model::DotnetSettings::forced_namespace_aliases].
2848    ///
2849    /// # Example
2850    /// ```ignore,no_run
2851    /// # use google_cloud_api::model::DotnetSettings;
2852    /// let x = DotnetSettings::new().set_forced_namespace_aliases(["a", "b", "c"]);
2853    /// ```
2854    pub fn set_forced_namespace_aliases<T, V>(mut self, v: T) -> Self
2855    where
2856        T: std::iter::IntoIterator<Item = V>,
2857        V: std::convert::Into<std::string::String>,
2858    {
2859        use std::iter::Iterator;
2860        self.forced_namespace_aliases = v.into_iter().map(|i| i.into()).collect();
2861        self
2862    }
2863
2864    /// Sets the value of [handwritten_signatures][crate::model::DotnetSettings::handwritten_signatures].
2865    ///
2866    /// # Example
2867    /// ```ignore,no_run
2868    /// # use google_cloud_api::model::DotnetSettings;
2869    /// let x = DotnetSettings::new().set_handwritten_signatures(["a", "b", "c"]);
2870    /// ```
2871    pub fn set_handwritten_signatures<T, V>(mut self, v: T) -> Self
2872    where
2873        T: std::iter::IntoIterator<Item = V>,
2874        V: std::convert::Into<std::string::String>,
2875    {
2876        use std::iter::Iterator;
2877        self.handwritten_signatures = v.into_iter().map(|i| i.into()).collect();
2878        self
2879    }
2880}
2881
2882impl wkt::message::Message for DotnetSettings {
2883    fn typename() -> &'static str {
2884        "type.googleapis.com/google.api.DotnetSettings"
2885    }
2886}
2887
2888/// Settings for Ruby client libraries.
2889#[derive(Clone, Default, PartialEq)]
2890#[non_exhaustive]
2891pub struct RubySettings {
2892    /// Some settings.
2893    pub common: std::option::Option<crate::model::CommonLanguageSettings>,
2894
2895    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2896}
2897
2898impl RubySettings {
2899    /// Creates a new default instance.
2900    pub fn new() -> Self {
2901        std::default::Default::default()
2902    }
2903
2904    /// Sets the value of [common][crate::model::RubySettings::common].
2905    ///
2906    /// # Example
2907    /// ```ignore,no_run
2908    /// # use google_cloud_api::model::RubySettings;
2909    /// use google_cloud_api::model::CommonLanguageSettings;
2910    /// let x = RubySettings::new().set_common(CommonLanguageSettings::default()/* use setters */);
2911    /// ```
2912    pub fn set_common<T>(mut self, v: T) -> Self
2913    where
2914        T: std::convert::Into<crate::model::CommonLanguageSettings>,
2915    {
2916        self.common = std::option::Option::Some(v.into());
2917        self
2918    }
2919
2920    /// Sets or clears the value of [common][crate::model::RubySettings::common].
2921    ///
2922    /// # Example
2923    /// ```ignore,no_run
2924    /// # use google_cloud_api::model::RubySettings;
2925    /// use google_cloud_api::model::CommonLanguageSettings;
2926    /// let x = RubySettings::new().set_or_clear_common(Some(CommonLanguageSettings::default()/* use setters */));
2927    /// let x = RubySettings::new().set_or_clear_common(None::<CommonLanguageSettings>);
2928    /// ```
2929    pub fn set_or_clear_common<T>(mut self, v: std::option::Option<T>) -> Self
2930    where
2931        T: std::convert::Into<crate::model::CommonLanguageSettings>,
2932    {
2933        self.common = v.map(|x| x.into());
2934        self
2935    }
2936}
2937
2938impl wkt::message::Message for RubySettings {
2939    fn typename() -> &'static str {
2940        "type.googleapis.com/google.api.RubySettings"
2941    }
2942}
2943
2944/// Settings for Go client libraries.
2945#[derive(Clone, Default, PartialEq)]
2946#[non_exhaustive]
2947pub struct GoSettings {
2948    /// Some settings.
2949    pub common: std::option::Option<crate::model::CommonLanguageSettings>,
2950
2951    /// Map of service names to renamed services. Keys are the package relative
2952    /// service names and values are the name to be used for the service client
2953    /// and call options.
2954    ///
2955    /// Example:
2956    ///
2957    /// ```norust
2958    /// publishing:
2959    ///   go_settings:
2960    ///     renamed_services:
2961    ///       Publisher: TopicAdmin
2962    /// ```
2963    pub renamed_services: std::collections::HashMap<std::string::String, std::string::String>,
2964
2965    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2966}
2967
2968impl GoSettings {
2969    /// Creates a new default instance.
2970    pub fn new() -> Self {
2971        std::default::Default::default()
2972    }
2973
2974    /// Sets the value of [common][crate::model::GoSettings::common].
2975    ///
2976    /// # Example
2977    /// ```ignore,no_run
2978    /// # use google_cloud_api::model::GoSettings;
2979    /// use google_cloud_api::model::CommonLanguageSettings;
2980    /// let x = GoSettings::new().set_common(CommonLanguageSettings::default()/* use setters */);
2981    /// ```
2982    pub fn set_common<T>(mut self, v: T) -> Self
2983    where
2984        T: std::convert::Into<crate::model::CommonLanguageSettings>,
2985    {
2986        self.common = std::option::Option::Some(v.into());
2987        self
2988    }
2989
2990    /// Sets or clears the value of [common][crate::model::GoSettings::common].
2991    ///
2992    /// # Example
2993    /// ```ignore,no_run
2994    /// # use google_cloud_api::model::GoSettings;
2995    /// use google_cloud_api::model::CommonLanguageSettings;
2996    /// let x = GoSettings::new().set_or_clear_common(Some(CommonLanguageSettings::default()/* use setters */));
2997    /// let x = GoSettings::new().set_or_clear_common(None::<CommonLanguageSettings>);
2998    /// ```
2999    pub fn set_or_clear_common<T>(mut self, v: std::option::Option<T>) -> Self
3000    where
3001        T: std::convert::Into<crate::model::CommonLanguageSettings>,
3002    {
3003        self.common = v.map(|x| x.into());
3004        self
3005    }
3006
3007    /// Sets the value of [renamed_services][crate::model::GoSettings::renamed_services].
3008    ///
3009    /// # Example
3010    /// ```ignore,no_run
3011    /// # use google_cloud_api::model::GoSettings;
3012    /// let x = GoSettings::new().set_renamed_services([
3013    ///     ("key0", "abc"),
3014    ///     ("key1", "xyz"),
3015    /// ]);
3016    /// ```
3017    pub fn set_renamed_services<T, K, V>(mut self, v: T) -> Self
3018    where
3019        T: std::iter::IntoIterator<Item = (K, V)>,
3020        K: std::convert::Into<std::string::String>,
3021        V: std::convert::Into<std::string::String>,
3022    {
3023        use std::iter::Iterator;
3024        self.renamed_services = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3025        self
3026    }
3027}
3028
3029impl wkt::message::Message for GoSettings {
3030    fn typename() -> &'static str {
3031        "type.googleapis.com/google.api.GoSettings"
3032    }
3033}
3034
3035/// Describes the generator configuration for a method.
3036#[derive(Clone, Default, PartialEq)]
3037#[non_exhaustive]
3038pub struct MethodSettings {
3039    /// The fully qualified name of the method, for which the options below apply.
3040    /// This is used to find the method to apply the options.
3041    ///
3042    /// Example:
3043    ///
3044    /// ```norust
3045    /// publishing:
3046    ///   method_settings:
3047    ///   - selector: google.storage.control.v2.StorageControl.CreateFolder
3048    ///     # method settings for CreateFolder...
3049    /// ```
3050    pub selector: std::string::String,
3051
3052    /// Describes settings to use for long-running operations when generating
3053    /// API methods for RPCs. Complements RPCs that use the annotations in
3054    /// google/longrunning/operations.proto.
3055    ///
3056    /// Example of a YAML configuration::
3057    ///
3058    /// ```norust
3059    /// publishing:
3060    ///   method_settings:
3061    ///   - selector: google.cloud.speech.v2.Speech.BatchRecognize
3062    ///     long_running:
3063    ///       initial_poll_delay: 60s # 1 minute
3064    ///       poll_delay_multiplier: 1.5
3065    ///       max_poll_delay: 360s # 6 minutes
3066    ///       total_poll_timeout: 54000s # 90 minutes
3067    /// ```
3068    pub long_running: std::option::Option<crate::model::method_settings::LongRunning>,
3069
3070    /// List of top-level fields of the request message, that should be
3071    /// automatically populated by the client libraries based on their
3072    /// (google.api.field_info).format. Currently supported format: UUID4.
3073    ///
3074    /// Example of a YAML configuration:
3075    ///
3076    /// ```norust
3077    /// publishing:
3078    ///   method_settings:
3079    ///   - selector: google.example.v1.ExampleService.CreateExample
3080    ///     auto_populated_fields:
3081    ///     - request_id
3082    /// ```
3083    pub auto_populated_fields: std::vec::Vec<std::string::String>,
3084
3085    /// Batching configuration for an API method in client libraries.
3086    ///
3087    /// Example of a YAML configuration:
3088    ///
3089    /// ```norust
3090    /// publishing:
3091    ///   method_settings:
3092    ///   - selector: google.example.v1.ExampleService.BatchCreateExample
3093    ///     batching:
3094    ///       element_count_threshold: 1000
3095    ///       request_byte_threshold: 100000000
3096    ///       delay_threshold_millis: 10
3097    /// ```
3098    pub batching: std::option::Option<crate::model::BatchingConfigProto>,
3099
3100    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3101}
3102
3103impl MethodSettings {
3104    /// Creates a new default instance.
3105    pub fn new() -> Self {
3106        std::default::Default::default()
3107    }
3108
3109    /// Sets the value of [selector][crate::model::MethodSettings::selector].
3110    ///
3111    /// # Example
3112    /// ```ignore,no_run
3113    /// # use google_cloud_api::model::MethodSettings;
3114    /// let x = MethodSettings::new().set_selector("example");
3115    /// ```
3116    pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3117        self.selector = v.into();
3118        self
3119    }
3120
3121    /// Sets the value of [long_running][crate::model::MethodSettings::long_running].
3122    ///
3123    /// # Example
3124    /// ```ignore,no_run
3125    /// # use google_cloud_api::model::MethodSettings;
3126    /// use google_cloud_api::model::method_settings::LongRunning;
3127    /// let x = MethodSettings::new().set_long_running(LongRunning::default()/* use setters */);
3128    /// ```
3129    pub fn set_long_running<T>(mut self, v: T) -> Self
3130    where
3131        T: std::convert::Into<crate::model::method_settings::LongRunning>,
3132    {
3133        self.long_running = std::option::Option::Some(v.into());
3134        self
3135    }
3136
3137    /// Sets or clears the value of [long_running][crate::model::MethodSettings::long_running].
3138    ///
3139    /// # Example
3140    /// ```ignore,no_run
3141    /// # use google_cloud_api::model::MethodSettings;
3142    /// use google_cloud_api::model::method_settings::LongRunning;
3143    /// let x = MethodSettings::new().set_or_clear_long_running(Some(LongRunning::default()/* use setters */));
3144    /// let x = MethodSettings::new().set_or_clear_long_running(None::<LongRunning>);
3145    /// ```
3146    pub fn set_or_clear_long_running<T>(mut self, v: std::option::Option<T>) -> Self
3147    where
3148        T: std::convert::Into<crate::model::method_settings::LongRunning>,
3149    {
3150        self.long_running = v.map(|x| x.into());
3151        self
3152    }
3153
3154    /// Sets the value of [auto_populated_fields][crate::model::MethodSettings::auto_populated_fields].
3155    ///
3156    /// # Example
3157    /// ```ignore,no_run
3158    /// # use google_cloud_api::model::MethodSettings;
3159    /// let x = MethodSettings::new().set_auto_populated_fields(["a", "b", "c"]);
3160    /// ```
3161    pub fn set_auto_populated_fields<T, V>(mut self, v: T) -> Self
3162    where
3163        T: std::iter::IntoIterator<Item = V>,
3164        V: std::convert::Into<std::string::String>,
3165    {
3166        use std::iter::Iterator;
3167        self.auto_populated_fields = v.into_iter().map(|i| i.into()).collect();
3168        self
3169    }
3170
3171    /// Sets the value of [batching][crate::model::MethodSettings::batching].
3172    ///
3173    /// # Example
3174    /// ```ignore,no_run
3175    /// # use google_cloud_api::model::MethodSettings;
3176    /// use google_cloud_api::model::BatchingConfigProto;
3177    /// let x = MethodSettings::new().set_batching(BatchingConfigProto::default()/* use setters */);
3178    /// ```
3179    pub fn set_batching<T>(mut self, v: T) -> Self
3180    where
3181        T: std::convert::Into<crate::model::BatchingConfigProto>,
3182    {
3183        self.batching = std::option::Option::Some(v.into());
3184        self
3185    }
3186
3187    /// Sets or clears the value of [batching][crate::model::MethodSettings::batching].
3188    ///
3189    /// # Example
3190    /// ```ignore,no_run
3191    /// # use google_cloud_api::model::MethodSettings;
3192    /// use google_cloud_api::model::BatchingConfigProto;
3193    /// let x = MethodSettings::new().set_or_clear_batching(Some(BatchingConfigProto::default()/* use setters */));
3194    /// let x = MethodSettings::new().set_or_clear_batching(None::<BatchingConfigProto>);
3195    /// ```
3196    pub fn set_or_clear_batching<T>(mut self, v: std::option::Option<T>) -> Self
3197    where
3198        T: std::convert::Into<crate::model::BatchingConfigProto>,
3199    {
3200        self.batching = v.map(|x| x.into());
3201        self
3202    }
3203}
3204
3205impl wkt::message::Message for MethodSettings {
3206    fn typename() -> &'static str {
3207        "type.googleapis.com/google.api.MethodSettings"
3208    }
3209}
3210
3211/// Defines additional types related to [MethodSettings].
3212pub mod method_settings {
3213    #[allow(unused_imports)]
3214    use super::*;
3215
3216    /// Describes settings to use when generating API methods that use the
3217    /// long-running operation pattern.
3218    /// All default values below are from those used in the client library
3219    /// generators (e.g.
3220    /// [Java](https://github.com/googleapis/gapic-generator-java/blob/04c2faa191a9b5a10b92392fe8482279c4404803/src/main/java/com/google/api/generator/gapic/composer/common/RetrySettingsComposer.java)).
3221    #[derive(Clone, Default, PartialEq)]
3222    #[non_exhaustive]
3223    pub struct LongRunning {
3224        /// Initial delay after which the first poll request will be made.
3225        /// Default value: 5 seconds.
3226        pub initial_poll_delay: std::option::Option<wkt::Duration>,
3227
3228        /// Multiplier to gradually increase delay between subsequent polls until it
3229        /// reaches max_poll_delay.
3230        /// Default value: 1.5.
3231        pub poll_delay_multiplier: f32,
3232
3233        /// Maximum time between two subsequent poll requests.
3234        /// Default value: 45 seconds.
3235        pub max_poll_delay: std::option::Option<wkt::Duration>,
3236
3237        /// Total polling timeout.
3238        /// Default value: 5 minutes.
3239        pub total_poll_timeout: std::option::Option<wkt::Duration>,
3240
3241        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3242    }
3243
3244    impl LongRunning {
3245        /// Creates a new default instance.
3246        pub fn new() -> Self {
3247            std::default::Default::default()
3248        }
3249
3250        /// Sets the value of [initial_poll_delay][crate::model::method_settings::LongRunning::initial_poll_delay].
3251        ///
3252        /// # Example
3253        /// ```ignore,no_run
3254        /// # use google_cloud_api::model::method_settings::LongRunning;
3255        /// use wkt::Duration;
3256        /// let x = LongRunning::new().set_initial_poll_delay(Duration::default()/* use setters */);
3257        /// ```
3258        pub fn set_initial_poll_delay<T>(mut self, v: T) -> Self
3259        where
3260            T: std::convert::Into<wkt::Duration>,
3261        {
3262            self.initial_poll_delay = std::option::Option::Some(v.into());
3263            self
3264        }
3265
3266        /// Sets or clears the value of [initial_poll_delay][crate::model::method_settings::LongRunning::initial_poll_delay].
3267        ///
3268        /// # Example
3269        /// ```ignore,no_run
3270        /// # use google_cloud_api::model::method_settings::LongRunning;
3271        /// use wkt::Duration;
3272        /// let x = LongRunning::new().set_or_clear_initial_poll_delay(Some(Duration::default()/* use setters */));
3273        /// let x = LongRunning::new().set_or_clear_initial_poll_delay(None::<Duration>);
3274        /// ```
3275        pub fn set_or_clear_initial_poll_delay<T>(mut self, v: std::option::Option<T>) -> Self
3276        where
3277            T: std::convert::Into<wkt::Duration>,
3278        {
3279            self.initial_poll_delay = v.map(|x| x.into());
3280            self
3281        }
3282
3283        /// Sets the value of [poll_delay_multiplier][crate::model::method_settings::LongRunning::poll_delay_multiplier].
3284        ///
3285        /// # Example
3286        /// ```ignore,no_run
3287        /// # use google_cloud_api::model::method_settings::LongRunning;
3288        /// let x = LongRunning::new().set_poll_delay_multiplier(42.0);
3289        /// ```
3290        pub fn set_poll_delay_multiplier<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
3291            self.poll_delay_multiplier = v.into();
3292            self
3293        }
3294
3295        /// Sets the value of [max_poll_delay][crate::model::method_settings::LongRunning::max_poll_delay].
3296        ///
3297        /// # Example
3298        /// ```ignore,no_run
3299        /// # use google_cloud_api::model::method_settings::LongRunning;
3300        /// use wkt::Duration;
3301        /// let x = LongRunning::new().set_max_poll_delay(Duration::default()/* use setters */);
3302        /// ```
3303        pub fn set_max_poll_delay<T>(mut self, v: T) -> Self
3304        where
3305            T: std::convert::Into<wkt::Duration>,
3306        {
3307            self.max_poll_delay = std::option::Option::Some(v.into());
3308            self
3309        }
3310
3311        /// Sets or clears the value of [max_poll_delay][crate::model::method_settings::LongRunning::max_poll_delay].
3312        ///
3313        /// # Example
3314        /// ```ignore,no_run
3315        /// # use google_cloud_api::model::method_settings::LongRunning;
3316        /// use wkt::Duration;
3317        /// let x = LongRunning::new().set_or_clear_max_poll_delay(Some(Duration::default()/* use setters */));
3318        /// let x = LongRunning::new().set_or_clear_max_poll_delay(None::<Duration>);
3319        /// ```
3320        pub fn set_or_clear_max_poll_delay<T>(mut self, v: std::option::Option<T>) -> Self
3321        where
3322            T: std::convert::Into<wkt::Duration>,
3323        {
3324            self.max_poll_delay = v.map(|x| x.into());
3325            self
3326        }
3327
3328        /// Sets the value of [total_poll_timeout][crate::model::method_settings::LongRunning::total_poll_timeout].
3329        ///
3330        /// # Example
3331        /// ```ignore,no_run
3332        /// # use google_cloud_api::model::method_settings::LongRunning;
3333        /// use wkt::Duration;
3334        /// let x = LongRunning::new().set_total_poll_timeout(Duration::default()/* use setters */);
3335        /// ```
3336        pub fn set_total_poll_timeout<T>(mut self, v: T) -> Self
3337        where
3338            T: std::convert::Into<wkt::Duration>,
3339        {
3340            self.total_poll_timeout = std::option::Option::Some(v.into());
3341            self
3342        }
3343
3344        /// Sets or clears the value of [total_poll_timeout][crate::model::method_settings::LongRunning::total_poll_timeout].
3345        ///
3346        /// # Example
3347        /// ```ignore,no_run
3348        /// # use google_cloud_api::model::method_settings::LongRunning;
3349        /// use wkt::Duration;
3350        /// let x = LongRunning::new().set_or_clear_total_poll_timeout(Some(Duration::default()/* use setters */));
3351        /// let x = LongRunning::new().set_or_clear_total_poll_timeout(None::<Duration>);
3352        /// ```
3353        pub fn set_or_clear_total_poll_timeout<T>(mut self, v: std::option::Option<T>) -> Self
3354        where
3355            T: std::convert::Into<wkt::Duration>,
3356        {
3357            self.total_poll_timeout = v.map(|x| x.into());
3358            self
3359        }
3360    }
3361
3362    impl wkt::message::Message for LongRunning {
3363        fn typename() -> &'static str {
3364            "type.googleapis.com/google.api.MethodSettings.LongRunning"
3365        }
3366    }
3367}
3368
3369/// This message is used to configure the generation of a subset of the RPCs in
3370/// a service for client libraries.
3371///
3372/// Note: This feature should not be used in most cases.
3373#[derive(Clone, Default, PartialEq)]
3374#[non_exhaustive]
3375pub struct SelectiveGapicGeneration {
3376    /// An allowlist of the fully qualified names of RPCs that should be included
3377    /// on public client surfaces.
3378    pub methods: std::vec::Vec<std::string::String>,
3379
3380    /// Setting this to true indicates to the client generators that methods
3381    /// that would be excluded from the generation should instead be generated
3382    /// in a way that indicates these methods should not be consumed by
3383    /// end users. How this is expressed is up to individual language
3384    /// implementations to decide. Some examples may be: added annotations,
3385    /// obfuscated identifiers, or other language idiomatic patterns.
3386    pub generate_omitted_as_internal: bool,
3387
3388    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3389}
3390
3391impl SelectiveGapicGeneration {
3392    /// Creates a new default instance.
3393    pub fn new() -> Self {
3394        std::default::Default::default()
3395    }
3396
3397    /// Sets the value of [methods][crate::model::SelectiveGapicGeneration::methods].
3398    ///
3399    /// # Example
3400    /// ```ignore,no_run
3401    /// # use google_cloud_api::model::SelectiveGapicGeneration;
3402    /// let x = SelectiveGapicGeneration::new().set_methods(["a", "b", "c"]);
3403    /// ```
3404    pub fn set_methods<T, V>(mut self, v: T) -> Self
3405    where
3406        T: std::iter::IntoIterator<Item = V>,
3407        V: std::convert::Into<std::string::String>,
3408    {
3409        use std::iter::Iterator;
3410        self.methods = v.into_iter().map(|i| i.into()).collect();
3411        self
3412    }
3413
3414    /// Sets the value of [generate_omitted_as_internal][crate::model::SelectiveGapicGeneration::generate_omitted_as_internal].
3415    ///
3416    /// # Example
3417    /// ```ignore,no_run
3418    /// # use google_cloud_api::model::SelectiveGapicGeneration;
3419    /// let x = SelectiveGapicGeneration::new().set_generate_omitted_as_internal(true);
3420    /// ```
3421    pub fn set_generate_omitted_as_internal<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3422        self.generate_omitted_as_internal = v.into();
3423        self
3424    }
3425}
3426
3427impl wkt::message::Message for SelectiveGapicGeneration {
3428    fn typename() -> &'static str {
3429        "type.googleapis.com/google.api.SelectiveGapicGeneration"
3430    }
3431}
3432
3433/// `BatchingConfigProto` defines the batching configuration for an API method.
3434#[derive(Clone, Default, PartialEq)]
3435#[non_exhaustive]
3436pub struct BatchingConfigProto {
3437    /// The thresholds which trigger a batched request to be sent.
3438    pub thresholds: std::option::Option<crate::model::BatchingSettingsProto>,
3439
3440    /// The request and response fields used in batching.
3441    pub batch_descriptor: std::option::Option<crate::model::BatchingDescriptorProto>,
3442
3443    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3444}
3445
3446impl BatchingConfigProto {
3447    /// Creates a new default instance.
3448    pub fn new() -> Self {
3449        std::default::Default::default()
3450    }
3451
3452    /// Sets the value of [thresholds][crate::model::BatchingConfigProto::thresholds].
3453    ///
3454    /// # Example
3455    /// ```ignore,no_run
3456    /// # use google_cloud_api::model::BatchingConfigProto;
3457    /// use google_cloud_api::model::BatchingSettingsProto;
3458    /// let x = BatchingConfigProto::new().set_thresholds(BatchingSettingsProto::default()/* use setters */);
3459    /// ```
3460    pub fn set_thresholds<T>(mut self, v: T) -> Self
3461    where
3462        T: std::convert::Into<crate::model::BatchingSettingsProto>,
3463    {
3464        self.thresholds = std::option::Option::Some(v.into());
3465        self
3466    }
3467
3468    /// Sets or clears the value of [thresholds][crate::model::BatchingConfigProto::thresholds].
3469    ///
3470    /// # Example
3471    /// ```ignore,no_run
3472    /// # use google_cloud_api::model::BatchingConfigProto;
3473    /// use google_cloud_api::model::BatchingSettingsProto;
3474    /// let x = BatchingConfigProto::new().set_or_clear_thresholds(Some(BatchingSettingsProto::default()/* use setters */));
3475    /// let x = BatchingConfigProto::new().set_or_clear_thresholds(None::<BatchingSettingsProto>);
3476    /// ```
3477    pub fn set_or_clear_thresholds<T>(mut self, v: std::option::Option<T>) -> Self
3478    where
3479        T: std::convert::Into<crate::model::BatchingSettingsProto>,
3480    {
3481        self.thresholds = v.map(|x| x.into());
3482        self
3483    }
3484
3485    /// Sets the value of [batch_descriptor][crate::model::BatchingConfigProto::batch_descriptor].
3486    ///
3487    /// # Example
3488    /// ```ignore,no_run
3489    /// # use google_cloud_api::model::BatchingConfigProto;
3490    /// use google_cloud_api::model::BatchingDescriptorProto;
3491    /// let x = BatchingConfigProto::new().set_batch_descriptor(BatchingDescriptorProto::default()/* use setters */);
3492    /// ```
3493    pub fn set_batch_descriptor<T>(mut self, v: T) -> Self
3494    where
3495        T: std::convert::Into<crate::model::BatchingDescriptorProto>,
3496    {
3497        self.batch_descriptor = std::option::Option::Some(v.into());
3498        self
3499    }
3500
3501    /// Sets or clears the value of [batch_descriptor][crate::model::BatchingConfigProto::batch_descriptor].
3502    ///
3503    /// # Example
3504    /// ```ignore,no_run
3505    /// # use google_cloud_api::model::BatchingConfigProto;
3506    /// use google_cloud_api::model::BatchingDescriptorProto;
3507    /// let x = BatchingConfigProto::new().set_or_clear_batch_descriptor(Some(BatchingDescriptorProto::default()/* use setters */));
3508    /// let x = BatchingConfigProto::new().set_or_clear_batch_descriptor(None::<BatchingDescriptorProto>);
3509    /// ```
3510    pub fn set_or_clear_batch_descriptor<T>(mut self, v: std::option::Option<T>) -> Self
3511    where
3512        T: std::convert::Into<crate::model::BatchingDescriptorProto>,
3513    {
3514        self.batch_descriptor = v.map(|x| x.into());
3515        self
3516    }
3517}
3518
3519impl wkt::message::Message for BatchingConfigProto {
3520    fn typename() -> &'static str {
3521        "type.googleapis.com/google.api.BatchingConfigProto"
3522    }
3523}
3524
3525/// `BatchingSettingsProto` specifies a set of batching thresholds, each of
3526/// which acts as a trigger to send a batch of messages as a request. At least
3527/// one threshold must be positive nonzero.
3528#[derive(Clone, Default, PartialEq)]
3529#[non_exhaustive]
3530pub struct BatchingSettingsProto {
3531    /// The number of elements of a field collected into a batch which, if
3532    /// exceeded, causes the batch to be sent.
3533    pub element_count_threshold: i32,
3534
3535    /// The aggregated size of the batched field which, if exceeded, causes the
3536    /// batch to be sent. This size is computed by aggregating the sizes of the
3537    /// request field to be batched, not of the entire request message.
3538    pub request_byte_threshold: i64,
3539
3540    /// The duration after which a batch should be sent, starting from the addition
3541    /// of the first message to that batch.
3542    pub delay_threshold: std::option::Option<wkt::Duration>,
3543
3544    /// The maximum number of elements collected in a batch that could be accepted
3545    /// by server.
3546    pub element_count_limit: i32,
3547
3548    /// The maximum size of the request that could be accepted by server.
3549    pub request_byte_limit: i32,
3550
3551    /// The maximum number of elements allowed by flow control.
3552    pub flow_control_element_limit: i32,
3553
3554    /// The maximum size of data allowed by flow control.
3555    pub flow_control_byte_limit: i32,
3556
3557    /// The behavior to take when the flow control limit is exceeded.
3558    pub flow_control_limit_exceeded_behavior: crate::model::FlowControlLimitExceededBehaviorProto,
3559
3560    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3561}
3562
3563impl BatchingSettingsProto {
3564    /// Creates a new default instance.
3565    pub fn new() -> Self {
3566        std::default::Default::default()
3567    }
3568
3569    /// Sets the value of [element_count_threshold][crate::model::BatchingSettingsProto::element_count_threshold].
3570    ///
3571    /// # Example
3572    /// ```ignore,no_run
3573    /// # use google_cloud_api::model::BatchingSettingsProto;
3574    /// let x = BatchingSettingsProto::new().set_element_count_threshold(42);
3575    /// ```
3576    pub fn set_element_count_threshold<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3577        self.element_count_threshold = v.into();
3578        self
3579    }
3580
3581    /// Sets the value of [request_byte_threshold][crate::model::BatchingSettingsProto::request_byte_threshold].
3582    ///
3583    /// # Example
3584    /// ```ignore,no_run
3585    /// # use google_cloud_api::model::BatchingSettingsProto;
3586    /// let x = BatchingSettingsProto::new().set_request_byte_threshold(42);
3587    /// ```
3588    pub fn set_request_byte_threshold<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
3589        self.request_byte_threshold = v.into();
3590        self
3591    }
3592
3593    /// Sets the value of [delay_threshold][crate::model::BatchingSettingsProto::delay_threshold].
3594    ///
3595    /// # Example
3596    /// ```ignore,no_run
3597    /// # use google_cloud_api::model::BatchingSettingsProto;
3598    /// use wkt::Duration;
3599    /// let x = BatchingSettingsProto::new().set_delay_threshold(Duration::default()/* use setters */);
3600    /// ```
3601    pub fn set_delay_threshold<T>(mut self, v: T) -> Self
3602    where
3603        T: std::convert::Into<wkt::Duration>,
3604    {
3605        self.delay_threshold = std::option::Option::Some(v.into());
3606        self
3607    }
3608
3609    /// Sets or clears the value of [delay_threshold][crate::model::BatchingSettingsProto::delay_threshold].
3610    ///
3611    /// # Example
3612    /// ```ignore,no_run
3613    /// # use google_cloud_api::model::BatchingSettingsProto;
3614    /// use wkt::Duration;
3615    /// let x = BatchingSettingsProto::new().set_or_clear_delay_threshold(Some(Duration::default()/* use setters */));
3616    /// let x = BatchingSettingsProto::new().set_or_clear_delay_threshold(None::<Duration>);
3617    /// ```
3618    pub fn set_or_clear_delay_threshold<T>(mut self, v: std::option::Option<T>) -> Self
3619    where
3620        T: std::convert::Into<wkt::Duration>,
3621    {
3622        self.delay_threshold = v.map(|x| x.into());
3623        self
3624    }
3625
3626    /// Sets the value of [element_count_limit][crate::model::BatchingSettingsProto::element_count_limit].
3627    ///
3628    /// # Example
3629    /// ```ignore,no_run
3630    /// # use google_cloud_api::model::BatchingSettingsProto;
3631    /// let x = BatchingSettingsProto::new().set_element_count_limit(42);
3632    /// ```
3633    pub fn set_element_count_limit<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3634        self.element_count_limit = v.into();
3635        self
3636    }
3637
3638    /// Sets the value of [request_byte_limit][crate::model::BatchingSettingsProto::request_byte_limit].
3639    ///
3640    /// # Example
3641    /// ```ignore,no_run
3642    /// # use google_cloud_api::model::BatchingSettingsProto;
3643    /// let x = BatchingSettingsProto::new().set_request_byte_limit(42);
3644    /// ```
3645    pub fn set_request_byte_limit<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3646        self.request_byte_limit = v.into();
3647        self
3648    }
3649
3650    /// Sets the value of [flow_control_element_limit][crate::model::BatchingSettingsProto::flow_control_element_limit].
3651    ///
3652    /// # Example
3653    /// ```ignore,no_run
3654    /// # use google_cloud_api::model::BatchingSettingsProto;
3655    /// let x = BatchingSettingsProto::new().set_flow_control_element_limit(42);
3656    /// ```
3657    pub fn set_flow_control_element_limit<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3658        self.flow_control_element_limit = v.into();
3659        self
3660    }
3661
3662    /// Sets the value of [flow_control_byte_limit][crate::model::BatchingSettingsProto::flow_control_byte_limit].
3663    ///
3664    /// # Example
3665    /// ```ignore,no_run
3666    /// # use google_cloud_api::model::BatchingSettingsProto;
3667    /// let x = BatchingSettingsProto::new().set_flow_control_byte_limit(42);
3668    /// ```
3669    pub fn set_flow_control_byte_limit<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3670        self.flow_control_byte_limit = v.into();
3671        self
3672    }
3673
3674    /// Sets the value of [flow_control_limit_exceeded_behavior][crate::model::BatchingSettingsProto::flow_control_limit_exceeded_behavior].
3675    ///
3676    /// # Example
3677    /// ```ignore,no_run
3678    /// # use google_cloud_api::model::BatchingSettingsProto;
3679    /// use google_cloud_api::model::FlowControlLimitExceededBehaviorProto;
3680    /// let x0 = BatchingSettingsProto::new().set_flow_control_limit_exceeded_behavior(FlowControlLimitExceededBehaviorProto::ThrowException);
3681    /// let x1 = BatchingSettingsProto::new().set_flow_control_limit_exceeded_behavior(FlowControlLimitExceededBehaviorProto::Block);
3682    /// let x2 = BatchingSettingsProto::new().set_flow_control_limit_exceeded_behavior(FlowControlLimitExceededBehaviorProto::Ignore);
3683    /// ```
3684    pub fn set_flow_control_limit_exceeded_behavior<
3685        T: std::convert::Into<crate::model::FlowControlLimitExceededBehaviorProto>,
3686    >(
3687        mut self,
3688        v: T,
3689    ) -> Self {
3690        self.flow_control_limit_exceeded_behavior = v.into();
3691        self
3692    }
3693}
3694
3695impl wkt::message::Message for BatchingSettingsProto {
3696    fn typename() -> &'static str {
3697        "type.googleapis.com/google.api.BatchingSettingsProto"
3698    }
3699}
3700
3701/// `BatchingDescriptorProto` specifies the fields of the request message to be
3702/// used for batching, and, optionally, the fields of the response message to be
3703/// used for demultiplexing.
3704#[derive(Clone, Default, PartialEq)]
3705#[non_exhaustive]
3706pub struct BatchingDescriptorProto {
3707    /// The repeated field in the request message to be aggregated by batching.
3708    pub batched_field: std::string::String,
3709
3710    /// A list of the fields in the request message. Two requests will be batched
3711    /// together only if the values of every field specified in
3712    /// `request_discriminator_fields` is equal between the two requests.
3713    pub discriminator_fields: std::vec::Vec<std::string::String>,
3714
3715    /// Optional. When present, indicates the field in the response message to be
3716    /// used to demultiplex the response into multiple response messages, in
3717    /// correspondence with the multiple request messages originally batched
3718    /// together.
3719    pub subresponse_field: std::string::String,
3720
3721    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3722}
3723
3724impl BatchingDescriptorProto {
3725    /// Creates a new default instance.
3726    pub fn new() -> Self {
3727        std::default::Default::default()
3728    }
3729
3730    /// Sets the value of [batched_field][crate::model::BatchingDescriptorProto::batched_field].
3731    ///
3732    /// # Example
3733    /// ```ignore,no_run
3734    /// # use google_cloud_api::model::BatchingDescriptorProto;
3735    /// let x = BatchingDescriptorProto::new().set_batched_field("example");
3736    /// ```
3737    pub fn set_batched_field<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3738        self.batched_field = v.into();
3739        self
3740    }
3741
3742    /// Sets the value of [discriminator_fields][crate::model::BatchingDescriptorProto::discriminator_fields].
3743    ///
3744    /// # Example
3745    /// ```ignore,no_run
3746    /// # use google_cloud_api::model::BatchingDescriptorProto;
3747    /// let x = BatchingDescriptorProto::new().set_discriminator_fields(["a", "b", "c"]);
3748    /// ```
3749    pub fn set_discriminator_fields<T, V>(mut self, v: T) -> Self
3750    where
3751        T: std::iter::IntoIterator<Item = V>,
3752        V: std::convert::Into<std::string::String>,
3753    {
3754        use std::iter::Iterator;
3755        self.discriminator_fields = v.into_iter().map(|i| i.into()).collect();
3756        self
3757    }
3758
3759    /// Sets the value of [subresponse_field][crate::model::BatchingDescriptorProto::subresponse_field].
3760    ///
3761    /// # Example
3762    /// ```ignore,no_run
3763    /// # use google_cloud_api::model::BatchingDescriptorProto;
3764    /// let x = BatchingDescriptorProto::new().set_subresponse_field("example");
3765    /// ```
3766    pub fn set_subresponse_field<T: std::convert::Into<std::string::String>>(
3767        mut self,
3768        v: T,
3769    ) -> Self {
3770        self.subresponse_field = v.into();
3771        self
3772    }
3773}
3774
3775impl wkt::message::Message for BatchingDescriptorProto {
3776    fn typename() -> &'static str {
3777        "type.googleapis.com/google.api.BatchingDescriptorProto"
3778    }
3779}
3780
3781/// Output generated from semantically comparing two versions of a service
3782/// configuration.
3783///
3784/// Includes detailed information about a field that have changed with
3785/// applicable advice about potential consequences for the change, such as
3786/// backwards-incompatibility.
3787#[derive(Clone, Default, PartialEq)]
3788#[non_exhaustive]
3789pub struct ConfigChange {
3790    /// Object hierarchy path to the change, with levels separated by a '.'
3791    /// character. For repeated fields, an applicable unique identifier field is
3792    /// used for the index (usually selector, name, or id). For maps, the term
3793    /// 'key' is used. If the field has no unique identifier, the numeric index
3794    /// is used.
3795    /// Examples:
3796    ///
3797    /// - visibility.rules[selector=="google.LibraryService.ListBooks"].restriction
3798    /// - quota.metric_rules[selector=="google"].metric_costs[key=="reads"].value
3799    /// - logging.producer_destinations[0]
3800    pub element: std::string::String,
3801
3802    /// Value of the changed object in the old Service configuration,
3803    /// in JSON format. This field will not be populated if ChangeType == ADDED.
3804    pub old_value: std::string::String,
3805
3806    /// Value of the changed object in the new Service configuration,
3807    /// in JSON format. This field will not be populated if ChangeType == REMOVED.
3808    pub new_value: std::string::String,
3809
3810    /// The type for this change, either ADDED, REMOVED, or MODIFIED.
3811    pub change_type: crate::model::ChangeType,
3812
3813    /// Collection of advice provided for this change, useful for determining the
3814    /// possible impact of this change.
3815    pub advices: std::vec::Vec<crate::model::Advice>,
3816
3817    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3818}
3819
3820impl ConfigChange {
3821    /// Creates a new default instance.
3822    pub fn new() -> Self {
3823        std::default::Default::default()
3824    }
3825
3826    /// Sets the value of [element][crate::model::ConfigChange::element].
3827    ///
3828    /// # Example
3829    /// ```ignore,no_run
3830    /// # use google_cloud_api::model::ConfigChange;
3831    /// let x = ConfigChange::new().set_element("example");
3832    /// ```
3833    pub fn set_element<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3834        self.element = v.into();
3835        self
3836    }
3837
3838    /// Sets the value of [old_value][crate::model::ConfigChange::old_value].
3839    ///
3840    /// # Example
3841    /// ```ignore,no_run
3842    /// # use google_cloud_api::model::ConfigChange;
3843    /// let x = ConfigChange::new().set_old_value("example");
3844    /// ```
3845    pub fn set_old_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3846        self.old_value = v.into();
3847        self
3848    }
3849
3850    /// Sets the value of [new_value][crate::model::ConfigChange::new_value].
3851    ///
3852    /// # Example
3853    /// ```ignore,no_run
3854    /// # use google_cloud_api::model::ConfigChange;
3855    /// let x = ConfigChange::new().set_new_value("example");
3856    /// ```
3857    pub fn set_new_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3858        self.new_value = v.into();
3859        self
3860    }
3861
3862    /// Sets the value of [change_type][crate::model::ConfigChange::change_type].
3863    ///
3864    /// # Example
3865    /// ```ignore,no_run
3866    /// # use google_cloud_api::model::ConfigChange;
3867    /// use google_cloud_api::model::ChangeType;
3868    /// let x0 = ConfigChange::new().set_change_type(ChangeType::Added);
3869    /// let x1 = ConfigChange::new().set_change_type(ChangeType::Removed);
3870    /// let x2 = ConfigChange::new().set_change_type(ChangeType::Modified);
3871    /// ```
3872    pub fn set_change_type<T: std::convert::Into<crate::model::ChangeType>>(
3873        mut self,
3874        v: T,
3875    ) -> Self {
3876        self.change_type = v.into();
3877        self
3878    }
3879
3880    /// Sets the value of [advices][crate::model::ConfigChange::advices].
3881    ///
3882    /// # Example
3883    /// ```ignore,no_run
3884    /// # use google_cloud_api::model::ConfigChange;
3885    /// use google_cloud_api::model::Advice;
3886    /// let x = ConfigChange::new()
3887    ///     .set_advices([
3888    ///         Advice::default()/* use setters */,
3889    ///         Advice::default()/* use (different) setters */,
3890    ///     ]);
3891    /// ```
3892    pub fn set_advices<T, V>(mut self, v: T) -> Self
3893    where
3894        T: std::iter::IntoIterator<Item = V>,
3895        V: std::convert::Into<crate::model::Advice>,
3896    {
3897        use std::iter::Iterator;
3898        self.advices = v.into_iter().map(|i| i.into()).collect();
3899        self
3900    }
3901}
3902
3903impl wkt::message::Message for ConfigChange {
3904    fn typename() -> &'static str {
3905        "type.googleapis.com/google.api.ConfigChange"
3906    }
3907}
3908
3909/// Generated advice about this change, used for providing more
3910/// information about how a change will affect the existing service.
3911#[derive(Clone, Default, PartialEq)]
3912#[non_exhaustive]
3913pub struct Advice {
3914    /// Useful description for why this advice was applied and what actions should
3915    /// be taken to mitigate any implied risks.
3916    pub description: std::string::String,
3917
3918    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3919}
3920
3921impl Advice {
3922    /// Creates a new default instance.
3923    pub fn new() -> Self {
3924        std::default::Default::default()
3925    }
3926
3927    /// Sets the value of [description][crate::model::Advice::description].
3928    ///
3929    /// # Example
3930    /// ```ignore,no_run
3931    /// # use google_cloud_api::model::Advice;
3932    /// let x = Advice::new().set_description("example");
3933    /// ```
3934    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3935        self.description = v.into();
3936        self
3937    }
3938}
3939
3940impl wkt::message::Message for Advice {
3941    fn typename() -> &'static str {
3942        "type.googleapis.com/google.api.Advice"
3943    }
3944}
3945
3946/// A descriptor for defining project properties for a service. One service may
3947/// have many consumer projects, and the service may want to behave differently
3948/// depending on some properties on the project. For example, a project may be
3949/// associated with a school, or a business, or a government agency, a business
3950/// type property on the project may affect how a service responds to the client.
3951/// This descriptor defines which properties are allowed to be set on a project.
3952///
3953/// Example:
3954///
3955/// ```norust
3956/// project_properties:
3957///   properties:
3958///   - name: NO_WATERMARK
3959///     type: BOOL
3960///     description: Allows usage of the API without watermarks.
3961///   - name: EXTENDED_TILE_CACHE_PERIOD
3962///     type: INT64
3963/// ```
3964#[derive(Clone, Default, PartialEq)]
3965#[non_exhaustive]
3966pub struct ProjectProperties {
3967    /// List of per consumer project-specific properties.
3968    pub properties: std::vec::Vec<crate::model::Property>,
3969
3970    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3971}
3972
3973impl ProjectProperties {
3974    /// Creates a new default instance.
3975    pub fn new() -> Self {
3976        std::default::Default::default()
3977    }
3978
3979    /// Sets the value of [properties][crate::model::ProjectProperties::properties].
3980    ///
3981    /// # Example
3982    /// ```ignore,no_run
3983    /// # use google_cloud_api::model::ProjectProperties;
3984    /// use google_cloud_api::model::Property;
3985    /// let x = ProjectProperties::new()
3986    ///     .set_properties([
3987    ///         Property::default()/* use setters */,
3988    ///         Property::default()/* use (different) setters */,
3989    ///     ]);
3990    /// ```
3991    pub fn set_properties<T, V>(mut self, v: T) -> Self
3992    where
3993        T: std::iter::IntoIterator<Item = V>,
3994        V: std::convert::Into<crate::model::Property>,
3995    {
3996        use std::iter::Iterator;
3997        self.properties = v.into_iter().map(|i| i.into()).collect();
3998        self
3999    }
4000}
4001
4002impl wkt::message::Message for ProjectProperties {
4003    fn typename() -> &'static str {
4004        "type.googleapis.com/google.api.ProjectProperties"
4005    }
4006}
4007
4008/// Defines project properties.
4009///
4010/// API services can define properties that can be assigned to consumer projects
4011/// so that backends can perform response customization without having to make
4012/// additional calls or maintain additional storage. For example, Maps API
4013/// defines properties that controls map tile cache period, or whether to embed a
4014/// watermark in a result.
4015///
4016/// These values can be set via API producer console. Only API providers can
4017/// define and set these properties.
4018#[derive(Clone, Default, PartialEq)]
4019#[non_exhaustive]
4020pub struct Property {
4021    /// The name of the property (a.k.a key).
4022    pub name: std::string::String,
4023
4024    /// The type of this property.
4025    pub r#type: crate::model::property::PropertyType,
4026
4027    /// The description of the property
4028    pub description: std::string::String,
4029
4030    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4031}
4032
4033impl Property {
4034    /// Creates a new default instance.
4035    pub fn new() -> Self {
4036        std::default::Default::default()
4037    }
4038
4039    /// Sets the value of [name][crate::model::Property::name].
4040    ///
4041    /// # Example
4042    /// ```ignore,no_run
4043    /// # use google_cloud_api::model::Property;
4044    /// let x = Property::new().set_name("example");
4045    /// ```
4046    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4047        self.name = v.into();
4048        self
4049    }
4050
4051    /// Sets the value of [r#type][crate::model::Property::type].
4052    ///
4053    /// # Example
4054    /// ```ignore,no_run
4055    /// # use google_cloud_api::model::Property;
4056    /// use google_cloud_api::model::property::PropertyType;
4057    /// let x0 = Property::new().set_type(PropertyType::Int64);
4058    /// let x1 = Property::new().set_type(PropertyType::Bool);
4059    /// let x2 = Property::new().set_type(PropertyType::String);
4060    /// ```
4061    pub fn set_type<T: std::convert::Into<crate::model::property::PropertyType>>(
4062        mut self,
4063        v: T,
4064    ) -> Self {
4065        self.r#type = v.into();
4066        self
4067    }
4068
4069    /// Sets the value of [description][crate::model::Property::description].
4070    ///
4071    /// # Example
4072    /// ```ignore,no_run
4073    /// # use google_cloud_api::model::Property;
4074    /// let x = Property::new().set_description("example");
4075    /// ```
4076    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4077        self.description = v.into();
4078        self
4079    }
4080}
4081
4082impl wkt::message::Message for Property {
4083    fn typename() -> &'static str {
4084        "type.googleapis.com/google.api.Property"
4085    }
4086}
4087
4088/// Defines additional types related to [Property].
4089pub mod property {
4090    #[allow(unused_imports)]
4091    use super::*;
4092
4093    /// Supported data type of the property values
4094    ///
4095    /// # Working with unknown values
4096    ///
4097    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4098    /// additional enum variants at any time. Adding new variants is not considered
4099    /// a breaking change. Applications should write their code in anticipation of:
4100    ///
4101    /// - New values appearing in future releases of the client library, **and**
4102    /// - New values received dynamically, without application changes.
4103    ///
4104    /// Please consult the [Working with enums] section in the user guide for some
4105    /// guidelines.
4106    ///
4107    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
4108    #[derive(Clone, Debug, PartialEq)]
4109    #[non_exhaustive]
4110    pub enum PropertyType {
4111        /// The type is unspecified, and will result in an error.
4112        Unspecified,
4113        /// The type is `int64`.
4114        Int64,
4115        /// The type is `bool`.
4116        Bool,
4117        /// The type is `string`.
4118        String,
4119        /// The type is 'double'.
4120        Double,
4121        /// If set, the enum was initialized with an unknown value.
4122        ///
4123        /// Applications can examine the value using [PropertyType::value] or
4124        /// [PropertyType::name].
4125        UnknownValue(property_type::UnknownValue),
4126    }
4127
4128    #[doc(hidden)]
4129    pub mod property_type {
4130        #[allow(unused_imports)]
4131        use super::*;
4132        #[derive(Clone, Debug, PartialEq)]
4133        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4134    }
4135
4136    impl PropertyType {
4137        /// Gets the enum value.
4138        ///
4139        /// Returns `None` if the enum contains an unknown value deserialized from
4140        /// the string representation of enums.
4141        pub fn value(&self) -> std::option::Option<i32> {
4142            match self {
4143                Self::Unspecified => std::option::Option::Some(0),
4144                Self::Int64 => std::option::Option::Some(1),
4145                Self::Bool => std::option::Option::Some(2),
4146                Self::String => std::option::Option::Some(3),
4147                Self::Double => std::option::Option::Some(4),
4148                Self::UnknownValue(u) => u.0.value(),
4149            }
4150        }
4151
4152        /// Gets the enum value as a string.
4153        ///
4154        /// Returns `None` if the enum contains an unknown value deserialized from
4155        /// the integer representation of enums.
4156        pub fn name(&self) -> std::option::Option<&str> {
4157            match self {
4158                Self::Unspecified => std::option::Option::Some("UNSPECIFIED"),
4159                Self::Int64 => std::option::Option::Some("INT64"),
4160                Self::Bool => std::option::Option::Some("BOOL"),
4161                Self::String => std::option::Option::Some("STRING"),
4162                Self::Double => std::option::Option::Some("DOUBLE"),
4163                Self::UnknownValue(u) => u.0.name(),
4164            }
4165        }
4166    }
4167
4168    impl std::default::Default for PropertyType {
4169        fn default() -> Self {
4170            use std::convert::From;
4171            Self::from(0)
4172        }
4173    }
4174
4175    impl std::fmt::Display for PropertyType {
4176        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4177            wkt::internal::display_enum(f, self.name(), self.value())
4178        }
4179    }
4180
4181    impl std::convert::From<i32> for PropertyType {
4182        fn from(value: i32) -> Self {
4183            match value {
4184                0 => Self::Unspecified,
4185                1 => Self::Int64,
4186                2 => Self::Bool,
4187                3 => Self::String,
4188                4 => Self::Double,
4189                _ => Self::UnknownValue(property_type::UnknownValue(
4190                    wkt::internal::UnknownEnumValue::Integer(value),
4191                )),
4192            }
4193        }
4194    }
4195
4196    impl std::convert::From<&str> for PropertyType {
4197        fn from(value: &str) -> Self {
4198            use std::string::ToString;
4199            match value {
4200                "UNSPECIFIED" => Self::Unspecified,
4201                "INT64" => Self::Int64,
4202                "BOOL" => Self::Bool,
4203                "STRING" => Self::String,
4204                "DOUBLE" => Self::Double,
4205                _ => Self::UnknownValue(property_type::UnknownValue(
4206                    wkt::internal::UnknownEnumValue::String(value.to_string()),
4207                )),
4208            }
4209        }
4210    }
4211
4212    impl serde::ser::Serialize for PropertyType {
4213        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4214        where
4215            S: serde::Serializer,
4216        {
4217            match self {
4218                Self::Unspecified => serializer.serialize_i32(0),
4219                Self::Int64 => serializer.serialize_i32(1),
4220                Self::Bool => serializer.serialize_i32(2),
4221                Self::String => serializer.serialize_i32(3),
4222                Self::Double => serializer.serialize_i32(4),
4223                Self::UnknownValue(u) => u.0.serialize(serializer),
4224            }
4225        }
4226    }
4227
4228    impl<'de> serde::de::Deserialize<'de> for PropertyType {
4229        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4230        where
4231            D: serde::Deserializer<'de>,
4232        {
4233            deserializer.deserialize_any(wkt::internal::EnumVisitor::<PropertyType>::new(
4234                ".google.api.Property.PropertyType",
4235            ))
4236        }
4237    }
4238}
4239
4240/// `Context` defines which contexts an API requests.
4241///
4242/// Example:
4243///
4244/// ```norust
4245/// context:
4246///   rules:
4247///   - selector: "*"
4248///     requested:
4249///     - google.rpc.context.ProjectContext
4250///     - google.rpc.context.OriginContext
4251/// ```
4252///
4253/// The above specifies that all methods in the API request
4254/// `google.rpc.context.ProjectContext` and
4255/// `google.rpc.context.OriginContext`.
4256///
4257/// Available context types are defined in package
4258/// `google.rpc.context`.
4259///
4260/// This also provides mechanism to allowlist any protobuf message extension that
4261/// can be sent in grpc metadata using “x-goog-ext-<extension_id>-bin” and
4262/// “x-goog-ext-<extension_id>-jspb” format. For example, list any service
4263/// specific protobuf types that can appear in grpc metadata as follows in your
4264/// yaml file:
4265///
4266/// Example:
4267///
4268/// ```norust
4269/// context:
4270///   rules:
4271///    - selector: "google.example.library.v1.LibraryService.CreateBook"
4272///      allowed_request_extensions:
4273///      - google.foo.v1.NewExtension
4274///      allowed_response_extensions:
4275///      - google.foo.v1.NewExtension
4276/// ```
4277///
4278/// You can also specify extension ID instead of fully qualified extension name
4279/// here.
4280#[derive(Clone, Default, PartialEq)]
4281#[non_exhaustive]
4282pub struct Context {
4283    /// A list of RPC context rules that apply to individual API methods.
4284    ///
4285    /// **NOTE:** All service configuration rules follow "last one wins" order.
4286    pub rules: std::vec::Vec<crate::model::ContextRule>,
4287
4288    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4289}
4290
4291impl Context {
4292    /// Creates a new default instance.
4293    pub fn new() -> Self {
4294        std::default::Default::default()
4295    }
4296
4297    /// Sets the value of [rules][crate::model::Context::rules].
4298    ///
4299    /// # Example
4300    /// ```ignore,no_run
4301    /// # use google_cloud_api::model::Context;
4302    /// use google_cloud_api::model::ContextRule;
4303    /// let x = Context::new()
4304    ///     .set_rules([
4305    ///         ContextRule::default()/* use setters */,
4306    ///         ContextRule::default()/* use (different) setters */,
4307    ///     ]);
4308    /// ```
4309    pub fn set_rules<T, V>(mut self, v: T) -> Self
4310    where
4311        T: std::iter::IntoIterator<Item = V>,
4312        V: std::convert::Into<crate::model::ContextRule>,
4313    {
4314        use std::iter::Iterator;
4315        self.rules = v.into_iter().map(|i| i.into()).collect();
4316        self
4317    }
4318}
4319
4320impl wkt::message::Message for Context {
4321    fn typename() -> &'static str {
4322        "type.googleapis.com/google.api.Context"
4323    }
4324}
4325
4326/// A context rule provides information about the context for an individual API
4327/// element.
4328#[derive(Clone, Default, PartialEq)]
4329#[non_exhaustive]
4330pub struct ContextRule {
4331    /// Selects the methods to which this rule applies.
4332    ///
4333    /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
4334    /// details.
4335    ///
4336    /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
4337    pub selector: std::string::String,
4338
4339    /// A list of full type names of requested contexts, only the requested context
4340    /// will be made available to the backend.
4341    pub requested: std::vec::Vec<std::string::String>,
4342
4343    /// A list of full type names of provided contexts. It is used to support
4344    /// propagating HTTP headers and ETags from the response extension.
4345    pub provided: std::vec::Vec<std::string::String>,
4346
4347    /// A list of full type names or extension IDs of extensions allowed in grpc
4348    /// side channel from client to backend.
4349    pub allowed_request_extensions: std::vec::Vec<std::string::String>,
4350
4351    /// A list of full type names or extension IDs of extensions allowed in grpc
4352    /// side channel from backend to client.
4353    pub allowed_response_extensions: std::vec::Vec<std::string::String>,
4354
4355    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4356}
4357
4358impl ContextRule {
4359    /// Creates a new default instance.
4360    pub fn new() -> Self {
4361        std::default::Default::default()
4362    }
4363
4364    /// Sets the value of [selector][crate::model::ContextRule::selector].
4365    ///
4366    /// # Example
4367    /// ```ignore,no_run
4368    /// # use google_cloud_api::model::ContextRule;
4369    /// let x = ContextRule::new().set_selector("example");
4370    /// ```
4371    pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4372        self.selector = v.into();
4373        self
4374    }
4375
4376    /// Sets the value of [requested][crate::model::ContextRule::requested].
4377    ///
4378    /// # Example
4379    /// ```ignore,no_run
4380    /// # use google_cloud_api::model::ContextRule;
4381    /// let x = ContextRule::new().set_requested(["a", "b", "c"]);
4382    /// ```
4383    pub fn set_requested<T, V>(mut self, v: T) -> Self
4384    where
4385        T: std::iter::IntoIterator<Item = V>,
4386        V: std::convert::Into<std::string::String>,
4387    {
4388        use std::iter::Iterator;
4389        self.requested = v.into_iter().map(|i| i.into()).collect();
4390        self
4391    }
4392
4393    /// Sets the value of [provided][crate::model::ContextRule::provided].
4394    ///
4395    /// # Example
4396    /// ```ignore,no_run
4397    /// # use google_cloud_api::model::ContextRule;
4398    /// let x = ContextRule::new().set_provided(["a", "b", "c"]);
4399    /// ```
4400    pub fn set_provided<T, V>(mut self, v: T) -> Self
4401    where
4402        T: std::iter::IntoIterator<Item = V>,
4403        V: std::convert::Into<std::string::String>,
4404    {
4405        use std::iter::Iterator;
4406        self.provided = v.into_iter().map(|i| i.into()).collect();
4407        self
4408    }
4409
4410    /// Sets the value of [allowed_request_extensions][crate::model::ContextRule::allowed_request_extensions].
4411    ///
4412    /// # Example
4413    /// ```ignore,no_run
4414    /// # use google_cloud_api::model::ContextRule;
4415    /// let x = ContextRule::new().set_allowed_request_extensions(["a", "b", "c"]);
4416    /// ```
4417    pub fn set_allowed_request_extensions<T, V>(mut self, v: T) -> Self
4418    where
4419        T: std::iter::IntoIterator<Item = V>,
4420        V: std::convert::Into<std::string::String>,
4421    {
4422        use std::iter::Iterator;
4423        self.allowed_request_extensions = v.into_iter().map(|i| i.into()).collect();
4424        self
4425    }
4426
4427    /// Sets the value of [allowed_response_extensions][crate::model::ContextRule::allowed_response_extensions].
4428    ///
4429    /// # Example
4430    /// ```ignore,no_run
4431    /// # use google_cloud_api::model::ContextRule;
4432    /// let x = ContextRule::new().set_allowed_response_extensions(["a", "b", "c"]);
4433    /// ```
4434    pub fn set_allowed_response_extensions<T, V>(mut self, v: T) -> Self
4435    where
4436        T: std::iter::IntoIterator<Item = V>,
4437        V: std::convert::Into<std::string::String>,
4438    {
4439        use std::iter::Iterator;
4440        self.allowed_response_extensions = v.into_iter().map(|i| i.into()).collect();
4441        self
4442    }
4443}
4444
4445impl wkt::message::Message for ContextRule {
4446    fn typename() -> &'static str {
4447        "type.googleapis.com/google.api.ContextRule"
4448    }
4449}
4450
4451/// Selects and configures the service controller used by the service.
4452///
4453/// Example:
4454///
4455/// ```norust
4456/// control:
4457///   environment: servicecontrol.googleapis.com
4458/// ```
4459#[derive(Clone, Default, PartialEq)]
4460#[non_exhaustive]
4461pub struct Control {
4462    /// The service controller environment to use. If empty, no control plane
4463    /// features (like quota and billing) will be enabled. The recommended value
4464    /// for most services is servicecontrol.googleapis.com.
4465    pub environment: std::string::String,
4466
4467    /// Defines policies applying to the API methods of the service.
4468    pub method_policies: std::vec::Vec<crate::model::MethodPolicy>,
4469
4470    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4471}
4472
4473impl Control {
4474    /// Creates a new default instance.
4475    pub fn new() -> Self {
4476        std::default::Default::default()
4477    }
4478
4479    /// Sets the value of [environment][crate::model::Control::environment].
4480    ///
4481    /// # Example
4482    /// ```ignore,no_run
4483    /// # use google_cloud_api::model::Control;
4484    /// let x = Control::new().set_environment("example");
4485    /// ```
4486    pub fn set_environment<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4487        self.environment = v.into();
4488        self
4489    }
4490
4491    /// Sets the value of [method_policies][crate::model::Control::method_policies].
4492    ///
4493    /// # Example
4494    /// ```ignore,no_run
4495    /// # use google_cloud_api::model::Control;
4496    /// use google_cloud_api::model::MethodPolicy;
4497    /// let x = Control::new()
4498    ///     .set_method_policies([
4499    ///         MethodPolicy::default()/* use setters */,
4500    ///         MethodPolicy::default()/* use (different) setters */,
4501    ///     ]);
4502    /// ```
4503    pub fn set_method_policies<T, V>(mut self, v: T) -> Self
4504    where
4505        T: std::iter::IntoIterator<Item = V>,
4506        V: std::convert::Into<crate::model::MethodPolicy>,
4507    {
4508        use std::iter::Iterator;
4509        self.method_policies = v.into_iter().map(|i| i.into()).collect();
4510        self
4511    }
4512}
4513
4514impl wkt::message::Message for Control {
4515    fn typename() -> &'static str {
4516        "type.googleapis.com/google.api.Control"
4517    }
4518}
4519
4520/// `Distribution` contains summary statistics for a population of values. It
4521/// optionally contains a histogram representing the distribution of those values
4522/// across a set of buckets.
4523///
4524/// The summary statistics are the count, mean, sum of the squared deviation from
4525/// the mean, the minimum, and the maximum of the set of population of values.
4526/// The histogram is based on a sequence of buckets and gives a count of values
4527/// that fall into each bucket. The boundaries of the buckets are given either
4528/// explicitly or by formulas for buckets of fixed or exponentially increasing
4529/// widths.
4530///
4531/// Although it is not forbidden, it is generally a bad idea to include
4532/// non-finite values (infinities or NaNs) in the population of values, as this
4533/// will render the `mean` and `sum_of_squared_deviation` fields meaningless.
4534#[derive(Clone, Default, PartialEq)]
4535#[non_exhaustive]
4536pub struct Distribution {
4537    /// The number of values in the population. Must be non-negative. This value
4538    /// must equal the sum of the values in `bucket_counts` if a histogram is
4539    /// provided.
4540    pub count: i64,
4541
4542    /// The arithmetic mean of the values in the population. If `count` is zero
4543    /// then this field must be zero.
4544    pub mean: f64,
4545
4546    /// The sum of squared deviations from the mean of the values in the
4547    /// population. For values x_i this is:
4548    ///
4549    /// ```norust
4550    /// Sum[i=1..n]((x_i - mean)^2)
4551    /// ```
4552    ///
4553    /// Knuth, "The Art of Computer Programming", Vol. 2, page 232, 3rd edition
4554    /// describes Welford's method for accumulating this sum in one pass.
4555    ///
4556    /// If `count` is zero then this field must be zero.
4557    pub sum_of_squared_deviation: f64,
4558
4559    /// If specified, contains the range of the population values. The field
4560    /// must not be present if the `count` is zero.
4561    pub range: std::option::Option<crate::model::distribution::Range>,
4562
4563    /// Defines the histogram bucket boundaries. If the distribution does not
4564    /// contain a histogram, then omit this field.
4565    pub bucket_options: std::option::Option<crate::model::distribution::BucketOptions>,
4566
4567    /// The number of values in each bucket of the histogram, as described in
4568    /// `bucket_options`. If the distribution does not have a histogram, then omit
4569    /// this field. If there is a histogram, then the sum of the values in
4570    /// `bucket_counts` must equal the value in the `count` field of the
4571    /// distribution.
4572    ///
4573    /// If present, `bucket_counts` should contain N values, where N is the number
4574    /// of buckets specified in `bucket_options`. If you supply fewer than N
4575    /// values, the remaining values are assumed to be 0.
4576    ///
4577    /// The order of the values in `bucket_counts` follows the bucket numbering
4578    /// schemes described for the three bucket types. The first value must be the
4579    /// count for the underflow bucket (number 0). The next N-2 values are the
4580    /// counts for the finite buckets (number 1 through N-2). The N'th value in
4581    /// `bucket_counts` is the count for the overflow bucket (number N-1).
4582    pub bucket_counts: std::vec::Vec<i64>,
4583
4584    /// Must be in increasing order of `value` field.
4585    pub exemplars: std::vec::Vec<crate::model::distribution::Exemplar>,
4586
4587    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4588}
4589
4590impl Distribution {
4591    /// Creates a new default instance.
4592    pub fn new() -> Self {
4593        std::default::Default::default()
4594    }
4595
4596    /// Sets the value of [count][crate::model::Distribution::count].
4597    ///
4598    /// # Example
4599    /// ```ignore,no_run
4600    /// # use google_cloud_api::model::Distribution;
4601    /// let x = Distribution::new().set_count(42);
4602    /// ```
4603    pub fn set_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
4604        self.count = v.into();
4605        self
4606    }
4607
4608    /// Sets the value of [mean][crate::model::Distribution::mean].
4609    ///
4610    /// # Example
4611    /// ```ignore,no_run
4612    /// # use google_cloud_api::model::Distribution;
4613    /// let x = Distribution::new().set_mean(42.0);
4614    /// ```
4615    pub fn set_mean<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
4616        self.mean = v.into();
4617        self
4618    }
4619
4620    /// Sets the value of [sum_of_squared_deviation][crate::model::Distribution::sum_of_squared_deviation].
4621    ///
4622    /// # Example
4623    /// ```ignore,no_run
4624    /// # use google_cloud_api::model::Distribution;
4625    /// let x = Distribution::new().set_sum_of_squared_deviation(42.0);
4626    /// ```
4627    pub fn set_sum_of_squared_deviation<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
4628        self.sum_of_squared_deviation = v.into();
4629        self
4630    }
4631
4632    /// Sets the value of [range][crate::model::Distribution::range].
4633    ///
4634    /// # Example
4635    /// ```ignore,no_run
4636    /// # use google_cloud_api::model::Distribution;
4637    /// use google_cloud_api::model::distribution::Range;
4638    /// let x = Distribution::new().set_range(Range::default()/* use setters */);
4639    /// ```
4640    pub fn set_range<T>(mut self, v: T) -> Self
4641    where
4642        T: std::convert::Into<crate::model::distribution::Range>,
4643    {
4644        self.range = std::option::Option::Some(v.into());
4645        self
4646    }
4647
4648    /// Sets or clears the value of [range][crate::model::Distribution::range].
4649    ///
4650    /// # Example
4651    /// ```ignore,no_run
4652    /// # use google_cloud_api::model::Distribution;
4653    /// use google_cloud_api::model::distribution::Range;
4654    /// let x = Distribution::new().set_or_clear_range(Some(Range::default()/* use setters */));
4655    /// let x = Distribution::new().set_or_clear_range(None::<Range>);
4656    /// ```
4657    pub fn set_or_clear_range<T>(mut self, v: std::option::Option<T>) -> Self
4658    where
4659        T: std::convert::Into<crate::model::distribution::Range>,
4660    {
4661        self.range = v.map(|x| x.into());
4662        self
4663    }
4664
4665    /// Sets the value of [bucket_options][crate::model::Distribution::bucket_options].
4666    ///
4667    /// # Example
4668    /// ```ignore,no_run
4669    /// # use google_cloud_api::model::Distribution;
4670    /// use google_cloud_api::model::distribution::BucketOptions;
4671    /// let x = Distribution::new().set_bucket_options(BucketOptions::default()/* use setters */);
4672    /// ```
4673    pub fn set_bucket_options<T>(mut self, v: T) -> Self
4674    where
4675        T: std::convert::Into<crate::model::distribution::BucketOptions>,
4676    {
4677        self.bucket_options = std::option::Option::Some(v.into());
4678        self
4679    }
4680
4681    /// Sets or clears the value of [bucket_options][crate::model::Distribution::bucket_options].
4682    ///
4683    /// # Example
4684    /// ```ignore,no_run
4685    /// # use google_cloud_api::model::Distribution;
4686    /// use google_cloud_api::model::distribution::BucketOptions;
4687    /// let x = Distribution::new().set_or_clear_bucket_options(Some(BucketOptions::default()/* use setters */));
4688    /// let x = Distribution::new().set_or_clear_bucket_options(None::<BucketOptions>);
4689    /// ```
4690    pub fn set_or_clear_bucket_options<T>(mut self, v: std::option::Option<T>) -> Self
4691    where
4692        T: std::convert::Into<crate::model::distribution::BucketOptions>,
4693    {
4694        self.bucket_options = v.map(|x| x.into());
4695        self
4696    }
4697
4698    /// Sets the value of [bucket_counts][crate::model::Distribution::bucket_counts].
4699    ///
4700    /// # Example
4701    /// ```ignore,no_run
4702    /// # use google_cloud_api::model::Distribution;
4703    /// let x = Distribution::new().set_bucket_counts([1, 2, 3]);
4704    /// ```
4705    pub fn set_bucket_counts<T, V>(mut self, v: T) -> Self
4706    where
4707        T: std::iter::IntoIterator<Item = V>,
4708        V: std::convert::Into<i64>,
4709    {
4710        use std::iter::Iterator;
4711        self.bucket_counts = v.into_iter().map(|i| i.into()).collect();
4712        self
4713    }
4714
4715    /// Sets the value of [exemplars][crate::model::Distribution::exemplars].
4716    ///
4717    /// # Example
4718    /// ```ignore,no_run
4719    /// # use google_cloud_api::model::Distribution;
4720    /// use google_cloud_api::model::distribution::Exemplar;
4721    /// let x = Distribution::new()
4722    ///     .set_exemplars([
4723    ///         Exemplar::default()/* use setters */,
4724    ///         Exemplar::default()/* use (different) setters */,
4725    ///     ]);
4726    /// ```
4727    pub fn set_exemplars<T, V>(mut self, v: T) -> Self
4728    where
4729        T: std::iter::IntoIterator<Item = V>,
4730        V: std::convert::Into<crate::model::distribution::Exemplar>,
4731    {
4732        use std::iter::Iterator;
4733        self.exemplars = v.into_iter().map(|i| i.into()).collect();
4734        self
4735    }
4736}
4737
4738impl wkt::message::Message for Distribution {
4739    fn typename() -> &'static str {
4740        "type.googleapis.com/google.api.Distribution"
4741    }
4742}
4743
4744/// Defines additional types related to [Distribution].
4745pub mod distribution {
4746    #[allow(unused_imports)]
4747    use super::*;
4748
4749    /// The range of the population values.
4750    #[derive(Clone, Default, PartialEq)]
4751    #[non_exhaustive]
4752    pub struct Range {
4753        /// The minimum of the population values.
4754        pub min: f64,
4755
4756        /// The maximum of the population values.
4757        pub max: f64,
4758
4759        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4760    }
4761
4762    impl Range {
4763        /// Creates a new default instance.
4764        pub fn new() -> Self {
4765            std::default::Default::default()
4766        }
4767
4768        /// Sets the value of [min][crate::model::distribution::Range::min].
4769        ///
4770        /// # Example
4771        /// ```ignore,no_run
4772        /// # use google_cloud_api::model::distribution::Range;
4773        /// let x = Range::new().set_min(42.0);
4774        /// ```
4775        pub fn set_min<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
4776            self.min = v.into();
4777            self
4778        }
4779
4780        /// Sets the value of [max][crate::model::distribution::Range::max].
4781        ///
4782        /// # Example
4783        /// ```ignore,no_run
4784        /// # use google_cloud_api::model::distribution::Range;
4785        /// let x = Range::new().set_max(42.0);
4786        /// ```
4787        pub fn set_max<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
4788            self.max = v.into();
4789            self
4790        }
4791    }
4792
4793    impl wkt::message::Message for Range {
4794        fn typename() -> &'static str {
4795            "type.googleapis.com/google.api.Distribution.Range"
4796        }
4797    }
4798
4799    /// `BucketOptions` describes the bucket boundaries used to create a histogram
4800    /// for the distribution. The buckets can be in a linear sequence, an
4801    /// exponential sequence, or each bucket can be specified explicitly.
4802    /// `BucketOptions` does not include the number of values in each bucket.
4803    ///
4804    /// A bucket has an inclusive lower bound and exclusive upper bound for the
4805    /// values that are counted for that bucket. The upper bound of a bucket must
4806    /// be strictly greater than the lower bound. The sequence of N buckets for a
4807    /// distribution consists of an underflow bucket (number 0), zero or more
4808    /// finite buckets (number 1 through N - 2) and an overflow bucket (number N -
4809    /// 1). The buckets are contiguous: the lower bound of bucket i (i > 0) is the
4810    /// same as the upper bound of bucket i - 1. The buckets span the whole range
4811    /// of finite values: lower bound of the underflow bucket is -infinity and the
4812    /// upper bound of the overflow bucket is +infinity. The finite buckets are
4813    /// so-called because both bounds are finite.
4814    #[derive(Clone, Default, PartialEq)]
4815    #[non_exhaustive]
4816    pub struct BucketOptions {
4817        /// Exactly one of these three fields must be set.
4818        pub options: std::option::Option<crate::model::distribution::bucket_options::Options>,
4819
4820        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4821    }
4822
4823    impl BucketOptions {
4824        /// Creates a new default instance.
4825        pub fn new() -> Self {
4826            std::default::Default::default()
4827        }
4828
4829        /// Sets the value of [options][crate::model::distribution::BucketOptions::options].
4830        ///
4831        /// Note that all the setters affecting `options` are mutually
4832        /// exclusive.
4833        ///
4834        /// # Example
4835        /// ```ignore,no_run
4836        /// # use google_cloud_api::model::distribution::BucketOptions;
4837        /// use google_cloud_api::model::distribution::bucket_options::Linear;
4838        /// let x = BucketOptions::new().set_options(Some(
4839        ///     google_cloud_api::model::distribution::bucket_options::Options::LinearBuckets(Linear::default().into())));
4840        /// ```
4841        pub fn set_options<
4842            T: std::convert::Into<
4843                    std::option::Option<crate::model::distribution::bucket_options::Options>,
4844                >,
4845        >(
4846            mut self,
4847            v: T,
4848        ) -> Self {
4849            self.options = v.into();
4850            self
4851        }
4852
4853        /// The value of [options][crate::model::distribution::BucketOptions::options]
4854        /// if it holds a `LinearBuckets`, `None` if the field is not set or
4855        /// holds a different branch.
4856        pub fn linear_buckets(
4857            &self,
4858        ) -> std::option::Option<&std::boxed::Box<crate::model::distribution::bucket_options::Linear>>
4859        {
4860            #[allow(unreachable_patterns)]
4861            self.options.as_ref().and_then(|v| match v {
4862                crate::model::distribution::bucket_options::Options::LinearBuckets(v) => {
4863                    std::option::Option::Some(v)
4864                }
4865                _ => std::option::Option::None,
4866            })
4867        }
4868
4869        /// Sets the value of [options][crate::model::distribution::BucketOptions::options]
4870        /// to hold a `LinearBuckets`.
4871        ///
4872        /// Note that all the setters affecting `options` are
4873        /// mutually exclusive.
4874        ///
4875        /// # Example
4876        /// ```ignore,no_run
4877        /// # use google_cloud_api::model::distribution::BucketOptions;
4878        /// use google_cloud_api::model::distribution::bucket_options::Linear;
4879        /// let x = BucketOptions::new().set_linear_buckets(Linear::default()/* use setters */);
4880        /// assert!(x.linear_buckets().is_some());
4881        /// assert!(x.exponential_buckets().is_none());
4882        /// assert!(x.explicit_buckets().is_none());
4883        /// ```
4884        pub fn set_linear_buckets<
4885            T: std::convert::Into<std::boxed::Box<crate::model::distribution::bucket_options::Linear>>,
4886        >(
4887            mut self,
4888            v: T,
4889        ) -> Self {
4890            self.options = std::option::Option::Some(
4891                crate::model::distribution::bucket_options::Options::LinearBuckets(v.into()),
4892            );
4893            self
4894        }
4895
4896        /// The value of [options][crate::model::distribution::BucketOptions::options]
4897        /// if it holds a `ExponentialBuckets`, `None` if the field is not set or
4898        /// holds a different branch.
4899        pub fn exponential_buckets(
4900            &self,
4901        ) -> std::option::Option<
4902            &std::boxed::Box<crate::model::distribution::bucket_options::Exponential>,
4903        > {
4904            #[allow(unreachable_patterns)]
4905            self.options.as_ref().and_then(|v| match v {
4906                crate::model::distribution::bucket_options::Options::ExponentialBuckets(v) => {
4907                    std::option::Option::Some(v)
4908                }
4909                _ => std::option::Option::None,
4910            })
4911        }
4912
4913        /// Sets the value of [options][crate::model::distribution::BucketOptions::options]
4914        /// to hold a `ExponentialBuckets`.
4915        ///
4916        /// Note that all the setters affecting `options` are
4917        /// mutually exclusive.
4918        ///
4919        /// # Example
4920        /// ```ignore,no_run
4921        /// # use google_cloud_api::model::distribution::BucketOptions;
4922        /// use google_cloud_api::model::distribution::bucket_options::Exponential;
4923        /// let x = BucketOptions::new().set_exponential_buckets(Exponential::default()/* use setters */);
4924        /// assert!(x.exponential_buckets().is_some());
4925        /// assert!(x.linear_buckets().is_none());
4926        /// assert!(x.explicit_buckets().is_none());
4927        /// ```
4928        pub fn set_exponential_buckets<
4929            T: std::convert::Into<
4930                    std::boxed::Box<crate::model::distribution::bucket_options::Exponential>,
4931                >,
4932        >(
4933            mut self,
4934            v: T,
4935        ) -> Self {
4936            self.options = std::option::Option::Some(
4937                crate::model::distribution::bucket_options::Options::ExponentialBuckets(v.into()),
4938            );
4939            self
4940        }
4941
4942        /// The value of [options][crate::model::distribution::BucketOptions::options]
4943        /// if it holds a `ExplicitBuckets`, `None` if the field is not set or
4944        /// holds a different branch.
4945        pub fn explicit_buckets(
4946            &self,
4947        ) -> std::option::Option<
4948            &std::boxed::Box<crate::model::distribution::bucket_options::Explicit>,
4949        > {
4950            #[allow(unreachable_patterns)]
4951            self.options.as_ref().and_then(|v| match v {
4952                crate::model::distribution::bucket_options::Options::ExplicitBuckets(v) => {
4953                    std::option::Option::Some(v)
4954                }
4955                _ => std::option::Option::None,
4956            })
4957        }
4958
4959        /// Sets the value of [options][crate::model::distribution::BucketOptions::options]
4960        /// to hold a `ExplicitBuckets`.
4961        ///
4962        /// Note that all the setters affecting `options` are
4963        /// mutually exclusive.
4964        ///
4965        /// # Example
4966        /// ```ignore,no_run
4967        /// # use google_cloud_api::model::distribution::BucketOptions;
4968        /// use google_cloud_api::model::distribution::bucket_options::Explicit;
4969        /// let x = BucketOptions::new().set_explicit_buckets(Explicit::default()/* use setters */);
4970        /// assert!(x.explicit_buckets().is_some());
4971        /// assert!(x.linear_buckets().is_none());
4972        /// assert!(x.exponential_buckets().is_none());
4973        /// ```
4974        pub fn set_explicit_buckets<
4975            T: std::convert::Into<
4976                    std::boxed::Box<crate::model::distribution::bucket_options::Explicit>,
4977                >,
4978        >(
4979            mut self,
4980            v: T,
4981        ) -> Self {
4982            self.options = std::option::Option::Some(
4983                crate::model::distribution::bucket_options::Options::ExplicitBuckets(v.into()),
4984            );
4985            self
4986        }
4987    }
4988
4989    impl wkt::message::Message for BucketOptions {
4990        fn typename() -> &'static str {
4991            "type.googleapis.com/google.api.Distribution.BucketOptions"
4992        }
4993    }
4994
4995    /// Defines additional types related to [BucketOptions].
4996    pub mod bucket_options {
4997        #[allow(unused_imports)]
4998        use super::*;
4999
5000        /// Specifies a linear sequence of buckets that all have the same width
5001        /// (except overflow and underflow). Each bucket represents a constant
5002        /// absolute uncertainty on the specific value in the bucket.
5003        ///
5004        /// There are `num_finite_buckets + 2` (= N) buckets. Bucket `i` has the
5005        /// following boundaries:
5006        ///
5007        /// Upper bound (0 <= i < N-1):     offset + (width * i).
5008        ///
5009        /// Lower bound (1 <= i < N):       offset + (width * (i - 1)).
5010        #[derive(Clone, Default, PartialEq)]
5011        #[non_exhaustive]
5012        pub struct Linear {
5013            /// Must be greater than 0.
5014            pub num_finite_buckets: i32,
5015
5016            /// Must be greater than 0.
5017            pub width: f64,
5018
5019            /// Lower bound of the first bucket.
5020            pub offset: f64,
5021
5022            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5023        }
5024
5025        impl Linear {
5026            /// Creates a new default instance.
5027            pub fn new() -> Self {
5028                std::default::Default::default()
5029            }
5030
5031            /// Sets the value of [num_finite_buckets][crate::model::distribution::bucket_options::Linear::num_finite_buckets].
5032            ///
5033            /// # Example
5034            /// ```ignore,no_run
5035            /// # use google_cloud_api::model::distribution::bucket_options::Linear;
5036            /// let x = Linear::new().set_num_finite_buckets(42);
5037            /// ```
5038            pub fn set_num_finite_buckets<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5039                self.num_finite_buckets = v.into();
5040                self
5041            }
5042
5043            /// Sets the value of [width][crate::model::distribution::bucket_options::Linear::width].
5044            ///
5045            /// # Example
5046            /// ```ignore,no_run
5047            /// # use google_cloud_api::model::distribution::bucket_options::Linear;
5048            /// let x = Linear::new().set_width(42.0);
5049            /// ```
5050            pub fn set_width<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
5051                self.width = v.into();
5052                self
5053            }
5054
5055            /// Sets the value of [offset][crate::model::distribution::bucket_options::Linear::offset].
5056            ///
5057            /// # Example
5058            /// ```ignore,no_run
5059            /// # use google_cloud_api::model::distribution::bucket_options::Linear;
5060            /// let x = Linear::new().set_offset(42.0);
5061            /// ```
5062            pub fn set_offset<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
5063                self.offset = v.into();
5064                self
5065            }
5066        }
5067
5068        impl wkt::message::Message for Linear {
5069            fn typename() -> &'static str {
5070                "type.googleapis.com/google.api.Distribution.BucketOptions.Linear"
5071            }
5072        }
5073
5074        /// Specifies an exponential sequence of buckets that have a width that is
5075        /// proportional to the value of the lower bound. Each bucket represents a
5076        /// constant relative uncertainty on a specific value in the bucket.
5077        ///
5078        /// There are `num_finite_buckets + 2` (= N) buckets. Bucket `i` has the
5079        /// following boundaries:
5080        ///
5081        /// Upper bound (0 <= i < N-1):     scale * (growth_factor ^ i).
5082        ///
5083        /// Lower bound (1 <= i < N):       scale * (growth_factor ^ (i - 1)).
5084        #[derive(Clone, Default, PartialEq)]
5085        #[non_exhaustive]
5086        pub struct Exponential {
5087            /// Must be greater than 0.
5088            pub num_finite_buckets: i32,
5089
5090            /// Must be greater than 1.
5091            pub growth_factor: f64,
5092
5093            /// Must be greater than 0.
5094            pub scale: f64,
5095
5096            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5097        }
5098
5099        impl Exponential {
5100            /// Creates a new default instance.
5101            pub fn new() -> Self {
5102                std::default::Default::default()
5103            }
5104
5105            /// Sets the value of [num_finite_buckets][crate::model::distribution::bucket_options::Exponential::num_finite_buckets].
5106            ///
5107            /// # Example
5108            /// ```ignore,no_run
5109            /// # use google_cloud_api::model::distribution::bucket_options::Exponential;
5110            /// let x = Exponential::new().set_num_finite_buckets(42);
5111            /// ```
5112            pub fn set_num_finite_buckets<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5113                self.num_finite_buckets = v.into();
5114                self
5115            }
5116
5117            /// Sets the value of [growth_factor][crate::model::distribution::bucket_options::Exponential::growth_factor].
5118            ///
5119            /// # Example
5120            /// ```ignore,no_run
5121            /// # use google_cloud_api::model::distribution::bucket_options::Exponential;
5122            /// let x = Exponential::new().set_growth_factor(42.0);
5123            /// ```
5124            pub fn set_growth_factor<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
5125                self.growth_factor = v.into();
5126                self
5127            }
5128
5129            /// Sets the value of [scale][crate::model::distribution::bucket_options::Exponential::scale].
5130            ///
5131            /// # Example
5132            /// ```ignore,no_run
5133            /// # use google_cloud_api::model::distribution::bucket_options::Exponential;
5134            /// let x = Exponential::new().set_scale(42.0);
5135            /// ```
5136            pub fn set_scale<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
5137                self.scale = v.into();
5138                self
5139            }
5140        }
5141
5142        impl wkt::message::Message for Exponential {
5143            fn typename() -> &'static str {
5144                "type.googleapis.com/google.api.Distribution.BucketOptions.Exponential"
5145            }
5146        }
5147
5148        /// Specifies a set of buckets with arbitrary widths.
5149        ///
5150        /// There are `size(bounds) + 1` (= N) buckets. Bucket `i` has the following
5151        /// boundaries:
5152        ///
5153        /// Upper bound (0 <= i < N-1):     bounds[i]
5154        /// Lower bound (1 <= i < N);       bounds[i - 1]
5155        ///
5156        /// The `bounds` field must contain at least one element. If `bounds` has
5157        /// only one element, then there are no finite buckets, and that single
5158        /// element is the common boundary of the overflow and underflow buckets.
5159        #[derive(Clone, Default, PartialEq)]
5160        #[non_exhaustive]
5161        pub struct Explicit {
5162            /// The values must be monotonically increasing.
5163            pub bounds: std::vec::Vec<f64>,
5164
5165            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5166        }
5167
5168        impl Explicit {
5169            /// Creates a new default instance.
5170            pub fn new() -> Self {
5171                std::default::Default::default()
5172            }
5173
5174            /// Sets the value of [bounds][crate::model::distribution::bucket_options::Explicit::bounds].
5175            ///
5176            /// # Example
5177            /// ```ignore,no_run
5178            /// # use google_cloud_api::model::distribution::bucket_options::Explicit;
5179            /// let x = Explicit::new().set_bounds([1.0, 2.0, 3.0]);
5180            /// ```
5181            pub fn set_bounds<T, V>(mut self, v: T) -> Self
5182            where
5183                T: std::iter::IntoIterator<Item = V>,
5184                V: std::convert::Into<f64>,
5185            {
5186                use std::iter::Iterator;
5187                self.bounds = v.into_iter().map(|i| i.into()).collect();
5188                self
5189            }
5190        }
5191
5192        impl wkt::message::Message for Explicit {
5193            fn typename() -> &'static str {
5194                "type.googleapis.com/google.api.Distribution.BucketOptions.Explicit"
5195            }
5196        }
5197
5198        /// Exactly one of these three fields must be set.
5199        #[derive(Clone, Debug, PartialEq)]
5200        #[non_exhaustive]
5201        pub enum Options {
5202            /// The linear bucket.
5203            LinearBuckets(std::boxed::Box<crate::model::distribution::bucket_options::Linear>),
5204            /// The exponential buckets.
5205            ExponentialBuckets(
5206                std::boxed::Box<crate::model::distribution::bucket_options::Exponential>,
5207            ),
5208            /// The explicit buckets.
5209            ExplicitBuckets(std::boxed::Box<crate::model::distribution::bucket_options::Explicit>),
5210        }
5211    }
5212
5213    /// Exemplars are example points that may be used to annotate aggregated
5214    /// distribution values. They are metadata that gives information about a
5215    /// particular value added to a Distribution bucket, such as a trace ID that
5216    /// was active when a value was added. They may contain further information,
5217    /// such as a example values and timestamps, origin, etc.
5218    #[derive(Clone, Default, PartialEq)]
5219    #[non_exhaustive]
5220    pub struct Exemplar {
5221        /// Value of the exemplar point. This value determines to which bucket the
5222        /// exemplar belongs.
5223        pub value: f64,
5224
5225        /// The observation (sampling) time of the above value.
5226        pub timestamp: std::option::Option<wkt::Timestamp>,
5227
5228        /// Contextual information about the example value. Examples are:
5229        ///
5230        /// Trace: type.googleapis.com/google.monitoring.v3.SpanContext
5231        ///
5232        /// Literal string: type.googleapis.com/google.protobuf.StringValue
5233        ///
5234        /// Labels dropped during aggregation:
5235        /// type.googleapis.com/google.monitoring.v3.DroppedLabels
5236        ///
5237        /// There may be only a single attachment of any given message type in a
5238        /// single exemplar, and this is enforced by the system.
5239        pub attachments: std::vec::Vec<wkt::Any>,
5240
5241        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5242    }
5243
5244    impl Exemplar {
5245        /// Creates a new default instance.
5246        pub fn new() -> Self {
5247            std::default::Default::default()
5248        }
5249
5250        /// Sets the value of [value][crate::model::distribution::Exemplar::value].
5251        ///
5252        /// # Example
5253        /// ```ignore,no_run
5254        /// # use google_cloud_api::model::distribution::Exemplar;
5255        /// let x = Exemplar::new().set_value(42.0);
5256        /// ```
5257        pub fn set_value<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
5258            self.value = v.into();
5259            self
5260        }
5261
5262        /// Sets the value of [timestamp][crate::model::distribution::Exemplar::timestamp].
5263        ///
5264        /// # Example
5265        /// ```ignore,no_run
5266        /// # use google_cloud_api::model::distribution::Exemplar;
5267        /// use wkt::Timestamp;
5268        /// let x = Exemplar::new().set_timestamp(Timestamp::default()/* use setters */);
5269        /// ```
5270        pub fn set_timestamp<T>(mut self, v: T) -> Self
5271        where
5272            T: std::convert::Into<wkt::Timestamp>,
5273        {
5274            self.timestamp = std::option::Option::Some(v.into());
5275            self
5276        }
5277
5278        /// Sets or clears the value of [timestamp][crate::model::distribution::Exemplar::timestamp].
5279        ///
5280        /// # Example
5281        /// ```ignore,no_run
5282        /// # use google_cloud_api::model::distribution::Exemplar;
5283        /// use wkt::Timestamp;
5284        /// let x = Exemplar::new().set_or_clear_timestamp(Some(Timestamp::default()/* use setters */));
5285        /// let x = Exemplar::new().set_or_clear_timestamp(None::<Timestamp>);
5286        /// ```
5287        pub fn set_or_clear_timestamp<T>(mut self, v: std::option::Option<T>) -> Self
5288        where
5289            T: std::convert::Into<wkt::Timestamp>,
5290        {
5291            self.timestamp = v.map(|x| x.into());
5292            self
5293        }
5294
5295        /// Sets the value of [attachments][crate::model::distribution::Exemplar::attachments].
5296        ///
5297        /// # Example
5298        /// ```ignore,no_run
5299        /// # use google_cloud_api::model::distribution::Exemplar;
5300        /// use wkt::Any;
5301        /// let x = Exemplar::new()
5302        ///     .set_attachments([
5303        ///         Any::default()/* use setters */,
5304        ///         Any::default()/* use (different) setters */,
5305        ///     ]);
5306        /// ```
5307        pub fn set_attachments<T, V>(mut self, v: T) -> Self
5308        where
5309            T: std::iter::IntoIterator<Item = V>,
5310            V: std::convert::Into<wkt::Any>,
5311        {
5312            use std::iter::Iterator;
5313            self.attachments = v.into_iter().map(|i| i.into()).collect();
5314            self
5315        }
5316    }
5317
5318    impl wkt::message::Message for Exemplar {
5319        fn typename() -> &'static str {
5320            "type.googleapis.com/google.api.Distribution.Exemplar"
5321        }
5322    }
5323}
5324
5325/// `Documentation` provides the information for describing a service.
5326///
5327/// Example:
5328///
5329/// Documentation is provided in markdown syntax. In addition to
5330/// standard markdown features, definition lists, tables and fenced
5331/// code blocks are supported. Section headers can be provided and are
5332/// interpreted relative to the section nesting of the context where
5333/// a documentation fragment is embedded.
5334///
5335/// Documentation from the IDL is merged with documentation defined
5336/// via the config at normalization time, where documentation provided
5337/// by config rules overrides IDL provided.
5338///
5339/// A number of constructs specific to the API platform are supported
5340/// in documentation text.
5341///
5342/// In order to reference a proto element, the following
5343/// notation can be used:
5344///
5345/// To override the display text used for the link, this can be used:
5346///
5347/// Text can be excluded from doc using the following notation:
5348///
5349/// A few directives are available in documentation. Note that
5350/// directives must appear on a single line to be properly
5351/// identified. The `include` directive includes a markdown file from
5352/// an external source:
5353///
5354/// The `resource_for` directive marks a message to be the resource of
5355/// a collection in REST view. If it is not specified, tools attempt
5356/// to infer the resource from the operations in a collection:
5357///
5358/// The directive `suppress_warning` does not directly affect documentation
5359/// and is documented together with service config validation.
5360#[derive(Clone, Default, PartialEq)]
5361#[non_exhaustive]
5362pub struct Documentation {
5363    /// A short description of what the service does. The summary must be plain
5364    /// text. It becomes the overview of the service displayed in Google Cloud
5365    /// Console.
5366    /// NOTE: This field is equivalent to the standard field `description`.
5367    pub summary: std::string::String,
5368
5369    /// The top level pages for the documentation set.
5370    pub pages: std::vec::Vec<crate::model::Page>,
5371
5372    /// A list of documentation rules that apply to individual API elements.
5373    ///
5374    /// **NOTE:** All service configuration rules follow "last one wins" order.
5375    pub rules: std::vec::Vec<crate::model::DocumentationRule>,
5376
5377    /// The URL to the root of documentation.
5378    pub documentation_root_url: std::string::String,
5379
5380    /// Specifies the service root url if the default one (the service name
5381    /// from the yaml file) is not suitable. This can be seen in any fully
5382    /// specified service urls as well as sections that show a base that other
5383    /// urls are relative to.
5384    pub service_root_url: std::string::String,
5385
5386    /// Declares a single overview page. For example:
5387    ///
5388    /// This is a shortcut for the following declaration (using pages style):
5389    ///
5390    /// Note: you cannot specify both `overview` field and `pages` field.
5391    pub overview: std::string::String,
5392
5393    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5394}
5395
5396impl Documentation {
5397    /// Creates a new default instance.
5398    pub fn new() -> Self {
5399        std::default::Default::default()
5400    }
5401
5402    /// Sets the value of [summary][crate::model::Documentation::summary].
5403    ///
5404    /// # Example
5405    /// ```ignore,no_run
5406    /// # use google_cloud_api::model::Documentation;
5407    /// let x = Documentation::new().set_summary("example");
5408    /// ```
5409    pub fn set_summary<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5410        self.summary = v.into();
5411        self
5412    }
5413
5414    /// Sets the value of [pages][crate::model::Documentation::pages].
5415    ///
5416    /// # Example
5417    /// ```ignore,no_run
5418    /// # use google_cloud_api::model::Documentation;
5419    /// use google_cloud_api::model::Page;
5420    /// let x = Documentation::new()
5421    ///     .set_pages([
5422    ///         Page::default()/* use setters */,
5423    ///         Page::default()/* use (different) setters */,
5424    ///     ]);
5425    /// ```
5426    pub fn set_pages<T, V>(mut self, v: T) -> Self
5427    where
5428        T: std::iter::IntoIterator<Item = V>,
5429        V: std::convert::Into<crate::model::Page>,
5430    {
5431        use std::iter::Iterator;
5432        self.pages = v.into_iter().map(|i| i.into()).collect();
5433        self
5434    }
5435
5436    /// Sets the value of [rules][crate::model::Documentation::rules].
5437    ///
5438    /// # Example
5439    /// ```ignore,no_run
5440    /// # use google_cloud_api::model::Documentation;
5441    /// use google_cloud_api::model::DocumentationRule;
5442    /// let x = Documentation::new()
5443    ///     .set_rules([
5444    ///         DocumentationRule::default()/* use setters */,
5445    ///         DocumentationRule::default()/* use (different) setters */,
5446    ///     ]);
5447    /// ```
5448    pub fn set_rules<T, V>(mut self, v: T) -> Self
5449    where
5450        T: std::iter::IntoIterator<Item = V>,
5451        V: std::convert::Into<crate::model::DocumentationRule>,
5452    {
5453        use std::iter::Iterator;
5454        self.rules = v.into_iter().map(|i| i.into()).collect();
5455        self
5456    }
5457
5458    /// Sets the value of [documentation_root_url][crate::model::Documentation::documentation_root_url].
5459    ///
5460    /// # Example
5461    /// ```ignore,no_run
5462    /// # use google_cloud_api::model::Documentation;
5463    /// let x = Documentation::new().set_documentation_root_url("example");
5464    /// ```
5465    pub fn set_documentation_root_url<T: std::convert::Into<std::string::String>>(
5466        mut self,
5467        v: T,
5468    ) -> Self {
5469        self.documentation_root_url = v.into();
5470        self
5471    }
5472
5473    /// Sets the value of [service_root_url][crate::model::Documentation::service_root_url].
5474    ///
5475    /// # Example
5476    /// ```ignore,no_run
5477    /// # use google_cloud_api::model::Documentation;
5478    /// let x = Documentation::new().set_service_root_url("example");
5479    /// ```
5480    pub fn set_service_root_url<T: std::convert::Into<std::string::String>>(
5481        mut self,
5482        v: T,
5483    ) -> Self {
5484        self.service_root_url = v.into();
5485        self
5486    }
5487
5488    /// Sets the value of [overview][crate::model::Documentation::overview].
5489    ///
5490    /// # Example
5491    /// ```ignore,no_run
5492    /// # use google_cloud_api::model::Documentation;
5493    /// let x = Documentation::new().set_overview("example");
5494    /// ```
5495    pub fn set_overview<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5496        self.overview = v.into();
5497        self
5498    }
5499}
5500
5501impl wkt::message::Message for Documentation {
5502    fn typename() -> &'static str {
5503        "type.googleapis.com/google.api.Documentation"
5504    }
5505}
5506
5507/// A documentation rule provides information about individual API elements.
5508#[derive(Clone, Default, PartialEq)]
5509#[non_exhaustive]
5510pub struct DocumentationRule {
5511    /// The selector is a comma-separated list of patterns for any element such as
5512    /// a method, a field, an enum value. Each pattern is a qualified name of the
5513    /// element which may end in "*", indicating a wildcard. Wildcards are only
5514    /// allowed at the end and for a whole component of the qualified name,
5515    /// i.e. "foo.*" is ok, but not "foo.b*" or "foo.*.bar". A wildcard will match
5516    /// one or more components. To specify a default for all applicable elements,
5517    /// the whole pattern "*" is used.
5518    pub selector: std::string::String,
5519
5520    /// Description of the selected proto element (e.g. a message, a method, a
5521    /// 'service' definition, or a field). Defaults to leading & trailing comments
5522    /// taken from the proto source definition of the proto element.
5523    pub description: std::string::String,
5524
5525    /// Deprecation description of the selected element(s). It can be provided if
5526    /// an element is marked as `deprecated`.
5527    pub deprecation_description: std::string::String,
5528
5529    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5530}
5531
5532impl DocumentationRule {
5533    /// Creates a new default instance.
5534    pub fn new() -> Self {
5535        std::default::Default::default()
5536    }
5537
5538    /// Sets the value of [selector][crate::model::DocumentationRule::selector].
5539    ///
5540    /// # Example
5541    /// ```ignore,no_run
5542    /// # use google_cloud_api::model::DocumentationRule;
5543    /// let x = DocumentationRule::new().set_selector("example");
5544    /// ```
5545    pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5546        self.selector = v.into();
5547        self
5548    }
5549
5550    /// Sets the value of [description][crate::model::DocumentationRule::description].
5551    ///
5552    /// # Example
5553    /// ```ignore,no_run
5554    /// # use google_cloud_api::model::DocumentationRule;
5555    /// let x = DocumentationRule::new().set_description("example");
5556    /// ```
5557    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5558        self.description = v.into();
5559        self
5560    }
5561
5562    /// Sets the value of [deprecation_description][crate::model::DocumentationRule::deprecation_description].
5563    ///
5564    /// # Example
5565    /// ```ignore,no_run
5566    /// # use google_cloud_api::model::DocumentationRule;
5567    /// let x = DocumentationRule::new().set_deprecation_description("example");
5568    /// ```
5569    pub fn set_deprecation_description<T: std::convert::Into<std::string::String>>(
5570        mut self,
5571        v: T,
5572    ) -> Self {
5573        self.deprecation_description = v.into();
5574        self
5575    }
5576}
5577
5578impl wkt::message::Message for DocumentationRule {
5579    fn typename() -> &'static str {
5580        "type.googleapis.com/google.api.DocumentationRule"
5581    }
5582}
5583
5584/// Represents a documentation page. A page can contain subpages to represent
5585/// nested documentation set structure.
5586#[derive(Clone, Default, PartialEq)]
5587#[non_exhaustive]
5588pub struct Page {
5589    /// The name of the page. It will be used as an identity of the page to
5590    /// generate URI of the page, text of the link to this page in navigation,
5591    /// etc. The full page name (start from the root page name to this page
5592    /// concatenated with `.`) can be used as reference to the page in your
5593    /// documentation. For example:
5594    ///
5595    /// You can reference `Java` page using Markdown reference link syntax:
5596    /// `[Java][Tutorial.Java]`.
5597    pub name: std::string::String,
5598
5599    /// The Markdown content of the page. You can use ```(== include {path}
5600    /// ==)``` to include content from a Markdown file. The content can be used
5601    /// to produce the documentation page such as HTML format page.
5602    pub content: std::string::String,
5603
5604    /// Subpages of this page. The order of subpages specified here will be
5605    /// honored in the generated docset.
5606    pub subpages: std::vec::Vec<crate::model::Page>,
5607
5608    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5609}
5610
5611impl Page {
5612    /// Creates a new default instance.
5613    pub fn new() -> Self {
5614        std::default::Default::default()
5615    }
5616
5617    /// Sets the value of [name][crate::model::Page::name].
5618    ///
5619    /// # Example
5620    /// ```ignore,no_run
5621    /// # use google_cloud_api::model::Page;
5622    /// let x = Page::new().set_name("example");
5623    /// ```
5624    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5625        self.name = v.into();
5626        self
5627    }
5628
5629    /// Sets the value of [content][crate::model::Page::content].
5630    ///
5631    /// # Example
5632    /// ```ignore,no_run
5633    /// # use google_cloud_api::model::Page;
5634    /// let x = Page::new().set_content("example");
5635    /// ```
5636    pub fn set_content<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5637        self.content = v.into();
5638        self
5639    }
5640
5641    /// Sets the value of [subpages][crate::model::Page::subpages].
5642    ///
5643    /// # Example
5644    /// ```ignore,no_run
5645    /// # use google_cloud_api::model::Page;
5646    /// let x = Page::new()
5647    ///     .set_subpages([
5648    ///         Page::default()/* use setters */,
5649    ///         Page::default()/* use (different) setters */,
5650    ///     ]);
5651    /// ```
5652    pub fn set_subpages<T, V>(mut self, v: T) -> Self
5653    where
5654        T: std::iter::IntoIterator<Item = V>,
5655        V: std::convert::Into<crate::model::Page>,
5656    {
5657        use std::iter::Iterator;
5658        self.subpages = v.into_iter().map(|i| i.into()).collect();
5659        self
5660    }
5661}
5662
5663impl wkt::message::Message for Page {
5664    fn typename() -> &'static str {
5665        "type.googleapis.com/google.api.Page"
5666    }
5667}
5668
5669/// `Endpoint` describes a network address of a service that serves a set of
5670/// APIs. It is commonly known as a service endpoint. A service may expose
5671/// any number of service endpoints, and all service endpoints share the same
5672/// service definition, such as quota limits and monitoring metrics.
5673///
5674/// Example:
5675///
5676/// ```norust
5677/// type: google.api.Service
5678/// name: library-example.googleapis.com
5679/// endpoints:
5680///   # Declares network address `https://library-example.googleapis.com`
5681///   # for service `library-example.googleapis.com`. The `https` scheme
5682///   # is implicit for all service endpoints. Other schemes may be
5683///   # supported in the future.
5684/// - name: library-example.googleapis.com
5685///   allow_cors: false
5686/// - name: content-staging-library-example.googleapis.com
5687///   # Allows HTTP OPTIONS calls to be passed to the API frontend, for it
5688///   # to decide whether the subsequent cross-origin request is allowed
5689///   # to proceed.
5690///   allow_cors: true
5691/// ```
5692#[derive(Clone, Default, PartialEq)]
5693#[non_exhaustive]
5694pub struct Endpoint {
5695    /// The canonical name of this endpoint.
5696    pub name: std::string::String,
5697
5698    /// Aliases for this endpoint, these will be served by the same UrlMap as the
5699    /// parent endpoint, and will be provisioned in the GCP stack for the Regional
5700    /// Endpoints.
5701    pub aliases: std::vec::Vec<std::string::String>,
5702
5703    /// The specification of an Internet routable address of API frontend that will
5704    /// handle requests to this [API
5705    /// Endpoint](https://cloud.google.com/apis/design/glossary). It should be
5706    /// either a valid IPv4 address or a fully-qualified domain name. For example,
5707    /// "8.8.8.8" or "myservice.appspot.com".
5708    pub target: std::string::String,
5709
5710    /// Allowing
5711    /// [CORS](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing), aka
5712    /// cross-domain traffic, would allow the backends served from this endpoint to
5713    /// receive and respond to HTTP OPTIONS requests. The response will be used by
5714    /// the browser to determine whether the subsequent cross-origin request is
5715    /// allowed to proceed.
5716    pub allow_cors: bool,
5717
5718    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5719}
5720
5721impl Endpoint {
5722    /// Creates a new default instance.
5723    pub fn new() -> Self {
5724        std::default::Default::default()
5725    }
5726
5727    /// Sets the value of [name][crate::model::Endpoint::name].
5728    ///
5729    /// # Example
5730    /// ```ignore,no_run
5731    /// # use google_cloud_api::model::Endpoint;
5732    /// let x = Endpoint::new().set_name("example");
5733    /// ```
5734    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5735        self.name = v.into();
5736        self
5737    }
5738
5739    /// Sets the value of [aliases][crate::model::Endpoint::aliases].
5740    ///
5741    /// # Example
5742    /// ```ignore,no_run
5743    /// # use google_cloud_api::model::Endpoint;
5744    /// let x = Endpoint::new().set_aliases(["a", "b", "c"]);
5745    /// ```
5746    pub fn set_aliases<T, V>(mut self, v: T) -> Self
5747    where
5748        T: std::iter::IntoIterator<Item = V>,
5749        V: std::convert::Into<std::string::String>,
5750    {
5751        use std::iter::Iterator;
5752        self.aliases = v.into_iter().map(|i| i.into()).collect();
5753        self
5754    }
5755
5756    /// Sets the value of [target][crate::model::Endpoint::target].
5757    ///
5758    /// # Example
5759    /// ```ignore,no_run
5760    /// # use google_cloud_api::model::Endpoint;
5761    /// let x = Endpoint::new().set_target("example");
5762    /// ```
5763    pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5764        self.target = v.into();
5765        self
5766    }
5767
5768    /// Sets the value of [allow_cors][crate::model::Endpoint::allow_cors].
5769    ///
5770    /// # Example
5771    /// ```ignore,no_run
5772    /// # use google_cloud_api::model::Endpoint;
5773    /// let x = Endpoint::new().set_allow_cors(true);
5774    /// ```
5775    pub fn set_allow_cors<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5776        self.allow_cors = v.into();
5777        self
5778    }
5779}
5780
5781impl wkt::message::Message for Endpoint {
5782    fn typename() -> &'static str {
5783        "type.googleapis.com/google.api.Endpoint"
5784    }
5785}
5786
5787/// Rich semantic information of an API field beyond basic typing.
5788#[derive(Clone, Default, PartialEq)]
5789#[non_exhaustive]
5790pub struct FieldInfo {
5791    /// The standard format of a field value. This does not explicitly configure
5792    /// any API consumer, just documents the API's format for the field it is
5793    /// applied to.
5794    pub format: crate::model::field_info::Format,
5795
5796    /// The type(s) that the annotated, generic field may represent.
5797    ///
5798    /// Currently, this must only be used on fields of type `google.protobuf.Any`.
5799    /// Supporting other generic types may be considered in the future.
5800    pub referenced_types: std::vec::Vec<crate::model::TypeReference>,
5801
5802    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5803}
5804
5805impl FieldInfo {
5806    /// Creates a new default instance.
5807    pub fn new() -> Self {
5808        std::default::Default::default()
5809    }
5810
5811    /// Sets the value of [format][crate::model::FieldInfo::format].
5812    ///
5813    /// # Example
5814    /// ```ignore,no_run
5815    /// # use google_cloud_api::model::FieldInfo;
5816    /// use google_cloud_api::model::field_info::Format;
5817    /// let x0 = FieldInfo::new().set_format(Format::Uuid4);
5818    /// let x1 = FieldInfo::new().set_format(Format::Ipv4);
5819    /// let x2 = FieldInfo::new().set_format(Format::Ipv6);
5820    /// ```
5821    pub fn set_format<T: std::convert::Into<crate::model::field_info::Format>>(
5822        mut self,
5823        v: T,
5824    ) -> Self {
5825        self.format = v.into();
5826        self
5827    }
5828
5829    /// Sets the value of [referenced_types][crate::model::FieldInfo::referenced_types].
5830    ///
5831    /// # Example
5832    /// ```ignore,no_run
5833    /// # use google_cloud_api::model::FieldInfo;
5834    /// use google_cloud_api::model::TypeReference;
5835    /// let x = FieldInfo::new()
5836    ///     .set_referenced_types([
5837    ///         TypeReference::default()/* use setters */,
5838    ///         TypeReference::default()/* use (different) setters */,
5839    ///     ]);
5840    /// ```
5841    pub fn set_referenced_types<T, V>(mut self, v: T) -> Self
5842    where
5843        T: std::iter::IntoIterator<Item = V>,
5844        V: std::convert::Into<crate::model::TypeReference>,
5845    {
5846        use std::iter::Iterator;
5847        self.referenced_types = v.into_iter().map(|i| i.into()).collect();
5848        self
5849    }
5850}
5851
5852impl wkt::message::Message for FieldInfo {
5853    fn typename() -> &'static str {
5854        "type.googleapis.com/google.api.FieldInfo"
5855    }
5856}
5857
5858/// Defines additional types related to [FieldInfo].
5859pub mod field_info {
5860    #[allow(unused_imports)]
5861    use super::*;
5862
5863    /// The standard format of a field value. The supported formats are all backed
5864    /// by either an RFC defined by the IETF or a Google-defined AIP.
5865    ///
5866    /// # Working with unknown values
5867    ///
5868    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5869    /// additional enum variants at any time. Adding new variants is not considered
5870    /// a breaking change. Applications should write their code in anticipation of:
5871    ///
5872    /// - New values appearing in future releases of the client library, **and**
5873    /// - New values received dynamically, without application changes.
5874    ///
5875    /// Please consult the [Working with enums] section in the user guide for some
5876    /// guidelines.
5877    ///
5878    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5879    #[derive(Clone, Debug, PartialEq)]
5880    #[non_exhaustive]
5881    pub enum Format {
5882        /// Default, unspecified value.
5883        Unspecified,
5884        /// Universally Unique Identifier, version 4, value as defined by
5885        /// <https://datatracker.ietf.org/doc/html/rfc4122>. The value may be
5886        /// normalized to entirely lowercase letters. For example, the value
5887        /// `F47AC10B-58CC-0372-8567-0E02B2C3D479` would be normalized to
5888        /// `f47ac10b-58cc-0372-8567-0e02b2c3d479`.
5889        Uuid4,
5890        /// Internet Protocol v4 value as defined by [RFC
5891        /// 791](https://datatracker.ietf.org/doc/html/rfc791). The value may be
5892        /// condensed, with leading zeros in each octet stripped. For example,
5893        /// `001.022.233.040` would be condensed to `1.22.233.40`.
5894        Ipv4,
5895        /// Internet Protocol v6 value as defined by [RFC
5896        /// 2460](https://datatracker.ietf.org/doc/html/rfc2460). The value may be
5897        /// normalized to entirely lowercase letters with zeros compressed, following
5898        /// [RFC 5952](https://datatracker.ietf.org/doc/html/rfc5952). For example,
5899        /// the value `2001:0DB8:0::0` would be normalized to `2001:db8::`.
5900        Ipv6,
5901        /// An IP address in either v4 or v6 format as described by the individual
5902        /// values defined herein. See the comments on the IPV4 and IPV6 types for
5903        /// allowed normalizations of each.
5904        Ipv4OrIpv6,
5905        /// If set, the enum was initialized with an unknown value.
5906        ///
5907        /// Applications can examine the value using [Format::value] or
5908        /// [Format::name].
5909        UnknownValue(format::UnknownValue),
5910    }
5911
5912    #[doc(hidden)]
5913    pub mod format {
5914        #[allow(unused_imports)]
5915        use super::*;
5916        #[derive(Clone, Debug, PartialEq)]
5917        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5918    }
5919
5920    impl Format {
5921        /// Gets the enum value.
5922        ///
5923        /// Returns `None` if the enum contains an unknown value deserialized from
5924        /// the string representation of enums.
5925        pub fn value(&self) -> std::option::Option<i32> {
5926            match self {
5927                Self::Unspecified => std::option::Option::Some(0),
5928                Self::Uuid4 => std::option::Option::Some(1),
5929                Self::Ipv4 => std::option::Option::Some(2),
5930                Self::Ipv6 => std::option::Option::Some(3),
5931                Self::Ipv4OrIpv6 => std::option::Option::Some(4),
5932                Self::UnknownValue(u) => u.0.value(),
5933            }
5934        }
5935
5936        /// Gets the enum value as a string.
5937        ///
5938        /// Returns `None` if the enum contains an unknown value deserialized from
5939        /// the integer representation of enums.
5940        pub fn name(&self) -> std::option::Option<&str> {
5941            match self {
5942                Self::Unspecified => std::option::Option::Some("FORMAT_UNSPECIFIED"),
5943                Self::Uuid4 => std::option::Option::Some("UUID4"),
5944                Self::Ipv4 => std::option::Option::Some("IPV4"),
5945                Self::Ipv6 => std::option::Option::Some("IPV6"),
5946                Self::Ipv4OrIpv6 => std::option::Option::Some("IPV4_OR_IPV6"),
5947                Self::UnknownValue(u) => u.0.name(),
5948            }
5949        }
5950    }
5951
5952    impl std::default::Default for Format {
5953        fn default() -> Self {
5954            use std::convert::From;
5955            Self::from(0)
5956        }
5957    }
5958
5959    impl std::fmt::Display for Format {
5960        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5961            wkt::internal::display_enum(f, self.name(), self.value())
5962        }
5963    }
5964
5965    impl std::convert::From<i32> for Format {
5966        fn from(value: i32) -> Self {
5967            match value {
5968                0 => Self::Unspecified,
5969                1 => Self::Uuid4,
5970                2 => Self::Ipv4,
5971                3 => Self::Ipv6,
5972                4 => Self::Ipv4OrIpv6,
5973                _ => Self::UnknownValue(format::UnknownValue(
5974                    wkt::internal::UnknownEnumValue::Integer(value),
5975                )),
5976            }
5977        }
5978    }
5979
5980    impl std::convert::From<&str> for Format {
5981        fn from(value: &str) -> Self {
5982            use std::string::ToString;
5983            match value {
5984                "FORMAT_UNSPECIFIED" => Self::Unspecified,
5985                "UUID4" => Self::Uuid4,
5986                "IPV4" => Self::Ipv4,
5987                "IPV6" => Self::Ipv6,
5988                "IPV4_OR_IPV6" => Self::Ipv4OrIpv6,
5989                _ => Self::UnknownValue(format::UnknownValue(
5990                    wkt::internal::UnknownEnumValue::String(value.to_string()),
5991                )),
5992            }
5993        }
5994    }
5995
5996    impl serde::ser::Serialize for Format {
5997        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5998        where
5999            S: serde::Serializer,
6000        {
6001            match self {
6002                Self::Unspecified => serializer.serialize_i32(0),
6003                Self::Uuid4 => serializer.serialize_i32(1),
6004                Self::Ipv4 => serializer.serialize_i32(2),
6005                Self::Ipv6 => serializer.serialize_i32(3),
6006                Self::Ipv4OrIpv6 => serializer.serialize_i32(4),
6007                Self::UnknownValue(u) => u.0.serialize(serializer),
6008            }
6009        }
6010    }
6011
6012    impl<'de> serde::de::Deserialize<'de> for Format {
6013        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6014        where
6015            D: serde::Deserializer<'de>,
6016        {
6017            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Format>::new(
6018                ".google.api.FieldInfo.Format",
6019            ))
6020        }
6021    }
6022}
6023
6024/// A reference to a message type, for use in [FieldInfo][google.api.FieldInfo].
6025///
6026/// [google.api.FieldInfo]: crate::model::FieldInfo
6027#[derive(Clone, Default, PartialEq)]
6028#[non_exhaustive]
6029pub struct TypeReference {
6030    /// The name of the type that the annotated, generic field may represent.
6031    /// If the type is in the same protobuf package, the value can be the simple
6032    /// message name e.g., `"MyMessage"`. Otherwise, the value must be the
6033    /// fully-qualified message name e.g., `"google.library.v1.Book"`.
6034    ///
6035    /// If the type(s) are unknown to the service (e.g. the field accepts generic
6036    /// user input), use the wildcard `"*"` to denote this behavior.
6037    ///
6038    /// See [AIP-202](https://google.aip.dev/202#type-references) for more details.
6039    pub type_name: std::string::String,
6040
6041    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6042}
6043
6044impl TypeReference {
6045    /// Creates a new default instance.
6046    pub fn new() -> Self {
6047        std::default::Default::default()
6048    }
6049
6050    /// Sets the value of [type_name][crate::model::TypeReference::type_name].
6051    ///
6052    /// # Example
6053    /// ```ignore,no_run
6054    /// # use google_cloud_api::model::TypeReference;
6055    /// let x = TypeReference::new().set_type_name("example");
6056    /// ```
6057    pub fn set_type_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6058        self.type_name = v.into();
6059        self
6060    }
6061}
6062
6063impl wkt::message::Message for TypeReference {
6064    fn typename() -> &'static str {
6065        "type.googleapis.com/google.api.TypeReference"
6066    }
6067}
6068
6069/// Defines the HTTP configuration for an API service. It contains a list of
6070/// [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method
6071/// to one or more HTTP REST API methods.
6072///
6073/// [google.api.HttpRule]: crate::model::HttpRule
6074#[derive(Clone, Default, PartialEq)]
6075#[non_exhaustive]
6076pub struct Http {
6077    /// A list of HTTP configuration rules that apply to individual API methods.
6078    ///
6079    /// **NOTE:** All service configuration rules follow "last one wins" order.
6080    pub rules: std::vec::Vec<crate::model::HttpRule>,
6081
6082    /// When set to true, URL path parameters will be fully URI-decoded except in
6083    /// cases of single segment matches in reserved expansion, where "%2F" will be
6084    /// left encoded.
6085    ///
6086    /// The default behavior is to not decode RFC 6570 reserved characters in multi
6087    /// segment matches.
6088    pub fully_decode_reserved_expansion: bool,
6089
6090    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6091}
6092
6093impl Http {
6094    /// Creates a new default instance.
6095    pub fn new() -> Self {
6096        std::default::Default::default()
6097    }
6098
6099    /// Sets the value of [rules][crate::model::Http::rules].
6100    ///
6101    /// # Example
6102    /// ```ignore,no_run
6103    /// # use google_cloud_api::model::Http;
6104    /// use google_cloud_api::model::HttpRule;
6105    /// let x = Http::new()
6106    ///     .set_rules([
6107    ///         HttpRule::default()/* use setters */,
6108    ///         HttpRule::default()/* use (different) setters */,
6109    ///     ]);
6110    /// ```
6111    pub fn set_rules<T, V>(mut self, v: T) -> Self
6112    where
6113        T: std::iter::IntoIterator<Item = V>,
6114        V: std::convert::Into<crate::model::HttpRule>,
6115    {
6116        use std::iter::Iterator;
6117        self.rules = v.into_iter().map(|i| i.into()).collect();
6118        self
6119    }
6120
6121    /// Sets the value of [fully_decode_reserved_expansion][crate::model::Http::fully_decode_reserved_expansion].
6122    ///
6123    /// # Example
6124    /// ```ignore,no_run
6125    /// # use google_cloud_api::model::Http;
6126    /// let x = Http::new().set_fully_decode_reserved_expansion(true);
6127    /// ```
6128    pub fn set_fully_decode_reserved_expansion<T: std::convert::Into<bool>>(
6129        mut self,
6130        v: T,
6131    ) -> Self {
6132        self.fully_decode_reserved_expansion = v.into();
6133        self
6134    }
6135}
6136
6137impl wkt::message::Message for Http {
6138    fn typename() -> &'static str {
6139        "type.googleapis.com/google.api.Http"
6140    }
6141}
6142
6143/// gRPC Transcoding
6144///
6145/// gRPC Transcoding is a feature for mapping between a gRPC method and one or
6146/// more HTTP REST endpoints. It allows developers to build a single API service
6147/// that supports both gRPC APIs and REST APIs. Many systems, including [Google
6148/// APIs](https://github.com/googleapis/googleapis),
6149/// [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC
6150/// Gateway](https://github.com/grpc-ecosystem/grpc-gateway),
6151/// and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature
6152/// and use it for large scale production services.
6153///
6154/// `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies
6155/// how different portions of the gRPC request message are mapped to the URL
6156/// path, URL query parameters, and HTTP request body. It also controls how the
6157/// gRPC response message is mapped to the HTTP response body. `HttpRule` is
6158/// typically specified as an `google.api.http` annotation on the gRPC method.
6159///
6160/// Each mapping specifies a URL path template and an HTTP method. The path
6161/// template may refer to one or more fields in the gRPC request message, as long
6162/// as each field is a non-repeated field with a primitive (non-message) type.
6163/// The path template controls how fields of the request message are mapped to
6164/// the URL path.
6165///
6166/// Example:
6167///
6168/// ```norust
6169/// service Messaging {
6170///   rpc GetMessage(GetMessageRequest) returns (Message) {
6171///     option (google.api.http) = {
6172///         get: "/v1/{name=messages/*}"
6173///     };
6174///   }
6175/// }
6176/// message GetMessageRequest {
6177///   string name = 1; // Mapped to URL path.
6178/// }
6179/// message Message {
6180///   string text = 1; // The resource content.
6181/// }
6182/// ```
6183///
6184/// This enables an HTTP REST to gRPC mapping as below:
6185///
6186/// - HTTP: `GET /v1/messages/123456`
6187/// - gRPC: `GetMessage(name: "messages/123456")`
6188///
6189/// Any fields in the request message which are not bound by the path template
6190/// automatically become HTTP query parameters if there is no HTTP request body.
6191/// For example:
6192///
6193/// ```norust
6194/// service Messaging {
6195///   rpc GetMessage(GetMessageRequest) returns (Message) {
6196///     option (google.api.http) = {
6197///         get:"/v1/messages/{message_id}"
6198///     };
6199///   }
6200/// }
6201/// message GetMessageRequest {
6202///   message SubMessage {
6203///     string subfield = 1;
6204///   }
6205///   string message_id = 1; // Mapped to URL path.
6206///   int64 revision = 2;    // Mapped to URL query parameter `revision`.
6207///   SubMessage sub = 3;    // Mapped to URL query parameter `sub.subfield`.
6208/// }
6209/// ```
6210///
6211/// This enables a HTTP JSON to RPC mapping as below:
6212///
6213/// - HTTP: `GET /v1/messages/123456?revision=2&sub.subfield=foo`
6214/// - gRPC: `GetMessage(message_id: "123456" revision: 2 sub:
6215///   SubMessage(subfield: "foo"))`
6216///
6217/// Note that fields which are mapped to URL query parameters must have a
6218/// primitive type or a repeated primitive type or a non-repeated message type.
6219/// In the case of a repeated type, the parameter can be repeated in the URL
6220/// as `...?param=A&param=B`. In the case of a message type, each field of the
6221/// message is mapped to a separate parameter, such as
6222/// `...?foo.a=A&foo.b=B&foo.c=C`.
6223///
6224/// For HTTP methods that allow a request body, the `body` field
6225/// specifies the mapping. Consider a REST update method on the
6226/// message resource collection:
6227///
6228/// ```norust
6229/// service Messaging {
6230///   rpc UpdateMessage(UpdateMessageRequest) returns (Message) {
6231///     option (google.api.http) = {
6232///       patch: "/v1/messages/{message_id}"
6233///       body: "message"
6234///     };
6235///   }
6236/// }
6237/// message UpdateMessageRequest {
6238///   string message_id = 1; // mapped to the URL
6239///   Message message = 2;   // mapped to the body
6240/// }
6241/// ```
6242///
6243/// The following HTTP JSON to RPC mapping is enabled, where the
6244/// representation of the JSON in the request body is determined by
6245/// protos JSON encoding:
6246///
6247/// - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }`
6248/// - gRPC: `UpdateMessage(message_id: "123456" message { text: "Hi!" })`
6249///
6250/// The special name `*` can be used in the body mapping to define that
6251/// every field not bound by the path template should be mapped to the
6252/// request body.  This enables the following alternative definition of
6253/// the update method:
6254///
6255/// ```norust
6256/// service Messaging {
6257///   rpc UpdateMessage(Message) returns (Message) {
6258///     option (google.api.http) = {
6259///       patch: "/v1/messages/{message_id}"
6260///       body: "*"
6261///     };
6262///   }
6263/// }
6264/// message Message {
6265///   string message_id = 1;
6266///   string text = 2;
6267/// }
6268/// ```
6269///
6270/// The following HTTP JSON to RPC mapping is enabled:
6271///
6272/// - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }`
6273/// - gRPC: `UpdateMessage(message_id: "123456" text: "Hi!")`
6274///
6275/// Note that when using `*` in the body mapping, it is not possible to
6276/// have HTTP parameters, as all fields not bound by the path end in
6277/// the body. This makes this option more rarely used in practice when
6278/// defining REST APIs. The common usage of `*` is in custom methods
6279/// which don't use the URL at all for transferring data.
6280///
6281/// It is possible to define multiple HTTP methods for one RPC by using
6282/// the `additional_bindings` option. Example:
6283///
6284/// ```norust
6285/// service Messaging {
6286///   rpc GetMessage(GetMessageRequest) returns (Message) {
6287///     option (google.api.http) = {
6288///       get: "/v1/messages/{message_id}"
6289///       additional_bindings {
6290///         get: "/v1/users/{user_id}/messages/{message_id}"
6291///       }
6292///     };
6293///   }
6294/// }
6295/// message GetMessageRequest {
6296///   string message_id = 1;
6297///   string user_id = 2;
6298/// }
6299/// ```
6300///
6301/// This enables the following two alternative HTTP JSON to RPC mappings:
6302///
6303/// - HTTP: `GET /v1/messages/123456`
6304///
6305/// - gRPC: `GetMessage(message_id: "123456")`
6306///
6307/// - HTTP: `GET /v1/users/me/messages/123456`
6308///
6309/// - gRPC: `GetMessage(user_id: "me" message_id: "123456")`
6310///
6311///
6312/// Rules for HTTP mapping
6313///
6314/// 1. Leaf request fields (recursive expansion nested messages in the request
6315///    message) are classified into three categories:
6316///    - Fields referred by the path template. They are passed via the URL path.
6317///    - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They
6318///      are passed via the HTTP
6319///      request body.
6320///    - All other fields are passed via the URL query parameters, and the
6321///      parameter name is the field path in the request message. A repeated
6322///      field can be represented as multiple query parameters under the same
6323///      name.
6324/// 1. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL
6325///    query parameter, all fields
6326///    are passed via URL path and HTTP request body.
6327/// 1. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP
6328///    request body, all
6329///    fields are passed via URL path and URL query parameters.
6330///
6331/// Path template syntax
6332///
6333/// ```norust
6334/// Template = "/" Segments [ Verb ] ;
6335/// Segments = Segment { "/" Segment } ;
6336/// Segment  = "*" | "**" | LITERAL | Variable ;
6337/// Variable = "{" FieldPath [ "=" Segments ] "}" ;
6338/// FieldPath = IDENT { "." IDENT } ;
6339/// Verb     = ":" LITERAL ;
6340/// ```
6341///
6342/// The syntax `*` matches a single URL path segment. The syntax `**` matches
6343/// zero or more URL path segments, which must be the last part of the URL path
6344/// except the `Verb`.
6345///
6346/// The syntax `Variable` matches part of the URL path as specified by its
6347/// template. A variable template must not contain other variables. If a variable
6348/// matches a single path segment, its template may be omitted, e.g. `{var}`
6349/// is equivalent to `{var=*}`.
6350///
6351/// The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL`
6352/// contains any reserved character, such characters should be percent-encoded
6353/// before the matching.
6354///
6355/// If a variable contains exactly one path segment, such as `"{var}"` or
6356/// `"{var=*}"`, when such a variable is expanded into a URL path on the client
6357/// side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The
6358/// server side does the reverse decoding. Such variables show up in the
6359/// [Discovery
6360/// Document](https://developers.google.com/discovery/v1/reference/apis) as
6361/// `{var}`.
6362///
6363/// If a variable contains multiple path segments, such as `"{var=foo/*}"`
6364/// or `"{var=**}"`, when such a variable is expanded into a URL path on the
6365/// client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded.
6366/// The server side does the reverse decoding, except "%2F" and "%2f" are left
6367/// unchanged. Such variables show up in the
6368/// [Discovery
6369/// Document](https://developers.google.com/discovery/v1/reference/apis) as
6370/// `{+var}`.
6371///
6372/// Using gRPC API Service Configuration
6373///
6374/// gRPC API Service Configuration (service config) is a configuration language
6375/// for configuring a gRPC service to become a user-facing product. The
6376/// service config is simply the YAML representation of the `google.api.Service`
6377/// proto message.
6378///
6379/// As an alternative to annotating your proto file, you can configure gRPC
6380/// transcoding in your service config YAML files. You do this by specifying a
6381/// `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same
6382/// effect as the proto annotation. This can be particularly useful if you
6383/// have a proto that is reused in multiple services. Note that any transcoding
6384/// specified in the service config will override any matching transcoding
6385/// configuration in the proto.
6386///
6387/// The following example selects a gRPC method and applies an `HttpRule` to it:
6388///
6389/// ```norust
6390/// http:
6391///   rules:
6392///     - selector: example.v1.Messaging.GetMessage
6393///       get: /v1/messages/{message_id}/{sub.subfield}
6394/// ```
6395///
6396/// Special notes
6397///
6398/// When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the
6399/// proto to JSON conversion must follow the [proto3
6400/// specification](https://developers.google.com/protocol-buffers/docs/proto3#json).
6401///
6402/// While the single segment variable follows the semantics of
6403/// [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String
6404/// Expansion, the multi segment variable **does not** follow RFC 6570 Section
6405/// 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion
6406/// does not expand special characters like `?` and `#`, which would lead
6407/// to invalid URLs. As the result, gRPC Transcoding uses a custom encoding
6408/// for multi segment variables.
6409///
6410/// The path variables **must not** refer to any repeated or mapped field,
6411/// because client libraries are not capable of handling such variable expansion.
6412///
6413/// The path variables **must not** capture the leading "/" character. The reason
6414/// is that the most common use case "{var}" does not capture the leading "/"
6415/// character. For consistency, all path variables must share the same behavior.
6416///
6417/// Repeated message fields must not be mapped to URL query parameters, because
6418/// no client library can support such complicated mapping.
6419///
6420/// If an API needs to use a JSON array for request or response body, it can map
6421/// the request or response body to a repeated field. However, some gRPC
6422/// Transcoding implementations may not support this feature.
6423///
6424/// [google.api.HttpRule.body]: crate::model::HttpRule::body
6425#[derive(Clone, Default, PartialEq)]
6426#[non_exhaustive]
6427pub struct HttpRule {
6428    /// Selects a method to which this rule applies.
6429    ///
6430    /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
6431    /// details.
6432    ///
6433    /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
6434    pub selector: std::string::String,
6435
6436    /// The name of the request field whose value is mapped to the HTTP request
6437    /// body, or `*` for mapping all request fields not captured by the path
6438    /// pattern to the HTTP body, or omitted for not having any HTTP request body.
6439    ///
6440    /// NOTE: the referred field must be present at the top-level of the request
6441    /// message type.
6442    pub body: std::string::String,
6443
6444    /// Optional. The name of the response field whose value is mapped to the HTTP
6445    /// response body. When omitted, the entire response message will be used
6446    /// as the HTTP response body.
6447    ///
6448    /// NOTE: The referred field must be present at the top-level of the response
6449    /// message type.
6450    pub response_body: std::string::String,
6451
6452    /// Additional HTTP bindings for the selector. Nested bindings must
6453    /// not contain an `additional_bindings` field themselves (that is,
6454    /// the nesting may only be one level deep).
6455    pub additional_bindings: std::vec::Vec<crate::model::HttpRule>,
6456
6457    /// Determines the URL pattern is matched by this rules. This pattern can be
6458    /// used with any of the {get|put|post|delete|patch} methods. A custom method
6459    /// can be defined using the 'custom' field.
6460    pub pattern: std::option::Option<crate::model::http_rule::Pattern>,
6461
6462    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6463}
6464
6465impl HttpRule {
6466    /// Creates a new default instance.
6467    pub fn new() -> Self {
6468        std::default::Default::default()
6469    }
6470
6471    /// Sets the value of [selector][crate::model::HttpRule::selector].
6472    ///
6473    /// # Example
6474    /// ```ignore,no_run
6475    /// # use google_cloud_api::model::HttpRule;
6476    /// let x = HttpRule::new().set_selector("example");
6477    /// ```
6478    pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6479        self.selector = v.into();
6480        self
6481    }
6482
6483    /// Sets the value of [body][crate::model::HttpRule::body].
6484    ///
6485    /// # Example
6486    /// ```ignore,no_run
6487    /// # use google_cloud_api::model::HttpRule;
6488    /// let x = HttpRule::new().set_body("example");
6489    /// ```
6490    pub fn set_body<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6491        self.body = v.into();
6492        self
6493    }
6494
6495    /// Sets the value of [response_body][crate::model::HttpRule::response_body].
6496    ///
6497    /// # Example
6498    /// ```ignore,no_run
6499    /// # use google_cloud_api::model::HttpRule;
6500    /// let x = HttpRule::new().set_response_body("example");
6501    /// ```
6502    pub fn set_response_body<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6503        self.response_body = v.into();
6504        self
6505    }
6506
6507    /// Sets the value of [additional_bindings][crate::model::HttpRule::additional_bindings].
6508    ///
6509    /// # Example
6510    /// ```ignore,no_run
6511    /// # use google_cloud_api::model::HttpRule;
6512    /// let x = HttpRule::new()
6513    ///     .set_additional_bindings([
6514    ///         HttpRule::default()/* use setters */,
6515    ///         HttpRule::default()/* use (different) setters */,
6516    ///     ]);
6517    /// ```
6518    pub fn set_additional_bindings<T, V>(mut self, v: T) -> Self
6519    where
6520        T: std::iter::IntoIterator<Item = V>,
6521        V: std::convert::Into<crate::model::HttpRule>,
6522    {
6523        use std::iter::Iterator;
6524        self.additional_bindings = v.into_iter().map(|i| i.into()).collect();
6525        self
6526    }
6527
6528    /// Sets the value of [pattern][crate::model::HttpRule::pattern].
6529    ///
6530    /// Note that all the setters affecting `pattern` are mutually
6531    /// exclusive.
6532    ///
6533    /// # Example
6534    /// ```ignore,no_run
6535    /// # use google_cloud_api::model::HttpRule;
6536    /// use google_cloud_api::model::http_rule::Pattern;
6537    /// let x = HttpRule::new().set_pattern(Some(Pattern::Get("example".to_string())));
6538    /// ```
6539    pub fn set_pattern<
6540        T: std::convert::Into<std::option::Option<crate::model::http_rule::Pattern>>,
6541    >(
6542        mut self,
6543        v: T,
6544    ) -> Self {
6545        self.pattern = v.into();
6546        self
6547    }
6548
6549    /// The value of [pattern][crate::model::HttpRule::pattern]
6550    /// if it holds a `Get`, `None` if the field is not set or
6551    /// holds a different branch.
6552    pub fn get(&self) -> std::option::Option<&std::string::String> {
6553        #[allow(unreachable_patterns)]
6554        self.pattern.as_ref().and_then(|v| match v {
6555            crate::model::http_rule::Pattern::Get(v) => std::option::Option::Some(v),
6556            _ => std::option::Option::None,
6557        })
6558    }
6559
6560    /// Sets the value of [pattern][crate::model::HttpRule::pattern]
6561    /// to hold a `Get`.
6562    ///
6563    /// Note that all the setters affecting `pattern` are
6564    /// mutually exclusive.
6565    ///
6566    /// # Example
6567    /// ```ignore,no_run
6568    /// # use google_cloud_api::model::HttpRule;
6569    /// let x = HttpRule::new().set_get("example");
6570    /// assert!(x.get().is_some());
6571    /// assert!(x.put().is_none());
6572    /// assert!(x.post().is_none());
6573    /// assert!(x.delete().is_none());
6574    /// assert!(x.patch().is_none());
6575    /// assert!(x.custom().is_none());
6576    /// ```
6577    pub fn set_get<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6578        self.pattern = std::option::Option::Some(crate::model::http_rule::Pattern::Get(v.into()));
6579        self
6580    }
6581
6582    /// The value of [pattern][crate::model::HttpRule::pattern]
6583    /// if it holds a `Put`, `None` if the field is not set or
6584    /// holds a different branch.
6585    pub fn put(&self) -> std::option::Option<&std::string::String> {
6586        #[allow(unreachable_patterns)]
6587        self.pattern.as_ref().and_then(|v| match v {
6588            crate::model::http_rule::Pattern::Put(v) => std::option::Option::Some(v),
6589            _ => std::option::Option::None,
6590        })
6591    }
6592
6593    /// Sets the value of [pattern][crate::model::HttpRule::pattern]
6594    /// to hold a `Put`.
6595    ///
6596    /// Note that all the setters affecting `pattern` are
6597    /// mutually exclusive.
6598    ///
6599    /// # Example
6600    /// ```ignore,no_run
6601    /// # use google_cloud_api::model::HttpRule;
6602    /// let x = HttpRule::new().set_put("example");
6603    /// assert!(x.put().is_some());
6604    /// assert!(x.get().is_none());
6605    /// assert!(x.post().is_none());
6606    /// assert!(x.delete().is_none());
6607    /// assert!(x.patch().is_none());
6608    /// assert!(x.custom().is_none());
6609    /// ```
6610    pub fn set_put<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6611        self.pattern = std::option::Option::Some(crate::model::http_rule::Pattern::Put(v.into()));
6612        self
6613    }
6614
6615    /// The value of [pattern][crate::model::HttpRule::pattern]
6616    /// if it holds a `Post`, `None` if the field is not set or
6617    /// holds a different branch.
6618    pub fn post(&self) -> std::option::Option<&std::string::String> {
6619        #[allow(unreachable_patterns)]
6620        self.pattern.as_ref().and_then(|v| match v {
6621            crate::model::http_rule::Pattern::Post(v) => std::option::Option::Some(v),
6622            _ => std::option::Option::None,
6623        })
6624    }
6625
6626    /// Sets the value of [pattern][crate::model::HttpRule::pattern]
6627    /// to hold a `Post`.
6628    ///
6629    /// Note that all the setters affecting `pattern` are
6630    /// mutually exclusive.
6631    ///
6632    /// # Example
6633    /// ```ignore,no_run
6634    /// # use google_cloud_api::model::HttpRule;
6635    /// let x = HttpRule::new().set_post("example");
6636    /// assert!(x.post().is_some());
6637    /// assert!(x.get().is_none());
6638    /// assert!(x.put().is_none());
6639    /// assert!(x.delete().is_none());
6640    /// assert!(x.patch().is_none());
6641    /// assert!(x.custom().is_none());
6642    /// ```
6643    pub fn set_post<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6644        self.pattern = std::option::Option::Some(crate::model::http_rule::Pattern::Post(v.into()));
6645        self
6646    }
6647
6648    /// The value of [pattern][crate::model::HttpRule::pattern]
6649    /// if it holds a `Delete`, `None` if the field is not set or
6650    /// holds a different branch.
6651    pub fn delete(&self) -> std::option::Option<&std::string::String> {
6652        #[allow(unreachable_patterns)]
6653        self.pattern.as_ref().and_then(|v| match v {
6654            crate::model::http_rule::Pattern::Delete(v) => std::option::Option::Some(v),
6655            _ => std::option::Option::None,
6656        })
6657    }
6658
6659    /// Sets the value of [pattern][crate::model::HttpRule::pattern]
6660    /// to hold a `Delete`.
6661    ///
6662    /// Note that all the setters affecting `pattern` are
6663    /// mutually exclusive.
6664    ///
6665    /// # Example
6666    /// ```ignore,no_run
6667    /// # use google_cloud_api::model::HttpRule;
6668    /// let x = HttpRule::new().set_delete("example");
6669    /// assert!(x.delete().is_some());
6670    /// assert!(x.get().is_none());
6671    /// assert!(x.put().is_none());
6672    /// assert!(x.post().is_none());
6673    /// assert!(x.patch().is_none());
6674    /// assert!(x.custom().is_none());
6675    /// ```
6676    pub fn set_delete<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6677        self.pattern =
6678            std::option::Option::Some(crate::model::http_rule::Pattern::Delete(v.into()));
6679        self
6680    }
6681
6682    /// The value of [pattern][crate::model::HttpRule::pattern]
6683    /// if it holds a `Patch`, `None` if the field is not set or
6684    /// holds a different branch.
6685    pub fn patch(&self) -> std::option::Option<&std::string::String> {
6686        #[allow(unreachable_patterns)]
6687        self.pattern.as_ref().and_then(|v| match v {
6688            crate::model::http_rule::Pattern::Patch(v) => std::option::Option::Some(v),
6689            _ => std::option::Option::None,
6690        })
6691    }
6692
6693    /// Sets the value of [pattern][crate::model::HttpRule::pattern]
6694    /// to hold a `Patch`.
6695    ///
6696    /// Note that all the setters affecting `pattern` are
6697    /// mutually exclusive.
6698    ///
6699    /// # Example
6700    /// ```ignore,no_run
6701    /// # use google_cloud_api::model::HttpRule;
6702    /// let x = HttpRule::new().set_patch("example");
6703    /// assert!(x.patch().is_some());
6704    /// assert!(x.get().is_none());
6705    /// assert!(x.put().is_none());
6706    /// assert!(x.post().is_none());
6707    /// assert!(x.delete().is_none());
6708    /// assert!(x.custom().is_none());
6709    /// ```
6710    pub fn set_patch<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6711        self.pattern = std::option::Option::Some(crate::model::http_rule::Pattern::Patch(v.into()));
6712        self
6713    }
6714
6715    /// The value of [pattern][crate::model::HttpRule::pattern]
6716    /// if it holds a `Custom`, `None` if the field is not set or
6717    /// holds a different branch.
6718    pub fn custom(&self) -> std::option::Option<&std::boxed::Box<crate::model::CustomHttpPattern>> {
6719        #[allow(unreachable_patterns)]
6720        self.pattern.as_ref().and_then(|v| match v {
6721            crate::model::http_rule::Pattern::Custom(v) => std::option::Option::Some(v),
6722            _ => std::option::Option::None,
6723        })
6724    }
6725
6726    /// Sets the value of [pattern][crate::model::HttpRule::pattern]
6727    /// to hold a `Custom`.
6728    ///
6729    /// Note that all the setters affecting `pattern` are
6730    /// mutually exclusive.
6731    ///
6732    /// # Example
6733    /// ```ignore,no_run
6734    /// # use google_cloud_api::model::HttpRule;
6735    /// use google_cloud_api::model::CustomHttpPattern;
6736    /// let x = HttpRule::new().set_custom(CustomHttpPattern::default()/* use setters */);
6737    /// assert!(x.custom().is_some());
6738    /// assert!(x.get().is_none());
6739    /// assert!(x.put().is_none());
6740    /// assert!(x.post().is_none());
6741    /// assert!(x.delete().is_none());
6742    /// assert!(x.patch().is_none());
6743    /// ```
6744    pub fn set_custom<T: std::convert::Into<std::boxed::Box<crate::model::CustomHttpPattern>>>(
6745        mut self,
6746        v: T,
6747    ) -> Self {
6748        self.pattern =
6749            std::option::Option::Some(crate::model::http_rule::Pattern::Custom(v.into()));
6750        self
6751    }
6752}
6753
6754impl wkt::message::Message for HttpRule {
6755    fn typename() -> &'static str {
6756        "type.googleapis.com/google.api.HttpRule"
6757    }
6758}
6759
6760/// Defines additional types related to [HttpRule].
6761pub mod http_rule {
6762    #[allow(unused_imports)]
6763    use super::*;
6764
6765    /// Determines the URL pattern is matched by this rules. This pattern can be
6766    /// used with any of the {get|put|post|delete|patch} methods. A custom method
6767    /// can be defined using the 'custom' field.
6768    #[derive(Clone, Debug, PartialEq)]
6769    #[non_exhaustive]
6770    pub enum Pattern {
6771        /// Maps to HTTP GET. Used for listing and getting information about
6772        /// resources.
6773        Get(std::string::String),
6774        /// Maps to HTTP PUT. Used for replacing a resource.
6775        Put(std::string::String),
6776        /// Maps to HTTP POST. Used for creating a resource or performing an action.
6777        Post(std::string::String),
6778        /// Maps to HTTP DELETE. Used for deleting a resource.
6779        Delete(std::string::String),
6780        /// Maps to HTTP PATCH. Used for updating a resource.
6781        Patch(std::string::String),
6782        /// The custom pattern is used for specifying an HTTP method that is not
6783        /// included in the `pattern` field, such as HEAD, or "*" to leave the
6784        /// HTTP method unspecified for this rule. The wild-card rule is useful
6785        /// for services that provide content to Web (HTML) clients.
6786        Custom(std::boxed::Box<crate::model::CustomHttpPattern>),
6787    }
6788}
6789
6790/// A custom pattern is used for defining custom HTTP verb.
6791#[derive(Clone, Default, PartialEq)]
6792#[non_exhaustive]
6793pub struct CustomHttpPattern {
6794    /// The name of this custom HTTP verb.
6795    pub kind: std::string::String,
6796
6797    /// The path matched by this custom verb.
6798    pub path: std::string::String,
6799
6800    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6801}
6802
6803impl CustomHttpPattern {
6804    /// Creates a new default instance.
6805    pub fn new() -> Self {
6806        std::default::Default::default()
6807    }
6808
6809    /// Sets the value of [kind][crate::model::CustomHttpPattern::kind].
6810    ///
6811    /// # Example
6812    /// ```ignore,no_run
6813    /// # use google_cloud_api::model::CustomHttpPattern;
6814    /// let x = CustomHttpPattern::new().set_kind("example");
6815    /// ```
6816    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6817        self.kind = v.into();
6818        self
6819    }
6820
6821    /// Sets the value of [path][crate::model::CustomHttpPattern::path].
6822    ///
6823    /// # Example
6824    /// ```ignore,no_run
6825    /// # use google_cloud_api::model::CustomHttpPattern;
6826    /// let x = CustomHttpPattern::new().set_path("example");
6827    /// ```
6828    pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6829        self.path = v.into();
6830        self
6831    }
6832}
6833
6834impl wkt::message::Message for CustomHttpPattern {
6835    fn typename() -> &'static str {
6836        "type.googleapis.com/google.api.CustomHttpPattern"
6837    }
6838}
6839
6840/// Message that represents an arbitrary HTTP body. It should only be used for
6841/// payload formats that can't be represented as JSON, such as raw binary or
6842/// an HTML page.
6843///
6844/// This message can be used both in streaming and non-streaming API methods in
6845/// the request as well as the response.
6846///
6847/// It can be used as a top-level request field, which is convenient if one
6848/// wants to extract parameters from either the URL or HTTP template into the
6849/// request fields and also want access to the raw HTTP body.
6850///
6851/// Example:
6852///
6853/// ```norust
6854/// message GetResourceRequest {
6855///   // A unique request id.
6856///   string request_id = 1;
6857///
6858///   // The raw HTTP body is bound to this field.
6859///   google.api.HttpBody http_body = 2;
6860///
6861/// }
6862///
6863/// service ResourceService {
6864///   rpc GetResource(GetResourceRequest)
6865///     returns (google.api.HttpBody);
6866///   rpc UpdateResource(google.api.HttpBody)
6867///     returns (google.protobuf.Empty);
6868///
6869/// }
6870/// ```
6871///
6872/// Example with streaming methods:
6873///
6874/// ```norust
6875/// service CaldavService {
6876///   rpc GetCalendar(stream google.api.HttpBody)
6877///     returns (stream google.api.HttpBody);
6878///   rpc UpdateCalendar(stream google.api.HttpBody)
6879///     returns (stream google.api.HttpBody);
6880///
6881/// }
6882/// ```
6883///
6884/// Use of this type only changes how the request and response bodies are
6885/// handled, all other features will continue to work unchanged.
6886#[derive(Clone, Default, PartialEq)]
6887#[non_exhaustive]
6888pub struct HttpBody {
6889    /// The HTTP Content-Type header value specifying the content type of the body.
6890    pub content_type: std::string::String,
6891
6892    /// The HTTP request/response body as raw binary.
6893    pub data: ::bytes::Bytes,
6894
6895    /// Application specific response metadata. Must be set in the first response
6896    /// for streaming APIs.
6897    pub extensions: std::vec::Vec<wkt::Any>,
6898
6899    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6900}
6901
6902impl HttpBody {
6903    /// Creates a new default instance.
6904    pub fn new() -> Self {
6905        std::default::Default::default()
6906    }
6907
6908    /// Sets the value of [content_type][crate::model::HttpBody::content_type].
6909    ///
6910    /// # Example
6911    /// ```ignore,no_run
6912    /// # use google_cloud_api::model::HttpBody;
6913    /// let x = HttpBody::new().set_content_type("example");
6914    /// ```
6915    pub fn set_content_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6916        self.content_type = v.into();
6917        self
6918    }
6919
6920    /// Sets the value of [data][crate::model::HttpBody::data].
6921    ///
6922    /// # Example
6923    /// ```ignore,no_run
6924    /// # use google_cloud_api::model::HttpBody;
6925    /// let x = HttpBody::new().set_data(bytes::Bytes::from_static(b"example"));
6926    /// ```
6927    pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
6928        self.data = v.into();
6929        self
6930    }
6931
6932    /// Sets the value of [extensions][crate::model::HttpBody::extensions].
6933    ///
6934    /// # Example
6935    /// ```ignore,no_run
6936    /// # use google_cloud_api::model::HttpBody;
6937    /// use wkt::Any;
6938    /// let x = HttpBody::new()
6939    ///     .set_extensions([
6940    ///         Any::default()/* use setters */,
6941    ///         Any::default()/* use (different) setters */,
6942    ///     ]);
6943    /// ```
6944    pub fn set_extensions<T, V>(mut self, v: T) -> Self
6945    where
6946        T: std::iter::IntoIterator<Item = V>,
6947        V: std::convert::Into<wkt::Any>,
6948    {
6949        use std::iter::Iterator;
6950        self.extensions = v.into_iter().map(|i| i.into()).collect();
6951        self
6952    }
6953}
6954
6955impl wkt::message::Message for HttpBody {
6956    fn typename() -> &'static str {
6957        "type.googleapis.com/google.api.HttpBody"
6958    }
6959}
6960
6961/// A description of a label.
6962#[derive(Clone, Default, PartialEq)]
6963#[non_exhaustive]
6964pub struct LabelDescriptor {
6965    /// The label key.
6966    pub key: std::string::String,
6967
6968    /// The type of data that can be assigned to the label.
6969    pub value_type: crate::model::label_descriptor::ValueType,
6970
6971    /// A human-readable description for the label.
6972    pub description: std::string::String,
6973
6974    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6975}
6976
6977impl LabelDescriptor {
6978    /// Creates a new default instance.
6979    pub fn new() -> Self {
6980        std::default::Default::default()
6981    }
6982
6983    /// Sets the value of [key][crate::model::LabelDescriptor::key].
6984    ///
6985    /// # Example
6986    /// ```ignore,no_run
6987    /// # use google_cloud_api::model::LabelDescriptor;
6988    /// let x = LabelDescriptor::new().set_key("example");
6989    /// ```
6990    pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6991        self.key = v.into();
6992        self
6993    }
6994
6995    /// Sets the value of [value_type][crate::model::LabelDescriptor::value_type].
6996    ///
6997    /// # Example
6998    /// ```ignore,no_run
6999    /// # use google_cloud_api::model::LabelDescriptor;
7000    /// use google_cloud_api::model::label_descriptor::ValueType;
7001    /// let x0 = LabelDescriptor::new().set_value_type(ValueType::Bool);
7002    /// let x1 = LabelDescriptor::new().set_value_type(ValueType::Int64);
7003    /// ```
7004    pub fn set_value_type<T: std::convert::Into<crate::model::label_descriptor::ValueType>>(
7005        mut self,
7006        v: T,
7007    ) -> Self {
7008        self.value_type = v.into();
7009        self
7010    }
7011
7012    /// Sets the value of [description][crate::model::LabelDescriptor::description].
7013    ///
7014    /// # Example
7015    /// ```ignore,no_run
7016    /// # use google_cloud_api::model::LabelDescriptor;
7017    /// let x = LabelDescriptor::new().set_description("example");
7018    /// ```
7019    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7020        self.description = v.into();
7021        self
7022    }
7023}
7024
7025impl wkt::message::Message for LabelDescriptor {
7026    fn typename() -> &'static str {
7027        "type.googleapis.com/google.api.LabelDescriptor"
7028    }
7029}
7030
7031/// Defines additional types related to [LabelDescriptor].
7032pub mod label_descriptor {
7033    #[allow(unused_imports)]
7034    use super::*;
7035
7036    /// Value types that can be used as label values.
7037    ///
7038    /// # Working with unknown values
7039    ///
7040    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7041    /// additional enum variants at any time. Adding new variants is not considered
7042    /// a breaking change. Applications should write their code in anticipation of:
7043    ///
7044    /// - New values appearing in future releases of the client library, **and**
7045    /// - New values received dynamically, without application changes.
7046    ///
7047    /// Please consult the [Working with enums] section in the user guide for some
7048    /// guidelines.
7049    ///
7050    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
7051    #[derive(Clone, Debug, PartialEq)]
7052    #[non_exhaustive]
7053    pub enum ValueType {
7054        /// A variable-length string. This is the default.
7055        String,
7056        /// Boolean; true or false.
7057        Bool,
7058        /// A 64-bit signed integer.
7059        Int64,
7060        /// If set, the enum was initialized with an unknown value.
7061        ///
7062        /// Applications can examine the value using [ValueType::value] or
7063        /// [ValueType::name].
7064        UnknownValue(value_type::UnknownValue),
7065    }
7066
7067    #[doc(hidden)]
7068    pub mod value_type {
7069        #[allow(unused_imports)]
7070        use super::*;
7071        #[derive(Clone, Debug, PartialEq)]
7072        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7073    }
7074
7075    impl ValueType {
7076        /// Gets the enum value.
7077        ///
7078        /// Returns `None` if the enum contains an unknown value deserialized from
7079        /// the string representation of enums.
7080        pub fn value(&self) -> std::option::Option<i32> {
7081            match self {
7082                Self::String => std::option::Option::Some(0),
7083                Self::Bool => std::option::Option::Some(1),
7084                Self::Int64 => std::option::Option::Some(2),
7085                Self::UnknownValue(u) => u.0.value(),
7086            }
7087        }
7088
7089        /// Gets the enum value as a string.
7090        ///
7091        /// Returns `None` if the enum contains an unknown value deserialized from
7092        /// the integer representation of enums.
7093        pub fn name(&self) -> std::option::Option<&str> {
7094            match self {
7095                Self::String => std::option::Option::Some("STRING"),
7096                Self::Bool => std::option::Option::Some("BOOL"),
7097                Self::Int64 => std::option::Option::Some("INT64"),
7098                Self::UnknownValue(u) => u.0.name(),
7099            }
7100        }
7101    }
7102
7103    impl std::default::Default for ValueType {
7104        fn default() -> Self {
7105            use std::convert::From;
7106            Self::from(0)
7107        }
7108    }
7109
7110    impl std::fmt::Display for ValueType {
7111        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7112            wkt::internal::display_enum(f, self.name(), self.value())
7113        }
7114    }
7115
7116    impl std::convert::From<i32> for ValueType {
7117        fn from(value: i32) -> Self {
7118            match value {
7119                0 => Self::String,
7120                1 => Self::Bool,
7121                2 => Self::Int64,
7122                _ => Self::UnknownValue(value_type::UnknownValue(
7123                    wkt::internal::UnknownEnumValue::Integer(value),
7124                )),
7125            }
7126        }
7127    }
7128
7129    impl std::convert::From<&str> for ValueType {
7130        fn from(value: &str) -> Self {
7131            use std::string::ToString;
7132            match value {
7133                "STRING" => Self::String,
7134                "BOOL" => Self::Bool,
7135                "INT64" => Self::Int64,
7136                _ => Self::UnknownValue(value_type::UnknownValue(
7137                    wkt::internal::UnknownEnumValue::String(value.to_string()),
7138                )),
7139            }
7140        }
7141    }
7142
7143    impl serde::ser::Serialize for ValueType {
7144        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7145        where
7146            S: serde::Serializer,
7147        {
7148            match self {
7149                Self::String => serializer.serialize_i32(0),
7150                Self::Bool => serializer.serialize_i32(1),
7151                Self::Int64 => serializer.serialize_i32(2),
7152                Self::UnknownValue(u) => u.0.serialize(serializer),
7153            }
7154        }
7155    }
7156
7157    impl<'de> serde::de::Deserialize<'de> for ValueType {
7158        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7159        where
7160            D: serde::Deserializer<'de>,
7161        {
7162            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ValueType>::new(
7163                ".google.api.LabelDescriptor.ValueType",
7164            ))
7165        }
7166    }
7167}
7168
7169/// A description of a log type. Example in YAML format:
7170///
7171/// ```norust
7172/// - name: library.googleapis.com/activity_history
7173///   description: The history of borrowing and returning library items.
7174///   display_name: Activity
7175///   labels:
7176///   - key: /customer_id
7177///     description: Identifier of a library customer
7178/// ```
7179#[derive(Clone, Default, PartialEq)]
7180#[non_exhaustive]
7181pub struct LogDescriptor {
7182    /// The name of the log. It must be less than 512 characters long and can
7183    /// include the following characters: upper- and lower-case alphanumeric
7184    /// characters [A-Za-z0-9], and punctuation characters including
7185    /// slash, underscore, hyphen, period [/_-.].
7186    pub name: std::string::String,
7187
7188    /// The set of labels that are available to describe a specific log entry.
7189    /// Runtime requests that contain labels not specified here are
7190    /// considered invalid.
7191    pub labels: std::vec::Vec<crate::model::LabelDescriptor>,
7192
7193    /// A human-readable description of this log. This information appears in
7194    /// the documentation and can contain details.
7195    pub description: std::string::String,
7196
7197    /// The human-readable name for this log. This information appears on
7198    /// the user interface and should be concise.
7199    pub display_name: std::string::String,
7200
7201    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7202}
7203
7204impl LogDescriptor {
7205    /// Creates a new default instance.
7206    pub fn new() -> Self {
7207        std::default::Default::default()
7208    }
7209
7210    /// Sets the value of [name][crate::model::LogDescriptor::name].
7211    ///
7212    /// # Example
7213    /// ```ignore,no_run
7214    /// # use google_cloud_api::model::LogDescriptor;
7215    /// let x = LogDescriptor::new().set_name("example");
7216    /// ```
7217    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7218        self.name = v.into();
7219        self
7220    }
7221
7222    /// Sets the value of [labels][crate::model::LogDescriptor::labels].
7223    ///
7224    /// # Example
7225    /// ```ignore,no_run
7226    /// # use google_cloud_api::model::LogDescriptor;
7227    /// use google_cloud_api::model::LabelDescriptor;
7228    /// let x = LogDescriptor::new()
7229    ///     .set_labels([
7230    ///         LabelDescriptor::default()/* use setters */,
7231    ///         LabelDescriptor::default()/* use (different) setters */,
7232    ///     ]);
7233    /// ```
7234    pub fn set_labels<T, V>(mut self, v: T) -> Self
7235    where
7236        T: std::iter::IntoIterator<Item = V>,
7237        V: std::convert::Into<crate::model::LabelDescriptor>,
7238    {
7239        use std::iter::Iterator;
7240        self.labels = v.into_iter().map(|i| i.into()).collect();
7241        self
7242    }
7243
7244    /// Sets the value of [description][crate::model::LogDescriptor::description].
7245    ///
7246    /// # Example
7247    /// ```ignore,no_run
7248    /// # use google_cloud_api::model::LogDescriptor;
7249    /// let x = LogDescriptor::new().set_description("example");
7250    /// ```
7251    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7252        self.description = v.into();
7253        self
7254    }
7255
7256    /// Sets the value of [display_name][crate::model::LogDescriptor::display_name].
7257    ///
7258    /// # Example
7259    /// ```ignore,no_run
7260    /// # use google_cloud_api::model::LogDescriptor;
7261    /// let x = LogDescriptor::new().set_display_name("example");
7262    /// ```
7263    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7264        self.display_name = v.into();
7265        self
7266    }
7267}
7268
7269impl wkt::message::Message for LogDescriptor {
7270    fn typename() -> &'static str {
7271        "type.googleapis.com/google.api.LogDescriptor"
7272    }
7273}
7274
7275/// Logging configuration of the service.
7276///
7277/// The following example shows how to configure logs to be sent to the
7278/// producer and consumer projects. In the example, the `activity_history`
7279/// log is sent to both the producer and consumer projects, whereas the
7280/// `purchase_history` log is only sent to the producer project.
7281///
7282/// ```norust
7283/// monitored_resources:
7284/// - type: library.googleapis.com/branch
7285///   labels:
7286///   - key: /city
7287///     description: The city where the library branch is located in.
7288///   - key: /name
7289///     description: The name of the branch.
7290/// logs:
7291/// - name: activity_history
7292///   labels:
7293///   - key: /customer_id
7294/// - name: purchase_history
7295/// logging:
7296///   producer_destinations:
7297///   - monitored_resource: library.googleapis.com/branch
7298///     logs:
7299///     - activity_history
7300///     - purchase_history
7301///   consumer_destinations:
7302///   - monitored_resource: library.googleapis.com/branch
7303///     logs:
7304///     - activity_history
7305/// ```
7306#[derive(Clone, Default, PartialEq)]
7307#[non_exhaustive]
7308pub struct Logging {
7309    /// Logging configurations for sending logs to the producer project.
7310    /// There can be multiple producer destinations, each one must have a
7311    /// different monitored resource type. A log can be used in at most
7312    /// one producer destination.
7313    pub producer_destinations: std::vec::Vec<crate::model::logging::LoggingDestination>,
7314
7315    /// Logging configurations for sending logs to the consumer project.
7316    /// There can be multiple consumer destinations, each one must have a
7317    /// different monitored resource type. A log can be used in at most
7318    /// one consumer destination.
7319    pub consumer_destinations: std::vec::Vec<crate::model::logging::LoggingDestination>,
7320
7321    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7322}
7323
7324impl Logging {
7325    /// Creates a new default instance.
7326    pub fn new() -> Self {
7327        std::default::Default::default()
7328    }
7329
7330    /// Sets the value of [producer_destinations][crate::model::Logging::producer_destinations].
7331    ///
7332    /// # Example
7333    /// ```ignore,no_run
7334    /// # use google_cloud_api::model::Logging;
7335    /// use google_cloud_api::model::logging::LoggingDestination;
7336    /// let x = Logging::new()
7337    ///     .set_producer_destinations([
7338    ///         LoggingDestination::default()/* use setters */,
7339    ///         LoggingDestination::default()/* use (different) setters */,
7340    ///     ]);
7341    /// ```
7342    pub fn set_producer_destinations<T, V>(mut self, v: T) -> Self
7343    where
7344        T: std::iter::IntoIterator<Item = V>,
7345        V: std::convert::Into<crate::model::logging::LoggingDestination>,
7346    {
7347        use std::iter::Iterator;
7348        self.producer_destinations = v.into_iter().map(|i| i.into()).collect();
7349        self
7350    }
7351
7352    /// Sets the value of [consumer_destinations][crate::model::Logging::consumer_destinations].
7353    ///
7354    /// # Example
7355    /// ```ignore,no_run
7356    /// # use google_cloud_api::model::Logging;
7357    /// use google_cloud_api::model::logging::LoggingDestination;
7358    /// let x = Logging::new()
7359    ///     .set_consumer_destinations([
7360    ///         LoggingDestination::default()/* use setters */,
7361    ///         LoggingDestination::default()/* use (different) setters */,
7362    ///     ]);
7363    /// ```
7364    pub fn set_consumer_destinations<T, V>(mut self, v: T) -> Self
7365    where
7366        T: std::iter::IntoIterator<Item = V>,
7367        V: std::convert::Into<crate::model::logging::LoggingDestination>,
7368    {
7369        use std::iter::Iterator;
7370        self.consumer_destinations = v.into_iter().map(|i| i.into()).collect();
7371        self
7372    }
7373}
7374
7375impl wkt::message::Message for Logging {
7376    fn typename() -> &'static str {
7377        "type.googleapis.com/google.api.Logging"
7378    }
7379}
7380
7381/// Defines additional types related to [Logging].
7382pub mod logging {
7383    #[allow(unused_imports)]
7384    use super::*;
7385
7386    /// Configuration of a specific logging destination (the producer project
7387    /// or the consumer project).
7388    #[derive(Clone, Default, PartialEq)]
7389    #[non_exhaustive]
7390    pub struct LoggingDestination {
7391        /// The monitored resource type. The type must be defined in the
7392        /// [Service.monitored_resources][google.api.Service.monitored_resources]
7393        /// section.
7394        ///
7395        /// [google.api.Service.monitored_resources]: crate::model::Service::monitored_resources
7396        pub monitored_resource: std::string::String,
7397
7398        /// Names of the logs to be sent to this destination. Each name must
7399        /// be defined in the [Service.logs][google.api.Service.logs] section. If the
7400        /// log name is not a domain scoped name, it will be automatically prefixed
7401        /// with the service name followed by "/".
7402        ///
7403        /// [google.api.Service.logs]: crate::model::Service::logs
7404        pub logs: std::vec::Vec<std::string::String>,
7405
7406        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7407    }
7408
7409    impl LoggingDestination {
7410        /// Creates a new default instance.
7411        pub fn new() -> Self {
7412            std::default::Default::default()
7413        }
7414
7415        /// Sets the value of [monitored_resource][crate::model::logging::LoggingDestination::monitored_resource].
7416        ///
7417        /// # Example
7418        /// ```ignore,no_run
7419        /// # use google_cloud_api::model::logging::LoggingDestination;
7420        /// let x = LoggingDestination::new().set_monitored_resource("example");
7421        /// ```
7422        pub fn set_monitored_resource<T: std::convert::Into<std::string::String>>(
7423            mut self,
7424            v: T,
7425        ) -> Self {
7426            self.monitored_resource = v.into();
7427            self
7428        }
7429
7430        /// Sets the value of [logs][crate::model::logging::LoggingDestination::logs].
7431        ///
7432        /// # Example
7433        /// ```ignore,no_run
7434        /// # use google_cloud_api::model::logging::LoggingDestination;
7435        /// let x = LoggingDestination::new().set_logs(["a", "b", "c"]);
7436        /// ```
7437        pub fn set_logs<T, V>(mut self, v: T) -> Self
7438        where
7439            T: std::iter::IntoIterator<Item = V>,
7440            V: std::convert::Into<std::string::String>,
7441        {
7442            use std::iter::Iterator;
7443            self.logs = v.into_iter().map(|i| i.into()).collect();
7444            self
7445        }
7446    }
7447
7448    impl wkt::message::Message for LoggingDestination {
7449        fn typename() -> &'static str {
7450            "type.googleapis.com/google.api.Logging.LoggingDestination"
7451        }
7452    }
7453}
7454
7455/// Defines a metric type and its schema. Once a metric descriptor is created,
7456/// deleting or altering it stops data collection and makes the metric type's
7457/// existing data unusable.
7458#[derive(Clone, Default, PartialEq)]
7459#[non_exhaustive]
7460pub struct MetricDescriptor {
7461    /// The resource name of the metric descriptor.
7462    pub name: std::string::String,
7463
7464    /// The metric type, including its DNS name prefix. The type is not
7465    /// URL-encoded. All user-defined metric types have the DNS name
7466    /// `custom.googleapis.com` or `external.googleapis.com`. Metric types should
7467    /// use a natural hierarchical grouping. For example:
7468    ///
7469    /// ```norust
7470    /// "custom.googleapis.com/invoice/paid/amount"
7471    /// "external.googleapis.com/prometheus/up"
7472    /// "appengine.googleapis.com/http/server/response_latencies"
7473    /// ```
7474    pub r#type: std::string::String,
7475
7476    /// The set of labels that can be used to describe a specific
7477    /// instance of this metric type. For example, the
7478    /// `appengine.googleapis.com/http/server/response_latencies` metric
7479    /// type has a label for the HTTP response code, `response_code`, so
7480    /// you can look at latencies for successful responses or just
7481    /// for responses that failed.
7482    pub labels: std::vec::Vec<crate::model::LabelDescriptor>,
7483
7484    /// Whether the metric records instantaneous values, changes to a value, etc.
7485    /// Some combinations of `metric_kind` and `value_type` might not be supported.
7486    pub metric_kind: crate::model::metric_descriptor::MetricKind,
7487
7488    /// Whether the measurement is an integer, a floating-point number, etc.
7489    /// Some combinations of `metric_kind` and `value_type` might not be supported.
7490    pub value_type: crate::model::metric_descriptor::ValueType,
7491
7492    /// The units in which the metric value is reported. It is only applicable
7493    /// if the `value_type` is `INT64`, `DOUBLE`, or `DISTRIBUTION`. The `unit`
7494    /// defines the representation of the stored metric values.
7495    ///
7496    /// Different systems might scale the values to be more easily displayed (so a
7497    /// value of `0.02kBy` _might_ be displayed as `20By`, and a value of
7498    /// `3523kBy` _might_ be displayed as `3.5MBy`). However, if the `unit` is
7499    /// `kBy`, then the value of the metric is always in thousands of bytes, no
7500    /// matter how it might be displayed.
7501    ///
7502    /// If you want a custom metric to record the exact number of CPU-seconds used
7503    /// by a job, you can create an `INT64 CUMULATIVE` metric whose `unit` is
7504    /// `s{CPU}` (or equivalently `1s{CPU}` or just `s`). If the job uses 12,005
7505    /// CPU-seconds, then the value is written as `12005`.
7506    ///
7507    /// Alternatively, if you want a custom metric to record data in a more
7508    /// granular way, you can create a `DOUBLE CUMULATIVE` metric whose `unit` is
7509    /// `ks{CPU}`, and then write the value `12.005` (which is `12005/1000`),
7510    /// or use `Kis{CPU}` and write `11.723` (which is `12005/1024`).
7511    ///
7512    /// The supported units are a subset of [The Unified Code for Units of
7513    /// Measure](https://unitsofmeasure.org/ucum.html) standard:
7514    ///
7515    /// **Basic units (UNIT)**
7516    ///
7517    /// * `bit`   bit
7518    /// * `By`    byte
7519    /// * `s`     second
7520    /// * `min`   minute
7521    /// * `h`     hour
7522    /// * `d`     day
7523    /// * `1`     dimensionless
7524    ///
7525    /// **Prefixes (PREFIX)**
7526    ///
7527    /// * `k`     kilo    (10^3)
7528    ///
7529    /// * `M`     mega    (10^6)
7530    ///
7531    /// * `G`     giga    (10^9)
7532    ///
7533    /// * `T`     tera    (10^12)
7534    ///
7535    /// * `P`     peta    (10^15)
7536    ///
7537    /// * `E`     exa     (10^18)
7538    ///
7539    /// * `Z`     zetta   (10^21)
7540    ///
7541    /// * `Y`     yotta   (10^24)
7542    ///
7543    /// * `m`     milli   (10^-3)
7544    ///
7545    /// * `u`     micro   (10^-6)
7546    ///
7547    /// * `n`     nano    (10^-9)
7548    ///
7549    /// * `p`     pico    (10^-12)
7550    ///
7551    /// * `f`     femto   (10^-15)
7552    ///
7553    /// * `a`     atto    (10^-18)
7554    ///
7555    /// * `z`     zepto   (10^-21)
7556    ///
7557    /// * `y`     yocto   (10^-24)
7558    ///
7559    /// * `Ki`    kibi    (2^10)
7560    ///
7561    /// * `Mi`    mebi    (2^20)
7562    ///
7563    /// * `Gi`    gibi    (2^30)
7564    ///
7565    /// * `Ti`    tebi    (2^40)
7566    ///
7567    /// * `Pi`    pebi    (2^50)
7568    ///
7569    ///
7570    /// **Grammar**
7571    ///
7572    /// The grammar also includes these connectors:
7573    ///
7574    /// * `/`    division or ratio (as an infix operator). For examples,
7575    ///   `kBy/{email}` or `MiBy/10ms` (although you should almost never
7576    ///   have `/s` in a metric `unit`; rates should always be computed at
7577    ///   query time from the underlying cumulative or delta value).
7578    /// * `.`    multiplication or composition (as an infix operator). For
7579    ///   examples, `GBy.d` or `k{watt}.h`.
7580    ///
7581    /// The grammar for a unit is as follows:
7582    ///
7583    /// ```norust
7584    /// Expression = Component { "." Component } { "/" Component } ;
7585    ///
7586    /// Component = ( [ PREFIX ] UNIT | "%" ) [ Annotation ]
7587    ///           | Annotation
7588    ///           | "1"
7589    ///           ;
7590    ///
7591    /// Annotation = "{" NAME "}" ;
7592    /// ```
7593    ///
7594    /// Notes:
7595    ///
7596    /// * `Annotation` is just a comment if it follows a `UNIT`. If the annotation
7597    ///   is used alone, then the unit is equivalent to `1`. For examples,
7598    ///   `{request}/s == 1/s`, `By{transmitted}/s == By/s`.
7599    /// * `NAME` is a sequence of non-blank printable ASCII characters not
7600    ///   containing `{` or `}`.
7601    /// * `1` represents a unitary [dimensionless
7602    ///   unit](https://en.wikipedia.org/wiki/Dimensionless_quantity) of 1, such
7603    ///   as in `1/s`. It is typically used when none of the basic units are
7604    ///   appropriate. For example, "new users per day" can be represented as
7605    ///   `1/d` or `{new-users}/d` (and a metric value `5` would mean "5 new
7606    ///   users). Alternatively, "thousands of page views per day" would be
7607    ///   represented as `1000/d` or `k1/d` or `k{page_views}/d` (and a metric
7608    ///   value of `5.3` would mean "5300 page views per day").
7609    /// * `%` represents dimensionless value of 1/100, and annotates values giving
7610    ///   a percentage (so the metric values are typically in the range of 0..100,
7611    ///   and a metric value `3` means "3 percent").
7612    /// * `10^2.%` indicates a metric contains a ratio, typically in the range
7613    ///   0..1, that will be multiplied by 100 and displayed as a percentage
7614    ///   (so a metric value `0.03` means "3 percent").
7615    pub unit: std::string::String,
7616
7617    /// A detailed description of the metric, which can be used in documentation.
7618    pub description: std::string::String,
7619
7620    /// A concise name for the metric, which can be displayed in user interfaces.
7621    /// Use sentence case without an ending period, for example "Request count".
7622    /// This field is optional but it is recommended to be set for any metrics
7623    /// associated with user-visible concepts, such as Quota.
7624    pub display_name: std::string::String,
7625
7626    /// Optional. Metadata which can be used to guide usage of the metric.
7627    pub metadata: std::option::Option<crate::model::metric_descriptor::MetricDescriptorMetadata>,
7628
7629    /// Optional. The launch stage of the metric definition.
7630    pub launch_stage: crate::model::LaunchStage,
7631
7632    /// Read-only. If present, then a [time
7633    /// series][google.monitoring.v3.TimeSeries], which is identified partially by
7634    /// a metric type and a
7635    /// [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor], that
7636    /// is associated with this metric type can only be associated with one of the
7637    /// monitored resource types listed here.
7638    ///
7639    /// [google.api.MonitoredResourceDescriptor]: crate::model::MonitoredResourceDescriptor
7640    pub monitored_resource_types: std::vec::Vec<std::string::String>,
7641
7642    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7643}
7644
7645impl MetricDescriptor {
7646    /// Creates a new default instance.
7647    pub fn new() -> Self {
7648        std::default::Default::default()
7649    }
7650
7651    /// Sets the value of [name][crate::model::MetricDescriptor::name].
7652    ///
7653    /// # Example
7654    /// ```ignore,no_run
7655    /// # use google_cloud_api::model::MetricDescriptor;
7656    /// let x = MetricDescriptor::new().set_name("example");
7657    /// ```
7658    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7659        self.name = v.into();
7660        self
7661    }
7662
7663    /// Sets the value of [r#type][crate::model::MetricDescriptor::type].
7664    ///
7665    /// # Example
7666    /// ```ignore,no_run
7667    /// # use google_cloud_api::model::MetricDescriptor;
7668    /// let x = MetricDescriptor::new().set_type("example");
7669    /// ```
7670    pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7671        self.r#type = v.into();
7672        self
7673    }
7674
7675    /// Sets the value of [labels][crate::model::MetricDescriptor::labels].
7676    ///
7677    /// # Example
7678    /// ```ignore,no_run
7679    /// # use google_cloud_api::model::MetricDescriptor;
7680    /// use google_cloud_api::model::LabelDescriptor;
7681    /// let x = MetricDescriptor::new()
7682    ///     .set_labels([
7683    ///         LabelDescriptor::default()/* use setters */,
7684    ///         LabelDescriptor::default()/* use (different) setters */,
7685    ///     ]);
7686    /// ```
7687    pub fn set_labels<T, V>(mut self, v: T) -> Self
7688    where
7689        T: std::iter::IntoIterator<Item = V>,
7690        V: std::convert::Into<crate::model::LabelDescriptor>,
7691    {
7692        use std::iter::Iterator;
7693        self.labels = v.into_iter().map(|i| i.into()).collect();
7694        self
7695    }
7696
7697    /// Sets the value of [metric_kind][crate::model::MetricDescriptor::metric_kind].
7698    ///
7699    /// # Example
7700    /// ```ignore,no_run
7701    /// # use google_cloud_api::model::MetricDescriptor;
7702    /// use google_cloud_api::model::metric_descriptor::MetricKind;
7703    /// let x0 = MetricDescriptor::new().set_metric_kind(MetricKind::Gauge);
7704    /// let x1 = MetricDescriptor::new().set_metric_kind(MetricKind::Delta);
7705    /// let x2 = MetricDescriptor::new().set_metric_kind(MetricKind::Cumulative);
7706    /// ```
7707    pub fn set_metric_kind<T: std::convert::Into<crate::model::metric_descriptor::MetricKind>>(
7708        mut self,
7709        v: T,
7710    ) -> Self {
7711        self.metric_kind = v.into();
7712        self
7713    }
7714
7715    /// Sets the value of [value_type][crate::model::MetricDescriptor::value_type].
7716    ///
7717    /// # Example
7718    /// ```ignore,no_run
7719    /// # use google_cloud_api::model::MetricDescriptor;
7720    /// use google_cloud_api::model::metric_descriptor::ValueType;
7721    /// let x0 = MetricDescriptor::new().set_value_type(ValueType::Bool);
7722    /// let x1 = MetricDescriptor::new().set_value_type(ValueType::Int64);
7723    /// let x2 = MetricDescriptor::new().set_value_type(ValueType::Double);
7724    /// ```
7725    pub fn set_value_type<T: std::convert::Into<crate::model::metric_descriptor::ValueType>>(
7726        mut self,
7727        v: T,
7728    ) -> Self {
7729        self.value_type = v.into();
7730        self
7731    }
7732
7733    /// Sets the value of [unit][crate::model::MetricDescriptor::unit].
7734    ///
7735    /// # Example
7736    /// ```ignore,no_run
7737    /// # use google_cloud_api::model::MetricDescriptor;
7738    /// let x = MetricDescriptor::new().set_unit("example");
7739    /// ```
7740    pub fn set_unit<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7741        self.unit = v.into();
7742        self
7743    }
7744
7745    /// Sets the value of [description][crate::model::MetricDescriptor::description].
7746    ///
7747    /// # Example
7748    /// ```ignore,no_run
7749    /// # use google_cloud_api::model::MetricDescriptor;
7750    /// let x = MetricDescriptor::new().set_description("example");
7751    /// ```
7752    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7753        self.description = v.into();
7754        self
7755    }
7756
7757    /// Sets the value of [display_name][crate::model::MetricDescriptor::display_name].
7758    ///
7759    /// # Example
7760    /// ```ignore,no_run
7761    /// # use google_cloud_api::model::MetricDescriptor;
7762    /// let x = MetricDescriptor::new().set_display_name("example");
7763    /// ```
7764    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7765        self.display_name = v.into();
7766        self
7767    }
7768
7769    /// Sets the value of [metadata][crate::model::MetricDescriptor::metadata].
7770    ///
7771    /// # Example
7772    /// ```ignore,no_run
7773    /// # use google_cloud_api::model::MetricDescriptor;
7774    /// use google_cloud_api::model::metric_descriptor::MetricDescriptorMetadata;
7775    /// let x = MetricDescriptor::new().set_metadata(MetricDescriptorMetadata::default()/* use setters */);
7776    /// ```
7777    pub fn set_metadata<T>(mut self, v: T) -> Self
7778    where
7779        T: std::convert::Into<crate::model::metric_descriptor::MetricDescriptorMetadata>,
7780    {
7781        self.metadata = std::option::Option::Some(v.into());
7782        self
7783    }
7784
7785    /// Sets or clears the value of [metadata][crate::model::MetricDescriptor::metadata].
7786    ///
7787    /// # Example
7788    /// ```ignore,no_run
7789    /// # use google_cloud_api::model::MetricDescriptor;
7790    /// use google_cloud_api::model::metric_descriptor::MetricDescriptorMetadata;
7791    /// let x = MetricDescriptor::new().set_or_clear_metadata(Some(MetricDescriptorMetadata::default()/* use setters */));
7792    /// let x = MetricDescriptor::new().set_or_clear_metadata(None::<MetricDescriptorMetadata>);
7793    /// ```
7794    pub fn set_or_clear_metadata<T>(mut self, v: std::option::Option<T>) -> Self
7795    where
7796        T: std::convert::Into<crate::model::metric_descriptor::MetricDescriptorMetadata>,
7797    {
7798        self.metadata = v.map(|x| x.into());
7799        self
7800    }
7801
7802    /// Sets the value of [launch_stage][crate::model::MetricDescriptor::launch_stage].
7803    ///
7804    /// # Example
7805    /// ```ignore,no_run
7806    /// # use google_cloud_api::model::MetricDescriptor;
7807    /// use google_cloud_api::model::LaunchStage;
7808    /// let x0 = MetricDescriptor::new().set_launch_stage(LaunchStage::Unimplemented);
7809    /// let x1 = MetricDescriptor::new().set_launch_stage(LaunchStage::Prelaunch);
7810    /// let x2 = MetricDescriptor::new().set_launch_stage(LaunchStage::EarlyAccess);
7811    /// ```
7812    pub fn set_launch_stage<T: std::convert::Into<crate::model::LaunchStage>>(
7813        mut self,
7814        v: T,
7815    ) -> Self {
7816        self.launch_stage = v.into();
7817        self
7818    }
7819
7820    /// Sets the value of [monitored_resource_types][crate::model::MetricDescriptor::monitored_resource_types].
7821    ///
7822    /// # Example
7823    /// ```ignore,no_run
7824    /// # use google_cloud_api::model::MetricDescriptor;
7825    /// let x = MetricDescriptor::new().set_monitored_resource_types(["a", "b", "c"]);
7826    /// ```
7827    pub fn set_monitored_resource_types<T, V>(mut self, v: T) -> Self
7828    where
7829        T: std::iter::IntoIterator<Item = V>,
7830        V: std::convert::Into<std::string::String>,
7831    {
7832        use std::iter::Iterator;
7833        self.monitored_resource_types = v.into_iter().map(|i| i.into()).collect();
7834        self
7835    }
7836}
7837
7838impl wkt::message::Message for MetricDescriptor {
7839    fn typename() -> &'static str {
7840        "type.googleapis.com/google.api.MetricDescriptor"
7841    }
7842}
7843
7844/// Defines additional types related to [MetricDescriptor].
7845pub mod metric_descriptor {
7846    #[allow(unused_imports)]
7847    use super::*;
7848
7849    /// Additional annotations that can be used to guide the usage of a metric.
7850    #[derive(Clone, Default, PartialEq)]
7851    #[non_exhaustive]
7852    pub struct MetricDescriptorMetadata {
7853
7854        /// Deprecated. Must use the
7855        /// [MetricDescriptor.launch_stage][google.api.MetricDescriptor.launch_stage]
7856        /// instead.
7857        ///
7858        /// [google.api.MetricDescriptor.launch_stage]: crate::model::MetricDescriptor::launch_stage
7859        #[deprecated]
7860        pub launch_stage: crate::model::LaunchStage,
7861
7862        /// The sampling period of metric data points. For metrics which are written
7863        /// periodically, consecutive data points are stored at this time interval,
7864        /// excluding data loss due to errors. Metrics with a higher granularity have
7865        /// a smaller sampling period.
7866        pub sample_period: std::option::Option<wkt::Duration>,
7867
7868        /// The delay of data points caused by ingestion. Data points older than this
7869        /// age are guaranteed to be ingested and available to be read, excluding
7870        /// data loss due to errors.
7871        pub ingest_delay: std::option::Option<wkt::Duration>,
7872
7873        /// The scope of the timeseries data of the metric.
7874        pub time_series_resource_hierarchy_level: std::vec::Vec<crate::model::metric_descriptor::metric_descriptor_metadata::TimeSeriesResourceHierarchyLevel>,
7875
7876        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7877    }
7878
7879    impl MetricDescriptorMetadata {
7880        /// Creates a new default instance.
7881        pub fn new() -> Self {
7882            std::default::Default::default()
7883        }
7884
7885        /// Sets the value of [launch_stage][crate::model::metric_descriptor::MetricDescriptorMetadata::launch_stage].
7886        ///
7887        /// # Example
7888        /// ```ignore,no_run
7889        /// # use google_cloud_api::model::metric_descriptor::MetricDescriptorMetadata;
7890        /// use google_cloud_api::model::LaunchStage;
7891        /// let x0 = MetricDescriptorMetadata::new().set_launch_stage(LaunchStage::Unimplemented);
7892        /// let x1 = MetricDescriptorMetadata::new().set_launch_stage(LaunchStage::Prelaunch);
7893        /// let x2 = MetricDescriptorMetadata::new().set_launch_stage(LaunchStage::EarlyAccess);
7894        /// ```
7895        #[deprecated]
7896        pub fn set_launch_stage<T: std::convert::Into<crate::model::LaunchStage>>(
7897            mut self,
7898            v: T,
7899        ) -> Self {
7900            self.launch_stage = v.into();
7901            self
7902        }
7903
7904        /// Sets the value of [sample_period][crate::model::metric_descriptor::MetricDescriptorMetadata::sample_period].
7905        ///
7906        /// # Example
7907        /// ```ignore,no_run
7908        /// # use google_cloud_api::model::metric_descriptor::MetricDescriptorMetadata;
7909        /// use wkt::Duration;
7910        /// let x = MetricDescriptorMetadata::new().set_sample_period(Duration::default()/* use setters */);
7911        /// ```
7912        pub fn set_sample_period<T>(mut self, v: T) -> Self
7913        where
7914            T: std::convert::Into<wkt::Duration>,
7915        {
7916            self.sample_period = std::option::Option::Some(v.into());
7917            self
7918        }
7919
7920        /// Sets or clears the value of [sample_period][crate::model::metric_descriptor::MetricDescriptorMetadata::sample_period].
7921        ///
7922        /// # Example
7923        /// ```ignore,no_run
7924        /// # use google_cloud_api::model::metric_descriptor::MetricDescriptorMetadata;
7925        /// use wkt::Duration;
7926        /// let x = MetricDescriptorMetadata::new().set_or_clear_sample_period(Some(Duration::default()/* use setters */));
7927        /// let x = MetricDescriptorMetadata::new().set_or_clear_sample_period(None::<Duration>);
7928        /// ```
7929        pub fn set_or_clear_sample_period<T>(mut self, v: std::option::Option<T>) -> Self
7930        where
7931            T: std::convert::Into<wkt::Duration>,
7932        {
7933            self.sample_period = v.map(|x| x.into());
7934            self
7935        }
7936
7937        /// Sets the value of [ingest_delay][crate::model::metric_descriptor::MetricDescriptorMetadata::ingest_delay].
7938        ///
7939        /// # Example
7940        /// ```ignore,no_run
7941        /// # use google_cloud_api::model::metric_descriptor::MetricDescriptorMetadata;
7942        /// use wkt::Duration;
7943        /// let x = MetricDescriptorMetadata::new().set_ingest_delay(Duration::default()/* use setters */);
7944        /// ```
7945        pub fn set_ingest_delay<T>(mut self, v: T) -> Self
7946        where
7947            T: std::convert::Into<wkt::Duration>,
7948        {
7949            self.ingest_delay = std::option::Option::Some(v.into());
7950            self
7951        }
7952
7953        /// Sets or clears the value of [ingest_delay][crate::model::metric_descriptor::MetricDescriptorMetadata::ingest_delay].
7954        ///
7955        /// # Example
7956        /// ```ignore,no_run
7957        /// # use google_cloud_api::model::metric_descriptor::MetricDescriptorMetadata;
7958        /// use wkt::Duration;
7959        /// let x = MetricDescriptorMetadata::new().set_or_clear_ingest_delay(Some(Duration::default()/* use setters */));
7960        /// let x = MetricDescriptorMetadata::new().set_or_clear_ingest_delay(None::<Duration>);
7961        /// ```
7962        pub fn set_or_clear_ingest_delay<T>(mut self, v: std::option::Option<T>) -> Self
7963        where
7964            T: std::convert::Into<wkt::Duration>,
7965        {
7966            self.ingest_delay = v.map(|x| x.into());
7967            self
7968        }
7969
7970        /// Sets the value of [time_series_resource_hierarchy_level][crate::model::metric_descriptor::MetricDescriptorMetadata::time_series_resource_hierarchy_level].
7971        ///
7972        /// # Example
7973        /// ```ignore,no_run
7974        /// # use google_cloud_api::model::metric_descriptor::MetricDescriptorMetadata;
7975        /// use google_cloud_api::model::metric_descriptor::metric_descriptor_metadata::TimeSeriesResourceHierarchyLevel;
7976        /// let x = MetricDescriptorMetadata::new().set_time_series_resource_hierarchy_level([
7977        ///     TimeSeriesResourceHierarchyLevel::Project,
7978        ///     TimeSeriesResourceHierarchyLevel::Organization,
7979        ///     TimeSeriesResourceHierarchyLevel::Folder,
7980        /// ]);
7981        /// ```
7982        pub fn set_time_series_resource_hierarchy_level<T, V>(mut self, v: T) -> Self
7983        where
7984            T: std::iter::IntoIterator<Item = V>,
7985            V: std::convert::Into<crate::model::metric_descriptor::metric_descriptor_metadata::TimeSeriesResourceHierarchyLevel>
7986        {
7987            use std::iter::Iterator;
7988            self.time_series_resource_hierarchy_level = v.into_iter().map(|i| i.into()).collect();
7989            self
7990        }
7991    }
7992
7993    impl wkt::message::Message for MetricDescriptorMetadata {
7994        fn typename() -> &'static str {
7995            "type.googleapis.com/google.api.MetricDescriptor.MetricDescriptorMetadata"
7996        }
7997    }
7998
7999    /// Defines additional types related to [MetricDescriptorMetadata].
8000    pub mod metric_descriptor_metadata {
8001        #[allow(unused_imports)]
8002        use super::*;
8003
8004        /// The resource hierarchy level of the timeseries data of a metric.
8005        ///
8006        /// # Working with unknown values
8007        ///
8008        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8009        /// additional enum variants at any time. Adding new variants is not considered
8010        /// a breaking change. Applications should write their code in anticipation of:
8011        ///
8012        /// - New values appearing in future releases of the client library, **and**
8013        /// - New values received dynamically, without application changes.
8014        ///
8015        /// Please consult the [Working with enums] section in the user guide for some
8016        /// guidelines.
8017        ///
8018        /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8019        #[derive(Clone, Debug, PartialEq)]
8020        #[non_exhaustive]
8021        pub enum TimeSeriesResourceHierarchyLevel {
8022            /// Do not use this default value.
8023            Unspecified,
8024            /// Scopes a metric to a project.
8025            Project,
8026            /// Scopes a metric to an organization.
8027            Organization,
8028            /// Scopes a metric to a folder.
8029            Folder,
8030            /// If set, the enum was initialized with an unknown value.
8031            ///
8032            /// Applications can examine the value using [TimeSeriesResourceHierarchyLevel::value] or
8033            /// [TimeSeriesResourceHierarchyLevel::name].
8034            UnknownValue(time_series_resource_hierarchy_level::UnknownValue),
8035        }
8036
8037        #[doc(hidden)]
8038        pub mod time_series_resource_hierarchy_level {
8039            #[allow(unused_imports)]
8040            use super::*;
8041            #[derive(Clone, Debug, PartialEq)]
8042            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8043        }
8044
8045        impl TimeSeriesResourceHierarchyLevel {
8046            /// Gets the enum value.
8047            ///
8048            /// Returns `None` if the enum contains an unknown value deserialized from
8049            /// the string representation of enums.
8050            pub fn value(&self) -> std::option::Option<i32> {
8051                match self {
8052                    Self::Unspecified => std::option::Option::Some(0),
8053                    Self::Project => std::option::Option::Some(1),
8054                    Self::Organization => std::option::Option::Some(2),
8055                    Self::Folder => std::option::Option::Some(3),
8056                    Self::UnknownValue(u) => u.0.value(),
8057                }
8058            }
8059
8060            /// Gets the enum value as a string.
8061            ///
8062            /// Returns `None` if the enum contains an unknown value deserialized from
8063            /// the integer representation of enums.
8064            pub fn name(&self) -> std::option::Option<&str> {
8065                match self {
8066                    Self::Unspecified => std::option::Option::Some(
8067                        "TIME_SERIES_RESOURCE_HIERARCHY_LEVEL_UNSPECIFIED",
8068                    ),
8069                    Self::Project => std::option::Option::Some("PROJECT"),
8070                    Self::Organization => std::option::Option::Some("ORGANIZATION"),
8071                    Self::Folder => std::option::Option::Some("FOLDER"),
8072                    Self::UnknownValue(u) => u.0.name(),
8073                }
8074            }
8075        }
8076
8077        impl std::default::Default for TimeSeriesResourceHierarchyLevel {
8078            fn default() -> Self {
8079                use std::convert::From;
8080                Self::from(0)
8081            }
8082        }
8083
8084        impl std::fmt::Display for TimeSeriesResourceHierarchyLevel {
8085            fn fmt(
8086                &self,
8087                f: &mut std::fmt::Formatter<'_>,
8088            ) -> std::result::Result<(), std::fmt::Error> {
8089                wkt::internal::display_enum(f, self.name(), self.value())
8090            }
8091        }
8092
8093        impl std::convert::From<i32> for TimeSeriesResourceHierarchyLevel {
8094            fn from(value: i32) -> Self {
8095                match value {
8096                    0 => Self::Unspecified,
8097                    1 => Self::Project,
8098                    2 => Self::Organization,
8099                    3 => Self::Folder,
8100                    _ => Self::UnknownValue(time_series_resource_hierarchy_level::UnknownValue(
8101                        wkt::internal::UnknownEnumValue::Integer(value),
8102                    )),
8103                }
8104            }
8105        }
8106
8107        impl std::convert::From<&str> for TimeSeriesResourceHierarchyLevel {
8108            fn from(value: &str) -> Self {
8109                use std::string::ToString;
8110                match value {
8111                    "TIME_SERIES_RESOURCE_HIERARCHY_LEVEL_UNSPECIFIED" => Self::Unspecified,
8112                    "PROJECT" => Self::Project,
8113                    "ORGANIZATION" => Self::Organization,
8114                    "FOLDER" => Self::Folder,
8115                    _ => Self::UnknownValue(time_series_resource_hierarchy_level::UnknownValue(
8116                        wkt::internal::UnknownEnumValue::String(value.to_string()),
8117                    )),
8118                }
8119            }
8120        }
8121
8122        impl serde::ser::Serialize for TimeSeriesResourceHierarchyLevel {
8123            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8124            where
8125                S: serde::Serializer,
8126            {
8127                match self {
8128                    Self::Unspecified => serializer.serialize_i32(0),
8129                    Self::Project => serializer.serialize_i32(1),
8130                    Self::Organization => serializer.serialize_i32(2),
8131                    Self::Folder => serializer.serialize_i32(3),
8132                    Self::UnknownValue(u) => u.0.serialize(serializer),
8133                }
8134            }
8135        }
8136
8137        impl<'de> serde::de::Deserialize<'de> for TimeSeriesResourceHierarchyLevel {
8138            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8139            where
8140                D: serde::Deserializer<'de>,
8141            {
8142                deserializer.deserialize_any(wkt::internal::EnumVisitor::<TimeSeriesResourceHierarchyLevel>::new(
8143                    ".google.api.MetricDescriptor.MetricDescriptorMetadata.TimeSeriesResourceHierarchyLevel"))
8144            }
8145        }
8146    }
8147
8148    /// The kind of measurement. It describes how the data is reported.
8149    /// For information on setting the start time and end time based on
8150    /// the MetricKind, see [TimeInterval][google.monitoring.v3.TimeInterval].
8151    ///
8152    /// # Working with unknown values
8153    ///
8154    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8155    /// additional enum variants at any time. Adding new variants is not considered
8156    /// a breaking change. Applications should write their code in anticipation of:
8157    ///
8158    /// - New values appearing in future releases of the client library, **and**
8159    /// - New values received dynamically, without application changes.
8160    ///
8161    /// Please consult the [Working with enums] section in the user guide for some
8162    /// guidelines.
8163    ///
8164    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8165    #[derive(Clone, Debug, PartialEq)]
8166    #[non_exhaustive]
8167    pub enum MetricKind {
8168        /// Do not use this default value.
8169        Unspecified,
8170        /// An instantaneous measurement of a value.
8171        Gauge,
8172        /// The change in a value during a time interval.
8173        Delta,
8174        /// A value accumulated over a time interval.  Cumulative
8175        /// measurements in a time series should have the same start time
8176        /// and increasing end times, until an event resets the cumulative
8177        /// value to zero and sets a new start time for the following
8178        /// points.
8179        Cumulative,
8180        /// If set, the enum was initialized with an unknown value.
8181        ///
8182        /// Applications can examine the value using [MetricKind::value] or
8183        /// [MetricKind::name].
8184        UnknownValue(metric_kind::UnknownValue),
8185    }
8186
8187    #[doc(hidden)]
8188    pub mod metric_kind {
8189        #[allow(unused_imports)]
8190        use super::*;
8191        #[derive(Clone, Debug, PartialEq)]
8192        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8193    }
8194
8195    impl MetricKind {
8196        /// Gets the enum value.
8197        ///
8198        /// Returns `None` if the enum contains an unknown value deserialized from
8199        /// the string representation of enums.
8200        pub fn value(&self) -> std::option::Option<i32> {
8201            match self {
8202                Self::Unspecified => std::option::Option::Some(0),
8203                Self::Gauge => std::option::Option::Some(1),
8204                Self::Delta => std::option::Option::Some(2),
8205                Self::Cumulative => std::option::Option::Some(3),
8206                Self::UnknownValue(u) => u.0.value(),
8207            }
8208        }
8209
8210        /// Gets the enum value as a string.
8211        ///
8212        /// Returns `None` if the enum contains an unknown value deserialized from
8213        /// the integer representation of enums.
8214        pub fn name(&self) -> std::option::Option<&str> {
8215            match self {
8216                Self::Unspecified => std::option::Option::Some("METRIC_KIND_UNSPECIFIED"),
8217                Self::Gauge => std::option::Option::Some("GAUGE"),
8218                Self::Delta => std::option::Option::Some("DELTA"),
8219                Self::Cumulative => std::option::Option::Some("CUMULATIVE"),
8220                Self::UnknownValue(u) => u.0.name(),
8221            }
8222        }
8223    }
8224
8225    impl std::default::Default for MetricKind {
8226        fn default() -> Self {
8227            use std::convert::From;
8228            Self::from(0)
8229        }
8230    }
8231
8232    impl std::fmt::Display for MetricKind {
8233        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8234            wkt::internal::display_enum(f, self.name(), self.value())
8235        }
8236    }
8237
8238    impl std::convert::From<i32> for MetricKind {
8239        fn from(value: i32) -> Self {
8240            match value {
8241                0 => Self::Unspecified,
8242                1 => Self::Gauge,
8243                2 => Self::Delta,
8244                3 => Self::Cumulative,
8245                _ => Self::UnknownValue(metric_kind::UnknownValue(
8246                    wkt::internal::UnknownEnumValue::Integer(value),
8247                )),
8248            }
8249        }
8250    }
8251
8252    impl std::convert::From<&str> for MetricKind {
8253        fn from(value: &str) -> Self {
8254            use std::string::ToString;
8255            match value {
8256                "METRIC_KIND_UNSPECIFIED" => Self::Unspecified,
8257                "GAUGE" => Self::Gauge,
8258                "DELTA" => Self::Delta,
8259                "CUMULATIVE" => Self::Cumulative,
8260                _ => Self::UnknownValue(metric_kind::UnknownValue(
8261                    wkt::internal::UnknownEnumValue::String(value.to_string()),
8262                )),
8263            }
8264        }
8265    }
8266
8267    impl serde::ser::Serialize for MetricKind {
8268        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8269        where
8270            S: serde::Serializer,
8271        {
8272            match self {
8273                Self::Unspecified => serializer.serialize_i32(0),
8274                Self::Gauge => serializer.serialize_i32(1),
8275                Self::Delta => serializer.serialize_i32(2),
8276                Self::Cumulative => serializer.serialize_i32(3),
8277                Self::UnknownValue(u) => u.0.serialize(serializer),
8278            }
8279        }
8280    }
8281
8282    impl<'de> serde::de::Deserialize<'de> for MetricKind {
8283        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8284        where
8285            D: serde::Deserializer<'de>,
8286        {
8287            deserializer.deserialize_any(wkt::internal::EnumVisitor::<MetricKind>::new(
8288                ".google.api.MetricDescriptor.MetricKind",
8289            ))
8290        }
8291    }
8292
8293    /// The value type of a metric.
8294    ///
8295    /// # Working with unknown values
8296    ///
8297    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8298    /// additional enum variants at any time. Adding new variants is not considered
8299    /// a breaking change. Applications should write their code in anticipation of:
8300    ///
8301    /// - New values appearing in future releases of the client library, **and**
8302    /// - New values received dynamically, without application changes.
8303    ///
8304    /// Please consult the [Working with enums] section in the user guide for some
8305    /// guidelines.
8306    ///
8307    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8308    #[derive(Clone, Debug, PartialEq)]
8309    #[non_exhaustive]
8310    pub enum ValueType {
8311        /// Do not use this default value.
8312        Unspecified,
8313        /// The value is a boolean.
8314        /// This value type can be used only if the metric kind is `GAUGE`.
8315        Bool,
8316        /// The value is a signed 64-bit integer.
8317        Int64,
8318        /// The value is a double precision floating point number.
8319        Double,
8320        /// The value is a text string.
8321        /// This value type can be used only if the metric kind is `GAUGE`.
8322        String,
8323        /// The value is a [`Distribution`][google.api.Distribution].
8324        ///
8325        /// [google.api.Distribution]: crate::model::Distribution
8326        Distribution,
8327        /// The value is money.
8328        Money,
8329        /// If set, the enum was initialized with an unknown value.
8330        ///
8331        /// Applications can examine the value using [ValueType::value] or
8332        /// [ValueType::name].
8333        UnknownValue(value_type::UnknownValue),
8334    }
8335
8336    #[doc(hidden)]
8337    pub mod value_type {
8338        #[allow(unused_imports)]
8339        use super::*;
8340        #[derive(Clone, Debug, PartialEq)]
8341        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8342    }
8343
8344    impl ValueType {
8345        /// Gets the enum value.
8346        ///
8347        /// Returns `None` if the enum contains an unknown value deserialized from
8348        /// the string representation of enums.
8349        pub fn value(&self) -> std::option::Option<i32> {
8350            match self {
8351                Self::Unspecified => std::option::Option::Some(0),
8352                Self::Bool => std::option::Option::Some(1),
8353                Self::Int64 => std::option::Option::Some(2),
8354                Self::Double => std::option::Option::Some(3),
8355                Self::String => std::option::Option::Some(4),
8356                Self::Distribution => std::option::Option::Some(5),
8357                Self::Money => std::option::Option::Some(6),
8358                Self::UnknownValue(u) => u.0.value(),
8359            }
8360        }
8361
8362        /// Gets the enum value as a string.
8363        ///
8364        /// Returns `None` if the enum contains an unknown value deserialized from
8365        /// the integer representation of enums.
8366        pub fn name(&self) -> std::option::Option<&str> {
8367            match self {
8368                Self::Unspecified => std::option::Option::Some("VALUE_TYPE_UNSPECIFIED"),
8369                Self::Bool => std::option::Option::Some("BOOL"),
8370                Self::Int64 => std::option::Option::Some("INT64"),
8371                Self::Double => std::option::Option::Some("DOUBLE"),
8372                Self::String => std::option::Option::Some("STRING"),
8373                Self::Distribution => std::option::Option::Some("DISTRIBUTION"),
8374                Self::Money => std::option::Option::Some("MONEY"),
8375                Self::UnknownValue(u) => u.0.name(),
8376            }
8377        }
8378    }
8379
8380    impl std::default::Default for ValueType {
8381        fn default() -> Self {
8382            use std::convert::From;
8383            Self::from(0)
8384        }
8385    }
8386
8387    impl std::fmt::Display for ValueType {
8388        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8389            wkt::internal::display_enum(f, self.name(), self.value())
8390        }
8391    }
8392
8393    impl std::convert::From<i32> for ValueType {
8394        fn from(value: i32) -> Self {
8395            match value {
8396                0 => Self::Unspecified,
8397                1 => Self::Bool,
8398                2 => Self::Int64,
8399                3 => Self::Double,
8400                4 => Self::String,
8401                5 => Self::Distribution,
8402                6 => Self::Money,
8403                _ => Self::UnknownValue(value_type::UnknownValue(
8404                    wkt::internal::UnknownEnumValue::Integer(value),
8405                )),
8406            }
8407        }
8408    }
8409
8410    impl std::convert::From<&str> for ValueType {
8411        fn from(value: &str) -> Self {
8412            use std::string::ToString;
8413            match value {
8414                "VALUE_TYPE_UNSPECIFIED" => Self::Unspecified,
8415                "BOOL" => Self::Bool,
8416                "INT64" => Self::Int64,
8417                "DOUBLE" => Self::Double,
8418                "STRING" => Self::String,
8419                "DISTRIBUTION" => Self::Distribution,
8420                "MONEY" => Self::Money,
8421                _ => Self::UnknownValue(value_type::UnknownValue(
8422                    wkt::internal::UnknownEnumValue::String(value.to_string()),
8423                )),
8424            }
8425        }
8426    }
8427
8428    impl serde::ser::Serialize for ValueType {
8429        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8430        where
8431            S: serde::Serializer,
8432        {
8433            match self {
8434                Self::Unspecified => serializer.serialize_i32(0),
8435                Self::Bool => serializer.serialize_i32(1),
8436                Self::Int64 => serializer.serialize_i32(2),
8437                Self::Double => serializer.serialize_i32(3),
8438                Self::String => serializer.serialize_i32(4),
8439                Self::Distribution => serializer.serialize_i32(5),
8440                Self::Money => serializer.serialize_i32(6),
8441                Self::UnknownValue(u) => u.0.serialize(serializer),
8442            }
8443        }
8444    }
8445
8446    impl<'de> serde::de::Deserialize<'de> for ValueType {
8447        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8448        where
8449            D: serde::Deserializer<'de>,
8450        {
8451            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ValueType>::new(
8452                ".google.api.MetricDescriptor.ValueType",
8453            ))
8454        }
8455    }
8456}
8457
8458/// A specific metric, identified by specifying values for all of the
8459/// labels of a [`MetricDescriptor`][google.api.MetricDescriptor].
8460///
8461/// [google.api.MetricDescriptor]: crate::model::MetricDescriptor
8462#[derive(Clone, Default, PartialEq)]
8463#[non_exhaustive]
8464pub struct Metric {
8465    /// An existing metric type, see
8466    /// [google.api.MetricDescriptor][google.api.MetricDescriptor]. For example,
8467    /// `custom.googleapis.com/invoice/paid/amount`.
8468    ///
8469    /// [google.api.MetricDescriptor]: crate::model::MetricDescriptor
8470    pub r#type: std::string::String,
8471
8472    /// The set of label values that uniquely identify this metric. All
8473    /// labels listed in the `MetricDescriptor` must be assigned values.
8474    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
8475
8476    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8477}
8478
8479impl Metric {
8480    /// Creates a new default instance.
8481    pub fn new() -> Self {
8482        std::default::Default::default()
8483    }
8484
8485    /// Sets the value of [r#type][crate::model::Metric::type].
8486    ///
8487    /// # Example
8488    /// ```ignore,no_run
8489    /// # use google_cloud_api::model::Metric;
8490    /// let x = Metric::new().set_type("example");
8491    /// ```
8492    pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8493        self.r#type = v.into();
8494        self
8495    }
8496
8497    /// Sets the value of [labels][crate::model::Metric::labels].
8498    ///
8499    /// # Example
8500    /// ```ignore,no_run
8501    /// # use google_cloud_api::model::Metric;
8502    /// let x = Metric::new().set_labels([
8503    ///     ("key0", "abc"),
8504    ///     ("key1", "xyz"),
8505    /// ]);
8506    /// ```
8507    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
8508    where
8509        T: std::iter::IntoIterator<Item = (K, V)>,
8510        K: std::convert::Into<std::string::String>,
8511        V: std::convert::Into<std::string::String>,
8512    {
8513        use std::iter::Iterator;
8514        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8515        self
8516    }
8517}
8518
8519impl wkt::message::Message for Metric {
8520    fn typename() -> &'static str {
8521        "type.googleapis.com/google.api.Metric"
8522    }
8523}
8524
8525/// An object that describes the schema of a
8526/// [MonitoredResource][google.api.MonitoredResource] object using a type name
8527/// and a set of labels.  For example, the monitored resource descriptor for
8528/// Google Compute Engine VM instances has a type of
8529/// `"gce_instance"` and specifies the use of the labels `"instance_id"` and
8530/// `"zone"` to identify particular VM instances.
8531///
8532/// Different APIs can support different monitored resource types. APIs generally
8533/// provide a `list` method that returns the monitored resource descriptors used
8534/// by the API.
8535///
8536/// [google.api.MonitoredResource]: crate::model::MonitoredResource
8537#[derive(Clone, Default, PartialEq)]
8538#[non_exhaustive]
8539pub struct MonitoredResourceDescriptor {
8540    /// Optional. The resource name of the monitored resource descriptor:
8541    /// `"projects/{project_id}/monitoredResourceDescriptors/{type}"` where
8542    /// {type} is the value of the `type` field in this object and
8543    /// {project_id} is a project ID that provides API-specific context for
8544    /// accessing the type.  APIs that do not use project information can use the
8545    /// resource name format `"monitoredResourceDescriptors/{type}"`.
8546    pub name: std::string::String,
8547
8548    /// Required. The monitored resource type. For example, the type
8549    /// `"cloudsql_database"` represents databases in Google Cloud SQL.
8550    /// For a list of types, see [Monitored resource
8551    /// types](https://cloud.google.com/monitoring/api/resources)
8552    /// and [Logging resource
8553    /// types](https://cloud.google.com/logging/docs/api/v2/resource-list).
8554    pub r#type: std::string::String,
8555
8556    /// Optional. A concise name for the monitored resource type that might be
8557    /// displayed in user interfaces. It should be a Title Cased Noun Phrase,
8558    /// without any article or other determiners. For example,
8559    /// `"Google Cloud SQL Database"`.
8560    pub display_name: std::string::String,
8561
8562    /// Optional. A detailed description of the monitored resource type that might
8563    /// be used in documentation.
8564    pub description: std::string::String,
8565
8566    /// Required. A set of labels used to describe instances of this monitored
8567    /// resource type. For example, an individual Google Cloud SQL database is
8568    /// identified by values for the labels `"database_id"` and `"zone"`.
8569    pub labels: std::vec::Vec<crate::model::LabelDescriptor>,
8570
8571    /// Optional. The launch stage of the monitored resource definition.
8572    pub launch_stage: crate::model::LaunchStage,
8573
8574    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8575}
8576
8577impl MonitoredResourceDescriptor {
8578    /// Creates a new default instance.
8579    pub fn new() -> Self {
8580        std::default::Default::default()
8581    }
8582
8583    /// Sets the value of [name][crate::model::MonitoredResourceDescriptor::name].
8584    ///
8585    /// # Example
8586    /// ```ignore,no_run
8587    /// # use google_cloud_api::model::MonitoredResourceDescriptor;
8588    /// let x = MonitoredResourceDescriptor::new().set_name("example");
8589    /// ```
8590    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8591        self.name = v.into();
8592        self
8593    }
8594
8595    /// Sets the value of [r#type][crate::model::MonitoredResourceDescriptor::type].
8596    ///
8597    /// # Example
8598    /// ```ignore,no_run
8599    /// # use google_cloud_api::model::MonitoredResourceDescriptor;
8600    /// let x = MonitoredResourceDescriptor::new().set_type("example");
8601    /// ```
8602    pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8603        self.r#type = v.into();
8604        self
8605    }
8606
8607    /// Sets the value of [display_name][crate::model::MonitoredResourceDescriptor::display_name].
8608    ///
8609    /// # Example
8610    /// ```ignore,no_run
8611    /// # use google_cloud_api::model::MonitoredResourceDescriptor;
8612    /// let x = MonitoredResourceDescriptor::new().set_display_name("example");
8613    /// ```
8614    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8615        self.display_name = v.into();
8616        self
8617    }
8618
8619    /// Sets the value of [description][crate::model::MonitoredResourceDescriptor::description].
8620    ///
8621    /// # Example
8622    /// ```ignore,no_run
8623    /// # use google_cloud_api::model::MonitoredResourceDescriptor;
8624    /// let x = MonitoredResourceDescriptor::new().set_description("example");
8625    /// ```
8626    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8627        self.description = v.into();
8628        self
8629    }
8630
8631    /// Sets the value of [labels][crate::model::MonitoredResourceDescriptor::labels].
8632    ///
8633    /// # Example
8634    /// ```ignore,no_run
8635    /// # use google_cloud_api::model::MonitoredResourceDescriptor;
8636    /// use google_cloud_api::model::LabelDescriptor;
8637    /// let x = MonitoredResourceDescriptor::new()
8638    ///     .set_labels([
8639    ///         LabelDescriptor::default()/* use setters */,
8640    ///         LabelDescriptor::default()/* use (different) setters */,
8641    ///     ]);
8642    /// ```
8643    pub fn set_labels<T, V>(mut self, v: T) -> Self
8644    where
8645        T: std::iter::IntoIterator<Item = V>,
8646        V: std::convert::Into<crate::model::LabelDescriptor>,
8647    {
8648        use std::iter::Iterator;
8649        self.labels = v.into_iter().map(|i| i.into()).collect();
8650        self
8651    }
8652
8653    /// Sets the value of [launch_stage][crate::model::MonitoredResourceDescriptor::launch_stage].
8654    ///
8655    /// # Example
8656    /// ```ignore,no_run
8657    /// # use google_cloud_api::model::MonitoredResourceDescriptor;
8658    /// use google_cloud_api::model::LaunchStage;
8659    /// let x0 = MonitoredResourceDescriptor::new().set_launch_stage(LaunchStage::Unimplemented);
8660    /// let x1 = MonitoredResourceDescriptor::new().set_launch_stage(LaunchStage::Prelaunch);
8661    /// let x2 = MonitoredResourceDescriptor::new().set_launch_stage(LaunchStage::EarlyAccess);
8662    /// ```
8663    pub fn set_launch_stage<T: std::convert::Into<crate::model::LaunchStage>>(
8664        mut self,
8665        v: T,
8666    ) -> Self {
8667        self.launch_stage = v.into();
8668        self
8669    }
8670}
8671
8672impl wkt::message::Message for MonitoredResourceDescriptor {
8673    fn typename() -> &'static str {
8674        "type.googleapis.com/google.api.MonitoredResourceDescriptor"
8675    }
8676}
8677
8678/// An object representing a resource that can be used for monitoring, logging,
8679/// billing, or other purposes. Examples include virtual machine instances,
8680/// databases, and storage devices such as disks. The `type` field identifies a
8681/// [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] object
8682/// that describes the resource's schema. Information in the `labels` field
8683/// identifies the actual resource and its attributes according to the schema.
8684/// For example, a particular Compute Engine VM instance could be represented by
8685/// the following object, because the
8686/// [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] for
8687/// `"gce_instance"` has labels
8688/// `"project_id"`, `"instance_id"` and `"zone"`:
8689///
8690/// ```norust
8691/// { "type": "gce_instance",
8692///   "labels": { "project_id": "my-project",
8693///               "instance_id": "12345678901234",
8694///               "zone": "us-central1-a" }}
8695/// ```
8696///
8697/// [google.api.MonitoredResourceDescriptor]: crate::model::MonitoredResourceDescriptor
8698#[derive(Clone, Default, PartialEq)]
8699#[non_exhaustive]
8700pub struct MonitoredResource {
8701    /// Required. The monitored resource type. This field must match
8702    /// the `type` field of a
8703    /// [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor]
8704    /// object. For example, the type of a Compute Engine VM instance is
8705    /// `gce_instance`. Some descriptors include the service name in the type; for
8706    /// example, the type of a Datastream stream is
8707    /// `datastream.googleapis.com/Stream`.
8708    ///
8709    /// [google.api.MonitoredResourceDescriptor]: crate::model::MonitoredResourceDescriptor
8710    pub r#type: std::string::String,
8711
8712    /// Required. Values for all of the labels listed in the associated monitored
8713    /// resource descriptor. For example, Compute Engine VM instances use the
8714    /// labels `"project_id"`, `"instance_id"`, and `"zone"`.
8715    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
8716
8717    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8718}
8719
8720impl MonitoredResource {
8721    /// Creates a new default instance.
8722    pub fn new() -> Self {
8723        std::default::Default::default()
8724    }
8725
8726    /// Sets the value of [r#type][crate::model::MonitoredResource::type].
8727    ///
8728    /// # Example
8729    /// ```ignore,no_run
8730    /// # use google_cloud_api::model::MonitoredResource;
8731    /// let x = MonitoredResource::new().set_type("example");
8732    /// ```
8733    pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8734        self.r#type = v.into();
8735        self
8736    }
8737
8738    /// Sets the value of [labels][crate::model::MonitoredResource::labels].
8739    ///
8740    /// # Example
8741    /// ```ignore,no_run
8742    /// # use google_cloud_api::model::MonitoredResource;
8743    /// let x = MonitoredResource::new().set_labels([
8744    ///     ("key0", "abc"),
8745    ///     ("key1", "xyz"),
8746    /// ]);
8747    /// ```
8748    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
8749    where
8750        T: std::iter::IntoIterator<Item = (K, V)>,
8751        K: std::convert::Into<std::string::String>,
8752        V: std::convert::Into<std::string::String>,
8753    {
8754        use std::iter::Iterator;
8755        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8756        self
8757    }
8758}
8759
8760impl wkt::message::Message for MonitoredResource {
8761    fn typename() -> &'static str {
8762        "type.googleapis.com/google.api.MonitoredResource"
8763    }
8764}
8765
8766/// Auxiliary metadata for a [MonitoredResource][google.api.MonitoredResource]
8767/// object. [MonitoredResource][google.api.MonitoredResource] objects contain the
8768/// minimum set of information to uniquely identify a monitored resource
8769/// instance. There is some other useful auxiliary metadata. Monitoring and
8770/// Logging use an ingestion pipeline to extract metadata for cloud resources of
8771/// all types, and store the metadata in this message.
8772///
8773/// [google.api.MonitoredResource]: crate::model::MonitoredResource
8774#[derive(Clone, Default, PartialEq)]
8775#[non_exhaustive]
8776pub struct MonitoredResourceMetadata {
8777    /// Output only. Values for predefined system metadata labels.
8778    /// System labels are a kind of metadata extracted by Google, including
8779    /// "machine_image", "vpc", "subnet_id",
8780    /// "security_group", "name", etc.
8781    /// System label values can be only strings, Boolean values, or a list of
8782    /// strings. For example:
8783    ///
8784    /// ```norust
8785    /// { "name": "my-test-instance",
8786    ///   "security_group": ["a", "b", "c"],
8787    ///   "spot_instance": false }
8788    /// ```
8789    pub system_labels: std::option::Option<wkt::Struct>,
8790
8791    /// Output only. A map of user-defined metadata labels.
8792    pub user_labels: std::collections::HashMap<std::string::String, std::string::String>,
8793
8794    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8795}
8796
8797impl MonitoredResourceMetadata {
8798    /// Creates a new default instance.
8799    pub fn new() -> Self {
8800        std::default::Default::default()
8801    }
8802
8803    /// Sets the value of [system_labels][crate::model::MonitoredResourceMetadata::system_labels].
8804    ///
8805    /// # Example
8806    /// ```ignore,no_run
8807    /// # use google_cloud_api::model::MonitoredResourceMetadata;
8808    /// use wkt::Struct;
8809    /// let x = MonitoredResourceMetadata::new().set_system_labels(Struct::default()/* use setters */);
8810    /// ```
8811    pub fn set_system_labels<T>(mut self, v: T) -> Self
8812    where
8813        T: std::convert::Into<wkt::Struct>,
8814    {
8815        self.system_labels = std::option::Option::Some(v.into());
8816        self
8817    }
8818
8819    /// Sets or clears the value of [system_labels][crate::model::MonitoredResourceMetadata::system_labels].
8820    ///
8821    /// # Example
8822    /// ```ignore,no_run
8823    /// # use google_cloud_api::model::MonitoredResourceMetadata;
8824    /// use wkt::Struct;
8825    /// let x = MonitoredResourceMetadata::new().set_or_clear_system_labels(Some(Struct::default()/* use setters */));
8826    /// let x = MonitoredResourceMetadata::new().set_or_clear_system_labels(None::<Struct>);
8827    /// ```
8828    pub fn set_or_clear_system_labels<T>(mut self, v: std::option::Option<T>) -> Self
8829    where
8830        T: std::convert::Into<wkt::Struct>,
8831    {
8832        self.system_labels = v.map(|x| x.into());
8833        self
8834    }
8835
8836    /// Sets the value of [user_labels][crate::model::MonitoredResourceMetadata::user_labels].
8837    ///
8838    /// # Example
8839    /// ```ignore,no_run
8840    /// # use google_cloud_api::model::MonitoredResourceMetadata;
8841    /// let x = MonitoredResourceMetadata::new().set_user_labels([
8842    ///     ("key0", "abc"),
8843    ///     ("key1", "xyz"),
8844    /// ]);
8845    /// ```
8846    pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
8847    where
8848        T: std::iter::IntoIterator<Item = (K, V)>,
8849        K: std::convert::Into<std::string::String>,
8850        V: std::convert::Into<std::string::String>,
8851    {
8852        use std::iter::Iterator;
8853        self.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8854        self
8855    }
8856}
8857
8858impl wkt::message::Message for MonitoredResourceMetadata {
8859    fn typename() -> &'static str {
8860        "type.googleapis.com/google.api.MonitoredResourceMetadata"
8861    }
8862}
8863
8864/// Monitoring configuration of the service.
8865///
8866/// The example below shows how to configure monitored resources and metrics
8867/// for monitoring. In the example, a monitored resource and two metrics are
8868/// defined. The `library.googleapis.com/book/returned_count` metric is sent
8869/// to both producer and consumer projects, whereas the
8870/// `library.googleapis.com/book/num_overdue` metric is only sent to the
8871/// consumer project.
8872///
8873/// ```norust
8874/// monitored_resources:
8875/// - type: library.googleapis.com/Branch
8876///   display_name: "Library Branch"
8877///   description: "A branch of a library."
8878///   launch_stage: GA
8879///   labels:
8880///   - key: resource_container
8881///     description: "The Cloud container (ie. project id) for the Branch."
8882///   - key: location
8883///     description: "The location of the library branch."
8884///   - key: branch_id
8885///     description: "The id of the branch."
8886/// metrics:
8887/// - name: library.googleapis.com/book/returned_count
8888///   display_name: "Books Returned"
8889///   description: "The count of books that have been returned."
8890///   launch_stage: GA
8891///   metric_kind: DELTA
8892///   value_type: INT64
8893///   unit: "1"
8894///   labels:
8895///   - key: customer_id
8896///     description: "The id of the customer."
8897/// - name: library.googleapis.com/book/num_overdue
8898///   display_name: "Books Overdue"
8899///   description: "The current number of overdue books."
8900///   launch_stage: GA
8901///   metric_kind: GAUGE
8902///   value_type: INT64
8903///   unit: "1"
8904///   labels:
8905///   - key: customer_id
8906///     description: "The id of the customer."
8907/// monitoring:
8908///   producer_destinations:
8909///   - monitored_resource: library.googleapis.com/Branch
8910///     metrics:
8911///     - library.googleapis.com/book/returned_count
8912///   consumer_destinations:
8913///   - monitored_resource: library.googleapis.com/Branch
8914///     metrics:
8915///     - library.googleapis.com/book/returned_count
8916///     - library.googleapis.com/book/num_overdue
8917/// ```
8918#[derive(Clone, Default, PartialEq)]
8919#[non_exhaustive]
8920pub struct Monitoring {
8921    /// Monitoring configurations for sending metrics to the producer project.
8922    /// There can be multiple producer destinations. A monitored resource type may
8923    /// appear in multiple monitoring destinations if different aggregations are
8924    /// needed for different sets of metrics associated with that monitored
8925    /// resource type. A monitored resource and metric pair may only be used once
8926    /// in the Monitoring configuration.
8927    pub producer_destinations: std::vec::Vec<crate::model::monitoring::MonitoringDestination>,
8928
8929    /// Monitoring configurations for sending metrics to the consumer project.
8930    /// There can be multiple consumer destinations. A monitored resource type may
8931    /// appear in multiple monitoring destinations if different aggregations are
8932    /// needed for different sets of metrics associated with that monitored
8933    /// resource type. A monitored resource and metric pair may only be used once
8934    /// in the Monitoring configuration.
8935    pub consumer_destinations: std::vec::Vec<crate::model::monitoring::MonitoringDestination>,
8936
8937    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8938}
8939
8940impl Monitoring {
8941    /// Creates a new default instance.
8942    pub fn new() -> Self {
8943        std::default::Default::default()
8944    }
8945
8946    /// Sets the value of [producer_destinations][crate::model::Monitoring::producer_destinations].
8947    ///
8948    /// # Example
8949    /// ```ignore,no_run
8950    /// # use google_cloud_api::model::Monitoring;
8951    /// use google_cloud_api::model::monitoring::MonitoringDestination;
8952    /// let x = Monitoring::new()
8953    ///     .set_producer_destinations([
8954    ///         MonitoringDestination::default()/* use setters */,
8955    ///         MonitoringDestination::default()/* use (different) setters */,
8956    ///     ]);
8957    /// ```
8958    pub fn set_producer_destinations<T, V>(mut self, v: T) -> Self
8959    where
8960        T: std::iter::IntoIterator<Item = V>,
8961        V: std::convert::Into<crate::model::monitoring::MonitoringDestination>,
8962    {
8963        use std::iter::Iterator;
8964        self.producer_destinations = v.into_iter().map(|i| i.into()).collect();
8965        self
8966    }
8967
8968    /// Sets the value of [consumer_destinations][crate::model::Monitoring::consumer_destinations].
8969    ///
8970    /// # Example
8971    /// ```ignore,no_run
8972    /// # use google_cloud_api::model::Monitoring;
8973    /// use google_cloud_api::model::monitoring::MonitoringDestination;
8974    /// let x = Monitoring::new()
8975    ///     .set_consumer_destinations([
8976    ///         MonitoringDestination::default()/* use setters */,
8977    ///         MonitoringDestination::default()/* use (different) setters */,
8978    ///     ]);
8979    /// ```
8980    pub fn set_consumer_destinations<T, V>(mut self, v: T) -> Self
8981    where
8982        T: std::iter::IntoIterator<Item = V>,
8983        V: std::convert::Into<crate::model::monitoring::MonitoringDestination>,
8984    {
8985        use std::iter::Iterator;
8986        self.consumer_destinations = v.into_iter().map(|i| i.into()).collect();
8987        self
8988    }
8989}
8990
8991impl wkt::message::Message for Monitoring {
8992    fn typename() -> &'static str {
8993        "type.googleapis.com/google.api.Monitoring"
8994    }
8995}
8996
8997/// Defines additional types related to [Monitoring].
8998pub mod monitoring {
8999    #[allow(unused_imports)]
9000    use super::*;
9001
9002    /// Configuration of a specific monitoring destination (the producer project
9003    /// or the consumer project).
9004    #[derive(Clone, Default, PartialEq)]
9005    #[non_exhaustive]
9006    pub struct MonitoringDestination {
9007        /// The monitored resource type. The type must be defined in
9008        /// [Service.monitored_resources][google.api.Service.monitored_resources]
9009        /// section.
9010        ///
9011        /// [google.api.Service.monitored_resources]: crate::model::Service::monitored_resources
9012        pub monitored_resource: std::string::String,
9013
9014        /// Types of the metrics to report to this monitoring destination.
9015        /// Each type must be defined in
9016        /// [Service.metrics][google.api.Service.metrics] section.
9017        ///
9018        /// [google.api.Service.metrics]: crate::model::Service::metrics
9019        pub metrics: std::vec::Vec<std::string::String>,
9020
9021        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9022    }
9023
9024    impl MonitoringDestination {
9025        /// Creates a new default instance.
9026        pub fn new() -> Self {
9027            std::default::Default::default()
9028        }
9029
9030        /// Sets the value of [monitored_resource][crate::model::monitoring::MonitoringDestination::monitored_resource].
9031        ///
9032        /// # Example
9033        /// ```ignore,no_run
9034        /// # use google_cloud_api::model::monitoring::MonitoringDestination;
9035        /// let x = MonitoringDestination::new().set_monitored_resource("example");
9036        /// ```
9037        pub fn set_monitored_resource<T: std::convert::Into<std::string::String>>(
9038            mut self,
9039            v: T,
9040        ) -> Self {
9041            self.monitored_resource = v.into();
9042            self
9043        }
9044
9045        /// Sets the value of [metrics][crate::model::monitoring::MonitoringDestination::metrics].
9046        ///
9047        /// # Example
9048        /// ```ignore,no_run
9049        /// # use google_cloud_api::model::monitoring::MonitoringDestination;
9050        /// let x = MonitoringDestination::new().set_metrics(["a", "b", "c"]);
9051        /// ```
9052        pub fn set_metrics<T, V>(mut self, v: T) -> Self
9053        where
9054            T: std::iter::IntoIterator<Item = V>,
9055            V: std::convert::Into<std::string::String>,
9056        {
9057            use std::iter::Iterator;
9058            self.metrics = v.into_iter().map(|i| i.into()).collect();
9059            self
9060        }
9061    }
9062
9063    impl wkt::message::Message for MonitoringDestination {
9064        fn typename() -> &'static str {
9065            "type.googleapis.com/google.api.Monitoring.MonitoringDestination"
9066        }
9067    }
9068}
9069
9070/// Google API Policy Annotation
9071///
9072/// This message defines a simple API policy annotation that can be used to
9073/// annotate API request and response message fields with applicable policies.
9074/// One field may have multiple applicable policies that must all be satisfied
9075/// before a request can be processed. This policy annotation is used to
9076/// generate the overall policy that will be used for automatic runtime
9077/// policy enforcement and documentation generation.
9078#[derive(Clone, Default, PartialEq)]
9079#[non_exhaustive]
9080pub struct FieldPolicy {
9081    /// Selects one or more request or response message fields to apply this
9082    /// `FieldPolicy`.
9083    ///
9084    /// When a `FieldPolicy` is used in proto annotation, the selector must
9085    /// be left as empty. The service config generator will automatically fill
9086    /// the correct value.
9087    ///
9088    /// When a `FieldPolicy` is used in service config, the selector must be a
9089    /// comma-separated string with valid request or response field paths,
9090    /// such as "foo.bar" or "foo.bar,foo.baz".
9091    pub selector: std::string::String,
9092
9093    /// Specifies the required permission(s) for the resource referred to by the
9094    /// field. It requires the field contains a valid resource reference, and
9095    /// the request must pass the permission checks to proceed. For example,
9096    /// "resourcemanager.projects.get".
9097    pub resource_permission: std::string::String,
9098
9099    /// Specifies the resource type for the resource referred to by the field.
9100    pub resource_type: std::string::String,
9101
9102    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9103}
9104
9105impl FieldPolicy {
9106    /// Creates a new default instance.
9107    pub fn new() -> Self {
9108        std::default::Default::default()
9109    }
9110
9111    /// Sets the value of [selector][crate::model::FieldPolicy::selector].
9112    ///
9113    /// # Example
9114    /// ```ignore,no_run
9115    /// # use google_cloud_api::model::FieldPolicy;
9116    /// let x = FieldPolicy::new().set_selector("example");
9117    /// ```
9118    pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9119        self.selector = v.into();
9120        self
9121    }
9122
9123    /// Sets the value of [resource_permission][crate::model::FieldPolicy::resource_permission].
9124    ///
9125    /// # Example
9126    /// ```ignore,no_run
9127    /// # use google_cloud_api::model::FieldPolicy;
9128    /// let x = FieldPolicy::new().set_resource_permission("example");
9129    /// ```
9130    pub fn set_resource_permission<T: std::convert::Into<std::string::String>>(
9131        mut self,
9132        v: T,
9133    ) -> Self {
9134        self.resource_permission = v.into();
9135        self
9136    }
9137
9138    /// Sets the value of [resource_type][crate::model::FieldPolicy::resource_type].
9139    ///
9140    /// # Example
9141    /// ```ignore,no_run
9142    /// # use google_cloud_api::model::FieldPolicy;
9143    /// let x = FieldPolicy::new().set_resource_type("example");
9144    /// ```
9145    pub fn set_resource_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9146        self.resource_type = v.into();
9147        self
9148    }
9149}
9150
9151impl wkt::message::Message for FieldPolicy {
9152    fn typename() -> &'static str {
9153        "type.googleapis.com/google.api.FieldPolicy"
9154    }
9155}
9156
9157/// Defines policies applying to an RPC method.
9158#[derive(Clone, Default, PartialEq)]
9159#[non_exhaustive]
9160pub struct MethodPolicy {
9161    /// Selects a method to which these policies should be enforced, for example,
9162    /// "google.pubsub.v1.Subscriber.CreateSubscription".
9163    ///
9164    /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
9165    /// details.
9166    ///
9167    /// NOTE: This field must not be set in the proto annotation. It will be
9168    /// automatically filled by the service config compiler .
9169    ///
9170    /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
9171    pub selector: std::string::String,
9172
9173    /// Policies that are applicable to the request message.
9174    pub request_policies: std::vec::Vec<crate::model::FieldPolicy>,
9175
9176    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9177}
9178
9179impl MethodPolicy {
9180    /// Creates a new default instance.
9181    pub fn new() -> Self {
9182        std::default::Default::default()
9183    }
9184
9185    /// Sets the value of [selector][crate::model::MethodPolicy::selector].
9186    ///
9187    /// # Example
9188    /// ```ignore,no_run
9189    /// # use google_cloud_api::model::MethodPolicy;
9190    /// let x = MethodPolicy::new().set_selector("example");
9191    /// ```
9192    pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9193        self.selector = v.into();
9194        self
9195    }
9196
9197    /// Sets the value of [request_policies][crate::model::MethodPolicy::request_policies].
9198    ///
9199    /// # Example
9200    /// ```ignore,no_run
9201    /// # use google_cloud_api::model::MethodPolicy;
9202    /// use google_cloud_api::model::FieldPolicy;
9203    /// let x = MethodPolicy::new()
9204    ///     .set_request_policies([
9205    ///         FieldPolicy::default()/* use setters */,
9206    ///         FieldPolicy::default()/* use (different) setters */,
9207    ///     ]);
9208    /// ```
9209    pub fn set_request_policies<T, V>(mut self, v: T) -> Self
9210    where
9211        T: std::iter::IntoIterator<Item = V>,
9212        V: std::convert::Into<crate::model::FieldPolicy>,
9213    {
9214        use std::iter::Iterator;
9215        self.request_policies = v.into_iter().map(|i| i.into()).collect();
9216        self
9217    }
9218}
9219
9220impl wkt::message::Message for MethodPolicy {
9221    fn typename() -> &'static str {
9222        "type.googleapis.com/google.api.MethodPolicy"
9223    }
9224}
9225
9226/// Quota configuration helps to achieve fairness and budgeting in service
9227/// usage.
9228///
9229/// The metric based quota configuration works this way:
9230///
9231/// - The service configuration defines a set of metrics.
9232/// - For API calls, the quota.metric_rules maps methods to metrics with
9233///   corresponding costs.
9234/// - The quota.limits defines limits on the metrics, which will be used for
9235///   quota checks at runtime.
9236///
9237/// An example quota configuration in yaml format:
9238///
9239/// quota:
9240/// limits:
9241///
9242/// ```norust
9243///  - name: apiWriteQpsPerProject
9244///    metric: library.googleapis.com/write_calls
9245///    unit: "1/min/{project}"  # rate limit for consumer projects
9246///    values:
9247///      STANDARD: 10000
9248///
9249///
9250///  (The metric rules bind all methods to the read_calls metric,
9251///   except for the UpdateBook and DeleteBook methods. These two methods
9252///   are mapped to the write_calls metric, with the UpdateBook method
9253///   consuming at twice rate as the DeleteBook method.)
9254///  metric_rules:
9255///  - selector: "*"
9256///    metric_costs:
9257///      library.googleapis.com/read_calls: 1
9258///  - selector: google.example.library.v1.LibraryService.UpdateBook
9259///    metric_costs:
9260///      library.googleapis.com/write_calls: 2
9261///  - selector: google.example.library.v1.LibraryService.DeleteBook
9262///    metric_costs:
9263///      library.googleapis.com/write_calls: 1
9264/// ```
9265///
9266/// Corresponding Metric definition:
9267///
9268/// ```norust
9269///  metrics:
9270///  - name: library.googleapis.com/read_calls
9271///    display_name: Read requests
9272///    metric_kind: DELTA
9273///    value_type: INT64
9274///
9275///  - name: library.googleapis.com/write_calls
9276///    display_name: Write requests
9277///    metric_kind: DELTA
9278///    value_type: INT64
9279/// ```
9280#[derive(Clone, Default, PartialEq)]
9281#[non_exhaustive]
9282pub struct Quota {
9283    /// List of QuotaLimit definitions for the service.
9284    pub limits: std::vec::Vec<crate::model::QuotaLimit>,
9285
9286    /// List of MetricRule definitions, each one mapping a selected method to one
9287    /// or more metrics.
9288    pub metric_rules: std::vec::Vec<crate::model::MetricRule>,
9289
9290    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9291}
9292
9293impl Quota {
9294    /// Creates a new default instance.
9295    pub fn new() -> Self {
9296        std::default::Default::default()
9297    }
9298
9299    /// Sets the value of [limits][crate::model::Quota::limits].
9300    ///
9301    /// # Example
9302    /// ```ignore,no_run
9303    /// # use google_cloud_api::model::Quota;
9304    /// use google_cloud_api::model::QuotaLimit;
9305    /// let x = Quota::new()
9306    ///     .set_limits([
9307    ///         QuotaLimit::default()/* use setters */,
9308    ///         QuotaLimit::default()/* use (different) setters */,
9309    ///     ]);
9310    /// ```
9311    pub fn set_limits<T, V>(mut self, v: T) -> Self
9312    where
9313        T: std::iter::IntoIterator<Item = V>,
9314        V: std::convert::Into<crate::model::QuotaLimit>,
9315    {
9316        use std::iter::Iterator;
9317        self.limits = v.into_iter().map(|i| i.into()).collect();
9318        self
9319    }
9320
9321    /// Sets the value of [metric_rules][crate::model::Quota::metric_rules].
9322    ///
9323    /// # Example
9324    /// ```ignore,no_run
9325    /// # use google_cloud_api::model::Quota;
9326    /// use google_cloud_api::model::MetricRule;
9327    /// let x = Quota::new()
9328    ///     .set_metric_rules([
9329    ///         MetricRule::default()/* use setters */,
9330    ///         MetricRule::default()/* use (different) setters */,
9331    ///     ]);
9332    /// ```
9333    pub fn set_metric_rules<T, V>(mut self, v: T) -> Self
9334    where
9335        T: std::iter::IntoIterator<Item = V>,
9336        V: std::convert::Into<crate::model::MetricRule>,
9337    {
9338        use std::iter::Iterator;
9339        self.metric_rules = v.into_iter().map(|i| i.into()).collect();
9340        self
9341    }
9342}
9343
9344impl wkt::message::Message for Quota {
9345    fn typename() -> &'static str {
9346        "type.googleapis.com/google.api.Quota"
9347    }
9348}
9349
9350/// Bind API methods to metrics. Binding a method to a metric causes that
9351/// metric's configured quota behaviors to apply to the method call.
9352#[derive(Clone, Default, PartialEq)]
9353#[non_exhaustive]
9354pub struct MetricRule {
9355    /// Selects the methods to which this rule applies.
9356    ///
9357    /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
9358    /// details.
9359    ///
9360    /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
9361    pub selector: std::string::String,
9362
9363    /// Metrics to update when the selected methods are called, and the associated
9364    /// cost applied to each metric.
9365    ///
9366    /// The key of the map is the metric name, and the values are the amount
9367    /// increased for the metric against which the quota limits are defined.
9368    /// The value must not be negative.
9369    pub metric_costs: std::collections::HashMap<std::string::String, i64>,
9370
9371    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9372}
9373
9374impl MetricRule {
9375    /// Creates a new default instance.
9376    pub fn new() -> Self {
9377        std::default::Default::default()
9378    }
9379
9380    /// Sets the value of [selector][crate::model::MetricRule::selector].
9381    ///
9382    /// # Example
9383    /// ```ignore,no_run
9384    /// # use google_cloud_api::model::MetricRule;
9385    /// let x = MetricRule::new().set_selector("example");
9386    /// ```
9387    pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9388        self.selector = v.into();
9389        self
9390    }
9391
9392    /// Sets the value of [metric_costs][crate::model::MetricRule::metric_costs].
9393    ///
9394    /// # Example
9395    /// ```ignore,no_run
9396    /// # use google_cloud_api::model::MetricRule;
9397    /// let x = MetricRule::new().set_metric_costs([
9398    ///     ("key0", 123),
9399    ///     ("key1", 456),
9400    /// ]);
9401    /// ```
9402    pub fn set_metric_costs<T, K, V>(mut self, v: T) -> Self
9403    where
9404        T: std::iter::IntoIterator<Item = (K, V)>,
9405        K: std::convert::Into<std::string::String>,
9406        V: std::convert::Into<i64>,
9407    {
9408        use std::iter::Iterator;
9409        self.metric_costs = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9410        self
9411    }
9412}
9413
9414impl wkt::message::Message for MetricRule {
9415    fn typename() -> &'static str {
9416        "type.googleapis.com/google.api.MetricRule"
9417    }
9418}
9419
9420/// `QuotaLimit` defines a specific limit that applies over a specified duration
9421/// for a limit type. There can be at most one limit for a duration and limit
9422/// type combination defined within a `QuotaGroup`.
9423#[derive(Clone, Default, PartialEq)]
9424#[non_exhaustive]
9425pub struct QuotaLimit {
9426    /// Name of the quota limit.
9427    ///
9428    /// The name must be provided, and it must be unique within the service. The
9429    /// name can only include alphanumeric characters as well as '-'.
9430    ///
9431    /// The maximum length of the limit name is 64 characters.
9432    pub name: std::string::String,
9433
9434    /// Optional. User-visible, extended description for this quota limit.
9435    /// Should be used only when more context is needed to understand this limit
9436    /// than provided by the limit's display name (see: `display_name`).
9437    pub description: std::string::String,
9438
9439    /// Default number of tokens that can be consumed during the specified
9440    /// duration. This is the number of tokens assigned when a client
9441    /// application developer activates the service for his/her project.
9442    ///
9443    /// Specifying a value of 0 will block all requests. This can be used if you
9444    /// are provisioning quota to selected consumers and blocking others.
9445    /// Similarly, a value of -1 will indicate an unlimited quota. No other
9446    /// negative values are allowed.
9447    ///
9448    /// Used by group-based quotas only.
9449    pub default_limit: i64,
9450
9451    /// Maximum number of tokens that can be consumed during the specified
9452    /// duration. Client application developers can override the default limit up
9453    /// to this maximum. If specified, this value cannot be set to a value less
9454    /// than the default limit. If not specified, it is set to the default limit.
9455    ///
9456    /// To allow clients to apply overrides with no upper bound, set this to -1,
9457    /// indicating unlimited maximum quota.
9458    ///
9459    /// Used by group-based quotas only.
9460    pub max_limit: i64,
9461
9462    /// Free tier value displayed in the Developers Console for this limit.
9463    /// The free tier is the number of tokens that will be subtracted from the
9464    /// billed amount when billing is enabled.
9465    /// This field can only be set on a limit with duration "1d", in a billable
9466    /// group; it is invalid on any other limit. If this field is not set, it
9467    /// defaults to 0, indicating that there is no free tier for this service.
9468    ///
9469    /// Used by group-based quotas only.
9470    pub free_tier: i64,
9471
9472    /// Duration of this limit in textual notation. Must be "100s" or "1d".
9473    ///
9474    /// Used by group-based quotas only.
9475    pub duration: std::string::String,
9476
9477    /// The name of the metric this quota limit applies to. The quota limits with
9478    /// the same metric will be checked together during runtime. The metric must be
9479    /// defined within the service config.
9480    pub metric: std::string::String,
9481
9482    /// Specify the unit of the quota limit. It uses the same syntax as
9483    /// [MetricDescriptor.unit][google.api.MetricDescriptor.unit]. The supported
9484    /// unit kinds are determined by the quota backend system.
9485    ///
9486    /// Here are some examples:
9487    ///
9488    /// * "1/min/{project}" for quota per minute per project.
9489    ///
9490    /// Note: the order of unit components is insignificant.
9491    /// The "1" at the beginning is required to follow the metric unit syntax.
9492    ///
9493    /// [google.api.MetricDescriptor.unit]: crate::model::MetricDescriptor::unit
9494    pub unit: std::string::String,
9495
9496    /// Tiered limit values. You must specify this as a key:value pair, with an
9497    /// integer value that is the maximum number of requests allowed for the
9498    /// specified unit. Currently only STANDARD is supported.
9499    pub values: std::collections::HashMap<std::string::String, i64>,
9500
9501    /// User-visible display name for this limit.
9502    /// Optional. If not set, the UI will provide a default display name based on
9503    /// the quota configuration. This field can be used to override the default
9504    /// display name generated from the configuration.
9505    pub display_name: std::string::String,
9506
9507    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9508}
9509
9510impl QuotaLimit {
9511    /// Creates a new default instance.
9512    pub fn new() -> Self {
9513        std::default::Default::default()
9514    }
9515
9516    /// Sets the value of [name][crate::model::QuotaLimit::name].
9517    ///
9518    /// # Example
9519    /// ```ignore,no_run
9520    /// # use google_cloud_api::model::QuotaLimit;
9521    /// let x = QuotaLimit::new().set_name("example");
9522    /// ```
9523    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9524        self.name = v.into();
9525        self
9526    }
9527
9528    /// Sets the value of [description][crate::model::QuotaLimit::description].
9529    ///
9530    /// # Example
9531    /// ```ignore,no_run
9532    /// # use google_cloud_api::model::QuotaLimit;
9533    /// let x = QuotaLimit::new().set_description("example");
9534    /// ```
9535    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9536        self.description = v.into();
9537        self
9538    }
9539
9540    /// Sets the value of [default_limit][crate::model::QuotaLimit::default_limit].
9541    ///
9542    /// # Example
9543    /// ```ignore,no_run
9544    /// # use google_cloud_api::model::QuotaLimit;
9545    /// let x = QuotaLimit::new().set_default_limit(42);
9546    /// ```
9547    pub fn set_default_limit<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
9548        self.default_limit = v.into();
9549        self
9550    }
9551
9552    /// Sets the value of [max_limit][crate::model::QuotaLimit::max_limit].
9553    ///
9554    /// # Example
9555    /// ```ignore,no_run
9556    /// # use google_cloud_api::model::QuotaLimit;
9557    /// let x = QuotaLimit::new().set_max_limit(42);
9558    /// ```
9559    pub fn set_max_limit<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
9560        self.max_limit = v.into();
9561        self
9562    }
9563
9564    /// Sets the value of [free_tier][crate::model::QuotaLimit::free_tier].
9565    ///
9566    /// # Example
9567    /// ```ignore,no_run
9568    /// # use google_cloud_api::model::QuotaLimit;
9569    /// let x = QuotaLimit::new().set_free_tier(42);
9570    /// ```
9571    pub fn set_free_tier<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
9572        self.free_tier = v.into();
9573        self
9574    }
9575
9576    /// Sets the value of [duration][crate::model::QuotaLimit::duration].
9577    ///
9578    /// # Example
9579    /// ```ignore,no_run
9580    /// # use google_cloud_api::model::QuotaLimit;
9581    /// let x = QuotaLimit::new().set_duration("example");
9582    /// ```
9583    pub fn set_duration<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9584        self.duration = v.into();
9585        self
9586    }
9587
9588    /// Sets the value of [metric][crate::model::QuotaLimit::metric].
9589    ///
9590    /// # Example
9591    /// ```ignore,no_run
9592    /// # use google_cloud_api::model::QuotaLimit;
9593    /// let x = QuotaLimit::new().set_metric("example");
9594    /// ```
9595    pub fn set_metric<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9596        self.metric = v.into();
9597        self
9598    }
9599
9600    /// Sets the value of [unit][crate::model::QuotaLimit::unit].
9601    ///
9602    /// # Example
9603    /// ```ignore,no_run
9604    /// # use google_cloud_api::model::QuotaLimit;
9605    /// let x = QuotaLimit::new().set_unit("example");
9606    /// ```
9607    pub fn set_unit<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9608        self.unit = v.into();
9609        self
9610    }
9611
9612    /// Sets the value of [values][crate::model::QuotaLimit::values].
9613    ///
9614    /// # Example
9615    /// ```ignore,no_run
9616    /// # use google_cloud_api::model::QuotaLimit;
9617    /// let x = QuotaLimit::new().set_values([
9618    ///     ("key0", 123),
9619    ///     ("key1", 456),
9620    /// ]);
9621    /// ```
9622    pub fn set_values<T, K, V>(mut self, v: T) -> Self
9623    where
9624        T: std::iter::IntoIterator<Item = (K, V)>,
9625        K: std::convert::Into<std::string::String>,
9626        V: std::convert::Into<i64>,
9627    {
9628        use std::iter::Iterator;
9629        self.values = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9630        self
9631    }
9632
9633    /// Sets the value of [display_name][crate::model::QuotaLimit::display_name].
9634    ///
9635    /// # Example
9636    /// ```ignore,no_run
9637    /// # use google_cloud_api::model::QuotaLimit;
9638    /// let x = QuotaLimit::new().set_display_name("example");
9639    /// ```
9640    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9641        self.display_name = v.into();
9642        self
9643    }
9644}
9645
9646impl wkt::message::Message for QuotaLimit {
9647    fn typename() -> &'static str {
9648        "type.googleapis.com/google.api.QuotaLimit"
9649    }
9650}
9651
9652/// A simple descriptor of a resource type.
9653///
9654/// ResourceDescriptor annotates a resource message (either by means of a
9655/// protobuf annotation or use in the service config), and associates the
9656/// resource's schema, the resource type, and the pattern of the resource name.
9657///
9658/// Example:
9659///
9660/// ```norust
9661/// message Topic {
9662///   // Indicates this message defines a resource schema.
9663///   // Declares the resource type in the format of {service}/{kind}.
9664///   // For Kubernetes resources, the format is {api group}/{kind}.
9665///   option (google.api.resource) = {
9666///     type: "pubsub.googleapis.com/Topic"
9667///     pattern: "projects/{project}/topics/{topic}"
9668///   };
9669/// }
9670/// ```
9671///
9672/// The ResourceDescriptor Yaml config will look like:
9673///
9674/// ```norust
9675/// resources:
9676/// - type: "pubsub.googleapis.com/Topic"
9677///   pattern: "projects/{project}/topics/{topic}"
9678/// ```
9679///
9680/// Sometimes, resources have multiple patterns, typically because they can
9681/// live under multiple parents.
9682///
9683/// Example:
9684///
9685/// ```norust
9686/// message LogEntry {
9687///   option (google.api.resource) = {
9688///     type: "logging.googleapis.com/LogEntry"
9689///     pattern: "projects/{project}/logs/{log}"
9690///     pattern: "folders/{folder}/logs/{log}"
9691///     pattern: "organizations/{organization}/logs/{log}"
9692///     pattern: "billingAccounts/{billing_account}/logs/{log}"
9693///   };
9694/// }
9695/// ```
9696///
9697/// The ResourceDescriptor Yaml config will look like:
9698///
9699/// ```norust
9700/// resources:
9701/// - type: 'logging.googleapis.com/LogEntry'
9702///   pattern: "projects/{project}/logs/{log}"
9703///   pattern: "folders/{folder}/logs/{log}"
9704///   pattern: "organizations/{organization}/logs/{log}"
9705///   pattern: "billingAccounts/{billing_account}/logs/{log}"
9706/// ```
9707#[derive(Clone, Default, PartialEq)]
9708#[non_exhaustive]
9709pub struct ResourceDescriptor {
9710    /// The resource type. It must be in the format of
9711    /// {service_name}/{resource_type_kind}. The `resource_type_kind` must be
9712    /// singular and must not include version numbers.
9713    ///
9714    /// Example: `storage.googleapis.com/Bucket`
9715    ///
9716    /// The value of the resource_type_kind must follow the regular expression
9717    /// /[A-Za-z][a-zA-Z0-9]+/. It should start with an upper case character and
9718    /// should use PascalCase (UpperCamelCase). The maximum number of
9719    /// characters allowed for the `resource_type_kind` is 100.
9720    pub r#type: std::string::String,
9721
9722    /// Optional. The relative resource name pattern associated with this resource
9723    /// type. The DNS prefix of the full resource name shouldn't be specified here.
9724    ///
9725    /// The path pattern must follow the syntax, which aligns with HTTP binding
9726    /// syntax:
9727    ///
9728    /// ```norust
9729    /// Template = Segment { "/" Segment } ;
9730    /// Segment = LITERAL | Variable ;
9731    /// Variable = "{" LITERAL "}" ;
9732    /// ```
9733    ///
9734    /// Examples:
9735    ///
9736    /// ```norust
9737    /// - "projects/{project}/topics/{topic}"
9738    /// - "projects/{project}/knowledgeBases/{knowledge_base}"
9739    /// ```
9740    ///
9741    /// The components in braces correspond to the IDs for each resource in the
9742    /// hierarchy. It is expected that, if multiple patterns are provided,
9743    /// the same component name (e.g. "project") refers to IDs of the same
9744    /// type of resource.
9745    pub pattern: std::vec::Vec<std::string::String>,
9746
9747    /// Optional. The field on the resource that designates the resource name
9748    /// field. If omitted, this is assumed to be "name".
9749    pub name_field: std::string::String,
9750
9751    /// Optional. The historical or future-looking state of the resource pattern.
9752    ///
9753    /// Example:
9754    ///
9755    /// ```norust
9756    /// // The InspectTemplate message originally only supported resource
9757    /// // names with organization, and project was added later.
9758    /// message InspectTemplate {
9759    ///   option (google.api.resource) = {
9760    ///     type: "dlp.googleapis.com/InspectTemplate"
9761    ///     pattern:
9762    ///     "organizations/{organization}/inspectTemplates/{inspect_template}"
9763    ///     pattern: "projects/{project}/inspectTemplates/{inspect_template}"
9764    ///     history: ORIGINALLY_SINGLE_PATTERN
9765    ///   };
9766    /// }
9767    /// ```
9768    pub history: crate::model::resource_descriptor::History,
9769
9770    /// The plural name used in the resource name and permission names, such as
9771    /// 'projects' for the resource name of 'projects/{project}' and the permission
9772    /// name of 'cloudresourcemanager.googleapis.com/projects.get'. One exception
9773    /// to this is for Nested Collections that have stuttering names, as defined
9774    /// in [AIP-122](https://google.aip.dev/122#nested-collections), where the
9775    /// collection ID in the resource name pattern does not necessarily directly
9776    /// match the `plural` value.
9777    ///
9778    /// It is the same concept of the `plural` field in k8s CRD spec
9779    /// <https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/>
9780    ///
9781    /// Note: The plural form is required even for singleton resources. See
9782    /// <https://aip.dev/156>
9783    pub plural: std::string::String,
9784
9785    /// The same concept of the `singular` field in k8s CRD spec
9786    /// <https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/>
9787    /// Such as "project" for the `resourcemanager.googleapis.com/Project` type.
9788    pub singular: std::string::String,
9789
9790    /// Style flag(s) for this resource.
9791    /// These indicate that a resource is expected to conform to a given
9792    /// style. See the specific style flags for additional information.
9793    pub style: std::vec::Vec<crate::model::resource_descriptor::Style>,
9794
9795    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9796}
9797
9798impl ResourceDescriptor {
9799    /// Creates a new default instance.
9800    pub fn new() -> Self {
9801        std::default::Default::default()
9802    }
9803
9804    /// Sets the value of [r#type][crate::model::ResourceDescriptor::type].
9805    ///
9806    /// # Example
9807    /// ```ignore,no_run
9808    /// # use google_cloud_api::model::ResourceDescriptor;
9809    /// let x = ResourceDescriptor::new().set_type("example");
9810    /// ```
9811    pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9812        self.r#type = v.into();
9813        self
9814    }
9815
9816    /// Sets the value of [pattern][crate::model::ResourceDescriptor::pattern].
9817    ///
9818    /// # Example
9819    /// ```ignore,no_run
9820    /// # use google_cloud_api::model::ResourceDescriptor;
9821    /// let x = ResourceDescriptor::new().set_pattern(["a", "b", "c"]);
9822    /// ```
9823    pub fn set_pattern<T, V>(mut self, v: T) -> Self
9824    where
9825        T: std::iter::IntoIterator<Item = V>,
9826        V: std::convert::Into<std::string::String>,
9827    {
9828        use std::iter::Iterator;
9829        self.pattern = v.into_iter().map(|i| i.into()).collect();
9830        self
9831    }
9832
9833    /// Sets the value of [name_field][crate::model::ResourceDescriptor::name_field].
9834    ///
9835    /// # Example
9836    /// ```ignore,no_run
9837    /// # use google_cloud_api::model::ResourceDescriptor;
9838    /// let x = ResourceDescriptor::new().set_name_field("example");
9839    /// ```
9840    pub fn set_name_field<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9841        self.name_field = v.into();
9842        self
9843    }
9844
9845    /// Sets the value of [history][crate::model::ResourceDescriptor::history].
9846    ///
9847    /// # Example
9848    /// ```ignore,no_run
9849    /// # use google_cloud_api::model::ResourceDescriptor;
9850    /// use google_cloud_api::model::resource_descriptor::History;
9851    /// let x0 = ResourceDescriptor::new().set_history(History::OriginallySinglePattern);
9852    /// let x1 = ResourceDescriptor::new().set_history(History::FutureMultiPattern);
9853    /// ```
9854    pub fn set_history<T: std::convert::Into<crate::model::resource_descriptor::History>>(
9855        mut self,
9856        v: T,
9857    ) -> Self {
9858        self.history = v.into();
9859        self
9860    }
9861
9862    /// Sets the value of [plural][crate::model::ResourceDescriptor::plural].
9863    ///
9864    /// # Example
9865    /// ```ignore,no_run
9866    /// # use google_cloud_api::model::ResourceDescriptor;
9867    /// let x = ResourceDescriptor::new().set_plural("example");
9868    /// ```
9869    pub fn set_plural<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9870        self.plural = v.into();
9871        self
9872    }
9873
9874    /// Sets the value of [singular][crate::model::ResourceDescriptor::singular].
9875    ///
9876    /// # Example
9877    /// ```ignore,no_run
9878    /// # use google_cloud_api::model::ResourceDescriptor;
9879    /// let x = ResourceDescriptor::new().set_singular("example");
9880    /// ```
9881    pub fn set_singular<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9882        self.singular = v.into();
9883        self
9884    }
9885
9886    /// Sets the value of [style][crate::model::ResourceDescriptor::style].
9887    ///
9888    /// # Example
9889    /// ```ignore,no_run
9890    /// # use google_cloud_api::model::ResourceDescriptor;
9891    /// use google_cloud_api::model::resource_descriptor::Style;
9892    /// let x = ResourceDescriptor::new().set_style([
9893    ///     Style::DeclarativeFriendly,
9894    /// ]);
9895    /// ```
9896    pub fn set_style<T, V>(mut self, v: T) -> Self
9897    where
9898        T: std::iter::IntoIterator<Item = V>,
9899        V: std::convert::Into<crate::model::resource_descriptor::Style>,
9900    {
9901        use std::iter::Iterator;
9902        self.style = v.into_iter().map(|i| i.into()).collect();
9903        self
9904    }
9905}
9906
9907impl wkt::message::Message for ResourceDescriptor {
9908    fn typename() -> &'static str {
9909        "type.googleapis.com/google.api.ResourceDescriptor"
9910    }
9911}
9912
9913/// Defines additional types related to [ResourceDescriptor].
9914pub mod resource_descriptor {
9915    #[allow(unused_imports)]
9916    use super::*;
9917
9918    /// A description of the historical or future-looking state of the
9919    /// resource pattern.
9920    ///
9921    /// # Working with unknown values
9922    ///
9923    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9924    /// additional enum variants at any time. Adding new variants is not considered
9925    /// a breaking change. Applications should write their code in anticipation of:
9926    ///
9927    /// - New values appearing in future releases of the client library, **and**
9928    /// - New values received dynamically, without application changes.
9929    ///
9930    /// Please consult the [Working with enums] section in the user guide for some
9931    /// guidelines.
9932    ///
9933    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
9934    #[derive(Clone, Debug, PartialEq)]
9935    #[non_exhaustive]
9936    pub enum History {
9937        /// The "unset" value.
9938        Unspecified,
9939        /// The resource originally had one pattern and launched as such, and
9940        /// additional patterns were added later.
9941        OriginallySinglePattern,
9942        /// The resource has one pattern, but the API owner expects to add more
9943        /// later. (This is the inverse of ORIGINALLY_SINGLE_PATTERN, and prevents
9944        /// that from being necessary once there are multiple patterns.)
9945        FutureMultiPattern,
9946        /// If set, the enum was initialized with an unknown value.
9947        ///
9948        /// Applications can examine the value using [History::value] or
9949        /// [History::name].
9950        UnknownValue(history::UnknownValue),
9951    }
9952
9953    #[doc(hidden)]
9954    pub mod history {
9955        #[allow(unused_imports)]
9956        use super::*;
9957        #[derive(Clone, Debug, PartialEq)]
9958        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9959    }
9960
9961    impl History {
9962        /// Gets the enum value.
9963        ///
9964        /// Returns `None` if the enum contains an unknown value deserialized from
9965        /// the string representation of enums.
9966        pub fn value(&self) -> std::option::Option<i32> {
9967            match self {
9968                Self::Unspecified => std::option::Option::Some(0),
9969                Self::OriginallySinglePattern => std::option::Option::Some(1),
9970                Self::FutureMultiPattern => std::option::Option::Some(2),
9971                Self::UnknownValue(u) => u.0.value(),
9972            }
9973        }
9974
9975        /// Gets the enum value as a string.
9976        ///
9977        /// Returns `None` if the enum contains an unknown value deserialized from
9978        /// the integer representation of enums.
9979        pub fn name(&self) -> std::option::Option<&str> {
9980            match self {
9981                Self::Unspecified => std::option::Option::Some("HISTORY_UNSPECIFIED"),
9982                Self::OriginallySinglePattern => {
9983                    std::option::Option::Some("ORIGINALLY_SINGLE_PATTERN")
9984                }
9985                Self::FutureMultiPattern => std::option::Option::Some("FUTURE_MULTI_PATTERN"),
9986                Self::UnknownValue(u) => u.0.name(),
9987            }
9988        }
9989    }
9990
9991    impl std::default::Default for History {
9992        fn default() -> Self {
9993            use std::convert::From;
9994            Self::from(0)
9995        }
9996    }
9997
9998    impl std::fmt::Display for History {
9999        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10000            wkt::internal::display_enum(f, self.name(), self.value())
10001        }
10002    }
10003
10004    impl std::convert::From<i32> for History {
10005        fn from(value: i32) -> Self {
10006            match value {
10007                0 => Self::Unspecified,
10008                1 => Self::OriginallySinglePattern,
10009                2 => Self::FutureMultiPattern,
10010                _ => Self::UnknownValue(history::UnknownValue(
10011                    wkt::internal::UnknownEnumValue::Integer(value),
10012                )),
10013            }
10014        }
10015    }
10016
10017    impl std::convert::From<&str> for History {
10018        fn from(value: &str) -> Self {
10019            use std::string::ToString;
10020            match value {
10021                "HISTORY_UNSPECIFIED" => Self::Unspecified,
10022                "ORIGINALLY_SINGLE_PATTERN" => Self::OriginallySinglePattern,
10023                "FUTURE_MULTI_PATTERN" => Self::FutureMultiPattern,
10024                _ => Self::UnknownValue(history::UnknownValue(
10025                    wkt::internal::UnknownEnumValue::String(value.to_string()),
10026                )),
10027            }
10028        }
10029    }
10030
10031    impl serde::ser::Serialize for History {
10032        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10033        where
10034            S: serde::Serializer,
10035        {
10036            match self {
10037                Self::Unspecified => serializer.serialize_i32(0),
10038                Self::OriginallySinglePattern => serializer.serialize_i32(1),
10039                Self::FutureMultiPattern => serializer.serialize_i32(2),
10040                Self::UnknownValue(u) => u.0.serialize(serializer),
10041            }
10042        }
10043    }
10044
10045    impl<'de> serde::de::Deserialize<'de> for History {
10046        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10047        where
10048            D: serde::Deserializer<'de>,
10049        {
10050            deserializer.deserialize_any(wkt::internal::EnumVisitor::<History>::new(
10051                ".google.api.ResourceDescriptor.History",
10052            ))
10053        }
10054    }
10055
10056    /// A flag representing a specific style that a resource claims to conform to.
10057    ///
10058    /// # Working with unknown values
10059    ///
10060    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10061    /// additional enum variants at any time. Adding new variants is not considered
10062    /// a breaking change. Applications should write their code in anticipation of:
10063    ///
10064    /// - New values appearing in future releases of the client library, **and**
10065    /// - New values received dynamically, without application changes.
10066    ///
10067    /// Please consult the [Working with enums] section in the user guide for some
10068    /// guidelines.
10069    ///
10070    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
10071    #[derive(Clone, Debug, PartialEq)]
10072    #[non_exhaustive]
10073    pub enum Style {
10074        /// The unspecified value. Do not use.
10075        Unspecified,
10076        /// This resource is intended to be "declarative-friendly".
10077        ///
10078        /// Declarative-friendly resources must be more strictly consistent, and
10079        /// setting this to true communicates to tools that this resource should
10080        /// adhere to declarative-friendly expectations.
10081        ///
10082        /// Note: This is used by the API linter (linter.aip.dev) to enable
10083        /// additional checks.
10084        DeclarativeFriendly,
10085        /// If set, the enum was initialized with an unknown value.
10086        ///
10087        /// Applications can examine the value using [Style::value] or
10088        /// [Style::name].
10089        UnknownValue(style::UnknownValue),
10090    }
10091
10092    #[doc(hidden)]
10093    pub mod style {
10094        #[allow(unused_imports)]
10095        use super::*;
10096        #[derive(Clone, Debug, PartialEq)]
10097        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10098    }
10099
10100    impl Style {
10101        /// Gets the enum value.
10102        ///
10103        /// Returns `None` if the enum contains an unknown value deserialized from
10104        /// the string representation of enums.
10105        pub fn value(&self) -> std::option::Option<i32> {
10106            match self {
10107                Self::Unspecified => std::option::Option::Some(0),
10108                Self::DeclarativeFriendly => std::option::Option::Some(1),
10109                Self::UnknownValue(u) => u.0.value(),
10110            }
10111        }
10112
10113        /// Gets the enum value as a string.
10114        ///
10115        /// Returns `None` if the enum contains an unknown value deserialized from
10116        /// the integer representation of enums.
10117        pub fn name(&self) -> std::option::Option<&str> {
10118            match self {
10119                Self::Unspecified => std::option::Option::Some("STYLE_UNSPECIFIED"),
10120                Self::DeclarativeFriendly => std::option::Option::Some("DECLARATIVE_FRIENDLY"),
10121                Self::UnknownValue(u) => u.0.name(),
10122            }
10123        }
10124    }
10125
10126    impl std::default::Default for Style {
10127        fn default() -> Self {
10128            use std::convert::From;
10129            Self::from(0)
10130        }
10131    }
10132
10133    impl std::fmt::Display for Style {
10134        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10135            wkt::internal::display_enum(f, self.name(), self.value())
10136        }
10137    }
10138
10139    impl std::convert::From<i32> for Style {
10140        fn from(value: i32) -> Self {
10141            match value {
10142                0 => Self::Unspecified,
10143                1 => Self::DeclarativeFriendly,
10144                _ => Self::UnknownValue(style::UnknownValue(
10145                    wkt::internal::UnknownEnumValue::Integer(value),
10146                )),
10147            }
10148        }
10149    }
10150
10151    impl std::convert::From<&str> for Style {
10152        fn from(value: &str) -> Self {
10153            use std::string::ToString;
10154            match value {
10155                "STYLE_UNSPECIFIED" => Self::Unspecified,
10156                "DECLARATIVE_FRIENDLY" => Self::DeclarativeFriendly,
10157                _ => Self::UnknownValue(style::UnknownValue(
10158                    wkt::internal::UnknownEnumValue::String(value.to_string()),
10159                )),
10160            }
10161        }
10162    }
10163
10164    impl serde::ser::Serialize for Style {
10165        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10166        where
10167            S: serde::Serializer,
10168        {
10169            match self {
10170                Self::Unspecified => serializer.serialize_i32(0),
10171                Self::DeclarativeFriendly => serializer.serialize_i32(1),
10172                Self::UnknownValue(u) => u.0.serialize(serializer),
10173            }
10174        }
10175    }
10176
10177    impl<'de> serde::de::Deserialize<'de> for Style {
10178        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10179        where
10180            D: serde::Deserializer<'de>,
10181        {
10182            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Style>::new(
10183                ".google.api.ResourceDescriptor.Style",
10184            ))
10185        }
10186    }
10187}
10188
10189/// Defines a proto annotation that describes a string field that refers to
10190/// an API resource.
10191#[derive(Clone, Default, PartialEq)]
10192#[non_exhaustive]
10193pub struct ResourceReference {
10194    /// The resource type that the annotated field references.
10195    ///
10196    /// Example:
10197    ///
10198    /// ```norust
10199    /// message Subscription {
10200    ///   string topic = 2 [(google.api.resource_reference) = {
10201    ///     type: "pubsub.googleapis.com/Topic"
10202    ///   }];
10203    /// }
10204    /// ```
10205    ///
10206    /// Occasionally, a field may reference an arbitrary resource. In this case,
10207    /// APIs use the special value * in their resource reference.
10208    ///
10209    /// Example:
10210    ///
10211    /// ```norust
10212    /// message GetIamPolicyRequest {
10213    ///   string resource = 2 [(google.api.resource_reference) = {
10214    ///     type: "*"
10215    ///   }];
10216    /// }
10217    /// ```
10218    pub r#type: std::string::String,
10219
10220    /// The resource type of a child collection that the annotated field
10221    /// references. This is useful for annotating the `parent` field that
10222    /// doesn't have a fixed resource type.
10223    ///
10224    /// Example:
10225    ///
10226    /// ```norust
10227    /// message ListLogEntriesRequest {
10228    ///   string parent = 1 [(google.api.resource_reference) = {
10229    ///     child_type: "logging.googleapis.com/LogEntry"
10230    ///   };
10231    /// }
10232    /// ```
10233    pub child_type: std::string::String,
10234
10235    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10236}
10237
10238impl ResourceReference {
10239    /// Creates a new default instance.
10240    pub fn new() -> Self {
10241        std::default::Default::default()
10242    }
10243
10244    /// Sets the value of [r#type][crate::model::ResourceReference::type].
10245    ///
10246    /// # Example
10247    /// ```ignore,no_run
10248    /// # use google_cloud_api::model::ResourceReference;
10249    /// let x = ResourceReference::new().set_type("example");
10250    /// ```
10251    pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10252        self.r#type = v.into();
10253        self
10254    }
10255
10256    /// Sets the value of [child_type][crate::model::ResourceReference::child_type].
10257    ///
10258    /// # Example
10259    /// ```ignore,no_run
10260    /// # use google_cloud_api::model::ResourceReference;
10261    /// let x = ResourceReference::new().set_child_type("example");
10262    /// ```
10263    pub fn set_child_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10264        self.child_type = v.into();
10265        self
10266    }
10267}
10268
10269impl wkt::message::Message for ResourceReference {
10270    fn typename() -> &'static str {
10271        "type.googleapis.com/google.api.ResourceReference"
10272    }
10273}
10274
10275/// Specifies the routing information that should be sent along with the request
10276/// in the form of routing header.
10277/// **NOTE:** All service configuration rules follow the "last one wins" order.
10278///
10279/// The examples below will apply to an RPC which has the following request type:
10280///
10281/// Message Definition:
10282///
10283/// ```norust
10284/// message Request {
10285///   // The name of the Table
10286///   // Values can be of the following formats:
10287///   // - `projects/<project>/tables/<table>`
10288///   // - `projects/<project>/instances/<instance>/tables/<table>`
10289///   // - `region/<region>/zones/<zone>/tables/<table>`
10290///   string table_name = 1;
10291///
10292///   // This value specifies routing for replication.
10293///   // It can be in the following formats:
10294///   // - `profiles/<profile_id>`
10295///   // - a legacy `profile_id` that can be any string
10296///   string app_profile_id = 2;
10297/// }
10298/// ```
10299///
10300/// Example message:
10301///
10302/// ```norust
10303/// {
10304///   table_name: projects/proj_foo/instances/instance_bar/table/table_baz,
10305///   app_profile_id: profiles/prof_qux
10306/// }
10307/// ```
10308///
10309/// The routing header consists of one or multiple key-value pairs. The order of
10310/// the key-value pairs is undefined, the order of the `routing_parameters` in
10311/// the `RoutingRule` only matters for the evaluation order of the path
10312/// templates when `field` is the same. See the examples below for more details.
10313///
10314/// Every key and value in the routing header must be percent-encoded,
10315/// and joined together in the following format: `key1=value1&key2=value2`.
10316/// The examples below skip the percent-encoding for readability.
10317///
10318/// Example 1
10319///
10320/// Extracting a field from the request to put into the routing header
10321/// unchanged, with the key equal to the field name.
10322///
10323/// annotation:
10324///
10325/// ```norust
10326/// option (google.api.routing) = {
10327///   // Take the `app_profile_id`.
10328///   routing_parameters {
10329///     field: "app_profile_id"
10330///   }
10331/// };
10332/// ```
10333///
10334/// result:
10335///
10336/// ```norust
10337/// x-goog-request-params: app_profile_id=profiles/prof_qux
10338/// ```
10339///
10340/// Example 2
10341///
10342/// Extracting a field from the request to put into the routing header
10343/// unchanged, with the key different from the field name.
10344///
10345/// annotation:
10346///
10347/// ```norust
10348/// option (google.api.routing) = {
10349///   // Take the `app_profile_id`, but name it `routing_id` in the header.
10350///   routing_parameters {
10351///     field: "app_profile_id"
10352///     path_template: "{routing_id=**}"
10353///   }
10354/// };
10355/// ```
10356///
10357/// result:
10358///
10359/// ```norust
10360/// x-goog-request-params: routing_id=profiles/prof_qux
10361/// ```
10362///
10363/// Example 3
10364///
10365/// Extracting a field from the request to put into the routing
10366/// header, while matching a path template syntax on the field's value.
10367///
10368/// NB: it is more useful to send nothing than to send garbage for the purpose
10369/// of dynamic routing, since garbage pollutes cache. Thus the matching.
10370///
10371/// Sub-example 3a
10372///
10373/// The field matches the template.
10374///
10375/// annotation:
10376///
10377/// ```norust
10378/// option (google.api.routing) = {
10379///   // Take the `table_name`, if it's well-formed (with project-based
10380///   // syntax).
10381///   routing_parameters {
10382///     field: "table_name"
10383///     path_template: "{table_name=projects/*/instances/*/**}"
10384///   }
10385/// };
10386/// ```
10387///
10388/// result:
10389///
10390/// ```norust
10391/// x-goog-request-params:
10392/// table_name=projects/proj_foo/instances/instance_bar/table/table_baz
10393/// ```
10394///
10395/// Sub-example 3b
10396///
10397/// The field does not match the template.
10398///
10399/// annotation:
10400///
10401/// ```norust
10402/// option (google.api.routing) = {
10403///   // Take the `table_name`, if it's well-formed (with region-based
10404///   // syntax).
10405///   routing_parameters {
10406///     field: "table_name"
10407///     path_template: "{table_name=regions/*/zones/*/**}"
10408///   }
10409/// };
10410/// ```
10411///
10412/// result:
10413///
10414/// ```norust
10415/// <no routing header will be sent>
10416/// ```
10417///
10418/// Sub-example 3c
10419///
10420/// Multiple alternative conflictingly named path templates are
10421/// specified. The one that matches is used to construct the header.
10422///
10423/// annotation:
10424///
10425/// ```norust
10426/// option (google.api.routing) = {
10427///   // Take the `table_name`, if it's well-formed, whether
10428///   // using the region- or projects-based syntax.
10429///
10430///   routing_parameters {
10431///     field: "table_name"
10432///     path_template: "{table_name=regions/*/zones/*/**}"
10433///   }
10434///   routing_parameters {
10435///     field: "table_name"
10436///     path_template: "{table_name=projects/*/instances/*/**}"
10437///   }
10438/// };
10439/// ```
10440///
10441/// result:
10442///
10443/// ```norust
10444/// x-goog-request-params:
10445/// table_name=projects/proj_foo/instances/instance_bar/table/table_baz
10446/// ```
10447///
10448/// Example 4
10449///
10450/// Extracting a single routing header key-value pair by matching a
10451/// template syntax on (a part of) a single request field.
10452///
10453/// annotation:
10454///
10455/// ```norust
10456/// option (google.api.routing) = {
10457///   // Take just the project id from the `table_name` field.
10458///   routing_parameters {
10459///     field: "table_name"
10460///     path_template: "{routing_id=projects/*}/**"
10461///   }
10462/// };
10463/// ```
10464///
10465/// result:
10466///
10467/// ```norust
10468/// x-goog-request-params: routing_id=projects/proj_foo
10469/// ```
10470///
10471/// Example 5
10472///
10473/// Extracting a single routing header key-value pair by matching
10474/// several conflictingly named path templates on (parts of) a single request
10475/// field. The last template to match "wins" the conflict.
10476///
10477/// annotation:
10478///
10479/// ```norust
10480/// option (google.api.routing) = {
10481///   // If the `table_name` does not have instances information,
10482///   // take just the project id for routing.
10483///   // Otherwise take project + instance.
10484///
10485///   routing_parameters {
10486///     field: "table_name"
10487///     path_template: "{routing_id=projects/*}/**"
10488///   }
10489///   routing_parameters {
10490///     field: "table_name"
10491///     path_template: "{routing_id=projects/*/instances/*}/**"
10492///   }
10493/// };
10494/// ```
10495///
10496/// result:
10497///
10498/// ```norust
10499/// x-goog-request-params:
10500/// routing_id=projects/proj_foo/instances/instance_bar
10501/// ```
10502///
10503/// Example 6
10504///
10505/// Extracting multiple routing header key-value pairs by matching
10506/// several non-conflicting path templates on (parts of) a single request field.
10507///
10508/// Sub-example 6a
10509///
10510/// Make the templates strict, so that if the `table_name` does not
10511/// have an instance information, nothing is sent.
10512///
10513/// annotation:
10514///
10515/// ```norust
10516/// option (google.api.routing) = {
10517///   // The routing code needs two keys instead of one composite
10518///   // but works only for the tables with the "project-instance" name
10519///   // syntax.
10520///
10521///   routing_parameters {
10522///     field: "table_name"
10523///     path_template: "{project_id=projects/*}/instances/*/**"
10524///   }
10525///   routing_parameters {
10526///     field: "table_name"
10527///     path_template: "projects/*/{instance_id=instances/*}/**"
10528///   }
10529/// };
10530/// ```
10531///
10532/// result:
10533///
10534/// ```norust
10535/// x-goog-request-params:
10536/// project_id=projects/proj_foo&instance_id=instances/instance_bar
10537/// ```
10538///
10539/// Sub-example 6b
10540///
10541/// Make the templates loose, so that if the `table_name` does not
10542/// have an instance information, just the project id part is sent.
10543///
10544/// annotation:
10545///
10546/// ```norust
10547/// option (google.api.routing) = {
10548///   // The routing code wants two keys instead of one composite
10549///   // but will work with just the `project_id` for tables without
10550///   // an instance in the `table_name`.
10551///
10552///   routing_parameters {
10553///     field: "table_name"
10554///     path_template: "{project_id=projects/*}/**"
10555///   }
10556///   routing_parameters {
10557///     field: "table_name"
10558///     path_template: "projects/*/{instance_id=instances/*}/**"
10559///   }
10560/// };
10561/// ```
10562///
10563/// result (is the same as 6a for our example message because it has the instance
10564/// information):
10565///
10566/// ```norust
10567/// x-goog-request-params:
10568/// project_id=projects/proj_foo&instance_id=instances/instance_bar
10569/// ```
10570///
10571/// Example 7
10572///
10573/// Extracting multiple routing header key-value pairs by matching
10574/// several path templates on multiple request fields.
10575///
10576/// NB: note that here there is no way to specify sending nothing if one of the
10577/// fields does not match its template. E.g. if the `table_name` is in the wrong
10578/// format, the `project_id` will not be sent, but the `routing_id` will be.
10579/// The backend routing code has to be aware of that and be prepared to not
10580/// receive a full complement of keys if it expects multiple.
10581///
10582/// annotation:
10583///
10584/// ```norust
10585/// option (google.api.routing) = {
10586///   // The routing needs both `project_id` and `routing_id`
10587///   // (from the `app_profile_id` field) for routing.
10588///
10589///   routing_parameters {
10590///     field: "table_name"
10591///     path_template: "{project_id=projects/*}/**"
10592///   }
10593///   routing_parameters {
10594///     field: "app_profile_id"
10595///     path_template: "{routing_id=**}"
10596///   }
10597/// };
10598/// ```
10599///
10600/// result:
10601///
10602/// ```norust
10603/// x-goog-request-params:
10604/// project_id=projects/proj_foo&routing_id=profiles/prof_qux
10605/// ```
10606///
10607/// Example 8
10608///
10609/// Extracting a single routing header key-value pair by matching
10610/// several conflictingly named path templates on several request fields. The
10611/// last template to match "wins" the conflict.
10612///
10613/// annotation:
10614///
10615/// ```norust
10616/// option (google.api.routing) = {
10617///   // The `routing_id` can be a project id or a region id depending on
10618///   // the table name format, but only if the `app_profile_id` is not set.
10619///   // If `app_profile_id` is set it should be used instead.
10620///
10621///   routing_parameters {
10622///     field: "table_name"
10623///     path_template: "{routing_id=projects/*}/**"
10624///   }
10625///   routing_parameters {
10626///      field: "table_name"
10627///      path_template: "{routing_id=regions/*}/**"
10628///   }
10629///   routing_parameters {
10630///     field: "app_profile_id"
10631///     path_template: "{routing_id=**}"
10632///   }
10633/// };
10634/// ```
10635///
10636/// result:
10637///
10638/// ```norust
10639/// x-goog-request-params: routing_id=profiles/prof_qux
10640/// ```
10641///
10642/// Example 9
10643///
10644/// Bringing it all together.
10645///
10646/// annotation:
10647///
10648/// ```norust
10649/// option (google.api.routing) = {
10650///   // For routing both `table_location` and a `routing_id` are needed.
10651///   //
10652///   // table_location can be either an instance id or a region+zone id.
10653///   //
10654///   // For `routing_id`, take the value of `app_profile_id`
10655///   // - If it's in the format `profiles/<profile_id>`, send
10656///   // just the `<profile_id>` part.
10657///   // - If it's any other literal, send it as is.
10658///   // If the `app_profile_id` is empty, and the `table_name` starts with
10659///   // the project_id, send that instead.
10660///
10661///   routing_parameters {
10662///     field: "table_name"
10663///     path_template: "projects/*/{table_location=instances/*}/tables/*"
10664///   }
10665///   routing_parameters {
10666///     field: "table_name"
10667///     path_template: "{table_location=regions/*/zones/*}/tables/*"
10668///   }
10669///   routing_parameters {
10670///     field: "table_name"
10671///     path_template: "{routing_id=projects/*}/**"
10672///   }
10673///   routing_parameters {
10674///     field: "app_profile_id"
10675///     path_template: "{routing_id=**}"
10676///   }
10677///   routing_parameters {
10678///     field: "app_profile_id"
10679///     path_template: "profiles/{routing_id=*}"
10680///   }
10681/// };
10682/// ```
10683///
10684/// result:
10685///
10686/// ```norust
10687/// x-goog-request-params:
10688/// table_location=instances/instance_bar&routing_id=prof_qux
10689/// ```
10690#[derive(Clone, Default, PartialEq)]
10691#[non_exhaustive]
10692pub struct RoutingRule {
10693    /// A collection of Routing Parameter specifications.
10694    /// **NOTE:** If multiple Routing Parameters describe the same key
10695    /// (via the `path_template` field or via the `field` field when
10696    /// `path_template` is not provided), "last one wins" rule
10697    /// determines which Parameter gets used.
10698    /// See the examples for more details.
10699    pub routing_parameters: std::vec::Vec<crate::model::RoutingParameter>,
10700
10701    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10702}
10703
10704impl RoutingRule {
10705    /// Creates a new default instance.
10706    pub fn new() -> Self {
10707        std::default::Default::default()
10708    }
10709
10710    /// Sets the value of [routing_parameters][crate::model::RoutingRule::routing_parameters].
10711    ///
10712    /// # Example
10713    /// ```ignore,no_run
10714    /// # use google_cloud_api::model::RoutingRule;
10715    /// use google_cloud_api::model::RoutingParameter;
10716    /// let x = RoutingRule::new()
10717    ///     .set_routing_parameters([
10718    ///         RoutingParameter::default()/* use setters */,
10719    ///         RoutingParameter::default()/* use (different) setters */,
10720    ///     ]);
10721    /// ```
10722    pub fn set_routing_parameters<T, V>(mut self, v: T) -> Self
10723    where
10724        T: std::iter::IntoIterator<Item = V>,
10725        V: std::convert::Into<crate::model::RoutingParameter>,
10726    {
10727        use std::iter::Iterator;
10728        self.routing_parameters = v.into_iter().map(|i| i.into()).collect();
10729        self
10730    }
10731}
10732
10733impl wkt::message::Message for RoutingRule {
10734    fn typename() -> &'static str {
10735        "type.googleapis.com/google.api.RoutingRule"
10736    }
10737}
10738
10739/// A projection from an input message to the GRPC or REST header.
10740#[derive(Clone, Default, PartialEq)]
10741#[non_exhaustive]
10742pub struct RoutingParameter {
10743    /// A request field to extract the header key-value pair from.
10744    pub field: std::string::String,
10745
10746    /// A pattern matching the key-value field. Optional.
10747    /// If not specified, the whole field specified in the `field` field will be
10748    /// taken as value, and its name used as key. If specified, it MUST contain
10749    /// exactly one named segment (along with any number of unnamed segments) The
10750    /// pattern will be matched over the field specified in the `field` field, then
10751    /// if the match is successful:
10752    ///
10753    /// - the name of the single named segment will be used as a header name,
10754    /// - the match value of the segment will be used as a header value;
10755    ///   if the match is NOT successful, nothing will be sent.
10756    ///
10757    /// Example:
10758    ///
10759    /// ```norust
10760    ///           -- This is a field in the request message
10761    ///          |   that the header value will be extracted from.
10762    ///          |
10763    ///          |                     -- This is the key name in the
10764    ///          |                    |   routing header.
10765    ///          V                    |
10766    /// field: "table_name"           v
10767    /// path_template: "projects/*/{table_location=instances/*}/tables/*"
10768    ///                                            ^            ^
10769    ///                                            |            |
10770    ///   In the {} brackets is the pattern that --             |
10771    ///   specifies what to extract from the                    |
10772    ///   field as a value to be sent.                          |
10773    ///                                                         |
10774    ///  The string in the field must match the whole pattern --
10775    ///  before brackets, inside brackets, after brackets.
10776    /// ```
10777    ///
10778    /// When looking at this specific example, we can see that:
10779    ///
10780    /// - A key-value pair with the key `table_location`
10781    ///   and the value matching `instances/*` should be added
10782    ///   to the x-goog-request-params routing header.
10783    /// - The value is extracted from the request message's `table_name` field
10784    ///   if it matches the full pattern specified:
10785    ///   `projects/*/instances/*/tables/*`.
10786    ///
10787    /// **NB:** If the `path_template` field is not provided, the key name is
10788    /// equal to the field name, and the whole field should be sent as a value.
10789    /// This makes the pattern for the field and the value functionally equivalent
10790    /// to `**`, and the configuration
10791    ///
10792    /// ```norust
10793    /// {
10794    ///   field: "table_name"
10795    /// }
10796    /// ```
10797    ///
10798    /// is a functionally equivalent shorthand to:
10799    ///
10800    /// ```norust
10801    /// {
10802    ///   field: "table_name"
10803    ///   path_template: "{table_name=**}"
10804    /// }
10805    /// ```
10806    ///
10807    /// See Example 1 for more details.
10808    pub path_template: std::string::String,
10809
10810    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10811}
10812
10813impl RoutingParameter {
10814    /// Creates a new default instance.
10815    pub fn new() -> Self {
10816        std::default::Default::default()
10817    }
10818
10819    /// Sets the value of [field][crate::model::RoutingParameter::field].
10820    ///
10821    /// # Example
10822    /// ```ignore,no_run
10823    /// # use google_cloud_api::model::RoutingParameter;
10824    /// let x = RoutingParameter::new().set_field("example");
10825    /// ```
10826    pub fn set_field<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10827        self.field = v.into();
10828        self
10829    }
10830
10831    /// Sets the value of [path_template][crate::model::RoutingParameter::path_template].
10832    ///
10833    /// # Example
10834    /// ```ignore,no_run
10835    /// # use google_cloud_api::model::RoutingParameter;
10836    /// let x = RoutingParameter::new().set_path_template("example");
10837    /// ```
10838    pub fn set_path_template<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10839        self.path_template = v.into();
10840        self
10841    }
10842}
10843
10844impl wkt::message::Message for RoutingParameter {
10845    fn typename() -> &'static str {
10846        "type.googleapis.com/google.api.RoutingParameter"
10847    }
10848}
10849
10850/// `Service` is the root object of Google API service configuration (service
10851/// config). It describes the basic information about a logical service,
10852/// such as the service name and the user-facing title, and delegates other
10853/// aspects to sub-sections. Each sub-section is either a proto message or a
10854/// repeated proto message that configures a specific aspect, such as auth.
10855/// For more information, see each proto message definition.
10856///
10857/// Example:
10858///
10859/// ```norust
10860/// type: google.api.Service
10861/// name: calendar.googleapis.com
10862/// title: Google Calendar API
10863/// apis:
10864/// - name: google.calendar.v3.Calendar
10865///
10866/// visibility:
10867///   rules:
10868///   - selector: "google.calendar.v3.*"
10869///     restriction: PREVIEW
10870/// backend:
10871///   rules:
10872///   - selector: "google.calendar.v3.*"
10873///     address: calendar.example.com
10874///
10875/// authentication:
10876///   providers:
10877///   - id: google_calendar_auth
10878///     jwks_uri: https://www.googleapis.com/oauth2/v1/certs
10879///     issuer: https://securetoken.google.com
10880///   rules:
10881///   - selector: "*"
10882///     requirements:
10883///       provider_id: google_calendar_auth
10884/// ```
10885#[derive(Clone, Default, PartialEq)]
10886#[non_exhaustive]
10887pub struct Service {
10888    /// The service name, which is a DNS-like logical identifier for the
10889    /// service, such as `calendar.googleapis.com`. The service name
10890    /// typically goes through DNS verification to make sure the owner
10891    /// of the service also owns the DNS name.
10892    pub name: std::string::String,
10893
10894    /// The product title for this service, it is the name displayed in Google
10895    /// Cloud Console.
10896    pub title: std::string::String,
10897
10898    /// The Google project that owns this service.
10899    pub producer_project_id: std::string::String,
10900
10901    /// A unique ID for a specific instance of this message, typically assigned
10902    /// by the client for tracking purpose. Must be no longer than 63 characters
10903    /// and only lower case letters, digits, '.', '_' and '-' are allowed. If
10904    /// empty, the server may choose to generate one instead.
10905    pub id: std::string::String,
10906
10907    /// A list of API interfaces exported by this service. Only the `name` field
10908    /// of the [google.protobuf.Api][google.protobuf.Api] needs to be provided by
10909    /// the configuration author, as the remaining fields will be derived from the
10910    /// IDL during the normalization process. It is an error to specify an API
10911    /// interface here which cannot be resolved against the associated IDL files.
10912    ///
10913    /// [google.protobuf.Api]: wkt::Api
10914    pub apis: std::vec::Vec<wkt::Api>,
10915
10916    /// A list of all proto message types included in this API service.
10917    /// Types referenced directly or indirectly by the `apis` are automatically
10918    /// included.  Messages which are not referenced but shall be included, such as
10919    /// types used by the `google.protobuf.Any` type, should be listed here by
10920    /// name by the configuration author. Example:
10921    ///
10922    /// ```norust
10923    /// types:
10924    /// - name: google.protobuf.Int32
10925    /// ```
10926    pub types: std::vec::Vec<wkt::Type>,
10927
10928    /// A list of all enum types included in this API service.  Enums referenced
10929    /// directly or indirectly by the `apis` are automatically included.  Enums
10930    /// which are not referenced but shall be included should be listed here by
10931    /// name by the configuration author. Example:
10932    ///
10933    /// ```norust
10934    /// enums:
10935    /// - name: google.someapi.v1.SomeEnum
10936    /// ```
10937    pub enums: std::vec::Vec<wkt::Enum>,
10938
10939    /// Additional API documentation.
10940    pub documentation: std::option::Option<crate::model::Documentation>,
10941
10942    /// API backend configuration.
10943    pub backend: std::option::Option<crate::model::Backend>,
10944
10945    /// HTTP configuration.
10946    pub http: std::option::Option<crate::model::Http>,
10947
10948    /// Quota configuration.
10949    pub quota: std::option::Option<crate::model::Quota>,
10950
10951    /// Auth configuration.
10952    pub authentication: std::option::Option<crate::model::Authentication>,
10953
10954    /// Context configuration.
10955    pub context: std::option::Option<crate::model::Context>,
10956
10957    /// Configuration controlling usage of this service.
10958    pub usage: std::option::Option<crate::model::Usage>,
10959
10960    /// Configuration for network endpoints.  If this is empty, then an endpoint
10961    /// with the same name as the service is automatically generated to service all
10962    /// defined APIs.
10963    pub endpoints: std::vec::Vec<crate::model::Endpoint>,
10964
10965    /// Configuration for the service control plane.
10966    pub control: std::option::Option<crate::model::Control>,
10967
10968    /// Defines the logs used by this service.
10969    pub logs: std::vec::Vec<crate::model::LogDescriptor>,
10970
10971    /// Defines the metrics used by this service.
10972    pub metrics: std::vec::Vec<crate::model::MetricDescriptor>,
10973
10974    /// Defines the monitored resources used by this service. This is required
10975    /// by the `Service.monitoring` and `Service.logging` configurations.
10976    pub monitored_resources: std::vec::Vec<crate::model::MonitoredResourceDescriptor>,
10977
10978    /// Billing configuration.
10979    pub billing: std::option::Option<crate::model::Billing>,
10980
10981    /// Logging configuration.
10982    pub logging: std::option::Option<crate::model::Logging>,
10983
10984    /// Monitoring configuration.
10985    pub monitoring: std::option::Option<crate::model::Monitoring>,
10986
10987    /// System parameter configuration.
10988    pub system_parameters: std::option::Option<crate::model::SystemParameters>,
10989
10990    /// Output only. The source information for this configuration if available.
10991    pub source_info: std::option::Option<crate::model::SourceInfo>,
10992
10993    /// Settings for [Google Cloud Client
10994    /// libraries](https://cloud.google.com/apis/docs/cloud-client-libraries)
10995    /// generated from APIs defined as protocol buffers.
10996    pub publishing: std::option::Option<crate::model::Publishing>,
10997
10998    /// Obsolete. Do not use.
10999    ///
11000    /// This field has no semantic meaning. The service config compiler always
11001    /// sets this field to `3`.
11002    pub config_version: std::option::Option<wkt::UInt32Value>,
11003
11004    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11005}
11006
11007impl Service {
11008    /// Creates a new default instance.
11009    pub fn new() -> Self {
11010        std::default::Default::default()
11011    }
11012
11013    /// Sets the value of [name][crate::model::Service::name].
11014    ///
11015    /// # Example
11016    /// ```ignore,no_run
11017    /// # use google_cloud_api::model::Service;
11018    /// let x = Service::new().set_name("example");
11019    /// ```
11020    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11021        self.name = v.into();
11022        self
11023    }
11024
11025    /// Sets the value of [title][crate::model::Service::title].
11026    ///
11027    /// # Example
11028    /// ```ignore,no_run
11029    /// # use google_cloud_api::model::Service;
11030    /// let x = Service::new().set_title("example");
11031    /// ```
11032    pub fn set_title<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11033        self.title = v.into();
11034        self
11035    }
11036
11037    /// Sets the value of [producer_project_id][crate::model::Service::producer_project_id].
11038    ///
11039    /// # Example
11040    /// ```ignore,no_run
11041    /// # use google_cloud_api::model::Service;
11042    /// let x = Service::new().set_producer_project_id("example");
11043    /// ```
11044    pub fn set_producer_project_id<T: std::convert::Into<std::string::String>>(
11045        mut self,
11046        v: T,
11047    ) -> Self {
11048        self.producer_project_id = v.into();
11049        self
11050    }
11051
11052    /// Sets the value of [id][crate::model::Service::id].
11053    ///
11054    /// # Example
11055    /// ```ignore,no_run
11056    /// # use google_cloud_api::model::Service;
11057    /// let x = Service::new().set_id("example");
11058    /// ```
11059    pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11060        self.id = v.into();
11061        self
11062    }
11063
11064    /// Sets the value of [apis][crate::model::Service::apis].
11065    ///
11066    /// # Example
11067    /// ```ignore,no_run
11068    /// # use google_cloud_api::model::Service;
11069    /// use wkt::Api;
11070    /// let x = Service::new()
11071    ///     .set_apis([
11072    ///         Api::default()/* use setters */,
11073    ///         Api::default()/* use (different) setters */,
11074    ///     ]);
11075    /// ```
11076    pub fn set_apis<T, V>(mut self, v: T) -> Self
11077    where
11078        T: std::iter::IntoIterator<Item = V>,
11079        V: std::convert::Into<wkt::Api>,
11080    {
11081        use std::iter::Iterator;
11082        self.apis = v.into_iter().map(|i| i.into()).collect();
11083        self
11084    }
11085
11086    /// Sets the value of [types][crate::model::Service::types].
11087    ///
11088    /// # Example
11089    /// ```ignore,no_run
11090    /// # use google_cloud_api::model::Service;
11091    /// use wkt::Type;
11092    /// let x = Service::new()
11093    ///     .set_types([
11094    ///         Type::default()/* use setters */,
11095    ///         Type::default()/* use (different) setters */,
11096    ///     ]);
11097    /// ```
11098    pub fn set_types<T, V>(mut self, v: T) -> Self
11099    where
11100        T: std::iter::IntoIterator<Item = V>,
11101        V: std::convert::Into<wkt::Type>,
11102    {
11103        use std::iter::Iterator;
11104        self.types = v.into_iter().map(|i| i.into()).collect();
11105        self
11106    }
11107
11108    /// Sets the value of [enums][crate::model::Service::enums].
11109    ///
11110    /// # Example
11111    /// ```ignore,no_run
11112    /// # use google_cloud_api::model::Service;
11113    /// use wkt::Enum;
11114    /// let x = Service::new()
11115    ///     .set_enums([
11116    ///         Enum::default()/* use setters */,
11117    ///         Enum::default()/* use (different) setters */,
11118    ///     ]);
11119    /// ```
11120    pub fn set_enums<T, V>(mut self, v: T) -> Self
11121    where
11122        T: std::iter::IntoIterator<Item = V>,
11123        V: std::convert::Into<wkt::Enum>,
11124    {
11125        use std::iter::Iterator;
11126        self.enums = v.into_iter().map(|i| i.into()).collect();
11127        self
11128    }
11129
11130    /// Sets the value of [documentation][crate::model::Service::documentation].
11131    ///
11132    /// # Example
11133    /// ```ignore,no_run
11134    /// # use google_cloud_api::model::Service;
11135    /// use google_cloud_api::model::Documentation;
11136    /// let x = Service::new().set_documentation(Documentation::default()/* use setters */);
11137    /// ```
11138    pub fn set_documentation<T>(mut self, v: T) -> Self
11139    where
11140        T: std::convert::Into<crate::model::Documentation>,
11141    {
11142        self.documentation = std::option::Option::Some(v.into());
11143        self
11144    }
11145
11146    /// Sets or clears the value of [documentation][crate::model::Service::documentation].
11147    ///
11148    /// # Example
11149    /// ```ignore,no_run
11150    /// # use google_cloud_api::model::Service;
11151    /// use google_cloud_api::model::Documentation;
11152    /// let x = Service::new().set_or_clear_documentation(Some(Documentation::default()/* use setters */));
11153    /// let x = Service::new().set_or_clear_documentation(None::<Documentation>);
11154    /// ```
11155    pub fn set_or_clear_documentation<T>(mut self, v: std::option::Option<T>) -> Self
11156    where
11157        T: std::convert::Into<crate::model::Documentation>,
11158    {
11159        self.documentation = v.map(|x| x.into());
11160        self
11161    }
11162
11163    /// Sets the value of [backend][crate::model::Service::backend].
11164    ///
11165    /// # Example
11166    /// ```ignore,no_run
11167    /// # use google_cloud_api::model::Service;
11168    /// use google_cloud_api::model::Backend;
11169    /// let x = Service::new().set_backend(Backend::default()/* use setters */);
11170    /// ```
11171    pub fn set_backend<T>(mut self, v: T) -> Self
11172    where
11173        T: std::convert::Into<crate::model::Backend>,
11174    {
11175        self.backend = std::option::Option::Some(v.into());
11176        self
11177    }
11178
11179    /// Sets or clears the value of [backend][crate::model::Service::backend].
11180    ///
11181    /// # Example
11182    /// ```ignore,no_run
11183    /// # use google_cloud_api::model::Service;
11184    /// use google_cloud_api::model::Backend;
11185    /// let x = Service::new().set_or_clear_backend(Some(Backend::default()/* use setters */));
11186    /// let x = Service::new().set_or_clear_backend(None::<Backend>);
11187    /// ```
11188    pub fn set_or_clear_backend<T>(mut self, v: std::option::Option<T>) -> Self
11189    where
11190        T: std::convert::Into<crate::model::Backend>,
11191    {
11192        self.backend = v.map(|x| x.into());
11193        self
11194    }
11195
11196    /// Sets the value of [http][crate::model::Service::http].
11197    ///
11198    /// # Example
11199    /// ```ignore,no_run
11200    /// # use google_cloud_api::model::Service;
11201    /// use google_cloud_api::model::Http;
11202    /// let x = Service::new().set_http(Http::default()/* use setters */);
11203    /// ```
11204    pub fn set_http<T>(mut self, v: T) -> Self
11205    where
11206        T: std::convert::Into<crate::model::Http>,
11207    {
11208        self.http = std::option::Option::Some(v.into());
11209        self
11210    }
11211
11212    /// Sets or clears the value of [http][crate::model::Service::http].
11213    ///
11214    /// # Example
11215    /// ```ignore,no_run
11216    /// # use google_cloud_api::model::Service;
11217    /// use google_cloud_api::model::Http;
11218    /// let x = Service::new().set_or_clear_http(Some(Http::default()/* use setters */));
11219    /// let x = Service::new().set_or_clear_http(None::<Http>);
11220    /// ```
11221    pub fn set_or_clear_http<T>(mut self, v: std::option::Option<T>) -> Self
11222    where
11223        T: std::convert::Into<crate::model::Http>,
11224    {
11225        self.http = v.map(|x| x.into());
11226        self
11227    }
11228
11229    /// Sets the value of [quota][crate::model::Service::quota].
11230    ///
11231    /// # Example
11232    /// ```ignore,no_run
11233    /// # use google_cloud_api::model::Service;
11234    /// use google_cloud_api::model::Quota;
11235    /// let x = Service::new().set_quota(Quota::default()/* use setters */);
11236    /// ```
11237    pub fn set_quota<T>(mut self, v: T) -> Self
11238    where
11239        T: std::convert::Into<crate::model::Quota>,
11240    {
11241        self.quota = std::option::Option::Some(v.into());
11242        self
11243    }
11244
11245    /// Sets or clears the value of [quota][crate::model::Service::quota].
11246    ///
11247    /// # Example
11248    /// ```ignore,no_run
11249    /// # use google_cloud_api::model::Service;
11250    /// use google_cloud_api::model::Quota;
11251    /// let x = Service::new().set_or_clear_quota(Some(Quota::default()/* use setters */));
11252    /// let x = Service::new().set_or_clear_quota(None::<Quota>);
11253    /// ```
11254    pub fn set_or_clear_quota<T>(mut self, v: std::option::Option<T>) -> Self
11255    where
11256        T: std::convert::Into<crate::model::Quota>,
11257    {
11258        self.quota = v.map(|x| x.into());
11259        self
11260    }
11261
11262    /// Sets the value of [authentication][crate::model::Service::authentication].
11263    ///
11264    /// # Example
11265    /// ```ignore,no_run
11266    /// # use google_cloud_api::model::Service;
11267    /// use google_cloud_api::model::Authentication;
11268    /// let x = Service::new().set_authentication(Authentication::default()/* use setters */);
11269    /// ```
11270    pub fn set_authentication<T>(mut self, v: T) -> Self
11271    where
11272        T: std::convert::Into<crate::model::Authentication>,
11273    {
11274        self.authentication = std::option::Option::Some(v.into());
11275        self
11276    }
11277
11278    /// Sets or clears the value of [authentication][crate::model::Service::authentication].
11279    ///
11280    /// # Example
11281    /// ```ignore,no_run
11282    /// # use google_cloud_api::model::Service;
11283    /// use google_cloud_api::model::Authentication;
11284    /// let x = Service::new().set_or_clear_authentication(Some(Authentication::default()/* use setters */));
11285    /// let x = Service::new().set_or_clear_authentication(None::<Authentication>);
11286    /// ```
11287    pub fn set_or_clear_authentication<T>(mut self, v: std::option::Option<T>) -> Self
11288    where
11289        T: std::convert::Into<crate::model::Authentication>,
11290    {
11291        self.authentication = v.map(|x| x.into());
11292        self
11293    }
11294
11295    /// Sets the value of [context][crate::model::Service::context].
11296    ///
11297    /// # Example
11298    /// ```ignore,no_run
11299    /// # use google_cloud_api::model::Service;
11300    /// use google_cloud_api::model::Context;
11301    /// let x = Service::new().set_context(Context::default()/* use setters */);
11302    /// ```
11303    pub fn set_context<T>(mut self, v: T) -> Self
11304    where
11305        T: std::convert::Into<crate::model::Context>,
11306    {
11307        self.context = std::option::Option::Some(v.into());
11308        self
11309    }
11310
11311    /// Sets or clears the value of [context][crate::model::Service::context].
11312    ///
11313    /// # Example
11314    /// ```ignore,no_run
11315    /// # use google_cloud_api::model::Service;
11316    /// use google_cloud_api::model::Context;
11317    /// let x = Service::new().set_or_clear_context(Some(Context::default()/* use setters */));
11318    /// let x = Service::new().set_or_clear_context(None::<Context>);
11319    /// ```
11320    pub fn set_or_clear_context<T>(mut self, v: std::option::Option<T>) -> Self
11321    where
11322        T: std::convert::Into<crate::model::Context>,
11323    {
11324        self.context = v.map(|x| x.into());
11325        self
11326    }
11327
11328    /// Sets the value of [usage][crate::model::Service::usage].
11329    ///
11330    /// # Example
11331    /// ```ignore,no_run
11332    /// # use google_cloud_api::model::Service;
11333    /// use google_cloud_api::model::Usage;
11334    /// let x = Service::new().set_usage(Usage::default()/* use setters */);
11335    /// ```
11336    pub fn set_usage<T>(mut self, v: T) -> Self
11337    where
11338        T: std::convert::Into<crate::model::Usage>,
11339    {
11340        self.usage = std::option::Option::Some(v.into());
11341        self
11342    }
11343
11344    /// Sets or clears the value of [usage][crate::model::Service::usage].
11345    ///
11346    /// # Example
11347    /// ```ignore,no_run
11348    /// # use google_cloud_api::model::Service;
11349    /// use google_cloud_api::model::Usage;
11350    /// let x = Service::new().set_or_clear_usage(Some(Usage::default()/* use setters */));
11351    /// let x = Service::new().set_or_clear_usage(None::<Usage>);
11352    /// ```
11353    pub fn set_or_clear_usage<T>(mut self, v: std::option::Option<T>) -> Self
11354    where
11355        T: std::convert::Into<crate::model::Usage>,
11356    {
11357        self.usage = v.map(|x| x.into());
11358        self
11359    }
11360
11361    /// Sets the value of [endpoints][crate::model::Service::endpoints].
11362    ///
11363    /// # Example
11364    /// ```ignore,no_run
11365    /// # use google_cloud_api::model::Service;
11366    /// use google_cloud_api::model::Endpoint;
11367    /// let x = Service::new()
11368    ///     .set_endpoints([
11369    ///         Endpoint::default()/* use setters */,
11370    ///         Endpoint::default()/* use (different) setters */,
11371    ///     ]);
11372    /// ```
11373    pub fn set_endpoints<T, V>(mut self, v: T) -> Self
11374    where
11375        T: std::iter::IntoIterator<Item = V>,
11376        V: std::convert::Into<crate::model::Endpoint>,
11377    {
11378        use std::iter::Iterator;
11379        self.endpoints = v.into_iter().map(|i| i.into()).collect();
11380        self
11381    }
11382
11383    /// Sets the value of [control][crate::model::Service::control].
11384    ///
11385    /// # Example
11386    /// ```ignore,no_run
11387    /// # use google_cloud_api::model::Service;
11388    /// use google_cloud_api::model::Control;
11389    /// let x = Service::new().set_control(Control::default()/* use setters */);
11390    /// ```
11391    pub fn set_control<T>(mut self, v: T) -> Self
11392    where
11393        T: std::convert::Into<crate::model::Control>,
11394    {
11395        self.control = std::option::Option::Some(v.into());
11396        self
11397    }
11398
11399    /// Sets or clears the value of [control][crate::model::Service::control].
11400    ///
11401    /// # Example
11402    /// ```ignore,no_run
11403    /// # use google_cloud_api::model::Service;
11404    /// use google_cloud_api::model::Control;
11405    /// let x = Service::new().set_or_clear_control(Some(Control::default()/* use setters */));
11406    /// let x = Service::new().set_or_clear_control(None::<Control>);
11407    /// ```
11408    pub fn set_or_clear_control<T>(mut self, v: std::option::Option<T>) -> Self
11409    where
11410        T: std::convert::Into<crate::model::Control>,
11411    {
11412        self.control = v.map(|x| x.into());
11413        self
11414    }
11415
11416    /// Sets the value of [logs][crate::model::Service::logs].
11417    ///
11418    /// # Example
11419    /// ```ignore,no_run
11420    /// # use google_cloud_api::model::Service;
11421    /// use google_cloud_api::model::LogDescriptor;
11422    /// let x = Service::new()
11423    ///     .set_logs([
11424    ///         LogDescriptor::default()/* use setters */,
11425    ///         LogDescriptor::default()/* use (different) setters */,
11426    ///     ]);
11427    /// ```
11428    pub fn set_logs<T, V>(mut self, v: T) -> Self
11429    where
11430        T: std::iter::IntoIterator<Item = V>,
11431        V: std::convert::Into<crate::model::LogDescriptor>,
11432    {
11433        use std::iter::Iterator;
11434        self.logs = v.into_iter().map(|i| i.into()).collect();
11435        self
11436    }
11437
11438    /// Sets the value of [metrics][crate::model::Service::metrics].
11439    ///
11440    /// # Example
11441    /// ```ignore,no_run
11442    /// # use google_cloud_api::model::Service;
11443    /// use google_cloud_api::model::MetricDescriptor;
11444    /// let x = Service::new()
11445    ///     .set_metrics([
11446    ///         MetricDescriptor::default()/* use setters */,
11447    ///         MetricDescriptor::default()/* use (different) setters */,
11448    ///     ]);
11449    /// ```
11450    pub fn set_metrics<T, V>(mut self, v: T) -> Self
11451    where
11452        T: std::iter::IntoIterator<Item = V>,
11453        V: std::convert::Into<crate::model::MetricDescriptor>,
11454    {
11455        use std::iter::Iterator;
11456        self.metrics = v.into_iter().map(|i| i.into()).collect();
11457        self
11458    }
11459
11460    /// Sets the value of [monitored_resources][crate::model::Service::monitored_resources].
11461    ///
11462    /// # Example
11463    /// ```ignore,no_run
11464    /// # use google_cloud_api::model::Service;
11465    /// use google_cloud_api::model::MonitoredResourceDescriptor;
11466    /// let x = Service::new()
11467    ///     .set_monitored_resources([
11468    ///         MonitoredResourceDescriptor::default()/* use setters */,
11469    ///         MonitoredResourceDescriptor::default()/* use (different) setters */,
11470    ///     ]);
11471    /// ```
11472    pub fn set_monitored_resources<T, V>(mut self, v: T) -> Self
11473    where
11474        T: std::iter::IntoIterator<Item = V>,
11475        V: std::convert::Into<crate::model::MonitoredResourceDescriptor>,
11476    {
11477        use std::iter::Iterator;
11478        self.monitored_resources = v.into_iter().map(|i| i.into()).collect();
11479        self
11480    }
11481
11482    /// Sets the value of [billing][crate::model::Service::billing].
11483    ///
11484    /// # Example
11485    /// ```ignore,no_run
11486    /// # use google_cloud_api::model::Service;
11487    /// use google_cloud_api::model::Billing;
11488    /// let x = Service::new().set_billing(Billing::default()/* use setters */);
11489    /// ```
11490    pub fn set_billing<T>(mut self, v: T) -> Self
11491    where
11492        T: std::convert::Into<crate::model::Billing>,
11493    {
11494        self.billing = std::option::Option::Some(v.into());
11495        self
11496    }
11497
11498    /// Sets or clears the value of [billing][crate::model::Service::billing].
11499    ///
11500    /// # Example
11501    /// ```ignore,no_run
11502    /// # use google_cloud_api::model::Service;
11503    /// use google_cloud_api::model::Billing;
11504    /// let x = Service::new().set_or_clear_billing(Some(Billing::default()/* use setters */));
11505    /// let x = Service::new().set_or_clear_billing(None::<Billing>);
11506    /// ```
11507    pub fn set_or_clear_billing<T>(mut self, v: std::option::Option<T>) -> Self
11508    where
11509        T: std::convert::Into<crate::model::Billing>,
11510    {
11511        self.billing = v.map(|x| x.into());
11512        self
11513    }
11514
11515    /// Sets the value of [logging][crate::model::Service::logging].
11516    ///
11517    /// # Example
11518    /// ```ignore,no_run
11519    /// # use google_cloud_api::model::Service;
11520    /// use google_cloud_api::model::Logging;
11521    /// let x = Service::new().set_logging(Logging::default()/* use setters */);
11522    /// ```
11523    pub fn set_logging<T>(mut self, v: T) -> Self
11524    where
11525        T: std::convert::Into<crate::model::Logging>,
11526    {
11527        self.logging = std::option::Option::Some(v.into());
11528        self
11529    }
11530
11531    /// Sets or clears the value of [logging][crate::model::Service::logging].
11532    ///
11533    /// # Example
11534    /// ```ignore,no_run
11535    /// # use google_cloud_api::model::Service;
11536    /// use google_cloud_api::model::Logging;
11537    /// let x = Service::new().set_or_clear_logging(Some(Logging::default()/* use setters */));
11538    /// let x = Service::new().set_or_clear_logging(None::<Logging>);
11539    /// ```
11540    pub fn set_or_clear_logging<T>(mut self, v: std::option::Option<T>) -> Self
11541    where
11542        T: std::convert::Into<crate::model::Logging>,
11543    {
11544        self.logging = v.map(|x| x.into());
11545        self
11546    }
11547
11548    /// Sets the value of [monitoring][crate::model::Service::monitoring].
11549    ///
11550    /// # Example
11551    /// ```ignore,no_run
11552    /// # use google_cloud_api::model::Service;
11553    /// use google_cloud_api::model::Monitoring;
11554    /// let x = Service::new().set_monitoring(Monitoring::default()/* use setters */);
11555    /// ```
11556    pub fn set_monitoring<T>(mut self, v: T) -> Self
11557    where
11558        T: std::convert::Into<crate::model::Monitoring>,
11559    {
11560        self.monitoring = std::option::Option::Some(v.into());
11561        self
11562    }
11563
11564    /// Sets or clears the value of [monitoring][crate::model::Service::monitoring].
11565    ///
11566    /// # Example
11567    /// ```ignore,no_run
11568    /// # use google_cloud_api::model::Service;
11569    /// use google_cloud_api::model::Monitoring;
11570    /// let x = Service::new().set_or_clear_monitoring(Some(Monitoring::default()/* use setters */));
11571    /// let x = Service::new().set_or_clear_monitoring(None::<Monitoring>);
11572    /// ```
11573    pub fn set_or_clear_monitoring<T>(mut self, v: std::option::Option<T>) -> Self
11574    where
11575        T: std::convert::Into<crate::model::Monitoring>,
11576    {
11577        self.monitoring = v.map(|x| x.into());
11578        self
11579    }
11580
11581    /// Sets the value of [system_parameters][crate::model::Service::system_parameters].
11582    ///
11583    /// # Example
11584    /// ```ignore,no_run
11585    /// # use google_cloud_api::model::Service;
11586    /// use google_cloud_api::model::SystemParameters;
11587    /// let x = Service::new().set_system_parameters(SystemParameters::default()/* use setters */);
11588    /// ```
11589    pub fn set_system_parameters<T>(mut self, v: T) -> Self
11590    where
11591        T: std::convert::Into<crate::model::SystemParameters>,
11592    {
11593        self.system_parameters = std::option::Option::Some(v.into());
11594        self
11595    }
11596
11597    /// Sets or clears the value of [system_parameters][crate::model::Service::system_parameters].
11598    ///
11599    /// # Example
11600    /// ```ignore,no_run
11601    /// # use google_cloud_api::model::Service;
11602    /// use google_cloud_api::model::SystemParameters;
11603    /// let x = Service::new().set_or_clear_system_parameters(Some(SystemParameters::default()/* use setters */));
11604    /// let x = Service::new().set_or_clear_system_parameters(None::<SystemParameters>);
11605    /// ```
11606    pub fn set_or_clear_system_parameters<T>(mut self, v: std::option::Option<T>) -> Self
11607    where
11608        T: std::convert::Into<crate::model::SystemParameters>,
11609    {
11610        self.system_parameters = v.map(|x| x.into());
11611        self
11612    }
11613
11614    /// Sets the value of [source_info][crate::model::Service::source_info].
11615    ///
11616    /// # Example
11617    /// ```ignore,no_run
11618    /// # use google_cloud_api::model::Service;
11619    /// use google_cloud_api::model::SourceInfo;
11620    /// let x = Service::new().set_source_info(SourceInfo::default()/* use setters */);
11621    /// ```
11622    pub fn set_source_info<T>(mut self, v: T) -> Self
11623    where
11624        T: std::convert::Into<crate::model::SourceInfo>,
11625    {
11626        self.source_info = std::option::Option::Some(v.into());
11627        self
11628    }
11629
11630    /// Sets or clears the value of [source_info][crate::model::Service::source_info].
11631    ///
11632    /// # Example
11633    /// ```ignore,no_run
11634    /// # use google_cloud_api::model::Service;
11635    /// use google_cloud_api::model::SourceInfo;
11636    /// let x = Service::new().set_or_clear_source_info(Some(SourceInfo::default()/* use setters */));
11637    /// let x = Service::new().set_or_clear_source_info(None::<SourceInfo>);
11638    /// ```
11639    pub fn set_or_clear_source_info<T>(mut self, v: std::option::Option<T>) -> Self
11640    where
11641        T: std::convert::Into<crate::model::SourceInfo>,
11642    {
11643        self.source_info = v.map(|x| x.into());
11644        self
11645    }
11646
11647    /// Sets the value of [publishing][crate::model::Service::publishing].
11648    ///
11649    /// # Example
11650    /// ```ignore,no_run
11651    /// # use google_cloud_api::model::Service;
11652    /// use google_cloud_api::model::Publishing;
11653    /// let x = Service::new().set_publishing(Publishing::default()/* use setters */);
11654    /// ```
11655    pub fn set_publishing<T>(mut self, v: T) -> Self
11656    where
11657        T: std::convert::Into<crate::model::Publishing>,
11658    {
11659        self.publishing = std::option::Option::Some(v.into());
11660        self
11661    }
11662
11663    /// Sets or clears the value of [publishing][crate::model::Service::publishing].
11664    ///
11665    /// # Example
11666    /// ```ignore,no_run
11667    /// # use google_cloud_api::model::Service;
11668    /// use google_cloud_api::model::Publishing;
11669    /// let x = Service::new().set_or_clear_publishing(Some(Publishing::default()/* use setters */));
11670    /// let x = Service::new().set_or_clear_publishing(None::<Publishing>);
11671    /// ```
11672    pub fn set_or_clear_publishing<T>(mut self, v: std::option::Option<T>) -> Self
11673    where
11674        T: std::convert::Into<crate::model::Publishing>,
11675    {
11676        self.publishing = v.map(|x| x.into());
11677        self
11678    }
11679
11680    /// Sets the value of [config_version][crate::model::Service::config_version].
11681    ///
11682    /// # Example
11683    /// ```ignore,no_run
11684    /// # use google_cloud_api::model::Service;
11685    /// use wkt::UInt32Value;
11686    /// let x = Service::new().set_config_version(UInt32Value::default()/* use setters */);
11687    /// ```
11688    pub fn set_config_version<T>(mut self, v: T) -> Self
11689    where
11690        T: std::convert::Into<wkt::UInt32Value>,
11691    {
11692        self.config_version = std::option::Option::Some(v.into());
11693        self
11694    }
11695
11696    /// Sets or clears the value of [config_version][crate::model::Service::config_version].
11697    ///
11698    /// # Example
11699    /// ```ignore,no_run
11700    /// # use google_cloud_api::model::Service;
11701    /// use wkt::UInt32Value;
11702    /// let x = Service::new().set_or_clear_config_version(Some(UInt32Value::default()/* use setters */));
11703    /// let x = Service::new().set_or_clear_config_version(None::<UInt32Value>);
11704    /// ```
11705    pub fn set_or_clear_config_version<T>(mut self, v: std::option::Option<T>) -> Self
11706    where
11707        T: std::convert::Into<wkt::UInt32Value>,
11708    {
11709        self.config_version = v.map(|x| x.into());
11710        self
11711    }
11712}
11713
11714impl wkt::message::Message for Service {
11715    fn typename() -> &'static str {
11716        "type.googleapis.com/google.api.Service"
11717    }
11718}
11719
11720/// Source information used to create a Service Config
11721#[derive(Clone, Default, PartialEq)]
11722#[non_exhaustive]
11723pub struct SourceInfo {
11724    /// All files used during config generation.
11725    pub source_files: std::vec::Vec<wkt::Any>,
11726
11727    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11728}
11729
11730impl SourceInfo {
11731    /// Creates a new default instance.
11732    pub fn new() -> Self {
11733        std::default::Default::default()
11734    }
11735
11736    /// Sets the value of [source_files][crate::model::SourceInfo::source_files].
11737    ///
11738    /// # Example
11739    /// ```ignore,no_run
11740    /// # use google_cloud_api::model::SourceInfo;
11741    /// use wkt::Any;
11742    /// let x = SourceInfo::new()
11743    ///     .set_source_files([
11744    ///         Any::default()/* use setters */,
11745    ///         Any::default()/* use (different) setters */,
11746    ///     ]);
11747    /// ```
11748    pub fn set_source_files<T, V>(mut self, v: T) -> Self
11749    where
11750        T: std::iter::IntoIterator<Item = V>,
11751        V: std::convert::Into<wkt::Any>,
11752    {
11753        use std::iter::Iterator;
11754        self.source_files = v.into_iter().map(|i| i.into()).collect();
11755        self
11756    }
11757}
11758
11759impl wkt::message::Message for SourceInfo {
11760    fn typename() -> &'static str {
11761        "type.googleapis.com/google.api.SourceInfo"
11762    }
11763}
11764
11765/// ### System parameter configuration
11766///
11767/// A system parameter is a special kind of parameter defined by the API
11768/// system, not by an individual API. It is typically mapped to an HTTP header
11769/// and/or a URL query parameter. This configuration specifies which methods
11770/// change the names of the system parameters.
11771#[derive(Clone, Default, PartialEq)]
11772#[non_exhaustive]
11773pub struct SystemParameters {
11774    /// Define system parameters.
11775    ///
11776    /// The parameters defined here will override the default parameters
11777    /// implemented by the system. If this field is missing from the service
11778    /// config, default system parameters will be used. Default system parameters
11779    /// and names is implementation-dependent.
11780    ///
11781    /// Example: define api key for all methods
11782    ///
11783    /// ```norust
11784    /// system_parameters
11785    ///   rules:
11786    ///     - selector: "*"
11787    ///       parameters:
11788    ///         - name: api_key
11789    ///           url_query_parameter: api_key
11790    /// ```
11791    ///
11792    /// Example: define 2 api key names for a specific method.
11793    ///
11794    /// ```norust
11795    /// system_parameters
11796    ///   rules:
11797    ///     - selector: "/ListShelves"
11798    ///       parameters:
11799    ///         - name: api_key
11800    ///           http_header: Api-Key1
11801    ///         - name: api_key
11802    ///           http_header: Api-Key2
11803    /// ```
11804    ///
11805    /// **NOTE:** All service configuration rules follow "last one wins" order.
11806    pub rules: std::vec::Vec<crate::model::SystemParameterRule>,
11807
11808    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11809}
11810
11811impl SystemParameters {
11812    /// Creates a new default instance.
11813    pub fn new() -> Self {
11814        std::default::Default::default()
11815    }
11816
11817    /// Sets the value of [rules][crate::model::SystemParameters::rules].
11818    ///
11819    /// # Example
11820    /// ```ignore,no_run
11821    /// # use google_cloud_api::model::SystemParameters;
11822    /// use google_cloud_api::model::SystemParameterRule;
11823    /// let x = SystemParameters::new()
11824    ///     .set_rules([
11825    ///         SystemParameterRule::default()/* use setters */,
11826    ///         SystemParameterRule::default()/* use (different) setters */,
11827    ///     ]);
11828    /// ```
11829    pub fn set_rules<T, V>(mut self, v: T) -> Self
11830    where
11831        T: std::iter::IntoIterator<Item = V>,
11832        V: std::convert::Into<crate::model::SystemParameterRule>,
11833    {
11834        use std::iter::Iterator;
11835        self.rules = v.into_iter().map(|i| i.into()).collect();
11836        self
11837    }
11838}
11839
11840impl wkt::message::Message for SystemParameters {
11841    fn typename() -> &'static str {
11842        "type.googleapis.com/google.api.SystemParameters"
11843    }
11844}
11845
11846/// Define a system parameter rule mapping system parameter definitions to
11847/// methods.
11848#[derive(Clone, Default, PartialEq)]
11849#[non_exhaustive]
11850pub struct SystemParameterRule {
11851    /// Selects the methods to which this rule applies. Use '*' to indicate all
11852    /// methods in all APIs.
11853    ///
11854    /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
11855    /// details.
11856    ///
11857    /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
11858    pub selector: std::string::String,
11859
11860    /// Define parameters. Multiple names may be defined for a parameter.
11861    /// For a given method call, only one of them should be used. If multiple
11862    /// names are used the behavior is implementation-dependent.
11863    /// If none of the specified names are present the behavior is
11864    /// parameter-dependent.
11865    pub parameters: std::vec::Vec<crate::model::SystemParameter>,
11866
11867    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11868}
11869
11870impl SystemParameterRule {
11871    /// Creates a new default instance.
11872    pub fn new() -> Self {
11873        std::default::Default::default()
11874    }
11875
11876    /// Sets the value of [selector][crate::model::SystemParameterRule::selector].
11877    ///
11878    /// # Example
11879    /// ```ignore,no_run
11880    /// # use google_cloud_api::model::SystemParameterRule;
11881    /// let x = SystemParameterRule::new().set_selector("example");
11882    /// ```
11883    pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11884        self.selector = v.into();
11885        self
11886    }
11887
11888    /// Sets the value of [parameters][crate::model::SystemParameterRule::parameters].
11889    ///
11890    /// # Example
11891    /// ```ignore,no_run
11892    /// # use google_cloud_api::model::SystemParameterRule;
11893    /// use google_cloud_api::model::SystemParameter;
11894    /// let x = SystemParameterRule::new()
11895    ///     .set_parameters([
11896    ///         SystemParameter::default()/* use setters */,
11897    ///         SystemParameter::default()/* use (different) setters */,
11898    ///     ]);
11899    /// ```
11900    pub fn set_parameters<T, V>(mut self, v: T) -> Self
11901    where
11902        T: std::iter::IntoIterator<Item = V>,
11903        V: std::convert::Into<crate::model::SystemParameter>,
11904    {
11905        use std::iter::Iterator;
11906        self.parameters = v.into_iter().map(|i| i.into()).collect();
11907        self
11908    }
11909}
11910
11911impl wkt::message::Message for SystemParameterRule {
11912    fn typename() -> &'static str {
11913        "type.googleapis.com/google.api.SystemParameterRule"
11914    }
11915}
11916
11917/// Define a parameter's name and location. The parameter may be passed as either
11918/// an HTTP header or a URL query parameter, and if both are passed the behavior
11919/// is implementation-dependent.
11920#[derive(Clone, Default, PartialEq)]
11921#[non_exhaustive]
11922pub struct SystemParameter {
11923    /// Define the name of the parameter, such as "api_key" . It is case sensitive.
11924    pub name: std::string::String,
11925
11926    /// Define the HTTP header name to use for the parameter. It is case
11927    /// insensitive.
11928    pub http_header: std::string::String,
11929
11930    /// Define the URL query parameter name to use for the parameter. It is case
11931    /// sensitive.
11932    pub url_query_parameter: std::string::String,
11933
11934    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11935}
11936
11937impl SystemParameter {
11938    /// Creates a new default instance.
11939    pub fn new() -> Self {
11940        std::default::Default::default()
11941    }
11942
11943    /// Sets the value of [name][crate::model::SystemParameter::name].
11944    ///
11945    /// # Example
11946    /// ```ignore,no_run
11947    /// # use google_cloud_api::model::SystemParameter;
11948    /// let x = SystemParameter::new().set_name("example");
11949    /// ```
11950    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11951        self.name = v.into();
11952        self
11953    }
11954
11955    /// Sets the value of [http_header][crate::model::SystemParameter::http_header].
11956    ///
11957    /// # Example
11958    /// ```ignore,no_run
11959    /// # use google_cloud_api::model::SystemParameter;
11960    /// let x = SystemParameter::new().set_http_header("example");
11961    /// ```
11962    pub fn set_http_header<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11963        self.http_header = v.into();
11964        self
11965    }
11966
11967    /// Sets the value of [url_query_parameter][crate::model::SystemParameter::url_query_parameter].
11968    ///
11969    /// # Example
11970    /// ```ignore,no_run
11971    /// # use google_cloud_api::model::SystemParameter;
11972    /// let x = SystemParameter::new().set_url_query_parameter("example");
11973    /// ```
11974    pub fn set_url_query_parameter<T: std::convert::Into<std::string::String>>(
11975        mut self,
11976        v: T,
11977    ) -> Self {
11978        self.url_query_parameter = v.into();
11979        self
11980    }
11981}
11982
11983impl wkt::message::Message for SystemParameter {
11984    fn typename() -> &'static str {
11985        "type.googleapis.com/google.api.SystemParameter"
11986    }
11987}
11988
11989/// Configuration controlling usage of a service.
11990#[derive(Clone, Default, PartialEq)]
11991#[non_exhaustive]
11992pub struct Usage {
11993    /// Requirements that must be satisfied before a consumer project can use the
11994    /// service. Each requirement is of the form <service.name>/\<requirement-id\>;
11995    /// for example 'serviceusage.googleapis.com/billing-enabled'.
11996    ///
11997    /// For Google APIs, a Terms of Service requirement must be included here.
11998    /// Google Cloud APIs must include "serviceusage.googleapis.com/tos/cloud".
11999    /// Other Google APIs should include
12000    /// "serviceusage.googleapis.com/tos/universal". Additional ToS can be
12001    /// included based on the business needs.
12002    pub requirements: std::vec::Vec<std::string::String>,
12003
12004    /// A list of usage rules that apply to individual API methods.
12005    ///
12006    /// **NOTE:** All service configuration rules follow "last one wins" order.
12007    pub rules: std::vec::Vec<crate::model::UsageRule>,
12008
12009    /// The full resource name of a channel used for sending notifications to the
12010    /// service producer.
12011    ///
12012    /// Google Service Management currently only supports
12013    /// [Google Cloud Pub/Sub](https://cloud.google.com/pubsub) as a notification
12014    /// channel. To use Google Cloud Pub/Sub as the channel, this must be the name
12015    /// of a Cloud Pub/Sub topic that uses the Cloud Pub/Sub topic name format
12016    /// documented in <https://cloud.google.com/pubsub/docs/overview>.
12017    pub producer_notification_channel: std::string::String,
12018
12019    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12020}
12021
12022impl Usage {
12023    /// Creates a new default instance.
12024    pub fn new() -> Self {
12025        std::default::Default::default()
12026    }
12027
12028    /// Sets the value of [requirements][crate::model::Usage::requirements].
12029    ///
12030    /// # Example
12031    /// ```ignore,no_run
12032    /// # use google_cloud_api::model::Usage;
12033    /// let x = Usage::new().set_requirements(["a", "b", "c"]);
12034    /// ```
12035    pub fn set_requirements<T, V>(mut self, v: T) -> Self
12036    where
12037        T: std::iter::IntoIterator<Item = V>,
12038        V: std::convert::Into<std::string::String>,
12039    {
12040        use std::iter::Iterator;
12041        self.requirements = v.into_iter().map(|i| i.into()).collect();
12042        self
12043    }
12044
12045    /// Sets the value of [rules][crate::model::Usage::rules].
12046    ///
12047    /// # Example
12048    /// ```ignore,no_run
12049    /// # use google_cloud_api::model::Usage;
12050    /// use google_cloud_api::model::UsageRule;
12051    /// let x = Usage::new()
12052    ///     .set_rules([
12053    ///         UsageRule::default()/* use setters */,
12054    ///         UsageRule::default()/* use (different) setters */,
12055    ///     ]);
12056    /// ```
12057    pub fn set_rules<T, V>(mut self, v: T) -> Self
12058    where
12059        T: std::iter::IntoIterator<Item = V>,
12060        V: std::convert::Into<crate::model::UsageRule>,
12061    {
12062        use std::iter::Iterator;
12063        self.rules = v.into_iter().map(|i| i.into()).collect();
12064        self
12065    }
12066
12067    /// Sets the value of [producer_notification_channel][crate::model::Usage::producer_notification_channel].
12068    ///
12069    /// # Example
12070    /// ```ignore,no_run
12071    /// # use google_cloud_api::model::Usage;
12072    /// let x = Usage::new().set_producer_notification_channel("example");
12073    /// ```
12074    pub fn set_producer_notification_channel<T: std::convert::Into<std::string::String>>(
12075        mut self,
12076        v: T,
12077    ) -> Self {
12078        self.producer_notification_channel = v.into();
12079        self
12080    }
12081}
12082
12083impl wkt::message::Message for Usage {
12084    fn typename() -> &'static str {
12085        "type.googleapis.com/google.api.Usage"
12086    }
12087}
12088
12089/// Usage configuration rules for the service.
12090#[derive(Clone, Default, PartialEq)]
12091#[non_exhaustive]
12092pub struct UsageRule {
12093    /// Selects the methods to which this rule applies. Use '*' to indicate all
12094    /// methods in all APIs.
12095    ///
12096    /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
12097    /// details.
12098    ///
12099    /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
12100    pub selector: std::string::String,
12101
12102    /// Use this rule to configure unregistered calls for the service. Unregistered
12103    /// calls are calls that do not contain consumer project identity.
12104    /// (Example: calls that do not contain an API key).
12105    ///
12106    /// WARNING: By default, API methods do not allow unregistered calls, and each
12107    /// method call must be identified by a consumer project identity.
12108    pub allow_unregistered_calls: bool,
12109
12110    /// If true, the selected method should skip service control and the control
12111    /// plane features, such as quota and billing, will not be available.
12112    /// This flag is used by Google Cloud Endpoints to bypass checks for internal
12113    /// methods, such as service health check methods.
12114    pub skip_service_control: bool,
12115
12116    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12117}
12118
12119impl UsageRule {
12120    /// Creates a new default instance.
12121    pub fn new() -> Self {
12122        std::default::Default::default()
12123    }
12124
12125    /// Sets the value of [selector][crate::model::UsageRule::selector].
12126    ///
12127    /// # Example
12128    /// ```ignore,no_run
12129    /// # use google_cloud_api::model::UsageRule;
12130    /// let x = UsageRule::new().set_selector("example");
12131    /// ```
12132    pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12133        self.selector = v.into();
12134        self
12135    }
12136
12137    /// Sets the value of [allow_unregistered_calls][crate::model::UsageRule::allow_unregistered_calls].
12138    ///
12139    /// # Example
12140    /// ```ignore,no_run
12141    /// # use google_cloud_api::model::UsageRule;
12142    /// let x = UsageRule::new().set_allow_unregistered_calls(true);
12143    /// ```
12144    pub fn set_allow_unregistered_calls<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12145        self.allow_unregistered_calls = v.into();
12146        self
12147    }
12148
12149    /// Sets the value of [skip_service_control][crate::model::UsageRule::skip_service_control].
12150    ///
12151    /// # Example
12152    /// ```ignore,no_run
12153    /// # use google_cloud_api::model::UsageRule;
12154    /// let x = UsageRule::new().set_skip_service_control(true);
12155    /// ```
12156    pub fn set_skip_service_control<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12157        self.skip_service_control = v.into();
12158        self
12159    }
12160}
12161
12162impl wkt::message::Message for UsageRule {
12163    fn typename() -> &'static str {
12164        "type.googleapis.com/google.api.UsageRule"
12165    }
12166}
12167
12168/// `Visibility` restricts service consumer's access to service elements,
12169/// such as whether an application can call a visibility-restricted method.
12170/// The restriction is expressed by applying visibility labels on service
12171/// elements. The visibility labels are elsewhere linked to service consumers.
12172///
12173/// A service can define multiple visibility labels, but a service consumer
12174/// should be granted at most one visibility label. Multiple visibility
12175/// labels for a single service consumer are not supported.
12176///
12177/// If an element and all its parents have no visibility label, its visibility
12178/// is unconditionally granted.
12179///
12180/// Example:
12181///
12182/// ```norust
12183/// visibility:
12184///   rules:
12185///   - selector: google.calendar.Calendar.EnhancedSearch
12186///     restriction: PREVIEW
12187///   - selector: google.calendar.Calendar.Delegate
12188///     restriction: INTERNAL
12189/// ```
12190///
12191/// Here, all methods are publicly visible except for the restricted methods
12192/// EnhancedSearch and Delegate.
12193#[derive(Clone, Default, PartialEq)]
12194#[non_exhaustive]
12195pub struct Visibility {
12196    /// A list of visibility rules that apply to individual API elements.
12197    ///
12198    /// **NOTE:** All service configuration rules follow "last one wins" order.
12199    pub rules: std::vec::Vec<crate::model::VisibilityRule>,
12200
12201    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12202}
12203
12204impl Visibility {
12205    /// Creates a new default instance.
12206    pub fn new() -> Self {
12207        std::default::Default::default()
12208    }
12209
12210    /// Sets the value of [rules][crate::model::Visibility::rules].
12211    ///
12212    /// # Example
12213    /// ```ignore,no_run
12214    /// # use google_cloud_api::model::Visibility;
12215    /// use google_cloud_api::model::VisibilityRule;
12216    /// let x = Visibility::new()
12217    ///     .set_rules([
12218    ///         VisibilityRule::default()/* use setters */,
12219    ///         VisibilityRule::default()/* use (different) setters */,
12220    ///     ]);
12221    /// ```
12222    pub fn set_rules<T, V>(mut self, v: T) -> Self
12223    where
12224        T: std::iter::IntoIterator<Item = V>,
12225        V: std::convert::Into<crate::model::VisibilityRule>,
12226    {
12227        use std::iter::Iterator;
12228        self.rules = v.into_iter().map(|i| i.into()).collect();
12229        self
12230    }
12231}
12232
12233impl wkt::message::Message for Visibility {
12234    fn typename() -> &'static str {
12235        "type.googleapis.com/google.api.Visibility"
12236    }
12237}
12238
12239/// A visibility rule provides visibility configuration for an individual API
12240/// element.
12241#[derive(Clone, Default, PartialEq)]
12242#[non_exhaustive]
12243pub struct VisibilityRule {
12244    /// Selects methods, messages, fields, enums, etc. to which this rule applies.
12245    ///
12246    /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
12247    /// details.
12248    ///
12249    /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
12250    pub selector: std::string::String,
12251
12252    /// A comma-separated list of visibility labels that apply to the `selector`.
12253    /// Any of the listed labels can be used to grant the visibility.
12254    ///
12255    /// If a rule has multiple labels, removing one of the labels but not all of
12256    /// them can break clients.
12257    ///
12258    /// Example:
12259    ///
12260    /// ```norust
12261    /// visibility:
12262    ///   rules:
12263    ///   - selector: google.calendar.Calendar.EnhancedSearch
12264    ///     restriction: INTERNAL, PREVIEW
12265    /// ```
12266    ///
12267    /// Removing INTERNAL from this restriction will break clients that rely on
12268    /// this method and only had access to it through INTERNAL.
12269    pub restriction: std::string::String,
12270
12271    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12272}
12273
12274impl VisibilityRule {
12275    /// Creates a new default instance.
12276    pub fn new() -> Self {
12277        std::default::Default::default()
12278    }
12279
12280    /// Sets the value of [selector][crate::model::VisibilityRule::selector].
12281    ///
12282    /// # Example
12283    /// ```ignore,no_run
12284    /// # use google_cloud_api::model::VisibilityRule;
12285    /// let x = VisibilityRule::new().set_selector("example");
12286    /// ```
12287    pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12288        self.selector = v.into();
12289        self
12290    }
12291
12292    /// Sets the value of [restriction][crate::model::VisibilityRule::restriction].
12293    ///
12294    /// # Example
12295    /// ```ignore,no_run
12296    /// # use google_cloud_api::model::VisibilityRule;
12297    /// let x = VisibilityRule::new().set_restriction("example");
12298    /// ```
12299    pub fn set_restriction<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12300        self.restriction = v.into();
12301        self
12302    }
12303}
12304
12305impl wkt::message::Message for VisibilityRule {
12306    fn typename() -> &'static str {
12307        "type.googleapis.com/google.api.VisibilityRule"
12308    }
12309}
12310
12311/// The organization for which the client libraries are being published.
12312/// Affects the url where generated docs are published, etc.
12313///
12314/// # Working with unknown values
12315///
12316/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12317/// additional enum variants at any time. Adding new variants is not considered
12318/// a breaking change. Applications should write their code in anticipation of:
12319///
12320/// - New values appearing in future releases of the client library, **and**
12321/// - New values received dynamically, without application changes.
12322///
12323/// Please consult the [Working with enums] section in the user guide for some
12324/// guidelines.
12325///
12326/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
12327#[derive(Clone, Debug, PartialEq)]
12328#[non_exhaustive]
12329pub enum ClientLibraryOrganization {
12330    /// Not useful.
12331    Unspecified,
12332    /// Google Cloud Platform Org.
12333    Cloud,
12334    /// Ads (Advertising) Org.
12335    Ads,
12336    /// Photos Org.
12337    Photos,
12338    /// Street View Org.
12339    StreetView,
12340    /// Shopping Org.
12341    Shopping,
12342    /// Geo Org.
12343    Geo,
12344    /// Generative AI - <https://developers.generativeai.google>
12345    GenerativeAi,
12346    /// If set, the enum was initialized with an unknown value.
12347    ///
12348    /// Applications can examine the value using [ClientLibraryOrganization::value] or
12349    /// [ClientLibraryOrganization::name].
12350    UnknownValue(client_library_organization::UnknownValue),
12351}
12352
12353#[doc(hidden)]
12354pub mod client_library_organization {
12355    #[allow(unused_imports)]
12356    use super::*;
12357    #[derive(Clone, Debug, PartialEq)]
12358    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
12359}
12360
12361impl ClientLibraryOrganization {
12362    /// Gets the enum value.
12363    ///
12364    /// Returns `None` if the enum contains an unknown value deserialized from
12365    /// the string representation of enums.
12366    pub fn value(&self) -> std::option::Option<i32> {
12367        match self {
12368            Self::Unspecified => std::option::Option::Some(0),
12369            Self::Cloud => std::option::Option::Some(1),
12370            Self::Ads => std::option::Option::Some(2),
12371            Self::Photos => std::option::Option::Some(3),
12372            Self::StreetView => std::option::Option::Some(4),
12373            Self::Shopping => std::option::Option::Some(5),
12374            Self::Geo => std::option::Option::Some(6),
12375            Self::GenerativeAi => std::option::Option::Some(7),
12376            Self::UnknownValue(u) => u.0.value(),
12377        }
12378    }
12379
12380    /// Gets the enum value as a string.
12381    ///
12382    /// Returns `None` if the enum contains an unknown value deserialized from
12383    /// the integer representation of enums.
12384    pub fn name(&self) -> std::option::Option<&str> {
12385        match self {
12386            Self::Unspecified => {
12387                std::option::Option::Some("CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED")
12388            }
12389            Self::Cloud => std::option::Option::Some("CLOUD"),
12390            Self::Ads => std::option::Option::Some("ADS"),
12391            Self::Photos => std::option::Option::Some("PHOTOS"),
12392            Self::StreetView => std::option::Option::Some("STREET_VIEW"),
12393            Self::Shopping => std::option::Option::Some("SHOPPING"),
12394            Self::Geo => std::option::Option::Some("GEO"),
12395            Self::GenerativeAi => std::option::Option::Some("GENERATIVE_AI"),
12396            Self::UnknownValue(u) => u.0.name(),
12397        }
12398    }
12399}
12400
12401impl std::default::Default for ClientLibraryOrganization {
12402    fn default() -> Self {
12403        use std::convert::From;
12404        Self::from(0)
12405    }
12406}
12407
12408impl std::fmt::Display for ClientLibraryOrganization {
12409    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
12410        wkt::internal::display_enum(f, self.name(), self.value())
12411    }
12412}
12413
12414impl std::convert::From<i32> for ClientLibraryOrganization {
12415    fn from(value: i32) -> Self {
12416        match value {
12417            0 => Self::Unspecified,
12418            1 => Self::Cloud,
12419            2 => Self::Ads,
12420            3 => Self::Photos,
12421            4 => Self::StreetView,
12422            5 => Self::Shopping,
12423            6 => Self::Geo,
12424            7 => Self::GenerativeAi,
12425            _ => Self::UnknownValue(client_library_organization::UnknownValue(
12426                wkt::internal::UnknownEnumValue::Integer(value),
12427            )),
12428        }
12429    }
12430}
12431
12432impl std::convert::From<&str> for ClientLibraryOrganization {
12433    fn from(value: &str) -> Self {
12434        use std::string::ToString;
12435        match value {
12436            "CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED" => Self::Unspecified,
12437            "CLOUD" => Self::Cloud,
12438            "ADS" => Self::Ads,
12439            "PHOTOS" => Self::Photos,
12440            "STREET_VIEW" => Self::StreetView,
12441            "SHOPPING" => Self::Shopping,
12442            "GEO" => Self::Geo,
12443            "GENERATIVE_AI" => Self::GenerativeAi,
12444            _ => Self::UnknownValue(client_library_organization::UnknownValue(
12445                wkt::internal::UnknownEnumValue::String(value.to_string()),
12446            )),
12447        }
12448    }
12449}
12450
12451impl serde::ser::Serialize for ClientLibraryOrganization {
12452    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12453    where
12454        S: serde::Serializer,
12455    {
12456        match self {
12457            Self::Unspecified => serializer.serialize_i32(0),
12458            Self::Cloud => serializer.serialize_i32(1),
12459            Self::Ads => serializer.serialize_i32(2),
12460            Self::Photos => serializer.serialize_i32(3),
12461            Self::StreetView => serializer.serialize_i32(4),
12462            Self::Shopping => serializer.serialize_i32(5),
12463            Self::Geo => serializer.serialize_i32(6),
12464            Self::GenerativeAi => serializer.serialize_i32(7),
12465            Self::UnknownValue(u) => u.0.serialize(serializer),
12466        }
12467    }
12468}
12469
12470impl<'de> serde::de::Deserialize<'de> for ClientLibraryOrganization {
12471    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12472    where
12473        D: serde::Deserializer<'de>,
12474    {
12475        deserializer.deserialize_any(
12476            wkt::internal::EnumVisitor::<ClientLibraryOrganization>::new(
12477                ".google.api.ClientLibraryOrganization",
12478            ),
12479        )
12480    }
12481}
12482
12483/// To where should client libraries be published?
12484///
12485/// # Working with unknown values
12486///
12487/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12488/// additional enum variants at any time. Adding new variants is not considered
12489/// a breaking change. Applications should write their code in anticipation of:
12490///
12491/// - New values appearing in future releases of the client library, **and**
12492/// - New values received dynamically, without application changes.
12493///
12494/// Please consult the [Working with enums] section in the user guide for some
12495/// guidelines.
12496///
12497/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
12498#[derive(Clone, Debug, PartialEq)]
12499#[non_exhaustive]
12500pub enum ClientLibraryDestination {
12501    /// Client libraries will neither be generated nor published to package
12502    /// managers.
12503    Unspecified,
12504    /// Generate the client library in a repo under github.com/googleapis,
12505    /// but don't publish it to package managers.
12506    Github,
12507    /// Publish the library to package managers like nuget.org and npmjs.com.
12508    PackageManager,
12509    /// If set, the enum was initialized with an unknown value.
12510    ///
12511    /// Applications can examine the value using [ClientLibraryDestination::value] or
12512    /// [ClientLibraryDestination::name].
12513    UnknownValue(client_library_destination::UnknownValue),
12514}
12515
12516#[doc(hidden)]
12517pub mod client_library_destination {
12518    #[allow(unused_imports)]
12519    use super::*;
12520    #[derive(Clone, Debug, PartialEq)]
12521    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
12522}
12523
12524impl ClientLibraryDestination {
12525    /// Gets the enum value.
12526    ///
12527    /// Returns `None` if the enum contains an unknown value deserialized from
12528    /// the string representation of enums.
12529    pub fn value(&self) -> std::option::Option<i32> {
12530        match self {
12531            Self::Unspecified => std::option::Option::Some(0),
12532            Self::Github => std::option::Option::Some(10),
12533            Self::PackageManager => std::option::Option::Some(20),
12534            Self::UnknownValue(u) => u.0.value(),
12535        }
12536    }
12537
12538    /// Gets the enum value as a string.
12539    ///
12540    /// Returns `None` if the enum contains an unknown value deserialized from
12541    /// the integer representation of enums.
12542    pub fn name(&self) -> std::option::Option<&str> {
12543        match self {
12544            Self::Unspecified => {
12545                std::option::Option::Some("CLIENT_LIBRARY_DESTINATION_UNSPECIFIED")
12546            }
12547            Self::Github => std::option::Option::Some("GITHUB"),
12548            Self::PackageManager => std::option::Option::Some("PACKAGE_MANAGER"),
12549            Self::UnknownValue(u) => u.0.name(),
12550        }
12551    }
12552}
12553
12554impl std::default::Default for ClientLibraryDestination {
12555    fn default() -> Self {
12556        use std::convert::From;
12557        Self::from(0)
12558    }
12559}
12560
12561impl std::fmt::Display for ClientLibraryDestination {
12562    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
12563        wkt::internal::display_enum(f, self.name(), self.value())
12564    }
12565}
12566
12567impl std::convert::From<i32> for ClientLibraryDestination {
12568    fn from(value: i32) -> Self {
12569        match value {
12570            0 => Self::Unspecified,
12571            10 => Self::Github,
12572            20 => Self::PackageManager,
12573            _ => Self::UnknownValue(client_library_destination::UnknownValue(
12574                wkt::internal::UnknownEnumValue::Integer(value),
12575            )),
12576        }
12577    }
12578}
12579
12580impl std::convert::From<&str> for ClientLibraryDestination {
12581    fn from(value: &str) -> Self {
12582        use std::string::ToString;
12583        match value {
12584            "CLIENT_LIBRARY_DESTINATION_UNSPECIFIED" => Self::Unspecified,
12585            "GITHUB" => Self::Github,
12586            "PACKAGE_MANAGER" => Self::PackageManager,
12587            _ => Self::UnknownValue(client_library_destination::UnknownValue(
12588                wkt::internal::UnknownEnumValue::String(value.to_string()),
12589            )),
12590        }
12591    }
12592}
12593
12594impl serde::ser::Serialize for ClientLibraryDestination {
12595    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12596    where
12597        S: serde::Serializer,
12598    {
12599        match self {
12600            Self::Unspecified => serializer.serialize_i32(0),
12601            Self::Github => serializer.serialize_i32(10),
12602            Self::PackageManager => serializer.serialize_i32(20),
12603            Self::UnknownValue(u) => u.0.serialize(serializer),
12604        }
12605    }
12606}
12607
12608impl<'de> serde::de::Deserialize<'de> for ClientLibraryDestination {
12609    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12610    where
12611        D: serde::Deserializer<'de>,
12612    {
12613        deserializer.deserialize_any(wkt::internal::EnumVisitor::<ClientLibraryDestination>::new(
12614            ".google.api.ClientLibraryDestination",
12615        ))
12616    }
12617}
12618
12619/// The behavior to take when the flow control limit is exceeded.
12620///
12621/// # Working with unknown values
12622///
12623/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12624/// additional enum variants at any time. Adding new variants is not considered
12625/// a breaking change. Applications should write their code in anticipation of:
12626///
12627/// - New values appearing in future releases of the client library, **and**
12628/// - New values received dynamically, without application changes.
12629///
12630/// Please consult the [Working with enums] section in the user guide for some
12631/// guidelines.
12632///
12633/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
12634#[derive(Clone, Debug, PartialEq)]
12635#[non_exhaustive]
12636pub enum FlowControlLimitExceededBehaviorProto {
12637    /// Default behavior, system-defined.
12638    UnsetBehavior,
12639    /// Stop operation, raise error.
12640    ThrowException,
12641    /// Pause operation until limit clears.
12642    Block,
12643    /// Continue operation, disregard limit.
12644    Ignore,
12645    /// If set, the enum was initialized with an unknown value.
12646    ///
12647    /// Applications can examine the value using [FlowControlLimitExceededBehaviorProto::value] or
12648    /// [FlowControlLimitExceededBehaviorProto::name].
12649    UnknownValue(flow_control_limit_exceeded_behavior_proto::UnknownValue),
12650}
12651
12652#[doc(hidden)]
12653pub mod flow_control_limit_exceeded_behavior_proto {
12654    #[allow(unused_imports)]
12655    use super::*;
12656    #[derive(Clone, Debug, PartialEq)]
12657    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
12658}
12659
12660impl FlowControlLimitExceededBehaviorProto {
12661    /// Gets the enum value.
12662    ///
12663    /// Returns `None` if the enum contains an unknown value deserialized from
12664    /// the string representation of enums.
12665    pub fn value(&self) -> std::option::Option<i32> {
12666        match self {
12667            Self::UnsetBehavior => std::option::Option::Some(0),
12668            Self::ThrowException => std::option::Option::Some(1),
12669            Self::Block => std::option::Option::Some(2),
12670            Self::Ignore => std::option::Option::Some(3),
12671            Self::UnknownValue(u) => u.0.value(),
12672        }
12673    }
12674
12675    /// Gets the enum value as a string.
12676    ///
12677    /// Returns `None` if the enum contains an unknown value deserialized from
12678    /// the integer representation of enums.
12679    pub fn name(&self) -> std::option::Option<&str> {
12680        match self {
12681            Self::UnsetBehavior => std::option::Option::Some("UNSET_BEHAVIOR"),
12682            Self::ThrowException => std::option::Option::Some("THROW_EXCEPTION"),
12683            Self::Block => std::option::Option::Some("BLOCK"),
12684            Self::Ignore => std::option::Option::Some("IGNORE"),
12685            Self::UnknownValue(u) => u.0.name(),
12686        }
12687    }
12688}
12689
12690impl std::default::Default for FlowControlLimitExceededBehaviorProto {
12691    fn default() -> Self {
12692        use std::convert::From;
12693        Self::from(0)
12694    }
12695}
12696
12697impl std::fmt::Display for FlowControlLimitExceededBehaviorProto {
12698    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
12699        wkt::internal::display_enum(f, self.name(), self.value())
12700    }
12701}
12702
12703impl std::convert::From<i32> for FlowControlLimitExceededBehaviorProto {
12704    fn from(value: i32) -> Self {
12705        match value {
12706            0 => Self::UnsetBehavior,
12707            1 => Self::ThrowException,
12708            2 => Self::Block,
12709            3 => Self::Ignore,
12710            _ => Self::UnknownValue(flow_control_limit_exceeded_behavior_proto::UnknownValue(
12711                wkt::internal::UnknownEnumValue::Integer(value),
12712            )),
12713        }
12714    }
12715}
12716
12717impl std::convert::From<&str> for FlowControlLimitExceededBehaviorProto {
12718    fn from(value: &str) -> Self {
12719        use std::string::ToString;
12720        match value {
12721            "UNSET_BEHAVIOR" => Self::UnsetBehavior,
12722            "THROW_EXCEPTION" => Self::ThrowException,
12723            "BLOCK" => Self::Block,
12724            "IGNORE" => Self::Ignore,
12725            _ => Self::UnknownValue(flow_control_limit_exceeded_behavior_proto::UnknownValue(
12726                wkt::internal::UnknownEnumValue::String(value.to_string()),
12727            )),
12728        }
12729    }
12730}
12731
12732impl serde::ser::Serialize for FlowControlLimitExceededBehaviorProto {
12733    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12734    where
12735        S: serde::Serializer,
12736    {
12737        match self {
12738            Self::UnsetBehavior => serializer.serialize_i32(0),
12739            Self::ThrowException => serializer.serialize_i32(1),
12740            Self::Block => serializer.serialize_i32(2),
12741            Self::Ignore => serializer.serialize_i32(3),
12742            Self::UnknownValue(u) => u.0.serialize(serializer),
12743        }
12744    }
12745}
12746
12747impl<'de> serde::de::Deserialize<'de> for FlowControlLimitExceededBehaviorProto {
12748    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12749    where
12750        D: serde::Deserializer<'de>,
12751    {
12752        deserializer.deserialize_any(wkt::internal::EnumVisitor::<
12753            FlowControlLimitExceededBehaviorProto,
12754        >::new(
12755            ".google.api.FlowControlLimitExceededBehaviorProto"
12756        ))
12757    }
12758}
12759
12760/// Classifies set of possible modifications to an object in the service
12761/// configuration.
12762///
12763/// # Working with unknown values
12764///
12765/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12766/// additional enum variants at any time. Adding new variants is not considered
12767/// a breaking change. Applications should write their code in anticipation of:
12768///
12769/// - New values appearing in future releases of the client library, **and**
12770/// - New values received dynamically, without application changes.
12771///
12772/// Please consult the [Working with enums] section in the user guide for some
12773/// guidelines.
12774///
12775/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
12776#[derive(Clone, Debug, PartialEq)]
12777#[non_exhaustive]
12778pub enum ChangeType {
12779    /// No value was provided.
12780    Unspecified,
12781    /// The changed object exists in the 'new' service configuration, but not
12782    /// in the 'old' service configuration.
12783    Added,
12784    /// The changed object exists in the 'old' service configuration, but not
12785    /// in the 'new' service configuration.
12786    Removed,
12787    /// The changed object exists in both service configurations, but its value
12788    /// is different.
12789    Modified,
12790    /// If set, the enum was initialized with an unknown value.
12791    ///
12792    /// Applications can examine the value using [ChangeType::value] or
12793    /// [ChangeType::name].
12794    UnknownValue(change_type::UnknownValue),
12795}
12796
12797#[doc(hidden)]
12798pub mod change_type {
12799    #[allow(unused_imports)]
12800    use super::*;
12801    #[derive(Clone, Debug, PartialEq)]
12802    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
12803}
12804
12805impl ChangeType {
12806    /// Gets the enum value.
12807    ///
12808    /// Returns `None` if the enum contains an unknown value deserialized from
12809    /// the string representation of enums.
12810    pub fn value(&self) -> std::option::Option<i32> {
12811        match self {
12812            Self::Unspecified => std::option::Option::Some(0),
12813            Self::Added => std::option::Option::Some(1),
12814            Self::Removed => std::option::Option::Some(2),
12815            Self::Modified => std::option::Option::Some(3),
12816            Self::UnknownValue(u) => u.0.value(),
12817        }
12818    }
12819
12820    /// Gets the enum value as a string.
12821    ///
12822    /// Returns `None` if the enum contains an unknown value deserialized from
12823    /// the integer representation of enums.
12824    pub fn name(&self) -> std::option::Option<&str> {
12825        match self {
12826            Self::Unspecified => std::option::Option::Some("CHANGE_TYPE_UNSPECIFIED"),
12827            Self::Added => std::option::Option::Some("ADDED"),
12828            Self::Removed => std::option::Option::Some("REMOVED"),
12829            Self::Modified => std::option::Option::Some("MODIFIED"),
12830            Self::UnknownValue(u) => u.0.name(),
12831        }
12832    }
12833}
12834
12835impl std::default::Default for ChangeType {
12836    fn default() -> Self {
12837        use std::convert::From;
12838        Self::from(0)
12839    }
12840}
12841
12842impl std::fmt::Display for ChangeType {
12843    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
12844        wkt::internal::display_enum(f, self.name(), self.value())
12845    }
12846}
12847
12848impl std::convert::From<i32> for ChangeType {
12849    fn from(value: i32) -> Self {
12850        match value {
12851            0 => Self::Unspecified,
12852            1 => Self::Added,
12853            2 => Self::Removed,
12854            3 => Self::Modified,
12855            _ => Self::UnknownValue(change_type::UnknownValue(
12856                wkt::internal::UnknownEnumValue::Integer(value),
12857            )),
12858        }
12859    }
12860}
12861
12862impl std::convert::From<&str> for ChangeType {
12863    fn from(value: &str) -> Self {
12864        use std::string::ToString;
12865        match value {
12866            "CHANGE_TYPE_UNSPECIFIED" => Self::Unspecified,
12867            "ADDED" => Self::Added,
12868            "REMOVED" => Self::Removed,
12869            "MODIFIED" => Self::Modified,
12870            _ => Self::UnknownValue(change_type::UnknownValue(
12871                wkt::internal::UnknownEnumValue::String(value.to_string()),
12872            )),
12873        }
12874    }
12875}
12876
12877impl serde::ser::Serialize for ChangeType {
12878    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12879    where
12880        S: serde::Serializer,
12881    {
12882        match self {
12883            Self::Unspecified => serializer.serialize_i32(0),
12884            Self::Added => serializer.serialize_i32(1),
12885            Self::Removed => serializer.serialize_i32(2),
12886            Self::Modified => serializer.serialize_i32(3),
12887            Self::UnknownValue(u) => u.0.serialize(serializer),
12888        }
12889    }
12890}
12891
12892impl<'de> serde::de::Deserialize<'de> for ChangeType {
12893    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12894    where
12895        D: serde::Deserializer<'de>,
12896    {
12897        deserializer.deserialize_any(wkt::internal::EnumVisitor::<ChangeType>::new(
12898            ".google.api.ChangeType",
12899        ))
12900    }
12901}
12902
12903/// Defines the supported values for `google.rpc.ErrorInfo.reason` for the
12904/// `googleapis.com` error domain. This error domain is reserved for [Service
12905/// Infrastructure](https://cloud.google.com/service-infrastructure/docs/overview).
12906/// For each error info of this domain, the metadata key "service" refers to the
12907/// logical identifier of an API service, such as "pubsub.googleapis.com". The
12908/// "consumer" refers to the entity that consumes an API Service. It typically is
12909/// a Google project that owns the client application or the server resource,
12910/// such as "projects/123". Other metadata keys are specific to each error
12911/// reason. For more information, see the definition of the specific error
12912/// reason.
12913///
12914/// # Working with unknown values
12915///
12916/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12917/// additional enum variants at any time. Adding new variants is not considered
12918/// a breaking change. Applications should write their code in anticipation of:
12919///
12920/// - New values appearing in future releases of the client library, **and**
12921/// - New values received dynamically, without application changes.
12922///
12923/// Please consult the [Working with enums] section in the user guide for some
12924/// guidelines.
12925///
12926/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
12927#[derive(Clone, Debug, PartialEq)]
12928#[non_exhaustive]
12929pub enum ErrorReason {
12930    /// Do not use this default value.
12931    Unspecified,
12932    /// The request is calling a disabled service for a consumer.
12933    ///
12934    /// Example of an ErrorInfo when the consumer "projects/123" contacting
12935    /// "pubsub.googleapis.com" service which is disabled:
12936    ///
12937    /// ```norust
12938    /// { "reason": "SERVICE_DISABLED",
12939    ///   "domain": "googleapis.com",
12940    ///   "metadata": {
12941    ///     "consumer": "projects/123",
12942    ///     "service": "pubsub.googleapis.com"
12943    ///   }
12944    /// }
12945    /// ```
12946    ///
12947    /// This response indicates the "pubsub.googleapis.com" has been disabled in
12948    /// "projects/123".
12949    ServiceDisabled,
12950    /// The request whose associated billing account is disabled.
12951    ///
12952    /// Example of an ErrorInfo when the consumer "projects/123" fails to contact
12953    /// "pubsub.googleapis.com" service because the associated billing account is
12954    /// disabled:
12955    ///
12956    /// ```norust
12957    /// { "reason": "BILLING_DISABLED",
12958    ///   "domain": "googleapis.com",
12959    ///   "metadata": {
12960    ///     "consumer": "projects/123",
12961    ///     "service": "pubsub.googleapis.com"
12962    ///   }
12963    /// }
12964    /// ```
12965    ///
12966    /// This response indicates the billing account associated has been disabled.
12967    BillingDisabled,
12968    /// The request is denied because the provided [API
12969    /// key](https://cloud.google.com/docs/authentication/api-keys) is invalid. It
12970    /// may be in a bad format, cannot be found, or has been expired).
12971    ///
12972    /// Example of an ErrorInfo when the request is contacting
12973    /// "storage.googleapis.com" service with an invalid API key:
12974    ///
12975    /// ```norust
12976    /// { "reason": "API_KEY_INVALID",
12977    ///   "domain": "googleapis.com",
12978    ///   "metadata": {
12979    ///     "service": "storage.googleapis.com",
12980    ///   }
12981    /// }
12982    /// ```
12983    ApiKeyInvalid,
12984    /// The request is denied because it violates [API key API
12985    /// restrictions](https://cloud.google.com/docs/authentication/api-keys#adding_api_restrictions).
12986    ///
12987    /// Example of an ErrorInfo when the consumer "projects/123" fails to call the
12988    /// "storage.googleapis.com" service because this service is restricted in the
12989    /// API key:
12990    ///
12991    /// ```norust
12992    /// { "reason": "API_KEY_SERVICE_BLOCKED",
12993    ///   "domain": "googleapis.com",
12994    ///   "metadata": {
12995    ///     "consumer": "projects/123",
12996    ///     "service": "storage.googleapis.com"
12997    ///   }
12998    /// }
12999    /// ```
13000    ApiKeyServiceBlocked,
13001    /// The request is denied because it violates [API key HTTP
13002    /// restrictions](https://cloud.google.com/docs/authentication/api-keys#adding_http_restrictions).
13003    ///
13004    /// Example of an ErrorInfo when the consumer "projects/123" fails to call
13005    /// "storage.googleapis.com" service because the http referrer of the request
13006    /// violates API key HTTP restrictions:
13007    ///
13008    /// ```norust
13009    /// { "reason": "API_KEY_HTTP_REFERRER_BLOCKED",
13010    ///   "domain": "googleapis.com",
13011    ///   "metadata": {
13012    ///     "consumer": "projects/123",
13013    ///     "service": "storage.googleapis.com",
13014    ///   }
13015    /// }
13016    /// ```
13017    ApiKeyHttpReferrerBlocked,
13018    /// The request is denied because it violates [API key IP address
13019    /// restrictions](https://cloud.google.com/docs/authentication/api-keys#adding_application_restrictions).
13020    ///
13021    /// Example of an ErrorInfo when the consumer "projects/123" fails to call
13022    /// "storage.googleapis.com" service because the caller IP of the request
13023    /// violates API key IP address restrictions:
13024    ///
13025    /// ```norust
13026    /// { "reason": "API_KEY_IP_ADDRESS_BLOCKED",
13027    ///   "domain": "googleapis.com",
13028    ///   "metadata": {
13029    ///     "consumer": "projects/123",
13030    ///     "service": "storage.googleapis.com",
13031    ///   }
13032    /// }
13033    /// ```
13034    ApiKeyIpAddressBlocked,
13035    /// The request is denied because it violates [API key Android application
13036    /// restrictions](https://cloud.google.com/docs/authentication/api-keys#adding_application_restrictions).
13037    ///
13038    /// Example of an ErrorInfo when the consumer "projects/123" fails to call
13039    /// "storage.googleapis.com" service because the request from the Android apps
13040    /// violates the API key Android application restrictions:
13041    ///
13042    /// ```norust
13043    /// { "reason": "API_KEY_ANDROID_APP_BLOCKED",
13044    ///   "domain": "googleapis.com",
13045    ///   "metadata": {
13046    ///     "consumer": "projects/123",
13047    ///     "service": "storage.googleapis.com"
13048    ///   }
13049    /// }
13050    /// ```
13051    ApiKeyAndroidAppBlocked,
13052    /// The request is denied because it violates [API key iOS application
13053    /// restrictions](https://cloud.google.com/docs/authentication/api-keys#adding_application_restrictions).
13054    ///
13055    /// Example of an ErrorInfo when the consumer "projects/123" fails to call
13056    /// "storage.googleapis.com" service because the request from the iOS apps
13057    /// violates the API key iOS application restrictions:
13058    ///
13059    /// ```norust
13060    /// { "reason": "API_KEY_IOS_APP_BLOCKED",
13061    ///   "domain": "googleapis.com",
13062    ///   "metadata": {
13063    ///     "consumer": "projects/123",
13064    ///     "service": "storage.googleapis.com"
13065    ///   }
13066    /// }
13067    /// ```
13068    ApiKeyIosAppBlocked,
13069    /// The request is denied because there is not enough rate quota for the
13070    /// consumer.
13071    ///
13072    /// Example of an ErrorInfo when the consumer "projects/123" fails to contact
13073    /// "pubsub.googleapis.com" service because consumer's rate quota usage has
13074    /// reached the maximum value set for the quota limit
13075    /// "ReadsPerMinutePerProject" on the quota metric
13076    /// "pubsub.googleapis.com/read_requests":
13077    ///
13078    /// ```norust
13079    /// { "reason": "RATE_LIMIT_EXCEEDED",
13080    ///   "domain": "googleapis.com",
13081    ///   "metadata": {
13082    ///     "consumer": "projects/123",
13083    ///     "service": "pubsub.googleapis.com",
13084    ///     "quota_metric": "pubsub.googleapis.com/read_requests",
13085    ///     "quota_limit": "ReadsPerMinutePerProject"
13086    ///   }
13087    /// }
13088    /// ```
13089    ///
13090    /// Example of an ErrorInfo when the consumer "projects/123" checks quota on
13091    /// the service "dataflow.googleapis.com" and hits the organization quota
13092    /// limit "DefaultRequestsPerMinutePerOrganization" on the metric
13093    /// "dataflow.googleapis.com/default_requests".
13094    ///
13095    /// ```norust
13096    /// { "reason": "RATE_LIMIT_EXCEEDED",
13097    ///   "domain": "googleapis.com",
13098    ///   "metadata": {
13099    ///     "consumer": "projects/123",
13100    ///     "service": "dataflow.googleapis.com",
13101    ///     "quota_metric": "dataflow.googleapis.com/default_requests",
13102    ///     "quota_limit": "DefaultRequestsPerMinutePerOrganization"
13103    ///   }
13104    /// }
13105    /// ```
13106    RateLimitExceeded,
13107    /// The request is denied because there is not enough resource quota for the
13108    /// consumer.
13109    ///
13110    /// Example of an ErrorInfo when the consumer "projects/123" fails to contact
13111    /// "compute.googleapis.com" service because consumer's resource quota usage
13112    /// has reached the maximum value set for the quota limit "VMsPerProject"
13113    /// on the quota metric "compute.googleapis.com/vms":
13114    ///
13115    /// ```norust
13116    /// { "reason": "RESOURCE_QUOTA_EXCEEDED",
13117    ///   "domain": "googleapis.com",
13118    ///   "metadata": {
13119    ///     "consumer": "projects/123",
13120    ///     "service": "compute.googleapis.com",
13121    ///     "quota_metric": "compute.googleapis.com/vms",
13122    ///     "quota_limit": "VMsPerProject"
13123    ///   }
13124    /// }
13125    /// ```
13126    ///
13127    /// Example of an ErrorInfo when the consumer "projects/123" checks resource
13128    /// quota on the service "dataflow.googleapis.com" and hits the organization
13129    /// quota limit "jobs-per-organization" on the metric
13130    /// "dataflow.googleapis.com/job_count".
13131    ///
13132    /// ```norust
13133    /// { "reason": "RESOURCE_QUOTA_EXCEEDED",
13134    ///   "domain": "googleapis.com",
13135    ///   "metadata": {
13136    ///     "consumer": "projects/123",
13137    ///     "service": "dataflow.googleapis.com",
13138    ///     "quota_metric": "dataflow.googleapis.com/job_count",
13139    ///     "quota_limit": "jobs-per-organization"
13140    ///   }
13141    /// }
13142    /// ```
13143    ResourceQuotaExceeded,
13144    /// The request whose associated billing account address is in a tax restricted
13145    /// location, violates the local tax restrictions when creating resources in
13146    /// the restricted region.
13147    ///
13148    /// Example of an ErrorInfo when creating the Cloud Storage Bucket in the
13149    /// container "projects/123" under a tax restricted region
13150    /// "locations/asia-northeast3":
13151    ///
13152    /// ```norust
13153    /// { "reason": "LOCATION_TAX_POLICY_VIOLATED",
13154    ///   "domain": "googleapis.com",
13155    ///   "metadata": {
13156    ///     "consumer": "projects/123",
13157    ///     "service": "storage.googleapis.com",
13158    ///     "location": "locations/asia-northeast3"
13159    ///   }
13160    /// }
13161    /// ```
13162    ///
13163    /// This response indicates creating the Cloud Storage Bucket in
13164    /// "locations/asia-northeast3" violates the location tax restriction.
13165    LocationTaxPolicyViolated,
13166    /// The request is denied because the caller does not have required permission
13167    /// on the user project "projects/123" or the user project is invalid. For more
13168    /// information, check the [userProject System
13169    /// Parameters](https://cloud.google.com/apis/docs/system-parameters).
13170    ///
13171    /// Example of an ErrorInfo when the caller is calling Cloud Storage service
13172    /// with insufficient permissions on the user project:
13173    ///
13174    /// ```norust
13175    /// { "reason": "USER_PROJECT_DENIED",
13176    ///   "domain": "googleapis.com",
13177    ///   "metadata": {
13178    ///     "consumer": "projects/123",
13179    ///     "service": "storage.googleapis.com"
13180    ///   }
13181    /// }
13182    /// ```
13183    UserProjectDenied,
13184    /// The request is denied because the consumer "projects/123" is suspended due
13185    /// to Terms of Service(Tos) violations. Check [Project suspension
13186    /// guidelines](https://cloud.google.com/resource-manager/docs/project-suspension-guidelines)
13187    /// for more information.
13188    ///
13189    /// Example of an ErrorInfo when calling Cloud Storage service with the
13190    /// suspended consumer "projects/123":
13191    ///
13192    /// ```norust
13193    /// { "reason": "CONSUMER_SUSPENDED",
13194    ///   "domain": "googleapis.com",
13195    ///   "metadata": {
13196    ///     "consumer": "projects/123",
13197    ///     "service": "storage.googleapis.com"
13198    ///   }
13199    /// }
13200    /// ```
13201    ConsumerSuspended,
13202    /// The request is denied because the associated consumer is invalid. It may be
13203    /// in a bad format, cannot be found, or have been deleted.
13204    ///
13205    /// Example of an ErrorInfo when calling Cloud Storage service with the
13206    /// invalid consumer "projects/123":
13207    ///
13208    /// ```norust
13209    /// { "reason": "CONSUMER_INVALID",
13210    ///   "domain": "googleapis.com",
13211    ///   "metadata": {
13212    ///     "consumer": "projects/123",
13213    ///     "service": "storage.googleapis.com"
13214    ///   }
13215    /// }
13216    /// ```
13217    ConsumerInvalid,
13218    /// The request is denied because it violates [VPC Service
13219    /// Controls](https://cloud.google.com/vpc-service-controls/docs/overview).
13220    /// The 'uid' field is a random generated identifier that customer can use it
13221    /// to search the audit log for a request rejected by VPC Service Controls. For
13222    /// more information, please refer [VPC Service Controls
13223    /// Troubleshooting](https://cloud.google.com/vpc-service-controls/docs/troubleshooting#unique-id)
13224    ///
13225    /// Example of an ErrorInfo when the consumer "projects/123" fails to call
13226    /// Cloud Storage service because the request is prohibited by the VPC Service
13227    /// Controls.
13228    ///
13229    /// ```norust
13230    /// { "reason": "SECURITY_POLICY_VIOLATED",
13231    ///   "domain": "googleapis.com",
13232    ///   "metadata": {
13233    ///     "uid": "123456789abcde",
13234    ///     "consumer": "projects/123",
13235    ///     "service": "storage.googleapis.com"
13236    ///   }
13237    /// }
13238    /// ```
13239    SecurityPolicyViolated,
13240    /// The request is denied because the provided access token has expired.
13241    ///
13242    /// Example of an ErrorInfo when the request is calling Cloud Storage service
13243    /// with an expired access token:
13244    ///
13245    /// ```norust
13246    /// { "reason": "ACCESS_TOKEN_EXPIRED",
13247    ///   "domain": "googleapis.com",
13248    ///   "metadata": {
13249    ///     "service": "storage.googleapis.com",
13250    ///     "method": "google.storage.v1.Storage.GetObject"
13251    ///   }
13252    /// }
13253    /// ```
13254    AccessTokenExpired,
13255    /// The request is denied because the provided access token doesn't have at
13256    /// least one of the acceptable scopes required for the API. Please check
13257    /// [OAuth 2.0 Scopes for Google
13258    /// APIs](https://developers.google.com/identity/protocols/oauth2/scopes) for
13259    /// the list of the OAuth 2.0 scopes that you might need to request to access
13260    /// the API.
13261    ///
13262    /// Example of an ErrorInfo when the request is calling Cloud Storage service
13263    /// with an access token that is missing required scopes:
13264    ///
13265    /// ```norust
13266    /// { "reason": "ACCESS_TOKEN_SCOPE_INSUFFICIENT",
13267    ///   "domain": "googleapis.com",
13268    ///   "metadata": {
13269    ///     "service": "storage.googleapis.com",
13270    ///     "method": "google.storage.v1.Storage.GetObject"
13271    ///   }
13272    /// }
13273    /// ```
13274    AccessTokenScopeInsufficient,
13275    /// The request is denied because the account associated with the provided
13276    /// access token is in an invalid state, such as disabled or deleted.
13277    /// For more information, see <https://cloud.google.com/docs/authentication>.
13278    ///
13279    /// Warning: For privacy reasons, the server may not be able to disclose the
13280    /// email address for some accounts. The client MUST NOT depend on the
13281    /// availability of the `email` attribute.
13282    ///
13283    /// Example of an ErrorInfo when the request is to the Cloud Storage API with
13284    /// an access token that is associated with a disabled or deleted [service
13285    /// account](http://cloud/iam/docs/service-accounts):
13286    ///
13287    /// ```norust
13288    /// { "reason": "ACCOUNT_STATE_INVALID",
13289    ///   "domain": "googleapis.com",
13290    ///   "metadata": {
13291    ///     "service": "storage.googleapis.com",
13292    ///     "method": "google.storage.v1.Storage.GetObject",
13293    ///     "email": "user@123.iam.gserviceaccount.com"
13294    ///   }
13295    /// }
13296    /// ```
13297    AccountStateInvalid,
13298    /// The request is denied because the type of the provided access token is not
13299    /// supported by the API being called.
13300    ///
13301    /// Example of an ErrorInfo when the request is to the Cloud Storage API with
13302    /// an unsupported token type.
13303    ///
13304    /// ```norust
13305    /// { "reason": "ACCESS_TOKEN_TYPE_UNSUPPORTED",
13306    ///   "domain": "googleapis.com",
13307    ///   "metadata": {
13308    ///     "service": "storage.googleapis.com",
13309    ///     "method": "google.storage.v1.Storage.GetObject"
13310    ///   }
13311    /// }
13312    /// ```
13313    AccessTokenTypeUnsupported,
13314    /// The request is denied because the request doesn't have any authentication
13315    /// credentials. For more information regarding the supported authentication
13316    /// strategies for Google Cloud APIs, see
13317    /// <https://cloud.google.com/docs/authentication>.
13318    ///
13319    /// Example of an ErrorInfo when the request is to the Cloud Storage API
13320    /// without any authentication credentials.
13321    ///
13322    /// ```norust
13323    /// { "reason": "CREDENTIALS_MISSING",
13324    ///   "domain": "googleapis.com",
13325    ///   "metadata": {
13326    ///     "service": "storage.googleapis.com",
13327    ///     "method": "google.storage.v1.Storage.GetObject"
13328    ///   }
13329    /// }
13330    /// ```
13331    CredentialsMissing,
13332    /// The request is denied because the provided project owning the resource
13333    /// which acts as the [API
13334    /// consumer](https://cloud.google.com/apis/design/glossary#api_consumer) is
13335    /// invalid. It may be in a bad format or empty.
13336    ///
13337    /// Example of an ErrorInfo when the request is to the Cloud Functions API,
13338    /// but the offered resource project in the request in a bad format which can't
13339    /// perform the ListFunctions method.
13340    ///
13341    /// ```norust
13342    /// { "reason": "RESOURCE_PROJECT_INVALID",
13343    ///   "domain": "googleapis.com",
13344    ///   "metadata": {
13345    ///     "service": "cloudfunctions.googleapis.com",
13346    ///     "method":
13347    ///     "google.cloud.functions.v1.CloudFunctionsService.ListFunctions"
13348    ///   }
13349    /// }
13350    /// ```
13351    ResourceProjectInvalid,
13352    /// The request is denied because the provided session cookie is missing,
13353    /// invalid or failed to decode.
13354    ///
13355    /// Example of an ErrorInfo when the request is calling Cloud Storage service
13356    /// with a SID cookie which can't be decoded.
13357    ///
13358    /// ```norust
13359    /// { "reason": "SESSION_COOKIE_INVALID",
13360    ///   "domain": "googleapis.com",
13361    ///   "metadata": {
13362    ///     "service": "storage.googleapis.com",
13363    ///     "method": "google.storage.v1.Storage.GetObject",
13364    ///     "cookie": "SID"
13365    ///   }
13366    /// }
13367    /// ```
13368    SessionCookieInvalid,
13369    /// The request is denied because the user is from a Google Workspace customer
13370    /// that blocks their users from accessing a particular service.
13371    ///
13372    /// Example scenario: <https://support.google.com/a/answer/9197205?hl=en>
13373    ///
13374    /// Example of an ErrorInfo when access to Google Cloud Storage service is
13375    /// blocked by the Google Workspace administrator:
13376    ///
13377    /// ```norust
13378    /// { "reason": "USER_BLOCKED_BY_ADMIN",
13379    ///   "domain": "googleapis.com",
13380    ///   "metadata": {
13381    ///     "service": "storage.googleapis.com",
13382    ///     "method": "google.storage.v1.Storage.GetObject",
13383    ///   }
13384    /// }
13385    /// ```
13386    UserBlockedByAdmin,
13387    /// The request is denied because the resource service usage is restricted
13388    /// by administrators according to the organization policy constraint.
13389    /// For more information see
13390    /// <https://cloud.google.com/resource-manager/docs/organization-policy/restricting-services>.
13391    ///
13392    /// Example of an ErrorInfo when access to Google Cloud Storage service is
13393    /// restricted by Resource Usage Restriction policy:
13394    ///
13395    /// ```norust
13396    /// { "reason": "RESOURCE_USAGE_RESTRICTION_VIOLATED",
13397    ///   "domain": "googleapis.com",
13398    ///   "metadata": {
13399    ///     "consumer": "projects/project-123",
13400    ///     "service": "storage.googleapis.com"
13401    ///   }
13402    /// }
13403    /// ```
13404    ResourceUsageRestrictionViolated,
13405    /// Unimplemented. Do not use.
13406    ///
13407    /// The request is denied because it contains unsupported system parameters in
13408    /// URL query parameters or HTTP headers. For more information,
13409    /// see <https://cloud.google.com/apis/docs/system-parameters>
13410    ///
13411    /// Example of an ErrorInfo when access "pubsub.googleapis.com" service with
13412    /// a request header of "x-goog-user-ip":
13413    ///
13414    /// ```norust
13415    /// { "reason": "SYSTEM_PARAMETER_UNSUPPORTED",
13416    ///   "domain": "googleapis.com",
13417    ///   "metadata": {
13418    ///     "service": "pubsub.googleapis.com"
13419    ///     "parameter": "x-goog-user-ip"
13420    ///   }
13421    /// }
13422    /// ```
13423    SystemParameterUnsupported,
13424    /// The request is denied because it violates Org Restriction: the requested
13425    /// resource does not belong to allowed organizations specified in
13426    /// "X-Goog-Allowed-Resources" header.
13427    ///
13428    /// Example of an ErrorInfo when accessing a GCP resource that is restricted by
13429    /// Org Restriction for "pubsub.googleapis.com" service.
13430    ///
13431    /// {
13432    /// reason: "ORG_RESTRICTION_VIOLATION"
13433    /// domain: "googleapis.com"
13434    /// metadata {
13435    /// "consumer":"projects/123456"
13436    /// "service": "pubsub.googleapis.com"
13437    /// }
13438    /// }
13439    OrgRestrictionViolation,
13440    /// The request is denied because "X-Goog-Allowed-Resources" header is in a bad
13441    /// format.
13442    ///
13443    /// Example of an ErrorInfo when
13444    /// accessing "pubsub.googleapis.com" service with an invalid
13445    /// "X-Goog-Allowed-Resources" request header.
13446    ///
13447    /// {
13448    /// reason: "ORG_RESTRICTION_HEADER_INVALID"
13449    /// domain: "googleapis.com"
13450    /// metadata {
13451    /// "consumer":"projects/123456"
13452    /// "service": "pubsub.googleapis.com"
13453    /// }
13454    /// }
13455    OrgRestrictionHeaderInvalid,
13456    /// Unimplemented. Do not use.
13457    ///
13458    /// The request is calling a service that is not visible to the consumer.
13459    ///
13460    /// Example of an ErrorInfo when the consumer "projects/123" contacting
13461    /// "pubsub.googleapis.com" service which is not visible to the consumer.
13462    ///
13463    /// ```norust
13464    /// { "reason": "SERVICE_NOT_VISIBLE",
13465    ///   "domain": "googleapis.com",
13466    ///   "metadata": {
13467    ///     "consumer": "projects/123",
13468    ///     "service": "pubsub.googleapis.com"
13469    ///   }
13470    /// }
13471    /// ```
13472    ///
13473    /// This response indicates the "pubsub.googleapis.com" is not visible to
13474    /// "projects/123" (or it may not exist).
13475    ServiceNotVisible,
13476    /// The request is related to a project for which GCP access is suspended.
13477    ///
13478    /// Example of an ErrorInfo when the consumer "projects/123" fails to contact
13479    /// "pubsub.googleapis.com" service because GCP access is suspended:
13480    ///
13481    /// ```norust
13482    /// { "reason": "GCP_SUSPENDED",
13483    ///   "domain": "googleapis.com",
13484    ///   "metadata": {
13485    ///     "consumer": "projects/123",
13486    ///     "service": "pubsub.googleapis.com"
13487    ///   }
13488    /// }
13489    /// ```
13490    ///
13491    /// This response indicates the associated GCP account has been suspended.
13492    GcpSuspended,
13493    /// The request violates the location policies when creating resources in
13494    /// the restricted region.
13495    ///
13496    /// Example of an ErrorInfo when creating the Cloud Storage Bucket by
13497    /// "projects/123" for service storage.googleapis.com:
13498    ///
13499    /// ```norust
13500    /// { "reason": "LOCATION_POLICY_VIOLATED",
13501    ///   "domain": "googleapis.com",
13502    ///   "metadata": {
13503    ///     "consumer": "projects/123",
13504    ///     "service": "storage.googleapis.com",
13505    ///   }
13506    /// }
13507    /// ```
13508    ///
13509    /// This response indicates creating the Cloud Storage Bucket in
13510    /// "locations/asia-northeast3" violates at least one location policy.
13511    /// The troubleshooting guidance is provided in the Help links.
13512    LocationPolicyViolated,
13513    /// The request is denied because origin request header is missing.
13514    ///
13515    /// Example of an ErrorInfo when
13516    /// accessing "pubsub.googleapis.com" service with an empty "Origin" request
13517    /// header.
13518    ///
13519    /// {
13520    /// reason: "MISSING_ORIGIN"
13521    /// domain: "googleapis.com"
13522    /// metadata {
13523    /// "consumer":"projects/123456"
13524    /// "service": "pubsub.googleapis.com"
13525    /// }
13526    /// }
13527    MissingOrigin,
13528    /// The request is denied because the request contains more than one credential
13529    /// type that are individually acceptable, but not together. The customer
13530    /// should retry their request with only one set of credentials.
13531    ///
13532    /// Example of an ErrorInfo when
13533    /// accessing "pubsub.googleapis.com" service with overloaded credentials.
13534    ///
13535    /// {
13536    /// reason: "OVERLOADED_CREDENTIALS"
13537    /// domain: "googleapis.com"
13538    /// metadata {
13539    /// "consumer":"projects/123456"
13540    /// "service": "pubsub.googleapis.com"
13541    /// }
13542    /// }
13543    OverloadedCredentials,
13544    /// The request whose associated location violates the location org policy
13545    /// restrictions when creating resources in the restricted region.
13546    ///
13547    /// Example of an ErrorInfo when creating the Cloud Storage Bucket in the
13548    /// container "projects/123" under a restricted region
13549    /// "locations/asia-northeast3":
13550    ///
13551    /// ```norust
13552    /// {
13553    ///   "reason": "LOCATION_ORG_POLICY_VIOLATED",
13554    ///   "domain": "googleapis.com",
13555    ///   "metadata": {
13556    ///     "resource": "projects/123",
13557    ///     "location": "locations/asia-northeast3"
13558    ///   }
13559    /// }
13560    /// ```
13561    ///
13562    /// This response indicates creating the Cloud Storage Bucket in
13563    /// "locations/asia-northeast3" violates the location org policy restriction.
13564    LocationOrgPolicyViolated,
13565    /// The request is denied because it access data of regulated customers using
13566    /// TLS 1.0 and 1.1.
13567    ///
13568    /// Example of an ErrorInfo when accessing a GCP resource "projects/123" that
13569    /// is restricted by TLS Version Restriction for "pubsub.googleapis.com"
13570    /// service.
13571    ///
13572    /// ```norust
13573    /// {
13574    ///   "reason": "TLS_ORG_POLICY_VIOLATED",
13575    ///   "domain": "googleapis.com",
13576    ///   "metadata": {
13577    ///     "service": "pubsub.googleapis.com"
13578    ///     "resource": "projects/123",
13579    ///     "policyName": "constraints/gcp.restrictTLSVersion",
13580    ///     "tlsVersion": "TLS_VERSION_1"
13581    ///   }
13582    /// }
13583    /// ```
13584    TlsOrgPolicyViolated,
13585    /// The request is denied because the associated project has exceeded the
13586    /// emulator quota limit.
13587    ///
13588    /// Example of an ErrorInfo when the associated "projects/123" has exceeded the
13589    /// emulator quota limit.
13590    ///
13591    /// ```norust
13592    /// {
13593    ///   "reason": "EMULATOR_QUOTA_EXCEEDED",
13594    ///   "domain": "googleapis.com",
13595    ///   "metadata": {
13596    ///       "service": "pubsub.googleapis.com"
13597    ///       "consumer": "projects/123"
13598    ///    }
13599    /// }
13600    /// ```
13601    EmulatorQuotaExceeded,
13602    /// The request is denied because the associated application credential header
13603    /// is invalid for an Android applications.
13604    ///
13605    /// Example of an ErrorInfo when the request from an Android application to the
13606    /// "pubsub.googleapis.com" with an invalid application credential header.
13607    ///
13608    /// ```norust
13609    /// {
13610    ///   "reason": "CREDENTIAL_ANDROID_APP_INVALID",
13611    ///   "domain": "googleapis.com",
13612    ///   "metadata": {
13613    ///       "service": "pubsub.googleapis.com"
13614    ///    }
13615    /// }
13616    /// ```
13617    CredentialAndroidAppInvalid,
13618    /// The request is denied because IAM permission on resource is denied.
13619    ///
13620    /// Example of an ErrorInfo when the IAM permission `aiplatform.datasets.list`
13621    /// is denied on resource `projects/123`.
13622    ///
13623    /// ```norust
13624    /// {
13625    ///   "reason": "IAM_PERMISSION_DENIED",
13626    ///   "domain": "googleapis.com",
13627    ///   "metadata": {
13628    ///       "resource": "projects/123"
13629    ///       "permission": "aiplatform.datasets.list"
13630    ///    }
13631    /// }
13632    /// ```
13633    IamPermissionDenied,
13634    /// The request is denied because it contains the invalid JWT token.
13635    ///
13636    /// Example of an ErrorInfo when the request contains an invalid JWT token for
13637    /// service `storage.googleapis.com`.
13638    ///
13639    /// ```norust
13640    /// {
13641    ///   "reason": "JWT_TOKEN_INVALID",
13642    ///   "domain": "googleapis.com",
13643    ///   "metadata": {
13644    ///       "service": "storage.googleapis.com"
13645    ///    }
13646    /// }
13647    /// ```
13648    JwtTokenInvalid,
13649    /// The request is denied because it contains credential with type that is
13650    /// unsupported.
13651    ///
13652    /// Example of an ErrorInfo when the request contains an unsupported credential
13653    /// type for service `storage.googleapis.com`.
13654    ///
13655    /// ```norust
13656    /// {
13657    ///   "reason": "CREDENTIAL_TYPE_UNSUPPORTED",
13658    ///   "domain": "googleapis.com",
13659    ///   "metadata": {
13660    ///       "service": "storage.googleapis.com"
13661    ///    }
13662    /// }
13663    /// ```
13664    CredentialTypeUnsupported,
13665    /// The request is denied because it contains unsupported account type.
13666    ///
13667    /// Example of an ErrorInfo when the request contains an unsupported account
13668    /// type for service `storage.googleapis.com`.
13669    ///
13670    /// ```norust
13671    /// {
13672    ///   "reason": "ACCOUNT_TYPE_UNSUPPORTED",
13673    ///   "domain": "googleapis.com",
13674    ///   "metadata": {
13675    ///       "service": "storage.googleapis.com"
13676    ///    }
13677    /// }
13678    /// ```
13679    AccountTypeUnsupported,
13680    /// The request is denied because the API endpoint is restricted by
13681    /// administrators according to the organization policy constraint.
13682    /// For more information see
13683    /// <https://cloud.google.com/assured-workloads/docs/restrict-endpoint-usage>.
13684    ///
13685    /// Example of an ErrorInfo when access to Google Cloud Storage service is
13686    /// restricted by Restrict Endpoint Usage policy:
13687    ///
13688    /// ```norust
13689    /// {
13690    ///   "reason": "ENDPOINT_USAGE_RESTRICTION_VIOLATED",
13691    ///   "domain": "googleapis.com/policies/endpointUsageRestriction",
13692    ///   "metadata": {
13693    ///     "policy_name": "constraints/gcp.restrictEndpointUsage",
13694    ///     "checked_value": "storage.googleapis.com"
13695    ///     "consumer": "organization/123"
13696    ///     "service": "storage.googleapis.com"
13697    ///    }
13698    /// }
13699    /// ```
13700    EndpointUsageRestrictionViolated,
13701    /// The request is denied because the TLS Cipher Suite is restricted by
13702    /// administrators according to the organization policy constraint.
13703    /// For more information see
13704    /// <https://cloud.google.com/assured-workloads/docs/restrict-tls-cipher-suites>
13705    ///
13706    /// Example of an ErrorInfo when access to Google Cloud BigQuery service is
13707    /// restricted by Restrict TLS Cipher Suites policy:
13708    ///
13709    /// ```norust
13710    /// {
13711    ///   "reason": "TLS_CIPHER_RESTRICTION_VIOLATED",
13712    ///   "domain": "googleapis.com/policies/tlsCipherRestriction",
13713    ///   "metadata": {
13714    ///     "policy_name": "constraints/gcp.restrictTLSCipherSuites",
13715    ///     "checked_value": "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
13716    ///     "consumer": "organization/123"
13717    ///     "service": "bigquery.googleapis.com"
13718    ///    }
13719    /// }
13720    /// ```
13721    TlsCipherRestrictionViolated,
13722    /// The request is denied because the MCP activation check fails.
13723    ///
13724    /// Example of an ErrorInfo when the container "projects/123" contacting
13725    /// "pubsub.googleapis.com" service which is disabled by MCP:
13726    ///
13727    /// ```norust
13728    /// { "reason": "MCP_SERVER_DISABLED",
13729    ///   "domain": "googleapis.com",
13730    ///   "metadata": {
13731    ///     "consumer": "projects/123",
13732    ///     "service": "pubsub.googleapis.com"
13733    ///   }
13734    /// }
13735    /// ```
13736    ///
13737    /// This response indicates the "pubsub.googleapis.com" has been disabled in
13738    /// "projects/123" for MCP.
13739    McpServerDisabled,
13740    /// If set, the enum was initialized with an unknown value.
13741    ///
13742    /// Applications can examine the value using [ErrorReason::value] or
13743    /// [ErrorReason::name].
13744    UnknownValue(error_reason::UnknownValue),
13745}
13746
13747#[doc(hidden)]
13748pub mod error_reason {
13749    #[allow(unused_imports)]
13750    use super::*;
13751    #[derive(Clone, Debug, PartialEq)]
13752    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13753}
13754
13755impl ErrorReason {
13756    /// Gets the enum value.
13757    ///
13758    /// Returns `None` if the enum contains an unknown value deserialized from
13759    /// the string representation of enums.
13760    pub fn value(&self) -> std::option::Option<i32> {
13761        match self {
13762            Self::Unspecified => std::option::Option::Some(0),
13763            Self::ServiceDisabled => std::option::Option::Some(1),
13764            Self::BillingDisabled => std::option::Option::Some(2),
13765            Self::ApiKeyInvalid => std::option::Option::Some(3),
13766            Self::ApiKeyServiceBlocked => std::option::Option::Some(4),
13767            Self::ApiKeyHttpReferrerBlocked => std::option::Option::Some(7),
13768            Self::ApiKeyIpAddressBlocked => std::option::Option::Some(8),
13769            Self::ApiKeyAndroidAppBlocked => std::option::Option::Some(9),
13770            Self::ApiKeyIosAppBlocked => std::option::Option::Some(13),
13771            Self::RateLimitExceeded => std::option::Option::Some(5),
13772            Self::ResourceQuotaExceeded => std::option::Option::Some(6),
13773            Self::LocationTaxPolicyViolated => std::option::Option::Some(10),
13774            Self::UserProjectDenied => std::option::Option::Some(11),
13775            Self::ConsumerSuspended => std::option::Option::Some(12),
13776            Self::ConsumerInvalid => std::option::Option::Some(14),
13777            Self::SecurityPolicyViolated => std::option::Option::Some(15),
13778            Self::AccessTokenExpired => std::option::Option::Some(16),
13779            Self::AccessTokenScopeInsufficient => std::option::Option::Some(17),
13780            Self::AccountStateInvalid => std::option::Option::Some(18),
13781            Self::AccessTokenTypeUnsupported => std::option::Option::Some(19),
13782            Self::CredentialsMissing => std::option::Option::Some(20),
13783            Self::ResourceProjectInvalid => std::option::Option::Some(21),
13784            Self::SessionCookieInvalid => std::option::Option::Some(23),
13785            Self::UserBlockedByAdmin => std::option::Option::Some(24),
13786            Self::ResourceUsageRestrictionViolated => std::option::Option::Some(25),
13787            Self::SystemParameterUnsupported => std::option::Option::Some(26),
13788            Self::OrgRestrictionViolation => std::option::Option::Some(27),
13789            Self::OrgRestrictionHeaderInvalid => std::option::Option::Some(28),
13790            Self::ServiceNotVisible => std::option::Option::Some(29),
13791            Self::GcpSuspended => std::option::Option::Some(30),
13792            Self::LocationPolicyViolated => std::option::Option::Some(31),
13793            Self::MissingOrigin => std::option::Option::Some(33),
13794            Self::OverloadedCredentials => std::option::Option::Some(34),
13795            Self::LocationOrgPolicyViolated => std::option::Option::Some(35),
13796            Self::TlsOrgPolicyViolated => std::option::Option::Some(36),
13797            Self::EmulatorQuotaExceeded => std::option::Option::Some(38),
13798            Self::CredentialAndroidAppInvalid => std::option::Option::Some(39),
13799            Self::IamPermissionDenied => std::option::Option::Some(41),
13800            Self::JwtTokenInvalid => std::option::Option::Some(42),
13801            Self::CredentialTypeUnsupported => std::option::Option::Some(43),
13802            Self::AccountTypeUnsupported => std::option::Option::Some(44),
13803            Self::EndpointUsageRestrictionViolated => std::option::Option::Some(45),
13804            Self::TlsCipherRestrictionViolated => std::option::Option::Some(46),
13805            Self::McpServerDisabled => std::option::Option::Some(47),
13806            Self::UnknownValue(u) => u.0.value(),
13807        }
13808    }
13809
13810    /// Gets the enum value as a string.
13811    ///
13812    /// Returns `None` if the enum contains an unknown value deserialized from
13813    /// the integer representation of enums.
13814    pub fn name(&self) -> std::option::Option<&str> {
13815        match self {
13816            Self::Unspecified => std::option::Option::Some("ERROR_REASON_UNSPECIFIED"),
13817            Self::ServiceDisabled => std::option::Option::Some("SERVICE_DISABLED"),
13818            Self::BillingDisabled => std::option::Option::Some("BILLING_DISABLED"),
13819            Self::ApiKeyInvalid => std::option::Option::Some("API_KEY_INVALID"),
13820            Self::ApiKeyServiceBlocked => std::option::Option::Some("API_KEY_SERVICE_BLOCKED"),
13821            Self::ApiKeyHttpReferrerBlocked => {
13822                std::option::Option::Some("API_KEY_HTTP_REFERRER_BLOCKED")
13823            }
13824            Self::ApiKeyIpAddressBlocked => std::option::Option::Some("API_KEY_IP_ADDRESS_BLOCKED"),
13825            Self::ApiKeyAndroidAppBlocked => {
13826                std::option::Option::Some("API_KEY_ANDROID_APP_BLOCKED")
13827            }
13828            Self::ApiKeyIosAppBlocked => std::option::Option::Some("API_KEY_IOS_APP_BLOCKED"),
13829            Self::RateLimitExceeded => std::option::Option::Some("RATE_LIMIT_EXCEEDED"),
13830            Self::ResourceQuotaExceeded => std::option::Option::Some("RESOURCE_QUOTA_EXCEEDED"),
13831            Self::LocationTaxPolicyViolated => {
13832                std::option::Option::Some("LOCATION_TAX_POLICY_VIOLATED")
13833            }
13834            Self::UserProjectDenied => std::option::Option::Some("USER_PROJECT_DENIED"),
13835            Self::ConsumerSuspended => std::option::Option::Some("CONSUMER_SUSPENDED"),
13836            Self::ConsumerInvalid => std::option::Option::Some("CONSUMER_INVALID"),
13837            Self::SecurityPolicyViolated => std::option::Option::Some("SECURITY_POLICY_VIOLATED"),
13838            Self::AccessTokenExpired => std::option::Option::Some("ACCESS_TOKEN_EXPIRED"),
13839            Self::AccessTokenScopeInsufficient => {
13840                std::option::Option::Some("ACCESS_TOKEN_SCOPE_INSUFFICIENT")
13841            }
13842            Self::AccountStateInvalid => std::option::Option::Some("ACCOUNT_STATE_INVALID"),
13843            Self::AccessTokenTypeUnsupported => {
13844                std::option::Option::Some("ACCESS_TOKEN_TYPE_UNSUPPORTED")
13845            }
13846            Self::CredentialsMissing => std::option::Option::Some("CREDENTIALS_MISSING"),
13847            Self::ResourceProjectInvalid => std::option::Option::Some("RESOURCE_PROJECT_INVALID"),
13848            Self::SessionCookieInvalid => std::option::Option::Some("SESSION_COOKIE_INVALID"),
13849            Self::UserBlockedByAdmin => std::option::Option::Some("USER_BLOCKED_BY_ADMIN"),
13850            Self::ResourceUsageRestrictionViolated => {
13851                std::option::Option::Some("RESOURCE_USAGE_RESTRICTION_VIOLATED")
13852            }
13853            Self::SystemParameterUnsupported => {
13854                std::option::Option::Some("SYSTEM_PARAMETER_UNSUPPORTED")
13855            }
13856            Self::OrgRestrictionViolation => std::option::Option::Some("ORG_RESTRICTION_VIOLATION"),
13857            Self::OrgRestrictionHeaderInvalid => {
13858                std::option::Option::Some("ORG_RESTRICTION_HEADER_INVALID")
13859            }
13860            Self::ServiceNotVisible => std::option::Option::Some("SERVICE_NOT_VISIBLE"),
13861            Self::GcpSuspended => std::option::Option::Some("GCP_SUSPENDED"),
13862            Self::LocationPolicyViolated => std::option::Option::Some("LOCATION_POLICY_VIOLATED"),
13863            Self::MissingOrigin => std::option::Option::Some("MISSING_ORIGIN"),
13864            Self::OverloadedCredentials => std::option::Option::Some("OVERLOADED_CREDENTIALS"),
13865            Self::LocationOrgPolicyViolated => {
13866                std::option::Option::Some("LOCATION_ORG_POLICY_VIOLATED")
13867            }
13868            Self::TlsOrgPolicyViolated => std::option::Option::Some("TLS_ORG_POLICY_VIOLATED"),
13869            Self::EmulatorQuotaExceeded => std::option::Option::Some("EMULATOR_QUOTA_EXCEEDED"),
13870            Self::CredentialAndroidAppInvalid => {
13871                std::option::Option::Some("CREDENTIAL_ANDROID_APP_INVALID")
13872            }
13873            Self::IamPermissionDenied => std::option::Option::Some("IAM_PERMISSION_DENIED"),
13874            Self::JwtTokenInvalid => std::option::Option::Some("JWT_TOKEN_INVALID"),
13875            Self::CredentialTypeUnsupported => {
13876                std::option::Option::Some("CREDENTIAL_TYPE_UNSUPPORTED")
13877            }
13878            Self::AccountTypeUnsupported => std::option::Option::Some("ACCOUNT_TYPE_UNSUPPORTED"),
13879            Self::EndpointUsageRestrictionViolated => {
13880                std::option::Option::Some("ENDPOINT_USAGE_RESTRICTION_VIOLATED")
13881            }
13882            Self::TlsCipherRestrictionViolated => {
13883                std::option::Option::Some("TLS_CIPHER_RESTRICTION_VIOLATED")
13884            }
13885            Self::McpServerDisabled => std::option::Option::Some("MCP_SERVER_DISABLED"),
13886            Self::UnknownValue(u) => u.0.name(),
13887        }
13888    }
13889}
13890
13891impl std::default::Default for ErrorReason {
13892    fn default() -> Self {
13893        use std::convert::From;
13894        Self::from(0)
13895    }
13896}
13897
13898impl std::fmt::Display for ErrorReason {
13899    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
13900        wkt::internal::display_enum(f, self.name(), self.value())
13901    }
13902}
13903
13904impl std::convert::From<i32> for ErrorReason {
13905    fn from(value: i32) -> Self {
13906        match value {
13907            0 => Self::Unspecified,
13908            1 => Self::ServiceDisabled,
13909            2 => Self::BillingDisabled,
13910            3 => Self::ApiKeyInvalid,
13911            4 => Self::ApiKeyServiceBlocked,
13912            5 => Self::RateLimitExceeded,
13913            6 => Self::ResourceQuotaExceeded,
13914            7 => Self::ApiKeyHttpReferrerBlocked,
13915            8 => Self::ApiKeyIpAddressBlocked,
13916            9 => Self::ApiKeyAndroidAppBlocked,
13917            10 => Self::LocationTaxPolicyViolated,
13918            11 => Self::UserProjectDenied,
13919            12 => Self::ConsumerSuspended,
13920            13 => Self::ApiKeyIosAppBlocked,
13921            14 => Self::ConsumerInvalid,
13922            15 => Self::SecurityPolicyViolated,
13923            16 => Self::AccessTokenExpired,
13924            17 => Self::AccessTokenScopeInsufficient,
13925            18 => Self::AccountStateInvalid,
13926            19 => Self::AccessTokenTypeUnsupported,
13927            20 => Self::CredentialsMissing,
13928            21 => Self::ResourceProjectInvalid,
13929            23 => Self::SessionCookieInvalid,
13930            24 => Self::UserBlockedByAdmin,
13931            25 => Self::ResourceUsageRestrictionViolated,
13932            26 => Self::SystemParameterUnsupported,
13933            27 => Self::OrgRestrictionViolation,
13934            28 => Self::OrgRestrictionHeaderInvalid,
13935            29 => Self::ServiceNotVisible,
13936            30 => Self::GcpSuspended,
13937            31 => Self::LocationPolicyViolated,
13938            33 => Self::MissingOrigin,
13939            34 => Self::OverloadedCredentials,
13940            35 => Self::LocationOrgPolicyViolated,
13941            36 => Self::TlsOrgPolicyViolated,
13942            38 => Self::EmulatorQuotaExceeded,
13943            39 => Self::CredentialAndroidAppInvalid,
13944            41 => Self::IamPermissionDenied,
13945            42 => Self::JwtTokenInvalid,
13946            43 => Self::CredentialTypeUnsupported,
13947            44 => Self::AccountTypeUnsupported,
13948            45 => Self::EndpointUsageRestrictionViolated,
13949            46 => Self::TlsCipherRestrictionViolated,
13950            47 => Self::McpServerDisabled,
13951            _ => Self::UnknownValue(error_reason::UnknownValue(
13952                wkt::internal::UnknownEnumValue::Integer(value),
13953            )),
13954        }
13955    }
13956}
13957
13958impl std::convert::From<&str> for ErrorReason {
13959    fn from(value: &str) -> Self {
13960        use std::string::ToString;
13961        match value {
13962            "ERROR_REASON_UNSPECIFIED" => Self::Unspecified,
13963            "SERVICE_DISABLED" => Self::ServiceDisabled,
13964            "BILLING_DISABLED" => Self::BillingDisabled,
13965            "API_KEY_INVALID" => Self::ApiKeyInvalid,
13966            "API_KEY_SERVICE_BLOCKED" => Self::ApiKeyServiceBlocked,
13967            "API_KEY_HTTP_REFERRER_BLOCKED" => Self::ApiKeyHttpReferrerBlocked,
13968            "API_KEY_IP_ADDRESS_BLOCKED" => Self::ApiKeyIpAddressBlocked,
13969            "API_KEY_ANDROID_APP_BLOCKED" => Self::ApiKeyAndroidAppBlocked,
13970            "API_KEY_IOS_APP_BLOCKED" => Self::ApiKeyIosAppBlocked,
13971            "RATE_LIMIT_EXCEEDED" => Self::RateLimitExceeded,
13972            "RESOURCE_QUOTA_EXCEEDED" => Self::ResourceQuotaExceeded,
13973            "LOCATION_TAX_POLICY_VIOLATED" => Self::LocationTaxPolicyViolated,
13974            "USER_PROJECT_DENIED" => Self::UserProjectDenied,
13975            "CONSUMER_SUSPENDED" => Self::ConsumerSuspended,
13976            "CONSUMER_INVALID" => Self::ConsumerInvalid,
13977            "SECURITY_POLICY_VIOLATED" => Self::SecurityPolicyViolated,
13978            "ACCESS_TOKEN_EXPIRED" => Self::AccessTokenExpired,
13979            "ACCESS_TOKEN_SCOPE_INSUFFICIENT" => Self::AccessTokenScopeInsufficient,
13980            "ACCOUNT_STATE_INVALID" => Self::AccountStateInvalid,
13981            "ACCESS_TOKEN_TYPE_UNSUPPORTED" => Self::AccessTokenTypeUnsupported,
13982            "CREDENTIALS_MISSING" => Self::CredentialsMissing,
13983            "RESOURCE_PROJECT_INVALID" => Self::ResourceProjectInvalid,
13984            "SESSION_COOKIE_INVALID" => Self::SessionCookieInvalid,
13985            "USER_BLOCKED_BY_ADMIN" => Self::UserBlockedByAdmin,
13986            "RESOURCE_USAGE_RESTRICTION_VIOLATED" => Self::ResourceUsageRestrictionViolated,
13987            "SYSTEM_PARAMETER_UNSUPPORTED" => Self::SystemParameterUnsupported,
13988            "ORG_RESTRICTION_VIOLATION" => Self::OrgRestrictionViolation,
13989            "ORG_RESTRICTION_HEADER_INVALID" => Self::OrgRestrictionHeaderInvalid,
13990            "SERVICE_NOT_VISIBLE" => Self::ServiceNotVisible,
13991            "GCP_SUSPENDED" => Self::GcpSuspended,
13992            "LOCATION_POLICY_VIOLATED" => Self::LocationPolicyViolated,
13993            "MISSING_ORIGIN" => Self::MissingOrigin,
13994            "OVERLOADED_CREDENTIALS" => Self::OverloadedCredentials,
13995            "LOCATION_ORG_POLICY_VIOLATED" => Self::LocationOrgPolicyViolated,
13996            "TLS_ORG_POLICY_VIOLATED" => Self::TlsOrgPolicyViolated,
13997            "EMULATOR_QUOTA_EXCEEDED" => Self::EmulatorQuotaExceeded,
13998            "CREDENTIAL_ANDROID_APP_INVALID" => Self::CredentialAndroidAppInvalid,
13999            "IAM_PERMISSION_DENIED" => Self::IamPermissionDenied,
14000            "JWT_TOKEN_INVALID" => Self::JwtTokenInvalid,
14001            "CREDENTIAL_TYPE_UNSUPPORTED" => Self::CredentialTypeUnsupported,
14002            "ACCOUNT_TYPE_UNSUPPORTED" => Self::AccountTypeUnsupported,
14003            "ENDPOINT_USAGE_RESTRICTION_VIOLATED" => Self::EndpointUsageRestrictionViolated,
14004            "TLS_CIPHER_RESTRICTION_VIOLATED" => Self::TlsCipherRestrictionViolated,
14005            "MCP_SERVER_DISABLED" => Self::McpServerDisabled,
14006            _ => Self::UnknownValue(error_reason::UnknownValue(
14007                wkt::internal::UnknownEnumValue::String(value.to_string()),
14008            )),
14009        }
14010    }
14011}
14012
14013impl serde::ser::Serialize for ErrorReason {
14014    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14015    where
14016        S: serde::Serializer,
14017    {
14018        match self {
14019            Self::Unspecified => serializer.serialize_i32(0),
14020            Self::ServiceDisabled => serializer.serialize_i32(1),
14021            Self::BillingDisabled => serializer.serialize_i32(2),
14022            Self::ApiKeyInvalid => serializer.serialize_i32(3),
14023            Self::ApiKeyServiceBlocked => serializer.serialize_i32(4),
14024            Self::ApiKeyHttpReferrerBlocked => serializer.serialize_i32(7),
14025            Self::ApiKeyIpAddressBlocked => serializer.serialize_i32(8),
14026            Self::ApiKeyAndroidAppBlocked => serializer.serialize_i32(9),
14027            Self::ApiKeyIosAppBlocked => serializer.serialize_i32(13),
14028            Self::RateLimitExceeded => serializer.serialize_i32(5),
14029            Self::ResourceQuotaExceeded => serializer.serialize_i32(6),
14030            Self::LocationTaxPolicyViolated => serializer.serialize_i32(10),
14031            Self::UserProjectDenied => serializer.serialize_i32(11),
14032            Self::ConsumerSuspended => serializer.serialize_i32(12),
14033            Self::ConsumerInvalid => serializer.serialize_i32(14),
14034            Self::SecurityPolicyViolated => serializer.serialize_i32(15),
14035            Self::AccessTokenExpired => serializer.serialize_i32(16),
14036            Self::AccessTokenScopeInsufficient => serializer.serialize_i32(17),
14037            Self::AccountStateInvalid => serializer.serialize_i32(18),
14038            Self::AccessTokenTypeUnsupported => serializer.serialize_i32(19),
14039            Self::CredentialsMissing => serializer.serialize_i32(20),
14040            Self::ResourceProjectInvalid => serializer.serialize_i32(21),
14041            Self::SessionCookieInvalid => serializer.serialize_i32(23),
14042            Self::UserBlockedByAdmin => serializer.serialize_i32(24),
14043            Self::ResourceUsageRestrictionViolated => serializer.serialize_i32(25),
14044            Self::SystemParameterUnsupported => serializer.serialize_i32(26),
14045            Self::OrgRestrictionViolation => serializer.serialize_i32(27),
14046            Self::OrgRestrictionHeaderInvalid => serializer.serialize_i32(28),
14047            Self::ServiceNotVisible => serializer.serialize_i32(29),
14048            Self::GcpSuspended => serializer.serialize_i32(30),
14049            Self::LocationPolicyViolated => serializer.serialize_i32(31),
14050            Self::MissingOrigin => serializer.serialize_i32(33),
14051            Self::OverloadedCredentials => serializer.serialize_i32(34),
14052            Self::LocationOrgPolicyViolated => serializer.serialize_i32(35),
14053            Self::TlsOrgPolicyViolated => serializer.serialize_i32(36),
14054            Self::EmulatorQuotaExceeded => serializer.serialize_i32(38),
14055            Self::CredentialAndroidAppInvalid => serializer.serialize_i32(39),
14056            Self::IamPermissionDenied => serializer.serialize_i32(41),
14057            Self::JwtTokenInvalid => serializer.serialize_i32(42),
14058            Self::CredentialTypeUnsupported => serializer.serialize_i32(43),
14059            Self::AccountTypeUnsupported => serializer.serialize_i32(44),
14060            Self::EndpointUsageRestrictionViolated => serializer.serialize_i32(45),
14061            Self::TlsCipherRestrictionViolated => serializer.serialize_i32(46),
14062            Self::McpServerDisabled => serializer.serialize_i32(47),
14063            Self::UnknownValue(u) => u.0.serialize(serializer),
14064        }
14065    }
14066}
14067
14068impl<'de> serde::de::Deserialize<'de> for ErrorReason {
14069    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14070    where
14071        D: serde::Deserializer<'de>,
14072    {
14073        deserializer.deserialize_any(wkt::internal::EnumVisitor::<ErrorReason>::new(
14074            ".google.api.ErrorReason",
14075        ))
14076    }
14077}
14078
14079/// An indicator of the behavior of a given field (for example, that a field
14080/// is required in requests, or given as output but ignored as input).
14081/// This **does not** change the behavior in protocol buffers itself; it only
14082/// denotes the behavior and may affect how API tooling handles the field.
14083///
14084/// Note: This enum **may** receive new values in the future.
14085///
14086/// # Working with unknown values
14087///
14088/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14089/// additional enum variants at any time. Adding new variants is not considered
14090/// a breaking change. Applications should write their code in anticipation of:
14091///
14092/// - New values appearing in future releases of the client library, **and**
14093/// - New values received dynamically, without application changes.
14094///
14095/// Please consult the [Working with enums] section in the user guide for some
14096/// guidelines.
14097///
14098/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
14099#[derive(Clone, Debug, PartialEq)]
14100#[non_exhaustive]
14101pub enum FieldBehavior {
14102    /// Conventional default for enums. Do not use this.
14103    Unspecified,
14104    /// Specifically denotes a field as optional.
14105    /// While all fields in protocol buffers are optional, this may be specified
14106    /// for emphasis if appropriate.
14107    Optional,
14108    /// Denotes a field as required.
14109    /// This indicates that the field **must** be provided as part of the request,
14110    /// and failure to do so will cause an error (usually `INVALID_ARGUMENT`).
14111    Required,
14112    /// Denotes a field as output only.
14113    /// This indicates that the field is provided in responses, but including the
14114    /// field in a request does nothing (the server *must* ignore it and
14115    /// *must not* throw an error as a result of the field's presence).
14116    OutputOnly,
14117    /// Denotes a field as input only.
14118    /// This indicates that the field is provided in requests, and the
14119    /// corresponding field is not included in output.
14120    InputOnly,
14121    /// Denotes a field as immutable.
14122    /// This indicates that the field may be set once in a request to create a
14123    /// resource, but may not be changed thereafter.
14124    Immutable,
14125    /// Denotes that a (repeated) field is an unordered list.
14126    /// This indicates that the service may provide the elements of the list
14127    /// in any arbitrary  order, rather than the order the user originally
14128    /// provided. Additionally, the list's order may or may not be stable.
14129    UnorderedList,
14130    /// Denotes that this field returns a non-empty default value if not set.
14131    /// This indicates that if the user provides the empty value in a request,
14132    /// a non-empty value will be returned. The user will not be aware of what
14133    /// non-empty value to expect.
14134    NonEmptyDefault,
14135    /// Denotes that the field in a resource (a message annotated with
14136    /// google.api.resource) is used in the resource name to uniquely identify the
14137    /// resource. For AIP-compliant APIs, this should only be applied to the
14138    /// `name` field on the resource.
14139    ///
14140    /// This behavior should not be applied to references to other resources within
14141    /// the message.
14142    ///
14143    /// The identifier field of resources often have different field behavior
14144    /// depending on the request it is embedded in (e.g. for Create methods name
14145    /// is optional and unused, while for Update methods it is required). Instead
14146    /// of method-specific annotations, only `IDENTIFIER` is required.
14147    Identifier,
14148    /// If set, the enum was initialized with an unknown value.
14149    ///
14150    /// Applications can examine the value using [FieldBehavior::value] or
14151    /// [FieldBehavior::name].
14152    UnknownValue(field_behavior::UnknownValue),
14153}
14154
14155#[doc(hidden)]
14156pub mod field_behavior {
14157    #[allow(unused_imports)]
14158    use super::*;
14159    #[derive(Clone, Debug, PartialEq)]
14160    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14161}
14162
14163impl FieldBehavior {
14164    /// Gets the enum value.
14165    ///
14166    /// Returns `None` if the enum contains an unknown value deserialized from
14167    /// the string representation of enums.
14168    pub fn value(&self) -> std::option::Option<i32> {
14169        match self {
14170            Self::Unspecified => std::option::Option::Some(0),
14171            Self::Optional => std::option::Option::Some(1),
14172            Self::Required => std::option::Option::Some(2),
14173            Self::OutputOnly => std::option::Option::Some(3),
14174            Self::InputOnly => std::option::Option::Some(4),
14175            Self::Immutable => std::option::Option::Some(5),
14176            Self::UnorderedList => std::option::Option::Some(6),
14177            Self::NonEmptyDefault => std::option::Option::Some(7),
14178            Self::Identifier => std::option::Option::Some(8),
14179            Self::UnknownValue(u) => u.0.value(),
14180        }
14181    }
14182
14183    /// Gets the enum value as a string.
14184    ///
14185    /// Returns `None` if the enum contains an unknown value deserialized from
14186    /// the integer representation of enums.
14187    pub fn name(&self) -> std::option::Option<&str> {
14188        match self {
14189            Self::Unspecified => std::option::Option::Some("FIELD_BEHAVIOR_UNSPECIFIED"),
14190            Self::Optional => std::option::Option::Some("OPTIONAL"),
14191            Self::Required => std::option::Option::Some("REQUIRED"),
14192            Self::OutputOnly => std::option::Option::Some("OUTPUT_ONLY"),
14193            Self::InputOnly => std::option::Option::Some("INPUT_ONLY"),
14194            Self::Immutable => std::option::Option::Some("IMMUTABLE"),
14195            Self::UnorderedList => std::option::Option::Some("UNORDERED_LIST"),
14196            Self::NonEmptyDefault => std::option::Option::Some("NON_EMPTY_DEFAULT"),
14197            Self::Identifier => std::option::Option::Some("IDENTIFIER"),
14198            Self::UnknownValue(u) => u.0.name(),
14199        }
14200    }
14201}
14202
14203impl std::default::Default for FieldBehavior {
14204    fn default() -> Self {
14205        use std::convert::From;
14206        Self::from(0)
14207    }
14208}
14209
14210impl std::fmt::Display for FieldBehavior {
14211    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14212        wkt::internal::display_enum(f, self.name(), self.value())
14213    }
14214}
14215
14216impl std::convert::From<i32> for FieldBehavior {
14217    fn from(value: i32) -> Self {
14218        match value {
14219            0 => Self::Unspecified,
14220            1 => Self::Optional,
14221            2 => Self::Required,
14222            3 => Self::OutputOnly,
14223            4 => Self::InputOnly,
14224            5 => Self::Immutable,
14225            6 => Self::UnorderedList,
14226            7 => Self::NonEmptyDefault,
14227            8 => Self::Identifier,
14228            _ => Self::UnknownValue(field_behavior::UnknownValue(
14229                wkt::internal::UnknownEnumValue::Integer(value),
14230            )),
14231        }
14232    }
14233}
14234
14235impl std::convert::From<&str> for FieldBehavior {
14236    fn from(value: &str) -> Self {
14237        use std::string::ToString;
14238        match value {
14239            "FIELD_BEHAVIOR_UNSPECIFIED" => Self::Unspecified,
14240            "OPTIONAL" => Self::Optional,
14241            "REQUIRED" => Self::Required,
14242            "OUTPUT_ONLY" => Self::OutputOnly,
14243            "INPUT_ONLY" => Self::InputOnly,
14244            "IMMUTABLE" => Self::Immutable,
14245            "UNORDERED_LIST" => Self::UnorderedList,
14246            "NON_EMPTY_DEFAULT" => Self::NonEmptyDefault,
14247            "IDENTIFIER" => Self::Identifier,
14248            _ => Self::UnknownValue(field_behavior::UnknownValue(
14249                wkt::internal::UnknownEnumValue::String(value.to_string()),
14250            )),
14251        }
14252    }
14253}
14254
14255impl serde::ser::Serialize for FieldBehavior {
14256    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14257    where
14258        S: serde::Serializer,
14259    {
14260        match self {
14261            Self::Unspecified => serializer.serialize_i32(0),
14262            Self::Optional => serializer.serialize_i32(1),
14263            Self::Required => serializer.serialize_i32(2),
14264            Self::OutputOnly => serializer.serialize_i32(3),
14265            Self::InputOnly => serializer.serialize_i32(4),
14266            Self::Immutable => serializer.serialize_i32(5),
14267            Self::UnorderedList => serializer.serialize_i32(6),
14268            Self::NonEmptyDefault => serializer.serialize_i32(7),
14269            Self::Identifier => serializer.serialize_i32(8),
14270            Self::UnknownValue(u) => u.0.serialize(serializer),
14271        }
14272    }
14273}
14274
14275impl<'de> serde::de::Deserialize<'de> for FieldBehavior {
14276    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14277    where
14278        D: serde::Deserializer<'de>,
14279    {
14280        deserializer.deserialize_any(wkt::internal::EnumVisitor::<FieldBehavior>::new(
14281            ".google.api.FieldBehavior",
14282        ))
14283    }
14284}
14285
14286/// The launch stage as defined by [Google Cloud Platform
14287/// Launch Stages](https://cloud.google.com/terms/launch-stages).
14288///
14289/// # Working with unknown values
14290///
14291/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14292/// additional enum variants at any time. Adding new variants is not considered
14293/// a breaking change. Applications should write their code in anticipation of:
14294///
14295/// - New values appearing in future releases of the client library, **and**
14296/// - New values received dynamically, without application changes.
14297///
14298/// Please consult the [Working with enums] section in the user guide for some
14299/// guidelines.
14300///
14301/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
14302#[derive(Clone, Debug, PartialEq)]
14303#[non_exhaustive]
14304pub enum LaunchStage {
14305    /// Do not use this default value.
14306    Unspecified,
14307    /// The feature is not yet implemented. Users can not use it.
14308    Unimplemented,
14309    /// Prelaunch features are hidden from users and are only visible internally.
14310    Prelaunch,
14311    /// Early Access features are limited to a closed group of testers. To use
14312    /// these features, you must sign up in advance and sign a Trusted Tester
14313    /// agreement (which includes confidentiality provisions). These features may
14314    /// be unstable, changed in backward-incompatible ways, and are not
14315    /// guaranteed to be released.
14316    EarlyAccess,
14317    /// Alpha is a limited availability test for releases before they are cleared
14318    /// for widespread use. By Alpha, all significant design issues are resolved
14319    /// and we are in the process of verifying functionality. Alpha customers
14320    /// need to apply for access, agree to applicable terms, and have their
14321    /// projects allowlisted. Alpha releases don't have to be feature complete,
14322    /// no SLAs are provided, and there are no technical support obligations, but
14323    /// they will be far enough along that customers can actually use them in
14324    /// test environments or for limited-use tests -- just like they would in
14325    /// normal production cases.
14326    Alpha,
14327    /// Beta is the point at which we are ready to open a release for any
14328    /// customer to use. There are no SLA or technical support obligations in a
14329    /// Beta release. Products will be complete from a feature perspective, but
14330    /// may have some open outstanding issues. Beta releases are suitable for
14331    /// limited production use cases.
14332    Beta,
14333    /// GA features are open to all developers and are considered stable and
14334    /// fully qualified for production use.
14335    Ga,
14336    /// Deprecated features are scheduled to be shut down and removed. For more
14337    /// information, see the "Deprecation Policy" section of our [Terms of
14338    /// Service](https://cloud.google.com/terms/)
14339    /// and the [Google Cloud Platform Subject to the Deprecation
14340    /// Policy](https://cloud.google.com/terms/deprecation) documentation.
14341    Deprecated,
14342    /// If set, the enum was initialized with an unknown value.
14343    ///
14344    /// Applications can examine the value using [LaunchStage::value] or
14345    /// [LaunchStage::name].
14346    UnknownValue(launch_stage::UnknownValue),
14347}
14348
14349#[doc(hidden)]
14350pub mod launch_stage {
14351    #[allow(unused_imports)]
14352    use super::*;
14353    #[derive(Clone, Debug, PartialEq)]
14354    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14355}
14356
14357impl LaunchStage {
14358    /// Gets the enum value.
14359    ///
14360    /// Returns `None` if the enum contains an unknown value deserialized from
14361    /// the string representation of enums.
14362    pub fn value(&self) -> std::option::Option<i32> {
14363        match self {
14364            Self::Unspecified => std::option::Option::Some(0),
14365            Self::Unimplemented => std::option::Option::Some(6),
14366            Self::Prelaunch => std::option::Option::Some(7),
14367            Self::EarlyAccess => std::option::Option::Some(1),
14368            Self::Alpha => std::option::Option::Some(2),
14369            Self::Beta => std::option::Option::Some(3),
14370            Self::Ga => std::option::Option::Some(4),
14371            Self::Deprecated => std::option::Option::Some(5),
14372            Self::UnknownValue(u) => u.0.value(),
14373        }
14374    }
14375
14376    /// Gets the enum value as a string.
14377    ///
14378    /// Returns `None` if the enum contains an unknown value deserialized from
14379    /// the integer representation of enums.
14380    pub fn name(&self) -> std::option::Option<&str> {
14381        match self {
14382            Self::Unspecified => std::option::Option::Some("LAUNCH_STAGE_UNSPECIFIED"),
14383            Self::Unimplemented => std::option::Option::Some("UNIMPLEMENTED"),
14384            Self::Prelaunch => std::option::Option::Some("PRELAUNCH"),
14385            Self::EarlyAccess => std::option::Option::Some("EARLY_ACCESS"),
14386            Self::Alpha => std::option::Option::Some("ALPHA"),
14387            Self::Beta => std::option::Option::Some("BETA"),
14388            Self::Ga => std::option::Option::Some("GA"),
14389            Self::Deprecated => std::option::Option::Some("DEPRECATED"),
14390            Self::UnknownValue(u) => u.0.name(),
14391        }
14392    }
14393}
14394
14395impl std::default::Default for LaunchStage {
14396    fn default() -> Self {
14397        use std::convert::From;
14398        Self::from(0)
14399    }
14400}
14401
14402impl std::fmt::Display for LaunchStage {
14403    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14404        wkt::internal::display_enum(f, self.name(), self.value())
14405    }
14406}
14407
14408impl std::convert::From<i32> for LaunchStage {
14409    fn from(value: i32) -> Self {
14410        match value {
14411            0 => Self::Unspecified,
14412            1 => Self::EarlyAccess,
14413            2 => Self::Alpha,
14414            3 => Self::Beta,
14415            4 => Self::Ga,
14416            5 => Self::Deprecated,
14417            6 => Self::Unimplemented,
14418            7 => Self::Prelaunch,
14419            _ => Self::UnknownValue(launch_stage::UnknownValue(
14420                wkt::internal::UnknownEnumValue::Integer(value),
14421            )),
14422        }
14423    }
14424}
14425
14426impl std::convert::From<&str> for LaunchStage {
14427    fn from(value: &str) -> Self {
14428        use std::string::ToString;
14429        match value {
14430            "LAUNCH_STAGE_UNSPECIFIED" => Self::Unspecified,
14431            "UNIMPLEMENTED" => Self::Unimplemented,
14432            "PRELAUNCH" => Self::Prelaunch,
14433            "EARLY_ACCESS" => Self::EarlyAccess,
14434            "ALPHA" => Self::Alpha,
14435            "BETA" => Self::Beta,
14436            "GA" => Self::Ga,
14437            "DEPRECATED" => Self::Deprecated,
14438            _ => Self::UnknownValue(launch_stage::UnknownValue(
14439                wkt::internal::UnknownEnumValue::String(value.to_string()),
14440            )),
14441        }
14442    }
14443}
14444
14445impl serde::ser::Serialize for LaunchStage {
14446    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14447    where
14448        S: serde::Serializer,
14449    {
14450        match self {
14451            Self::Unspecified => serializer.serialize_i32(0),
14452            Self::Unimplemented => serializer.serialize_i32(6),
14453            Self::Prelaunch => serializer.serialize_i32(7),
14454            Self::EarlyAccess => serializer.serialize_i32(1),
14455            Self::Alpha => serializer.serialize_i32(2),
14456            Self::Beta => serializer.serialize_i32(3),
14457            Self::Ga => serializer.serialize_i32(4),
14458            Self::Deprecated => serializer.serialize_i32(5),
14459            Self::UnknownValue(u) => u.0.serialize(serializer),
14460        }
14461    }
14462}
14463
14464impl<'de> serde::de::Deserialize<'de> for LaunchStage {
14465    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14466    where
14467        D: serde::Deserializer<'de>,
14468    {
14469        deserializer.deserialize_any(wkt::internal::EnumVisitor::<LaunchStage>::new(
14470            ".google.api.LaunchStage",
14471        ))
14472    }
14473}