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::bare_urls)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![allow(rustdoc::invalid_html_tags)]
20#![allow(rustdoc::redundant_explicit_links)]
21#![no_implicit_prelude]
22extern crate bytes;
23extern crate serde;
24extern crate serde_json;
25extern crate serde_with;
26extern crate std;
27extern crate wkt;
28
29mod debug;
30mod deserialize;
31mod serialize;
32
33/// `Authentication` defines the authentication configuration for API methods
34/// provided by an API service.
35///
36/// Example:
37///
38/// ```norust
39/// name: calendar.googleapis.com
40/// authentication:
41///   providers:
42///   - id: google_calendar_auth
43///     jwks_uri: https://www.googleapis.com/oauth2/v1/certs
44///     issuer: https://securetoken.google.com
45///   rules:
46///   - selector: "*"
47///     requirements:
48///       provider_id: google_calendar_auth
49///   - selector: google.calendar.Delegate
50///     oauth:
51///       canonical_scopes: https://www.googleapis.com/auth/calendar.read
52/// ```
53#[derive(Clone, Default, PartialEq)]
54#[non_exhaustive]
55pub struct Authentication {
56    /// A list of authentication rules that apply to individual API methods.
57    ///
58    /// **NOTE:** All service configuration rules follow "last one wins" order.
59    pub rules: std::vec::Vec<crate::model::AuthenticationRule>,
60
61    /// Defines a set of authentication providers that a service supports.
62    pub providers: std::vec::Vec<crate::model::AuthProvider>,
63
64    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
65}
66
67impl Authentication {
68    /// Creates a new default instance.
69    pub fn new() -> Self {
70        std::default::Default::default()
71    }
72
73    /// Sets the value of [rules][crate::model::Authentication::rules].
74    ///
75    /// # Example
76    /// ```ignore,no_run
77    /// # use google_cloud_api::model::Authentication;
78    /// use google_cloud_api::model::AuthenticationRule;
79    /// let x = Authentication::new()
80    ///     .set_rules([
81    ///         AuthenticationRule::default()/* use setters */,
82    ///         AuthenticationRule::default()/* use (different) setters */,
83    ///     ]);
84    /// ```
85    pub fn set_rules<T, V>(mut self, v: T) -> Self
86    where
87        T: std::iter::IntoIterator<Item = V>,
88        V: std::convert::Into<crate::model::AuthenticationRule>,
89    {
90        use std::iter::Iterator;
91        self.rules = v.into_iter().map(|i| i.into()).collect();
92        self
93    }
94
95    /// Sets the value of [providers][crate::model::Authentication::providers].
96    ///
97    /// # Example
98    /// ```ignore,no_run
99    /// # use google_cloud_api::model::Authentication;
100    /// use google_cloud_api::model::AuthProvider;
101    /// let x = Authentication::new()
102    ///     .set_providers([
103    ///         AuthProvider::default()/* use setters */,
104    ///         AuthProvider::default()/* use (different) setters */,
105    ///     ]);
106    /// ```
107    pub fn set_providers<T, V>(mut self, v: T) -> Self
108    where
109        T: std::iter::IntoIterator<Item = V>,
110        V: std::convert::Into<crate::model::AuthProvider>,
111    {
112        use std::iter::Iterator;
113        self.providers = v.into_iter().map(|i| i.into()).collect();
114        self
115    }
116}
117
118impl wkt::message::Message for Authentication {
119    fn typename() -> &'static str {
120        "type.googleapis.com/google.api.Authentication"
121    }
122}
123
124/// Authentication rules for the service.
125///
126/// By default, if a method has any authentication requirements, every request
127/// must include a valid credential matching one of the requirements.
128/// It's an error to include more than one kind of credential in a single
129/// request.
130///
131/// If a method doesn't have any auth requirements, request credentials will be
132/// ignored.
133#[derive(Clone, Default, PartialEq)]
134#[non_exhaustive]
135pub struct AuthenticationRule {
136    /// Selects the methods to which this rule applies.
137    ///
138    /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
139    /// details.
140    ///
141    /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
142    pub selector: std::string::String,
143
144    /// The requirements for OAuth credentials.
145    pub oauth: std::option::Option<crate::model::OAuthRequirements>,
146
147    /// If true, the service accepts API keys without any other credential.
148    /// This flag only applies to HTTP and gRPC requests.
149    pub allow_without_credential: bool,
150
151    /// Requirements for additional authentication providers.
152    pub requirements: std::vec::Vec<crate::model::AuthRequirement>,
153
154    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
155}
156
157impl AuthenticationRule {
158    /// Creates a new default instance.
159    pub fn new() -> Self {
160        std::default::Default::default()
161    }
162
163    /// Sets the value of [selector][crate::model::AuthenticationRule::selector].
164    ///
165    /// # Example
166    /// ```ignore,no_run
167    /// # use google_cloud_api::model::AuthenticationRule;
168    /// let x = AuthenticationRule::new().set_selector("example");
169    /// ```
170    pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
171        self.selector = v.into();
172        self
173    }
174
175    /// Sets the value of [oauth][crate::model::AuthenticationRule::oauth].
176    ///
177    /// # Example
178    /// ```ignore,no_run
179    /// # use google_cloud_api::model::AuthenticationRule;
180    /// use google_cloud_api::model::OAuthRequirements;
181    /// let x = AuthenticationRule::new().set_oauth(OAuthRequirements::default()/* use setters */);
182    /// ```
183    pub fn set_oauth<T>(mut self, v: T) -> Self
184    where
185        T: std::convert::Into<crate::model::OAuthRequirements>,
186    {
187        self.oauth = std::option::Option::Some(v.into());
188        self
189    }
190
191    /// Sets or clears the value of [oauth][crate::model::AuthenticationRule::oauth].
192    ///
193    /// # Example
194    /// ```ignore,no_run
195    /// # use google_cloud_api::model::AuthenticationRule;
196    /// use google_cloud_api::model::OAuthRequirements;
197    /// let x = AuthenticationRule::new().set_or_clear_oauth(Some(OAuthRequirements::default()/* use setters */));
198    /// let x = AuthenticationRule::new().set_or_clear_oauth(None::<OAuthRequirements>);
199    /// ```
200    pub fn set_or_clear_oauth<T>(mut self, v: std::option::Option<T>) -> Self
201    where
202        T: std::convert::Into<crate::model::OAuthRequirements>,
203    {
204        self.oauth = v.map(|x| x.into());
205        self
206    }
207
208    /// Sets the value of [allow_without_credential][crate::model::AuthenticationRule::allow_without_credential].
209    ///
210    /// # Example
211    /// ```ignore,no_run
212    /// # use google_cloud_api::model::AuthenticationRule;
213    /// let x = AuthenticationRule::new().set_allow_without_credential(true);
214    /// ```
215    pub fn set_allow_without_credential<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
216        self.allow_without_credential = v.into();
217        self
218    }
219
220    /// Sets the value of [requirements][crate::model::AuthenticationRule::requirements].
221    ///
222    /// # Example
223    /// ```ignore,no_run
224    /// # use google_cloud_api::model::AuthenticationRule;
225    /// use google_cloud_api::model::AuthRequirement;
226    /// let x = AuthenticationRule::new()
227    ///     .set_requirements([
228    ///         AuthRequirement::default()/* use setters */,
229    ///         AuthRequirement::default()/* use (different) setters */,
230    ///     ]);
231    /// ```
232    pub fn set_requirements<T, V>(mut self, v: T) -> Self
233    where
234        T: std::iter::IntoIterator<Item = V>,
235        V: std::convert::Into<crate::model::AuthRequirement>,
236    {
237        use std::iter::Iterator;
238        self.requirements = v.into_iter().map(|i| i.into()).collect();
239        self
240    }
241}
242
243impl wkt::message::Message for AuthenticationRule {
244    fn typename() -> &'static str {
245        "type.googleapis.com/google.api.AuthenticationRule"
246    }
247}
248
249/// Specifies a location to extract JWT from an API request.
250#[derive(Clone, Default, PartialEq)]
251#[non_exhaustive]
252pub struct JwtLocation {
253    /// The value prefix. The value format is "value_prefix{token}"
254    /// Only applies to "in" header type. Must be empty for "in" query type.
255    /// If not empty, the header value has to match (case sensitive) this prefix.
256    /// If not matched, JWT will not be extracted. If matched, JWT will be
257    /// extracted after the prefix is removed.
258    ///
259    /// For example, for "Authorization: Bearer {JWT}",
260    /// value_prefix="Bearer " with a space at the end.
261    pub value_prefix: std::string::String,
262
263    #[allow(missing_docs)]
264    pub r#in: std::option::Option<crate::model::jwt_location::In>,
265
266    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
267}
268
269impl JwtLocation {
270    /// Creates a new default instance.
271    pub fn new() -> Self {
272        std::default::Default::default()
273    }
274
275    /// Sets the value of [value_prefix][crate::model::JwtLocation::value_prefix].
276    ///
277    /// # Example
278    /// ```ignore,no_run
279    /// # use google_cloud_api::model::JwtLocation;
280    /// let x = JwtLocation::new().set_value_prefix("example");
281    /// ```
282    pub fn set_value_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
283        self.value_prefix = v.into();
284        self
285    }
286
287    /// Sets the value of [r#in][crate::model::JwtLocation::in].
288    ///
289    /// Note that all the setters affecting `r#in` are mutually
290    /// exclusive.
291    ///
292    /// # Example
293    /// ```ignore,no_run
294    /// # use google_cloud_api::model::JwtLocation;
295    /// use google_cloud_api::model::jwt_location::In;
296    /// let x = JwtLocation::new().set_in(Some(In::Header("example".to_string())));
297    /// ```
298    pub fn set_in<T: std::convert::Into<std::option::Option<crate::model::jwt_location::In>>>(
299        mut self,
300        v: T,
301    ) -> Self {
302        self.r#in = v.into();
303        self
304    }
305
306    /// The value of [r#in][crate::model::JwtLocation::r#in]
307    /// if it holds a `Header`, `None` if the field is not set or
308    /// holds a different branch.
309    pub fn header(&self) -> std::option::Option<&std::string::String> {
310        #[allow(unreachable_patterns)]
311        self.r#in.as_ref().and_then(|v| match v {
312            crate::model::jwt_location::In::Header(v) => std::option::Option::Some(v),
313            _ => std::option::Option::None,
314        })
315    }
316
317    /// Sets the value of [r#in][crate::model::JwtLocation::r#in]
318    /// to hold a `Header`.
319    ///
320    /// Note that all the setters affecting `r#in` are
321    /// mutually exclusive.
322    ///
323    /// # Example
324    /// ```ignore,no_run
325    /// # use google_cloud_api::model::JwtLocation;
326    /// let x = JwtLocation::new().set_header("example");
327    /// assert!(x.header().is_some());
328    /// assert!(x.query().is_none());
329    /// assert!(x.cookie().is_none());
330    /// ```
331    pub fn set_header<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
332        self.r#in = std::option::Option::Some(crate::model::jwt_location::In::Header(v.into()));
333        self
334    }
335
336    /// The value of [r#in][crate::model::JwtLocation::r#in]
337    /// if it holds a `Query`, `None` if the field is not set or
338    /// holds a different branch.
339    pub fn query(&self) -> std::option::Option<&std::string::String> {
340        #[allow(unreachable_patterns)]
341        self.r#in.as_ref().and_then(|v| match v {
342            crate::model::jwt_location::In::Query(v) => std::option::Option::Some(v),
343            _ => std::option::Option::None,
344        })
345    }
346
347    /// Sets the value of [r#in][crate::model::JwtLocation::r#in]
348    /// to hold a `Query`.
349    ///
350    /// Note that all the setters affecting `r#in` are
351    /// mutually exclusive.
352    ///
353    /// # Example
354    /// ```ignore,no_run
355    /// # use google_cloud_api::model::JwtLocation;
356    /// let x = JwtLocation::new().set_query("example");
357    /// assert!(x.query().is_some());
358    /// assert!(x.header().is_none());
359    /// assert!(x.cookie().is_none());
360    /// ```
361    pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
362        self.r#in = std::option::Option::Some(crate::model::jwt_location::In::Query(v.into()));
363        self
364    }
365
366    /// The value of [r#in][crate::model::JwtLocation::r#in]
367    /// if it holds a `Cookie`, `None` if the field is not set or
368    /// holds a different branch.
369    pub fn cookie(&self) -> std::option::Option<&std::string::String> {
370        #[allow(unreachable_patterns)]
371        self.r#in.as_ref().and_then(|v| match v {
372            crate::model::jwt_location::In::Cookie(v) => std::option::Option::Some(v),
373            _ => std::option::Option::None,
374        })
375    }
376
377    /// Sets the value of [r#in][crate::model::JwtLocation::r#in]
378    /// to hold a `Cookie`.
379    ///
380    /// Note that all the setters affecting `r#in` are
381    /// mutually exclusive.
382    ///
383    /// # Example
384    /// ```ignore,no_run
385    /// # use google_cloud_api::model::JwtLocation;
386    /// let x = JwtLocation::new().set_cookie("example");
387    /// assert!(x.cookie().is_some());
388    /// assert!(x.header().is_none());
389    /// assert!(x.query().is_none());
390    /// ```
391    pub fn set_cookie<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
392        self.r#in = std::option::Option::Some(crate::model::jwt_location::In::Cookie(v.into()));
393        self
394    }
395}
396
397impl wkt::message::Message for JwtLocation {
398    fn typename() -> &'static str {
399        "type.googleapis.com/google.api.JwtLocation"
400    }
401}
402
403/// Defines additional types related to [JwtLocation].
404pub mod jwt_location {
405    #[allow(unused_imports)]
406    use super::*;
407
408    #[allow(missing_docs)]
409    #[derive(Clone, Debug, PartialEq)]
410    #[non_exhaustive]
411    pub enum In {
412        /// Specifies HTTP header name to extract JWT token.
413        Header(std::string::String),
414        /// Specifies URL query parameter name to extract JWT token.
415        Query(std::string::String),
416        /// Specifies cookie name to extract JWT token.
417        Cookie(std::string::String),
418    }
419}
420
421/// Configuration for an authentication provider, including support for
422/// [JSON Web Token
423/// (JWT)](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32).
424#[derive(Clone, Default, PartialEq)]
425#[non_exhaustive]
426pub struct AuthProvider {
427    /// The unique identifier of the auth provider. It will be referred to by
428    /// `AuthRequirement.provider_id`.
429    ///
430    /// Example: "bookstore_auth".
431    pub id: std::string::String,
432
433    /// Identifies the principal that issued the JWT. See
434    /// <https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.1>
435    /// Usually a URL or an email address.
436    ///
437    /// Example: <https://securetoken.google.com>
438    /// Example: 1234567-compute@developer.gserviceaccount.com
439    pub issuer: std::string::String,
440
441    /// URL of the provider's public key set to validate signature of the JWT. See
442    /// [OpenID
443    /// Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata).
444    /// Optional if the key set document:
445    ///
446    /// - can be retrieved from
447    ///   [OpenID
448    ///   Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html)
449    ///   of the issuer.
450    /// - can be inferred from the email domain of the issuer (e.g. a Google
451    ///   service account).
452    ///
453    /// Example: <https://www.googleapis.com/oauth2/v1/certs>
454    pub jwks_uri: std::string::String,
455
456    /// The list of JWT
457    /// [audiences](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.3).
458    /// that are allowed to access. A JWT containing any of these audiences will
459    /// be accepted. When this setting is absent, JWTs with audiences:
460    ///
461    /// - "https://[service.name]/[google.protobuf.Api.name]"
462    /// - "https://[service.name]/"
463    ///   will be accepted.
464    ///   For example, if no audiences are in the setting, LibraryService API will
465    ///   accept JWTs with the following audiences:
466    /// - <https://library-example.googleapis.com/google.example.library.v1.LibraryService>
467    /// - <https://library-example.googleapis.com/>
468    ///
469    /// Example:
470    ///
471    /// ```norust
472    /// audiences: bookstore_android.apps.googleusercontent.com,
473    ///            bookstore_web.apps.googleusercontent.com
474    /// ```
475    pub audiences: std::string::String,
476
477    /// Redirect URL if JWT token is required but not present or is expired.
478    /// Implement authorizationUrl of securityDefinitions in OpenAPI spec.
479    pub authorization_url: std::string::String,
480
481    /// Defines the locations to extract the JWT.  For now it is only used by the
482    /// Cloud Endpoints to store the OpenAPI extension [x-google-jwt-locations]
483    /// (<https://cloud.google.com/endpoints/docs/openapi/openapi-extensions#x-google-jwt-locations>)
484    ///
485    /// JWT locations can be one of HTTP headers, URL query parameters or
486    /// cookies. The rule is that the first match wins.
487    ///
488    /// If not specified,  default to use following 3 locations:
489    ///
490    /// 1. Authorization: Bearer
491    /// 1. x-goog-iap-jwt-assertion
492    /// 1. access_token query parameter
493    ///
494    /// Default locations can be specified as followings:
495    /// jwt_locations:
496    ///
497    /// - header: Authorization
498    ///   value_prefix: "Bearer "
499    /// - header: x-goog-iap-jwt-assertion
500    /// - query: access_token
501    pub jwt_locations: std::vec::Vec<crate::model::JwtLocation>,
502
503    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
504}
505
506impl AuthProvider {
507    /// Creates a new default instance.
508    pub fn new() -> Self {
509        std::default::Default::default()
510    }
511
512    /// Sets the value of [id][crate::model::AuthProvider::id].
513    ///
514    /// # Example
515    /// ```ignore,no_run
516    /// # use google_cloud_api::model::AuthProvider;
517    /// let x = AuthProvider::new().set_id("example");
518    /// ```
519    pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
520        self.id = v.into();
521        self
522    }
523
524    /// Sets the value of [issuer][crate::model::AuthProvider::issuer].
525    ///
526    /// # Example
527    /// ```ignore,no_run
528    /// # use google_cloud_api::model::AuthProvider;
529    /// let x = AuthProvider::new().set_issuer("example");
530    /// ```
531    pub fn set_issuer<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
532        self.issuer = v.into();
533        self
534    }
535
536    /// Sets the value of [jwks_uri][crate::model::AuthProvider::jwks_uri].
537    ///
538    /// # Example
539    /// ```ignore,no_run
540    /// # use google_cloud_api::model::AuthProvider;
541    /// let x = AuthProvider::new().set_jwks_uri("example");
542    /// ```
543    pub fn set_jwks_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
544        self.jwks_uri = v.into();
545        self
546    }
547
548    /// Sets the value of [audiences][crate::model::AuthProvider::audiences].
549    ///
550    /// # Example
551    /// ```ignore,no_run
552    /// # use google_cloud_api::model::AuthProvider;
553    /// let x = AuthProvider::new().set_audiences("example");
554    /// ```
555    pub fn set_audiences<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
556        self.audiences = v.into();
557        self
558    }
559
560    /// Sets the value of [authorization_url][crate::model::AuthProvider::authorization_url].
561    ///
562    /// # Example
563    /// ```ignore,no_run
564    /// # use google_cloud_api::model::AuthProvider;
565    /// let x = AuthProvider::new().set_authorization_url("example");
566    /// ```
567    pub fn set_authorization_url<T: std::convert::Into<std::string::String>>(
568        mut self,
569        v: T,
570    ) -> Self {
571        self.authorization_url = v.into();
572        self
573    }
574
575    /// Sets the value of [jwt_locations][crate::model::AuthProvider::jwt_locations].
576    ///
577    /// # Example
578    /// ```ignore,no_run
579    /// # use google_cloud_api::model::AuthProvider;
580    /// use google_cloud_api::model::JwtLocation;
581    /// let x = AuthProvider::new()
582    ///     .set_jwt_locations([
583    ///         JwtLocation::default()/* use setters */,
584    ///         JwtLocation::default()/* use (different) setters */,
585    ///     ]);
586    /// ```
587    pub fn set_jwt_locations<T, V>(mut self, v: T) -> Self
588    where
589        T: std::iter::IntoIterator<Item = V>,
590        V: std::convert::Into<crate::model::JwtLocation>,
591    {
592        use std::iter::Iterator;
593        self.jwt_locations = v.into_iter().map(|i| i.into()).collect();
594        self
595    }
596}
597
598impl wkt::message::Message for AuthProvider {
599    fn typename() -> &'static str {
600        "type.googleapis.com/google.api.AuthProvider"
601    }
602}
603
604/// OAuth scopes are a way to define data and permissions on data. For example,
605/// there are scopes defined for "Read-only access to Google Calendar" and
606/// "Access to Cloud Platform". Users can consent to a scope for an application,
607/// giving it permission to access that data on their behalf.
608///
609/// OAuth scope specifications should be fairly coarse grained; a user will need
610/// to see and understand the text description of what your scope means.
611///
612/// In most cases: use one or at most two OAuth scopes for an entire family of
613/// products. If your product has multiple APIs, you should probably be sharing
614/// the OAuth scope across all of those APIs.
615///
616/// When you need finer grained OAuth consent screens: talk with your product
617/// management about how developers will use them in practice.
618///
619/// Please note that even though each of the canonical scopes is enough for a
620/// request to be accepted and passed to the backend, a request can still fail
621/// due to the backend requiring additional scopes or permissions.
622#[derive(Clone, Default, PartialEq)]
623#[non_exhaustive]
624pub struct OAuthRequirements {
625    /// The list of publicly documented OAuth scopes that are allowed access. An
626    /// OAuth token containing any of these scopes will be accepted.
627    ///
628    /// Example:
629    ///
630    /// ```norust
631    ///  canonical_scopes: https://www.googleapis.com/auth/calendar,
632    ///                    https://www.googleapis.com/auth/calendar.read
633    /// ```
634    pub canonical_scopes: std::string::String,
635
636    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
637}
638
639impl OAuthRequirements {
640    /// Creates a new default instance.
641    pub fn new() -> Self {
642        std::default::Default::default()
643    }
644
645    /// Sets the value of [canonical_scopes][crate::model::OAuthRequirements::canonical_scopes].
646    ///
647    /// # Example
648    /// ```ignore,no_run
649    /// # use google_cloud_api::model::OAuthRequirements;
650    /// let x = OAuthRequirements::new().set_canonical_scopes("example");
651    /// ```
652    pub fn set_canonical_scopes<T: std::convert::Into<std::string::String>>(
653        mut self,
654        v: T,
655    ) -> Self {
656        self.canonical_scopes = v.into();
657        self
658    }
659}
660
661impl wkt::message::Message for OAuthRequirements {
662    fn typename() -> &'static str {
663        "type.googleapis.com/google.api.OAuthRequirements"
664    }
665}
666
667/// User-defined authentication requirements, including support for
668/// [JSON Web Token
669/// (JWT)](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32).
670#[derive(Clone, Default, PartialEq)]
671#[non_exhaustive]
672pub struct AuthRequirement {
673    /// [id][google.api.AuthProvider.id] from authentication provider.
674    ///
675    /// Example:
676    ///
677    /// ```norust
678    /// provider_id: bookstore_auth
679    /// ```
680    ///
681    /// [google.api.AuthProvider.id]: crate::model::AuthProvider::id
682    pub provider_id: std::string::String,
683
684    /// NOTE: This will be deprecated soon, once AuthProvider.audiences is
685    /// implemented and accepted in all the runtime components.
686    ///
687    /// The list of JWT
688    /// [audiences](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.3).
689    /// that are allowed to access. A JWT containing any of these audiences will
690    /// be accepted. When this setting is absent, only JWTs with audience
691    /// "https://[Service_name][google.api.Service.name]/[API_name][google.protobuf.Api.name]"
692    /// will be accepted. For example, if no audiences are in the setting,
693    /// LibraryService API will only accept JWTs with the following audience
694    /// `https://library-example.googleapis.com/google.example.library.v1.LibraryService`.
695    ///
696    /// Example:
697    ///
698    /// ```norust
699    /// audiences: bookstore_android.apps.googleusercontent.com,
700    ///            bookstore_web.apps.googleusercontent.com
701    /// ```
702    ///
703    /// [google.api.Service.name]: crate::model::Service::name
704    /// [google.protobuf.Api.name]: wkt::Api::name
705    pub audiences: std::string::String,
706
707    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
708}
709
710impl AuthRequirement {
711    /// Creates a new default instance.
712    pub fn new() -> Self {
713        std::default::Default::default()
714    }
715
716    /// Sets the value of [provider_id][crate::model::AuthRequirement::provider_id].
717    ///
718    /// # Example
719    /// ```ignore,no_run
720    /// # use google_cloud_api::model::AuthRequirement;
721    /// let x = AuthRequirement::new().set_provider_id("example");
722    /// ```
723    pub fn set_provider_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
724        self.provider_id = v.into();
725        self
726    }
727
728    /// Sets the value of [audiences][crate::model::AuthRequirement::audiences].
729    ///
730    /// # Example
731    /// ```ignore,no_run
732    /// # use google_cloud_api::model::AuthRequirement;
733    /// let x = AuthRequirement::new().set_audiences("example");
734    /// ```
735    pub fn set_audiences<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
736        self.audiences = v.into();
737        self
738    }
739}
740
741impl wkt::message::Message for AuthRequirement {
742    fn typename() -> &'static str {
743        "type.googleapis.com/google.api.AuthRequirement"
744    }
745}
746
747/// `Backend` defines the backend configuration for a service.
748#[derive(Clone, Default, PartialEq)]
749#[non_exhaustive]
750pub struct Backend {
751    /// A list of API backend rules that apply to individual API methods.
752    ///
753    /// **NOTE:** All service configuration rules follow "last one wins" order.
754    pub rules: std::vec::Vec<crate::model::BackendRule>,
755
756    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
757}
758
759impl Backend {
760    /// Creates a new default instance.
761    pub fn new() -> Self {
762        std::default::Default::default()
763    }
764
765    /// Sets the value of [rules][crate::model::Backend::rules].
766    ///
767    /// # Example
768    /// ```ignore,no_run
769    /// # use google_cloud_api::model::Backend;
770    /// use google_cloud_api::model::BackendRule;
771    /// let x = Backend::new()
772    ///     .set_rules([
773    ///         BackendRule::default()/* use setters */,
774    ///         BackendRule::default()/* use (different) setters */,
775    ///     ]);
776    /// ```
777    pub fn set_rules<T, V>(mut self, v: T) -> Self
778    where
779        T: std::iter::IntoIterator<Item = V>,
780        V: std::convert::Into<crate::model::BackendRule>,
781    {
782        use std::iter::Iterator;
783        self.rules = v.into_iter().map(|i| i.into()).collect();
784        self
785    }
786}
787
788impl wkt::message::Message for Backend {
789    fn typename() -> &'static str {
790        "type.googleapis.com/google.api.Backend"
791    }
792}
793
794/// A backend rule provides configuration for an individual API element.
795#[derive(Clone, Default, PartialEq)]
796#[non_exhaustive]
797pub struct BackendRule {
798    /// Selects the methods to which this rule applies.
799    ///
800    /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
801    /// details.
802    ///
803    /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
804    pub selector: std::string::String,
805
806    /// The address of the API backend.
807    ///
808    /// The scheme is used to determine the backend protocol and security.
809    /// The following schemes are accepted:
810    ///
811    /// SCHEME        PROTOCOL    SECURITY
812    /// http://       HTTP        None
813    /// https://      HTTP        TLS
814    /// grpc://       gRPC        None
815    /// grpcs://      gRPC        TLS
816    ///
817    /// It is recommended to explicitly include a scheme. Leaving out the scheme
818    /// may cause constrasting behaviors across platforms.
819    ///
820    /// If the port is unspecified, the default is:
821    ///
822    /// - 80 for schemes without TLS
823    /// - 443 for schemes with TLS
824    ///
825    /// For HTTP backends, use [protocol][google.api.BackendRule.protocol]
826    /// to specify the protocol version.
827    ///
828    /// [google.api.BackendRule.protocol]: crate::model::BackendRule::protocol
829    pub address: std::string::String,
830
831    /// The number of seconds to wait for a response from a request. The default
832    /// varies based on the request protocol and deployment environment.
833    pub deadline: f64,
834
835    /// Deprecated, do not use.
836    #[deprecated]
837    pub min_deadline: f64,
838
839    /// The number of seconds to wait for the completion of a long running
840    /// operation. The default is no deadline.
841    pub operation_deadline: f64,
842
843    /// Path translation specifies how to combine the backend address with the
844    /// request path in order to produce the appropriate forwarding URL for the
845    /// request. See [PathTranslation][google.api.BackendRule.PathTranslation] for
846    /// more details.
847    ///
848    /// [google.api.BackendRule.PathTranslation]: crate::model::backend_rule::PathTranslation
849    pub path_translation: crate::model::backend_rule::PathTranslation,
850
851    /// The protocol used for sending a request to the backend.
852    /// The supported values are "http/1.1" and "h2".
853    ///
854    /// The default value is inferred from the scheme in the
855    /// [address][google.api.BackendRule.address] field:
856    ///
857    /// SCHEME        PROTOCOL
858    /// http://       http/1.1
859    /// https://      http/1.1
860    /// grpc://       h2
861    /// grpcs://      h2
862    ///
863    /// For secure HTTP backends (https://) that support HTTP/2, set this field
864    /// to "h2" for improved performance.
865    ///
866    /// Configuring this field to non-default values is only supported for secure
867    /// HTTP backends. This field will be ignored for all other backends.
868    ///
869    /// See
870    /// <https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml#alpn-protocol-ids>
871    /// for more details on the supported values.
872    ///
873    /// [google.api.BackendRule.address]: crate::model::BackendRule::address
874    pub protocol: std::string::String,
875
876    /// The map between request protocol and the backend address.
877    pub overrides_by_request_protocol:
878        std::collections::HashMap<std::string::String, crate::model::BackendRule>,
879
880    /// The load balancing policy used for connection to the application backend.
881    ///
882    /// Defined as an arbitrary string to accomondate custom load balancing
883    /// policies supported by the underlying channel, but suggest most users use
884    /// one of the standard policies, such as the default, "RoundRobin".
885    pub load_balancing_policy: std::string::String,
886
887    /// Authentication settings used by the backend.
888    ///
889    /// These are typically used to provide service management functionality to
890    /// a backend served on a publicly-routable URL. The `authentication`
891    /// details should match the authentication behavior used by the backend.
892    ///
893    /// For example, specifying `jwt_audience` implies that the backend expects
894    /// authentication via a JWT.
895    ///
896    /// When authentication is unspecified, the resulting behavior is the same
897    /// as `disable_auth` set to `true`.
898    ///
899    /// Refer to <https://developers.google.com/identity/protocols/OpenIDConnect> for
900    /// JWT ID token.
901    pub authentication: std::option::Option<crate::model::backend_rule::Authentication>,
902
903    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
904}
905
906impl BackendRule {
907    /// Creates a new default instance.
908    pub fn new() -> Self {
909        std::default::Default::default()
910    }
911
912    /// Sets the value of [selector][crate::model::BackendRule::selector].
913    ///
914    /// # Example
915    /// ```ignore,no_run
916    /// # use google_cloud_api::model::BackendRule;
917    /// let x = BackendRule::new().set_selector("example");
918    /// ```
919    pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
920        self.selector = v.into();
921        self
922    }
923
924    /// Sets the value of [address][crate::model::BackendRule::address].
925    ///
926    /// # Example
927    /// ```ignore,no_run
928    /// # use google_cloud_api::model::BackendRule;
929    /// let x = BackendRule::new().set_address("example");
930    /// ```
931    pub fn set_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
932        self.address = v.into();
933        self
934    }
935
936    /// Sets the value of [deadline][crate::model::BackendRule::deadline].
937    ///
938    /// # Example
939    /// ```ignore,no_run
940    /// # use google_cloud_api::model::BackendRule;
941    /// let x = BackendRule::new().set_deadline(42.0);
942    /// ```
943    pub fn set_deadline<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
944        self.deadline = v.into();
945        self
946    }
947
948    /// Sets the value of [min_deadline][crate::model::BackendRule::min_deadline].
949    ///
950    /// # Example
951    /// ```ignore,no_run
952    /// # use google_cloud_api::model::BackendRule;
953    /// let x = BackendRule::new().set_min_deadline(42.0);
954    /// ```
955    #[deprecated]
956    pub fn set_min_deadline<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
957        self.min_deadline = v.into();
958        self
959    }
960
961    /// Sets the value of [operation_deadline][crate::model::BackendRule::operation_deadline].
962    ///
963    /// # Example
964    /// ```ignore,no_run
965    /// # use google_cloud_api::model::BackendRule;
966    /// let x = BackendRule::new().set_operation_deadline(42.0);
967    /// ```
968    pub fn set_operation_deadline<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
969        self.operation_deadline = v.into();
970        self
971    }
972
973    /// Sets the value of [path_translation][crate::model::BackendRule::path_translation].
974    ///
975    /// # Example
976    /// ```ignore,no_run
977    /// # use google_cloud_api::model::BackendRule;
978    /// use google_cloud_api::model::backend_rule::PathTranslation;
979    /// let x0 = BackendRule::new().set_path_translation(PathTranslation::ConstantAddress);
980    /// let x1 = BackendRule::new().set_path_translation(PathTranslation::AppendPathToAddress);
981    /// ```
982    pub fn set_path_translation<
983        T: std::convert::Into<crate::model::backend_rule::PathTranslation>,
984    >(
985        mut self,
986        v: T,
987    ) -> Self {
988        self.path_translation = v.into();
989        self
990    }
991
992    /// Sets the value of [protocol][crate::model::BackendRule::protocol].
993    ///
994    /// # Example
995    /// ```ignore,no_run
996    /// # use google_cloud_api::model::BackendRule;
997    /// let x = BackendRule::new().set_protocol("example");
998    /// ```
999    pub fn set_protocol<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1000        self.protocol = v.into();
1001        self
1002    }
1003
1004    /// Sets the value of [overrides_by_request_protocol][crate::model::BackendRule::overrides_by_request_protocol].
1005    ///
1006    /// # Example
1007    /// ```ignore,no_run
1008    /// # use google_cloud_api::model::BackendRule;
1009    /// let x = BackendRule::new().set_overrides_by_request_protocol([
1010    ///     ("key0", BackendRule::default()/* use setters */),
1011    ///     ("key1", BackendRule::default()/* use (different) setters */),
1012    /// ]);
1013    /// ```
1014    pub fn set_overrides_by_request_protocol<T, K, V>(mut self, v: T) -> Self
1015    where
1016        T: std::iter::IntoIterator<Item = (K, V)>,
1017        K: std::convert::Into<std::string::String>,
1018        V: std::convert::Into<crate::model::BackendRule>,
1019    {
1020        use std::iter::Iterator;
1021        self.overrides_by_request_protocol =
1022            v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1023        self
1024    }
1025
1026    /// Sets the value of [load_balancing_policy][crate::model::BackendRule::load_balancing_policy].
1027    ///
1028    /// # Example
1029    /// ```ignore,no_run
1030    /// # use google_cloud_api::model::BackendRule;
1031    /// let x = BackendRule::new().set_load_balancing_policy("example");
1032    /// ```
1033    pub fn set_load_balancing_policy<T: std::convert::Into<std::string::String>>(
1034        mut self,
1035        v: T,
1036    ) -> Self {
1037        self.load_balancing_policy = v.into();
1038        self
1039    }
1040
1041    /// Sets the value of [authentication][crate::model::BackendRule::authentication].
1042    ///
1043    /// Note that all the setters affecting `authentication` are mutually
1044    /// exclusive.
1045    ///
1046    /// # Example
1047    /// ```ignore,no_run
1048    /// # use google_cloud_api::model::BackendRule;
1049    /// use google_cloud_api::model::backend_rule::Authentication;
1050    /// let x = BackendRule::new().set_authentication(Some(Authentication::JwtAudience("example".to_string())));
1051    /// ```
1052    pub fn set_authentication<
1053        T: std::convert::Into<std::option::Option<crate::model::backend_rule::Authentication>>,
1054    >(
1055        mut self,
1056        v: T,
1057    ) -> Self {
1058        self.authentication = v.into();
1059        self
1060    }
1061
1062    /// The value of [authentication][crate::model::BackendRule::authentication]
1063    /// if it holds a `JwtAudience`, `None` if the field is not set or
1064    /// holds a different branch.
1065    pub fn jwt_audience(&self) -> std::option::Option<&std::string::String> {
1066        #[allow(unreachable_patterns)]
1067        self.authentication.as_ref().and_then(|v| match v {
1068            crate::model::backend_rule::Authentication::JwtAudience(v) => {
1069                std::option::Option::Some(v)
1070            }
1071            _ => std::option::Option::None,
1072        })
1073    }
1074
1075    /// Sets the value of [authentication][crate::model::BackendRule::authentication]
1076    /// to hold a `JwtAudience`.
1077    ///
1078    /// Note that all the setters affecting `authentication` are
1079    /// mutually exclusive.
1080    ///
1081    /// # Example
1082    /// ```ignore,no_run
1083    /// # use google_cloud_api::model::BackendRule;
1084    /// let x = BackendRule::new().set_jwt_audience("example");
1085    /// assert!(x.jwt_audience().is_some());
1086    /// assert!(x.disable_auth().is_none());
1087    /// ```
1088    pub fn set_jwt_audience<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1089        self.authentication = std::option::Option::Some(
1090            crate::model::backend_rule::Authentication::JwtAudience(v.into()),
1091        );
1092        self
1093    }
1094
1095    /// The value of [authentication][crate::model::BackendRule::authentication]
1096    /// if it holds a `DisableAuth`, `None` if the field is not set or
1097    /// holds a different branch.
1098    pub fn disable_auth(&self) -> std::option::Option<&bool> {
1099        #[allow(unreachable_patterns)]
1100        self.authentication.as_ref().and_then(|v| match v {
1101            crate::model::backend_rule::Authentication::DisableAuth(v) => {
1102                std::option::Option::Some(v)
1103            }
1104            _ => std::option::Option::None,
1105        })
1106    }
1107
1108    /// Sets the value of [authentication][crate::model::BackendRule::authentication]
1109    /// to hold a `DisableAuth`.
1110    ///
1111    /// Note that all the setters affecting `authentication` are
1112    /// mutually exclusive.
1113    ///
1114    /// # Example
1115    /// ```ignore,no_run
1116    /// # use google_cloud_api::model::BackendRule;
1117    /// let x = BackendRule::new().set_disable_auth(true);
1118    /// assert!(x.disable_auth().is_some());
1119    /// assert!(x.jwt_audience().is_none());
1120    /// ```
1121    pub fn set_disable_auth<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1122        self.authentication = std::option::Option::Some(
1123            crate::model::backend_rule::Authentication::DisableAuth(v.into()),
1124        );
1125        self
1126    }
1127}
1128
1129impl wkt::message::Message for BackendRule {
1130    fn typename() -> &'static str {
1131        "type.googleapis.com/google.api.BackendRule"
1132    }
1133}
1134
1135/// Defines additional types related to [BackendRule].
1136pub mod backend_rule {
1137    #[allow(unused_imports)]
1138    use super::*;
1139
1140    /// Path Translation specifies how to combine the backend address with the
1141    /// request path in order to produce the appropriate forwarding URL for the
1142    /// request.
1143    ///
1144    /// Path Translation is applicable only to HTTP-based backends. Backends which
1145    /// do not accept requests over HTTP/HTTPS should leave `path_translation`
1146    /// unspecified.
1147    ///
1148    /// # Working with unknown values
1149    ///
1150    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1151    /// additional enum variants at any time. Adding new variants is not considered
1152    /// a breaking change. Applications should write their code in anticipation of:
1153    ///
1154    /// - New values appearing in future releases of the client library, **and**
1155    /// - New values received dynamically, without application changes.
1156    ///
1157    /// Please consult the [Working with enums] section in the user guide for some
1158    /// guidelines.
1159    ///
1160    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1161    #[derive(Clone, Debug, PartialEq)]
1162    #[non_exhaustive]
1163    pub enum PathTranslation {
1164        #[allow(missing_docs)]
1165        Unspecified,
1166        /// Use the backend address as-is, with no modification to the path. If the
1167        /// URL pattern contains variables, the variable names and values will be
1168        /// appended to the query string. If a query string parameter and a URL
1169        /// pattern variable have the same name, this may result in duplicate keys in
1170        /// the query string.
1171        ///
1172        /// # Examples
1173        ///
1174        /// Given the following operation config:
1175        ///
1176        /// ```norust
1177        /// Method path:        /api/company/{cid}/user/{uid}
1178        /// Backend address:    https://example.cloudfunctions.net/getUser
1179        /// ```
1180        ///
1181        /// Requests to the following request paths will call the backend at the
1182        /// translated path:
1183        ///
1184        /// ```norust
1185        /// Request path: /api/company/widgetworks/user/johndoe
1186        /// Translated:
1187        /// https://example.cloudfunctions.net/getUser?cid=widgetworks&uid=johndoe
1188        ///
1189        /// Request path: /api/company/widgetworks/user/johndoe?timezone=EST
1190        /// Translated:
1191        /// https://example.cloudfunctions.net/getUser?timezone=EST&cid=widgetworks&uid=johndoe
1192        /// ```
1193        ConstantAddress,
1194        /// The request path will be appended to the backend address.
1195        ///
1196        /// # Examples
1197        ///
1198        /// Given the following operation config:
1199        ///
1200        /// ```norust
1201        /// Method path:        /api/company/{cid}/user/{uid}
1202        /// Backend address:    https://example.appspot.com
1203        /// ```
1204        ///
1205        /// Requests to the following request paths will call the backend at the
1206        /// translated path:
1207        ///
1208        /// ```norust
1209        /// Request path: /api/company/widgetworks/user/johndoe
1210        /// Translated:
1211        /// https://example.appspot.com/api/company/widgetworks/user/johndoe
1212        ///
1213        /// Request path: /api/company/widgetworks/user/johndoe?timezone=EST
1214        /// Translated:
1215        /// https://example.appspot.com/api/company/widgetworks/user/johndoe?timezone=EST
1216        /// ```
1217        AppendPathToAddress,
1218        /// If set, the enum was initialized with an unknown value.
1219        ///
1220        /// Applications can examine the value using [PathTranslation::value] or
1221        /// [PathTranslation::name].
1222        UnknownValue(path_translation::UnknownValue),
1223    }
1224
1225    #[doc(hidden)]
1226    pub mod path_translation {
1227        #[allow(unused_imports)]
1228        use super::*;
1229        #[derive(Clone, Debug, PartialEq)]
1230        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1231    }
1232
1233    impl PathTranslation {
1234        /// Gets the enum value.
1235        ///
1236        /// Returns `None` if the enum contains an unknown value deserialized from
1237        /// the string representation of enums.
1238        pub fn value(&self) -> std::option::Option<i32> {
1239            match self {
1240                Self::Unspecified => std::option::Option::Some(0),
1241                Self::ConstantAddress => std::option::Option::Some(1),
1242                Self::AppendPathToAddress => std::option::Option::Some(2),
1243                Self::UnknownValue(u) => u.0.value(),
1244            }
1245        }
1246
1247        /// Gets the enum value as a string.
1248        ///
1249        /// Returns `None` if the enum contains an unknown value deserialized from
1250        /// the integer representation of enums.
1251        pub fn name(&self) -> std::option::Option<&str> {
1252            match self {
1253                Self::Unspecified => std::option::Option::Some("PATH_TRANSLATION_UNSPECIFIED"),
1254                Self::ConstantAddress => std::option::Option::Some("CONSTANT_ADDRESS"),
1255                Self::AppendPathToAddress => std::option::Option::Some("APPEND_PATH_TO_ADDRESS"),
1256                Self::UnknownValue(u) => u.0.name(),
1257            }
1258        }
1259    }
1260
1261    impl std::default::Default for PathTranslation {
1262        fn default() -> Self {
1263            use std::convert::From;
1264            Self::from(0)
1265        }
1266    }
1267
1268    impl std::fmt::Display for PathTranslation {
1269        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1270            wkt::internal::display_enum(f, self.name(), self.value())
1271        }
1272    }
1273
1274    impl std::convert::From<i32> for PathTranslation {
1275        fn from(value: i32) -> Self {
1276            match value {
1277                0 => Self::Unspecified,
1278                1 => Self::ConstantAddress,
1279                2 => Self::AppendPathToAddress,
1280                _ => Self::UnknownValue(path_translation::UnknownValue(
1281                    wkt::internal::UnknownEnumValue::Integer(value),
1282                )),
1283            }
1284        }
1285    }
1286
1287    impl std::convert::From<&str> for PathTranslation {
1288        fn from(value: &str) -> Self {
1289            use std::string::ToString;
1290            match value {
1291                "PATH_TRANSLATION_UNSPECIFIED" => Self::Unspecified,
1292                "CONSTANT_ADDRESS" => Self::ConstantAddress,
1293                "APPEND_PATH_TO_ADDRESS" => Self::AppendPathToAddress,
1294                _ => Self::UnknownValue(path_translation::UnknownValue(
1295                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1296                )),
1297            }
1298        }
1299    }
1300
1301    impl serde::ser::Serialize for PathTranslation {
1302        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1303        where
1304            S: serde::Serializer,
1305        {
1306            match self {
1307                Self::Unspecified => serializer.serialize_i32(0),
1308                Self::ConstantAddress => serializer.serialize_i32(1),
1309                Self::AppendPathToAddress => serializer.serialize_i32(2),
1310                Self::UnknownValue(u) => u.0.serialize(serializer),
1311            }
1312        }
1313    }
1314
1315    impl<'de> serde::de::Deserialize<'de> for PathTranslation {
1316        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1317        where
1318            D: serde::Deserializer<'de>,
1319        {
1320            deserializer.deserialize_any(wkt::internal::EnumVisitor::<PathTranslation>::new(
1321                ".google.api.BackendRule.PathTranslation",
1322            ))
1323        }
1324    }
1325
1326    /// Authentication settings used by the backend.
1327    ///
1328    /// These are typically used to provide service management functionality to
1329    /// a backend served on a publicly-routable URL. The `authentication`
1330    /// details should match the authentication behavior used by the backend.
1331    ///
1332    /// For example, specifying `jwt_audience` implies that the backend expects
1333    /// authentication via a JWT.
1334    ///
1335    /// When authentication is unspecified, the resulting behavior is the same
1336    /// as `disable_auth` set to `true`.
1337    ///
1338    /// Refer to <https://developers.google.com/identity/protocols/OpenIDConnect> for
1339    /// JWT ID token.
1340    #[derive(Clone, Debug, PartialEq)]
1341    #[non_exhaustive]
1342    pub enum Authentication {
1343        /// The JWT audience is used when generating a JWT ID token for the backend.
1344        /// This ID token will be added in the HTTP "authorization" header, and sent
1345        /// to the backend.
1346        JwtAudience(std::string::String),
1347        /// When disable_auth is true, a JWT ID token won't be generated and the
1348        /// original "Authorization" HTTP header will be preserved. If the header is
1349        /// used to carry the original token and is expected by the backend, this
1350        /// field must be set to true to preserve the header.
1351        DisableAuth(bool),
1352    }
1353}
1354
1355/// Billing related configuration of the service.
1356///
1357/// The following example shows how to configure monitored resources and metrics
1358/// for billing, `consumer_destinations` is the only supported destination and
1359/// the monitored resources need at least one label key
1360/// `cloud.googleapis.com/location` to indicate the location of the billing
1361/// usage, using different monitored resources between monitoring and billing is
1362/// recommended so they can be evolved independently:
1363///
1364/// ```norust
1365/// monitored_resources:
1366/// - type: library.googleapis.com/billing_branch
1367///   labels:
1368///   - key: cloud.googleapis.com/location
1369///     description: |
1370///       Predefined label to support billing location restriction.
1371///   - key: city
1372///     description: |
1373///       Custom label to define the city where the library branch is located
1374///       in.
1375///   - key: name
1376///     description: Custom label to define the name of the library branch.
1377/// metrics:
1378/// - name: library.googleapis.com/book/borrowed_count
1379///   metric_kind: DELTA
1380///   value_type: INT64
1381///   unit: "1"
1382/// billing:
1383///   consumer_destinations:
1384///   - monitored_resource: library.googleapis.com/billing_branch
1385///     metrics:
1386///     - library.googleapis.com/book/borrowed_count
1387/// ```
1388#[derive(Clone, Default, PartialEq)]
1389#[non_exhaustive]
1390pub struct Billing {
1391    /// Billing configurations for sending metrics to the consumer project.
1392    /// There can be multiple consumer destinations per service, each one must have
1393    /// a different monitored resource type. A metric can be used in at most
1394    /// one consumer destination.
1395    pub consumer_destinations: std::vec::Vec<crate::model::billing::BillingDestination>,
1396
1397    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1398}
1399
1400impl Billing {
1401    /// Creates a new default instance.
1402    pub fn new() -> Self {
1403        std::default::Default::default()
1404    }
1405
1406    /// Sets the value of [consumer_destinations][crate::model::Billing::consumer_destinations].
1407    ///
1408    /// # Example
1409    /// ```ignore,no_run
1410    /// # use google_cloud_api::model::Billing;
1411    /// use google_cloud_api::model::billing::BillingDestination;
1412    /// let x = Billing::new()
1413    ///     .set_consumer_destinations([
1414    ///         BillingDestination::default()/* use setters */,
1415    ///         BillingDestination::default()/* use (different) setters */,
1416    ///     ]);
1417    /// ```
1418    pub fn set_consumer_destinations<T, V>(mut self, v: T) -> Self
1419    where
1420        T: std::iter::IntoIterator<Item = V>,
1421        V: std::convert::Into<crate::model::billing::BillingDestination>,
1422    {
1423        use std::iter::Iterator;
1424        self.consumer_destinations = v.into_iter().map(|i| i.into()).collect();
1425        self
1426    }
1427}
1428
1429impl wkt::message::Message for Billing {
1430    fn typename() -> &'static str {
1431        "type.googleapis.com/google.api.Billing"
1432    }
1433}
1434
1435/// Defines additional types related to [Billing].
1436pub mod billing {
1437    #[allow(unused_imports)]
1438    use super::*;
1439
1440    /// Configuration of a specific billing destination (Currently only support
1441    /// bill against consumer project).
1442    #[derive(Clone, Default, PartialEq)]
1443    #[non_exhaustive]
1444    pub struct BillingDestination {
1445        /// The monitored resource type. The type must be defined in
1446        /// [Service.monitored_resources][google.api.Service.monitored_resources]
1447        /// section.
1448        ///
1449        /// [google.api.Service.monitored_resources]: crate::model::Service::monitored_resources
1450        pub monitored_resource: std::string::String,
1451
1452        /// Names of the metrics to report to this billing destination.
1453        /// Each name must be defined in
1454        /// [Service.metrics][google.api.Service.metrics] section.
1455        ///
1456        /// [google.api.Service.metrics]: crate::model::Service::metrics
1457        pub metrics: std::vec::Vec<std::string::String>,
1458
1459        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1460    }
1461
1462    impl BillingDestination {
1463        /// Creates a new default instance.
1464        pub fn new() -> Self {
1465            std::default::Default::default()
1466        }
1467
1468        /// Sets the value of [monitored_resource][crate::model::billing::BillingDestination::monitored_resource].
1469        ///
1470        /// # Example
1471        /// ```ignore,no_run
1472        /// # use google_cloud_api::model::billing::BillingDestination;
1473        /// let x = BillingDestination::new().set_monitored_resource("example");
1474        /// ```
1475        pub fn set_monitored_resource<T: std::convert::Into<std::string::String>>(
1476            mut self,
1477            v: T,
1478        ) -> Self {
1479            self.monitored_resource = v.into();
1480            self
1481        }
1482
1483        /// Sets the value of [metrics][crate::model::billing::BillingDestination::metrics].
1484        ///
1485        /// # Example
1486        /// ```ignore,no_run
1487        /// # use google_cloud_api::model::billing::BillingDestination;
1488        /// let x = BillingDestination::new().set_metrics(["a", "b", "c"]);
1489        /// ```
1490        pub fn set_metrics<T, V>(mut self, v: T) -> Self
1491        where
1492            T: std::iter::IntoIterator<Item = V>,
1493            V: std::convert::Into<std::string::String>,
1494        {
1495            use std::iter::Iterator;
1496            self.metrics = v.into_iter().map(|i| i.into()).collect();
1497            self
1498        }
1499    }
1500
1501    impl wkt::message::Message for BillingDestination {
1502        fn typename() -> &'static str {
1503            "type.googleapis.com/google.api.Billing.BillingDestination"
1504        }
1505    }
1506}
1507
1508/// Required information for every language.
1509#[derive(Clone, Default, PartialEq)]
1510#[non_exhaustive]
1511pub struct CommonLanguageSettings {
1512    /// Link to automatically generated reference documentation.  Example:
1513    /// <https://cloud.google.com/nodejs/docs/reference/asset/latest>
1514    #[deprecated]
1515    pub reference_docs_uri: std::string::String,
1516
1517    /// The destination where API teams want this client library to be published.
1518    pub destinations: std::vec::Vec<crate::model::ClientLibraryDestination>,
1519
1520    /// Configuration for which RPCs should be generated in the GAPIC client.
1521    ///
1522    /// Note: This field should not be used in most cases.
1523    pub selective_gapic_generation: std::option::Option<crate::model::SelectiveGapicGeneration>,
1524
1525    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1526}
1527
1528impl CommonLanguageSettings {
1529    /// Creates a new default instance.
1530    pub fn new() -> Self {
1531        std::default::Default::default()
1532    }
1533
1534    /// Sets the value of [reference_docs_uri][crate::model::CommonLanguageSettings::reference_docs_uri].
1535    ///
1536    /// # Example
1537    /// ```ignore,no_run
1538    /// # use google_cloud_api::model::CommonLanguageSettings;
1539    /// let x = CommonLanguageSettings::new().set_reference_docs_uri("example");
1540    /// ```
1541    #[deprecated]
1542    pub fn set_reference_docs_uri<T: std::convert::Into<std::string::String>>(
1543        mut self,
1544        v: T,
1545    ) -> Self {
1546        self.reference_docs_uri = v.into();
1547        self
1548    }
1549
1550    /// Sets the value of [destinations][crate::model::CommonLanguageSettings::destinations].
1551    ///
1552    /// # Example
1553    /// ```ignore,no_run
1554    /// # use google_cloud_api::model::CommonLanguageSettings;
1555    /// use google_cloud_api::model::ClientLibraryDestination;
1556    /// let x = CommonLanguageSettings::new().set_destinations([
1557    ///     ClientLibraryDestination::Github,
1558    ///     ClientLibraryDestination::PackageManager,
1559    /// ]);
1560    /// ```
1561    pub fn set_destinations<T, V>(mut self, v: T) -> Self
1562    where
1563        T: std::iter::IntoIterator<Item = V>,
1564        V: std::convert::Into<crate::model::ClientLibraryDestination>,
1565    {
1566        use std::iter::Iterator;
1567        self.destinations = v.into_iter().map(|i| i.into()).collect();
1568        self
1569    }
1570
1571    /// Sets the value of [selective_gapic_generation][crate::model::CommonLanguageSettings::selective_gapic_generation].
1572    ///
1573    /// # Example
1574    /// ```ignore,no_run
1575    /// # use google_cloud_api::model::CommonLanguageSettings;
1576    /// use google_cloud_api::model::SelectiveGapicGeneration;
1577    /// let x = CommonLanguageSettings::new().set_selective_gapic_generation(SelectiveGapicGeneration::default()/* use setters */);
1578    /// ```
1579    pub fn set_selective_gapic_generation<T>(mut self, v: T) -> Self
1580    where
1581        T: std::convert::Into<crate::model::SelectiveGapicGeneration>,
1582    {
1583        self.selective_gapic_generation = std::option::Option::Some(v.into());
1584        self
1585    }
1586
1587    /// Sets or clears the value of [selective_gapic_generation][crate::model::CommonLanguageSettings::selective_gapic_generation].
1588    ///
1589    /// # Example
1590    /// ```ignore,no_run
1591    /// # use google_cloud_api::model::CommonLanguageSettings;
1592    /// use google_cloud_api::model::SelectiveGapicGeneration;
1593    /// let x = CommonLanguageSettings::new().set_or_clear_selective_gapic_generation(Some(SelectiveGapicGeneration::default()/* use setters */));
1594    /// let x = CommonLanguageSettings::new().set_or_clear_selective_gapic_generation(None::<SelectiveGapicGeneration>);
1595    /// ```
1596    pub fn set_or_clear_selective_gapic_generation<T>(mut self, v: std::option::Option<T>) -> Self
1597    where
1598        T: std::convert::Into<crate::model::SelectiveGapicGeneration>,
1599    {
1600        self.selective_gapic_generation = v.map(|x| x.into());
1601        self
1602    }
1603}
1604
1605impl wkt::message::Message for CommonLanguageSettings {
1606    fn typename() -> &'static str {
1607        "type.googleapis.com/google.api.CommonLanguageSettings"
1608    }
1609}
1610
1611/// Details about how and where to publish client libraries.
1612#[derive(Clone, Default, PartialEq)]
1613#[non_exhaustive]
1614pub struct ClientLibrarySettings {
1615    /// Version of the API to apply these settings to. This is the full protobuf
1616    /// package for the API, ending in the version element.
1617    /// Examples: "google.cloud.speech.v1" and "google.spanner.admin.database.v1".
1618    pub version: std::string::String,
1619
1620    /// Launch stage of this version of the API.
1621    pub launch_stage: crate::model::LaunchStage,
1622
1623    /// When using transport=rest, the client request will encode enums as
1624    /// numbers rather than strings.
1625    pub rest_numeric_enums: bool,
1626
1627    /// Settings for legacy Java features, supported in the Service YAML.
1628    pub java_settings: std::option::Option<crate::model::JavaSettings>,
1629
1630    /// Settings for C++ client libraries.
1631    pub cpp_settings: std::option::Option<crate::model::CppSettings>,
1632
1633    /// Settings for PHP client libraries.
1634    pub php_settings: std::option::Option<crate::model::PhpSettings>,
1635
1636    /// Settings for Python client libraries.
1637    pub python_settings: std::option::Option<crate::model::PythonSettings>,
1638
1639    /// Settings for Node client libraries.
1640    pub node_settings: std::option::Option<crate::model::NodeSettings>,
1641
1642    /// Settings for .NET client libraries.
1643    pub dotnet_settings: std::option::Option<crate::model::DotnetSettings>,
1644
1645    /// Settings for Ruby client libraries.
1646    pub ruby_settings: std::option::Option<crate::model::RubySettings>,
1647
1648    /// Settings for Go client libraries.
1649    pub go_settings: std::option::Option<crate::model::GoSettings>,
1650
1651    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1652}
1653
1654impl ClientLibrarySettings {
1655    /// Creates a new default instance.
1656    pub fn new() -> Self {
1657        std::default::Default::default()
1658    }
1659
1660    /// Sets the value of [version][crate::model::ClientLibrarySettings::version].
1661    ///
1662    /// # Example
1663    /// ```ignore,no_run
1664    /// # use google_cloud_api::model::ClientLibrarySettings;
1665    /// let x = ClientLibrarySettings::new().set_version("example");
1666    /// ```
1667    pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1668        self.version = v.into();
1669        self
1670    }
1671
1672    /// Sets the value of [launch_stage][crate::model::ClientLibrarySettings::launch_stage].
1673    ///
1674    /// # Example
1675    /// ```ignore,no_run
1676    /// # use google_cloud_api::model::ClientLibrarySettings;
1677    /// use google_cloud_api::model::LaunchStage;
1678    /// let x0 = ClientLibrarySettings::new().set_launch_stage(LaunchStage::Unimplemented);
1679    /// let x1 = ClientLibrarySettings::new().set_launch_stage(LaunchStage::Prelaunch);
1680    /// let x2 = ClientLibrarySettings::new().set_launch_stage(LaunchStage::EarlyAccess);
1681    /// ```
1682    pub fn set_launch_stage<T: std::convert::Into<crate::model::LaunchStage>>(
1683        mut self,
1684        v: T,
1685    ) -> Self {
1686        self.launch_stage = v.into();
1687        self
1688    }
1689
1690    /// Sets the value of [rest_numeric_enums][crate::model::ClientLibrarySettings::rest_numeric_enums].
1691    ///
1692    /// # Example
1693    /// ```ignore,no_run
1694    /// # use google_cloud_api::model::ClientLibrarySettings;
1695    /// let x = ClientLibrarySettings::new().set_rest_numeric_enums(true);
1696    /// ```
1697    pub fn set_rest_numeric_enums<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1698        self.rest_numeric_enums = v.into();
1699        self
1700    }
1701
1702    /// Sets the value of [java_settings][crate::model::ClientLibrarySettings::java_settings].
1703    ///
1704    /// # Example
1705    /// ```ignore,no_run
1706    /// # use google_cloud_api::model::ClientLibrarySettings;
1707    /// use google_cloud_api::model::JavaSettings;
1708    /// let x = ClientLibrarySettings::new().set_java_settings(JavaSettings::default()/* use setters */);
1709    /// ```
1710    pub fn set_java_settings<T>(mut self, v: T) -> Self
1711    where
1712        T: std::convert::Into<crate::model::JavaSettings>,
1713    {
1714        self.java_settings = std::option::Option::Some(v.into());
1715        self
1716    }
1717
1718    /// Sets or clears the value of [java_settings][crate::model::ClientLibrarySettings::java_settings].
1719    ///
1720    /// # Example
1721    /// ```ignore,no_run
1722    /// # use google_cloud_api::model::ClientLibrarySettings;
1723    /// use google_cloud_api::model::JavaSettings;
1724    /// let x = ClientLibrarySettings::new().set_or_clear_java_settings(Some(JavaSettings::default()/* use setters */));
1725    /// let x = ClientLibrarySettings::new().set_or_clear_java_settings(None::<JavaSettings>);
1726    /// ```
1727    pub fn set_or_clear_java_settings<T>(mut self, v: std::option::Option<T>) -> Self
1728    where
1729        T: std::convert::Into<crate::model::JavaSettings>,
1730    {
1731        self.java_settings = v.map(|x| x.into());
1732        self
1733    }
1734
1735    /// Sets the value of [cpp_settings][crate::model::ClientLibrarySettings::cpp_settings].
1736    ///
1737    /// # Example
1738    /// ```ignore,no_run
1739    /// # use google_cloud_api::model::ClientLibrarySettings;
1740    /// use google_cloud_api::model::CppSettings;
1741    /// let x = ClientLibrarySettings::new().set_cpp_settings(CppSettings::default()/* use setters */);
1742    /// ```
1743    pub fn set_cpp_settings<T>(mut self, v: T) -> Self
1744    where
1745        T: std::convert::Into<crate::model::CppSettings>,
1746    {
1747        self.cpp_settings = std::option::Option::Some(v.into());
1748        self
1749    }
1750
1751    /// Sets or clears the value of [cpp_settings][crate::model::ClientLibrarySettings::cpp_settings].
1752    ///
1753    /// # Example
1754    /// ```ignore,no_run
1755    /// # use google_cloud_api::model::ClientLibrarySettings;
1756    /// use google_cloud_api::model::CppSettings;
1757    /// let x = ClientLibrarySettings::new().set_or_clear_cpp_settings(Some(CppSettings::default()/* use setters */));
1758    /// let x = ClientLibrarySettings::new().set_or_clear_cpp_settings(None::<CppSettings>);
1759    /// ```
1760    pub fn set_or_clear_cpp_settings<T>(mut self, v: std::option::Option<T>) -> Self
1761    where
1762        T: std::convert::Into<crate::model::CppSettings>,
1763    {
1764        self.cpp_settings = v.map(|x| x.into());
1765        self
1766    }
1767
1768    /// Sets the value of [php_settings][crate::model::ClientLibrarySettings::php_settings].
1769    ///
1770    /// # Example
1771    /// ```ignore,no_run
1772    /// # use google_cloud_api::model::ClientLibrarySettings;
1773    /// use google_cloud_api::model::PhpSettings;
1774    /// let x = ClientLibrarySettings::new().set_php_settings(PhpSettings::default()/* use setters */);
1775    /// ```
1776    pub fn set_php_settings<T>(mut self, v: T) -> Self
1777    where
1778        T: std::convert::Into<crate::model::PhpSettings>,
1779    {
1780        self.php_settings = std::option::Option::Some(v.into());
1781        self
1782    }
1783
1784    /// Sets or clears the value of [php_settings][crate::model::ClientLibrarySettings::php_settings].
1785    ///
1786    /// # Example
1787    /// ```ignore,no_run
1788    /// # use google_cloud_api::model::ClientLibrarySettings;
1789    /// use google_cloud_api::model::PhpSettings;
1790    /// let x = ClientLibrarySettings::new().set_or_clear_php_settings(Some(PhpSettings::default()/* use setters */));
1791    /// let x = ClientLibrarySettings::new().set_or_clear_php_settings(None::<PhpSettings>);
1792    /// ```
1793    pub fn set_or_clear_php_settings<T>(mut self, v: std::option::Option<T>) -> Self
1794    where
1795        T: std::convert::Into<crate::model::PhpSettings>,
1796    {
1797        self.php_settings = v.map(|x| x.into());
1798        self
1799    }
1800
1801    /// Sets the value of [python_settings][crate::model::ClientLibrarySettings::python_settings].
1802    ///
1803    /// # Example
1804    /// ```ignore,no_run
1805    /// # use google_cloud_api::model::ClientLibrarySettings;
1806    /// use google_cloud_api::model::PythonSettings;
1807    /// let x = ClientLibrarySettings::new().set_python_settings(PythonSettings::default()/* use setters */);
1808    /// ```
1809    pub fn set_python_settings<T>(mut self, v: T) -> Self
1810    where
1811        T: std::convert::Into<crate::model::PythonSettings>,
1812    {
1813        self.python_settings = std::option::Option::Some(v.into());
1814        self
1815    }
1816
1817    /// Sets or clears the value of [python_settings][crate::model::ClientLibrarySettings::python_settings].
1818    ///
1819    /// # Example
1820    /// ```ignore,no_run
1821    /// # use google_cloud_api::model::ClientLibrarySettings;
1822    /// use google_cloud_api::model::PythonSettings;
1823    /// let x = ClientLibrarySettings::new().set_or_clear_python_settings(Some(PythonSettings::default()/* use setters */));
1824    /// let x = ClientLibrarySettings::new().set_or_clear_python_settings(None::<PythonSettings>);
1825    /// ```
1826    pub fn set_or_clear_python_settings<T>(mut self, v: std::option::Option<T>) -> Self
1827    where
1828        T: std::convert::Into<crate::model::PythonSettings>,
1829    {
1830        self.python_settings = v.map(|x| x.into());
1831        self
1832    }
1833
1834    /// Sets the value of [node_settings][crate::model::ClientLibrarySettings::node_settings].
1835    ///
1836    /// # Example
1837    /// ```ignore,no_run
1838    /// # use google_cloud_api::model::ClientLibrarySettings;
1839    /// use google_cloud_api::model::NodeSettings;
1840    /// let x = ClientLibrarySettings::new().set_node_settings(NodeSettings::default()/* use setters */);
1841    /// ```
1842    pub fn set_node_settings<T>(mut self, v: T) -> Self
1843    where
1844        T: std::convert::Into<crate::model::NodeSettings>,
1845    {
1846        self.node_settings = std::option::Option::Some(v.into());
1847        self
1848    }
1849
1850    /// Sets or clears the value of [node_settings][crate::model::ClientLibrarySettings::node_settings].
1851    ///
1852    /// # Example
1853    /// ```ignore,no_run
1854    /// # use google_cloud_api::model::ClientLibrarySettings;
1855    /// use google_cloud_api::model::NodeSettings;
1856    /// let x = ClientLibrarySettings::new().set_or_clear_node_settings(Some(NodeSettings::default()/* use setters */));
1857    /// let x = ClientLibrarySettings::new().set_or_clear_node_settings(None::<NodeSettings>);
1858    /// ```
1859    pub fn set_or_clear_node_settings<T>(mut self, v: std::option::Option<T>) -> Self
1860    where
1861        T: std::convert::Into<crate::model::NodeSettings>,
1862    {
1863        self.node_settings = v.map(|x| x.into());
1864        self
1865    }
1866
1867    /// Sets the value of [dotnet_settings][crate::model::ClientLibrarySettings::dotnet_settings].
1868    ///
1869    /// # Example
1870    /// ```ignore,no_run
1871    /// # use google_cloud_api::model::ClientLibrarySettings;
1872    /// use google_cloud_api::model::DotnetSettings;
1873    /// let x = ClientLibrarySettings::new().set_dotnet_settings(DotnetSettings::default()/* use setters */);
1874    /// ```
1875    pub fn set_dotnet_settings<T>(mut self, v: T) -> Self
1876    where
1877        T: std::convert::Into<crate::model::DotnetSettings>,
1878    {
1879        self.dotnet_settings = std::option::Option::Some(v.into());
1880        self
1881    }
1882
1883    /// Sets or clears the value of [dotnet_settings][crate::model::ClientLibrarySettings::dotnet_settings].
1884    ///
1885    /// # Example
1886    /// ```ignore,no_run
1887    /// # use google_cloud_api::model::ClientLibrarySettings;
1888    /// use google_cloud_api::model::DotnetSettings;
1889    /// let x = ClientLibrarySettings::new().set_or_clear_dotnet_settings(Some(DotnetSettings::default()/* use setters */));
1890    /// let x = ClientLibrarySettings::new().set_or_clear_dotnet_settings(None::<DotnetSettings>);
1891    /// ```
1892    pub fn set_or_clear_dotnet_settings<T>(mut self, v: std::option::Option<T>) -> Self
1893    where
1894        T: std::convert::Into<crate::model::DotnetSettings>,
1895    {
1896        self.dotnet_settings = v.map(|x| x.into());
1897        self
1898    }
1899
1900    /// Sets the value of [ruby_settings][crate::model::ClientLibrarySettings::ruby_settings].
1901    ///
1902    /// # Example
1903    /// ```ignore,no_run
1904    /// # use google_cloud_api::model::ClientLibrarySettings;
1905    /// use google_cloud_api::model::RubySettings;
1906    /// let x = ClientLibrarySettings::new().set_ruby_settings(RubySettings::default()/* use setters */);
1907    /// ```
1908    pub fn set_ruby_settings<T>(mut self, v: T) -> Self
1909    where
1910        T: std::convert::Into<crate::model::RubySettings>,
1911    {
1912        self.ruby_settings = std::option::Option::Some(v.into());
1913        self
1914    }
1915
1916    /// Sets or clears the value of [ruby_settings][crate::model::ClientLibrarySettings::ruby_settings].
1917    ///
1918    /// # Example
1919    /// ```ignore,no_run
1920    /// # use google_cloud_api::model::ClientLibrarySettings;
1921    /// use google_cloud_api::model::RubySettings;
1922    /// let x = ClientLibrarySettings::new().set_or_clear_ruby_settings(Some(RubySettings::default()/* use setters */));
1923    /// let x = ClientLibrarySettings::new().set_or_clear_ruby_settings(None::<RubySettings>);
1924    /// ```
1925    pub fn set_or_clear_ruby_settings<T>(mut self, v: std::option::Option<T>) -> Self
1926    where
1927        T: std::convert::Into<crate::model::RubySettings>,
1928    {
1929        self.ruby_settings = v.map(|x| x.into());
1930        self
1931    }
1932
1933    /// Sets the value of [go_settings][crate::model::ClientLibrarySettings::go_settings].
1934    ///
1935    /// # Example
1936    /// ```ignore,no_run
1937    /// # use google_cloud_api::model::ClientLibrarySettings;
1938    /// use google_cloud_api::model::GoSettings;
1939    /// let x = ClientLibrarySettings::new().set_go_settings(GoSettings::default()/* use setters */);
1940    /// ```
1941    pub fn set_go_settings<T>(mut self, v: T) -> Self
1942    where
1943        T: std::convert::Into<crate::model::GoSettings>,
1944    {
1945        self.go_settings = std::option::Option::Some(v.into());
1946        self
1947    }
1948
1949    /// Sets or clears the value of [go_settings][crate::model::ClientLibrarySettings::go_settings].
1950    ///
1951    /// # Example
1952    /// ```ignore,no_run
1953    /// # use google_cloud_api::model::ClientLibrarySettings;
1954    /// use google_cloud_api::model::GoSettings;
1955    /// let x = ClientLibrarySettings::new().set_or_clear_go_settings(Some(GoSettings::default()/* use setters */));
1956    /// let x = ClientLibrarySettings::new().set_or_clear_go_settings(None::<GoSettings>);
1957    /// ```
1958    pub fn set_or_clear_go_settings<T>(mut self, v: std::option::Option<T>) -> Self
1959    where
1960        T: std::convert::Into<crate::model::GoSettings>,
1961    {
1962        self.go_settings = v.map(|x| x.into());
1963        self
1964    }
1965}
1966
1967impl wkt::message::Message for ClientLibrarySettings {
1968    fn typename() -> &'static str {
1969        "type.googleapis.com/google.api.ClientLibrarySettings"
1970    }
1971}
1972
1973/// This message configures the settings for publishing [Google Cloud Client
1974/// libraries](https://cloud.google.com/apis/docs/cloud-client-libraries)
1975/// generated from the service config.
1976#[derive(Clone, Default, PartialEq)]
1977#[non_exhaustive]
1978pub struct Publishing {
1979    /// A list of API method settings, e.g. the behavior for methods that use the
1980    /// long-running operation pattern.
1981    pub method_settings: std::vec::Vec<crate::model::MethodSettings>,
1982
1983    /// Link to a *public* URI where users can report issues.  Example:
1984    /// <https://issuetracker.google.com/issues/new?component=190865&template=1161103>
1985    pub new_issue_uri: std::string::String,
1986
1987    /// Link to product home page.  Example:
1988    /// <https://cloud.google.com/asset-inventory/docs/overview>
1989    pub documentation_uri: std::string::String,
1990
1991    /// Used as a tracking tag when collecting data about the APIs developer
1992    /// relations artifacts like docs, packages delivered to package managers,
1993    /// etc.  Example: "speech".
1994    pub api_short_name: std::string::String,
1995
1996    /// GitHub label to apply to issues and pull requests opened for this API.
1997    pub github_label: std::string::String,
1998
1999    /// GitHub teams to be added to CODEOWNERS in the directory in GitHub
2000    /// containing source code for the client libraries for this API.
2001    pub codeowner_github_teams: std::vec::Vec<std::string::String>,
2002
2003    /// A prefix used in sample code when demarking regions to be included in
2004    /// documentation.
2005    pub doc_tag_prefix: std::string::String,
2006
2007    /// For whom the client library is being published.
2008    pub organization: crate::model::ClientLibraryOrganization,
2009
2010    /// Client library settings.  If the same version string appears multiple
2011    /// times in this list, then the last one wins.  Settings from earlier
2012    /// settings with the same version string are discarded.
2013    pub library_settings: std::vec::Vec<crate::model::ClientLibrarySettings>,
2014
2015    /// Optional link to proto reference documentation.  Example:
2016    /// <https://cloud.google.com/pubsub/lite/docs/reference/rpc>
2017    pub proto_reference_documentation_uri: std::string::String,
2018
2019    /// Optional link to REST reference documentation.  Example:
2020    /// <https://cloud.google.com/pubsub/lite/docs/reference/rest>
2021    pub rest_reference_documentation_uri: std::string::String,
2022
2023    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2024}
2025
2026impl Publishing {
2027    /// Creates a new default instance.
2028    pub fn new() -> Self {
2029        std::default::Default::default()
2030    }
2031
2032    /// Sets the value of [method_settings][crate::model::Publishing::method_settings].
2033    ///
2034    /// # Example
2035    /// ```ignore,no_run
2036    /// # use google_cloud_api::model::Publishing;
2037    /// use google_cloud_api::model::MethodSettings;
2038    /// let x = Publishing::new()
2039    ///     .set_method_settings([
2040    ///         MethodSettings::default()/* use setters */,
2041    ///         MethodSettings::default()/* use (different) setters */,
2042    ///     ]);
2043    /// ```
2044    pub fn set_method_settings<T, V>(mut self, v: T) -> Self
2045    where
2046        T: std::iter::IntoIterator<Item = V>,
2047        V: std::convert::Into<crate::model::MethodSettings>,
2048    {
2049        use std::iter::Iterator;
2050        self.method_settings = v.into_iter().map(|i| i.into()).collect();
2051        self
2052    }
2053
2054    /// Sets the value of [new_issue_uri][crate::model::Publishing::new_issue_uri].
2055    ///
2056    /// # Example
2057    /// ```ignore,no_run
2058    /// # use google_cloud_api::model::Publishing;
2059    /// let x = Publishing::new().set_new_issue_uri("example");
2060    /// ```
2061    pub fn set_new_issue_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2062        self.new_issue_uri = v.into();
2063        self
2064    }
2065
2066    /// Sets the value of [documentation_uri][crate::model::Publishing::documentation_uri].
2067    ///
2068    /// # Example
2069    /// ```ignore,no_run
2070    /// # use google_cloud_api::model::Publishing;
2071    /// let x = Publishing::new().set_documentation_uri("example");
2072    /// ```
2073    pub fn set_documentation_uri<T: std::convert::Into<std::string::String>>(
2074        mut self,
2075        v: T,
2076    ) -> Self {
2077        self.documentation_uri = v.into();
2078        self
2079    }
2080
2081    /// Sets the value of [api_short_name][crate::model::Publishing::api_short_name].
2082    ///
2083    /// # Example
2084    /// ```ignore,no_run
2085    /// # use google_cloud_api::model::Publishing;
2086    /// let x = Publishing::new().set_api_short_name("example");
2087    /// ```
2088    pub fn set_api_short_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2089        self.api_short_name = v.into();
2090        self
2091    }
2092
2093    /// Sets the value of [github_label][crate::model::Publishing::github_label].
2094    ///
2095    /// # Example
2096    /// ```ignore,no_run
2097    /// # use google_cloud_api::model::Publishing;
2098    /// let x = Publishing::new().set_github_label("example");
2099    /// ```
2100    pub fn set_github_label<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2101        self.github_label = v.into();
2102        self
2103    }
2104
2105    /// Sets the value of [codeowner_github_teams][crate::model::Publishing::codeowner_github_teams].
2106    ///
2107    /// # Example
2108    /// ```ignore,no_run
2109    /// # use google_cloud_api::model::Publishing;
2110    /// let x = Publishing::new().set_codeowner_github_teams(["a", "b", "c"]);
2111    /// ```
2112    pub fn set_codeowner_github_teams<T, V>(mut self, v: T) -> Self
2113    where
2114        T: std::iter::IntoIterator<Item = V>,
2115        V: std::convert::Into<std::string::String>,
2116    {
2117        use std::iter::Iterator;
2118        self.codeowner_github_teams = v.into_iter().map(|i| i.into()).collect();
2119        self
2120    }
2121
2122    /// Sets the value of [doc_tag_prefix][crate::model::Publishing::doc_tag_prefix].
2123    ///
2124    /// # Example
2125    /// ```ignore,no_run
2126    /// # use google_cloud_api::model::Publishing;
2127    /// let x = Publishing::new().set_doc_tag_prefix("example");
2128    /// ```
2129    pub fn set_doc_tag_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2130        self.doc_tag_prefix = v.into();
2131        self
2132    }
2133
2134    /// Sets the value of [organization][crate::model::Publishing::organization].
2135    ///
2136    /// # Example
2137    /// ```ignore,no_run
2138    /// # use google_cloud_api::model::Publishing;
2139    /// use google_cloud_api::model::ClientLibraryOrganization;
2140    /// let x0 = Publishing::new().set_organization(ClientLibraryOrganization::Cloud);
2141    /// let x1 = Publishing::new().set_organization(ClientLibraryOrganization::Ads);
2142    /// let x2 = Publishing::new().set_organization(ClientLibraryOrganization::Photos);
2143    /// ```
2144    pub fn set_organization<T: std::convert::Into<crate::model::ClientLibraryOrganization>>(
2145        mut self,
2146        v: T,
2147    ) -> Self {
2148        self.organization = v.into();
2149        self
2150    }
2151
2152    /// Sets the value of [library_settings][crate::model::Publishing::library_settings].
2153    ///
2154    /// # Example
2155    /// ```ignore,no_run
2156    /// # use google_cloud_api::model::Publishing;
2157    /// use google_cloud_api::model::ClientLibrarySettings;
2158    /// let x = Publishing::new()
2159    ///     .set_library_settings([
2160    ///         ClientLibrarySettings::default()/* use setters */,
2161    ///         ClientLibrarySettings::default()/* use (different) setters */,
2162    ///     ]);
2163    /// ```
2164    pub fn set_library_settings<T, V>(mut self, v: T) -> Self
2165    where
2166        T: std::iter::IntoIterator<Item = V>,
2167        V: std::convert::Into<crate::model::ClientLibrarySettings>,
2168    {
2169        use std::iter::Iterator;
2170        self.library_settings = v.into_iter().map(|i| i.into()).collect();
2171        self
2172    }
2173
2174    /// Sets the value of [proto_reference_documentation_uri][crate::model::Publishing::proto_reference_documentation_uri].
2175    ///
2176    /// # Example
2177    /// ```ignore,no_run
2178    /// # use google_cloud_api::model::Publishing;
2179    /// let x = Publishing::new().set_proto_reference_documentation_uri("example");
2180    /// ```
2181    pub fn set_proto_reference_documentation_uri<T: std::convert::Into<std::string::String>>(
2182        mut self,
2183        v: T,
2184    ) -> Self {
2185        self.proto_reference_documentation_uri = v.into();
2186        self
2187    }
2188
2189    /// Sets the value of [rest_reference_documentation_uri][crate::model::Publishing::rest_reference_documentation_uri].
2190    ///
2191    /// # Example
2192    /// ```ignore,no_run
2193    /// # use google_cloud_api::model::Publishing;
2194    /// let x = Publishing::new().set_rest_reference_documentation_uri("example");
2195    /// ```
2196    pub fn set_rest_reference_documentation_uri<T: std::convert::Into<std::string::String>>(
2197        mut self,
2198        v: T,
2199    ) -> Self {
2200        self.rest_reference_documentation_uri = v.into();
2201        self
2202    }
2203}
2204
2205impl wkt::message::Message for Publishing {
2206    fn typename() -> &'static str {
2207        "type.googleapis.com/google.api.Publishing"
2208    }
2209}
2210
2211/// Settings for Java client libraries.
2212#[derive(Clone, Default, PartialEq)]
2213#[non_exhaustive]
2214pub struct JavaSettings {
2215    /// The package name to use in Java. Clobbers the java_package option
2216    /// set in the protobuf. This should be used **only** by APIs
2217    /// who have already set the language_settings.java.package_name" field
2218    /// in gapic.yaml. API teams should use the protobuf java_package option
2219    /// where possible.
2220    ///
2221    /// Example of a YAML configuration::
2222    ///
2223    /// ```norust
2224    /// publishing:
2225    ///   library_settings:
2226    ///     java_settings:
2227    ///       library_package: com.google.cloud.pubsub.v1
2228    /// ```
2229    pub library_package: std::string::String,
2230
2231    /// Configure the Java class name to use instead of the service's for its
2232    /// corresponding generated GAPIC client. Keys are fully-qualified
2233    /// service names as they appear in the protobuf (including the full
2234    /// the language_settings.java.interface_names" field in gapic.yaml. API
2235    /// teams should otherwise use the service name as it appears in the
2236    /// protobuf.
2237    ///
2238    /// Example of a YAML configuration::
2239    ///
2240    /// ```norust
2241    /// publishing:
2242    ///   java_settings:
2243    ///     service_class_names:
2244    ///       - google.pubsub.v1.Publisher: TopicAdmin
2245    ///       - google.pubsub.v1.Subscriber: SubscriptionAdmin
2246    /// ```
2247    pub service_class_names: std::collections::HashMap<std::string::String, std::string::String>,
2248
2249    /// Some settings.
2250    pub common: std::option::Option<crate::model::CommonLanguageSettings>,
2251
2252    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2253}
2254
2255impl JavaSettings {
2256    /// Creates a new default instance.
2257    pub fn new() -> Self {
2258        std::default::Default::default()
2259    }
2260
2261    /// Sets the value of [library_package][crate::model::JavaSettings::library_package].
2262    ///
2263    /// # Example
2264    /// ```ignore,no_run
2265    /// # use google_cloud_api::model::JavaSettings;
2266    /// let x = JavaSettings::new().set_library_package("example");
2267    /// ```
2268    pub fn set_library_package<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2269        self.library_package = v.into();
2270        self
2271    }
2272
2273    /// Sets the value of [service_class_names][crate::model::JavaSettings::service_class_names].
2274    ///
2275    /// # Example
2276    /// ```ignore,no_run
2277    /// # use google_cloud_api::model::JavaSettings;
2278    /// let x = JavaSettings::new().set_service_class_names([
2279    ///     ("key0", "abc"),
2280    ///     ("key1", "xyz"),
2281    /// ]);
2282    /// ```
2283    pub fn set_service_class_names<T, K, V>(mut self, v: T) -> Self
2284    where
2285        T: std::iter::IntoIterator<Item = (K, V)>,
2286        K: std::convert::Into<std::string::String>,
2287        V: std::convert::Into<std::string::String>,
2288    {
2289        use std::iter::Iterator;
2290        self.service_class_names = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2291        self
2292    }
2293
2294    /// Sets the value of [common][crate::model::JavaSettings::common].
2295    ///
2296    /// # Example
2297    /// ```ignore,no_run
2298    /// # use google_cloud_api::model::JavaSettings;
2299    /// use google_cloud_api::model::CommonLanguageSettings;
2300    /// let x = JavaSettings::new().set_common(CommonLanguageSettings::default()/* use setters */);
2301    /// ```
2302    pub fn set_common<T>(mut self, v: T) -> Self
2303    where
2304        T: std::convert::Into<crate::model::CommonLanguageSettings>,
2305    {
2306        self.common = std::option::Option::Some(v.into());
2307        self
2308    }
2309
2310    /// Sets or clears the value of [common][crate::model::JavaSettings::common].
2311    ///
2312    /// # Example
2313    /// ```ignore,no_run
2314    /// # use google_cloud_api::model::JavaSettings;
2315    /// use google_cloud_api::model::CommonLanguageSettings;
2316    /// let x = JavaSettings::new().set_or_clear_common(Some(CommonLanguageSettings::default()/* use setters */));
2317    /// let x = JavaSettings::new().set_or_clear_common(None::<CommonLanguageSettings>);
2318    /// ```
2319    pub fn set_or_clear_common<T>(mut self, v: std::option::Option<T>) -> Self
2320    where
2321        T: std::convert::Into<crate::model::CommonLanguageSettings>,
2322    {
2323        self.common = v.map(|x| x.into());
2324        self
2325    }
2326}
2327
2328impl wkt::message::Message for JavaSettings {
2329    fn typename() -> &'static str {
2330        "type.googleapis.com/google.api.JavaSettings"
2331    }
2332}
2333
2334/// Settings for C++ client libraries.
2335#[derive(Clone, Default, PartialEq)]
2336#[non_exhaustive]
2337pub struct CppSettings {
2338    /// Some settings.
2339    pub common: std::option::Option<crate::model::CommonLanguageSettings>,
2340
2341    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2342}
2343
2344impl CppSettings {
2345    /// Creates a new default instance.
2346    pub fn new() -> Self {
2347        std::default::Default::default()
2348    }
2349
2350    /// Sets the value of [common][crate::model::CppSettings::common].
2351    ///
2352    /// # Example
2353    /// ```ignore,no_run
2354    /// # use google_cloud_api::model::CppSettings;
2355    /// use google_cloud_api::model::CommonLanguageSettings;
2356    /// let x = CppSettings::new().set_common(CommonLanguageSettings::default()/* use setters */);
2357    /// ```
2358    pub fn set_common<T>(mut self, v: T) -> Self
2359    where
2360        T: std::convert::Into<crate::model::CommonLanguageSettings>,
2361    {
2362        self.common = std::option::Option::Some(v.into());
2363        self
2364    }
2365
2366    /// Sets or clears the value of [common][crate::model::CppSettings::common].
2367    ///
2368    /// # Example
2369    /// ```ignore,no_run
2370    /// # use google_cloud_api::model::CppSettings;
2371    /// use google_cloud_api::model::CommonLanguageSettings;
2372    /// let x = CppSettings::new().set_or_clear_common(Some(CommonLanguageSettings::default()/* use setters */));
2373    /// let x = CppSettings::new().set_or_clear_common(None::<CommonLanguageSettings>);
2374    /// ```
2375    pub fn set_or_clear_common<T>(mut self, v: std::option::Option<T>) -> Self
2376    where
2377        T: std::convert::Into<crate::model::CommonLanguageSettings>,
2378    {
2379        self.common = v.map(|x| x.into());
2380        self
2381    }
2382}
2383
2384impl wkt::message::Message for CppSettings {
2385    fn typename() -> &'static str {
2386        "type.googleapis.com/google.api.CppSettings"
2387    }
2388}
2389
2390/// Settings for Php client libraries.
2391#[derive(Clone, Default, PartialEq)]
2392#[non_exhaustive]
2393pub struct PhpSettings {
2394    /// Some settings.
2395    pub common: std::option::Option<crate::model::CommonLanguageSettings>,
2396
2397    /// The package name to use in Php. Clobbers the php_namespace option
2398    /// set in the protobuf. This should be used **only** by APIs
2399    /// who have already set the language_settings.php.package_name" field
2400    /// in gapic.yaml. API teams should use the protobuf php_namespace option
2401    /// where possible.
2402    ///
2403    /// Example of a YAML configuration::
2404    ///
2405    /// ```norust
2406    /// publishing:
2407    ///   library_settings:
2408    ///     php_settings:
2409    ///       library_package: Google\Cloud\PubSub\V1
2410    /// ```
2411    pub library_package: std::string::String,
2412
2413    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2414}
2415
2416impl PhpSettings {
2417    /// Creates a new default instance.
2418    pub fn new() -> Self {
2419        std::default::Default::default()
2420    }
2421
2422    /// Sets the value of [common][crate::model::PhpSettings::common].
2423    ///
2424    /// # Example
2425    /// ```ignore,no_run
2426    /// # use google_cloud_api::model::PhpSettings;
2427    /// use google_cloud_api::model::CommonLanguageSettings;
2428    /// let x = PhpSettings::new().set_common(CommonLanguageSettings::default()/* use setters */);
2429    /// ```
2430    pub fn set_common<T>(mut self, v: T) -> Self
2431    where
2432        T: std::convert::Into<crate::model::CommonLanguageSettings>,
2433    {
2434        self.common = std::option::Option::Some(v.into());
2435        self
2436    }
2437
2438    /// Sets or clears the value of [common][crate::model::PhpSettings::common].
2439    ///
2440    /// # Example
2441    /// ```ignore,no_run
2442    /// # use google_cloud_api::model::PhpSettings;
2443    /// use google_cloud_api::model::CommonLanguageSettings;
2444    /// let x = PhpSettings::new().set_or_clear_common(Some(CommonLanguageSettings::default()/* use setters */));
2445    /// let x = PhpSettings::new().set_or_clear_common(None::<CommonLanguageSettings>);
2446    /// ```
2447    pub fn set_or_clear_common<T>(mut self, v: std::option::Option<T>) -> Self
2448    where
2449        T: std::convert::Into<crate::model::CommonLanguageSettings>,
2450    {
2451        self.common = v.map(|x| x.into());
2452        self
2453    }
2454
2455    /// Sets the value of [library_package][crate::model::PhpSettings::library_package].
2456    ///
2457    /// # Example
2458    /// ```ignore,no_run
2459    /// # use google_cloud_api::model::PhpSettings;
2460    /// let x = PhpSettings::new().set_library_package("example");
2461    /// ```
2462    pub fn set_library_package<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2463        self.library_package = v.into();
2464        self
2465    }
2466}
2467
2468impl wkt::message::Message for PhpSettings {
2469    fn typename() -> &'static str {
2470        "type.googleapis.com/google.api.PhpSettings"
2471    }
2472}
2473
2474/// Settings for Python client libraries.
2475#[derive(Clone, Default, PartialEq)]
2476#[non_exhaustive]
2477pub struct PythonSettings {
2478    /// Some settings.
2479    pub common: std::option::Option<crate::model::CommonLanguageSettings>,
2480
2481    /// Experimental features to be included during client library generation.
2482    pub experimental_features:
2483        std::option::Option<crate::model::python_settings::ExperimentalFeatures>,
2484
2485    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2486}
2487
2488impl PythonSettings {
2489    /// Creates a new default instance.
2490    pub fn new() -> Self {
2491        std::default::Default::default()
2492    }
2493
2494    /// Sets the value of [common][crate::model::PythonSettings::common].
2495    ///
2496    /// # Example
2497    /// ```ignore,no_run
2498    /// # use google_cloud_api::model::PythonSettings;
2499    /// use google_cloud_api::model::CommonLanguageSettings;
2500    /// let x = PythonSettings::new().set_common(CommonLanguageSettings::default()/* use setters */);
2501    /// ```
2502    pub fn set_common<T>(mut self, v: T) -> Self
2503    where
2504        T: std::convert::Into<crate::model::CommonLanguageSettings>,
2505    {
2506        self.common = std::option::Option::Some(v.into());
2507        self
2508    }
2509
2510    /// Sets or clears the value of [common][crate::model::PythonSettings::common].
2511    ///
2512    /// # Example
2513    /// ```ignore,no_run
2514    /// # use google_cloud_api::model::PythonSettings;
2515    /// use google_cloud_api::model::CommonLanguageSettings;
2516    /// let x = PythonSettings::new().set_or_clear_common(Some(CommonLanguageSettings::default()/* use setters */));
2517    /// let x = PythonSettings::new().set_or_clear_common(None::<CommonLanguageSettings>);
2518    /// ```
2519    pub fn set_or_clear_common<T>(mut self, v: std::option::Option<T>) -> Self
2520    where
2521        T: std::convert::Into<crate::model::CommonLanguageSettings>,
2522    {
2523        self.common = v.map(|x| x.into());
2524        self
2525    }
2526
2527    /// Sets the value of [experimental_features][crate::model::PythonSettings::experimental_features].
2528    ///
2529    /// # Example
2530    /// ```ignore,no_run
2531    /// # use google_cloud_api::model::PythonSettings;
2532    /// use google_cloud_api::model::python_settings::ExperimentalFeatures;
2533    /// let x = PythonSettings::new().set_experimental_features(ExperimentalFeatures::default()/* use setters */);
2534    /// ```
2535    pub fn set_experimental_features<T>(mut self, v: T) -> Self
2536    where
2537        T: std::convert::Into<crate::model::python_settings::ExperimentalFeatures>,
2538    {
2539        self.experimental_features = std::option::Option::Some(v.into());
2540        self
2541    }
2542
2543    /// Sets or clears the value of [experimental_features][crate::model::PythonSettings::experimental_features].
2544    ///
2545    /// # Example
2546    /// ```ignore,no_run
2547    /// # use google_cloud_api::model::PythonSettings;
2548    /// use google_cloud_api::model::python_settings::ExperimentalFeatures;
2549    /// let x = PythonSettings::new().set_or_clear_experimental_features(Some(ExperimentalFeatures::default()/* use setters */));
2550    /// let x = PythonSettings::new().set_or_clear_experimental_features(None::<ExperimentalFeatures>);
2551    /// ```
2552    pub fn set_or_clear_experimental_features<T>(mut self, v: std::option::Option<T>) -> Self
2553    where
2554        T: std::convert::Into<crate::model::python_settings::ExperimentalFeatures>,
2555    {
2556        self.experimental_features = v.map(|x| x.into());
2557        self
2558    }
2559}
2560
2561impl wkt::message::Message for PythonSettings {
2562    fn typename() -> &'static str {
2563        "type.googleapis.com/google.api.PythonSettings"
2564    }
2565}
2566
2567/// Defines additional types related to [PythonSettings].
2568pub mod python_settings {
2569    #[allow(unused_imports)]
2570    use super::*;
2571
2572    /// Experimental features to be included during client library generation.
2573    /// These fields will be deprecated once the feature graduates and is enabled
2574    /// by default.
2575    #[derive(Clone, Default, PartialEq)]
2576    #[non_exhaustive]
2577    pub struct ExperimentalFeatures {
2578        /// Enables generation of asynchronous REST clients if `rest` transport is
2579        /// enabled. By default, asynchronous REST clients will not be generated.
2580        /// This feature will be enabled by default 1 month after launching the
2581        /// feature in preview packages.
2582        pub rest_async_io_enabled: bool,
2583
2584        /// Enables generation of protobuf code using new types that are more
2585        /// Pythonic which are included in `protobuf>=5.29.x`. This feature will be
2586        /// enabled by default 1 month after launching the feature in preview
2587        /// packages.
2588        pub protobuf_pythonic_types_enabled: bool,
2589
2590        /// Disables generation of an unversioned Python package for this client
2591        /// library. This means that the module names will need to be versioned in
2592        /// import statements. For example `import google.cloud.library_v2` instead
2593        /// of `import google.cloud.library`.
2594        pub unversioned_package_disabled: bool,
2595
2596        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2597    }
2598
2599    impl ExperimentalFeatures {
2600        /// Creates a new default instance.
2601        pub fn new() -> Self {
2602            std::default::Default::default()
2603        }
2604
2605        /// Sets the value of [rest_async_io_enabled][crate::model::python_settings::ExperimentalFeatures::rest_async_io_enabled].
2606        ///
2607        /// # Example
2608        /// ```ignore,no_run
2609        /// # use google_cloud_api::model::python_settings::ExperimentalFeatures;
2610        /// let x = ExperimentalFeatures::new().set_rest_async_io_enabled(true);
2611        /// ```
2612        pub fn set_rest_async_io_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2613            self.rest_async_io_enabled = v.into();
2614            self
2615        }
2616
2617        /// Sets the value of [protobuf_pythonic_types_enabled][crate::model::python_settings::ExperimentalFeatures::protobuf_pythonic_types_enabled].
2618        ///
2619        /// # Example
2620        /// ```ignore,no_run
2621        /// # use google_cloud_api::model::python_settings::ExperimentalFeatures;
2622        /// let x = ExperimentalFeatures::new().set_protobuf_pythonic_types_enabled(true);
2623        /// ```
2624        pub fn set_protobuf_pythonic_types_enabled<T: std::convert::Into<bool>>(
2625            mut self,
2626            v: T,
2627        ) -> Self {
2628            self.protobuf_pythonic_types_enabled = v.into();
2629            self
2630        }
2631
2632        /// Sets the value of [unversioned_package_disabled][crate::model::python_settings::ExperimentalFeatures::unversioned_package_disabled].
2633        ///
2634        /// # Example
2635        /// ```ignore,no_run
2636        /// # use google_cloud_api::model::python_settings::ExperimentalFeatures;
2637        /// let x = ExperimentalFeatures::new().set_unversioned_package_disabled(true);
2638        /// ```
2639        pub fn set_unversioned_package_disabled<T: std::convert::Into<bool>>(
2640            mut self,
2641            v: T,
2642        ) -> Self {
2643            self.unversioned_package_disabled = v.into();
2644            self
2645        }
2646    }
2647
2648    impl wkt::message::Message for ExperimentalFeatures {
2649        fn typename() -> &'static str {
2650            "type.googleapis.com/google.api.PythonSettings.ExperimentalFeatures"
2651        }
2652    }
2653}
2654
2655/// Settings for Node client libraries.
2656#[derive(Clone, Default, PartialEq)]
2657#[non_exhaustive]
2658pub struct NodeSettings {
2659    /// Some settings.
2660    pub common: std::option::Option<crate::model::CommonLanguageSettings>,
2661
2662    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2663}
2664
2665impl NodeSettings {
2666    /// Creates a new default instance.
2667    pub fn new() -> Self {
2668        std::default::Default::default()
2669    }
2670
2671    /// Sets the value of [common][crate::model::NodeSettings::common].
2672    ///
2673    /// # Example
2674    /// ```ignore,no_run
2675    /// # use google_cloud_api::model::NodeSettings;
2676    /// use google_cloud_api::model::CommonLanguageSettings;
2677    /// let x = NodeSettings::new().set_common(CommonLanguageSettings::default()/* use setters */);
2678    /// ```
2679    pub fn set_common<T>(mut self, v: T) -> Self
2680    where
2681        T: std::convert::Into<crate::model::CommonLanguageSettings>,
2682    {
2683        self.common = std::option::Option::Some(v.into());
2684        self
2685    }
2686
2687    /// Sets or clears the value of [common][crate::model::NodeSettings::common].
2688    ///
2689    /// # Example
2690    /// ```ignore,no_run
2691    /// # use google_cloud_api::model::NodeSettings;
2692    /// use google_cloud_api::model::CommonLanguageSettings;
2693    /// let x = NodeSettings::new().set_or_clear_common(Some(CommonLanguageSettings::default()/* use setters */));
2694    /// let x = NodeSettings::new().set_or_clear_common(None::<CommonLanguageSettings>);
2695    /// ```
2696    pub fn set_or_clear_common<T>(mut self, v: std::option::Option<T>) -> Self
2697    where
2698        T: std::convert::Into<crate::model::CommonLanguageSettings>,
2699    {
2700        self.common = v.map(|x| x.into());
2701        self
2702    }
2703}
2704
2705impl wkt::message::Message for NodeSettings {
2706    fn typename() -> &'static str {
2707        "type.googleapis.com/google.api.NodeSettings"
2708    }
2709}
2710
2711/// Settings for Dotnet client libraries.
2712#[derive(Clone, Default, PartialEq)]
2713#[non_exhaustive]
2714pub struct DotnetSettings {
2715    /// Some settings.
2716    pub common: std::option::Option<crate::model::CommonLanguageSettings>,
2717
2718    /// Map from original service names to renamed versions.
2719    /// This is used when the default generated types
2720    /// would cause a naming conflict. (Neither name is
2721    /// fully-qualified.)
2722    /// Example: Subscriber to SubscriberServiceApi.
2723    pub renamed_services: std::collections::HashMap<std::string::String, std::string::String>,
2724
2725    /// Map from full resource types to the effective short name
2726    /// for the resource. This is used when otherwise resource
2727    /// named from different services would cause naming collisions.
2728    /// Example entry:
2729    /// "datalabeling.googleapis.com/Dataset": "DataLabelingDataset"
2730    pub renamed_resources: std::collections::HashMap<std::string::String, std::string::String>,
2731
2732    /// List of full resource types to ignore during generation.
2733    /// This is typically used for API-specific Location resources,
2734    /// which should be handled by the generator as if they were actually
2735    /// the common Location resources.
2736    /// Example entry: "documentai.googleapis.com/Location"
2737    pub ignored_resources: std::vec::Vec<std::string::String>,
2738
2739    /// Namespaces which must be aliased in snippets due to
2740    /// a known (but non-generator-predictable) naming collision
2741    pub forced_namespace_aliases: std::vec::Vec<std::string::String>,
2742
2743    /// Method signatures (in the form "service.method(signature)")
2744    /// which are provided separately, so shouldn't be generated.
2745    /// Snippets *calling* these methods are still generated, however.
2746    pub handwritten_signatures: std::vec::Vec<std::string::String>,
2747
2748    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2749}
2750
2751impl DotnetSettings {
2752    /// Creates a new default instance.
2753    pub fn new() -> Self {
2754        std::default::Default::default()
2755    }
2756
2757    /// Sets the value of [common][crate::model::DotnetSettings::common].
2758    ///
2759    /// # Example
2760    /// ```ignore,no_run
2761    /// # use google_cloud_api::model::DotnetSettings;
2762    /// use google_cloud_api::model::CommonLanguageSettings;
2763    /// let x = DotnetSettings::new().set_common(CommonLanguageSettings::default()/* use setters */);
2764    /// ```
2765    pub fn set_common<T>(mut self, v: T) -> Self
2766    where
2767        T: std::convert::Into<crate::model::CommonLanguageSettings>,
2768    {
2769        self.common = std::option::Option::Some(v.into());
2770        self
2771    }
2772
2773    /// Sets or clears the value of [common][crate::model::DotnetSettings::common].
2774    ///
2775    /// # Example
2776    /// ```ignore,no_run
2777    /// # use google_cloud_api::model::DotnetSettings;
2778    /// use google_cloud_api::model::CommonLanguageSettings;
2779    /// let x = DotnetSettings::new().set_or_clear_common(Some(CommonLanguageSettings::default()/* use setters */));
2780    /// let x = DotnetSettings::new().set_or_clear_common(None::<CommonLanguageSettings>);
2781    /// ```
2782    pub fn set_or_clear_common<T>(mut self, v: std::option::Option<T>) -> Self
2783    where
2784        T: std::convert::Into<crate::model::CommonLanguageSettings>,
2785    {
2786        self.common = v.map(|x| x.into());
2787        self
2788    }
2789
2790    /// Sets the value of [renamed_services][crate::model::DotnetSettings::renamed_services].
2791    ///
2792    /// # Example
2793    /// ```ignore,no_run
2794    /// # use google_cloud_api::model::DotnetSettings;
2795    /// let x = DotnetSettings::new().set_renamed_services([
2796    ///     ("key0", "abc"),
2797    ///     ("key1", "xyz"),
2798    /// ]);
2799    /// ```
2800    pub fn set_renamed_services<T, K, V>(mut self, v: T) -> Self
2801    where
2802        T: std::iter::IntoIterator<Item = (K, V)>,
2803        K: std::convert::Into<std::string::String>,
2804        V: std::convert::Into<std::string::String>,
2805    {
2806        use std::iter::Iterator;
2807        self.renamed_services = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2808        self
2809    }
2810
2811    /// Sets the value of [renamed_resources][crate::model::DotnetSettings::renamed_resources].
2812    ///
2813    /// # Example
2814    /// ```ignore,no_run
2815    /// # use google_cloud_api::model::DotnetSettings;
2816    /// let x = DotnetSettings::new().set_renamed_resources([
2817    ///     ("key0", "abc"),
2818    ///     ("key1", "xyz"),
2819    /// ]);
2820    /// ```
2821    pub fn set_renamed_resources<T, K, V>(mut self, v: T) -> Self
2822    where
2823        T: std::iter::IntoIterator<Item = (K, V)>,
2824        K: std::convert::Into<std::string::String>,
2825        V: std::convert::Into<std::string::String>,
2826    {
2827        use std::iter::Iterator;
2828        self.renamed_resources = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2829        self
2830    }
2831
2832    /// Sets the value of [ignored_resources][crate::model::DotnetSettings::ignored_resources].
2833    ///
2834    /// # Example
2835    /// ```ignore,no_run
2836    /// # use google_cloud_api::model::DotnetSettings;
2837    /// let x = DotnetSettings::new().set_ignored_resources(["a", "b", "c"]);
2838    /// ```
2839    pub fn set_ignored_resources<T, V>(mut self, v: T) -> Self
2840    where
2841        T: std::iter::IntoIterator<Item = V>,
2842        V: std::convert::Into<std::string::String>,
2843    {
2844        use std::iter::Iterator;
2845        self.ignored_resources = v.into_iter().map(|i| i.into()).collect();
2846        self
2847    }
2848
2849    /// Sets the value of [forced_namespace_aliases][crate::model::DotnetSettings::forced_namespace_aliases].
2850    ///
2851    /// # Example
2852    /// ```ignore,no_run
2853    /// # use google_cloud_api::model::DotnetSettings;
2854    /// let x = DotnetSettings::new().set_forced_namespace_aliases(["a", "b", "c"]);
2855    /// ```
2856    pub fn set_forced_namespace_aliases<T, V>(mut self, v: T) -> Self
2857    where
2858        T: std::iter::IntoIterator<Item = V>,
2859        V: std::convert::Into<std::string::String>,
2860    {
2861        use std::iter::Iterator;
2862        self.forced_namespace_aliases = v.into_iter().map(|i| i.into()).collect();
2863        self
2864    }
2865
2866    /// Sets the value of [handwritten_signatures][crate::model::DotnetSettings::handwritten_signatures].
2867    ///
2868    /// # Example
2869    /// ```ignore,no_run
2870    /// # use google_cloud_api::model::DotnetSettings;
2871    /// let x = DotnetSettings::new().set_handwritten_signatures(["a", "b", "c"]);
2872    /// ```
2873    pub fn set_handwritten_signatures<T, V>(mut self, v: T) -> Self
2874    where
2875        T: std::iter::IntoIterator<Item = V>,
2876        V: std::convert::Into<std::string::String>,
2877    {
2878        use std::iter::Iterator;
2879        self.handwritten_signatures = v.into_iter().map(|i| i.into()).collect();
2880        self
2881    }
2882}
2883
2884impl wkt::message::Message for DotnetSettings {
2885    fn typename() -> &'static str {
2886        "type.googleapis.com/google.api.DotnetSettings"
2887    }
2888}
2889
2890/// Settings for Ruby client libraries.
2891#[derive(Clone, Default, PartialEq)]
2892#[non_exhaustive]
2893pub struct RubySettings {
2894    /// Some settings.
2895    pub common: std::option::Option<crate::model::CommonLanguageSettings>,
2896
2897    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2898}
2899
2900impl RubySettings {
2901    /// Creates a new default instance.
2902    pub fn new() -> Self {
2903        std::default::Default::default()
2904    }
2905
2906    /// Sets the value of [common][crate::model::RubySettings::common].
2907    ///
2908    /// # Example
2909    /// ```ignore,no_run
2910    /// # use google_cloud_api::model::RubySettings;
2911    /// use google_cloud_api::model::CommonLanguageSettings;
2912    /// let x = RubySettings::new().set_common(CommonLanguageSettings::default()/* use setters */);
2913    /// ```
2914    pub fn set_common<T>(mut self, v: T) -> Self
2915    where
2916        T: std::convert::Into<crate::model::CommonLanguageSettings>,
2917    {
2918        self.common = std::option::Option::Some(v.into());
2919        self
2920    }
2921
2922    /// Sets or clears the value of [common][crate::model::RubySettings::common].
2923    ///
2924    /// # Example
2925    /// ```ignore,no_run
2926    /// # use google_cloud_api::model::RubySettings;
2927    /// use google_cloud_api::model::CommonLanguageSettings;
2928    /// let x = RubySettings::new().set_or_clear_common(Some(CommonLanguageSettings::default()/* use setters */));
2929    /// let x = RubySettings::new().set_or_clear_common(None::<CommonLanguageSettings>);
2930    /// ```
2931    pub fn set_or_clear_common<T>(mut self, v: std::option::Option<T>) -> Self
2932    where
2933        T: std::convert::Into<crate::model::CommonLanguageSettings>,
2934    {
2935        self.common = v.map(|x| x.into());
2936        self
2937    }
2938}
2939
2940impl wkt::message::Message for RubySettings {
2941    fn typename() -> &'static str {
2942        "type.googleapis.com/google.api.RubySettings"
2943    }
2944}
2945
2946/// Settings for Go client libraries.
2947#[derive(Clone, Default, PartialEq)]
2948#[non_exhaustive]
2949pub struct GoSettings {
2950    /// Some settings.
2951    pub common: std::option::Option<crate::model::CommonLanguageSettings>,
2952
2953    /// Map of service names to renamed services. Keys are the package relative
2954    /// service names and values are the name to be used for the service client
2955    /// and call options.
2956    ///
2957    /// Example:
2958    ///
2959    /// ```norust
2960    /// publishing:
2961    ///   go_settings:
2962    ///     renamed_services:
2963    ///       Publisher: TopicAdmin
2964    /// ```
2965    pub renamed_services: std::collections::HashMap<std::string::String, std::string::String>,
2966
2967    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2968}
2969
2970impl GoSettings {
2971    /// Creates a new default instance.
2972    pub fn new() -> Self {
2973        std::default::Default::default()
2974    }
2975
2976    /// Sets the value of [common][crate::model::GoSettings::common].
2977    ///
2978    /// # Example
2979    /// ```ignore,no_run
2980    /// # use google_cloud_api::model::GoSettings;
2981    /// use google_cloud_api::model::CommonLanguageSettings;
2982    /// let x = GoSettings::new().set_common(CommonLanguageSettings::default()/* use setters */);
2983    /// ```
2984    pub fn set_common<T>(mut self, v: T) -> Self
2985    where
2986        T: std::convert::Into<crate::model::CommonLanguageSettings>,
2987    {
2988        self.common = std::option::Option::Some(v.into());
2989        self
2990    }
2991
2992    /// Sets or clears the value of [common][crate::model::GoSettings::common].
2993    ///
2994    /// # Example
2995    /// ```ignore,no_run
2996    /// # use google_cloud_api::model::GoSettings;
2997    /// use google_cloud_api::model::CommonLanguageSettings;
2998    /// let x = GoSettings::new().set_or_clear_common(Some(CommonLanguageSettings::default()/* use setters */));
2999    /// let x = GoSettings::new().set_or_clear_common(None::<CommonLanguageSettings>);
3000    /// ```
3001    pub fn set_or_clear_common<T>(mut self, v: std::option::Option<T>) -> Self
3002    where
3003        T: std::convert::Into<crate::model::CommonLanguageSettings>,
3004    {
3005        self.common = v.map(|x| x.into());
3006        self
3007    }
3008
3009    /// Sets the value of [renamed_services][crate::model::GoSettings::renamed_services].
3010    ///
3011    /// # Example
3012    /// ```ignore,no_run
3013    /// # use google_cloud_api::model::GoSettings;
3014    /// let x = GoSettings::new().set_renamed_services([
3015    ///     ("key0", "abc"),
3016    ///     ("key1", "xyz"),
3017    /// ]);
3018    /// ```
3019    pub fn set_renamed_services<T, K, V>(mut self, v: T) -> Self
3020    where
3021        T: std::iter::IntoIterator<Item = (K, V)>,
3022        K: std::convert::Into<std::string::String>,
3023        V: std::convert::Into<std::string::String>,
3024    {
3025        use std::iter::Iterator;
3026        self.renamed_services = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3027        self
3028    }
3029}
3030
3031impl wkt::message::Message for GoSettings {
3032    fn typename() -> &'static str {
3033        "type.googleapis.com/google.api.GoSettings"
3034    }
3035}
3036
3037/// Describes the generator configuration for a method.
3038#[derive(Clone, Default, PartialEq)]
3039#[non_exhaustive]
3040pub struct MethodSettings {
3041    /// The fully qualified name of the method, for which the options below apply.
3042    /// This is used to find the method to apply the options.
3043    ///
3044    /// Example:
3045    ///
3046    /// ```norust
3047    /// publishing:
3048    ///   method_settings:
3049    ///   - selector: google.storage.control.v2.StorageControl.CreateFolder
3050    ///     # method settings for CreateFolder...
3051    /// ```
3052    pub selector: std::string::String,
3053
3054    /// Describes settings to use for long-running operations when generating
3055    /// API methods for RPCs. Complements RPCs that use the annotations in
3056    /// google/longrunning/operations.proto.
3057    ///
3058    /// Example of a YAML configuration::
3059    ///
3060    /// ```norust
3061    /// publishing:
3062    ///   method_settings:
3063    ///   - selector: google.cloud.speech.v2.Speech.BatchRecognize
3064    ///     long_running:
3065    ///       initial_poll_delay: 60s # 1 minute
3066    ///       poll_delay_multiplier: 1.5
3067    ///       max_poll_delay: 360s # 6 minutes
3068    ///       total_poll_timeout: 54000s # 90 minutes
3069    /// ```
3070    pub long_running: std::option::Option<crate::model::method_settings::LongRunning>,
3071
3072    /// List of top-level fields of the request message, that should be
3073    /// automatically populated by the client libraries based on their
3074    /// (google.api.field_info).format. Currently supported format: UUID4.
3075    ///
3076    /// Example of a YAML configuration:
3077    ///
3078    /// ```norust
3079    /// publishing:
3080    ///   method_settings:
3081    ///   - selector: google.example.v1.ExampleService.CreateExample
3082    ///     auto_populated_fields:
3083    ///     - request_id
3084    /// ```
3085    pub auto_populated_fields: std::vec::Vec<std::string::String>,
3086
3087    /// Batching configuration for an API method in client libraries.
3088    ///
3089    /// Example of a YAML configuration:
3090    ///
3091    /// ```norust
3092    /// publishing:
3093    ///   method_settings:
3094    ///   - selector: google.example.v1.ExampleService.BatchCreateExample
3095    ///     batching:
3096    ///       element_count_threshold: 1000
3097    ///       request_byte_threshold: 100000000
3098    ///       delay_threshold_millis: 10
3099    /// ```
3100    pub batching: std::option::Option<crate::model::BatchingConfigProto>,
3101
3102    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3103}
3104
3105impl MethodSettings {
3106    /// Creates a new default instance.
3107    pub fn new() -> Self {
3108        std::default::Default::default()
3109    }
3110
3111    /// Sets the value of [selector][crate::model::MethodSettings::selector].
3112    ///
3113    /// # Example
3114    /// ```ignore,no_run
3115    /// # use google_cloud_api::model::MethodSettings;
3116    /// let x = MethodSettings::new().set_selector("example");
3117    /// ```
3118    pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3119        self.selector = v.into();
3120        self
3121    }
3122
3123    /// Sets the value of [long_running][crate::model::MethodSettings::long_running].
3124    ///
3125    /// # Example
3126    /// ```ignore,no_run
3127    /// # use google_cloud_api::model::MethodSettings;
3128    /// use google_cloud_api::model::method_settings::LongRunning;
3129    /// let x = MethodSettings::new().set_long_running(LongRunning::default()/* use setters */);
3130    /// ```
3131    pub fn set_long_running<T>(mut self, v: T) -> Self
3132    where
3133        T: std::convert::Into<crate::model::method_settings::LongRunning>,
3134    {
3135        self.long_running = std::option::Option::Some(v.into());
3136        self
3137    }
3138
3139    /// Sets or clears the value of [long_running][crate::model::MethodSettings::long_running].
3140    ///
3141    /// # Example
3142    /// ```ignore,no_run
3143    /// # use google_cloud_api::model::MethodSettings;
3144    /// use google_cloud_api::model::method_settings::LongRunning;
3145    /// let x = MethodSettings::new().set_or_clear_long_running(Some(LongRunning::default()/* use setters */));
3146    /// let x = MethodSettings::new().set_or_clear_long_running(None::<LongRunning>);
3147    /// ```
3148    pub fn set_or_clear_long_running<T>(mut self, v: std::option::Option<T>) -> Self
3149    where
3150        T: std::convert::Into<crate::model::method_settings::LongRunning>,
3151    {
3152        self.long_running = v.map(|x| x.into());
3153        self
3154    }
3155
3156    /// Sets the value of [auto_populated_fields][crate::model::MethodSettings::auto_populated_fields].
3157    ///
3158    /// # Example
3159    /// ```ignore,no_run
3160    /// # use google_cloud_api::model::MethodSettings;
3161    /// let x = MethodSettings::new().set_auto_populated_fields(["a", "b", "c"]);
3162    /// ```
3163    pub fn set_auto_populated_fields<T, V>(mut self, v: T) -> Self
3164    where
3165        T: std::iter::IntoIterator<Item = V>,
3166        V: std::convert::Into<std::string::String>,
3167    {
3168        use std::iter::Iterator;
3169        self.auto_populated_fields = v.into_iter().map(|i| i.into()).collect();
3170        self
3171    }
3172
3173    /// Sets the value of [batching][crate::model::MethodSettings::batching].
3174    ///
3175    /// # Example
3176    /// ```ignore,no_run
3177    /// # use google_cloud_api::model::MethodSettings;
3178    /// use google_cloud_api::model::BatchingConfigProto;
3179    /// let x = MethodSettings::new().set_batching(BatchingConfigProto::default()/* use setters */);
3180    /// ```
3181    pub fn set_batching<T>(mut self, v: T) -> Self
3182    where
3183        T: std::convert::Into<crate::model::BatchingConfigProto>,
3184    {
3185        self.batching = std::option::Option::Some(v.into());
3186        self
3187    }
3188
3189    /// Sets or clears the value of [batching][crate::model::MethodSettings::batching].
3190    ///
3191    /// # Example
3192    /// ```ignore,no_run
3193    /// # use google_cloud_api::model::MethodSettings;
3194    /// use google_cloud_api::model::BatchingConfigProto;
3195    /// let x = MethodSettings::new().set_or_clear_batching(Some(BatchingConfigProto::default()/* use setters */));
3196    /// let x = MethodSettings::new().set_or_clear_batching(None::<BatchingConfigProto>);
3197    /// ```
3198    pub fn set_or_clear_batching<T>(mut self, v: std::option::Option<T>) -> Self
3199    where
3200        T: std::convert::Into<crate::model::BatchingConfigProto>,
3201    {
3202        self.batching = v.map(|x| x.into());
3203        self
3204    }
3205}
3206
3207impl wkt::message::Message for MethodSettings {
3208    fn typename() -> &'static str {
3209        "type.googleapis.com/google.api.MethodSettings"
3210    }
3211}
3212
3213/// Defines additional types related to [MethodSettings].
3214pub mod method_settings {
3215    #[allow(unused_imports)]
3216    use super::*;
3217
3218    /// Describes settings to use when generating API methods that use the
3219    /// long-running operation pattern.
3220    /// All default values below are from those used in the client library
3221    /// generators (e.g.
3222    /// [Java](https://github.com/googleapis/gapic-generator-java/blob/04c2faa191a9b5a10b92392fe8482279c4404803/src/main/java/com/google/api/generator/gapic/composer/common/RetrySettingsComposer.java)).
3223    #[derive(Clone, Default, PartialEq)]
3224    #[non_exhaustive]
3225    pub struct LongRunning {
3226        /// Initial delay after which the first poll request will be made.
3227        /// Default value: 5 seconds.
3228        pub initial_poll_delay: std::option::Option<wkt::Duration>,
3229
3230        /// Multiplier to gradually increase delay between subsequent polls until it
3231        /// reaches max_poll_delay.
3232        /// Default value: 1.5.
3233        pub poll_delay_multiplier: f32,
3234
3235        /// Maximum time between two subsequent poll requests.
3236        /// Default value: 45 seconds.
3237        pub max_poll_delay: std::option::Option<wkt::Duration>,
3238
3239        /// Total polling timeout.
3240        /// Default value: 5 minutes.
3241        pub total_poll_timeout: std::option::Option<wkt::Duration>,
3242
3243        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3244    }
3245
3246    impl LongRunning {
3247        /// Creates a new default instance.
3248        pub fn new() -> Self {
3249            std::default::Default::default()
3250        }
3251
3252        /// Sets the value of [initial_poll_delay][crate::model::method_settings::LongRunning::initial_poll_delay].
3253        ///
3254        /// # Example
3255        /// ```ignore,no_run
3256        /// # use google_cloud_api::model::method_settings::LongRunning;
3257        /// use wkt::Duration;
3258        /// let x = LongRunning::new().set_initial_poll_delay(Duration::default()/* use setters */);
3259        /// ```
3260        pub fn set_initial_poll_delay<T>(mut self, v: T) -> Self
3261        where
3262            T: std::convert::Into<wkt::Duration>,
3263        {
3264            self.initial_poll_delay = std::option::Option::Some(v.into());
3265            self
3266        }
3267
3268        /// Sets or clears the value of [initial_poll_delay][crate::model::method_settings::LongRunning::initial_poll_delay].
3269        ///
3270        /// # Example
3271        /// ```ignore,no_run
3272        /// # use google_cloud_api::model::method_settings::LongRunning;
3273        /// use wkt::Duration;
3274        /// let x = LongRunning::new().set_or_clear_initial_poll_delay(Some(Duration::default()/* use setters */));
3275        /// let x = LongRunning::new().set_or_clear_initial_poll_delay(None::<Duration>);
3276        /// ```
3277        pub fn set_or_clear_initial_poll_delay<T>(mut self, v: std::option::Option<T>) -> Self
3278        where
3279            T: std::convert::Into<wkt::Duration>,
3280        {
3281            self.initial_poll_delay = v.map(|x| x.into());
3282            self
3283        }
3284
3285        /// Sets the value of [poll_delay_multiplier][crate::model::method_settings::LongRunning::poll_delay_multiplier].
3286        ///
3287        /// # Example
3288        /// ```ignore,no_run
3289        /// # use google_cloud_api::model::method_settings::LongRunning;
3290        /// let x = LongRunning::new().set_poll_delay_multiplier(42.0);
3291        /// ```
3292        pub fn set_poll_delay_multiplier<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
3293            self.poll_delay_multiplier = v.into();
3294            self
3295        }
3296
3297        /// Sets the value of [max_poll_delay][crate::model::method_settings::LongRunning::max_poll_delay].
3298        ///
3299        /// # Example
3300        /// ```ignore,no_run
3301        /// # use google_cloud_api::model::method_settings::LongRunning;
3302        /// use wkt::Duration;
3303        /// let x = LongRunning::new().set_max_poll_delay(Duration::default()/* use setters */);
3304        /// ```
3305        pub fn set_max_poll_delay<T>(mut self, v: T) -> Self
3306        where
3307            T: std::convert::Into<wkt::Duration>,
3308        {
3309            self.max_poll_delay = std::option::Option::Some(v.into());
3310            self
3311        }
3312
3313        /// Sets or clears the value of [max_poll_delay][crate::model::method_settings::LongRunning::max_poll_delay].
3314        ///
3315        /// # Example
3316        /// ```ignore,no_run
3317        /// # use google_cloud_api::model::method_settings::LongRunning;
3318        /// use wkt::Duration;
3319        /// let x = LongRunning::new().set_or_clear_max_poll_delay(Some(Duration::default()/* use setters */));
3320        /// let x = LongRunning::new().set_or_clear_max_poll_delay(None::<Duration>);
3321        /// ```
3322        pub fn set_or_clear_max_poll_delay<T>(mut self, v: std::option::Option<T>) -> Self
3323        where
3324            T: std::convert::Into<wkt::Duration>,
3325        {
3326            self.max_poll_delay = v.map(|x| x.into());
3327            self
3328        }
3329
3330        /// Sets the value of [total_poll_timeout][crate::model::method_settings::LongRunning::total_poll_timeout].
3331        ///
3332        /// # Example
3333        /// ```ignore,no_run
3334        /// # use google_cloud_api::model::method_settings::LongRunning;
3335        /// use wkt::Duration;
3336        /// let x = LongRunning::new().set_total_poll_timeout(Duration::default()/* use setters */);
3337        /// ```
3338        pub fn set_total_poll_timeout<T>(mut self, v: T) -> Self
3339        where
3340            T: std::convert::Into<wkt::Duration>,
3341        {
3342            self.total_poll_timeout = std::option::Option::Some(v.into());
3343            self
3344        }
3345
3346        /// Sets or clears the value of [total_poll_timeout][crate::model::method_settings::LongRunning::total_poll_timeout].
3347        ///
3348        /// # Example
3349        /// ```ignore,no_run
3350        /// # use google_cloud_api::model::method_settings::LongRunning;
3351        /// use wkt::Duration;
3352        /// let x = LongRunning::new().set_or_clear_total_poll_timeout(Some(Duration::default()/* use setters */));
3353        /// let x = LongRunning::new().set_or_clear_total_poll_timeout(None::<Duration>);
3354        /// ```
3355        pub fn set_or_clear_total_poll_timeout<T>(mut self, v: std::option::Option<T>) -> Self
3356        where
3357            T: std::convert::Into<wkt::Duration>,
3358        {
3359            self.total_poll_timeout = v.map(|x| x.into());
3360            self
3361        }
3362    }
3363
3364    impl wkt::message::Message for LongRunning {
3365        fn typename() -> &'static str {
3366            "type.googleapis.com/google.api.MethodSettings.LongRunning"
3367        }
3368    }
3369}
3370
3371/// This message is used to configure the generation of a subset of the RPCs in
3372/// a service for client libraries.
3373///
3374/// Note: This feature should not be used in most cases.
3375#[derive(Clone, Default, PartialEq)]
3376#[non_exhaustive]
3377pub struct SelectiveGapicGeneration {
3378    /// An allowlist of the fully qualified names of RPCs that should be included
3379    /// on public client surfaces.
3380    pub methods: std::vec::Vec<std::string::String>,
3381
3382    /// Setting this to true indicates to the client generators that methods
3383    /// that would be excluded from the generation should instead be generated
3384    /// in a way that indicates these methods should not be consumed by
3385    /// end users. How this is expressed is up to individual language
3386    /// implementations to decide. Some examples may be: added annotations,
3387    /// obfuscated identifiers, or other language idiomatic patterns.
3388    pub generate_omitted_as_internal: bool,
3389
3390    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3391}
3392
3393impl SelectiveGapicGeneration {
3394    /// Creates a new default instance.
3395    pub fn new() -> Self {
3396        std::default::Default::default()
3397    }
3398
3399    /// Sets the value of [methods][crate::model::SelectiveGapicGeneration::methods].
3400    ///
3401    /// # Example
3402    /// ```ignore,no_run
3403    /// # use google_cloud_api::model::SelectiveGapicGeneration;
3404    /// let x = SelectiveGapicGeneration::new().set_methods(["a", "b", "c"]);
3405    /// ```
3406    pub fn set_methods<T, V>(mut self, v: T) -> Self
3407    where
3408        T: std::iter::IntoIterator<Item = V>,
3409        V: std::convert::Into<std::string::String>,
3410    {
3411        use std::iter::Iterator;
3412        self.methods = v.into_iter().map(|i| i.into()).collect();
3413        self
3414    }
3415
3416    /// Sets the value of [generate_omitted_as_internal][crate::model::SelectiveGapicGeneration::generate_omitted_as_internal].
3417    ///
3418    /// # Example
3419    /// ```ignore,no_run
3420    /// # use google_cloud_api::model::SelectiveGapicGeneration;
3421    /// let x = SelectiveGapicGeneration::new().set_generate_omitted_as_internal(true);
3422    /// ```
3423    pub fn set_generate_omitted_as_internal<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3424        self.generate_omitted_as_internal = v.into();
3425        self
3426    }
3427}
3428
3429impl wkt::message::Message for SelectiveGapicGeneration {
3430    fn typename() -> &'static str {
3431        "type.googleapis.com/google.api.SelectiveGapicGeneration"
3432    }
3433}
3434
3435/// `BatchingConfigProto` defines the batching configuration for an API method.
3436#[derive(Clone, Default, PartialEq)]
3437#[non_exhaustive]
3438pub struct BatchingConfigProto {
3439    /// The thresholds which trigger a batched request to be sent.
3440    pub thresholds: std::option::Option<crate::model::BatchingSettingsProto>,
3441
3442    /// The request and response fields used in batching.
3443    pub batch_descriptor: std::option::Option<crate::model::BatchingDescriptorProto>,
3444
3445    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3446}
3447
3448impl BatchingConfigProto {
3449    /// Creates a new default instance.
3450    pub fn new() -> Self {
3451        std::default::Default::default()
3452    }
3453
3454    /// Sets the value of [thresholds][crate::model::BatchingConfigProto::thresholds].
3455    ///
3456    /// # Example
3457    /// ```ignore,no_run
3458    /// # use google_cloud_api::model::BatchingConfigProto;
3459    /// use google_cloud_api::model::BatchingSettingsProto;
3460    /// let x = BatchingConfigProto::new().set_thresholds(BatchingSettingsProto::default()/* use setters */);
3461    /// ```
3462    pub fn set_thresholds<T>(mut self, v: T) -> Self
3463    where
3464        T: std::convert::Into<crate::model::BatchingSettingsProto>,
3465    {
3466        self.thresholds = std::option::Option::Some(v.into());
3467        self
3468    }
3469
3470    /// Sets or clears the value of [thresholds][crate::model::BatchingConfigProto::thresholds].
3471    ///
3472    /// # Example
3473    /// ```ignore,no_run
3474    /// # use google_cloud_api::model::BatchingConfigProto;
3475    /// use google_cloud_api::model::BatchingSettingsProto;
3476    /// let x = BatchingConfigProto::new().set_or_clear_thresholds(Some(BatchingSettingsProto::default()/* use setters */));
3477    /// let x = BatchingConfigProto::new().set_or_clear_thresholds(None::<BatchingSettingsProto>);
3478    /// ```
3479    pub fn set_or_clear_thresholds<T>(mut self, v: std::option::Option<T>) -> Self
3480    where
3481        T: std::convert::Into<crate::model::BatchingSettingsProto>,
3482    {
3483        self.thresholds = v.map(|x| x.into());
3484        self
3485    }
3486
3487    /// Sets the value of [batch_descriptor][crate::model::BatchingConfigProto::batch_descriptor].
3488    ///
3489    /// # Example
3490    /// ```ignore,no_run
3491    /// # use google_cloud_api::model::BatchingConfigProto;
3492    /// use google_cloud_api::model::BatchingDescriptorProto;
3493    /// let x = BatchingConfigProto::new().set_batch_descriptor(BatchingDescriptorProto::default()/* use setters */);
3494    /// ```
3495    pub fn set_batch_descriptor<T>(mut self, v: T) -> Self
3496    where
3497        T: std::convert::Into<crate::model::BatchingDescriptorProto>,
3498    {
3499        self.batch_descriptor = std::option::Option::Some(v.into());
3500        self
3501    }
3502
3503    /// Sets or clears the value of [batch_descriptor][crate::model::BatchingConfigProto::batch_descriptor].
3504    ///
3505    /// # Example
3506    /// ```ignore,no_run
3507    /// # use google_cloud_api::model::BatchingConfigProto;
3508    /// use google_cloud_api::model::BatchingDescriptorProto;
3509    /// let x = BatchingConfigProto::new().set_or_clear_batch_descriptor(Some(BatchingDescriptorProto::default()/* use setters */));
3510    /// let x = BatchingConfigProto::new().set_or_clear_batch_descriptor(None::<BatchingDescriptorProto>);
3511    /// ```
3512    pub fn set_or_clear_batch_descriptor<T>(mut self, v: std::option::Option<T>) -> Self
3513    where
3514        T: std::convert::Into<crate::model::BatchingDescriptorProto>,
3515    {
3516        self.batch_descriptor = v.map(|x| x.into());
3517        self
3518    }
3519}
3520
3521impl wkt::message::Message for BatchingConfigProto {
3522    fn typename() -> &'static str {
3523        "type.googleapis.com/google.api.BatchingConfigProto"
3524    }
3525}
3526
3527/// `BatchingSettingsProto` specifies a set of batching thresholds, each of
3528/// which acts as a trigger to send a batch of messages as a request. At least
3529/// one threshold must be positive nonzero.
3530#[derive(Clone, Default, PartialEq)]
3531#[non_exhaustive]
3532pub struct BatchingSettingsProto {
3533    /// The number of elements of a field collected into a batch which, if
3534    /// exceeded, causes the batch to be sent.
3535    pub element_count_threshold: i32,
3536
3537    /// The aggregated size of the batched field which, if exceeded, causes the
3538    /// batch to be sent. This size is computed by aggregating the sizes of the
3539    /// request field to be batched, not of the entire request message.
3540    pub request_byte_threshold: i64,
3541
3542    /// The duration after which a batch should be sent, starting from the addition
3543    /// of the first message to that batch.
3544    pub delay_threshold: std::option::Option<wkt::Duration>,
3545
3546    /// The maximum number of elements collected in a batch that could be accepted
3547    /// by server.
3548    pub element_count_limit: i32,
3549
3550    /// The maximum size of the request that could be accepted by server.
3551    pub request_byte_limit: i32,
3552
3553    /// The maximum number of elements allowed by flow control.
3554    pub flow_control_element_limit: i32,
3555
3556    /// The maximum size of data allowed by flow control.
3557    pub flow_control_byte_limit: i32,
3558
3559    /// The behavior to take when the flow control limit is exceeded.
3560    pub flow_control_limit_exceeded_behavior: crate::model::FlowControlLimitExceededBehaviorProto,
3561
3562    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3563}
3564
3565impl BatchingSettingsProto {
3566    /// Creates a new default instance.
3567    pub fn new() -> Self {
3568        std::default::Default::default()
3569    }
3570
3571    /// Sets the value of [element_count_threshold][crate::model::BatchingSettingsProto::element_count_threshold].
3572    ///
3573    /// # Example
3574    /// ```ignore,no_run
3575    /// # use google_cloud_api::model::BatchingSettingsProto;
3576    /// let x = BatchingSettingsProto::new().set_element_count_threshold(42);
3577    /// ```
3578    pub fn set_element_count_threshold<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3579        self.element_count_threshold = v.into();
3580        self
3581    }
3582
3583    /// Sets the value of [request_byte_threshold][crate::model::BatchingSettingsProto::request_byte_threshold].
3584    ///
3585    /// # Example
3586    /// ```ignore,no_run
3587    /// # use google_cloud_api::model::BatchingSettingsProto;
3588    /// let x = BatchingSettingsProto::new().set_request_byte_threshold(42);
3589    /// ```
3590    pub fn set_request_byte_threshold<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
3591        self.request_byte_threshold = v.into();
3592        self
3593    }
3594
3595    /// Sets the value of [delay_threshold][crate::model::BatchingSettingsProto::delay_threshold].
3596    ///
3597    /// # Example
3598    /// ```ignore,no_run
3599    /// # use google_cloud_api::model::BatchingSettingsProto;
3600    /// use wkt::Duration;
3601    /// let x = BatchingSettingsProto::new().set_delay_threshold(Duration::default()/* use setters */);
3602    /// ```
3603    pub fn set_delay_threshold<T>(mut self, v: T) -> Self
3604    where
3605        T: std::convert::Into<wkt::Duration>,
3606    {
3607        self.delay_threshold = std::option::Option::Some(v.into());
3608        self
3609    }
3610
3611    /// Sets or clears the value of [delay_threshold][crate::model::BatchingSettingsProto::delay_threshold].
3612    ///
3613    /// # Example
3614    /// ```ignore,no_run
3615    /// # use google_cloud_api::model::BatchingSettingsProto;
3616    /// use wkt::Duration;
3617    /// let x = BatchingSettingsProto::new().set_or_clear_delay_threshold(Some(Duration::default()/* use setters */));
3618    /// let x = BatchingSettingsProto::new().set_or_clear_delay_threshold(None::<Duration>);
3619    /// ```
3620    pub fn set_or_clear_delay_threshold<T>(mut self, v: std::option::Option<T>) -> Self
3621    where
3622        T: std::convert::Into<wkt::Duration>,
3623    {
3624        self.delay_threshold = v.map(|x| x.into());
3625        self
3626    }
3627
3628    /// Sets the value of [element_count_limit][crate::model::BatchingSettingsProto::element_count_limit].
3629    ///
3630    /// # Example
3631    /// ```ignore,no_run
3632    /// # use google_cloud_api::model::BatchingSettingsProto;
3633    /// let x = BatchingSettingsProto::new().set_element_count_limit(42);
3634    /// ```
3635    pub fn set_element_count_limit<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3636        self.element_count_limit = v.into();
3637        self
3638    }
3639
3640    /// Sets the value of [request_byte_limit][crate::model::BatchingSettingsProto::request_byte_limit].
3641    ///
3642    /// # Example
3643    /// ```ignore,no_run
3644    /// # use google_cloud_api::model::BatchingSettingsProto;
3645    /// let x = BatchingSettingsProto::new().set_request_byte_limit(42);
3646    /// ```
3647    pub fn set_request_byte_limit<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3648        self.request_byte_limit = v.into();
3649        self
3650    }
3651
3652    /// Sets the value of [flow_control_element_limit][crate::model::BatchingSettingsProto::flow_control_element_limit].
3653    ///
3654    /// # Example
3655    /// ```ignore,no_run
3656    /// # use google_cloud_api::model::BatchingSettingsProto;
3657    /// let x = BatchingSettingsProto::new().set_flow_control_element_limit(42);
3658    /// ```
3659    pub fn set_flow_control_element_limit<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3660        self.flow_control_element_limit = v.into();
3661        self
3662    }
3663
3664    /// Sets the value of [flow_control_byte_limit][crate::model::BatchingSettingsProto::flow_control_byte_limit].
3665    ///
3666    /// # Example
3667    /// ```ignore,no_run
3668    /// # use google_cloud_api::model::BatchingSettingsProto;
3669    /// let x = BatchingSettingsProto::new().set_flow_control_byte_limit(42);
3670    /// ```
3671    pub fn set_flow_control_byte_limit<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3672        self.flow_control_byte_limit = v.into();
3673        self
3674    }
3675
3676    /// Sets the value of [flow_control_limit_exceeded_behavior][crate::model::BatchingSettingsProto::flow_control_limit_exceeded_behavior].
3677    ///
3678    /// # Example
3679    /// ```ignore,no_run
3680    /// # use google_cloud_api::model::BatchingSettingsProto;
3681    /// use google_cloud_api::model::FlowControlLimitExceededBehaviorProto;
3682    /// let x0 = BatchingSettingsProto::new().set_flow_control_limit_exceeded_behavior(FlowControlLimitExceededBehaviorProto::ThrowException);
3683    /// let x1 = BatchingSettingsProto::new().set_flow_control_limit_exceeded_behavior(FlowControlLimitExceededBehaviorProto::Block);
3684    /// let x2 = BatchingSettingsProto::new().set_flow_control_limit_exceeded_behavior(FlowControlLimitExceededBehaviorProto::Ignore);
3685    /// ```
3686    pub fn set_flow_control_limit_exceeded_behavior<
3687        T: std::convert::Into<crate::model::FlowControlLimitExceededBehaviorProto>,
3688    >(
3689        mut self,
3690        v: T,
3691    ) -> Self {
3692        self.flow_control_limit_exceeded_behavior = v.into();
3693        self
3694    }
3695}
3696
3697impl wkt::message::Message for BatchingSettingsProto {
3698    fn typename() -> &'static str {
3699        "type.googleapis.com/google.api.BatchingSettingsProto"
3700    }
3701}
3702
3703/// `BatchingDescriptorProto` specifies the fields of the request message to be
3704/// used for batching, and, optionally, the fields of the response message to be
3705/// used for demultiplexing.
3706#[derive(Clone, Default, PartialEq)]
3707#[non_exhaustive]
3708pub struct BatchingDescriptorProto {
3709    /// The repeated field in the request message to be aggregated by batching.
3710    pub batched_field: std::string::String,
3711
3712    /// A list of the fields in the request message. Two requests will be batched
3713    /// together only if the values of every field specified in
3714    /// `request_discriminator_fields` is equal between the two requests.
3715    pub discriminator_fields: std::vec::Vec<std::string::String>,
3716
3717    /// Optional. When present, indicates the field in the response message to be
3718    /// used to demultiplex the response into multiple response messages, in
3719    /// correspondence with the multiple request messages originally batched
3720    /// together.
3721    pub subresponse_field: std::string::String,
3722
3723    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3724}
3725
3726impl BatchingDescriptorProto {
3727    /// Creates a new default instance.
3728    pub fn new() -> Self {
3729        std::default::Default::default()
3730    }
3731
3732    /// Sets the value of [batched_field][crate::model::BatchingDescriptorProto::batched_field].
3733    ///
3734    /// # Example
3735    /// ```ignore,no_run
3736    /// # use google_cloud_api::model::BatchingDescriptorProto;
3737    /// let x = BatchingDescriptorProto::new().set_batched_field("example");
3738    /// ```
3739    pub fn set_batched_field<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3740        self.batched_field = v.into();
3741        self
3742    }
3743
3744    /// Sets the value of [discriminator_fields][crate::model::BatchingDescriptorProto::discriminator_fields].
3745    ///
3746    /// # Example
3747    /// ```ignore,no_run
3748    /// # use google_cloud_api::model::BatchingDescriptorProto;
3749    /// let x = BatchingDescriptorProto::new().set_discriminator_fields(["a", "b", "c"]);
3750    /// ```
3751    pub fn set_discriminator_fields<T, V>(mut self, v: T) -> Self
3752    where
3753        T: std::iter::IntoIterator<Item = V>,
3754        V: std::convert::Into<std::string::String>,
3755    {
3756        use std::iter::Iterator;
3757        self.discriminator_fields = v.into_iter().map(|i| i.into()).collect();
3758        self
3759    }
3760
3761    /// Sets the value of [subresponse_field][crate::model::BatchingDescriptorProto::subresponse_field].
3762    ///
3763    /// # Example
3764    /// ```ignore,no_run
3765    /// # use google_cloud_api::model::BatchingDescriptorProto;
3766    /// let x = BatchingDescriptorProto::new().set_subresponse_field("example");
3767    /// ```
3768    pub fn set_subresponse_field<T: std::convert::Into<std::string::String>>(
3769        mut self,
3770        v: T,
3771    ) -> Self {
3772        self.subresponse_field = v.into();
3773        self
3774    }
3775}
3776
3777impl wkt::message::Message for BatchingDescriptorProto {
3778    fn typename() -> &'static str {
3779        "type.googleapis.com/google.api.BatchingDescriptorProto"
3780    }
3781}
3782
3783/// Output generated from semantically comparing two versions of a service
3784/// configuration.
3785///
3786/// Includes detailed information about a field that have changed with
3787/// applicable advice about potential consequences for the change, such as
3788/// backwards-incompatibility.
3789#[derive(Clone, Default, PartialEq)]
3790#[non_exhaustive]
3791pub struct ConfigChange {
3792    /// Object hierarchy path to the change, with levels separated by a '.'
3793    /// character. For repeated fields, an applicable unique identifier field is
3794    /// used for the index (usually selector, name, or id). For maps, the term
3795    /// 'key' is used. If the field has no unique identifier, the numeric index
3796    /// is used.
3797    /// Examples:
3798    ///
3799    /// - visibility.rules[selector=="google.LibraryService.ListBooks"].restriction
3800    /// - quota.metric_rules[selector=="google"].metric_costs[key=="reads"].value
3801    /// - logging.producer_destinations[0]
3802    pub element: std::string::String,
3803
3804    /// Value of the changed object in the old Service configuration,
3805    /// in JSON format. This field will not be populated if ChangeType == ADDED.
3806    pub old_value: std::string::String,
3807
3808    /// Value of the changed object in the new Service configuration,
3809    /// in JSON format. This field will not be populated if ChangeType == REMOVED.
3810    pub new_value: std::string::String,
3811
3812    /// The type for this change, either ADDED, REMOVED, or MODIFIED.
3813    pub change_type: crate::model::ChangeType,
3814
3815    /// Collection of advice provided for this change, useful for determining the
3816    /// possible impact of this change.
3817    pub advices: std::vec::Vec<crate::model::Advice>,
3818
3819    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3820}
3821
3822impl ConfigChange {
3823    /// Creates a new default instance.
3824    pub fn new() -> Self {
3825        std::default::Default::default()
3826    }
3827
3828    /// Sets the value of [element][crate::model::ConfigChange::element].
3829    ///
3830    /// # Example
3831    /// ```ignore,no_run
3832    /// # use google_cloud_api::model::ConfigChange;
3833    /// let x = ConfigChange::new().set_element("example");
3834    /// ```
3835    pub fn set_element<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3836        self.element = v.into();
3837        self
3838    }
3839
3840    /// Sets the value of [old_value][crate::model::ConfigChange::old_value].
3841    ///
3842    /// # Example
3843    /// ```ignore,no_run
3844    /// # use google_cloud_api::model::ConfigChange;
3845    /// let x = ConfigChange::new().set_old_value("example");
3846    /// ```
3847    pub fn set_old_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3848        self.old_value = v.into();
3849        self
3850    }
3851
3852    /// Sets the value of [new_value][crate::model::ConfigChange::new_value].
3853    ///
3854    /// # Example
3855    /// ```ignore,no_run
3856    /// # use google_cloud_api::model::ConfigChange;
3857    /// let x = ConfigChange::new().set_new_value("example");
3858    /// ```
3859    pub fn set_new_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3860        self.new_value = v.into();
3861        self
3862    }
3863
3864    /// Sets the value of [change_type][crate::model::ConfigChange::change_type].
3865    ///
3866    /// # Example
3867    /// ```ignore,no_run
3868    /// # use google_cloud_api::model::ConfigChange;
3869    /// use google_cloud_api::model::ChangeType;
3870    /// let x0 = ConfigChange::new().set_change_type(ChangeType::Added);
3871    /// let x1 = ConfigChange::new().set_change_type(ChangeType::Removed);
3872    /// let x2 = ConfigChange::new().set_change_type(ChangeType::Modified);
3873    /// ```
3874    pub fn set_change_type<T: std::convert::Into<crate::model::ChangeType>>(
3875        mut self,
3876        v: T,
3877    ) -> Self {
3878        self.change_type = v.into();
3879        self
3880    }
3881
3882    /// Sets the value of [advices][crate::model::ConfigChange::advices].
3883    ///
3884    /// # Example
3885    /// ```ignore,no_run
3886    /// # use google_cloud_api::model::ConfigChange;
3887    /// use google_cloud_api::model::Advice;
3888    /// let x = ConfigChange::new()
3889    ///     .set_advices([
3890    ///         Advice::default()/* use setters */,
3891    ///         Advice::default()/* use (different) setters */,
3892    ///     ]);
3893    /// ```
3894    pub fn set_advices<T, V>(mut self, v: T) -> Self
3895    where
3896        T: std::iter::IntoIterator<Item = V>,
3897        V: std::convert::Into<crate::model::Advice>,
3898    {
3899        use std::iter::Iterator;
3900        self.advices = v.into_iter().map(|i| i.into()).collect();
3901        self
3902    }
3903}
3904
3905impl wkt::message::Message for ConfigChange {
3906    fn typename() -> &'static str {
3907        "type.googleapis.com/google.api.ConfigChange"
3908    }
3909}
3910
3911/// Generated advice about this change, used for providing more
3912/// information about how a change will affect the existing service.
3913#[derive(Clone, Default, PartialEq)]
3914#[non_exhaustive]
3915pub struct Advice {
3916    /// Useful description for why this advice was applied and what actions should
3917    /// be taken to mitigate any implied risks.
3918    pub description: std::string::String,
3919
3920    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3921}
3922
3923impl Advice {
3924    /// Creates a new default instance.
3925    pub fn new() -> Self {
3926        std::default::Default::default()
3927    }
3928
3929    /// Sets the value of [description][crate::model::Advice::description].
3930    ///
3931    /// # Example
3932    /// ```ignore,no_run
3933    /// # use google_cloud_api::model::Advice;
3934    /// let x = Advice::new().set_description("example");
3935    /// ```
3936    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3937        self.description = v.into();
3938        self
3939    }
3940}
3941
3942impl wkt::message::Message for Advice {
3943    fn typename() -> &'static str {
3944        "type.googleapis.com/google.api.Advice"
3945    }
3946}
3947
3948/// A descriptor for defining project properties for a service. One service may
3949/// have many consumer projects, and the service may want to behave differently
3950/// depending on some properties on the project. For example, a project may be
3951/// associated with a school, or a business, or a government agency, a business
3952/// type property on the project may affect how a service responds to the client.
3953/// This descriptor defines which properties are allowed to be set on a project.
3954///
3955/// Example:
3956///
3957/// ```norust
3958/// project_properties:
3959///   properties:
3960///   - name: NO_WATERMARK
3961///     type: BOOL
3962///     description: Allows usage of the API without watermarks.
3963///   - name: EXTENDED_TILE_CACHE_PERIOD
3964///     type: INT64
3965/// ```
3966#[derive(Clone, Default, PartialEq)]
3967#[non_exhaustive]
3968pub struct ProjectProperties {
3969    /// List of per consumer project-specific properties.
3970    pub properties: std::vec::Vec<crate::model::Property>,
3971
3972    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3973}
3974
3975impl ProjectProperties {
3976    /// Creates a new default instance.
3977    pub fn new() -> Self {
3978        std::default::Default::default()
3979    }
3980
3981    /// Sets the value of [properties][crate::model::ProjectProperties::properties].
3982    ///
3983    /// # Example
3984    /// ```ignore,no_run
3985    /// # use google_cloud_api::model::ProjectProperties;
3986    /// use google_cloud_api::model::Property;
3987    /// let x = ProjectProperties::new()
3988    ///     .set_properties([
3989    ///         Property::default()/* use setters */,
3990    ///         Property::default()/* use (different) setters */,
3991    ///     ]);
3992    /// ```
3993    pub fn set_properties<T, V>(mut self, v: T) -> Self
3994    where
3995        T: std::iter::IntoIterator<Item = V>,
3996        V: std::convert::Into<crate::model::Property>,
3997    {
3998        use std::iter::Iterator;
3999        self.properties = v.into_iter().map(|i| i.into()).collect();
4000        self
4001    }
4002}
4003
4004impl wkt::message::Message for ProjectProperties {
4005    fn typename() -> &'static str {
4006        "type.googleapis.com/google.api.ProjectProperties"
4007    }
4008}
4009
4010/// Defines project properties.
4011///
4012/// API services can define properties that can be assigned to consumer projects
4013/// so that backends can perform response customization without having to make
4014/// additional calls or maintain additional storage. For example, Maps API
4015/// defines properties that controls map tile cache period, or whether to embed a
4016/// watermark in a result.
4017///
4018/// These values can be set via API producer console. Only API providers can
4019/// define and set these properties.
4020#[derive(Clone, Default, PartialEq)]
4021#[non_exhaustive]
4022pub struct Property {
4023    /// The name of the property (a.k.a key).
4024    pub name: std::string::String,
4025
4026    /// The type of this property.
4027    pub r#type: crate::model::property::PropertyType,
4028
4029    /// The description of the property
4030    pub description: std::string::String,
4031
4032    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4033}
4034
4035impl Property {
4036    /// Creates a new default instance.
4037    pub fn new() -> Self {
4038        std::default::Default::default()
4039    }
4040
4041    /// Sets the value of [name][crate::model::Property::name].
4042    ///
4043    /// # Example
4044    /// ```ignore,no_run
4045    /// # use google_cloud_api::model::Property;
4046    /// let x = Property::new().set_name("example");
4047    /// ```
4048    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4049        self.name = v.into();
4050        self
4051    }
4052
4053    /// Sets the value of [r#type][crate::model::Property::type].
4054    ///
4055    /// # Example
4056    /// ```ignore,no_run
4057    /// # use google_cloud_api::model::Property;
4058    /// use google_cloud_api::model::property::PropertyType;
4059    /// let x0 = Property::new().set_type(PropertyType::Int64);
4060    /// let x1 = Property::new().set_type(PropertyType::Bool);
4061    /// let x2 = Property::new().set_type(PropertyType::String);
4062    /// ```
4063    pub fn set_type<T: std::convert::Into<crate::model::property::PropertyType>>(
4064        mut self,
4065        v: T,
4066    ) -> Self {
4067        self.r#type = v.into();
4068        self
4069    }
4070
4071    /// Sets the value of [description][crate::model::Property::description].
4072    ///
4073    /// # Example
4074    /// ```ignore,no_run
4075    /// # use google_cloud_api::model::Property;
4076    /// let x = Property::new().set_description("example");
4077    /// ```
4078    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4079        self.description = v.into();
4080        self
4081    }
4082}
4083
4084impl wkt::message::Message for Property {
4085    fn typename() -> &'static str {
4086        "type.googleapis.com/google.api.Property"
4087    }
4088}
4089
4090/// Defines additional types related to [Property].
4091pub mod property {
4092    #[allow(unused_imports)]
4093    use super::*;
4094
4095    /// Supported data type of the property values
4096    ///
4097    /// # Working with unknown values
4098    ///
4099    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4100    /// additional enum variants at any time. Adding new variants is not considered
4101    /// a breaking change. Applications should write their code in anticipation of:
4102    ///
4103    /// - New values appearing in future releases of the client library, **and**
4104    /// - New values received dynamically, without application changes.
4105    ///
4106    /// Please consult the [Working with enums] section in the user guide for some
4107    /// guidelines.
4108    ///
4109    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
4110    #[derive(Clone, Debug, PartialEq)]
4111    #[non_exhaustive]
4112    pub enum PropertyType {
4113        /// The type is unspecified, and will result in an error.
4114        Unspecified,
4115        /// The type is `int64`.
4116        Int64,
4117        /// The type is `bool`.
4118        Bool,
4119        /// The type is `string`.
4120        String,
4121        /// The type is 'double'.
4122        Double,
4123        /// If set, the enum was initialized with an unknown value.
4124        ///
4125        /// Applications can examine the value using [PropertyType::value] or
4126        /// [PropertyType::name].
4127        UnknownValue(property_type::UnknownValue),
4128    }
4129
4130    #[doc(hidden)]
4131    pub mod property_type {
4132        #[allow(unused_imports)]
4133        use super::*;
4134        #[derive(Clone, Debug, PartialEq)]
4135        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4136    }
4137
4138    impl PropertyType {
4139        /// Gets the enum value.
4140        ///
4141        /// Returns `None` if the enum contains an unknown value deserialized from
4142        /// the string representation of enums.
4143        pub fn value(&self) -> std::option::Option<i32> {
4144            match self {
4145                Self::Unspecified => std::option::Option::Some(0),
4146                Self::Int64 => std::option::Option::Some(1),
4147                Self::Bool => std::option::Option::Some(2),
4148                Self::String => std::option::Option::Some(3),
4149                Self::Double => std::option::Option::Some(4),
4150                Self::UnknownValue(u) => u.0.value(),
4151            }
4152        }
4153
4154        /// Gets the enum value as a string.
4155        ///
4156        /// Returns `None` if the enum contains an unknown value deserialized from
4157        /// the integer representation of enums.
4158        pub fn name(&self) -> std::option::Option<&str> {
4159            match self {
4160                Self::Unspecified => std::option::Option::Some("UNSPECIFIED"),
4161                Self::Int64 => std::option::Option::Some("INT64"),
4162                Self::Bool => std::option::Option::Some("BOOL"),
4163                Self::String => std::option::Option::Some("STRING"),
4164                Self::Double => std::option::Option::Some("DOUBLE"),
4165                Self::UnknownValue(u) => u.0.name(),
4166            }
4167        }
4168    }
4169
4170    impl std::default::Default for PropertyType {
4171        fn default() -> Self {
4172            use std::convert::From;
4173            Self::from(0)
4174        }
4175    }
4176
4177    impl std::fmt::Display for PropertyType {
4178        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4179            wkt::internal::display_enum(f, self.name(), self.value())
4180        }
4181    }
4182
4183    impl std::convert::From<i32> for PropertyType {
4184        fn from(value: i32) -> Self {
4185            match value {
4186                0 => Self::Unspecified,
4187                1 => Self::Int64,
4188                2 => Self::Bool,
4189                3 => Self::String,
4190                4 => Self::Double,
4191                _ => Self::UnknownValue(property_type::UnknownValue(
4192                    wkt::internal::UnknownEnumValue::Integer(value),
4193                )),
4194            }
4195        }
4196    }
4197
4198    impl std::convert::From<&str> for PropertyType {
4199        fn from(value: &str) -> Self {
4200            use std::string::ToString;
4201            match value {
4202                "UNSPECIFIED" => Self::Unspecified,
4203                "INT64" => Self::Int64,
4204                "BOOL" => Self::Bool,
4205                "STRING" => Self::String,
4206                "DOUBLE" => Self::Double,
4207                _ => Self::UnknownValue(property_type::UnknownValue(
4208                    wkt::internal::UnknownEnumValue::String(value.to_string()),
4209                )),
4210            }
4211        }
4212    }
4213
4214    impl serde::ser::Serialize for PropertyType {
4215        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4216        where
4217            S: serde::Serializer,
4218        {
4219            match self {
4220                Self::Unspecified => serializer.serialize_i32(0),
4221                Self::Int64 => serializer.serialize_i32(1),
4222                Self::Bool => serializer.serialize_i32(2),
4223                Self::String => serializer.serialize_i32(3),
4224                Self::Double => serializer.serialize_i32(4),
4225                Self::UnknownValue(u) => u.0.serialize(serializer),
4226            }
4227        }
4228    }
4229
4230    impl<'de> serde::de::Deserialize<'de> for PropertyType {
4231        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4232        where
4233            D: serde::Deserializer<'de>,
4234        {
4235            deserializer.deserialize_any(wkt::internal::EnumVisitor::<PropertyType>::new(
4236                ".google.api.Property.PropertyType",
4237            ))
4238        }
4239    }
4240}
4241
4242/// `Context` defines which contexts an API requests.
4243///
4244/// Example:
4245///
4246/// ```norust
4247/// context:
4248///   rules:
4249///   - selector: "*"
4250///     requested:
4251///     - google.rpc.context.ProjectContext
4252///     - google.rpc.context.OriginContext
4253/// ```
4254///
4255/// The above specifies that all methods in the API request
4256/// `google.rpc.context.ProjectContext` and
4257/// `google.rpc.context.OriginContext`.
4258///
4259/// Available context types are defined in package
4260/// `google.rpc.context`.
4261///
4262/// This also provides mechanism to allowlist any protobuf message extension that
4263/// can be sent in grpc metadata using “x-goog-ext-<extension_id>-bin” and
4264/// “x-goog-ext-<extension_id>-jspb” format. For example, list any service
4265/// specific protobuf types that can appear in grpc metadata as follows in your
4266/// yaml file:
4267///
4268/// Example:
4269///
4270/// ```norust
4271/// context:
4272///   rules:
4273///    - selector: "google.example.library.v1.LibraryService.CreateBook"
4274///      allowed_request_extensions:
4275///      - google.foo.v1.NewExtension
4276///      allowed_response_extensions:
4277///      - google.foo.v1.NewExtension
4278/// ```
4279///
4280/// You can also specify extension ID instead of fully qualified extension name
4281/// here.
4282#[derive(Clone, Default, PartialEq)]
4283#[non_exhaustive]
4284pub struct Context {
4285    /// A list of RPC context rules that apply to individual API methods.
4286    ///
4287    /// **NOTE:** All service configuration rules follow "last one wins" order.
4288    pub rules: std::vec::Vec<crate::model::ContextRule>,
4289
4290    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4291}
4292
4293impl Context {
4294    /// Creates a new default instance.
4295    pub fn new() -> Self {
4296        std::default::Default::default()
4297    }
4298
4299    /// Sets the value of [rules][crate::model::Context::rules].
4300    ///
4301    /// # Example
4302    /// ```ignore,no_run
4303    /// # use google_cloud_api::model::Context;
4304    /// use google_cloud_api::model::ContextRule;
4305    /// let x = Context::new()
4306    ///     .set_rules([
4307    ///         ContextRule::default()/* use setters */,
4308    ///         ContextRule::default()/* use (different) setters */,
4309    ///     ]);
4310    /// ```
4311    pub fn set_rules<T, V>(mut self, v: T) -> Self
4312    where
4313        T: std::iter::IntoIterator<Item = V>,
4314        V: std::convert::Into<crate::model::ContextRule>,
4315    {
4316        use std::iter::Iterator;
4317        self.rules = v.into_iter().map(|i| i.into()).collect();
4318        self
4319    }
4320}
4321
4322impl wkt::message::Message for Context {
4323    fn typename() -> &'static str {
4324        "type.googleapis.com/google.api.Context"
4325    }
4326}
4327
4328/// A context rule provides information about the context for an individual API
4329/// element.
4330#[derive(Clone, Default, PartialEq)]
4331#[non_exhaustive]
4332pub struct ContextRule {
4333    /// Selects the methods to which this rule applies.
4334    ///
4335    /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
4336    /// details.
4337    ///
4338    /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
4339    pub selector: std::string::String,
4340
4341    /// A list of full type names of requested contexts, only the requested context
4342    /// will be made available to the backend.
4343    pub requested: std::vec::Vec<std::string::String>,
4344
4345    /// A list of full type names of provided contexts. It is used to support
4346    /// propagating HTTP headers and ETags from the response extension.
4347    pub provided: std::vec::Vec<std::string::String>,
4348
4349    /// A list of full type names or extension IDs of extensions allowed in grpc
4350    /// side channel from client to backend.
4351    pub allowed_request_extensions: std::vec::Vec<std::string::String>,
4352
4353    /// A list of full type names or extension IDs of extensions allowed in grpc
4354    /// side channel from backend to client.
4355    pub allowed_response_extensions: std::vec::Vec<std::string::String>,
4356
4357    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4358}
4359
4360impl ContextRule {
4361    /// Creates a new default instance.
4362    pub fn new() -> Self {
4363        std::default::Default::default()
4364    }
4365
4366    /// Sets the value of [selector][crate::model::ContextRule::selector].
4367    ///
4368    /// # Example
4369    /// ```ignore,no_run
4370    /// # use google_cloud_api::model::ContextRule;
4371    /// let x = ContextRule::new().set_selector("example");
4372    /// ```
4373    pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4374        self.selector = v.into();
4375        self
4376    }
4377
4378    /// Sets the value of [requested][crate::model::ContextRule::requested].
4379    ///
4380    /// # Example
4381    /// ```ignore,no_run
4382    /// # use google_cloud_api::model::ContextRule;
4383    /// let x = ContextRule::new().set_requested(["a", "b", "c"]);
4384    /// ```
4385    pub fn set_requested<T, V>(mut self, v: T) -> Self
4386    where
4387        T: std::iter::IntoIterator<Item = V>,
4388        V: std::convert::Into<std::string::String>,
4389    {
4390        use std::iter::Iterator;
4391        self.requested = v.into_iter().map(|i| i.into()).collect();
4392        self
4393    }
4394
4395    /// Sets the value of [provided][crate::model::ContextRule::provided].
4396    ///
4397    /// # Example
4398    /// ```ignore,no_run
4399    /// # use google_cloud_api::model::ContextRule;
4400    /// let x = ContextRule::new().set_provided(["a", "b", "c"]);
4401    /// ```
4402    pub fn set_provided<T, V>(mut self, v: T) -> Self
4403    where
4404        T: std::iter::IntoIterator<Item = V>,
4405        V: std::convert::Into<std::string::String>,
4406    {
4407        use std::iter::Iterator;
4408        self.provided = v.into_iter().map(|i| i.into()).collect();
4409        self
4410    }
4411
4412    /// Sets the value of [allowed_request_extensions][crate::model::ContextRule::allowed_request_extensions].
4413    ///
4414    /// # Example
4415    /// ```ignore,no_run
4416    /// # use google_cloud_api::model::ContextRule;
4417    /// let x = ContextRule::new().set_allowed_request_extensions(["a", "b", "c"]);
4418    /// ```
4419    pub fn set_allowed_request_extensions<T, V>(mut self, v: T) -> Self
4420    where
4421        T: std::iter::IntoIterator<Item = V>,
4422        V: std::convert::Into<std::string::String>,
4423    {
4424        use std::iter::Iterator;
4425        self.allowed_request_extensions = v.into_iter().map(|i| i.into()).collect();
4426        self
4427    }
4428
4429    /// Sets the value of [allowed_response_extensions][crate::model::ContextRule::allowed_response_extensions].
4430    ///
4431    /// # Example
4432    /// ```ignore,no_run
4433    /// # use google_cloud_api::model::ContextRule;
4434    /// let x = ContextRule::new().set_allowed_response_extensions(["a", "b", "c"]);
4435    /// ```
4436    pub fn set_allowed_response_extensions<T, V>(mut self, v: T) -> Self
4437    where
4438        T: std::iter::IntoIterator<Item = V>,
4439        V: std::convert::Into<std::string::String>,
4440    {
4441        use std::iter::Iterator;
4442        self.allowed_response_extensions = v.into_iter().map(|i| i.into()).collect();
4443        self
4444    }
4445}
4446
4447impl wkt::message::Message for ContextRule {
4448    fn typename() -> &'static str {
4449        "type.googleapis.com/google.api.ContextRule"
4450    }
4451}
4452
4453/// Selects and configures the service controller used by the service.
4454///
4455/// Example:
4456///
4457/// ```norust
4458/// control:
4459///   environment: servicecontrol.googleapis.com
4460/// ```
4461#[derive(Clone, Default, PartialEq)]
4462#[non_exhaustive]
4463pub struct Control {
4464    /// The service controller environment to use. If empty, no control plane
4465    /// features (like quota and billing) will be enabled. The recommended value
4466    /// for most services is servicecontrol.googleapis.com.
4467    pub environment: std::string::String,
4468
4469    /// Defines policies applying to the API methods of the service.
4470    pub method_policies: std::vec::Vec<crate::model::MethodPolicy>,
4471
4472    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4473}
4474
4475impl Control {
4476    /// Creates a new default instance.
4477    pub fn new() -> Self {
4478        std::default::Default::default()
4479    }
4480
4481    /// Sets the value of [environment][crate::model::Control::environment].
4482    ///
4483    /// # Example
4484    /// ```ignore,no_run
4485    /// # use google_cloud_api::model::Control;
4486    /// let x = Control::new().set_environment("example");
4487    /// ```
4488    pub fn set_environment<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4489        self.environment = v.into();
4490        self
4491    }
4492
4493    /// Sets the value of [method_policies][crate::model::Control::method_policies].
4494    ///
4495    /// # Example
4496    /// ```ignore,no_run
4497    /// # use google_cloud_api::model::Control;
4498    /// use google_cloud_api::model::MethodPolicy;
4499    /// let x = Control::new()
4500    ///     .set_method_policies([
4501    ///         MethodPolicy::default()/* use setters */,
4502    ///         MethodPolicy::default()/* use (different) setters */,
4503    ///     ]);
4504    /// ```
4505    pub fn set_method_policies<T, V>(mut self, v: T) -> Self
4506    where
4507        T: std::iter::IntoIterator<Item = V>,
4508        V: std::convert::Into<crate::model::MethodPolicy>,
4509    {
4510        use std::iter::Iterator;
4511        self.method_policies = v.into_iter().map(|i| i.into()).collect();
4512        self
4513    }
4514}
4515
4516impl wkt::message::Message for Control {
4517    fn typename() -> &'static str {
4518        "type.googleapis.com/google.api.Control"
4519    }
4520}
4521
4522/// `Distribution` contains summary statistics for a population of values. It
4523/// optionally contains a histogram representing the distribution of those values
4524/// across a set of buckets.
4525///
4526/// The summary statistics are the count, mean, sum of the squared deviation from
4527/// the mean, the minimum, and the maximum of the set of population of values.
4528/// The histogram is based on a sequence of buckets and gives a count of values
4529/// that fall into each bucket. The boundaries of the buckets are given either
4530/// explicitly or by formulas for buckets of fixed or exponentially increasing
4531/// widths.
4532///
4533/// Although it is not forbidden, it is generally a bad idea to include
4534/// non-finite values (infinities or NaNs) in the population of values, as this
4535/// will render the `mean` and `sum_of_squared_deviation` fields meaningless.
4536#[derive(Clone, Default, PartialEq)]
4537#[non_exhaustive]
4538pub struct Distribution {
4539    /// The number of values in the population. Must be non-negative. This value
4540    /// must equal the sum of the values in `bucket_counts` if a histogram is
4541    /// provided.
4542    pub count: i64,
4543
4544    /// The arithmetic mean of the values in the population. If `count` is zero
4545    /// then this field must be zero.
4546    pub mean: f64,
4547
4548    /// The sum of squared deviations from the mean of the values in the
4549    /// population. For values x_i this is:
4550    ///
4551    /// ```norust
4552    /// Sum[i=1..n]((x_i - mean)^2)
4553    /// ```
4554    ///
4555    /// Knuth, "The Art of Computer Programming", Vol. 2, page 232, 3rd edition
4556    /// describes Welford's method for accumulating this sum in one pass.
4557    ///
4558    /// If `count` is zero then this field must be zero.
4559    pub sum_of_squared_deviation: f64,
4560
4561    /// If specified, contains the range of the population values. The field
4562    /// must not be present if the `count` is zero.
4563    pub range: std::option::Option<crate::model::distribution::Range>,
4564
4565    /// Defines the histogram bucket boundaries. If the distribution does not
4566    /// contain a histogram, then omit this field.
4567    pub bucket_options: std::option::Option<crate::model::distribution::BucketOptions>,
4568
4569    /// The number of values in each bucket of the histogram, as described in
4570    /// `bucket_options`. If the distribution does not have a histogram, then omit
4571    /// this field. If there is a histogram, then the sum of the values in
4572    /// `bucket_counts` must equal the value in the `count` field of the
4573    /// distribution.
4574    ///
4575    /// If present, `bucket_counts` should contain N values, where N is the number
4576    /// of buckets specified in `bucket_options`. If you supply fewer than N
4577    /// values, the remaining values are assumed to be 0.
4578    ///
4579    /// The order of the values in `bucket_counts` follows the bucket numbering
4580    /// schemes described for the three bucket types. The first value must be the
4581    /// count for the underflow bucket (number 0). The next N-2 values are the
4582    /// counts for the finite buckets (number 1 through N-2). The N'th value in
4583    /// `bucket_counts` is the count for the overflow bucket (number N-1).
4584    pub bucket_counts: std::vec::Vec<i64>,
4585
4586    /// Must be in increasing order of `value` field.
4587    pub exemplars: std::vec::Vec<crate::model::distribution::Exemplar>,
4588
4589    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4590}
4591
4592impl Distribution {
4593    /// Creates a new default instance.
4594    pub fn new() -> Self {
4595        std::default::Default::default()
4596    }
4597
4598    /// Sets the value of [count][crate::model::Distribution::count].
4599    ///
4600    /// # Example
4601    /// ```ignore,no_run
4602    /// # use google_cloud_api::model::Distribution;
4603    /// let x = Distribution::new().set_count(42);
4604    /// ```
4605    pub fn set_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
4606        self.count = v.into();
4607        self
4608    }
4609
4610    /// Sets the value of [mean][crate::model::Distribution::mean].
4611    ///
4612    /// # Example
4613    /// ```ignore,no_run
4614    /// # use google_cloud_api::model::Distribution;
4615    /// let x = Distribution::new().set_mean(42.0);
4616    /// ```
4617    pub fn set_mean<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
4618        self.mean = v.into();
4619        self
4620    }
4621
4622    /// Sets the value of [sum_of_squared_deviation][crate::model::Distribution::sum_of_squared_deviation].
4623    ///
4624    /// # Example
4625    /// ```ignore,no_run
4626    /// # use google_cloud_api::model::Distribution;
4627    /// let x = Distribution::new().set_sum_of_squared_deviation(42.0);
4628    /// ```
4629    pub fn set_sum_of_squared_deviation<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
4630        self.sum_of_squared_deviation = v.into();
4631        self
4632    }
4633
4634    /// Sets the value of [range][crate::model::Distribution::range].
4635    ///
4636    /// # Example
4637    /// ```ignore,no_run
4638    /// # use google_cloud_api::model::Distribution;
4639    /// use google_cloud_api::model::distribution::Range;
4640    /// let x = Distribution::new().set_range(Range::default()/* use setters */);
4641    /// ```
4642    pub fn set_range<T>(mut self, v: T) -> Self
4643    where
4644        T: std::convert::Into<crate::model::distribution::Range>,
4645    {
4646        self.range = std::option::Option::Some(v.into());
4647        self
4648    }
4649
4650    /// Sets or clears the value of [range][crate::model::Distribution::range].
4651    ///
4652    /// # Example
4653    /// ```ignore,no_run
4654    /// # use google_cloud_api::model::Distribution;
4655    /// use google_cloud_api::model::distribution::Range;
4656    /// let x = Distribution::new().set_or_clear_range(Some(Range::default()/* use setters */));
4657    /// let x = Distribution::new().set_or_clear_range(None::<Range>);
4658    /// ```
4659    pub fn set_or_clear_range<T>(mut self, v: std::option::Option<T>) -> Self
4660    where
4661        T: std::convert::Into<crate::model::distribution::Range>,
4662    {
4663        self.range = v.map(|x| x.into());
4664        self
4665    }
4666
4667    /// Sets the value of [bucket_options][crate::model::Distribution::bucket_options].
4668    ///
4669    /// # Example
4670    /// ```ignore,no_run
4671    /// # use google_cloud_api::model::Distribution;
4672    /// use google_cloud_api::model::distribution::BucketOptions;
4673    /// let x = Distribution::new().set_bucket_options(BucketOptions::default()/* use setters */);
4674    /// ```
4675    pub fn set_bucket_options<T>(mut self, v: T) -> Self
4676    where
4677        T: std::convert::Into<crate::model::distribution::BucketOptions>,
4678    {
4679        self.bucket_options = std::option::Option::Some(v.into());
4680        self
4681    }
4682
4683    /// Sets or clears the value of [bucket_options][crate::model::Distribution::bucket_options].
4684    ///
4685    /// # Example
4686    /// ```ignore,no_run
4687    /// # use google_cloud_api::model::Distribution;
4688    /// use google_cloud_api::model::distribution::BucketOptions;
4689    /// let x = Distribution::new().set_or_clear_bucket_options(Some(BucketOptions::default()/* use setters */));
4690    /// let x = Distribution::new().set_or_clear_bucket_options(None::<BucketOptions>);
4691    /// ```
4692    pub fn set_or_clear_bucket_options<T>(mut self, v: std::option::Option<T>) -> Self
4693    where
4694        T: std::convert::Into<crate::model::distribution::BucketOptions>,
4695    {
4696        self.bucket_options = v.map(|x| x.into());
4697        self
4698    }
4699
4700    /// Sets the value of [bucket_counts][crate::model::Distribution::bucket_counts].
4701    ///
4702    /// # Example
4703    /// ```ignore,no_run
4704    /// # use google_cloud_api::model::Distribution;
4705    /// let x = Distribution::new().set_bucket_counts([1, 2, 3]);
4706    /// ```
4707    pub fn set_bucket_counts<T, V>(mut self, v: T) -> Self
4708    where
4709        T: std::iter::IntoIterator<Item = V>,
4710        V: std::convert::Into<i64>,
4711    {
4712        use std::iter::Iterator;
4713        self.bucket_counts = v.into_iter().map(|i| i.into()).collect();
4714        self
4715    }
4716
4717    /// Sets the value of [exemplars][crate::model::Distribution::exemplars].
4718    ///
4719    /// # Example
4720    /// ```ignore,no_run
4721    /// # use google_cloud_api::model::Distribution;
4722    /// use google_cloud_api::model::distribution::Exemplar;
4723    /// let x = Distribution::new()
4724    ///     .set_exemplars([
4725    ///         Exemplar::default()/* use setters */,
4726    ///         Exemplar::default()/* use (different) setters */,
4727    ///     ]);
4728    /// ```
4729    pub fn set_exemplars<T, V>(mut self, v: T) -> Self
4730    where
4731        T: std::iter::IntoIterator<Item = V>,
4732        V: std::convert::Into<crate::model::distribution::Exemplar>,
4733    {
4734        use std::iter::Iterator;
4735        self.exemplars = v.into_iter().map(|i| i.into()).collect();
4736        self
4737    }
4738}
4739
4740impl wkt::message::Message for Distribution {
4741    fn typename() -> &'static str {
4742        "type.googleapis.com/google.api.Distribution"
4743    }
4744}
4745
4746/// Defines additional types related to [Distribution].
4747pub mod distribution {
4748    #[allow(unused_imports)]
4749    use super::*;
4750
4751    /// The range of the population values.
4752    #[derive(Clone, Default, PartialEq)]
4753    #[non_exhaustive]
4754    pub struct Range {
4755        /// The minimum of the population values.
4756        pub min: f64,
4757
4758        /// The maximum of the population values.
4759        pub max: f64,
4760
4761        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4762    }
4763
4764    impl Range {
4765        /// Creates a new default instance.
4766        pub fn new() -> Self {
4767            std::default::Default::default()
4768        }
4769
4770        /// Sets the value of [min][crate::model::distribution::Range::min].
4771        ///
4772        /// # Example
4773        /// ```ignore,no_run
4774        /// # use google_cloud_api::model::distribution::Range;
4775        /// let x = Range::new().set_min(42.0);
4776        /// ```
4777        pub fn set_min<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
4778            self.min = v.into();
4779            self
4780        }
4781
4782        /// Sets the value of [max][crate::model::distribution::Range::max].
4783        ///
4784        /// # Example
4785        /// ```ignore,no_run
4786        /// # use google_cloud_api::model::distribution::Range;
4787        /// let x = Range::new().set_max(42.0);
4788        /// ```
4789        pub fn set_max<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
4790            self.max = v.into();
4791            self
4792        }
4793    }
4794
4795    impl wkt::message::Message for Range {
4796        fn typename() -> &'static str {
4797            "type.googleapis.com/google.api.Distribution.Range"
4798        }
4799    }
4800
4801    /// `BucketOptions` describes the bucket boundaries used to create a histogram
4802    /// for the distribution. The buckets can be in a linear sequence, an
4803    /// exponential sequence, or each bucket can be specified explicitly.
4804    /// `BucketOptions` does not include the number of values in each bucket.
4805    ///
4806    /// A bucket has an inclusive lower bound and exclusive upper bound for the
4807    /// values that are counted for that bucket. The upper bound of a bucket must
4808    /// be strictly greater than the lower bound. The sequence of N buckets for a
4809    /// distribution consists of an underflow bucket (number 0), zero or more
4810    /// finite buckets (number 1 through N - 2) and an overflow bucket (number N -
4811    /// 1). The buckets are contiguous: the lower bound of bucket i (i > 0) is the
4812    /// same as the upper bound of bucket i - 1. The buckets span the whole range
4813    /// of finite values: lower bound of the underflow bucket is -infinity and the
4814    /// upper bound of the overflow bucket is +infinity. The finite buckets are
4815    /// so-called because both bounds are finite.
4816    #[derive(Clone, Default, PartialEq)]
4817    #[non_exhaustive]
4818    pub struct BucketOptions {
4819        /// Exactly one of these three fields must be set.
4820        pub options: std::option::Option<crate::model::distribution::bucket_options::Options>,
4821
4822        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4823    }
4824
4825    impl BucketOptions {
4826        /// Creates a new default instance.
4827        pub fn new() -> Self {
4828            std::default::Default::default()
4829        }
4830
4831        /// Sets the value of [options][crate::model::distribution::BucketOptions::options].
4832        ///
4833        /// Note that all the setters affecting `options` are mutually
4834        /// exclusive.
4835        ///
4836        /// # Example
4837        /// ```ignore,no_run
4838        /// # use google_cloud_api::model::distribution::BucketOptions;
4839        /// use google_cloud_api::model::distribution::bucket_options::Linear;
4840        /// let x = BucketOptions::new().set_options(Some(
4841        ///     google_cloud_api::model::distribution::bucket_options::Options::LinearBuckets(Linear::default().into())));
4842        /// ```
4843        pub fn set_options<
4844            T: std::convert::Into<
4845                    std::option::Option<crate::model::distribution::bucket_options::Options>,
4846                >,
4847        >(
4848            mut self,
4849            v: T,
4850        ) -> Self {
4851            self.options = v.into();
4852            self
4853        }
4854
4855        /// The value of [options][crate::model::distribution::BucketOptions::options]
4856        /// if it holds a `LinearBuckets`, `None` if the field is not set or
4857        /// holds a different branch.
4858        pub fn linear_buckets(
4859            &self,
4860        ) -> std::option::Option<&std::boxed::Box<crate::model::distribution::bucket_options::Linear>>
4861        {
4862            #[allow(unreachable_patterns)]
4863            self.options.as_ref().and_then(|v| match v {
4864                crate::model::distribution::bucket_options::Options::LinearBuckets(v) => {
4865                    std::option::Option::Some(v)
4866                }
4867                _ => std::option::Option::None,
4868            })
4869        }
4870
4871        /// Sets the value of [options][crate::model::distribution::BucketOptions::options]
4872        /// to hold a `LinearBuckets`.
4873        ///
4874        /// Note that all the setters affecting `options` are
4875        /// mutually exclusive.
4876        ///
4877        /// # Example
4878        /// ```ignore,no_run
4879        /// # use google_cloud_api::model::distribution::BucketOptions;
4880        /// use google_cloud_api::model::distribution::bucket_options::Linear;
4881        /// let x = BucketOptions::new().set_linear_buckets(Linear::default()/* use setters */);
4882        /// assert!(x.linear_buckets().is_some());
4883        /// assert!(x.exponential_buckets().is_none());
4884        /// assert!(x.explicit_buckets().is_none());
4885        /// ```
4886        pub fn set_linear_buckets<
4887            T: std::convert::Into<std::boxed::Box<crate::model::distribution::bucket_options::Linear>>,
4888        >(
4889            mut self,
4890            v: T,
4891        ) -> Self {
4892            self.options = std::option::Option::Some(
4893                crate::model::distribution::bucket_options::Options::LinearBuckets(v.into()),
4894            );
4895            self
4896        }
4897
4898        /// The value of [options][crate::model::distribution::BucketOptions::options]
4899        /// if it holds a `ExponentialBuckets`, `None` if the field is not set or
4900        /// holds a different branch.
4901        pub fn exponential_buckets(
4902            &self,
4903        ) -> std::option::Option<
4904            &std::boxed::Box<crate::model::distribution::bucket_options::Exponential>,
4905        > {
4906            #[allow(unreachable_patterns)]
4907            self.options.as_ref().and_then(|v| match v {
4908                crate::model::distribution::bucket_options::Options::ExponentialBuckets(v) => {
4909                    std::option::Option::Some(v)
4910                }
4911                _ => std::option::Option::None,
4912            })
4913        }
4914
4915        /// Sets the value of [options][crate::model::distribution::BucketOptions::options]
4916        /// to hold a `ExponentialBuckets`.
4917        ///
4918        /// Note that all the setters affecting `options` are
4919        /// mutually exclusive.
4920        ///
4921        /// # Example
4922        /// ```ignore,no_run
4923        /// # use google_cloud_api::model::distribution::BucketOptions;
4924        /// use google_cloud_api::model::distribution::bucket_options::Exponential;
4925        /// let x = BucketOptions::new().set_exponential_buckets(Exponential::default()/* use setters */);
4926        /// assert!(x.exponential_buckets().is_some());
4927        /// assert!(x.linear_buckets().is_none());
4928        /// assert!(x.explicit_buckets().is_none());
4929        /// ```
4930        pub fn set_exponential_buckets<
4931            T: std::convert::Into<
4932                    std::boxed::Box<crate::model::distribution::bucket_options::Exponential>,
4933                >,
4934        >(
4935            mut self,
4936            v: T,
4937        ) -> Self {
4938            self.options = std::option::Option::Some(
4939                crate::model::distribution::bucket_options::Options::ExponentialBuckets(v.into()),
4940            );
4941            self
4942        }
4943
4944        /// The value of [options][crate::model::distribution::BucketOptions::options]
4945        /// if it holds a `ExplicitBuckets`, `None` if the field is not set or
4946        /// holds a different branch.
4947        pub fn explicit_buckets(
4948            &self,
4949        ) -> std::option::Option<
4950            &std::boxed::Box<crate::model::distribution::bucket_options::Explicit>,
4951        > {
4952            #[allow(unreachable_patterns)]
4953            self.options.as_ref().and_then(|v| match v {
4954                crate::model::distribution::bucket_options::Options::ExplicitBuckets(v) => {
4955                    std::option::Option::Some(v)
4956                }
4957                _ => std::option::Option::None,
4958            })
4959        }
4960
4961        /// Sets the value of [options][crate::model::distribution::BucketOptions::options]
4962        /// to hold a `ExplicitBuckets`.
4963        ///
4964        /// Note that all the setters affecting `options` are
4965        /// mutually exclusive.
4966        ///
4967        /// # Example
4968        /// ```ignore,no_run
4969        /// # use google_cloud_api::model::distribution::BucketOptions;
4970        /// use google_cloud_api::model::distribution::bucket_options::Explicit;
4971        /// let x = BucketOptions::new().set_explicit_buckets(Explicit::default()/* use setters */);
4972        /// assert!(x.explicit_buckets().is_some());
4973        /// assert!(x.linear_buckets().is_none());
4974        /// assert!(x.exponential_buckets().is_none());
4975        /// ```
4976        pub fn set_explicit_buckets<
4977            T: std::convert::Into<
4978                    std::boxed::Box<crate::model::distribution::bucket_options::Explicit>,
4979                >,
4980        >(
4981            mut self,
4982            v: T,
4983        ) -> Self {
4984            self.options = std::option::Option::Some(
4985                crate::model::distribution::bucket_options::Options::ExplicitBuckets(v.into()),
4986            );
4987            self
4988        }
4989    }
4990
4991    impl wkt::message::Message for BucketOptions {
4992        fn typename() -> &'static str {
4993            "type.googleapis.com/google.api.Distribution.BucketOptions"
4994        }
4995    }
4996
4997    /// Defines additional types related to [BucketOptions].
4998    pub mod bucket_options {
4999        #[allow(unused_imports)]
5000        use super::*;
5001
5002        /// Specifies a linear sequence of buckets that all have the same width
5003        /// (except overflow and underflow). Each bucket represents a constant
5004        /// absolute uncertainty on the specific value in the bucket.
5005        ///
5006        /// There are `num_finite_buckets + 2` (= N) buckets. Bucket `i` has the
5007        /// following boundaries:
5008        ///
5009        /// Upper bound (0 <= i < N-1):     offset + (width * i).
5010        ///
5011        /// Lower bound (1 <= i < N):       offset + (width * (i - 1)).
5012        #[derive(Clone, Default, PartialEq)]
5013        #[non_exhaustive]
5014        pub struct Linear {
5015            /// Must be greater than 0.
5016            pub num_finite_buckets: i32,
5017
5018            /// Must be greater than 0.
5019            pub width: f64,
5020
5021            /// Lower bound of the first bucket.
5022            pub offset: f64,
5023
5024            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5025        }
5026
5027        impl Linear {
5028            /// Creates a new default instance.
5029            pub fn new() -> Self {
5030                std::default::Default::default()
5031            }
5032
5033            /// Sets the value of [num_finite_buckets][crate::model::distribution::bucket_options::Linear::num_finite_buckets].
5034            ///
5035            /// # Example
5036            /// ```ignore,no_run
5037            /// # use google_cloud_api::model::distribution::bucket_options::Linear;
5038            /// let x = Linear::new().set_num_finite_buckets(42);
5039            /// ```
5040            pub fn set_num_finite_buckets<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5041                self.num_finite_buckets = v.into();
5042                self
5043            }
5044
5045            /// Sets the value of [width][crate::model::distribution::bucket_options::Linear::width].
5046            ///
5047            /// # Example
5048            /// ```ignore,no_run
5049            /// # use google_cloud_api::model::distribution::bucket_options::Linear;
5050            /// let x = Linear::new().set_width(42.0);
5051            /// ```
5052            pub fn set_width<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
5053                self.width = v.into();
5054                self
5055            }
5056
5057            /// Sets the value of [offset][crate::model::distribution::bucket_options::Linear::offset].
5058            ///
5059            /// # Example
5060            /// ```ignore,no_run
5061            /// # use google_cloud_api::model::distribution::bucket_options::Linear;
5062            /// let x = Linear::new().set_offset(42.0);
5063            /// ```
5064            pub fn set_offset<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
5065                self.offset = v.into();
5066                self
5067            }
5068        }
5069
5070        impl wkt::message::Message for Linear {
5071            fn typename() -> &'static str {
5072                "type.googleapis.com/google.api.Distribution.BucketOptions.Linear"
5073            }
5074        }
5075
5076        /// Specifies an exponential sequence of buckets that have a width that is
5077        /// proportional to the value of the lower bound. Each bucket represents a
5078        /// constant relative uncertainty on a specific value in the bucket.
5079        ///
5080        /// There are `num_finite_buckets + 2` (= N) buckets. Bucket `i` has the
5081        /// following boundaries:
5082        ///
5083        /// Upper bound (0 <= i < N-1):     scale * (growth_factor ^ i).
5084        ///
5085        /// Lower bound (1 <= i < N):       scale * (growth_factor ^ (i - 1)).
5086        #[derive(Clone, Default, PartialEq)]
5087        #[non_exhaustive]
5088        pub struct Exponential {
5089            /// Must be greater than 0.
5090            pub num_finite_buckets: i32,
5091
5092            /// Must be greater than 1.
5093            pub growth_factor: f64,
5094
5095            /// Must be greater than 0.
5096            pub scale: f64,
5097
5098            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5099        }
5100
5101        impl Exponential {
5102            /// Creates a new default instance.
5103            pub fn new() -> Self {
5104                std::default::Default::default()
5105            }
5106
5107            /// Sets the value of [num_finite_buckets][crate::model::distribution::bucket_options::Exponential::num_finite_buckets].
5108            ///
5109            /// # Example
5110            /// ```ignore,no_run
5111            /// # use google_cloud_api::model::distribution::bucket_options::Exponential;
5112            /// let x = Exponential::new().set_num_finite_buckets(42);
5113            /// ```
5114            pub fn set_num_finite_buckets<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5115                self.num_finite_buckets = v.into();
5116                self
5117            }
5118
5119            /// Sets the value of [growth_factor][crate::model::distribution::bucket_options::Exponential::growth_factor].
5120            ///
5121            /// # Example
5122            /// ```ignore,no_run
5123            /// # use google_cloud_api::model::distribution::bucket_options::Exponential;
5124            /// let x = Exponential::new().set_growth_factor(42.0);
5125            /// ```
5126            pub fn set_growth_factor<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
5127                self.growth_factor = v.into();
5128                self
5129            }
5130
5131            /// Sets the value of [scale][crate::model::distribution::bucket_options::Exponential::scale].
5132            ///
5133            /// # Example
5134            /// ```ignore,no_run
5135            /// # use google_cloud_api::model::distribution::bucket_options::Exponential;
5136            /// let x = Exponential::new().set_scale(42.0);
5137            /// ```
5138            pub fn set_scale<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
5139                self.scale = v.into();
5140                self
5141            }
5142        }
5143
5144        impl wkt::message::Message for Exponential {
5145            fn typename() -> &'static str {
5146                "type.googleapis.com/google.api.Distribution.BucketOptions.Exponential"
5147            }
5148        }
5149
5150        /// Specifies a set of buckets with arbitrary widths.
5151        ///
5152        /// There are `size(bounds) + 1` (= N) buckets. Bucket `i` has the following
5153        /// boundaries:
5154        ///
5155        /// Upper bound (0 <= i < N-1):     bounds[i]
5156        /// Lower bound (1 <= i < N);       bounds[i - 1]
5157        ///
5158        /// The `bounds` field must contain at least one element. If `bounds` has
5159        /// only one element, then there are no finite buckets, and that single
5160        /// element is the common boundary of the overflow and underflow buckets.
5161        #[derive(Clone, Default, PartialEq)]
5162        #[non_exhaustive]
5163        pub struct Explicit {
5164            /// The values must be monotonically increasing.
5165            pub bounds: std::vec::Vec<f64>,
5166
5167            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5168        }
5169
5170        impl Explicit {
5171            /// Creates a new default instance.
5172            pub fn new() -> Self {
5173                std::default::Default::default()
5174            }
5175
5176            /// Sets the value of [bounds][crate::model::distribution::bucket_options::Explicit::bounds].
5177            ///
5178            /// # Example
5179            /// ```ignore,no_run
5180            /// # use google_cloud_api::model::distribution::bucket_options::Explicit;
5181            /// let x = Explicit::new().set_bounds([1.0, 2.0, 3.0]);
5182            /// ```
5183            pub fn set_bounds<T, V>(mut self, v: T) -> Self
5184            where
5185                T: std::iter::IntoIterator<Item = V>,
5186                V: std::convert::Into<f64>,
5187            {
5188                use std::iter::Iterator;
5189                self.bounds = v.into_iter().map(|i| i.into()).collect();
5190                self
5191            }
5192        }
5193
5194        impl wkt::message::Message for Explicit {
5195            fn typename() -> &'static str {
5196                "type.googleapis.com/google.api.Distribution.BucketOptions.Explicit"
5197            }
5198        }
5199
5200        /// Exactly one of these three fields must be set.
5201        #[derive(Clone, Debug, PartialEq)]
5202        #[non_exhaustive]
5203        pub enum Options {
5204            /// The linear bucket.
5205            LinearBuckets(std::boxed::Box<crate::model::distribution::bucket_options::Linear>),
5206            /// The exponential buckets.
5207            ExponentialBuckets(
5208                std::boxed::Box<crate::model::distribution::bucket_options::Exponential>,
5209            ),
5210            /// The explicit buckets.
5211            ExplicitBuckets(std::boxed::Box<crate::model::distribution::bucket_options::Explicit>),
5212        }
5213    }
5214
5215    /// Exemplars are example points that may be used to annotate aggregated
5216    /// distribution values. They are metadata that gives information about a
5217    /// particular value added to a Distribution bucket, such as a trace ID that
5218    /// was active when a value was added. They may contain further information,
5219    /// such as a example values and timestamps, origin, etc.
5220    #[derive(Clone, Default, PartialEq)]
5221    #[non_exhaustive]
5222    pub struct Exemplar {
5223        /// Value of the exemplar point. This value determines to which bucket the
5224        /// exemplar belongs.
5225        pub value: f64,
5226
5227        /// The observation (sampling) time of the above value.
5228        pub timestamp: std::option::Option<wkt::Timestamp>,
5229
5230        /// Contextual information about the example value. Examples are:
5231        ///
5232        /// Trace: type.googleapis.com/google.monitoring.v3.SpanContext
5233        ///
5234        /// Literal string: type.googleapis.com/google.protobuf.StringValue
5235        ///
5236        /// Labels dropped during aggregation:
5237        /// type.googleapis.com/google.monitoring.v3.DroppedLabels
5238        ///
5239        /// There may be only a single attachment of any given message type in a
5240        /// single exemplar, and this is enforced by the system.
5241        pub attachments: std::vec::Vec<wkt::Any>,
5242
5243        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5244    }
5245
5246    impl Exemplar {
5247        /// Creates a new default instance.
5248        pub fn new() -> Self {
5249            std::default::Default::default()
5250        }
5251
5252        /// Sets the value of [value][crate::model::distribution::Exemplar::value].
5253        ///
5254        /// # Example
5255        /// ```ignore,no_run
5256        /// # use google_cloud_api::model::distribution::Exemplar;
5257        /// let x = Exemplar::new().set_value(42.0);
5258        /// ```
5259        pub fn set_value<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
5260            self.value = v.into();
5261            self
5262        }
5263
5264        /// Sets the value of [timestamp][crate::model::distribution::Exemplar::timestamp].
5265        ///
5266        /// # Example
5267        /// ```ignore,no_run
5268        /// # use google_cloud_api::model::distribution::Exemplar;
5269        /// use wkt::Timestamp;
5270        /// let x = Exemplar::new().set_timestamp(Timestamp::default()/* use setters */);
5271        /// ```
5272        pub fn set_timestamp<T>(mut self, v: T) -> Self
5273        where
5274            T: std::convert::Into<wkt::Timestamp>,
5275        {
5276            self.timestamp = std::option::Option::Some(v.into());
5277            self
5278        }
5279
5280        /// Sets or clears the value of [timestamp][crate::model::distribution::Exemplar::timestamp].
5281        ///
5282        /// # Example
5283        /// ```ignore,no_run
5284        /// # use google_cloud_api::model::distribution::Exemplar;
5285        /// use wkt::Timestamp;
5286        /// let x = Exemplar::new().set_or_clear_timestamp(Some(Timestamp::default()/* use setters */));
5287        /// let x = Exemplar::new().set_or_clear_timestamp(None::<Timestamp>);
5288        /// ```
5289        pub fn set_or_clear_timestamp<T>(mut self, v: std::option::Option<T>) -> Self
5290        where
5291            T: std::convert::Into<wkt::Timestamp>,
5292        {
5293            self.timestamp = v.map(|x| x.into());
5294            self
5295        }
5296
5297        /// Sets the value of [attachments][crate::model::distribution::Exemplar::attachments].
5298        ///
5299        /// # Example
5300        /// ```ignore,no_run
5301        /// # use google_cloud_api::model::distribution::Exemplar;
5302        /// use wkt::Any;
5303        /// let x = Exemplar::new()
5304        ///     .set_attachments([
5305        ///         Any::default()/* use setters */,
5306        ///         Any::default()/* use (different) setters */,
5307        ///     ]);
5308        /// ```
5309        pub fn set_attachments<T, V>(mut self, v: T) -> Self
5310        where
5311            T: std::iter::IntoIterator<Item = V>,
5312            V: std::convert::Into<wkt::Any>,
5313        {
5314            use std::iter::Iterator;
5315            self.attachments = v.into_iter().map(|i| i.into()).collect();
5316            self
5317        }
5318    }
5319
5320    impl wkt::message::Message for Exemplar {
5321        fn typename() -> &'static str {
5322            "type.googleapis.com/google.api.Distribution.Exemplar"
5323        }
5324    }
5325}
5326
5327/// `Documentation` provides the information for describing a service.
5328///
5329/// Example:
5330///
5331/// Documentation is provided in markdown syntax. In addition to
5332/// standard markdown features, definition lists, tables and fenced
5333/// code blocks are supported. Section headers can be provided and are
5334/// interpreted relative to the section nesting of the context where
5335/// a documentation fragment is embedded.
5336///
5337/// Documentation from the IDL is merged with documentation defined
5338/// via the config at normalization time, where documentation provided
5339/// by config rules overrides IDL provided.
5340///
5341/// A number of constructs specific to the API platform are supported
5342/// in documentation text.
5343///
5344/// In order to reference a proto element, the following
5345/// notation can be used:
5346///
5347/// To override the display text used for the link, this can be used:
5348///
5349/// Text can be excluded from doc using the following notation:
5350///
5351/// A few directives are available in documentation. Note that
5352/// directives must appear on a single line to be properly
5353/// identified. The `include` directive includes a markdown file from
5354/// an external source:
5355///
5356/// The `resource_for` directive marks a message to be the resource of
5357/// a collection in REST view. If it is not specified, tools attempt
5358/// to infer the resource from the operations in a collection:
5359///
5360/// The directive `suppress_warning` does not directly affect documentation
5361/// and is documented together with service config validation.
5362#[derive(Clone, Default, PartialEq)]
5363#[non_exhaustive]
5364pub struct Documentation {
5365    /// A short description of what the service does. The summary must be plain
5366    /// text. It becomes the overview of the service displayed in Google Cloud
5367    /// Console.
5368    /// NOTE: This field is equivalent to the standard field `description`.
5369    pub summary: std::string::String,
5370
5371    /// The top level pages for the documentation set.
5372    pub pages: std::vec::Vec<crate::model::Page>,
5373
5374    /// A list of documentation rules that apply to individual API elements.
5375    ///
5376    /// **NOTE:** All service configuration rules follow "last one wins" order.
5377    pub rules: std::vec::Vec<crate::model::DocumentationRule>,
5378
5379    /// The URL to the root of documentation.
5380    pub documentation_root_url: std::string::String,
5381
5382    /// Specifies the service root url if the default one (the service name
5383    /// from the yaml file) is not suitable. This can be seen in any fully
5384    /// specified service urls as well as sections that show a base that other
5385    /// urls are relative to.
5386    pub service_root_url: std::string::String,
5387
5388    /// Declares a single overview page. For example:
5389    ///
5390    /// This is a shortcut for the following declaration (using pages style):
5391    ///
5392    /// Note: you cannot specify both `overview` field and `pages` field.
5393    pub overview: std::string::String,
5394
5395    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5396}
5397
5398impl Documentation {
5399    /// Creates a new default instance.
5400    pub fn new() -> Self {
5401        std::default::Default::default()
5402    }
5403
5404    /// Sets the value of [summary][crate::model::Documentation::summary].
5405    ///
5406    /// # Example
5407    /// ```ignore,no_run
5408    /// # use google_cloud_api::model::Documentation;
5409    /// let x = Documentation::new().set_summary("example");
5410    /// ```
5411    pub fn set_summary<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5412        self.summary = v.into();
5413        self
5414    }
5415
5416    /// Sets the value of [pages][crate::model::Documentation::pages].
5417    ///
5418    /// # Example
5419    /// ```ignore,no_run
5420    /// # use google_cloud_api::model::Documentation;
5421    /// use google_cloud_api::model::Page;
5422    /// let x = Documentation::new()
5423    ///     .set_pages([
5424    ///         Page::default()/* use setters */,
5425    ///         Page::default()/* use (different) setters */,
5426    ///     ]);
5427    /// ```
5428    pub fn set_pages<T, V>(mut self, v: T) -> Self
5429    where
5430        T: std::iter::IntoIterator<Item = V>,
5431        V: std::convert::Into<crate::model::Page>,
5432    {
5433        use std::iter::Iterator;
5434        self.pages = v.into_iter().map(|i| i.into()).collect();
5435        self
5436    }
5437
5438    /// Sets the value of [rules][crate::model::Documentation::rules].
5439    ///
5440    /// # Example
5441    /// ```ignore,no_run
5442    /// # use google_cloud_api::model::Documentation;
5443    /// use google_cloud_api::model::DocumentationRule;
5444    /// let x = Documentation::new()
5445    ///     .set_rules([
5446    ///         DocumentationRule::default()/* use setters */,
5447    ///         DocumentationRule::default()/* use (different) setters */,
5448    ///     ]);
5449    /// ```
5450    pub fn set_rules<T, V>(mut self, v: T) -> Self
5451    where
5452        T: std::iter::IntoIterator<Item = V>,
5453        V: std::convert::Into<crate::model::DocumentationRule>,
5454    {
5455        use std::iter::Iterator;
5456        self.rules = v.into_iter().map(|i| i.into()).collect();
5457        self
5458    }
5459
5460    /// Sets the value of [documentation_root_url][crate::model::Documentation::documentation_root_url].
5461    ///
5462    /// # Example
5463    /// ```ignore,no_run
5464    /// # use google_cloud_api::model::Documentation;
5465    /// let x = Documentation::new().set_documentation_root_url("example");
5466    /// ```
5467    pub fn set_documentation_root_url<T: std::convert::Into<std::string::String>>(
5468        mut self,
5469        v: T,
5470    ) -> Self {
5471        self.documentation_root_url = v.into();
5472        self
5473    }
5474
5475    /// Sets the value of [service_root_url][crate::model::Documentation::service_root_url].
5476    ///
5477    /// # Example
5478    /// ```ignore,no_run
5479    /// # use google_cloud_api::model::Documentation;
5480    /// let x = Documentation::new().set_service_root_url("example");
5481    /// ```
5482    pub fn set_service_root_url<T: std::convert::Into<std::string::String>>(
5483        mut self,
5484        v: T,
5485    ) -> Self {
5486        self.service_root_url = v.into();
5487        self
5488    }
5489
5490    /// Sets the value of [overview][crate::model::Documentation::overview].
5491    ///
5492    /// # Example
5493    /// ```ignore,no_run
5494    /// # use google_cloud_api::model::Documentation;
5495    /// let x = Documentation::new().set_overview("example");
5496    /// ```
5497    pub fn set_overview<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5498        self.overview = v.into();
5499        self
5500    }
5501}
5502
5503impl wkt::message::Message for Documentation {
5504    fn typename() -> &'static str {
5505        "type.googleapis.com/google.api.Documentation"
5506    }
5507}
5508
5509/// A documentation rule provides information about individual API elements.
5510#[derive(Clone, Default, PartialEq)]
5511#[non_exhaustive]
5512pub struct DocumentationRule {
5513    /// The selector is a comma-separated list of patterns for any element such as
5514    /// a method, a field, an enum value. Each pattern is a qualified name of the
5515    /// element which may end in "*", indicating a wildcard. Wildcards are only
5516    /// allowed at the end and for a whole component of the qualified name,
5517    /// i.e. "foo.*" is ok, but not "foo.b*" or "foo.*.bar". A wildcard will match
5518    /// one or more components. To specify a default for all applicable elements,
5519    /// the whole pattern "*" is used.
5520    pub selector: std::string::String,
5521
5522    /// Description of the selected proto element (e.g. a message, a method, a
5523    /// 'service' definition, or a field). Defaults to leading & trailing comments
5524    /// taken from the proto source definition of the proto element.
5525    pub description: std::string::String,
5526
5527    /// Deprecation description of the selected element(s). It can be provided if
5528    /// an element is marked as `deprecated`.
5529    pub deprecation_description: std::string::String,
5530
5531    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5532}
5533
5534impl DocumentationRule {
5535    /// Creates a new default instance.
5536    pub fn new() -> Self {
5537        std::default::Default::default()
5538    }
5539
5540    /// Sets the value of [selector][crate::model::DocumentationRule::selector].
5541    ///
5542    /// # Example
5543    /// ```ignore,no_run
5544    /// # use google_cloud_api::model::DocumentationRule;
5545    /// let x = DocumentationRule::new().set_selector("example");
5546    /// ```
5547    pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5548        self.selector = v.into();
5549        self
5550    }
5551
5552    /// Sets the value of [description][crate::model::DocumentationRule::description].
5553    ///
5554    /// # Example
5555    /// ```ignore,no_run
5556    /// # use google_cloud_api::model::DocumentationRule;
5557    /// let x = DocumentationRule::new().set_description("example");
5558    /// ```
5559    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5560        self.description = v.into();
5561        self
5562    }
5563
5564    /// Sets the value of [deprecation_description][crate::model::DocumentationRule::deprecation_description].
5565    ///
5566    /// # Example
5567    /// ```ignore,no_run
5568    /// # use google_cloud_api::model::DocumentationRule;
5569    /// let x = DocumentationRule::new().set_deprecation_description("example");
5570    /// ```
5571    pub fn set_deprecation_description<T: std::convert::Into<std::string::String>>(
5572        mut self,
5573        v: T,
5574    ) -> Self {
5575        self.deprecation_description = v.into();
5576        self
5577    }
5578}
5579
5580impl wkt::message::Message for DocumentationRule {
5581    fn typename() -> &'static str {
5582        "type.googleapis.com/google.api.DocumentationRule"
5583    }
5584}
5585
5586/// Represents a documentation page. A page can contain subpages to represent
5587/// nested documentation set structure.
5588#[derive(Clone, Default, PartialEq)]
5589#[non_exhaustive]
5590pub struct Page {
5591    /// The name of the page. It will be used as an identity of the page to
5592    /// generate URI of the page, text of the link to this page in navigation,
5593    /// etc. The full page name (start from the root page name to this page
5594    /// concatenated with `.`) can be used as reference to the page in your
5595    /// documentation. For example:
5596    ///
5597    /// You can reference `Java` page using Markdown reference link syntax:
5598    /// `[Java][Tutorial.Java]`.
5599    pub name: std::string::String,
5600
5601    /// The Markdown content of the page. You can use ```(== include {path}
5602    /// ==)``` to include content from a Markdown file. The content can be used
5603    /// to produce the documentation page such as HTML format page.
5604    pub content: std::string::String,
5605
5606    /// Subpages of this page. The order of subpages specified here will be
5607    /// honored in the generated docset.
5608    pub subpages: std::vec::Vec<crate::model::Page>,
5609
5610    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5611}
5612
5613impl Page {
5614    /// Creates a new default instance.
5615    pub fn new() -> Self {
5616        std::default::Default::default()
5617    }
5618
5619    /// Sets the value of [name][crate::model::Page::name].
5620    ///
5621    /// # Example
5622    /// ```ignore,no_run
5623    /// # use google_cloud_api::model::Page;
5624    /// let x = Page::new().set_name("example");
5625    /// ```
5626    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5627        self.name = v.into();
5628        self
5629    }
5630
5631    /// Sets the value of [content][crate::model::Page::content].
5632    ///
5633    /// # Example
5634    /// ```ignore,no_run
5635    /// # use google_cloud_api::model::Page;
5636    /// let x = Page::new().set_content("example");
5637    /// ```
5638    pub fn set_content<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5639        self.content = v.into();
5640        self
5641    }
5642
5643    /// Sets the value of [subpages][crate::model::Page::subpages].
5644    ///
5645    /// # Example
5646    /// ```ignore,no_run
5647    /// # use google_cloud_api::model::Page;
5648    /// let x = Page::new()
5649    ///     .set_subpages([
5650    ///         Page::default()/* use setters */,
5651    ///         Page::default()/* use (different) setters */,
5652    ///     ]);
5653    /// ```
5654    pub fn set_subpages<T, V>(mut self, v: T) -> Self
5655    where
5656        T: std::iter::IntoIterator<Item = V>,
5657        V: std::convert::Into<crate::model::Page>,
5658    {
5659        use std::iter::Iterator;
5660        self.subpages = v.into_iter().map(|i| i.into()).collect();
5661        self
5662    }
5663}
5664
5665impl wkt::message::Message for Page {
5666    fn typename() -> &'static str {
5667        "type.googleapis.com/google.api.Page"
5668    }
5669}
5670
5671/// `Endpoint` describes a network address of a service that serves a set of
5672/// APIs. It is commonly known as a service endpoint. A service may expose
5673/// any number of service endpoints, and all service endpoints share the same
5674/// service definition, such as quota limits and monitoring metrics.
5675///
5676/// Example:
5677///
5678/// ```norust
5679/// type: google.api.Service
5680/// name: library-example.googleapis.com
5681/// endpoints:
5682///   # Declares network address `https://library-example.googleapis.com`
5683///   # for service `library-example.googleapis.com`. The `https` scheme
5684///   # is implicit for all service endpoints. Other schemes may be
5685///   # supported in the future.
5686/// - name: library-example.googleapis.com
5687///   allow_cors: false
5688/// - name: content-staging-library-example.googleapis.com
5689///   # Allows HTTP OPTIONS calls to be passed to the API frontend, for it
5690///   # to decide whether the subsequent cross-origin request is allowed
5691///   # to proceed.
5692///   allow_cors: true
5693/// ```
5694#[derive(Clone, Default, PartialEq)]
5695#[non_exhaustive]
5696pub struct Endpoint {
5697    /// The canonical name of this endpoint.
5698    pub name: std::string::String,
5699
5700    /// Aliases for this endpoint, these will be served by the same UrlMap as the
5701    /// parent endpoint, and will be provisioned in the GCP stack for the Regional
5702    /// Endpoints.
5703    pub aliases: std::vec::Vec<std::string::String>,
5704
5705    /// The specification of an Internet routable address of API frontend that will
5706    /// handle requests to this [API
5707    /// Endpoint](https://cloud.google.com/apis/design/glossary). It should be
5708    /// either a valid IPv4 address or a fully-qualified domain name. For example,
5709    /// "8.8.8.8" or "myservice.appspot.com".
5710    pub target: std::string::String,
5711
5712    /// Allowing
5713    /// [CORS](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing), aka
5714    /// cross-domain traffic, would allow the backends served from this endpoint to
5715    /// receive and respond to HTTP OPTIONS requests. The response will be used by
5716    /// the browser to determine whether the subsequent cross-origin request is
5717    /// allowed to proceed.
5718    pub allow_cors: bool,
5719
5720    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5721}
5722
5723impl Endpoint {
5724    /// Creates a new default instance.
5725    pub fn new() -> Self {
5726        std::default::Default::default()
5727    }
5728
5729    /// Sets the value of [name][crate::model::Endpoint::name].
5730    ///
5731    /// # Example
5732    /// ```ignore,no_run
5733    /// # use google_cloud_api::model::Endpoint;
5734    /// let x = Endpoint::new().set_name("example");
5735    /// ```
5736    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5737        self.name = v.into();
5738        self
5739    }
5740
5741    /// Sets the value of [aliases][crate::model::Endpoint::aliases].
5742    ///
5743    /// # Example
5744    /// ```ignore,no_run
5745    /// # use google_cloud_api::model::Endpoint;
5746    /// let x = Endpoint::new().set_aliases(["a", "b", "c"]);
5747    /// ```
5748    pub fn set_aliases<T, V>(mut self, v: T) -> Self
5749    where
5750        T: std::iter::IntoIterator<Item = V>,
5751        V: std::convert::Into<std::string::String>,
5752    {
5753        use std::iter::Iterator;
5754        self.aliases = v.into_iter().map(|i| i.into()).collect();
5755        self
5756    }
5757
5758    /// Sets the value of [target][crate::model::Endpoint::target].
5759    ///
5760    /// # Example
5761    /// ```ignore,no_run
5762    /// # use google_cloud_api::model::Endpoint;
5763    /// let x = Endpoint::new().set_target("example");
5764    /// ```
5765    pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5766        self.target = v.into();
5767        self
5768    }
5769
5770    /// Sets the value of [allow_cors][crate::model::Endpoint::allow_cors].
5771    ///
5772    /// # Example
5773    /// ```ignore,no_run
5774    /// # use google_cloud_api::model::Endpoint;
5775    /// let x = Endpoint::new().set_allow_cors(true);
5776    /// ```
5777    pub fn set_allow_cors<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5778        self.allow_cors = v.into();
5779        self
5780    }
5781}
5782
5783impl wkt::message::Message for Endpoint {
5784    fn typename() -> &'static str {
5785        "type.googleapis.com/google.api.Endpoint"
5786    }
5787}
5788
5789/// Rich semantic information of an API field beyond basic typing.
5790#[derive(Clone, Default, PartialEq)]
5791#[non_exhaustive]
5792pub struct FieldInfo {
5793    /// The standard format of a field value. This does not explicitly configure
5794    /// any API consumer, just documents the API's format for the field it is
5795    /// applied to.
5796    pub format: crate::model::field_info::Format,
5797
5798    /// The type(s) that the annotated, generic field may represent.
5799    ///
5800    /// Currently, this must only be used on fields of type `google.protobuf.Any`.
5801    /// Supporting other generic types may be considered in the future.
5802    pub referenced_types: std::vec::Vec<crate::model::TypeReference>,
5803
5804    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5805}
5806
5807impl FieldInfo {
5808    /// Creates a new default instance.
5809    pub fn new() -> Self {
5810        std::default::Default::default()
5811    }
5812
5813    /// Sets the value of [format][crate::model::FieldInfo::format].
5814    ///
5815    /// # Example
5816    /// ```ignore,no_run
5817    /// # use google_cloud_api::model::FieldInfo;
5818    /// use google_cloud_api::model::field_info::Format;
5819    /// let x0 = FieldInfo::new().set_format(Format::Uuid4);
5820    /// let x1 = FieldInfo::new().set_format(Format::Ipv4);
5821    /// let x2 = FieldInfo::new().set_format(Format::Ipv6);
5822    /// ```
5823    pub fn set_format<T: std::convert::Into<crate::model::field_info::Format>>(
5824        mut self,
5825        v: T,
5826    ) -> Self {
5827        self.format = v.into();
5828        self
5829    }
5830
5831    /// Sets the value of [referenced_types][crate::model::FieldInfo::referenced_types].
5832    ///
5833    /// # Example
5834    /// ```ignore,no_run
5835    /// # use google_cloud_api::model::FieldInfo;
5836    /// use google_cloud_api::model::TypeReference;
5837    /// let x = FieldInfo::new()
5838    ///     .set_referenced_types([
5839    ///         TypeReference::default()/* use setters */,
5840    ///         TypeReference::default()/* use (different) setters */,
5841    ///     ]);
5842    /// ```
5843    pub fn set_referenced_types<T, V>(mut self, v: T) -> Self
5844    where
5845        T: std::iter::IntoIterator<Item = V>,
5846        V: std::convert::Into<crate::model::TypeReference>,
5847    {
5848        use std::iter::Iterator;
5849        self.referenced_types = v.into_iter().map(|i| i.into()).collect();
5850        self
5851    }
5852}
5853
5854impl wkt::message::Message for FieldInfo {
5855    fn typename() -> &'static str {
5856        "type.googleapis.com/google.api.FieldInfo"
5857    }
5858}
5859
5860/// Defines additional types related to [FieldInfo].
5861pub mod field_info {
5862    #[allow(unused_imports)]
5863    use super::*;
5864
5865    /// The standard format of a field value. The supported formats are all backed
5866    /// by either an RFC defined by the IETF or a Google-defined AIP.
5867    ///
5868    /// # Working with unknown values
5869    ///
5870    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5871    /// additional enum variants at any time. Adding new variants is not considered
5872    /// a breaking change. Applications should write their code in anticipation of:
5873    ///
5874    /// - New values appearing in future releases of the client library, **and**
5875    /// - New values received dynamically, without application changes.
5876    ///
5877    /// Please consult the [Working with enums] section in the user guide for some
5878    /// guidelines.
5879    ///
5880    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5881    #[derive(Clone, Debug, PartialEq)]
5882    #[non_exhaustive]
5883    pub enum Format {
5884        /// Default, unspecified value.
5885        Unspecified,
5886        /// Universally Unique Identifier, version 4, value as defined by
5887        /// <https://datatracker.ietf.org/doc/html/rfc4122>. The value may be
5888        /// normalized to entirely lowercase letters. For example, the value
5889        /// `F47AC10B-58CC-0372-8567-0E02B2C3D479` would be normalized to
5890        /// `f47ac10b-58cc-0372-8567-0e02b2c3d479`.
5891        Uuid4,
5892        /// Internet Protocol v4 value as defined by [RFC
5893        /// 791](https://datatracker.ietf.org/doc/html/rfc791). The value may be
5894        /// condensed, with leading zeros in each octet stripped. For example,
5895        /// `001.022.233.040` would be condensed to `1.22.233.40`.
5896        Ipv4,
5897        /// Internet Protocol v6 value as defined by [RFC
5898        /// 2460](https://datatracker.ietf.org/doc/html/rfc2460). The value may be
5899        /// normalized to entirely lowercase letters with zeros compressed, following
5900        /// [RFC 5952](https://datatracker.ietf.org/doc/html/rfc5952). For example,
5901        /// the value `2001:0DB8:0::0` would be normalized to `2001:db8::`.
5902        Ipv6,
5903        /// An IP address in either v4 or v6 format as described by the individual
5904        /// values defined herein. See the comments on the IPV4 and IPV6 types for
5905        /// allowed normalizations of each.
5906        Ipv4OrIpv6,
5907        /// If set, the enum was initialized with an unknown value.
5908        ///
5909        /// Applications can examine the value using [Format::value] or
5910        /// [Format::name].
5911        UnknownValue(format::UnknownValue),
5912    }
5913
5914    #[doc(hidden)]
5915    pub mod format {
5916        #[allow(unused_imports)]
5917        use super::*;
5918        #[derive(Clone, Debug, PartialEq)]
5919        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5920    }
5921
5922    impl Format {
5923        /// Gets the enum value.
5924        ///
5925        /// Returns `None` if the enum contains an unknown value deserialized from
5926        /// the string representation of enums.
5927        pub fn value(&self) -> std::option::Option<i32> {
5928            match self {
5929                Self::Unspecified => std::option::Option::Some(0),
5930                Self::Uuid4 => std::option::Option::Some(1),
5931                Self::Ipv4 => std::option::Option::Some(2),
5932                Self::Ipv6 => std::option::Option::Some(3),
5933                Self::Ipv4OrIpv6 => std::option::Option::Some(4),
5934                Self::UnknownValue(u) => u.0.value(),
5935            }
5936        }
5937
5938        /// Gets the enum value as a string.
5939        ///
5940        /// Returns `None` if the enum contains an unknown value deserialized from
5941        /// the integer representation of enums.
5942        pub fn name(&self) -> std::option::Option<&str> {
5943            match self {
5944                Self::Unspecified => std::option::Option::Some("FORMAT_UNSPECIFIED"),
5945                Self::Uuid4 => std::option::Option::Some("UUID4"),
5946                Self::Ipv4 => std::option::Option::Some("IPV4"),
5947                Self::Ipv6 => std::option::Option::Some("IPV6"),
5948                Self::Ipv4OrIpv6 => std::option::Option::Some("IPV4_OR_IPV6"),
5949                Self::UnknownValue(u) => u.0.name(),
5950            }
5951        }
5952    }
5953
5954    impl std::default::Default for Format {
5955        fn default() -> Self {
5956            use std::convert::From;
5957            Self::from(0)
5958        }
5959    }
5960
5961    impl std::fmt::Display for Format {
5962        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5963            wkt::internal::display_enum(f, self.name(), self.value())
5964        }
5965    }
5966
5967    impl std::convert::From<i32> for Format {
5968        fn from(value: i32) -> Self {
5969            match value {
5970                0 => Self::Unspecified,
5971                1 => Self::Uuid4,
5972                2 => Self::Ipv4,
5973                3 => Self::Ipv6,
5974                4 => Self::Ipv4OrIpv6,
5975                _ => Self::UnknownValue(format::UnknownValue(
5976                    wkt::internal::UnknownEnumValue::Integer(value),
5977                )),
5978            }
5979        }
5980    }
5981
5982    impl std::convert::From<&str> for Format {
5983        fn from(value: &str) -> Self {
5984            use std::string::ToString;
5985            match value {
5986                "FORMAT_UNSPECIFIED" => Self::Unspecified,
5987                "UUID4" => Self::Uuid4,
5988                "IPV4" => Self::Ipv4,
5989                "IPV6" => Self::Ipv6,
5990                "IPV4_OR_IPV6" => Self::Ipv4OrIpv6,
5991                _ => Self::UnknownValue(format::UnknownValue(
5992                    wkt::internal::UnknownEnumValue::String(value.to_string()),
5993                )),
5994            }
5995        }
5996    }
5997
5998    impl serde::ser::Serialize for Format {
5999        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6000        where
6001            S: serde::Serializer,
6002        {
6003            match self {
6004                Self::Unspecified => serializer.serialize_i32(0),
6005                Self::Uuid4 => serializer.serialize_i32(1),
6006                Self::Ipv4 => serializer.serialize_i32(2),
6007                Self::Ipv6 => serializer.serialize_i32(3),
6008                Self::Ipv4OrIpv6 => serializer.serialize_i32(4),
6009                Self::UnknownValue(u) => u.0.serialize(serializer),
6010            }
6011        }
6012    }
6013
6014    impl<'de> serde::de::Deserialize<'de> for Format {
6015        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6016        where
6017            D: serde::Deserializer<'de>,
6018        {
6019            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Format>::new(
6020                ".google.api.FieldInfo.Format",
6021            ))
6022        }
6023    }
6024}
6025
6026/// A reference to a message type, for use in [FieldInfo][google.api.FieldInfo].
6027///
6028/// [google.api.FieldInfo]: crate::model::FieldInfo
6029#[derive(Clone, Default, PartialEq)]
6030#[non_exhaustive]
6031pub struct TypeReference {
6032    /// The name of the type that the annotated, generic field may represent.
6033    /// If the type is in the same protobuf package, the value can be the simple
6034    /// message name e.g., `"MyMessage"`. Otherwise, the value must be the
6035    /// fully-qualified message name e.g., `"google.library.v1.Book"`.
6036    ///
6037    /// If the type(s) are unknown to the service (e.g. the field accepts generic
6038    /// user input), use the wildcard `"*"` to denote this behavior.
6039    ///
6040    /// See [AIP-202](https://google.aip.dev/202#type-references) for more details.
6041    pub type_name: std::string::String,
6042
6043    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6044}
6045
6046impl TypeReference {
6047    /// Creates a new default instance.
6048    pub fn new() -> Self {
6049        std::default::Default::default()
6050    }
6051
6052    /// Sets the value of [type_name][crate::model::TypeReference::type_name].
6053    ///
6054    /// # Example
6055    /// ```ignore,no_run
6056    /// # use google_cloud_api::model::TypeReference;
6057    /// let x = TypeReference::new().set_type_name("example");
6058    /// ```
6059    pub fn set_type_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6060        self.type_name = v.into();
6061        self
6062    }
6063}
6064
6065impl wkt::message::Message for TypeReference {
6066    fn typename() -> &'static str {
6067        "type.googleapis.com/google.api.TypeReference"
6068    }
6069}
6070
6071/// Defines the HTTP configuration for an API service. It contains a list of
6072/// [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method
6073/// to one or more HTTP REST API methods.
6074///
6075/// [google.api.HttpRule]: crate::model::HttpRule
6076#[derive(Clone, Default, PartialEq)]
6077#[non_exhaustive]
6078pub struct Http {
6079    /// A list of HTTP configuration rules that apply to individual API methods.
6080    ///
6081    /// **NOTE:** All service configuration rules follow "last one wins" order.
6082    pub rules: std::vec::Vec<crate::model::HttpRule>,
6083
6084    /// When set to true, URL path parameters will be fully URI-decoded except in
6085    /// cases of single segment matches in reserved expansion, where "%2F" will be
6086    /// left encoded.
6087    ///
6088    /// The default behavior is to not decode RFC 6570 reserved characters in multi
6089    /// segment matches.
6090    pub fully_decode_reserved_expansion: bool,
6091
6092    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6093}
6094
6095impl Http {
6096    /// Creates a new default instance.
6097    pub fn new() -> Self {
6098        std::default::Default::default()
6099    }
6100
6101    /// Sets the value of [rules][crate::model::Http::rules].
6102    ///
6103    /// # Example
6104    /// ```ignore,no_run
6105    /// # use google_cloud_api::model::Http;
6106    /// use google_cloud_api::model::HttpRule;
6107    /// let x = Http::new()
6108    ///     .set_rules([
6109    ///         HttpRule::default()/* use setters */,
6110    ///         HttpRule::default()/* use (different) setters */,
6111    ///     ]);
6112    /// ```
6113    pub fn set_rules<T, V>(mut self, v: T) -> Self
6114    where
6115        T: std::iter::IntoIterator<Item = V>,
6116        V: std::convert::Into<crate::model::HttpRule>,
6117    {
6118        use std::iter::Iterator;
6119        self.rules = v.into_iter().map(|i| i.into()).collect();
6120        self
6121    }
6122
6123    /// Sets the value of [fully_decode_reserved_expansion][crate::model::Http::fully_decode_reserved_expansion].
6124    ///
6125    /// # Example
6126    /// ```ignore,no_run
6127    /// # use google_cloud_api::model::Http;
6128    /// let x = Http::new().set_fully_decode_reserved_expansion(true);
6129    /// ```
6130    pub fn set_fully_decode_reserved_expansion<T: std::convert::Into<bool>>(
6131        mut self,
6132        v: T,
6133    ) -> Self {
6134        self.fully_decode_reserved_expansion = v.into();
6135        self
6136    }
6137}
6138
6139impl wkt::message::Message for Http {
6140    fn typename() -> &'static str {
6141        "type.googleapis.com/google.api.Http"
6142    }
6143}
6144
6145/// gRPC Transcoding
6146///
6147/// gRPC Transcoding is a feature for mapping between a gRPC method and one or
6148/// more HTTP REST endpoints. It allows developers to build a single API service
6149/// that supports both gRPC APIs and REST APIs. Many systems, including [Google
6150/// APIs](https://github.com/googleapis/googleapis),
6151/// [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC
6152/// Gateway](https://github.com/grpc-ecosystem/grpc-gateway),
6153/// and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature
6154/// and use it for large scale production services.
6155///
6156/// `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies
6157/// how different portions of the gRPC request message are mapped to the URL
6158/// path, URL query parameters, and HTTP request body. It also controls how the
6159/// gRPC response message is mapped to the HTTP response body. `HttpRule` is
6160/// typically specified as an `google.api.http` annotation on the gRPC method.
6161///
6162/// Each mapping specifies a URL path template and an HTTP method. The path
6163/// template may refer to one or more fields in the gRPC request message, as long
6164/// as each field is a non-repeated field with a primitive (non-message) type.
6165/// The path template controls how fields of the request message are mapped to
6166/// the URL path.
6167///
6168/// Example:
6169///
6170/// ```norust
6171/// service Messaging {
6172///   rpc GetMessage(GetMessageRequest) returns (Message) {
6173///     option (google.api.http) = {
6174///         get: "/v1/{name=messages/*}"
6175///     };
6176///   }
6177/// }
6178/// message GetMessageRequest {
6179///   string name = 1; // Mapped to URL path.
6180/// }
6181/// message Message {
6182///   string text = 1; // The resource content.
6183/// }
6184/// ```
6185///
6186/// This enables an HTTP REST to gRPC mapping as below:
6187///
6188/// - HTTP: `GET /v1/messages/123456`
6189/// - gRPC: `GetMessage(name: "messages/123456")`
6190///
6191/// Any fields in the request message which are not bound by the path template
6192/// automatically become HTTP query parameters if there is no HTTP request body.
6193/// For example:
6194///
6195/// ```norust
6196/// service Messaging {
6197///   rpc GetMessage(GetMessageRequest) returns (Message) {
6198///     option (google.api.http) = {
6199///         get:"/v1/messages/{message_id}"
6200///     };
6201///   }
6202/// }
6203/// message GetMessageRequest {
6204///   message SubMessage {
6205///     string subfield = 1;
6206///   }
6207///   string message_id = 1; // Mapped to URL path.
6208///   int64 revision = 2;    // Mapped to URL query parameter `revision`.
6209///   SubMessage sub = 3;    // Mapped to URL query parameter `sub.subfield`.
6210/// }
6211/// ```
6212///
6213/// This enables a HTTP JSON to RPC mapping as below:
6214///
6215/// - HTTP: `GET /v1/messages/123456?revision=2&sub.subfield=foo`
6216/// - gRPC: `GetMessage(message_id: "123456" revision: 2 sub:
6217///   SubMessage(subfield: "foo"))`
6218///
6219/// Note that fields which are mapped to URL query parameters must have a
6220/// primitive type or a repeated primitive type or a non-repeated message type.
6221/// In the case of a repeated type, the parameter can be repeated in the URL
6222/// as `...?param=A&param=B`. In the case of a message type, each field of the
6223/// message is mapped to a separate parameter, such as
6224/// `...?foo.a=A&foo.b=B&foo.c=C`.
6225///
6226/// For HTTP methods that allow a request body, the `body` field
6227/// specifies the mapping. Consider a REST update method on the
6228/// message resource collection:
6229///
6230/// ```norust
6231/// service Messaging {
6232///   rpc UpdateMessage(UpdateMessageRequest) returns (Message) {
6233///     option (google.api.http) = {
6234///       patch: "/v1/messages/{message_id}"
6235///       body: "message"
6236///     };
6237///   }
6238/// }
6239/// message UpdateMessageRequest {
6240///   string message_id = 1; // mapped to the URL
6241///   Message message = 2;   // mapped to the body
6242/// }
6243/// ```
6244///
6245/// The following HTTP JSON to RPC mapping is enabled, where the
6246/// representation of the JSON in the request body is determined by
6247/// protos JSON encoding:
6248///
6249/// - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }`
6250/// - gRPC: `UpdateMessage(message_id: "123456" message { text: "Hi!" })`
6251///
6252/// The special name `*` can be used in the body mapping to define that
6253/// every field not bound by the path template should be mapped to the
6254/// request body.  This enables the following alternative definition of
6255/// the update method:
6256///
6257/// ```norust
6258/// service Messaging {
6259///   rpc UpdateMessage(Message) returns (Message) {
6260///     option (google.api.http) = {
6261///       patch: "/v1/messages/{message_id}"
6262///       body: "*"
6263///     };
6264///   }
6265/// }
6266/// message Message {
6267///   string message_id = 1;
6268///   string text = 2;
6269/// }
6270/// ```
6271///
6272/// The following HTTP JSON to RPC mapping is enabled:
6273///
6274/// - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }`
6275/// - gRPC: `UpdateMessage(message_id: "123456" text: "Hi!")`
6276///
6277/// Note that when using `*` in the body mapping, it is not possible to
6278/// have HTTP parameters, as all fields not bound by the path end in
6279/// the body. This makes this option more rarely used in practice when
6280/// defining REST APIs. The common usage of `*` is in custom methods
6281/// which don't use the URL at all for transferring data.
6282///
6283/// It is possible to define multiple HTTP methods for one RPC by using
6284/// the `additional_bindings` option. Example:
6285///
6286/// ```norust
6287/// service Messaging {
6288///   rpc GetMessage(GetMessageRequest) returns (Message) {
6289///     option (google.api.http) = {
6290///       get: "/v1/messages/{message_id}"
6291///       additional_bindings {
6292///         get: "/v1/users/{user_id}/messages/{message_id}"
6293///       }
6294///     };
6295///   }
6296/// }
6297/// message GetMessageRequest {
6298///   string message_id = 1;
6299///   string user_id = 2;
6300/// }
6301/// ```
6302///
6303/// This enables the following two alternative HTTP JSON to RPC mappings:
6304///
6305/// - HTTP: `GET /v1/messages/123456`
6306///
6307/// - gRPC: `GetMessage(message_id: "123456")`
6308///
6309/// - HTTP: `GET /v1/users/me/messages/123456`
6310///
6311/// - gRPC: `GetMessage(user_id: "me" message_id: "123456")`
6312///
6313///
6314/// Rules for HTTP mapping
6315///
6316/// 1. Leaf request fields (recursive expansion nested messages in the request
6317///    message) are classified into three categories:
6318///    - Fields referred by the path template. They are passed via the URL path.
6319///    - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They
6320///      are passed via the HTTP
6321///      request body.
6322///    - All other fields are passed via the URL query parameters, and the
6323///      parameter name is the field path in the request message. A repeated
6324///      field can be represented as multiple query parameters under the same
6325///      name.
6326/// 1. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL
6327///    query parameter, all fields
6328///    are passed via URL path and HTTP request body.
6329/// 1. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP
6330///    request body, all
6331///    fields are passed via URL path and URL query parameters.
6332///
6333/// Path template syntax
6334///
6335/// ```norust
6336/// Template = "/" Segments [ Verb ] ;
6337/// Segments = Segment { "/" Segment } ;
6338/// Segment  = "*" | "**" | LITERAL | Variable ;
6339/// Variable = "{" FieldPath [ "=" Segments ] "}" ;
6340/// FieldPath = IDENT { "." IDENT } ;
6341/// Verb     = ":" LITERAL ;
6342/// ```
6343///
6344/// The syntax `*` matches a single URL path segment. The syntax `**` matches
6345/// zero or more URL path segments, which must be the last part of the URL path
6346/// except the `Verb`.
6347///
6348/// The syntax `Variable` matches part of the URL path as specified by its
6349/// template. A variable template must not contain other variables. If a variable
6350/// matches a single path segment, its template may be omitted, e.g. `{var}`
6351/// is equivalent to `{var=*}`.
6352///
6353/// The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL`
6354/// contains any reserved character, such characters should be percent-encoded
6355/// before the matching.
6356///
6357/// If a variable contains exactly one path segment, such as `"{var}"` or
6358/// `"{var=*}"`, when such a variable is expanded into a URL path on the client
6359/// side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The
6360/// server side does the reverse decoding. Such variables show up in the
6361/// [Discovery
6362/// Document](https://developers.google.com/discovery/v1/reference/apis) as
6363/// `{var}`.
6364///
6365/// If a variable contains multiple path segments, such as `"{var=foo/*}"`
6366/// or `"{var=**}"`, when such a variable is expanded into a URL path on the
6367/// client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded.
6368/// The server side does the reverse decoding, except "%2F" and "%2f" are left
6369/// unchanged. Such variables show up in the
6370/// [Discovery
6371/// Document](https://developers.google.com/discovery/v1/reference/apis) as
6372/// `{+var}`.
6373///
6374/// Using gRPC API Service Configuration
6375///
6376/// gRPC API Service Configuration (service config) is a configuration language
6377/// for configuring a gRPC service to become a user-facing product. The
6378/// service config is simply the YAML representation of the `google.api.Service`
6379/// proto message.
6380///
6381/// As an alternative to annotating your proto file, you can configure gRPC
6382/// transcoding in your service config YAML files. You do this by specifying a
6383/// `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same
6384/// effect as the proto annotation. This can be particularly useful if you
6385/// have a proto that is reused in multiple services. Note that any transcoding
6386/// specified in the service config will override any matching transcoding
6387/// configuration in the proto.
6388///
6389/// The following example selects a gRPC method and applies an `HttpRule` to it:
6390///
6391/// ```norust
6392/// http:
6393///   rules:
6394///     - selector: example.v1.Messaging.GetMessage
6395///       get: /v1/messages/{message_id}/{sub.subfield}
6396/// ```
6397///
6398/// Special notes
6399///
6400/// When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the
6401/// proto to JSON conversion must follow the [proto3
6402/// specification](https://developers.google.com/protocol-buffers/docs/proto3#json).
6403///
6404/// While the single segment variable follows the semantics of
6405/// [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String
6406/// Expansion, the multi segment variable **does not** follow RFC 6570 Section
6407/// 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion
6408/// does not expand special characters like `?` and `#`, which would lead
6409/// to invalid URLs. As the result, gRPC Transcoding uses a custom encoding
6410/// for multi segment variables.
6411///
6412/// The path variables **must not** refer to any repeated or mapped field,
6413/// because client libraries are not capable of handling such variable expansion.
6414///
6415/// The path variables **must not** capture the leading "/" character. The reason
6416/// is that the most common use case "{var}" does not capture the leading "/"
6417/// character. For consistency, all path variables must share the same behavior.
6418///
6419/// Repeated message fields must not be mapped to URL query parameters, because
6420/// no client library can support such complicated mapping.
6421///
6422/// If an API needs to use a JSON array for request or response body, it can map
6423/// the request or response body to a repeated field. However, some gRPC
6424/// Transcoding implementations may not support this feature.
6425///
6426/// [google.api.HttpRule.body]: crate::model::HttpRule::body
6427#[derive(Clone, Default, PartialEq)]
6428#[non_exhaustive]
6429pub struct HttpRule {
6430    /// Selects a method to which this rule applies.
6431    ///
6432    /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
6433    /// details.
6434    ///
6435    /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
6436    pub selector: std::string::String,
6437
6438    /// The name of the request field whose value is mapped to the HTTP request
6439    /// body, or `*` for mapping all request fields not captured by the path
6440    /// pattern to the HTTP body, or omitted for not having any HTTP request body.
6441    ///
6442    /// NOTE: the referred field must be present at the top-level of the request
6443    /// message type.
6444    pub body: std::string::String,
6445
6446    /// Optional. The name of the response field whose value is mapped to the HTTP
6447    /// response body. When omitted, the entire response message will be used
6448    /// as the HTTP response body.
6449    ///
6450    /// NOTE: The referred field must be present at the top-level of the response
6451    /// message type.
6452    pub response_body: std::string::String,
6453
6454    /// Additional HTTP bindings for the selector. Nested bindings must
6455    /// not contain an `additional_bindings` field themselves (that is,
6456    /// the nesting may only be one level deep).
6457    pub additional_bindings: std::vec::Vec<crate::model::HttpRule>,
6458
6459    /// Determines the URL pattern is matched by this rules. This pattern can be
6460    /// used with any of the {get|put|post|delete|patch} methods. A custom method
6461    /// can be defined using the 'custom' field.
6462    pub pattern: std::option::Option<crate::model::http_rule::Pattern>,
6463
6464    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6465}
6466
6467impl HttpRule {
6468    /// Creates a new default instance.
6469    pub fn new() -> Self {
6470        std::default::Default::default()
6471    }
6472
6473    /// Sets the value of [selector][crate::model::HttpRule::selector].
6474    ///
6475    /// # Example
6476    /// ```ignore,no_run
6477    /// # use google_cloud_api::model::HttpRule;
6478    /// let x = HttpRule::new().set_selector("example");
6479    /// ```
6480    pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6481        self.selector = v.into();
6482        self
6483    }
6484
6485    /// Sets the value of [body][crate::model::HttpRule::body].
6486    ///
6487    /// # Example
6488    /// ```ignore,no_run
6489    /// # use google_cloud_api::model::HttpRule;
6490    /// let x = HttpRule::new().set_body("example");
6491    /// ```
6492    pub fn set_body<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6493        self.body = v.into();
6494        self
6495    }
6496
6497    /// Sets the value of [response_body][crate::model::HttpRule::response_body].
6498    ///
6499    /// # Example
6500    /// ```ignore,no_run
6501    /// # use google_cloud_api::model::HttpRule;
6502    /// let x = HttpRule::new().set_response_body("example");
6503    /// ```
6504    pub fn set_response_body<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6505        self.response_body = v.into();
6506        self
6507    }
6508
6509    /// Sets the value of [additional_bindings][crate::model::HttpRule::additional_bindings].
6510    ///
6511    /// # Example
6512    /// ```ignore,no_run
6513    /// # use google_cloud_api::model::HttpRule;
6514    /// let x = HttpRule::new()
6515    ///     .set_additional_bindings([
6516    ///         HttpRule::default()/* use setters */,
6517    ///         HttpRule::default()/* use (different) setters */,
6518    ///     ]);
6519    /// ```
6520    pub fn set_additional_bindings<T, V>(mut self, v: T) -> Self
6521    where
6522        T: std::iter::IntoIterator<Item = V>,
6523        V: std::convert::Into<crate::model::HttpRule>,
6524    {
6525        use std::iter::Iterator;
6526        self.additional_bindings = v.into_iter().map(|i| i.into()).collect();
6527        self
6528    }
6529
6530    /// Sets the value of [pattern][crate::model::HttpRule::pattern].
6531    ///
6532    /// Note that all the setters affecting `pattern` are mutually
6533    /// exclusive.
6534    ///
6535    /// # Example
6536    /// ```ignore,no_run
6537    /// # use google_cloud_api::model::HttpRule;
6538    /// use google_cloud_api::model::http_rule::Pattern;
6539    /// let x = HttpRule::new().set_pattern(Some(Pattern::Get("example".to_string())));
6540    /// ```
6541    pub fn set_pattern<
6542        T: std::convert::Into<std::option::Option<crate::model::http_rule::Pattern>>,
6543    >(
6544        mut self,
6545        v: T,
6546    ) -> Self {
6547        self.pattern = v.into();
6548        self
6549    }
6550
6551    /// The value of [pattern][crate::model::HttpRule::pattern]
6552    /// if it holds a `Get`, `None` if the field is not set or
6553    /// holds a different branch.
6554    pub fn get(&self) -> std::option::Option<&std::string::String> {
6555        #[allow(unreachable_patterns)]
6556        self.pattern.as_ref().and_then(|v| match v {
6557            crate::model::http_rule::Pattern::Get(v) => std::option::Option::Some(v),
6558            _ => std::option::Option::None,
6559        })
6560    }
6561
6562    /// Sets the value of [pattern][crate::model::HttpRule::pattern]
6563    /// to hold a `Get`.
6564    ///
6565    /// Note that all the setters affecting `pattern` are
6566    /// mutually exclusive.
6567    ///
6568    /// # Example
6569    /// ```ignore,no_run
6570    /// # use google_cloud_api::model::HttpRule;
6571    /// let x = HttpRule::new().set_get("example");
6572    /// assert!(x.get().is_some());
6573    /// assert!(x.put().is_none());
6574    /// assert!(x.post().is_none());
6575    /// assert!(x.delete().is_none());
6576    /// assert!(x.patch().is_none());
6577    /// assert!(x.custom().is_none());
6578    /// ```
6579    pub fn set_get<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6580        self.pattern = std::option::Option::Some(crate::model::http_rule::Pattern::Get(v.into()));
6581        self
6582    }
6583
6584    /// The value of [pattern][crate::model::HttpRule::pattern]
6585    /// if it holds a `Put`, `None` if the field is not set or
6586    /// holds a different branch.
6587    pub fn put(&self) -> std::option::Option<&std::string::String> {
6588        #[allow(unreachable_patterns)]
6589        self.pattern.as_ref().and_then(|v| match v {
6590            crate::model::http_rule::Pattern::Put(v) => std::option::Option::Some(v),
6591            _ => std::option::Option::None,
6592        })
6593    }
6594
6595    /// Sets the value of [pattern][crate::model::HttpRule::pattern]
6596    /// to hold a `Put`.
6597    ///
6598    /// Note that all the setters affecting `pattern` are
6599    /// mutually exclusive.
6600    ///
6601    /// # Example
6602    /// ```ignore,no_run
6603    /// # use google_cloud_api::model::HttpRule;
6604    /// let x = HttpRule::new().set_put("example");
6605    /// assert!(x.put().is_some());
6606    /// assert!(x.get().is_none());
6607    /// assert!(x.post().is_none());
6608    /// assert!(x.delete().is_none());
6609    /// assert!(x.patch().is_none());
6610    /// assert!(x.custom().is_none());
6611    /// ```
6612    pub fn set_put<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6613        self.pattern = std::option::Option::Some(crate::model::http_rule::Pattern::Put(v.into()));
6614        self
6615    }
6616
6617    /// The value of [pattern][crate::model::HttpRule::pattern]
6618    /// if it holds a `Post`, `None` if the field is not set or
6619    /// holds a different branch.
6620    pub fn post(&self) -> std::option::Option<&std::string::String> {
6621        #[allow(unreachable_patterns)]
6622        self.pattern.as_ref().and_then(|v| match v {
6623            crate::model::http_rule::Pattern::Post(v) => std::option::Option::Some(v),
6624            _ => std::option::Option::None,
6625        })
6626    }
6627
6628    /// Sets the value of [pattern][crate::model::HttpRule::pattern]
6629    /// to hold a `Post`.
6630    ///
6631    /// Note that all the setters affecting `pattern` are
6632    /// mutually exclusive.
6633    ///
6634    /// # Example
6635    /// ```ignore,no_run
6636    /// # use google_cloud_api::model::HttpRule;
6637    /// let x = HttpRule::new().set_post("example");
6638    /// assert!(x.post().is_some());
6639    /// assert!(x.get().is_none());
6640    /// assert!(x.put().is_none());
6641    /// assert!(x.delete().is_none());
6642    /// assert!(x.patch().is_none());
6643    /// assert!(x.custom().is_none());
6644    /// ```
6645    pub fn set_post<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6646        self.pattern = std::option::Option::Some(crate::model::http_rule::Pattern::Post(v.into()));
6647        self
6648    }
6649
6650    /// The value of [pattern][crate::model::HttpRule::pattern]
6651    /// if it holds a `Delete`, `None` if the field is not set or
6652    /// holds a different branch.
6653    pub fn delete(&self) -> std::option::Option<&std::string::String> {
6654        #[allow(unreachable_patterns)]
6655        self.pattern.as_ref().and_then(|v| match v {
6656            crate::model::http_rule::Pattern::Delete(v) => std::option::Option::Some(v),
6657            _ => std::option::Option::None,
6658        })
6659    }
6660
6661    /// Sets the value of [pattern][crate::model::HttpRule::pattern]
6662    /// to hold a `Delete`.
6663    ///
6664    /// Note that all the setters affecting `pattern` are
6665    /// mutually exclusive.
6666    ///
6667    /// # Example
6668    /// ```ignore,no_run
6669    /// # use google_cloud_api::model::HttpRule;
6670    /// let x = HttpRule::new().set_delete("example");
6671    /// assert!(x.delete().is_some());
6672    /// assert!(x.get().is_none());
6673    /// assert!(x.put().is_none());
6674    /// assert!(x.post().is_none());
6675    /// assert!(x.patch().is_none());
6676    /// assert!(x.custom().is_none());
6677    /// ```
6678    pub fn set_delete<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6679        self.pattern =
6680            std::option::Option::Some(crate::model::http_rule::Pattern::Delete(v.into()));
6681        self
6682    }
6683
6684    /// The value of [pattern][crate::model::HttpRule::pattern]
6685    /// if it holds a `Patch`, `None` if the field is not set or
6686    /// holds a different branch.
6687    pub fn patch(&self) -> std::option::Option<&std::string::String> {
6688        #[allow(unreachable_patterns)]
6689        self.pattern.as_ref().and_then(|v| match v {
6690            crate::model::http_rule::Pattern::Patch(v) => std::option::Option::Some(v),
6691            _ => std::option::Option::None,
6692        })
6693    }
6694
6695    /// Sets the value of [pattern][crate::model::HttpRule::pattern]
6696    /// to hold a `Patch`.
6697    ///
6698    /// Note that all the setters affecting `pattern` are
6699    /// mutually exclusive.
6700    ///
6701    /// # Example
6702    /// ```ignore,no_run
6703    /// # use google_cloud_api::model::HttpRule;
6704    /// let x = HttpRule::new().set_patch("example");
6705    /// assert!(x.patch().is_some());
6706    /// assert!(x.get().is_none());
6707    /// assert!(x.put().is_none());
6708    /// assert!(x.post().is_none());
6709    /// assert!(x.delete().is_none());
6710    /// assert!(x.custom().is_none());
6711    /// ```
6712    pub fn set_patch<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6713        self.pattern = std::option::Option::Some(crate::model::http_rule::Pattern::Patch(v.into()));
6714        self
6715    }
6716
6717    /// The value of [pattern][crate::model::HttpRule::pattern]
6718    /// if it holds a `Custom`, `None` if the field is not set or
6719    /// holds a different branch.
6720    pub fn custom(&self) -> std::option::Option<&std::boxed::Box<crate::model::CustomHttpPattern>> {
6721        #[allow(unreachable_patterns)]
6722        self.pattern.as_ref().and_then(|v| match v {
6723            crate::model::http_rule::Pattern::Custom(v) => std::option::Option::Some(v),
6724            _ => std::option::Option::None,
6725        })
6726    }
6727
6728    /// Sets the value of [pattern][crate::model::HttpRule::pattern]
6729    /// to hold a `Custom`.
6730    ///
6731    /// Note that all the setters affecting `pattern` are
6732    /// mutually exclusive.
6733    ///
6734    /// # Example
6735    /// ```ignore,no_run
6736    /// # use google_cloud_api::model::HttpRule;
6737    /// use google_cloud_api::model::CustomHttpPattern;
6738    /// let x = HttpRule::new().set_custom(CustomHttpPattern::default()/* use setters */);
6739    /// assert!(x.custom().is_some());
6740    /// assert!(x.get().is_none());
6741    /// assert!(x.put().is_none());
6742    /// assert!(x.post().is_none());
6743    /// assert!(x.delete().is_none());
6744    /// assert!(x.patch().is_none());
6745    /// ```
6746    pub fn set_custom<T: std::convert::Into<std::boxed::Box<crate::model::CustomHttpPattern>>>(
6747        mut self,
6748        v: T,
6749    ) -> Self {
6750        self.pattern =
6751            std::option::Option::Some(crate::model::http_rule::Pattern::Custom(v.into()));
6752        self
6753    }
6754}
6755
6756impl wkt::message::Message for HttpRule {
6757    fn typename() -> &'static str {
6758        "type.googleapis.com/google.api.HttpRule"
6759    }
6760}
6761
6762/// Defines additional types related to [HttpRule].
6763pub mod http_rule {
6764    #[allow(unused_imports)]
6765    use super::*;
6766
6767    /// Determines the URL pattern is matched by this rules. This pattern can be
6768    /// used with any of the {get|put|post|delete|patch} methods. A custom method
6769    /// can be defined using the 'custom' field.
6770    #[derive(Clone, Debug, PartialEq)]
6771    #[non_exhaustive]
6772    pub enum Pattern {
6773        /// Maps to HTTP GET. Used for listing and getting information about
6774        /// resources.
6775        Get(std::string::String),
6776        /// Maps to HTTP PUT. Used for replacing a resource.
6777        Put(std::string::String),
6778        /// Maps to HTTP POST. Used for creating a resource or performing an action.
6779        Post(std::string::String),
6780        /// Maps to HTTP DELETE. Used for deleting a resource.
6781        Delete(std::string::String),
6782        /// Maps to HTTP PATCH. Used for updating a resource.
6783        Patch(std::string::String),
6784        /// The custom pattern is used for specifying an HTTP method that is not
6785        /// included in the `pattern` field, such as HEAD, or "*" to leave the
6786        /// HTTP method unspecified for this rule. The wild-card rule is useful
6787        /// for services that provide content to Web (HTML) clients.
6788        Custom(std::boxed::Box<crate::model::CustomHttpPattern>),
6789    }
6790}
6791
6792/// A custom pattern is used for defining custom HTTP verb.
6793#[derive(Clone, Default, PartialEq)]
6794#[non_exhaustive]
6795pub struct CustomHttpPattern {
6796    /// The name of this custom HTTP verb.
6797    pub kind: std::string::String,
6798
6799    /// The path matched by this custom verb.
6800    pub path: std::string::String,
6801
6802    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6803}
6804
6805impl CustomHttpPattern {
6806    /// Creates a new default instance.
6807    pub fn new() -> Self {
6808        std::default::Default::default()
6809    }
6810
6811    /// Sets the value of [kind][crate::model::CustomHttpPattern::kind].
6812    ///
6813    /// # Example
6814    /// ```ignore,no_run
6815    /// # use google_cloud_api::model::CustomHttpPattern;
6816    /// let x = CustomHttpPattern::new().set_kind("example");
6817    /// ```
6818    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6819        self.kind = v.into();
6820        self
6821    }
6822
6823    /// Sets the value of [path][crate::model::CustomHttpPattern::path].
6824    ///
6825    /// # Example
6826    /// ```ignore,no_run
6827    /// # use google_cloud_api::model::CustomHttpPattern;
6828    /// let x = CustomHttpPattern::new().set_path("example");
6829    /// ```
6830    pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6831        self.path = v.into();
6832        self
6833    }
6834}
6835
6836impl wkt::message::Message for CustomHttpPattern {
6837    fn typename() -> &'static str {
6838        "type.googleapis.com/google.api.CustomHttpPattern"
6839    }
6840}
6841
6842/// Message that represents an arbitrary HTTP body. It should only be used for
6843/// payload formats that can't be represented as JSON, such as raw binary or
6844/// an HTML page.
6845///
6846/// This message can be used both in streaming and non-streaming API methods in
6847/// the request as well as the response.
6848///
6849/// It can be used as a top-level request field, which is convenient if one
6850/// wants to extract parameters from either the URL or HTTP template into the
6851/// request fields and also want access to the raw HTTP body.
6852///
6853/// Example:
6854///
6855/// ```norust
6856/// message GetResourceRequest {
6857///   // A unique request id.
6858///   string request_id = 1;
6859///
6860///   // The raw HTTP body is bound to this field.
6861///   google.api.HttpBody http_body = 2;
6862///
6863/// }
6864///
6865/// service ResourceService {
6866///   rpc GetResource(GetResourceRequest)
6867///     returns (google.api.HttpBody);
6868///   rpc UpdateResource(google.api.HttpBody)
6869///     returns (google.protobuf.Empty);
6870///
6871/// }
6872/// ```
6873///
6874/// Example with streaming methods:
6875///
6876/// ```norust
6877/// service CaldavService {
6878///   rpc GetCalendar(stream google.api.HttpBody)
6879///     returns (stream google.api.HttpBody);
6880///   rpc UpdateCalendar(stream google.api.HttpBody)
6881///     returns (stream google.api.HttpBody);
6882///
6883/// }
6884/// ```
6885///
6886/// Use of this type only changes how the request and response bodies are
6887/// handled, all other features will continue to work unchanged.
6888#[derive(Clone, Default, PartialEq)]
6889#[non_exhaustive]
6890pub struct HttpBody {
6891    /// The HTTP Content-Type header value specifying the content type of the body.
6892    pub content_type: std::string::String,
6893
6894    /// The HTTP request/response body as raw binary.
6895    pub data: ::bytes::Bytes,
6896
6897    /// Application specific response metadata. Must be set in the first response
6898    /// for streaming APIs.
6899    pub extensions: std::vec::Vec<wkt::Any>,
6900
6901    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6902}
6903
6904impl HttpBody {
6905    /// Creates a new default instance.
6906    pub fn new() -> Self {
6907        std::default::Default::default()
6908    }
6909
6910    /// Sets the value of [content_type][crate::model::HttpBody::content_type].
6911    ///
6912    /// # Example
6913    /// ```ignore,no_run
6914    /// # use google_cloud_api::model::HttpBody;
6915    /// let x = HttpBody::new().set_content_type("example");
6916    /// ```
6917    pub fn set_content_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6918        self.content_type = v.into();
6919        self
6920    }
6921
6922    /// Sets the value of [data][crate::model::HttpBody::data].
6923    ///
6924    /// # Example
6925    /// ```ignore,no_run
6926    /// # use google_cloud_api::model::HttpBody;
6927    /// let x = HttpBody::new().set_data(bytes::Bytes::from_static(b"example"));
6928    /// ```
6929    pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
6930        self.data = v.into();
6931        self
6932    }
6933
6934    /// Sets the value of [extensions][crate::model::HttpBody::extensions].
6935    ///
6936    /// # Example
6937    /// ```ignore,no_run
6938    /// # use google_cloud_api::model::HttpBody;
6939    /// use wkt::Any;
6940    /// let x = HttpBody::new()
6941    ///     .set_extensions([
6942    ///         Any::default()/* use setters */,
6943    ///         Any::default()/* use (different) setters */,
6944    ///     ]);
6945    /// ```
6946    pub fn set_extensions<T, V>(mut self, v: T) -> Self
6947    where
6948        T: std::iter::IntoIterator<Item = V>,
6949        V: std::convert::Into<wkt::Any>,
6950    {
6951        use std::iter::Iterator;
6952        self.extensions = v.into_iter().map(|i| i.into()).collect();
6953        self
6954    }
6955}
6956
6957impl wkt::message::Message for HttpBody {
6958    fn typename() -> &'static str {
6959        "type.googleapis.com/google.api.HttpBody"
6960    }
6961}
6962
6963/// A description of a label.
6964#[derive(Clone, Default, PartialEq)]
6965#[non_exhaustive]
6966pub struct LabelDescriptor {
6967    /// The label key.
6968    pub key: std::string::String,
6969
6970    /// The type of data that can be assigned to the label.
6971    pub value_type: crate::model::label_descriptor::ValueType,
6972
6973    /// A human-readable description for the label.
6974    pub description: std::string::String,
6975
6976    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6977}
6978
6979impl LabelDescriptor {
6980    /// Creates a new default instance.
6981    pub fn new() -> Self {
6982        std::default::Default::default()
6983    }
6984
6985    /// Sets the value of [key][crate::model::LabelDescriptor::key].
6986    ///
6987    /// # Example
6988    /// ```ignore,no_run
6989    /// # use google_cloud_api::model::LabelDescriptor;
6990    /// let x = LabelDescriptor::new().set_key("example");
6991    /// ```
6992    pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6993        self.key = v.into();
6994        self
6995    }
6996
6997    /// Sets the value of [value_type][crate::model::LabelDescriptor::value_type].
6998    ///
6999    /// # Example
7000    /// ```ignore,no_run
7001    /// # use google_cloud_api::model::LabelDescriptor;
7002    /// use google_cloud_api::model::label_descriptor::ValueType;
7003    /// let x0 = LabelDescriptor::new().set_value_type(ValueType::Bool);
7004    /// let x1 = LabelDescriptor::new().set_value_type(ValueType::Int64);
7005    /// ```
7006    pub fn set_value_type<T: std::convert::Into<crate::model::label_descriptor::ValueType>>(
7007        mut self,
7008        v: T,
7009    ) -> Self {
7010        self.value_type = v.into();
7011        self
7012    }
7013
7014    /// Sets the value of [description][crate::model::LabelDescriptor::description].
7015    ///
7016    /// # Example
7017    /// ```ignore,no_run
7018    /// # use google_cloud_api::model::LabelDescriptor;
7019    /// let x = LabelDescriptor::new().set_description("example");
7020    /// ```
7021    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7022        self.description = v.into();
7023        self
7024    }
7025}
7026
7027impl wkt::message::Message for LabelDescriptor {
7028    fn typename() -> &'static str {
7029        "type.googleapis.com/google.api.LabelDescriptor"
7030    }
7031}
7032
7033/// Defines additional types related to [LabelDescriptor].
7034pub mod label_descriptor {
7035    #[allow(unused_imports)]
7036    use super::*;
7037
7038    /// Value types that can be used as label values.
7039    ///
7040    /// # Working with unknown values
7041    ///
7042    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7043    /// additional enum variants at any time. Adding new variants is not considered
7044    /// a breaking change. Applications should write their code in anticipation of:
7045    ///
7046    /// - New values appearing in future releases of the client library, **and**
7047    /// - New values received dynamically, without application changes.
7048    ///
7049    /// Please consult the [Working with enums] section in the user guide for some
7050    /// guidelines.
7051    ///
7052    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
7053    #[derive(Clone, Debug, PartialEq)]
7054    #[non_exhaustive]
7055    pub enum ValueType {
7056        /// A variable-length string. This is the default.
7057        String,
7058        /// Boolean; true or false.
7059        Bool,
7060        /// A 64-bit signed integer.
7061        Int64,
7062        /// If set, the enum was initialized with an unknown value.
7063        ///
7064        /// Applications can examine the value using [ValueType::value] or
7065        /// [ValueType::name].
7066        UnknownValue(value_type::UnknownValue),
7067    }
7068
7069    #[doc(hidden)]
7070    pub mod value_type {
7071        #[allow(unused_imports)]
7072        use super::*;
7073        #[derive(Clone, Debug, PartialEq)]
7074        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7075    }
7076
7077    impl ValueType {
7078        /// Gets the enum value.
7079        ///
7080        /// Returns `None` if the enum contains an unknown value deserialized from
7081        /// the string representation of enums.
7082        pub fn value(&self) -> std::option::Option<i32> {
7083            match self {
7084                Self::String => std::option::Option::Some(0),
7085                Self::Bool => std::option::Option::Some(1),
7086                Self::Int64 => std::option::Option::Some(2),
7087                Self::UnknownValue(u) => u.0.value(),
7088            }
7089        }
7090
7091        /// Gets the enum value as a string.
7092        ///
7093        /// Returns `None` if the enum contains an unknown value deserialized from
7094        /// the integer representation of enums.
7095        pub fn name(&self) -> std::option::Option<&str> {
7096            match self {
7097                Self::String => std::option::Option::Some("STRING"),
7098                Self::Bool => std::option::Option::Some("BOOL"),
7099                Self::Int64 => std::option::Option::Some("INT64"),
7100                Self::UnknownValue(u) => u.0.name(),
7101            }
7102        }
7103    }
7104
7105    impl std::default::Default for ValueType {
7106        fn default() -> Self {
7107            use std::convert::From;
7108            Self::from(0)
7109        }
7110    }
7111
7112    impl std::fmt::Display for ValueType {
7113        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7114            wkt::internal::display_enum(f, self.name(), self.value())
7115        }
7116    }
7117
7118    impl std::convert::From<i32> for ValueType {
7119        fn from(value: i32) -> Self {
7120            match value {
7121                0 => Self::String,
7122                1 => Self::Bool,
7123                2 => Self::Int64,
7124                _ => Self::UnknownValue(value_type::UnknownValue(
7125                    wkt::internal::UnknownEnumValue::Integer(value),
7126                )),
7127            }
7128        }
7129    }
7130
7131    impl std::convert::From<&str> for ValueType {
7132        fn from(value: &str) -> Self {
7133            use std::string::ToString;
7134            match value {
7135                "STRING" => Self::String,
7136                "BOOL" => Self::Bool,
7137                "INT64" => Self::Int64,
7138                _ => Self::UnknownValue(value_type::UnknownValue(
7139                    wkt::internal::UnknownEnumValue::String(value.to_string()),
7140                )),
7141            }
7142        }
7143    }
7144
7145    impl serde::ser::Serialize for ValueType {
7146        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7147        where
7148            S: serde::Serializer,
7149        {
7150            match self {
7151                Self::String => serializer.serialize_i32(0),
7152                Self::Bool => serializer.serialize_i32(1),
7153                Self::Int64 => serializer.serialize_i32(2),
7154                Self::UnknownValue(u) => u.0.serialize(serializer),
7155            }
7156        }
7157    }
7158
7159    impl<'de> serde::de::Deserialize<'de> for ValueType {
7160        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7161        where
7162            D: serde::Deserializer<'de>,
7163        {
7164            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ValueType>::new(
7165                ".google.api.LabelDescriptor.ValueType",
7166            ))
7167        }
7168    }
7169}
7170
7171/// A description of a log type. Example in YAML format:
7172///
7173/// ```norust
7174/// - name: library.googleapis.com/activity_history
7175///   description: The history of borrowing and returning library items.
7176///   display_name: Activity
7177///   labels:
7178///   - key: /customer_id
7179///     description: Identifier of a library customer
7180/// ```
7181#[derive(Clone, Default, PartialEq)]
7182#[non_exhaustive]
7183pub struct LogDescriptor {
7184    /// The name of the log. It must be less than 512 characters long and can
7185    /// include the following characters: upper- and lower-case alphanumeric
7186    /// characters [A-Za-z0-9], and punctuation characters including
7187    /// slash, underscore, hyphen, period [/_-.].
7188    pub name: std::string::String,
7189
7190    /// The set of labels that are available to describe a specific log entry.
7191    /// Runtime requests that contain labels not specified here are
7192    /// considered invalid.
7193    pub labels: std::vec::Vec<crate::model::LabelDescriptor>,
7194
7195    /// A human-readable description of this log. This information appears in
7196    /// the documentation and can contain details.
7197    pub description: std::string::String,
7198
7199    /// The human-readable name for this log. This information appears on
7200    /// the user interface and should be concise.
7201    pub display_name: std::string::String,
7202
7203    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7204}
7205
7206impl LogDescriptor {
7207    /// Creates a new default instance.
7208    pub fn new() -> Self {
7209        std::default::Default::default()
7210    }
7211
7212    /// Sets the value of [name][crate::model::LogDescriptor::name].
7213    ///
7214    /// # Example
7215    /// ```ignore,no_run
7216    /// # use google_cloud_api::model::LogDescriptor;
7217    /// let x = LogDescriptor::new().set_name("example");
7218    /// ```
7219    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7220        self.name = v.into();
7221        self
7222    }
7223
7224    /// Sets the value of [labels][crate::model::LogDescriptor::labels].
7225    ///
7226    /// # Example
7227    /// ```ignore,no_run
7228    /// # use google_cloud_api::model::LogDescriptor;
7229    /// use google_cloud_api::model::LabelDescriptor;
7230    /// let x = LogDescriptor::new()
7231    ///     .set_labels([
7232    ///         LabelDescriptor::default()/* use setters */,
7233    ///         LabelDescriptor::default()/* use (different) setters */,
7234    ///     ]);
7235    /// ```
7236    pub fn set_labels<T, V>(mut self, v: T) -> Self
7237    where
7238        T: std::iter::IntoIterator<Item = V>,
7239        V: std::convert::Into<crate::model::LabelDescriptor>,
7240    {
7241        use std::iter::Iterator;
7242        self.labels = v.into_iter().map(|i| i.into()).collect();
7243        self
7244    }
7245
7246    /// Sets the value of [description][crate::model::LogDescriptor::description].
7247    ///
7248    /// # Example
7249    /// ```ignore,no_run
7250    /// # use google_cloud_api::model::LogDescriptor;
7251    /// let x = LogDescriptor::new().set_description("example");
7252    /// ```
7253    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7254        self.description = v.into();
7255        self
7256    }
7257
7258    /// Sets the value of [display_name][crate::model::LogDescriptor::display_name].
7259    ///
7260    /// # Example
7261    /// ```ignore,no_run
7262    /// # use google_cloud_api::model::LogDescriptor;
7263    /// let x = LogDescriptor::new().set_display_name("example");
7264    /// ```
7265    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7266        self.display_name = v.into();
7267        self
7268    }
7269}
7270
7271impl wkt::message::Message for LogDescriptor {
7272    fn typename() -> &'static str {
7273        "type.googleapis.com/google.api.LogDescriptor"
7274    }
7275}
7276
7277/// Logging configuration of the service.
7278///
7279/// The following example shows how to configure logs to be sent to the
7280/// producer and consumer projects. In the example, the `activity_history`
7281/// log is sent to both the producer and consumer projects, whereas the
7282/// `purchase_history` log is only sent to the producer project.
7283///
7284/// ```norust
7285/// monitored_resources:
7286/// - type: library.googleapis.com/branch
7287///   labels:
7288///   - key: /city
7289///     description: The city where the library branch is located in.
7290///   - key: /name
7291///     description: The name of the branch.
7292/// logs:
7293/// - name: activity_history
7294///   labels:
7295///   - key: /customer_id
7296/// - name: purchase_history
7297/// logging:
7298///   producer_destinations:
7299///   - monitored_resource: library.googleapis.com/branch
7300///     logs:
7301///     - activity_history
7302///     - purchase_history
7303///   consumer_destinations:
7304///   - monitored_resource: library.googleapis.com/branch
7305///     logs:
7306///     - activity_history
7307/// ```
7308#[derive(Clone, Default, PartialEq)]
7309#[non_exhaustive]
7310pub struct Logging {
7311    /// Logging configurations for sending logs to the producer project.
7312    /// There can be multiple producer destinations, each one must have a
7313    /// different monitored resource type. A log can be used in at most
7314    /// one producer destination.
7315    pub producer_destinations: std::vec::Vec<crate::model::logging::LoggingDestination>,
7316
7317    /// Logging configurations for sending logs to the consumer project.
7318    /// There can be multiple consumer destinations, each one must have a
7319    /// different monitored resource type. A log can be used in at most
7320    /// one consumer destination.
7321    pub consumer_destinations: std::vec::Vec<crate::model::logging::LoggingDestination>,
7322
7323    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7324}
7325
7326impl Logging {
7327    /// Creates a new default instance.
7328    pub fn new() -> Self {
7329        std::default::Default::default()
7330    }
7331
7332    /// Sets the value of [producer_destinations][crate::model::Logging::producer_destinations].
7333    ///
7334    /// # Example
7335    /// ```ignore,no_run
7336    /// # use google_cloud_api::model::Logging;
7337    /// use google_cloud_api::model::logging::LoggingDestination;
7338    /// let x = Logging::new()
7339    ///     .set_producer_destinations([
7340    ///         LoggingDestination::default()/* use setters */,
7341    ///         LoggingDestination::default()/* use (different) setters */,
7342    ///     ]);
7343    /// ```
7344    pub fn set_producer_destinations<T, V>(mut self, v: T) -> Self
7345    where
7346        T: std::iter::IntoIterator<Item = V>,
7347        V: std::convert::Into<crate::model::logging::LoggingDestination>,
7348    {
7349        use std::iter::Iterator;
7350        self.producer_destinations = v.into_iter().map(|i| i.into()).collect();
7351        self
7352    }
7353
7354    /// Sets the value of [consumer_destinations][crate::model::Logging::consumer_destinations].
7355    ///
7356    /// # Example
7357    /// ```ignore,no_run
7358    /// # use google_cloud_api::model::Logging;
7359    /// use google_cloud_api::model::logging::LoggingDestination;
7360    /// let x = Logging::new()
7361    ///     .set_consumer_destinations([
7362    ///         LoggingDestination::default()/* use setters */,
7363    ///         LoggingDestination::default()/* use (different) setters */,
7364    ///     ]);
7365    /// ```
7366    pub fn set_consumer_destinations<T, V>(mut self, v: T) -> Self
7367    where
7368        T: std::iter::IntoIterator<Item = V>,
7369        V: std::convert::Into<crate::model::logging::LoggingDestination>,
7370    {
7371        use std::iter::Iterator;
7372        self.consumer_destinations = v.into_iter().map(|i| i.into()).collect();
7373        self
7374    }
7375}
7376
7377impl wkt::message::Message for Logging {
7378    fn typename() -> &'static str {
7379        "type.googleapis.com/google.api.Logging"
7380    }
7381}
7382
7383/// Defines additional types related to [Logging].
7384pub mod logging {
7385    #[allow(unused_imports)]
7386    use super::*;
7387
7388    /// Configuration of a specific logging destination (the producer project
7389    /// or the consumer project).
7390    #[derive(Clone, Default, PartialEq)]
7391    #[non_exhaustive]
7392    pub struct LoggingDestination {
7393        /// The monitored resource type. The type must be defined in the
7394        /// [Service.monitored_resources][google.api.Service.monitored_resources]
7395        /// section.
7396        ///
7397        /// [google.api.Service.monitored_resources]: crate::model::Service::monitored_resources
7398        pub monitored_resource: std::string::String,
7399
7400        /// Names of the logs to be sent to this destination. Each name must
7401        /// be defined in the [Service.logs][google.api.Service.logs] section. If the
7402        /// log name is not a domain scoped name, it will be automatically prefixed
7403        /// with the service name followed by "/".
7404        ///
7405        /// [google.api.Service.logs]: crate::model::Service::logs
7406        pub logs: std::vec::Vec<std::string::String>,
7407
7408        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7409    }
7410
7411    impl LoggingDestination {
7412        /// Creates a new default instance.
7413        pub fn new() -> Self {
7414            std::default::Default::default()
7415        }
7416
7417        /// Sets the value of [monitored_resource][crate::model::logging::LoggingDestination::monitored_resource].
7418        ///
7419        /// # Example
7420        /// ```ignore,no_run
7421        /// # use google_cloud_api::model::logging::LoggingDestination;
7422        /// let x = LoggingDestination::new().set_monitored_resource("example");
7423        /// ```
7424        pub fn set_monitored_resource<T: std::convert::Into<std::string::String>>(
7425            mut self,
7426            v: T,
7427        ) -> Self {
7428            self.monitored_resource = v.into();
7429            self
7430        }
7431
7432        /// Sets the value of [logs][crate::model::logging::LoggingDestination::logs].
7433        ///
7434        /// # Example
7435        /// ```ignore,no_run
7436        /// # use google_cloud_api::model::logging::LoggingDestination;
7437        /// let x = LoggingDestination::new().set_logs(["a", "b", "c"]);
7438        /// ```
7439        pub fn set_logs<T, V>(mut self, v: T) -> Self
7440        where
7441            T: std::iter::IntoIterator<Item = V>,
7442            V: std::convert::Into<std::string::String>,
7443        {
7444            use std::iter::Iterator;
7445            self.logs = v.into_iter().map(|i| i.into()).collect();
7446            self
7447        }
7448    }
7449
7450    impl wkt::message::Message for LoggingDestination {
7451        fn typename() -> &'static str {
7452            "type.googleapis.com/google.api.Logging.LoggingDestination"
7453        }
7454    }
7455}
7456
7457/// Defines a metric type and its schema. Once a metric descriptor is created,
7458/// deleting or altering it stops data collection and makes the metric type's
7459/// existing data unusable.
7460#[derive(Clone, Default, PartialEq)]
7461#[non_exhaustive]
7462pub struct MetricDescriptor {
7463    /// The resource name of the metric descriptor.
7464    pub name: std::string::String,
7465
7466    /// The metric type, including its DNS name prefix. The type is not
7467    /// URL-encoded. All user-defined metric types have the DNS name
7468    /// `custom.googleapis.com` or `external.googleapis.com`. Metric types should
7469    /// use a natural hierarchical grouping. For example:
7470    ///
7471    /// ```norust
7472    /// "custom.googleapis.com/invoice/paid/amount"
7473    /// "external.googleapis.com/prometheus/up"
7474    /// "appengine.googleapis.com/http/server/response_latencies"
7475    /// ```
7476    pub r#type: std::string::String,
7477
7478    /// The set of labels that can be used to describe a specific
7479    /// instance of this metric type. For example, the
7480    /// `appengine.googleapis.com/http/server/response_latencies` metric
7481    /// type has a label for the HTTP response code, `response_code`, so
7482    /// you can look at latencies for successful responses or just
7483    /// for responses that failed.
7484    pub labels: std::vec::Vec<crate::model::LabelDescriptor>,
7485
7486    /// Whether the metric records instantaneous values, changes to a value, etc.
7487    /// Some combinations of `metric_kind` and `value_type` might not be supported.
7488    pub metric_kind: crate::model::metric_descriptor::MetricKind,
7489
7490    /// Whether the measurement is an integer, a floating-point number, etc.
7491    /// Some combinations of `metric_kind` and `value_type` might not be supported.
7492    pub value_type: crate::model::metric_descriptor::ValueType,
7493
7494    /// The units in which the metric value is reported. It is only applicable
7495    /// if the `value_type` is `INT64`, `DOUBLE`, or `DISTRIBUTION`. The `unit`
7496    /// defines the representation of the stored metric values.
7497    ///
7498    /// Different systems might scale the values to be more easily displayed (so a
7499    /// value of `0.02kBy` _might_ be displayed as `20By`, and a value of
7500    /// `3523kBy` _might_ be displayed as `3.5MBy`). However, if the `unit` is
7501    /// `kBy`, then the value of the metric is always in thousands of bytes, no
7502    /// matter how it might be displayed.
7503    ///
7504    /// If you want a custom metric to record the exact number of CPU-seconds used
7505    /// by a job, you can create an `INT64 CUMULATIVE` metric whose `unit` is
7506    /// `s{CPU}` (or equivalently `1s{CPU}` or just `s`). If the job uses 12,005
7507    /// CPU-seconds, then the value is written as `12005`.
7508    ///
7509    /// Alternatively, if you want a custom metric to record data in a more
7510    /// granular way, you can create a `DOUBLE CUMULATIVE` metric whose `unit` is
7511    /// `ks{CPU}`, and then write the value `12.005` (which is `12005/1000`),
7512    /// or use `Kis{CPU}` and write `11.723` (which is `12005/1024`).
7513    ///
7514    /// The supported units are a subset of [The Unified Code for Units of
7515    /// Measure](https://unitsofmeasure.org/ucum.html) standard:
7516    ///
7517    /// **Basic units (UNIT)**
7518    ///
7519    /// * `bit`   bit
7520    /// * `By`    byte
7521    /// * `s`     second
7522    /// * `min`   minute
7523    /// * `h`     hour
7524    /// * `d`     day
7525    /// * `1`     dimensionless
7526    ///
7527    /// **Prefixes (PREFIX)**
7528    ///
7529    /// * `k`     kilo    (10^3)
7530    ///
7531    /// * `M`     mega    (10^6)
7532    ///
7533    /// * `G`     giga    (10^9)
7534    ///
7535    /// * `T`     tera    (10^12)
7536    ///
7537    /// * `P`     peta    (10^15)
7538    ///
7539    /// * `E`     exa     (10^18)
7540    ///
7541    /// * `Z`     zetta   (10^21)
7542    ///
7543    /// * `Y`     yotta   (10^24)
7544    ///
7545    /// * `m`     milli   (10^-3)
7546    ///
7547    /// * `u`     micro   (10^-6)
7548    ///
7549    /// * `n`     nano    (10^-9)
7550    ///
7551    /// * `p`     pico    (10^-12)
7552    ///
7553    /// * `f`     femto   (10^-15)
7554    ///
7555    /// * `a`     atto    (10^-18)
7556    ///
7557    /// * `z`     zepto   (10^-21)
7558    ///
7559    /// * `y`     yocto   (10^-24)
7560    ///
7561    /// * `Ki`    kibi    (2^10)
7562    ///
7563    /// * `Mi`    mebi    (2^20)
7564    ///
7565    /// * `Gi`    gibi    (2^30)
7566    ///
7567    /// * `Ti`    tebi    (2^40)
7568    ///
7569    /// * `Pi`    pebi    (2^50)
7570    ///
7571    ///
7572    /// **Grammar**
7573    ///
7574    /// The grammar also includes these connectors:
7575    ///
7576    /// * `/`    division or ratio (as an infix operator). For examples,
7577    ///   `kBy/{email}` or `MiBy/10ms` (although you should almost never
7578    ///   have `/s` in a metric `unit`; rates should always be computed at
7579    ///   query time from the underlying cumulative or delta value).
7580    /// * `.`    multiplication or composition (as an infix operator). For
7581    ///   examples, `GBy.d` or `k{watt}.h`.
7582    ///
7583    /// The grammar for a unit is as follows:
7584    ///
7585    /// ```norust
7586    /// Expression = Component { "." Component } { "/" Component } ;
7587    ///
7588    /// Component = ( [ PREFIX ] UNIT | "%" ) [ Annotation ]
7589    ///           | Annotation
7590    ///           | "1"
7591    ///           ;
7592    ///
7593    /// Annotation = "{" NAME "}" ;
7594    /// ```
7595    ///
7596    /// Notes:
7597    ///
7598    /// * `Annotation` is just a comment if it follows a `UNIT`. If the annotation
7599    ///   is used alone, then the unit is equivalent to `1`. For examples,
7600    ///   `{request}/s == 1/s`, `By{transmitted}/s == By/s`.
7601    /// * `NAME` is a sequence of non-blank printable ASCII characters not
7602    ///   containing `{` or `}`.
7603    /// * `1` represents a unitary [dimensionless
7604    ///   unit](https://en.wikipedia.org/wiki/Dimensionless_quantity) of 1, such
7605    ///   as in `1/s`. It is typically used when none of the basic units are
7606    ///   appropriate. For example, "new users per day" can be represented as
7607    ///   `1/d` or `{new-users}/d` (and a metric value `5` would mean "5 new
7608    ///   users). Alternatively, "thousands of page views per day" would be
7609    ///   represented as `1000/d` or `k1/d` or `k{page_views}/d` (and a metric
7610    ///   value of `5.3` would mean "5300 page views per day").
7611    /// * `%` represents dimensionless value of 1/100, and annotates values giving
7612    ///   a percentage (so the metric values are typically in the range of 0..100,
7613    ///   and a metric value `3` means "3 percent").
7614    /// * `10^2.%` indicates a metric contains a ratio, typically in the range
7615    ///   0..1, that will be multiplied by 100 and displayed as a percentage
7616    ///   (so a metric value `0.03` means "3 percent").
7617    pub unit: std::string::String,
7618
7619    /// A detailed description of the metric, which can be used in documentation.
7620    pub description: std::string::String,
7621
7622    /// A concise name for the metric, which can be displayed in user interfaces.
7623    /// Use sentence case without an ending period, for example "Request count".
7624    /// This field is optional but it is recommended to be set for any metrics
7625    /// associated with user-visible concepts, such as Quota.
7626    pub display_name: std::string::String,
7627
7628    /// Optional. Metadata which can be used to guide usage of the metric.
7629    pub metadata: std::option::Option<crate::model::metric_descriptor::MetricDescriptorMetadata>,
7630
7631    /// Optional. The launch stage of the metric definition.
7632    pub launch_stage: crate::model::LaunchStage,
7633
7634    /// Read-only. If present, then a [time
7635    /// series][google.monitoring.v3.TimeSeries], which is identified partially by
7636    /// a metric type and a
7637    /// [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor], that
7638    /// is associated with this metric type can only be associated with one of the
7639    /// monitored resource types listed here.
7640    ///
7641    /// [google.api.MonitoredResourceDescriptor]: crate::model::MonitoredResourceDescriptor
7642    pub monitored_resource_types: std::vec::Vec<std::string::String>,
7643
7644    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7645}
7646
7647impl MetricDescriptor {
7648    /// Creates a new default instance.
7649    pub fn new() -> Self {
7650        std::default::Default::default()
7651    }
7652
7653    /// Sets the value of [name][crate::model::MetricDescriptor::name].
7654    ///
7655    /// # Example
7656    /// ```ignore,no_run
7657    /// # use google_cloud_api::model::MetricDescriptor;
7658    /// let x = MetricDescriptor::new().set_name("example");
7659    /// ```
7660    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7661        self.name = v.into();
7662        self
7663    }
7664
7665    /// Sets the value of [r#type][crate::model::MetricDescriptor::type].
7666    ///
7667    /// # Example
7668    /// ```ignore,no_run
7669    /// # use google_cloud_api::model::MetricDescriptor;
7670    /// let x = MetricDescriptor::new().set_type("example");
7671    /// ```
7672    pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7673        self.r#type = v.into();
7674        self
7675    }
7676
7677    /// Sets the value of [labels][crate::model::MetricDescriptor::labels].
7678    ///
7679    /// # Example
7680    /// ```ignore,no_run
7681    /// # use google_cloud_api::model::MetricDescriptor;
7682    /// use google_cloud_api::model::LabelDescriptor;
7683    /// let x = MetricDescriptor::new()
7684    ///     .set_labels([
7685    ///         LabelDescriptor::default()/* use setters */,
7686    ///         LabelDescriptor::default()/* use (different) setters */,
7687    ///     ]);
7688    /// ```
7689    pub fn set_labels<T, V>(mut self, v: T) -> Self
7690    where
7691        T: std::iter::IntoIterator<Item = V>,
7692        V: std::convert::Into<crate::model::LabelDescriptor>,
7693    {
7694        use std::iter::Iterator;
7695        self.labels = v.into_iter().map(|i| i.into()).collect();
7696        self
7697    }
7698
7699    /// Sets the value of [metric_kind][crate::model::MetricDescriptor::metric_kind].
7700    ///
7701    /// # Example
7702    /// ```ignore,no_run
7703    /// # use google_cloud_api::model::MetricDescriptor;
7704    /// use google_cloud_api::model::metric_descriptor::MetricKind;
7705    /// let x0 = MetricDescriptor::new().set_metric_kind(MetricKind::Gauge);
7706    /// let x1 = MetricDescriptor::new().set_metric_kind(MetricKind::Delta);
7707    /// let x2 = MetricDescriptor::new().set_metric_kind(MetricKind::Cumulative);
7708    /// ```
7709    pub fn set_metric_kind<T: std::convert::Into<crate::model::metric_descriptor::MetricKind>>(
7710        mut self,
7711        v: T,
7712    ) -> Self {
7713        self.metric_kind = v.into();
7714        self
7715    }
7716
7717    /// Sets the value of [value_type][crate::model::MetricDescriptor::value_type].
7718    ///
7719    /// # Example
7720    /// ```ignore,no_run
7721    /// # use google_cloud_api::model::MetricDescriptor;
7722    /// use google_cloud_api::model::metric_descriptor::ValueType;
7723    /// let x0 = MetricDescriptor::new().set_value_type(ValueType::Bool);
7724    /// let x1 = MetricDescriptor::new().set_value_type(ValueType::Int64);
7725    /// let x2 = MetricDescriptor::new().set_value_type(ValueType::Double);
7726    /// ```
7727    pub fn set_value_type<T: std::convert::Into<crate::model::metric_descriptor::ValueType>>(
7728        mut self,
7729        v: T,
7730    ) -> Self {
7731        self.value_type = v.into();
7732        self
7733    }
7734
7735    /// Sets the value of [unit][crate::model::MetricDescriptor::unit].
7736    ///
7737    /// # Example
7738    /// ```ignore,no_run
7739    /// # use google_cloud_api::model::MetricDescriptor;
7740    /// let x = MetricDescriptor::new().set_unit("example");
7741    /// ```
7742    pub fn set_unit<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7743        self.unit = v.into();
7744        self
7745    }
7746
7747    /// Sets the value of [description][crate::model::MetricDescriptor::description].
7748    ///
7749    /// # Example
7750    /// ```ignore,no_run
7751    /// # use google_cloud_api::model::MetricDescriptor;
7752    /// let x = MetricDescriptor::new().set_description("example");
7753    /// ```
7754    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7755        self.description = v.into();
7756        self
7757    }
7758
7759    /// Sets the value of [display_name][crate::model::MetricDescriptor::display_name].
7760    ///
7761    /// # Example
7762    /// ```ignore,no_run
7763    /// # use google_cloud_api::model::MetricDescriptor;
7764    /// let x = MetricDescriptor::new().set_display_name("example");
7765    /// ```
7766    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7767        self.display_name = v.into();
7768        self
7769    }
7770
7771    /// Sets the value of [metadata][crate::model::MetricDescriptor::metadata].
7772    ///
7773    /// # Example
7774    /// ```ignore,no_run
7775    /// # use google_cloud_api::model::MetricDescriptor;
7776    /// use google_cloud_api::model::metric_descriptor::MetricDescriptorMetadata;
7777    /// let x = MetricDescriptor::new().set_metadata(MetricDescriptorMetadata::default()/* use setters */);
7778    /// ```
7779    pub fn set_metadata<T>(mut self, v: T) -> Self
7780    where
7781        T: std::convert::Into<crate::model::metric_descriptor::MetricDescriptorMetadata>,
7782    {
7783        self.metadata = std::option::Option::Some(v.into());
7784        self
7785    }
7786
7787    /// Sets or clears the value of [metadata][crate::model::MetricDescriptor::metadata].
7788    ///
7789    /// # Example
7790    /// ```ignore,no_run
7791    /// # use google_cloud_api::model::MetricDescriptor;
7792    /// use google_cloud_api::model::metric_descriptor::MetricDescriptorMetadata;
7793    /// let x = MetricDescriptor::new().set_or_clear_metadata(Some(MetricDescriptorMetadata::default()/* use setters */));
7794    /// let x = MetricDescriptor::new().set_or_clear_metadata(None::<MetricDescriptorMetadata>);
7795    /// ```
7796    pub fn set_or_clear_metadata<T>(mut self, v: std::option::Option<T>) -> Self
7797    where
7798        T: std::convert::Into<crate::model::metric_descriptor::MetricDescriptorMetadata>,
7799    {
7800        self.metadata = v.map(|x| x.into());
7801        self
7802    }
7803
7804    /// Sets the value of [launch_stage][crate::model::MetricDescriptor::launch_stage].
7805    ///
7806    /// # Example
7807    /// ```ignore,no_run
7808    /// # use google_cloud_api::model::MetricDescriptor;
7809    /// use google_cloud_api::model::LaunchStage;
7810    /// let x0 = MetricDescriptor::new().set_launch_stage(LaunchStage::Unimplemented);
7811    /// let x1 = MetricDescriptor::new().set_launch_stage(LaunchStage::Prelaunch);
7812    /// let x2 = MetricDescriptor::new().set_launch_stage(LaunchStage::EarlyAccess);
7813    /// ```
7814    pub fn set_launch_stage<T: std::convert::Into<crate::model::LaunchStage>>(
7815        mut self,
7816        v: T,
7817    ) -> Self {
7818        self.launch_stage = v.into();
7819        self
7820    }
7821
7822    /// Sets the value of [monitored_resource_types][crate::model::MetricDescriptor::monitored_resource_types].
7823    ///
7824    /// # Example
7825    /// ```ignore,no_run
7826    /// # use google_cloud_api::model::MetricDescriptor;
7827    /// let x = MetricDescriptor::new().set_monitored_resource_types(["a", "b", "c"]);
7828    /// ```
7829    pub fn set_monitored_resource_types<T, V>(mut self, v: T) -> Self
7830    where
7831        T: std::iter::IntoIterator<Item = V>,
7832        V: std::convert::Into<std::string::String>,
7833    {
7834        use std::iter::Iterator;
7835        self.monitored_resource_types = v.into_iter().map(|i| i.into()).collect();
7836        self
7837    }
7838}
7839
7840impl wkt::message::Message for MetricDescriptor {
7841    fn typename() -> &'static str {
7842        "type.googleapis.com/google.api.MetricDescriptor"
7843    }
7844}
7845
7846/// Defines additional types related to [MetricDescriptor].
7847pub mod metric_descriptor {
7848    #[allow(unused_imports)]
7849    use super::*;
7850
7851    /// Additional annotations that can be used to guide the usage of a metric.
7852    #[derive(Clone, Default, PartialEq)]
7853    #[non_exhaustive]
7854    pub struct MetricDescriptorMetadata {
7855
7856        /// Deprecated. Must use the
7857        /// [MetricDescriptor.launch_stage][google.api.MetricDescriptor.launch_stage]
7858        /// instead.
7859        ///
7860        /// [google.api.MetricDescriptor.launch_stage]: crate::model::MetricDescriptor::launch_stage
7861        #[deprecated]
7862        pub launch_stage: crate::model::LaunchStage,
7863
7864        /// The sampling period of metric data points. For metrics which are written
7865        /// periodically, consecutive data points are stored at this time interval,
7866        /// excluding data loss due to errors. Metrics with a higher granularity have
7867        /// a smaller sampling period.
7868        pub sample_period: std::option::Option<wkt::Duration>,
7869
7870        /// The delay of data points caused by ingestion. Data points older than this
7871        /// age are guaranteed to be ingested and available to be read, excluding
7872        /// data loss due to errors.
7873        pub ingest_delay: std::option::Option<wkt::Duration>,
7874
7875        /// The scope of the timeseries data of the metric.
7876        pub time_series_resource_hierarchy_level: std::vec::Vec<crate::model::metric_descriptor::metric_descriptor_metadata::TimeSeriesResourceHierarchyLevel>,
7877
7878        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7879    }
7880
7881    impl MetricDescriptorMetadata {
7882        /// Creates a new default instance.
7883        pub fn new() -> Self {
7884            std::default::Default::default()
7885        }
7886
7887        /// Sets the value of [launch_stage][crate::model::metric_descriptor::MetricDescriptorMetadata::launch_stage].
7888        ///
7889        /// # Example
7890        /// ```ignore,no_run
7891        /// # use google_cloud_api::model::metric_descriptor::MetricDescriptorMetadata;
7892        /// use google_cloud_api::model::LaunchStage;
7893        /// let x0 = MetricDescriptorMetadata::new().set_launch_stage(LaunchStage::Unimplemented);
7894        /// let x1 = MetricDescriptorMetadata::new().set_launch_stage(LaunchStage::Prelaunch);
7895        /// let x2 = MetricDescriptorMetadata::new().set_launch_stage(LaunchStage::EarlyAccess);
7896        /// ```
7897        #[deprecated]
7898        pub fn set_launch_stage<T: std::convert::Into<crate::model::LaunchStage>>(
7899            mut self,
7900            v: T,
7901        ) -> Self {
7902            self.launch_stage = v.into();
7903            self
7904        }
7905
7906        /// Sets the value of [sample_period][crate::model::metric_descriptor::MetricDescriptorMetadata::sample_period].
7907        ///
7908        /// # Example
7909        /// ```ignore,no_run
7910        /// # use google_cloud_api::model::metric_descriptor::MetricDescriptorMetadata;
7911        /// use wkt::Duration;
7912        /// let x = MetricDescriptorMetadata::new().set_sample_period(Duration::default()/* use setters */);
7913        /// ```
7914        pub fn set_sample_period<T>(mut self, v: T) -> Self
7915        where
7916            T: std::convert::Into<wkt::Duration>,
7917        {
7918            self.sample_period = std::option::Option::Some(v.into());
7919            self
7920        }
7921
7922        /// Sets or clears the value of [sample_period][crate::model::metric_descriptor::MetricDescriptorMetadata::sample_period].
7923        ///
7924        /// # Example
7925        /// ```ignore,no_run
7926        /// # use google_cloud_api::model::metric_descriptor::MetricDescriptorMetadata;
7927        /// use wkt::Duration;
7928        /// let x = MetricDescriptorMetadata::new().set_or_clear_sample_period(Some(Duration::default()/* use setters */));
7929        /// let x = MetricDescriptorMetadata::new().set_or_clear_sample_period(None::<Duration>);
7930        /// ```
7931        pub fn set_or_clear_sample_period<T>(mut self, v: std::option::Option<T>) -> Self
7932        where
7933            T: std::convert::Into<wkt::Duration>,
7934        {
7935            self.sample_period = v.map(|x| x.into());
7936            self
7937        }
7938
7939        /// Sets the value of [ingest_delay][crate::model::metric_descriptor::MetricDescriptorMetadata::ingest_delay].
7940        ///
7941        /// # Example
7942        /// ```ignore,no_run
7943        /// # use google_cloud_api::model::metric_descriptor::MetricDescriptorMetadata;
7944        /// use wkt::Duration;
7945        /// let x = MetricDescriptorMetadata::new().set_ingest_delay(Duration::default()/* use setters */);
7946        /// ```
7947        pub fn set_ingest_delay<T>(mut self, v: T) -> Self
7948        where
7949            T: std::convert::Into<wkt::Duration>,
7950        {
7951            self.ingest_delay = std::option::Option::Some(v.into());
7952            self
7953        }
7954
7955        /// Sets or clears the value of [ingest_delay][crate::model::metric_descriptor::MetricDescriptorMetadata::ingest_delay].
7956        ///
7957        /// # Example
7958        /// ```ignore,no_run
7959        /// # use google_cloud_api::model::metric_descriptor::MetricDescriptorMetadata;
7960        /// use wkt::Duration;
7961        /// let x = MetricDescriptorMetadata::new().set_or_clear_ingest_delay(Some(Duration::default()/* use setters */));
7962        /// let x = MetricDescriptorMetadata::new().set_or_clear_ingest_delay(None::<Duration>);
7963        /// ```
7964        pub fn set_or_clear_ingest_delay<T>(mut self, v: std::option::Option<T>) -> Self
7965        where
7966            T: std::convert::Into<wkt::Duration>,
7967        {
7968            self.ingest_delay = v.map(|x| x.into());
7969            self
7970        }
7971
7972        /// Sets the value of [time_series_resource_hierarchy_level][crate::model::metric_descriptor::MetricDescriptorMetadata::time_series_resource_hierarchy_level].
7973        ///
7974        /// # Example
7975        /// ```ignore,no_run
7976        /// # use google_cloud_api::model::metric_descriptor::MetricDescriptorMetadata;
7977        /// use google_cloud_api::model::metric_descriptor::metric_descriptor_metadata::TimeSeriesResourceHierarchyLevel;
7978        /// let x = MetricDescriptorMetadata::new().set_time_series_resource_hierarchy_level([
7979        ///     TimeSeriesResourceHierarchyLevel::Project,
7980        ///     TimeSeriesResourceHierarchyLevel::Organization,
7981        ///     TimeSeriesResourceHierarchyLevel::Folder,
7982        /// ]);
7983        /// ```
7984        pub fn set_time_series_resource_hierarchy_level<T, V>(mut self, v: T) -> Self
7985        where
7986            T: std::iter::IntoIterator<Item = V>,
7987            V: std::convert::Into<crate::model::metric_descriptor::metric_descriptor_metadata::TimeSeriesResourceHierarchyLevel>
7988        {
7989            use std::iter::Iterator;
7990            self.time_series_resource_hierarchy_level = v.into_iter().map(|i| i.into()).collect();
7991            self
7992        }
7993    }
7994
7995    impl wkt::message::Message for MetricDescriptorMetadata {
7996        fn typename() -> &'static str {
7997            "type.googleapis.com/google.api.MetricDescriptor.MetricDescriptorMetadata"
7998        }
7999    }
8000
8001    /// Defines additional types related to [MetricDescriptorMetadata].
8002    pub mod metric_descriptor_metadata {
8003        #[allow(unused_imports)]
8004        use super::*;
8005
8006        /// The resource hierarchy level of the timeseries data of a metric.
8007        ///
8008        /// # Working with unknown values
8009        ///
8010        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8011        /// additional enum variants at any time. Adding new variants is not considered
8012        /// a breaking change. Applications should write their code in anticipation of:
8013        ///
8014        /// - New values appearing in future releases of the client library, **and**
8015        /// - New values received dynamically, without application changes.
8016        ///
8017        /// Please consult the [Working with enums] section in the user guide for some
8018        /// guidelines.
8019        ///
8020        /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8021        #[derive(Clone, Debug, PartialEq)]
8022        #[non_exhaustive]
8023        pub enum TimeSeriesResourceHierarchyLevel {
8024            /// Do not use this default value.
8025            Unspecified,
8026            /// Scopes a metric to a project.
8027            Project,
8028            /// Scopes a metric to an organization.
8029            Organization,
8030            /// Scopes a metric to a folder.
8031            Folder,
8032            /// If set, the enum was initialized with an unknown value.
8033            ///
8034            /// Applications can examine the value using [TimeSeriesResourceHierarchyLevel::value] or
8035            /// [TimeSeriesResourceHierarchyLevel::name].
8036            UnknownValue(time_series_resource_hierarchy_level::UnknownValue),
8037        }
8038
8039        #[doc(hidden)]
8040        pub mod time_series_resource_hierarchy_level {
8041            #[allow(unused_imports)]
8042            use super::*;
8043            #[derive(Clone, Debug, PartialEq)]
8044            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8045        }
8046
8047        impl TimeSeriesResourceHierarchyLevel {
8048            /// Gets the enum value.
8049            ///
8050            /// Returns `None` if the enum contains an unknown value deserialized from
8051            /// the string representation of enums.
8052            pub fn value(&self) -> std::option::Option<i32> {
8053                match self {
8054                    Self::Unspecified => std::option::Option::Some(0),
8055                    Self::Project => std::option::Option::Some(1),
8056                    Self::Organization => std::option::Option::Some(2),
8057                    Self::Folder => std::option::Option::Some(3),
8058                    Self::UnknownValue(u) => u.0.value(),
8059                }
8060            }
8061
8062            /// Gets the enum value as a string.
8063            ///
8064            /// Returns `None` if the enum contains an unknown value deserialized from
8065            /// the integer representation of enums.
8066            pub fn name(&self) -> std::option::Option<&str> {
8067                match self {
8068                    Self::Unspecified => std::option::Option::Some(
8069                        "TIME_SERIES_RESOURCE_HIERARCHY_LEVEL_UNSPECIFIED",
8070                    ),
8071                    Self::Project => std::option::Option::Some("PROJECT"),
8072                    Self::Organization => std::option::Option::Some("ORGANIZATION"),
8073                    Self::Folder => std::option::Option::Some("FOLDER"),
8074                    Self::UnknownValue(u) => u.0.name(),
8075                }
8076            }
8077        }
8078
8079        impl std::default::Default for TimeSeriesResourceHierarchyLevel {
8080            fn default() -> Self {
8081                use std::convert::From;
8082                Self::from(0)
8083            }
8084        }
8085
8086        impl std::fmt::Display for TimeSeriesResourceHierarchyLevel {
8087            fn fmt(
8088                &self,
8089                f: &mut std::fmt::Formatter<'_>,
8090            ) -> std::result::Result<(), std::fmt::Error> {
8091                wkt::internal::display_enum(f, self.name(), self.value())
8092            }
8093        }
8094
8095        impl std::convert::From<i32> for TimeSeriesResourceHierarchyLevel {
8096            fn from(value: i32) -> Self {
8097                match value {
8098                    0 => Self::Unspecified,
8099                    1 => Self::Project,
8100                    2 => Self::Organization,
8101                    3 => Self::Folder,
8102                    _ => Self::UnknownValue(time_series_resource_hierarchy_level::UnknownValue(
8103                        wkt::internal::UnknownEnumValue::Integer(value),
8104                    )),
8105                }
8106            }
8107        }
8108
8109        impl std::convert::From<&str> for TimeSeriesResourceHierarchyLevel {
8110            fn from(value: &str) -> Self {
8111                use std::string::ToString;
8112                match value {
8113                    "TIME_SERIES_RESOURCE_HIERARCHY_LEVEL_UNSPECIFIED" => Self::Unspecified,
8114                    "PROJECT" => Self::Project,
8115                    "ORGANIZATION" => Self::Organization,
8116                    "FOLDER" => Self::Folder,
8117                    _ => Self::UnknownValue(time_series_resource_hierarchy_level::UnknownValue(
8118                        wkt::internal::UnknownEnumValue::String(value.to_string()),
8119                    )),
8120                }
8121            }
8122        }
8123
8124        impl serde::ser::Serialize for TimeSeriesResourceHierarchyLevel {
8125            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8126            where
8127                S: serde::Serializer,
8128            {
8129                match self {
8130                    Self::Unspecified => serializer.serialize_i32(0),
8131                    Self::Project => serializer.serialize_i32(1),
8132                    Self::Organization => serializer.serialize_i32(2),
8133                    Self::Folder => serializer.serialize_i32(3),
8134                    Self::UnknownValue(u) => u.0.serialize(serializer),
8135                }
8136            }
8137        }
8138
8139        impl<'de> serde::de::Deserialize<'de> for TimeSeriesResourceHierarchyLevel {
8140            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8141            where
8142                D: serde::Deserializer<'de>,
8143            {
8144                deserializer.deserialize_any(wkt::internal::EnumVisitor::<TimeSeriesResourceHierarchyLevel>::new(
8145                    ".google.api.MetricDescriptor.MetricDescriptorMetadata.TimeSeriesResourceHierarchyLevel"))
8146            }
8147        }
8148    }
8149
8150    /// The kind of measurement. It describes how the data is reported.
8151    /// For information on setting the start time and end time based on
8152    /// the MetricKind, see [TimeInterval][google.monitoring.v3.TimeInterval].
8153    ///
8154    /// # Working with unknown values
8155    ///
8156    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8157    /// additional enum variants at any time. Adding new variants is not considered
8158    /// a breaking change. Applications should write their code in anticipation of:
8159    ///
8160    /// - New values appearing in future releases of the client library, **and**
8161    /// - New values received dynamically, without application changes.
8162    ///
8163    /// Please consult the [Working with enums] section in the user guide for some
8164    /// guidelines.
8165    ///
8166    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8167    #[derive(Clone, Debug, PartialEq)]
8168    #[non_exhaustive]
8169    pub enum MetricKind {
8170        /// Do not use this default value.
8171        Unspecified,
8172        /// An instantaneous measurement of a value.
8173        Gauge,
8174        /// The change in a value during a time interval.
8175        Delta,
8176        /// A value accumulated over a time interval.  Cumulative
8177        /// measurements in a time series should have the same start time
8178        /// and increasing end times, until an event resets the cumulative
8179        /// value to zero and sets a new start time for the following
8180        /// points.
8181        Cumulative,
8182        /// If set, the enum was initialized with an unknown value.
8183        ///
8184        /// Applications can examine the value using [MetricKind::value] or
8185        /// [MetricKind::name].
8186        UnknownValue(metric_kind::UnknownValue),
8187    }
8188
8189    #[doc(hidden)]
8190    pub mod metric_kind {
8191        #[allow(unused_imports)]
8192        use super::*;
8193        #[derive(Clone, Debug, PartialEq)]
8194        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8195    }
8196
8197    impl MetricKind {
8198        /// Gets the enum value.
8199        ///
8200        /// Returns `None` if the enum contains an unknown value deserialized from
8201        /// the string representation of enums.
8202        pub fn value(&self) -> std::option::Option<i32> {
8203            match self {
8204                Self::Unspecified => std::option::Option::Some(0),
8205                Self::Gauge => std::option::Option::Some(1),
8206                Self::Delta => std::option::Option::Some(2),
8207                Self::Cumulative => std::option::Option::Some(3),
8208                Self::UnknownValue(u) => u.0.value(),
8209            }
8210        }
8211
8212        /// Gets the enum value as a string.
8213        ///
8214        /// Returns `None` if the enum contains an unknown value deserialized from
8215        /// the integer representation of enums.
8216        pub fn name(&self) -> std::option::Option<&str> {
8217            match self {
8218                Self::Unspecified => std::option::Option::Some("METRIC_KIND_UNSPECIFIED"),
8219                Self::Gauge => std::option::Option::Some("GAUGE"),
8220                Self::Delta => std::option::Option::Some("DELTA"),
8221                Self::Cumulative => std::option::Option::Some("CUMULATIVE"),
8222                Self::UnknownValue(u) => u.0.name(),
8223            }
8224        }
8225    }
8226
8227    impl std::default::Default for MetricKind {
8228        fn default() -> Self {
8229            use std::convert::From;
8230            Self::from(0)
8231        }
8232    }
8233
8234    impl std::fmt::Display for MetricKind {
8235        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8236            wkt::internal::display_enum(f, self.name(), self.value())
8237        }
8238    }
8239
8240    impl std::convert::From<i32> for MetricKind {
8241        fn from(value: i32) -> Self {
8242            match value {
8243                0 => Self::Unspecified,
8244                1 => Self::Gauge,
8245                2 => Self::Delta,
8246                3 => Self::Cumulative,
8247                _ => Self::UnknownValue(metric_kind::UnknownValue(
8248                    wkt::internal::UnknownEnumValue::Integer(value),
8249                )),
8250            }
8251        }
8252    }
8253
8254    impl std::convert::From<&str> for MetricKind {
8255        fn from(value: &str) -> Self {
8256            use std::string::ToString;
8257            match value {
8258                "METRIC_KIND_UNSPECIFIED" => Self::Unspecified,
8259                "GAUGE" => Self::Gauge,
8260                "DELTA" => Self::Delta,
8261                "CUMULATIVE" => Self::Cumulative,
8262                _ => Self::UnknownValue(metric_kind::UnknownValue(
8263                    wkt::internal::UnknownEnumValue::String(value.to_string()),
8264                )),
8265            }
8266        }
8267    }
8268
8269    impl serde::ser::Serialize for MetricKind {
8270        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8271        where
8272            S: serde::Serializer,
8273        {
8274            match self {
8275                Self::Unspecified => serializer.serialize_i32(0),
8276                Self::Gauge => serializer.serialize_i32(1),
8277                Self::Delta => serializer.serialize_i32(2),
8278                Self::Cumulative => serializer.serialize_i32(3),
8279                Self::UnknownValue(u) => u.0.serialize(serializer),
8280            }
8281        }
8282    }
8283
8284    impl<'de> serde::de::Deserialize<'de> for MetricKind {
8285        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8286        where
8287            D: serde::Deserializer<'de>,
8288        {
8289            deserializer.deserialize_any(wkt::internal::EnumVisitor::<MetricKind>::new(
8290                ".google.api.MetricDescriptor.MetricKind",
8291            ))
8292        }
8293    }
8294
8295    /// The value type of a metric.
8296    ///
8297    /// # Working with unknown values
8298    ///
8299    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8300    /// additional enum variants at any time. Adding new variants is not considered
8301    /// a breaking change. Applications should write their code in anticipation of:
8302    ///
8303    /// - New values appearing in future releases of the client library, **and**
8304    /// - New values received dynamically, without application changes.
8305    ///
8306    /// Please consult the [Working with enums] section in the user guide for some
8307    /// guidelines.
8308    ///
8309    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8310    #[derive(Clone, Debug, PartialEq)]
8311    #[non_exhaustive]
8312    pub enum ValueType {
8313        /// Do not use this default value.
8314        Unspecified,
8315        /// The value is a boolean.
8316        /// This value type can be used only if the metric kind is `GAUGE`.
8317        Bool,
8318        /// The value is a signed 64-bit integer.
8319        Int64,
8320        /// The value is a double precision floating point number.
8321        Double,
8322        /// The value is a text string.
8323        /// This value type can be used only if the metric kind is `GAUGE`.
8324        String,
8325        /// The value is a [`Distribution`][google.api.Distribution].
8326        ///
8327        /// [google.api.Distribution]: crate::model::Distribution
8328        Distribution,
8329        /// The value is money.
8330        Money,
8331        /// If set, the enum was initialized with an unknown value.
8332        ///
8333        /// Applications can examine the value using [ValueType::value] or
8334        /// [ValueType::name].
8335        UnknownValue(value_type::UnknownValue),
8336    }
8337
8338    #[doc(hidden)]
8339    pub mod value_type {
8340        #[allow(unused_imports)]
8341        use super::*;
8342        #[derive(Clone, Debug, PartialEq)]
8343        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8344    }
8345
8346    impl ValueType {
8347        /// Gets the enum value.
8348        ///
8349        /// Returns `None` if the enum contains an unknown value deserialized from
8350        /// the string representation of enums.
8351        pub fn value(&self) -> std::option::Option<i32> {
8352            match self {
8353                Self::Unspecified => std::option::Option::Some(0),
8354                Self::Bool => std::option::Option::Some(1),
8355                Self::Int64 => std::option::Option::Some(2),
8356                Self::Double => std::option::Option::Some(3),
8357                Self::String => std::option::Option::Some(4),
8358                Self::Distribution => std::option::Option::Some(5),
8359                Self::Money => std::option::Option::Some(6),
8360                Self::UnknownValue(u) => u.0.value(),
8361            }
8362        }
8363
8364        /// Gets the enum value as a string.
8365        ///
8366        /// Returns `None` if the enum contains an unknown value deserialized from
8367        /// the integer representation of enums.
8368        pub fn name(&self) -> std::option::Option<&str> {
8369            match self {
8370                Self::Unspecified => std::option::Option::Some("VALUE_TYPE_UNSPECIFIED"),
8371                Self::Bool => std::option::Option::Some("BOOL"),
8372                Self::Int64 => std::option::Option::Some("INT64"),
8373                Self::Double => std::option::Option::Some("DOUBLE"),
8374                Self::String => std::option::Option::Some("STRING"),
8375                Self::Distribution => std::option::Option::Some("DISTRIBUTION"),
8376                Self::Money => std::option::Option::Some("MONEY"),
8377                Self::UnknownValue(u) => u.0.name(),
8378            }
8379        }
8380    }
8381
8382    impl std::default::Default for ValueType {
8383        fn default() -> Self {
8384            use std::convert::From;
8385            Self::from(0)
8386        }
8387    }
8388
8389    impl std::fmt::Display for ValueType {
8390        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8391            wkt::internal::display_enum(f, self.name(), self.value())
8392        }
8393    }
8394
8395    impl std::convert::From<i32> for ValueType {
8396        fn from(value: i32) -> Self {
8397            match value {
8398                0 => Self::Unspecified,
8399                1 => Self::Bool,
8400                2 => Self::Int64,
8401                3 => Self::Double,
8402                4 => Self::String,
8403                5 => Self::Distribution,
8404                6 => Self::Money,
8405                _ => Self::UnknownValue(value_type::UnknownValue(
8406                    wkt::internal::UnknownEnumValue::Integer(value),
8407                )),
8408            }
8409        }
8410    }
8411
8412    impl std::convert::From<&str> for ValueType {
8413        fn from(value: &str) -> Self {
8414            use std::string::ToString;
8415            match value {
8416                "VALUE_TYPE_UNSPECIFIED" => Self::Unspecified,
8417                "BOOL" => Self::Bool,
8418                "INT64" => Self::Int64,
8419                "DOUBLE" => Self::Double,
8420                "STRING" => Self::String,
8421                "DISTRIBUTION" => Self::Distribution,
8422                "MONEY" => Self::Money,
8423                _ => Self::UnknownValue(value_type::UnknownValue(
8424                    wkt::internal::UnknownEnumValue::String(value.to_string()),
8425                )),
8426            }
8427        }
8428    }
8429
8430    impl serde::ser::Serialize for ValueType {
8431        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8432        where
8433            S: serde::Serializer,
8434        {
8435            match self {
8436                Self::Unspecified => serializer.serialize_i32(0),
8437                Self::Bool => serializer.serialize_i32(1),
8438                Self::Int64 => serializer.serialize_i32(2),
8439                Self::Double => serializer.serialize_i32(3),
8440                Self::String => serializer.serialize_i32(4),
8441                Self::Distribution => serializer.serialize_i32(5),
8442                Self::Money => serializer.serialize_i32(6),
8443                Self::UnknownValue(u) => u.0.serialize(serializer),
8444            }
8445        }
8446    }
8447
8448    impl<'de> serde::de::Deserialize<'de> for ValueType {
8449        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8450        where
8451            D: serde::Deserializer<'de>,
8452        {
8453            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ValueType>::new(
8454                ".google.api.MetricDescriptor.ValueType",
8455            ))
8456        }
8457    }
8458}
8459
8460/// A specific metric, identified by specifying values for all of the
8461/// labels of a [`MetricDescriptor`][google.api.MetricDescriptor].
8462///
8463/// [google.api.MetricDescriptor]: crate::model::MetricDescriptor
8464#[derive(Clone, Default, PartialEq)]
8465#[non_exhaustive]
8466pub struct Metric {
8467    /// An existing metric type, see
8468    /// [google.api.MetricDescriptor][google.api.MetricDescriptor]. For example,
8469    /// `custom.googleapis.com/invoice/paid/amount`.
8470    ///
8471    /// [google.api.MetricDescriptor]: crate::model::MetricDescriptor
8472    pub r#type: std::string::String,
8473
8474    /// The set of label values that uniquely identify this metric. All
8475    /// labels listed in the `MetricDescriptor` must be assigned values.
8476    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
8477
8478    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8479}
8480
8481impl Metric {
8482    /// Creates a new default instance.
8483    pub fn new() -> Self {
8484        std::default::Default::default()
8485    }
8486
8487    /// Sets the value of [r#type][crate::model::Metric::type].
8488    ///
8489    /// # Example
8490    /// ```ignore,no_run
8491    /// # use google_cloud_api::model::Metric;
8492    /// let x = Metric::new().set_type("example");
8493    /// ```
8494    pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8495        self.r#type = v.into();
8496        self
8497    }
8498
8499    /// Sets the value of [labels][crate::model::Metric::labels].
8500    ///
8501    /// # Example
8502    /// ```ignore,no_run
8503    /// # use google_cloud_api::model::Metric;
8504    /// let x = Metric::new().set_labels([
8505    ///     ("key0", "abc"),
8506    ///     ("key1", "xyz"),
8507    /// ]);
8508    /// ```
8509    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
8510    where
8511        T: std::iter::IntoIterator<Item = (K, V)>,
8512        K: std::convert::Into<std::string::String>,
8513        V: std::convert::Into<std::string::String>,
8514    {
8515        use std::iter::Iterator;
8516        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8517        self
8518    }
8519}
8520
8521impl wkt::message::Message for Metric {
8522    fn typename() -> &'static str {
8523        "type.googleapis.com/google.api.Metric"
8524    }
8525}
8526
8527/// An object that describes the schema of a
8528/// [MonitoredResource][google.api.MonitoredResource] object using a type name
8529/// and a set of labels.  For example, the monitored resource descriptor for
8530/// Google Compute Engine VM instances has a type of
8531/// `"gce_instance"` and specifies the use of the labels `"instance_id"` and
8532/// `"zone"` to identify particular VM instances.
8533///
8534/// Different APIs can support different monitored resource types. APIs generally
8535/// provide a `list` method that returns the monitored resource descriptors used
8536/// by the API.
8537///
8538/// [google.api.MonitoredResource]: crate::model::MonitoredResource
8539#[derive(Clone, Default, PartialEq)]
8540#[non_exhaustive]
8541pub struct MonitoredResourceDescriptor {
8542    /// Optional. The resource name of the monitored resource descriptor:
8543    /// `"projects/{project_id}/monitoredResourceDescriptors/{type}"` where
8544    /// {type} is the value of the `type` field in this object and
8545    /// {project_id} is a project ID that provides API-specific context for
8546    /// accessing the type.  APIs that do not use project information can use the
8547    /// resource name format `"monitoredResourceDescriptors/{type}"`.
8548    pub name: std::string::String,
8549
8550    /// Required. The monitored resource type. For example, the type
8551    /// `"cloudsql_database"` represents databases in Google Cloud SQL.
8552    /// For a list of types, see [Monitored resource
8553    /// types](https://cloud.google.com/monitoring/api/resources)
8554    /// and [Logging resource
8555    /// types](https://cloud.google.com/logging/docs/api/v2/resource-list).
8556    pub r#type: std::string::String,
8557
8558    /// Optional. A concise name for the monitored resource type that might be
8559    /// displayed in user interfaces. It should be a Title Cased Noun Phrase,
8560    /// without any article or other determiners. For example,
8561    /// `"Google Cloud SQL Database"`.
8562    pub display_name: std::string::String,
8563
8564    /// Optional. A detailed description of the monitored resource type that might
8565    /// be used in documentation.
8566    pub description: std::string::String,
8567
8568    /// Required. A set of labels used to describe instances of this monitored
8569    /// resource type. For example, an individual Google Cloud SQL database is
8570    /// identified by values for the labels `"database_id"` and `"zone"`.
8571    pub labels: std::vec::Vec<crate::model::LabelDescriptor>,
8572
8573    /// Optional. The launch stage of the monitored resource definition.
8574    pub launch_stage: crate::model::LaunchStage,
8575
8576    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8577}
8578
8579impl MonitoredResourceDescriptor {
8580    /// Creates a new default instance.
8581    pub fn new() -> Self {
8582        std::default::Default::default()
8583    }
8584
8585    /// Sets the value of [name][crate::model::MonitoredResourceDescriptor::name].
8586    ///
8587    /// # Example
8588    /// ```ignore,no_run
8589    /// # use google_cloud_api::model::MonitoredResourceDescriptor;
8590    /// let x = MonitoredResourceDescriptor::new().set_name("example");
8591    /// ```
8592    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8593        self.name = v.into();
8594        self
8595    }
8596
8597    /// Sets the value of [r#type][crate::model::MonitoredResourceDescriptor::type].
8598    ///
8599    /// # Example
8600    /// ```ignore,no_run
8601    /// # use google_cloud_api::model::MonitoredResourceDescriptor;
8602    /// let x = MonitoredResourceDescriptor::new().set_type("example");
8603    /// ```
8604    pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8605        self.r#type = v.into();
8606        self
8607    }
8608
8609    /// Sets the value of [display_name][crate::model::MonitoredResourceDescriptor::display_name].
8610    ///
8611    /// # Example
8612    /// ```ignore,no_run
8613    /// # use google_cloud_api::model::MonitoredResourceDescriptor;
8614    /// let x = MonitoredResourceDescriptor::new().set_display_name("example");
8615    /// ```
8616    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8617        self.display_name = v.into();
8618        self
8619    }
8620
8621    /// Sets the value of [description][crate::model::MonitoredResourceDescriptor::description].
8622    ///
8623    /// # Example
8624    /// ```ignore,no_run
8625    /// # use google_cloud_api::model::MonitoredResourceDescriptor;
8626    /// let x = MonitoredResourceDescriptor::new().set_description("example");
8627    /// ```
8628    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8629        self.description = v.into();
8630        self
8631    }
8632
8633    /// Sets the value of [labels][crate::model::MonitoredResourceDescriptor::labels].
8634    ///
8635    /// # Example
8636    /// ```ignore,no_run
8637    /// # use google_cloud_api::model::MonitoredResourceDescriptor;
8638    /// use google_cloud_api::model::LabelDescriptor;
8639    /// let x = MonitoredResourceDescriptor::new()
8640    ///     .set_labels([
8641    ///         LabelDescriptor::default()/* use setters */,
8642    ///         LabelDescriptor::default()/* use (different) setters */,
8643    ///     ]);
8644    /// ```
8645    pub fn set_labels<T, V>(mut self, v: T) -> Self
8646    where
8647        T: std::iter::IntoIterator<Item = V>,
8648        V: std::convert::Into<crate::model::LabelDescriptor>,
8649    {
8650        use std::iter::Iterator;
8651        self.labels = v.into_iter().map(|i| i.into()).collect();
8652        self
8653    }
8654
8655    /// Sets the value of [launch_stage][crate::model::MonitoredResourceDescriptor::launch_stage].
8656    ///
8657    /// # Example
8658    /// ```ignore,no_run
8659    /// # use google_cloud_api::model::MonitoredResourceDescriptor;
8660    /// use google_cloud_api::model::LaunchStage;
8661    /// let x0 = MonitoredResourceDescriptor::new().set_launch_stage(LaunchStage::Unimplemented);
8662    /// let x1 = MonitoredResourceDescriptor::new().set_launch_stage(LaunchStage::Prelaunch);
8663    /// let x2 = MonitoredResourceDescriptor::new().set_launch_stage(LaunchStage::EarlyAccess);
8664    /// ```
8665    pub fn set_launch_stage<T: std::convert::Into<crate::model::LaunchStage>>(
8666        mut self,
8667        v: T,
8668    ) -> Self {
8669        self.launch_stage = v.into();
8670        self
8671    }
8672}
8673
8674impl wkt::message::Message for MonitoredResourceDescriptor {
8675    fn typename() -> &'static str {
8676        "type.googleapis.com/google.api.MonitoredResourceDescriptor"
8677    }
8678}
8679
8680/// An object representing a resource that can be used for monitoring, logging,
8681/// billing, or other purposes. Examples include virtual machine instances,
8682/// databases, and storage devices such as disks. The `type` field identifies a
8683/// [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] object
8684/// that describes the resource's schema. Information in the `labels` field
8685/// identifies the actual resource and its attributes according to the schema.
8686/// For example, a particular Compute Engine VM instance could be represented by
8687/// the following object, because the
8688/// [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] for
8689/// `"gce_instance"` has labels
8690/// `"project_id"`, `"instance_id"` and `"zone"`:
8691///
8692/// ```norust
8693/// { "type": "gce_instance",
8694///   "labels": { "project_id": "my-project",
8695///               "instance_id": "12345678901234",
8696///               "zone": "us-central1-a" }}
8697/// ```
8698///
8699/// [google.api.MonitoredResourceDescriptor]: crate::model::MonitoredResourceDescriptor
8700#[derive(Clone, Default, PartialEq)]
8701#[non_exhaustive]
8702pub struct MonitoredResource {
8703    /// Required. The monitored resource type. This field must match
8704    /// the `type` field of a
8705    /// [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor]
8706    /// object. For example, the type of a Compute Engine VM instance is
8707    /// `gce_instance`. Some descriptors include the service name in the type; for
8708    /// example, the type of a Datastream stream is
8709    /// `datastream.googleapis.com/Stream`.
8710    ///
8711    /// [google.api.MonitoredResourceDescriptor]: crate::model::MonitoredResourceDescriptor
8712    pub r#type: std::string::String,
8713
8714    /// Required. Values for all of the labels listed in the associated monitored
8715    /// resource descriptor. For example, Compute Engine VM instances use the
8716    /// labels `"project_id"`, `"instance_id"`, and `"zone"`.
8717    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
8718
8719    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8720}
8721
8722impl MonitoredResource {
8723    /// Creates a new default instance.
8724    pub fn new() -> Self {
8725        std::default::Default::default()
8726    }
8727
8728    /// Sets the value of [r#type][crate::model::MonitoredResource::type].
8729    ///
8730    /// # Example
8731    /// ```ignore,no_run
8732    /// # use google_cloud_api::model::MonitoredResource;
8733    /// let x = MonitoredResource::new().set_type("example");
8734    /// ```
8735    pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8736        self.r#type = v.into();
8737        self
8738    }
8739
8740    /// Sets the value of [labels][crate::model::MonitoredResource::labels].
8741    ///
8742    /// # Example
8743    /// ```ignore,no_run
8744    /// # use google_cloud_api::model::MonitoredResource;
8745    /// let x = MonitoredResource::new().set_labels([
8746    ///     ("key0", "abc"),
8747    ///     ("key1", "xyz"),
8748    /// ]);
8749    /// ```
8750    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
8751    where
8752        T: std::iter::IntoIterator<Item = (K, V)>,
8753        K: std::convert::Into<std::string::String>,
8754        V: std::convert::Into<std::string::String>,
8755    {
8756        use std::iter::Iterator;
8757        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8758        self
8759    }
8760}
8761
8762impl wkt::message::Message for MonitoredResource {
8763    fn typename() -> &'static str {
8764        "type.googleapis.com/google.api.MonitoredResource"
8765    }
8766}
8767
8768/// Auxiliary metadata for a [MonitoredResource][google.api.MonitoredResource]
8769/// object. [MonitoredResource][google.api.MonitoredResource] objects contain the
8770/// minimum set of information to uniquely identify a monitored resource
8771/// instance. There is some other useful auxiliary metadata. Monitoring and
8772/// Logging use an ingestion pipeline to extract metadata for cloud resources of
8773/// all types, and store the metadata in this message.
8774///
8775/// [google.api.MonitoredResource]: crate::model::MonitoredResource
8776#[derive(Clone, Default, PartialEq)]
8777#[non_exhaustive]
8778pub struct MonitoredResourceMetadata {
8779    /// Output only. Values for predefined system metadata labels.
8780    /// System labels are a kind of metadata extracted by Google, including
8781    /// "machine_image", "vpc", "subnet_id",
8782    /// "security_group", "name", etc.
8783    /// System label values can be only strings, Boolean values, or a list of
8784    /// strings. For example:
8785    ///
8786    /// ```norust
8787    /// { "name": "my-test-instance",
8788    ///   "security_group": ["a", "b", "c"],
8789    ///   "spot_instance": false }
8790    /// ```
8791    pub system_labels: std::option::Option<wkt::Struct>,
8792
8793    /// Output only. A map of user-defined metadata labels.
8794    pub user_labels: std::collections::HashMap<std::string::String, std::string::String>,
8795
8796    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8797}
8798
8799impl MonitoredResourceMetadata {
8800    /// Creates a new default instance.
8801    pub fn new() -> Self {
8802        std::default::Default::default()
8803    }
8804
8805    /// Sets the value of [system_labels][crate::model::MonitoredResourceMetadata::system_labels].
8806    ///
8807    /// # Example
8808    /// ```ignore,no_run
8809    /// # use google_cloud_api::model::MonitoredResourceMetadata;
8810    /// use wkt::Struct;
8811    /// let x = MonitoredResourceMetadata::new().set_system_labels(Struct::default()/* use setters */);
8812    /// ```
8813    pub fn set_system_labels<T>(mut self, v: T) -> Self
8814    where
8815        T: std::convert::Into<wkt::Struct>,
8816    {
8817        self.system_labels = std::option::Option::Some(v.into());
8818        self
8819    }
8820
8821    /// Sets or clears the value of [system_labels][crate::model::MonitoredResourceMetadata::system_labels].
8822    ///
8823    /// # Example
8824    /// ```ignore,no_run
8825    /// # use google_cloud_api::model::MonitoredResourceMetadata;
8826    /// use wkt::Struct;
8827    /// let x = MonitoredResourceMetadata::new().set_or_clear_system_labels(Some(Struct::default()/* use setters */));
8828    /// let x = MonitoredResourceMetadata::new().set_or_clear_system_labels(None::<Struct>);
8829    /// ```
8830    pub fn set_or_clear_system_labels<T>(mut self, v: std::option::Option<T>) -> Self
8831    where
8832        T: std::convert::Into<wkt::Struct>,
8833    {
8834        self.system_labels = v.map(|x| x.into());
8835        self
8836    }
8837
8838    /// Sets the value of [user_labels][crate::model::MonitoredResourceMetadata::user_labels].
8839    ///
8840    /// # Example
8841    /// ```ignore,no_run
8842    /// # use google_cloud_api::model::MonitoredResourceMetadata;
8843    /// let x = MonitoredResourceMetadata::new().set_user_labels([
8844    ///     ("key0", "abc"),
8845    ///     ("key1", "xyz"),
8846    /// ]);
8847    /// ```
8848    pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
8849    where
8850        T: std::iter::IntoIterator<Item = (K, V)>,
8851        K: std::convert::Into<std::string::String>,
8852        V: std::convert::Into<std::string::String>,
8853    {
8854        use std::iter::Iterator;
8855        self.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8856        self
8857    }
8858}
8859
8860impl wkt::message::Message for MonitoredResourceMetadata {
8861    fn typename() -> &'static str {
8862        "type.googleapis.com/google.api.MonitoredResourceMetadata"
8863    }
8864}
8865
8866/// Monitoring configuration of the service.
8867///
8868/// The example below shows how to configure monitored resources and metrics
8869/// for monitoring. In the example, a monitored resource and two metrics are
8870/// defined. The `library.googleapis.com/book/returned_count` metric is sent
8871/// to both producer and consumer projects, whereas the
8872/// `library.googleapis.com/book/num_overdue` metric is only sent to the
8873/// consumer project.
8874///
8875/// ```norust
8876/// monitored_resources:
8877/// - type: library.googleapis.com/Branch
8878///   display_name: "Library Branch"
8879///   description: "A branch of a library."
8880///   launch_stage: GA
8881///   labels:
8882///   - key: resource_container
8883///     description: "The Cloud container (ie. project id) for the Branch."
8884///   - key: location
8885///     description: "The location of the library branch."
8886///   - key: branch_id
8887///     description: "The id of the branch."
8888/// metrics:
8889/// - name: library.googleapis.com/book/returned_count
8890///   display_name: "Books Returned"
8891///   description: "The count of books that have been returned."
8892///   launch_stage: GA
8893///   metric_kind: DELTA
8894///   value_type: INT64
8895///   unit: "1"
8896///   labels:
8897///   - key: customer_id
8898///     description: "The id of the customer."
8899/// - name: library.googleapis.com/book/num_overdue
8900///   display_name: "Books Overdue"
8901///   description: "The current number of overdue books."
8902///   launch_stage: GA
8903///   metric_kind: GAUGE
8904///   value_type: INT64
8905///   unit: "1"
8906///   labels:
8907///   - key: customer_id
8908///     description: "The id of the customer."
8909/// monitoring:
8910///   producer_destinations:
8911///   - monitored_resource: library.googleapis.com/Branch
8912///     metrics:
8913///     - library.googleapis.com/book/returned_count
8914///   consumer_destinations:
8915///   - monitored_resource: library.googleapis.com/Branch
8916///     metrics:
8917///     - library.googleapis.com/book/returned_count
8918///     - library.googleapis.com/book/num_overdue
8919/// ```
8920#[derive(Clone, Default, PartialEq)]
8921#[non_exhaustive]
8922pub struct Monitoring {
8923    /// Monitoring configurations for sending metrics to the producer project.
8924    /// There can be multiple producer destinations. A monitored resource type may
8925    /// appear in multiple monitoring destinations if different aggregations are
8926    /// needed for different sets of metrics associated with that monitored
8927    /// resource type. A monitored resource and metric pair may only be used once
8928    /// in the Monitoring configuration.
8929    pub producer_destinations: std::vec::Vec<crate::model::monitoring::MonitoringDestination>,
8930
8931    /// Monitoring configurations for sending metrics to the consumer project.
8932    /// There can be multiple consumer destinations. A monitored resource type may
8933    /// appear in multiple monitoring destinations if different aggregations are
8934    /// needed for different sets of metrics associated with that monitored
8935    /// resource type. A monitored resource and metric pair may only be used once
8936    /// in the Monitoring configuration.
8937    pub consumer_destinations: std::vec::Vec<crate::model::monitoring::MonitoringDestination>,
8938
8939    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8940}
8941
8942impl Monitoring {
8943    /// Creates a new default instance.
8944    pub fn new() -> Self {
8945        std::default::Default::default()
8946    }
8947
8948    /// Sets the value of [producer_destinations][crate::model::Monitoring::producer_destinations].
8949    ///
8950    /// # Example
8951    /// ```ignore,no_run
8952    /// # use google_cloud_api::model::Monitoring;
8953    /// use google_cloud_api::model::monitoring::MonitoringDestination;
8954    /// let x = Monitoring::new()
8955    ///     .set_producer_destinations([
8956    ///         MonitoringDestination::default()/* use setters */,
8957    ///         MonitoringDestination::default()/* use (different) setters */,
8958    ///     ]);
8959    /// ```
8960    pub fn set_producer_destinations<T, V>(mut self, v: T) -> Self
8961    where
8962        T: std::iter::IntoIterator<Item = V>,
8963        V: std::convert::Into<crate::model::monitoring::MonitoringDestination>,
8964    {
8965        use std::iter::Iterator;
8966        self.producer_destinations = v.into_iter().map(|i| i.into()).collect();
8967        self
8968    }
8969
8970    /// Sets the value of [consumer_destinations][crate::model::Monitoring::consumer_destinations].
8971    ///
8972    /// # Example
8973    /// ```ignore,no_run
8974    /// # use google_cloud_api::model::Monitoring;
8975    /// use google_cloud_api::model::monitoring::MonitoringDestination;
8976    /// let x = Monitoring::new()
8977    ///     .set_consumer_destinations([
8978    ///         MonitoringDestination::default()/* use setters */,
8979    ///         MonitoringDestination::default()/* use (different) setters */,
8980    ///     ]);
8981    /// ```
8982    pub fn set_consumer_destinations<T, V>(mut self, v: T) -> Self
8983    where
8984        T: std::iter::IntoIterator<Item = V>,
8985        V: std::convert::Into<crate::model::monitoring::MonitoringDestination>,
8986    {
8987        use std::iter::Iterator;
8988        self.consumer_destinations = v.into_iter().map(|i| i.into()).collect();
8989        self
8990    }
8991}
8992
8993impl wkt::message::Message for Monitoring {
8994    fn typename() -> &'static str {
8995        "type.googleapis.com/google.api.Monitoring"
8996    }
8997}
8998
8999/// Defines additional types related to [Monitoring].
9000pub mod monitoring {
9001    #[allow(unused_imports)]
9002    use super::*;
9003
9004    /// Configuration of a specific monitoring destination (the producer project
9005    /// or the consumer project).
9006    #[derive(Clone, Default, PartialEq)]
9007    #[non_exhaustive]
9008    pub struct MonitoringDestination {
9009        /// The monitored resource type. The type must be defined in
9010        /// [Service.monitored_resources][google.api.Service.monitored_resources]
9011        /// section.
9012        ///
9013        /// [google.api.Service.monitored_resources]: crate::model::Service::monitored_resources
9014        pub monitored_resource: std::string::String,
9015
9016        /// Types of the metrics to report to this monitoring destination.
9017        /// Each type must be defined in
9018        /// [Service.metrics][google.api.Service.metrics] section.
9019        ///
9020        /// [google.api.Service.metrics]: crate::model::Service::metrics
9021        pub metrics: std::vec::Vec<std::string::String>,
9022
9023        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9024    }
9025
9026    impl MonitoringDestination {
9027        /// Creates a new default instance.
9028        pub fn new() -> Self {
9029            std::default::Default::default()
9030        }
9031
9032        /// Sets the value of [monitored_resource][crate::model::monitoring::MonitoringDestination::monitored_resource].
9033        ///
9034        /// # Example
9035        /// ```ignore,no_run
9036        /// # use google_cloud_api::model::monitoring::MonitoringDestination;
9037        /// let x = MonitoringDestination::new().set_monitored_resource("example");
9038        /// ```
9039        pub fn set_monitored_resource<T: std::convert::Into<std::string::String>>(
9040            mut self,
9041            v: T,
9042        ) -> Self {
9043            self.monitored_resource = v.into();
9044            self
9045        }
9046
9047        /// Sets the value of [metrics][crate::model::monitoring::MonitoringDestination::metrics].
9048        ///
9049        /// # Example
9050        /// ```ignore,no_run
9051        /// # use google_cloud_api::model::monitoring::MonitoringDestination;
9052        /// let x = MonitoringDestination::new().set_metrics(["a", "b", "c"]);
9053        /// ```
9054        pub fn set_metrics<T, V>(mut self, v: T) -> Self
9055        where
9056            T: std::iter::IntoIterator<Item = V>,
9057            V: std::convert::Into<std::string::String>,
9058        {
9059            use std::iter::Iterator;
9060            self.metrics = v.into_iter().map(|i| i.into()).collect();
9061            self
9062        }
9063    }
9064
9065    impl wkt::message::Message for MonitoringDestination {
9066        fn typename() -> &'static str {
9067            "type.googleapis.com/google.api.Monitoring.MonitoringDestination"
9068        }
9069    }
9070}
9071
9072/// Google API Policy Annotation
9073///
9074/// This message defines a simple API policy annotation that can be used to
9075/// annotate API request and response message fields with applicable policies.
9076/// One field may have multiple applicable policies that must all be satisfied
9077/// before a request can be processed. This policy annotation is used to
9078/// generate the overall policy that will be used for automatic runtime
9079/// policy enforcement and documentation generation.
9080#[derive(Clone, Default, PartialEq)]
9081#[non_exhaustive]
9082pub struct FieldPolicy {
9083    /// Selects one or more request or response message fields to apply this
9084    /// `FieldPolicy`.
9085    ///
9086    /// When a `FieldPolicy` is used in proto annotation, the selector must
9087    /// be left as empty. The service config generator will automatically fill
9088    /// the correct value.
9089    ///
9090    /// When a `FieldPolicy` is used in service config, the selector must be a
9091    /// comma-separated string with valid request or response field paths,
9092    /// such as "foo.bar" or "foo.bar,foo.baz".
9093    pub selector: std::string::String,
9094
9095    /// Specifies the required permission(s) for the resource referred to by the
9096    /// field. It requires the field contains a valid resource reference, and
9097    /// the request must pass the permission checks to proceed. For example,
9098    /// "resourcemanager.projects.get".
9099    pub resource_permission: std::string::String,
9100
9101    /// Specifies the resource type for the resource referred to by the field.
9102    pub resource_type: std::string::String,
9103
9104    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9105}
9106
9107impl FieldPolicy {
9108    /// Creates a new default instance.
9109    pub fn new() -> Self {
9110        std::default::Default::default()
9111    }
9112
9113    /// Sets the value of [selector][crate::model::FieldPolicy::selector].
9114    ///
9115    /// # Example
9116    /// ```ignore,no_run
9117    /// # use google_cloud_api::model::FieldPolicy;
9118    /// let x = FieldPolicy::new().set_selector("example");
9119    /// ```
9120    pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9121        self.selector = v.into();
9122        self
9123    }
9124
9125    /// Sets the value of [resource_permission][crate::model::FieldPolicy::resource_permission].
9126    ///
9127    /// # Example
9128    /// ```ignore,no_run
9129    /// # use google_cloud_api::model::FieldPolicy;
9130    /// let x = FieldPolicy::new().set_resource_permission("example");
9131    /// ```
9132    pub fn set_resource_permission<T: std::convert::Into<std::string::String>>(
9133        mut self,
9134        v: T,
9135    ) -> Self {
9136        self.resource_permission = v.into();
9137        self
9138    }
9139
9140    /// Sets the value of [resource_type][crate::model::FieldPolicy::resource_type].
9141    ///
9142    /// # Example
9143    /// ```ignore,no_run
9144    /// # use google_cloud_api::model::FieldPolicy;
9145    /// let x = FieldPolicy::new().set_resource_type("example");
9146    /// ```
9147    pub fn set_resource_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9148        self.resource_type = v.into();
9149        self
9150    }
9151}
9152
9153impl wkt::message::Message for FieldPolicy {
9154    fn typename() -> &'static str {
9155        "type.googleapis.com/google.api.FieldPolicy"
9156    }
9157}
9158
9159/// Defines policies applying to an RPC method.
9160#[derive(Clone, Default, PartialEq)]
9161#[non_exhaustive]
9162pub struct MethodPolicy {
9163    /// Selects a method to which these policies should be enforced, for example,
9164    /// "google.pubsub.v1.Subscriber.CreateSubscription".
9165    ///
9166    /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
9167    /// details.
9168    ///
9169    /// NOTE: This field must not be set in the proto annotation. It will be
9170    /// automatically filled by the service config compiler .
9171    ///
9172    /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
9173    pub selector: std::string::String,
9174
9175    /// Policies that are applicable to the request message.
9176    pub request_policies: std::vec::Vec<crate::model::FieldPolicy>,
9177
9178    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9179}
9180
9181impl MethodPolicy {
9182    /// Creates a new default instance.
9183    pub fn new() -> Self {
9184        std::default::Default::default()
9185    }
9186
9187    /// Sets the value of [selector][crate::model::MethodPolicy::selector].
9188    ///
9189    /// # Example
9190    /// ```ignore,no_run
9191    /// # use google_cloud_api::model::MethodPolicy;
9192    /// let x = MethodPolicy::new().set_selector("example");
9193    /// ```
9194    pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9195        self.selector = v.into();
9196        self
9197    }
9198
9199    /// Sets the value of [request_policies][crate::model::MethodPolicy::request_policies].
9200    ///
9201    /// # Example
9202    /// ```ignore,no_run
9203    /// # use google_cloud_api::model::MethodPolicy;
9204    /// use google_cloud_api::model::FieldPolicy;
9205    /// let x = MethodPolicy::new()
9206    ///     .set_request_policies([
9207    ///         FieldPolicy::default()/* use setters */,
9208    ///         FieldPolicy::default()/* use (different) setters */,
9209    ///     ]);
9210    /// ```
9211    pub fn set_request_policies<T, V>(mut self, v: T) -> Self
9212    where
9213        T: std::iter::IntoIterator<Item = V>,
9214        V: std::convert::Into<crate::model::FieldPolicy>,
9215    {
9216        use std::iter::Iterator;
9217        self.request_policies = v.into_iter().map(|i| i.into()).collect();
9218        self
9219    }
9220}
9221
9222impl wkt::message::Message for MethodPolicy {
9223    fn typename() -> &'static str {
9224        "type.googleapis.com/google.api.MethodPolicy"
9225    }
9226}
9227
9228/// Quota configuration helps to achieve fairness and budgeting in service
9229/// usage.
9230///
9231/// The metric based quota configuration works this way:
9232///
9233/// - The service configuration defines a set of metrics.
9234/// - For API calls, the quota.metric_rules maps methods to metrics with
9235///   corresponding costs.
9236/// - The quota.limits defines limits on the metrics, which will be used for
9237///   quota checks at runtime.
9238///
9239/// An example quota configuration in yaml format:
9240///
9241/// quota:
9242/// limits:
9243///
9244/// ```norust
9245///  - name: apiWriteQpsPerProject
9246///    metric: library.googleapis.com/write_calls
9247///    unit: "1/min/{project}"  # rate limit for consumer projects
9248///    values:
9249///      STANDARD: 10000
9250///
9251///
9252///  (The metric rules bind all methods to the read_calls metric,
9253///   except for the UpdateBook and DeleteBook methods. These two methods
9254///   are mapped to the write_calls metric, with the UpdateBook method
9255///   consuming at twice rate as the DeleteBook method.)
9256///  metric_rules:
9257///  - selector: "*"
9258///    metric_costs:
9259///      library.googleapis.com/read_calls: 1
9260///  - selector: google.example.library.v1.LibraryService.UpdateBook
9261///    metric_costs:
9262///      library.googleapis.com/write_calls: 2
9263///  - selector: google.example.library.v1.LibraryService.DeleteBook
9264///    metric_costs:
9265///      library.googleapis.com/write_calls: 1
9266/// ```
9267///
9268/// Corresponding Metric definition:
9269///
9270/// ```norust
9271///  metrics:
9272///  - name: library.googleapis.com/read_calls
9273///    display_name: Read requests
9274///    metric_kind: DELTA
9275///    value_type: INT64
9276///
9277///  - name: library.googleapis.com/write_calls
9278///    display_name: Write requests
9279///    metric_kind: DELTA
9280///    value_type: INT64
9281/// ```
9282#[derive(Clone, Default, PartialEq)]
9283#[non_exhaustive]
9284pub struct Quota {
9285    /// List of QuotaLimit definitions for the service.
9286    pub limits: std::vec::Vec<crate::model::QuotaLimit>,
9287
9288    /// List of MetricRule definitions, each one mapping a selected method to one
9289    /// or more metrics.
9290    pub metric_rules: std::vec::Vec<crate::model::MetricRule>,
9291
9292    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9293}
9294
9295impl Quota {
9296    /// Creates a new default instance.
9297    pub fn new() -> Self {
9298        std::default::Default::default()
9299    }
9300
9301    /// Sets the value of [limits][crate::model::Quota::limits].
9302    ///
9303    /// # Example
9304    /// ```ignore,no_run
9305    /// # use google_cloud_api::model::Quota;
9306    /// use google_cloud_api::model::QuotaLimit;
9307    /// let x = Quota::new()
9308    ///     .set_limits([
9309    ///         QuotaLimit::default()/* use setters */,
9310    ///         QuotaLimit::default()/* use (different) setters */,
9311    ///     ]);
9312    /// ```
9313    pub fn set_limits<T, V>(mut self, v: T) -> Self
9314    where
9315        T: std::iter::IntoIterator<Item = V>,
9316        V: std::convert::Into<crate::model::QuotaLimit>,
9317    {
9318        use std::iter::Iterator;
9319        self.limits = v.into_iter().map(|i| i.into()).collect();
9320        self
9321    }
9322
9323    /// Sets the value of [metric_rules][crate::model::Quota::metric_rules].
9324    ///
9325    /// # Example
9326    /// ```ignore,no_run
9327    /// # use google_cloud_api::model::Quota;
9328    /// use google_cloud_api::model::MetricRule;
9329    /// let x = Quota::new()
9330    ///     .set_metric_rules([
9331    ///         MetricRule::default()/* use setters */,
9332    ///         MetricRule::default()/* use (different) setters */,
9333    ///     ]);
9334    /// ```
9335    pub fn set_metric_rules<T, V>(mut self, v: T) -> Self
9336    where
9337        T: std::iter::IntoIterator<Item = V>,
9338        V: std::convert::Into<crate::model::MetricRule>,
9339    {
9340        use std::iter::Iterator;
9341        self.metric_rules = v.into_iter().map(|i| i.into()).collect();
9342        self
9343    }
9344}
9345
9346impl wkt::message::Message for Quota {
9347    fn typename() -> &'static str {
9348        "type.googleapis.com/google.api.Quota"
9349    }
9350}
9351
9352/// Bind API methods to metrics. Binding a method to a metric causes that
9353/// metric's configured quota behaviors to apply to the method call.
9354#[derive(Clone, Default, PartialEq)]
9355#[non_exhaustive]
9356pub struct MetricRule {
9357    /// Selects the methods to which this rule applies.
9358    ///
9359    /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
9360    /// details.
9361    ///
9362    /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
9363    pub selector: std::string::String,
9364
9365    /// Metrics to update when the selected methods are called, and the associated
9366    /// cost applied to each metric.
9367    ///
9368    /// The key of the map is the metric name, and the values are the amount
9369    /// increased for the metric against which the quota limits are defined.
9370    /// The value must not be negative.
9371    pub metric_costs: std::collections::HashMap<std::string::String, i64>,
9372
9373    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9374}
9375
9376impl MetricRule {
9377    /// Creates a new default instance.
9378    pub fn new() -> Self {
9379        std::default::Default::default()
9380    }
9381
9382    /// Sets the value of [selector][crate::model::MetricRule::selector].
9383    ///
9384    /// # Example
9385    /// ```ignore,no_run
9386    /// # use google_cloud_api::model::MetricRule;
9387    /// let x = MetricRule::new().set_selector("example");
9388    /// ```
9389    pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9390        self.selector = v.into();
9391        self
9392    }
9393
9394    /// Sets the value of [metric_costs][crate::model::MetricRule::metric_costs].
9395    ///
9396    /// # Example
9397    /// ```ignore,no_run
9398    /// # use google_cloud_api::model::MetricRule;
9399    /// let x = MetricRule::new().set_metric_costs([
9400    ///     ("key0", 123),
9401    ///     ("key1", 456),
9402    /// ]);
9403    /// ```
9404    pub fn set_metric_costs<T, K, V>(mut self, v: T) -> Self
9405    where
9406        T: std::iter::IntoIterator<Item = (K, V)>,
9407        K: std::convert::Into<std::string::String>,
9408        V: std::convert::Into<i64>,
9409    {
9410        use std::iter::Iterator;
9411        self.metric_costs = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9412        self
9413    }
9414}
9415
9416impl wkt::message::Message for MetricRule {
9417    fn typename() -> &'static str {
9418        "type.googleapis.com/google.api.MetricRule"
9419    }
9420}
9421
9422/// `QuotaLimit` defines a specific limit that applies over a specified duration
9423/// for a limit type. There can be at most one limit for a duration and limit
9424/// type combination defined within a `QuotaGroup`.
9425#[derive(Clone, Default, PartialEq)]
9426#[non_exhaustive]
9427pub struct QuotaLimit {
9428    /// Name of the quota limit.
9429    ///
9430    /// The name must be provided, and it must be unique within the service. The
9431    /// name can only include alphanumeric characters as well as '-'.
9432    ///
9433    /// The maximum length of the limit name is 64 characters.
9434    pub name: std::string::String,
9435
9436    /// Optional. User-visible, extended description for this quota limit.
9437    /// Should be used only when more context is needed to understand this limit
9438    /// than provided by the limit's display name (see: `display_name`).
9439    pub description: std::string::String,
9440
9441    /// Default number of tokens that can be consumed during the specified
9442    /// duration. This is the number of tokens assigned when a client
9443    /// application developer activates the service for his/her project.
9444    ///
9445    /// Specifying a value of 0 will block all requests. This can be used if you
9446    /// are provisioning quota to selected consumers and blocking others.
9447    /// Similarly, a value of -1 will indicate an unlimited quota. No other
9448    /// negative values are allowed.
9449    ///
9450    /// Used by group-based quotas only.
9451    pub default_limit: i64,
9452
9453    /// Maximum number of tokens that can be consumed during the specified
9454    /// duration. Client application developers can override the default limit up
9455    /// to this maximum. If specified, this value cannot be set to a value less
9456    /// than the default limit. If not specified, it is set to the default limit.
9457    ///
9458    /// To allow clients to apply overrides with no upper bound, set this to -1,
9459    /// indicating unlimited maximum quota.
9460    ///
9461    /// Used by group-based quotas only.
9462    pub max_limit: i64,
9463
9464    /// Free tier value displayed in the Developers Console for this limit.
9465    /// The free tier is the number of tokens that will be subtracted from the
9466    /// billed amount when billing is enabled.
9467    /// This field can only be set on a limit with duration "1d", in a billable
9468    /// group; it is invalid on any other limit. If this field is not set, it
9469    /// defaults to 0, indicating that there is no free tier for this service.
9470    ///
9471    /// Used by group-based quotas only.
9472    pub free_tier: i64,
9473
9474    /// Duration of this limit in textual notation. Must be "100s" or "1d".
9475    ///
9476    /// Used by group-based quotas only.
9477    pub duration: std::string::String,
9478
9479    /// The name of the metric this quota limit applies to. The quota limits with
9480    /// the same metric will be checked together during runtime. The metric must be
9481    /// defined within the service config.
9482    pub metric: std::string::String,
9483
9484    /// Specify the unit of the quota limit. It uses the same syntax as
9485    /// [MetricDescriptor.unit][google.api.MetricDescriptor.unit]. The supported
9486    /// unit kinds are determined by the quota backend system.
9487    ///
9488    /// Here are some examples:
9489    ///
9490    /// * "1/min/{project}" for quota per minute per project.
9491    ///
9492    /// Note: the order of unit components is insignificant.
9493    /// The "1" at the beginning is required to follow the metric unit syntax.
9494    ///
9495    /// [google.api.MetricDescriptor.unit]: crate::model::MetricDescriptor::unit
9496    pub unit: std::string::String,
9497
9498    /// Tiered limit values. You must specify this as a key:value pair, with an
9499    /// integer value that is the maximum number of requests allowed for the
9500    /// specified unit. Currently only STANDARD is supported.
9501    pub values: std::collections::HashMap<std::string::String, i64>,
9502
9503    /// User-visible display name for this limit.
9504    /// Optional. If not set, the UI will provide a default display name based on
9505    /// the quota configuration. This field can be used to override the default
9506    /// display name generated from the configuration.
9507    pub display_name: std::string::String,
9508
9509    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9510}
9511
9512impl QuotaLimit {
9513    /// Creates a new default instance.
9514    pub fn new() -> Self {
9515        std::default::Default::default()
9516    }
9517
9518    /// Sets the value of [name][crate::model::QuotaLimit::name].
9519    ///
9520    /// # Example
9521    /// ```ignore,no_run
9522    /// # use google_cloud_api::model::QuotaLimit;
9523    /// let x = QuotaLimit::new().set_name("example");
9524    /// ```
9525    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9526        self.name = v.into();
9527        self
9528    }
9529
9530    /// Sets the value of [description][crate::model::QuotaLimit::description].
9531    ///
9532    /// # Example
9533    /// ```ignore,no_run
9534    /// # use google_cloud_api::model::QuotaLimit;
9535    /// let x = QuotaLimit::new().set_description("example");
9536    /// ```
9537    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9538        self.description = v.into();
9539        self
9540    }
9541
9542    /// Sets the value of [default_limit][crate::model::QuotaLimit::default_limit].
9543    ///
9544    /// # Example
9545    /// ```ignore,no_run
9546    /// # use google_cloud_api::model::QuotaLimit;
9547    /// let x = QuotaLimit::new().set_default_limit(42);
9548    /// ```
9549    pub fn set_default_limit<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
9550        self.default_limit = v.into();
9551        self
9552    }
9553
9554    /// Sets the value of [max_limit][crate::model::QuotaLimit::max_limit].
9555    ///
9556    /// # Example
9557    /// ```ignore,no_run
9558    /// # use google_cloud_api::model::QuotaLimit;
9559    /// let x = QuotaLimit::new().set_max_limit(42);
9560    /// ```
9561    pub fn set_max_limit<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
9562        self.max_limit = v.into();
9563        self
9564    }
9565
9566    /// Sets the value of [free_tier][crate::model::QuotaLimit::free_tier].
9567    ///
9568    /// # Example
9569    /// ```ignore,no_run
9570    /// # use google_cloud_api::model::QuotaLimit;
9571    /// let x = QuotaLimit::new().set_free_tier(42);
9572    /// ```
9573    pub fn set_free_tier<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
9574        self.free_tier = v.into();
9575        self
9576    }
9577
9578    /// Sets the value of [duration][crate::model::QuotaLimit::duration].
9579    ///
9580    /// # Example
9581    /// ```ignore,no_run
9582    /// # use google_cloud_api::model::QuotaLimit;
9583    /// let x = QuotaLimit::new().set_duration("example");
9584    /// ```
9585    pub fn set_duration<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9586        self.duration = v.into();
9587        self
9588    }
9589
9590    /// Sets the value of [metric][crate::model::QuotaLimit::metric].
9591    ///
9592    /// # Example
9593    /// ```ignore,no_run
9594    /// # use google_cloud_api::model::QuotaLimit;
9595    /// let x = QuotaLimit::new().set_metric("example");
9596    /// ```
9597    pub fn set_metric<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9598        self.metric = v.into();
9599        self
9600    }
9601
9602    /// Sets the value of [unit][crate::model::QuotaLimit::unit].
9603    ///
9604    /// # Example
9605    /// ```ignore,no_run
9606    /// # use google_cloud_api::model::QuotaLimit;
9607    /// let x = QuotaLimit::new().set_unit("example");
9608    /// ```
9609    pub fn set_unit<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9610        self.unit = v.into();
9611        self
9612    }
9613
9614    /// Sets the value of [values][crate::model::QuotaLimit::values].
9615    ///
9616    /// # Example
9617    /// ```ignore,no_run
9618    /// # use google_cloud_api::model::QuotaLimit;
9619    /// let x = QuotaLimit::new().set_values([
9620    ///     ("key0", 123),
9621    ///     ("key1", 456),
9622    /// ]);
9623    /// ```
9624    pub fn set_values<T, K, V>(mut self, v: T) -> Self
9625    where
9626        T: std::iter::IntoIterator<Item = (K, V)>,
9627        K: std::convert::Into<std::string::String>,
9628        V: std::convert::Into<i64>,
9629    {
9630        use std::iter::Iterator;
9631        self.values = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9632        self
9633    }
9634
9635    /// Sets the value of [display_name][crate::model::QuotaLimit::display_name].
9636    ///
9637    /// # Example
9638    /// ```ignore,no_run
9639    /// # use google_cloud_api::model::QuotaLimit;
9640    /// let x = QuotaLimit::new().set_display_name("example");
9641    /// ```
9642    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9643        self.display_name = v.into();
9644        self
9645    }
9646}
9647
9648impl wkt::message::Message for QuotaLimit {
9649    fn typename() -> &'static str {
9650        "type.googleapis.com/google.api.QuotaLimit"
9651    }
9652}
9653
9654/// A simple descriptor of a resource type.
9655///
9656/// ResourceDescriptor annotates a resource message (either by means of a
9657/// protobuf annotation or use in the service config), and associates the
9658/// resource's schema, the resource type, and the pattern of the resource name.
9659///
9660/// Example:
9661///
9662/// ```norust
9663/// message Topic {
9664///   // Indicates this message defines a resource schema.
9665///   // Declares the resource type in the format of {service}/{kind}.
9666///   // For Kubernetes resources, the format is {api group}/{kind}.
9667///   option (google.api.resource) = {
9668///     type: "pubsub.googleapis.com/Topic"
9669///     pattern: "projects/{project}/topics/{topic}"
9670///   };
9671/// }
9672/// ```
9673///
9674/// The ResourceDescriptor Yaml config will look like:
9675///
9676/// ```norust
9677/// resources:
9678/// - type: "pubsub.googleapis.com/Topic"
9679///   pattern: "projects/{project}/topics/{topic}"
9680/// ```
9681///
9682/// Sometimes, resources have multiple patterns, typically because they can
9683/// live under multiple parents.
9684///
9685/// Example:
9686///
9687/// ```norust
9688/// message LogEntry {
9689///   option (google.api.resource) = {
9690///     type: "logging.googleapis.com/LogEntry"
9691///     pattern: "projects/{project}/logs/{log}"
9692///     pattern: "folders/{folder}/logs/{log}"
9693///     pattern: "organizations/{organization}/logs/{log}"
9694///     pattern: "billingAccounts/{billing_account}/logs/{log}"
9695///   };
9696/// }
9697/// ```
9698///
9699/// The ResourceDescriptor Yaml config will look like:
9700///
9701/// ```norust
9702/// resources:
9703/// - type: 'logging.googleapis.com/LogEntry'
9704///   pattern: "projects/{project}/logs/{log}"
9705///   pattern: "folders/{folder}/logs/{log}"
9706///   pattern: "organizations/{organization}/logs/{log}"
9707///   pattern: "billingAccounts/{billing_account}/logs/{log}"
9708/// ```
9709#[derive(Clone, Default, PartialEq)]
9710#[non_exhaustive]
9711pub struct ResourceDescriptor {
9712    /// The resource type. It must be in the format of
9713    /// {service_name}/{resource_type_kind}. The `resource_type_kind` must be
9714    /// singular and must not include version numbers.
9715    ///
9716    /// Example: `storage.googleapis.com/Bucket`
9717    ///
9718    /// The value of the resource_type_kind must follow the regular expression
9719    /// /[A-Za-z][a-zA-Z0-9]+/. It should start with an upper case character and
9720    /// should use PascalCase (UpperCamelCase). The maximum number of
9721    /// characters allowed for the `resource_type_kind` is 100.
9722    pub r#type: std::string::String,
9723
9724    /// Optional. The relative resource name pattern associated with this resource
9725    /// type. The DNS prefix of the full resource name shouldn't be specified here.
9726    ///
9727    /// The path pattern must follow the syntax, which aligns with HTTP binding
9728    /// syntax:
9729    ///
9730    /// ```norust
9731    /// Template = Segment { "/" Segment } ;
9732    /// Segment = LITERAL | Variable ;
9733    /// Variable = "{" LITERAL "}" ;
9734    /// ```
9735    ///
9736    /// Examples:
9737    ///
9738    /// ```norust
9739    /// - "projects/{project}/topics/{topic}"
9740    /// - "projects/{project}/knowledgeBases/{knowledge_base}"
9741    /// ```
9742    ///
9743    /// The components in braces correspond to the IDs for each resource in the
9744    /// hierarchy. It is expected that, if multiple patterns are provided,
9745    /// the same component name (e.g. "project") refers to IDs of the same
9746    /// type of resource.
9747    pub pattern: std::vec::Vec<std::string::String>,
9748
9749    /// Optional. The field on the resource that designates the resource name
9750    /// field. If omitted, this is assumed to be "name".
9751    pub name_field: std::string::String,
9752
9753    /// Optional. The historical or future-looking state of the resource pattern.
9754    ///
9755    /// Example:
9756    ///
9757    /// ```norust
9758    /// // The InspectTemplate message originally only supported resource
9759    /// // names with organization, and project was added later.
9760    /// message InspectTemplate {
9761    ///   option (google.api.resource) = {
9762    ///     type: "dlp.googleapis.com/InspectTemplate"
9763    ///     pattern:
9764    ///     "organizations/{organization}/inspectTemplates/{inspect_template}"
9765    ///     pattern: "projects/{project}/inspectTemplates/{inspect_template}"
9766    ///     history: ORIGINALLY_SINGLE_PATTERN
9767    ///   };
9768    /// }
9769    /// ```
9770    pub history: crate::model::resource_descriptor::History,
9771
9772    /// The plural name used in the resource name and permission names, such as
9773    /// 'projects' for the resource name of 'projects/{project}' and the permission
9774    /// name of 'cloudresourcemanager.googleapis.com/projects.get'. One exception
9775    /// to this is for Nested Collections that have stuttering names, as defined
9776    /// in [AIP-122](https://google.aip.dev/122#nested-collections), where the
9777    /// collection ID in the resource name pattern does not necessarily directly
9778    /// match the `plural` value.
9779    ///
9780    /// It is the same concept of the `plural` field in k8s CRD spec
9781    /// <https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/>
9782    ///
9783    /// Note: The plural form is required even for singleton resources. See
9784    /// <https://aip.dev/156>
9785    pub plural: std::string::String,
9786
9787    /// The same concept of the `singular` field in k8s CRD spec
9788    /// <https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/>
9789    /// Such as "project" for the `resourcemanager.googleapis.com/Project` type.
9790    pub singular: std::string::String,
9791
9792    /// Style flag(s) for this resource.
9793    /// These indicate that a resource is expected to conform to a given
9794    /// style. See the specific style flags for additional information.
9795    pub style: std::vec::Vec<crate::model::resource_descriptor::Style>,
9796
9797    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9798}
9799
9800impl ResourceDescriptor {
9801    /// Creates a new default instance.
9802    pub fn new() -> Self {
9803        std::default::Default::default()
9804    }
9805
9806    /// Sets the value of [r#type][crate::model::ResourceDescriptor::type].
9807    ///
9808    /// # Example
9809    /// ```ignore,no_run
9810    /// # use google_cloud_api::model::ResourceDescriptor;
9811    /// let x = ResourceDescriptor::new().set_type("example");
9812    /// ```
9813    pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9814        self.r#type = v.into();
9815        self
9816    }
9817
9818    /// Sets the value of [pattern][crate::model::ResourceDescriptor::pattern].
9819    ///
9820    /// # Example
9821    /// ```ignore,no_run
9822    /// # use google_cloud_api::model::ResourceDescriptor;
9823    /// let x = ResourceDescriptor::new().set_pattern(["a", "b", "c"]);
9824    /// ```
9825    pub fn set_pattern<T, V>(mut self, v: T) -> Self
9826    where
9827        T: std::iter::IntoIterator<Item = V>,
9828        V: std::convert::Into<std::string::String>,
9829    {
9830        use std::iter::Iterator;
9831        self.pattern = v.into_iter().map(|i| i.into()).collect();
9832        self
9833    }
9834
9835    /// Sets the value of [name_field][crate::model::ResourceDescriptor::name_field].
9836    ///
9837    /// # Example
9838    /// ```ignore,no_run
9839    /// # use google_cloud_api::model::ResourceDescriptor;
9840    /// let x = ResourceDescriptor::new().set_name_field("example");
9841    /// ```
9842    pub fn set_name_field<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9843        self.name_field = v.into();
9844        self
9845    }
9846
9847    /// Sets the value of [history][crate::model::ResourceDescriptor::history].
9848    ///
9849    /// # Example
9850    /// ```ignore,no_run
9851    /// # use google_cloud_api::model::ResourceDescriptor;
9852    /// use google_cloud_api::model::resource_descriptor::History;
9853    /// let x0 = ResourceDescriptor::new().set_history(History::OriginallySinglePattern);
9854    /// let x1 = ResourceDescriptor::new().set_history(History::FutureMultiPattern);
9855    /// ```
9856    pub fn set_history<T: std::convert::Into<crate::model::resource_descriptor::History>>(
9857        mut self,
9858        v: T,
9859    ) -> Self {
9860        self.history = v.into();
9861        self
9862    }
9863
9864    /// Sets the value of [plural][crate::model::ResourceDescriptor::plural].
9865    ///
9866    /// # Example
9867    /// ```ignore,no_run
9868    /// # use google_cloud_api::model::ResourceDescriptor;
9869    /// let x = ResourceDescriptor::new().set_plural("example");
9870    /// ```
9871    pub fn set_plural<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9872        self.plural = v.into();
9873        self
9874    }
9875
9876    /// Sets the value of [singular][crate::model::ResourceDescriptor::singular].
9877    ///
9878    /// # Example
9879    /// ```ignore,no_run
9880    /// # use google_cloud_api::model::ResourceDescriptor;
9881    /// let x = ResourceDescriptor::new().set_singular("example");
9882    /// ```
9883    pub fn set_singular<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9884        self.singular = v.into();
9885        self
9886    }
9887
9888    /// Sets the value of [style][crate::model::ResourceDescriptor::style].
9889    ///
9890    /// # Example
9891    /// ```ignore,no_run
9892    /// # use google_cloud_api::model::ResourceDescriptor;
9893    /// use google_cloud_api::model::resource_descriptor::Style;
9894    /// let x = ResourceDescriptor::new().set_style([
9895    ///     Style::DeclarativeFriendly,
9896    /// ]);
9897    /// ```
9898    pub fn set_style<T, V>(mut self, v: T) -> Self
9899    where
9900        T: std::iter::IntoIterator<Item = V>,
9901        V: std::convert::Into<crate::model::resource_descriptor::Style>,
9902    {
9903        use std::iter::Iterator;
9904        self.style = v.into_iter().map(|i| i.into()).collect();
9905        self
9906    }
9907}
9908
9909impl wkt::message::Message for ResourceDescriptor {
9910    fn typename() -> &'static str {
9911        "type.googleapis.com/google.api.ResourceDescriptor"
9912    }
9913}
9914
9915/// Defines additional types related to [ResourceDescriptor].
9916pub mod resource_descriptor {
9917    #[allow(unused_imports)]
9918    use super::*;
9919
9920    /// A description of the historical or future-looking state of the
9921    /// resource pattern.
9922    ///
9923    /// # Working with unknown values
9924    ///
9925    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9926    /// additional enum variants at any time. Adding new variants is not considered
9927    /// a breaking change. Applications should write their code in anticipation of:
9928    ///
9929    /// - New values appearing in future releases of the client library, **and**
9930    /// - New values received dynamically, without application changes.
9931    ///
9932    /// Please consult the [Working with enums] section in the user guide for some
9933    /// guidelines.
9934    ///
9935    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
9936    #[derive(Clone, Debug, PartialEq)]
9937    #[non_exhaustive]
9938    pub enum History {
9939        /// The "unset" value.
9940        Unspecified,
9941        /// The resource originally had one pattern and launched as such, and
9942        /// additional patterns were added later.
9943        OriginallySinglePattern,
9944        /// The resource has one pattern, but the API owner expects to add more
9945        /// later. (This is the inverse of ORIGINALLY_SINGLE_PATTERN, and prevents
9946        /// that from being necessary once there are multiple patterns.)
9947        FutureMultiPattern,
9948        /// If set, the enum was initialized with an unknown value.
9949        ///
9950        /// Applications can examine the value using [History::value] or
9951        /// [History::name].
9952        UnknownValue(history::UnknownValue),
9953    }
9954
9955    #[doc(hidden)]
9956    pub mod history {
9957        #[allow(unused_imports)]
9958        use super::*;
9959        #[derive(Clone, Debug, PartialEq)]
9960        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9961    }
9962
9963    impl History {
9964        /// Gets the enum value.
9965        ///
9966        /// Returns `None` if the enum contains an unknown value deserialized from
9967        /// the string representation of enums.
9968        pub fn value(&self) -> std::option::Option<i32> {
9969            match self {
9970                Self::Unspecified => std::option::Option::Some(0),
9971                Self::OriginallySinglePattern => std::option::Option::Some(1),
9972                Self::FutureMultiPattern => std::option::Option::Some(2),
9973                Self::UnknownValue(u) => u.0.value(),
9974            }
9975        }
9976
9977        /// Gets the enum value as a string.
9978        ///
9979        /// Returns `None` if the enum contains an unknown value deserialized from
9980        /// the integer representation of enums.
9981        pub fn name(&self) -> std::option::Option<&str> {
9982            match self {
9983                Self::Unspecified => std::option::Option::Some("HISTORY_UNSPECIFIED"),
9984                Self::OriginallySinglePattern => {
9985                    std::option::Option::Some("ORIGINALLY_SINGLE_PATTERN")
9986                }
9987                Self::FutureMultiPattern => std::option::Option::Some("FUTURE_MULTI_PATTERN"),
9988                Self::UnknownValue(u) => u.0.name(),
9989            }
9990        }
9991    }
9992
9993    impl std::default::Default for History {
9994        fn default() -> Self {
9995            use std::convert::From;
9996            Self::from(0)
9997        }
9998    }
9999
10000    impl std::fmt::Display for History {
10001        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10002            wkt::internal::display_enum(f, self.name(), self.value())
10003        }
10004    }
10005
10006    impl std::convert::From<i32> for History {
10007        fn from(value: i32) -> Self {
10008            match value {
10009                0 => Self::Unspecified,
10010                1 => Self::OriginallySinglePattern,
10011                2 => Self::FutureMultiPattern,
10012                _ => Self::UnknownValue(history::UnknownValue(
10013                    wkt::internal::UnknownEnumValue::Integer(value),
10014                )),
10015            }
10016        }
10017    }
10018
10019    impl std::convert::From<&str> for History {
10020        fn from(value: &str) -> Self {
10021            use std::string::ToString;
10022            match value {
10023                "HISTORY_UNSPECIFIED" => Self::Unspecified,
10024                "ORIGINALLY_SINGLE_PATTERN" => Self::OriginallySinglePattern,
10025                "FUTURE_MULTI_PATTERN" => Self::FutureMultiPattern,
10026                _ => Self::UnknownValue(history::UnknownValue(
10027                    wkt::internal::UnknownEnumValue::String(value.to_string()),
10028                )),
10029            }
10030        }
10031    }
10032
10033    impl serde::ser::Serialize for History {
10034        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10035        where
10036            S: serde::Serializer,
10037        {
10038            match self {
10039                Self::Unspecified => serializer.serialize_i32(0),
10040                Self::OriginallySinglePattern => serializer.serialize_i32(1),
10041                Self::FutureMultiPattern => serializer.serialize_i32(2),
10042                Self::UnknownValue(u) => u.0.serialize(serializer),
10043            }
10044        }
10045    }
10046
10047    impl<'de> serde::de::Deserialize<'de> for History {
10048        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10049        where
10050            D: serde::Deserializer<'de>,
10051        {
10052            deserializer.deserialize_any(wkt::internal::EnumVisitor::<History>::new(
10053                ".google.api.ResourceDescriptor.History",
10054            ))
10055        }
10056    }
10057
10058    /// A flag representing a specific style that a resource claims to conform to.
10059    ///
10060    /// # Working with unknown values
10061    ///
10062    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10063    /// additional enum variants at any time. Adding new variants is not considered
10064    /// a breaking change. Applications should write their code in anticipation of:
10065    ///
10066    /// - New values appearing in future releases of the client library, **and**
10067    /// - New values received dynamically, without application changes.
10068    ///
10069    /// Please consult the [Working with enums] section in the user guide for some
10070    /// guidelines.
10071    ///
10072    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
10073    #[derive(Clone, Debug, PartialEq)]
10074    #[non_exhaustive]
10075    pub enum Style {
10076        /// The unspecified value. Do not use.
10077        Unspecified,
10078        /// This resource is intended to be "declarative-friendly".
10079        ///
10080        /// Declarative-friendly resources must be more strictly consistent, and
10081        /// setting this to true communicates to tools that this resource should
10082        /// adhere to declarative-friendly expectations.
10083        ///
10084        /// Note: This is used by the API linter (linter.aip.dev) to enable
10085        /// additional checks.
10086        DeclarativeFriendly,
10087        /// If set, the enum was initialized with an unknown value.
10088        ///
10089        /// Applications can examine the value using [Style::value] or
10090        /// [Style::name].
10091        UnknownValue(style::UnknownValue),
10092    }
10093
10094    #[doc(hidden)]
10095    pub mod style {
10096        #[allow(unused_imports)]
10097        use super::*;
10098        #[derive(Clone, Debug, PartialEq)]
10099        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10100    }
10101
10102    impl Style {
10103        /// Gets the enum value.
10104        ///
10105        /// Returns `None` if the enum contains an unknown value deserialized from
10106        /// the string representation of enums.
10107        pub fn value(&self) -> std::option::Option<i32> {
10108            match self {
10109                Self::Unspecified => std::option::Option::Some(0),
10110                Self::DeclarativeFriendly => std::option::Option::Some(1),
10111                Self::UnknownValue(u) => u.0.value(),
10112            }
10113        }
10114
10115        /// Gets the enum value as a string.
10116        ///
10117        /// Returns `None` if the enum contains an unknown value deserialized from
10118        /// the integer representation of enums.
10119        pub fn name(&self) -> std::option::Option<&str> {
10120            match self {
10121                Self::Unspecified => std::option::Option::Some("STYLE_UNSPECIFIED"),
10122                Self::DeclarativeFriendly => std::option::Option::Some("DECLARATIVE_FRIENDLY"),
10123                Self::UnknownValue(u) => u.0.name(),
10124            }
10125        }
10126    }
10127
10128    impl std::default::Default for Style {
10129        fn default() -> Self {
10130            use std::convert::From;
10131            Self::from(0)
10132        }
10133    }
10134
10135    impl std::fmt::Display for Style {
10136        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10137            wkt::internal::display_enum(f, self.name(), self.value())
10138        }
10139    }
10140
10141    impl std::convert::From<i32> for Style {
10142        fn from(value: i32) -> Self {
10143            match value {
10144                0 => Self::Unspecified,
10145                1 => Self::DeclarativeFriendly,
10146                _ => Self::UnknownValue(style::UnknownValue(
10147                    wkt::internal::UnknownEnumValue::Integer(value),
10148                )),
10149            }
10150        }
10151    }
10152
10153    impl std::convert::From<&str> for Style {
10154        fn from(value: &str) -> Self {
10155            use std::string::ToString;
10156            match value {
10157                "STYLE_UNSPECIFIED" => Self::Unspecified,
10158                "DECLARATIVE_FRIENDLY" => Self::DeclarativeFriendly,
10159                _ => Self::UnknownValue(style::UnknownValue(
10160                    wkt::internal::UnknownEnumValue::String(value.to_string()),
10161                )),
10162            }
10163        }
10164    }
10165
10166    impl serde::ser::Serialize for Style {
10167        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10168        where
10169            S: serde::Serializer,
10170        {
10171            match self {
10172                Self::Unspecified => serializer.serialize_i32(0),
10173                Self::DeclarativeFriendly => serializer.serialize_i32(1),
10174                Self::UnknownValue(u) => u.0.serialize(serializer),
10175            }
10176        }
10177    }
10178
10179    impl<'de> serde::de::Deserialize<'de> for Style {
10180        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10181        where
10182            D: serde::Deserializer<'de>,
10183        {
10184            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Style>::new(
10185                ".google.api.ResourceDescriptor.Style",
10186            ))
10187        }
10188    }
10189}
10190
10191/// Defines a proto annotation that describes a string field that refers to
10192/// an API resource.
10193#[derive(Clone, Default, PartialEq)]
10194#[non_exhaustive]
10195pub struct ResourceReference {
10196    /// The resource type that the annotated field references.
10197    ///
10198    /// Example:
10199    ///
10200    /// ```norust
10201    /// message Subscription {
10202    ///   string topic = 2 [(google.api.resource_reference) = {
10203    ///     type: "pubsub.googleapis.com/Topic"
10204    ///   }];
10205    /// }
10206    /// ```
10207    ///
10208    /// Occasionally, a field may reference an arbitrary resource. In this case,
10209    /// APIs use the special value * in their resource reference.
10210    ///
10211    /// Example:
10212    ///
10213    /// ```norust
10214    /// message GetIamPolicyRequest {
10215    ///   string resource = 2 [(google.api.resource_reference) = {
10216    ///     type: "*"
10217    ///   }];
10218    /// }
10219    /// ```
10220    pub r#type: std::string::String,
10221
10222    /// The resource type of a child collection that the annotated field
10223    /// references. This is useful for annotating the `parent` field that
10224    /// doesn't have a fixed resource type.
10225    ///
10226    /// Example:
10227    ///
10228    /// ```norust
10229    /// message ListLogEntriesRequest {
10230    ///   string parent = 1 [(google.api.resource_reference) = {
10231    ///     child_type: "logging.googleapis.com/LogEntry"
10232    ///   };
10233    /// }
10234    /// ```
10235    pub child_type: std::string::String,
10236
10237    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10238}
10239
10240impl ResourceReference {
10241    /// Creates a new default instance.
10242    pub fn new() -> Self {
10243        std::default::Default::default()
10244    }
10245
10246    /// Sets the value of [r#type][crate::model::ResourceReference::type].
10247    ///
10248    /// # Example
10249    /// ```ignore,no_run
10250    /// # use google_cloud_api::model::ResourceReference;
10251    /// let x = ResourceReference::new().set_type("example");
10252    /// ```
10253    pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10254        self.r#type = v.into();
10255        self
10256    }
10257
10258    /// Sets the value of [child_type][crate::model::ResourceReference::child_type].
10259    ///
10260    /// # Example
10261    /// ```ignore,no_run
10262    /// # use google_cloud_api::model::ResourceReference;
10263    /// let x = ResourceReference::new().set_child_type("example");
10264    /// ```
10265    pub fn set_child_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10266        self.child_type = v.into();
10267        self
10268    }
10269}
10270
10271impl wkt::message::Message for ResourceReference {
10272    fn typename() -> &'static str {
10273        "type.googleapis.com/google.api.ResourceReference"
10274    }
10275}
10276
10277/// Specifies the routing information that should be sent along with the request
10278/// in the form of routing header.
10279/// **NOTE:** All service configuration rules follow the "last one wins" order.
10280///
10281/// The examples below will apply to an RPC which has the following request type:
10282///
10283/// Message Definition:
10284///
10285/// ```norust
10286/// message Request {
10287///   // The name of the Table
10288///   // Values can be of the following formats:
10289///   // - `projects/<project>/tables/<table>`
10290///   // - `projects/<project>/instances/<instance>/tables/<table>`
10291///   // - `region/<region>/zones/<zone>/tables/<table>`
10292///   string table_name = 1;
10293///
10294///   // This value specifies routing for replication.
10295///   // It can be in the following formats:
10296///   // - `profiles/<profile_id>`
10297///   // - a legacy `profile_id` that can be any string
10298///   string app_profile_id = 2;
10299/// }
10300/// ```
10301///
10302/// Example message:
10303///
10304/// ```norust
10305/// {
10306///   table_name: projects/proj_foo/instances/instance_bar/table/table_baz,
10307///   app_profile_id: profiles/prof_qux
10308/// }
10309/// ```
10310///
10311/// The routing header consists of one or multiple key-value pairs. The order of
10312/// the key-value pairs is undefined, the order of the `routing_parameters` in
10313/// the `RoutingRule` only matters for the evaluation order of the path
10314/// templates when `field` is the same. See the examples below for more details.
10315///
10316/// Every key and value in the routing header must be percent-encoded,
10317/// and joined together in the following format: `key1=value1&key2=value2`.
10318/// The examples below skip the percent-encoding for readability.
10319///
10320/// Example 1
10321///
10322/// Extracting a field from the request to put into the routing header
10323/// unchanged, with the key equal to the field name.
10324///
10325/// annotation:
10326///
10327/// ```norust
10328/// option (google.api.routing) = {
10329///   // Take the `app_profile_id`.
10330///   routing_parameters {
10331///     field: "app_profile_id"
10332///   }
10333/// };
10334/// ```
10335///
10336/// result:
10337///
10338/// ```norust
10339/// x-goog-request-params: app_profile_id=profiles/prof_qux
10340/// ```
10341///
10342/// Example 2
10343///
10344/// Extracting a field from the request to put into the routing header
10345/// unchanged, with the key different from the field name.
10346///
10347/// annotation:
10348///
10349/// ```norust
10350/// option (google.api.routing) = {
10351///   // Take the `app_profile_id`, but name it `routing_id` in the header.
10352///   routing_parameters {
10353///     field: "app_profile_id"
10354///     path_template: "{routing_id=**}"
10355///   }
10356/// };
10357/// ```
10358///
10359/// result:
10360///
10361/// ```norust
10362/// x-goog-request-params: routing_id=profiles/prof_qux
10363/// ```
10364///
10365/// Example 3
10366///
10367/// Extracting a field from the request to put into the routing
10368/// header, while matching a path template syntax on the field's value.
10369///
10370/// NB: it is more useful to send nothing than to send garbage for the purpose
10371/// of dynamic routing, since garbage pollutes cache. Thus the matching.
10372///
10373/// Sub-example 3a
10374///
10375/// The field matches the template.
10376///
10377/// annotation:
10378///
10379/// ```norust
10380/// option (google.api.routing) = {
10381///   // Take the `table_name`, if it's well-formed (with project-based
10382///   // syntax).
10383///   routing_parameters {
10384///     field: "table_name"
10385///     path_template: "{table_name=projects/*/instances/*/**}"
10386///   }
10387/// };
10388/// ```
10389///
10390/// result:
10391///
10392/// ```norust
10393/// x-goog-request-params:
10394/// table_name=projects/proj_foo/instances/instance_bar/table/table_baz
10395/// ```
10396///
10397/// Sub-example 3b
10398///
10399/// The field does not match the template.
10400///
10401/// annotation:
10402///
10403/// ```norust
10404/// option (google.api.routing) = {
10405///   // Take the `table_name`, if it's well-formed (with region-based
10406///   // syntax).
10407///   routing_parameters {
10408///     field: "table_name"
10409///     path_template: "{table_name=regions/*/zones/*/**}"
10410///   }
10411/// };
10412/// ```
10413///
10414/// result:
10415///
10416/// ```norust
10417/// <no routing header will be sent>
10418/// ```
10419///
10420/// Sub-example 3c
10421///
10422/// Multiple alternative conflictingly named path templates are
10423/// specified. The one that matches is used to construct the header.
10424///
10425/// annotation:
10426///
10427/// ```norust
10428/// option (google.api.routing) = {
10429///   // Take the `table_name`, if it's well-formed, whether
10430///   // using the region- or projects-based syntax.
10431///
10432///   routing_parameters {
10433///     field: "table_name"
10434///     path_template: "{table_name=regions/*/zones/*/**}"
10435///   }
10436///   routing_parameters {
10437///     field: "table_name"
10438///     path_template: "{table_name=projects/*/instances/*/**}"
10439///   }
10440/// };
10441/// ```
10442///
10443/// result:
10444///
10445/// ```norust
10446/// x-goog-request-params:
10447/// table_name=projects/proj_foo/instances/instance_bar/table/table_baz
10448/// ```
10449///
10450/// Example 4
10451///
10452/// Extracting a single routing header key-value pair by matching a
10453/// template syntax on (a part of) a single request field.
10454///
10455/// annotation:
10456///
10457/// ```norust
10458/// option (google.api.routing) = {
10459///   // Take just the project id from the `table_name` field.
10460///   routing_parameters {
10461///     field: "table_name"
10462///     path_template: "{routing_id=projects/*}/**"
10463///   }
10464/// };
10465/// ```
10466///
10467/// result:
10468///
10469/// ```norust
10470/// x-goog-request-params: routing_id=projects/proj_foo
10471/// ```
10472///
10473/// Example 5
10474///
10475/// Extracting a single routing header key-value pair by matching
10476/// several conflictingly named path templates on (parts of) a single request
10477/// field. The last template to match "wins" the conflict.
10478///
10479/// annotation:
10480///
10481/// ```norust
10482/// option (google.api.routing) = {
10483///   // If the `table_name` does not have instances information,
10484///   // take just the project id for routing.
10485///   // Otherwise take project + instance.
10486///
10487///   routing_parameters {
10488///     field: "table_name"
10489///     path_template: "{routing_id=projects/*}/**"
10490///   }
10491///   routing_parameters {
10492///     field: "table_name"
10493///     path_template: "{routing_id=projects/*/instances/*}/**"
10494///   }
10495/// };
10496/// ```
10497///
10498/// result:
10499///
10500/// ```norust
10501/// x-goog-request-params:
10502/// routing_id=projects/proj_foo/instances/instance_bar
10503/// ```
10504///
10505/// Example 6
10506///
10507/// Extracting multiple routing header key-value pairs by matching
10508/// several non-conflicting path templates on (parts of) a single request field.
10509///
10510/// Sub-example 6a
10511///
10512/// Make the templates strict, so that if the `table_name` does not
10513/// have an instance information, nothing is sent.
10514///
10515/// annotation:
10516///
10517/// ```norust
10518/// option (google.api.routing) = {
10519///   // The routing code needs two keys instead of one composite
10520///   // but works only for the tables with the "project-instance" name
10521///   // syntax.
10522///
10523///   routing_parameters {
10524///     field: "table_name"
10525///     path_template: "{project_id=projects/*}/instances/*/**"
10526///   }
10527///   routing_parameters {
10528///     field: "table_name"
10529///     path_template: "projects/*/{instance_id=instances/*}/**"
10530///   }
10531/// };
10532/// ```
10533///
10534/// result:
10535///
10536/// ```norust
10537/// x-goog-request-params:
10538/// project_id=projects/proj_foo&instance_id=instances/instance_bar
10539/// ```
10540///
10541/// Sub-example 6b
10542///
10543/// Make the templates loose, so that if the `table_name` does not
10544/// have an instance information, just the project id part is sent.
10545///
10546/// annotation:
10547///
10548/// ```norust
10549/// option (google.api.routing) = {
10550///   // The routing code wants two keys instead of one composite
10551///   // but will work with just the `project_id` for tables without
10552///   // an instance in the `table_name`.
10553///
10554///   routing_parameters {
10555///     field: "table_name"
10556///     path_template: "{project_id=projects/*}/**"
10557///   }
10558///   routing_parameters {
10559///     field: "table_name"
10560///     path_template: "projects/*/{instance_id=instances/*}/**"
10561///   }
10562/// };
10563/// ```
10564///
10565/// result (is the same as 6a for our example message because it has the instance
10566/// information):
10567///
10568/// ```norust
10569/// x-goog-request-params:
10570/// project_id=projects/proj_foo&instance_id=instances/instance_bar
10571/// ```
10572///
10573/// Example 7
10574///
10575/// Extracting multiple routing header key-value pairs by matching
10576/// several path templates on multiple request fields.
10577///
10578/// NB: note that here there is no way to specify sending nothing if one of the
10579/// fields does not match its template. E.g. if the `table_name` is in the wrong
10580/// format, the `project_id` will not be sent, but the `routing_id` will be.
10581/// The backend routing code has to be aware of that and be prepared to not
10582/// receive a full complement of keys if it expects multiple.
10583///
10584/// annotation:
10585///
10586/// ```norust
10587/// option (google.api.routing) = {
10588///   // The routing needs both `project_id` and `routing_id`
10589///   // (from the `app_profile_id` field) for routing.
10590///
10591///   routing_parameters {
10592///     field: "table_name"
10593///     path_template: "{project_id=projects/*}/**"
10594///   }
10595///   routing_parameters {
10596///     field: "app_profile_id"
10597///     path_template: "{routing_id=**}"
10598///   }
10599/// };
10600/// ```
10601///
10602/// result:
10603///
10604/// ```norust
10605/// x-goog-request-params:
10606/// project_id=projects/proj_foo&routing_id=profiles/prof_qux
10607/// ```
10608///
10609/// Example 8
10610///
10611/// Extracting a single routing header key-value pair by matching
10612/// several conflictingly named path templates on several request fields. The
10613/// last template to match "wins" the conflict.
10614///
10615/// annotation:
10616///
10617/// ```norust
10618/// option (google.api.routing) = {
10619///   // The `routing_id` can be a project id or a region id depending on
10620///   // the table name format, but only if the `app_profile_id` is not set.
10621///   // If `app_profile_id` is set it should be used instead.
10622///
10623///   routing_parameters {
10624///     field: "table_name"
10625///     path_template: "{routing_id=projects/*}/**"
10626///   }
10627///   routing_parameters {
10628///      field: "table_name"
10629///      path_template: "{routing_id=regions/*}/**"
10630///   }
10631///   routing_parameters {
10632///     field: "app_profile_id"
10633///     path_template: "{routing_id=**}"
10634///   }
10635/// };
10636/// ```
10637///
10638/// result:
10639///
10640/// ```norust
10641/// x-goog-request-params: routing_id=profiles/prof_qux
10642/// ```
10643///
10644/// Example 9
10645///
10646/// Bringing it all together.
10647///
10648/// annotation:
10649///
10650/// ```norust
10651/// option (google.api.routing) = {
10652///   // For routing both `table_location` and a `routing_id` are needed.
10653///   //
10654///   // table_location can be either an instance id or a region+zone id.
10655///   //
10656///   // For `routing_id`, take the value of `app_profile_id`
10657///   // - If it's in the format `profiles/<profile_id>`, send
10658///   // just the `<profile_id>` part.
10659///   // - If it's any other literal, send it as is.
10660///   // If the `app_profile_id` is empty, and the `table_name` starts with
10661///   // the project_id, send that instead.
10662///
10663///   routing_parameters {
10664///     field: "table_name"
10665///     path_template: "projects/*/{table_location=instances/*}/tables/*"
10666///   }
10667///   routing_parameters {
10668///     field: "table_name"
10669///     path_template: "{table_location=regions/*/zones/*}/tables/*"
10670///   }
10671///   routing_parameters {
10672///     field: "table_name"
10673///     path_template: "{routing_id=projects/*}/**"
10674///   }
10675///   routing_parameters {
10676///     field: "app_profile_id"
10677///     path_template: "{routing_id=**}"
10678///   }
10679///   routing_parameters {
10680///     field: "app_profile_id"
10681///     path_template: "profiles/{routing_id=*}"
10682///   }
10683/// };
10684/// ```
10685///
10686/// result:
10687///
10688/// ```norust
10689/// x-goog-request-params:
10690/// table_location=instances/instance_bar&routing_id=prof_qux
10691/// ```
10692#[derive(Clone, Default, PartialEq)]
10693#[non_exhaustive]
10694pub struct RoutingRule {
10695    /// A collection of Routing Parameter specifications.
10696    /// **NOTE:** If multiple Routing Parameters describe the same key
10697    /// (via the `path_template` field or via the `field` field when
10698    /// `path_template` is not provided), "last one wins" rule
10699    /// determines which Parameter gets used.
10700    /// See the examples for more details.
10701    pub routing_parameters: std::vec::Vec<crate::model::RoutingParameter>,
10702
10703    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10704}
10705
10706impl RoutingRule {
10707    /// Creates a new default instance.
10708    pub fn new() -> Self {
10709        std::default::Default::default()
10710    }
10711
10712    /// Sets the value of [routing_parameters][crate::model::RoutingRule::routing_parameters].
10713    ///
10714    /// # Example
10715    /// ```ignore,no_run
10716    /// # use google_cloud_api::model::RoutingRule;
10717    /// use google_cloud_api::model::RoutingParameter;
10718    /// let x = RoutingRule::new()
10719    ///     .set_routing_parameters([
10720    ///         RoutingParameter::default()/* use setters */,
10721    ///         RoutingParameter::default()/* use (different) setters */,
10722    ///     ]);
10723    /// ```
10724    pub fn set_routing_parameters<T, V>(mut self, v: T) -> Self
10725    where
10726        T: std::iter::IntoIterator<Item = V>,
10727        V: std::convert::Into<crate::model::RoutingParameter>,
10728    {
10729        use std::iter::Iterator;
10730        self.routing_parameters = v.into_iter().map(|i| i.into()).collect();
10731        self
10732    }
10733}
10734
10735impl wkt::message::Message for RoutingRule {
10736    fn typename() -> &'static str {
10737        "type.googleapis.com/google.api.RoutingRule"
10738    }
10739}
10740
10741/// A projection from an input message to the GRPC or REST header.
10742#[derive(Clone, Default, PartialEq)]
10743#[non_exhaustive]
10744pub struct RoutingParameter {
10745    /// A request field to extract the header key-value pair from.
10746    pub field: std::string::String,
10747
10748    /// A pattern matching the key-value field. Optional.
10749    /// If not specified, the whole field specified in the `field` field will be
10750    /// taken as value, and its name used as key. If specified, it MUST contain
10751    /// exactly one named segment (along with any number of unnamed segments) The
10752    /// pattern will be matched over the field specified in the `field` field, then
10753    /// if the match is successful:
10754    ///
10755    /// - the name of the single named segment will be used as a header name,
10756    /// - the match value of the segment will be used as a header value;
10757    ///   if the match is NOT successful, nothing will be sent.
10758    ///
10759    /// Example:
10760    ///
10761    /// ```norust
10762    ///           -- This is a field in the request message
10763    ///          |   that the header value will be extracted from.
10764    ///          |
10765    ///          |                     -- This is the key name in the
10766    ///          |                    |   routing header.
10767    ///          V                    |
10768    /// field: "table_name"           v
10769    /// path_template: "projects/*/{table_location=instances/*}/tables/*"
10770    ///                                            ^            ^
10771    ///                                            |            |
10772    ///   In the {} brackets is the pattern that --             |
10773    ///   specifies what to extract from the                    |
10774    ///   field as a value to be sent.                          |
10775    ///                                                         |
10776    ///  The string in the field must match the whole pattern --
10777    ///  before brackets, inside brackets, after brackets.
10778    /// ```
10779    ///
10780    /// When looking at this specific example, we can see that:
10781    ///
10782    /// - A key-value pair with the key `table_location`
10783    ///   and the value matching `instances/*` should be added
10784    ///   to the x-goog-request-params routing header.
10785    /// - The value is extracted from the request message's `table_name` field
10786    ///   if it matches the full pattern specified:
10787    ///   `projects/*/instances/*/tables/*`.
10788    ///
10789    /// **NB:** If the `path_template` field is not provided, the key name is
10790    /// equal to the field name, and the whole field should be sent as a value.
10791    /// This makes the pattern for the field and the value functionally equivalent
10792    /// to `**`, and the configuration
10793    ///
10794    /// ```norust
10795    /// {
10796    ///   field: "table_name"
10797    /// }
10798    /// ```
10799    ///
10800    /// is a functionally equivalent shorthand to:
10801    ///
10802    /// ```norust
10803    /// {
10804    ///   field: "table_name"
10805    ///   path_template: "{table_name=**}"
10806    /// }
10807    /// ```
10808    ///
10809    /// See Example 1 for more details.
10810    pub path_template: std::string::String,
10811
10812    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10813}
10814
10815impl RoutingParameter {
10816    /// Creates a new default instance.
10817    pub fn new() -> Self {
10818        std::default::Default::default()
10819    }
10820
10821    /// Sets the value of [field][crate::model::RoutingParameter::field].
10822    ///
10823    /// # Example
10824    /// ```ignore,no_run
10825    /// # use google_cloud_api::model::RoutingParameter;
10826    /// let x = RoutingParameter::new().set_field("example");
10827    /// ```
10828    pub fn set_field<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10829        self.field = v.into();
10830        self
10831    }
10832
10833    /// Sets the value of [path_template][crate::model::RoutingParameter::path_template].
10834    ///
10835    /// # Example
10836    /// ```ignore,no_run
10837    /// # use google_cloud_api::model::RoutingParameter;
10838    /// let x = RoutingParameter::new().set_path_template("example");
10839    /// ```
10840    pub fn set_path_template<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10841        self.path_template = v.into();
10842        self
10843    }
10844}
10845
10846impl wkt::message::Message for RoutingParameter {
10847    fn typename() -> &'static str {
10848        "type.googleapis.com/google.api.RoutingParameter"
10849    }
10850}
10851
10852/// `Service` is the root object of Google API service configuration (service
10853/// config). It describes the basic information about a logical service,
10854/// such as the service name and the user-facing title, and delegates other
10855/// aspects to sub-sections. Each sub-section is either a proto message or a
10856/// repeated proto message that configures a specific aspect, such as auth.
10857/// For more information, see each proto message definition.
10858///
10859/// Example:
10860///
10861/// ```norust
10862/// type: google.api.Service
10863/// name: calendar.googleapis.com
10864/// title: Google Calendar API
10865/// apis:
10866/// - name: google.calendar.v3.Calendar
10867///
10868/// visibility:
10869///   rules:
10870///   - selector: "google.calendar.v3.*"
10871///     restriction: PREVIEW
10872/// backend:
10873///   rules:
10874///   - selector: "google.calendar.v3.*"
10875///     address: calendar.example.com
10876///
10877/// authentication:
10878///   providers:
10879///   - id: google_calendar_auth
10880///     jwks_uri: https://www.googleapis.com/oauth2/v1/certs
10881///     issuer: https://securetoken.google.com
10882///   rules:
10883///   - selector: "*"
10884///     requirements:
10885///       provider_id: google_calendar_auth
10886/// ```
10887#[derive(Clone, Default, PartialEq)]
10888#[non_exhaustive]
10889pub struct Service {
10890    /// The service name, which is a DNS-like logical identifier for the
10891    /// service, such as `calendar.googleapis.com`. The service name
10892    /// typically goes through DNS verification to make sure the owner
10893    /// of the service also owns the DNS name.
10894    pub name: std::string::String,
10895
10896    /// The product title for this service, it is the name displayed in Google
10897    /// Cloud Console.
10898    pub title: std::string::String,
10899
10900    /// The Google project that owns this service.
10901    pub producer_project_id: std::string::String,
10902
10903    /// A unique ID for a specific instance of this message, typically assigned
10904    /// by the client for tracking purpose. Must be no longer than 63 characters
10905    /// and only lower case letters, digits, '.', '_' and '-' are allowed. If
10906    /// empty, the server may choose to generate one instead.
10907    pub id: std::string::String,
10908
10909    /// A list of API interfaces exported by this service. Only the `name` field
10910    /// of the [google.protobuf.Api][google.protobuf.Api] needs to be provided by
10911    /// the configuration author, as the remaining fields will be derived from the
10912    /// IDL during the normalization process. It is an error to specify an API
10913    /// interface here which cannot be resolved against the associated IDL files.
10914    ///
10915    /// [google.protobuf.Api]: wkt::Api
10916    pub apis: std::vec::Vec<wkt::Api>,
10917
10918    /// A list of all proto message types included in this API service.
10919    /// Types referenced directly or indirectly by the `apis` are automatically
10920    /// included.  Messages which are not referenced but shall be included, such as
10921    /// types used by the `google.protobuf.Any` type, should be listed here by
10922    /// name by the configuration author. Example:
10923    ///
10924    /// ```norust
10925    /// types:
10926    /// - name: google.protobuf.Int32
10927    /// ```
10928    pub types: std::vec::Vec<wkt::Type>,
10929
10930    /// A list of all enum types included in this API service.  Enums referenced
10931    /// directly or indirectly by the `apis` are automatically included.  Enums
10932    /// which are not referenced but shall be included should be listed here by
10933    /// name by the configuration author. Example:
10934    ///
10935    /// ```norust
10936    /// enums:
10937    /// - name: google.someapi.v1.SomeEnum
10938    /// ```
10939    pub enums: std::vec::Vec<wkt::Enum>,
10940
10941    /// Additional API documentation.
10942    pub documentation: std::option::Option<crate::model::Documentation>,
10943
10944    /// API backend configuration.
10945    pub backend: std::option::Option<crate::model::Backend>,
10946
10947    /// HTTP configuration.
10948    pub http: std::option::Option<crate::model::Http>,
10949
10950    /// Quota configuration.
10951    pub quota: std::option::Option<crate::model::Quota>,
10952
10953    /// Auth configuration.
10954    pub authentication: std::option::Option<crate::model::Authentication>,
10955
10956    /// Context configuration.
10957    pub context: std::option::Option<crate::model::Context>,
10958
10959    /// Configuration controlling usage of this service.
10960    pub usage: std::option::Option<crate::model::Usage>,
10961
10962    /// Configuration for network endpoints.  If this is empty, then an endpoint
10963    /// with the same name as the service is automatically generated to service all
10964    /// defined APIs.
10965    pub endpoints: std::vec::Vec<crate::model::Endpoint>,
10966
10967    /// Configuration for the service control plane.
10968    pub control: std::option::Option<crate::model::Control>,
10969
10970    /// Defines the logs used by this service.
10971    pub logs: std::vec::Vec<crate::model::LogDescriptor>,
10972
10973    /// Defines the metrics used by this service.
10974    pub metrics: std::vec::Vec<crate::model::MetricDescriptor>,
10975
10976    /// Defines the monitored resources used by this service. This is required
10977    /// by the `Service.monitoring` and `Service.logging` configurations.
10978    pub monitored_resources: std::vec::Vec<crate::model::MonitoredResourceDescriptor>,
10979
10980    /// Billing configuration.
10981    pub billing: std::option::Option<crate::model::Billing>,
10982
10983    /// Logging configuration.
10984    pub logging: std::option::Option<crate::model::Logging>,
10985
10986    /// Monitoring configuration.
10987    pub monitoring: std::option::Option<crate::model::Monitoring>,
10988
10989    /// System parameter configuration.
10990    pub system_parameters: std::option::Option<crate::model::SystemParameters>,
10991
10992    /// Output only. The source information for this configuration if available.
10993    pub source_info: std::option::Option<crate::model::SourceInfo>,
10994
10995    /// Settings for [Google Cloud Client
10996    /// libraries](https://cloud.google.com/apis/docs/cloud-client-libraries)
10997    /// generated from APIs defined as protocol buffers.
10998    pub publishing: std::option::Option<crate::model::Publishing>,
10999
11000    /// Obsolete. Do not use.
11001    ///
11002    /// This field has no semantic meaning. The service config compiler always
11003    /// sets this field to `3`.
11004    pub config_version: std::option::Option<wkt::UInt32Value>,
11005
11006    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11007}
11008
11009impl Service {
11010    /// Creates a new default instance.
11011    pub fn new() -> Self {
11012        std::default::Default::default()
11013    }
11014
11015    /// Sets the value of [name][crate::model::Service::name].
11016    ///
11017    /// # Example
11018    /// ```ignore,no_run
11019    /// # use google_cloud_api::model::Service;
11020    /// let x = Service::new().set_name("example");
11021    /// ```
11022    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11023        self.name = v.into();
11024        self
11025    }
11026
11027    /// Sets the value of [title][crate::model::Service::title].
11028    ///
11029    /// # Example
11030    /// ```ignore,no_run
11031    /// # use google_cloud_api::model::Service;
11032    /// let x = Service::new().set_title("example");
11033    /// ```
11034    pub fn set_title<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11035        self.title = v.into();
11036        self
11037    }
11038
11039    /// Sets the value of [producer_project_id][crate::model::Service::producer_project_id].
11040    ///
11041    /// # Example
11042    /// ```ignore,no_run
11043    /// # use google_cloud_api::model::Service;
11044    /// let x = Service::new().set_producer_project_id("example");
11045    /// ```
11046    pub fn set_producer_project_id<T: std::convert::Into<std::string::String>>(
11047        mut self,
11048        v: T,
11049    ) -> Self {
11050        self.producer_project_id = v.into();
11051        self
11052    }
11053
11054    /// Sets the value of [id][crate::model::Service::id].
11055    ///
11056    /// # Example
11057    /// ```ignore,no_run
11058    /// # use google_cloud_api::model::Service;
11059    /// let x = Service::new().set_id("example");
11060    /// ```
11061    pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11062        self.id = v.into();
11063        self
11064    }
11065
11066    /// Sets the value of [apis][crate::model::Service::apis].
11067    ///
11068    /// # Example
11069    /// ```ignore,no_run
11070    /// # use google_cloud_api::model::Service;
11071    /// use wkt::Api;
11072    /// let x = Service::new()
11073    ///     .set_apis([
11074    ///         Api::default()/* use setters */,
11075    ///         Api::default()/* use (different) setters */,
11076    ///     ]);
11077    /// ```
11078    pub fn set_apis<T, V>(mut self, v: T) -> Self
11079    where
11080        T: std::iter::IntoIterator<Item = V>,
11081        V: std::convert::Into<wkt::Api>,
11082    {
11083        use std::iter::Iterator;
11084        self.apis = v.into_iter().map(|i| i.into()).collect();
11085        self
11086    }
11087
11088    /// Sets the value of [types][crate::model::Service::types].
11089    ///
11090    /// # Example
11091    /// ```ignore,no_run
11092    /// # use google_cloud_api::model::Service;
11093    /// use wkt::Type;
11094    /// let x = Service::new()
11095    ///     .set_types([
11096    ///         Type::default()/* use setters */,
11097    ///         Type::default()/* use (different) setters */,
11098    ///     ]);
11099    /// ```
11100    pub fn set_types<T, V>(mut self, v: T) -> Self
11101    where
11102        T: std::iter::IntoIterator<Item = V>,
11103        V: std::convert::Into<wkt::Type>,
11104    {
11105        use std::iter::Iterator;
11106        self.types = v.into_iter().map(|i| i.into()).collect();
11107        self
11108    }
11109
11110    /// Sets the value of [enums][crate::model::Service::enums].
11111    ///
11112    /// # Example
11113    /// ```ignore,no_run
11114    /// # use google_cloud_api::model::Service;
11115    /// use wkt::Enum;
11116    /// let x = Service::new()
11117    ///     .set_enums([
11118    ///         Enum::default()/* use setters */,
11119    ///         Enum::default()/* use (different) setters */,
11120    ///     ]);
11121    /// ```
11122    pub fn set_enums<T, V>(mut self, v: T) -> Self
11123    where
11124        T: std::iter::IntoIterator<Item = V>,
11125        V: std::convert::Into<wkt::Enum>,
11126    {
11127        use std::iter::Iterator;
11128        self.enums = v.into_iter().map(|i| i.into()).collect();
11129        self
11130    }
11131
11132    /// Sets the value of [documentation][crate::model::Service::documentation].
11133    ///
11134    /// # Example
11135    /// ```ignore,no_run
11136    /// # use google_cloud_api::model::Service;
11137    /// use google_cloud_api::model::Documentation;
11138    /// let x = Service::new().set_documentation(Documentation::default()/* use setters */);
11139    /// ```
11140    pub fn set_documentation<T>(mut self, v: T) -> Self
11141    where
11142        T: std::convert::Into<crate::model::Documentation>,
11143    {
11144        self.documentation = std::option::Option::Some(v.into());
11145        self
11146    }
11147
11148    /// Sets or clears the value of [documentation][crate::model::Service::documentation].
11149    ///
11150    /// # Example
11151    /// ```ignore,no_run
11152    /// # use google_cloud_api::model::Service;
11153    /// use google_cloud_api::model::Documentation;
11154    /// let x = Service::new().set_or_clear_documentation(Some(Documentation::default()/* use setters */));
11155    /// let x = Service::new().set_or_clear_documentation(None::<Documentation>);
11156    /// ```
11157    pub fn set_or_clear_documentation<T>(mut self, v: std::option::Option<T>) -> Self
11158    where
11159        T: std::convert::Into<crate::model::Documentation>,
11160    {
11161        self.documentation = v.map(|x| x.into());
11162        self
11163    }
11164
11165    /// Sets the value of [backend][crate::model::Service::backend].
11166    ///
11167    /// # Example
11168    /// ```ignore,no_run
11169    /// # use google_cloud_api::model::Service;
11170    /// use google_cloud_api::model::Backend;
11171    /// let x = Service::new().set_backend(Backend::default()/* use setters */);
11172    /// ```
11173    pub fn set_backend<T>(mut self, v: T) -> Self
11174    where
11175        T: std::convert::Into<crate::model::Backend>,
11176    {
11177        self.backend = std::option::Option::Some(v.into());
11178        self
11179    }
11180
11181    /// Sets or clears the value of [backend][crate::model::Service::backend].
11182    ///
11183    /// # Example
11184    /// ```ignore,no_run
11185    /// # use google_cloud_api::model::Service;
11186    /// use google_cloud_api::model::Backend;
11187    /// let x = Service::new().set_or_clear_backend(Some(Backend::default()/* use setters */));
11188    /// let x = Service::new().set_or_clear_backend(None::<Backend>);
11189    /// ```
11190    pub fn set_or_clear_backend<T>(mut self, v: std::option::Option<T>) -> Self
11191    where
11192        T: std::convert::Into<crate::model::Backend>,
11193    {
11194        self.backend = v.map(|x| x.into());
11195        self
11196    }
11197
11198    /// Sets the value of [http][crate::model::Service::http].
11199    ///
11200    /// # Example
11201    /// ```ignore,no_run
11202    /// # use google_cloud_api::model::Service;
11203    /// use google_cloud_api::model::Http;
11204    /// let x = Service::new().set_http(Http::default()/* use setters */);
11205    /// ```
11206    pub fn set_http<T>(mut self, v: T) -> Self
11207    where
11208        T: std::convert::Into<crate::model::Http>,
11209    {
11210        self.http = std::option::Option::Some(v.into());
11211        self
11212    }
11213
11214    /// Sets or clears the value of [http][crate::model::Service::http].
11215    ///
11216    /// # Example
11217    /// ```ignore,no_run
11218    /// # use google_cloud_api::model::Service;
11219    /// use google_cloud_api::model::Http;
11220    /// let x = Service::new().set_or_clear_http(Some(Http::default()/* use setters */));
11221    /// let x = Service::new().set_or_clear_http(None::<Http>);
11222    /// ```
11223    pub fn set_or_clear_http<T>(mut self, v: std::option::Option<T>) -> Self
11224    where
11225        T: std::convert::Into<crate::model::Http>,
11226    {
11227        self.http = v.map(|x| x.into());
11228        self
11229    }
11230
11231    /// Sets the value of [quota][crate::model::Service::quota].
11232    ///
11233    /// # Example
11234    /// ```ignore,no_run
11235    /// # use google_cloud_api::model::Service;
11236    /// use google_cloud_api::model::Quota;
11237    /// let x = Service::new().set_quota(Quota::default()/* use setters */);
11238    /// ```
11239    pub fn set_quota<T>(mut self, v: T) -> Self
11240    where
11241        T: std::convert::Into<crate::model::Quota>,
11242    {
11243        self.quota = std::option::Option::Some(v.into());
11244        self
11245    }
11246
11247    /// Sets or clears the value of [quota][crate::model::Service::quota].
11248    ///
11249    /// # Example
11250    /// ```ignore,no_run
11251    /// # use google_cloud_api::model::Service;
11252    /// use google_cloud_api::model::Quota;
11253    /// let x = Service::new().set_or_clear_quota(Some(Quota::default()/* use setters */));
11254    /// let x = Service::new().set_or_clear_quota(None::<Quota>);
11255    /// ```
11256    pub fn set_or_clear_quota<T>(mut self, v: std::option::Option<T>) -> Self
11257    where
11258        T: std::convert::Into<crate::model::Quota>,
11259    {
11260        self.quota = v.map(|x| x.into());
11261        self
11262    }
11263
11264    /// Sets the value of [authentication][crate::model::Service::authentication].
11265    ///
11266    /// # Example
11267    /// ```ignore,no_run
11268    /// # use google_cloud_api::model::Service;
11269    /// use google_cloud_api::model::Authentication;
11270    /// let x = Service::new().set_authentication(Authentication::default()/* use setters */);
11271    /// ```
11272    pub fn set_authentication<T>(mut self, v: T) -> Self
11273    where
11274        T: std::convert::Into<crate::model::Authentication>,
11275    {
11276        self.authentication = std::option::Option::Some(v.into());
11277        self
11278    }
11279
11280    /// Sets or clears the value of [authentication][crate::model::Service::authentication].
11281    ///
11282    /// # Example
11283    /// ```ignore,no_run
11284    /// # use google_cloud_api::model::Service;
11285    /// use google_cloud_api::model::Authentication;
11286    /// let x = Service::new().set_or_clear_authentication(Some(Authentication::default()/* use setters */));
11287    /// let x = Service::new().set_or_clear_authentication(None::<Authentication>);
11288    /// ```
11289    pub fn set_or_clear_authentication<T>(mut self, v: std::option::Option<T>) -> Self
11290    where
11291        T: std::convert::Into<crate::model::Authentication>,
11292    {
11293        self.authentication = v.map(|x| x.into());
11294        self
11295    }
11296
11297    /// Sets the value of [context][crate::model::Service::context].
11298    ///
11299    /// # Example
11300    /// ```ignore,no_run
11301    /// # use google_cloud_api::model::Service;
11302    /// use google_cloud_api::model::Context;
11303    /// let x = Service::new().set_context(Context::default()/* use setters */);
11304    /// ```
11305    pub fn set_context<T>(mut self, v: T) -> Self
11306    where
11307        T: std::convert::Into<crate::model::Context>,
11308    {
11309        self.context = std::option::Option::Some(v.into());
11310        self
11311    }
11312
11313    /// Sets or clears the value of [context][crate::model::Service::context].
11314    ///
11315    /// # Example
11316    /// ```ignore,no_run
11317    /// # use google_cloud_api::model::Service;
11318    /// use google_cloud_api::model::Context;
11319    /// let x = Service::new().set_or_clear_context(Some(Context::default()/* use setters */));
11320    /// let x = Service::new().set_or_clear_context(None::<Context>);
11321    /// ```
11322    pub fn set_or_clear_context<T>(mut self, v: std::option::Option<T>) -> Self
11323    where
11324        T: std::convert::Into<crate::model::Context>,
11325    {
11326        self.context = v.map(|x| x.into());
11327        self
11328    }
11329
11330    /// Sets the value of [usage][crate::model::Service::usage].
11331    ///
11332    /// # Example
11333    /// ```ignore,no_run
11334    /// # use google_cloud_api::model::Service;
11335    /// use google_cloud_api::model::Usage;
11336    /// let x = Service::new().set_usage(Usage::default()/* use setters */);
11337    /// ```
11338    pub fn set_usage<T>(mut self, v: T) -> Self
11339    where
11340        T: std::convert::Into<crate::model::Usage>,
11341    {
11342        self.usage = std::option::Option::Some(v.into());
11343        self
11344    }
11345
11346    /// Sets or clears the value of [usage][crate::model::Service::usage].
11347    ///
11348    /// # Example
11349    /// ```ignore,no_run
11350    /// # use google_cloud_api::model::Service;
11351    /// use google_cloud_api::model::Usage;
11352    /// let x = Service::new().set_or_clear_usage(Some(Usage::default()/* use setters */));
11353    /// let x = Service::new().set_or_clear_usage(None::<Usage>);
11354    /// ```
11355    pub fn set_or_clear_usage<T>(mut self, v: std::option::Option<T>) -> Self
11356    where
11357        T: std::convert::Into<crate::model::Usage>,
11358    {
11359        self.usage = v.map(|x| x.into());
11360        self
11361    }
11362
11363    /// Sets the value of [endpoints][crate::model::Service::endpoints].
11364    ///
11365    /// # Example
11366    /// ```ignore,no_run
11367    /// # use google_cloud_api::model::Service;
11368    /// use google_cloud_api::model::Endpoint;
11369    /// let x = Service::new()
11370    ///     .set_endpoints([
11371    ///         Endpoint::default()/* use setters */,
11372    ///         Endpoint::default()/* use (different) setters */,
11373    ///     ]);
11374    /// ```
11375    pub fn set_endpoints<T, V>(mut self, v: T) -> Self
11376    where
11377        T: std::iter::IntoIterator<Item = V>,
11378        V: std::convert::Into<crate::model::Endpoint>,
11379    {
11380        use std::iter::Iterator;
11381        self.endpoints = v.into_iter().map(|i| i.into()).collect();
11382        self
11383    }
11384
11385    /// Sets the value of [control][crate::model::Service::control].
11386    ///
11387    /// # Example
11388    /// ```ignore,no_run
11389    /// # use google_cloud_api::model::Service;
11390    /// use google_cloud_api::model::Control;
11391    /// let x = Service::new().set_control(Control::default()/* use setters */);
11392    /// ```
11393    pub fn set_control<T>(mut self, v: T) -> Self
11394    where
11395        T: std::convert::Into<crate::model::Control>,
11396    {
11397        self.control = std::option::Option::Some(v.into());
11398        self
11399    }
11400
11401    /// Sets or clears the value of [control][crate::model::Service::control].
11402    ///
11403    /// # Example
11404    /// ```ignore,no_run
11405    /// # use google_cloud_api::model::Service;
11406    /// use google_cloud_api::model::Control;
11407    /// let x = Service::new().set_or_clear_control(Some(Control::default()/* use setters */));
11408    /// let x = Service::new().set_or_clear_control(None::<Control>);
11409    /// ```
11410    pub fn set_or_clear_control<T>(mut self, v: std::option::Option<T>) -> Self
11411    where
11412        T: std::convert::Into<crate::model::Control>,
11413    {
11414        self.control = v.map(|x| x.into());
11415        self
11416    }
11417
11418    /// Sets the value of [logs][crate::model::Service::logs].
11419    ///
11420    /// # Example
11421    /// ```ignore,no_run
11422    /// # use google_cloud_api::model::Service;
11423    /// use google_cloud_api::model::LogDescriptor;
11424    /// let x = Service::new()
11425    ///     .set_logs([
11426    ///         LogDescriptor::default()/* use setters */,
11427    ///         LogDescriptor::default()/* use (different) setters */,
11428    ///     ]);
11429    /// ```
11430    pub fn set_logs<T, V>(mut self, v: T) -> Self
11431    where
11432        T: std::iter::IntoIterator<Item = V>,
11433        V: std::convert::Into<crate::model::LogDescriptor>,
11434    {
11435        use std::iter::Iterator;
11436        self.logs = v.into_iter().map(|i| i.into()).collect();
11437        self
11438    }
11439
11440    /// Sets the value of [metrics][crate::model::Service::metrics].
11441    ///
11442    /// # Example
11443    /// ```ignore,no_run
11444    /// # use google_cloud_api::model::Service;
11445    /// use google_cloud_api::model::MetricDescriptor;
11446    /// let x = Service::new()
11447    ///     .set_metrics([
11448    ///         MetricDescriptor::default()/* use setters */,
11449    ///         MetricDescriptor::default()/* use (different) setters */,
11450    ///     ]);
11451    /// ```
11452    pub fn set_metrics<T, V>(mut self, v: T) -> Self
11453    where
11454        T: std::iter::IntoIterator<Item = V>,
11455        V: std::convert::Into<crate::model::MetricDescriptor>,
11456    {
11457        use std::iter::Iterator;
11458        self.metrics = v.into_iter().map(|i| i.into()).collect();
11459        self
11460    }
11461
11462    /// Sets the value of [monitored_resources][crate::model::Service::monitored_resources].
11463    ///
11464    /// # Example
11465    /// ```ignore,no_run
11466    /// # use google_cloud_api::model::Service;
11467    /// use google_cloud_api::model::MonitoredResourceDescriptor;
11468    /// let x = Service::new()
11469    ///     .set_monitored_resources([
11470    ///         MonitoredResourceDescriptor::default()/* use setters */,
11471    ///         MonitoredResourceDescriptor::default()/* use (different) setters */,
11472    ///     ]);
11473    /// ```
11474    pub fn set_monitored_resources<T, V>(mut self, v: T) -> Self
11475    where
11476        T: std::iter::IntoIterator<Item = V>,
11477        V: std::convert::Into<crate::model::MonitoredResourceDescriptor>,
11478    {
11479        use std::iter::Iterator;
11480        self.monitored_resources = v.into_iter().map(|i| i.into()).collect();
11481        self
11482    }
11483
11484    /// Sets the value of [billing][crate::model::Service::billing].
11485    ///
11486    /// # Example
11487    /// ```ignore,no_run
11488    /// # use google_cloud_api::model::Service;
11489    /// use google_cloud_api::model::Billing;
11490    /// let x = Service::new().set_billing(Billing::default()/* use setters */);
11491    /// ```
11492    pub fn set_billing<T>(mut self, v: T) -> Self
11493    where
11494        T: std::convert::Into<crate::model::Billing>,
11495    {
11496        self.billing = std::option::Option::Some(v.into());
11497        self
11498    }
11499
11500    /// Sets or clears the value of [billing][crate::model::Service::billing].
11501    ///
11502    /// # Example
11503    /// ```ignore,no_run
11504    /// # use google_cloud_api::model::Service;
11505    /// use google_cloud_api::model::Billing;
11506    /// let x = Service::new().set_or_clear_billing(Some(Billing::default()/* use setters */));
11507    /// let x = Service::new().set_or_clear_billing(None::<Billing>);
11508    /// ```
11509    pub fn set_or_clear_billing<T>(mut self, v: std::option::Option<T>) -> Self
11510    where
11511        T: std::convert::Into<crate::model::Billing>,
11512    {
11513        self.billing = v.map(|x| x.into());
11514        self
11515    }
11516
11517    /// Sets the value of [logging][crate::model::Service::logging].
11518    ///
11519    /// # Example
11520    /// ```ignore,no_run
11521    /// # use google_cloud_api::model::Service;
11522    /// use google_cloud_api::model::Logging;
11523    /// let x = Service::new().set_logging(Logging::default()/* use setters */);
11524    /// ```
11525    pub fn set_logging<T>(mut self, v: T) -> Self
11526    where
11527        T: std::convert::Into<crate::model::Logging>,
11528    {
11529        self.logging = std::option::Option::Some(v.into());
11530        self
11531    }
11532
11533    /// Sets or clears the value of [logging][crate::model::Service::logging].
11534    ///
11535    /// # Example
11536    /// ```ignore,no_run
11537    /// # use google_cloud_api::model::Service;
11538    /// use google_cloud_api::model::Logging;
11539    /// let x = Service::new().set_or_clear_logging(Some(Logging::default()/* use setters */));
11540    /// let x = Service::new().set_or_clear_logging(None::<Logging>);
11541    /// ```
11542    pub fn set_or_clear_logging<T>(mut self, v: std::option::Option<T>) -> Self
11543    where
11544        T: std::convert::Into<crate::model::Logging>,
11545    {
11546        self.logging = v.map(|x| x.into());
11547        self
11548    }
11549
11550    /// Sets the value of [monitoring][crate::model::Service::monitoring].
11551    ///
11552    /// # Example
11553    /// ```ignore,no_run
11554    /// # use google_cloud_api::model::Service;
11555    /// use google_cloud_api::model::Monitoring;
11556    /// let x = Service::new().set_monitoring(Monitoring::default()/* use setters */);
11557    /// ```
11558    pub fn set_monitoring<T>(mut self, v: T) -> Self
11559    where
11560        T: std::convert::Into<crate::model::Monitoring>,
11561    {
11562        self.monitoring = std::option::Option::Some(v.into());
11563        self
11564    }
11565
11566    /// Sets or clears the value of [monitoring][crate::model::Service::monitoring].
11567    ///
11568    /// # Example
11569    /// ```ignore,no_run
11570    /// # use google_cloud_api::model::Service;
11571    /// use google_cloud_api::model::Monitoring;
11572    /// let x = Service::new().set_or_clear_monitoring(Some(Monitoring::default()/* use setters */));
11573    /// let x = Service::new().set_or_clear_monitoring(None::<Monitoring>);
11574    /// ```
11575    pub fn set_or_clear_monitoring<T>(mut self, v: std::option::Option<T>) -> Self
11576    where
11577        T: std::convert::Into<crate::model::Monitoring>,
11578    {
11579        self.monitoring = v.map(|x| x.into());
11580        self
11581    }
11582
11583    /// Sets the value of [system_parameters][crate::model::Service::system_parameters].
11584    ///
11585    /// # Example
11586    /// ```ignore,no_run
11587    /// # use google_cloud_api::model::Service;
11588    /// use google_cloud_api::model::SystemParameters;
11589    /// let x = Service::new().set_system_parameters(SystemParameters::default()/* use setters */);
11590    /// ```
11591    pub fn set_system_parameters<T>(mut self, v: T) -> Self
11592    where
11593        T: std::convert::Into<crate::model::SystemParameters>,
11594    {
11595        self.system_parameters = std::option::Option::Some(v.into());
11596        self
11597    }
11598
11599    /// Sets or clears the value of [system_parameters][crate::model::Service::system_parameters].
11600    ///
11601    /// # Example
11602    /// ```ignore,no_run
11603    /// # use google_cloud_api::model::Service;
11604    /// use google_cloud_api::model::SystemParameters;
11605    /// let x = Service::new().set_or_clear_system_parameters(Some(SystemParameters::default()/* use setters */));
11606    /// let x = Service::new().set_or_clear_system_parameters(None::<SystemParameters>);
11607    /// ```
11608    pub fn set_or_clear_system_parameters<T>(mut self, v: std::option::Option<T>) -> Self
11609    where
11610        T: std::convert::Into<crate::model::SystemParameters>,
11611    {
11612        self.system_parameters = v.map(|x| x.into());
11613        self
11614    }
11615
11616    /// Sets the value of [source_info][crate::model::Service::source_info].
11617    ///
11618    /// # Example
11619    /// ```ignore,no_run
11620    /// # use google_cloud_api::model::Service;
11621    /// use google_cloud_api::model::SourceInfo;
11622    /// let x = Service::new().set_source_info(SourceInfo::default()/* use setters */);
11623    /// ```
11624    pub fn set_source_info<T>(mut self, v: T) -> Self
11625    where
11626        T: std::convert::Into<crate::model::SourceInfo>,
11627    {
11628        self.source_info = std::option::Option::Some(v.into());
11629        self
11630    }
11631
11632    /// Sets or clears the value of [source_info][crate::model::Service::source_info].
11633    ///
11634    /// # Example
11635    /// ```ignore,no_run
11636    /// # use google_cloud_api::model::Service;
11637    /// use google_cloud_api::model::SourceInfo;
11638    /// let x = Service::new().set_or_clear_source_info(Some(SourceInfo::default()/* use setters */));
11639    /// let x = Service::new().set_or_clear_source_info(None::<SourceInfo>);
11640    /// ```
11641    pub fn set_or_clear_source_info<T>(mut self, v: std::option::Option<T>) -> Self
11642    where
11643        T: std::convert::Into<crate::model::SourceInfo>,
11644    {
11645        self.source_info = v.map(|x| x.into());
11646        self
11647    }
11648
11649    /// Sets the value of [publishing][crate::model::Service::publishing].
11650    ///
11651    /// # Example
11652    /// ```ignore,no_run
11653    /// # use google_cloud_api::model::Service;
11654    /// use google_cloud_api::model::Publishing;
11655    /// let x = Service::new().set_publishing(Publishing::default()/* use setters */);
11656    /// ```
11657    pub fn set_publishing<T>(mut self, v: T) -> Self
11658    where
11659        T: std::convert::Into<crate::model::Publishing>,
11660    {
11661        self.publishing = std::option::Option::Some(v.into());
11662        self
11663    }
11664
11665    /// Sets or clears the value of [publishing][crate::model::Service::publishing].
11666    ///
11667    /// # Example
11668    /// ```ignore,no_run
11669    /// # use google_cloud_api::model::Service;
11670    /// use google_cloud_api::model::Publishing;
11671    /// let x = Service::new().set_or_clear_publishing(Some(Publishing::default()/* use setters */));
11672    /// let x = Service::new().set_or_clear_publishing(None::<Publishing>);
11673    /// ```
11674    pub fn set_or_clear_publishing<T>(mut self, v: std::option::Option<T>) -> Self
11675    where
11676        T: std::convert::Into<crate::model::Publishing>,
11677    {
11678        self.publishing = v.map(|x| x.into());
11679        self
11680    }
11681
11682    /// Sets the value of [config_version][crate::model::Service::config_version].
11683    ///
11684    /// # Example
11685    /// ```ignore,no_run
11686    /// # use google_cloud_api::model::Service;
11687    /// use wkt::UInt32Value;
11688    /// let x = Service::new().set_config_version(UInt32Value::default()/* use setters */);
11689    /// ```
11690    pub fn set_config_version<T>(mut self, v: T) -> Self
11691    where
11692        T: std::convert::Into<wkt::UInt32Value>,
11693    {
11694        self.config_version = std::option::Option::Some(v.into());
11695        self
11696    }
11697
11698    /// Sets or clears the value of [config_version][crate::model::Service::config_version].
11699    ///
11700    /// # Example
11701    /// ```ignore,no_run
11702    /// # use google_cloud_api::model::Service;
11703    /// use wkt::UInt32Value;
11704    /// let x = Service::new().set_or_clear_config_version(Some(UInt32Value::default()/* use setters */));
11705    /// let x = Service::new().set_or_clear_config_version(None::<UInt32Value>);
11706    /// ```
11707    pub fn set_or_clear_config_version<T>(mut self, v: std::option::Option<T>) -> Self
11708    where
11709        T: std::convert::Into<wkt::UInt32Value>,
11710    {
11711        self.config_version = v.map(|x| x.into());
11712        self
11713    }
11714}
11715
11716impl wkt::message::Message for Service {
11717    fn typename() -> &'static str {
11718        "type.googleapis.com/google.api.Service"
11719    }
11720}
11721
11722/// Source information used to create a Service Config
11723#[derive(Clone, Default, PartialEq)]
11724#[non_exhaustive]
11725pub struct SourceInfo {
11726    /// All files used during config generation.
11727    pub source_files: std::vec::Vec<wkt::Any>,
11728
11729    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11730}
11731
11732impl SourceInfo {
11733    /// Creates a new default instance.
11734    pub fn new() -> Self {
11735        std::default::Default::default()
11736    }
11737
11738    /// Sets the value of [source_files][crate::model::SourceInfo::source_files].
11739    ///
11740    /// # Example
11741    /// ```ignore,no_run
11742    /// # use google_cloud_api::model::SourceInfo;
11743    /// use wkt::Any;
11744    /// let x = SourceInfo::new()
11745    ///     .set_source_files([
11746    ///         Any::default()/* use setters */,
11747    ///         Any::default()/* use (different) setters */,
11748    ///     ]);
11749    /// ```
11750    pub fn set_source_files<T, V>(mut self, v: T) -> Self
11751    where
11752        T: std::iter::IntoIterator<Item = V>,
11753        V: std::convert::Into<wkt::Any>,
11754    {
11755        use std::iter::Iterator;
11756        self.source_files = v.into_iter().map(|i| i.into()).collect();
11757        self
11758    }
11759}
11760
11761impl wkt::message::Message for SourceInfo {
11762    fn typename() -> &'static str {
11763        "type.googleapis.com/google.api.SourceInfo"
11764    }
11765}
11766
11767/// ### System parameter configuration
11768///
11769/// A system parameter is a special kind of parameter defined by the API
11770/// system, not by an individual API. It is typically mapped to an HTTP header
11771/// and/or a URL query parameter. This configuration specifies which methods
11772/// change the names of the system parameters.
11773#[derive(Clone, Default, PartialEq)]
11774#[non_exhaustive]
11775pub struct SystemParameters {
11776    /// Define system parameters.
11777    ///
11778    /// The parameters defined here will override the default parameters
11779    /// implemented by the system. If this field is missing from the service
11780    /// config, default system parameters will be used. Default system parameters
11781    /// and names is implementation-dependent.
11782    ///
11783    /// Example: define api key for all methods
11784    ///
11785    /// ```norust
11786    /// system_parameters
11787    ///   rules:
11788    ///     - selector: "*"
11789    ///       parameters:
11790    ///         - name: api_key
11791    ///           url_query_parameter: api_key
11792    /// ```
11793    ///
11794    /// Example: define 2 api key names for a specific method.
11795    ///
11796    /// ```norust
11797    /// system_parameters
11798    ///   rules:
11799    ///     - selector: "/ListShelves"
11800    ///       parameters:
11801    ///         - name: api_key
11802    ///           http_header: Api-Key1
11803    ///         - name: api_key
11804    ///           http_header: Api-Key2
11805    /// ```
11806    ///
11807    /// **NOTE:** All service configuration rules follow "last one wins" order.
11808    pub rules: std::vec::Vec<crate::model::SystemParameterRule>,
11809
11810    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11811}
11812
11813impl SystemParameters {
11814    /// Creates a new default instance.
11815    pub fn new() -> Self {
11816        std::default::Default::default()
11817    }
11818
11819    /// Sets the value of [rules][crate::model::SystemParameters::rules].
11820    ///
11821    /// # Example
11822    /// ```ignore,no_run
11823    /// # use google_cloud_api::model::SystemParameters;
11824    /// use google_cloud_api::model::SystemParameterRule;
11825    /// let x = SystemParameters::new()
11826    ///     .set_rules([
11827    ///         SystemParameterRule::default()/* use setters */,
11828    ///         SystemParameterRule::default()/* use (different) setters */,
11829    ///     ]);
11830    /// ```
11831    pub fn set_rules<T, V>(mut self, v: T) -> Self
11832    where
11833        T: std::iter::IntoIterator<Item = V>,
11834        V: std::convert::Into<crate::model::SystemParameterRule>,
11835    {
11836        use std::iter::Iterator;
11837        self.rules = v.into_iter().map(|i| i.into()).collect();
11838        self
11839    }
11840}
11841
11842impl wkt::message::Message for SystemParameters {
11843    fn typename() -> &'static str {
11844        "type.googleapis.com/google.api.SystemParameters"
11845    }
11846}
11847
11848/// Define a system parameter rule mapping system parameter definitions to
11849/// methods.
11850#[derive(Clone, Default, PartialEq)]
11851#[non_exhaustive]
11852pub struct SystemParameterRule {
11853    /// Selects the methods to which this rule applies. Use '*' to indicate all
11854    /// methods in all APIs.
11855    ///
11856    /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
11857    /// details.
11858    ///
11859    /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
11860    pub selector: std::string::String,
11861
11862    /// Define parameters. Multiple names may be defined for a parameter.
11863    /// For a given method call, only one of them should be used. If multiple
11864    /// names are used the behavior is implementation-dependent.
11865    /// If none of the specified names are present the behavior is
11866    /// parameter-dependent.
11867    pub parameters: std::vec::Vec<crate::model::SystemParameter>,
11868
11869    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11870}
11871
11872impl SystemParameterRule {
11873    /// Creates a new default instance.
11874    pub fn new() -> Self {
11875        std::default::Default::default()
11876    }
11877
11878    /// Sets the value of [selector][crate::model::SystemParameterRule::selector].
11879    ///
11880    /// # Example
11881    /// ```ignore,no_run
11882    /// # use google_cloud_api::model::SystemParameterRule;
11883    /// let x = SystemParameterRule::new().set_selector("example");
11884    /// ```
11885    pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11886        self.selector = v.into();
11887        self
11888    }
11889
11890    /// Sets the value of [parameters][crate::model::SystemParameterRule::parameters].
11891    ///
11892    /// # Example
11893    /// ```ignore,no_run
11894    /// # use google_cloud_api::model::SystemParameterRule;
11895    /// use google_cloud_api::model::SystemParameter;
11896    /// let x = SystemParameterRule::new()
11897    ///     .set_parameters([
11898    ///         SystemParameter::default()/* use setters */,
11899    ///         SystemParameter::default()/* use (different) setters */,
11900    ///     ]);
11901    /// ```
11902    pub fn set_parameters<T, V>(mut self, v: T) -> Self
11903    where
11904        T: std::iter::IntoIterator<Item = V>,
11905        V: std::convert::Into<crate::model::SystemParameter>,
11906    {
11907        use std::iter::Iterator;
11908        self.parameters = v.into_iter().map(|i| i.into()).collect();
11909        self
11910    }
11911}
11912
11913impl wkt::message::Message for SystemParameterRule {
11914    fn typename() -> &'static str {
11915        "type.googleapis.com/google.api.SystemParameterRule"
11916    }
11917}
11918
11919/// Define a parameter's name and location. The parameter may be passed as either
11920/// an HTTP header or a URL query parameter, and if both are passed the behavior
11921/// is implementation-dependent.
11922#[derive(Clone, Default, PartialEq)]
11923#[non_exhaustive]
11924pub struct SystemParameter {
11925    /// Define the name of the parameter, such as "api_key" . It is case sensitive.
11926    pub name: std::string::String,
11927
11928    /// Define the HTTP header name to use for the parameter. It is case
11929    /// insensitive.
11930    pub http_header: std::string::String,
11931
11932    /// Define the URL query parameter name to use for the parameter. It is case
11933    /// sensitive.
11934    pub url_query_parameter: std::string::String,
11935
11936    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11937}
11938
11939impl SystemParameter {
11940    /// Creates a new default instance.
11941    pub fn new() -> Self {
11942        std::default::Default::default()
11943    }
11944
11945    /// Sets the value of [name][crate::model::SystemParameter::name].
11946    ///
11947    /// # Example
11948    /// ```ignore,no_run
11949    /// # use google_cloud_api::model::SystemParameter;
11950    /// let x = SystemParameter::new().set_name("example");
11951    /// ```
11952    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11953        self.name = v.into();
11954        self
11955    }
11956
11957    /// Sets the value of [http_header][crate::model::SystemParameter::http_header].
11958    ///
11959    /// # Example
11960    /// ```ignore,no_run
11961    /// # use google_cloud_api::model::SystemParameter;
11962    /// let x = SystemParameter::new().set_http_header("example");
11963    /// ```
11964    pub fn set_http_header<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11965        self.http_header = v.into();
11966        self
11967    }
11968
11969    /// Sets the value of [url_query_parameter][crate::model::SystemParameter::url_query_parameter].
11970    ///
11971    /// # Example
11972    /// ```ignore,no_run
11973    /// # use google_cloud_api::model::SystemParameter;
11974    /// let x = SystemParameter::new().set_url_query_parameter("example");
11975    /// ```
11976    pub fn set_url_query_parameter<T: std::convert::Into<std::string::String>>(
11977        mut self,
11978        v: T,
11979    ) -> Self {
11980        self.url_query_parameter = v.into();
11981        self
11982    }
11983}
11984
11985impl wkt::message::Message for SystemParameter {
11986    fn typename() -> &'static str {
11987        "type.googleapis.com/google.api.SystemParameter"
11988    }
11989}
11990
11991/// Configuration controlling usage of a service.
11992#[derive(Clone, Default, PartialEq)]
11993#[non_exhaustive]
11994pub struct Usage {
11995    /// Requirements that must be satisfied before a consumer project can use the
11996    /// service. Each requirement is of the form <service.name>/\<requirement-id\>;
11997    /// for example 'serviceusage.googleapis.com/billing-enabled'.
11998    ///
11999    /// For Google APIs, a Terms of Service requirement must be included here.
12000    /// Google Cloud APIs must include "serviceusage.googleapis.com/tos/cloud".
12001    /// Other Google APIs should include
12002    /// "serviceusage.googleapis.com/tos/universal". Additional ToS can be
12003    /// included based on the business needs.
12004    pub requirements: std::vec::Vec<std::string::String>,
12005
12006    /// A list of usage rules that apply to individual API methods.
12007    ///
12008    /// **NOTE:** All service configuration rules follow "last one wins" order.
12009    pub rules: std::vec::Vec<crate::model::UsageRule>,
12010
12011    /// The full resource name of a channel used for sending notifications to the
12012    /// service producer.
12013    ///
12014    /// Google Service Management currently only supports
12015    /// [Google Cloud Pub/Sub](https://cloud.google.com/pubsub) as a notification
12016    /// channel. To use Google Cloud Pub/Sub as the channel, this must be the name
12017    /// of a Cloud Pub/Sub topic that uses the Cloud Pub/Sub topic name format
12018    /// documented in <https://cloud.google.com/pubsub/docs/overview>.
12019    pub producer_notification_channel: std::string::String,
12020
12021    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12022}
12023
12024impl Usage {
12025    /// Creates a new default instance.
12026    pub fn new() -> Self {
12027        std::default::Default::default()
12028    }
12029
12030    /// Sets the value of [requirements][crate::model::Usage::requirements].
12031    ///
12032    /// # Example
12033    /// ```ignore,no_run
12034    /// # use google_cloud_api::model::Usage;
12035    /// let x = Usage::new().set_requirements(["a", "b", "c"]);
12036    /// ```
12037    pub fn set_requirements<T, V>(mut self, v: T) -> Self
12038    where
12039        T: std::iter::IntoIterator<Item = V>,
12040        V: std::convert::Into<std::string::String>,
12041    {
12042        use std::iter::Iterator;
12043        self.requirements = v.into_iter().map(|i| i.into()).collect();
12044        self
12045    }
12046
12047    /// Sets the value of [rules][crate::model::Usage::rules].
12048    ///
12049    /// # Example
12050    /// ```ignore,no_run
12051    /// # use google_cloud_api::model::Usage;
12052    /// use google_cloud_api::model::UsageRule;
12053    /// let x = Usage::new()
12054    ///     .set_rules([
12055    ///         UsageRule::default()/* use setters */,
12056    ///         UsageRule::default()/* use (different) setters */,
12057    ///     ]);
12058    /// ```
12059    pub fn set_rules<T, V>(mut self, v: T) -> Self
12060    where
12061        T: std::iter::IntoIterator<Item = V>,
12062        V: std::convert::Into<crate::model::UsageRule>,
12063    {
12064        use std::iter::Iterator;
12065        self.rules = v.into_iter().map(|i| i.into()).collect();
12066        self
12067    }
12068
12069    /// Sets the value of [producer_notification_channel][crate::model::Usage::producer_notification_channel].
12070    ///
12071    /// # Example
12072    /// ```ignore,no_run
12073    /// # use google_cloud_api::model::Usage;
12074    /// let x = Usage::new().set_producer_notification_channel("example");
12075    /// ```
12076    pub fn set_producer_notification_channel<T: std::convert::Into<std::string::String>>(
12077        mut self,
12078        v: T,
12079    ) -> Self {
12080        self.producer_notification_channel = v.into();
12081        self
12082    }
12083}
12084
12085impl wkt::message::Message for Usage {
12086    fn typename() -> &'static str {
12087        "type.googleapis.com/google.api.Usage"
12088    }
12089}
12090
12091/// Usage configuration rules for the service.
12092#[derive(Clone, Default, PartialEq)]
12093#[non_exhaustive]
12094pub struct UsageRule {
12095    /// Selects the methods to which this rule applies. Use '*' to indicate all
12096    /// methods in all APIs.
12097    ///
12098    /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
12099    /// details.
12100    ///
12101    /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
12102    pub selector: std::string::String,
12103
12104    /// Use this rule to configure unregistered calls for the service. Unregistered
12105    /// calls are calls that do not contain consumer project identity.
12106    /// (Example: calls that do not contain an API key).
12107    ///
12108    /// WARNING: By default, API methods do not allow unregistered calls, and each
12109    /// method call must be identified by a consumer project identity.
12110    pub allow_unregistered_calls: bool,
12111
12112    /// If true, the selected method should skip service control and the control
12113    /// plane features, such as quota and billing, will not be available.
12114    /// This flag is used by Google Cloud Endpoints to bypass checks for internal
12115    /// methods, such as service health check methods.
12116    pub skip_service_control: bool,
12117
12118    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12119}
12120
12121impl UsageRule {
12122    /// Creates a new default instance.
12123    pub fn new() -> Self {
12124        std::default::Default::default()
12125    }
12126
12127    /// Sets the value of [selector][crate::model::UsageRule::selector].
12128    ///
12129    /// # Example
12130    /// ```ignore,no_run
12131    /// # use google_cloud_api::model::UsageRule;
12132    /// let x = UsageRule::new().set_selector("example");
12133    /// ```
12134    pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12135        self.selector = v.into();
12136        self
12137    }
12138
12139    /// Sets the value of [allow_unregistered_calls][crate::model::UsageRule::allow_unregistered_calls].
12140    ///
12141    /// # Example
12142    /// ```ignore,no_run
12143    /// # use google_cloud_api::model::UsageRule;
12144    /// let x = UsageRule::new().set_allow_unregistered_calls(true);
12145    /// ```
12146    pub fn set_allow_unregistered_calls<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12147        self.allow_unregistered_calls = v.into();
12148        self
12149    }
12150
12151    /// Sets the value of [skip_service_control][crate::model::UsageRule::skip_service_control].
12152    ///
12153    /// # Example
12154    /// ```ignore,no_run
12155    /// # use google_cloud_api::model::UsageRule;
12156    /// let x = UsageRule::new().set_skip_service_control(true);
12157    /// ```
12158    pub fn set_skip_service_control<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12159        self.skip_service_control = v.into();
12160        self
12161    }
12162}
12163
12164impl wkt::message::Message for UsageRule {
12165    fn typename() -> &'static str {
12166        "type.googleapis.com/google.api.UsageRule"
12167    }
12168}
12169
12170/// `Visibility` restricts service consumer's access to service elements,
12171/// such as whether an application can call a visibility-restricted method.
12172/// The restriction is expressed by applying visibility labels on service
12173/// elements. The visibility labels are elsewhere linked to service consumers.
12174///
12175/// A service can define multiple visibility labels, but a service consumer
12176/// should be granted at most one visibility label. Multiple visibility
12177/// labels for a single service consumer are not supported.
12178///
12179/// If an element and all its parents have no visibility label, its visibility
12180/// is unconditionally granted.
12181///
12182/// Example:
12183///
12184/// ```norust
12185/// visibility:
12186///   rules:
12187///   - selector: google.calendar.Calendar.EnhancedSearch
12188///     restriction: PREVIEW
12189///   - selector: google.calendar.Calendar.Delegate
12190///     restriction: INTERNAL
12191/// ```
12192///
12193/// Here, all methods are publicly visible except for the restricted methods
12194/// EnhancedSearch and Delegate.
12195#[derive(Clone, Default, PartialEq)]
12196#[non_exhaustive]
12197pub struct Visibility {
12198    /// A list of visibility rules that apply to individual API elements.
12199    ///
12200    /// **NOTE:** All service configuration rules follow "last one wins" order.
12201    pub rules: std::vec::Vec<crate::model::VisibilityRule>,
12202
12203    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12204}
12205
12206impl Visibility {
12207    /// Creates a new default instance.
12208    pub fn new() -> Self {
12209        std::default::Default::default()
12210    }
12211
12212    /// Sets the value of [rules][crate::model::Visibility::rules].
12213    ///
12214    /// # Example
12215    /// ```ignore,no_run
12216    /// # use google_cloud_api::model::Visibility;
12217    /// use google_cloud_api::model::VisibilityRule;
12218    /// let x = Visibility::new()
12219    ///     .set_rules([
12220    ///         VisibilityRule::default()/* use setters */,
12221    ///         VisibilityRule::default()/* use (different) setters */,
12222    ///     ]);
12223    /// ```
12224    pub fn set_rules<T, V>(mut self, v: T) -> Self
12225    where
12226        T: std::iter::IntoIterator<Item = V>,
12227        V: std::convert::Into<crate::model::VisibilityRule>,
12228    {
12229        use std::iter::Iterator;
12230        self.rules = v.into_iter().map(|i| i.into()).collect();
12231        self
12232    }
12233}
12234
12235impl wkt::message::Message for Visibility {
12236    fn typename() -> &'static str {
12237        "type.googleapis.com/google.api.Visibility"
12238    }
12239}
12240
12241/// A visibility rule provides visibility configuration for an individual API
12242/// element.
12243#[derive(Clone, Default, PartialEq)]
12244#[non_exhaustive]
12245pub struct VisibilityRule {
12246    /// Selects methods, messages, fields, enums, etc. to which this rule applies.
12247    ///
12248    /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
12249    /// details.
12250    ///
12251    /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
12252    pub selector: std::string::String,
12253
12254    /// A comma-separated list of visibility labels that apply to the `selector`.
12255    /// Any of the listed labels can be used to grant the visibility.
12256    ///
12257    /// If a rule has multiple labels, removing one of the labels but not all of
12258    /// them can break clients.
12259    ///
12260    /// Example:
12261    ///
12262    /// ```norust
12263    /// visibility:
12264    ///   rules:
12265    ///   - selector: google.calendar.Calendar.EnhancedSearch
12266    ///     restriction: INTERNAL, PREVIEW
12267    /// ```
12268    ///
12269    /// Removing INTERNAL from this restriction will break clients that rely on
12270    /// this method and only had access to it through INTERNAL.
12271    pub restriction: std::string::String,
12272
12273    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12274}
12275
12276impl VisibilityRule {
12277    /// Creates a new default instance.
12278    pub fn new() -> Self {
12279        std::default::Default::default()
12280    }
12281
12282    /// Sets the value of [selector][crate::model::VisibilityRule::selector].
12283    ///
12284    /// # Example
12285    /// ```ignore,no_run
12286    /// # use google_cloud_api::model::VisibilityRule;
12287    /// let x = VisibilityRule::new().set_selector("example");
12288    /// ```
12289    pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12290        self.selector = v.into();
12291        self
12292    }
12293
12294    /// Sets the value of [restriction][crate::model::VisibilityRule::restriction].
12295    ///
12296    /// # Example
12297    /// ```ignore,no_run
12298    /// # use google_cloud_api::model::VisibilityRule;
12299    /// let x = VisibilityRule::new().set_restriction("example");
12300    /// ```
12301    pub fn set_restriction<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12302        self.restriction = v.into();
12303        self
12304    }
12305}
12306
12307impl wkt::message::Message for VisibilityRule {
12308    fn typename() -> &'static str {
12309        "type.googleapis.com/google.api.VisibilityRule"
12310    }
12311}
12312
12313/// The organization for which the client libraries are being published.
12314/// Affects the url where generated docs are published, etc.
12315///
12316/// # Working with unknown values
12317///
12318/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12319/// additional enum variants at any time. Adding new variants is not considered
12320/// a breaking change. Applications should write their code in anticipation of:
12321///
12322/// - New values appearing in future releases of the client library, **and**
12323/// - New values received dynamically, without application changes.
12324///
12325/// Please consult the [Working with enums] section in the user guide for some
12326/// guidelines.
12327///
12328/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
12329#[derive(Clone, Debug, PartialEq)]
12330#[non_exhaustive]
12331pub enum ClientLibraryOrganization {
12332    /// Not useful.
12333    Unspecified,
12334    /// Google Cloud Platform Org.
12335    Cloud,
12336    /// Ads (Advertising) Org.
12337    Ads,
12338    /// Photos Org.
12339    Photos,
12340    /// Street View Org.
12341    StreetView,
12342    /// Shopping Org.
12343    Shopping,
12344    /// Geo Org.
12345    Geo,
12346    /// Generative AI - <https://developers.generativeai.google>
12347    GenerativeAi,
12348    /// If set, the enum was initialized with an unknown value.
12349    ///
12350    /// Applications can examine the value using [ClientLibraryOrganization::value] or
12351    /// [ClientLibraryOrganization::name].
12352    UnknownValue(client_library_organization::UnknownValue),
12353}
12354
12355#[doc(hidden)]
12356pub mod client_library_organization {
12357    #[allow(unused_imports)]
12358    use super::*;
12359    #[derive(Clone, Debug, PartialEq)]
12360    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
12361}
12362
12363impl ClientLibraryOrganization {
12364    /// Gets the enum value.
12365    ///
12366    /// Returns `None` if the enum contains an unknown value deserialized from
12367    /// the string representation of enums.
12368    pub fn value(&self) -> std::option::Option<i32> {
12369        match self {
12370            Self::Unspecified => std::option::Option::Some(0),
12371            Self::Cloud => std::option::Option::Some(1),
12372            Self::Ads => std::option::Option::Some(2),
12373            Self::Photos => std::option::Option::Some(3),
12374            Self::StreetView => std::option::Option::Some(4),
12375            Self::Shopping => std::option::Option::Some(5),
12376            Self::Geo => std::option::Option::Some(6),
12377            Self::GenerativeAi => std::option::Option::Some(7),
12378            Self::UnknownValue(u) => u.0.value(),
12379        }
12380    }
12381
12382    /// Gets the enum value as a string.
12383    ///
12384    /// Returns `None` if the enum contains an unknown value deserialized from
12385    /// the integer representation of enums.
12386    pub fn name(&self) -> std::option::Option<&str> {
12387        match self {
12388            Self::Unspecified => {
12389                std::option::Option::Some("CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED")
12390            }
12391            Self::Cloud => std::option::Option::Some("CLOUD"),
12392            Self::Ads => std::option::Option::Some("ADS"),
12393            Self::Photos => std::option::Option::Some("PHOTOS"),
12394            Self::StreetView => std::option::Option::Some("STREET_VIEW"),
12395            Self::Shopping => std::option::Option::Some("SHOPPING"),
12396            Self::Geo => std::option::Option::Some("GEO"),
12397            Self::GenerativeAi => std::option::Option::Some("GENERATIVE_AI"),
12398            Self::UnknownValue(u) => u.0.name(),
12399        }
12400    }
12401}
12402
12403impl std::default::Default for ClientLibraryOrganization {
12404    fn default() -> Self {
12405        use std::convert::From;
12406        Self::from(0)
12407    }
12408}
12409
12410impl std::fmt::Display for ClientLibraryOrganization {
12411    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
12412        wkt::internal::display_enum(f, self.name(), self.value())
12413    }
12414}
12415
12416impl std::convert::From<i32> for ClientLibraryOrganization {
12417    fn from(value: i32) -> Self {
12418        match value {
12419            0 => Self::Unspecified,
12420            1 => Self::Cloud,
12421            2 => Self::Ads,
12422            3 => Self::Photos,
12423            4 => Self::StreetView,
12424            5 => Self::Shopping,
12425            6 => Self::Geo,
12426            7 => Self::GenerativeAi,
12427            _ => Self::UnknownValue(client_library_organization::UnknownValue(
12428                wkt::internal::UnknownEnumValue::Integer(value),
12429            )),
12430        }
12431    }
12432}
12433
12434impl std::convert::From<&str> for ClientLibraryOrganization {
12435    fn from(value: &str) -> Self {
12436        use std::string::ToString;
12437        match value {
12438            "CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED" => Self::Unspecified,
12439            "CLOUD" => Self::Cloud,
12440            "ADS" => Self::Ads,
12441            "PHOTOS" => Self::Photos,
12442            "STREET_VIEW" => Self::StreetView,
12443            "SHOPPING" => Self::Shopping,
12444            "GEO" => Self::Geo,
12445            "GENERATIVE_AI" => Self::GenerativeAi,
12446            _ => Self::UnknownValue(client_library_organization::UnknownValue(
12447                wkt::internal::UnknownEnumValue::String(value.to_string()),
12448            )),
12449        }
12450    }
12451}
12452
12453impl serde::ser::Serialize for ClientLibraryOrganization {
12454    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12455    where
12456        S: serde::Serializer,
12457    {
12458        match self {
12459            Self::Unspecified => serializer.serialize_i32(0),
12460            Self::Cloud => serializer.serialize_i32(1),
12461            Self::Ads => serializer.serialize_i32(2),
12462            Self::Photos => serializer.serialize_i32(3),
12463            Self::StreetView => serializer.serialize_i32(4),
12464            Self::Shopping => serializer.serialize_i32(5),
12465            Self::Geo => serializer.serialize_i32(6),
12466            Self::GenerativeAi => serializer.serialize_i32(7),
12467            Self::UnknownValue(u) => u.0.serialize(serializer),
12468        }
12469    }
12470}
12471
12472impl<'de> serde::de::Deserialize<'de> for ClientLibraryOrganization {
12473    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12474    where
12475        D: serde::Deserializer<'de>,
12476    {
12477        deserializer.deserialize_any(
12478            wkt::internal::EnumVisitor::<ClientLibraryOrganization>::new(
12479                ".google.api.ClientLibraryOrganization",
12480            ),
12481        )
12482    }
12483}
12484
12485/// To where should client libraries be published?
12486///
12487/// # Working with unknown values
12488///
12489/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12490/// additional enum variants at any time. Adding new variants is not considered
12491/// a breaking change. Applications should write their code in anticipation of:
12492///
12493/// - New values appearing in future releases of the client library, **and**
12494/// - New values received dynamically, without application changes.
12495///
12496/// Please consult the [Working with enums] section in the user guide for some
12497/// guidelines.
12498///
12499/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
12500#[derive(Clone, Debug, PartialEq)]
12501#[non_exhaustive]
12502pub enum ClientLibraryDestination {
12503    /// Client libraries will neither be generated nor published to package
12504    /// managers.
12505    Unspecified,
12506    /// Generate the client library in a repo under github.com/googleapis,
12507    /// but don't publish it to package managers.
12508    Github,
12509    /// Publish the library to package managers like nuget.org and npmjs.com.
12510    PackageManager,
12511    /// If set, the enum was initialized with an unknown value.
12512    ///
12513    /// Applications can examine the value using [ClientLibraryDestination::value] or
12514    /// [ClientLibraryDestination::name].
12515    UnknownValue(client_library_destination::UnknownValue),
12516}
12517
12518#[doc(hidden)]
12519pub mod client_library_destination {
12520    #[allow(unused_imports)]
12521    use super::*;
12522    #[derive(Clone, Debug, PartialEq)]
12523    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
12524}
12525
12526impl ClientLibraryDestination {
12527    /// Gets the enum value.
12528    ///
12529    /// Returns `None` if the enum contains an unknown value deserialized from
12530    /// the string representation of enums.
12531    pub fn value(&self) -> std::option::Option<i32> {
12532        match self {
12533            Self::Unspecified => std::option::Option::Some(0),
12534            Self::Github => std::option::Option::Some(10),
12535            Self::PackageManager => std::option::Option::Some(20),
12536            Self::UnknownValue(u) => u.0.value(),
12537        }
12538    }
12539
12540    /// Gets the enum value as a string.
12541    ///
12542    /// Returns `None` if the enum contains an unknown value deserialized from
12543    /// the integer representation of enums.
12544    pub fn name(&self) -> std::option::Option<&str> {
12545        match self {
12546            Self::Unspecified => {
12547                std::option::Option::Some("CLIENT_LIBRARY_DESTINATION_UNSPECIFIED")
12548            }
12549            Self::Github => std::option::Option::Some("GITHUB"),
12550            Self::PackageManager => std::option::Option::Some("PACKAGE_MANAGER"),
12551            Self::UnknownValue(u) => u.0.name(),
12552        }
12553    }
12554}
12555
12556impl std::default::Default for ClientLibraryDestination {
12557    fn default() -> Self {
12558        use std::convert::From;
12559        Self::from(0)
12560    }
12561}
12562
12563impl std::fmt::Display for ClientLibraryDestination {
12564    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
12565        wkt::internal::display_enum(f, self.name(), self.value())
12566    }
12567}
12568
12569impl std::convert::From<i32> for ClientLibraryDestination {
12570    fn from(value: i32) -> Self {
12571        match value {
12572            0 => Self::Unspecified,
12573            10 => Self::Github,
12574            20 => Self::PackageManager,
12575            _ => Self::UnknownValue(client_library_destination::UnknownValue(
12576                wkt::internal::UnknownEnumValue::Integer(value),
12577            )),
12578        }
12579    }
12580}
12581
12582impl std::convert::From<&str> for ClientLibraryDestination {
12583    fn from(value: &str) -> Self {
12584        use std::string::ToString;
12585        match value {
12586            "CLIENT_LIBRARY_DESTINATION_UNSPECIFIED" => Self::Unspecified,
12587            "GITHUB" => Self::Github,
12588            "PACKAGE_MANAGER" => Self::PackageManager,
12589            _ => Self::UnknownValue(client_library_destination::UnknownValue(
12590                wkt::internal::UnknownEnumValue::String(value.to_string()),
12591            )),
12592        }
12593    }
12594}
12595
12596impl serde::ser::Serialize for ClientLibraryDestination {
12597    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12598    where
12599        S: serde::Serializer,
12600    {
12601        match self {
12602            Self::Unspecified => serializer.serialize_i32(0),
12603            Self::Github => serializer.serialize_i32(10),
12604            Self::PackageManager => serializer.serialize_i32(20),
12605            Self::UnknownValue(u) => u.0.serialize(serializer),
12606        }
12607    }
12608}
12609
12610impl<'de> serde::de::Deserialize<'de> for ClientLibraryDestination {
12611    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12612    where
12613        D: serde::Deserializer<'de>,
12614    {
12615        deserializer.deserialize_any(wkt::internal::EnumVisitor::<ClientLibraryDestination>::new(
12616            ".google.api.ClientLibraryDestination",
12617        ))
12618    }
12619}
12620
12621/// The behavior to take when the flow control limit is exceeded.
12622///
12623/// # Working with unknown values
12624///
12625/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12626/// additional enum variants at any time. Adding new variants is not considered
12627/// a breaking change. Applications should write their code in anticipation of:
12628///
12629/// - New values appearing in future releases of the client library, **and**
12630/// - New values received dynamically, without application changes.
12631///
12632/// Please consult the [Working with enums] section in the user guide for some
12633/// guidelines.
12634///
12635/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
12636#[derive(Clone, Debug, PartialEq)]
12637#[non_exhaustive]
12638pub enum FlowControlLimitExceededBehaviorProto {
12639    /// Default behavior, system-defined.
12640    UnsetBehavior,
12641    /// Stop operation, raise error.
12642    ThrowException,
12643    /// Pause operation until limit clears.
12644    Block,
12645    /// Continue operation, disregard limit.
12646    Ignore,
12647    /// If set, the enum was initialized with an unknown value.
12648    ///
12649    /// Applications can examine the value using [FlowControlLimitExceededBehaviorProto::value] or
12650    /// [FlowControlLimitExceededBehaviorProto::name].
12651    UnknownValue(flow_control_limit_exceeded_behavior_proto::UnknownValue),
12652}
12653
12654#[doc(hidden)]
12655pub mod flow_control_limit_exceeded_behavior_proto {
12656    #[allow(unused_imports)]
12657    use super::*;
12658    #[derive(Clone, Debug, PartialEq)]
12659    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
12660}
12661
12662impl FlowControlLimitExceededBehaviorProto {
12663    /// Gets the enum value.
12664    ///
12665    /// Returns `None` if the enum contains an unknown value deserialized from
12666    /// the string representation of enums.
12667    pub fn value(&self) -> std::option::Option<i32> {
12668        match self {
12669            Self::UnsetBehavior => std::option::Option::Some(0),
12670            Self::ThrowException => std::option::Option::Some(1),
12671            Self::Block => std::option::Option::Some(2),
12672            Self::Ignore => std::option::Option::Some(3),
12673            Self::UnknownValue(u) => u.0.value(),
12674        }
12675    }
12676
12677    /// Gets the enum value as a string.
12678    ///
12679    /// Returns `None` if the enum contains an unknown value deserialized from
12680    /// the integer representation of enums.
12681    pub fn name(&self) -> std::option::Option<&str> {
12682        match self {
12683            Self::UnsetBehavior => std::option::Option::Some("UNSET_BEHAVIOR"),
12684            Self::ThrowException => std::option::Option::Some("THROW_EXCEPTION"),
12685            Self::Block => std::option::Option::Some("BLOCK"),
12686            Self::Ignore => std::option::Option::Some("IGNORE"),
12687            Self::UnknownValue(u) => u.0.name(),
12688        }
12689    }
12690}
12691
12692impl std::default::Default for FlowControlLimitExceededBehaviorProto {
12693    fn default() -> Self {
12694        use std::convert::From;
12695        Self::from(0)
12696    }
12697}
12698
12699impl std::fmt::Display for FlowControlLimitExceededBehaviorProto {
12700    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
12701        wkt::internal::display_enum(f, self.name(), self.value())
12702    }
12703}
12704
12705impl std::convert::From<i32> for FlowControlLimitExceededBehaviorProto {
12706    fn from(value: i32) -> Self {
12707        match value {
12708            0 => Self::UnsetBehavior,
12709            1 => Self::ThrowException,
12710            2 => Self::Block,
12711            3 => Self::Ignore,
12712            _ => Self::UnknownValue(flow_control_limit_exceeded_behavior_proto::UnknownValue(
12713                wkt::internal::UnknownEnumValue::Integer(value),
12714            )),
12715        }
12716    }
12717}
12718
12719impl std::convert::From<&str> for FlowControlLimitExceededBehaviorProto {
12720    fn from(value: &str) -> Self {
12721        use std::string::ToString;
12722        match value {
12723            "UNSET_BEHAVIOR" => Self::UnsetBehavior,
12724            "THROW_EXCEPTION" => Self::ThrowException,
12725            "BLOCK" => Self::Block,
12726            "IGNORE" => Self::Ignore,
12727            _ => Self::UnknownValue(flow_control_limit_exceeded_behavior_proto::UnknownValue(
12728                wkt::internal::UnknownEnumValue::String(value.to_string()),
12729            )),
12730        }
12731    }
12732}
12733
12734impl serde::ser::Serialize for FlowControlLimitExceededBehaviorProto {
12735    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12736    where
12737        S: serde::Serializer,
12738    {
12739        match self {
12740            Self::UnsetBehavior => serializer.serialize_i32(0),
12741            Self::ThrowException => serializer.serialize_i32(1),
12742            Self::Block => serializer.serialize_i32(2),
12743            Self::Ignore => serializer.serialize_i32(3),
12744            Self::UnknownValue(u) => u.0.serialize(serializer),
12745        }
12746    }
12747}
12748
12749impl<'de> serde::de::Deserialize<'de> for FlowControlLimitExceededBehaviorProto {
12750    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12751    where
12752        D: serde::Deserializer<'de>,
12753    {
12754        deserializer.deserialize_any(wkt::internal::EnumVisitor::<
12755            FlowControlLimitExceededBehaviorProto,
12756        >::new(
12757            ".google.api.FlowControlLimitExceededBehaviorProto"
12758        ))
12759    }
12760}
12761
12762/// Classifies set of possible modifications to an object in the service
12763/// configuration.
12764///
12765/// # Working with unknown values
12766///
12767/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12768/// additional enum variants at any time. Adding new variants is not considered
12769/// a breaking change. Applications should write their code in anticipation of:
12770///
12771/// - New values appearing in future releases of the client library, **and**
12772/// - New values received dynamically, without application changes.
12773///
12774/// Please consult the [Working with enums] section in the user guide for some
12775/// guidelines.
12776///
12777/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
12778#[derive(Clone, Debug, PartialEq)]
12779#[non_exhaustive]
12780pub enum ChangeType {
12781    /// No value was provided.
12782    Unspecified,
12783    /// The changed object exists in the 'new' service configuration, but not
12784    /// in the 'old' service configuration.
12785    Added,
12786    /// The changed object exists in the 'old' service configuration, but not
12787    /// in the 'new' service configuration.
12788    Removed,
12789    /// The changed object exists in both service configurations, but its value
12790    /// is different.
12791    Modified,
12792    /// If set, the enum was initialized with an unknown value.
12793    ///
12794    /// Applications can examine the value using [ChangeType::value] or
12795    /// [ChangeType::name].
12796    UnknownValue(change_type::UnknownValue),
12797}
12798
12799#[doc(hidden)]
12800pub mod change_type {
12801    #[allow(unused_imports)]
12802    use super::*;
12803    #[derive(Clone, Debug, PartialEq)]
12804    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
12805}
12806
12807impl ChangeType {
12808    /// Gets the enum value.
12809    ///
12810    /// Returns `None` if the enum contains an unknown value deserialized from
12811    /// the string representation of enums.
12812    pub fn value(&self) -> std::option::Option<i32> {
12813        match self {
12814            Self::Unspecified => std::option::Option::Some(0),
12815            Self::Added => std::option::Option::Some(1),
12816            Self::Removed => std::option::Option::Some(2),
12817            Self::Modified => std::option::Option::Some(3),
12818            Self::UnknownValue(u) => u.0.value(),
12819        }
12820    }
12821
12822    /// Gets the enum value as a string.
12823    ///
12824    /// Returns `None` if the enum contains an unknown value deserialized from
12825    /// the integer representation of enums.
12826    pub fn name(&self) -> std::option::Option<&str> {
12827        match self {
12828            Self::Unspecified => std::option::Option::Some("CHANGE_TYPE_UNSPECIFIED"),
12829            Self::Added => std::option::Option::Some("ADDED"),
12830            Self::Removed => std::option::Option::Some("REMOVED"),
12831            Self::Modified => std::option::Option::Some("MODIFIED"),
12832            Self::UnknownValue(u) => u.0.name(),
12833        }
12834    }
12835}
12836
12837impl std::default::Default for ChangeType {
12838    fn default() -> Self {
12839        use std::convert::From;
12840        Self::from(0)
12841    }
12842}
12843
12844impl std::fmt::Display for ChangeType {
12845    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
12846        wkt::internal::display_enum(f, self.name(), self.value())
12847    }
12848}
12849
12850impl std::convert::From<i32> for ChangeType {
12851    fn from(value: i32) -> Self {
12852        match value {
12853            0 => Self::Unspecified,
12854            1 => Self::Added,
12855            2 => Self::Removed,
12856            3 => Self::Modified,
12857            _ => Self::UnknownValue(change_type::UnknownValue(
12858                wkt::internal::UnknownEnumValue::Integer(value),
12859            )),
12860        }
12861    }
12862}
12863
12864impl std::convert::From<&str> for ChangeType {
12865    fn from(value: &str) -> Self {
12866        use std::string::ToString;
12867        match value {
12868            "CHANGE_TYPE_UNSPECIFIED" => Self::Unspecified,
12869            "ADDED" => Self::Added,
12870            "REMOVED" => Self::Removed,
12871            "MODIFIED" => Self::Modified,
12872            _ => Self::UnknownValue(change_type::UnknownValue(
12873                wkt::internal::UnknownEnumValue::String(value.to_string()),
12874            )),
12875        }
12876    }
12877}
12878
12879impl serde::ser::Serialize for ChangeType {
12880    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12881    where
12882        S: serde::Serializer,
12883    {
12884        match self {
12885            Self::Unspecified => serializer.serialize_i32(0),
12886            Self::Added => serializer.serialize_i32(1),
12887            Self::Removed => serializer.serialize_i32(2),
12888            Self::Modified => serializer.serialize_i32(3),
12889            Self::UnknownValue(u) => u.0.serialize(serializer),
12890        }
12891    }
12892}
12893
12894impl<'de> serde::de::Deserialize<'de> for ChangeType {
12895    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12896    where
12897        D: serde::Deserializer<'de>,
12898    {
12899        deserializer.deserialize_any(wkt::internal::EnumVisitor::<ChangeType>::new(
12900            ".google.api.ChangeType",
12901        ))
12902    }
12903}
12904
12905/// Defines the supported values for `google.rpc.ErrorInfo.reason` for the
12906/// `googleapis.com` error domain. This error domain is reserved for [Service
12907/// Infrastructure](https://cloud.google.com/service-infrastructure/docs/overview).
12908/// For each error info of this domain, the metadata key "service" refers to the
12909/// logical identifier of an API service, such as "pubsub.googleapis.com". The
12910/// "consumer" refers to the entity that consumes an API Service. It typically is
12911/// a Google project that owns the client application or the server resource,
12912/// such as "projects/123". Other metadata keys are specific to each error
12913/// reason. For more information, see the definition of the specific error
12914/// reason.
12915///
12916/// # Working with unknown values
12917///
12918/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12919/// additional enum variants at any time. Adding new variants is not considered
12920/// a breaking change. Applications should write their code in anticipation of:
12921///
12922/// - New values appearing in future releases of the client library, **and**
12923/// - New values received dynamically, without application changes.
12924///
12925/// Please consult the [Working with enums] section in the user guide for some
12926/// guidelines.
12927///
12928/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
12929#[derive(Clone, Debug, PartialEq)]
12930#[non_exhaustive]
12931pub enum ErrorReason {
12932    /// Do not use this default value.
12933    Unspecified,
12934    /// The request is calling a disabled service for a consumer.
12935    ///
12936    /// Example of an ErrorInfo when the consumer "projects/123" contacting
12937    /// "pubsub.googleapis.com" service which is disabled:
12938    ///
12939    /// ```norust
12940    /// { "reason": "SERVICE_DISABLED",
12941    ///   "domain": "googleapis.com",
12942    ///   "metadata": {
12943    ///     "consumer": "projects/123",
12944    ///     "service": "pubsub.googleapis.com"
12945    ///   }
12946    /// }
12947    /// ```
12948    ///
12949    /// This response indicates the "pubsub.googleapis.com" has been disabled in
12950    /// "projects/123".
12951    ServiceDisabled,
12952    /// The request whose associated billing account is disabled.
12953    ///
12954    /// Example of an ErrorInfo when the consumer "projects/123" fails to contact
12955    /// "pubsub.googleapis.com" service because the associated billing account is
12956    /// disabled:
12957    ///
12958    /// ```norust
12959    /// { "reason": "BILLING_DISABLED",
12960    ///   "domain": "googleapis.com",
12961    ///   "metadata": {
12962    ///     "consumer": "projects/123",
12963    ///     "service": "pubsub.googleapis.com"
12964    ///   }
12965    /// }
12966    /// ```
12967    ///
12968    /// This response indicates the billing account associated has been disabled.
12969    BillingDisabled,
12970    /// The request is denied because the provided [API
12971    /// key](https://cloud.google.com/docs/authentication/api-keys) is invalid. It
12972    /// may be in a bad format, cannot be found, or has been expired).
12973    ///
12974    /// Example of an ErrorInfo when the request is contacting
12975    /// "storage.googleapis.com" service with an invalid API key:
12976    ///
12977    /// ```norust
12978    /// { "reason": "API_KEY_INVALID",
12979    ///   "domain": "googleapis.com",
12980    ///   "metadata": {
12981    ///     "service": "storage.googleapis.com",
12982    ///   }
12983    /// }
12984    /// ```
12985    ApiKeyInvalid,
12986    /// The request is denied because it violates [API key API
12987    /// restrictions](https://cloud.google.com/docs/authentication/api-keys#adding_api_restrictions).
12988    ///
12989    /// Example of an ErrorInfo when the consumer "projects/123" fails to call the
12990    /// "storage.googleapis.com" service because this service is restricted in the
12991    /// API key:
12992    ///
12993    /// ```norust
12994    /// { "reason": "API_KEY_SERVICE_BLOCKED",
12995    ///   "domain": "googleapis.com",
12996    ///   "metadata": {
12997    ///     "consumer": "projects/123",
12998    ///     "service": "storage.googleapis.com"
12999    ///   }
13000    /// }
13001    /// ```
13002    ApiKeyServiceBlocked,
13003    /// The request is denied because it violates [API key HTTP
13004    /// restrictions](https://cloud.google.com/docs/authentication/api-keys#adding_http_restrictions).
13005    ///
13006    /// Example of an ErrorInfo when the consumer "projects/123" fails to call
13007    /// "storage.googleapis.com" service because the http referrer of the request
13008    /// violates API key HTTP restrictions:
13009    ///
13010    /// ```norust
13011    /// { "reason": "API_KEY_HTTP_REFERRER_BLOCKED",
13012    ///   "domain": "googleapis.com",
13013    ///   "metadata": {
13014    ///     "consumer": "projects/123",
13015    ///     "service": "storage.googleapis.com",
13016    ///   }
13017    /// }
13018    /// ```
13019    ApiKeyHttpReferrerBlocked,
13020    /// The request is denied because it violates [API key IP address
13021    /// restrictions](https://cloud.google.com/docs/authentication/api-keys#adding_application_restrictions).
13022    ///
13023    /// Example of an ErrorInfo when the consumer "projects/123" fails to call
13024    /// "storage.googleapis.com" service because the caller IP of the request
13025    /// violates API key IP address restrictions:
13026    ///
13027    /// ```norust
13028    /// { "reason": "API_KEY_IP_ADDRESS_BLOCKED",
13029    ///   "domain": "googleapis.com",
13030    ///   "metadata": {
13031    ///     "consumer": "projects/123",
13032    ///     "service": "storage.googleapis.com",
13033    ///   }
13034    /// }
13035    /// ```
13036    ApiKeyIpAddressBlocked,
13037    /// The request is denied because it violates [API key Android application
13038    /// restrictions](https://cloud.google.com/docs/authentication/api-keys#adding_application_restrictions).
13039    ///
13040    /// Example of an ErrorInfo when the consumer "projects/123" fails to call
13041    /// "storage.googleapis.com" service because the request from the Android apps
13042    /// violates the API key Android application restrictions:
13043    ///
13044    /// ```norust
13045    /// { "reason": "API_KEY_ANDROID_APP_BLOCKED",
13046    ///   "domain": "googleapis.com",
13047    ///   "metadata": {
13048    ///     "consumer": "projects/123",
13049    ///     "service": "storage.googleapis.com"
13050    ///   }
13051    /// }
13052    /// ```
13053    ApiKeyAndroidAppBlocked,
13054    /// The request is denied because it violates [API key iOS application
13055    /// restrictions](https://cloud.google.com/docs/authentication/api-keys#adding_application_restrictions).
13056    ///
13057    /// Example of an ErrorInfo when the consumer "projects/123" fails to call
13058    /// "storage.googleapis.com" service because the request from the iOS apps
13059    /// violates the API key iOS application restrictions:
13060    ///
13061    /// ```norust
13062    /// { "reason": "API_KEY_IOS_APP_BLOCKED",
13063    ///   "domain": "googleapis.com",
13064    ///   "metadata": {
13065    ///     "consumer": "projects/123",
13066    ///     "service": "storage.googleapis.com"
13067    ///   }
13068    /// }
13069    /// ```
13070    ApiKeyIosAppBlocked,
13071    /// The request is denied because there is not enough rate quota for the
13072    /// consumer.
13073    ///
13074    /// Example of an ErrorInfo when the consumer "projects/123" fails to contact
13075    /// "pubsub.googleapis.com" service because consumer's rate quota usage has
13076    /// reached the maximum value set for the quota limit
13077    /// "ReadsPerMinutePerProject" on the quota metric
13078    /// "pubsub.googleapis.com/read_requests":
13079    ///
13080    /// ```norust
13081    /// { "reason": "RATE_LIMIT_EXCEEDED",
13082    ///   "domain": "googleapis.com",
13083    ///   "metadata": {
13084    ///     "consumer": "projects/123",
13085    ///     "service": "pubsub.googleapis.com",
13086    ///     "quota_metric": "pubsub.googleapis.com/read_requests",
13087    ///     "quota_limit": "ReadsPerMinutePerProject"
13088    ///   }
13089    /// }
13090    /// ```
13091    ///
13092    /// Example of an ErrorInfo when the consumer "projects/123" checks quota on
13093    /// the service "dataflow.googleapis.com" and hits the organization quota
13094    /// limit "DefaultRequestsPerMinutePerOrganization" on the metric
13095    /// "dataflow.googleapis.com/default_requests".
13096    ///
13097    /// ```norust
13098    /// { "reason": "RATE_LIMIT_EXCEEDED",
13099    ///   "domain": "googleapis.com",
13100    ///   "metadata": {
13101    ///     "consumer": "projects/123",
13102    ///     "service": "dataflow.googleapis.com",
13103    ///     "quota_metric": "dataflow.googleapis.com/default_requests",
13104    ///     "quota_limit": "DefaultRequestsPerMinutePerOrganization"
13105    ///   }
13106    /// }
13107    /// ```
13108    RateLimitExceeded,
13109    /// The request is denied because there is not enough resource quota for the
13110    /// consumer.
13111    ///
13112    /// Example of an ErrorInfo when the consumer "projects/123" fails to contact
13113    /// "compute.googleapis.com" service because consumer's resource quota usage
13114    /// has reached the maximum value set for the quota limit "VMsPerProject"
13115    /// on the quota metric "compute.googleapis.com/vms":
13116    ///
13117    /// ```norust
13118    /// { "reason": "RESOURCE_QUOTA_EXCEEDED",
13119    ///   "domain": "googleapis.com",
13120    ///   "metadata": {
13121    ///     "consumer": "projects/123",
13122    ///     "service": "compute.googleapis.com",
13123    ///     "quota_metric": "compute.googleapis.com/vms",
13124    ///     "quota_limit": "VMsPerProject"
13125    ///   }
13126    /// }
13127    /// ```
13128    ///
13129    /// Example of an ErrorInfo when the consumer "projects/123" checks resource
13130    /// quota on the service "dataflow.googleapis.com" and hits the organization
13131    /// quota limit "jobs-per-organization" on the metric
13132    /// "dataflow.googleapis.com/job_count".
13133    ///
13134    /// ```norust
13135    /// { "reason": "RESOURCE_QUOTA_EXCEEDED",
13136    ///   "domain": "googleapis.com",
13137    ///   "metadata": {
13138    ///     "consumer": "projects/123",
13139    ///     "service": "dataflow.googleapis.com",
13140    ///     "quota_metric": "dataflow.googleapis.com/job_count",
13141    ///     "quota_limit": "jobs-per-organization"
13142    ///   }
13143    /// }
13144    /// ```
13145    ResourceQuotaExceeded,
13146    /// The request whose associated billing account address is in a tax restricted
13147    /// location, violates the local tax restrictions when creating resources in
13148    /// the restricted region.
13149    ///
13150    /// Example of an ErrorInfo when creating the Cloud Storage Bucket in the
13151    /// container "projects/123" under a tax restricted region
13152    /// "locations/asia-northeast3":
13153    ///
13154    /// ```norust
13155    /// { "reason": "LOCATION_TAX_POLICY_VIOLATED",
13156    ///   "domain": "googleapis.com",
13157    ///   "metadata": {
13158    ///     "consumer": "projects/123",
13159    ///     "service": "storage.googleapis.com",
13160    ///     "location": "locations/asia-northeast3"
13161    ///   }
13162    /// }
13163    /// ```
13164    ///
13165    /// This response indicates creating the Cloud Storage Bucket in
13166    /// "locations/asia-northeast3" violates the location tax restriction.
13167    LocationTaxPolicyViolated,
13168    /// The request is denied because the caller does not have required permission
13169    /// on the user project "projects/123" or the user project is invalid. For more
13170    /// information, check the [userProject System
13171    /// Parameters](https://cloud.google.com/apis/docs/system-parameters).
13172    ///
13173    /// Example of an ErrorInfo when the caller is calling Cloud Storage service
13174    /// with insufficient permissions on the user project:
13175    ///
13176    /// ```norust
13177    /// { "reason": "USER_PROJECT_DENIED",
13178    ///   "domain": "googleapis.com",
13179    ///   "metadata": {
13180    ///     "consumer": "projects/123",
13181    ///     "service": "storage.googleapis.com"
13182    ///   }
13183    /// }
13184    /// ```
13185    UserProjectDenied,
13186    /// The request is denied because the consumer "projects/123" is suspended due
13187    /// to Terms of Service(Tos) violations. Check [Project suspension
13188    /// guidelines](https://cloud.google.com/resource-manager/docs/project-suspension-guidelines)
13189    /// for more information.
13190    ///
13191    /// Example of an ErrorInfo when calling Cloud Storage service with the
13192    /// suspended consumer "projects/123":
13193    ///
13194    /// ```norust
13195    /// { "reason": "CONSUMER_SUSPENDED",
13196    ///   "domain": "googleapis.com",
13197    ///   "metadata": {
13198    ///     "consumer": "projects/123",
13199    ///     "service": "storage.googleapis.com"
13200    ///   }
13201    /// }
13202    /// ```
13203    ConsumerSuspended,
13204    /// The request is denied because the associated consumer is invalid. It may be
13205    /// in a bad format, cannot be found, or have been deleted.
13206    ///
13207    /// Example of an ErrorInfo when calling Cloud Storage service with the
13208    /// invalid consumer "projects/123":
13209    ///
13210    /// ```norust
13211    /// { "reason": "CONSUMER_INVALID",
13212    ///   "domain": "googleapis.com",
13213    ///   "metadata": {
13214    ///     "consumer": "projects/123",
13215    ///     "service": "storage.googleapis.com"
13216    ///   }
13217    /// }
13218    /// ```
13219    ConsumerInvalid,
13220    /// The request is denied because it violates [VPC Service
13221    /// Controls](https://cloud.google.com/vpc-service-controls/docs/overview).
13222    /// The 'uid' field is a random generated identifier that customer can use it
13223    /// to search the audit log for a request rejected by VPC Service Controls. For
13224    /// more information, please refer [VPC Service Controls
13225    /// Troubleshooting](https://cloud.google.com/vpc-service-controls/docs/troubleshooting#unique-id)
13226    ///
13227    /// Example of an ErrorInfo when the consumer "projects/123" fails to call
13228    /// Cloud Storage service because the request is prohibited by the VPC Service
13229    /// Controls.
13230    ///
13231    /// ```norust
13232    /// { "reason": "SECURITY_POLICY_VIOLATED",
13233    ///   "domain": "googleapis.com",
13234    ///   "metadata": {
13235    ///     "uid": "123456789abcde",
13236    ///     "consumer": "projects/123",
13237    ///     "service": "storage.googleapis.com"
13238    ///   }
13239    /// }
13240    /// ```
13241    SecurityPolicyViolated,
13242    /// The request is denied because the provided access token has expired.
13243    ///
13244    /// Example of an ErrorInfo when the request is calling Cloud Storage service
13245    /// with an expired access token:
13246    ///
13247    /// ```norust
13248    /// { "reason": "ACCESS_TOKEN_EXPIRED",
13249    ///   "domain": "googleapis.com",
13250    ///   "metadata": {
13251    ///     "service": "storage.googleapis.com",
13252    ///     "method": "google.storage.v1.Storage.GetObject"
13253    ///   }
13254    /// }
13255    /// ```
13256    AccessTokenExpired,
13257    /// The request is denied because the provided access token doesn't have at
13258    /// least one of the acceptable scopes required for the API. Please check
13259    /// [OAuth 2.0 Scopes for Google
13260    /// APIs](https://developers.google.com/identity/protocols/oauth2/scopes) for
13261    /// the list of the OAuth 2.0 scopes that you might need to request to access
13262    /// the API.
13263    ///
13264    /// Example of an ErrorInfo when the request is calling Cloud Storage service
13265    /// with an access token that is missing required scopes:
13266    ///
13267    /// ```norust
13268    /// { "reason": "ACCESS_TOKEN_SCOPE_INSUFFICIENT",
13269    ///   "domain": "googleapis.com",
13270    ///   "metadata": {
13271    ///     "service": "storage.googleapis.com",
13272    ///     "method": "google.storage.v1.Storage.GetObject"
13273    ///   }
13274    /// }
13275    /// ```
13276    AccessTokenScopeInsufficient,
13277    /// The request is denied because the account associated with the provided
13278    /// access token is in an invalid state, such as disabled or deleted.
13279    /// For more information, see <https://cloud.google.com/docs/authentication>.
13280    ///
13281    /// Warning: For privacy reasons, the server may not be able to disclose the
13282    /// email address for some accounts. The client MUST NOT depend on the
13283    /// availability of the `email` attribute.
13284    ///
13285    /// Example of an ErrorInfo when the request is to the Cloud Storage API with
13286    /// an access token that is associated with a disabled or deleted [service
13287    /// account](http://cloud/iam/docs/service-accounts):
13288    ///
13289    /// ```norust
13290    /// { "reason": "ACCOUNT_STATE_INVALID",
13291    ///   "domain": "googleapis.com",
13292    ///   "metadata": {
13293    ///     "service": "storage.googleapis.com",
13294    ///     "method": "google.storage.v1.Storage.GetObject",
13295    ///     "email": "user@123.iam.gserviceaccount.com"
13296    ///   }
13297    /// }
13298    /// ```
13299    AccountStateInvalid,
13300    /// The request is denied because the type of the provided access token is not
13301    /// supported by the API being called.
13302    ///
13303    /// Example of an ErrorInfo when the request is to the Cloud Storage API with
13304    /// an unsupported token type.
13305    ///
13306    /// ```norust
13307    /// { "reason": "ACCESS_TOKEN_TYPE_UNSUPPORTED",
13308    ///   "domain": "googleapis.com",
13309    ///   "metadata": {
13310    ///     "service": "storage.googleapis.com",
13311    ///     "method": "google.storage.v1.Storage.GetObject"
13312    ///   }
13313    /// }
13314    /// ```
13315    AccessTokenTypeUnsupported,
13316    /// The request is denied because the request doesn't have any authentication
13317    /// credentials. For more information regarding the supported authentication
13318    /// strategies for Google Cloud APIs, see
13319    /// <https://cloud.google.com/docs/authentication>.
13320    ///
13321    /// Example of an ErrorInfo when the request is to the Cloud Storage API
13322    /// without any authentication credentials.
13323    ///
13324    /// ```norust
13325    /// { "reason": "CREDENTIALS_MISSING",
13326    ///   "domain": "googleapis.com",
13327    ///   "metadata": {
13328    ///     "service": "storage.googleapis.com",
13329    ///     "method": "google.storage.v1.Storage.GetObject"
13330    ///   }
13331    /// }
13332    /// ```
13333    CredentialsMissing,
13334    /// The request is denied because the provided project owning the resource
13335    /// which acts as the [API
13336    /// consumer](https://cloud.google.com/apis/design/glossary#api_consumer) is
13337    /// invalid. It may be in a bad format or empty.
13338    ///
13339    /// Example of an ErrorInfo when the request is to the Cloud Functions API,
13340    /// but the offered resource project in the request in a bad format which can't
13341    /// perform the ListFunctions method.
13342    ///
13343    /// ```norust
13344    /// { "reason": "RESOURCE_PROJECT_INVALID",
13345    ///   "domain": "googleapis.com",
13346    ///   "metadata": {
13347    ///     "service": "cloudfunctions.googleapis.com",
13348    ///     "method":
13349    ///     "google.cloud.functions.v1.CloudFunctionsService.ListFunctions"
13350    ///   }
13351    /// }
13352    /// ```
13353    ResourceProjectInvalid,
13354    /// The request is denied because the provided session cookie is missing,
13355    /// invalid or failed to decode.
13356    ///
13357    /// Example of an ErrorInfo when the request is calling Cloud Storage service
13358    /// with a SID cookie which can't be decoded.
13359    ///
13360    /// ```norust
13361    /// { "reason": "SESSION_COOKIE_INVALID",
13362    ///   "domain": "googleapis.com",
13363    ///   "metadata": {
13364    ///     "service": "storage.googleapis.com",
13365    ///     "method": "google.storage.v1.Storage.GetObject",
13366    ///     "cookie": "SID"
13367    ///   }
13368    /// }
13369    /// ```
13370    SessionCookieInvalid,
13371    /// The request is denied because the user is from a Google Workspace customer
13372    /// that blocks their users from accessing a particular service.
13373    ///
13374    /// Example scenario: <https://support.google.com/a/answer/9197205?hl=en>
13375    ///
13376    /// Example of an ErrorInfo when access to Google Cloud Storage service is
13377    /// blocked by the Google Workspace administrator:
13378    ///
13379    /// ```norust
13380    /// { "reason": "USER_BLOCKED_BY_ADMIN",
13381    ///   "domain": "googleapis.com",
13382    ///   "metadata": {
13383    ///     "service": "storage.googleapis.com",
13384    ///     "method": "google.storage.v1.Storage.GetObject",
13385    ///   }
13386    /// }
13387    /// ```
13388    UserBlockedByAdmin,
13389    /// The request is denied because the resource service usage is restricted
13390    /// by administrators according to the organization policy constraint.
13391    /// For more information see
13392    /// <https://cloud.google.com/resource-manager/docs/organization-policy/restricting-services>.
13393    ///
13394    /// Example of an ErrorInfo when access to Google Cloud Storage service is
13395    /// restricted by Resource Usage Restriction policy:
13396    ///
13397    /// ```norust
13398    /// { "reason": "RESOURCE_USAGE_RESTRICTION_VIOLATED",
13399    ///   "domain": "googleapis.com",
13400    ///   "metadata": {
13401    ///     "consumer": "projects/project-123",
13402    ///     "service": "storage.googleapis.com"
13403    ///   }
13404    /// }
13405    /// ```
13406    ResourceUsageRestrictionViolated,
13407    /// Unimplemented. Do not use.
13408    ///
13409    /// The request is denied because it contains unsupported system parameters in
13410    /// URL query parameters or HTTP headers. For more information,
13411    /// see <https://cloud.google.com/apis/docs/system-parameters>
13412    ///
13413    /// Example of an ErrorInfo when access "pubsub.googleapis.com" service with
13414    /// a request header of "x-goog-user-ip":
13415    ///
13416    /// ```norust
13417    /// { "reason": "SYSTEM_PARAMETER_UNSUPPORTED",
13418    ///   "domain": "googleapis.com",
13419    ///   "metadata": {
13420    ///     "service": "pubsub.googleapis.com"
13421    ///     "parameter": "x-goog-user-ip"
13422    ///   }
13423    /// }
13424    /// ```
13425    SystemParameterUnsupported,
13426    /// The request is denied because it violates Org Restriction: the requested
13427    /// resource does not belong to allowed organizations specified in
13428    /// "X-Goog-Allowed-Resources" header.
13429    ///
13430    /// Example of an ErrorInfo when accessing a GCP resource that is restricted by
13431    /// Org Restriction for "pubsub.googleapis.com" service.
13432    ///
13433    /// {
13434    /// reason: "ORG_RESTRICTION_VIOLATION"
13435    /// domain: "googleapis.com"
13436    /// metadata {
13437    /// "consumer":"projects/123456"
13438    /// "service": "pubsub.googleapis.com"
13439    /// }
13440    /// }
13441    OrgRestrictionViolation,
13442    /// The request is denied because "X-Goog-Allowed-Resources" header is in a bad
13443    /// format.
13444    ///
13445    /// Example of an ErrorInfo when
13446    /// accessing "pubsub.googleapis.com" service with an invalid
13447    /// "X-Goog-Allowed-Resources" request header.
13448    ///
13449    /// {
13450    /// reason: "ORG_RESTRICTION_HEADER_INVALID"
13451    /// domain: "googleapis.com"
13452    /// metadata {
13453    /// "consumer":"projects/123456"
13454    /// "service": "pubsub.googleapis.com"
13455    /// }
13456    /// }
13457    OrgRestrictionHeaderInvalid,
13458    /// Unimplemented. Do not use.
13459    ///
13460    /// The request is calling a service that is not visible to the consumer.
13461    ///
13462    /// Example of an ErrorInfo when the consumer "projects/123" contacting
13463    /// "pubsub.googleapis.com" service which is not visible to the consumer.
13464    ///
13465    /// ```norust
13466    /// { "reason": "SERVICE_NOT_VISIBLE",
13467    ///   "domain": "googleapis.com",
13468    ///   "metadata": {
13469    ///     "consumer": "projects/123",
13470    ///     "service": "pubsub.googleapis.com"
13471    ///   }
13472    /// }
13473    /// ```
13474    ///
13475    /// This response indicates the "pubsub.googleapis.com" is not visible to
13476    /// "projects/123" (or it may not exist).
13477    ServiceNotVisible,
13478    /// The request is related to a project for which GCP access is suspended.
13479    ///
13480    /// Example of an ErrorInfo when the consumer "projects/123" fails to contact
13481    /// "pubsub.googleapis.com" service because GCP access is suspended:
13482    ///
13483    /// ```norust
13484    /// { "reason": "GCP_SUSPENDED",
13485    ///   "domain": "googleapis.com",
13486    ///   "metadata": {
13487    ///     "consumer": "projects/123",
13488    ///     "service": "pubsub.googleapis.com"
13489    ///   }
13490    /// }
13491    /// ```
13492    ///
13493    /// This response indicates the associated GCP account has been suspended.
13494    GcpSuspended,
13495    /// The request violates the location policies when creating resources in
13496    /// the restricted region.
13497    ///
13498    /// Example of an ErrorInfo when creating the Cloud Storage Bucket by
13499    /// "projects/123" for service storage.googleapis.com:
13500    ///
13501    /// ```norust
13502    /// { "reason": "LOCATION_POLICY_VIOLATED",
13503    ///   "domain": "googleapis.com",
13504    ///   "metadata": {
13505    ///     "consumer": "projects/123",
13506    ///     "service": "storage.googleapis.com",
13507    ///   }
13508    /// }
13509    /// ```
13510    ///
13511    /// This response indicates creating the Cloud Storage Bucket in
13512    /// "locations/asia-northeast3" violates at least one location policy.
13513    /// The troubleshooting guidance is provided in the Help links.
13514    LocationPolicyViolated,
13515    /// The request is denied because origin request header is missing.
13516    ///
13517    /// Example of an ErrorInfo when
13518    /// accessing "pubsub.googleapis.com" service with an empty "Origin" request
13519    /// header.
13520    ///
13521    /// {
13522    /// reason: "MISSING_ORIGIN"
13523    /// domain: "googleapis.com"
13524    /// metadata {
13525    /// "consumer":"projects/123456"
13526    /// "service": "pubsub.googleapis.com"
13527    /// }
13528    /// }
13529    MissingOrigin,
13530    /// The request is denied because the request contains more than one credential
13531    /// type that are individually acceptable, but not together. The customer
13532    /// should retry their request with only one set of credentials.
13533    ///
13534    /// Example of an ErrorInfo when
13535    /// accessing "pubsub.googleapis.com" service with overloaded credentials.
13536    ///
13537    /// {
13538    /// reason: "OVERLOADED_CREDENTIALS"
13539    /// domain: "googleapis.com"
13540    /// metadata {
13541    /// "consumer":"projects/123456"
13542    /// "service": "pubsub.googleapis.com"
13543    /// }
13544    /// }
13545    OverloadedCredentials,
13546    /// The request whose associated location violates the location org policy
13547    /// restrictions when creating resources in the restricted region.
13548    ///
13549    /// Example of an ErrorInfo when creating the Cloud Storage Bucket in the
13550    /// container "projects/123" under a restricted region
13551    /// "locations/asia-northeast3":
13552    ///
13553    /// ```norust
13554    /// {
13555    ///   "reason": "LOCATION_ORG_POLICY_VIOLATED",
13556    ///   "domain": "googleapis.com",
13557    ///   "metadata": {
13558    ///     "resource": "projects/123",
13559    ///     "location": "locations/asia-northeast3"
13560    ///   }
13561    /// }
13562    /// ```
13563    ///
13564    /// This response indicates creating the Cloud Storage Bucket in
13565    /// "locations/asia-northeast3" violates the location org policy restriction.
13566    LocationOrgPolicyViolated,
13567    /// The request is denied because it access data of regulated customers using
13568    /// TLS 1.0 and 1.1.
13569    ///
13570    /// Example of an ErrorInfo when accessing a GCP resource "projects/123" that
13571    /// is restricted by TLS Version Restriction for "pubsub.googleapis.com"
13572    /// service.
13573    ///
13574    /// ```norust
13575    /// {
13576    ///   "reason": "TLS_ORG_POLICY_VIOLATED",
13577    ///   "domain": "googleapis.com",
13578    ///   "metadata": {
13579    ///     "service": "pubsub.googleapis.com"
13580    ///     "resource": "projects/123",
13581    ///     "policyName": "constraints/gcp.restrictTLSVersion",
13582    ///     "tlsVersion": "TLS_VERSION_1"
13583    ///   }
13584    /// }
13585    /// ```
13586    TlsOrgPolicyViolated,
13587    /// The request is denied because the associated project has exceeded the
13588    /// emulator quota limit.
13589    ///
13590    /// Example of an ErrorInfo when the associated "projects/123" has exceeded the
13591    /// emulator quota limit.
13592    ///
13593    /// ```norust
13594    /// {
13595    ///   "reason": "EMULATOR_QUOTA_EXCEEDED",
13596    ///   "domain": "googleapis.com",
13597    ///   "metadata": {
13598    ///       "service": "pubsub.googleapis.com"
13599    ///       "consumer": "projects/123"
13600    ///    }
13601    /// }
13602    /// ```
13603    EmulatorQuotaExceeded,
13604    /// The request is denied because the associated application credential header
13605    /// is invalid for an Android applications.
13606    ///
13607    /// Example of an ErrorInfo when the request from an Android application to the
13608    /// "pubsub.googleapis.com" with an invalid application credential header.
13609    ///
13610    /// ```norust
13611    /// {
13612    ///   "reason": "CREDENTIAL_ANDROID_APP_INVALID",
13613    ///   "domain": "googleapis.com",
13614    ///   "metadata": {
13615    ///       "service": "pubsub.googleapis.com"
13616    ///    }
13617    /// }
13618    /// ```
13619    CredentialAndroidAppInvalid,
13620    /// The request is denied because IAM permission on resource is denied.
13621    ///
13622    /// Example of an ErrorInfo when the IAM permission `aiplatform.datasets.list`
13623    /// is denied on resource `projects/123`.
13624    ///
13625    /// ```norust
13626    /// {
13627    ///   "reason": "IAM_PERMISSION_DENIED",
13628    ///   "domain": "googleapis.com",
13629    ///   "metadata": {
13630    ///       "resource": "projects/123"
13631    ///       "permission": "aiplatform.datasets.list"
13632    ///    }
13633    /// }
13634    /// ```
13635    IamPermissionDenied,
13636    /// The request is denied because it contains the invalid JWT token.
13637    ///
13638    /// Example of an ErrorInfo when the request contains an invalid JWT token for
13639    /// service `storage.googleapis.com`.
13640    ///
13641    /// ```norust
13642    /// {
13643    ///   "reason": "JWT_TOKEN_INVALID",
13644    ///   "domain": "googleapis.com",
13645    ///   "metadata": {
13646    ///       "service": "storage.googleapis.com"
13647    ///    }
13648    /// }
13649    /// ```
13650    JwtTokenInvalid,
13651    /// The request is denied because it contains credential with type that is
13652    /// unsupported.
13653    ///
13654    /// Example of an ErrorInfo when the request contains an unsupported credential
13655    /// type for service `storage.googleapis.com`.
13656    ///
13657    /// ```norust
13658    /// {
13659    ///   "reason": "CREDENTIAL_TYPE_UNSUPPORTED",
13660    ///   "domain": "googleapis.com",
13661    ///   "metadata": {
13662    ///       "service": "storage.googleapis.com"
13663    ///    }
13664    /// }
13665    /// ```
13666    CredentialTypeUnsupported,
13667    /// The request is denied because it contains unsupported account type.
13668    ///
13669    /// Example of an ErrorInfo when the request contains an unsupported account
13670    /// type for service `storage.googleapis.com`.
13671    ///
13672    /// ```norust
13673    /// {
13674    ///   "reason": "ACCOUNT_TYPE_UNSUPPORTED",
13675    ///   "domain": "googleapis.com",
13676    ///   "metadata": {
13677    ///       "service": "storage.googleapis.com"
13678    ///    }
13679    /// }
13680    /// ```
13681    AccountTypeUnsupported,
13682    /// The request is denied because the API endpoint is restricted by
13683    /// administrators according to the organization policy constraint.
13684    /// For more information see
13685    /// <https://cloud.google.com/assured-workloads/docs/restrict-endpoint-usage>.
13686    ///
13687    /// Example of an ErrorInfo when access to Google Cloud Storage service is
13688    /// restricted by Restrict Endpoint Usage policy:
13689    ///
13690    /// ```norust
13691    /// {
13692    ///   "reason": "ENDPOINT_USAGE_RESTRICTION_VIOLATED",
13693    ///   "domain": "googleapis.com/policies/endpointUsageRestriction",
13694    ///   "metadata": {
13695    ///     "policy_name": "constraints/gcp.restrictEndpointUsage",
13696    ///     "checked_value": "storage.googleapis.com"
13697    ///     "consumer": "organization/123"
13698    ///     "service": "storage.googleapis.com"
13699    ///    }
13700    /// }
13701    /// ```
13702    EndpointUsageRestrictionViolated,
13703    /// The request is denied because the TLS Cipher Suite is restricted by
13704    /// administrators according to the organization policy constraint.
13705    /// For more information see
13706    /// <https://cloud.google.com/assured-workloads/docs/restrict-tls-cipher-suites>
13707    ///
13708    /// Example of an ErrorInfo when access to Google Cloud BigQuery service is
13709    /// restricted by Restrict TLS Cipher Suites policy:
13710    ///
13711    /// ```norust
13712    /// {
13713    ///   "reason": "TLS_CIPHER_RESTRICTION_VIOLATED",
13714    ///   "domain": "googleapis.com/policies/tlsCipherRestriction",
13715    ///   "metadata": {
13716    ///     "policy_name": "constraints/gcp.restrictTLSCipherSuites",
13717    ///     "checked_value": "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
13718    ///     "consumer": "organization/123"
13719    ///     "service": "bigquery.googleapis.com"
13720    ///    }
13721    /// }
13722    /// ```
13723    TlsCipherRestrictionViolated,
13724    /// The request is denied because the MCP activation check fails.
13725    ///
13726    /// Example of an ErrorInfo when the container "projects/123" contacting
13727    /// "pubsub.googleapis.com" service which is disabled by MCP:
13728    ///
13729    /// ```norust
13730    /// { "reason": "MCP_SERVER_DISABLED",
13731    ///   "domain": "googleapis.com",
13732    ///   "metadata": {
13733    ///     "consumer": "projects/123",
13734    ///     "service": "pubsub.googleapis.com"
13735    ///   }
13736    /// }
13737    /// ```
13738    ///
13739    /// This response indicates the "pubsub.googleapis.com" has been disabled in
13740    /// "projects/123" for MCP.
13741    McpServerDisabled,
13742    /// If set, the enum was initialized with an unknown value.
13743    ///
13744    /// Applications can examine the value using [ErrorReason::value] or
13745    /// [ErrorReason::name].
13746    UnknownValue(error_reason::UnknownValue),
13747}
13748
13749#[doc(hidden)]
13750pub mod error_reason {
13751    #[allow(unused_imports)]
13752    use super::*;
13753    #[derive(Clone, Debug, PartialEq)]
13754    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13755}
13756
13757impl ErrorReason {
13758    /// Gets the enum value.
13759    ///
13760    /// Returns `None` if the enum contains an unknown value deserialized from
13761    /// the string representation of enums.
13762    pub fn value(&self) -> std::option::Option<i32> {
13763        match self {
13764            Self::Unspecified => std::option::Option::Some(0),
13765            Self::ServiceDisabled => std::option::Option::Some(1),
13766            Self::BillingDisabled => std::option::Option::Some(2),
13767            Self::ApiKeyInvalid => std::option::Option::Some(3),
13768            Self::ApiKeyServiceBlocked => std::option::Option::Some(4),
13769            Self::ApiKeyHttpReferrerBlocked => std::option::Option::Some(7),
13770            Self::ApiKeyIpAddressBlocked => std::option::Option::Some(8),
13771            Self::ApiKeyAndroidAppBlocked => std::option::Option::Some(9),
13772            Self::ApiKeyIosAppBlocked => std::option::Option::Some(13),
13773            Self::RateLimitExceeded => std::option::Option::Some(5),
13774            Self::ResourceQuotaExceeded => std::option::Option::Some(6),
13775            Self::LocationTaxPolicyViolated => std::option::Option::Some(10),
13776            Self::UserProjectDenied => std::option::Option::Some(11),
13777            Self::ConsumerSuspended => std::option::Option::Some(12),
13778            Self::ConsumerInvalid => std::option::Option::Some(14),
13779            Self::SecurityPolicyViolated => std::option::Option::Some(15),
13780            Self::AccessTokenExpired => std::option::Option::Some(16),
13781            Self::AccessTokenScopeInsufficient => std::option::Option::Some(17),
13782            Self::AccountStateInvalid => std::option::Option::Some(18),
13783            Self::AccessTokenTypeUnsupported => std::option::Option::Some(19),
13784            Self::CredentialsMissing => std::option::Option::Some(20),
13785            Self::ResourceProjectInvalid => std::option::Option::Some(21),
13786            Self::SessionCookieInvalid => std::option::Option::Some(23),
13787            Self::UserBlockedByAdmin => std::option::Option::Some(24),
13788            Self::ResourceUsageRestrictionViolated => std::option::Option::Some(25),
13789            Self::SystemParameterUnsupported => std::option::Option::Some(26),
13790            Self::OrgRestrictionViolation => std::option::Option::Some(27),
13791            Self::OrgRestrictionHeaderInvalid => std::option::Option::Some(28),
13792            Self::ServiceNotVisible => std::option::Option::Some(29),
13793            Self::GcpSuspended => std::option::Option::Some(30),
13794            Self::LocationPolicyViolated => std::option::Option::Some(31),
13795            Self::MissingOrigin => std::option::Option::Some(33),
13796            Self::OverloadedCredentials => std::option::Option::Some(34),
13797            Self::LocationOrgPolicyViolated => std::option::Option::Some(35),
13798            Self::TlsOrgPolicyViolated => std::option::Option::Some(36),
13799            Self::EmulatorQuotaExceeded => std::option::Option::Some(38),
13800            Self::CredentialAndroidAppInvalid => std::option::Option::Some(39),
13801            Self::IamPermissionDenied => std::option::Option::Some(41),
13802            Self::JwtTokenInvalid => std::option::Option::Some(42),
13803            Self::CredentialTypeUnsupported => std::option::Option::Some(43),
13804            Self::AccountTypeUnsupported => std::option::Option::Some(44),
13805            Self::EndpointUsageRestrictionViolated => std::option::Option::Some(45),
13806            Self::TlsCipherRestrictionViolated => std::option::Option::Some(46),
13807            Self::McpServerDisabled => std::option::Option::Some(47),
13808            Self::UnknownValue(u) => u.0.value(),
13809        }
13810    }
13811
13812    /// Gets the enum value as a string.
13813    ///
13814    /// Returns `None` if the enum contains an unknown value deserialized from
13815    /// the integer representation of enums.
13816    pub fn name(&self) -> std::option::Option<&str> {
13817        match self {
13818            Self::Unspecified => std::option::Option::Some("ERROR_REASON_UNSPECIFIED"),
13819            Self::ServiceDisabled => std::option::Option::Some("SERVICE_DISABLED"),
13820            Self::BillingDisabled => std::option::Option::Some("BILLING_DISABLED"),
13821            Self::ApiKeyInvalid => std::option::Option::Some("API_KEY_INVALID"),
13822            Self::ApiKeyServiceBlocked => std::option::Option::Some("API_KEY_SERVICE_BLOCKED"),
13823            Self::ApiKeyHttpReferrerBlocked => {
13824                std::option::Option::Some("API_KEY_HTTP_REFERRER_BLOCKED")
13825            }
13826            Self::ApiKeyIpAddressBlocked => std::option::Option::Some("API_KEY_IP_ADDRESS_BLOCKED"),
13827            Self::ApiKeyAndroidAppBlocked => {
13828                std::option::Option::Some("API_KEY_ANDROID_APP_BLOCKED")
13829            }
13830            Self::ApiKeyIosAppBlocked => std::option::Option::Some("API_KEY_IOS_APP_BLOCKED"),
13831            Self::RateLimitExceeded => std::option::Option::Some("RATE_LIMIT_EXCEEDED"),
13832            Self::ResourceQuotaExceeded => std::option::Option::Some("RESOURCE_QUOTA_EXCEEDED"),
13833            Self::LocationTaxPolicyViolated => {
13834                std::option::Option::Some("LOCATION_TAX_POLICY_VIOLATED")
13835            }
13836            Self::UserProjectDenied => std::option::Option::Some("USER_PROJECT_DENIED"),
13837            Self::ConsumerSuspended => std::option::Option::Some("CONSUMER_SUSPENDED"),
13838            Self::ConsumerInvalid => std::option::Option::Some("CONSUMER_INVALID"),
13839            Self::SecurityPolicyViolated => std::option::Option::Some("SECURITY_POLICY_VIOLATED"),
13840            Self::AccessTokenExpired => std::option::Option::Some("ACCESS_TOKEN_EXPIRED"),
13841            Self::AccessTokenScopeInsufficient => {
13842                std::option::Option::Some("ACCESS_TOKEN_SCOPE_INSUFFICIENT")
13843            }
13844            Self::AccountStateInvalid => std::option::Option::Some("ACCOUNT_STATE_INVALID"),
13845            Self::AccessTokenTypeUnsupported => {
13846                std::option::Option::Some("ACCESS_TOKEN_TYPE_UNSUPPORTED")
13847            }
13848            Self::CredentialsMissing => std::option::Option::Some("CREDENTIALS_MISSING"),
13849            Self::ResourceProjectInvalid => std::option::Option::Some("RESOURCE_PROJECT_INVALID"),
13850            Self::SessionCookieInvalid => std::option::Option::Some("SESSION_COOKIE_INVALID"),
13851            Self::UserBlockedByAdmin => std::option::Option::Some("USER_BLOCKED_BY_ADMIN"),
13852            Self::ResourceUsageRestrictionViolated => {
13853                std::option::Option::Some("RESOURCE_USAGE_RESTRICTION_VIOLATED")
13854            }
13855            Self::SystemParameterUnsupported => {
13856                std::option::Option::Some("SYSTEM_PARAMETER_UNSUPPORTED")
13857            }
13858            Self::OrgRestrictionViolation => std::option::Option::Some("ORG_RESTRICTION_VIOLATION"),
13859            Self::OrgRestrictionHeaderInvalid => {
13860                std::option::Option::Some("ORG_RESTRICTION_HEADER_INVALID")
13861            }
13862            Self::ServiceNotVisible => std::option::Option::Some("SERVICE_NOT_VISIBLE"),
13863            Self::GcpSuspended => std::option::Option::Some("GCP_SUSPENDED"),
13864            Self::LocationPolicyViolated => std::option::Option::Some("LOCATION_POLICY_VIOLATED"),
13865            Self::MissingOrigin => std::option::Option::Some("MISSING_ORIGIN"),
13866            Self::OverloadedCredentials => std::option::Option::Some("OVERLOADED_CREDENTIALS"),
13867            Self::LocationOrgPolicyViolated => {
13868                std::option::Option::Some("LOCATION_ORG_POLICY_VIOLATED")
13869            }
13870            Self::TlsOrgPolicyViolated => std::option::Option::Some("TLS_ORG_POLICY_VIOLATED"),
13871            Self::EmulatorQuotaExceeded => std::option::Option::Some("EMULATOR_QUOTA_EXCEEDED"),
13872            Self::CredentialAndroidAppInvalid => {
13873                std::option::Option::Some("CREDENTIAL_ANDROID_APP_INVALID")
13874            }
13875            Self::IamPermissionDenied => std::option::Option::Some("IAM_PERMISSION_DENIED"),
13876            Self::JwtTokenInvalid => std::option::Option::Some("JWT_TOKEN_INVALID"),
13877            Self::CredentialTypeUnsupported => {
13878                std::option::Option::Some("CREDENTIAL_TYPE_UNSUPPORTED")
13879            }
13880            Self::AccountTypeUnsupported => std::option::Option::Some("ACCOUNT_TYPE_UNSUPPORTED"),
13881            Self::EndpointUsageRestrictionViolated => {
13882                std::option::Option::Some("ENDPOINT_USAGE_RESTRICTION_VIOLATED")
13883            }
13884            Self::TlsCipherRestrictionViolated => {
13885                std::option::Option::Some("TLS_CIPHER_RESTRICTION_VIOLATED")
13886            }
13887            Self::McpServerDisabled => std::option::Option::Some("MCP_SERVER_DISABLED"),
13888            Self::UnknownValue(u) => u.0.name(),
13889        }
13890    }
13891}
13892
13893impl std::default::Default for ErrorReason {
13894    fn default() -> Self {
13895        use std::convert::From;
13896        Self::from(0)
13897    }
13898}
13899
13900impl std::fmt::Display for ErrorReason {
13901    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
13902        wkt::internal::display_enum(f, self.name(), self.value())
13903    }
13904}
13905
13906impl std::convert::From<i32> for ErrorReason {
13907    fn from(value: i32) -> Self {
13908        match value {
13909            0 => Self::Unspecified,
13910            1 => Self::ServiceDisabled,
13911            2 => Self::BillingDisabled,
13912            3 => Self::ApiKeyInvalid,
13913            4 => Self::ApiKeyServiceBlocked,
13914            5 => Self::RateLimitExceeded,
13915            6 => Self::ResourceQuotaExceeded,
13916            7 => Self::ApiKeyHttpReferrerBlocked,
13917            8 => Self::ApiKeyIpAddressBlocked,
13918            9 => Self::ApiKeyAndroidAppBlocked,
13919            10 => Self::LocationTaxPolicyViolated,
13920            11 => Self::UserProjectDenied,
13921            12 => Self::ConsumerSuspended,
13922            13 => Self::ApiKeyIosAppBlocked,
13923            14 => Self::ConsumerInvalid,
13924            15 => Self::SecurityPolicyViolated,
13925            16 => Self::AccessTokenExpired,
13926            17 => Self::AccessTokenScopeInsufficient,
13927            18 => Self::AccountStateInvalid,
13928            19 => Self::AccessTokenTypeUnsupported,
13929            20 => Self::CredentialsMissing,
13930            21 => Self::ResourceProjectInvalid,
13931            23 => Self::SessionCookieInvalid,
13932            24 => Self::UserBlockedByAdmin,
13933            25 => Self::ResourceUsageRestrictionViolated,
13934            26 => Self::SystemParameterUnsupported,
13935            27 => Self::OrgRestrictionViolation,
13936            28 => Self::OrgRestrictionHeaderInvalid,
13937            29 => Self::ServiceNotVisible,
13938            30 => Self::GcpSuspended,
13939            31 => Self::LocationPolicyViolated,
13940            33 => Self::MissingOrigin,
13941            34 => Self::OverloadedCredentials,
13942            35 => Self::LocationOrgPolicyViolated,
13943            36 => Self::TlsOrgPolicyViolated,
13944            38 => Self::EmulatorQuotaExceeded,
13945            39 => Self::CredentialAndroidAppInvalid,
13946            41 => Self::IamPermissionDenied,
13947            42 => Self::JwtTokenInvalid,
13948            43 => Self::CredentialTypeUnsupported,
13949            44 => Self::AccountTypeUnsupported,
13950            45 => Self::EndpointUsageRestrictionViolated,
13951            46 => Self::TlsCipherRestrictionViolated,
13952            47 => Self::McpServerDisabled,
13953            _ => Self::UnknownValue(error_reason::UnknownValue(
13954                wkt::internal::UnknownEnumValue::Integer(value),
13955            )),
13956        }
13957    }
13958}
13959
13960impl std::convert::From<&str> for ErrorReason {
13961    fn from(value: &str) -> Self {
13962        use std::string::ToString;
13963        match value {
13964            "ERROR_REASON_UNSPECIFIED" => Self::Unspecified,
13965            "SERVICE_DISABLED" => Self::ServiceDisabled,
13966            "BILLING_DISABLED" => Self::BillingDisabled,
13967            "API_KEY_INVALID" => Self::ApiKeyInvalid,
13968            "API_KEY_SERVICE_BLOCKED" => Self::ApiKeyServiceBlocked,
13969            "API_KEY_HTTP_REFERRER_BLOCKED" => Self::ApiKeyHttpReferrerBlocked,
13970            "API_KEY_IP_ADDRESS_BLOCKED" => Self::ApiKeyIpAddressBlocked,
13971            "API_KEY_ANDROID_APP_BLOCKED" => Self::ApiKeyAndroidAppBlocked,
13972            "API_KEY_IOS_APP_BLOCKED" => Self::ApiKeyIosAppBlocked,
13973            "RATE_LIMIT_EXCEEDED" => Self::RateLimitExceeded,
13974            "RESOURCE_QUOTA_EXCEEDED" => Self::ResourceQuotaExceeded,
13975            "LOCATION_TAX_POLICY_VIOLATED" => Self::LocationTaxPolicyViolated,
13976            "USER_PROJECT_DENIED" => Self::UserProjectDenied,
13977            "CONSUMER_SUSPENDED" => Self::ConsumerSuspended,
13978            "CONSUMER_INVALID" => Self::ConsumerInvalid,
13979            "SECURITY_POLICY_VIOLATED" => Self::SecurityPolicyViolated,
13980            "ACCESS_TOKEN_EXPIRED" => Self::AccessTokenExpired,
13981            "ACCESS_TOKEN_SCOPE_INSUFFICIENT" => Self::AccessTokenScopeInsufficient,
13982            "ACCOUNT_STATE_INVALID" => Self::AccountStateInvalid,
13983            "ACCESS_TOKEN_TYPE_UNSUPPORTED" => Self::AccessTokenTypeUnsupported,
13984            "CREDENTIALS_MISSING" => Self::CredentialsMissing,
13985            "RESOURCE_PROJECT_INVALID" => Self::ResourceProjectInvalid,
13986            "SESSION_COOKIE_INVALID" => Self::SessionCookieInvalid,
13987            "USER_BLOCKED_BY_ADMIN" => Self::UserBlockedByAdmin,
13988            "RESOURCE_USAGE_RESTRICTION_VIOLATED" => Self::ResourceUsageRestrictionViolated,
13989            "SYSTEM_PARAMETER_UNSUPPORTED" => Self::SystemParameterUnsupported,
13990            "ORG_RESTRICTION_VIOLATION" => Self::OrgRestrictionViolation,
13991            "ORG_RESTRICTION_HEADER_INVALID" => Self::OrgRestrictionHeaderInvalid,
13992            "SERVICE_NOT_VISIBLE" => Self::ServiceNotVisible,
13993            "GCP_SUSPENDED" => Self::GcpSuspended,
13994            "LOCATION_POLICY_VIOLATED" => Self::LocationPolicyViolated,
13995            "MISSING_ORIGIN" => Self::MissingOrigin,
13996            "OVERLOADED_CREDENTIALS" => Self::OverloadedCredentials,
13997            "LOCATION_ORG_POLICY_VIOLATED" => Self::LocationOrgPolicyViolated,
13998            "TLS_ORG_POLICY_VIOLATED" => Self::TlsOrgPolicyViolated,
13999            "EMULATOR_QUOTA_EXCEEDED" => Self::EmulatorQuotaExceeded,
14000            "CREDENTIAL_ANDROID_APP_INVALID" => Self::CredentialAndroidAppInvalid,
14001            "IAM_PERMISSION_DENIED" => Self::IamPermissionDenied,
14002            "JWT_TOKEN_INVALID" => Self::JwtTokenInvalid,
14003            "CREDENTIAL_TYPE_UNSUPPORTED" => Self::CredentialTypeUnsupported,
14004            "ACCOUNT_TYPE_UNSUPPORTED" => Self::AccountTypeUnsupported,
14005            "ENDPOINT_USAGE_RESTRICTION_VIOLATED" => Self::EndpointUsageRestrictionViolated,
14006            "TLS_CIPHER_RESTRICTION_VIOLATED" => Self::TlsCipherRestrictionViolated,
14007            "MCP_SERVER_DISABLED" => Self::McpServerDisabled,
14008            _ => Self::UnknownValue(error_reason::UnknownValue(
14009                wkt::internal::UnknownEnumValue::String(value.to_string()),
14010            )),
14011        }
14012    }
14013}
14014
14015impl serde::ser::Serialize for ErrorReason {
14016    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14017    where
14018        S: serde::Serializer,
14019    {
14020        match self {
14021            Self::Unspecified => serializer.serialize_i32(0),
14022            Self::ServiceDisabled => serializer.serialize_i32(1),
14023            Self::BillingDisabled => serializer.serialize_i32(2),
14024            Self::ApiKeyInvalid => serializer.serialize_i32(3),
14025            Self::ApiKeyServiceBlocked => serializer.serialize_i32(4),
14026            Self::ApiKeyHttpReferrerBlocked => serializer.serialize_i32(7),
14027            Self::ApiKeyIpAddressBlocked => serializer.serialize_i32(8),
14028            Self::ApiKeyAndroidAppBlocked => serializer.serialize_i32(9),
14029            Self::ApiKeyIosAppBlocked => serializer.serialize_i32(13),
14030            Self::RateLimitExceeded => serializer.serialize_i32(5),
14031            Self::ResourceQuotaExceeded => serializer.serialize_i32(6),
14032            Self::LocationTaxPolicyViolated => serializer.serialize_i32(10),
14033            Self::UserProjectDenied => serializer.serialize_i32(11),
14034            Self::ConsumerSuspended => serializer.serialize_i32(12),
14035            Self::ConsumerInvalid => serializer.serialize_i32(14),
14036            Self::SecurityPolicyViolated => serializer.serialize_i32(15),
14037            Self::AccessTokenExpired => serializer.serialize_i32(16),
14038            Self::AccessTokenScopeInsufficient => serializer.serialize_i32(17),
14039            Self::AccountStateInvalid => serializer.serialize_i32(18),
14040            Self::AccessTokenTypeUnsupported => serializer.serialize_i32(19),
14041            Self::CredentialsMissing => serializer.serialize_i32(20),
14042            Self::ResourceProjectInvalid => serializer.serialize_i32(21),
14043            Self::SessionCookieInvalid => serializer.serialize_i32(23),
14044            Self::UserBlockedByAdmin => serializer.serialize_i32(24),
14045            Self::ResourceUsageRestrictionViolated => serializer.serialize_i32(25),
14046            Self::SystemParameterUnsupported => serializer.serialize_i32(26),
14047            Self::OrgRestrictionViolation => serializer.serialize_i32(27),
14048            Self::OrgRestrictionHeaderInvalid => serializer.serialize_i32(28),
14049            Self::ServiceNotVisible => serializer.serialize_i32(29),
14050            Self::GcpSuspended => serializer.serialize_i32(30),
14051            Self::LocationPolicyViolated => serializer.serialize_i32(31),
14052            Self::MissingOrigin => serializer.serialize_i32(33),
14053            Self::OverloadedCredentials => serializer.serialize_i32(34),
14054            Self::LocationOrgPolicyViolated => serializer.serialize_i32(35),
14055            Self::TlsOrgPolicyViolated => serializer.serialize_i32(36),
14056            Self::EmulatorQuotaExceeded => serializer.serialize_i32(38),
14057            Self::CredentialAndroidAppInvalid => serializer.serialize_i32(39),
14058            Self::IamPermissionDenied => serializer.serialize_i32(41),
14059            Self::JwtTokenInvalid => serializer.serialize_i32(42),
14060            Self::CredentialTypeUnsupported => serializer.serialize_i32(43),
14061            Self::AccountTypeUnsupported => serializer.serialize_i32(44),
14062            Self::EndpointUsageRestrictionViolated => serializer.serialize_i32(45),
14063            Self::TlsCipherRestrictionViolated => serializer.serialize_i32(46),
14064            Self::McpServerDisabled => serializer.serialize_i32(47),
14065            Self::UnknownValue(u) => u.0.serialize(serializer),
14066        }
14067    }
14068}
14069
14070impl<'de> serde::de::Deserialize<'de> for ErrorReason {
14071    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14072    where
14073        D: serde::Deserializer<'de>,
14074    {
14075        deserializer.deserialize_any(wkt::internal::EnumVisitor::<ErrorReason>::new(
14076            ".google.api.ErrorReason",
14077        ))
14078    }
14079}
14080
14081/// An indicator of the behavior of a given field (for example, that a field
14082/// is required in requests, or given as output but ignored as input).
14083/// This **does not** change the behavior in protocol buffers itself; it only
14084/// denotes the behavior and may affect how API tooling handles the field.
14085///
14086/// Note: This enum **may** receive new values in the future.
14087///
14088/// # Working with unknown values
14089///
14090/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14091/// additional enum variants at any time. Adding new variants is not considered
14092/// a breaking change. Applications should write their code in anticipation of:
14093///
14094/// - New values appearing in future releases of the client library, **and**
14095/// - New values received dynamically, without application changes.
14096///
14097/// Please consult the [Working with enums] section in the user guide for some
14098/// guidelines.
14099///
14100/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
14101#[derive(Clone, Debug, PartialEq)]
14102#[non_exhaustive]
14103pub enum FieldBehavior {
14104    /// Conventional default for enums. Do not use this.
14105    Unspecified,
14106    /// Specifically denotes a field as optional.
14107    /// While all fields in protocol buffers are optional, this may be specified
14108    /// for emphasis if appropriate.
14109    Optional,
14110    /// Denotes a field as required.
14111    /// This indicates that the field **must** be provided as part of the request,
14112    /// and failure to do so will cause an error (usually `INVALID_ARGUMENT`).
14113    Required,
14114    /// Denotes a field as output only.
14115    /// This indicates that the field is provided in responses, but including the
14116    /// field in a request does nothing (the server *must* ignore it and
14117    /// *must not* throw an error as a result of the field's presence).
14118    OutputOnly,
14119    /// Denotes a field as input only.
14120    /// This indicates that the field is provided in requests, and the
14121    /// corresponding field is not included in output.
14122    InputOnly,
14123    /// Denotes a field as immutable.
14124    /// This indicates that the field may be set once in a request to create a
14125    /// resource, but may not be changed thereafter.
14126    Immutable,
14127    /// Denotes that a (repeated) field is an unordered list.
14128    /// This indicates that the service may provide the elements of the list
14129    /// in any arbitrary  order, rather than the order the user originally
14130    /// provided. Additionally, the list's order may or may not be stable.
14131    UnorderedList,
14132    /// Denotes that this field returns a non-empty default value if not set.
14133    /// This indicates that if the user provides the empty value in a request,
14134    /// a non-empty value will be returned. The user will not be aware of what
14135    /// non-empty value to expect.
14136    NonEmptyDefault,
14137    /// Denotes that the field in a resource (a message annotated with
14138    /// google.api.resource) is used in the resource name to uniquely identify the
14139    /// resource. For AIP-compliant APIs, this should only be applied to the
14140    /// `name` field on the resource.
14141    ///
14142    /// This behavior should not be applied to references to other resources within
14143    /// the message.
14144    ///
14145    /// The identifier field of resources often have different field behavior
14146    /// depending on the request it is embedded in (e.g. for Create methods name
14147    /// is optional and unused, while for Update methods it is required). Instead
14148    /// of method-specific annotations, only `IDENTIFIER` is required.
14149    Identifier,
14150    /// If set, the enum was initialized with an unknown value.
14151    ///
14152    /// Applications can examine the value using [FieldBehavior::value] or
14153    /// [FieldBehavior::name].
14154    UnknownValue(field_behavior::UnknownValue),
14155}
14156
14157#[doc(hidden)]
14158pub mod field_behavior {
14159    #[allow(unused_imports)]
14160    use super::*;
14161    #[derive(Clone, Debug, PartialEq)]
14162    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14163}
14164
14165impl FieldBehavior {
14166    /// Gets the enum value.
14167    ///
14168    /// Returns `None` if the enum contains an unknown value deserialized from
14169    /// the string representation of enums.
14170    pub fn value(&self) -> std::option::Option<i32> {
14171        match self {
14172            Self::Unspecified => std::option::Option::Some(0),
14173            Self::Optional => std::option::Option::Some(1),
14174            Self::Required => std::option::Option::Some(2),
14175            Self::OutputOnly => std::option::Option::Some(3),
14176            Self::InputOnly => std::option::Option::Some(4),
14177            Self::Immutable => std::option::Option::Some(5),
14178            Self::UnorderedList => std::option::Option::Some(6),
14179            Self::NonEmptyDefault => std::option::Option::Some(7),
14180            Self::Identifier => std::option::Option::Some(8),
14181            Self::UnknownValue(u) => u.0.value(),
14182        }
14183    }
14184
14185    /// Gets the enum value as a string.
14186    ///
14187    /// Returns `None` if the enum contains an unknown value deserialized from
14188    /// the integer representation of enums.
14189    pub fn name(&self) -> std::option::Option<&str> {
14190        match self {
14191            Self::Unspecified => std::option::Option::Some("FIELD_BEHAVIOR_UNSPECIFIED"),
14192            Self::Optional => std::option::Option::Some("OPTIONAL"),
14193            Self::Required => std::option::Option::Some("REQUIRED"),
14194            Self::OutputOnly => std::option::Option::Some("OUTPUT_ONLY"),
14195            Self::InputOnly => std::option::Option::Some("INPUT_ONLY"),
14196            Self::Immutable => std::option::Option::Some("IMMUTABLE"),
14197            Self::UnorderedList => std::option::Option::Some("UNORDERED_LIST"),
14198            Self::NonEmptyDefault => std::option::Option::Some("NON_EMPTY_DEFAULT"),
14199            Self::Identifier => std::option::Option::Some("IDENTIFIER"),
14200            Self::UnknownValue(u) => u.0.name(),
14201        }
14202    }
14203}
14204
14205impl std::default::Default for FieldBehavior {
14206    fn default() -> Self {
14207        use std::convert::From;
14208        Self::from(0)
14209    }
14210}
14211
14212impl std::fmt::Display for FieldBehavior {
14213    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14214        wkt::internal::display_enum(f, self.name(), self.value())
14215    }
14216}
14217
14218impl std::convert::From<i32> for FieldBehavior {
14219    fn from(value: i32) -> Self {
14220        match value {
14221            0 => Self::Unspecified,
14222            1 => Self::Optional,
14223            2 => Self::Required,
14224            3 => Self::OutputOnly,
14225            4 => Self::InputOnly,
14226            5 => Self::Immutable,
14227            6 => Self::UnorderedList,
14228            7 => Self::NonEmptyDefault,
14229            8 => Self::Identifier,
14230            _ => Self::UnknownValue(field_behavior::UnknownValue(
14231                wkt::internal::UnknownEnumValue::Integer(value),
14232            )),
14233        }
14234    }
14235}
14236
14237impl std::convert::From<&str> for FieldBehavior {
14238    fn from(value: &str) -> Self {
14239        use std::string::ToString;
14240        match value {
14241            "FIELD_BEHAVIOR_UNSPECIFIED" => Self::Unspecified,
14242            "OPTIONAL" => Self::Optional,
14243            "REQUIRED" => Self::Required,
14244            "OUTPUT_ONLY" => Self::OutputOnly,
14245            "INPUT_ONLY" => Self::InputOnly,
14246            "IMMUTABLE" => Self::Immutable,
14247            "UNORDERED_LIST" => Self::UnorderedList,
14248            "NON_EMPTY_DEFAULT" => Self::NonEmptyDefault,
14249            "IDENTIFIER" => Self::Identifier,
14250            _ => Self::UnknownValue(field_behavior::UnknownValue(
14251                wkt::internal::UnknownEnumValue::String(value.to_string()),
14252            )),
14253        }
14254    }
14255}
14256
14257impl serde::ser::Serialize for FieldBehavior {
14258    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14259    where
14260        S: serde::Serializer,
14261    {
14262        match self {
14263            Self::Unspecified => serializer.serialize_i32(0),
14264            Self::Optional => serializer.serialize_i32(1),
14265            Self::Required => serializer.serialize_i32(2),
14266            Self::OutputOnly => serializer.serialize_i32(3),
14267            Self::InputOnly => serializer.serialize_i32(4),
14268            Self::Immutable => serializer.serialize_i32(5),
14269            Self::UnorderedList => serializer.serialize_i32(6),
14270            Self::NonEmptyDefault => serializer.serialize_i32(7),
14271            Self::Identifier => serializer.serialize_i32(8),
14272            Self::UnknownValue(u) => u.0.serialize(serializer),
14273        }
14274    }
14275}
14276
14277impl<'de> serde::de::Deserialize<'de> for FieldBehavior {
14278    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14279    where
14280        D: serde::Deserializer<'de>,
14281    {
14282        deserializer.deserialize_any(wkt::internal::EnumVisitor::<FieldBehavior>::new(
14283            ".google.api.FieldBehavior",
14284        ))
14285    }
14286}
14287
14288/// The launch stage as defined by [Google Cloud Platform
14289/// Launch Stages](https://cloud.google.com/terms/launch-stages).
14290///
14291/// # Working with unknown values
14292///
14293/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14294/// additional enum variants at any time. Adding new variants is not considered
14295/// a breaking change. Applications should write their code in anticipation of:
14296///
14297/// - New values appearing in future releases of the client library, **and**
14298/// - New values received dynamically, without application changes.
14299///
14300/// Please consult the [Working with enums] section in the user guide for some
14301/// guidelines.
14302///
14303/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
14304#[derive(Clone, Debug, PartialEq)]
14305#[non_exhaustive]
14306pub enum LaunchStage {
14307    /// Do not use this default value.
14308    Unspecified,
14309    /// The feature is not yet implemented. Users can not use it.
14310    Unimplemented,
14311    /// Prelaunch features are hidden from users and are only visible internally.
14312    Prelaunch,
14313    /// Early Access features are limited to a closed group of testers. To use
14314    /// these features, you must sign up in advance and sign a Trusted Tester
14315    /// agreement (which includes confidentiality provisions). These features may
14316    /// be unstable, changed in backward-incompatible ways, and are not
14317    /// guaranteed to be released.
14318    EarlyAccess,
14319    /// Alpha is a limited availability test for releases before they are cleared
14320    /// for widespread use. By Alpha, all significant design issues are resolved
14321    /// and we are in the process of verifying functionality. Alpha customers
14322    /// need to apply for access, agree to applicable terms, and have their
14323    /// projects allowlisted. Alpha releases don't have to be feature complete,
14324    /// no SLAs are provided, and there are no technical support obligations, but
14325    /// they will be far enough along that customers can actually use them in
14326    /// test environments or for limited-use tests -- just like they would in
14327    /// normal production cases.
14328    Alpha,
14329    /// Beta is the point at which we are ready to open a release for any
14330    /// customer to use. There are no SLA or technical support obligations in a
14331    /// Beta release. Products will be complete from a feature perspective, but
14332    /// may have some open outstanding issues. Beta releases are suitable for
14333    /// limited production use cases.
14334    Beta,
14335    /// GA features are open to all developers and are considered stable and
14336    /// fully qualified for production use.
14337    Ga,
14338    /// Deprecated features are scheduled to be shut down and removed. For more
14339    /// information, see the "Deprecation Policy" section of our [Terms of
14340    /// Service](https://cloud.google.com/terms/)
14341    /// and the [Google Cloud Platform Subject to the Deprecation
14342    /// Policy](https://cloud.google.com/terms/deprecation) documentation.
14343    Deprecated,
14344    /// If set, the enum was initialized with an unknown value.
14345    ///
14346    /// Applications can examine the value using [LaunchStage::value] or
14347    /// [LaunchStage::name].
14348    UnknownValue(launch_stage::UnknownValue),
14349}
14350
14351#[doc(hidden)]
14352pub mod launch_stage {
14353    #[allow(unused_imports)]
14354    use super::*;
14355    #[derive(Clone, Debug, PartialEq)]
14356    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14357}
14358
14359impl LaunchStage {
14360    /// Gets the enum value.
14361    ///
14362    /// Returns `None` if the enum contains an unknown value deserialized from
14363    /// the string representation of enums.
14364    pub fn value(&self) -> std::option::Option<i32> {
14365        match self {
14366            Self::Unspecified => std::option::Option::Some(0),
14367            Self::Unimplemented => std::option::Option::Some(6),
14368            Self::Prelaunch => std::option::Option::Some(7),
14369            Self::EarlyAccess => std::option::Option::Some(1),
14370            Self::Alpha => std::option::Option::Some(2),
14371            Self::Beta => std::option::Option::Some(3),
14372            Self::Ga => std::option::Option::Some(4),
14373            Self::Deprecated => std::option::Option::Some(5),
14374            Self::UnknownValue(u) => u.0.value(),
14375        }
14376    }
14377
14378    /// Gets the enum value as a string.
14379    ///
14380    /// Returns `None` if the enum contains an unknown value deserialized from
14381    /// the integer representation of enums.
14382    pub fn name(&self) -> std::option::Option<&str> {
14383        match self {
14384            Self::Unspecified => std::option::Option::Some("LAUNCH_STAGE_UNSPECIFIED"),
14385            Self::Unimplemented => std::option::Option::Some("UNIMPLEMENTED"),
14386            Self::Prelaunch => std::option::Option::Some("PRELAUNCH"),
14387            Self::EarlyAccess => std::option::Option::Some("EARLY_ACCESS"),
14388            Self::Alpha => std::option::Option::Some("ALPHA"),
14389            Self::Beta => std::option::Option::Some("BETA"),
14390            Self::Ga => std::option::Option::Some("GA"),
14391            Self::Deprecated => std::option::Option::Some("DEPRECATED"),
14392            Self::UnknownValue(u) => u.0.name(),
14393        }
14394    }
14395}
14396
14397impl std::default::Default for LaunchStage {
14398    fn default() -> Self {
14399        use std::convert::From;
14400        Self::from(0)
14401    }
14402}
14403
14404impl std::fmt::Display for LaunchStage {
14405    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14406        wkt::internal::display_enum(f, self.name(), self.value())
14407    }
14408}
14409
14410impl std::convert::From<i32> for LaunchStage {
14411    fn from(value: i32) -> Self {
14412        match value {
14413            0 => Self::Unspecified,
14414            1 => Self::EarlyAccess,
14415            2 => Self::Alpha,
14416            3 => Self::Beta,
14417            4 => Self::Ga,
14418            5 => Self::Deprecated,
14419            6 => Self::Unimplemented,
14420            7 => Self::Prelaunch,
14421            _ => Self::UnknownValue(launch_stage::UnknownValue(
14422                wkt::internal::UnknownEnumValue::Integer(value),
14423            )),
14424        }
14425    }
14426}
14427
14428impl std::convert::From<&str> for LaunchStage {
14429    fn from(value: &str) -> Self {
14430        use std::string::ToString;
14431        match value {
14432            "LAUNCH_STAGE_UNSPECIFIED" => Self::Unspecified,
14433            "UNIMPLEMENTED" => Self::Unimplemented,
14434            "PRELAUNCH" => Self::Prelaunch,
14435            "EARLY_ACCESS" => Self::EarlyAccess,
14436            "ALPHA" => Self::Alpha,
14437            "BETA" => Self::Beta,
14438            "GA" => Self::Ga,
14439            "DEPRECATED" => Self::Deprecated,
14440            _ => Self::UnknownValue(launch_stage::UnknownValue(
14441                wkt::internal::UnknownEnumValue::String(value.to_string()),
14442            )),
14443        }
14444    }
14445}
14446
14447impl serde::ser::Serialize for LaunchStage {
14448    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14449    where
14450        S: serde::Serializer,
14451    {
14452        match self {
14453            Self::Unspecified => serializer.serialize_i32(0),
14454            Self::Unimplemented => serializer.serialize_i32(6),
14455            Self::Prelaunch => serializer.serialize_i32(7),
14456            Self::EarlyAccess => serializer.serialize_i32(1),
14457            Self::Alpha => serializer.serialize_i32(2),
14458            Self::Beta => serializer.serialize_i32(3),
14459            Self::Ga => serializer.serialize_i32(4),
14460            Self::Deprecated => serializer.serialize_i32(5),
14461            Self::UnknownValue(u) => u.0.serialize(serializer),
14462        }
14463    }
14464}
14465
14466impl<'de> serde::de::Deserialize<'de> for LaunchStage {
14467    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14468    where
14469        D: serde::Deserializer<'de>,
14470    {
14471        deserializer.deserialize_any(wkt::internal::EnumVisitor::<LaunchStage>::new(
14472            ".google.api.LaunchStage",
14473        ))
14474    }
14475}