Skip to main content

google_cloud_api/
model.rs

1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate bytes;
21extern crate serde;
22extern crate serde_json;
23extern crate serde_with;
24extern crate std;
25extern crate wkt;
26
27mod debug;
28mod deserialize;
29mod serialize;
30
31/// `Authentication` defines the authentication configuration for API methods
32/// provided by an API service.
33///
34/// Example:
35///
36/// ```norust
37/// name: calendar.googleapis.com
38/// authentication:
39///   providers:
40///   - id: google_calendar_auth
41///     jwks_uri: https://www.googleapis.com/oauth2/v1/certs
42///     issuer: https://securetoken.google.com
43///   rules:
44///   - selector: "*"
45///     requirements:
46///       provider_id: google_calendar_auth
47///   - selector: google.calendar.Delegate
48///     oauth:
49///       canonical_scopes: https://www.googleapis.com/auth/calendar.read
50/// ```
51#[derive(Clone, Default, PartialEq)]
52#[non_exhaustive]
53pub struct Authentication {
54    /// A list of authentication rules that apply to individual API methods.
55    ///
56    /// **NOTE:** All service configuration rules follow "last one wins" order.
57    pub rules: std::vec::Vec<crate::model::AuthenticationRule>,
58
59    /// Defines a set of authentication providers that a service supports.
60    pub providers: std::vec::Vec<crate::model::AuthProvider>,
61
62    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
63}
64
65impl Authentication {
66    pub fn new() -> Self {
67        std::default::Default::default()
68    }
69
70    /// Sets the value of [rules][crate::model::Authentication::rules].
71    ///
72    /// # Example
73    /// ```ignore,no_run
74    /// # use google_cloud_api::model::Authentication;
75    /// use google_cloud_api::model::AuthenticationRule;
76    /// let x = Authentication::new()
77    ///     .set_rules([
78    ///         AuthenticationRule::default()/* use setters */,
79    ///         AuthenticationRule::default()/* use (different) setters */,
80    ///     ]);
81    /// ```
82    pub fn set_rules<T, V>(mut self, v: T) -> Self
83    where
84        T: std::iter::IntoIterator<Item = V>,
85        V: std::convert::Into<crate::model::AuthenticationRule>,
86    {
87        use std::iter::Iterator;
88        self.rules = v.into_iter().map(|i| i.into()).collect();
89        self
90    }
91
92    /// Sets the value of [providers][crate::model::Authentication::providers].
93    ///
94    /// # Example
95    /// ```ignore,no_run
96    /// # use google_cloud_api::model::Authentication;
97    /// use google_cloud_api::model::AuthProvider;
98    /// let x = Authentication::new()
99    ///     .set_providers([
100    ///         AuthProvider::default()/* use setters */,
101    ///         AuthProvider::default()/* use (different) setters */,
102    ///     ]);
103    /// ```
104    pub fn set_providers<T, V>(mut self, v: T) -> Self
105    where
106        T: std::iter::IntoIterator<Item = V>,
107        V: std::convert::Into<crate::model::AuthProvider>,
108    {
109        use std::iter::Iterator;
110        self.providers = v.into_iter().map(|i| i.into()).collect();
111        self
112    }
113}
114
115impl wkt::message::Message for Authentication {
116    fn typename() -> &'static str {
117        "type.googleapis.com/google.api.Authentication"
118    }
119}
120
121/// Authentication rules for the service.
122///
123/// By default, if a method has any authentication requirements, every request
124/// must include a valid credential matching one of the requirements.
125/// It's an error to include more than one kind of credential in a single
126/// request.
127///
128/// If a method doesn't have any auth requirements, request credentials will be
129/// ignored.
130#[derive(Clone, Default, PartialEq)]
131#[non_exhaustive]
132pub struct AuthenticationRule {
133    /// Selects the methods to which this rule applies.
134    ///
135    /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
136    /// details.
137    ///
138    /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
139    pub selector: std::string::String,
140
141    /// The requirements for OAuth credentials.
142    pub oauth: std::option::Option<crate::model::OAuthRequirements>,
143
144    /// If true, the service accepts API keys without any other credential.
145    /// This flag only applies to HTTP and gRPC requests.
146    pub allow_without_credential: bool,
147
148    /// Requirements for additional authentication providers.
149    pub requirements: std::vec::Vec<crate::model::AuthRequirement>,
150
151    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
152}
153
154impl AuthenticationRule {
155    pub fn new() -> Self {
156        std::default::Default::default()
157    }
158
159    /// Sets the value of [selector][crate::model::AuthenticationRule::selector].
160    ///
161    /// # Example
162    /// ```ignore,no_run
163    /// # use google_cloud_api::model::AuthenticationRule;
164    /// let x = AuthenticationRule::new().set_selector("example");
165    /// ```
166    pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
167        self.selector = v.into();
168        self
169    }
170
171    /// Sets the value of [oauth][crate::model::AuthenticationRule::oauth].
172    ///
173    /// # Example
174    /// ```ignore,no_run
175    /// # use google_cloud_api::model::AuthenticationRule;
176    /// use google_cloud_api::model::OAuthRequirements;
177    /// let x = AuthenticationRule::new().set_oauth(OAuthRequirements::default()/* use setters */);
178    /// ```
179    pub fn set_oauth<T>(mut self, v: T) -> Self
180    where
181        T: std::convert::Into<crate::model::OAuthRequirements>,
182    {
183        self.oauth = std::option::Option::Some(v.into());
184        self
185    }
186
187    /// Sets or clears the value of [oauth][crate::model::AuthenticationRule::oauth].
188    ///
189    /// # Example
190    /// ```ignore,no_run
191    /// # use google_cloud_api::model::AuthenticationRule;
192    /// use google_cloud_api::model::OAuthRequirements;
193    /// let x = AuthenticationRule::new().set_or_clear_oauth(Some(OAuthRequirements::default()/* use setters */));
194    /// let x = AuthenticationRule::new().set_or_clear_oauth(None::<OAuthRequirements>);
195    /// ```
196    pub fn set_or_clear_oauth<T>(mut self, v: std::option::Option<T>) -> Self
197    where
198        T: std::convert::Into<crate::model::OAuthRequirements>,
199    {
200        self.oauth = v.map(|x| x.into());
201        self
202    }
203
204    /// Sets the value of [allow_without_credential][crate::model::AuthenticationRule::allow_without_credential].
205    ///
206    /// # Example
207    /// ```ignore,no_run
208    /// # use google_cloud_api::model::AuthenticationRule;
209    /// let x = AuthenticationRule::new().set_allow_without_credential(true);
210    /// ```
211    pub fn set_allow_without_credential<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
212        self.allow_without_credential = v.into();
213        self
214    }
215
216    /// Sets the value of [requirements][crate::model::AuthenticationRule::requirements].
217    ///
218    /// # Example
219    /// ```ignore,no_run
220    /// # use google_cloud_api::model::AuthenticationRule;
221    /// use google_cloud_api::model::AuthRequirement;
222    /// let x = AuthenticationRule::new()
223    ///     .set_requirements([
224    ///         AuthRequirement::default()/* use setters */,
225    ///         AuthRequirement::default()/* use (different) setters */,
226    ///     ]);
227    /// ```
228    pub fn set_requirements<T, V>(mut self, v: T) -> Self
229    where
230        T: std::iter::IntoIterator<Item = V>,
231        V: std::convert::Into<crate::model::AuthRequirement>,
232    {
233        use std::iter::Iterator;
234        self.requirements = v.into_iter().map(|i| i.into()).collect();
235        self
236    }
237}
238
239impl wkt::message::Message for AuthenticationRule {
240    fn typename() -> &'static str {
241        "type.googleapis.com/google.api.AuthenticationRule"
242    }
243}
244
245/// Specifies a location to extract JWT from an API request.
246#[derive(Clone, Default, PartialEq)]
247#[non_exhaustive]
248pub struct JwtLocation {
249    /// The value prefix. The value format is "value_prefix{token}"
250    /// Only applies to "in" header type. Must be empty for "in" query type.
251    /// If not empty, the header value has to match (case sensitive) this prefix.
252    /// If not matched, JWT will not be extracted. If matched, JWT will be
253    /// extracted after the prefix is removed.
254    ///
255    /// For example, for "Authorization: Bearer {JWT}",
256    /// value_prefix="Bearer " with a space at the end.
257    pub value_prefix: std::string::String,
258
259    pub r#in: std::option::Option<crate::model::jwt_location::In>,
260
261    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
262}
263
264impl JwtLocation {
265    pub fn new() -> Self {
266        std::default::Default::default()
267    }
268
269    /// Sets the value of [value_prefix][crate::model::JwtLocation::value_prefix].
270    ///
271    /// # Example
272    /// ```ignore,no_run
273    /// # use google_cloud_api::model::JwtLocation;
274    /// let x = JwtLocation::new().set_value_prefix("example");
275    /// ```
276    pub fn set_value_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
277        self.value_prefix = v.into();
278        self
279    }
280
281    /// Sets the value of [r#in][crate::model::JwtLocation::in].
282    ///
283    /// Note that all the setters affecting `r#in` are mutually
284    /// exclusive.
285    ///
286    /// # Example
287    /// ```ignore,no_run
288    /// # use google_cloud_api::model::JwtLocation;
289    /// use google_cloud_api::model::jwt_location::In;
290    /// let x = JwtLocation::new().set_in(Some(In::Header("example".to_string())));
291    /// ```
292    pub fn set_in<T: std::convert::Into<std::option::Option<crate::model::jwt_location::In>>>(
293        mut self,
294        v: T,
295    ) -> Self {
296        self.r#in = v.into();
297        self
298    }
299
300    /// The value of [r#in][crate::model::JwtLocation::r#in]
301    /// if it holds a `Header`, `None` if the field is not set or
302    /// holds a different branch.
303    pub fn header(&self) -> std::option::Option<&std::string::String> {
304        #[allow(unreachable_patterns)]
305        self.r#in.as_ref().and_then(|v| match v {
306            crate::model::jwt_location::In::Header(v) => std::option::Option::Some(v),
307            _ => std::option::Option::None,
308        })
309    }
310
311    /// Sets the value of [r#in][crate::model::JwtLocation::r#in]
312    /// to hold a `Header`.
313    ///
314    /// Note that all the setters affecting `r#in` are
315    /// mutually exclusive.
316    ///
317    /// # Example
318    /// ```ignore,no_run
319    /// # use google_cloud_api::model::JwtLocation;
320    /// let x = JwtLocation::new().set_header("example");
321    /// assert!(x.header().is_some());
322    /// assert!(x.query().is_none());
323    /// assert!(x.cookie().is_none());
324    /// ```
325    pub fn set_header<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
326        self.r#in = std::option::Option::Some(crate::model::jwt_location::In::Header(v.into()));
327        self
328    }
329
330    /// The value of [r#in][crate::model::JwtLocation::r#in]
331    /// if it holds a `Query`, `None` if the field is not set or
332    /// holds a different branch.
333    pub fn query(&self) -> std::option::Option<&std::string::String> {
334        #[allow(unreachable_patterns)]
335        self.r#in.as_ref().and_then(|v| match v {
336            crate::model::jwt_location::In::Query(v) => std::option::Option::Some(v),
337            _ => std::option::Option::None,
338        })
339    }
340
341    /// Sets the value of [r#in][crate::model::JwtLocation::r#in]
342    /// to hold a `Query`.
343    ///
344    /// Note that all the setters affecting `r#in` are
345    /// mutually exclusive.
346    ///
347    /// # Example
348    /// ```ignore,no_run
349    /// # use google_cloud_api::model::JwtLocation;
350    /// let x = JwtLocation::new().set_query("example");
351    /// assert!(x.query().is_some());
352    /// assert!(x.header().is_none());
353    /// assert!(x.cookie().is_none());
354    /// ```
355    pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
356        self.r#in = std::option::Option::Some(crate::model::jwt_location::In::Query(v.into()));
357        self
358    }
359
360    /// The value of [r#in][crate::model::JwtLocation::r#in]
361    /// if it holds a `Cookie`, `None` if the field is not set or
362    /// holds a different branch.
363    pub fn cookie(&self) -> std::option::Option<&std::string::String> {
364        #[allow(unreachable_patterns)]
365        self.r#in.as_ref().and_then(|v| match v {
366            crate::model::jwt_location::In::Cookie(v) => std::option::Option::Some(v),
367            _ => std::option::Option::None,
368        })
369    }
370
371    /// Sets the value of [r#in][crate::model::JwtLocation::r#in]
372    /// to hold a `Cookie`.
373    ///
374    /// Note that all the setters affecting `r#in` are
375    /// mutually exclusive.
376    ///
377    /// # Example
378    /// ```ignore,no_run
379    /// # use google_cloud_api::model::JwtLocation;
380    /// let x = JwtLocation::new().set_cookie("example");
381    /// assert!(x.cookie().is_some());
382    /// assert!(x.header().is_none());
383    /// assert!(x.query().is_none());
384    /// ```
385    pub fn set_cookie<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
386        self.r#in = std::option::Option::Some(crate::model::jwt_location::In::Cookie(v.into()));
387        self
388    }
389}
390
391impl wkt::message::Message for JwtLocation {
392    fn typename() -> &'static str {
393        "type.googleapis.com/google.api.JwtLocation"
394    }
395}
396
397/// Defines additional types related to [JwtLocation].
398pub mod jwt_location {
399    #[allow(unused_imports)]
400    use super::*;
401
402    #[derive(Clone, Debug, PartialEq)]
403    #[non_exhaustive]
404    pub enum In {
405        /// Specifies HTTP header name to extract JWT token.
406        Header(std::string::String),
407        /// Specifies URL query parameter name to extract JWT token.
408        Query(std::string::String),
409        /// Specifies cookie name to extract JWT token.
410        Cookie(std::string::String),
411    }
412}
413
414/// Configuration for an authentication provider, including support for
415/// [JSON Web Token
416/// (JWT)](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32).
417#[derive(Clone, Default, PartialEq)]
418#[non_exhaustive]
419pub struct AuthProvider {
420    /// The unique identifier of the auth provider. It will be referred to by
421    /// `AuthRequirement.provider_id`.
422    ///
423    /// Example: "bookstore_auth".
424    pub id: std::string::String,
425
426    /// Identifies the principal that issued the JWT. See
427    /// <https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.1>
428    /// Usually a URL or an email address.
429    ///
430    /// Example: <https://securetoken.google.com>
431    /// Example: 1234567-compute@developer.gserviceaccount.com
432    pub issuer: std::string::String,
433
434    /// URL of the provider's public key set to validate signature of the JWT. See
435    /// [OpenID
436    /// Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata).
437    /// Optional if the key set document:
438    ///
439    /// - can be retrieved from
440    ///   [OpenID
441    ///   Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html)
442    ///   of the issuer.
443    /// - can be inferred from the email domain of the issuer (e.g. a Google
444    ///   service account).
445    ///
446    /// Example: <https://www.googleapis.com/oauth2/v1/certs>
447    pub jwks_uri: std::string::String,
448
449    /// The list of JWT
450    /// [audiences](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.3).
451    /// that are allowed to access. A JWT containing any of these audiences will
452    /// be accepted. When this setting is absent, JWTs with audiences:
453    ///
454    /// - "https://[service.name]/[google.protobuf.Api.name]"
455    /// - "https://[service.name]/"
456    ///   will be accepted.
457    ///   For example, if no audiences are in the setting, LibraryService API will
458    ///   accept JWTs with the following audiences:
459    /// - <https://library-example.googleapis.com/google.example.library.v1.LibraryService>
460    /// - <https://library-example.googleapis.com/>
461    ///
462    /// Example:
463    ///
464    /// ```norust
465    /// audiences: bookstore_android.apps.googleusercontent.com,
466    ///            bookstore_web.apps.googleusercontent.com
467    /// ```
468    pub audiences: std::string::String,
469
470    /// Redirect URL if JWT token is required but not present or is expired.
471    /// Implement authorizationUrl of securityDefinitions in OpenAPI spec.
472    pub authorization_url: std::string::String,
473
474    /// Defines the locations to extract the JWT.  For now it is only used by the
475    /// Cloud Endpoints to store the OpenAPI extension [x-google-jwt-locations]
476    /// (<https://cloud.google.com/endpoints/docs/openapi/openapi-extensions#x-google-jwt-locations>)
477    ///
478    /// JWT locations can be one of HTTP headers, URL query parameters or
479    /// cookies. The rule is that the first match wins.
480    ///
481    /// If not specified,  default to use following 3 locations:
482    ///
483    /// 1. Authorization: Bearer
484    /// 1. x-goog-iap-jwt-assertion
485    /// 1. access_token query parameter
486    ///
487    /// Default locations can be specified as followings:
488    /// jwt_locations:
489    ///
490    /// - header: Authorization
491    ///   value_prefix: "Bearer "
492    /// - header: x-goog-iap-jwt-assertion
493    /// - query: access_token
494    pub jwt_locations: std::vec::Vec<crate::model::JwtLocation>,
495
496    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
497}
498
499impl AuthProvider {
500    pub fn new() -> Self {
501        std::default::Default::default()
502    }
503
504    /// Sets the value of [id][crate::model::AuthProvider::id].
505    ///
506    /// # Example
507    /// ```ignore,no_run
508    /// # use google_cloud_api::model::AuthProvider;
509    /// let x = AuthProvider::new().set_id("example");
510    /// ```
511    pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
512        self.id = v.into();
513        self
514    }
515
516    /// Sets the value of [issuer][crate::model::AuthProvider::issuer].
517    ///
518    /// # Example
519    /// ```ignore,no_run
520    /// # use google_cloud_api::model::AuthProvider;
521    /// let x = AuthProvider::new().set_issuer("example");
522    /// ```
523    pub fn set_issuer<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
524        self.issuer = v.into();
525        self
526    }
527
528    /// Sets the value of [jwks_uri][crate::model::AuthProvider::jwks_uri].
529    ///
530    /// # Example
531    /// ```ignore,no_run
532    /// # use google_cloud_api::model::AuthProvider;
533    /// let x = AuthProvider::new().set_jwks_uri("example");
534    /// ```
535    pub fn set_jwks_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
536        self.jwks_uri = v.into();
537        self
538    }
539
540    /// Sets the value of [audiences][crate::model::AuthProvider::audiences].
541    ///
542    /// # Example
543    /// ```ignore,no_run
544    /// # use google_cloud_api::model::AuthProvider;
545    /// let x = AuthProvider::new().set_audiences("example");
546    /// ```
547    pub fn set_audiences<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
548        self.audiences = v.into();
549        self
550    }
551
552    /// Sets the value of [authorization_url][crate::model::AuthProvider::authorization_url].
553    ///
554    /// # Example
555    /// ```ignore,no_run
556    /// # use google_cloud_api::model::AuthProvider;
557    /// let x = AuthProvider::new().set_authorization_url("example");
558    /// ```
559    pub fn set_authorization_url<T: std::convert::Into<std::string::String>>(
560        mut self,
561        v: T,
562    ) -> Self {
563        self.authorization_url = v.into();
564        self
565    }
566
567    /// Sets the value of [jwt_locations][crate::model::AuthProvider::jwt_locations].
568    ///
569    /// # Example
570    /// ```ignore,no_run
571    /// # use google_cloud_api::model::AuthProvider;
572    /// use google_cloud_api::model::JwtLocation;
573    /// let x = AuthProvider::new()
574    ///     .set_jwt_locations([
575    ///         JwtLocation::default()/* use setters */,
576    ///         JwtLocation::default()/* use (different) setters */,
577    ///     ]);
578    /// ```
579    pub fn set_jwt_locations<T, V>(mut self, v: T) -> Self
580    where
581        T: std::iter::IntoIterator<Item = V>,
582        V: std::convert::Into<crate::model::JwtLocation>,
583    {
584        use std::iter::Iterator;
585        self.jwt_locations = v.into_iter().map(|i| i.into()).collect();
586        self
587    }
588}
589
590impl wkt::message::Message for AuthProvider {
591    fn typename() -> &'static str {
592        "type.googleapis.com/google.api.AuthProvider"
593    }
594}
595
596/// OAuth scopes are a way to define data and permissions on data. For example,
597/// there are scopes defined for "Read-only access to Google Calendar" and
598/// "Access to Cloud Platform". Users can consent to a scope for an application,
599/// giving it permission to access that data on their behalf.
600///
601/// OAuth scope specifications should be fairly coarse grained; a user will need
602/// to see and understand the text description of what your scope means.
603///
604/// In most cases: use one or at most two OAuth scopes for an entire family of
605/// products. If your product has multiple APIs, you should probably be sharing
606/// the OAuth scope across all of those APIs.
607///
608/// When you need finer grained OAuth consent screens: talk with your product
609/// management about how developers will use them in practice.
610///
611/// Please note that even though each of the canonical scopes is enough for a
612/// request to be accepted and passed to the backend, a request can still fail
613/// due to the backend requiring additional scopes or permissions.
614#[derive(Clone, Default, PartialEq)]
615#[non_exhaustive]
616pub struct OAuthRequirements {
617    /// The list of publicly documented OAuth scopes that are allowed access. An
618    /// OAuth token containing any of these scopes will be accepted.
619    ///
620    /// Example:
621    ///
622    /// ```norust
623    ///  canonical_scopes: https://www.googleapis.com/auth/calendar,
624    ///                    https://www.googleapis.com/auth/calendar.read
625    /// ```
626    pub canonical_scopes: std::string::String,
627
628    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
629}
630
631impl OAuthRequirements {
632    pub fn new() -> Self {
633        std::default::Default::default()
634    }
635
636    /// Sets the value of [canonical_scopes][crate::model::OAuthRequirements::canonical_scopes].
637    ///
638    /// # Example
639    /// ```ignore,no_run
640    /// # use google_cloud_api::model::OAuthRequirements;
641    /// let x = OAuthRequirements::new().set_canonical_scopes("example");
642    /// ```
643    pub fn set_canonical_scopes<T: std::convert::Into<std::string::String>>(
644        mut self,
645        v: T,
646    ) -> Self {
647        self.canonical_scopes = v.into();
648        self
649    }
650}
651
652impl wkt::message::Message for OAuthRequirements {
653    fn typename() -> &'static str {
654        "type.googleapis.com/google.api.OAuthRequirements"
655    }
656}
657
658/// User-defined authentication requirements, including support for
659/// [JSON Web Token
660/// (JWT)](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32).
661#[derive(Clone, Default, PartialEq)]
662#[non_exhaustive]
663pub struct AuthRequirement {
664    /// [id][google.api.AuthProvider.id] from authentication provider.
665    ///
666    /// Example:
667    ///
668    /// ```norust
669    /// provider_id: bookstore_auth
670    /// ```
671    ///
672    /// [google.api.AuthProvider.id]: crate::model::AuthProvider::id
673    pub provider_id: std::string::String,
674
675    /// NOTE: This will be deprecated soon, once AuthProvider.audiences is
676    /// implemented and accepted in all the runtime components.
677    ///
678    /// The list of JWT
679    /// [audiences](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.3).
680    /// that are allowed to access. A JWT containing any of these audiences will
681    /// be accepted. When this setting is absent, only JWTs with audience
682    /// "https://[Service_name][google.api.Service.name]/[API_name][google.protobuf.Api.name]"
683    /// will be accepted. For example, if no audiences are in the setting,
684    /// LibraryService API will only accept JWTs with the following audience
685    /// `https://library-example.googleapis.com/google.example.library.v1.LibraryService`.
686    ///
687    /// Example:
688    ///
689    /// ```norust
690    /// audiences: bookstore_android.apps.googleusercontent.com,
691    ///            bookstore_web.apps.googleusercontent.com
692    /// ```
693    ///
694    /// [google.api.Service.name]: crate::model::Service::name
695    /// [google.protobuf.Api.name]: wkt::Api::name
696    pub audiences: std::string::String,
697
698    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
699}
700
701impl AuthRequirement {
702    pub fn new() -> Self {
703        std::default::Default::default()
704    }
705
706    /// Sets the value of [provider_id][crate::model::AuthRequirement::provider_id].
707    ///
708    /// # Example
709    /// ```ignore,no_run
710    /// # use google_cloud_api::model::AuthRequirement;
711    /// let x = AuthRequirement::new().set_provider_id("example");
712    /// ```
713    pub fn set_provider_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
714        self.provider_id = v.into();
715        self
716    }
717
718    /// Sets the value of [audiences][crate::model::AuthRequirement::audiences].
719    ///
720    /// # Example
721    /// ```ignore,no_run
722    /// # use google_cloud_api::model::AuthRequirement;
723    /// let x = AuthRequirement::new().set_audiences("example");
724    /// ```
725    pub fn set_audiences<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
726        self.audiences = v.into();
727        self
728    }
729}
730
731impl wkt::message::Message for AuthRequirement {
732    fn typename() -> &'static str {
733        "type.googleapis.com/google.api.AuthRequirement"
734    }
735}
736
737/// `Backend` defines the backend configuration for a service.
738#[derive(Clone, Default, PartialEq)]
739#[non_exhaustive]
740pub struct Backend {
741    /// A list of API backend rules that apply to individual API methods.
742    ///
743    /// **NOTE:** All service configuration rules follow "last one wins" order.
744    pub rules: std::vec::Vec<crate::model::BackendRule>,
745
746    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
747}
748
749impl Backend {
750    pub fn new() -> Self {
751        std::default::Default::default()
752    }
753
754    /// Sets the value of [rules][crate::model::Backend::rules].
755    ///
756    /// # Example
757    /// ```ignore,no_run
758    /// # use google_cloud_api::model::Backend;
759    /// use google_cloud_api::model::BackendRule;
760    /// let x = Backend::new()
761    ///     .set_rules([
762    ///         BackendRule::default()/* use setters */,
763    ///         BackendRule::default()/* use (different) setters */,
764    ///     ]);
765    /// ```
766    pub fn set_rules<T, V>(mut self, v: T) -> Self
767    where
768        T: std::iter::IntoIterator<Item = V>,
769        V: std::convert::Into<crate::model::BackendRule>,
770    {
771        use std::iter::Iterator;
772        self.rules = v.into_iter().map(|i| i.into()).collect();
773        self
774    }
775}
776
777impl wkt::message::Message for Backend {
778    fn typename() -> &'static str {
779        "type.googleapis.com/google.api.Backend"
780    }
781}
782
783/// A backend rule provides configuration for an individual API element.
784#[derive(Clone, Default, PartialEq)]
785#[non_exhaustive]
786pub struct BackendRule {
787    /// Selects the methods to which this rule applies.
788    ///
789    /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
790    /// details.
791    ///
792    /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
793    pub selector: std::string::String,
794
795    /// The address of the API backend.
796    ///
797    /// The scheme is used to determine the backend protocol and security.
798    /// The following schemes are accepted:
799    ///
800    /// SCHEME        PROTOCOL    SECURITY
801    /// http://       HTTP        None
802    /// https://      HTTP        TLS
803    /// grpc://       gRPC        None
804    /// grpcs://      gRPC        TLS
805    ///
806    /// It is recommended to explicitly include a scheme. Leaving out the scheme
807    /// may cause constrasting behaviors across platforms.
808    ///
809    /// If the port is unspecified, the default is:
810    ///
811    /// - 80 for schemes without TLS
812    /// - 443 for schemes with TLS
813    ///
814    /// For HTTP backends, use [protocol][google.api.BackendRule.protocol]
815    /// to specify the protocol version.
816    ///
817    /// [google.api.BackendRule.protocol]: crate::model::BackendRule::protocol
818    pub address: std::string::String,
819
820    /// The number of seconds to wait for a response from a request. The default
821    /// varies based on the request protocol and deployment environment.
822    pub deadline: f64,
823
824    /// Deprecated, do not use.
825    #[deprecated]
826    pub min_deadline: f64,
827
828    /// The number of seconds to wait for the completion of a long running
829    /// operation. The default is no deadline.
830    pub operation_deadline: f64,
831
832    pub path_translation: crate::model::backend_rule::PathTranslation,
833
834    /// The protocol used for sending a request to the backend.
835    /// The supported values are "http/1.1" and "h2".
836    ///
837    /// The default value is inferred from the scheme in the
838    /// [address][google.api.BackendRule.address] field:
839    ///
840    /// SCHEME        PROTOCOL
841    /// http://       http/1.1
842    /// https://      http/1.1
843    /// grpc://       h2
844    /// grpcs://      h2
845    ///
846    /// For secure HTTP backends (https://) that support HTTP/2, set this field
847    /// to "h2" for improved performance.
848    ///
849    /// Configuring this field to non-default values is only supported for secure
850    /// HTTP backends. This field will be ignored for all other backends.
851    ///
852    /// See
853    /// <https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml#alpn-protocol-ids>
854    /// for more details on the supported values.
855    ///
856    /// [google.api.BackendRule.address]: crate::model::BackendRule::address
857    pub protocol: std::string::String,
858
859    /// The map between request protocol and the backend address.
860    pub overrides_by_request_protocol:
861        std::collections::HashMap<std::string::String, crate::model::BackendRule>,
862
863    /// Authentication settings used by the backend.
864    ///
865    /// These are typically used to provide service management functionality to
866    /// a backend served on a publicly-routable URL. The `authentication`
867    /// details should match the authentication behavior used by the backend.
868    ///
869    /// For example, specifying `jwt_audience` implies that the backend expects
870    /// authentication via a JWT.
871    ///
872    /// When authentication is unspecified, the resulting behavior is the same
873    /// as `disable_auth` set to `true`.
874    ///
875    /// Refer to <https://developers.google.com/identity/protocols/OpenIDConnect> for
876    /// JWT ID token.
877    pub authentication: std::option::Option<crate::model::backend_rule::Authentication>,
878
879    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
880}
881
882impl BackendRule {
883    pub fn new() -> Self {
884        std::default::Default::default()
885    }
886
887    /// Sets the value of [selector][crate::model::BackendRule::selector].
888    ///
889    /// # Example
890    /// ```ignore,no_run
891    /// # use google_cloud_api::model::BackendRule;
892    /// let x = BackendRule::new().set_selector("example");
893    /// ```
894    pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
895        self.selector = v.into();
896        self
897    }
898
899    /// Sets the value of [address][crate::model::BackendRule::address].
900    ///
901    /// # Example
902    /// ```ignore,no_run
903    /// # use google_cloud_api::model::BackendRule;
904    /// let x = BackendRule::new().set_address("example");
905    /// ```
906    pub fn set_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
907        self.address = v.into();
908        self
909    }
910
911    /// Sets the value of [deadline][crate::model::BackendRule::deadline].
912    ///
913    /// # Example
914    /// ```ignore,no_run
915    /// # use google_cloud_api::model::BackendRule;
916    /// let x = BackendRule::new().set_deadline(42.0);
917    /// ```
918    pub fn set_deadline<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
919        self.deadline = v.into();
920        self
921    }
922
923    /// Sets the value of [min_deadline][crate::model::BackendRule::min_deadline].
924    ///
925    /// # Example
926    /// ```ignore,no_run
927    /// # use google_cloud_api::model::BackendRule;
928    /// let x = BackendRule::new().set_min_deadline(42.0);
929    /// ```
930    #[deprecated]
931    pub fn set_min_deadline<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
932        self.min_deadline = v.into();
933        self
934    }
935
936    /// Sets the value of [operation_deadline][crate::model::BackendRule::operation_deadline].
937    ///
938    /// # Example
939    /// ```ignore,no_run
940    /// # use google_cloud_api::model::BackendRule;
941    /// let x = BackendRule::new().set_operation_deadline(42.0);
942    /// ```
943    pub fn set_operation_deadline<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
944        self.operation_deadline = v.into();
945        self
946    }
947
948    /// Sets the value of [path_translation][crate::model::BackendRule::path_translation].
949    ///
950    /// # Example
951    /// ```ignore,no_run
952    /// # use google_cloud_api::model::BackendRule;
953    /// use google_cloud_api::model::backend_rule::PathTranslation;
954    /// let x0 = BackendRule::new().set_path_translation(PathTranslation::ConstantAddress);
955    /// let x1 = BackendRule::new().set_path_translation(PathTranslation::AppendPathToAddress);
956    /// ```
957    pub fn set_path_translation<
958        T: std::convert::Into<crate::model::backend_rule::PathTranslation>,
959    >(
960        mut self,
961        v: T,
962    ) -> Self {
963        self.path_translation = v.into();
964        self
965    }
966
967    /// Sets the value of [protocol][crate::model::BackendRule::protocol].
968    ///
969    /// # Example
970    /// ```ignore,no_run
971    /// # use google_cloud_api::model::BackendRule;
972    /// let x = BackendRule::new().set_protocol("example");
973    /// ```
974    pub fn set_protocol<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
975        self.protocol = v.into();
976        self
977    }
978
979    /// Sets the value of [overrides_by_request_protocol][crate::model::BackendRule::overrides_by_request_protocol].
980    ///
981    /// # Example
982    /// ```ignore,no_run
983    /// # use google_cloud_api::model::BackendRule;
984    /// let x = BackendRule::new().set_overrides_by_request_protocol([
985    ///     ("key0", BackendRule::default()/* use setters */),
986    ///     ("key1", BackendRule::default()/* use (different) setters */),
987    /// ]);
988    /// ```
989    pub fn set_overrides_by_request_protocol<T, K, V>(mut self, v: T) -> Self
990    where
991        T: std::iter::IntoIterator<Item = (K, V)>,
992        K: std::convert::Into<std::string::String>,
993        V: std::convert::Into<crate::model::BackendRule>,
994    {
995        use std::iter::Iterator;
996        self.overrides_by_request_protocol =
997            v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
998        self
999    }
1000
1001    /// Sets the value of [authentication][crate::model::BackendRule::authentication].
1002    ///
1003    /// Note that all the setters affecting `authentication` are mutually
1004    /// exclusive.
1005    ///
1006    /// # Example
1007    /// ```ignore,no_run
1008    /// # use google_cloud_api::model::BackendRule;
1009    /// use google_cloud_api::model::backend_rule::Authentication;
1010    /// let x = BackendRule::new().set_authentication(Some(Authentication::JwtAudience("example".to_string())));
1011    /// ```
1012    pub fn set_authentication<
1013        T: std::convert::Into<std::option::Option<crate::model::backend_rule::Authentication>>,
1014    >(
1015        mut self,
1016        v: T,
1017    ) -> Self {
1018        self.authentication = v.into();
1019        self
1020    }
1021
1022    /// The value of [authentication][crate::model::BackendRule::authentication]
1023    /// if it holds a `JwtAudience`, `None` if the field is not set or
1024    /// holds a different branch.
1025    pub fn jwt_audience(&self) -> std::option::Option<&std::string::String> {
1026        #[allow(unreachable_patterns)]
1027        self.authentication.as_ref().and_then(|v| match v {
1028            crate::model::backend_rule::Authentication::JwtAudience(v) => {
1029                std::option::Option::Some(v)
1030            }
1031            _ => std::option::Option::None,
1032        })
1033    }
1034
1035    /// Sets the value of [authentication][crate::model::BackendRule::authentication]
1036    /// to hold a `JwtAudience`.
1037    ///
1038    /// Note that all the setters affecting `authentication` are
1039    /// mutually exclusive.
1040    ///
1041    /// # Example
1042    /// ```ignore,no_run
1043    /// # use google_cloud_api::model::BackendRule;
1044    /// let x = BackendRule::new().set_jwt_audience("example");
1045    /// assert!(x.jwt_audience().is_some());
1046    /// assert!(x.disable_auth().is_none());
1047    /// ```
1048    pub fn set_jwt_audience<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1049        self.authentication = std::option::Option::Some(
1050            crate::model::backend_rule::Authentication::JwtAudience(v.into()),
1051        );
1052        self
1053    }
1054
1055    /// The value of [authentication][crate::model::BackendRule::authentication]
1056    /// if it holds a `DisableAuth`, `None` if the field is not set or
1057    /// holds a different branch.
1058    pub fn disable_auth(&self) -> std::option::Option<&bool> {
1059        #[allow(unreachable_patterns)]
1060        self.authentication.as_ref().and_then(|v| match v {
1061            crate::model::backend_rule::Authentication::DisableAuth(v) => {
1062                std::option::Option::Some(v)
1063            }
1064            _ => std::option::Option::None,
1065        })
1066    }
1067
1068    /// Sets the value of [authentication][crate::model::BackendRule::authentication]
1069    /// to hold a `DisableAuth`.
1070    ///
1071    /// Note that all the setters affecting `authentication` are
1072    /// mutually exclusive.
1073    ///
1074    /// # Example
1075    /// ```ignore,no_run
1076    /// # use google_cloud_api::model::BackendRule;
1077    /// let x = BackendRule::new().set_disable_auth(true);
1078    /// assert!(x.disable_auth().is_some());
1079    /// assert!(x.jwt_audience().is_none());
1080    /// ```
1081    pub fn set_disable_auth<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1082        self.authentication = std::option::Option::Some(
1083            crate::model::backend_rule::Authentication::DisableAuth(v.into()),
1084        );
1085        self
1086    }
1087}
1088
1089impl wkt::message::Message for BackendRule {
1090    fn typename() -> &'static str {
1091        "type.googleapis.com/google.api.BackendRule"
1092    }
1093}
1094
1095/// Defines additional types related to [BackendRule].
1096pub mod backend_rule {
1097    #[allow(unused_imports)]
1098    use super::*;
1099
1100    /// Path Translation specifies how to combine the backend address with the
1101    /// request path in order to produce the appropriate forwarding URL for the
1102    /// request.
1103    ///
1104    /// Path Translation is applicable only to HTTP-based backends. Backends which
1105    /// do not accept requests over HTTP/HTTPS should leave `path_translation`
1106    /// unspecified.
1107    ///
1108    /// # Working with unknown values
1109    ///
1110    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1111    /// additional enum variants at any time. Adding new variants is not considered
1112    /// a breaking change. Applications should write their code in anticipation of:
1113    ///
1114    /// - New values appearing in future releases of the client library, **and**
1115    /// - New values received dynamically, without application changes.
1116    ///
1117    /// Please consult the [Working with enums] section in the user guide for some
1118    /// guidelines.
1119    ///
1120    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1121    #[derive(Clone, Debug, PartialEq)]
1122    #[non_exhaustive]
1123    pub enum PathTranslation {
1124        Unspecified,
1125        /// Use the backend address as-is, with no modification to the path. If the
1126        /// URL pattern contains variables, the variable names and values will be
1127        /// appended to the query string. If a query string parameter and a URL
1128        /// pattern variable have the same name, this may result in duplicate keys in
1129        /// the query string.
1130        ///
1131        /// # Examples
1132        ///
1133        /// Given the following operation config:
1134        ///
1135        /// ```norust
1136        /// Method path:        /api/company/{cid}/user/{uid}
1137        /// Backend address:    https://example.cloudfunctions.net/getUser
1138        /// ```
1139        ///
1140        /// Requests to the following request paths will call the backend at the
1141        /// translated path:
1142        ///
1143        /// ```norust
1144        /// Request path: /api/company/widgetworks/user/johndoe
1145        /// Translated:
1146        /// https://example.cloudfunctions.net/getUser?cid=widgetworks&uid=johndoe
1147        ///
1148        /// Request path: /api/company/widgetworks/user/johndoe?timezone=EST
1149        /// Translated:
1150        /// https://example.cloudfunctions.net/getUser?timezone=EST&cid=widgetworks&uid=johndoe
1151        /// ```
1152        ConstantAddress,
1153        /// The request path will be appended to the backend address.
1154        ///
1155        /// # Examples
1156        ///
1157        /// Given the following operation config:
1158        ///
1159        /// ```norust
1160        /// Method path:        /api/company/{cid}/user/{uid}
1161        /// Backend address:    https://example.appspot.com
1162        /// ```
1163        ///
1164        /// Requests to the following request paths will call the backend at the
1165        /// translated path:
1166        ///
1167        /// ```norust
1168        /// Request path: /api/company/widgetworks/user/johndoe
1169        /// Translated:
1170        /// https://example.appspot.com/api/company/widgetworks/user/johndoe
1171        ///
1172        /// Request path: /api/company/widgetworks/user/johndoe?timezone=EST
1173        /// Translated:
1174        /// https://example.appspot.com/api/company/widgetworks/user/johndoe?timezone=EST
1175        /// ```
1176        AppendPathToAddress,
1177        /// If set, the enum was initialized with an unknown value.
1178        ///
1179        /// Applications can examine the value using [PathTranslation::value] or
1180        /// [PathTranslation::name].
1181        UnknownValue(path_translation::UnknownValue),
1182    }
1183
1184    #[doc(hidden)]
1185    pub mod path_translation {
1186        #[allow(unused_imports)]
1187        use super::*;
1188        #[derive(Clone, Debug, PartialEq)]
1189        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1190    }
1191
1192    impl PathTranslation {
1193        /// Gets the enum value.
1194        ///
1195        /// Returns `None` if the enum contains an unknown value deserialized from
1196        /// the string representation of enums.
1197        pub fn value(&self) -> std::option::Option<i32> {
1198            match self {
1199                Self::Unspecified => std::option::Option::Some(0),
1200                Self::ConstantAddress => std::option::Option::Some(1),
1201                Self::AppendPathToAddress => std::option::Option::Some(2),
1202                Self::UnknownValue(u) => u.0.value(),
1203            }
1204        }
1205
1206        /// Gets the enum value as a string.
1207        ///
1208        /// Returns `None` if the enum contains an unknown value deserialized from
1209        /// the integer representation of enums.
1210        pub fn name(&self) -> std::option::Option<&str> {
1211            match self {
1212                Self::Unspecified => std::option::Option::Some("PATH_TRANSLATION_UNSPECIFIED"),
1213                Self::ConstantAddress => std::option::Option::Some("CONSTANT_ADDRESS"),
1214                Self::AppendPathToAddress => std::option::Option::Some("APPEND_PATH_TO_ADDRESS"),
1215                Self::UnknownValue(u) => u.0.name(),
1216            }
1217        }
1218    }
1219
1220    impl std::default::Default for PathTranslation {
1221        fn default() -> Self {
1222            use std::convert::From;
1223            Self::from(0)
1224        }
1225    }
1226
1227    impl std::fmt::Display for PathTranslation {
1228        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1229            wkt::internal::display_enum(f, self.name(), self.value())
1230        }
1231    }
1232
1233    impl std::convert::From<i32> for PathTranslation {
1234        fn from(value: i32) -> Self {
1235            match value {
1236                0 => Self::Unspecified,
1237                1 => Self::ConstantAddress,
1238                2 => Self::AppendPathToAddress,
1239                _ => Self::UnknownValue(path_translation::UnknownValue(
1240                    wkt::internal::UnknownEnumValue::Integer(value),
1241                )),
1242            }
1243        }
1244    }
1245
1246    impl std::convert::From<&str> for PathTranslation {
1247        fn from(value: &str) -> Self {
1248            use std::string::ToString;
1249            match value {
1250                "PATH_TRANSLATION_UNSPECIFIED" => Self::Unspecified,
1251                "CONSTANT_ADDRESS" => Self::ConstantAddress,
1252                "APPEND_PATH_TO_ADDRESS" => Self::AppendPathToAddress,
1253                _ => Self::UnknownValue(path_translation::UnknownValue(
1254                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1255                )),
1256            }
1257        }
1258    }
1259
1260    impl serde::ser::Serialize for PathTranslation {
1261        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1262        where
1263            S: serde::Serializer,
1264        {
1265            match self {
1266                Self::Unspecified => serializer.serialize_i32(0),
1267                Self::ConstantAddress => serializer.serialize_i32(1),
1268                Self::AppendPathToAddress => serializer.serialize_i32(2),
1269                Self::UnknownValue(u) => u.0.serialize(serializer),
1270            }
1271        }
1272    }
1273
1274    impl<'de> serde::de::Deserialize<'de> for PathTranslation {
1275        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1276        where
1277            D: serde::Deserializer<'de>,
1278        {
1279            deserializer.deserialize_any(wkt::internal::EnumVisitor::<PathTranslation>::new(
1280                ".google.api.BackendRule.PathTranslation",
1281            ))
1282        }
1283    }
1284
1285    /// Authentication settings used by the backend.
1286    ///
1287    /// These are typically used to provide service management functionality to
1288    /// a backend served on a publicly-routable URL. The `authentication`
1289    /// details should match the authentication behavior used by the backend.
1290    ///
1291    /// For example, specifying `jwt_audience` implies that the backend expects
1292    /// authentication via a JWT.
1293    ///
1294    /// When authentication is unspecified, the resulting behavior is the same
1295    /// as `disable_auth` set to `true`.
1296    ///
1297    /// Refer to <https://developers.google.com/identity/protocols/OpenIDConnect> for
1298    /// JWT ID token.
1299    #[derive(Clone, Debug, PartialEq)]
1300    #[non_exhaustive]
1301    pub enum Authentication {
1302        /// The JWT audience is used when generating a JWT ID token for the backend.
1303        /// This ID token will be added in the HTTP "authorization" header, and sent
1304        /// to the backend.
1305        JwtAudience(std::string::String),
1306        /// When disable_auth is true, a JWT ID token won't be generated and the
1307        /// original "Authorization" HTTP header will be preserved. If the header is
1308        /// used to carry the original token and is expected by the backend, this
1309        /// field must be set to true to preserve the header.
1310        DisableAuth(bool),
1311    }
1312}
1313
1314/// Billing related configuration of the service.
1315///
1316/// The following example shows how to configure monitored resources and metrics
1317/// for billing, `consumer_destinations` is the only supported destination and
1318/// the monitored resources need at least one label key
1319/// `cloud.googleapis.com/location` to indicate the location of the billing
1320/// usage, using different monitored resources between monitoring and billing is
1321/// recommended so they can be evolved independently:
1322///
1323/// ```norust
1324/// monitored_resources:
1325/// - type: library.googleapis.com/billing_branch
1326///   labels:
1327///   - key: cloud.googleapis.com/location
1328///     description: |
1329///       Predefined label to support billing location restriction.
1330///   - key: city
1331///     description: |
1332///       Custom label to define the city where the library branch is located
1333///       in.
1334///   - key: name
1335///     description: Custom label to define the name of the library branch.
1336/// metrics:
1337/// - name: library.googleapis.com/book/borrowed_count
1338///   metric_kind: DELTA
1339///   value_type: INT64
1340///   unit: "1"
1341/// billing:
1342///   consumer_destinations:
1343///   - monitored_resource: library.googleapis.com/billing_branch
1344///     metrics:
1345///     - library.googleapis.com/book/borrowed_count
1346/// ```
1347#[derive(Clone, Default, PartialEq)]
1348#[non_exhaustive]
1349pub struct Billing {
1350    /// Billing configurations for sending metrics to the consumer project.
1351    /// There can be multiple consumer destinations per service, each one must have
1352    /// a different monitored resource type. A metric can be used in at most
1353    /// one consumer destination.
1354    pub consumer_destinations: std::vec::Vec<crate::model::billing::BillingDestination>,
1355
1356    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1357}
1358
1359impl Billing {
1360    pub fn new() -> Self {
1361        std::default::Default::default()
1362    }
1363
1364    /// Sets the value of [consumer_destinations][crate::model::Billing::consumer_destinations].
1365    ///
1366    /// # Example
1367    /// ```ignore,no_run
1368    /// # use google_cloud_api::model::Billing;
1369    /// use google_cloud_api::model::billing::BillingDestination;
1370    /// let x = Billing::new()
1371    ///     .set_consumer_destinations([
1372    ///         BillingDestination::default()/* use setters */,
1373    ///         BillingDestination::default()/* use (different) setters */,
1374    ///     ]);
1375    /// ```
1376    pub fn set_consumer_destinations<T, V>(mut self, v: T) -> Self
1377    where
1378        T: std::iter::IntoIterator<Item = V>,
1379        V: std::convert::Into<crate::model::billing::BillingDestination>,
1380    {
1381        use std::iter::Iterator;
1382        self.consumer_destinations = v.into_iter().map(|i| i.into()).collect();
1383        self
1384    }
1385}
1386
1387impl wkt::message::Message for Billing {
1388    fn typename() -> &'static str {
1389        "type.googleapis.com/google.api.Billing"
1390    }
1391}
1392
1393/// Defines additional types related to [Billing].
1394pub mod billing {
1395    #[allow(unused_imports)]
1396    use super::*;
1397
1398    /// Configuration of a specific billing destination (Currently only support
1399    /// bill against consumer project).
1400    #[derive(Clone, Default, PartialEq)]
1401    #[non_exhaustive]
1402    pub struct BillingDestination {
1403        /// The monitored resource type. The type must be defined in
1404        /// [Service.monitored_resources][google.api.Service.monitored_resources]
1405        /// section.
1406        ///
1407        /// [google.api.Service.monitored_resources]: crate::model::Service::monitored_resources
1408        pub monitored_resource: std::string::String,
1409
1410        /// Names of the metrics to report to this billing destination.
1411        /// Each name must be defined in
1412        /// [Service.metrics][google.api.Service.metrics] section.
1413        ///
1414        /// [google.api.Service.metrics]: crate::model::Service::metrics
1415        pub metrics: std::vec::Vec<std::string::String>,
1416
1417        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1418    }
1419
1420    impl BillingDestination {
1421        pub fn new() -> Self {
1422            std::default::Default::default()
1423        }
1424
1425        /// Sets the value of [monitored_resource][crate::model::billing::BillingDestination::monitored_resource].
1426        ///
1427        /// # Example
1428        /// ```ignore,no_run
1429        /// # use google_cloud_api::model::billing::BillingDestination;
1430        /// let x = BillingDestination::new().set_monitored_resource("example");
1431        /// ```
1432        pub fn set_monitored_resource<T: std::convert::Into<std::string::String>>(
1433            mut self,
1434            v: T,
1435        ) -> Self {
1436            self.monitored_resource = v.into();
1437            self
1438        }
1439
1440        /// Sets the value of [metrics][crate::model::billing::BillingDestination::metrics].
1441        ///
1442        /// # Example
1443        /// ```ignore,no_run
1444        /// # use google_cloud_api::model::billing::BillingDestination;
1445        /// let x = BillingDestination::new().set_metrics(["a", "b", "c"]);
1446        /// ```
1447        pub fn set_metrics<T, V>(mut self, v: T) -> Self
1448        where
1449            T: std::iter::IntoIterator<Item = V>,
1450            V: std::convert::Into<std::string::String>,
1451        {
1452            use std::iter::Iterator;
1453            self.metrics = v.into_iter().map(|i| i.into()).collect();
1454            self
1455        }
1456    }
1457
1458    impl wkt::message::Message for BillingDestination {
1459        fn typename() -> &'static str {
1460            "type.googleapis.com/google.api.Billing.BillingDestination"
1461        }
1462    }
1463}
1464
1465/// Required information for every language.
1466#[derive(Clone, Default, PartialEq)]
1467#[non_exhaustive]
1468pub struct CommonLanguageSettings {
1469    /// Link to automatically generated reference documentation.  Example:
1470    /// <https://cloud.google.com/nodejs/docs/reference/asset/latest>
1471    #[deprecated]
1472    pub reference_docs_uri: std::string::String,
1473
1474    /// The destination where API teams want this client library to be published.
1475    pub destinations: std::vec::Vec<crate::model::ClientLibraryDestination>,
1476
1477    /// Configuration for which RPCs should be generated in the GAPIC client.
1478    pub selective_gapic_generation: std::option::Option<crate::model::SelectiveGapicGeneration>,
1479
1480    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1481}
1482
1483impl CommonLanguageSettings {
1484    pub fn new() -> Self {
1485        std::default::Default::default()
1486    }
1487
1488    /// Sets the value of [reference_docs_uri][crate::model::CommonLanguageSettings::reference_docs_uri].
1489    ///
1490    /// # Example
1491    /// ```ignore,no_run
1492    /// # use google_cloud_api::model::CommonLanguageSettings;
1493    /// let x = CommonLanguageSettings::new().set_reference_docs_uri("example");
1494    /// ```
1495    #[deprecated]
1496    pub fn set_reference_docs_uri<T: std::convert::Into<std::string::String>>(
1497        mut self,
1498        v: T,
1499    ) -> Self {
1500        self.reference_docs_uri = v.into();
1501        self
1502    }
1503
1504    /// Sets the value of [destinations][crate::model::CommonLanguageSettings::destinations].
1505    ///
1506    /// # Example
1507    /// ```ignore,no_run
1508    /// # use google_cloud_api::model::CommonLanguageSettings;
1509    /// use google_cloud_api::model::ClientLibraryDestination;
1510    /// let x = CommonLanguageSettings::new().set_destinations([
1511    ///     ClientLibraryDestination::Github,
1512    ///     ClientLibraryDestination::PackageManager,
1513    /// ]);
1514    /// ```
1515    pub fn set_destinations<T, V>(mut self, v: T) -> Self
1516    where
1517        T: std::iter::IntoIterator<Item = V>,
1518        V: std::convert::Into<crate::model::ClientLibraryDestination>,
1519    {
1520        use std::iter::Iterator;
1521        self.destinations = v.into_iter().map(|i| i.into()).collect();
1522        self
1523    }
1524
1525    /// Sets the value of [selective_gapic_generation][crate::model::CommonLanguageSettings::selective_gapic_generation].
1526    ///
1527    /// # Example
1528    /// ```ignore,no_run
1529    /// # use google_cloud_api::model::CommonLanguageSettings;
1530    /// use google_cloud_api::model::SelectiveGapicGeneration;
1531    /// let x = CommonLanguageSettings::new().set_selective_gapic_generation(SelectiveGapicGeneration::default()/* use setters */);
1532    /// ```
1533    pub fn set_selective_gapic_generation<T>(mut self, v: T) -> Self
1534    where
1535        T: std::convert::Into<crate::model::SelectiveGapicGeneration>,
1536    {
1537        self.selective_gapic_generation = std::option::Option::Some(v.into());
1538        self
1539    }
1540
1541    /// Sets or clears the value of [selective_gapic_generation][crate::model::CommonLanguageSettings::selective_gapic_generation].
1542    ///
1543    /// # Example
1544    /// ```ignore,no_run
1545    /// # use google_cloud_api::model::CommonLanguageSettings;
1546    /// use google_cloud_api::model::SelectiveGapicGeneration;
1547    /// let x = CommonLanguageSettings::new().set_or_clear_selective_gapic_generation(Some(SelectiveGapicGeneration::default()/* use setters */));
1548    /// let x = CommonLanguageSettings::new().set_or_clear_selective_gapic_generation(None::<SelectiveGapicGeneration>);
1549    /// ```
1550    pub fn set_or_clear_selective_gapic_generation<T>(mut self, v: std::option::Option<T>) -> Self
1551    where
1552        T: std::convert::Into<crate::model::SelectiveGapicGeneration>,
1553    {
1554        self.selective_gapic_generation = v.map(|x| x.into());
1555        self
1556    }
1557}
1558
1559impl wkt::message::Message for CommonLanguageSettings {
1560    fn typename() -> &'static str {
1561        "type.googleapis.com/google.api.CommonLanguageSettings"
1562    }
1563}
1564
1565/// Details about how and where to publish client libraries.
1566#[derive(Clone, Default, PartialEq)]
1567#[non_exhaustive]
1568pub struct ClientLibrarySettings {
1569    /// Version of the API to apply these settings to. This is the full protobuf
1570    /// package for the API, ending in the version element.
1571    /// Examples: "google.cloud.speech.v1" and "google.spanner.admin.database.v1".
1572    pub version: std::string::String,
1573
1574    /// Launch stage of this version of the API.
1575    pub launch_stage: crate::model::LaunchStage,
1576
1577    /// When using transport=rest, the client request will encode enums as
1578    /// numbers rather than strings.
1579    pub rest_numeric_enums: bool,
1580
1581    /// Settings for legacy Java features, supported in the Service YAML.
1582    pub java_settings: std::option::Option<crate::model::JavaSettings>,
1583
1584    /// Settings for C++ client libraries.
1585    pub cpp_settings: std::option::Option<crate::model::CppSettings>,
1586
1587    /// Settings for PHP client libraries.
1588    pub php_settings: std::option::Option<crate::model::PhpSettings>,
1589
1590    /// Settings for Python client libraries.
1591    pub python_settings: std::option::Option<crate::model::PythonSettings>,
1592
1593    /// Settings for Node client libraries.
1594    pub node_settings: std::option::Option<crate::model::NodeSettings>,
1595
1596    /// Settings for .NET client libraries.
1597    pub dotnet_settings: std::option::Option<crate::model::DotnetSettings>,
1598
1599    /// Settings for Ruby client libraries.
1600    pub ruby_settings: std::option::Option<crate::model::RubySettings>,
1601
1602    /// Settings for Go client libraries.
1603    pub go_settings: std::option::Option<crate::model::GoSettings>,
1604
1605    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1606}
1607
1608impl ClientLibrarySettings {
1609    pub fn new() -> Self {
1610        std::default::Default::default()
1611    }
1612
1613    /// Sets the value of [version][crate::model::ClientLibrarySettings::version].
1614    ///
1615    /// # Example
1616    /// ```ignore,no_run
1617    /// # use google_cloud_api::model::ClientLibrarySettings;
1618    /// let x = ClientLibrarySettings::new().set_version("example");
1619    /// ```
1620    pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1621        self.version = v.into();
1622        self
1623    }
1624
1625    /// Sets the value of [launch_stage][crate::model::ClientLibrarySettings::launch_stage].
1626    ///
1627    /// # Example
1628    /// ```ignore,no_run
1629    /// # use google_cloud_api::model::ClientLibrarySettings;
1630    /// use google_cloud_api::model::LaunchStage;
1631    /// let x0 = ClientLibrarySettings::new().set_launch_stage(LaunchStage::Unimplemented);
1632    /// let x1 = ClientLibrarySettings::new().set_launch_stage(LaunchStage::Prelaunch);
1633    /// let x2 = ClientLibrarySettings::new().set_launch_stage(LaunchStage::EarlyAccess);
1634    /// ```
1635    pub fn set_launch_stage<T: std::convert::Into<crate::model::LaunchStage>>(
1636        mut self,
1637        v: T,
1638    ) -> Self {
1639        self.launch_stage = v.into();
1640        self
1641    }
1642
1643    /// Sets the value of [rest_numeric_enums][crate::model::ClientLibrarySettings::rest_numeric_enums].
1644    ///
1645    /// # Example
1646    /// ```ignore,no_run
1647    /// # use google_cloud_api::model::ClientLibrarySettings;
1648    /// let x = ClientLibrarySettings::new().set_rest_numeric_enums(true);
1649    /// ```
1650    pub fn set_rest_numeric_enums<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1651        self.rest_numeric_enums = v.into();
1652        self
1653    }
1654
1655    /// Sets the value of [java_settings][crate::model::ClientLibrarySettings::java_settings].
1656    ///
1657    /// # Example
1658    /// ```ignore,no_run
1659    /// # use google_cloud_api::model::ClientLibrarySettings;
1660    /// use google_cloud_api::model::JavaSettings;
1661    /// let x = ClientLibrarySettings::new().set_java_settings(JavaSettings::default()/* use setters */);
1662    /// ```
1663    pub fn set_java_settings<T>(mut self, v: T) -> Self
1664    where
1665        T: std::convert::Into<crate::model::JavaSettings>,
1666    {
1667        self.java_settings = std::option::Option::Some(v.into());
1668        self
1669    }
1670
1671    /// Sets or clears the value of [java_settings][crate::model::ClientLibrarySettings::java_settings].
1672    ///
1673    /// # Example
1674    /// ```ignore,no_run
1675    /// # use google_cloud_api::model::ClientLibrarySettings;
1676    /// use google_cloud_api::model::JavaSettings;
1677    /// let x = ClientLibrarySettings::new().set_or_clear_java_settings(Some(JavaSettings::default()/* use setters */));
1678    /// let x = ClientLibrarySettings::new().set_or_clear_java_settings(None::<JavaSettings>);
1679    /// ```
1680    pub fn set_or_clear_java_settings<T>(mut self, v: std::option::Option<T>) -> Self
1681    where
1682        T: std::convert::Into<crate::model::JavaSettings>,
1683    {
1684        self.java_settings = v.map(|x| x.into());
1685        self
1686    }
1687
1688    /// Sets the value of [cpp_settings][crate::model::ClientLibrarySettings::cpp_settings].
1689    ///
1690    /// # Example
1691    /// ```ignore,no_run
1692    /// # use google_cloud_api::model::ClientLibrarySettings;
1693    /// use google_cloud_api::model::CppSettings;
1694    /// let x = ClientLibrarySettings::new().set_cpp_settings(CppSettings::default()/* use setters */);
1695    /// ```
1696    pub fn set_cpp_settings<T>(mut self, v: T) -> Self
1697    where
1698        T: std::convert::Into<crate::model::CppSettings>,
1699    {
1700        self.cpp_settings = std::option::Option::Some(v.into());
1701        self
1702    }
1703
1704    /// Sets or clears the value of [cpp_settings][crate::model::ClientLibrarySettings::cpp_settings].
1705    ///
1706    /// # Example
1707    /// ```ignore,no_run
1708    /// # use google_cloud_api::model::ClientLibrarySettings;
1709    /// use google_cloud_api::model::CppSettings;
1710    /// let x = ClientLibrarySettings::new().set_or_clear_cpp_settings(Some(CppSettings::default()/* use setters */));
1711    /// let x = ClientLibrarySettings::new().set_or_clear_cpp_settings(None::<CppSettings>);
1712    /// ```
1713    pub fn set_or_clear_cpp_settings<T>(mut self, v: std::option::Option<T>) -> Self
1714    where
1715        T: std::convert::Into<crate::model::CppSettings>,
1716    {
1717        self.cpp_settings = v.map(|x| x.into());
1718        self
1719    }
1720
1721    /// Sets the value of [php_settings][crate::model::ClientLibrarySettings::php_settings].
1722    ///
1723    /// # Example
1724    /// ```ignore,no_run
1725    /// # use google_cloud_api::model::ClientLibrarySettings;
1726    /// use google_cloud_api::model::PhpSettings;
1727    /// let x = ClientLibrarySettings::new().set_php_settings(PhpSettings::default()/* use setters */);
1728    /// ```
1729    pub fn set_php_settings<T>(mut self, v: T) -> Self
1730    where
1731        T: std::convert::Into<crate::model::PhpSettings>,
1732    {
1733        self.php_settings = std::option::Option::Some(v.into());
1734        self
1735    }
1736
1737    /// Sets or clears the value of [php_settings][crate::model::ClientLibrarySettings::php_settings].
1738    ///
1739    /// # Example
1740    /// ```ignore,no_run
1741    /// # use google_cloud_api::model::ClientLibrarySettings;
1742    /// use google_cloud_api::model::PhpSettings;
1743    /// let x = ClientLibrarySettings::new().set_or_clear_php_settings(Some(PhpSettings::default()/* use setters */));
1744    /// let x = ClientLibrarySettings::new().set_or_clear_php_settings(None::<PhpSettings>);
1745    /// ```
1746    pub fn set_or_clear_php_settings<T>(mut self, v: std::option::Option<T>) -> Self
1747    where
1748        T: std::convert::Into<crate::model::PhpSettings>,
1749    {
1750        self.php_settings = v.map(|x| x.into());
1751        self
1752    }
1753
1754    /// Sets the value of [python_settings][crate::model::ClientLibrarySettings::python_settings].
1755    ///
1756    /// # Example
1757    /// ```ignore,no_run
1758    /// # use google_cloud_api::model::ClientLibrarySettings;
1759    /// use google_cloud_api::model::PythonSettings;
1760    /// let x = ClientLibrarySettings::new().set_python_settings(PythonSettings::default()/* use setters */);
1761    /// ```
1762    pub fn set_python_settings<T>(mut self, v: T) -> Self
1763    where
1764        T: std::convert::Into<crate::model::PythonSettings>,
1765    {
1766        self.python_settings = std::option::Option::Some(v.into());
1767        self
1768    }
1769
1770    /// Sets or clears the value of [python_settings][crate::model::ClientLibrarySettings::python_settings].
1771    ///
1772    /// # Example
1773    /// ```ignore,no_run
1774    /// # use google_cloud_api::model::ClientLibrarySettings;
1775    /// use google_cloud_api::model::PythonSettings;
1776    /// let x = ClientLibrarySettings::new().set_or_clear_python_settings(Some(PythonSettings::default()/* use setters */));
1777    /// let x = ClientLibrarySettings::new().set_or_clear_python_settings(None::<PythonSettings>);
1778    /// ```
1779    pub fn set_or_clear_python_settings<T>(mut self, v: std::option::Option<T>) -> Self
1780    where
1781        T: std::convert::Into<crate::model::PythonSettings>,
1782    {
1783        self.python_settings = v.map(|x| x.into());
1784        self
1785    }
1786
1787    /// Sets the value of [node_settings][crate::model::ClientLibrarySettings::node_settings].
1788    ///
1789    /// # Example
1790    /// ```ignore,no_run
1791    /// # use google_cloud_api::model::ClientLibrarySettings;
1792    /// use google_cloud_api::model::NodeSettings;
1793    /// let x = ClientLibrarySettings::new().set_node_settings(NodeSettings::default()/* use setters */);
1794    /// ```
1795    pub fn set_node_settings<T>(mut self, v: T) -> Self
1796    where
1797        T: std::convert::Into<crate::model::NodeSettings>,
1798    {
1799        self.node_settings = std::option::Option::Some(v.into());
1800        self
1801    }
1802
1803    /// Sets or clears the value of [node_settings][crate::model::ClientLibrarySettings::node_settings].
1804    ///
1805    /// # Example
1806    /// ```ignore,no_run
1807    /// # use google_cloud_api::model::ClientLibrarySettings;
1808    /// use google_cloud_api::model::NodeSettings;
1809    /// let x = ClientLibrarySettings::new().set_or_clear_node_settings(Some(NodeSettings::default()/* use setters */));
1810    /// let x = ClientLibrarySettings::new().set_or_clear_node_settings(None::<NodeSettings>);
1811    /// ```
1812    pub fn set_or_clear_node_settings<T>(mut self, v: std::option::Option<T>) -> Self
1813    where
1814        T: std::convert::Into<crate::model::NodeSettings>,
1815    {
1816        self.node_settings = v.map(|x| x.into());
1817        self
1818    }
1819
1820    /// Sets the value of [dotnet_settings][crate::model::ClientLibrarySettings::dotnet_settings].
1821    ///
1822    /// # Example
1823    /// ```ignore,no_run
1824    /// # use google_cloud_api::model::ClientLibrarySettings;
1825    /// use google_cloud_api::model::DotnetSettings;
1826    /// let x = ClientLibrarySettings::new().set_dotnet_settings(DotnetSettings::default()/* use setters */);
1827    /// ```
1828    pub fn set_dotnet_settings<T>(mut self, v: T) -> Self
1829    where
1830        T: std::convert::Into<crate::model::DotnetSettings>,
1831    {
1832        self.dotnet_settings = std::option::Option::Some(v.into());
1833        self
1834    }
1835
1836    /// Sets or clears the value of [dotnet_settings][crate::model::ClientLibrarySettings::dotnet_settings].
1837    ///
1838    /// # Example
1839    /// ```ignore,no_run
1840    /// # use google_cloud_api::model::ClientLibrarySettings;
1841    /// use google_cloud_api::model::DotnetSettings;
1842    /// let x = ClientLibrarySettings::new().set_or_clear_dotnet_settings(Some(DotnetSettings::default()/* use setters */));
1843    /// let x = ClientLibrarySettings::new().set_or_clear_dotnet_settings(None::<DotnetSettings>);
1844    /// ```
1845    pub fn set_or_clear_dotnet_settings<T>(mut self, v: std::option::Option<T>) -> Self
1846    where
1847        T: std::convert::Into<crate::model::DotnetSettings>,
1848    {
1849        self.dotnet_settings = v.map(|x| x.into());
1850        self
1851    }
1852
1853    /// Sets the value of [ruby_settings][crate::model::ClientLibrarySettings::ruby_settings].
1854    ///
1855    /// # Example
1856    /// ```ignore,no_run
1857    /// # use google_cloud_api::model::ClientLibrarySettings;
1858    /// use google_cloud_api::model::RubySettings;
1859    /// let x = ClientLibrarySettings::new().set_ruby_settings(RubySettings::default()/* use setters */);
1860    /// ```
1861    pub fn set_ruby_settings<T>(mut self, v: T) -> Self
1862    where
1863        T: std::convert::Into<crate::model::RubySettings>,
1864    {
1865        self.ruby_settings = std::option::Option::Some(v.into());
1866        self
1867    }
1868
1869    /// Sets or clears the value of [ruby_settings][crate::model::ClientLibrarySettings::ruby_settings].
1870    ///
1871    /// # Example
1872    /// ```ignore,no_run
1873    /// # use google_cloud_api::model::ClientLibrarySettings;
1874    /// use google_cloud_api::model::RubySettings;
1875    /// let x = ClientLibrarySettings::new().set_or_clear_ruby_settings(Some(RubySettings::default()/* use setters */));
1876    /// let x = ClientLibrarySettings::new().set_or_clear_ruby_settings(None::<RubySettings>);
1877    /// ```
1878    pub fn set_or_clear_ruby_settings<T>(mut self, v: std::option::Option<T>) -> Self
1879    where
1880        T: std::convert::Into<crate::model::RubySettings>,
1881    {
1882        self.ruby_settings = v.map(|x| x.into());
1883        self
1884    }
1885
1886    /// Sets the value of [go_settings][crate::model::ClientLibrarySettings::go_settings].
1887    ///
1888    /// # Example
1889    /// ```ignore,no_run
1890    /// # use google_cloud_api::model::ClientLibrarySettings;
1891    /// use google_cloud_api::model::GoSettings;
1892    /// let x = ClientLibrarySettings::new().set_go_settings(GoSettings::default()/* use setters */);
1893    /// ```
1894    pub fn set_go_settings<T>(mut self, v: T) -> Self
1895    where
1896        T: std::convert::Into<crate::model::GoSettings>,
1897    {
1898        self.go_settings = std::option::Option::Some(v.into());
1899        self
1900    }
1901
1902    /// Sets or clears the value of [go_settings][crate::model::ClientLibrarySettings::go_settings].
1903    ///
1904    /// # Example
1905    /// ```ignore,no_run
1906    /// # use google_cloud_api::model::ClientLibrarySettings;
1907    /// use google_cloud_api::model::GoSettings;
1908    /// let x = ClientLibrarySettings::new().set_or_clear_go_settings(Some(GoSettings::default()/* use setters */));
1909    /// let x = ClientLibrarySettings::new().set_or_clear_go_settings(None::<GoSettings>);
1910    /// ```
1911    pub fn set_or_clear_go_settings<T>(mut self, v: std::option::Option<T>) -> Self
1912    where
1913        T: std::convert::Into<crate::model::GoSettings>,
1914    {
1915        self.go_settings = v.map(|x| x.into());
1916        self
1917    }
1918}
1919
1920impl wkt::message::Message for ClientLibrarySettings {
1921    fn typename() -> &'static str {
1922        "type.googleapis.com/google.api.ClientLibrarySettings"
1923    }
1924}
1925
1926/// This message configures the settings for publishing [Google Cloud Client
1927/// libraries](https://cloud.google.com/apis/docs/cloud-client-libraries)
1928/// generated from the service config.
1929#[derive(Clone, Default, PartialEq)]
1930#[non_exhaustive]
1931pub struct Publishing {
1932    /// A list of API method settings, e.g. the behavior for methods that use the
1933    /// long-running operation pattern.
1934    pub method_settings: std::vec::Vec<crate::model::MethodSettings>,
1935
1936    /// Link to a *public* URI where users can report issues.  Example:
1937    /// <https://issuetracker.google.com/issues/new?component=190865&template=1161103>
1938    pub new_issue_uri: std::string::String,
1939
1940    /// Link to product home page.  Example:
1941    /// <https://cloud.google.com/asset-inventory/docs/overview>
1942    pub documentation_uri: std::string::String,
1943
1944    /// Used as a tracking tag when collecting data about the APIs developer
1945    /// relations artifacts like docs, packages delivered to package managers,
1946    /// etc.  Example: "speech".
1947    pub api_short_name: std::string::String,
1948
1949    /// GitHub label to apply to issues and pull requests opened for this API.
1950    pub github_label: std::string::String,
1951
1952    /// GitHub teams to be added to CODEOWNERS in the directory in GitHub
1953    /// containing source code for the client libraries for this API.
1954    pub codeowner_github_teams: std::vec::Vec<std::string::String>,
1955
1956    /// A prefix used in sample code when demarking regions to be included in
1957    /// documentation.
1958    pub doc_tag_prefix: std::string::String,
1959
1960    /// For whom the client library is being published.
1961    pub organization: crate::model::ClientLibraryOrganization,
1962
1963    /// Client library settings.  If the same version string appears multiple
1964    /// times in this list, then the last one wins.  Settings from earlier
1965    /// settings with the same version string are discarded.
1966    pub library_settings: std::vec::Vec<crate::model::ClientLibrarySettings>,
1967
1968    /// Optional link to proto reference documentation.  Example:
1969    /// <https://cloud.google.com/pubsub/lite/docs/reference/rpc>
1970    pub proto_reference_documentation_uri: std::string::String,
1971
1972    /// Optional link to REST reference documentation.  Example:
1973    /// <https://cloud.google.com/pubsub/lite/docs/reference/rest>
1974    pub rest_reference_documentation_uri: std::string::String,
1975
1976    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1977}
1978
1979impl Publishing {
1980    pub fn new() -> Self {
1981        std::default::Default::default()
1982    }
1983
1984    /// Sets the value of [method_settings][crate::model::Publishing::method_settings].
1985    ///
1986    /// # Example
1987    /// ```ignore,no_run
1988    /// # use google_cloud_api::model::Publishing;
1989    /// use google_cloud_api::model::MethodSettings;
1990    /// let x = Publishing::new()
1991    ///     .set_method_settings([
1992    ///         MethodSettings::default()/* use setters */,
1993    ///         MethodSettings::default()/* use (different) setters */,
1994    ///     ]);
1995    /// ```
1996    pub fn set_method_settings<T, V>(mut self, v: T) -> Self
1997    where
1998        T: std::iter::IntoIterator<Item = V>,
1999        V: std::convert::Into<crate::model::MethodSettings>,
2000    {
2001        use std::iter::Iterator;
2002        self.method_settings = v.into_iter().map(|i| i.into()).collect();
2003        self
2004    }
2005
2006    /// Sets the value of [new_issue_uri][crate::model::Publishing::new_issue_uri].
2007    ///
2008    /// # Example
2009    /// ```ignore,no_run
2010    /// # use google_cloud_api::model::Publishing;
2011    /// let x = Publishing::new().set_new_issue_uri("example");
2012    /// ```
2013    pub fn set_new_issue_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2014        self.new_issue_uri = v.into();
2015        self
2016    }
2017
2018    /// Sets the value of [documentation_uri][crate::model::Publishing::documentation_uri].
2019    ///
2020    /// # Example
2021    /// ```ignore,no_run
2022    /// # use google_cloud_api::model::Publishing;
2023    /// let x = Publishing::new().set_documentation_uri("example");
2024    /// ```
2025    pub fn set_documentation_uri<T: std::convert::Into<std::string::String>>(
2026        mut self,
2027        v: T,
2028    ) -> Self {
2029        self.documentation_uri = v.into();
2030        self
2031    }
2032
2033    /// Sets the value of [api_short_name][crate::model::Publishing::api_short_name].
2034    ///
2035    /// # Example
2036    /// ```ignore,no_run
2037    /// # use google_cloud_api::model::Publishing;
2038    /// let x = Publishing::new().set_api_short_name("example");
2039    /// ```
2040    pub fn set_api_short_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2041        self.api_short_name = v.into();
2042        self
2043    }
2044
2045    /// Sets the value of [github_label][crate::model::Publishing::github_label].
2046    ///
2047    /// # Example
2048    /// ```ignore,no_run
2049    /// # use google_cloud_api::model::Publishing;
2050    /// let x = Publishing::new().set_github_label("example");
2051    /// ```
2052    pub fn set_github_label<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2053        self.github_label = v.into();
2054        self
2055    }
2056
2057    /// Sets the value of [codeowner_github_teams][crate::model::Publishing::codeowner_github_teams].
2058    ///
2059    /// # Example
2060    /// ```ignore,no_run
2061    /// # use google_cloud_api::model::Publishing;
2062    /// let x = Publishing::new().set_codeowner_github_teams(["a", "b", "c"]);
2063    /// ```
2064    pub fn set_codeowner_github_teams<T, V>(mut self, v: T) -> Self
2065    where
2066        T: std::iter::IntoIterator<Item = V>,
2067        V: std::convert::Into<std::string::String>,
2068    {
2069        use std::iter::Iterator;
2070        self.codeowner_github_teams = v.into_iter().map(|i| i.into()).collect();
2071        self
2072    }
2073
2074    /// Sets the value of [doc_tag_prefix][crate::model::Publishing::doc_tag_prefix].
2075    ///
2076    /// # Example
2077    /// ```ignore,no_run
2078    /// # use google_cloud_api::model::Publishing;
2079    /// let x = Publishing::new().set_doc_tag_prefix("example");
2080    /// ```
2081    pub fn set_doc_tag_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2082        self.doc_tag_prefix = v.into();
2083        self
2084    }
2085
2086    /// Sets the value of [organization][crate::model::Publishing::organization].
2087    ///
2088    /// # Example
2089    /// ```ignore,no_run
2090    /// # use google_cloud_api::model::Publishing;
2091    /// use google_cloud_api::model::ClientLibraryOrganization;
2092    /// let x0 = Publishing::new().set_organization(ClientLibraryOrganization::Cloud);
2093    /// let x1 = Publishing::new().set_organization(ClientLibraryOrganization::Ads);
2094    /// let x2 = Publishing::new().set_organization(ClientLibraryOrganization::Photos);
2095    /// ```
2096    pub fn set_organization<T: std::convert::Into<crate::model::ClientLibraryOrganization>>(
2097        mut self,
2098        v: T,
2099    ) -> Self {
2100        self.organization = v.into();
2101        self
2102    }
2103
2104    /// Sets the value of [library_settings][crate::model::Publishing::library_settings].
2105    ///
2106    /// # Example
2107    /// ```ignore,no_run
2108    /// # use google_cloud_api::model::Publishing;
2109    /// use google_cloud_api::model::ClientLibrarySettings;
2110    /// let x = Publishing::new()
2111    ///     .set_library_settings([
2112    ///         ClientLibrarySettings::default()/* use setters */,
2113    ///         ClientLibrarySettings::default()/* use (different) setters */,
2114    ///     ]);
2115    /// ```
2116    pub fn set_library_settings<T, V>(mut self, v: T) -> Self
2117    where
2118        T: std::iter::IntoIterator<Item = V>,
2119        V: std::convert::Into<crate::model::ClientLibrarySettings>,
2120    {
2121        use std::iter::Iterator;
2122        self.library_settings = v.into_iter().map(|i| i.into()).collect();
2123        self
2124    }
2125
2126    /// Sets the value of [proto_reference_documentation_uri][crate::model::Publishing::proto_reference_documentation_uri].
2127    ///
2128    /// # Example
2129    /// ```ignore,no_run
2130    /// # use google_cloud_api::model::Publishing;
2131    /// let x = Publishing::new().set_proto_reference_documentation_uri("example");
2132    /// ```
2133    pub fn set_proto_reference_documentation_uri<T: std::convert::Into<std::string::String>>(
2134        mut self,
2135        v: T,
2136    ) -> Self {
2137        self.proto_reference_documentation_uri = v.into();
2138        self
2139    }
2140
2141    /// Sets the value of [rest_reference_documentation_uri][crate::model::Publishing::rest_reference_documentation_uri].
2142    ///
2143    /// # Example
2144    /// ```ignore,no_run
2145    /// # use google_cloud_api::model::Publishing;
2146    /// let x = Publishing::new().set_rest_reference_documentation_uri("example");
2147    /// ```
2148    pub fn set_rest_reference_documentation_uri<T: std::convert::Into<std::string::String>>(
2149        mut self,
2150        v: T,
2151    ) -> Self {
2152        self.rest_reference_documentation_uri = v.into();
2153        self
2154    }
2155}
2156
2157impl wkt::message::Message for Publishing {
2158    fn typename() -> &'static str {
2159        "type.googleapis.com/google.api.Publishing"
2160    }
2161}
2162
2163/// Settings for Java client libraries.
2164#[derive(Clone, Default, PartialEq)]
2165#[non_exhaustive]
2166pub struct JavaSettings {
2167    /// The package name to use in Java. Clobbers the java_package option
2168    /// set in the protobuf. This should be used **only** by APIs
2169    /// who have already set the language_settings.java.package_name" field
2170    /// in gapic.yaml. API teams should use the protobuf java_package option
2171    /// where possible.
2172    ///
2173    /// Example of a YAML configuration::
2174    ///
2175    /// publishing:
2176    /// java_settings:
2177    /// library_package: com.google.cloud.pubsub.v1
2178    pub library_package: std::string::String,
2179
2180    /// Configure the Java class name to use instead of the service's for its
2181    /// corresponding generated GAPIC client. Keys are fully-qualified
2182    /// service names as they appear in the protobuf (including the full
2183    /// the language_settings.java.interface_names" field in gapic.yaml. API
2184    /// teams should otherwise use the service name as it appears in the
2185    /// protobuf.
2186    ///
2187    /// Example of a YAML configuration::
2188    ///
2189    /// publishing:
2190    /// java_settings:
2191    /// service_class_names:
2192    /// - google.pubsub.v1.Publisher: TopicAdmin
2193    /// - google.pubsub.v1.Subscriber: SubscriptionAdmin
2194    pub service_class_names: std::collections::HashMap<std::string::String, std::string::String>,
2195
2196    /// Some settings.
2197    pub common: std::option::Option<crate::model::CommonLanguageSettings>,
2198
2199    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2200}
2201
2202impl JavaSettings {
2203    pub fn new() -> Self {
2204        std::default::Default::default()
2205    }
2206
2207    /// Sets the value of [library_package][crate::model::JavaSettings::library_package].
2208    ///
2209    /// # Example
2210    /// ```ignore,no_run
2211    /// # use google_cloud_api::model::JavaSettings;
2212    /// let x = JavaSettings::new().set_library_package("example");
2213    /// ```
2214    pub fn set_library_package<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2215        self.library_package = v.into();
2216        self
2217    }
2218
2219    /// Sets the value of [service_class_names][crate::model::JavaSettings::service_class_names].
2220    ///
2221    /// # Example
2222    /// ```ignore,no_run
2223    /// # use google_cloud_api::model::JavaSettings;
2224    /// let x = JavaSettings::new().set_service_class_names([
2225    ///     ("key0", "abc"),
2226    ///     ("key1", "xyz"),
2227    /// ]);
2228    /// ```
2229    pub fn set_service_class_names<T, K, V>(mut self, v: T) -> Self
2230    where
2231        T: std::iter::IntoIterator<Item = (K, V)>,
2232        K: std::convert::Into<std::string::String>,
2233        V: std::convert::Into<std::string::String>,
2234    {
2235        use std::iter::Iterator;
2236        self.service_class_names = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2237        self
2238    }
2239
2240    /// Sets the value of [common][crate::model::JavaSettings::common].
2241    ///
2242    /// # Example
2243    /// ```ignore,no_run
2244    /// # use google_cloud_api::model::JavaSettings;
2245    /// use google_cloud_api::model::CommonLanguageSettings;
2246    /// let x = JavaSettings::new().set_common(CommonLanguageSettings::default()/* use setters */);
2247    /// ```
2248    pub fn set_common<T>(mut self, v: T) -> Self
2249    where
2250        T: std::convert::Into<crate::model::CommonLanguageSettings>,
2251    {
2252        self.common = std::option::Option::Some(v.into());
2253        self
2254    }
2255
2256    /// Sets or clears the value of [common][crate::model::JavaSettings::common].
2257    ///
2258    /// # Example
2259    /// ```ignore,no_run
2260    /// # use google_cloud_api::model::JavaSettings;
2261    /// use google_cloud_api::model::CommonLanguageSettings;
2262    /// let x = JavaSettings::new().set_or_clear_common(Some(CommonLanguageSettings::default()/* use setters */));
2263    /// let x = JavaSettings::new().set_or_clear_common(None::<CommonLanguageSettings>);
2264    /// ```
2265    pub fn set_or_clear_common<T>(mut self, v: std::option::Option<T>) -> Self
2266    where
2267        T: std::convert::Into<crate::model::CommonLanguageSettings>,
2268    {
2269        self.common = v.map(|x| x.into());
2270        self
2271    }
2272}
2273
2274impl wkt::message::Message for JavaSettings {
2275    fn typename() -> &'static str {
2276        "type.googleapis.com/google.api.JavaSettings"
2277    }
2278}
2279
2280/// Settings for C++ client libraries.
2281#[derive(Clone, Default, PartialEq)]
2282#[non_exhaustive]
2283pub struct CppSettings {
2284    /// Some settings.
2285    pub common: std::option::Option<crate::model::CommonLanguageSettings>,
2286
2287    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2288}
2289
2290impl CppSettings {
2291    pub fn new() -> Self {
2292        std::default::Default::default()
2293    }
2294
2295    /// Sets the value of [common][crate::model::CppSettings::common].
2296    ///
2297    /// # Example
2298    /// ```ignore,no_run
2299    /// # use google_cloud_api::model::CppSettings;
2300    /// use google_cloud_api::model::CommonLanguageSettings;
2301    /// let x = CppSettings::new().set_common(CommonLanguageSettings::default()/* use setters */);
2302    /// ```
2303    pub fn set_common<T>(mut self, v: T) -> Self
2304    where
2305        T: std::convert::Into<crate::model::CommonLanguageSettings>,
2306    {
2307        self.common = std::option::Option::Some(v.into());
2308        self
2309    }
2310
2311    /// Sets or clears the value of [common][crate::model::CppSettings::common].
2312    ///
2313    /// # Example
2314    /// ```ignore,no_run
2315    /// # use google_cloud_api::model::CppSettings;
2316    /// use google_cloud_api::model::CommonLanguageSettings;
2317    /// let x = CppSettings::new().set_or_clear_common(Some(CommonLanguageSettings::default()/* use setters */));
2318    /// let x = CppSettings::new().set_or_clear_common(None::<CommonLanguageSettings>);
2319    /// ```
2320    pub fn set_or_clear_common<T>(mut self, v: std::option::Option<T>) -> Self
2321    where
2322        T: std::convert::Into<crate::model::CommonLanguageSettings>,
2323    {
2324        self.common = v.map(|x| x.into());
2325        self
2326    }
2327}
2328
2329impl wkt::message::Message for CppSettings {
2330    fn typename() -> &'static str {
2331        "type.googleapis.com/google.api.CppSettings"
2332    }
2333}
2334
2335/// Settings for Php client libraries.
2336#[derive(Clone, Default, PartialEq)]
2337#[non_exhaustive]
2338pub struct PhpSettings {
2339    /// Some settings.
2340    pub common: std::option::Option<crate::model::CommonLanguageSettings>,
2341
2342    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2343}
2344
2345impl PhpSettings {
2346    pub fn new() -> Self {
2347        std::default::Default::default()
2348    }
2349
2350    /// Sets the value of [common][crate::model::PhpSettings::common].
2351    ///
2352    /// # Example
2353    /// ```ignore,no_run
2354    /// # use google_cloud_api::model::PhpSettings;
2355    /// use google_cloud_api::model::CommonLanguageSettings;
2356    /// let x = PhpSettings::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::PhpSettings::common].
2367    ///
2368    /// # Example
2369    /// ```ignore,no_run
2370    /// # use google_cloud_api::model::PhpSettings;
2371    /// use google_cloud_api::model::CommonLanguageSettings;
2372    /// let x = PhpSettings::new().set_or_clear_common(Some(CommonLanguageSettings::default()/* use setters */));
2373    /// let x = PhpSettings::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 PhpSettings {
2385    fn typename() -> &'static str {
2386        "type.googleapis.com/google.api.PhpSettings"
2387    }
2388}
2389
2390/// Settings for Python client libraries.
2391#[derive(Clone, Default, PartialEq)]
2392#[non_exhaustive]
2393pub struct PythonSettings {
2394    /// Some settings.
2395    pub common: std::option::Option<crate::model::CommonLanguageSettings>,
2396
2397    /// Experimental features to be included during client library generation.
2398    pub experimental_features:
2399        std::option::Option<crate::model::python_settings::ExperimentalFeatures>,
2400
2401    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2402}
2403
2404impl PythonSettings {
2405    pub fn new() -> Self {
2406        std::default::Default::default()
2407    }
2408
2409    /// Sets the value of [common][crate::model::PythonSettings::common].
2410    ///
2411    /// # Example
2412    /// ```ignore,no_run
2413    /// # use google_cloud_api::model::PythonSettings;
2414    /// use google_cloud_api::model::CommonLanguageSettings;
2415    /// let x = PythonSettings::new().set_common(CommonLanguageSettings::default()/* use setters */);
2416    /// ```
2417    pub fn set_common<T>(mut self, v: T) -> Self
2418    where
2419        T: std::convert::Into<crate::model::CommonLanguageSettings>,
2420    {
2421        self.common = std::option::Option::Some(v.into());
2422        self
2423    }
2424
2425    /// Sets or clears the value of [common][crate::model::PythonSettings::common].
2426    ///
2427    /// # Example
2428    /// ```ignore,no_run
2429    /// # use google_cloud_api::model::PythonSettings;
2430    /// use google_cloud_api::model::CommonLanguageSettings;
2431    /// let x = PythonSettings::new().set_or_clear_common(Some(CommonLanguageSettings::default()/* use setters */));
2432    /// let x = PythonSettings::new().set_or_clear_common(None::<CommonLanguageSettings>);
2433    /// ```
2434    pub fn set_or_clear_common<T>(mut self, v: std::option::Option<T>) -> Self
2435    where
2436        T: std::convert::Into<crate::model::CommonLanguageSettings>,
2437    {
2438        self.common = v.map(|x| x.into());
2439        self
2440    }
2441
2442    /// Sets the value of [experimental_features][crate::model::PythonSettings::experimental_features].
2443    ///
2444    /// # Example
2445    /// ```ignore,no_run
2446    /// # use google_cloud_api::model::PythonSettings;
2447    /// use google_cloud_api::model::python_settings::ExperimentalFeatures;
2448    /// let x = PythonSettings::new().set_experimental_features(ExperimentalFeatures::default()/* use setters */);
2449    /// ```
2450    pub fn set_experimental_features<T>(mut self, v: T) -> Self
2451    where
2452        T: std::convert::Into<crate::model::python_settings::ExperimentalFeatures>,
2453    {
2454        self.experimental_features = std::option::Option::Some(v.into());
2455        self
2456    }
2457
2458    /// Sets or clears the value of [experimental_features][crate::model::PythonSettings::experimental_features].
2459    ///
2460    /// # Example
2461    /// ```ignore,no_run
2462    /// # use google_cloud_api::model::PythonSettings;
2463    /// use google_cloud_api::model::python_settings::ExperimentalFeatures;
2464    /// let x = PythonSettings::new().set_or_clear_experimental_features(Some(ExperimentalFeatures::default()/* use setters */));
2465    /// let x = PythonSettings::new().set_or_clear_experimental_features(None::<ExperimentalFeatures>);
2466    /// ```
2467    pub fn set_or_clear_experimental_features<T>(mut self, v: std::option::Option<T>) -> Self
2468    where
2469        T: std::convert::Into<crate::model::python_settings::ExperimentalFeatures>,
2470    {
2471        self.experimental_features = v.map(|x| x.into());
2472        self
2473    }
2474}
2475
2476impl wkt::message::Message for PythonSettings {
2477    fn typename() -> &'static str {
2478        "type.googleapis.com/google.api.PythonSettings"
2479    }
2480}
2481
2482/// Defines additional types related to [PythonSettings].
2483pub mod python_settings {
2484    #[allow(unused_imports)]
2485    use super::*;
2486
2487    /// Experimental features to be included during client library generation.
2488    /// These fields will be deprecated once the feature graduates and is enabled
2489    /// by default.
2490    #[derive(Clone, Default, PartialEq)]
2491    #[non_exhaustive]
2492    pub struct ExperimentalFeatures {
2493        /// Enables generation of asynchronous REST clients if `rest` transport is
2494        /// enabled. By default, asynchronous REST clients will not be generated.
2495        /// This feature will be enabled by default 1 month after launching the
2496        /// feature in preview packages.
2497        pub rest_async_io_enabled: bool,
2498
2499        /// Enables generation of protobuf code using new types that are more
2500        /// Pythonic which are included in `protobuf>=5.29.x`. This feature will be
2501        /// enabled by default 1 month after launching the feature in preview
2502        /// packages.
2503        pub protobuf_pythonic_types_enabled: bool,
2504
2505        /// Disables generation of an unversioned Python package for this client
2506        /// library. This means that the module names will need to be versioned in
2507        /// import statements. For example `import google.cloud.library_v2` instead
2508        /// of `import google.cloud.library`.
2509        pub unversioned_package_disabled: bool,
2510
2511        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2512    }
2513
2514    impl ExperimentalFeatures {
2515        pub fn new() -> Self {
2516            std::default::Default::default()
2517        }
2518
2519        /// Sets the value of [rest_async_io_enabled][crate::model::python_settings::ExperimentalFeatures::rest_async_io_enabled].
2520        ///
2521        /// # Example
2522        /// ```ignore,no_run
2523        /// # use google_cloud_api::model::python_settings::ExperimentalFeatures;
2524        /// let x = ExperimentalFeatures::new().set_rest_async_io_enabled(true);
2525        /// ```
2526        pub fn set_rest_async_io_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2527            self.rest_async_io_enabled = v.into();
2528            self
2529        }
2530
2531        /// Sets the value of [protobuf_pythonic_types_enabled][crate::model::python_settings::ExperimentalFeatures::protobuf_pythonic_types_enabled].
2532        ///
2533        /// # Example
2534        /// ```ignore,no_run
2535        /// # use google_cloud_api::model::python_settings::ExperimentalFeatures;
2536        /// let x = ExperimentalFeatures::new().set_protobuf_pythonic_types_enabled(true);
2537        /// ```
2538        pub fn set_protobuf_pythonic_types_enabled<T: std::convert::Into<bool>>(
2539            mut self,
2540            v: T,
2541        ) -> Self {
2542            self.protobuf_pythonic_types_enabled = v.into();
2543            self
2544        }
2545
2546        /// Sets the value of [unversioned_package_disabled][crate::model::python_settings::ExperimentalFeatures::unversioned_package_disabled].
2547        ///
2548        /// # Example
2549        /// ```ignore,no_run
2550        /// # use google_cloud_api::model::python_settings::ExperimentalFeatures;
2551        /// let x = ExperimentalFeatures::new().set_unversioned_package_disabled(true);
2552        /// ```
2553        pub fn set_unversioned_package_disabled<T: std::convert::Into<bool>>(
2554            mut self,
2555            v: T,
2556        ) -> Self {
2557            self.unversioned_package_disabled = v.into();
2558            self
2559        }
2560    }
2561
2562    impl wkt::message::Message for ExperimentalFeatures {
2563        fn typename() -> &'static str {
2564            "type.googleapis.com/google.api.PythonSettings.ExperimentalFeatures"
2565        }
2566    }
2567}
2568
2569/// Settings for Node client libraries.
2570#[derive(Clone, Default, PartialEq)]
2571#[non_exhaustive]
2572pub struct NodeSettings {
2573    /// Some settings.
2574    pub common: std::option::Option<crate::model::CommonLanguageSettings>,
2575
2576    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2577}
2578
2579impl NodeSettings {
2580    pub fn new() -> Self {
2581        std::default::Default::default()
2582    }
2583
2584    /// Sets the value of [common][crate::model::NodeSettings::common].
2585    ///
2586    /// # Example
2587    /// ```ignore,no_run
2588    /// # use google_cloud_api::model::NodeSettings;
2589    /// use google_cloud_api::model::CommonLanguageSettings;
2590    /// let x = NodeSettings::new().set_common(CommonLanguageSettings::default()/* use setters */);
2591    /// ```
2592    pub fn set_common<T>(mut self, v: T) -> Self
2593    where
2594        T: std::convert::Into<crate::model::CommonLanguageSettings>,
2595    {
2596        self.common = std::option::Option::Some(v.into());
2597        self
2598    }
2599
2600    /// Sets or clears the value of [common][crate::model::NodeSettings::common].
2601    ///
2602    /// # Example
2603    /// ```ignore,no_run
2604    /// # use google_cloud_api::model::NodeSettings;
2605    /// use google_cloud_api::model::CommonLanguageSettings;
2606    /// let x = NodeSettings::new().set_or_clear_common(Some(CommonLanguageSettings::default()/* use setters */));
2607    /// let x = NodeSettings::new().set_or_clear_common(None::<CommonLanguageSettings>);
2608    /// ```
2609    pub fn set_or_clear_common<T>(mut self, v: std::option::Option<T>) -> Self
2610    where
2611        T: std::convert::Into<crate::model::CommonLanguageSettings>,
2612    {
2613        self.common = v.map(|x| x.into());
2614        self
2615    }
2616}
2617
2618impl wkt::message::Message for NodeSettings {
2619    fn typename() -> &'static str {
2620        "type.googleapis.com/google.api.NodeSettings"
2621    }
2622}
2623
2624/// Settings for Dotnet client libraries.
2625#[derive(Clone, Default, PartialEq)]
2626#[non_exhaustive]
2627pub struct DotnetSettings {
2628    /// Some settings.
2629    pub common: std::option::Option<crate::model::CommonLanguageSettings>,
2630
2631    /// Map from original service names to renamed versions.
2632    /// This is used when the default generated types
2633    /// would cause a naming conflict. (Neither name is
2634    /// fully-qualified.)
2635    /// Example: Subscriber to SubscriberServiceApi.
2636    pub renamed_services: std::collections::HashMap<std::string::String, std::string::String>,
2637
2638    /// Map from full resource types to the effective short name
2639    /// for the resource. This is used when otherwise resource
2640    /// named from different services would cause naming collisions.
2641    /// Example entry:
2642    /// "datalabeling.googleapis.com/Dataset": "DataLabelingDataset"
2643    pub renamed_resources: std::collections::HashMap<std::string::String, std::string::String>,
2644
2645    /// List of full resource types to ignore during generation.
2646    /// This is typically used for API-specific Location resources,
2647    /// which should be handled by the generator as if they were actually
2648    /// the common Location resources.
2649    /// Example entry: "documentai.googleapis.com/Location"
2650    pub ignored_resources: std::vec::Vec<std::string::String>,
2651
2652    /// Namespaces which must be aliased in snippets due to
2653    /// a known (but non-generator-predictable) naming collision
2654    pub forced_namespace_aliases: std::vec::Vec<std::string::String>,
2655
2656    /// Method signatures (in the form "service.method(signature)")
2657    /// which are provided separately, so shouldn't be generated.
2658    /// Snippets *calling* these methods are still generated, however.
2659    pub handwritten_signatures: std::vec::Vec<std::string::String>,
2660
2661    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2662}
2663
2664impl DotnetSettings {
2665    pub fn new() -> Self {
2666        std::default::Default::default()
2667    }
2668
2669    /// Sets the value of [common][crate::model::DotnetSettings::common].
2670    ///
2671    /// # Example
2672    /// ```ignore,no_run
2673    /// # use google_cloud_api::model::DotnetSettings;
2674    /// use google_cloud_api::model::CommonLanguageSettings;
2675    /// let x = DotnetSettings::new().set_common(CommonLanguageSettings::default()/* use setters */);
2676    /// ```
2677    pub fn set_common<T>(mut self, v: T) -> Self
2678    where
2679        T: std::convert::Into<crate::model::CommonLanguageSettings>,
2680    {
2681        self.common = std::option::Option::Some(v.into());
2682        self
2683    }
2684
2685    /// Sets or clears the value of [common][crate::model::DotnetSettings::common].
2686    ///
2687    /// # Example
2688    /// ```ignore,no_run
2689    /// # use google_cloud_api::model::DotnetSettings;
2690    /// use google_cloud_api::model::CommonLanguageSettings;
2691    /// let x = DotnetSettings::new().set_or_clear_common(Some(CommonLanguageSettings::default()/* use setters */));
2692    /// let x = DotnetSettings::new().set_or_clear_common(None::<CommonLanguageSettings>);
2693    /// ```
2694    pub fn set_or_clear_common<T>(mut self, v: std::option::Option<T>) -> Self
2695    where
2696        T: std::convert::Into<crate::model::CommonLanguageSettings>,
2697    {
2698        self.common = v.map(|x| x.into());
2699        self
2700    }
2701
2702    /// Sets the value of [renamed_services][crate::model::DotnetSettings::renamed_services].
2703    ///
2704    /// # Example
2705    /// ```ignore,no_run
2706    /// # use google_cloud_api::model::DotnetSettings;
2707    /// let x = DotnetSettings::new().set_renamed_services([
2708    ///     ("key0", "abc"),
2709    ///     ("key1", "xyz"),
2710    /// ]);
2711    /// ```
2712    pub fn set_renamed_services<T, K, V>(mut self, v: T) -> Self
2713    where
2714        T: std::iter::IntoIterator<Item = (K, V)>,
2715        K: std::convert::Into<std::string::String>,
2716        V: std::convert::Into<std::string::String>,
2717    {
2718        use std::iter::Iterator;
2719        self.renamed_services = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2720        self
2721    }
2722
2723    /// Sets the value of [renamed_resources][crate::model::DotnetSettings::renamed_resources].
2724    ///
2725    /// # Example
2726    /// ```ignore,no_run
2727    /// # use google_cloud_api::model::DotnetSettings;
2728    /// let x = DotnetSettings::new().set_renamed_resources([
2729    ///     ("key0", "abc"),
2730    ///     ("key1", "xyz"),
2731    /// ]);
2732    /// ```
2733    pub fn set_renamed_resources<T, K, V>(mut self, v: T) -> Self
2734    where
2735        T: std::iter::IntoIterator<Item = (K, V)>,
2736        K: std::convert::Into<std::string::String>,
2737        V: std::convert::Into<std::string::String>,
2738    {
2739        use std::iter::Iterator;
2740        self.renamed_resources = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2741        self
2742    }
2743
2744    /// Sets the value of [ignored_resources][crate::model::DotnetSettings::ignored_resources].
2745    ///
2746    /// # Example
2747    /// ```ignore,no_run
2748    /// # use google_cloud_api::model::DotnetSettings;
2749    /// let x = DotnetSettings::new().set_ignored_resources(["a", "b", "c"]);
2750    /// ```
2751    pub fn set_ignored_resources<T, V>(mut self, v: T) -> Self
2752    where
2753        T: std::iter::IntoIterator<Item = V>,
2754        V: std::convert::Into<std::string::String>,
2755    {
2756        use std::iter::Iterator;
2757        self.ignored_resources = v.into_iter().map(|i| i.into()).collect();
2758        self
2759    }
2760
2761    /// Sets the value of [forced_namespace_aliases][crate::model::DotnetSettings::forced_namespace_aliases].
2762    ///
2763    /// # Example
2764    /// ```ignore,no_run
2765    /// # use google_cloud_api::model::DotnetSettings;
2766    /// let x = DotnetSettings::new().set_forced_namespace_aliases(["a", "b", "c"]);
2767    /// ```
2768    pub fn set_forced_namespace_aliases<T, V>(mut self, v: T) -> Self
2769    where
2770        T: std::iter::IntoIterator<Item = V>,
2771        V: std::convert::Into<std::string::String>,
2772    {
2773        use std::iter::Iterator;
2774        self.forced_namespace_aliases = v.into_iter().map(|i| i.into()).collect();
2775        self
2776    }
2777
2778    /// Sets the value of [handwritten_signatures][crate::model::DotnetSettings::handwritten_signatures].
2779    ///
2780    /// # Example
2781    /// ```ignore,no_run
2782    /// # use google_cloud_api::model::DotnetSettings;
2783    /// let x = DotnetSettings::new().set_handwritten_signatures(["a", "b", "c"]);
2784    /// ```
2785    pub fn set_handwritten_signatures<T, V>(mut self, v: T) -> Self
2786    where
2787        T: std::iter::IntoIterator<Item = V>,
2788        V: std::convert::Into<std::string::String>,
2789    {
2790        use std::iter::Iterator;
2791        self.handwritten_signatures = v.into_iter().map(|i| i.into()).collect();
2792        self
2793    }
2794}
2795
2796impl wkt::message::Message for DotnetSettings {
2797    fn typename() -> &'static str {
2798        "type.googleapis.com/google.api.DotnetSettings"
2799    }
2800}
2801
2802/// Settings for Ruby client libraries.
2803#[derive(Clone, Default, PartialEq)]
2804#[non_exhaustive]
2805pub struct RubySettings {
2806    /// Some settings.
2807    pub common: std::option::Option<crate::model::CommonLanguageSettings>,
2808
2809    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2810}
2811
2812impl RubySettings {
2813    pub fn new() -> Self {
2814        std::default::Default::default()
2815    }
2816
2817    /// Sets the value of [common][crate::model::RubySettings::common].
2818    ///
2819    /// # Example
2820    /// ```ignore,no_run
2821    /// # use google_cloud_api::model::RubySettings;
2822    /// use google_cloud_api::model::CommonLanguageSettings;
2823    /// let x = RubySettings::new().set_common(CommonLanguageSettings::default()/* use setters */);
2824    /// ```
2825    pub fn set_common<T>(mut self, v: T) -> Self
2826    where
2827        T: std::convert::Into<crate::model::CommonLanguageSettings>,
2828    {
2829        self.common = std::option::Option::Some(v.into());
2830        self
2831    }
2832
2833    /// Sets or clears the value of [common][crate::model::RubySettings::common].
2834    ///
2835    /// # Example
2836    /// ```ignore,no_run
2837    /// # use google_cloud_api::model::RubySettings;
2838    /// use google_cloud_api::model::CommonLanguageSettings;
2839    /// let x = RubySettings::new().set_or_clear_common(Some(CommonLanguageSettings::default()/* use setters */));
2840    /// let x = RubySettings::new().set_or_clear_common(None::<CommonLanguageSettings>);
2841    /// ```
2842    pub fn set_or_clear_common<T>(mut self, v: std::option::Option<T>) -> Self
2843    where
2844        T: std::convert::Into<crate::model::CommonLanguageSettings>,
2845    {
2846        self.common = v.map(|x| x.into());
2847        self
2848    }
2849}
2850
2851impl wkt::message::Message for RubySettings {
2852    fn typename() -> &'static str {
2853        "type.googleapis.com/google.api.RubySettings"
2854    }
2855}
2856
2857/// Settings for Go client libraries.
2858#[derive(Clone, Default, PartialEq)]
2859#[non_exhaustive]
2860pub struct GoSettings {
2861    /// Some settings.
2862    pub common: std::option::Option<crate::model::CommonLanguageSettings>,
2863
2864    /// Map of service names to renamed services. Keys are the package relative
2865    /// service names and values are the name to be used for the service client
2866    /// and call options.
2867    ///
2868    /// publishing:
2869    /// go_settings:
2870    /// renamed_services:
2871    /// Publisher: TopicAdmin
2872    pub renamed_services: std::collections::HashMap<std::string::String, std::string::String>,
2873
2874    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2875}
2876
2877impl GoSettings {
2878    pub fn new() -> Self {
2879        std::default::Default::default()
2880    }
2881
2882    /// Sets the value of [common][crate::model::GoSettings::common].
2883    ///
2884    /// # Example
2885    /// ```ignore,no_run
2886    /// # use google_cloud_api::model::GoSettings;
2887    /// use google_cloud_api::model::CommonLanguageSettings;
2888    /// let x = GoSettings::new().set_common(CommonLanguageSettings::default()/* use setters */);
2889    /// ```
2890    pub fn set_common<T>(mut self, v: T) -> Self
2891    where
2892        T: std::convert::Into<crate::model::CommonLanguageSettings>,
2893    {
2894        self.common = std::option::Option::Some(v.into());
2895        self
2896    }
2897
2898    /// Sets or clears the value of [common][crate::model::GoSettings::common].
2899    ///
2900    /// # Example
2901    /// ```ignore,no_run
2902    /// # use google_cloud_api::model::GoSettings;
2903    /// use google_cloud_api::model::CommonLanguageSettings;
2904    /// let x = GoSettings::new().set_or_clear_common(Some(CommonLanguageSettings::default()/* use setters */));
2905    /// let x = GoSettings::new().set_or_clear_common(None::<CommonLanguageSettings>);
2906    /// ```
2907    pub fn set_or_clear_common<T>(mut self, v: std::option::Option<T>) -> Self
2908    where
2909        T: std::convert::Into<crate::model::CommonLanguageSettings>,
2910    {
2911        self.common = v.map(|x| x.into());
2912        self
2913    }
2914
2915    /// Sets the value of [renamed_services][crate::model::GoSettings::renamed_services].
2916    ///
2917    /// # Example
2918    /// ```ignore,no_run
2919    /// # use google_cloud_api::model::GoSettings;
2920    /// let x = GoSettings::new().set_renamed_services([
2921    ///     ("key0", "abc"),
2922    ///     ("key1", "xyz"),
2923    /// ]);
2924    /// ```
2925    pub fn set_renamed_services<T, K, V>(mut self, v: T) -> Self
2926    where
2927        T: std::iter::IntoIterator<Item = (K, V)>,
2928        K: std::convert::Into<std::string::String>,
2929        V: std::convert::Into<std::string::String>,
2930    {
2931        use std::iter::Iterator;
2932        self.renamed_services = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2933        self
2934    }
2935}
2936
2937impl wkt::message::Message for GoSettings {
2938    fn typename() -> &'static str {
2939        "type.googleapis.com/google.api.GoSettings"
2940    }
2941}
2942
2943/// Describes the generator configuration for a method.
2944#[derive(Clone, Default, PartialEq)]
2945#[non_exhaustive]
2946pub struct MethodSettings {
2947    /// The fully qualified name of the method, for which the options below apply.
2948    /// This is used to find the method to apply the options.
2949    ///
2950    /// Example:
2951    ///
2952    /// ```norust
2953    /// publishing:
2954    ///   method_settings:
2955    ///   - selector: google.storage.control.v2.StorageControl.CreateFolder
2956    ///     # method settings for CreateFolder...
2957    /// ```
2958    pub selector: std::string::String,
2959
2960    /// Describes settings to use for long-running operations when generating
2961    /// API methods for RPCs. Complements RPCs that use the annotations in
2962    /// google/longrunning/operations.proto.
2963    ///
2964    /// Example of a YAML configuration::
2965    ///
2966    /// ```norust
2967    /// publishing:
2968    ///   method_settings:
2969    ///   - selector: google.cloud.speech.v2.Speech.BatchRecognize
2970    ///     long_running:
2971    ///       initial_poll_delay: 60s # 1 minute
2972    ///       poll_delay_multiplier: 1.5
2973    ///       max_poll_delay: 360s # 6 minutes
2974    ///       total_poll_timeout: 54000s # 90 minutes
2975    /// ```
2976    pub long_running: std::option::Option<crate::model::method_settings::LongRunning>,
2977
2978    /// List of top-level fields of the request message, that should be
2979    /// automatically populated by the client libraries based on their
2980    /// (google.api.field_info).format. Currently supported format: UUID4.
2981    ///
2982    /// Example of a YAML configuration:
2983    ///
2984    /// ```norust
2985    /// publishing:
2986    ///   method_settings:
2987    ///   - selector: google.example.v1.ExampleService.CreateExample
2988    ///     auto_populated_fields:
2989    ///     - request_id
2990    /// ```
2991    pub auto_populated_fields: std::vec::Vec<std::string::String>,
2992
2993    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2994}
2995
2996impl MethodSettings {
2997    pub fn new() -> Self {
2998        std::default::Default::default()
2999    }
3000
3001    /// Sets the value of [selector][crate::model::MethodSettings::selector].
3002    ///
3003    /// # Example
3004    /// ```ignore,no_run
3005    /// # use google_cloud_api::model::MethodSettings;
3006    /// let x = MethodSettings::new().set_selector("example");
3007    /// ```
3008    pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3009        self.selector = v.into();
3010        self
3011    }
3012
3013    /// Sets the value of [long_running][crate::model::MethodSettings::long_running].
3014    ///
3015    /// # Example
3016    /// ```ignore,no_run
3017    /// # use google_cloud_api::model::MethodSettings;
3018    /// use google_cloud_api::model::method_settings::LongRunning;
3019    /// let x = MethodSettings::new().set_long_running(LongRunning::default()/* use setters */);
3020    /// ```
3021    pub fn set_long_running<T>(mut self, v: T) -> Self
3022    where
3023        T: std::convert::Into<crate::model::method_settings::LongRunning>,
3024    {
3025        self.long_running = std::option::Option::Some(v.into());
3026        self
3027    }
3028
3029    /// Sets or clears the value of [long_running][crate::model::MethodSettings::long_running].
3030    ///
3031    /// # Example
3032    /// ```ignore,no_run
3033    /// # use google_cloud_api::model::MethodSettings;
3034    /// use google_cloud_api::model::method_settings::LongRunning;
3035    /// let x = MethodSettings::new().set_or_clear_long_running(Some(LongRunning::default()/* use setters */));
3036    /// let x = MethodSettings::new().set_or_clear_long_running(None::<LongRunning>);
3037    /// ```
3038    pub fn set_or_clear_long_running<T>(mut self, v: std::option::Option<T>) -> Self
3039    where
3040        T: std::convert::Into<crate::model::method_settings::LongRunning>,
3041    {
3042        self.long_running = v.map(|x| x.into());
3043        self
3044    }
3045
3046    /// Sets the value of [auto_populated_fields][crate::model::MethodSettings::auto_populated_fields].
3047    ///
3048    /// # Example
3049    /// ```ignore,no_run
3050    /// # use google_cloud_api::model::MethodSettings;
3051    /// let x = MethodSettings::new().set_auto_populated_fields(["a", "b", "c"]);
3052    /// ```
3053    pub fn set_auto_populated_fields<T, V>(mut self, v: T) -> Self
3054    where
3055        T: std::iter::IntoIterator<Item = V>,
3056        V: std::convert::Into<std::string::String>,
3057    {
3058        use std::iter::Iterator;
3059        self.auto_populated_fields = v.into_iter().map(|i| i.into()).collect();
3060        self
3061    }
3062}
3063
3064impl wkt::message::Message for MethodSettings {
3065    fn typename() -> &'static str {
3066        "type.googleapis.com/google.api.MethodSettings"
3067    }
3068}
3069
3070/// Defines additional types related to [MethodSettings].
3071pub mod method_settings {
3072    #[allow(unused_imports)]
3073    use super::*;
3074
3075    /// Describes settings to use when generating API methods that use the
3076    /// long-running operation pattern.
3077    /// All default values below are from those used in the client library
3078    /// generators (e.g.
3079    /// [Java](https://github.com/googleapis/gapic-generator-java/blob/04c2faa191a9b5a10b92392fe8482279c4404803/src/main/java/com/google/api/generator/gapic/composer/common/RetrySettingsComposer.java)).
3080    #[derive(Clone, Default, PartialEq)]
3081    #[non_exhaustive]
3082    pub struct LongRunning {
3083        /// Initial delay after which the first poll request will be made.
3084        /// Default value: 5 seconds.
3085        pub initial_poll_delay: std::option::Option<wkt::Duration>,
3086
3087        /// Multiplier to gradually increase delay between subsequent polls until it
3088        /// reaches max_poll_delay.
3089        /// Default value: 1.5.
3090        pub poll_delay_multiplier: f32,
3091
3092        /// Maximum time between two subsequent poll requests.
3093        /// Default value: 45 seconds.
3094        pub max_poll_delay: std::option::Option<wkt::Duration>,
3095
3096        /// Total polling timeout.
3097        /// Default value: 5 minutes.
3098        pub total_poll_timeout: std::option::Option<wkt::Duration>,
3099
3100        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3101    }
3102
3103    impl LongRunning {
3104        pub fn new() -> Self {
3105            std::default::Default::default()
3106        }
3107
3108        /// Sets the value of [initial_poll_delay][crate::model::method_settings::LongRunning::initial_poll_delay].
3109        ///
3110        /// # Example
3111        /// ```ignore,no_run
3112        /// # use google_cloud_api::model::method_settings::LongRunning;
3113        /// use wkt::Duration;
3114        /// let x = LongRunning::new().set_initial_poll_delay(Duration::default()/* use setters */);
3115        /// ```
3116        pub fn set_initial_poll_delay<T>(mut self, v: T) -> Self
3117        where
3118            T: std::convert::Into<wkt::Duration>,
3119        {
3120            self.initial_poll_delay = std::option::Option::Some(v.into());
3121            self
3122        }
3123
3124        /// Sets or clears the value of [initial_poll_delay][crate::model::method_settings::LongRunning::initial_poll_delay].
3125        ///
3126        /// # Example
3127        /// ```ignore,no_run
3128        /// # use google_cloud_api::model::method_settings::LongRunning;
3129        /// use wkt::Duration;
3130        /// let x = LongRunning::new().set_or_clear_initial_poll_delay(Some(Duration::default()/* use setters */));
3131        /// let x = LongRunning::new().set_or_clear_initial_poll_delay(None::<Duration>);
3132        /// ```
3133        pub fn set_or_clear_initial_poll_delay<T>(mut self, v: std::option::Option<T>) -> Self
3134        where
3135            T: std::convert::Into<wkt::Duration>,
3136        {
3137            self.initial_poll_delay = v.map(|x| x.into());
3138            self
3139        }
3140
3141        /// Sets the value of [poll_delay_multiplier][crate::model::method_settings::LongRunning::poll_delay_multiplier].
3142        ///
3143        /// # Example
3144        /// ```ignore,no_run
3145        /// # use google_cloud_api::model::method_settings::LongRunning;
3146        /// let x = LongRunning::new().set_poll_delay_multiplier(42.0);
3147        /// ```
3148        pub fn set_poll_delay_multiplier<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
3149            self.poll_delay_multiplier = v.into();
3150            self
3151        }
3152
3153        /// Sets the value of [max_poll_delay][crate::model::method_settings::LongRunning::max_poll_delay].
3154        ///
3155        /// # Example
3156        /// ```ignore,no_run
3157        /// # use google_cloud_api::model::method_settings::LongRunning;
3158        /// use wkt::Duration;
3159        /// let x = LongRunning::new().set_max_poll_delay(Duration::default()/* use setters */);
3160        /// ```
3161        pub fn set_max_poll_delay<T>(mut self, v: T) -> Self
3162        where
3163            T: std::convert::Into<wkt::Duration>,
3164        {
3165            self.max_poll_delay = std::option::Option::Some(v.into());
3166            self
3167        }
3168
3169        /// Sets or clears the value of [max_poll_delay][crate::model::method_settings::LongRunning::max_poll_delay].
3170        ///
3171        /// # Example
3172        /// ```ignore,no_run
3173        /// # use google_cloud_api::model::method_settings::LongRunning;
3174        /// use wkt::Duration;
3175        /// let x = LongRunning::new().set_or_clear_max_poll_delay(Some(Duration::default()/* use setters */));
3176        /// let x = LongRunning::new().set_or_clear_max_poll_delay(None::<Duration>);
3177        /// ```
3178        pub fn set_or_clear_max_poll_delay<T>(mut self, v: std::option::Option<T>) -> Self
3179        where
3180            T: std::convert::Into<wkt::Duration>,
3181        {
3182            self.max_poll_delay = v.map(|x| x.into());
3183            self
3184        }
3185
3186        /// Sets the value of [total_poll_timeout][crate::model::method_settings::LongRunning::total_poll_timeout].
3187        ///
3188        /// # Example
3189        /// ```ignore,no_run
3190        /// # use google_cloud_api::model::method_settings::LongRunning;
3191        /// use wkt::Duration;
3192        /// let x = LongRunning::new().set_total_poll_timeout(Duration::default()/* use setters */);
3193        /// ```
3194        pub fn set_total_poll_timeout<T>(mut self, v: T) -> Self
3195        where
3196            T: std::convert::Into<wkt::Duration>,
3197        {
3198            self.total_poll_timeout = std::option::Option::Some(v.into());
3199            self
3200        }
3201
3202        /// Sets or clears the value of [total_poll_timeout][crate::model::method_settings::LongRunning::total_poll_timeout].
3203        ///
3204        /// # Example
3205        /// ```ignore,no_run
3206        /// # use google_cloud_api::model::method_settings::LongRunning;
3207        /// use wkt::Duration;
3208        /// let x = LongRunning::new().set_or_clear_total_poll_timeout(Some(Duration::default()/* use setters */));
3209        /// let x = LongRunning::new().set_or_clear_total_poll_timeout(None::<Duration>);
3210        /// ```
3211        pub fn set_or_clear_total_poll_timeout<T>(mut self, v: std::option::Option<T>) -> Self
3212        where
3213            T: std::convert::Into<wkt::Duration>,
3214        {
3215            self.total_poll_timeout = v.map(|x| x.into());
3216            self
3217        }
3218    }
3219
3220    impl wkt::message::Message for LongRunning {
3221        fn typename() -> &'static str {
3222            "type.googleapis.com/google.api.MethodSettings.LongRunning"
3223        }
3224    }
3225}
3226
3227/// This message is used to configure the generation of a subset of the RPCs in
3228/// a service for client libraries.
3229#[derive(Clone, Default, PartialEq)]
3230#[non_exhaustive]
3231pub struct SelectiveGapicGeneration {
3232    /// An allowlist of the fully qualified names of RPCs that should be included
3233    /// on public client surfaces.
3234    pub methods: std::vec::Vec<std::string::String>,
3235
3236    /// Setting this to true indicates to the client generators that methods
3237    /// that would be excluded from the generation should instead be generated
3238    /// in a way that indicates these methods should not be consumed by
3239    /// end users. How this is expressed is up to individual language
3240    /// implementations to decide. Some examples may be: added annotations,
3241    /// obfuscated identifiers, or other language idiomatic patterns.
3242    pub generate_omitted_as_internal: bool,
3243
3244    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3245}
3246
3247impl SelectiveGapicGeneration {
3248    pub fn new() -> Self {
3249        std::default::Default::default()
3250    }
3251
3252    /// Sets the value of [methods][crate::model::SelectiveGapicGeneration::methods].
3253    ///
3254    /// # Example
3255    /// ```ignore,no_run
3256    /// # use google_cloud_api::model::SelectiveGapicGeneration;
3257    /// let x = SelectiveGapicGeneration::new().set_methods(["a", "b", "c"]);
3258    /// ```
3259    pub fn set_methods<T, V>(mut self, v: T) -> Self
3260    where
3261        T: std::iter::IntoIterator<Item = V>,
3262        V: std::convert::Into<std::string::String>,
3263    {
3264        use std::iter::Iterator;
3265        self.methods = v.into_iter().map(|i| i.into()).collect();
3266        self
3267    }
3268
3269    /// Sets the value of [generate_omitted_as_internal][crate::model::SelectiveGapicGeneration::generate_omitted_as_internal].
3270    ///
3271    /// # Example
3272    /// ```ignore,no_run
3273    /// # use google_cloud_api::model::SelectiveGapicGeneration;
3274    /// let x = SelectiveGapicGeneration::new().set_generate_omitted_as_internal(true);
3275    /// ```
3276    pub fn set_generate_omitted_as_internal<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3277        self.generate_omitted_as_internal = v.into();
3278        self
3279    }
3280}
3281
3282impl wkt::message::Message for SelectiveGapicGeneration {
3283    fn typename() -> &'static str {
3284        "type.googleapis.com/google.api.SelectiveGapicGeneration"
3285    }
3286}
3287
3288/// Output generated from semantically comparing two versions of a service
3289/// configuration.
3290///
3291/// Includes detailed information about a field that have changed with
3292/// applicable advice about potential consequences for the change, such as
3293/// backwards-incompatibility.
3294#[derive(Clone, Default, PartialEq)]
3295#[non_exhaustive]
3296pub struct ConfigChange {
3297    /// Object hierarchy path to the change, with levels separated by a '.'
3298    /// character. For repeated fields, an applicable unique identifier field is
3299    /// used for the index (usually selector, name, or id). For maps, the term
3300    /// 'key' is used. If the field has no unique identifier, the numeric index
3301    /// is used.
3302    /// Examples:
3303    ///
3304    /// - visibility.rules[selector=="google.LibraryService.ListBooks"].restriction
3305    /// - quota.metric_rules[selector=="google"].metric_costs[key=="reads"].value
3306    /// - logging.producer_destinations[0]
3307    pub element: std::string::String,
3308
3309    /// Value of the changed object in the old Service configuration,
3310    /// in JSON format. This field will not be populated if ChangeType == ADDED.
3311    pub old_value: std::string::String,
3312
3313    /// Value of the changed object in the new Service configuration,
3314    /// in JSON format. This field will not be populated if ChangeType == REMOVED.
3315    pub new_value: std::string::String,
3316
3317    /// The type for this change, either ADDED, REMOVED, or MODIFIED.
3318    pub change_type: crate::model::ChangeType,
3319
3320    /// Collection of advice provided for this change, useful for determining the
3321    /// possible impact of this change.
3322    pub advices: std::vec::Vec<crate::model::Advice>,
3323
3324    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3325}
3326
3327impl ConfigChange {
3328    pub fn new() -> Self {
3329        std::default::Default::default()
3330    }
3331
3332    /// Sets the value of [element][crate::model::ConfigChange::element].
3333    ///
3334    /// # Example
3335    /// ```ignore,no_run
3336    /// # use google_cloud_api::model::ConfigChange;
3337    /// let x = ConfigChange::new().set_element("example");
3338    /// ```
3339    pub fn set_element<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3340        self.element = v.into();
3341        self
3342    }
3343
3344    /// Sets the value of [old_value][crate::model::ConfigChange::old_value].
3345    ///
3346    /// # Example
3347    /// ```ignore,no_run
3348    /// # use google_cloud_api::model::ConfigChange;
3349    /// let x = ConfigChange::new().set_old_value("example");
3350    /// ```
3351    pub fn set_old_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3352        self.old_value = v.into();
3353        self
3354    }
3355
3356    /// Sets the value of [new_value][crate::model::ConfigChange::new_value].
3357    ///
3358    /// # Example
3359    /// ```ignore,no_run
3360    /// # use google_cloud_api::model::ConfigChange;
3361    /// let x = ConfigChange::new().set_new_value("example");
3362    /// ```
3363    pub fn set_new_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3364        self.new_value = v.into();
3365        self
3366    }
3367
3368    /// Sets the value of [change_type][crate::model::ConfigChange::change_type].
3369    ///
3370    /// # Example
3371    /// ```ignore,no_run
3372    /// # use google_cloud_api::model::ConfigChange;
3373    /// use google_cloud_api::model::ChangeType;
3374    /// let x0 = ConfigChange::new().set_change_type(ChangeType::Added);
3375    /// let x1 = ConfigChange::new().set_change_type(ChangeType::Removed);
3376    /// let x2 = ConfigChange::new().set_change_type(ChangeType::Modified);
3377    /// ```
3378    pub fn set_change_type<T: std::convert::Into<crate::model::ChangeType>>(
3379        mut self,
3380        v: T,
3381    ) -> Self {
3382        self.change_type = v.into();
3383        self
3384    }
3385
3386    /// Sets the value of [advices][crate::model::ConfigChange::advices].
3387    ///
3388    /// # Example
3389    /// ```ignore,no_run
3390    /// # use google_cloud_api::model::ConfigChange;
3391    /// use google_cloud_api::model::Advice;
3392    /// let x = ConfigChange::new()
3393    ///     .set_advices([
3394    ///         Advice::default()/* use setters */,
3395    ///         Advice::default()/* use (different) setters */,
3396    ///     ]);
3397    /// ```
3398    pub fn set_advices<T, V>(mut self, v: T) -> Self
3399    where
3400        T: std::iter::IntoIterator<Item = V>,
3401        V: std::convert::Into<crate::model::Advice>,
3402    {
3403        use std::iter::Iterator;
3404        self.advices = v.into_iter().map(|i| i.into()).collect();
3405        self
3406    }
3407}
3408
3409impl wkt::message::Message for ConfigChange {
3410    fn typename() -> &'static str {
3411        "type.googleapis.com/google.api.ConfigChange"
3412    }
3413}
3414
3415/// Generated advice about this change, used for providing more
3416/// information about how a change will affect the existing service.
3417#[derive(Clone, Default, PartialEq)]
3418#[non_exhaustive]
3419pub struct Advice {
3420    /// Useful description for why this advice was applied and what actions should
3421    /// be taken to mitigate any implied risks.
3422    pub description: std::string::String,
3423
3424    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3425}
3426
3427impl Advice {
3428    pub fn new() -> Self {
3429        std::default::Default::default()
3430    }
3431
3432    /// Sets the value of [description][crate::model::Advice::description].
3433    ///
3434    /// # Example
3435    /// ```ignore,no_run
3436    /// # use google_cloud_api::model::Advice;
3437    /// let x = Advice::new().set_description("example");
3438    /// ```
3439    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3440        self.description = v.into();
3441        self
3442    }
3443}
3444
3445impl wkt::message::Message for Advice {
3446    fn typename() -> &'static str {
3447        "type.googleapis.com/google.api.Advice"
3448    }
3449}
3450
3451/// A descriptor for defining project properties for a service. One service may
3452/// have many consumer projects, and the service may want to behave differently
3453/// depending on some properties on the project. For example, a project may be
3454/// associated with a school, or a business, or a government agency, a business
3455/// type property on the project may affect how a service responds to the client.
3456/// This descriptor defines which properties are allowed to be set on a project.
3457///
3458/// Example:
3459///
3460/// ```norust
3461/// project_properties:
3462///   properties:
3463///   - name: NO_WATERMARK
3464///     type: BOOL
3465///     description: Allows usage of the API without watermarks.
3466///   - name: EXTENDED_TILE_CACHE_PERIOD
3467///     type: INT64
3468/// ```
3469#[derive(Clone, Default, PartialEq)]
3470#[non_exhaustive]
3471pub struct ProjectProperties {
3472    /// List of per consumer project-specific properties.
3473    pub properties: std::vec::Vec<crate::model::Property>,
3474
3475    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3476}
3477
3478impl ProjectProperties {
3479    pub fn new() -> Self {
3480        std::default::Default::default()
3481    }
3482
3483    /// Sets the value of [properties][crate::model::ProjectProperties::properties].
3484    ///
3485    /// # Example
3486    /// ```ignore,no_run
3487    /// # use google_cloud_api::model::ProjectProperties;
3488    /// use google_cloud_api::model::Property;
3489    /// let x = ProjectProperties::new()
3490    ///     .set_properties([
3491    ///         Property::default()/* use setters */,
3492    ///         Property::default()/* use (different) setters */,
3493    ///     ]);
3494    /// ```
3495    pub fn set_properties<T, V>(mut self, v: T) -> Self
3496    where
3497        T: std::iter::IntoIterator<Item = V>,
3498        V: std::convert::Into<crate::model::Property>,
3499    {
3500        use std::iter::Iterator;
3501        self.properties = v.into_iter().map(|i| i.into()).collect();
3502        self
3503    }
3504}
3505
3506impl wkt::message::Message for ProjectProperties {
3507    fn typename() -> &'static str {
3508        "type.googleapis.com/google.api.ProjectProperties"
3509    }
3510}
3511
3512/// Defines project properties.
3513///
3514/// API services can define properties that can be assigned to consumer projects
3515/// so that backends can perform response customization without having to make
3516/// additional calls or maintain additional storage. For example, Maps API
3517/// defines properties that controls map tile cache period, or whether to embed a
3518/// watermark in a result.
3519///
3520/// These values can be set via API producer console. Only API providers can
3521/// define and set these properties.
3522#[derive(Clone, Default, PartialEq)]
3523#[non_exhaustive]
3524pub struct Property {
3525    /// The name of the property (a.k.a key).
3526    pub name: std::string::String,
3527
3528    /// The type of this property.
3529    pub r#type: crate::model::property::PropertyType,
3530
3531    /// The description of the property
3532    pub description: std::string::String,
3533
3534    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3535}
3536
3537impl Property {
3538    pub fn new() -> Self {
3539        std::default::Default::default()
3540    }
3541
3542    /// Sets the value of [name][crate::model::Property::name].
3543    ///
3544    /// # Example
3545    /// ```ignore,no_run
3546    /// # use google_cloud_api::model::Property;
3547    /// let x = Property::new().set_name("example");
3548    /// ```
3549    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3550        self.name = v.into();
3551        self
3552    }
3553
3554    /// Sets the value of [r#type][crate::model::Property::type].
3555    ///
3556    /// # Example
3557    /// ```ignore,no_run
3558    /// # use google_cloud_api::model::Property;
3559    /// use google_cloud_api::model::property::PropertyType;
3560    /// let x0 = Property::new().set_type(PropertyType::Int64);
3561    /// let x1 = Property::new().set_type(PropertyType::Bool);
3562    /// let x2 = Property::new().set_type(PropertyType::String);
3563    /// ```
3564    pub fn set_type<T: std::convert::Into<crate::model::property::PropertyType>>(
3565        mut self,
3566        v: T,
3567    ) -> Self {
3568        self.r#type = v.into();
3569        self
3570    }
3571
3572    /// Sets the value of [description][crate::model::Property::description].
3573    ///
3574    /// # Example
3575    /// ```ignore,no_run
3576    /// # use google_cloud_api::model::Property;
3577    /// let x = Property::new().set_description("example");
3578    /// ```
3579    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3580        self.description = v.into();
3581        self
3582    }
3583}
3584
3585impl wkt::message::Message for Property {
3586    fn typename() -> &'static str {
3587        "type.googleapis.com/google.api.Property"
3588    }
3589}
3590
3591/// Defines additional types related to [Property].
3592pub mod property {
3593    #[allow(unused_imports)]
3594    use super::*;
3595
3596    /// Supported data type of the property values
3597    ///
3598    /// # Working with unknown values
3599    ///
3600    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3601    /// additional enum variants at any time. Adding new variants is not considered
3602    /// a breaking change. Applications should write their code in anticipation of:
3603    ///
3604    /// - New values appearing in future releases of the client library, **and**
3605    /// - New values received dynamically, without application changes.
3606    ///
3607    /// Please consult the [Working with enums] section in the user guide for some
3608    /// guidelines.
3609    ///
3610    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3611    #[derive(Clone, Debug, PartialEq)]
3612    #[non_exhaustive]
3613    pub enum PropertyType {
3614        /// The type is unspecified, and will result in an error.
3615        Unspecified,
3616        /// The type is `int64`.
3617        Int64,
3618        /// The type is `bool`.
3619        Bool,
3620        /// The type is `string`.
3621        String,
3622        /// The type is 'double'.
3623        Double,
3624        /// If set, the enum was initialized with an unknown value.
3625        ///
3626        /// Applications can examine the value using [PropertyType::value] or
3627        /// [PropertyType::name].
3628        UnknownValue(property_type::UnknownValue),
3629    }
3630
3631    #[doc(hidden)]
3632    pub mod property_type {
3633        #[allow(unused_imports)]
3634        use super::*;
3635        #[derive(Clone, Debug, PartialEq)]
3636        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3637    }
3638
3639    impl PropertyType {
3640        /// Gets the enum value.
3641        ///
3642        /// Returns `None` if the enum contains an unknown value deserialized from
3643        /// the string representation of enums.
3644        pub fn value(&self) -> std::option::Option<i32> {
3645            match self {
3646                Self::Unspecified => std::option::Option::Some(0),
3647                Self::Int64 => std::option::Option::Some(1),
3648                Self::Bool => std::option::Option::Some(2),
3649                Self::String => std::option::Option::Some(3),
3650                Self::Double => std::option::Option::Some(4),
3651                Self::UnknownValue(u) => u.0.value(),
3652            }
3653        }
3654
3655        /// Gets the enum value as a string.
3656        ///
3657        /// Returns `None` if the enum contains an unknown value deserialized from
3658        /// the integer representation of enums.
3659        pub fn name(&self) -> std::option::Option<&str> {
3660            match self {
3661                Self::Unspecified => std::option::Option::Some("UNSPECIFIED"),
3662                Self::Int64 => std::option::Option::Some("INT64"),
3663                Self::Bool => std::option::Option::Some("BOOL"),
3664                Self::String => std::option::Option::Some("STRING"),
3665                Self::Double => std::option::Option::Some("DOUBLE"),
3666                Self::UnknownValue(u) => u.0.name(),
3667            }
3668        }
3669    }
3670
3671    impl std::default::Default for PropertyType {
3672        fn default() -> Self {
3673            use std::convert::From;
3674            Self::from(0)
3675        }
3676    }
3677
3678    impl std::fmt::Display for PropertyType {
3679        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3680            wkt::internal::display_enum(f, self.name(), self.value())
3681        }
3682    }
3683
3684    impl std::convert::From<i32> for PropertyType {
3685        fn from(value: i32) -> Self {
3686            match value {
3687                0 => Self::Unspecified,
3688                1 => Self::Int64,
3689                2 => Self::Bool,
3690                3 => Self::String,
3691                4 => Self::Double,
3692                _ => Self::UnknownValue(property_type::UnknownValue(
3693                    wkt::internal::UnknownEnumValue::Integer(value),
3694                )),
3695            }
3696        }
3697    }
3698
3699    impl std::convert::From<&str> for PropertyType {
3700        fn from(value: &str) -> Self {
3701            use std::string::ToString;
3702            match value {
3703                "UNSPECIFIED" => Self::Unspecified,
3704                "INT64" => Self::Int64,
3705                "BOOL" => Self::Bool,
3706                "STRING" => Self::String,
3707                "DOUBLE" => Self::Double,
3708                _ => Self::UnknownValue(property_type::UnknownValue(
3709                    wkt::internal::UnknownEnumValue::String(value.to_string()),
3710                )),
3711            }
3712        }
3713    }
3714
3715    impl serde::ser::Serialize for PropertyType {
3716        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3717        where
3718            S: serde::Serializer,
3719        {
3720            match self {
3721                Self::Unspecified => serializer.serialize_i32(0),
3722                Self::Int64 => serializer.serialize_i32(1),
3723                Self::Bool => serializer.serialize_i32(2),
3724                Self::String => serializer.serialize_i32(3),
3725                Self::Double => serializer.serialize_i32(4),
3726                Self::UnknownValue(u) => u.0.serialize(serializer),
3727            }
3728        }
3729    }
3730
3731    impl<'de> serde::de::Deserialize<'de> for PropertyType {
3732        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3733        where
3734            D: serde::Deserializer<'de>,
3735        {
3736            deserializer.deserialize_any(wkt::internal::EnumVisitor::<PropertyType>::new(
3737                ".google.api.Property.PropertyType",
3738            ))
3739        }
3740    }
3741}
3742
3743/// `Context` defines which contexts an API requests.
3744///
3745/// Example:
3746///
3747/// ```norust
3748/// context:
3749///   rules:
3750///   - selector: "*"
3751///     requested:
3752///     - google.rpc.context.ProjectContext
3753///     - google.rpc.context.OriginContext
3754/// ```
3755///
3756/// The above specifies that all methods in the API request
3757/// `google.rpc.context.ProjectContext` and
3758/// `google.rpc.context.OriginContext`.
3759///
3760/// Available context types are defined in package
3761/// `google.rpc.context`.
3762///
3763/// This also provides mechanism to allowlist any protobuf message extension that
3764/// can be sent in grpc metadata using “x-goog-ext-<extension_id>-bin” and
3765/// “x-goog-ext-<extension_id>-jspb” format. For example, list any service
3766/// specific protobuf types that can appear in grpc metadata as follows in your
3767/// yaml file:
3768///
3769/// Example:
3770///
3771/// ```norust
3772/// context:
3773///   rules:
3774///    - selector: "google.example.library.v1.LibraryService.CreateBook"
3775///      allowed_request_extensions:
3776///      - google.foo.v1.NewExtension
3777///      allowed_response_extensions:
3778///      - google.foo.v1.NewExtension
3779/// ```
3780///
3781/// You can also specify extension ID instead of fully qualified extension name
3782/// here.
3783#[derive(Clone, Default, PartialEq)]
3784#[non_exhaustive]
3785pub struct Context {
3786    /// A list of RPC context rules that apply to individual API methods.
3787    ///
3788    /// **NOTE:** All service configuration rules follow "last one wins" order.
3789    pub rules: std::vec::Vec<crate::model::ContextRule>,
3790
3791    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3792}
3793
3794impl Context {
3795    pub fn new() -> Self {
3796        std::default::Default::default()
3797    }
3798
3799    /// Sets the value of [rules][crate::model::Context::rules].
3800    ///
3801    /// # Example
3802    /// ```ignore,no_run
3803    /// # use google_cloud_api::model::Context;
3804    /// use google_cloud_api::model::ContextRule;
3805    /// let x = Context::new()
3806    ///     .set_rules([
3807    ///         ContextRule::default()/* use setters */,
3808    ///         ContextRule::default()/* use (different) setters */,
3809    ///     ]);
3810    /// ```
3811    pub fn set_rules<T, V>(mut self, v: T) -> Self
3812    where
3813        T: std::iter::IntoIterator<Item = V>,
3814        V: std::convert::Into<crate::model::ContextRule>,
3815    {
3816        use std::iter::Iterator;
3817        self.rules = v.into_iter().map(|i| i.into()).collect();
3818        self
3819    }
3820}
3821
3822impl wkt::message::Message for Context {
3823    fn typename() -> &'static str {
3824        "type.googleapis.com/google.api.Context"
3825    }
3826}
3827
3828/// A context rule provides information about the context for an individual API
3829/// element.
3830#[derive(Clone, Default, PartialEq)]
3831#[non_exhaustive]
3832pub struct ContextRule {
3833    /// Selects the methods to which this rule applies.
3834    ///
3835    /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
3836    /// details.
3837    ///
3838    /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
3839    pub selector: std::string::String,
3840
3841    /// A list of full type names of requested contexts, only the requested context
3842    /// will be made available to the backend.
3843    pub requested: std::vec::Vec<std::string::String>,
3844
3845    /// A list of full type names of provided contexts. It is used to support
3846    /// propagating HTTP headers and ETags from the response extension.
3847    pub provided: std::vec::Vec<std::string::String>,
3848
3849    /// A list of full type names or extension IDs of extensions allowed in grpc
3850    /// side channel from client to backend.
3851    pub allowed_request_extensions: std::vec::Vec<std::string::String>,
3852
3853    /// A list of full type names or extension IDs of extensions allowed in grpc
3854    /// side channel from backend to client.
3855    pub allowed_response_extensions: std::vec::Vec<std::string::String>,
3856
3857    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3858}
3859
3860impl ContextRule {
3861    pub fn new() -> Self {
3862        std::default::Default::default()
3863    }
3864
3865    /// Sets the value of [selector][crate::model::ContextRule::selector].
3866    ///
3867    /// # Example
3868    /// ```ignore,no_run
3869    /// # use google_cloud_api::model::ContextRule;
3870    /// let x = ContextRule::new().set_selector("example");
3871    /// ```
3872    pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3873        self.selector = v.into();
3874        self
3875    }
3876
3877    /// Sets the value of [requested][crate::model::ContextRule::requested].
3878    ///
3879    /// # Example
3880    /// ```ignore,no_run
3881    /// # use google_cloud_api::model::ContextRule;
3882    /// let x = ContextRule::new().set_requested(["a", "b", "c"]);
3883    /// ```
3884    pub fn set_requested<T, V>(mut self, v: T) -> Self
3885    where
3886        T: std::iter::IntoIterator<Item = V>,
3887        V: std::convert::Into<std::string::String>,
3888    {
3889        use std::iter::Iterator;
3890        self.requested = v.into_iter().map(|i| i.into()).collect();
3891        self
3892    }
3893
3894    /// Sets the value of [provided][crate::model::ContextRule::provided].
3895    ///
3896    /// # Example
3897    /// ```ignore,no_run
3898    /// # use google_cloud_api::model::ContextRule;
3899    /// let x = ContextRule::new().set_provided(["a", "b", "c"]);
3900    /// ```
3901    pub fn set_provided<T, V>(mut self, v: T) -> Self
3902    where
3903        T: std::iter::IntoIterator<Item = V>,
3904        V: std::convert::Into<std::string::String>,
3905    {
3906        use std::iter::Iterator;
3907        self.provided = v.into_iter().map(|i| i.into()).collect();
3908        self
3909    }
3910
3911    /// Sets the value of [allowed_request_extensions][crate::model::ContextRule::allowed_request_extensions].
3912    ///
3913    /// # Example
3914    /// ```ignore,no_run
3915    /// # use google_cloud_api::model::ContextRule;
3916    /// let x = ContextRule::new().set_allowed_request_extensions(["a", "b", "c"]);
3917    /// ```
3918    pub fn set_allowed_request_extensions<T, V>(mut self, v: T) -> Self
3919    where
3920        T: std::iter::IntoIterator<Item = V>,
3921        V: std::convert::Into<std::string::String>,
3922    {
3923        use std::iter::Iterator;
3924        self.allowed_request_extensions = v.into_iter().map(|i| i.into()).collect();
3925        self
3926    }
3927
3928    /// Sets the value of [allowed_response_extensions][crate::model::ContextRule::allowed_response_extensions].
3929    ///
3930    /// # Example
3931    /// ```ignore,no_run
3932    /// # use google_cloud_api::model::ContextRule;
3933    /// let x = ContextRule::new().set_allowed_response_extensions(["a", "b", "c"]);
3934    /// ```
3935    pub fn set_allowed_response_extensions<T, V>(mut self, v: T) -> Self
3936    where
3937        T: std::iter::IntoIterator<Item = V>,
3938        V: std::convert::Into<std::string::String>,
3939    {
3940        use std::iter::Iterator;
3941        self.allowed_response_extensions = v.into_iter().map(|i| i.into()).collect();
3942        self
3943    }
3944}
3945
3946impl wkt::message::Message for ContextRule {
3947    fn typename() -> &'static str {
3948        "type.googleapis.com/google.api.ContextRule"
3949    }
3950}
3951
3952/// Selects and configures the service controller used by the service.
3953///
3954/// Example:
3955///
3956/// ```norust
3957/// control:
3958///   environment: servicecontrol.googleapis.com
3959/// ```
3960#[derive(Clone, Default, PartialEq)]
3961#[non_exhaustive]
3962pub struct Control {
3963    /// The service controller environment to use. If empty, no control plane
3964    /// feature (like quota and billing) will be enabled. The recommended value for
3965    /// most services is servicecontrol.googleapis.com
3966    pub environment: std::string::String,
3967
3968    /// Defines policies applying to the API methods of the service.
3969    pub method_policies: std::vec::Vec<crate::model::MethodPolicy>,
3970
3971    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3972}
3973
3974impl Control {
3975    pub fn new() -> Self {
3976        std::default::Default::default()
3977    }
3978
3979    /// Sets the value of [environment][crate::model::Control::environment].
3980    ///
3981    /// # Example
3982    /// ```ignore,no_run
3983    /// # use google_cloud_api::model::Control;
3984    /// let x = Control::new().set_environment("example");
3985    /// ```
3986    pub fn set_environment<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3987        self.environment = v.into();
3988        self
3989    }
3990
3991    /// Sets the value of [method_policies][crate::model::Control::method_policies].
3992    ///
3993    /// # Example
3994    /// ```ignore,no_run
3995    /// # use google_cloud_api::model::Control;
3996    /// use google_cloud_api::model::MethodPolicy;
3997    /// let x = Control::new()
3998    ///     .set_method_policies([
3999    ///         MethodPolicy::default()/* use setters */,
4000    ///         MethodPolicy::default()/* use (different) setters */,
4001    ///     ]);
4002    /// ```
4003    pub fn set_method_policies<T, V>(mut self, v: T) -> Self
4004    where
4005        T: std::iter::IntoIterator<Item = V>,
4006        V: std::convert::Into<crate::model::MethodPolicy>,
4007    {
4008        use std::iter::Iterator;
4009        self.method_policies = v.into_iter().map(|i| i.into()).collect();
4010        self
4011    }
4012}
4013
4014impl wkt::message::Message for Control {
4015    fn typename() -> &'static str {
4016        "type.googleapis.com/google.api.Control"
4017    }
4018}
4019
4020/// `Distribution` contains summary statistics for a population of values. It
4021/// optionally contains a histogram representing the distribution of those values
4022/// across a set of buckets.
4023///
4024/// The summary statistics are the count, mean, sum of the squared deviation from
4025/// the mean, the minimum, and the maximum of the set of population of values.
4026/// The histogram is based on a sequence of buckets and gives a count of values
4027/// that fall into each bucket. The boundaries of the buckets are given either
4028/// explicitly or by formulas for buckets of fixed or exponentially increasing
4029/// widths.
4030///
4031/// Although it is not forbidden, it is generally a bad idea to include
4032/// non-finite values (infinities or NaNs) in the population of values, as this
4033/// will render the `mean` and `sum_of_squared_deviation` fields meaningless.
4034#[derive(Clone, Default, PartialEq)]
4035#[non_exhaustive]
4036pub struct Distribution {
4037    /// The number of values in the population. Must be non-negative. This value
4038    /// must equal the sum of the values in `bucket_counts` if a histogram is
4039    /// provided.
4040    pub count: i64,
4041
4042    /// The arithmetic mean of the values in the population. If `count` is zero
4043    /// then this field must be zero.
4044    pub mean: f64,
4045
4046    /// The sum of squared deviations from the mean of the values in the
4047    /// population. For values x_i this is:
4048    ///
4049    /// ```norust
4050    /// Sum[i=1..n]((x_i - mean)^2)
4051    /// ```
4052    ///
4053    /// Knuth, "The Art of Computer Programming", Vol. 2, page 232, 3rd edition
4054    /// describes Welford's method for accumulating this sum in one pass.
4055    ///
4056    /// If `count` is zero then this field must be zero.
4057    pub sum_of_squared_deviation: f64,
4058
4059    /// If specified, contains the range of the population values. The field
4060    /// must not be present if the `count` is zero.
4061    pub range: std::option::Option<crate::model::distribution::Range>,
4062
4063    /// Defines the histogram bucket boundaries. If the distribution does not
4064    /// contain a histogram, then omit this field.
4065    pub bucket_options: std::option::Option<crate::model::distribution::BucketOptions>,
4066
4067    /// The number of values in each bucket of the histogram, as described in
4068    /// `bucket_options`. If the distribution does not have a histogram, then omit
4069    /// this field. If there is a histogram, then the sum of the values in
4070    /// `bucket_counts` must equal the value in the `count` field of the
4071    /// distribution.
4072    ///
4073    /// If present, `bucket_counts` should contain N values, where N is the number
4074    /// of buckets specified in `bucket_options`. If you supply fewer than N
4075    /// values, the remaining values are assumed to be 0.
4076    ///
4077    /// The order of the values in `bucket_counts` follows the bucket numbering
4078    /// schemes described for the three bucket types. The first value must be the
4079    /// count for the underflow bucket (number 0). The next N-2 values are the
4080    /// counts for the finite buckets (number 1 through N-2). The N'th value in
4081    /// `bucket_counts` is the count for the overflow bucket (number N-1).
4082    pub bucket_counts: std::vec::Vec<i64>,
4083
4084    /// Must be in increasing order of `value` field.
4085    pub exemplars: std::vec::Vec<crate::model::distribution::Exemplar>,
4086
4087    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4088}
4089
4090impl Distribution {
4091    pub fn new() -> Self {
4092        std::default::Default::default()
4093    }
4094
4095    /// Sets the value of [count][crate::model::Distribution::count].
4096    ///
4097    /// # Example
4098    /// ```ignore,no_run
4099    /// # use google_cloud_api::model::Distribution;
4100    /// let x = Distribution::new().set_count(42);
4101    /// ```
4102    pub fn set_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
4103        self.count = v.into();
4104        self
4105    }
4106
4107    /// Sets the value of [mean][crate::model::Distribution::mean].
4108    ///
4109    /// # Example
4110    /// ```ignore,no_run
4111    /// # use google_cloud_api::model::Distribution;
4112    /// let x = Distribution::new().set_mean(42.0);
4113    /// ```
4114    pub fn set_mean<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
4115        self.mean = v.into();
4116        self
4117    }
4118
4119    /// Sets the value of [sum_of_squared_deviation][crate::model::Distribution::sum_of_squared_deviation].
4120    ///
4121    /// # Example
4122    /// ```ignore,no_run
4123    /// # use google_cloud_api::model::Distribution;
4124    /// let x = Distribution::new().set_sum_of_squared_deviation(42.0);
4125    /// ```
4126    pub fn set_sum_of_squared_deviation<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
4127        self.sum_of_squared_deviation = v.into();
4128        self
4129    }
4130
4131    /// Sets the value of [range][crate::model::Distribution::range].
4132    ///
4133    /// # Example
4134    /// ```ignore,no_run
4135    /// # use google_cloud_api::model::Distribution;
4136    /// use google_cloud_api::model::distribution::Range;
4137    /// let x = Distribution::new().set_range(Range::default()/* use setters */);
4138    /// ```
4139    pub fn set_range<T>(mut self, v: T) -> Self
4140    where
4141        T: std::convert::Into<crate::model::distribution::Range>,
4142    {
4143        self.range = std::option::Option::Some(v.into());
4144        self
4145    }
4146
4147    /// Sets or clears the value of [range][crate::model::Distribution::range].
4148    ///
4149    /// # Example
4150    /// ```ignore,no_run
4151    /// # use google_cloud_api::model::Distribution;
4152    /// use google_cloud_api::model::distribution::Range;
4153    /// let x = Distribution::new().set_or_clear_range(Some(Range::default()/* use setters */));
4154    /// let x = Distribution::new().set_or_clear_range(None::<Range>);
4155    /// ```
4156    pub fn set_or_clear_range<T>(mut self, v: std::option::Option<T>) -> Self
4157    where
4158        T: std::convert::Into<crate::model::distribution::Range>,
4159    {
4160        self.range = v.map(|x| x.into());
4161        self
4162    }
4163
4164    /// Sets the value of [bucket_options][crate::model::Distribution::bucket_options].
4165    ///
4166    /// # Example
4167    /// ```ignore,no_run
4168    /// # use google_cloud_api::model::Distribution;
4169    /// use google_cloud_api::model::distribution::BucketOptions;
4170    /// let x = Distribution::new().set_bucket_options(BucketOptions::default()/* use setters */);
4171    /// ```
4172    pub fn set_bucket_options<T>(mut self, v: T) -> Self
4173    where
4174        T: std::convert::Into<crate::model::distribution::BucketOptions>,
4175    {
4176        self.bucket_options = std::option::Option::Some(v.into());
4177        self
4178    }
4179
4180    /// Sets or clears the value of [bucket_options][crate::model::Distribution::bucket_options].
4181    ///
4182    /// # Example
4183    /// ```ignore,no_run
4184    /// # use google_cloud_api::model::Distribution;
4185    /// use google_cloud_api::model::distribution::BucketOptions;
4186    /// let x = Distribution::new().set_or_clear_bucket_options(Some(BucketOptions::default()/* use setters */));
4187    /// let x = Distribution::new().set_or_clear_bucket_options(None::<BucketOptions>);
4188    /// ```
4189    pub fn set_or_clear_bucket_options<T>(mut self, v: std::option::Option<T>) -> Self
4190    where
4191        T: std::convert::Into<crate::model::distribution::BucketOptions>,
4192    {
4193        self.bucket_options = v.map(|x| x.into());
4194        self
4195    }
4196
4197    /// Sets the value of [bucket_counts][crate::model::Distribution::bucket_counts].
4198    ///
4199    /// # Example
4200    /// ```ignore,no_run
4201    /// # use google_cloud_api::model::Distribution;
4202    /// let x = Distribution::new().set_bucket_counts([1, 2, 3]);
4203    /// ```
4204    pub fn set_bucket_counts<T, V>(mut self, v: T) -> Self
4205    where
4206        T: std::iter::IntoIterator<Item = V>,
4207        V: std::convert::Into<i64>,
4208    {
4209        use std::iter::Iterator;
4210        self.bucket_counts = v.into_iter().map(|i| i.into()).collect();
4211        self
4212    }
4213
4214    /// Sets the value of [exemplars][crate::model::Distribution::exemplars].
4215    ///
4216    /// # Example
4217    /// ```ignore,no_run
4218    /// # use google_cloud_api::model::Distribution;
4219    /// use google_cloud_api::model::distribution::Exemplar;
4220    /// let x = Distribution::new()
4221    ///     .set_exemplars([
4222    ///         Exemplar::default()/* use setters */,
4223    ///         Exemplar::default()/* use (different) setters */,
4224    ///     ]);
4225    /// ```
4226    pub fn set_exemplars<T, V>(mut self, v: T) -> Self
4227    where
4228        T: std::iter::IntoIterator<Item = V>,
4229        V: std::convert::Into<crate::model::distribution::Exemplar>,
4230    {
4231        use std::iter::Iterator;
4232        self.exemplars = v.into_iter().map(|i| i.into()).collect();
4233        self
4234    }
4235}
4236
4237impl wkt::message::Message for Distribution {
4238    fn typename() -> &'static str {
4239        "type.googleapis.com/google.api.Distribution"
4240    }
4241}
4242
4243/// Defines additional types related to [Distribution].
4244pub mod distribution {
4245    #[allow(unused_imports)]
4246    use super::*;
4247
4248    /// The range of the population values.
4249    #[derive(Clone, Default, PartialEq)]
4250    #[non_exhaustive]
4251    pub struct Range {
4252        /// The minimum of the population values.
4253        pub min: f64,
4254
4255        /// The maximum of the population values.
4256        pub max: f64,
4257
4258        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4259    }
4260
4261    impl Range {
4262        pub fn new() -> Self {
4263            std::default::Default::default()
4264        }
4265
4266        /// Sets the value of [min][crate::model::distribution::Range::min].
4267        ///
4268        /// # Example
4269        /// ```ignore,no_run
4270        /// # use google_cloud_api::model::distribution::Range;
4271        /// let x = Range::new().set_min(42.0);
4272        /// ```
4273        pub fn set_min<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
4274            self.min = v.into();
4275            self
4276        }
4277
4278        /// Sets the value of [max][crate::model::distribution::Range::max].
4279        ///
4280        /// # Example
4281        /// ```ignore,no_run
4282        /// # use google_cloud_api::model::distribution::Range;
4283        /// let x = Range::new().set_max(42.0);
4284        /// ```
4285        pub fn set_max<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
4286            self.max = v.into();
4287            self
4288        }
4289    }
4290
4291    impl wkt::message::Message for Range {
4292        fn typename() -> &'static str {
4293            "type.googleapis.com/google.api.Distribution.Range"
4294        }
4295    }
4296
4297    /// `BucketOptions` describes the bucket boundaries used to create a histogram
4298    /// for the distribution. The buckets can be in a linear sequence, an
4299    /// exponential sequence, or each bucket can be specified explicitly.
4300    /// `BucketOptions` does not include the number of values in each bucket.
4301    ///
4302    /// A bucket has an inclusive lower bound and exclusive upper bound for the
4303    /// values that are counted for that bucket. The upper bound of a bucket must
4304    /// be strictly greater than the lower bound. The sequence of N buckets for a
4305    /// distribution consists of an underflow bucket (number 0), zero or more
4306    /// finite buckets (number 1 through N - 2) and an overflow bucket (number N -
4307    /// 1). The buckets are contiguous: the lower bound of bucket i (i > 0) is the
4308    /// same as the upper bound of bucket i - 1. The buckets span the whole range
4309    /// of finite values: lower bound of the underflow bucket is -infinity and the
4310    /// upper bound of the overflow bucket is +infinity. The finite buckets are
4311    /// so-called because both bounds are finite.
4312    #[derive(Clone, Default, PartialEq)]
4313    #[non_exhaustive]
4314    pub struct BucketOptions {
4315        /// Exactly one of these three fields must be set.
4316        pub options: std::option::Option<crate::model::distribution::bucket_options::Options>,
4317
4318        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4319    }
4320
4321    impl BucketOptions {
4322        pub fn new() -> Self {
4323            std::default::Default::default()
4324        }
4325
4326        /// Sets the value of [options][crate::model::distribution::BucketOptions::options].
4327        ///
4328        /// Note that all the setters affecting `options` are mutually
4329        /// exclusive.
4330        ///
4331        /// # Example
4332        /// ```ignore,no_run
4333        /// # use google_cloud_api::model::distribution::BucketOptions;
4334        /// use google_cloud_api::model::distribution::bucket_options::Linear;
4335        /// let x = BucketOptions::new().set_options(Some(
4336        ///     google_cloud_api::model::distribution::bucket_options::Options::LinearBuckets(Linear::default().into())));
4337        /// ```
4338        pub fn set_options<
4339            T: std::convert::Into<
4340                    std::option::Option<crate::model::distribution::bucket_options::Options>,
4341                >,
4342        >(
4343            mut self,
4344            v: T,
4345        ) -> Self {
4346            self.options = v.into();
4347            self
4348        }
4349
4350        /// The value of [options][crate::model::distribution::BucketOptions::options]
4351        /// if it holds a `LinearBuckets`, `None` if the field is not set or
4352        /// holds a different branch.
4353        pub fn linear_buckets(
4354            &self,
4355        ) -> std::option::Option<&std::boxed::Box<crate::model::distribution::bucket_options::Linear>>
4356        {
4357            #[allow(unreachable_patterns)]
4358            self.options.as_ref().and_then(|v| match v {
4359                crate::model::distribution::bucket_options::Options::LinearBuckets(v) => {
4360                    std::option::Option::Some(v)
4361                }
4362                _ => std::option::Option::None,
4363            })
4364        }
4365
4366        /// Sets the value of [options][crate::model::distribution::BucketOptions::options]
4367        /// to hold a `LinearBuckets`.
4368        ///
4369        /// Note that all the setters affecting `options` are
4370        /// mutually exclusive.
4371        ///
4372        /// # Example
4373        /// ```ignore,no_run
4374        /// # use google_cloud_api::model::distribution::BucketOptions;
4375        /// use google_cloud_api::model::distribution::bucket_options::Linear;
4376        /// let x = BucketOptions::new().set_linear_buckets(Linear::default()/* use setters */);
4377        /// assert!(x.linear_buckets().is_some());
4378        /// assert!(x.exponential_buckets().is_none());
4379        /// assert!(x.explicit_buckets().is_none());
4380        /// ```
4381        pub fn set_linear_buckets<
4382            T: std::convert::Into<std::boxed::Box<crate::model::distribution::bucket_options::Linear>>,
4383        >(
4384            mut self,
4385            v: T,
4386        ) -> Self {
4387            self.options = std::option::Option::Some(
4388                crate::model::distribution::bucket_options::Options::LinearBuckets(v.into()),
4389            );
4390            self
4391        }
4392
4393        /// The value of [options][crate::model::distribution::BucketOptions::options]
4394        /// if it holds a `ExponentialBuckets`, `None` if the field is not set or
4395        /// holds a different branch.
4396        pub fn exponential_buckets(
4397            &self,
4398        ) -> std::option::Option<
4399            &std::boxed::Box<crate::model::distribution::bucket_options::Exponential>,
4400        > {
4401            #[allow(unreachable_patterns)]
4402            self.options.as_ref().and_then(|v| match v {
4403                crate::model::distribution::bucket_options::Options::ExponentialBuckets(v) => {
4404                    std::option::Option::Some(v)
4405                }
4406                _ => std::option::Option::None,
4407            })
4408        }
4409
4410        /// Sets the value of [options][crate::model::distribution::BucketOptions::options]
4411        /// to hold a `ExponentialBuckets`.
4412        ///
4413        /// Note that all the setters affecting `options` are
4414        /// mutually exclusive.
4415        ///
4416        /// # Example
4417        /// ```ignore,no_run
4418        /// # use google_cloud_api::model::distribution::BucketOptions;
4419        /// use google_cloud_api::model::distribution::bucket_options::Exponential;
4420        /// let x = BucketOptions::new().set_exponential_buckets(Exponential::default()/* use setters */);
4421        /// assert!(x.exponential_buckets().is_some());
4422        /// assert!(x.linear_buckets().is_none());
4423        /// assert!(x.explicit_buckets().is_none());
4424        /// ```
4425        pub fn set_exponential_buckets<
4426            T: std::convert::Into<
4427                    std::boxed::Box<crate::model::distribution::bucket_options::Exponential>,
4428                >,
4429        >(
4430            mut self,
4431            v: T,
4432        ) -> Self {
4433            self.options = std::option::Option::Some(
4434                crate::model::distribution::bucket_options::Options::ExponentialBuckets(v.into()),
4435            );
4436            self
4437        }
4438
4439        /// The value of [options][crate::model::distribution::BucketOptions::options]
4440        /// if it holds a `ExplicitBuckets`, `None` if the field is not set or
4441        /// holds a different branch.
4442        pub fn explicit_buckets(
4443            &self,
4444        ) -> std::option::Option<
4445            &std::boxed::Box<crate::model::distribution::bucket_options::Explicit>,
4446        > {
4447            #[allow(unreachable_patterns)]
4448            self.options.as_ref().and_then(|v| match v {
4449                crate::model::distribution::bucket_options::Options::ExplicitBuckets(v) => {
4450                    std::option::Option::Some(v)
4451                }
4452                _ => std::option::Option::None,
4453            })
4454        }
4455
4456        /// Sets the value of [options][crate::model::distribution::BucketOptions::options]
4457        /// to hold a `ExplicitBuckets`.
4458        ///
4459        /// Note that all the setters affecting `options` are
4460        /// mutually exclusive.
4461        ///
4462        /// # Example
4463        /// ```ignore,no_run
4464        /// # use google_cloud_api::model::distribution::BucketOptions;
4465        /// use google_cloud_api::model::distribution::bucket_options::Explicit;
4466        /// let x = BucketOptions::new().set_explicit_buckets(Explicit::default()/* use setters */);
4467        /// assert!(x.explicit_buckets().is_some());
4468        /// assert!(x.linear_buckets().is_none());
4469        /// assert!(x.exponential_buckets().is_none());
4470        /// ```
4471        pub fn set_explicit_buckets<
4472            T: std::convert::Into<
4473                    std::boxed::Box<crate::model::distribution::bucket_options::Explicit>,
4474                >,
4475        >(
4476            mut self,
4477            v: T,
4478        ) -> Self {
4479            self.options = std::option::Option::Some(
4480                crate::model::distribution::bucket_options::Options::ExplicitBuckets(v.into()),
4481            );
4482            self
4483        }
4484    }
4485
4486    impl wkt::message::Message for BucketOptions {
4487        fn typename() -> &'static str {
4488            "type.googleapis.com/google.api.Distribution.BucketOptions"
4489        }
4490    }
4491
4492    /// Defines additional types related to [BucketOptions].
4493    pub mod bucket_options {
4494        #[allow(unused_imports)]
4495        use super::*;
4496
4497        /// Specifies a linear sequence of buckets that all have the same width
4498        /// (except overflow and underflow). Each bucket represents a constant
4499        /// absolute uncertainty on the specific value in the bucket.
4500        ///
4501        /// There are `num_finite_buckets + 2` (= N) buckets. Bucket `i` has the
4502        /// following boundaries:
4503        ///
4504        /// Upper bound (0 <= i < N-1):     offset + (width * i).
4505        ///
4506        /// Lower bound (1 <= i < N):       offset + (width * (i - 1)).
4507        #[derive(Clone, Default, PartialEq)]
4508        #[non_exhaustive]
4509        pub struct Linear {
4510            /// Must be greater than 0.
4511            pub num_finite_buckets: i32,
4512
4513            /// Must be greater than 0.
4514            pub width: f64,
4515
4516            /// Lower bound of the first bucket.
4517            pub offset: f64,
4518
4519            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4520        }
4521
4522        impl Linear {
4523            pub fn new() -> Self {
4524                std::default::Default::default()
4525            }
4526
4527            /// Sets the value of [num_finite_buckets][crate::model::distribution::bucket_options::Linear::num_finite_buckets].
4528            ///
4529            /// # Example
4530            /// ```ignore,no_run
4531            /// # use google_cloud_api::model::distribution::bucket_options::Linear;
4532            /// let x = Linear::new().set_num_finite_buckets(42);
4533            /// ```
4534            pub fn set_num_finite_buckets<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4535                self.num_finite_buckets = v.into();
4536                self
4537            }
4538
4539            /// Sets the value of [width][crate::model::distribution::bucket_options::Linear::width].
4540            ///
4541            /// # Example
4542            /// ```ignore,no_run
4543            /// # use google_cloud_api::model::distribution::bucket_options::Linear;
4544            /// let x = Linear::new().set_width(42.0);
4545            /// ```
4546            pub fn set_width<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
4547                self.width = v.into();
4548                self
4549            }
4550
4551            /// Sets the value of [offset][crate::model::distribution::bucket_options::Linear::offset].
4552            ///
4553            /// # Example
4554            /// ```ignore,no_run
4555            /// # use google_cloud_api::model::distribution::bucket_options::Linear;
4556            /// let x = Linear::new().set_offset(42.0);
4557            /// ```
4558            pub fn set_offset<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
4559                self.offset = v.into();
4560                self
4561            }
4562        }
4563
4564        impl wkt::message::Message for Linear {
4565            fn typename() -> &'static str {
4566                "type.googleapis.com/google.api.Distribution.BucketOptions.Linear"
4567            }
4568        }
4569
4570        /// Specifies an exponential sequence of buckets that have a width that is
4571        /// proportional to the value of the lower bound. Each bucket represents a
4572        /// constant relative uncertainty on a specific value in the bucket.
4573        ///
4574        /// There are `num_finite_buckets + 2` (= N) buckets. Bucket `i` has the
4575        /// following boundaries:
4576        ///
4577        /// Upper bound (0 <= i < N-1):     scale * (growth_factor ^ i).
4578        ///
4579        /// Lower bound (1 <= i < N):       scale * (growth_factor ^ (i - 1)).
4580        #[derive(Clone, Default, PartialEq)]
4581        #[non_exhaustive]
4582        pub struct Exponential {
4583            /// Must be greater than 0.
4584            pub num_finite_buckets: i32,
4585
4586            /// Must be greater than 1.
4587            pub growth_factor: f64,
4588
4589            /// Must be greater than 0.
4590            pub scale: f64,
4591
4592            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4593        }
4594
4595        impl Exponential {
4596            pub fn new() -> Self {
4597                std::default::Default::default()
4598            }
4599
4600            /// Sets the value of [num_finite_buckets][crate::model::distribution::bucket_options::Exponential::num_finite_buckets].
4601            ///
4602            /// # Example
4603            /// ```ignore,no_run
4604            /// # use google_cloud_api::model::distribution::bucket_options::Exponential;
4605            /// let x = Exponential::new().set_num_finite_buckets(42);
4606            /// ```
4607            pub fn set_num_finite_buckets<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4608                self.num_finite_buckets = v.into();
4609                self
4610            }
4611
4612            /// Sets the value of [growth_factor][crate::model::distribution::bucket_options::Exponential::growth_factor].
4613            ///
4614            /// # Example
4615            /// ```ignore,no_run
4616            /// # use google_cloud_api::model::distribution::bucket_options::Exponential;
4617            /// let x = Exponential::new().set_growth_factor(42.0);
4618            /// ```
4619            pub fn set_growth_factor<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
4620                self.growth_factor = v.into();
4621                self
4622            }
4623
4624            /// Sets the value of [scale][crate::model::distribution::bucket_options::Exponential::scale].
4625            ///
4626            /// # Example
4627            /// ```ignore,no_run
4628            /// # use google_cloud_api::model::distribution::bucket_options::Exponential;
4629            /// let x = Exponential::new().set_scale(42.0);
4630            /// ```
4631            pub fn set_scale<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
4632                self.scale = v.into();
4633                self
4634            }
4635        }
4636
4637        impl wkt::message::Message for Exponential {
4638            fn typename() -> &'static str {
4639                "type.googleapis.com/google.api.Distribution.BucketOptions.Exponential"
4640            }
4641        }
4642
4643        /// Specifies a set of buckets with arbitrary widths.
4644        ///
4645        /// There are `size(bounds) + 1` (= N) buckets. Bucket `i` has the following
4646        /// boundaries:
4647        ///
4648        /// Upper bound (0 <= i < N-1):     bounds[i]
4649        /// Lower bound (1 <= i < N);       bounds[i - 1]
4650        ///
4651        /// The `bounds` field must contain at least one element. If `bounds` has
4652        /// only one element, then there are no finite buckets, and that single
4653        /// element is the common boundary of the overflow and underflow buckets.
4654        #[derive(Clone, Default, PartialEq)]
4655        #[non_exhaustive]
4656        pub struct Explicit {
4657            /// The values must be monotonically increasing.
4658            pub bounds: std::vec::Vec<f64>,
4659
4660            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4661        }
4662
4663        impl Explicit {
4664            pub fn new() -> Self {
4665                std::default::Default::default()
4666            }
4667
4668            /// Sets the value of [bounds][crate::model::distribution::bucket_options::Explicit::bounds].
4669            ///
4670            /// # Example
4671            /// ```ignore,no_run
4672            /// # use google_cloud_api::model::distribution::bucket_options::Explicit;
4673            /// let x = Explicit::new().set_bounds([1.0, 2.0, 3.0]);
4674            /// ```
4675            pub fn set_bounds<T, V>(mut self, v: T) -> Self
4676            where
4677                T: std::iter::IntoIterator<Item = V>,
4678                V: std::convert::Into<f64>,
4679            {
4680                use std::iter::Iterator;
4681                self.bounds = v.into_iter().map(|i| i.into()).collect();
4682                self
4683            }
4684        }
4685
4686        impl wkt::message::Message for Explicit {
4687            fn typename() -> &'static str {
4688                "type.googleapis.com/google.api.Distribution.BucketOptions.Explicit"
4689            }
4690        }
4691
4692        /// Exactly one of these three fields must be set.
4693        #[derive(Clone, Debug, PartialEq)]
4694        #[non_exhaustive]
4695        pub enum Options {
4696            /// The linear bucket.
4697            LinearBuckets(std::boxed::Box<crate::model::distribution::bucket_options::Linear>),
4698            /// The exponential buckets.
4699            ExponentialBuckets(
4700                std::boxed::Box<crate::model::distribution::bucket_options::Exponential>,
4701            ),
4702            /// The explicit buckets.
4703            ExplicitBuckets(std::boxed::Box<crate::model::distribution::bucket_options::Explicit>),
4704        }
4705    }
4706
4707    /// Exemplars are example points that may be used to annotate aggregated
4708    /// distribution values. They are metadata that gives information about a
4709    /// particular value added to a Distribution bucket, such as a trace ID that
4710    /// was active when a value was added. They may contain further information,
4711    /// such as a example values and timestamps, origin, etc.
4712    #[derive(Clone, Default, PartialEq)]
4713    #[non_exhaustive]
4714    pub struct Exemplar {
4715        /// Value of the exemplar point. This value determines to which bucket the
4716        /// exemplar belongs.
4717        pub value: f64,
4718
4719        /// The observation (sampling) time of the above value.
4720        pub timestamp: std::option::Option<wkt::Timestamp>,
4721
4722        /// Contextual information about the example value. Examples are:
4723        ///
4724        /// Trace: type.googleapis.com/google.monitoring.v3.SpanContext
4725        ///
4726        /// Literal string: type.googleapis.com/google.protobuf.StringValue
4727        ///
4728        /// Labels dropped during aggregation:
4729        /// type.googleapis.com/google.monitoring.v3.DroppedLabels
4730        ///
4731        /// There may be only a single attachment of any given message type in a
4732        /// single exemplar, and this is enforced by the system.
4733        pub attachments: std::vec::Vec<wkt::Any>,
4734
4735        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4736    }
4737
4738    impl Exemplar {
4739        pub fn new() -> Self {
4740            std::default::Default::default()
4741        }
4742
4743        /// Sets the value of [value][crate::model::distribution::Exemplar::value].
4744        ///
4745        /// # Example
4746        /// ```ignore,no_run
4747        /// # use google_cloud_api::model::distribution::Exemplar;
4748        /// let x = Exemplar::new().set_value(42.0);
4749        /// ```
4750        pub fn set_value<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
4751            self.value = v.into();
4752            self
4753        }
4754
4755        /// Sets the value of [timestamp][crate::model::distribution::Exemplar::timestamp].
4756        ///
4757        /// # Example
4758        /// ```ignore,no_run
4759        /// # use google_cloud_api::model::distribution::Exemplar;
4760        /// use wkt::Timestamp;
4761        /// let x = Exemplar::new().set_timestamp(Timestamp::default()/* use setters */);
4762        /// ```
4763        pub fn set_timestamp<T>(mut self, v: T) -> Self
4764        where
4765            T: std::convert::Into<wkt::Timestamp>,
4766        {
4767            self.timestamp = std::option::Option::Some(v.into());
4768            self
4769        }
4770
4771        /// Sets or clears the value of [timestamp][crate::model::distribution::Exemplar::timestamp].
4772        ///
4773        /// # Example
4774        /// ```ignore,no_run
4775        /// # use google_cloud_api::model::distribution::Exemplar;
4776        /// use wkt::Timestamp;
4777        /// let x = Exemplar::new().set_or_clear_timestamp(Some(Timestamp::default()/* use setters */));
4778        /// let x = Exemplar::new().set_or_clear_timestamp(None::<Timestamp>);
4779        /// ```
4780        pub fn set_or_clear_timestamp<T>(mut self, v: std::option::Option<T>) -> Self
4781        where
4782            T: std::convert::Into<wkt::Timestamp>,
4783        {
4784            self.timestamp = v.map(|x| x.into());
4785            self
4786        }
4787
4788        /// Sets the value of [attachments][crate::model::distribution::Exemplar::attachments].
4789        ///
4790        /// # Example
4791        /// ```ignore,no_run
4792        /// # use google_cloud_api::model::distribution::Exemplar;
4793        /// use wkt::Any;
4794        /// let x = Exemplar::new()
4795        ///     .set_attachments([
4796        ///         Any::default()/* use setters */,
4797        ///         Any::default()/* use (different) setters */,
4798        ///     ]);
4799        /// ```
4800        pub fn set_attachments<T, V>(mut self, v: T) -> Self
4801        where
4802            T: std::iter::IntoIterator<Item = V>,
4803            V: std::convert::Into<wkt::Any>,
4804        {
4805            use std::iter::Iterator;
4806            self.attachments = v.into_iter().map(|i| i.into()).collect();
4807            self
4808        }
4809    }
4810
4811    impl wkt::message::Message for Exemplar {
4812        fn typename() -> &'static str {
4813            "type.googleapis.com/google.api.Distribution.Exemplar"
4814        }
4815    }
4816}
4817
4818/// `Documentation` provides the information for describing a service.
4819///
4820/// Example:
4821///
4822/// Documentation is provided in markdown syntax. In addition to
4823/// standard markdown features, definition lists, tables and fenced
4824/// code blocks are supported. Section headers can be provided and are
4825/// interpreted relative to the section nesting of the context where
4826/// a documentation fragment is embedded.
4827///
4828/// Documentation from the IDL is merged with documentation defined
4829/// via the config at normalization time, where documentation provided
4830/// by config rules overrides IDL provided.
4831///
4832/// A number of constructs specific to the API platform are supported
4833/// in documentation text.
4834///
4835/// In order to reference a proto element, the following
4836/// notation can be used:
4837///
4838/// To override the display text used for the link, this can be used:
4839///
4840/// Text can be excluded from doc using the following notation:
4841///
4842/// A few directives are available in documentation. Note that
4843/// directives must appear on a single line to be properly
4844/// identified. The `include` directive includes a markdown file from
4845/// an external source:
4846///
4847/// The `resource_for` directive marks a message to be the resource of
4848/// a collection in REST view. If it is not specified, tools attempt
4849/// to infer the resource from the operations in a collection:
4850///
4851/// The directive `suppress_warning` does not directly affect documentation
4852/// and is documented together with service config validation.
4853#[derive(Clone, Default, PartialEq)]
4854#[non_exhaustive]
4855pub struct Documentation {
4856    /// A short description of what the service does. The summary must be plain
4857    /// text. It becomes the overview of the service displayed in Google Cloud
4858    /// Console.
4859    /// NOTE: This field is equivalent to the standard field `description`.
4860    pub summary: std::string::String,
4861
4862    /// The top level pages for the documentation set.
4863    pub pages: std::vec::Vec<crate::model::Page>,
4864
4865    /// A list of documentation rules that apply to individual API elements.
4866    ///
4867    /// **NOTE:** All service configuration rules follow "last one wins" order.
4868    pub rules: std::vec::Vec<crate::model::DocumentationRule>,
4869
4870    /// The URL to the root of documentation.
4871    pub documentation_root_url: std::string::String,
4872
4873    /// Specifies the service root url if the default one (the service name
4874    /// from the yaml file) is not suitable. This can be seen in any fully
4875    /// specified service urls as well as sections that show a base that other
4876    /// urls are relative to.
4877    pub service_root_url: std::string::String,
4878
4879    /// Declares a single overview page. For example:
4880    ///
4881    /// This is a shortcut for the following declaration (using pages style):
4882    ///
4883    /// Note: you cannot specify both `overview` field and `pages` field.
4884    pub overview: std::string::String,
4885
4886    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4887}
4888
4889impl Documentation {
4890    pub fn new() -> Self {
4891        std::default::Default::default()
4892    }
4893
4894    /// Sets the value of [summary][crate::model::Documentation::summary].
4895    ///
4896    /// # Example
4897    /// ```ignore,no_run
4898    /// # use google_cloud_api::model::Documentation;
4899    /// let x = Documentation::new().set_summary("example");
4900    /// ```
4901    pub fn set_summary<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4902        self.summary = v.into();
4903        self
4904    }
4905
4906    /// Sets the value of [pages][crate::model::Documentation::pages].
4907    ///
4908    /// # Example
4909    /// ```ignore,no_run
4910    /// # use google_cloud_api::model::Documentation;
4911    /// use google_cloud_api::model::Page;
4912    /// let x = Documentation::new()
4913    ///     .set_pages([
4914    ///         Page::default()/* use setters */,
4915    ///         Page::default()/* use (different) setters */,
4916    ///     ]);
4917    /// ```
4918    pub fn set_pages<T, V>(mut self, v: T) -> Self
4919    where
4920        T: std::iter::IntoIterator<Item = V>,
4921        V: std::convert::Into<crate::model::Page>,
4922    {
4923        use std::iter::Iterator;
4924        self.pages = v.into_iter().map(|i| i.into()).collect();
4925        self
4926    }
4927
4928    /// Sets the value of [rules][crate::model::Documentation::rules].
4929    ///
4930    /// # Example
4931    /// ```ignore,no_run
4932    /// # use google_cloud_api::model::Documentation;
4933    /// use google_cloud_api::model::DocumentationRule;
4934    /// let x = Documentation::new()
4935    ///     .set_rules([
4936    ///         DocumentationRule::default()/* use setters */,
4937    ///         DocumentationRule::default()/* use (different) setters */,
4938    ///     ]);
4939    /// ```
4940    pub fn set_rules<T, V>(mut self, v: T) -> Self
4941    where
4942        T: std::iter::IntoIterator<Item = V>,
4943        V: std::convert::Into<crate::model::DocumentationRule>,
4944    {
4945        use std::iter::Iterator;
4946        self.rules = v.into_iter().map(|i| i.into()).collect();
4947        self
4948    }
4949
4950    /// Sets the value of [documentation_root_url][crate::model::Documentation::documentation_root_url].
4951    ///
4952    /// # Example
4953    /// ```ignore,no_run
4954    /// # use google_cloud_api::model::Documentation;
4955    /// let x = Documentation::new().set_documentation_root_url("example");
4956    /// ```
4957    pub fn set_documentation_root_url<T: std::convert::Into<std::string::String>>(
4958        mut self,
4959        v: T,
4960    ) -> Self {
4961        self.documentation_root_url = v.into();
4962        self
4963    }
4964
4965    /// Sets the value of [service_root_url][crate::model::Documentation::service_root_url].
4966    ///
4967    /// # Example
4968    /// ```ignore,no_run
4969    /// # use google_cloud_api::model::Documentation;
4970    /// let x = Documentation::new().set_service_root_url("example");
4971    /// ```
4972    pub fn set_service_root_url<T: std::convert::Into<std::string::String>>(
4973        mut self,
4974        v: T,
4975    ) -> Self {
4976        self.service_root_url = v.into();
4977        self
4978    }
4979
4980    /// Sets the value of [overview][crate::model::Documentation::overview].
4981    ///
4982    /// # Example
4983    /// ```ignore,no_run
4984    /// # use google_cloud_api::model::Documentation;
4985    /// let x = Documentation::new().set_overview("example");
4986    /// ```
4987    pub fn set_overview<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4988        self.overview = v.into();
4989        self
4990    }
4991}
4992
4993impl wkt::message::Message for Documentation {
4994    fn typename() -> &'static str {
4995        "type.googleapis.com/google.api.Documentation"
4996    }
4997}
4998
4999/// A documentation rule provides information about individual API elements.
5000#[derive(Clone, Default, PartialEq)]
5001#[non_exhaustive]
5002pub struct DocumentationRule {
5003    /// The selector is a comma-separated list of patterns for any element such as
5004    /// a method, a field, an enum value. Each pattern is a qualified name of the
5005    /// element which may end in "*", indicating a wildcard. Wildcards are only
5006    /// allowed at the end and for a whole component of the qualified name,
5007    /// i.e. "foo.*" is ok, but not "foo.b*" or "foo.*.bar". A wildcard will match
5008    /// one or more components. To specify a default for all applicable elements,
5009    /// the whole pattern "*" is used.
5010    pub selector: std::string::String,
5011
5012    /// Description of the selected proto element (e.g. a message, a method, a
5013    /// 'service' definition, or a field). Defaults to leading & trailing comments
5014    /// taken from the proto source definition of the proto element.
5015    pub description: std::string::String,
5016
5017    /// Deprecation description of the selected element(s). It can be provided if
5018    /// an element is marked as `deprecated`.
5019    pub deprecation_description: std::string::String,
5020
5021    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5022}
5023
5024impl DocumentationRule {
5025    pub fn new() -> Self {
5026        std::default::Default::default()
5027    }
5028
5029    /// Sets the value of [selector][crate::model::DocumentationRule::selector].
5030    ///
5031    /// # Example
5032    /// ```ignore,no_run
5033    /// # use google_cloud_api::model::DocumentationRule;
5034    /// let x = DocumentationRule::new().set_selector("example");
5035    /// ```
5036    pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5037        self.selector = v.into();
5038        self
5039    }
5040
5041    /// Sets the value of [description][crate::model::DocumentationRule::description].
5042    ///
5043    /// # Example
5044    /// ```ignore,no_run
5045    /// # use google_cloud_api::model::DocumentationRule;
5046    /// let x = DocumentationRule::new().set_description("example");
5047    /// ```
5048    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5049        self.description = v.into();
5050        self
5051    }
5052
5053    /// Sets the value of [deprecation_description][crate::model::DocumentationRule::deprecation_description].
5054    ///
5055    /// # Example
5056    /// ```ignore,no_run
5057    /// # use google_cloud_api::model::DocumentationRule;
5058    /// let x = DocumentationRule::new().set_deprecation_description("example");
5059    /// ```
5060    pub fn set_deprecation_description<T: std::convert::Into<std::string::String>>(
5061        mut self,
5062        v: T,
5063    ) -> Self {
5064        self.deprecation_description = v.into();
5065        self
5066    }
5067}
5068
5069impl wkt::message::Message for DocumentationRule {
5070    fn typename() -> &'static str {
5071        "type.googleapis.com/google.api.DocumentationRule"
5072    }
5073}
5074
5075/// Represents a documentation page. A page can contain subpages to represent
5076/// nested documentation set structure.
5077#[derive(Clone, Default, PartialEq)]
5078#[non_exhaustive]
5079pub struct Page {
5080    /// The name of the page. It will be used as an identity of the page to
5081    /// generate URI of the page, text of the link to this page in navigation,
5082    /// etc. The full page name (start from the root page name to this page
5083    /// concatenated with `.`) can be used as reference to the page in your
5084    /// documentation. For example:
5085    ///
5086    /// You can reference `Java` page using Markdown reference link syntax:
5087    /// `[Java][Tutorial.Java]`.
5088    pub name: std::string::String,
5089
5090    /// The Markdown content of the page. You can use ```(== include {path}
5091    /// ==)``` to include content from a Markdown file. The content can be used
5092    /// to produce the documentation page such as HTML format page.
5093    pub content: std::string::String,
5094
5095    /// Subpages of this page. The order of subpages specified here will be
5096    /// honored in the generated docset.
5097    pub subpages: std::vec::Vec<crate::model::Page>,
5098
5099    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5100}
5101
5102impl Page {
5103    pub fn new() -> Self {
5104        std::default::Default::default()
5105    }
5106
5107    /// Sets the value of [name][crate::model::Page::name].
5108    ///
5109    /// # Example
5110    /// ```ignore,no_run
5111    /// # use google_cloud_api::model::Page;
5112    /// let x = Page::new().set_name("example");
5113    /// ```
5114    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5115        self.name = v.into();
5116        self
5117    }
5118
5119    /// Sets the value of [content][crate::model::Page::content].
5120    ///
5121    /// # Example
5122    /// ```ignore,no_run
5123    /// # use google_cloud_api::model::Page;
5124    /// let x = Page::new().set_content("example");
5125    /// ```
5126    pub fn set_content<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5127        self.content = v.into();
5128        self
5129    }
5130
5131    /// Sets the value of [subpages][crate::model::Page::subpages].
5132    ///
5133    /// # Example
5134    /// ```ignore,no_run
5135    /// # use google_cloud_api::model::Page;
5136    /// let x = Page::new()
5137    ///     .set_subpages([
5138    ///         Page::default()/* use setters */,
5139    ///         Page::default()/* use (different) setters */,
5140    ///     ]);
5141    /// ```
5142    pub fn set_subpages<T, V>(mut self, v: T) -> Self
5143    where
5144        T: std::iter::IntoIterator<Item = V>,
5145        V: std::convert::Into<crate::model::Page>,
5146    {
5147        use std::iter::Iterator;
5148        self.subpages = v.into_iter().map(|i| i.into()).collect();
5149        self
5150    }
5151}
5152
5153impl wkt::message::Message for Page {
5154    fn typename() -> &'static str {
5155        "type.googleapis.com/google.api.Page"
5156    }
5157}
5158
5159/// `Endpoint` describes a network address of a service that serves a set of
5160/// APIs. It is commonly known as a service endpoint. A service may expose
5161/// any number of service endpoints, and all service endpoints share the same
5162/// service definition, such as quota limits and monitoring metrics.
5163///
5164/// Example:
5165///
5166/// ```norust
5167/// type: google.api.Service
5168/// name: library-example.googleapis.com
5169/// endpoints:
5170///   # Declares network address `https://library-example.googleapis.com`
5171///   # for service `library-example.googleapis.com`. The `https` scheme
5172///   # is implicit for all service endpoints. Other schemes may be
5173///   # supported in the future.
5174/// - name: library-example.googleapis.com
5175///   allow_cors: false
5176/// - name: content-staging-library-example.googleapis.com
5177///   # Allows HTTP OPTIONS calls to be passed to the API frontend, for it
5178///   # to decide whether the subsequent cross-origin request is allowed
5179///   # to proceed.
5180///   allow_cors: true
5181/// ```
5182#[derive(Clone, Default, PartialEq)]
5183#[non_exhaustive]
5184pub struct Endpoint {
5185    /// The canonical name of this endpoint.
5186    pub name: std::string::String,
5187
5188    /// Aliases for this endpoint, these will be served by the same UrlMap as the
5189    /// parent endpoint, and will be provisioned in the GCP stack for the Regional
5190    /// Endpoints.
5191    pub aliases: std::vec::Vec<std::string::String>,
5192
5193    /// The specification of an Internet routable address of API frontend that will
5194    /// handle requests to this [API
5195    /// Endpoint](https://cloud.google.com/apis/design/glossary). It should be
5196    /// either a valid IPv4 address or a fully-qualified domain name. For example,
5197    /// "8.8.8.8" or "myservice.appspot.com".
5198    pub target: std::string::String,
5199
5200    /// Allowing
5201    /// [CORS](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing), aka
5202    /// cross-domain traffic, would allow the backends served from this endpoint to
5203    /// receive and respond to HTTP OPTIONS requests. The response will be used by
5204    /// the browser to determine whether the subsequent cross-origin request is
5205    /// allowed to proceed.
5206    pub allow_cors: bool,
5207
5208    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5209}
5210
5211impl Endpoint {
5212    pub fn new() -> Self {
5213        std::default::Default::default()
5214    }
5215
5216    /// Sets the value of [name][crate::model::Endpoint::name].
5217    ///
5218    /// # Example
5219    /// ```ignore,no_run
5220    /// # use google_cloud_api::model::Endpoint;
5221    /// let x = Endpoint::new().set_name("example");
5222    /// ```
5223    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5224        self.name = v.into();
5225        self
5226    }
5227
5228    /// Sets the value of [aliases][crate::model::Endpoint::aliases].
5229    ///
5230    /// # Example
5231    /// ```ignore,no_run
5232    /// # use google_cloud_api::model::Endpoint;
5233    /// let x = Endpoint::new().set_aliases(["a", "b", "c"]);
5234    /// ```
5235    pub fn set_aliases<T, V>(mut self, v: T) -> Self
5236    where
5237        T: std::iter::IntoIterator<Item = V>,
5238        V: std::convert::Into<std::string::String>,
5239    {
5240        use std::iter::Iterator;
5241        self.aliases = v.into_iter().map(|i| i.into()).collect();
5242        self
5243    }
5244
5245    /// Sets the value of [target][crate::model::Endpoint::target].
5246    ///
5247    /// # Example
5248    /// ```ignore,no_run
5249    /// # use google_cloud_api::model::Endpoint;
5250    /// let x = Endpoint::new().set_target("example");
5251    /// ```
5252    pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5253        self.target = v.into();
5254        self
5255    }
5256
5257    /// Sets the value of [allow_cors][crate::model::Endpoint::allow_cors].
5258    ///
5259    /// # Example
5260    /// ```ignore,no_run
5261    /// # use google_cloud_api::model::Endpoint;
5262    /// let x = Endpoint::new().set_allow_cors(true);
5263    /// ```
5264    pub fn set_allow_cors<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5265        self.allow_cors = v.into();
5266        self
5267    }
5268}
5269
5270impl wkt::message::Message for Endpoint {
5271    fn typename() -> &'static str {
5272        "type.googleapis.com/google.api.Endpoint"
5273    }
5274}
5275
5276/// Rich semantic information of an API field beyond basic typing.
5277#[derive(Clone, Default, PartialEq)]
5278#[non_exhaustive]
5279pub struct FieldInfo {
5280    /// The standard format of a field value. This does not explicitly configure
5281    /// any API consumer, just documents the API's format for the field it is
5282    /// applied to.
5283    pub format: crate::model::field_info::Format,
5284
5285    /// The type(s) that the annotated, generic field may represent.
5286    ///
5287    /// Currently, this must only be used on fields of type `google.protobuf.Any`.
5288    /// Supporting other generic types may be considered in the future.
5289    pub referenced_types: std::vec::Vec<crate::model::TypeReference>,
5290
5291    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5292}
5293
5294impl FieldInfo {
5295    pub fn new() -> Self {
5296        std::default::Default::default()
5297    }
5298
5299    /// Sets the value of [format][crate::model::FieldInfo::format].
5300    ///
5301    /// # Example
5302    /// ```ignore,no_run
5303    /// # use google_cloud_api::model::FieldInfo;
5304    /// use google_cloud_api::model::field_info::Format;
5305    /// let x0 = FieldInfo::new().set_format(Format::Uuid4);
5306    /// let x1 = FieldInfo::new().set_format(Format::Ipv4);
5307    /// let x2 = FieldInfo::new().set_format(Format::Ipv6);
5308    /// ```
5309    pub fn set_format<T: std::convert::Into<crate::model::field_info::Format>>(
5310        mut self,
5311        v: T,
5312    ) -> Self {
5313        self.format = v.into();
5314        self
5315    }
5316
5317    /// Sets the value of [referenced_types][crate::model::FieldInfo::referenced_types].
5318    ///
5319    /// # Example
5320    /// ```ignore,no_run
5321    /// # use google_cloud_api::model::FieldInfo;
5322    /// use google_cloud_api::model::TypeReference;
5323    /// let x = FieldInfo::new()
5324    ///     .set_referenced_types([
5325    ///         TypeReference::default()/* use setters */,
5326    ///         TypeReference::default()/* use (different) setters */,
5327    ///     ]);
5328    /// ```
5329    pub fn set_referenced_types<T, V>(mut self, v: T) -> Self
5330    where
5331        T: std::iter::IntoIterator<Item = V>,
5332        V: std::convert::Into<crate::model::TypeReference>,
5333    {
5334        use std::iter::Iterator;
5335        self.referenced_types = v.into_iter().map(|i| i.into()).collect();
5336        self
5337    }
5338}
5339
5340impl wkt::message::Message for FieldInfo {
5341    fn typename() -> &'static str {
5342        "type.googleapis.com/google.api.FieldInfo"
5343    }
5344}
5345
5346/// Defines additional types related to [FieldInfo].
5347pub mod field_info {
5348    #[allow(unused_imports)]
5349    use super::*;
5350
5351    /// The standard format of a field value. The supported formats are all backed
5352    /// by either an RFC defined by the IETF or a Google-defined AIP.
5353    ///
5354    /// # Working with unknown values
5355    ///
5356    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5357    /// additional enum variants at any time. Adding new variants is not considered
5358    /// a breaking change. Applications should write their code in anticipation of:
5359    ///
5360    /// - New values appearing in future releases of the client library, **and**
5361    /// - New values received dynamically, without application changes.
5362    ///
5363    /// Please consult the [Working with enums] section in the user guide for some
5364    /// guidelines.
5365    ///
5366    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
5367    #[derive(Clone, Debug, PartialEq)]
5368    #[non_exhaustive]
5369    pub enum Format {
5370        /// Default, unspecified value.
5371        Unspecified,
5372        /// Universally Unique Identifier, version 4, value as defined by
5373        /// <https://datatracker.ietf.org/doc/html/rfc4122>. The value may be
5374        /// normalized to entirely lowercase letters. For example, the value
5375        /// `F47AC10B-58CC-0372-8567-0E02B2C3D479` would be normalized to
5376        /// `f47ac10b-58cc-0372-8567-0e02b2c3d479`.
5377        Uuid4,
5378        /// Internet Protocol v4 value as defined by [RFC
5379        /// 791](https://datatracker.ietf.org/doc/html/rfc791). The value may be
5380        /// condensed, with leading zeros in each octet stripped. For example,
5381        /// `001.022.233.040` would be condensed to `1.22.233.40`.
5382        Ipv4,
5383        /// Internet Protocol v6 value as defined by [RFC
5384        /// 2460](https://datatracker.ietf.org/doc/html/rfc2460). The value may be
5385        /// normalized to entirely lowercase letters with zeros compressed, following
5386        /// [RFC 5952](https://datatracker.ietf.org/doc/html/rfc5952). For example,
5387        /// the value `2001:0DB8:0::0` would be normalized to `2001:db8::`.
5388        Ipv6,
5389        /// An IP address in either v4 or v6 format as described by the individual
5390        /// values defined herein. See the comments on the IPV4 and IPV6 types for
5391        /// allowed normalizations of each.
5392        Ipv4OrIpv6,
5393        /// If set, the enum was initialized with an unknown value.
5394        ///
5395        /// Applications can examine the value using [Format::value] or
5396        /// [Format::name].
5397        UnknownValue(format::UnknownValue),
5398    }
5399
5400    #[doc(hidden)]
5401    pub mod format {
5402        #[allow(unused_imports)]
5403        use super::*;
5404        #[derive(Clone, Debug, PartialEq)]
5405        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5406    }
5407
5408    impl Format {
5409        /// Gets the enum value.
5410        ///
5411        /// Returns `None` if the enum contains an unknown value deserialized from
5412        /// the string representation of enums.
5413        pub fn value(&self) -> std::option::Option<i32> {
5414            match self {
5415                Self::Unspecified => std::option::Option::Some(0),
5416                Self::Uuid4 => std::option::Option::Some(1),
5417                Self::Ipv4 => std::option::Option::Some(2),
5418                Self::Ipv6 => std::option::Option::Some(3),
5419                Self::Ipv4OrIpv6 => std::option::Option::Some(4),
5420                Self::UnknownValue(u) => u.0.value(),
5421            }
5422        }
5423
5424        /// Gets the enum value as a string.
5425        ///
5426        /// Returns `None` if the enum contains an unknown value deserialized from
5427        /// the integer representation of enums.
5428        pub fn name(&self) -> std::option::Option<&str> {
5429            match self {
5430                Self::Unspecified => std::option::Option::Some("FORMAT_UNSPECIFIED"),
5431                Self::Uuid4 => std::option::Option::Some("UUID4"),
5432                Self::Ipv4 => std::option::Option::Some("IPV4"),
5433                Self::Ipv6 => std::option::Option::Some("IPV6"),
5434                Self::Ipv4OrIpv6 => std::option::Option::Some("IPV4_OR_IPV6"),
5435                Self::UnknownValue(u) => u.0.name(),
5436            }
5437        }
5438    }
5439
5440    impl std::default::Default for Format {
5441        fn default() -> Self {
5442            use std::convert::From;
5443            Self::from(0)
5444        }
5445    }
5446
5447    impl std::fmt::Display for Format {
5448        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5449            wkt::internal::display_enum(f, self.name(), self.value())
5450        }
5451    }
5452
5453    impl std::convert::From<i32> for Format {
5454        fn from(value: i32) -> Self {
5455            match value {
5456                0 => Self::Unspecified,
5457                1 => Self::Uuid4,
5458                2 => Self::Ipv4,
5459                3 => Self::Ipv6,
5460                4 => Self::Ipv4OrIpv6,
5461                _ => Self::UnknownValue(format::UnknownValue(
5462                    wkt::internal::UnknownEnumValue::Integer(value),
5463                )),
5464            }
5465        }
5466    }
5467
5468    impl std::convert::From<&str> for Format {
5469        fn from(value: &str) -> Self {
5470            use std::string::ToString;
5471            match value {
5472                "FORMAT_UNSPECIFIED" => Self::Unspecified,
5473                "UUID4" => Self::Uuid4,
5474                "IPV4" => Self::Ipv4,
5475                "IPV6" => Self::Ipv6,
5476                "IPV4_OR_IPV6" => Self::Ipv4OrIpv6,
5477                _ => Self::UnknownValue(format::UnknownValue(
5478                    wkt::internal::UnknownEnumValue::String(value.to_string()),
5479                )),
5480            }
5481        }
5482    }
5483
5484    impl serde::ser::Serialize for Format {
5485        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5486        where
5487            S: serde::Serializer,
5488        {
5489            match self {
5490                Self::Unspecified => serializer.serialize_i32(0),
5491                Self::Uuid4 => serializer.serialize_i32(1),
5492                Self::Ipv4 => serializer.serialize_i32(2),
5493                Self::Ipv6 => serializer.serialize_i32(3),
5494                Self::Ipv4OrIpv6 => serializer.serialize_i32(4),
5495                Self::UnknownValue(u) => u.0.serialize(serializer),
5496            }
5497        }
5498    }
5499
5500    impl<'de> serde::de::Deserialize<'de> for Format {
5501        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5502        where
5503            D: serde::Deserializer<'de>,
5504        {
5505            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Format>::new(
5506                ".google.api.FieldInfo.Format",
5507            ))
5508        }
5509    }
5510}
5511
5512/// A reference to a message type, for use in [FieldInfo][google.api.FieldInfo].
5513///
5514/// [google.api.FieldInfo]: crate::model::FieldInfo
5515#[derive(Clone, Default, PartialEq)]
5516#[non_exhaustive]
5517pub struct TypeReference {
5518    /// The name of the type that the annotated, generic field may represent.
5519    /// If the type is in the same protobuf package, the value can be the simple
5520    /// message name e.g., `"MyMessage"`. Otherwise, the value must be the
5521    /// fully-qualified message name e.g., `"google.library.v1.Book"`.
5522    ///
5523    /// If the type(s) are unknown to the service (e.g. the field accepts generic
5524    /// user input), use the wildcard `"*"` to denote this behavior.
5525    ///
5526    /// See [AIP-202](https://google.aip.dev/202#type-references) for more details.
5527    pub type_name: std::string::String,
5528
5529    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5530}
5531
5532impl TypeReference {
5533    pub fn new() -> Self {
5534        std::default::Default::default()
5535    }
5536
5537    /// Sets the value of [type_name][crate::model::TypeReference::type_name].
5538    ///
5539    /// # Example
5540    /// ```ignore,no_run
5541    /// # use google_cloud_api::model::TypeReference;
5542    /// let x = TypeReference::new().set_type_name("example");
5543    /// ```
5544    pub fn set_type_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5545        self.type_name = v.into();
5546        self
5547    }
5548}
5549
5550impl wkt::message::Message for TypeReference {
5551    fn typename() -> &'static str {
5552        "type.googleapis.com/google.api.TypeReference"
5553    }
5554}
5555
5556/// Defines the HTTP configuration for an API service. It contains a list of
5557/// [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method
5558/// to one or more HTTP REST API methods.
5559///
5560/// [google.api.HttpRule]: crate::model::HttpRule
5561#[derive(Clone, Default, PartialEq)]
5562#[non_exhaustive]
5563pub struct Http {
5564    /// A list of HTTP configuration rules that apply to individual API methods.
5565    ///
5566    /// **NOTE:** All service configuration rules follow "last one wins" order.
5567    pub rules: std::vec::Vec<crate::model::HttpRule>,
5568
5569    /// When set to true, URL path parameters will be fully URI-decoded except in
5570    /// cases of single segment matches in reserved expansion, where "%2F" will be
5571    /// left encoded.
5572    ///
5573    /// The default behavior is to not decode RFC 6570 reserved characters in multi
5574    /// segment matches.
5575    pub fully_decode_reserved_expansion: bool,
5576
5577    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5578}
5579
5580impl Http {
5581    pub fn new() -> Self {
5582        std::default::Default::default()
5583    }
5584
5585    /// Sets the value of [rules][crate::model::Http::rules].
5586    ///
5587    /// # Example
5588    /// ```ignore,no_run
5589    /// # use google_cloud_api::model::Http;
5590    /// use google_cloud_api::model::HttpRule;
5591    /// let x = Http::new()
5592    ///     .set_rules([
5593    ///         HttpRule::default()/* use setters */,
5594    ///         HttpRule::default()/* use (different) setters */,
5595    ///     ]);
5596    /// ```
5597    pub fn set_rules<T, V>(mut self, v: T) -> Self
5598    where
5599        T: std::iter::IntoIterator<Item = V>,
5600        V: std::convert::Into<crate::model::HttpRule>,
5601    {
5602        use std::iter::Iterator;
5603        self.rules = v.into_iter().map(|i| i.into()).collect();
5604        self
5605    }
5606
5607    /// Sets the value of [fully_decode_reserved_expansion][crate::model::Http::fully_decode_reserved_expansion].
5608    ///
5609    /// # Example
5610    /// ```ignore,no_run
5611    /// # use google_cloud_api::model::Http;
5612    /// let x = Http::new().set_fully_decode_reserved_expansion(true);
5613    /// ```
5614    pub fn set_fully_decode_reserved_expansion<T: std::convert::Into<bool>>(
5615        mut self,
5616        v: T,
5617    ) -> Self {
5618        self.fully_decode_reserved_expansion = v.into();
5619        self
5620    }
5621}
5622
5623impl wkt::message::Message for Http {
5624    fn typename() -> &'static str {
5625        "type.googleapis.com/google.api.Http"
5626    }
5627}
5628
5629/// gRPC Transcoding
5630///
5631/// gRPC Transcoding is a feature for mapping between a gRPC method and one or
5632/// more HTTP REST endpoints. It allows developers to build a single API service
5633/// that supports both gRPC APIs and REST APIs. Many systems, including [Google
5634/// APIs](https://github.com/googleapis/googleapis),
5635/// [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC
5636/// Gateway](https://github.com/grpc-ecosystem/grpc-gateway),
5637/// and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature
5638/// and use it for large scale production services.
5639///
5640/// `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies
5641/// how different portions of the gRPC request message are mapped to the URL
5642/// path, URL query parameters, and HTTP request body. It also controls how the
5643/// gRPC response message is mapped to the HTTP response body. `HttpRule` is
5644/// typically specified as an `google.api.http` annotation on the gRPC method.
5645///
5646/// Each mapping specifies a URL path template and an HTTP method. The path
5647/// template may refer to one or more fields in the gRPC request message, as long
5648/// as each field is a non-repeated field with a primitive (non-message) type.
5649/// The path template controls how fields of the request message are mapped to
5650/// the URL path.
5651///
5652/// Example:
5653///
5654/// ```norust
5655/// service Messaging {
5656///   rpc GetMessage(GetMessageRequest) returns (Message) {
5657///     option (google.api.http) = {
5658///         get: "/v1/{name=messages/*}"
5659///     };
5660///   }
5661/// }
5662/// message GetMessageRequest {
5663///   string name = 1; // Mapped to URL path.
5664/// }
5665/// message Message {
5666///   string text = 1; // The resource content.
5667/// }
5668/// ```
5669///
5670/// This enables an HTTP REST to gRPC mapping as below:
5671///
5672/// - HTTP: `GET /v1/messages/123456`
5673/// - gRPC: `GetMessage(name: "messages/123456")`
5674///
5675/// Any fields in the request message which are not bound by the path template
5676/// automatically become HTTP query parameters if there is no HTTP request body.
5677/// For example:
5678///
5679/// ```norust
5680/// service Messaging {
5681///   rpc GetMessage(GetMessageRequest) returns (Message) {
5682///     option (google.api.http) = {
5683///         get:"/v1/messages/{message_id}"
5684///     };
5685///   }
5686/// }
5687/// message GetMessageRequest {
5688///   message SubMessage {
5689///     string subfield = 1;
5690///   }
5691///   string message_id = 1; // Mapped to URL path.
5692///   int64 revision = 2;    // Mapped to URL query parameter `revision`.
5693///   SubMessage sub = 3;    // Mapped to URL query parameter `sub.subfield`.
5694/// }
5695/// ```
5696///
5697/// This enables a HTTP JSON to RPC mapping as below:
5698///
5699/// - HTTP: `GET /v1/messages/123456?revision=2&sub.subfield=foo`
5700/// - gRPC: `GetMessage(message_id: "123456" revision: 2 sub:
5701///   SubMessage(subfield: "foo"))`
5702///
5703/// Note that fields which are mapped to URL query parameters must have a
5704/// primitive type or a repeated primitive type or a non-repeated message type.
5705/// In the case of a repeated type, the parameter can be repeated in the URL
5706/// as `...?param=A&param=B`. In the case of a message type, each field of the
5707/// message is mapped to a separate parameter, such as
5708/// `...?foo.a=A&foo.b=B&foo.c=C`.
5709///
5710/// For HTTP methods that allow a request body, the `body` field
5711/// specifies the mapping. Consider a REST update method on the
5712/// message resource collection:
5713///
5714/// ```norust
5715/// service Messaging {
5716///   rpc UpdateMessage(UpdateMessageRequest) returns (Message) {
5717///     option (google.api.http) = {
5718///       patch: "/v1/messages/{message_id}"
5719///       body: "message"
5720///     };
5721///   }
5722/// }
5723/// message UpdateMessageRequest {
5724///   string message_id = 1; // mapped to the URL
5725///   Message message = 2;   // mapped to the body
5726/// }
5727/// ```
5728///
5729/// The following HTTP JSON to RPC mapping is enabled, where the
5730/// representation of the JSON in the request body is determined by
5731/// protos JSON encoding:
5732///
5733/// - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }`
5734/// - gRPC: `UpdateMessage(message_id: "123456" message { text: "Hi!" })`
5735///
5736/// The special name `*` can be used in the body mapping to define that
5737/// every field not bound by the path template should be mapped to the
5738/// request body.  This enables the following alternative definition of
5739/// the update method:
5740///
5741/// ```norust
5742/// service Messaging {
5743///   rpc UpdateMessage(Message) returns (Message) {
5744///     option (google.api.http) = {
5745///       patch: "/v1/messages/{message_id}"
5746///       body: "*"
5747///     };
5748///   }
5749/// }
5750/// message Message {
5751///   string message_id = 1;
5752///   string text = 2;
5753/// }
5754/// ```
5755///
5756/// The following HTTP JSON to RPC mapping is enabled:
5757///
5758/// - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }`
5759/// - gRPC: `UpdateMessage(message_id: "123456" text: "Hi!")`
5760///
5761/// Note that when using `*` in the body mapping, it is not possible to
5762/// have HTTP parameters, as all fields not bound by the path end in
5763/// the body. This makes this option more rarely used in practice when
5764/// defining REST APIs. The common usage of `*` is in custom methods
5765/// which don't use the URL at all for transferring data.
5766///
5767/// It is possible to define multiple HTTP methods for one RPC by using
5768/// the `additional_bindings` option. Example:
5769///
5770/// ```norust
5771/// service Messaging {
5772///   rpc GetMessage(GetMessageRequest) returns (Message) {
5773///     option (google.api.http) = {
5774///       get: "/v1/messages/{message_id}"
5775///       additional_bindings {
5776///         get: "/v1/users/{user_id}/messages/{message_id}"
5777///       }
5778///     };
5779///   }
5780/// }
5781/// message GetMessageRequest {
5782///   string message_id = 1;
5783///   string user_id = 2;
5784/// }
5785/// ```
5786///
5787/// This enables the following two alternative HTTP JSON to RPC mappings:
5788///
5789/// - HTTP: `GET /v1/messages/123456`
5790///
5791/// - gRPC: `GetMessage(message_id: "123456")`
5792///
5793/// - HTTP: `GET /v1/users/me/messages/123456`
5794///
5795/// - gRPC: `GetMessage(user_id: "me" message_id: "123456")`
5796///
5797///
5798/// Rules for HTTP mapping
5799///
5800/// 1. Leaf request fields (recursive expansion nested messages in the request
5801///    message) are classified into three categories:
5802///    - Fields referred by the path template. They are passed via the URL path.
5803///    - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They
5804///      are passed via the HTTP
5805///      request body.
5806///    - All other fields are passed via the URL query parameters, and the
5807///      parameter name is the field path in the request message. A repeated
5808///      field can be represented as multiple query parameters under the same
5809///      name.
5810/// 1. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL
5811///    query parameter, all fields
5812///    are passed via URL path and HTTP request body.
5813/// 1. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP
5814///    request body, all
5815///    fields are passed via URL path and URL query parameters.
5816///
5817/// Path template syntax
5818///
5819/// ```norust
5820/// Template = "/" Segments [ Verb ] ;
5821/// Segments = Segment { "/" Segment } ;
5822/// Segment  = "*" | "**" | LITERAL | Variable ;
5823/// Variable = "{" FieldPath [ "=" Segments ] "}" ;
5824/// FieldPath = IDENT { "." IDENT } ;
5825/// Verb     = ":" LITERAL ;
5826/// ```
5827///
5828/// The syntax `*` matches a single URL path segment. The syntax `**` matches
5829/// zero or more URL path segments, which must be the last part of the URL path
5830/// except the `Verb`.
5831///
5832/// The syntax `Variable` matches part of the URL path as specified by its
5833/// template. A variable template must not contain other variables. If a variable
5834/// matches a single path segment, its template may be omitted, e.g. `{var}`
5835/// is equivalent to `{var=*}`.
5836///
5837/// The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL`
5838/// contains any reserved character, such characters should be percent-encoded
5839/// before the matching.
5840///
5841/// If a variable contains exactly one path segment, such as `"{var}"` or
5842/// `"{var=*}"`, when such a variable is expanded into a URL path on the client
5843/// side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The
5844/// server side does the reverse decoding. Such variables show up in the
5845/// [Discovery
5846/// Document](https://developers.google.com/discovery/v1/reference/apis) as
5847/// `{var}`.
5848///
5849/// If a variable contains multiple path segments, such as `"{var=foo/*}"`
5850/// or `"{var=**}"`, when such a variable is expanded into a URL path on the
5851/// client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded.
5852/// The server side does the reverse decoding, except "%2F" and "%2f" are left
5853/// unchanged. Such variables show up in the
5854/// [Discovery
5855/// Document](https://developers.google.com/discovery/v1/reference/apis) as
5856/// `{+var}`.
5857///
5858/// Using gRPC API Service Configuration
5859///
5860/// gRPC API Service Configuration (service config) is a configuration language
5861/// for configuring a gRPC service to become a user-facing product. The
5862/// service config is simply the YAML representation of the `google.api.Service`
5863/// proto message.
5864///
5865/// As an alternative to annotating your proto file, you can configure gRPC
5866/// transcoding in your service config YAML files. You do this by specifying a
5867/// `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same
5868/// effect as the proto annotation. This can be particularly useful if you
5869/// have a proto that is reused in multiple services. Note that any transcoding
5870/// specified in the service config will override any matching transcoding
5871/// configuration in the proto.
5872///
5873/// The following example selects a gRPC method and applies an `HttpRule` to it:
5874///
5875/// ```norust
5876/// http:
5877///   rules:
5878///     - selector: example.v1.Messaging.GetMessage
5879///       get: /v1/messages/{message_id}/{sub.subfield}
5880/// ```
5881///
5882/// Special notes
5883///
5884/// When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the
5885/// proto to JSON conversion must follow the [proto3
5886/// specification](https://developers.google.com/protocol-buffers/docs/proto3#json).
5887///
5888/// While the single segment variable follows the semantics of
5889/// [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String
5890/// Expansion, the multi segment variable **does not** follow RFC 6570 Section
5891/// 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion
5892/// does not expand special characters like `?` and `#`, which would lead
5893/// to invalid URLs. As the result, gRPC Transcoding uses a custom encoding
5894/// for multi segment variables.
5895///
5896/// The path variables **must not** refer to any repeated or mapped field,
5897/// because client libraries are not capable of handling such variable expansion.
5898///
5899/// The path variables **must not** capture the leading "/" character. The reason
5900/// is that the most common use case "{var}" does not capture the leading "/"
5901/// character. For consistency, all path variables must share the same behavior.
5902///
5903/// Repeated message fields must not be mapped to URL query parameters, because
5904/// no client library can support such complicated mapping.
5905///
5906/// If an API needs to use a JSON array for request or response body, it can map
5907/// the request or response body to a repeated field. However, some gRPC
5908/// Transcoding implementations may not support this feature.
5909///
5910/// [google.api.HttpRule.body]: crate::model::HttpRule::body
5911#[derive(Clone, Default, PartialEq)]
5912#[non_exhaustive]
5913pub struct HttpRule {
5914    /// Selects a method to which this rule applies.
5915    ///
5916    /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
5917    /// details.
5918    ///
5919    /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
5920    pub selector: std::string::String,
5921
5922    /// The name of the request field whose value is mapped to the HTTP request
5923    /// body, or `*` for mapping all request fields not captured by the path
5924    /// pattern to the HTTP body, or omitted for not having any HTTP request body.
5925    ///
5926    /// NOTE: the referred field must be present at the top-level of the request
5927    /// message type.
5928    pub body: std::string::String,
5929
5930    /// Optional. The name of the response field whose value is mapped to the HTTP
5931    /// response body. When omitted, the entire response message will be used
5932    /// as the HTTP response body.
5933    ///
5934    /// NOTE: The referred field must be present at the top-level of the response
5935    /// message type.
5936    pub response_body: std::string::String,
5937
5938    /// Additional HTTP bindings for the selector. Nested bindings must
5939    /// not contain an `additional_bindings` field themselves (that is,
5940    /// the nesting may only be one level deep).
5941    pub additional_bindings: std::vec::Vec<crate::model::HttpRule>,
5942
5943    /// Determines the URL pattern is matched by this rules. This pattern can be
5944    /// used with any of the {get|put|post|delete|patch} methods. A custom method
5945    /// can be defined using the 'custom' field.
5946    pub pattern: std::option::Option<crate::model::http_rule::Pattern>,
5947
5948    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5949}
5950
5951impl HttpRule {
5952    pub fn new() -> Self {
5953        std::default::Default::default()
5954    }
5955
5956    /// Sets the value of [selector][crate::model::HttpRule::selector].
5957    ///
5958    /// # Example
5959    /// ```ignore,no_run
5960    /// # use google_cloud_api::model::HttpRule;
5961    /// let x = HttpRule::new().set_selector("example");
5962    /// ```
5963    pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5964        self.selector = v.into();
5965        self
5966    }
5967
5968    /// Sets the value of [body][crate::model::HttpRule::body].
5969    ///
5970    /// # Example
5971    /// ```ignore,no_run
5972    /// # use google_cloud_api::model::HttpRule;
5973    /// let x = HttpRule::new().set_body("example");
5974    /// ```
5975    pub fn set_body<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5976        self.body = v.into();
5977        self
5978    }
5979
5980    /// Sets the value of [response_body][crate::model::HttpRule::response_body].
5981    ///
5982    /// # Example
5983    /// ```ignore,no_run
5984    /// # use google_cloud_api::model::HttpRule;
5985    /// let x = HttpRule::new().set_response_body("example");
5986    /// ```
5987    pub fn set_response_body<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5988        self.response_body = v.into();
5989        self
5990    }
5991
5992    /// Sets the value of [additional_bindings][crate::model::HttpRule::additional_bindings].
5993    ///
5994    /// # Example
5995    /// ```ignore,no_run
5996    /// # use google_cloud_api::model::HttpRule;
5997    /// let x = HttpRule::new()
5998    ///     .set_additional_bindings([
5999    ///         HttpRule::default()/* use setters */,
6000    ///         HttpRule::default()/* use (different) setters */,
6001    ///     ]);
6002    /// ```
6003    pub fn set_additional_bindings<T, V>(mut self, v: T) -> Self
6004    where
6005        T: std::iter::IntoIterator<Item = V>,
6006        V: std::convert::Into<crate::model::HttpRule>,
6007    {
6008        use std::iter::Iterator;
6009        self.additional_bindings = v.into_iter().map(|i| i.into()).collect();
6010        self
6011    }
6012
6013    /// Sets the value of [pattern][crate::model::HttpRule::pattern].
6014    ///
6015    /// Note that all the setters affecting `pattern` are mutually
6016    /// exclusive.
6017    ///
6018    /// # Example
6019    /// ```ignore,no_run
6020    /// # use google_cloud_api::model::HttpRule;
6021    /// use google_cloud_api::model::http_rule::Pattern;
6022    /// let x = HttpRule::new().set_pattern(Some(Pattern::Get("example".to_string())));
6023    /// ```
6024    pub fn set_pattern<
6025        T: std::convert::Into<std::option::Option<crate::model::http_rule::Pattern>>,
6026    >(
6027        mut self,
6028        v: T,
6029    ) -> Self {
6030        self.pattern = v.into();
6031        self
6032    }
6033
6034    /// The value of [pattern][crate::model::HttpRule::pattern]
6035    /// if it holds a `Get`, `None` if the field is not set or
6036    /// holds a different branch.
6037    pub fn get(&self) -> std::option::Option<&std::string::String> {
6038        #[allow(unreachable_patterns)]
6039        self.pattern.as_ref().and_then(|v| match v {
6040            crate::model::http_rule::Pattern::Get(v) => std::option::Option::Some(v),
6041            _ => std::option::Option::None,
6042        })
6043    }
6044
6045    /// Sets the value of [pattern][crate::model::HttpRule::pattern]
6046    /// to hold a `Get`.
6047    ///
6048    /// Note that all the setters affecting `pattern` are
6049    /// mutually exclusive.
6050    ///
6051    /// # Example
6052    /// ```ignore,no_run
6053    /// # use google_cloud_api::model::HttpRule;
6054    /// let x = HttpRule::new().set_get("example");
6055    /// assert!(x.get().is_some());
6056    /// assert!(x.put().is_none());
6057    /// assert!(x.post().is_none());
6058    /// assert!(x.delete().is_none());
6059    /// assert!(x.patch().is_none());
6060    /// assert!(x.custom().is_none());
6061    /// ```
6062    pub fn set_get<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6063        self.pattern = std::option::Option::Some(crate::model::http_rule::Pattern::Get(v.into()));
6064        self
6065    }
6066
6067    /// The value of [pattern][crate::model::HttpRule::pattern]
6068    /// if it holds a `Put`, `None` if the field is not set or
6069    /// holds a different branch.
6070    pub fn put(&self) -> std::option::Option<&std::string::String> {
6071        #[allow(unreachable_patterns)]
6072        self.pattern.as_ref().and_then(|v| match v {
6073            crate::model::http_rule::Pattern::Put(v) => std::option::Option::Some(v),
6074            _ => std::option::Option::None,
6075        })
6076    }
6077
6078    /// Sets the value of [pattern][crate::model::HttpRule::pattern]
6079    /// to hold a `Put`.
6080    ///
6081    /// Note that all the setters affecting `pattern` are
6082    /// mutually exclusive.
6083    ///
6084    /// # Example
6085    /// ```ignore,no_run
6086    /// # use google_cloud_api::model::HttpRule;
6087    /// let x = HttpRule::new().set_put("example");
6088    /// assert!(x.put().is_some());
6089    /// assert!(x.get().is_none());
6090    /// assert!(x.post().is_none());
6091    /// assert!(x.delete().is_none());
6092    /// assert!(x.patch().is_none());
6093    /// assert!(x.custom().is_none());
6094    /// ```
6095    pub fn set_put<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6096        self.pattern = std::option::Option::Some(crate::model::http_rule::Pattern::Put(v.into()));
6097        self
6098    }
6099
6100    /// The value of [pattern][crate::model::HttpRule::pattern]
6101    /// if it holds a `Post`, `None` if the field is not set or
6102    /// holds a different branch.
6103    pub fn post(&self) -> std::option::Option<&std::string::String> {
6104        #[allow(unreachable_patterns)]
6105        self.pattern.as_ref().and_then(|v| match v {
6106            crate::model::http_rule::Pattern::Post(v) => std::option::Option::Some(v),
6107            _ => std::option::Option::None,
6108        })
6109    }
6110
6111    /// Sets the value of [pattern][crate::model::HttpRule::pattern]
6112    /// to hold a `Post`.
6113    ///
6114    /// Note that all the setters affecting `pattern` are
6115    /// mutually exclusive.
6116    ///
6117    /// # Example
6118    /// ```ignore,no_run
6119    /// # use google_cloud_api::model::HttpRule;
6120    /// let x = HttpRule::new().set_post("example");
6121    /// assert!(x.post().is_some());
6122    /// assert!(x.get().is_none());
6123    /// assert!(x.put().is_none());
6124    /// assert!(x.delete().is_none());
6125    /// assert!(x.patch().is_none());
6126    /// assert!(x.custom().is_none());
6127    /// ```
6128    pub fn set_post<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6129        self.pattern = std::option::Option::Some(crate::model::http_rule::Pattern::Post(v.into()));
6130        self
6131    }
6132
6133    /// The value of [pattern][crate::model::HttpRule::pattern]
6134    /// if it holds a `Delete`, `None` if the field is not set or
6135    /// holds a different branch.
6136    pub fn delete(&self) -> std::option::Option<&std::string::String> {
6137        #[allow(unreachable_patterns)]
6138        self.pattern.as_ref().and_then(|v| match v {
6139            crate::model::http_rule::Pattern::Delete(v) => std::option::Option::Some(v),
6140            _ => std::option::Option::None,
6141        })
6142    }
6143
6144    /// Sets the value of [pattern][crate::model::HttpRule::pattern]
6145    /// to hold a `Delete`.
6146    ///
6147    /// Note that all the setters affecting `pattern` are
6148    /// mutually exclusive.
6149    ///
6150    /// # Example
6151    /// ```ignore,no_run
6152    /// # use google_cloud_api::model::HttpRule;
6153    /// let x = HttpRule::new().set_delete("example");
6154    /// assert!(x.delete().is_some());
6155    /// assert!(x.get().is_none());
6156    /// assert!(x.put().is_none());
6157    /// assert!(x.post().is_none());
6158    /// assert!(x.patch().is_none());
6159    /// assert!(x.custom().is_none());
6160    /// ```
6161    pub fn set_delete<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6162        self.pattern =
6163            std::option::Option::Some(crate::model::http_rule::Pattern::Delete(v.into()));
6164        self
6165    }
6166
6167    /// The value of [pattern][crate::model::HttpRule::pattern]
6168    /// if it holds a `Patch`, `None` if the field is not set or
6169    /// holds a different branch.
6170    pub fn patch(&self) -> std::option::Option<&std::string::String> {
6171        #[allow(unreachable_patterns)]
6172        self.pattern.as_ref().and_then(|v| match v {
6173            crate::model::http_rule::Pattern::Patch(v) => std::option::Option::Some(v),
6174            _ => std::option::Option::None,
6175        })
6176    }
6177
6178    /// Sets the value of [pattern][crate::model::HttpRule::pattern]
6179    /// to hold a `Patch`.
6180    ///
6181    /// Note that all the setters affecting `pattern` are
6182    /// mutually exclusive.
6183    ///
6184    /// # Example
6185    /// ```ignore,no_run
6186    /// # use google_cloud_api::model::HttpRule;
6187    /// let x = HttpRule::new().set_patch("example");
6188    /// assert!(x.patch().is_some());
6189    /// assert!(x.get().is_none());
6190    /// assert!(x.put().is_none());
6191    /// assert!(x.post().is_none());
6192    /// assert!(x.delete().is_none());
6193    /// assert!(x.custom().is_none());
6194    /// ```
6195    pub fn set_patch<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6196        self.pattern = std::option::Option::Some(crate::model::http_rule::Pattern::Patch(v.into()));
6197        self
6198    }
6199
6200    /// The value of [pattern][crate::model::HttpRule::pattern]
6201    /// if it holds a `Custom`, `None` if the field is not set or
6202    /// holds a different branch.
6203    pub fn custom(&self) -> std::option::Option<&std::boxed::Box<crate::model::CustomHttpPattern>> {
6204        #[allow(unreachable_patterns)]
6205        self.pattern.as_ref().and_then(|v| match v {
6206            crate::model::http_rule::Pattern::Custom(v) => std::option::Option::Some(v),
6207            _ => std::option::Option::None,
6208        })
6209    }
6210
6211    /// Sets the value of [pattern][crate::model::HttpRule::pattern]
6212    /// to hold a `Custom`.
6213    ///
6214    /// Note that all the setters affecting `pattern` are
6215    /// mutually exclusive.
6216    ///
6217    /// # Example
6218    /// ```ignore,no_run
6219    /// # use google_cloud_api::model::HttpRule;
6220    /// use google_cloud_api::model::CustomHttpPattern;
6221    /// let x = HttpRule::new().set_custom(CustomHttpPattern::default()/* use setters */);
6222    /// assert!(x.custom().is_some());
6223    /// assert!(x.get().is_none());
6224    /// assert!(x.put().is_none());
6225    /// assert!(x.post().is_none());
6226    /// assert!(x.delete().is_none());
6227    /// assert!(x.patch().is_none());
6228    /// ```
6229    pub fn set_custom<T: std::convert::Into<std::boxed::Box<crate::model::CustomHttpPattern>>>(
6230        mut self,
6231        v: T,
6232    ) -> Self {
6233        self.pattern =
6234            std::option::Option::Some(crate::model::http_rule::Pattern::Custom(v.into()));
6235        self
6236    }
6237}
6238
6239impl wkt::message::Message for HttpRule {
6240    fn typename() -> &'static str {
6241        "type.googleapis.com/google.api.HttpRule"
6242    }
6243}
6244
6245/// Defines additional types related to [HttpRule].
6246pub mod http_rule {
6247    #[allow(unused_imports)]
6248    use super::*;
6249
6250    /// Determines the URL pattern is matched by this rules. This pattern can be
6251    /// used with any of the {get|put|post|delete|patch} methods. A custom method
6252    /// can be defined using the 'custom' field.
6253    #[derive(Clone, Debug, PartialEq)]
6254    #[non_exhaustive]
6255    pub enum Pattern {
6256        /// Maps to HTTP GET. Used for listing and getting information about
6257        /// resources.
6258        Get(std::string::String),
6259        /// Maps to HTTP PUT. Used for replacing a resource.
6260        Put(std::string::String),
6261        /// Maps to HTTP POST. Used for creating a resource or performing an action.
6262        Post(std::string::String),
6263        /// Maps to HTTP DELETE. Used for deleting a resource.
6264        Delete(std::string::String),
6265        /// Maps to HTTP PATCH. Used for updating a resource.
6266        Patch(std::string::String),
6267        /// The custom pattern is used for specifying an HTTP method that is not
6268        /// included in the `pattern` field, such as HEAD, or "*" to leave the
6269        /// HTTP method unspecified for this rule. The wild-card rule is useful
6270        /// for services that provide content to Web (HTML) clients.
6271        Custom(std::boxed::Box<crate::model::CustomHttpPattern>),
6272    }
6273}
6274
6275/// A custom pattern is used for defining custom HTTP verb.
6276#[derive(Clone, Default, PartialEq)]
6277#[non_exhaustive]
6278pub struct CustomHttpPattern {
6279    /// The name of this custom HTTP verb.
6280    pub kind: std::string::String,
6281
6282    /// The path matched by this custom verb.
6283    pub path: std::string::String,
6284
6285    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6286}
6287
6288impl CustomHttpPattern {
6289    pub fn new() -> Self {
6290        std::default::Default::default()
6291    }
6292
6293    /// Sets the value of [kind][crate::model::CustomHttpPattern::kind].
6294    ///
6295    /// # Example
6296    /// ```ignore,no_run
6297    /// # use google_cloud_api::model::CustomHttpPattern;
6298    /// let x = CustomHttpPattern::new().set_kind("example");
6299    /// ```
6300    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6301        self.kind = v.into();
6302        self
6303    }
6304
6305    /// Sets the value of [path][crate::model::CustomHttpPattern::path].
6306    ///
6307    /// # Example
6308    /// ```ignore,no_run
6309    /// # use google_cloud_api::model::CustomHttpPattern;
6310    /// let x = CustomHttpPattern::new().set_path("example");
6311    /// ```
6312    pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6313        self.path = v.into();
6314        self
6315    }
6316}
6317
6318impl wkt::message::Message for CustomHttpPattern {
6319    fn typename() -> &'static str {
6320        "type.googleapis.com/google.api.CustomHttpPattern"
6321    }
6322}
6323
6324/// Message that represents an arbitrary HTTP body. It should only be used for
6325/// payload formats that can't be represented as JSON, such as raw binary or
6326/// an HTML page.
6327///
6328/// This message can be used both in streaming and non-streaming API methods in
6329/// the request as well as the response.
6330///
6331/// It can be used as a top-level request field, which is convenient if one
6332/// wants to extract parameters from either the URL or HTTP template into the
6333/// request fields and also want access to the raw HTTP body.
6334///
6335/// Example:
6336///
6337/// ```norust
6338/// message GetResourceRequest {
6339///   // A unique request id.
6340///   string request_id = 1;
6341///
6342///   // The raw HTTP body is bound to this field.
6343///   google.api.HttpBody http_body = 2;
6344///
6345/// }
6346///
6347/// service ResourceService {
6348///   rpc GetResource(GetResourceRequest)
6349///     returns (google.api.HttpBody);
6350///   rpc UpdateResource(google.api.HttpBody)
6351///     returns (google.protobuf.Empty);
6352///
6353/// }
6354/// ```
6355///
6356/// Example with streaming methods:
6357///
6358/// ```norust
6359/// service CaldavService {
6360///   rpc GetCalendar(stream google.api.HttpBody)
6361///     returns (stream google.api.HttpBody);
6362///   rpc UpdateCalendar(stream google.api.HttpBody)
6363///     returns (stream google.api.HttpBody);
6364///
6365/// }
6366/// ```
6367///
6368/// Use of this type only changes how the request and response bodies are
6369/// handled, all other features will continue to work unchanged.
6370#[derive(Clone, Default, PartialEq)]
6371#[non_exhaustive]
6372pub struct HttpBody {
6373    /// The HTTP Content-Type header value specifying the content type of the body.
6374    pub content_type: std::string::String,
6375
6376    /// The HTTP request/response body as raw binary.
6377    pub data: ::bytes::Bytes,
6378
6379    /// Application specific response metadata. Must be set in the first response
6380    /// for streaming APIs.
6381    pub extensions: std::vec::Vec<wkt::Any>,
6382
6383    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6384}
6385
6386impl HttpBody {
6387    pub fn new() -> Self {
6388        std::default::Default::default()
6389    }
6390
6391    /// Sets the value of [content_type][crate::model::HttpBody::content_type].
6392    ///
6393    /// # Example
6394    /// ```ignore,no_run
6395    /// # use google_cloud_api::model::HttpBody;
6396    /// let x = HttpBody::new().set_content_type("example");
6397    /// ```
6398    pub fn set_content_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6399        self.content_type = v.into();
6400        self
6401    }
6402
6403    /// Sets the value of [data][crate::model::HttpBody::data].
6404    ///
6405    /// # Example
6406    /// ```ignore,no_run
6407    /// # use google_cloud_api::model::HttpBody;
6408    /// let x = HttpBody::new().set_data(bytes::Bytes::from_static(b"example"));
6409    /// ```
6410    pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
6411        self.data = v.into();
6412        self
6413    }
6414
6415    /// Sets the value of [extensions][crate::model::HttpBody::extensions].
6416    ///
6417    /// # Example
6418    /// ```ignore,no_run
6419    /// # use google_cloud_api::model::HttpBody;
6420    /// use wkt::Any;
6421    /// let x = HttpBody::new()
6422    ///     .set_extensions([
6423    ///         Any::default()/* use setters */,
6424    ///         Any::default()/* use (different) setters */,
6425    ///     ]);
6426    /// ```
6427    pub fn set_extensions<T, V>(mut self, v: T) -> Self
6428    where
6429        T: std::iter::IntoIterator<Item = V>,
6430        V: std::convert::Into<wkt::Any>,
6431    {
6432        use std::iter::Iterator;
6433        self.extensions = v.into_iter().map(|i| i.into()).collect();
6434        self
6435    }
6436}
6437
6438impl wkt::message::Message for HttpBody {
6439    fn typename() -> &'static str {
6440        "type.googleapis.com/google.api.HttpBody"
6441    }
6442}
6443
6444/// A description of a label.
6445#[derive(Clone, Default, PartialEq)]
6446#[non_exhaustive]
6447pub struct LabelDescriptor {
6448    /// The label key.
6449    pub key: std::string::String,
6450
6451    /// The type of data that can be assigned to the label.
6452    pub value_type: crate::model::label_descriptor::ValueType,
6453
6454    /// A human-readable description for the label.
6455    pub description: std::string::String,
6456
6457    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6458}
6459
6460impl LabelDescriptor {
6461    pub fn new() -> Self {
6462        std::default::Default::default()
6463    }
6464
6465    /// Sets the value of [key][crate::model::LabelDescriptor::key].
6466    ///
6467    /// # Example
6468    /// ```ignore,no_run
6469    /// # use google_cloud_api::model::LabelDescriptor;
6470    /// let x = LabelDescriptor::new().set_key("example");
6471    /// ```
6472    pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6473        self.key = v.into();
6474        self
6475    }
6476
6477    /// Sets the value of [value_type][crate::model::LabelDescriptor::value_type].
6478    ///
6479    /// # Example
6480    /// ```ignore,no_run
6481    /// # use google_cloud_api::model::LabelDescriptor;
6482    /// use google_cloud_api::model::label_descriptor::ValueType;
6483    /// let x0 = LabelDescriptor::new().set_value_type(ValueType::Bool);
6484    /// let x1 = LabelDescriptor::new().set_value_type(ValueType::Int64);
6485    /// ```
6486    pub fn set_value_type<T: std::convert::Into<crate::model::label_descriptor::ValueType>>(
6487        mut self,
6488        v: T,
6489    ) -> Self {
6490        self.value_type = v.into();
6491        self
6492    }
6493
6494    /// Sets the value of [description][crate::model::LabelDescriptor::description].
6495    ///
6496    /// # Example
6497    /// ```ignore,no_run
6498    /// # use google_cloud_api::model::LabelDescriptor;
6499    /// let x = LabelDescriptor::new().set_description("example");
6500    /// ```
6501    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6502        self.description = v.into();
6503        self
6504    }
6505}
6506
6507impl wkt::message::Message for LabelDescriptor {
6508    fn typename() -> &'static str {
6509        "type.googleapis.com/google.api.LabelDescriptor"
6510    }
6511}
6512
6513/// Defines additional types related to [LabelDescriptor].
6514pub mod label_descriptor {
6515    #[allow(unused_imports)]
6516    use super::*;
6517
6518    /// Value types that can be used as label values.
6519    ///
6520    /// # Working with unknown values
6521    ///
6522    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6523    /// additional enum variants at any time. Adding new variants is not considered
6524    /// a breaking change. Applications should write their code in anticipation of:
6525    ///
6526    /// - New values appearing in future releases of the client library, **and**
6527    /// - New values received dynamically, without application changes.
6528    ///
6529    /// Please consult the [Working with enums] section in the user guide for some
6530    /// guidelines.
6531    ///
6532    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
6533    #[derive(Clone, Debug, PartialEq)]
6534    #[non_exhaustive]
6535    pub enum ValueType {
6536        /// A variable-length string. This is the default.
6537        String,
6538        /// Boolean; true or false.
6539        Bool,
6540        /// A 64-bit signed integer.
6541        Int64,
6542        /// If set, the enum was initialized with an unknown value.
6543        ///
6544        /// Applications can examine the value using [ValueType::value] or
6545        /// [ValueType::name].
6546        UnknownValue(value_type::UnknownValue),
6547    }
6548
6549    #[doc(hidden)]
6550    pub mod value_type {
6551        #[allow(unused_imports)]
6552        use super::*;
6553        #[derive(Clone, Debug, PartialEq)]
6554        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6555    }
6556
6557    impl ValueType {
6558        /// Gets the enum value.
6559        ///
6560        /// Returns `None` if the enum contains an unknown value deserialized from
6561        /// the string representation of enums.
6562        pub fn value(&self) -> std::option::Option<i32> {
6563            match self {
6564                Self::String => std::option::Option::Some(0),
6565                Self::Bool => std::option::Option::Some(1),
6566                Self::Int64 => std::option::Option::Some(2),
6567                Self::UnknownValue(u) => u.0.value(),
6568            }
6569        }
6570
6571        /// Gets the enum value as a string.
6572        ///
6573        /// Returns `None` if the enum contains an unknown value deserialized from
6574        /// the integer representation of enums.
6575        pub fn name(&self) -> std::option::Option<&str> {
6576            match self {
6577                Self::String => std::option::Option::Some("STRING"),
6578                Self::Bool => std::option::Option::Some("BOOL"),
6579                Self::Int64 => std::option::Option::Some("INT64"),
6580                Self::UnknownValue(u) => u.0.name(),
6581            }
6582        }
6583    }
6584
6585    impl std::default::Default for ValueType {
6586        fn default() -> Self {
6587            use std::convert::From;
6588            Self::from(0)
6589        }
6590    }
6591
6592    impl std::fmt::Display for ValueType {
6593        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6594            wkt::internal::display_enum(f, self.name(), self.value())
6595        }
6596    }
6597
6598    impl std::convert::From<i32> for ValueType {
6599        fn from(value: i32) -> Self {
6600            match value {
6601                0 => Self::String,
6602                1 => Self::Bool,
6603                2 => Self::Int64,
6604                _ => Self::UnknownValue(value_type::UnknownValue(
6605                    wkt::internal::UnknownEnumValue::Integer(value),
6606                )),
6607            }
6608        }
6609    }
6610
6611    impl std::convert::From<&str> for ValueType {
6612        fn from(value: &str) -> Self {
6613            use std::string::ToString;
6614            match value {
6615                "STRING" => Self::String,
6616                "BOOL" => Self::Bool,
6617                "INT64" => Self::Int64,
6618                _ => Self::UnknownValue(value_type::UnknownValue(
6619                    wkt::internal::UnknownEnumValue::String(value.to_string()),
6620                )),
6621            }
6622        }
6623    }
6624
6625    impl serde::ser::Serialize for ValueType {
6626        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6627        where
6628            S: serde::Serializer,
6629        {
6630            match self {
6631                Self::String => serializer.serialize_i32(0),
6632                Self::Bool => serializer.serialize_i32(1),
6633                Self::Int64 => serializer.serialize_i32(2),
6634                Self::UnknownValue(u) => u.0.serialize(serializer),
6635            }
6636        }
6637    }
6638
6639    impl<'de> serde::de::Deserialize<'de> for ValueType {
6640        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6641        where
6642            D: serde::Deserializer<'de>,
6643        {
6644            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ValueType>::new(
6645                ".google.api.LabelDescriptor.ValueType",
6646            ))
6647        }
6648    }
6649}
6650
6651/// A description of a log type. Example in YAML format:
6652///
6653/// ```norust
6654/// - name: library.googleapis.com/activity_history
6655///   description: The history of borrowing and returning library items.
6656///   display_name: Activity
6657///   labels:
6658///   - key: /customer_id
6659///     description: Identifier of a library customer
6660/// ```
6661#[derive(Clone, Default, PartialEq)]
6662#[non_exhaustive]
6663pub struct LogDescriptor {
6664    /// The name of the log. It must be less than 512 characters long and can
6665    /// include the following characters: upper- and lower-case alphanumeric
6666    /// characters [A-Za-z0-9], and punctuation characters including
6667    /// slash, underscore, hyphen, period [/_-.].
6668    pub name: std::string::String,
6669
6670    /// The set of labels that are available to describe a specific log entry.
6671    /// Runtime requests that contain labels not specified here are
6672    /// considered invalid.
6673    pub labels: std::vec::Vec<crate::model::LabelDescriptor>,
6674
6675    /// A human-readable description of this log. This information appears in
6676    /// the documentation and can contain details.
6677    pub description: std::string::String,
6678
6679    /// The human-readable name for this log. This information appears on
6680    /// the user interface and should be concise.
6681    pub display_name: std::string::String,
6682
6683    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6684}
6685
6686impl LogDescriptor {
6687    pub fn new() -> Self {
6688        std::default::Default::default()
6689    }
6690
6691    /// Sets the value of [name][crate::model::LogDescriptor::name].
6692    ///
6693    /// # Example
6694    /// ```ignore,no_run
6695    /// # use google_cloud_api::model::LogDescriptor;
6696    /// let x = LogDescriptor::new().set_name("example");
6697    /// ```
6698    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6699        self.name = v.into();
6700        self
6701    }
6702
6703    /// Sets the value of [labels][crate::model::LogDescriptor::labels].
6704    ///
6705    /// # Example
6706    /// ```ignore,no_run
6707    /// # use google_cloud_api::model::LogDescriptor;
6708    /// use google_cloud_api::model::LabelDescriptor;
6709    /// let x = LogDescriptor::new()
6710    ///     .set_labels([
6711    ///         LabelDescriptor::default()/* use setters */,
6712    ///         LabelDescriptor::default()/* use (different) setters */,
6713    ///     ]);
6714    /// ```
6715    pub fn set_labels<T, V>(mut self, v: T) -> Self
6716    where
6717        T: std::iter::IntoIterator<Item = V>,
6718        V: std::convert::Into<crate::model::LabelDescriptor>,
6719    {
6720        use std::iter::Iterator;
6721        self.labels = v.into_iter().map(|i| i.into()).collect();
6722        self
6723    }
6724
6725    /// Sets the value of [description][crate::model::LogDescriptor::description].
6726    ///
6727    /// # Example
6728    /// ```ignore,no_run
6729    /// # use google_cloud_api::model::LogDescriptor;
6730    /// let x = LogDescriptor::new().set_description("example");
6731    /// ```
6732    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6733        self.description = v.into();
6734        self
6735    }
6736
6737    /// Sets the value of [display_name][crate::model::LogDescriptor::display_name].
6738    ///
6739    /// # Example
6740    /// ```ignore,no_run
6741    /// # use google_cloud_api::model::LogDescriptor;
6742    /// let x = LogDescriptor::new().set_display_name("example");
6743    /// ```
6744    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6745        self.display_name = v.into();
6746        self
6747    }
6748}
6749
6750impl wkt::message::Message for LogDescriptor {
6751    fn typename() -> &'static str {
6752        "type.googleapis.com/google.api.LogDescriptor"
6753    }
6754}
6755
6756/// Logging configuration of the service.
6757///
6758/// The following example shows how to configure logs to be sent to the
6759/// producer and consumer projects. In the example, the `activity_history`
6760/// log is sent to both the producer and consumer projects, whereas the
6761/// `purchase_history` log is only sent to the producer project.
6762///
6763/// ```norust
6764/// monitored_resources:
6765/// - type: library.googleapis.com/branch
6766///   labels:
6767///   - key: /city
6768///     description: The city where the library branch is located in.
6769///   - key: /name
6770///     description: The name of the branch.
6771/// logs:
6772/// - name: activity_history
6773///   labels:
6774///   - key: /customer_id
6775/// - name: purchase_history
6776/// logging:
6777///   producer_destinations:
6778///   - monitored_resource: library.googleapis.com/branch
6779///     logs:
6780///     - activity_history
6781///     - purchase_history
6782///   consumer_destinations:
6783///   - monitored_resource: library.googleapis.com/branch
6784///     logs:
6785///     - activity_history
6786/// ```
6787#[derive(Clone, Default, PartialEq)]
6788#[non_exhaustive]
6789pub struct Logging {
6790    /// Logging configurations for sending logs to the producer project.
6791    /// There can be multiple producer destinations, each one must have a
6792    /// different monitored resource type. A log can be used in at most
6793    /// one producer destination.
6794    pub producer_destinations: std::vec::Vec<crate::model::logging::LoggingDestination>,
6795
6796    /// Logging configurations for sending logs to the consumer project.
6797    /// There can be multiple consumer destinations, each one must have a
6798    /// different monitored resource type. A log can be used in at most
6799    /// one consumer destination.
6800    pub consumer_destinations: std::vec::Vec<crate::model::logging::LoggingDestination>,
6801
6802    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6803}
6804
6805impl Logging {
6806    pub fn new() -> Self {
6807        std::default::Default::default()
6808    }
6809
6810    /// Sets the value of [producer_destinations][crate::model::Logging::producer_destinations].
6811    ///
6812    /// # Example
6813    /// ```ignore,no_run
6814    /// # use google_cloud_api::model::Logging;
6815    /// use google_cloud_api::model::logging::LoggingDestination;
6816    /// let x = Logging::new()
6817    ///     .set_producer_destinations([
6818    ///         LoggingDestination::default()/* use setters */,
6819    ///         LoggingDestination::default()/* use (different) setters */,
6820    ///     ]);
6821    /// ```
6822    pub fn set_producer_destinations<T, V>(mut self, v: T) -> Self
6823    where
6824        T: std::iter::IntoIterator<Item = V>,
6825        V: std::convert::Into<crate::model::logging::LoggingDestination>,
6826    {
6827        use std::iter::Iterator;
6828        self.producer_destinations = v.into_iter().map(|i| i.into()).collect();
6829        self
6830    }
6831
6832    /// Sets the value of [consumer_destinations][crate::model::Logging::consumer_destinations].
6833    ///
6834    /// # Example
6835    /// ```ignore,no_run
6836    /// # use google_cloud_api::model::Logging;
6837    /// use google_cloud_api::model::logging::LoggingDestination;
6838    /// let x = Logging::new()
6839    ///     .set_consumer_destinations([
6840    ///         LoggingDestination::default()/* use setters */,
6841    ///         LoggingDestination::default()/* use (different) setters */,
6842    ///     ]);
6843    /// ```
6844    pub fn set_consumer_destinations<T, V>(mut self, v: T) -> Self
6845    where
6846        T: std::iter::IntoIterator<Item = V>,
6847        V: std::convert::Into<crate::model::logging::LoggingDestination>,
6848    {
6849        use std::iter::Iterator;
6850        self.consumer_destinations = v.into_iter().map(|i| i.into()).collect();
6851        self
6852    }
6853}
6854
6855impl wkt::message::Message for Logging {
6856    fn typename() -> &'static str {
6857        "type.googleapis.com/google.api.Logging"
6858    }
6859}
6860
6861/// Defines additional types related to [Logging].
6862pub mod logging {
6863    #[allow(unused_imports)]
6864    use super::*;
6865
6866    /// Configuration of a specific logging destination (the producer project
6867    /// or the consumer project).
6868    #[derive(Clone, Default, PartialEq)]
6869    #[non_exhaustive]
6870    pub struct LoggingDestination {
6871        /// The monitored resource type. The type must be defined in the
6872        /// [Service.monitored_resources][google.api.Service.monitored_resources]
6873        /// section.
6874        ///
6875        /// [google.api.Service.monitored_resources]: crate::model::Service::monitored_resources
6876        pub monitored_resource: std::string::String,
6877
6878        /// Names of the logs to be sent to this destination. Each name must
6879        /// be defined in the [Service.logs][google.api.Service.logs] section. If the
6880        /// log name is not a domain scoped name, it will be automatically prefixed
6881        /// with the service name followed by "/".
6882        ///
6883        /// [google.api.Service.logs]: crate::model::Service::logs
6884        pub logs: std::vec::Vec<std::string::String>,
6885
6886        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6887    }
6888
6889    impl LoggingDestination {
6890        pub fn new() -> Self {
6891            std::default::Default::default()
6892        }
6893
6894        /// Sets the value of [monitored_resource][crate::model::logging::LoggingDestination::monitored_resource].
6895        ///
6896        /// # Example
6897        /// ```ignore,no_run
6898        /// # use google_cloud_api::model::logging::LoggingDestination;
6899        /// let x = LoggingDestination::new().set_monitored_resource("example");
6900        /// ```
6901        pub fn set_monitored_resource<T: std::convert::Into<std::string::String>>(
6902            mut self,
6903            v: T,
6904        ) -> Self {
6905            self.monitored_resource = v.into();
6906            self
6907        }
6908
6909        /// Sets the value of [logs][crate::model::logging::LoggingDestination::logs].
6910        ///
6911        /// # Example
6912        /// ```ignore,no_run
6913        /// # use google_cloud_api::model::logging::LoggingDestination;
6914        /// let x = LoggingDestination::new().set_logs(["a", "b", "c"]);
6915        /// ```
6916        pub fn set_logs<T, V>(mut self, v: T) -> Self
6917        where
6918            T: std::iter::IntoIterator<Item = V>,
6919            V: std::convert::Into<std::string::String>,
6920        {
6921            use std::iter::Iterator;
6922            self.logs = v.into_iter().map(|i| i.into()).collect();
6923            self
6924        }
6925    }
6926
6927    impl wkt::message::Message for LoggingDestination {
6928        fn typename() -> &'static str {
6929            "type.googleapis.com/google.api.Logging.LoggingDestination"
6930        }
6931    }
6932}
6933
6934/// Defines a metric type and its schema. Once a metric descriptor is created,
6935/// deleting or altering it stops data collection and makes the metric type's
6936/// existing data unusable.
6937#[derive(Clone, Default, PartialEq)]
6938#[non_exhaustive]
6939pub struct MetricDescriptor {
6940    /// The resource name of the metric descriptor.
6941    pub name: std::string::String,
6942
6943    /// The metric type, including its DNS name prefix. The type is not
6944    /// URL-encoded. All user-defined metric types have the DNS name
6945    /// `custom.googleapis.com` or `external.googleapis.com`. Metric types should
6946    /// use a natural hierarchical grouping. For example:
6947    ///
6948    /// ```norust
6949    /// "custom.googleapis.com/invoice/paid/amount"
6950    /// "external.googleapis.com/prometheus/up"
6951    /// "appengine.googleapis.com/http/server/response_latencies"
6952    /// ```
6953    pub r#type: std::string::String,
6954
6955    /// The set of labels that can be used to describe a specific
6956    /// instance of this metric type. For example, the
6957    /// `appengine.googleapis.com/http/server/response_latencies` metric
6958    /// type has a label for the HTTP response code, `response_code`, so
6959    /// you can look at latencies for successful responses or just
6960    /// for responses that failed.
6961    pub labels: std::vec::Vec<crate::model::LabelDescriptor>,
6962
6963    /// Whether the metric records instantaneous values, changes to a value, etc.
6964    /// Some combinations of `metric_kind` and `value_type` might not be supported.
6965    pub metric_kind: crate::model::metric_descriptor::MetricKind,
6966
6967    /// Whether the measurement is an integer, a floating-point number, etc.
6968    /// Some combinations of `metric_kind` and `value_type` might not be supported.
6969    pub value_type: crate::model::metric_descriptor::ValueType,
6970
6971    /// The units in which the metric value is reported. It is only applicable
6972    /// if the `value_type` is `INT64`, `DOUBLE`, or `DISTRIBUTION`. The `unit`
6973    /// defines the representation of the stored metric values.
6974    ///
6975    /// Different systems might scale the values to be more easily displayed (so a
6976    /// value of `0.02kBy` _might_ be displayed as `20By`, and a value of
6977    /// `3523kBy` _might_ be displayed as `3.5MBy`). However, if the `unit` is
6978    /// `kBy`, then the value of the metric is always in thousands of bytes, no
6979    /// matter how it might be displayed.
6980    ///
6981    /// If you want a custom metric to record the exact number of CPU-seconds used
6982    /// by a job, you can create an `INT64 CUMULATIVE` metric whose `unit` is
6983    /// `s{CPU}` (or equivalently `1s{CPU}` or just `s`). If the job uses 12,005
6984    /// CPU-seconds, then the value is written as `12005`.
6985    ///
6986    /// Alternatively, if you want a custom metric to record data in a more
6987    /// granular way, you can create a `DOUBLE CUMULATIVE` metric whose `unit` is
6988    /// `ks{CPU}`, and then write the value `12.005` (which is `12005/1000`),
6989    /// or use `Kis{CPU}` and write `11.723` (which is `12005/1024`).
6990    ///
6991    /// The supported units are a subset of [The Unified Code for Units of
6992    /// Measure](https://unitsofmeasure.org/ucum.html) standard:
6993    ///
6994    /// **Basic units (UNIT)**
6995    ///
6996    /// * `bit`   bit
6997    /// * `By`    byte
6998    /// * `s`     second
6999    /// * `min`   minute
7000    /// * `h`     hour
7001    /// * `d`     day
7002    /// * `1`     dimensionless
7003    ///
7004    /// **Prefixes (PREFIX)**
7005    ///
7006    /// * `k`     kilo    (10^3)
7007    ///
7008    /// * `M`     mega    (10^6)
7009    ///
7010    /// * `G`     giga    (10^9)
7011    ///
7012    /// * `T`     tera    (10^12)
7013    ///
7014    /// * `P`     peta    (10^15)
7015    ///
7016    /// * `E`     exa     (10^18)
7017    ///
7018    /// * `Z`     zetta   (10^21)
7019    ///
7020    /// * `Y`     yotta   (10^24)
7021    ///
7022    /// * `m`     milli   (10^-3)
7023    ///
7024    /// * `u`     micro   (10^-6)
7025    ///
7026    /// * `n`     nano    (10^-9)
7027    ///
7028    /// * `p`     pico    (10^-12)
7029    ///
7030    /// * `f`     femto   (10^-15)
7031    ///
7032    /// * `a`     atto    (10^-18)
7033    ///
7034    /// * `z`     zepto   (10^-21)
7035    ///
7036    /// * `y`     yocto   (10^-24)
7037    ///
7038    /// * `Ki`    kibi    (2^10)
7039    ///
7040    /// * `Mi`    mebi    (2^20)
7041    ///
7042    /// * `Gi`    gibi    (2^30)
7043    ///
7044    /// * `Ti`    tebi    (2^40)
7045    ///
7046    /// * `Pi`    pebi    (2^50)
7047    ///
7048    ///
7049    /// **Grammar**
7050    ///
7051    /// The grammar also includes these connectors:
7052    ///
7053    /// * `/`    division or ratio (as an infix operator). For examples,
7054    ///   `kBy/{email}` or `MiBy/10ms` (although you should almost never
7055    ///   have `/s` in a metric `unit`; rates should always be computed at
7056    ///   query time from the underlying cumulative or delta value).
7057    /// * `.`    multiplication or composition (as an infix operator). For
7058    ///   examples, `GBy.d` or `k{watt}.h`.
7059    ///
7060    /// The grammar for a unit is as follows:
7061    ///
7062    /// ```norust
7063    /// Expression = Component { "." Component } { "/" Component } ;
7064    ///
7065    /// Component = ( [ PREFIX ] UNIT | "%" ) [ Annotation ]
7066    ///           | Annotation
7067    ///           | "1"
7068    ///           ;
7069    ///
7070    /// Annotation = "{" NAME "}" ;
7071    /// ```
7072    ///
7073    /// Notes:
7074    ///
7075    /// * `Annotation` is just a comment if it follows a `UNIT`. If the annotation
7076    ///   is used alone, then the unit is equivalent to `1`. For examples,
7077    ///   `{request}/s == 1/s`, `By{transmitted}/s == By/s`.
7078    /// * `NAME` is a sequence of non-blank printable ASCII characters not
7079    ///   containing `{` or `}`.
7080    /// * `1` represents a unitary [dimensionless
7081    ///   unit](https://en.wikipedia.org/wiki/Dimensionless_quantity) of 1, such
7082    ///   as in `1/s`. It is typically used when none of the basic units are
7083    ///   appropriate. For example, "new users per day" can be represented as
7084    ///   `1/d` or `{new-users}/d` (and a metric value `5` would mean "5 new
7085    ///   users). Alternatively, "thousands of page views per day" would be
7086    ///   represented as `1000/d` or `k1/d` or `k{page_views}/d` (and a metric
7087    ///   value of `5.3` would mean "5300 page views per day").
7088    /// * `%` represents dimensionless value of 1/100, and annotates values giving
7089    ///   a percentage (so the metric values are typically in the range of 0..100,
7090    ///   and a metric value `3` means "3 percent").
7091    /// * `10^2.%` indicates a metric contains a ratio, typically in the range
7092    ///   0..1, that will be multiplied by 100 and displayed as a percentage
7093    ///   (so a metric value `0.03` means "3 percent").
7094    pub unit: std::string::String,
7095
7096    /// A detailed description of the metric, which can be used in documentation.
7097    pub description: std::string::String,
7098
7099    /// A concise name for the metric, which can be displayed in user interfaces.
7100    /// Use sentence case without an ending period, for example "Request count".
7101    /// This field is optional but it is recommended to be set for any metrics
7102    /// associated with user-visible concepts, such as Quota.
7103    pub display_name: std::string::String,
7104
7105    /// Optional. Metadata which can be used to guide usage of the metric.
7106    pub metadata: std::option::Option<crate::model::metric_descriptor::MetricDescriptorMetadata>,
7107
7108    /// Optional. The launch stage of the metric definition.
7109    pub launch_stage: crate::model::LaunchStage,
7110
7111    /// Read-only. If present, then a [time
7112    /// series][google.monitoring.v3.TimeSeries], which is identified partially by
7113    /// a metric type and a
7114    /// [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor], that
7115    /// is associated with this metric type can only be associated with one of the
7116    /// monitored resource types listed here.
7117    ///
7118    /// [google.api.MonitoredResourceDescriptor]: crate::model::MonitoredResourceDescriptor
7119    pub monitored_resource_types: std::vec::Vec<std::string::String>,
7120
7121    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7122}
7123
7124impl MetricDescriptor {
7125    pub fn new() -> Self {
7126        std::default::Default::default()
7127    }
7128
7129    /// Sets the value of [name][crate::model::MetricDescriptor::name].
7130    ///
7131    /// # Example
7132    /// ```ignore,no_run
7133    /// # use google_cloud_api::model::MetricDescriptor;
7134    /// let x = MetricDescriptor::new().set_name("example");
7135    /// ```
7136    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7137        self.name = v.into();
7138        self
7139    }
7140
7141    /// Sets the value of [r#type][crate::model::MetricDescriptor::type].
7142    ///
7143    /// # Example
7144    /// ```ignore,no_run
7145    /// # use google_cloud_api::model::MetricDescriptor;
7146    /// let x = MetricDescriptor::new().set_type("example");
7147    /// ```
7148    pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7149        self.r#type = v.into();
7150        self
7151    }
7152
7153    /// Sets the value of [labels][crate::model::MetricDescriptor::labels].
7154    ///
7155    /// # Example
7156    /// ```ignore,no_run
7157    /// # use google_cloud_api::model::MetricDescriptor;
7158    /// use google_cloud_api::model::LabelDescriptor;
7159    /// let x = MetricDescriptor::new()
7160    ///     .set_labels([
7161    ///         LabelDescriptor::default()/* use setters */,
7162    ///         LabelDescriptor::default()/* use (different) setters */,
7163    ///     ]);
7164    /// ```
7165    pub fn set_labels<T, V>(mut self, v: T) -> Self
7166    where
7167        T: std::iter::IntoIterator<Item = V>,
7168        V: std::convert::Into<crate::model::LabelDescriptor>,
7169    {
7170        use std::iter::Iterator;
7171        self.labels = v.into_iter().map(|i| i.into()).collect();
7172        self
7173    }
7174
7175    /// Sets the value of [metric_kind][crate::model::MetricDescriptor::metric_kind].
7176    ///
7177    /// # Example
7178    /// ```ignore,no_run
7179    /// # use google_cloud_api::model::MetricDescriptor;
7180    /// use google_cloud_api::model::metric_descriptor::MetricKind;
7181    /// let x0 = MetricDescriptor::new().set_metric_kind(MetricKind::Gauge);
7182    /// let x1 = MetricDescriptor::new().set_metric_kind(MetricKind::Delta);
7183    /// let x2 = MetricDescriptor::new().set_metric_kind(MetricKind::Cumulative);
7184    /// ```
7185    pub fn set_metric_kind<T: std::convert::Into<crate::model::metric_descriptor::MetricKind>>(
7186        mut self,
7187        v: T,
7188    ) -> Self {
7189        self.metric_kind = v.into();
7190        self
7191    }
7192
7193    /// Sets the value of [value_type][crate::model::MetricDescriptor::value_type].
7194    ///
7195    /// # Example
7196    /// ```ignore,no_run
7197    /// # use google_cloud_api::model::MetricDescriptor;
7198    /// use google_cloud_api::model::metric_descriptor::ValueType;
7199    /// let x0 = MetricDescriptor::new().set_value_type(ValueType::Bool);
7200    /// let x1 = MetricDescriptor::new().set_value_type(ValueType::Int64);
7201    /// let x2 = MetricDescriptor::new().set_value_type(ValueType::Double);
7202    /// ```
7203    pub fn set_value_type<T: std::convert::Into<crate::model::metric_descriptor::ValueType>>(
7204        mut self,
7205        v: T,
7206    ) -> Self {
7207        self.value_type = v.into();
7208        self
7209    }
7210
7211    /// Sets the value of [unit][crate::model::MetricDescriptor::unit].
7212    ///
7213    /// # Example
7214    /// ```ignore,no_run
7215    /// # use google_cloud_api::model::MetricDescriptor;
7216    /// let x = MetricDescriptor::new().set_unit("example");
7217    /// ```
7218    pub fn set_unit<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7219        self.unit = v.into();
7220        self
7221    }
7222
7223    /// Sets the value of [description][crate::model::MetricDescriptor::description].
7224    ///
7225    /// # Example
7226    /// ```ignore,no_run
7227    /// # use google_cloud_api::model::MetricDescriptor;
7228    /// let x = MetricDescriptor::new().set_description("example");
7229    /// ```
7230    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7231        self.description = v.into();
7232        self
7233    }
7234
7235    /// Sets the value of [display_name][crate::model::MetricDescriptor::display_name].
7236    ///
7237    /// # Example
7238    /// ```ignore,no_run
7239    /// # use google_cloud_api::model::MetricDescriptor;
7240    /// let x = MetricDescriptor::new().set_display_name("example");
7241    /// ```
7242    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7243        self.display_name = v.into();
7244        self
7245    }
7246
7247    /// Sets the value of [metadata][crate::model::MetricDescriptor::metadata].
7248    ///
7249    /// # Example
7250    /// ```ignore,no_run
7251    /// # use google_cloud_api::model::MetricDescriptor;
7252    /// use google_cloud_api::model::metric_descriptor::MetricDescriptorMetadata;
7253    /// let x = MetricDescriptor::new().set_metadata(MetricDescriptorMetadata::default()/* use setters */);
7254    /// ```
7255    pub fn set_metadata<T>(mut self, v: T) -> Self
7256    where
7257        T: std::convert::Into<crate::model::metric_descriptor::MetricDescriptorMetadata>,
7258    {
7259        self.metadata = std::option::Option::Some(v.into());
7260        self
7261    }
7262
7263    /// Sets or clears the value of [metadata][crate::model::MetricDescriptor::metadata].
7264    ///
7265    /// # Example
7266    /// ```ignore,no_run
7267    /// # use google_cloud_api::model::MetricDescriptor;
7268    /// use google_cloud_api::model::metric_descriptor::MetricDescriptorMetadata;
7269    /// let x = MetricDescriptor::new().set_or_clear_metadata(Some(MetricDescriptorMetadata::default()/* use setters */));
7270    /// let x = MetricDescriptor::new().set_or_clear_metadata(None::<MetricDescriptorMetadata>);
7271    /// ```
7272    pub fn set_or_clear_metadata<T>(mut self, v: std::option::Option<T>) -> Self
7273    where
7274        T: std::convert::Into<crate::model::metric_descriptor::MetricDescriptorMetadata>,
7275    {
7276        self.metadata = v.map(|x| x.into());
7277        self
7278    }
7279
7280    /// Sets the value of [launch_stage][crate::model::MetricDescriptor::launch_stage].
7281    ///
7282    /// # Example
7283    /// ```ignore,no_run
7284    /// # use google_cloud_api::model::MetricDescriptor;
7285    /// use google_cloud_api::model::LaunchStage;
7286    /// let x0 = MetricDescriptor::new().set_launch_stage(LaunchStage::Unimplemented);
7287    /// let x1 = MetricDescriptor::new().set_launch_stage(LaunchStage::Prelaunch);
7288    /// let x2 = MetricDescriptor::new().set_launch_stage(LaunchStage::EarlyAccess);
7289    /// ```
7290    pub fn set_launch_stage<T: std::convert::Into<crate::model::LaunchStage>>(
7291        mut self,
7292        v: T,
7293    ) -> Self {
7294        self.launch_stage = v.into();
7295        self
7296    }
7297
7298    /// Sets the value of [monitored_resource_types][crate::model::MetricDescriptor::monitored_resource_types].
7299    ///
7300    /// # Example
7301    /// ```ignore,no_run
7302    /// # use google_cloud_api::model::MetricDescriptor;
7303    /// let x = MetricDescriptor::new().set_monitored_resource_types(["a", "b", "c"]);
7304    /// ```
7305    pub fn set_monitored_resource_types<T, V>(mut self, v: T) -> Self
7306    where
7307        T: std::iter::IntoIterator<Item = V>,
7308        V: std::convert::Into<std::string::String>,
7309    {
7310        use std::iter::Iterator;
7311        self.monitored_resource_types = v.into_iter().map(|i| i.into()).collect();
7312        self
7313    }
7314}
7315
7316impl wkt::message::Message for MetricDescriptor {
7317    fn typename() -> &'static str {
7318        "type.googleapis.com/google.api.MetricDescriptor"
7319    }
7320}
7321
7322/// Defines additional types related to [MetricDescriptor].
7323pub mod metric_descriptor {
7324    #[allow(unused_imports)]
7325    use super::*;
7326
7327    /// Additional annotations that can be used to guide the usage of a metric.
7328    #[derive(Clone, Default, PartialEq)]
7329    #[non_exhaustive]
7330    pub struct MetricDescriptorMetadata {
7331
7332        /// Deprecated. Must use the
7333        /// [MetricDescriptor.launch_stage][google.api.MetricDescriptor.launch_stage]
7334        /// instead.
7335        ///
7336        /// [google.api.MetricDescriptor.launch_stage]: crate::model::MetricDescriptor::launch_stage
7337        #[deprecated]
7338        pub launch_stage: crate::model::LaunchStage,
7339
7340        /// The sampling period of metric data points. For metrics which are written
7341        /// periodically, consecutive data points are stored at this time interval,
7342        /// excluding data loss due to errors. Metrics with a higher granularity have
7343        /// a smaller sampling period.
7344        pub sample_period: std::option::Option<wkt::Duration>,
7345
7346        /// The delay of data points caused by ingestion. Data points older than this
7347        /// age are guaranteed to be ingested and available to be read, excluding
7348        /// data loss due to errors.
7349        pub ingest_delay: std::option::Option<wkt::Duration>,
7350
7351        /// The scope of the timeseries data of the metric.
7352        pub time_series_resource_hierarchy_level: std::vec::Vec<crate::model::metric_descriptor::metric_descriptor_metadata::TimeSeriesResourceHierarchyLevel>,
7353
7354        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7355    }
7356
7357    impl MetricDescriptorMetadata {
7358        pub fn new() -> Self {
7359            std::default::Default::default()
7360        }
7361
7362        /// Sets the value of [launch_stage][crate::model::metric_descriptor::MetricDescriptorMetadata::launch_stage].
7363        ///
7364        /// # Example
7365        /// ```ignore,no_run
7366        /// # use google_cloud_api::model::metric_descriptor::MetricDescriptorMetadata;
7367        /// use google_cloud_api::model::LaunchStage;
7368        /// let x0 = MetricDescriptorMetadata::new().set_launch_stage(LaunchStage::Unimplemented);
7369        /// let x1 = MetricDescriptorMetadata::new().set_launch_stage(LaunchStage::Prelaunch);
7370        /// let x2 = MetricDescriptorMetadata::new().set_launch_stage(LaunchStage::EarlyAccess);
7371        /// ```
7372        #[deprecated]
7373        pub fn set_launch_stage<T: std::convert::Into<crate::model::LaunchStage>>(
7374            mut self,
7375            v: T,
7376        ) -> Self {
7377            self.launch_stage = v.into();
7378            self
7379        }
7380
7381        /// Sets the value of [sample_period][crate::model::metric_descriptor::MetricDescriptorMetadata::sample_period].
7382        ///
7383        /// # Example
7384        /// ```ignore,no_run
7385        /// # use google_cloud_api::model::metric_descriptor::MetricDescriptorMetadata;
7386        /// use wkt::Duration;
7387        /// let x = MetricDescriptorMetadata::new().set_sample_period(Duration::default()/* use setters */);
7388        /// ```
7389        pub fn set_sample_period<T>(mut self, v: T) -> Self
7390        where
7391            T: std::convert::Into<wkt::Duration>,
7392        {
7393            self.sample_period = std::option::Option::Some(v.into());
7394            self
7395        }
7396
7397        /// Sets or clears the value of [sample_period][crate::model::metric_descriptor::MetricDescriptorMetadata::sample_period].
7398        ///
7399        /// # Example
7400        /// ```ignore,no_run
7401        /// # use google_cloud_api::model::metric_descriptor::MetricDescriptorMetadata;
7402        /// use wkt::Duration;
7403        /// let x = MetricDescriptorMetadata::new().set_or_clear_sample_period(Some(Duration::default()/* use setters */));
7404        /// let x = MetricDescriptorMetadata::new().set_or_clear_sample_period(None::<Duration>);
7405        /// ```
7406        pub fn set_or_clear_sample_period<T>(mut self, v: std::option::Option<T>) -> Self
7407        where
7408            T: std::convert::Into<wkt::Duration>,
7409        {
7410            self.sample_period = v.map(|x| x.into());
7411            self
7412        }
7413
7414        /// Sets the value of [ingest_delay][crate::model::metric_descriptor::MetricDescriptorMetadata::ingest_delay].
7415        ///
7416        /// # Example
7417        /// ```ignore,no_run
7418        /// # use google_cloud_api::model::metric_descriptor::MetricDescriptorMetadata;
7419        /// use wkt::Duration;
7420        /// let x = MetricDescriptorMetadata::new().set_ingest_delay(Duration::default()/* use setters */);
7421        /// ```
7422        pub fn set_ingest_delay<T>(mut self, v: T) -> Self
7423        where
7424            T: std::convert::Into<wkt::Duration>,
7425        {
7426            self.ingest_delay = std::option::Option::Some(v.into());
7427            self
7428        }
7429
7430        /// Sets or clears the value of [ingest_delay][crate::model::metric_descriptor::MetricDescriptorMetadata::ingest_delay].
7431        ///
7432        /// # Example
7433        /// ```ignore,no_run
7434        /// # use google_cloud_api::model::metric_descriptor::MetricDescriptorMetadata;
7435        /// use wkt::Duration;
7436        /// let x = MetricDescriptorMetadata::new().set_or_clear_ingest_delay(Some(Duration::default()/* use setters */));
7437        /// let x = MetricDescriptorMetadata::new().set_or_clear_ingest_delay(None::<Duration>);
7438        /// ```
7439        pub fn set_or_clear_ingest_delay<T>(mut self, v: std::option::Option<T>) -> Self
7440        where
7441            T: std::convert::Into<wkt::Duration>,
7442        {
7443            self.ingest_delay = v.map(|x| x.into());
7444            self
7445        }
7446
7447        /// Sets the value of [time_series_resource_hierarchy_level][crate::model::metric_descriptor::MetricDescriptorMetadata::time_series_resource_hierarchy_level].
7448        ///
7449        /// # Example
7450        /// ```ignore,no_run
7451        /// # use google_cloud_api::model::metric_descriptor::MetricDescriptorMetadata;
7452        /// use google_cloud_api::model::metric_descriptor::metric_descriptor_metadata::TimeSeriesResourceHierarchyLevel;
7453        /// let x = MetricDescriptorMetadata::new().set_time_series_resource_hierarchy_level([
7454        ///     TimeSeriesResourceHierarchyLevel::Project,
7455        ///     TimeSeriesResourceHierarchyLevel::Organization,
7456        ///     TimeSeriesResourceHierarchyLevel::Folder,
7457        /// ]);
7458        /// ```
7459        pub fn set_time_series_resource_hierarchy_level<T, V>(mut self, v: T) -> Self
7460        where
7461            T: std::iter::IntoIterator<Item = V>,
7462            V: std::convert::Into<crate::model::metric_descriptor::metric_descriptor_metadata::TimeSeriesResourceHierarchyLevel>
7463        {
7464            use std::iter::Iterator;
7465            self.time_series_resource_hierarchy_level = v.into_iter().map(|i| i.into()).collect();
7466            self
7467        }
7468    }
7469
7470    impl wkt::message::Message for MetricDescriptorMetadata {
7471        fn typename() -> &'static str {
7472            "type.googleapis.com/google.api.MetricDescriptor.MetricDescriptorMetadata"
7473        }
7474    }
7475
7476    /// Defines additional types related to [MetricDescriptorMetadata].
7477    pub mod metric_descriptor_metadata {
7478        #[allow(unused_imports)]
7479        use super::*;
7480
7481        /// The resource hierarchy level of the timeseries data of a metric.
7482        ///
7483        /// # Working with unknown values
7484        ///
7485        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7486        /// additional enum variants at any time. Adding new variants is not considered
7487        /// a breaking change. Applications should write their code in anticipation of:
7488        ///
7489        /// - New values appearing in future releases of the client library, **and**
7490        /// - New values received dynamically, without application changes.
7491        ///
7492        /// Please consult the [Working with enums] section in the user guide for some
7493        /// guidelines.
7494        ///
7495        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
7496        #[derive(Clone, Debug, PartialEq)]
7497        #[non_exhaustive]
7498        pub enum TimeSeriesResourceHierarchyLevel {
7499            /// Do not use this default value.
7500            Unspecified,
7501            /// Scopes a metric to a project.
7502            Project,
7503            /// Scopes a metric to an organization.
7504            Organization,
7505            /// Scopes a metric to a folder.
7506            Folder,
7507            /// If set, the enum was initialized with an unknown value.
7508            ///
7509            /// Applications can examine the value using [TimeSeriesResourceHierarchyLevel::value] or
7510            /// [TimeSeriesResourceHierarchyLevel::name].
7511            UnknownValue(time_series_resource_hierarchy_level::UnknownValue),
7512        }
7513
7514        #[doc(hidden)]
7515        pub mod time_series_resource_hierarchy_level {
7516            #[allow(unused_imports)]
7517            use super::*;
7518            #[derive(Clone, Debug, PartialEq)]
7519            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7520        }
7521
7522        impl TimeSeriesResourceHierarchyLevel {
7523            /// Gets the enum value.
7524            ///
7525            /// Returns `None` if the enum contains an unknown value deserialized from
7526            /// the string representation of enums.
7527            pub fn value(&self) -> std::option::Option<i32> {
7528                match self {
7529                    Self::Unspecified => std::option::Option::Some(0),
7530                    Self::Project => std::option::Option::Some(1),
7531                    Self::Organization => std::option::Option::Some(2),
7532                    Self::Folder => std::option::Option::Some(3),
7533                    Self::UnknownValue(u) => u.0.value(),
7534                }
7535            }
7536
7537            /// Gets the enum value as a string.
7538            ///
7539            /// Returns `None` if the enum contains an unknown value deserialized from
7540            /// the integer representation of enums.
7541            pub fn name(&self) -> std::option::Option<&str> {
7542                match self {
7543                    Self::Unspecified => std::option::Option::Some(
7544                        "TIME_SERIES_RESOURCE_HIERARCHY_LEVEL_UNSPECIFIED",
7545                    ),
7546                    Self::Project => std::option::Option::Some("PROJECT"),
7547                    Self::Organization => std::option::Option::Some("ORGANIZATION"),
7548                    Self::Folder => std::option::Option::Some("FOLDER"),
7549                    Self::UnknownValue(u) => u.0.name(),
7550                }
7551            }
7552        }
7553
7554        impl std::default::Default for TimeSeriesResourceHierarchyLevel {
7555            fn default() -> Self {
7556                use std::convert::From;
7557                Self::from(0)
7558            }
7559        }
7560
7561        impl std::fmt::Display for TimeSeriesResourceHierarchyLevel {
7562            fn fmt(
7563                &self,
7564                f: &mut std::fmt::Formatter<'_>,
7565            ) -> std::result::Result<(), std::fmt::Error> {
7566                wkt::internal::display_enum(f, self.name(), self.value())
7567            }
7568        }
7569
7570        impl std::convert::From<i32> for TimeSeriesResourceHierarchyLevel {
7571            fn from(value: i32) -> Self {
7572                match value {
7573                    0 => Self::Unspecified,
7574                    1 => Self::Project,
7575                    2 => Self::Organization,
7576                    3 => Self::Folder,
7577                    _ => Self::UnknownValue(time_series_resource_hierarchy_level::UnknownValue(
7578                        wkt::internal::UnknownEnumValue::Integer(value),
7579                    )),
7580                }
7581            }
7582        }
7583
7584        impl std::convert::From<&str> for TimeSeriesResourceHierarchyLevel {
7585            fn from(value: &str) -> Self {
7586                use std::string::ToString;
7587                match value {
7588                    "TIME_SERIES_RESOURCE_HIERARCHY_LEVEL_UNSPECIFIED" => Self::Unspecified,
7589                    "PROJECT" => Self::Project,
7590                    "ORGANIZATION" => Self::Organization,
7591                    "FOLDER" => Self::Folder,
7592                    _ => Self::UnknownValue(time_series_resource_hierarchy_level::UnknownValue(
7593                        wkt::internal::UnknownEnumValue::String(value.to_string()),
7594                    )),
7595                }
7596            }
7597        }
7598
7599        impl serde::ser::Serialize for TimeSeriesResourceHierarchyLevel {
7600            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7601            where
7602                S: serde::Serializer,
7603            {
7604                match self {
7605                    Self::Unspecified => serializer.serialize_i32(0),
7606                    Self::Project => serializer.serialize_i32(1),
7607                    Self::Organization => serializer.serialize_i32(2),
7608                    Self::Folder => serializer.serialize_i32(3),
7609                    Self::UnknownValue(u) => u.0.serialize(serializer),
7610                }
7611            }
7612        }
7613
7614        impl<'de> serde::de::Deserialize<'de> for TimeSeriesResourceHierarchyLevel {
7615            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7616            where
7617                D: serde::Deserializer<'de>,
7618            {
7619                deserializer.deserialize_any(wkt::internal::EnumVisitor::<TimeSeriesResourceHierarchyLevel>::new(
7620                    ".google.api.MetricDescriptor.MetricDescriptorMetadata.TimeSeriesResourceHierarchyLevel"))
7621            }
7622        }
7623    }
7624
7625    /// The kind of measurement. It describes how the data is reported.
7626    /// For information on setting the start time and end time based on
7627    /// the MetricKind, see [TimeInterval][google.monitoring.v3.TimeInterval].
7628    ///
7629    /// # Working with unknown values
7630    ///
7631    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7632    /// additional enum variants at any time. Adding new variants is not considered
7633    /// a breaking change. Applications should write their code in anticipation of:
7634    ///
7635    /// - New values appearing in future releases of the client library, **and**
7636    /// - New values received dynamically, without application changes.
7637    ///
7638    /// Please consult the [Working with enums] section in the user guide for some
7639    /// guidelines.
7640    ///
7641    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
7642    #[derive(Clone, Debug, PartialEq)]
7643    #[non_exhaustive]
7644    pub enum MetricKind {
7645        /// Do not use this default value.
7646        Unspecified,
7647        /// An instantaneous measurement of a value.
7648        Gauge,
7649        /// The change in a value during a time interval.
7650        Delta,
7651        /// A value accumulated over a time interval.  Cumulative
7652        /// measurements in a time series should have the same start time
7653        /// and increasing end times, until an event resets the cumulative
7654        /// value to zero and sets a new start time for the following
7655        /// points.
7656        Cumulative,
7657        /// If set, the enum was initialized with an unknown value.
7658        ///
7659        /// Applications can examine the value using [MetricKind::value] or
7660        /// [MetricKind::name].
7661        UnknownValue(metric_kind::UnknownValue),
7662    }
7663
7664    #[doc(hidden)]
7665    pub mod metric_kind {
7666        #[allow(unused_imports)]
7667        use super::*;
7668        #[derive(Clone, Debug, PartialEq)]
7669        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7670    }
7671
7672    impl MetricKind {
7673        /// Gets the enum value.
7674        ///
7675        /// Returns `None` if the enum contains an unknown value deserialized from
7676        /// the string representation of enums.
7677        pub fn value(&self) -> std::option::Option<i32> {
7678            match self {
7679                Self::Unspecified => std::option::Option::Some(0),
7680                Self::Gauge => std::option::Option::Some(1),
7681                Self::Delta => std::option::Option::Some(2),
7682                Self::Cumulative => std::option::Option::Some(3),
7683                Self::UnknownValue(u) => u.0.value(),
7684            }
7685        }
7686
7687        /// Gets the enum value as a string.
7688        ///
7689        /// Returns `None` if the enum contains an unknown value deserialized from
7690        /// the integer representation of enums.
7691        pub fn name(&self) -> std::option::Option<&str> {
7692            match self {
7693                Self::Unspecified => std::option::Option::Some("METRIC_KIND_UNSPECIFIED"),
7694                Self::Gauge => std::option::Option::Some("GAUGE"),
7695                Self::Delta => std::option::Option::Some("DELTA"),
7696                Self::Cumulative => std::option::Option::Some("CUMULATIVE"),
7697                Self::UnknownValue(u) => u.0.name(),
7698            }
7699        }
7700    }
7701
7702    impl std::default::Default for MetricKind {
7703        fn default() -> Self {
7704            use std::convert::From;
7705            Self::from(0)
7706        }
7707    }
7708
7709    impl std::fmt::Display for MetricKind {
7710        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7711            wkt::internal::display_enum(f, self.name(), self.value())
7712        }
7713    }
7714
7715    impl std::convert::From<i32> for MetricKind {
7716        fn from(value: i32) -> Self {
7717            match value {
7718                0 => Self::Unspecified,
7719                1 => Self::Gauge,
7720                2 => Self::Delta,
7721                3 => Self::Cumulative,
7722                _ => Self::UnknownValue(metric_kind::UnknownValue(
7723                    wkt::internal::UnknownEnumValue::Integer(value),
7724                )),
7725            }
7726        }
7727    }
7728
7729    impl std::convert::From<&str> for MetricKind {
7730        fn from(value: &str) -> Self {
7731            use std::string::ToString;
7732            match value {
7733                "METRIC_KIND_UNSPECIFIED" => Self::Unspecified,
7734                "GAUGE" => Self::Gauge,
7735                "DELTA" => Self::Delta,
7736                "CUMULATIVE" => Self::Cumulative,
7737                _ => Self::UnknownValue(metric_kind::UnknownValue(
7738                    wkt::internal::UnknownEnumValue::String(value.to_string()),
7739                )),
7740            }
7741        }
7742    }
7743
7744    impl serde::ser::Serialize for MetricKind {
7745        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7746        where
7747            S: serde::Serializer,
7748        {
7749            match self {
7750                Self::Unspecified => serializer.serialize_i32(0),
7751                Self::Gauge => serializer.serialize_i32(1),
7752                Self::Delta => serializer.serialize_i32(2),
7753                Self::Cumulative => serializer.serialize_i32(3),
7754                Self::UnknownValue(u) => u.0.serialize(serializer),
7755            }
7756        }
7757    }
7758
7759    impl<'de> serde::de::Deserialize<'de> for MetricKind {
7760        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7761        where
7762            D: serde::Deserializer<'de>,
7763        {
7764            deserializer.deserialize_any(wkt::internal::EnumVisitor::<MetricKind>::new(
7765                ".google.api.MetricDescriptor.MetricKind",
7766            ))
7767        }
7768    }
7769
7770    /// The value type of a metric.
7771    ///
7772    /// # Working with unknown values
7773    ///
7774    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7775    /// additional enum variants at any time. Adding new variants is not considered
7776    /// a breaking change. Applications should write their code in anticipation of:
7777    ///
7778    /// - New values appearing in future releases of the client library, **and**
7779    /// - New values received dynamically, without application changes.
7780    ///
7781    /// Please consult the [Working with enums] section in the user guide for some
7782    /// guidelines.
7783    ///
7784    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
7785    #[derive(Clone, Debug, PartialEq)]
7786    #[non_exhaustive]
7787    pub enum ValueType {
7788        /// Do not use this default value.
7789        Unspecified,
7790        /// The value is a boolean.
7791        /// This value type can be used only if the metric kind is `GAUGE`.
7792        Bool,
7793        /// The value is a signed 64-bit integer.
7794        Int64,
7795        /// The value is a double precision floating point number.
7796        Double,
7797        /// The value is a text string.
7798        /// This value type can be used only if the metric kind is `GAUGE`.
7799        String,
7800        /// The value is a [`Distribution`][google.api.Distribution].
7801        ///
7802        /// [google.api.Distribution]: crate::model::Distribution
7803        Distribution,
7804        /// The value is money.
7805        Money,
7806        /// If set, the enum was initialized with an unknown value.
7807        ///
7808        /// Applications can examine the value using [ValueType::value] or
7809        /// [ValueType::name].
7810        UnknownValue(value_type::UnknownValue),
7811    }
7812
7813    #[doc(hidden)]
7814    pub mod value_type {
7815        #[allow(unused_imports)]
7816        use super::*;
7817        #[derive(Clone, Debug, PartialEq)]
7818        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7819    }
7820
7821    impl ValueType {
7822        /// Gets the enum value.
7823        ///
7824        /// Returns `None` if the enum contains an unknown value deserialized from
7825        /// the string representation of enums.
7826        pub fn value(&self) -> std::option::Option<i32> {
7827            match self {
7828                Self::Unspecified => std::option::Option::Some(0),
7829                Self::Bool => std::option::Option::Some(1),
7830                Self::Int64 => std::option::Option::Some(2),
7831                Self::Double => std::option::Option::Some(3),
7832                Self::String => std::option::Option::Some(4),
7833                Self::Distribution => std::option::Option::Some(5),
7834                Self::Money => std::option::Option::Some(6),
7835                Self::UnknownValue(u) => u.0.value(),
7836            }
7837        }
7838
7839        /// Gets the enum value as a string.
7840        ///
7841        /// Returns `None` if the enum contains an unknown value deserialized from
7842        /// the integer representation of enums.
7843        pub fn name(&self) -> std::option::Option<&str> {
7844            match self {
7845                Self::Unspecified => std::option::Option::Some("VALUE_TYPE_UNSPECIFIED"),
7846                Self::Bool => std::option::Option::Some("BOOL"),
7847                Self::Int64 => std::option::Option::Some("INT64"),
7848                Self::Double => std::option::Option::Some("DOUBLE"),
7849                Self::String => std::option::Option::Some("STRING"),
7850                Self::Distribution => std::option::Option::Some("DISTRIBUTION"),
7851                Self::Money => std::option::Option::Some("MONEY"),
7852                Self::UnknownValue(u) => u.0.name(),
7853            }
7854        }
7855    }
7856
7857    impl std::default::Default for ValueType {
7858        fn default() -> Self {
7859            use std::convert::From;
7860            Self::from(0)
7861        }
7862    }
7863
7864    impl std::fmt::Display for ValueType {
7865        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7866            wkt::internal::display_enum(f, self.name(), self.value())
7867        }
7868    }
7869
7870    impl std::convert::From<i32> for ValueType {
7871        fn from(value: i32) -> Self {
7872            match value {
7873                0 => Self::Unspecified,
7874                1 => Self::Bool,
7875                2 => Self::Int64,
7876                3 => Self::Double,
7877                4 => Self::String,
7878                5 => Self::Distribution,
7879                6 => Self::Money,
7880                _ => Self::UnknownValue(value_type::UnknownValue(
7881                    wkt::internal::UnknownEnumValue::Integer(value),
7882                )),
7883            }
7884        }
7885    }
7886
7887    impl std::convert::From<&str> for ValueType {
7888        fn from(value: &str) -> Self {
7889            use std::string::ToString;
7890            match value {
7891                "VALUE_TYPE_UNSPECIFIED" => Self::Unspecified,
7892                "BOOL" => Self::Bool,
7893                "INT64" => Self::Int64,
7894                "DOUBLE" => Self::Double,
7895                "STRING" => Self::String,
7896                "DISTRIBUTION" => Self::Distribution,
7897                "MONEY" => Self::Money,
7898                _ => Self::UnknownValue(value_type::UnknownValue(
7899                    wkt::internal::UnknownEnumValue::String(value.to_string()),
7900                )),
7901            }
7902        }
7903    }
7904
7905    impl serde::ser::Serialize for ValueType {
7906        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7907        where
7908            S: serde::Serializer,
7909        {
7910            match self {
7911                Self::Unspecified => serializer.serialize_i32(0),
7912                Self::Bool => serializer.serialize_i32(1),
7913                Self::Int64 => serializer.serialize_i32(2),
7914                Self::Double => serializer.serialize_i32(3),
7915                Self::String => serializer.serialize_i32(4),
7916                Self::Distribution => serializer.serialize_i32(5),
7917                Self::Money => serializer.serialize_i32(6),
7918                Self::UnknownValue(u) => u.0.serialize(serializer),
7919            }
7920        }
7921    }
7922
7923    impl<'de> serde::de::Deserialize<'de> for ValueType {
7924        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7925        where
7926            D: serde::Deserializer<'de>,
7927        {
7928            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ValueType>::new(
7929                ".google.api.MetricDescriptor.ValueType",
7930            ))
7931        }
7932    }
7933}
7934
7935/// A specific metric, identified by specifying values for all of the
7936/// labels of a [`MetricDescriptor`][google.api.MetricDescriptor].
7937///
7938/// [google.api.MetricDescriptor]: crate::model::MetricDescriptor
7939#[derive(Clone, Default, PartialEq)]
7940#[non_exhaustive]
7941pub struct Metric {
7942    /// An existing metric type, see
7943    /// [google.api.MetricDescriptor][google.api.MetricDescriptor]. For example,
7944    /// `custom.googleapis.com/invoice/paid/amount`.
7945    ///
7946    /// [google.api.MetricDescriptor]: crate::model::MetricDescriptor
7947    pub r#type: std::string::String,
7948
7949    /// The set of label values that uniquely identify this metric. All
7950    /// labels listed in the `MetricDescriptor` must be assigned values.
7951    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
7952
7953    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7954}
7955
7956impl Metric {
7957    pub fn new() -> Self {
7958        std::default::Default::default()
7959    }
7960
7961    /// Sets the value of [r#type][crate::model::Metric::type].
7962    ///
7963    /// # Example
7964    /// ```ignore,no_run
7965    /// # use google_cloud_api::model::Metric;
7966    /// let x = Metric::new().set_type("example");
7967    /// ```
7968    pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7969        self.r#type = v.into();
7970        self
7971    }
7972
7973    /// Sets the value of [labels][crate::model::Metric::labels].
7974    ///
7975    /// # Example
7976    /// ```ignore,no_run
7977    /// # use google_cloud_api::model::Metric;
7978    /// let x = Metric::new().set_labels([
7979    ///     ("key0", "abc"),
7980    ///     ("key1", "xyz"),
7981    /// ]);
7982    /// ```
7983    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
7984    where
7985        T: std::iter::IntoIterator<Item = (K, V)>,
7986        K: std::convert::Into<std::string::String>,
7987        V: std::convert::Into<std::string::String>,
7988    {
7989        use std::iter::Iterator;
7990        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7991        self
7992    }
7993}
7994
7995impl wkt::message::Message for Metric {
7996    fn typename() -> &'static str {
7997        "type.googleapis.com/google.api.Metric"
7998    }
7999}
8000
8001/// An object that describes the schema of a
8002/// [MonitoredResource][google.api.MonitoredResource] object using a type name
8003/// and a set of labels.  For example, the monitored resource descriptor for
8004/// Google Compute Engine VM instances has a type of
8005/// `"gce_instance"` and specifies the use of the labels `"instance_id"` and
8006/// `"zone"` to identify particular VM instances.
8007///
8008/// Different APIs can support different monitored resource types. APIs generally
8009/// provide a `list` method that returns the monitored resource descriptors used
8010/// by the API.
8011///
8012/// [google.api.MonitoredResource]: crate::model::MonitoredResource
8013#[derive(Clone, Default, PartialEq)]
8014#[non_exhaustive]
8015pub struct MonitoredResourceDescriptor {
8016    /// Optional. The resource name of the monitored resource descriptor:
8017    /// `"projects/{project_id}/monitoredResourceDescriptors/{type}"` where
8018    /// {type} is the value of the `type` field in this object and
8019    /// {project_id} is a project ID that provides API-specific context for
8020    /// accessing the type.  APIs that do not use project information can use the
8021    /// resource name format `"monitoredResourceDescriptors/{type}"`.
8022    pub name: std::string::String,
8023
8024    /// Required. The monitored resource type. For example, the type
8025    /// `"cloudsql_database"` represents databases in Google Cloud SQL.
8026    /// For a list of types, see [Monitored resource
8027    /// types](https://cloud.google.com/monitoring/api/resources)
8028    /// and [Logging resource
8029    /// types](https://cloud.google.com/logging/docs/api/v2/resource-list).
8030    pub r#type: std::string::String,
8031
8032    /// Optional. A concise name for the monitored resource type that might be
8033    /// displayed in user interfaces. It should be a Title Cased Noun Phrase,
8034    /// without any article or other determiners. For example,
8035    /// `"Google Cloud SQL Database"`.
8036    pub display_name: std::string::String,
8037
8038    /// Optional. A detailed description of the monitored resource type that might
8039    /// be used in documentation.
8040    pub description: std::string::String,
8041
8042    /// Required. A set of labels used to describe instances of this monitored
8043    /// resource type. For example, an individual Google Cloud SQL database is
8044    /// identified by values for the labels `"database_id"` and `"zone"`.
8045    pub labels: std::vec::Vec<crate::model::LabelDescriptor>,
8046
8047    /// Optional. The launch stage of the monitored resource definition.
8048    pub launch_stage: crate::model::LaunchStage,
8049
8050    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8051}
8052
8053impl MonitoredResourceDescriptor {
8054    pub fn new() -> Self {
8055        std::default::Default::default()
8056    }
8057
8058    /// Sets the value of [name][crate::model::MonitoredResourceDescriptor::name].
8059    ///
8060    /// # Example
8061    /// ```ignore,no_run
8062    /// # use google_cloud_api::model::MonitoredResourceDescriptor;
8063    /// let x = MonitoredResourceDescriptor::new().set_name("example");
8064    /// ```
8065    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8066        self.name = v.into();
8067        self
8068    }
8069
8070    /// Sets the value of [r#type][crate::model::MonitoredResourceDescriptor::type].
8071    ///
8072    /// # Example
8073    /// ```ignore,no_run
8074    /// # use google_cloud_api::model::MonitoredResourceDescriptor;
8075    /// let x = MonitoredResourceDescriptor::new().set_type("example");
8076    /// ```
8077    pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8078        self.r#type = v.into();
8079        self
8080    }
8081
8082    /// Sets the value of [display_name][crate::model::MonitoredResourceDescriptor::display_name].
8083    ///
8084    /// # Example
8085    /// ```ignore,no_run
8086    /// # use google_cloud_api::model::MonitoredResourceDescriptor;
8087    /// let x = MonitoredResourceDescriptor::new().set_display_name("example");
8088    /// ```
8089    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8090        self.display_name = v.into();
8091        self
8092    }
8093
8094    /// Sets the value of [description][crate::model::MonitoredResourceDescriptor::description].
8095    ///
8096    /// # Example
8097    /// ```ignore,no_run
8098    /// # use google_cloud_api::model::MonitoredResourceDescriptor;
8099    /// let x = MonitoredResourceDescriptor::new().set_description("example");
8100    /// ```
8101    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8102        self.description = v.into();
8103        self
8104    }
8105
8106    /// Sets the value of [labels][crate::model::MonitoredResourceDescriptor::labels].
8107    ///
8108    /// # Example
8109    /// ```ignore,no_run
8110    /// # use google_cloud_api::model::MonitoredResourceDescriptor;
8111    /// use google_cloud_api::model::LabelDescriptor;
8112    /// let x = MonitoredResourceDescriptor::new()
8113    ///     .set_labels([
8114    ///         LabelDescriptor::default()/* use setters */,
8115    ///         LabelDescriptor::default()/* use (different) setters */,
8116    ///     ]);
8117    /// ```
8118    pub fn set_labels<T, V>(mut self, v: T) -> Self
8119    where
8120        T: std::iter::IntoIterator<Item = V>,
8121        V: std::convert::Into<crate::model::LabelDescriptor>,
8122    {
8123        use std::iter::Iterator;
8124        self.labels = v.into_iter().map(|i| i.into()).collect();
8125        self
8126    }
8127
8128    /// Sets the value of [launch_stage][crate::model::MonitoredResourceDescriptor::launch_stage].
8129    ///
8130    /// # Example
8131    /// ```ignore,no_run
8132    /// # use google_cloud_api::model::MonitoredResourceDescriptor;
8133    /// use google_cloud_api::model::LaunchStage;
8134    /// let x0 = MonitoredResourceDescriptor::new().set_launch_stage(LaunchStage::Unimplemented);
8135    /// let x1 = MonitoredResourceDescriptor::new().set_launch_stage(LaunchStage::Prelaunch);
8136    /// let x2 = MonitoredResourceDescriptor::new().set_launch_stage(LaunchStage::EarlyAccess);
8137    /// ```
8138    pub fn set_launch_stage<T: std::convert::Into<crate::model::LaunchStage>>(
8139        mut self,
8140        v: T,
8141    ) -> Self {
8142        self.launch_stage = v.into();
8143        self
8144    }
8145}
8146
8147impl wkt::message::Message for MonitoredResourceDescriptor {
8148    fn typename() -> &'static str {
8149        "type.googleapis.com/google.api.MonitoredResourceDescriptor"
8150    }
8151}
8152
8153/// An object representing a resource that can be used for monitoring, logging,
8154/// billing, or other purposes. Examples include virtual machine instances,
8155/// databases, and storage devices such as disks. The `type` field identifies a
8156/// [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] object
8157/// that describes the resource's schema. Information in the `labels` field
8158/// identifies the actual resource and its attributes according to the schema.
8159/// For example, a particular Compute Engine VM instance could be represented by
8160/// the following object, because the
8161/// [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] for
8162/// `"gce_instance"` has labels
8163/// `"project_id"`, `"instance_id"` and `"zone"`:
8164///
8165/// ```norust
8166/// { "type": "gce_instance",
8167///   "labels": { "project_id": "my-project",
8168///               "instance_id": "12345678901234",
8169///               "zone": "us-central1-a" }}
8170/// ```
8171///
8172/// [google.api.MonitoredResourceDescriptor]: crate::model::MonitoredResourceDescriptor
8173#[derive(Clone, Default, PartialEq)]
8174#[non_exhaustive]
8175pub struct MonitoredResource {
8176    /// Required. The monitored resource type. This field must match
8177    /// the `type` field of a
8178    /// [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor]
8179    /// object. For example, the type of a Compute Engine VM instance is
8180    /// `gce_instance`. Some descriptors include the service name in the type; for
8181    /// example, the type of a Datastream stream is
8182    /// `datastream.googleapis.com/Stream`.
8183    ///
8184    /// [google.api.MonitoredResourceDescriptor]: crate::model::MonitoredResourceDescriptor
8185    pub r#type: std::string::String,
8186
8187    /// Required. Values for all of the labels listed in the associated monitored
8188    /// resource descriptor. For example, Compute Engine VM instances use the
8189    /// labels `"project_id"`, `"instance_id"`, and `"zone"`.
8190    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
8191
8192    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8193}
8194
8195impl MonitoredResource {
8196    pub fn new() -> Self {
8197        std::default::Default::default()
8198    }
8199
8200    /// Sets the value of [r#type][crate::model::MonitoredResource::type].
8201    ///
8202    /// # Example
8203    /// ```ignore,no_run
8204    /// # use google_cloud_api::model::MonitoredResource;
8205    /// let x = MonitoredResource::new().set_type("example");
8206    /// ```
8207    pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8208        self.r#type = v.into();
8209        self
8210    }
8211
8212    /// Sets the value of [labels][crate::model::MonitoredResource::labels].
8213    ///
8214    /// # Example
8215    /// ```ignore,no_run
8216    /// # use google_cloud_api::model::MonitoredResource;
8217    /// let x = MonitoredResource::new().set_labels([
8218    ///     ("key0", "abc"),
8219    ///     ("key1", "xyz"),
8220    /// ]);
8221    /// ```
8222    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
8223    where
8224        T: std::iter::IntoIterator<Item = (K, V)>,
8225        K: std::convert::Into<std::string::String>,
8226        V: std::convert::Into<std::string::String>,
8227    {
8228        use std::iter::Iterator;
8229        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8230        self
8231    }
8232}
8233
8234impl wkt::message::Message for MonitoredResource {
8235    fn typename() -> &'static str {
8236        "type.googleapis.com/google.api.MonitoredResource"
8237    }
8238}
8239
8240/// Auxiliary metadata for a [MonitoredResource][google.api.MonitoredResource]
8241/// object. [MonitoredResource][google.api.MonitoredResource] objects contain the
8242/// minimum set of information to uniquely identify a monitored resource
8243/// instance. There is some other useful auxiliary metadata. Monitoring and
8244/// Logging use an ingestion pipeline to extract metadata for cloud resources of
8245/// all types, and store the metadata in this message.
8246///
8247/// [google.api.MonitoredResource]: crate::model::MonitoredResource
8248#[derive(Clone, Default, PartialEq)]
8249#[non_exhaustive]
8250pub struct MonitoredResourceMetadata {
8251    /// Output only. Values for predefined system metadata labels.
8252    /// System labels are a kind of metadata extracted by Google, including
8253    /// "machine_image", "vpc", "subnet_id",
8254    /// "security_group", "name", etc.
8255    /// System label values can be only strings, Boolean values, or a list of
8256    /// strings. For example:
8257    ///
8258    /// ```norust
8259    /// { "name": "my-test-instance",
8260    ///   "security_group": ["a", "b", "c"],
8261    ///   "spot_instance": false }
8262    /// ```
8263    pub system_labels: std::option::Option<wkt::Struct>,
8264
8265    /// Output only. A map of user-defined metadata labels.
8266    pub user_labels: std::collections::HashMap<std::string::String, std::string::String>,
8267
8268    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8269}
8270
8271impl MonitoredResourceMetadata {
8272    pub fn new() -> Self {
8273        std::default::Default::default()
8274    }
8275
8276    /// Sets the value of [system_labels][crate::model::MonitoredResourceMetadata::system_labels].
8277    ///
8278    /// # Example
8279    /// ```ignore,no_run
8280    /// # use google_cloud_api::model::MonitoredResourceMetadata;
8281    /// use wkt::Struct;
8282    /// let x = MonitoredResourceMetadata::new().set_system_labels(Struct::default()/* use setters */);
8283    /// ```
8284    pub fn set_system_labels<T>(mut self, v: T) -> Self
8285    where
8286        T: std::convert::Into<wkt::Struct>,
8287    {
8288        self.system_labels = std::option::Option::Some(v.into());
8289        self
8290    }
8291
8292    /// Sets or clears the value of [system_labels][crate::model::MonitoredResourceMetadata::system_labels].
8293    ///
8294    /// # Example
8295    /// ```ignore,no_run
8296    /// # use google_cloud_api::model::MonitoredResourceMetadata;
8297    /// use wkt::Struct;
8298    /// let x = MonitoredResourceMetadata::new().set_or_clear_system_labels(Some(Struct::default()/* use setters */));
8299    /// let x = MonitoredResourceMetadata::new().set_or_clear_system_labels(None::<Struct>);
8300    /// ```
8301    pub fn set_or_clear_system_labels<T>(mut self, v: std::option::Option<T>) -> Self
8302    where
8303        T: std::convert::Into<wkt::Struct>,
8304    {
8305        self.system_labels = v.map(|x| x.into());
8306        self
8307    }
8308
8309    /// Sets the value of [user_labels][crate::model::MonitoredResourceMetadata::user_labels].
8310    ///
8311    /// # Example
8312    /// ```ignore,no_run
8313    /// # use google_cloud_api::model::MonitoredResourceMetadata;
8314    /// let x = MonitoredResourceMetadata::new().set_user_labels([
8315    ///     ("key0", "abc"),
8316    ///     ("key1", "xyz"),
8317    /// ]);
8318    /// ```
8319    pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
8320    where
8321        T: std::iter::IntoIterator<Item = (K, V)>,
8322        K: std::convert::Into<std::string::String>,
8323        V: std::convert::Into<std::string::String>,
8324    {
8325        use std::iter::Iterator;
8326        self.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8327        self
8328    }
8329}
8330
8331impl wkt::message::Message for MonitoredResourceMetadata {
8332    fn typename() -> &'static str {
8333        "type.googleapis.com/google.api.MonitoredResourceMetadata"
8334    }
8335}
8336
8337/// Monitoring configuration of the service.
8338///
8339/// The example below shows how to configure monitored resources and metrics
8340/// for monitoring. In the example, a monitored resource and two metrics are
8341/// defined. The `library.googleapis.com/book/returned_count` metric is sent
8342/// to both producer and consumer projects, whereas the
8343/// `library.googleapis.com/book/num_overdue` metric is only sent to the
8344/// consumer project.
8345///
8346/// ```norust
8347/// monitored_resources:
8348/// - type: library.googleapis.com/Branch
8349///   display_name: "Library Branch"
8350///   description: "A branch of a library."
8351///   launch_stage: GA
8352///   labels:
8353///   - key: resource_container
8354///     description: "The Cloud container (ie. project id) for the Branch."
8355///   - key: location
8356///     description: "The location of the library branch."
8357///   - key: branch_id
8358///     description: "The id of the branch."
8359/// metrics:
8360/// - name: library.googleapis.com/book/returned_count
8361///   display_name: "Books Returned"
8362///   description: "The count of books that have been returned."
8363///   launch_stage: GA
8364///   metric_kind: DELTA
8365///   value_type: INT64
8366///   unit: "1"
8367///   labels:
8368///   - key: customer_id
8369///     description: "The id of the customer."
8370/// - name: library.googleapis.com/book/num_overdue
8371///   display_name: "Books Overdue"
8372///   description: "The current number of overdue books."
8373///   launch_stage: GA
8374///   metric_kind: GAUGE
8375///   value_type: INT64
8376///   unit: "1"
8377///   labels:
8378///   - key: customer_id
8379///     description: "The id of the customer."
8380/// monitoring:
8381///   producer_destinations:
8382///   - monitored_resource: library.googleapis.com/Branch
8383///     metrics:
8384///     - library.googleapis.com/book/returned_count
8385///   consumer_destinations:
8386///   - monitored_resource: library.googleapis.com/Branch
8387///     metrics:
8388///     - library.googleapis.com/book/returned_count
8389///     - library.googleapis.com/book/num_overdue
8390/// ```
8391#[derive(Clone, Default, PartialEq)]
8392#[non_exhaustive]
8393pub struct Monitoring {
8394    /// Monitoring configurations for sending metrics to the producer project.
8395    /// There can be multiple producer destinations. A monitored resource type may
8396    /// appear in multiple monitoring destinations if different aggregations are
8397    /// needed for different sets of metrics associated with that monitored
8398    /// resource type. A monitored resource and metric pair may only be used once
8399    /// in the Monitoring configuration.
8400    pub producer_destinations: std::vec::Vec<crate::model::monitoring::MonitoringDestination>,
8401
8402    /// Monitoring configurations for sending metrics to the consumer project.
8403    /// There can be multiple consumer destinations. A monitored resource type may
8404    /// appear in multiple monitoring destinations if different aggregations are
8405    /// needed for different sets of metrics associated with that monitored
8406    /// resource type. A monitored resource and metric pair may only be used once
8407    /// in the Monitoring configuration.
8408    pub consumer_destinations: std::vec::Vec<crate::model::monitoring::MonitoringDestination>,
8409
8410    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8411}
8412
8413impl Monitoring {
8414    pub fn new() -> Self {
8415        std::default::Default::default()
8416    }
8417
8418    /// Sets the value of [producer_destinations][crate::model::Monitoring::producer_destinations].
8419    ///
8420    /// # Example
8421    /// ```ignore,no_run
8422    /// # use google_cloud_api::model::Monitoring;
8423    /// use google_cloud_api::model::monitoring::MonitoringDestination;
8424    /// let x = Monitoring::new()
8425    ///     .set_producer_destinations([
8426    ///         MonitoringDestination::default()/* use setters */,
8427    ///         MonitoringDestination::default()/* use (different) setters */,
8428    ///     ]);
8429    /// ```
8430    pub fn set_producer_destinations<T, V>(mut self, v: T) -> Self
8431    where
8432        T: std::iter::IntoIterator<Item = V>,
8433        V: std::convert::Into<crate::model::monitoring::MonitoringDestination>,
8434    {
8435        use std::iter::Iterator;
8436        self.producer_destinations = v.into_iter().map(|i| i.into()).collect();
8437        self
8438    }
8439
8440    /// Sets the value of [consumer_destinations][crate::model::Monitoring::consumer_destinations].
8441    ///
8442    /// # Example
8443    /// ```ignore,no_run
8444    /// # use google_cloud_api::model::Monitoring;
8445    /// use google_cloud_api::model::monitoring::MonitoringDestination;
8446    /// let x = Monitoring::new()
8447    ///     .set_consumer_destinations([
8448    ///         MonitoringDestination::default()/* use setters */,
8449    ///         MonitoringDestination::default()/* use (different) setters */,
8450    ///     ]);
8451    /// ```
8452    pub fn set_consumer_destinations<T, V>(mut self, v: T) -> Self
8453    where
8454        T: std::iter::IntoIterator<Item = V>,
8455        V: std::convert::Into<crate::model::monitoring::MonitoringDestination>,
8456    {
8457        use std::iter::Iterator;
8458        self.consumer_destinations = v.into_iter().map(|i| i.into()).collect();
8459        self
8460    }
8461}
8462
8463impl wkt::message::Message for Monitoring {
8464    fn typename() -> &'static str {
8465        "type.googleapis.com/google.api.Monitoring"
8466    }
8467}
8468
8469/// Defines additional types related to [Monitoring].
8470pub mod monitoring {
8471    #[allow(unused_imports)]
8472    use super::*;
8473
8474    /// Configuration of a specific monitoring destination (the producer project
8475    /// or the consumer project).
8476    #[derive(Clone, Default, PartialEq)]
8477    #[non_exhaustive]
8478    pub struct MonitoringDestination {
8479        /// The monitored resource type. The type must be defined in
8480        /// [Service.monitored_resources][google.api.Service.monitored_resources]
8481        /// section.
8482        ///
8483        /// [google.api.Service.monitored_resources]: crate::model::Service::monitored_resources
8484        pub monitored_resource: std::string::String,
8485
8486        /// Types of the metrics to report to this monitoring destination.
8487        /// Each type must be defined in
8488        /// [Service.metrics][google.api.Service.metrics] section.
8489        ///
8490        /// [google.api.Service.metrics]: crate::model::Service::metrics
8491        pub metrics: std::vec::Vec<std::string::String>,
8492
8493        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8494    }
8495
8496    impl MonitoringDestination {
8497        pub fn new() -> Self {
8498            std::default::Default::default()
8499        }
8500
8501        /// Sets the value of [monitored_resource][crate::model::monitoring::MonitoringDestination::monitored_resource].
8502        ///
8503        /// # Example
8504        /// ```ignore,no_run
8505        /// # use google_cloud_api::model::monitoring::MonitoringDestination;
8506        /// let x = MonitoringDestination::new().set_monitored_resource("example");
8507        /// ```
8508        pub fn set_monitored_resource<T: std::convert::Into<std::string::String>>(
8509            mut self,
8510            v: T,
8511        ) -> Self {
8512            self.monitored_resource = v.into();
8513            self
8514        }
8515
8516        /// Sets the value of [metrics][crate::model::monitoring::MonitoringDestination::metrics].
8517        ///
8518        /// # Example
8519        /// ```ignore,no_run
8520        /// # use google_cloud_api::model::monitoring::MonitoringDestination;
8521        /// let x = MonitoringDestination::new().set_metrics(["a", "b", "c"]);
8522        /// ```
8523        pub fn set_metrics<T, V>(mut self, v: T) -> Self
8524        where
8525            T: std::iter::IntoIterator<Item = V>,
8526            V: std::convert::Into<std::string::String>,
8527        {
8528            use std::iter::Iterator;
8529            self.metrics = v.into_iter().map(|i| i.into()).collect();
8530            self
8531        }
8532    }
8533
8534    impl wkt::message::Message for MonitoringDestination {
8535        fn typename() -> &'static str {
8536            "type.googleapis.com/google.api.Monitoring.MonitoringDestination"
8537        }
8538    }
8539}
8540
8541/// Google API Policy Annotation
8542///
8543/// This message defines a simple API policy annotation that can be used to
8544/// annotate API request and response message fields with applicable policies.
8545/// One field may have multiple applicable policies that must all be satisfied
8546/// before a request can be processed. This policy annotation is used to
8547/// generate the overall policy that will be used for automatic runtime
8548/// policy enforcement and documentation generation.
8549#[derive(Clone, Default, PartialEq)]
8550#[non_exhaustive]
8551pub struct FieldPolicy {
8552    /// Selects one or more request or response message fields to apply this
8553    /// `FieldPolicy`.
8554    ///
8555    /// When a `FieldPolicy` is used in proto annotation, the selector must
8556    /// be left as empty. The service config generator will automatically fill
8557    /// the correct value.
8558    ///
8559    /// When a `FieldPolicy` is used in service config, the selector must be a
8560    /// comma-separated string with valid request or response field paths,
8561    /// such as "foo.bar" or "foo.bar,foo.baz".
8562    pub selector: std::string::String,
8563
8564    /// Specifies the required permission(s) for the resource referred to by the
8565    /// field. It requires the field contains a valid resource reference, and
8566    /// the request must pass the permission checks to proceed. For example,
8567    /// "resourcemanager.projects.get".
8568    pub resource_permission: std::string::String,
8569
8570    /// Specifies the resource type for the resource referred to by the field.
8571    pub resource_type: std::string::String,
8572
8573    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8574}
8575
8576impl FieldPolicy {
8577    pub fn new() -> Self {
8578        std::default::Default::default()
8579    }
8580
8581    /// Sets the value of [selector][crate::model::FieldPolicy::selector].
8582    ///
8583    /// # Example
8584    /// ```ignore,no_run
8585    /// # use google_cloud_api::model::FieldPolicy;
8586    /// let x = FieldPolicy::new().set_selector("example");
8587    /// ```
8588    pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8589        self.selector = v.into();
8590        self
8591    }
8592
8593    /// Sets the value of [resource_permission][crate::model::FieldPolicy::resource_permission].
8594    ///
8595    /// # Example
8596    /// ```ignore,no_run
8597    /// # use google_cloud_api::model::FieldPolicy;
8598    /// let x = FieldPolicy::new().set_resource_permission("example");
8599    /// ```
8600    pub fn set_resource_permission<T: std::convert::Into<std::string::String>>(
8601        mut self,
8602        v: T,
8603    ) -> Self {
8604        self.resource_permission = v.into();
8605        self
8606    }
8607
8608    /// Sets the value of [resource_type][crate::model::FieldPolicy::resource_type].
8609    ///
8610    /// # Example
8611    /// ```ignore,no_run
8612    /// # use google_cloud_api::model::FieldPolicy;
8613    /// let x = FieldPolicy::new().set_resource_type("example");
8614    /// ```
8615    pub fn set_resource_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8616        self.resource_type = v.into();
8617        self
8618    }
8619}
8620
8621impl wkt::message::Message for FieldPolicy {
8622    fn typename() -> &'static str {
8623        "type.googleapis.com/google.api.FieldPolicy"
8624    }
8625}
8626
8627/// Defines policies applying to an RPC method.
8628#[derive(Clone, Default, PartialEq)]
8629#[non_exhaustive]
8630pub struct MethodPolicy {
8631    /// Selects a method to which these policies should be enforced, for example,
8632    /// "google.pubsub.v1.Subscriber.CreateSubscription".
8633    ///
8634    /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
8635    /// details.
8636    ///
8637    /// NOTE: This field must not be set in the proto annotation. It will be
8638    /// automatically filled by the service config compiler .
8639    ///
8640    /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
8641    pub selector: std::string::String,
8642
8643    /// Policies that are applicable to the request message.
8644    pub request_policies: std::vec::Vec<crate::model::FieldPolicy>,
8645
8646    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8647}
8648
8649impl MethodPolicy {
8650    pub fn new() -> Self {
8651        std::default::Default::default()
8652    }
8653
8654    /// Sets the value of [selector][crate::model::MethodPolicy::selector].
8655    ///
8656    /// # Example
8657    /// ```ignore,no_run
8658    /// # use google_cloud_api::model::MethodPolicy;
8659    /// let x = MethodPolicy::new().set_selector("example");
8660    /// ```
8661    pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8662        self.selector = v.into();
8663        self
8664    }
8665
8666    /// Sets the value of [request_policies][crate::model::MethodPolicy::request_policies].
8667    ///
8668    /// # Example
8669    /// ```ignore,no_run
8670    /// # use google_cloud_api::model::MethodPolicy;
8671    /// use google_cloud_api::model::FieldPolicy;
8672    /// let x = MethodPolicy::new()
8673    ///     .set_request_policies([
8674    ///         FieldPolicy::default()/* use setters */,
8675    ///         FieldPolicy::default()/* use (different) setters */,
8676    ///     ]);
8677    /// ```
8678    pub fn set_request_policies<T, V>(mut self, v: T) -> Self
8679    where
8680        T: std::iter::IntoIterator<Item = V>,
8681        V: std::convert::Into<crate::model::FieldPolicy>,
8682    {
8683        use std::iter::Iterator;
8684        self.request_policies = v.into_iter().map(|i| i.into()).collect();
8685        self
8686    }
8687}
8688
8689impl wkt::message::Message for MethodPolicy {
8690    fn typename() -> &'static str {
8691        "type.googleapis.com/google.api.MethodPolicy"
8692    }
8693}
8694
8695/// Quota configuration helps to achieve fairness and budgeting in service
8696/// usage.
8697///
8698/// The metric based quota configuration works this way:
8699///
8700/// - The service configuration defines a set of metrics.
8701/// - For API calls, the quota.metric_rules maps methods to metrics with
8702///   corresponding costs.
8703/// - The quota.limits defines limits on the metrics, which will be used for
8704///   quota checks at runtime.
8705///
8706/// An example quota configuration in yaml format:
8707///
8708/// quota:
8709/// limits:
8710///
8711/// ```norust
8712///  - name: apiWriteQpsPerProject
8713///    metric: library.googleapis.com/write_calls
8714///    unit: "1/min/{project}"  # rate limit for consumer projects
8715///    values:
8716///      STANDARD: 10000
8717///
8718///
8719///  (The metric rules bind all methods to the read_calls metric,
8720///   except for the UpdateBook and DeleteBook methods. These two methods
8721///   are mapped to the write_calls metric, with the UpdateBook method
8722///   consuming at twice rate as the DeleteBook method.)
8723///  metric_rules:
8724///  - selector: "*"
8725///    metric_costs:
8726///      library.googleapis.com/read_calls: 1
8727///  - selector: google.example.library.v1.LibraryService.UpdateBook
8728///    metric_costs:
8729///      library.googleapis.com/write_calls: 2
8730///  - selector: google.example.library.v1.LibraryService.DeleteBook
8731///    metric_costs:
8732///      library.googleapis.com/write_calls: 1
8733/// ```
8734///
8735/// Corresponding Metric definition:
8736///
8737/// ```norust
8738///  metrics:
8739///  - name: library.googleapis.com/read_calls
8740///    display_name: Read requests
8741///    metric_kind: DELTA
8742///    value_type: INT64
8743///
8744///  - name: library.googleapis.com/write_calls
8745///    display_name: Write requests
8746///    metric_kind: DELTA
8747///    value_type: INT64
8748/// ```
8749#[derive(Clone, Default, PartialEq)]
8750#[non_exhaustive]
8751pub struct Quota {
8752    /// List of QuotaLimit definitions for the service.
8753    pub limits: std::vec::Vec<crate::model::QuotaLimit>,
8754
8755    /// List of MetricRule definitions, each one mapping a selected method to one
8756    /// or more metrics.
8757    pub metric_rules: std::vec::Vec<crate::model::MetricRule>,
8758
8759    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8760}
8761
8762impl Quota {
8763    pub fn new() -> Self {
8764        std::default::Default::default()
8765    }
8766
8767    /// Sets the value of [limits][crate::model::Quota::limits].
8768    ///
8769    /// # Example
8770    /// ```ignore,no_run
8771    /// # use google_cloud_api::model::Quota;
8772    /// use google_cloud_api::model::QuotaLimit;
8773    /// let x = Quota::new()
8774    ///     .set_limits([
8775    ///         QuotaLimit::default()/* use setters */,
8776    ///         QuotaLimit::default()/* use (different) setters */,
8777    ///     ]);
8778    /// ```
8779    pub fn set_limits<T, V>(mut self, v: T) -> Self
8780    where
8781        T: std::iter::IntoIterator<Item = V>,
8782        V: std::convert::Into<crate::model::QuotaLimit>,
8783    {
8784        use std::iter::Iterator;
8785        self.limits = v.into_iter().map(|i| i.into()).collect();
8786        self
8787    }
8788
8789    /// Sets the value of [metric_rules][crate::model::Quota::metric_rules].
8790    ///
8791    /// # Example
8792    /// ```ignore,no_run
8793    /// # use google_cloud_api::model::Quota;
8794    /// use google_cloud_api::model::MetricRule;
8795    /// let x = Quota::new()
8796    ///     .set_metric_rules([
8797    ///         MetricRule::default()/* use setters */,
8798    ///         MetricRule::default()/* use (different) setters */,
8799    ///     ]);
8800    /// ```
8801    pub fn set_metric_rules<T, V>(mut self, v: T) -> Self
8802    where
8803        T: std::iter::IntoIterator<Item = V>,
8804        V: std::convert::Into<crate::model::MetricRule>,
8805    {
8806        use std::iter::Iterator;
8807        self.metric_rules = v.into_iter().map(|i| i.into()).collect();
8808        self
8809    }
8810}
8811
8812impl wkt::message::Message for Quota {
8813    fn typename() -> &'static str {
8814        "type.googleapis.com/google.api.Quota"
8815    }
8816}
8817
8818/// Bind API methods to metrics. Binding a method to a metric causes that
8819/// metric's configured quota behaviors to apply to the method call.
8820#[derive(Clone, Default, PartialEq)]
8821#[non_exhaustive]
8822pub struct MetricRule {
8823    /// Selects the methods to which this rule applies.
8824    ///
8825    /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
8826    /// details.
8827    ///
8828    /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
8829    pub selector: std::string::String,
8830
8831    /// Metrics to update when the selected methods are called, and the associated
8832    /// cost applied to each metric.
8833    ///
8834    /// The key of the map is the metric name, and the values are the amount
8835    /// increased for the metric against which the quota limits are defined.
8836    /// The value must not be negative.
8837    pub metric_costs: std::collections::HashMap<std::string::String, i64>,
8838
8839    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8840}
8841
8842impl MetricRule {
8843    pub fn new() -> Self {
8844        std::default::Default::default()
8845    }
8846
8847    /// Sets the value of [selector][crate::model::MetricRule::selector].
8848    ///
8849    /// # Example
8850    /// ```ignore,no_run
8851    /// # use google_cloud_api::model::MetricRule;
8852    /// let x = MetricRule::new().set_selector("example");
8853    /// ```
8854    pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8855        self.selector = v.into();
8856        self
8857    }
8858
8859    /// Sets the value of [metric_costs][crate::model::MetricRule::metric_costs].
8860    ///
8861    /// # Example
8862    /// ```ignore,no_run
8863    /// # use google_cloud_api::model::MetricRule;
8864    /// let x = MetricRule::new().set_metric_costs([
8865    ///     ("key0", 123),
8866    ///     ("key1", 456),
8867    /// ]);
8868    /// ```
8869    pub fn set_metric_costs<T, K, V>(mut self, v: T) -> Self
8870    where
8871        T: std::iter::IntoIterator<Item = (K, V)>,
8872        K: std::convert::Into<std::string::String>,
8873        V: std::convert::Into<i64>,
8874    {
8875        use std::iter::Iterator;
8876        self.metric_costs = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8877        self
8878    }
8879}
8880
8881impl wkt::message::Message for MetricRule {
8882    fn typename() -> &'static str {
8883        "type.googleapis.com/google.api.MetricRule"
8884    }
8885}
8886
8887/// `QuotaLimit` defines a specific limit that applies over a specified duration
8888/// for a limit type. There can be at most one limit for a duration and limit
8889/// type combination defined within a `QuotaGroup`.
8890#[derive(Clone, Default, PartialEq)]
8891#[non_exhaustive]
8892pub struct QuotaLimit {
8893    /// Name of the quota limit.
8894    ///
8895    /// The name must be provided, and it must be unique within the service. The
8896    /// name can only include alphanumeric characters as well as '-'.
8897    ///
8898    /// The maximum length of the limit name is 64 characters.
8899    pub name: std::string::String,
8900
8901    /// Optional. User-visible, extended description for this quota limit.
8902    /// Should be used only when more context is needed to understand this limit
8903    /// than provided by the limit's display name (see: `display_name`).
8904    pub description: std::string::String,
8905
8906    /// Default number of tokens that can be consumed during the specified
8907    /// duration. This is the number of tokens assigned when a client
8908    /// application developer activates the service for his/her project.
8909    ///
8910    /// Specifying a value of 0 will block all requests. This can be used if you
8911    /// are provisioning quota to selected consumers and blocking others.
8912    /// Similarly, a value of -1 will indicate an unlimited quota. No other
8913    /// negative values are allowed.
8914    ///
8915    /// Used by group-based quotas only.
8916    pub default_limit: i64,
8917
8918    /// Maximum number of tokens that can be consumed during the specified
8919    /// duration. Client application developers can override the default limit up
8920    /// to this maximum. If specified, this value cannot be set to a value less
8921    /// than the default limit. If not specified, it is set to the default limit.
8922    ///
8923    /// To allow clients to apply overrides with no upper bound, set this to -1,
8924    /// indicating unlimited maximum quota.
8925    ///
8926    /// Used by group-based quotas only.
8927    pub max_limit: i64,
8928
8929    /// Free tier value displayed in the Developers Console for this limit.
8930    /// The free tier is the number of tokens that will be subtracted from the
8931    /// billed amount when billing is enabled.
8932    /// This field can only be set on a limit with duration "1d", in a billable
8933    /// group; it is invalid on any other limit. If this field is not set, it
8934    /// defaults to 0, indicating that there is no free tier for this service.
8935    ///
8936    /// Used by group-based quotas only.
8937    pub free_tier: i64,
8938
8939    /// Duration of this limit in textual notation. Must be "100s" or "1d".
8940    ///
8941    /// Used by group-based quotas only.
8942    pub duration: std::string::String,
8943
8944    /// The name of the metric this quota limit applies to. The quota limits with
8945    /// the same metric will be checked together during runtime. The metric must be
8946    /// defined within the service config.
8947    pub metric: std::string::String,
8948
8949    /// Specify the unit of the quota limit. It uses the same syntax as
8950    /// [MetricDescriptor.unit][google.api.MetricDescriptor.unit]. The supported
8951    /// unit kinds are determined by the quota backend system.
8952    ///
8953    /// Here are some examples:
8954    ///
8955    /// * "1/min/{project}" for quota per minute per project.
8956    ///
8957    /// Note: the order of unit components is insignificant.
8958    /// The "1" at the beginning is required to follow the metric unit syntax.
8959    ///
8960    /// [google.api.MetricDescriptor.unit]: crate::model::MetricDescriptor::unit
8961    pub unit: std::string::String,
8962
8963    /// Tiered limit values. You must specify this as a key:value pair, with an
8964    /// integer value that is the maximum number of requests allowed for the
8965    /// specified unit. Currently only STANDARD is supported.
8966    pub values: std::collections::HashMap<std::string::String, i64>,
8967
8968    /// User-visible display name for this limit.
8969    /// Optional. If not set, the UI will provide a default display name based on
8970    /// the quota configuration. This field can be used to override the default
8971    /// display name generated from the configuration.
8972    pub display_name: std::string::String,
8973
8974    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8975}
8976
8977impl QuotaLimit {
8978    pub fn new() -> Self {
8979        std::default::Default::default()
8980    }
8981
8982    /// Sets the value of [name][crate::model::QuotaLimit::name].
8983    ///
8984    /// # Example
8985    /// ```ignore,no_run
8986    /// # use google_cloud_api::model::QuotaLimit;
8987    /// let x = QuotaLimit::new().set_name("example");
8988    /// ```
8989    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8990        self.name = v.into();
8991        self
8992    }
8993
8994    /// Sets the value of [description][crate::model::QuotaLimit::description].
8995    ///
8996    /// # Example
8997    /// ```ignore,no_run
8998    /// # use google_cloud_api::model::QuotaLimit;
8999    /// let x = QuotaLimit::new().set_description("example");
9000    /// ```
9001    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9002        self.description = v.into();
9003        self
9004    }
9005
9006    /// Sets the value of [default_limit][crate::model::QuotaLimit::default_limit].
9007    ///
9008    /// # Example
9009    /// ```ignore,no_run
9010    /// # use google_cloud_api::model::QuotaLimit;
9011    /// let x = QuotaLimit::new().set_default_limit(42);
9012    /// ```
9013    pub fn set_default_limit<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
9014        self.default_limit = v.into();
9015        self
9016    }
9017
9018    /// Sets the value of [max_limit][crate::model::QuotaLimit::max_limit].
9019    ///
9020    /// # Example
9021    /// ```ignore,no_run
9022    /// # use google_cloud_api::model::QuotaLimit;
9023    /// let x = QuotaLimit::new().set_max_limit(42);
9024    /// ```
9025    pub fn set_max_limit<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
9026        self.max_limit = v.into();
9027        self
9028    }
9029
9030    /// Sets the value of [free_tier][crate::model::QuotaLimit::free_tier].
9031    ///
9032    /// # Example
9033    /// ```ignore,no_run
9034    /// # use google_cloud_api::model::QuotaLimit;
9035    /// let x = QuotaLimit::new().set_free_tier(42);
9036    /// ```
9037    pub fn set_free_tier<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
9038        self.free_tier = v.into();
9039        self
9040    }
9041
9042    /// Sets the value of [duration][crate::model::QuotaLimit::duration].
9043    ///
9044    /// # Example
9045    /// ```ignore,no_run
9046    /// # use google_cloud_api::model::QuotaLimit;
9047    /// let x = QuotaLimit::new().set_duration("example");
9048    /// ```
9049    pub fn set_duration<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9050        self.duration = v.into();
9051        self
9052    }
9053
9054    /// Sets the value of [metric][crate::model::QuotaLimit::metric].
9055    ///
9056    /// # Example
9057    /// ```ignore,no_run
9058    /// # use google_cloud_api::model::QuotaLimit;
9059    /// let x = QuotaLimit::new().set_metric("example");
9060    /// ```
9061    pub fn set_metric<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9062        self.metric = v.into();
9063        self
9064    }
9065
9066    /// Sets the value of [unit][crate::model::QuotaLimit::unit].
9067    ///
9068    /// # Example
9069    /// ```ignore,no_run
9070    /// # use google_cloud_api::model::QuotaLimit;
9071    /// let x = QuotaLimit::new().set_unit("example");
9072    /// ```
9073    pub fn set_unit<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9074        self.unit = v.into();
9075        self
9076    }
9077
9078    /// Sets the value of [values][crate::model::QuotaLimit::values].
9079    ///
9080    /// # Example
9081    /// ```ignore,no_run
9082    /// # use google_cloud_api::model::QuotaLimit;
9083    /// let x = QuotaLimit::new().set_values([
9084    ///     ("key0", 123),
9085    ///     ("key1", 456),
9086    /// ]);
9087    /// ```
9088    pub fn set_values<T, K, V>(mut self, v: T) -> Self
9089    where
9090        T: std::iter::IntoIterator<Item = (K, V)>,
9091        K: std::convert::Into<std::string::String>,
9092        V: std::convert::Into<i64>,
9093    {
9094        use std::iter::Iterator;
9095        self.values = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9096        self
9097    }
9098
9099    /// Sets the value of [display_name][crate::model::QuotaLimit::display_name].
9100    ///
9101    /// # Example
9102    /// ```ignore,no_run
9103    /// # use google_cloud_api::model::QuotaLimit;
9104    /// let x = QuotaLimit::new().set_display_name("example");
9105    /// ```
9106    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9107        self.display_name = v.into();
9108        self
9109    }
9110}
9111
9112impl wkt::message::Message for QuotaLimit {
9113    fn typename() -> &'static str {
9114        "type.googleapis.com/google.api.QuotaLimit"
9115    }
9116}
9117
9118/// A simple descriptor of a resource type.
9119///
9120/// ResourceDescriptor annotates a resource message (either by means of a
9121/// protobuf annotation or use in the service config), and associates the
9122/// resource's schema, the resource type, and the pattern of the resource name.
9123///
9124/// Example:
9125///
9126/// ```norust
9127/// message Topic {
9128///   // Indicates this message defines a resource schema.
9129///   // Declares the resource type in the format of {service}/{kind}.
9130///   // For Kubernetes resources, the format is {api group}/{kind}.
9131///   option (google.api.resource) = {
9132///     type: "pubsub.googleapis.com/Topic"
9133///     pattern: "projects/{project}/topics/{topic}"
9134///   };
9135/// }
9136/// ```
9137///
9138/// The ResourceDescriptor Yaml config will look like:
9139///
9140/// ```norust
9141/// resources:
9142/// - type: "pubsub.googleapis.com/Topic"
9143///   pattern: "projects/{project}/topics/{topic}"
9144/// ```
9145///
9146/// Sometimes, resources have multiple patterns, typically because they can
9147/// live under multiple parents.
9148///
9149/// Example:
9150///
9151/// ```norust
9152/// message LogEntry {
9153///   option (google.api.resource) = {
9154///     type: "logging.googleapis.com/LogEntry"
9155///     pattern: "projects/{project}/logs/{log}"
9156///     pattern: "folders/{folder}/logs/{log}"
9157///     pattern: "organizations/{organization}/logs/{log}"
9158///     pattern: "billingAccounts/{billing_account}/logs/{log}"
9159///   };
9160/// }
9161/// ```
9162///
9163/// The ResourceDescriptor Yaml config will look like:
9164///
9165/// ```norust
9166/// resources:
9167/// - type: 'logging.googleapis.com/LogEntry'
9168///   pattern: "projects/{project}/logs/{log}"
9169///   pattern: "folders/{folder}/logs/{log}"
9170///   pattern: "organizations/{organization}/logs/{log}"
9171///   pattern: "billingAccounts/{billing_account}/logs/{log}"
9172/// ```
9173#[derive(Clone, Default, PartialEq)]
9174#[non_exhaustive]
9175pub struct ResourceDescriptor {
9176    /// The resource type. It must be in the format of
9177    /// {service_name}/{resource_type_kind}. The `resource_type_kind` must be
9178    /// singular and must not include version numbers.
9179    ///
9180    /// Example: `storage.googleapis.com/Bucket`
9181    ///
9182    /// The value of the resource_type_kind must follow the regular expression
9183    /// /[A-Za-z][a-zA-Z0-9]+/. It should start with an upper case character and
9184    /// should use PascalCase (UpperCamelCase). The maximum number of
9185    /// characters allowed for the `resource_type_kind` is 100.
9186    pub r#type: std::string::String,
9187
9188    /// Optional. The relative resource name pattern associated with this resource
9189    /// type. The DNS prefix of the full resource name shouldn't be specified here.
9190    ///
9191    /// The path pattern must follow the syntax, which aligns with HTTP binding
9192    /// syntax:
9193    ///
9194    /// ```norust
9195    /// Template = Segment { "/" Segment } ;
9196    /// Segment = LITERAL | Variable ;
9197    /// Variable = "{" LITERAL "}" ;
9198    /// ```
9199    ///
9200    /// Examples:
9201    ///
9202    /// ```norust
9203    /// - "projects/{project}/topics/{topic}"
9204    /// - "projects/{project}/knowledgeBases/{knowledge_base}"
9205    /// ```
9206    ///
9207    /// The components in braces correspond to the IDs for each resource in the
9208    /// hierarchy. It is expected that, if multiple patterns are provided,
9209    /// the same component name (e.g. "project") refers to IDs of the same
9210    /// type of resource.
9211    pub pattern: std::vec::Vec<std::string::String>,
9212
9213    /// Optional. The field on the resource that designates the resource name
9214    /// field. If omitted, this is assumed to be "name".
9215    pub name_field: std::string::String,
9216
9217    /// Optional. The historical or future-looking state of the resource pattern.
9218    ///
9219    /// Example:
9220    ///
9221    /// ```norust
9222    /// // The InspectTemplate message originally only supported resource
9223    /// // names with organization, and project was added later.
9224    /// message InspectTemplate {
9225    ///   option (google.api.resource) = {
9226    ///     type: "dlp.googleapis.com/InspectTemplate"
9227    ///     pattern:
9228    ///     "organizations/{organization}/inspectTemplates/{inspect_template}"
9229    ///     pattern: "projects/{project}/inspectTemplates/{inspect_template}"
9230    ///     history: ORIGINALLY_SINGLE_PATTERN
9231    ///   };
9232    /// }
9233    /// ```
9234    pub history: crate::model::resource_descriptor::History,
9235
9236    /// The plural name used in the resource name and permission names, such as
9237    /// 'projects' for the resource name of 'projects/{project}' and the permission
9238    /// name of 'cloudresourcemanager.googleapis.com/projects.get'. One exception
9239    /// to this is for Nested Collections that have stuttering names, as defined
9240    /// in [AIP-122](https://google.aip.dev/122#nested-collections), where the
9241    /// collection ID in the resource name pattern does not necessarily directly
9242    /// match the `plural` value.
9243    ///
9244    /// It is the same concept of the `plural` field in k8s CRD spec
9245    /// <https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/>
9246    ///
9247    /// Note: The plural form is required even for singleton resources. See
9248    /// <https://aip.dev/156>
9249    pub plural: std::string::String,
9250
9251    /// The same concept of the `singular` field in k8s CRD spec
9252    /// <https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/>
9253    /// Such as "project" for the `resourcemanager.googleapis.com/Project` type.
9254    pub singular: std::string::String,
9255
9256    /// Style flag(s) for this resource.
9257    /// These indicate that a resource is expected to conform to a given
9258    /// style. See the specific style flags for additional information.
9259    pub style: std::vec::Vec<crate::model::resource_descriptor::Style>,
9260
9261    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9262}
9263
9264impl ResourceDescriptor {
9265    pub fn new() -> Self {
9266        std::default::Default::default()
9267    }
9268
9269    /// Sets the value of [r#type][crate::model::ResourceDescriptor::type].
9270    ///
9271    /// # Example
9272    /// ```ignore,no_run
9273    /// # use google_cloud_api::model::ResourceDescriptor;
9274    /// let x = ResourceDescriptor::new().set_type("example");
9275    /// ```
9276    pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9277        self.r#type = v.into();
9278        self
9279    }
9280
9281    /// Sets the value of [pattern][crate::model::ResourceDescriptor::pattern].
9282    ///
9283    /// # Example
9284    /// ```ignore,no_run
9285    /// # use google_cloud_api::model::ResourceDescriptor;
9286    /// let x = ResourceDescriptor::new().set_pattern(["a", "b", "c"]);
9287    /// ```
9288    pub fn set_pattern<T, V>(mut self, v: T) -> Self
9289    where
9290        T: std::iter::IntoIterator<Item = V>,
9291        V: std::convert::Into<std::string::String>,
9292    {
9293        use std::iter::Iterator;
9294        self.pattern = v.into_iter().map(|i| i.into()).collect();
9295        self
9296    }
9297
9298    /// Sets the value of [name_field][crate::model::ResourceDescriptor::name_field].
9299    ///
9300    /// # Example
9301    /// ```ignore,no_run
9302    /// # use google_cloud_api::model::ResourceDescriptor;
9303    /// let x = ResourceDescriptor::new().set_name_field("example");
9304    /// ```
9305    pub fn set_name_field<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9306        self.name_field = v.into();
9307        self
9308    }
9309
9310    /// Sets the value of [history][crate::model::ResourceDescriptor::history].
9311    ///
9312    /// # Example
9313    /// ```ignore,no_run
9314    /// # use google_cloud_api::model::ResourceDescriptor;
9315    /// use google_cloud_api::model::resource_descriptor::History;
9316    /// let x0 = ResourceDescriptor::new().set_history(History::OriginallySinglePattern);
9317    /// let x1 = ResourceDescriptor::new().set_history(History::FutureMultiPattern);
9318    /// ```
9319    pub fn set_history<T: std::convert::Into<crate::model::resource_descriptor::History>>(
9320        mut self,
9321        v: T,
9322    ) -> Self {
9323        self.history = v.into();
9324        self
9325    }
9326
9327    /// Sets the value of [plural][crate::model::ResourceDescriptor::plural].
9328    ///
9329    /// # Example
9330    /// ```ignore,no_run
9331    /// # use google_cloud_api::model::ResourceDescriptor;
9332    /// let x = ResourceDescriptor::new().set_plural("example");
9333    /// ```
9334    pub fn set_plural<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9335        self.plural = v.into();
9336        self
9337    }
9338
9339    /// Sets the value of [singular][crate::model::ResourceDescriptor::singular].
9340    ///
9341    /// # Example
9342    /// ```ignore,no_run
9343    /// # use google_cloud_api::model::ResourceDescriptor;
9344    /// let x = ResourceDescriptor::new().set_singular("example");
9345    /// ```
9346    pub fn set_singular<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9347        self.singular = v.into();
9348        self
9349    }
9350
9351    /// Sets the value of [style][crate::model::ResourceDescriptor::style].
9352    ///
9353    /// # Example
9354    /// ```ignore,no_run
9355    /// # use google_cloud_api::model::ResourceDescriptor;
9356    /// use google_cloud_api::model::resource_descriptor::Style;
9357    /// let x = ResourceDescriptor::new().set_style([
9358    ///     Style::DeclarativeFriendly,
9359    /// ]);
9360    /// ```
9361    pub fn set_style<T, V>(mut self, v: T) -> Self
9362    where
9363        T: std::iter::IntoIterator<Item = V>,
9364        V: std::convert::Into<crate::model::resource_descriptor::Style>,
9365    {
9366        use std::iter::Iterator;
9367        self.style = v.into_iter().map(|i| i.into()).collect();
9368        self
9369    }
9370}
9371
9372impl wkt::message::Message for ResourceDescriptor {
9373    fn typename() -> &'static str {
9374        "type.googleapis.com/google.api.ResourceDescriptor"
9375    }
9376}
9377
9378/// Defines additional types related to [ResourceDescriptor].
9379pub mod resource_descriptor {
9380    #[allow(unused_imports)]
9381    use super::*;
9382
9383    /// A description of the historical or future-looking state of the
9384    /// resource pattern.
9385    ///
9386    /// # Working with unknown values
9387    ///
9388    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9389    /// additional enum variants at any time. Adding new variants is not considered
9390    /// a breaking change. Applications should write their code in anticipation of:
9391    ///
9392    /// - New values appearing in future releases of the client library, **and**
9393    /// - New values received dynamically, without application changes.
9394    ///
9395    /// Please consult the [Working with enums] section in the user guide for some
9396    /// guidelines.
9397    ///
9398    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9399    #[derive(Clone, Debug, PartialEq)]
9400    #[non_exhaustive]
9401    pub enum History {
9402        /// The "unset" value.
9403        Unspecified,
9404        /// The resource originally had one pattern and launched as such, and
9405        /// additional patterns were added later.
9406        OriginallySinglePattern,
9407        /// The resource has one pattern, but the API owner expects to add more
9408        /// later. (This is the inverse of ORIGINALLY_SINGLE_PATTERN, and prevents
9409        /// that from being necessary once there are multiple patterns.)
9410        FutureMultiPattern,
9411        /// If set, the enum was initialized with an unknown value.
9412        ///
9413        /// Applications can examine the value using [History::value] or
9414        /// [History::name].
9415        UnknownValue(history::UnknownValue),
9416    }
9417
9418    #[doc(hidden)]
9419    pub mod history {
9420        #[allow(unused_imports)]
9421        use super::*;
9422        #[derive(Clone, Debug, PartialEq)]
9423        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9424    }
9425
9426    impl History {
9427        /// Gets the enum value.
9428        ///
9429        /// Returns `None` if the enum contains an unknown value deserialized from
9430        /// the string representation of enums.
9431        pub fn value(&self) -> std::option::Option<i32> {
9432            match self {
9433                Self::Unspecified => std::option::Option::Some(0),
9434                Self::OriginallySinglePattern => std::option::Option::Some(1),
9435                Self::FutureMultiPattern => std::option::Option::Some(2),
9436                Self::UnknownValue(u) => u.0.value(),
9437            }
9438        }
9439
9440        /// Gets the enum value as a string.
9441        ///
9442        /// Returns `None` if the enum contains an unknown value deserialized from
9443        /// the integer representation of enums.
9444        pub fn name(&self) -> std::option::Option<&str> {
9445            match self {
9446                Self::Unspecified => std::option::Option::Some("HISTORY_UNSPECIFIED"),
9447                Self::OriginallySinglePattern => {
9448                    std::option::Option::Some("ORIGINALLY_SINGLE_PATTERN")
9449                }
9450                Self::FutureMultiPattern => std::option::Option::Some("FUTURE_MULTI_PATTERN"),
9451                Self::UnknownValue(u) => u.0.name(),
9452            }
9453        }
9454    }
9455
9456    impl std::default::Default for History {
9457        fn default() -> Self {
9458            use std::convert::From;
9459            Self::from(0)
9460        }
9461    }
9462
9463    impl std::fmt::Display for History {
9464        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9465            wkt::internal::display_enum(f, self.name(), self.value())
9466        }
9467    }
9468
9469    impl std::convert::From<i32> for History {
9470        fn from(value: i32) -> Self {
9471            match value {
9472                0 => Self::Unspecified,
9473                1 => Self::OriginallySinglePattern,
9474                2 => Self::FutureMultiPattern,
9475                _ => Self::UnknownValue(history::UnknownValue(
9476                    wkt::internal::UnknownEnumValue::Integer(value),
9477                )),
9478            }
9479        }
9480    }
9481
9482    impl std::convert::From<&str> for History {
9483        fn from(value: &str) -> Self {
9484            use std::string::ToString;
9485            match value {
9486                "HISTORY_UNSPECIFIED" => Self::Unspecified,
9487                "ORIGINALLY_SINGLE_PATTERN" => Self::OriginallySinglePattern,
9488                "FUTURE_MULTI_PATTERN" => Self::FutureMultiPattern,
9489                _ => Self::UnknownValue(history::UnknownValue(
9490                    wkt::internal::UnknownEnumValue::String(value.to_string()),
9491                )),
9492            }
9493        }
9494    }
9495
9496    impl serde::ser::Serialize for History {
9497        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9498        where
9499            S: serde::Serializer,
9500        {
9501            match self {
9502                Self::Unspecified => serializer.serialize_i32(0),
9503                Self::OriginallySinglePattern => serializer.serialize_i32(1),
9504                Self::FutureMultiPattern => serializer.serialize_i32(2),
9505                Self::UnknownValue(u) => u.0.serialize(serializer),
9506            }
9507        }
9508    }
9509
9510    impl<'de> serde::de::Deserialize<'de> for History {
9511        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9512        where
9513            D: serde::Deserializer<'de>,
9514        {
9515            deserializer.deserialize_any(wkt::internal::EnumVisitor::<History>::new(
9516                ".google.api.ResourceDescriptor.History",
9517            ))
9518        }
9519    }
9520
9521    /// A flag representing a specific style that a resource claims to conform to.
9522    ///
9523    /// # Working with unknown values
9524    ///
9525    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9526    /// additional enum variants at any time. Adding new variants is not considered
9527    /// a breaking change. Applications should write their code in anticipation of:
9528    ///
9529    /// - New values appearing in future releases of the client library, **and**
9530    /// - New values received dynamically, without application changes.
9531    ///
9532    /// Please consult the [Working with enums] section in the user guide for some
9533    /// guidelines.
9534    ///
9535    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9536    #[derive(Clone, Debug, PartialEq)]
9537    #[non_exhaustive]
9538    pub enum Style {
9539        /// The unspecified value. Do not use.
9540        Unspecified,
9541        /// This resource is intended to be "declarative-friendly".
9542        ///
9543        /// Declarative-friendly resources must be more strictly consistent, and
9544        /// setting this to true communicates to tools that this resource should
9545        /// adhere to declarative-friendly expectations.
9546        ///
9547        /// Note: This is used by the API linter (linter.aip.dev) to enable
9548        /// additional checks.
9549        DeclarativeFriendly,
9550        /// If set, the enum was initialized with an unknown value.
9551        ///
9552        /// Applications can examine the value using [Style::value] or
9553        /// [Style::name].
9554        UnknownValue(style::UnknownValue),
9555    }
9556
9557    #[doc(hidden)]
9558    pub mod style {
9559        #[allow(unused_imports)]
9560        use super::*;
9561        #[derive(Clone, Debug, PartialEq)]
9562        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9563    }
9564
9565    impl Style {
9566        /// Gets the enum value.
9567        ///
9568        /// Returns `None` if the enum contains an unknown value deserialized from
9569        /// the string representation of enums.
9570        pub fn value(&self) -> std::option::Option<i32> {
9571            match self {
9572                Self::Unspecified => std::option::Option::Some(0),
9573                Self::DeclarativeFriendly => std::option::Option::Some(1),
9574                Self::UnknownValue(u) => u.0.value(),
9575            }
9576        }
9577
9578        /// Gets the enum value as a string.
9579        ///
9580        /// Returns `None` if the enum contains an unknown value deserialized from
9581        /// the integer representation of enums.
9582        pub fn name(&self) -> std::option::Option<&str> {
9583            match self {
9584                Self::Unspecified => std::option::Option::Some("STYLE_UNSPECIFIED"),
9585                Self::DeclarativeFriendly => std::option::Option::Some("DECLARATIVE_FRIENDLY"),
9586                Self::UnknownValue(u) => u.0.name(),
9587            }
9588        }
9589    }
9590
9591    impl std::default::Default for Style {
9592        fn default() -> Self {
9593            use std::convert::From;
9594            Self::from(0)
9595        }
9596    }
9597
9598    impl std::fmt::Display for Style {
9599        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9600            wkt::internal::display_enum(f, self.name(), self.value())
9601        }
9602    }
9603
9604    impl std::convert::From<i32> for Style {
9605        fn from(value: i32) -> Self {
9606            match value {
9607                0 => Self::Unspecified,
9608                1 => Self::DeclarativeFriendly,
9609                _ => Self::UnknownValue(style::UnknownValue(
9610                    wkt::internal::UnknownEnumValue::Integer(value),
9611                )),
9612            }
9613        }
9614    }
9615
9616    impl std::convert::From<&str> for Style {
9617        fn from(value: &str) -> Self {
9618            use std::string::ToString;
9619            match value {
9620                "STYLE_UNSPECIFIED" => Self::Unspecified,
9621                "DECLARATIVE_FRIENDLY" => Self::DeclarativeFriendly,
9622                _ => Self::UnknownValue(style::UnknownValue(
9623                    wkt::internal::UnknownEnumValue::String(value.to_string()),
9624                )),
9625            }
9626        }
9627    }
9628
9629    impl serde::ser::Serialize for Style {
9630        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9631        where
9632            S: serde::Serializer,
9633        {
9634            match self {
9635                Self::Unspecified => serializer.serialize_i32(0),
9636                Self::DeclarativeFriendly => serializer.serialize_i32(1),
9637                Self::UnknownValue(u) => u.0.serialize(serializer),
9638            }
9639        }
9640    }
9641
9642    impl<'de> serde::de::Deserialize<'de> for Style {
9643        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9644        where
9645            D: serde::Deserializer<'de>,
9646        {
9647            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Style>::new(
9648                ".google.api.ResourceDescriptor.Style",
9649            ))
9650        }
9651    }
9652}
9653
9654/// Defines a proto annotation that describes a string field that refers to
9655/// an API resource.
9656#[derive(Clone, Default, PartialEq)]
9657#[non_exhaustive]
9658pub struct ResourceReference {
9659    /// The resource type that the annotated field references.
9660    ///
9661    /// Example:
9662    ///
9663    /// ```norust
9664    /// message Subscription {
9665    ///   string topic = 2 [(google.api.resource_reference) = {
9666    ///     type: "pubsub.googleapis.com/Topic"
9667    ///   }];
9668    /// }
9669    /// ```
9670    ///
9671    /// Occasionally, a field may reference an arbitrary resource. In this case,
9672    /// APIs use the special value * in their resource reference.
9673    ///
9674    /// Example:
9675    ///
9676    /// ```norust
9677    /// message GetIamPolicyRequest {
9678    ///   string resource = 2 [(google.api.resource_reference) = {
9679    ///     type: "*"
9680    ///   }];
9681    /// }
9682    /// ```
9683    pub r#type: std::string::String,
9684
9685    /// The resource type of a child collection that the annotated field
9686    /// references. This is useful for annotating the `parent` field that
9687    /// doesn't have a fixed resource type.
9688    ///
9689    /// Example:
9690    ///
9691    /// ```norust
9692    /// message ListLogEntriesRequest {
9693    ///   string parent = 1 [(google.api.resource_reference) = {
9694    ///     child_type: "logging.googleapis.com/LogEntry"
9695    ///   };
9696    /// }
9697    /// ```
9698    pub child_type: std::string::String,
9699
9700    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9701}
9702
9703impl ResourceReference {
9704    pub fn new() -> Self {
9705        std::default::Default::default()
9706    }
9707
9708    /// Sets the value of [r#type][crate::model::ResourceReference::type].
9709    ///
9710    /// # Example
9711    /// ```ignore,no_run
9712    /// # use google_cloud_api::model::ResourceReference;
9713    /// let x = ResourceReference::new().set_type("example");
9714    /// ```
9715    pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9716        self.r#type = v.into();
9717        self
9718    }
9719
9720    /// Sets the value of [child_type][crate::model::ResourceReference::child_type].
9721    ///
9722    /// # Example
9723    /// ```ignore,no_run
9724    /// # use google_cloud_api::model::ResourceReference;
9725    /// let x = ResourceReference::new().set_child_type("example");
9726    /// ```
9727    pub fn set_child_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9728        self.child_type = v.into();
9729        self
9730    }
9731}
9732
9733impl wkt::message::Message for ResourceReference {
9734    fn typename() -> &'static str {
9735        "type.googleapis.com/google.api.ResourceReference"
9736    }
9737}
9738
9739/// Specifies the routing information that should be sent along with the request
9740/// in the form of routing header.
9741/// **NOTE:** All service configuration rules follow the "last one wins" order.
9742///
9743/// The examples below will apply to an RPC which has the following request type:
9744///
9745/// Message Definition:
9746///
9747/// ```norust
9748/// message Request {
9749///   // The name of the Table
9750///   // Values can be of the following formats:
9751///   // - `projects/<project>/tables/<table>`
9752///   // - `projects/<project>/instances/<instance>/tables/<table>`
9753///   // - `region/<region>/zones/<zone>/tables/<table>`
9754///   string table_name = 1;
9755///
9756///   // This value specifies routing for replication.
9757///   // It can be in the following formats:
9758///   // - `profiles/<profile_id>`
9759///   // - a legacy `profile_id` that can be any string
9760///   string app_profile_id = 2;
9761/// }
9762/// ```
9763///
9764/// Example message:
9765///
9766/// ```norust
9767/// {
9768///   table_name: projects/proj_foo/instances/instance_bar/table/table_baz,
9769///   app_profile_id: profiles/prof_qux
9770/// }
9771/// ```
9772///
9773/// The routing header consists of one or multiple key-value pairs. Every key
9774/// and value must be percent-encoded, and joined together in the format of
9775/// `key1=value1&key2=value2`.
9776/// The examples below skip the percent-encoding for readability.
9777///
9778/// Example 1
9779///
9780/// Extracting a field from the request to put into the routing header
9781/// unchanged, with the key equal to the field name.
9782///
9783/// annotation:
9784///
9785/// ```norust
9786/// option (google.api.routing) = {
9787///   // Take the `app_profile_id`.
9788///   routing_parameters {
9789///     field: "app_profile_id"
9790///   }
9791/// };
9792/// ```
9793///
9794/// result:
9795///
9796/// ```norust
9797/// x-goog-request-params: app_profile_id=profiles/prof_qux
9798/// ```
9799///
9800/// Example 2
9801///
9802/// Extracting a field from the request to put into the routing header
9803/// unchanged, with the key different from the field name.
9804///
9805/// annotation:
9806///
9807/// ```norust
9808/// option (google.api.routing) = {
9809///   // Take the `app_profile_id`, but name it `routing_id` in the header.
9810///   routing_parameters {
9811///     field: "app_profile_id"
9812///     path_template: "{routing_id=**}"
9813///   }
9814/// };
9815/// ```
9816///
9817/// result:
9818///
9819/// ```norust
9820/// x-goog-request-params: routing_id=profiles/prof_qux
9821/// ```
9822///
9823/// Example 3
9824///
9825/// Extracting a field from the request to put into the routing
9826/// header, while matching a path template syntax on the field's value.
9827///
9828/// NB: it is more useful to send nothing than to send garbage for the purpose
9829/// of dynamic routing, since garbage pollutes cache. Thus the matching.
9830///
9831/// Sub-example 3a
9832///
9833/// The field matches the template.
9834///
9835/// annotation:
9836///
9837/// ```norust
9838/// option (google.api.routing) = {
9839///   // Take the `table_name`, if it's well-formed (with project-based
9840///   // syntax).
9841///   routing_parameters {
9842///     field: "table_name"
9843///     path_template: "{table_name=projects/*/instances/*/**}"
9844///   }
9845/// };
9846/// ```
9847///
9848/// result:
9849///
9850/// ```norust
9851/// x-goog-request-params:
9852/// table_name=projects/proj_foo/instances/instance_bar/table/table_baz
9853/// ```
9854///
9855/// Sub-example 3b
9856///
9857/// The field does not match the template.
9858///
9859/// annotation:
9860///
9861/// ```norust
9862/// option (google.api.routing) = {
9863///   // Take the `table_name`, if it's well-formed (with region-based
9864///   // syntax).
9865///   routing_parameters {
9866///     field: "table_name"
9867///     path_template: "{table_name=regions/*/zones/*/**}"
9868///   }
9869/// };
9870/// ```
9871///
9872/// result:
9873///
9874/// ```norust
9875/// <no routing header will be sent>
9876/// ```
9877///
9878/// Sub-example 3c
9879///
9880/// Multiple alternative conflictingly named path templates are
9881/// specified. The one that matches is used to construct the header.
9882///
9883/// annotation:
9884///
9885/// ```norust
9886/// option (google.api.routing) = {
9887///   // Take the `table_name`, if it's well-formed, whether
9888///   // using the region- or projects-based syntax.
9889///
9890///   routing_parameters {
9891///     field: "table_name"
9892///     path_template: "{table_name=regions/*/zones/*/**}"
9893///   }
9894///   routing_parameters {
9895///     field: "table_name"
9896///     path_template: "{table_name=projects/*/instances/*/**}"
9897///   }
9898/// };
9899/// ```
9900///
9901/// result:
9902///
9903/// ```norust
9904/// x-goog-request-params:
9905/// table_name=projects/proj_foo/instances/instance_bar/table/table_baz
9906/// ```
9907///
9908/// Example 4
9909///
9910/// Extracting a single routing header key-value pair by matching a
9911/// template syntax on (a part of) a single request field.
9912///
9913/// annotation:
9914///
9915/// ```norust
9916/// option (google.api.routing) = {
9917///   // Take just the project id from the `table_name` field.
9918///   routing_parameters {
9919///     field: "table_name"
9920///     path_template: "{routing_id=projects/*}/**"
9921///   }
9922/// };
9923/// ```
9924///
9925/// result:
9926///
9927/// ```norust
9928/// x-goog-request-params: routing_id=projects/proj_foo
9929/// ```
9930///
9931/// Example 5
9932///
9933/// Extracting a single routing header key-value pair by matching
9934/// several conflictingly named path templates on (parts of) a single request
9935/// field. The last template to match "wins" the conflict.
9936///
9937/// annotation:
9938///
9939/// ```norust
9940/// option (google.api.routing) = {
9941///   // If the `table_name` does not have instances information,
9942///   // take just the project id for routing.
9943///   // Otherwise take project + instance.
9944///
9945///   routing_parameters {
9946///     field: "table_name"
9947///     path_template: "{routing_id=projects/*}/**"
9948///   }
9949///   routing_parameters {
9950///     field: "table_name"
9951///     path_template: "{routing_id=projects/*/instances/*}/**"
9952///   }
9953/// };
9954/// ```
9955///
9956/// result:
9957///
9958/// ```norust
9959/// x-goog-request-params:
9960/// routing_id=projects/proj_foo/instances/instance_bar
9961/// ```
9962///
9963/// Example 6
9964///
9965/// Extracting multiple routing header key-value pairs by matching
9966/// several non-conflicting path templates on (parts of) a single request field.
9967///
9968/// Sub-example 6a
9969///
9970/// Make the templates strict, so that if the `table_name` does not
9971/// have an instance information, nothing is sent.
9972///
9973/// annotation:
9974///
9975/// ```norust
9976/// option (google.api.routing) = {
9977///   // The routing code needs two keys instead of one composite
9978///   // but works only for the tables with the "project-instance" name
9979///   // syntax.
9980///
9981///   routing_parameters {
9982///     field: "table_name"
9983///     path_template: "{project_id=projects/*}/instances/*/**"
9984///   }
9985///   routing_parameters {
9986///     field: "table_name"
9987///     path_template: "projects/*/{instance_id=instances/*}/**"
9988///   }
9989/// };
9990/// ```
9991///
9992/// result:
9993///
9994/// ```norust
9995/// x-goog-request-params:
9996/// project_id=projects/proj_foo&instance_id=instances/instance_bar
9997/// ```
9998///
9999/// Sub-example 6b
10000///
10001/// Make the templates loose, so that if the `table_name` does not
10002/// have an instance information, just the project id part is sent.
10003///
10004/// annotation:
10005///
10006/// ```norust
10007/// option (google.api.routing) = {
10008///   // The routing code wants two keys instead of one composite
10009///   // but will work with just the `project_id` for tables without
10010///   // an instance in the `table_name`.
10011///
10012///   routing_parameters {
10013///     field: "table_name"
10014///     path_template: "{project_id=projects/*}/**"
10015///   }
10016///   routing_parameters {
10017///     field: "table_name"
10018///     path_template: "projects/*/{instance_id=instances/*}/**"
10019///   }
10020/// };
10021/// ```
10022///
10023/// result (is the same as 6a for our example message because it has the instance
10024/// information):
10025///
10026/// ```norust
10027/// x-goog-request-params:
10028/// project_id=projects/proj_foo&instance_id=instances/instance_bar
10029/// ```
10030///
10031/// Example 7
10032///
10033/// Extracting multiple routing header key-value pairs by matching
10034/// several path templates on multiple request fields.
10035///
10036/// NB: note that here there is no way to specify sending nothing if one of the
10037/// fields does not match its template. E.g. if the `table_name` is in the wrong
10038/// format, the `project_id` will not be sent, but the `routing_id` will be.
10039/// The backend routing code has to be aware of that and be prepared to not
10040/// receive a full complement of keys if it expects multiple.
10041///
10042/// annotation:
10043///
10044/// ```norust
10045/// option (google.api.routing) = {
10046///   // The routing needs both `project_id` and `routing_id`
10047///   // (from the `app_profile_id` field) for routing.
10048///
10049///   routing_parameters {
10050///     field: "table_name"
10051///     path_template: "{project_id=projects/*}/**"
10052///   }
10053///   routing_parameters {
10054///     field: "app_profile_id"
10055///     path_template: "{routing_id=**}"
10056///   }
10057/// };
10058/// ```
10059///
10060/// result:
10061///
10062/// ```norust
10063/// x-goog-request-params:
10064/// project_id=projects/proj_foo&routing_id=profiles/prof_qux
10065/// ```
10066///
10067/// Example 8
10068///
10069/// Extracting a single routing header key-value pair by matching
10070/// several conflictingly named path templates on several request fields. The
10071/// last template to match "wins" the conflict.
10072///
10073/// annotation:
10074///
10075/// ```norust
10076/// option (google.api.routing) = {
10077///   // The `routing_id` can be a project id or a region id depending on
10078///   // the table name format, but only if the `app_profile_id` is not set.
10079///   // If `app_profile_id` is set it should be used instead.
10080///
10081///   routing_parameters {
10082///     field: "table_name"
10083///     path_template: "{routing_id=projects/*}/**"
10084///   }
10085///   routing_parameters {
10086///      field: "table_name"
10087///      path_template: "{routing_id=regions/*}/**"
10088///   }
10089///   routing_parameters {
10090///     field: "app_profile_id"
10091///     path_template: "{routing_id=**}"
10092///   }
10093/// };
10094/// ```
10095///
10096/// result:
10097///
10098/// ```norust
10099/// x-goog-request-params: routing_id=profiles/prof_qux
10100/// ```
10101///
10102/// Example 9
10103///
10104/// Bringing it all together.
10105///
10106/// annotation:
10107///
10108/// ```norust
10109/// option (google.api.routing) = {
10110///   // For routing both `table_location` and a `routing_id` are needed.
10111///   //
10112///   // table_location can be either an instance id or a region+zone id.
10113///   //
10114///   // For `routing_id`, take the value of `app_profile_id`
10115///   // - If it's in the format `profiles/<profile_id>`, send
10116///   // just the `<profile_id>` part.
10117///   // - If it's any other literal, send it as is.
10118///   // If the `app_profile_id` is empty, and the `table_name` starts with
10119///   // the project_id, send that instead.
10120///
10121///   routing_parameters {
10122///     field: "table_name"
10123///     path_template: "projects/*/{table_location=instances/*}/tables/*"
10124///   }
10125///   routing_parameters {
10126///     field: "table_name"
10127///     path_template: "{table_location=regions/*/zones/*}/tables/*"
10128///   }
10129///   routing_parameters {
10130///     field: "table_name"
10131///     path_template: "{routing_id=projects/*}/**"
10132///   }
10133///   routing_parameters {
10134///     field: "app_profile_id"
10135///     path_template: "{routing_id=**}"
10136///   }
10137///   routing_parameters {
10138///     field: "app_profile_id"
10139///     path_template: "profiles/{routing_id=*}"
10140///   }
10141/// };
10142/// ```
10143///
10144/// result:
10145///
10146/// ```norust
10147/// x-goog-request-params:
10148/// table_location=instances/instance_bar&routing_id=prof_qux
10149/// ```
10150#[derive(Clone, Default, PartialEq)]
10151#[non_exhaustive]
10152pub struct RoutingRule {
10153    /// A collection of Routing Parameter specifications.
10154    /// **NOTE:** If multiple Routing Parameters describe the same key
10155    /// (via the `path_template` field or via the `field` field when
10156    /// `path_template` is not provided), "last one wins" rule
10157    /// determines which Parameter gets used.
10158    /// See the examples for more details.
10159    pub routing_parameters: std::vec::Vec<crate::model::RoutingParameter>,
10160
10161    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10162}
10163
10164impl RoutingRule {
10165    pub fn new() -> Self {
10166        std::default::Default::default()
10167    }
10168
10169    /// Sets the value of [routing_parameters][crate::model::RoutingRule::routing_parameters].
10170    ///
10171    /// # Example
10172    /// ```ignore,no_run
10173    /// # use google_cloud_api::model::RoutingRule;
10174    /// use google_cloud_api::model::RoutingParameter;
10175    /// let x = RoutingRule::new()
10176    ///     .set_routing_parameters([
10177    ///         RoutingParameter::default()/* use setters */,
10178    ///         RoutingParameter::default()/* use (different) setters */,
10179    ///     ]);
10180    /// ```
10181    pub fn set_routing_parameters<T, V>(mut self, v: T) -> Self
10182    where
10183        T: std::iter::IntoIterator<Item = V>,
10184        V: std::convert::Into<crate::model::RoutingParameter>,
10185    {
10186        use std::iter::Iterator;
10187        self.routing_parameters = v.into_iter().map(|i| i.into()).collect();
10188        self
10189    }
10190}
10191
10192impl wkt::message::Message for RoutingRule {
10193    fn typename() -> &'static str {
10194        "type.googleapis.com/google.api.RoutingRule"
10195    }
10196}
10197
10198/// A projection from an input message to the GRPC or REST header.
10199#[derive(Clone, Default, PartialEq)]
10200#[non_exhaustive]
10201pub struct RoutingParameter {
10202    /// A request field to extract the header key-value pair from.
10203    pub field: std::string::String,
10204
10205    /// A pattern matching the key-value field. Optional.
10206    /// If not specified, the whole field specified in the `field` field will be
10207    /// taken as value, and its name used as key. If specified, it MUST contain
10208    /// exactly one named segment (along with any number of unnamed segments) The
10209    /// pattern will be matched over the field specified in the `field` field, then
10210    /// if the match is successful:
10211    ///
10212    /// - the name of the single named segment will be used as a header name,
10213    /// - the match value of the segment will be used as a header value;
10214    ///   if the match is NOT successful, nothing will be sent.
10215    ///
10216    /// Example:
10217    ///
10218    /// ```norust
10219    ///           -- This is a field in the request message
10220    ///          |   that the header value will be extracted from.
10221    ///          |
10222    ///          |                     -- This is the key name in the
10223    ///          |                    |   routing header.
10224    ///          V                    |
10225    /// field: "table_name"           v
10226    /// path_template: "projects/*/{table_location=instances/*}/tables/*"
10227    ///                                            ^            ^
10228    ///                                            |            |
10229    ///   In the {} brackets is the pattern that --             |
10230    ///   specifies what to extract from the                    |
10231    ///   field as a value to be sent.                          |
10232    ///                                                         |
10233    ///  The string in the field must match the whole pattern --
10234    ///  before brackets, inside brackets, after brackets.
10235    /// ```
10236    ///
10237    /// When looking at this specific example, we can see that:
10238    ///
10239    /// - A key-value pair with the key `table_location`
10240    ///   and the value matching `instances/*` should be added
10241    ///   to the x-goog-request-params routing header.
10242    /// - The value is extracted from the request message's `table_name` field
10243    ///   if it matches the full pattern specified:
10244    ///   `projects/*/instances/*/tables/*`.
10245    ///
10246    /// **NB:** If the `path_template` field is not provided, the key name is
10247    /// equal to the field name, and the whole field should be sent as a value.
10248    /// This makes the pattern for the field and the value functionally equivalent
10249    /// to `**`, and the configuration
10250    ///
10251    /// ```norust
10252    /// {
10253    ///   field: "table_name"
10254    /// }
10255    /// ```
10256    ///
10257    /// is a functionally equivalent shorthand to:
10258    ///
10259    /// ```norust
10260    /// {
10261    ///   field: "table_name"
10262    ///   path_template: "{table_name=**}"
10263    /// }
10264    /// ```
10265    ///
10266    /// See Example 1 for more details.
10267    pub path_template: std::string::String,
10268
10269    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10270}
10271
10272impl RoutingParameter {
10273    pub fn new() -> Self {
10274        std::default::Default::default()
10275    }
10276
10277    /// Sets the value of [field][crate::model::RoutingParameter::field].
10278    ///
10279    /// # Example
10280    /// ```ignore,no_run
10281    /// # use google_cloud_api::model::RoutingParameter;
10282    /// let x = RoutingParameter::new().set_field("example");
10283    /// ```
10284    pub fn set_field<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10285        self.field = v.into();
10286        self
10287    }
10288
10289    /// Sets the value of [path_template][crate::model::RoutingParameter::path_template].
10290    ///
10291    /// # Example
10292    /// ```ignore,no_run
10293    /// # use google_cloud_api::model::RoutingParameter;
10294    /// let x = RoutingParameter::new().set_path_template("example");
10295    /// ```
10296    pub fn set_path_template<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10297        self.path_template = v.into();
10298        self
10299    }
10300}
10301
10302impl wkt::message::Message for RoutingParameter {
10303    fn typename() -> &'static str {
10304        "type.googleapis.com/google.api.RoutingParameter"
10305    }
10306}
10307
10308/// `Service` is the root object of Google API service configuration (service
10309/// config). It describes the basic information about a logical service,
10310/// such as the service name and the user-facing title, and delegates other
10311/// aspects to sub-sections. Each sub-section is either a proto message or a
10312/// repeated proto message that configures a specific aspect, such as auth.
10313/// For more information, see each proto message definition.
10314///
10315/// Example:
10316///
10317/// ```norust
10318/// type: google.api.Service
10319/// name: calendar.googleapis.com
10320/// title: Google Calendar API
10321/// apis:
10322/// - name: google.calendar.v3.Calendar
10323///
10324/// visibility:
10325///   rules:
10326///   - selector: "google.calendar.v3.*"
10327///     restriction: PREVIEW
10328/// backend:
10329///   rules:
10330///   - selector: "google.calendar.v3.*"
10331///     address: calendar.example.com
10332///
10333/// authentication:
10334///   providers:
10335///   - id: google_calendar_auth
10336///     jwks_uri: https://www.googleapis.com/oauth2/v1/certs
10337///     issuer: https://securetoken.google.com
10338///   rules:
10339///   - selector: "*"
10340///     requirements:
10341///       provider_id: google_calendar_auth
10342/// ```
10343#[derive(Clone, Default, PartialEq)]
10344#[non_exhaustive]
10345pub struct Service {
10346    /// The service name, which is a DNS-like logical identifier for the
10347    /// service, such as `calendar.googleapis.com`. The service name
10348    /// typically goes through DNS verification to make sure the owner
10349    /// of the service also owns the DNS name.
10350    pub name: std::string::String,
10351
10352    /// The product title for this service, it is the name displayed in Google
10353    /// Cloud Console.
10354    pub title: std::string::String,
10355
10356    /// The Google project that owns this service.
10357    pub producer_project_id: std::string::String,
10358
10359    /// A unique ID for a specific instance of this message, typically assigned
10360    /// by the client for tracking purpose. Must be no longer than 63 characters
10361    /// and only lower case letters, digits, '.', '_' and '-' are allowed. If
10362    /// empty, the server may choose to generate one instead.
10363    pub id: std::string::String,
10364
10365    /// A list of API interfaces exported by this service. Only the `name` field
10366    /// of the [google.protobuf.Api][google.protobuf.Api] needs to be provided by
10367    /// the configuration author, as the remaining fields will be derived from the
10368    /// IDL during the normalization process. It is an error to specify an API
10369    /// interface here which cannot be resolved against the associated IDL files.
10370    ///
10371    /// [google.protobuf.Api]: wkt::Api
10372    pub apis: std::vec::Vec<wkt::Api>,
10373
10374    /// A list of all proto message types included in this API service.
10375    /// Types referenced directly or indirectly by the `apis` are automatically
10376    /// included.  Messages which are not referenced but shall be included, such as
10377    /// types used by the `google.protobuf.Any` type, should be listed here by
10378    /// name by the configuration author. Example:
10379    ///
10380    /// ```norust
10381    /// types:
10382    /// - name: google.protobuf.Int32
10383    /// ```
10384    pub types: std::vec::Vec<wkt::Type>,
10385
10386    /// A list of all enum types included in this API service.  Enums referenced
10387    /// directly or indirectly by the `apis` are automatically included.  Enums
10388    /// which are not referenced but shall be included should be listed here by
10389    /// name by the configuration author. Example:
10390    ///
10391    /// ```norust
10392    /// enums:
10393    /// - name: google.someapi.v1.SomeEnum
10394    /// ```
10395    pub enums: std::vec::Vec<wkt::Enum>,
10396
10397    /// Additional API documentation.
10398    pub documentation: std::option::Option<crate::model::Documentation>,
10399
10400    /// API backend configuration.
10401    pub backend: std::option::Option<crate::model::Backend>,
10402
10403    /// HTTP configuration.
10404    pub http: std::option::Option<crate::model::Http>,
10405
10406    /// Quota configuration.
10407    pub quota: std::option::Option<crate::model::Quota>,
10408
10409    /// Auth configuration.
10410    pub authentication: std::option::Option<crate::model::Authentication>,
10411
10412    /// Context configuration.
10413    pub context: std::option::Option<crate::model::Context>,
10414
10415    /// Configuration controlling usage of this service.
10416    pub usage: std::option::Option<crate::model::Usage>,
10417
10418    /// Configuration for network endpoints.  If this is empty, then an endpoint
10419    /// with the same name as the service is automatically generated to service all
10420    /// defined APIs.
10421    pub endpoints: std::vec::Vec<crate::model::Endpoint>,
10422
10423    /// Configuration for the service control plane.
10424    pub control: std::option::Option<crate::model::Control>,
10425
10426    /// Defines the logs used by this service.
10427    pub logs: std::vec::Vec<crate::model::LogDescriptor>,
10428
10429    /// Defines the metrics used by this service.
10430    pub metrics: std::vec::Vec<crate::model::MetricDescriptor>,
10431
10432    /// Defines the monitored resources used by this service. This is required
10433    /// by the [Service.monitoring][google.api.Service.monitoring] and
10434    /// [Service.logging][google.api.Service.logging] configurations.
10435    ///
10436    /// [google.api.Service.logging]: crate::model::Service::logging
10437    /// [google.api.Service.monitoring]: crate::model::Service::monitoring
10438    pub monitored_resources: std::vec::Vec<crate::model::MonitoredResourceDescriptor>,
10439
10440    /// Billing configuration.
10441    pub billing: std::option::Option<crate::model::Billing>,
10442
10443    /// Logging configuration.
10444    pub logging: std::option::Option<crate::model::Logging>,
10445
10446    /// Monitoring configuration.
10447    pub monitoring: std::option::Option<crate::model::Monitoring>,
10448
10449    /// System parameter configuration.
10450    pub system_parameters: std::option::Option<crate::model::SystemParameters>,
10451
10452    /// Output only. The source information for this configuration if available.
10453    pub source_info: std::option::Option<crate::model::SourceInfo>,
10454
10455    /// Settings for [Google Cloud Client
10456    /// libraries](https://cloud.google.com/apis/docs/cloud-client-libraries)
10457    /// generated from APIs defined as protocol buffers.
10458    pub publishing: std::option::Option<crate::model::Publishing>,
10459
10460    /// Obsolete. Do not use.
10461    ///
10462    /// This field has no semantic meaning. The service config compiler always
10463    /// sets this field to `3`.
10464    pub config_version: std::option::Option<wkt::UInt32Value>,
10465
10466    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10467}
10468
10469impl Service {
10470    pub fn new() -> Self {
10471        std::default::Default::default()
10472    }
10473
10474    /// Sets the value of [name][crate::model::Service::name].
10475    ///
10476    /// # Example
10477    /// ```ignore,no_run
10478    /// # use google_cloud_api::model::Service;
10479    /// let x = Service::new().set_name("example");
10480    /// ```
10481    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10482        self.name = v.into();
10483        self
10484    }
10485
10486    /// Sets the value of [title][crate::model::Service::title].
10487    ///
10488    /// # Example
10489    /// ```ignore,no_run
10490    /// # use google_cloud_api::model::Service;
10491    /// let x = Service::new().set_title("example");
10492    /// ```
10493    pub fn set_title<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10494        self.title = v.into();
10495        self
10496    }
10497
10498    /// Sets the value of [producer_project_id][crate::model::Service::producer_project_id].
10499    ///
10500    /// # Example
10501    /// ```ignore,no_run
10502    /// # use google_cloud_api::model::Service;
10503    /// let x = Service::new().set_producer_project_id("example");
10504    /// ```
10505    pub fn set_producer_project_id<T: std::convert::Into<std::string::String>>(
10506        mut self,
10507        v: T,
10508    ) -> Self {
10509        self.producer_project_id = v.into();
10510        self
10511    }
10512
10513    /// Sets the value of [id][crate::model::Service::id].
10514    ///
10515    /// # Example
10516    /// ```ignore,no_run
10517    /// # use google_cloud_api::model::Service;
10518    /// let x = Service::new().set_id("example");
10519    /// ```
10520    pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10521        self.id = v.into();
10522        self
10523    }
10524
10525    /// Sets the value of [apis][crate::model::Service::apis].
10526    ///
10527    /// # Example
10528    /// ```ignore,no_run
10529    /// # use google_cloud_api::model::Service;
10530    /// use wkt::Api;
10531    /// let x = Service::new()
10532    ///     .set_apis([
10533    ///         Api::default()/* use setters */,
10534    ///         Api::default()/* use (different) setters */,
10535    ///     ]);
10536    /// ```
10537    pub fn set_apis<T, V>(mut self, v: T) -> Self
10538    where
10539        T: std::iter::IntoIterator<Item = V>,
10540        V: std::convert::Into<wkt::Api>,
10541    {
10542        use std::iter::Iterator;
10543        self.apis = v.into_iter().map(|i| i.into()).collect();
10544        self
10545    }
10546
10547    /// Sets the value of [types][crate::model::Service::types].
10548    ///
10549    /// # Example
10550    /// ```ignore,no_run
10551    /// # use google_cloud_api::model::Service;
10552    /// use wkt::Type;
10553    /// let x = Service::new()
10554    ///     .set_types([
10555    ///         Type::default()/* use setters */,
10556    ///         Type::default()/* use (different) setters */,
10557    ///     ]);
10558    /// ```
10559    pub fn set_types<T, V>(mut self, v: T) -> Self
10560    where
10561        T: std::iter::IntoIterator<Item = V>,
10562        V: std::convert::Into<wkt::Type>,
10563    {
10564        use std::iter::Iterator;
10565        self.types = v.into_iter().map(|i| i.into()).collect();
10566        self
10567    }
10568
10569    /// Sets the value of [enums][crate::model::Service::enums].
10570    ///
10571    /// # Example
10572    /// ```ignore,no_run
10573    /// # use google_cloud_api::model::Service;
10574    /// use wkt::Enum;
10575    /// let x = Service::new()
10576    ///     .set_enums([
10577    ///         Enum::default()/* use setters */,
10578    ///         Enum::default()/* use (different) setters */,
10579    ///     ]);
10580    /// ```
10581    pub fn set_enums<T, V>(mut self, v: T) -> Self
10582    where
10583        T: std::iter::IntoIterator<Item = V>,
10584        V: std::convert::Into<wkt::Enum>,
10585    {
10586        use std::iter::Iterator;
10587        self.enums = v.into_iter().map(|i| i.into()).collect();
10588        self
10589    }
10590
10591    /// Sets the value of [documentation][crate::model::Service::documentation].
10592    ///
10593    /// # Example
10594    /// ```ignore,no_run
10595    /// # use google_cloud_api::model::Service;
10596    /// use google_cloud_api::model::Documentation;
10597    /// let x = Service::new().set_documentation(Documentation::default()/* use setters */);
10598    /// ```
10599    pub fn set_documentation<T>(mut self, v: T) -> Self
10600    where
10601        T: std::convert::Into<crate::model::Documentation>,
10602    {
10603        self.documentation = std::option::Option::Some(v.into());
10604        self
10605    }
10606
10607    /// Sets or clears the value of [documentation][crate::model::Service::documentation].
10608    ///
10609    /// # Example
10610    /// ```ignore,no_run
10611    /// # use google_cloud_api::model::Service;
10612    /// use google_cloud_api::model::Documentation;
10613    /// let x = Service::new().set_or_clear_documentation(Some(Documentation::default()/* use setters */));
10614    /// let x = Service::new().set_or_clear_documentation(None::<Documentation>);
10615    /// ```
10616    pub fn set_or_clear_documentation<T>(mut self, v: std::option::Option<T>) -> Self
10617    where
10618        T: std::convert::Into<crate::model::Documentation>,
10619    {
10620        self.documentation = v.map(|x| x.into());
10621        self
10622    }
10623
10624    /// Sets the value of [backend][crate::model::Service::backend].
10625    ///
10626    /// # Example
10627    /// ```ignore,no_run
10628    /// # use google_cloud_api::model::Service;
10629    /// use google_cloud_api::model::Backend;
10630    /// let x = Service::new().set_backend(Backend::default()/* use setters */);
10631    /// ```
10632    pub fn set_backend<T>(mut self, v: T) -> Self
10633    where
10634        T: std::convert::Into<crate::model::Backend>,
10635    {
10636        self.backend = std::option::Option::Some(v.into());
10637        self
10638    }
10639
10640    /// Sets or clears the value of [backend][crate::model::Service::backend].
10641    ///
10642    /// # Example
10643    /// ```ignore,no_run
10644    /// # use google_cloud_api::model::Service;
10645    /// use google_cloud_api::model::Backend;
10646    /// let x = Service::new().set_or_clear_backend(Some(Backend::default()/* use setters */));
10647    /// let x = Service::new().set_or_clear_backend(None::<Backend>);
10648    /// ```
10649    pub fn set_or_clear_backend<T>(mut self, v: std::option::Option<T>) -> Self
10650    where
10651        T: std::convert::Into<crate::model::Backend>,
10652    {
10653        self.backend = v.map(|x| x.into());
10654        self
10655    }
10656
10657    /// Sets the value of [http][crate::model::Service::http].
10658    ///
10659    /// # Example
10660    /// ```ignore,no_run
10661    /// # use google_cloud_api::model::Service;
10662    /// use google_cloud_api::model::Http;
10663    /// let x = Service::new().set_http(Http::default()/* use setters */);
10664    /// ```
10665    pub fn set_http<T>(mut self, v: T) -> Self
10666    where
10667        T: std::convert::Into<crate::model::Http>,
10668    {
10669        self.http = std::option::Option::Some(v.into());
10670        self
10671    }
10672
10673    /// Sets or clears the value of [http][crate::model::Service::http].
10674    ///
10675    /// # Example
10676    /// ```ignore,no_run
10677    /// # use google_cloud_api::model::Service;
10678    /// use google_cloud_api::model::Http;
10679    /// let x = Service::new().set_or_clear_http(Some(Http::default()/* use setters */));
10680    /// let x = Service::new().set_or_clear_http(None::<Http>);
10681    /// ```
10682    pub fn set_or_clear_http<T>(mut self, v: std::option::Option<T>) -> Self
10683    where
10684        T: std::convert::Into<crate::model::Http>,
10685    {
10686        self.http = v.map(|x| x.into());
10687        self
10688    }
10689
10690    /// Sets the value of [quota][crate::model::Service::quota].
10691    ///
10692    /// # Example
10693    /// ```ignore,no_run
10694    /// # use google_cloud_api::model::Service;
10695    /// use google_cloud_api::model::Quota;
10696    /// let x = Service::new().set_quota(Quota::default()/* use setters */);
10697    /// ```
10698    pub fn set_quota<T>(mut self, v: T) -> Self
10699    where
10700        T: std::convert::Into<crate::model::Quota>,
10701    {
10702        self.quota = std::option::Option::Some(v.into());
10703        self
10704    }
10705
10706    /// Sets or clears the value of [quota][crate::model::Service::quota].
10707    ///
10708    /// # Example
10709    /// ```ignore,no_run
10710    /// # use google_cloud_api::model::Service;
10711    /// use google_cloud_api::model::Quota;
10712    /// let x = Service::new().set_or_clear_quota(Some(Quota::default()/* use setters */));
10713    /// let x = Service::new().set_or_clear_quota(None::<Quota>);
10714    /// ```
10715    pub fn set_or_clear_quota<T>(mut self, v: std::option::Option<T>) -> Self
10716    where
10717        T: std::convert::Into<crate::model::Quota>,
10718    {
10719        self.quota = v.map(|x| x.into());
10720        self
10721    }
10722
10723    /// Sets the value of [authentication][crate::model::Service::authentication].
10724    ///
10725    /// # Example
10726    /// ```ignore,no_run
10727    /// # use google_cloud_api::model::Service;
10728    /// use google_cloud_api::model::Authentication;
10729    /// let x = Service::new().set_authentication(Authentication::default()/* use setters */);
10730    /// ```
10731    pub fn set_authentication<T>(mut self, v: T) -> Self
10732    where
10733        T: std::convert::Into<crate::model::Authentication>,
10734    {
10735        self.authentication = std::option::Option::Some(v.into());
10736        self
10737    }
10738
10739    /// Sets or clears the value of [authentication][crate::model::Service::authentication].
10740    ///
10741    /// # Example
10742    /// ```ignore,no_run
10743    /// # use google_cloud_api::model::Service;
10744    /// use google_cloud_api::model::Authentication;
10745    /// let x = Service::new().set_or_clear_authentication(Some(Authentication::default()/* use setters */));
10746    /// let x = Service::new().set_or_clear_authentication(None::<Authentication>);
10747    /// ```
10748    pub fn set_or_clear_authentication<T>(mut self, v: std::option::Option<T>) -> Self
10749    where
10750        T: std::convert::Into<crate::model::Authentication>,
10751    {
10752        self.authentication = v.map(|x| x.into());
10753        self
10754    }
10755
10756    /// Sets the value of [context][crate::model::Service::context].
10757    ///
10758    /// # Example
10759    /// ```ignore,no_run
10760    /// # use google_cloud_api::model::Service;
10761    /// use google_cloud_api::model::Context;
10762    /// let x = Service::new().set_context(Context::default()/* use setters */);
10763    /// ```
10764    pub fn set_context<T>(mut self, v: T) -> Self
10765    where
10766        T: std::convert::Into<crate::model::Context>,
10767    {
10768        self.context = std::option::Option::Some(v.into());
10769        self
10770    }
10771
10772    /// Sets or clears the value of [context][crate::model::Service::context].
10773    ///
10774    /// # Example
10775    /// ```ignore,no_run
10776    /// # use google_cloud_api::model::Service;
10777    /// use google_cloud_api::model::Context;
10778    /// let x = Service::new().set_or_clear_context(Some(Context::default()/* use setters */));
10779    /// let x = Service::new().set_or_clear_context(None::<Context>);
10780    /// ```
10781    pub fn set_or_clear_context<T>(mut self, v: std::option::Option<T>) -> Self
10782    where
10783        T: std::convert::Into<crate::model::Context>,
10784    {
10785        self.context = v.map(|x| x.into());
10786        self
10787    }
10788
10789    /// Sets the value of [usage][crate::model::Service::usage].
10790    ///
10791    /// # Example
10792    /// ```ignore,no_run
10793    /// # use google_cloud_api::model::Service;
10794    /// use google_cloud_api::model::Usage;
10795    /// let x = Service::new().set_usage(Usage::default()/* use setters */);
10796    /// ```
10797    pub fn set_usage<T>(mut self, v: T) -> Self
10798    where
10799        T: std::convert::Into<crate::model::Usage>,
10800    {
10801        self.usage = std::option::Option::Some(v.into());
10802        self
10803    }
10804
10805    /// Sets or clears the value of [usage][crate::model::Service::usage].
10806    ///
10807    /// # Example
10808    /// ```ignore,no_run
10809    /// # use google_cloud_api::model::Service;
10810    /// use google_cloud_api::model::Usage;
10811    /// let x = Service::new().set_or_clear_usage(Some(Usage::default()/* use setters */));
10812    /// let x = Service::new().set_or_clear_usage(None::<Usage>);
10813    /// ```
10814    pub fn set_or_clear_usage<T>(mut self, v: std::option::Option<T>) -> Self
10815    where
10816        T: std::convert::Into<crate::model::Usage>,
10817    {
10818        self.usage = v.map(|x| x.into());
10819        self
10820    }
10821
10822    /// Sets the value of [endpoints][crate::model::Service::endpoints].
10823    ///
10824    /// # Example
10825    /// ```ignore,no_run
10826    /// # use google_cloud_api::model::Service;
10827    /// use google_cloud_api::model::Endpoint;
10828    /// let x = Service::new()
10829    ///     .set_endpoints([
10830    ///         Endpoint::default()/* use setters */,
10831    ///         Endpoint::default()/* use (different) setters */,
10832    ///     ]);
10833    /// ```
10834    pub fn set_endpoints<T, V>(mut self, v: T) -> Self
10835    where
10836        T: std::iter::IntoIterator<Item = V>,
10837        V: std::convert::Into<crate::model::Endpoint>,
10838    {
10839        use std::iter::Iterator;
10840        self.endpoints = v.into_iter().map(|i| i.into()).collect();
10841        self
10842    }
10843
10844    /// Sets the value of [control][crate::model::Service::control].
10845    ///
10846    /// # Example
10847    /// ```ignore,no_run
10848    /// # use google_cloud_api::model::Service;
10849    /// use google_cloud_api::model::Control;
10850    /// let x = Service::new().set_control(Control::default()/* use setters */);
10851    /// ```
10852    pub fn set_control<T>(mut self, v: T) -> Self
10853    where
10854        T: std::convert::Into<crate::model::Control>,
10855    {
10856        self.control = std::option::Option::Some(v.into());
10857        self
10858    }
10859
10860    /// Sets or clears the value of [control][crate::model::Service::control].
10861    ///
10862    /// # Example
10863    /// ```ignore,no_run
10864    /// # use google_cloud_api::model::Service;
10865    /// use google_cloud_api::model::Control;
10866    /// let x = Service::new().set_or_clear_control(Some(Control::default()/* use setters */));
10867    /// let x = Service::new().set_or_clear_control(None::<Control>);
10868    /// ```
10869    pub fn set_or_clear_control<T>(mut self, v: std::option::Option<T>) -> Self
10870    where
10871        T: std::convert::Into<crate::model::Control>,
10872    {
10873        self.control = v.map(|x| x.into());
10874        self
10875    }
10876
10877    /// Sets the value of [logs][crate::model::Service::logs].
10878    ///
10879    /// # Example
10880    /// ```ignore,no_run
10881    /// # use google_cloud_api::model::Service;
10882    /// use google_cloud_api::model::LogDescriptor;
10883    /// let x = Service::new()
10884    ///     .set_logs([
10885    ///         LogDescriptor::default()/* use setters */,
10886    ///         LogDescriptor::default()/* use (different) setters */,
10887    ///     ]);
10888    /// ```
10889    pub fn set_logs<T, V>(mut self, v: T) -> Self
10890    where
10891        T: std::iter::IntoIterator<Item = V>,
10892        V: std::convert::Into<crate::model::LogDescriptor>,
10893    {
10894        use std::iter::Iterator;
10895        self.logs = v.into_iter().map(|i| i.into()).collect();
10896        self
10897    }
10898
10899    /// Sets the value of [metrics][crate::model::Service::metrics].
10900    ///
10901    /// # Example
10902    /// ```ignore,no_run
10903    /// # use google_cloud_api::model::Service;
10904    /// use google_cloud_api::model::MetricDescriptor;
10905    /// let x = Service::new()
10906    ///     .set_metrics([
10907    ///         MetricDescriptor::default()/* use setters */,
10908    ///         MetricDescriptor::default()/* use (different) setters */,
10909    ///     ]);
10910    /// ```
10911    pub fn set_metrics<T, V>(mut self, v: T) -> Self
10912    where
10913        T: std::iter::IntoIterator<Item = V>,
10914        V: std::convert::Into<crate::model::MetricDescriptor>,
10915    {
10916        use std::iter::Iterator;
10917        self.metrics = v.into_iter().map(|i| i.into()).collect();
10918        self
10919    }
10920
10921    /// Sets the value of [monitored_resources][crate::model::Service::monitored_resources].
10922    ///
10923    /// # Example
10924    /// ```ignore,no_run
10925    /// # use google_cloud_api::model::Service;
10926    /// use google_cloud_api::model::MonitoredResourceDescriptor;
10927    /// let x = Service::new()
10928    ///     .set_monitored_resources([
10929    ///         MonitoredResourceDescriptor::default()/* use setters */,
10930    ///         MonitoredResourceDescriptor::default()/* use (different) setters */,
10931    ///     ]);
10932    /// ```
10933    pub fn set_monitored_resources<T, V>(mut self, v: T) -> Self
10934    where
10935        T: std::iter::IntoIterator<Item = V>,
10936        V: std::convert::Into<crate::model::MonitoredResourceDescriptor>,
10937    {
10938        use std::iter::Iterator;
10939        self.monitored_resources = v.into_iter().map(|i| i.into()).collect();
10940        self
10941    }
10942
10943    /// Sets the value of [billing][crate::model::Service::billing].
10944    ///
10945    /// # Example
10946    /// ```ignore,no_run
10947    /// # use google_cloud_api::model::Service;
10948    /// use google_cloud_api::model::Billing;
10949    /// let x = Service::new().set_billing(Billing::default()/* use setters */);
10950    /// ```
10951    pub fn set_billing<T>(mut self, v: T) -> Self
10952    where
10953        T: std::convert::Into<crate::model::Billing>,
10954    {
10955        self.billing = std::option::Option::Some(v.into());
10956        self
10957    }
10958
10959    /// Sets or clears the value of [billing][crate::model::Service::billing].
10960    ///
10961    /// # Example
10962    /// ```ignore,no_run
10963    /// # use google_cloud_api::model::Service;
10964    /// use google_cloud_api::model::Billing;
10965    /// let x = Service::new().set_or_clear_billing(Some(Billing::default()/* use setters */));
10966    /// let x = Service::new().set_or_clear_billing(None::<Billing>);
10967    /// ```
10968    pub fn set_or_clear_billing<T>(mut self, v: std::option::Option<T>) -> Self
10969    where
10970        T: std::convert::Into<crate::model::Billing>,
10971    {
10972        self.billing = v.map(|x| x.into());
10973        self
10974    }
10975
10976    /// Sets the value of [logging][crate::model::Service::logging].
10977    ///
10978    /// # Example
10979    /// ```ignore,no_run
10980    /// # use google_cloud_api::model::Service;
10981    /// use google_cloud_api::model::Logging;
10982    /// let x = Service::new().set_logging(Logging::default()/* use setters */);
10983    /// ```
10984    pub fn set_logging<T>(mut self, v: T) -> Self
10985    where
10986        T: std::convert::Into<crate::model::Logging>,
10987    {
10988        self.logging = std::option::Option::Some(v.into());
10989        self
10990    }
10991
10992    /// Sets or clears the value of [logging][crate::model::Service::logging].
10993    ///
10994    /// # Example
10995    /// ```ignore,no_run
10996    /// # use google_cloud_api::model::Service;
10997    /// use google_cloud_api::model::Logging;
10998    /// let x = Service::new().set_or_clear_logging(Some(Logging::default()/* use setters */));
10999    /// let x = Service::new().set_or_clear_logging(None::<Logging>);
11000    /// ```
11001    pub fn set_or_clear_logging<T>(mut self, v: std::option::Option<T>) -> Self
11002    where
11003        T: std::convert::Into<crate::model::Logging>,
11004    {
11005        self.logging = v.map(|x| x.into());
11006        self
11007    }
11008
11009    /// Sets the value of [monitoring][crate::model::Service::monitoring].
11010    ///
11011    /// # Example
11012    /// ```ignore,no_run
11013    /// # use google_cloud_api::model::Service;
11014    /// use google_cloud_api::model::Monitoring;
11015    /// let x = Service::new().set_monitoring(Monitoring::default()/* use setters */);
11016    /// ```
11017    pub fn set_monitoring<T>(mut self, v: T) -> Self
11018    where
11019        T: std::convert::Into<crate::model::Monitoring>,
11020    {
11021        self.monitoring = std::option::Option::Some(v.into());
11022        self
11023    }
11024
11025    /// Sets or clears the value of [monitoring][crate::model::Service::monitoring].
11026    ///
11027    /// # Example
11028    /// ```ignore,no_run
11029    /// # use google_cloud_api::model::Service;
11030    /// use google_cloud_api::model::Monitoring;
11031    /// let x = Service::new().set_or_clear_monitoring(Some(Monitoring::default()/* use setters */));
11032    /// let x = Service::new().set_or_clear_monitoring(None::<Monitoring>);
11033    /// ```
11034    pub fn set_or_clear_monitoring<T>(mut self, v: std::option::Option<T>) -> Self
11035    where
11036        T: std::convert::Into<crate::model::Monitoring>,
11037    {
11038        self.monitoring = v.map(|x| x.into());
11039        self
11040    }
11041
11042    /// Sets the value of [system_parameters][crate::model::Service::system_parameters].
11043    ///
11044    /// # Example
11045    /// ```ignore,no_run
11046    /// # use google_cloud_api::model::Service;
11047    /// use google_cloud_api::model::SystemParameters;
11048    /// let x = Service::new().set_system_parameters(SystemParameters::default()/* use setters */);
11049    /// ```
11050    pub fn set_system_parameters<T>(mut self, v: T) -> Self
11051    where
11052        T: std::convert::Into<crate::model::SystemParameters>,
11053    {
11054        self.system_parameters = std::option::Option::Some(v.into());
11055        self
11056    }
11057
11058    /// Sets or clears the value of [system_parameters][crate::model::Service::system_parameters].
11059    ///
11060    /// # Example
11061    /// ```ignore,no_run
11062    /// # use google_cloud_api::model::Service;
11063    /// use google_cloud_api::model::SystemParameters;
11064    /// let x = Service::new().set_or_clear_system_parameters(Some(SystemParameters::default()/* use setters */));
11065    /// let x = Service::new().set_or_clear_system_parameters(None::<SystemParameters>);
11066    /// ```
11067    pub fn set_or_clear_system_parameters<T>(mut self, v: std::option::Option<T>) -> Self
11068    where
11069        T: std::convert::Into<crate::model::SystemParameters>,
11070    {
11071        self.system_parameters = v.map(|x| x.into());
11072        self
11073    }
11074
11075    /// Sets the value of [source_info][crate::model::Service::source_info].
11076    ///
11077    /// # Example
11078    /// ```ignore,no_run
11079    /// # use google_cloud_api::model::Service;
11080    /// use google_cloud_api::model::SourceInfo;
11081    /// let x = Service::new().set_source_info(SourceInfo::default()/* use setters */);
11082    /// ```
11083    pub fn set_source_info<T>(mut self, v: T) -> Self
11084    where
11085        T: std::convert::Into<crate::model::SourceInfo>,
11086    {
11087        self.source_info = std::option::Option::Some(v.into());
11088        self
11089    }
11090
11091    /// Sets or clears the value of [source_info][crate::model::Service::source_info].
11092    ///
11093    /// # Example
11094    /// ```ignore,no_run
11095    /// # use google_cloud_api::model::Service;
11096    /// use google_cloud_api::model::SourceInfo;
11097    /// let x = Service::new().set_or_clear_source_info(Some(SourceInfo::default()/* use setters */));
11098    /// let x = Service::new().set_or_clear_source_info(None::<SourceInfo>);
11099    /// ```
11100    pub fn set_or_clear_source_info<T>(mut self, v: std::option::Option<T>) -> Self
11101    where
11102        T: std::convert::Into<crate::model::SourceInfo>,
11103    {
11104        self.source_info = v.map(|x| x.into());
11105        self
11106    }
11107
11108    /// Sets the value of [publishing][crate::model::Service::publishing].
11109    ///
11110    /// # Example
11111    /// ```ignore,no_run
11112    /// # use google_cloud_api::model::Service;
11113    /// use google_cloud_api::model::Publishing;
11114    /// let x = Service::new().set_publishing(Publishing::default()/* use setters */);
11115    /// ```
11116    pub fn set_publishing<T>(mut self, v: T) -> Self
11117    where
11118        T: std::convert::Into<crate::model::Publishing>,
11119    {
11120        self.publishing = std::option::Option::Some(v.into());
11121        self
11122    }
11123
11124    /// Sets or clears the value of [publishing][crate::model::Service::publishing].
11125    ///
11126    /// # Example
11127    /// ```ignore,no_run
11128    /// # use google_cloud_api::model::Service;
11129    /// use google_cloud_api::model::Publishing;
11130    /// let x = Service::new().set_or_clear_publishing(Some(Publishing::default()/* use setters */));
11131    /// let x = Service::new().set_or_clear_publishing(None::<Publishing>);
11132    /// ```
11133    pub fn set_or_clear_publishing<T>(mut self, v: std::option::Option<T>) -> Self
11134    where
11135        T: std::convert::Into<crate::model::Publishing>,
11136    {
11137        self.publishing = v.map(|x| x.into());
11138        self
11139    }
11140
11141    /// Sets the value of [config_version][crate::model::Service::config_version].
11142    ///
11143    /// # Example
11144    /// ```ignore,no_run
11145    /// # use google_cloud_api::model::Service;
11146    /// use wkt::UInt32Value;
11147    /// let x = Service::new().set_config_version(UInt32Value::default()/* use setters */);
11148    /// ```
11149    pub fn set_config_version<T>(mut self, v: T) -> Self
11150    where
11151        T: std::convert::Into<wkt::UInt32Value>,
11152    {
11153        self.config_version = std::option::Option::Some(v.into());
11154        self
11155    }
11156
11157    /// Sets or clears the value of [config_version][crate::model::Service::config_version].
11158    ///
11159    /// # Example
11160    /// ```ignore,no_run
11161    /// # use google_cloud_api::model::Service;
11162    /// use wkt::UInt32Value;
11163    /// let x = Service::new().set_or_clear_config_version(Some(UInt32Value::default()/* use setters */));
11164    /// let x = Service::new().set_or_clear_config_version(None::<UInt32Value>);
11165    /// ```
11166    pub fn set_or_clear_config_version<T>(mut self, v: std::option::Option<T>) -> Self
11167    where
11168        T: std::convert::Into<wkt::UInt32Value>,
11169    {
11170        self.config_version = v.map(|x| x.into());
11171        self
11172    }
11173}
11174
11175impl wkt::message::Message for Service {
11176    fn typename() -> &'static str {
11177        "type.googleapis.com/google.api.Service"
11178    }
11179}
11180
11181/// Source information used to create a Service Config
11182#[derive(Clone, Default, PartialEq)]
11183#[non_exhaustive]
11184pub struct SourceInfo {
11185    /// All files used during config generation.
11186    pub source_files: std::vec::Vec<wkt::Any>,
11187
11188    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11189}
11190
11191impl SourceInfo {
11192    pub fn new() -> Self {
11193        std::default::Default::default()
11194    }
11195
11196    /// Sets the value of [source_files][crate::model::SourceInfo::source_files].
11197    ///
11198    /// # Example
11199    /// ```ignore,no_run
11200    /// # use google_cloud_api::model::SourceInfo;
11201    /// use wkt::Any;
11202    /// let x = SourceInfo::new()
11203    ///     .set_source_files([
11204    ///         Any::default()/* use setters */,
11205    ///         Any::default()/* use (different) setters */,
11206    ///     ]);
11207    /// ```
11208    pub fn set_source_files<T, V>(mut self, v: T) -> Self
11209    where
11210        T: std::iter::IntoIterator<Item = V>,
11211        V: std::convert::Into<wkt::Any>,
11212    {
11213        use std::iter::Iterator;
11214        self.source_files = v.into_iter().map(|i| i.into()).collect();
11215        self
11216    }
11217}
11218
11219impl wkt::message::Message for SourceInfo {
11220    fn typename() -> &'static str {
11221        "type.googleapis.com/google.api.SourceInfo"
11222    }
11223}
11224
11225/// ### System parameter configuration
11226///
11227/// A system parameter is a special kind of parameter defined by the API
11228/// system, not by an individual API. It is typically mapped to an HTTP header
11229/// and/or a URL query parameter. This configuration specifies which methods
11230/// change the names of the system parameters.
11231#[derive(Clone, Default, PartialEq)]
11232#[non_exhaustive]
11233pub struct SystemParameters {
11234    /// Define system parameters.
11235    ///
11236    /// The parameters defined here will override the default parameters
11237    /// implemented by the system. If this field is missing from the service
11238    /// config, default system parameters will be used. Default system parameters
11239    /// and names is implementation-dependent.
11240    ///
11241    /// Example: define api key for all methods
11242    ///
11243    /// ```norust
11244    /// system_parameters
11245    ///   rules:
11246    ///     - selector: "*"
11247    ///       parameters:
11248    ///         - name: api_key
11249    ///           url_query_parameter: api_key
11250    /// ```
11251    ///
11252    /// Example: define 2 api key names for a specific method.
11253    ///
11254    /// ```norust
11255    /// system_parameters
11256    ///   rules:
11257    ///     - selector: "/ListShelves"
11258    ///       parameters:
11259    ///         - name: api_key
11260    ///           http_header: Api-Key1
11261    ///         - name: api_key
11262    ///           http_header: Api-Key2
11263    /// ```
11264    ///
11265    /// **NOTE:** All service configuration rules follow "last one wins" order.
11266    pub rules: std::vec::Vec<crate::model::SystemParameterRule>,
11267
11268    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11269}
11270
11271impl SystemParameters {
11272    pub fn new() -> Self {
11273        std::default::Default::default()
11274    }
11275
11276    /// Sets the value of [rules][crate::model::SystemParameters::rules].
11277    ///
11278    /// # Example
11279    /// ```ignore,no_run
11280    /// # use google_cloud_api::model::SystemParameters;
11281    /// use google_cloud_api::model::SystemParameterRule;
11282    /// let x = SystemParameters::new()
11283    ///     .set_rules([
11284    ///         SystemParameterRule::default()/* use setters */,
11285    ///         SystemParameterRule::default()/* use (different) setters */,
11286    ///     ]);
11287    /// ```
11288    pub fn set_rules<T, V>(mut self, v: T) -> Self
11289    where
11290        T: std::iter::IntoIterator<Item = V>,
11291        V: std::convert::Into<crate::model::SystemParameterRule>,
11292    {
11293        use std::iter::Iterator;
11294        self.rules = v.into_iter().map(|i| i.into()).collect();
11295        self
11296    }
11297}
11298
11299impl wkt::message::Message for SystemParameters {
11300    fn typename() -> &'static str {
11301        "type.googleapis.com/google.api.SystemParameters"
11302    }
11303}
11304
11305/// Define a system parameter rule mapping system parameter definitions to
11306/// methods.
11307#[derive(Clone, Default, PartialEq)]
11308#[non_exhaustive]
11309pub struct SystemParameterRule {
11310    /// Selects the methods to which this rule applies. Use '*' to indicate all
11311    /// methods in all APIs.
11312    ///
11313    /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
11314    /// details.
11315    ///
11316    /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
11317    pub selector: std::string::String,
11318
11319    /// Define parameters. Multiple names may be defined for a parameter.
11320    /// For a given method call, only one of them should be used. If multiple
11321    /// names are used the behavior is implementation-dependent.
11322    /// If none of the specified names are present the behavior is
11323    /// parameter-dependent.
11324    pub parameters: std::vec::Vec<crate::model::SystemParameter>,
11325
11326    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11327}
11328
11329impl SystemParameterRule {
11330    pub fn new() -> Self {
11331        std::default::Default::default()
11332    }
11333
11334    /// Sets the value of [selector][crate::model::SystemParameterRule::selector].
11335    ///
11336    /// # Example
11337    /// ```ignore,no_run
11338    /// # use google_cloud_api::model::SystemParameterRule;
11339    /// let x = SystemParameterRule::new().set_selector("example");
11340    /// ```
11341    pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11342        self.selector = v.into();
11343        self
11344    }
11345
11346    /// Sets the value of [parameters][crate::model::SystemParameterRule::parameters].
11347    ///
11348    /// # Example
11349    /// ```ignore,no_run
11350    /// # use google_cloud_api::model::SystemParameterRule;
11351    /// use google_cloud_api::model::SystemParameter;
11352    /// let x = SystemParameterRule::new()
11353    ///     .set_parameters([
11354    ///         SystemParameter::default()/* use setters */,
11355    ///         SystemParameter::default()/* use (different) setters */,
11356    ///     ]);
11357    /// ```
11358    pub fn set_parameters<T, V>(mut self, v: T) -> Self
11359    where
11360        T: std::iter::IntoIterator<Item = V>,
11361        V: std::convert::Into<crate::model::SystemParameter>,
11362    {
11363        use std::iter::Iterator;
11364        self.parameters = v.into_iter().map(|i| i.into()).collect();
11365        self
11366    }
11367}
11368
11369impl wkt::message::Message for SystemParameterRule {
11370    fn typename() -> &'static str {
11371        "type.googleapis.com/google.api.SystemParameterRule"
11372    }
11373}
11374
11375/// Define a parameter's name and location. The parameter may be passed as either
11376/// an HTTP header or a URL query parameter, and if both are passed the behavior
11377/// is implementation-dependent.
11378#[derive(Clone, Default, PartialEq)]
11379#[non_exhaustive]
11380pub struct SystemParameter {
11381    /// Define the name of the parameter, such as "api_key" . It is case sensitive.
11382    pub name: std::string::String,
11383
11384    /// Define the HTTP header name to use for the parameter. It is case
11385    /// insensitive.
11386    pub http_header: std::string::String,
11387
11388    /// Define the URL query parameter name to use for the parameter. It is case
11389    /// sensitive.
11390    pub url_query_parameter: std::string::String,
11391
11392    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11393}
11394
11395impl SystemParameter {
11396    pub fn new() -> Self {
11397        std::default::Default::default()
11398    }
11399
11400    /// Sets the value of [name][crate::model::SystemParameter::name].
11401    ///
11402    /// # Example
11403    /// ```ignore,no_run
11404    /// # use google_cloud_api::model::SystemParameter;
11405    /// let x = SystemParameter::new().set_name("example");
11406    /// ```
11407    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11408        self.name = v.into();
11409        self
11410    }
11411
11412    /// Sets the value of [http_header][crate::model::SystemParameter::http_header].
11413    ///
11414    /// # Example
11415    /// ```ignore,no_run
11416    /// # use google_cloud_api::model::SystemParameter;
11417    /// let x = SystemParameter::new().set_http_header("example");
11418    /// ```
11419    pub fn set_http_header<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11420        self.http_header = v.into();
11421        self
11422    }
11423
11424    /// Sets the value of [url_query_parameter][crate::model::SystemParameter::url_query_parameter].
11425    ///
11426    /// # Example
11427    /// ```ignore,no_run
11428    /// # use google_cloud_api::model::SystemParameter;
11429    /// let x = SystemParameter::new().set_url_query_parameter("example");
11430    /// ```
11431    pub fn set_url_query_parameter<T: std::convert::Into<std::string::String>>(
11432        mut self,
11433        v: T,
11434    ) -> Self {
11435        self.url_query_parameter = v.into();
11436        self
11437    }
11438}
11439
11440impl wkt::message::Message for SystemParameter {
11441    fn typename() -> &'static str {
11442        "type.googleapis.com/google.api.SystemParameter"
11443    }
11444}
11445
11446/// Configuration controlling usage of a service.
11447#[derive(Clone, Default, PartialEq)]
11448#[non_exhaustive]
11449pub struct Usage {
11450    /// Requirements that must be satisfied before a consumer project can use the
11451    /// service. Each requirement is of the form <service.name>/\<requirement-id\>;
11452    /// for example 'serviceusage.googleapis.com/billing-enabled'.
11453    ///
11454    /// For Google APIs, a Terms of Service requirement must be included here.
11455    /// Google Cloud APIs must include "serviceusage.googleapis.com/tos/cloud".
11456    /// Other Google APIs should include
11457    /// "serviceusage.googleapis.com/tos/universal". Additional ToS can be
11458    /// included based on the business needs.
11459    pub requirements: std::vec::Vec<std::string::String>,
11460
11461    /// A list of usage rules that apply to individual API methods.
11462    ///
11463    /// **NOTE:** All service configuration rules follow "last one wins" order.
11464    pub rules: std::vec::Vec<crate::model::UsageRule>,
11465
11466    /// The full resource name of a channel used for sending notifications to the
11467    /// service producer.
11468    ///
11469    /// Google Service Management currently only supports
11470    /// [Google Cloud Pub/Sub](https://cloud.google.com/pubsub) as a notification
11471    /// channel. To use Google Cloud Pub/Sub as the channel, this must be the name
11472    /// of a Cloud Pub/Sub topic that uses the Cloud Pub/Sub topic name format
11473    /// documented in <https://cloud.google.com/pubsub/docs/overview>.
11474    pub producer_notification_channel: std::string::String,
11475
11476    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11477}
11478
11479impl Usage {
11480    pub fn new() -> Self {
11481        std::default::Default::default()
11482    }
11483
11484    /// Sets the value of [requirements][crate::model::Usage::requirements].
11485    ///
11486    /// # Example
11487    /// ```ignore,no_run
11488    /// # use google_cloud_api::model::Usage;
11489    /// let x = Usage::new().set_requirements(["a", "b", "c"]);
11490    /// ```
11491    pub fn set_requirements<T, V>(mut self, v: T) -> Self
11492    where
11493        T: std::iter::IntoIterator<Item = V>,
11494        V: std::convert::Into<std::string::String>,
11495    {
11496        use std::iter::Iterator;
11497        self.requirements = v.into_iter().map(|i| i.into()).collect();
11498        self
11499    }
11500
11501    /// Sets the value of [rules][crate::model::Usage::rules].
11502    ///
11503    /// # Example
11504    /// ```ignore,no_run
11505    /// # use google_cloud_api::model::Usage;
11506    /// use google_cloud_api::model::UsageRule;
11507    /// let x = Usage::new()
11508    ///     .set_rules([
11509    ///         UsageRule::default()/* use setters */,
11510    ///         UsageRule::default()/* use (different) setters */,
11511    ///     ]);
11512    /// ```
11513    pub fn set_rules<T, V>(mut self, v: T) -> Self
11514    where
11515        T: std::iter::IntoIterator<Item = V>,
11516        V: std::convert::Into<crate::model::UsageRule>,
11517    {
11518        use std::iter::Iterator;
11519        self.rules = v.into_iter().map(|i| i.into()).collect();
11520        self
11521    }
11522
11523    /// Sets the value of [producer_notification_channel][crate::model::Usage::producer_notification_channel].
11524    ///
11525    /// # Example
11526    /// ```ignore,no_run
11527    /// # use google_cloud_api::model::Usage;
11528    /// let x = Usage::new().set_producer_notification_channel("example");
11529    /// ```
11530    pub fn set_producer_notification_channel<T: std::convert::Into<std::string::String>>(
11531        mut self,
11532        v: T,
11533    ) -> Self {
11534        self.producer_notification_channel = v.into();
11535        self
11536    }
11537}
11538
11539impl wkt::message::Message for Usage {
11540    fn typename() -> &'static str {
11541        "type.googleapis.com/google.api.Usage"
11542    }
11543}
11544
11545/// Usage configuration rules for the service.
11546///
11547/// NOTE: Under development.
11548///
11549/// Use this rule to configure unregistered calls for the service. Unregistered
11550/// calls are calls that do not contain consumer project identity.
11551/// (Example: calls that do not contain an API key).
11552/// By default, API methods do not allow unregistered calls, and each method call
11553/// must be identified by a consumer project identity. Use this rule to
11554/// allow/disallow unregistered calls.
11555///
11556/// Example of an API that wants to allow unregistered calls for entire service.
11557///
11558/// ```norust
11559/// usage:
11560///   rules:
11561///   - selector: "*"
11562///     allow_unregistered_calls: true
11563/// ```
11564///
11565/// Example of a method that wants to allow unregistered calls.
11566///
11567/// ```norust
11568/// usage:
11569///   rules:
11570///   - selector: "google.example.library.v1.LibraryService.CreateBook"
11571///     allow_unregistered_calls: true
11572/// ```
11573#[derive(Clone, Default, PartialEq)]
11574#[non_exhaustive]
11575pub struct UsageRule {
11576    /// Selects the methods to which this rule applies. Use '*' to indicate all
11577    /// methods in all APIs.
11578    ///
11579    /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
11580    /// details.
11581    ///
11582    /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
11583    pub selector: std::string::String,
11584
11585    /// If true, the selected method allows unregistered calls, e.g. calls
11586    /// that don't identify any user or application.
11587    pub allow_unregistered_calls: bool,
11588
11589    /// If true, the selected method should skip service control and the control
11590    /// plane features, such as quota and billing, will not be available.
11591    /// This flag is used by Google Cloud Endpoints to bypass checks for internal
11592    /// methods, such as service health check methods.
11593    pub skip_service_control: bool,
11594
11595    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11596}
11597
11598impl UsageRule {
11599    pub fn new() -> Self {
11600        std::default::Default::default()
11601    }
11602
11603    /// Sets the value of [selector][crate::model::UsageRule::selector].
11604    ///
11605    /// # Example
11606    /// ```ignore,no_run
11607    /// # use google_cloud_api::model::UsageRule;
11608    /// let x = UsageRule::new().set_selector("example");
11609    /// ```
11610    pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11611        self.selector = v.into();
11612        self
11613    }
11614
11615    /// Sets the value of [allow_unregistered_calls][crate::model::UsageRule::allow_unregistered_calls].
11616    ///
11617    /// # Example
11618    /// ```ignore,no_run
11619    /// # use google_cloud_api::model::UsageRule;
11620    /// let x = UsageRule::new().set_allow_unregistered_calls(true);
11621    /// ```
11622    pub fn set_allow_unregistered_calls<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11623        self.allow_unregistered_calls = v.into();
11624        self
11625    }
11626
11627    /// Sets the value of [skip_service_control][crate::model::UsageRule::skip_service_control].
11628    ///
11629    /// # Example
11630    /// ```ignore,no_run
11631    /// # use google_cloud_api::model::UsageRule;
11632    /// let x = UsageRule::new().set_skip_service_control(true);
11633    /// ```
11634    pub fn set_skip_service_control<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11635        self.skip_service_control = v.into();
11636        self
11637    }
11638}
11639
11640impl wkt::message::Message for UsageRule {
11641    fn typename() -> &'static str {
11642        "type.googleapis.com/google.api.UsageRule"
11643    }
11644}
11645
11646/// `Visibility` restricts service consumer's access to service elements,
11647/// such as whether an application can call a visibility-restricted method.
11648/// The restriction is expressed by applying visibility labels on service
11649/// elements. The visibility labels are elsewhere linked to service consumers.
11650///
11651/// A service can define multiple visibility labels, but a service consumer
11652/// should be granted at most one visibility label. Multiple visibility
11653/// labels for a single service consumer are not supported.
11654///
11655/// If an element and all its parents have no visibility label, its visibility
11656/// is unconditionally granted.
11657///
11658/// Example:
11659///
11660/// ```norust
11661/// visibility:
11662///   rules:
11663///   - selector: google.calendar.Calendar.EnhancedSearch
11664///     restriction: PREVIEW
11665///   - selector: google.calendar.Calendar.Delegate
11666///     restriction: INTERNAL
11667/// ```
11668///
11669/// Here, all methods are publicly visible except for the restricted methods
11670/// EnhancedSearch and Delegate.
11671#[derive(Clone, Default, PartialEq)]
11672#[non_exhaustive]
11673pub struct Visibility {
11674    /// A list of visibility rules that apply to individual API elements.
11675    ///
11676    /// **NOTE:** All service configuration rules follow "last one wins" order.
11677    pub rules: std::vec::Vec<crate::model::VisibilityRule>,
11678
11679    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11680}
11681
11682impl Visibility {
11683    pub fn new() -> Self {
11684        std::default::Default::default()
11685    }
11686
11687    /// Sets the value of [rules][crate::model::Visibility::rules].
11688    ///
11689    /// # Example
11690    /// ```ignore,no_run
11691    /// # use google_cloud_api::model::Visibility;
11692    /// use google_cloud_api::model::VisibilityRule;
11693    /// let x = Visibility::new()
11694    ///     .set_rules([
11695    ///         VisibilityRule::default()/* use setters */,
11696    ///         VisibilityRule::default()/* use (different) setters */,
11697    ///     ]);
11698    /// ```
11699    pub fn set_rules<T, V>(mut self, v: T) -> Self
11700    where
11701        T: std::iter::IntoIterator<Item = V>,
11702        V: std::convert::Into<crate::model::VisibilityRule>,
11703    {
11704        use std::iter::Iterator;
11705        self.rules = v.into_iter().map(|i| i.into()).collect();
11706        self
11707    }
11708}
11709
11710impl wkt::message::Message for Visibility {
11711    fn typename() -> &'static str {
11712        "type.googleapis.com/google.api.Visibility"
11713    }
11714}
11715
11716/// A visibility rule provides visibility configuration for an individual API
11717/// element.
11718#[derive(Clone, Default, PartialEq)]
11719#[non_exhaustive]
11720pub struct VisibilityRule {
11721    /// Selects methods, messages, fields, enums, etc. to which this rule applies.
11722    ///
11723    /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
11724    /// details.
11725    ///
11726    /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
11727    pub selector: std::string::String,
11728
11729    /// A comma-separated list of visibility labels that apply to the `selector`.
11730    /// Any of the listed labels can be used to grant the visibility.
11731    ///
11732    /// If a rule has multiple labels, removing one of the labels but not all of
11733    /// them can break clients.
11734    ///
11735    /// Example:
11736    ///
11737    /// ```norust
11738    /// visibility:
11739    ///   rules:
11740    ///   - selector: google.calendar.Calendar.EnhancedSearch
11741    ///     restriction: INTERNAL, PREVIEW
11742    /// ```
11743    ///
11744    /// Removing INTERNAL from this restriction will break clients that rely on
11745    /// this method and only had access to it through INTERNAL.
11746    pub restriction: std::string::String,
11747
11748    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11749}
11750
11751impl VisibilityRule {
11752    pub fn new() -> Self {
11753        std::default::Default::default()
11754    }
11755
11756    /// Sets the value of [selector][crate::model::VisibilityRule::selector].
11757    ///
11758    /// # Example
11759    /// ```ignore,no_run
11760    /// # use google_cloud_api::model::VisibilityRule;
11761    /// let x = VisibilityRule::new().set_selector("example");
11762    /// ```
11763    pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11764        self.selector = v.into();
11765        self
11766    }
11767
11768    /// Sets the value of [restriction][crate::model::VisibilityRule::restriction].
11769    ///
11770    /// # Example
11771    /// ```ignore,no_run
11772    /// # use google_cloud_api::model::VisibilityRule;
11773    /// let x = VisibilityRule::new().set_restriction("example");
11774    /// ```
11775    pub fn set_restriction<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11776        self.restriction = v.into();
11777        self
11778    }
11779}
11780
11781impl wkt::message::Message for VisibilityRule {
11782    fn typename() -> &'static str {
11783        "type.googleapis.com/google.api.VisibilityRule"
11784    }
11785}
11786
11787/// The organization for which the client libraries are being published.
11788/// Affects the url where generated docs are published, etc.
11789///
11790/// # Working with unknown values
11791///
11792/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11793/// additional enum variants at any time. Adding new variants is not considered
11794/// a breaking change. Applications should write their code in anticipation of:
11795///
11796/// - New values appearing in future releases of the client library, **and**
11797/// - New values received dynamically, without application changes.
11798///
11799/// Please consult the [Working with enums] section in the user guide for some
11800/// guidelines.
11801///
11802/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
11803#[derive(Clone, Debug, PartialEq)]
11804#[non_exhaustive]
11805pub enum ClientLibraryOrganization {
11806    /// Not useful.
11807    Unspecified,
11808    /// Google Cloud Platform Org.
11809    Cloud,
11810    /// Ads (Advertising) Org.
11811    Ads,
11812    /// Photos Org.
11813    Photos,
11814    /// Street View Org.
11815    StreetView,
11816    /// Shopping Org.
11817    Shopping,
11818    /// Geo Org.
11819    Geo,
11820    /// Generative AI - <https://developers.generativeai.google>
11821    GenerativeAi,
11822    /// If set, the enum was initialized with an unknown value.
11823    ///
11824    /// Applications can examine the value using [ClientLibraryOrganization::value] or
11825    /// [ClientLibraryOrganization::name].
11826    UnknownValue(client_library_organization::UnknownValue),
11827}
11828
11829#[doc(hidden)]
11830pub mod client_library_organization {
11831    #[allow(unused_imports)]
11832    use super::*;
11833    #[derive(Clone, Debug, PartialEq)]
11834    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11835}
11836
11837impl ClientLibraryOrganization {
11838    /// Gets the enum value.
11839    ///
11840    /// Returns `None` if the enum contains an unknown value deserialized from
11841    /// the string representation of enums.
11842    pub fn value(&self) -> std::option::Option<i32> {
11843        match self {
11844            Self::Unspecified => std::option::Option::Some(0),
11845            Self::Cloud => std::option::Option::Some(1),
11846            Self::Ads => std::option::Option::Some(2),
11847            Self::Photos => std::option::Option::Some(3),
11848            Self::StreetView => std::option::Option::Some(4),
11849            Self::Shopping => std::option::Option::Some(5),
11850            Self::Geo => std::option::Option::Some(6),
11851            Self::GenerativeAi => std::option::Option::Some(7),
11852            Self::UnknownValue(u) => u.0.value(),
11853        }
11854    }
11855
11856    /// Gets the enum value as a string.
11857    ///
11858    /// Returns `None` if the enum contains an unknown value deserialized from
11859    /// the integer representation of enums.
11860    pub fn name(&self) -> std::option::Option<&str> {
11861        match self {
11862            Self::Unspecified => {
11863                std::option::Option::Some("CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED")
11864            }
11865            Self::Cloud => std::option::Option::Some("CLOUD"),
11866            Self::Ads => std::option::Option::Some("ADS"),
11867            Self::Photos => std::option::Option::Some("PHOTOS"),
11868            Self::StreetView => std::option::Option::Some("STREET_VIEW"),
11869            Self::Shopping => std::option::Option::Some("SHOPPING"),
11870            Self::Geo => std::option::Option::Some("GEO"),
11871            Self::GenerativeAi => std::option::Option::Some("GENERATIVE_AI"),
11872            Self::UnknownValue(u) => u.0.name(),
11873        }
11874    }
11875}
11876
11877impl std::default::Default for ClientLibraryOrganization {
11878    fn default() -> Self {
11879        use std::convert::From;
11880        Self::from(0)
11881    }
11882}
11883
11884impl std::fmt::Display for ClientLibraryOrganization {
11885    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11886        wkt::internal::display_enum(f, self.name(), self.value())
11887    }
11888}
11889
11890impl std::convert::From<i32> for ClientLibraryOrganization {
11891    fn from(value: i32) -> Self {
11892        match value {
11893            0 => Self::Unspecified,
11894            1 => Self::Cloud,
11895            2 => Self::Ads,
11896            3 => Self::Photos,
11897            4 => Self::StreetView,
11898            5 => Self::Shopping,
11899            6 => Self::Geo,
11900            7 => Self::GenerativeAi,
11901            _ => Self::UnknownValue(client_library_organization::UnknownValue(
11902                wkt::internal::UnknownEnumValue::Integer(value),
11903            )),
11904        }
11905    }
11906}
11907
11908impl std::convert::From<&str> for ClientLibraryOrganization {
11909    fn from(value: &str) -> Self {
11910        use std::string::ToString;
11911        match value {
11912            "CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED" => Self::Unspecified,
11913            "CLOUD" => Self::Cloud,
11914            "ADS" => Self::Ads,
11915            "PHOTOS" => Self::Photos,
11916            "STREET_VIEW" => Self::StreetView,
11917            "SHOPPING" => Self::Shopping,
11918            "GEO" => Self::Geo,
11919            "GENERATIVE_AI" => Self::GenerativeAi,
11920            _ => Self::UnknownValue(client_library_organization::UnknownValue(
11921                wkt::internal::UnknownEnumValue::String(value.to_string()),
11922            )),
11923        }
11924    }
11925}
11926
11927impl serde::ser::Serialize for ClientLibraryOrganization {
11928    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11929    where
11930        S: serde::Serializer,
11931    {
11932        match self {
11933            Self::Unspecified => serializer.serialize_i32(0),
11934            Self::Cloud => serializer.serialize_i32(1),
11935            Self::Ads => serializer.serialize_i32(2),
11936            Self::Photos => serializer.serialize_i32(3),
11937            Self::StreetView => serializer.serialize_i32(4),
11938            Self::Shopping => serializer.serialize_i32(5),
11939            Self::Geo => serializer.serialize_i32(6),
11940            Self::GenerativeAi => serializer.serialize_i32(7),
11941            Self::UnknownValue(u) => u.0.serialize(serializer),
11942        }
11943    }
11944}
11945
11946impl<'de> serde::de::Deserialize<'de> for ClientLibraryOrganization {
11947    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11948    where
11949        D: serde::Deserializer<'de>,
11950    {
11951        deserializer.deserialize_any(
11952            wkt::internal::EnumVisitor::<ClientLibraryOrganization>::new(
11953                ".google.api.ClientLibraryOrganization",
11954            ),
11955        )
11956    }
11957}
11958
11959/// To where should client libraries be published?
11960///
11961/// # Working with unknown values
11962///
11963/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11964/// additional enum variants at any time. Adding new variants is not considered
11965/// a breaking change. Applications should write their code in anticipation of:
11966///
11967/// - New values appearing in future releases of the client library, **and**
11968/// - New values received dynamically, without application changes.
11969///
11970/// Please consult the [Working with enums] section in the user guide for some
11971/// guidelines.
11972///
11973/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
11974#[derive(Clone, Debug, PartialEq)]
11975#[non_exhaustive]
11976pub enum ClientLibraryDestination {
11977    /// Client libraries will neither be generated nor published to package
11978    /// managers.
11979    Unspecified,
11980    /// Generate the client library in a repo under github.com/googleapis,
11981    /// but don't publish it to package managers.
11982    Github,
11983    /// Publish the library to package managers like nuget.org and npmjs.com.
11984    PackageManager,
11985    /// If set, the enum was initialized with an unknown value.
11986    ///
11987    /// Applications can examine the value using [ClientLibraryDestination::value] or
11988    /// [ClientLibraryDestination::name].
11989    UnknownValue(client_library_destination::UnknownValue),
11990}
11991
11992#[doc(hidden)]
11993pub mod client_library_destination {
11994    #[allow(unused_imports)]
11995    use super::*;
11996    #[derive(Clone, Debug, PartialEq)]
11997    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11998}
11999
12000impl ClientLibraryDestination {
12001    /// Gets the enum value.
12002    ///
12003    /// Returns `None` if the enum contains an unknown value deserialized from
12004    /// the string representation of enums.
12005    pub fn value(&self) -> std::option::Option<i32> {
12006        match self {
12007            Self::Unspecified => std::option::Option::Some(0),
12008            Self::Github => std::option::Option::Some(10),
12009            Self::PackageManager => std::option::Option::Some(20),
12010            Self::UnknownValue(u) => u.0.value(),
12011        }
12012    }
12013
12014    /// Gets the enum value as a string.
12015    ///
12016    /// Returns `None` if the enum contains an unknown value deserialized from
12017    /// the integer representation of enums.
12018    pub fn name(&self) -> std::option::Option<&str> {
12019        match self {
12020            Self::Unspecified => {
12021                std::option::Option::Some("CLIENT_LIBRARY_DESTINATION_UNSPECIFIED")
12022            }
12023            Self::Github => std::option::Option::Some("GITHUB"),
12024            Self::PackageManager => std::option::Option::Some("PACKAGE_MANAGER"),
12025            Self::UnknownValue(u) => u.0.name(),
12026        }
12027    }
12028}
12029
12030impl std::default::Default for ClientLibraryDestination {
12031    fn default() -> Self {
12032        use std::convert::From;
12033        Self::from(0)
12034    }
12035}
12036
12037impl std::fmt::Display for ClientLibraryDestination {
12038    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
12039        wkt::internal::display_enum(f, self.name(), self.value())
12040    }
12041}
12042
12043impl std::convert::From<i32> for ClientLibraryDestination {
12044    fn from(value: i32) -> Self {
12045        match value {
12046            0 => Self::Unspecified,
12047            10 => Self::Github,
12048            20 => Self::PackageManager,
12049            _ => Self::UnknownValue(client_library_destination::UnknownValue(
12050                wkt::internal::UnknownEnumValue::Integer(value),
12051            )),
12052        }
12053    }
12054}
12055
12056impl std::convert::From<&str> for ClientLibraryDestination {
12057    fn from(value: &str) -> Self {
12058        use std::string::ToString;
12059        match value {
12060            "CLIENT_LIBRARY_DESTINATION_UNSPECIFIED" => Self::Unspecified,
12061            "GITHUB" => Self::Github,
12062            "PACKAGE_MANAGER" => Self::PackageManager,
12063            _ => Self::UnknownValue(client_library_destination::UnknownValue(
12064                wkt::internal::UnknownEnumValue::String(value.to_string()),
12065            )),
12066        }
12067    }
12068}
12069
12070impl serde::ser::Serialize for ClientLibraryDestination {
12071    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12072    where
12073        S: serde::Serializer,
12074    {
12075        match self {
12076            Self::Unspecified => serializer.serialize_i32(0),
12077            Self::Github => serializer.serialize_i32(10),
12078            Self::PackageManager => serializer.serialize_i32(20),
12079            Self::UnknownValue(u) => u.0.serialize(serializer),
12080        }
12081    }
12082}
12083
12084impl<'de> serde::de::Deserialize<'de> for ClientLibraryDestination {
12085    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12086    where
12087        D: serde::Deserializer<'de>,
12088    {
12089        deserializer.deserialize_any(wkt::internal::EnumVisitor::<ClientLibraryDestination>::new(
12090            ".google.api.ClientLibraryDestination",
12091        ))
12092    }
12093}
12094
12095/// Classifies set of possible modifications to an object in the service
12096/// configuration.
12097///
12098/// # Working with unknown values
12099///
12100/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12101/// additional enum variants at any time. Adding new variants is not considered
12102/// a breaking change. Applications should write their code in anticipation of:
12103///
12104/// - New values appearing in future releases of the client library, **and**
12105/// - New values received dynamically, without application changes.
12106///
12107/// Please consult the [Working with enums] section in the user guide for some
12108/// guidelines.
12109///
12110/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
12111#[derive(Clone, Debug, PartialEq)]
12112#[non_exhaustive]
12113pub enum ChangeType {
12114    /// No value was provided.
12115    Unspecified,
12116    /// The changed object exists in the 'new' service configuration, but not
12117    /// in the 'old' service configuration.
12118    Added,
12119    /// The changed object exists in the 'old' service configuration, but not
12120    /// in the 'new' service configuration.
12121    Removed,
12122    /// The changed object exists in both service configurations, but its value
12123    /// is different.
12124    Modified,
12125    /// If set, the enum was initialized with an unknown value.
12126    ///
12127    /// Applications can examine the value using [ChangeType::value] or
12128    /// [ChangeType::name].
12129    UnknownValue(change_type::UnknownValue),
12130}
12131
12132#[doc(hidden)]
12133pub mod change_type {
12134    #[allow(unused_imports)]
12135    use super::*;
12136    #[derive(Clone, Debug, PartialEq)]
12137    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
12138}
12139
12140impl ChangeType {
12141    /// Gets the enum value.
12142    ///
12143    /// Returns `None` if the enum contains an unknown value deserialized from
12144    /// the string representation of enums.
12145    pub fn value(&self) -> std::option::Option<i32> {
12146        match self {
12147            Self::Unspecified => std::option::Option::Some(0),
12148            Self::Added => std::option::Option::Some(1),
12149            Self::Removed => std::option::Option::Some(2),
12150            Self::Modified => std::option::Option::Some(3),
12151            Self::UnknownValue(u) => u.0.value(),
12152        }
12153    }
12154
12155    /// Gets the enum value as a string.
12156    ///
12157    /// Returns `None` if the enum contains an unknown value deserialized from
12158    /// the integer representation of enums.
12159    pub fn name(&self) -> std::option::Option<&str> {
12160        match self {
12161            Self::Unspecified => std::option::Option::Some("CHANGE_TYPE_UNSPECIFIED"),
12162            Self::Added => std::option::Option::Some("ADDED"),
12163            Self::Removed => std::option::Option::Some("REMOVED"),
12164            Self::Modified => std::option::Option::Some("MODIFIED"),
12165            Self::UnknownValue(u) => u.0.name(),
12166        }
12167    }
12168}
12169
12170impl std::default::Default for ChangeType {
12171    fn default() -> Self {
12172        use std::convert::From;
12173        Self::from(0)
12174    }
12175}
12176
12177impl std::fmt::Display for ChangeType {
12178    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
12179        wkt::internal::display_enum(f, self.name(), self.value())
12180    }
12181}
12182
12183impl std::convert::From<i32> for ChangeType {
12184    fn from(value: i32) -> Self {
12185        match value {
12186            0 => Self::Unspecified,
12187            1 => Self::Added,
12188            2 => Self::Removed,
12189            3 => Self::Modified,
12190            _ => Self::UnknownValue(change_type::UnknownValue(
12191                wkt::internal::UnknownEnumValue::Integer(value),
12192            )),
12193        }
12194    }
12195}
12196
12197impl std::convert::From<&str> for ChangeType {
12198    fn from(value: &str) -> Self {
12199        use std::string::ToString;
12200        match value {
12201            "CHANGE_TYPE_UNSPECIFIED" => Self::Unspecified,
12202            "ADDED" => Self::Added,
12203            "REMOVED" => Self::Removed,
12204            "MODIFIED" => Self::Modified,
12205            _ => Self::UnknownValue(change_type::UnknownValue(
12206                wkt::internal::UnknownEnumValue::String(value.to_string()),
12207            )),
12208        }
12209    }
12210}
12211
12212impl serde::ser::Serialize for ChangeType {
12213    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12214    where
12215        S: serde::Serializer,
12216    {
12217        match self {
12218            Self::Unspecified => serializer.serialize_i32(0),
12219            Self::Added => serializer.serialize_i32(1),
12220            Self::Removed => serializer.serialize_i32(2),
12221            Self::Modified => serializer.serialize_i32(3),
12222            Self::UnknownValue(u) => u.0.serialize(serializer),
12223        }
12224    }
12225}
12226
12227impl<'de> serde::de::Deserialize<'de> for ChangeType {
12228    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12229    where
12230        D: serde::Deserializer<'de>,
12231    {
12232        deserializer.deserialize_any(wkt::internal::EnumVisitor::<ChangeType>::new(
12233            ".google.api.ChangeType",
12234        ))
12235    }
12236}
12237
12238/// Defines the supported values for `google.rpc.ErrorInfo.reason` for the
12239/// `googleapis.com` error domain. This error domain is reserved for [Service
12240/// Infrastructure](https://cloud.google.com/service-infrastructure/docs/overview).
12241/// For each error info of this domain, the metadata key "service" refers to the
12242/// logical identifier of an API service, such as "pubsub.googleapis.com". The
12243/// "consumer" refers to the entity that consumes an API Service. It typically is
12244/// a Google project that owns the client application or the server resource,
12245/// such as "projects/123". Other metadata keys are specific to each error
12246/// reason. For more information, see the definition of the specific error
12247/// reason.
12248///
12249/// # Working with unknown values
12250///
12251/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12252/// additional enum variants at any time. Adding new variants is not considered
12253/// a breaking change. Applications should write their code in anticipation of:
12254///
12255/// - New values appearing in future releases of the client library, **and**
12256/// - New values received dynamically, without application changes.
12257///
12258/// Please consult the [Working with enums] section in the user guide for some
12259/// guidelines.
12260///
12261/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
12262#[derive(Clone, Debug, PartialEq)]
12263#[non_exhaustive]
12264pub enum ErrorReason {
12265    /// Do not use this default value.
12266    Unspecified,
12267    /// The request is calling a disabled service for a consumer.
12268    ///
12269    /// Example of an ErrorInfo when the consumer "projects/123" contacting
12270    /// "pubsub.googleapis.com" service which is disabled:
12271    ///
12272    /// ```norust
12273    /// { "reason": "SERVICE_DISABLED",
12274    ///   "domain": "googleapis.com",
12275    ///   "metadata": {
12276    ///     "consumer": "projects/123",
12277    ///     "service": "pubsub.googleapis.com"
12278    ///   }
12279    /// }
12280    /// ```
12281    ///
12282    /// This response indicates the "pubsub.googleapis.com" has been disabled in
12283    /// "projects/123".
12284    ServiceDisabled,
12285    /// The request whose associated billing account is disabled.
12286    ///
12287    /// Example of an ErrorInfo when the consumer "projects/123" fails to contact
12288    /// "pubsub.googleapis.com" service because the associated billing account is
12289    /// disabled:
12290    ///
12291    /// ```norust
12292    /// { "reason": "BILLING_DISABLED",
12293    ///   "domain": "googleapis.com",
12294    ///   "metadata": {
12295    ///     "consumer": "projects/123",
12296    ///     "service": "pubsub.googleapis.com"
12297    ///   }
12298    /// }
12299    /// ```
12300    ///
12301    /// This response indicates the billing account associated has been disabled.
12302    BillingDisabled,
12303    /// The request is denied because the provided [API
12304    /// key](https://cloud.google.com/docs/authentication/api-keys) is invalid. It
12305    /// may be in a bad format, cannot be found, or has been expired).
12306    ///
12307    /// Example of an ErrorInfo when the request is contacting
12308    /// "storage.googleapis.com" service with an invalid API key:
12309    ///
12310    /// ```norust
12311    /// { "reason": "API_KEY_INVALID",
12312    ///   "domain": "googleapis.com",
12313    ///   "metadata": {
12314    ///     "service": "storage.googleapis.com",
12315    ///   }
12316    /// }
12317    /// ```
12318    ApiKeyInvalid,
12319    /// The request is denied because it violates [API key API
12320    /// restrictions](https://cloud.google.com/docs/authentication/api-keys#adding_api_restrictions).
12321    ///
12322    /// Example of an ErrorInfo when the consumer "projects/123" fails to call the
12323    /// "storage.googleapis.com" service because this service is restricted in the
12324    /// API key:
12325    ///
12326    /// ```norust
12327    /// { "reason": "API_KEY_SERVICE_BLOCKED",
12328    ///   "domain": "googleapis.com",
12329    ///   "metadata": {
12330    ///     "consumer": "projects/123",
12331    ///     "service": "storage.googleapis.com"
12332    ///   }
12333    /// }
12334    /// ```
12335    ApiKeyServiceBlocked,
12336    /// The request is denied because it violates [API key HTTP
12337    /// restrictions](https://cloud.google.com/docs/authentication/api-keys#adding_http_restrictions).
12338    ///
12339    /// Example of an ErrorInfo when the consumer "projects/123" fails to call
12340    /// "storage.googleapis.com" service because the http referrer of the request
12341    /// violates API key HTTP restrictions:
12342    ///
12343    /// ```norust
12344    /// { "reason": "API_KEY_HTTP_REFERRER_BLOCKED",
12345    ///   "domain": "googleapis.com",
12346    ///   "metadata": {
12347    ///     "consumer": "projects/123",
12348    ///     "service": "storage.googleapis.com",
12349    ///   }
12350    /// }
12351    /// ```
12352    ApiKeyHttpReferrerBlocked,
12353    /// The request is denied because it violates [API key IP address
12354    /// restrictions](https://cloud.google.com/docs/authentication/api-keys#adding_application_restrictions).
12355    ///
12356    /// Example of an ErrorInfo when the consumer "projects/123" fails to call
12357    /// "storage.googleapis.com" service because the caller IP of the request
12358    /// violates API key IP address restrictions:
12359    ///
12360    /// ```norust
12361    /// { "reason": "API_KEY_IP_ADDRESS_BLOCKED",
12362    ///   "domain": "googleapis.com",
12363    ///   "metadata": {
12364    ///     "consumer": "projects/123",
12365    ///     "service": "storage.googleapis.com",
12366    ///   }
12367    /// }
12368    /// ```
12369    ApiKeyIpAddressBlocked,
12370    /// The request is denied because it violates [API key Android application
12371    /// restrictions](https://cloud.google.com/docs/authentication/api-keys#adding_application_restrictions).
12372    ///
12373    /// Example of an ErrorInfo when the consumer "projects/123" fails to call
12374    /// "storage.googleapis.com" service because the request from the Android apps
12375    /// violates the API key Android application restrictions:
12376    ///
12377    /// ```norust
12378    /// { "reason": "API_KEY_ANDROID_APP_BLOCKED",
12379    ///   "domain": "googleapis.com",
12380    ///   "metadata": {
12381    ///     "consumer": "projects/123",
12382    ///     "service": "storage.googleapis.com"
12383    ///   }
12384    /// }
12385    /// ```
12386    ApiKeyAndroidAppBlocked,
12387    /// The request is denied because it violates [API key iOS application
12388    /// restrictions](https://cloud.google.com/docs/authentication/api-keys#adding_application_restrictions).
12389    ///
12390    /// Example of an ErrorInfo when the consumer "projects/123" fails to call
12391    /// "storage.googleapis.com" service because the request from the iOS apps
12392    /// violates the API key iOS application restrictions:
12393    ///
12394    /// ```norust
12395    /// { "reason": "API_KEY_IOS_APP_BLOCKED",
12396    ///   "domain": "googleapis.com",
12397    ///   "metadata": {
12398    ///     "consumer": "projects/123",
12399    ///     "service": "storage.googleapis.com"
12400    ///   }
12401    /// }
12402    /// ```
12403    ApiKeyIosAppBlocked,
12404    /// The request is denied because there is not enough rate quota for the
12405    /// consumer.
12406    ///
12407    /// Example of an ErrorInfo when the consumer "projects/123" fails to contact
12408    /// "pubsub.googleapis.com" service because consumer's rate quota usage has
12409    /// reached the maximum value set for the quota limit
12410    /// "ReadsPerMinutePerProject" on the quota metric
12411    /// "pubsub.googleapis.com/read_requests":
12412    ///
12413    /// ```norust
12414    /// { "reason": "RATE_LIMIT_EXCEEDED",
12415    ///   "domain": "googleapis.com",
12416    ///   "metadata": {
12417    ///     "consumer": "projects/123",
12418    ///     "service": "pubsub.googleapis.com",
12419    ///     "quota_metric": "pubsub.googleapis.com/read_requests",
12420    ///     "quota_limit": "ReadsPerMinutePerProject"
12421    ///   }
12422    /// }
12423    /// ```
12424    ///
12425    /// Example of an ErrorInfo when the consumer "projects/123" checks quota on
12426    /// the service "dataflow.googleapis.com" and hits the organization quota
12427    /// limit "DefaultRequestsPerMinutePerOrganization" on the metric
12428    /// "dataflow.googleapis.com/default_requests".
12429    ///
12430    /// ```norust
12431    /// { "reason": "RATE_LIMIT_EXCEEDED",
12432    ///   "domain": "googleapis.com",
12433    ///   "metadata": {
12434    ///     "consumer": "projects/123",
12435    ///     "service": "dataflow.googleapis.com",
12436    ///     "quota_metric": "dataflow.googleapis.com/default_requests",
12437    ///     "quota_limit": "DefaultRequestsPerMinutePerOrganization"
12438    ///   }
12439    /// }
12440    /// ```
12441    RateLimitExceeded,
12442    /// The request is denied because there is not enough resource quota for the
12443    /// consumer.
12444    ///
12445    /// Example of an ErrorInfo when the consumer "projects/123" fails to contact
12446    /// "compute.googleapis.com" service because consumer's resource quota usage
12447    /// has reached the maximum value set for the quota limit "VMsPerProject"
12448    /// on the quota metric "compute.googleapis.com/vms":
12449    ///
12450    /// ```norust
12451    /// { "reason": "RESOURCE_QUOTA_EXCEEDED",
12452    ///   "domain": "googleapis.com",
12453    ///   "metadata": {
12454    ///     "consumer": "projects/123",
12455    ///     "service": "compute.googleapis.com",
12456    ///     "quota_metric": "compute.googleapis.com/vms",
12457    ///     "quota_limit": "VMsPerProject"
12458    ///   }
12459    /// }
12460    /// ```
12461    ///
12462    /// Example of an ErrorInfo when the consumer "projects/123" checks resource
12463    /// quota on the service "dataflow.googleapis.com" and hits the organization
12464    /// quota limit "jobs-per-organization" on the metric
12465    /// "dataflow.googleapis.com/job_count".
12466    ///
12467    /// ```norust
12468    /// { "reason": "RESOURCE_QUOTA_EXCEEDED",
12469    ///   "domain": "googleapis.com",
12470    ///   "metadata": {
12471    ///     "consumer": "projects/123",
12472    ///     "service": "dataflow.googleapis.com",
12473    ///     "quota_metric": "dataflow.googleapis.com/job_count",
12474    ///     "quota_limit": "jobs-per-organization"
12475    ///   }
12476    /// }
12477    /// ```
12478    ResourceQuotaExceeded,
12479    /// The request whose associated billing account address is in a tax restricted
12480    /// location, violates the local tax restrictions when creating resources in
12481    /// the restricted region.
12482    ///
12483    /// Example of an ErrorInfo when creating the Cloud Storage Bucket in the
12484    /// container "projects/123" under a tax restricted region
12485    /// "locations/asia-northeast3":
12486    ///
12487    /// ```norust
12488    /// { "reason": "LOCATION_TAX_POLICY_VIOLATED",
12489    ///   "domain": "googleapis.com",
12490    ///   "metadata": {
12491    ///     "consumer": "projects/123",
12492    ///     "service": "storage.googleapis.com",
12493    ///     "location": "locations/asia-northeast3"
12494    ///   }
12495    /// }
12496    /// ```
12497    ///
12498    /// This response indicates creating the Cloud Storage Bucket in
12499    /// "locations/asia-northeast3" violates the location tax restriction.
12500    LocationTaxPolicyViolated,
12501    /// The request is denied because the caller does not have required permission
12502    /// on the user project "projects/123" or the user project is invalid. For more
12503    /// information, check the [userProject System
12504    /// Parameters](https://cloud.google.com/apis/docs/system-parameters).
12505    ///
12506    /// Example of an ErrorInfo when the caller is calling Cloud Storage service
12507    /// with insufficient permissions on the user project:
12508    ///
12509    /// ```norust
12510    /// { "reason": "USER_PROJECT_DENIED",
12511    ///   "domain": "googleapis.com",
12512    ///   "metadata": {
12513    ///     "consumer": "projects/123",
12514    ///     "service": "storage.googleapis.com"
12515    ///   }
12516    /// }
12517    /// ```
12518    UserProjectDenied,
12519    /// The request is denied because the consumer "projects/123" is suspended due
12520    /// to Terms of Service(Tos) violations. Check [Project suspension
12521    /// guidelines](https://cloud.google.com/resource-manager/docs/project-suspension-guidelines)
12522    /// for more information.
12523    ///
12524    /// Example of an ErrorInfo when calling Cloud Storage service with the
12525    /// suspended consumer "projects/123":
12526    ///
12527    /// ```norust
12528    /// { "reason": "CONSUMER_SUSPENDED",
12529    ///   "domain": "googleapis.com",
12530    ///   "metadata": {
12531    ///     "consumer": "projects/123",
12532    ///     "service": "storage.googleapis.com"
12533    ///   }
12534    /// }
12535    /// ```
12536    ConsumerSuspended,
12537    /// The request is denied because the associated consumer is invalid. It may be
12538    /// in a bad format, cannot be found, or have been deleted.
12539    ///
12540    /// Example of an ErrorInfo when calling Cloud Storage service with the
12541    /// invalid consumer "projects/123":
12542    ///
12543    /// ```norust
12544    /// { "reason": "CONSUMER_INVALID",
12545    ///   "domain": "googleapis.com",
12546    ///   "metadata": {
12547    ///     "consumer": "projects/123",
12548    ///     "service": "storage.googleapis.com"
12549    ///   }
12550    /// }
12551    /// ```
12552    ConsumerInvalid,
12553    /// The request is denied because it violates [VPC Service
12554    /// Controls](https://cloud.google.com/vpc-service-controls/docs/overview).
12555    /// The 'uid' field is a random generated identifier that customer can use it
12556    /// to search the audit log for a request rejected by VPC Service Controls. For
12557    /// more information, please refer [VPC Service Controls
12558    /// Troubleshooting](https://cloud.google.com/vpc-service-controls/docs/troubleshooting#unique-id)
12559    ///
12560    /// Example of an ErrorInfo when the consumer "projects/123" fails to call
12561    /// Cloud Storage service because the request is prohibited by the VPC Service
12562    /// Controls.
12563    ///
12564    /// ```norust
12565    /// { "reason": "SECURITY_POLICY_VIOLATED",
12566    ///   "domain": "googleapis.com",
12567    ///   "metadata": {
12568    ///     "uid": "123456789abcde",
12569    ///     "consumer": "projects/123",
12570    ///     "service": "storage.googleapis.com"
12571    ///   }
12572    /// }
12573    /// ```
12574    SecurityPolicyViolated,
12575    /// The request is denied because the provided access token has expired.
12576    ///
12577    /// Example of an ErrorInfo when the request is calling Cloud Storage service
12578    /// with an expired access token:
12579    ///
12580    /// ```norust
12581    /// { "reason": "ACCESS_TOKEN_EXPIRED",
12582    ///   "domain": "googleapis.com",
12583    ///   "metadata": {
12584    ///     "service": "storage.googleapis.com",
12585    ///     "method": "google.storage.v1.Storage.GetObject"
12586    ///   }
12587    /// }
12588    /// ```
12589    AccessTokenExpired,
12590    /// The request is denied because the provided access token doesn't have at
12591    /// least one of the acceptable scopes required for the API. Please check
12592    /// [OAuth 2.0 Scopes for Google
12593    /// APIs](https://developers.google.com/identity/protocols/oauth2/scopes) for
12594    /// the list of the OAuth 2.0 scopes that you might need to request to access
12595    /// the API.
12596    ///
12597    /// Example of an ErrorInfo when the request is calling Cloud Storage service
12598    /// with an access token that is missing required scopes:
12599    ///
12600    /// ```norust
12601    /// { "reason": "ACCESS_TOKEN_SCOPE_INSUFFICIENT",
12602    ///   "domain": "googleapis.com",
12603    ///   "metadata": {
12604    ///     "service": "storage.googleapis.com",
12605    ///     "method": "google.storage.v1.Storage.GetObject"
12606    ///   }
12607    /// }
12608    /// ```
12609    AccessTokenScopeInsufficient,
12610    /// The request is denied because the account associated with the provided
12611    /// access token is in an invalid state, such as disabled or deleted.
12612    /// For more information, see <https://cloud.google.com/docs/authentication>.
12613    ///
12614    /// Warning: For privacy reasons, the server may not be able to disclose the
12615    /// email address for some accounts. The client MUST NOT depend on the
12616    /// availability of the `email` attribute.
12617    ///
12618    /// Example of an ErrorInfo when the request is to the Cloud Storage API with
12619    /// an access token that is associated with a disabled or deleted [service
12620    /// account](http://cloud/iam/docs/service-accounts):
12621    ///
12622    /// ```norust
12623    /// { "reason": "ACCOUNT_STATE_INVALID",
12624    ///   "domain": "googleapis.com",
12625    ///   "metadata": {
12626    ///     "service": "storage.googleapis.com",
12627    ///     "method": "google.storage.v1.Storage.GetObject",
12628    ///     "email": "user@123.iam.gserviceaccount.com"
12629    ///   }
12630    /// }
12631    /// ```
12632    AccountStateInvalid,
12633    /// The request is denied because the type of the provided access token is not
12634    /// supported by the API being called.
12635    ///
12636    /// Example of an ErrorInfo when the request is to the Cloud Storage API with
12637    /// an unsupported token type.
12638    ///
12639    /// ```norust
12640    /// { "reason": "ACCESS_TOKEN_TYPE_UNSUPPORTED",
12641    ///   "domain": "googleapis.com",
12642    ///   "metadata": {
12643    ///     "service": "storage.googleapis.com",
12644    ///     "method": "google.storage.v1.Storage.GetObject"
12645    ///   }
12646    /// }
12647    /// ```
12648    AccessTokenTypeUnsupported,
12649    /// The request is denied because the request doesn't have any authentication
12650    /// credentials. For more information regarding the supported authentication
12651    /// strategies for Google Cloud APIs, see
12652    /// <https://cloud.google.com/docs/authentication>.
12653    ///
12654    /// Example of an ErrorInfo when the request is to the Cloud Storage API
12655    /// without any authentication credentials.
12656    ///
12657    /// ```norust
12658    /// { "reason": "CREDENTIALS_MISSING",
12659    ///   "domain": "googleapis.com",
12660    ///   "metadata": {
12661    ///     "service": "storage.googleapis.com",
12662    ///     "method": "google.storage.v1.Storage.GetObject"
12663    ///   }
12664    /// }
12665    /// ```
12666    CredentialsMissing,
12667    /// The request is denied because the provided project owning the resource
12668    /// which acts as the [API
12669    /// consumer](https://cloud.google.com/apis/design/glossary#api_consumer) is
12670    /// invalid. It may be in a bad format or empty.
12671    ///
12672    /// Example of an ErrorInfo when the request is to the Cloud Functions API,
12673    /// but the offered resource project in the request in a bad format which can't
12674    /// perform the ListFunctions method.
12675    ///
12676    /// ```norust
12677    /// { "reason": "RESOURCE_PROJECT_INVALID",
12678    ///   "domain": "googleapis.com",
12679    ///   "metadata": {
12680    ///     "service": "cloudfunctions.googleapis.com",
12681    ///     "method":
12682    ///     "google.cloud.functions.v1.CloudFunctionsService.ListFunctions"
12683    ///   }
12684    /// }
12685    /// ```
12686    ResourceProjectInvalid,
12687    /// The request is denied because the provided session cookie is missing,
12688    /// invalid or failed to decode.
12689    ///
12690    /// Example of an ErrorInfo when the request is calling Cloud Storage service
12691    /// with a SID cookie which can't be decoded.
12692    ///
12693    /// ```norust
12694    /// { "reason": "SESSION_COOKIE_INVALID",
12695    ///   "domain": "googleapis.com",
12696    ///   "metadata": {
12697    ///     "service": "storage.googleapis.com",
12698    ///     "method": "google.storage.v1.Storage.GetObject",
12699    ///     "cookie": "SID"
12700    ///   }
12701    /// }
12702    /// ```
12703    SessionCookieInvalid,
12704    /// The request is denied because the user is from a Google Workspace customer
12705    /// that blocks their users from accessing a particular service.
12706    ///
12707    /// Example scenario: <https://support.google.com/a/answer/9197205?hl=en>
12708    ///
12709    /// Example of an ErrorInfo when access to Google Cloud Storage service is
12710    /// blocked by the Google Workspace administrator:
12711    ///
12712    /// ```norust
12713    /// { "reason": "USER_BLOCKED_BY_ADMIN",
12714    ///   "domain": "googleapis.com",
12715    ///   "metadata": {
12716    ///     "service": "storage.googleapis.com",
12717    ///     "method": "google.storage.v1.Storage.GetObject",
12718    ///   }
12719    /// }
12720    /// ```
12721    UserBlockedByAdmin,
12722    /// The request is denied because the resource service usage is restricted
12723    /// by administrators according to the organization policy constraint.
12724    /// For more information see
12725    /// <https://cloud.google.com/resource-manager/docs/organization-policy/restricting-services>.
12726    ///
12727    /// Example of an ErrorInfo when access to Google Cloud Storage service is
12728    /// restricted by Resource Usage Restriction policy:
12729    ///
12730    /// ```norust
12731    /// { "reason": "RESOURCE_USAGE_RESTRICTION_VIOLATED",
12732    ///   "domain": "googleapis.com",
12733    ///   "metadata": {
12734    ///     "consumer": "projects/project-123",
12735    ///     "service": "storage.googleapis.com"
12736    ///   }
12737    /// }
12738    /// ```
12739    ResourceUsageRestrictionViolated,
12740    /// Unimplemented. Do not use.
12741    ///
12742    /// The request is denied because it contains unsupported system parameters in
12743    /// URL query parameters or HTTP headers. For more information,
12744    /// see <https://cloud.google.com/apis/docs/system-parameters>
12745    ///
12746    /// Example of an ErrorInfo when access "pubsub.googleapis.com" service with
12747    /// a request header of "x-goog-user-ip":
12748    ///
12749    /// ```norust
12750    /// { "reason": "SYSTEM_PARAMETER_UNSUPPORTED",
12751    ///   "domain": "googleapis.com",
12752    ///   "metadata": {
12753    ///     "service": "pubsub.googleapis.com"
12754    ///     "parameter": "x-goog-user-ip"
12755    ///   }
12756    /// }
12757    /// ```
12758    SystemParameterUnsupported,
12759    /// The request is denied because it violates Org Restriction: the requested
12760    /// resource does not belong to allowed organizations specified in
12761    /// "X-Goog-Allowed-Resources" header.
12762    ///
12763    /// Example of an ErrorInfo when accessing a GCP resource that is restricted by
12764    /// Org Restriction for "pubsub.googleapis.com" service.
12765    ///
12766    /// {
12767    /// reason: "ORG_RESTRICTION_VIOLATION"
12768    /// domain: "googleapis.com"
12769    /// metadata {
12770    /// "consumer":"projects/123456"
12771    /// "service": "pubsub.googleapis.com"
12772    /// }
12773    /// }
12774    OrgRestrictionViolation,
12775    /// The request is denied because "X-Goog-Allowed-Resources" header is in a bad
12776    /// format.
12777    ///
12778    /// Example of an ErrorInfo when
12779    /// accessing "pubsub.googleapis.com" service with an invalid
12780    /// "X-Goog-Allowed-Resources" request header.
12781    ///
12782    /// {
12783    /// reason: "ORG_RESTRICTION_HEADER_INVALID"
12784    /// domain: "googleapis.com"
12785    /// metadata {
12786    /// "consumer":"projects/123456"
12787    /// "service": "pubsub.googleapis.com"
12788    /// }
12789    /// }
12790    OrgRestrictionHeaderInvalid,
12791    /// Unimplemented. Do not use.
12792    ///
12793    /// The request is calling a service that is not visible to the consumer.
12794    ///
12795    /// Example of an ErrorInfo when the consumer "projects/123" contacting
12796    /// "pubsub.googleapis.com" service which is not visible to the consumer.
12797    ///
12798    /// ```norust
12799    /// { "reason": "SERVICE_NOT_VISIBLE",
12800    ///   "domain": "googleapis.com",
12801    ///   "metadata": {
12802    ///     "consumer": "projects/123",
12803    ///     "service": "pubsub.googleapis.com"
12804    ///   }
12805    /// }
12806    /// ```
12807    ///
12808    /// This response indicates the "pubsub.googleapis.com" is not visible to
12809    /// "projects/123" (or it may not exist).
12810    ServiceNotVisible,
12811    /// The request is related to a project for which GCP access is suspended.
12812    ///
12813    /// Example of an ErrorInfo when the consumer "projects/123" fails to contact
12814    /// "pubsub.googleapis.com" service because GCP access is suspended:
12815    ///
12816    /// ```norust
12817    /// { "reason": "GCP_SUSPENDED",
12818    ///   "domain": "googleapis.com",
12819    ///   "metadata": {
12820    ///     "consumer": "projects/123",
12821    ///     "service": "pubsub.googleapis.com"
12822    ///   }
12823    /// }
12824    /// ```
12825    ///
12826    /// This response indicates the associated GCP account has been suspended.
12827    GcpSuspended,
12828    /// The request violates the location policies when creating resources in
12829    /// the restricted region.
12830    ///
12831    /// Example of an ErrorInfo when creating the Cloud Storage Bucket by
12832    /// "projects/123" for service storage.googleapis.com:
12833    ///
12834    /// ```norust
12835    /// { "reason": "LOCATION_POLICY_VIOLATED",
12836    ///   "domain": "googleapis.com",
12837    ///   "metadata": {
12838    ///     "consumer": "projects/123",
12839    ///     "service": "storage.googleapis.com",
12840    ///   }
12841    /// }
12842    /// ```
12843    ///
12844    /// This response indicates creating the Cloud Storage Bucket in
12845    /// "locations/asia-northeast3" violates at least one location policy.
12846    /// The troubleshooting guidance is provided in the Help links.
12847    LocationPolicyViolated,
12848    /// The request is denied because origin request header is missing.
12849    ///
12850    /// Example of an ErrorInfo when
12851    /// accessing "pubsub.googleapis.com" service with an empty "Origin" request
12852    /// header.
12853    ///
12854    /// {
12855    /// reason: "MISSING_ORIGIN"
12856    /// domain: "googleapis.com"
12857    /// metadata {
12858    /// "consumer":"projects/123456"
12859    /// "service": "pubsub.googleapis.com"
12860    /// }
12861    /// }
12862    MissingOrigin,
12863    /// The request is denied because the request contains more than one credential
12864    /// type that are individually acceptable, but not together. The customer
12865    /// should retry their request with only one set of credentials.
12866    ///
12867    /// Example of an ErrorInfo when
12868    /// accessing "pubsub.googleapis.com" service with overloaded credentials.
12869    ///
12870    /// {
12871    /// reason: "OVERLOADED_CREDENTIALS"
12872    /// domain: "googleapis.com"
12873    /// metadata {
12874    /// "consumer":"projects/123456"
12875    /// "service": "pubsub.googleapis.com"
12876    /// }
12877    /// }
12878    OverloadedCredentials,
12879    /// If set, the enum was initialized with an unknown value.
12880    ///
12881    /// Applications can examine the value using [ErrorReason::value] or
12882    /// [ErrorReason::name].
12883    UnknownValue(error_reason::UnknownValue),
12884}
12885
12886#[doc(hidden)]
12887pub mod error_reason {
12888    #[allow(unused_imports)]
12889    use super::*;
12890    #[derive(Clone, Debug, PartialEq)]
12891    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
12892}
12893
12894impl ErrorReason {
12895    /// Gets the enum value.
12896    ///
12897    /// Returns `None` if the enum contains an unknown value deserialized from
12898    /// the string representation of enums.
12899    pub fn value(&self) -> std::option::Option<i32> {
12900        match self {
12901            Self::Unspecified => std::option::Option::Some(0),
12902            Self::ServiceDisabled => std::option::Option::Some(1),
12903            Self::BillingDisabled => std::option::Option::Some(2),
12904            Self::ApiKeyInvalid => std::option::Option::Some(3),
12905            Self::ApiKeyServiceBlocked => std::option::Option::Some(4),
12906            Self::ApiKeyHttpReferrerBlocked => std::option::Option::Some(7),
12907            Self::ApiKeyIpAddressBlocked => std::option::Option::Some(8),
12908            Self::ApiKeyAndroidAppBlocked => std::option::Option::Some(9),
12909            Self::ApiKeyIosAppBlocked => std::option::Option::Some(13),
12910            Self::RateLimitExceeded => std::option::Option::Some(5),
12911            Self::ResourceQuotaExceeded => std::option::Option::Some(6),
12912            Self::LocationTaxPolicyViolated => std::option::Option::Some(10),
12913            Self::UserProjectDenied => std::option::Option::Some(11),
12914            Self::ConsumerSuspended => std::option::Option::Some(12),
12915            Self::ConsumerInvalid => std::option::Option::Some(14),
12916            Self::SecurityPolicyViolated => std::option::Option::Some(15),
12917            Self::AccessTokenExpired => std::option::Option::Some(16),
12918            Self::AccessTokenScopeInsufficient => std::option::Option::Some(17),
12919            Self::AccountStateInvalid => std::option::Option::Some(18),
12920            Self::AccessTokenTypeUnsupported => std::option::Option::Some(19),
12921            Self::CredentialsMissing => std::option::Option::Some(20),
12922            Self::ResourceProjectInvalid => std::option::Option::Some(21),
12923            Self::SessionCookieInvalid => std::option::Option::Some(23),
12924            Self::UserBlockedByAdmin => std::option::Option::Some(24),
12925            Self::ResourceUsageRestrictionViolated => std::option::Option::Some(25),
12926            Self::SystemParameterUnsupported => std::option::Option::Some(26),
12927            Self::OrgRestrictionViolation => std::option::Option::Some(27),
12928            Self::OrgRestrictionHeaderInvalid => std::option::Option::Some(28),
12929            Self::ServiceNotVisible => std::option::Option::Some(29),
12930            Self::GcpSuspended => std::option::Option::Some(30),
12931            Self::LocationPolicyViolated => std::option::Option::Some(31),
12932            Self::MissingOrigin => std::option::Option::Some(33),
12933            Self::OverloadedCredentials => std::option::Option::Some(34),
12934            Self::UnknownValue(u) => u.0.value(),
12935        }
12936    }
12937
12938    /// Gets the enum value as a string.
12939    ///
12940    /// Returns `None` if the enum contains an unknown value deserialized from
12941    /// the integer representation of enums.
12942    pub fn name(&self) -> std::option::Option<&str> {
12943        match self {
12944            Self::Unspecified => std::option::Option::Some("ERROR_REASON_UNSPECIFIED"),
12945            Self::ServiceDisabled => std::option::Option::Some("SERVICE_DISABLED"),
12946            Self::BillingDisabled => std::option::Option::Some("BILLING_DISABLED"),
12947            Self::ApiKeyInvalid => std::option::Option::Some("API_KEY_INVALID"),
12948            Self::ApiKeyServiceBlocked => std::option::Option::Some("API_KEY_SERVICE_BLOCKED"),
12949            Self::ApiKeyHttpReferrerBlocked => {
12950                std::option::Option::Some("API_KEY_HTTP_REFERRER_BLOCKED")
12951            }
12952            Self::ApiKeyIpAddressBlocked => std::option::Option::Some("API_KEY_IP_ADDRESS_BLOCKED"),
12953            Self::ApiKeyAndroidAppBlocked => {
12954                std::option::Option::Some("API_KEY_ANDROID_APP_BLOCKED")
12955            }
12956            Self::ApiKeyIosAppBlocked => std::option::Option::Some("API_KEY_IOS_APP_BLOCKED"),
12957            Self::RateLimitExceeded => std::option::Option::Some("RATE_LIMIT_EXCEEDED"),
12958            Self::ResourceQuotaExceeded => std::option::Option::Some("RESOURCE_QUOTA_EXCEEDED"),
12959            Self::LocationTaxPolicyViolated => {
12960                std::option::Option::Some("LOCATION_TAX_POLICY_VIOLATED")
12961            }
12962            Self::UserProjectDenied => std::option::Option::Some("USER_PROJECT_DENIED"),
12963            Self::ConsumerSuspended => std::option::Option::Some("CONSUMER_SUSPENDED"),
12964            Self::ConsumerInvalid => std::option::Option::Some("CONSUMER_INVALID"),
12965            Self::SecurityPolicyViolated => std::option::Option::Some("SECURITY_POLICY_VIOLATED"),
12966            Self::AccessTokenExpired => std::option::Option::Some("ACCESS_TOKEN_EXPIRED"),
12967            Self::AccessTokenScopeInsufficient => {
12968                std::option::Option::Some("ACCESS_TOKEN_SCOPE_INSUFFICIENT")
12969            }
12970            Self::AccountStateInvalid => std::option::Option::Some("ACCOUNT_STATE_INVALID"),
12971            Self::AccessTokenTypeUnsupported => {
12972                std::option::Option::Some("ACCESS_TOKEN_TYPE_UNSUPPORTED")
12973            }
12974            Self::CredentialsMissing => std::option::Option::Some("CREDENTIALS_MISSING"),
12975            Self::ResourceProjectInvalid => std::option::Option::Some("RESOURCE_PROJECT_INVALID"),
12976            Self::SessionCookieInvalid => std::option::Option::Some("SESSION_COOKIE_INVALID"),
12977            Self::UserBlockedByAdmin => std::option::Option::Some("USER_BLOCKED_BY_ADMIN"),
12978            Self::ResourceUsageRestrictionViolated => {
12979                std::option::Option::Some("RESOURCE_USAGE_RESTRICTION_VIOLATED")
12980            }
12981            Self::SystemParameterUnsupported => {
12982                std::option::Option::Some("SYSTEM_PARAMETER_UNSUPPORTED")
12983            }
12984            Self::OrgRestrictionViolation => std::option::Option::Some("ORG_RESTRICTION_VIOLATION"),
12985            Self::OrgRestrictionHeaderInvalid => {
12986                std::option::Option::Some("ORG_RESTRICTION_HEADER_INVALID")
12987            }
12988            Self::ServiceNotVisible => std::option::Option::Some("SERVICE_NOT_VISIBLE"),
12989            Self::GcpSuspended => std::option::Option::Some("GCP_SUSPENDED"),
12990            Self::LocationPolicyViolated => std::option::Option::Some("LOCATION_POLICY_VIOLATED"),
12991            Self::MissingOrigin => std::option::Option::Some("MISSING_ORIGIN"),
12992            Self::OverloadedCredentials => std::option::Option::Some("OVERLOADED_CREDENTIALS"),
12993            Self::UnknownValue(u) => u.0.name(),
12994        }
12995    }
12996}
12997
12998impl std::default::Default for ErrorReason {
12999    fn default() -> Self {
13000        use std::convert::From;
13001        Self::from(0)
13002    }
13003}
13004
13005impl std::fmt::Display for ErrorReason {
13006    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
13007        wkt::internal::display_enum(f, self.name(), self.value())
13008    }
13009}
13010
13011impl std::convert::From<i32> for ErrorReason {
13012    fn from(value: i32) -> Self {
13013        match value {
13014            0 => Self::Unspecified,
13015            1 => Self::ServiceDisabled,
13016            2 => Self::BillingDisabled,
13017            3 => Self::ApiKeyInvalid,
13018            4 => Self::ApiKeyServiceBlocked,
13019            5 => Self::RateLimitExceeded,
13020            6 => Self::ResourceQuotaExceeded,
13021            7 => Self::ApiKeyHttpReferrerBlocked,
13022            8 => Self::ApiKeyIpAddressBlocked,
13023            9 => Self::ApiKeyAndroidAppBlocked,
13024            10 => Self::LocationTaxPolicyViolated,
13025            11 => Self::UserProjectDenied,
13026            12 => Self::ConsumerSuspended,
13027            13 => Self::ApiKeyIosAppBlocked,
13028            14 => Self::ConsumerInvalid,
13029            15 => Self::SecurityPolicyViolated,
13030            16 => Self::AccessTokenExpired,
13031            17 => Self::AccessTokenScopeInsufficient,
13032            18 => Self::AccountStateInvalid,
13033            19 => Self::AccessTokenTypeUnsupported,
13034            20 => Self::CredentialsMissing,
13035            21 => Self::ResourceProjectInvalid,
13036            23 => Self::SessionCookieInvalid,
13037            24 => Self::UserBlockedByAdmin,
13038            25 => Self::ResourceUsageRestrictionViolated,
13039            26 => Self::SystemParameterUnsupported,
13040            27 => Self::OrgRestrictionViolation,
13041            28 => Self::OrgRestrictionHeaderInvalid,
13042            29 => Self::ServiceNotVisible,
13043            30 => Self::GcpSuspended,
13044            31 => Self::LocationPolicyViolated,
13045            33 => Self::MissingOrigin,
13046            34 => Self::OverloadedCredentials,
13047            _ => Self::UnknownValue(error_reason::UnknownValue(
13048                wkt::internal::UnknownEnumValue::Integer(value),
13049            )),
13050        }
13051    }
13052}
13053
13054impl std::convert::From<&str> for ErrorReason {
13055    fn from(value: &str) -> Self {
13056        use std::string::ToString;
13057        match value {
13058            "ERROR_REASON_UNSPECIFIED" => Self::Unspecified,
13059            "SERVICE_DISABLED" => Self::ServiceDisabled,
13060            "BILLING_DISABLED" => Self::BillingDisabled,
13061            "API_KEY_INVALID" => Self::ApiKeyInvalid,
13062            "API_KEY_SERVICE_BLOCKED" => Self::ApiKeyServiceBlocked,
13063            "API_KEY_HTTP_REFERRER_BLOCKED" => Self::ApiKeyHttpReferrerBlocked,
13064            "API_KEY_IP_ADDRESS_BLOCKED" => Self::ApiKeyIpAddressBlocked,
13065            "API_KEY_ANDROID_APP_BLOCKED" => Self::ApiKeyAndroidAppBlocked,
13066            "API_KEY_IOS_APP_BLOCKED" => Self::ApiKeyIosAppBlocked,
13067            "RATE_LIMIT_EXCEEDED" => Self::RateLimitExceeded,
13068            "RESOURCE_QUOTA_EXCEEDED" => Self::ResourceQuotaExceeded,
13069            "LOCATION_TAX_POLICY_VIOLATED" => Self::LocationTaxPolicyViolated,
13070            "USER_PROJECT_DENIED" => Self::UserProjectDenied,
13071            "CONSUMER_SUSPENDED" => Self::ConsumerSuspended,
13072            "CONSUMER_INVALID" => Self::ConsumerInvalid,
13073            "SECURITY_POLICY_VIOLATED" => Self::SecurityPolicyViolated,
13074            "ACCESS_TOKEN_EXPIRED" => Self::AccessTokenExpired,
13075            "ACCESS_TOKEN_SCOPE_INSUFFICIENT" => Self::AccessTokenScopeInsufficient,
13076            "ACCOUNT_STATE_INVALID" => Self::AccountStateInvalid,
13077            "ACCESS_TOKEN_TYPE_UNSUPPORTED" => Self::AccessTokenTypeUnsupported,
13078            "CREDENTIALS_MISSING" => Self::CredentialsMissing,
13079            "RESOURCE_PROJECT_INVALID" => Self::ResourceProjectInvalid,
13080            "SESSION_COOKIE_INVALID" => Self::SessionCookieInvalid,
13081            "USER_BLOCKED_BY_ADMIN" => Self::UserBlockedByAdmin,
13082            "RESOURCE_USAGE_RESTRICTION_VIOLATED" => Self::ResourceUsageRestrictionViolated,
13083            "SYSTEM_PARAMETER_UNSUPPORTED" => Self::SystemParameterUnsupported,
13084            "ORG_RESTRICTION_VIOLATION" => Self::OrgRestrictionViolation,
13085            "ORG_RESTRICTION_HEADER_INVALID" => Self::OrgRestrictionHeaderInvalid,
13086            "SERVICE_NOT_VISIBLE" => Self::ServiceNotVisible,
13087            "GCP_SUSPENDED" => Self::GcpSuspended,
13088            "LOCATION_POLICY_VIOLATED" => Self::LocationPolicyViolated,
13089            "MISSING_ORIGIN" => Self::MissingOrigin,
13090            "OVERLOADED_CREDENTIALS" => Self::OverloadedCredentials,
13091            _ => Self::UnknownValue(error_reason::UnknownValue(
13092                wkt::internal::UnknownEnumValue::String(value.to_string()),
13093            )),
13094        }
13095    }
13096}
13097
13098impl serde::ser::Serialize for ErrorReason {
13099    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13100    where
13101        S: serde::Serializer,
13102    {
13103        match self {
13104            Self::Unspecified => serializer.serialize_i32(0),
13105            Self::ServiceDisabled => serializer.serialize_i32(1),
13106            Self::BillingDisabled => serializer.serialize_i32(2),
13107            Self::ApiKeyInvalid => serializer.serialize_i32(3),
13108            Self::ApiKeyServiceBlocked => serializer.serialize_i32(4),
13109            Self::ApiKeyHttpReferrerBlocked => serializer.serialize_i32(7),
13110            Self::ApiKeyIpAddressBlocked => serializer.serialize_i32(8),
13111            Self::ApiKeyAndroidAppBlocked => serializer.serialize_i32(9),
13112            Self::ApiKeyIosAppBlocked => serializer.serialize_i32(13),
13113            Self::RateLimitExceeded => serializer.serialize_i32(5),
13114            Self::ResourceQuotaExceeded => serializer.serialize_i32(6),
13115            Self::LocationTaxPolicyViolated => serializer.serialize_i32(10),
13116            Self::UserProjectDenied => serializer.serialize_i32(11),
13117            Self::ConsumerSuspended => serializer.serialize_i32(12),
13118            Self::ConsumerInvalid => serializer.serialize_i32(14),
13119            Self::SecurityPolicyViolated => serializer.serialize_i32(15),
13120            Self::AccessTokenExpired => serializer.serialize_i32(16),
13121            Self::AccessTokenScopeInsufficient => serializer.serialize_i32(17),
13122            Self::AccountStateInvalid => serializer.serialize_i32(18),
13123            Self::AccessTokenTypeUnsupported => serializer.serialize_i32(19),
13124            Self::CredentialsMissing => serializer.serialize_i32(20),
13125            Self::ResourceProjectInvalid => serializer.serialize_i32(21),
13126            Self::SessionCookieInvalid => serializer.serialize_i32(23),
13127            Self::UserBlockedByAdmin => serializer.serialize_i32(24),
13128            Self::ResourceUsageRestrictionViolated => serializer.serialize_i32(25),
13129            Self::SystemParameterUnsupported => serializer.serialize_i32(26),
13130            Self::OrgRestrictionViolation => serializer.serialize_i32(27),
13131            Self::OrgRestrictionHeaderInvalid => serializer.serialize_i32(28),
13132            Self::ServiceNotVisible => serializer.serialize_i32(29),
13133            Self::GcpSuspended => serializer.serialize_i32(30),
13134            Self::LocationPolicyViolated => serializer.serialize_i32(31),
13135            Self::MissingOrigin => serializer.serialize_i32(33),
13136            Self::OverloadedCredentials => serializer.serialize_i32(34),
13137            Self::UnknownValue(u) => u.0.serialize(serializer),
13138        }
13139    }
13140}
13141
13142impl<'de> serde::de::Deserialize<'de> for ErrorReason {
13143    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13144    where
13145        D: serde::Deserializer<'de>,
13146    {
13147        deserializer.deserialize_any(wkt::internal::EnumVisitor::<ErrorReason>::new(
13148            ".google.api.ErrorReason",
13149        ))
13150    }
13151}
13152
13153/// An indicator of the behavior of a given field (for example, that a field
13154/// is required in requests, or given as output but ignored as input).
13155/// This **does not** change the behavior in protocol buffers itself; it only
13156/// denotes the behavior and may affect how API tooling handles the field.
13157///
13158/// Note: This enum **may** receive new values in the future.
13159///
13160/// # Working with unknown values
13161///
13162/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
13163/// additional enum variants at any time. Adding new variants is not considered
13164/// a breaking change. Applications should write their code in anticipation of:
13165///
13166/// - New values appearing in future releases of the client library, **and**
13167/// - New values received dynamically, without application changes.
13168///
13169/// Please consult the [Working with enums] section in the user guide for some
13170/// guidelines.
13171///
13172/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
13173#[derive(Clone, Debug, PartialEq)]
13174#[non_exhaustive]
13175pub enum FieldBehavior {
13176    /// Conventional default for enums. Do not use this.
13177    Unspecified,
13178    /// Specifically denotes a field as optional.
13179    /// While all fields in protocol buffers are optional, this may be specified
13180    /// for emphasis if appropriate.
13181    Optional,
13182    /// Denotes a field as required.
13183    /// This indicates that the field **must** be provided as part of the request,
13184    /// and failure to do so will cause an error (usually `INVALID_ARGUMENT`).
13185    Required,
13186    /// Denotes a field as output only.
13187    /// This indicates that the field is provided in responses, but including the
13188    /// field in a request does nothing (the server *must* ignore it and
13189    /// *must not* throw an error as a result of the field's presence).
13190    OutputOnly,
13191    /// Denotes a field as input only.
13192    /// This indicates that the field is provided in requests, and the
13193    /// corresponding field is not included in output.
13194    InputOnly,
13195    /// Denotes a field as immutable.
13196    /// This indicates that the field may be set once in a request to create a
13197    /// resource, but may not be changed thereafter.
13198    Immutable,
13199    /// Denotes that a (repeated) field is an unordered list.
13200    /// This indicates that the service may provide the elements of the list
13201    /// in any arbitrary  order, rather than the order the user originally
13202    /// provided. Additionally, the list's order may or may not be stable.
13203    UnorderedList,
13204    /// Denotes that this field returns a non-empty default value if not set.
13205    /// This indicates that if the user provides the empty value in a request,
13206    /// a non-empty value will be returned. The user will not be aware of what
13207    /// non-empty value to expect.
13208    NonEmptyDefault,
13209    /// Denotes that the field in a resource (a message annotated with
13210    /// google.api.resource) is used in the resource name to uniquely identify the
13211    /// resource. For AIP-compliant APIs, this should only be applied to the
13212    /// `name` field on the resource.
13213    ///
13214    /// This behavior should not be applied to references to other resources within
13215    /// the message.
13216    ///
13217    /// The identifier field of resources often have different field behavior
13218    /// depending on the request it is embedded in (e.g. for Create methods name
13219    /// is optional and unused, while for Update methods it is required). Instead
13220    /// of method-specific annotations, only `IDENTIFIER` is required.
13221    Identifier,
13222    /// If set, the enum was initialized with an unknown value.
13223    ///
13224    /// Applications can examine the value using [FieldBehavior::value] or
13225    /// [FieldBehavior::name].
13226    UnknownValue(field_behavior::UnknownValue),
13227}
13228
13229#[doc(hidden)]
13230pub mod field_behavior {
13231    #[allow(unused_imports)]
13232    use super::*;
13233    #[derive(Clone, Debug, PartialEq)]
13234    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13235}
13236
13237impl FieldBehavior {
13238    /// Gets the enum value.
13239    ///
13240    /// Returns `None` if the enum contains an unknown value deserialized from
13241    /// the string representation of enums.
13242    pub fn value(&self) -> std::option::Option<i32> {
13243        match self {
13244            Self::Unspecified => std::option::Option::Some(0),
13245            Self::Optional => std::option::Option::Some(1),
13246            Self::Required => std::option::Option::Some(2),
13247            Self::OutputOnly => std::option::Option::Some(3),
13248            Self::InputOnly => std::option::Option::Some(4),
13249            Self::Immutable => std::option::Option::Some(5),
13250            Self::UnorderedList => std::option::Option::Some(6),
13251            Self::NonEmptyDefault => std::option::Option::Some(7),
13252            Self::Identifier => std::option::Option::Some(8),
13253            Self::UnknownValue(u) => u.0.value(),
13254        }
13255    }
13256
13257    /// Gets the enum value as a string.
13258    ///
13259    /// Returns `None` if the enum contains an unknown value deserialized from
13260    /// the integer representation of enums.
13261    pub fn name(&self) -> std::option::Option<&str> {
13262        match self {
13263            Self::Unspecified => std::option::Option::Some("FIELD_BEHAVIOR_UNSPECIFIED"),
13264            Self::Optional => std::option::Option::Some("OPTIONAL"),
13265            Self::Required => std::option::Option::Some("REQUIRED"),
13266            Self::OutputOnly => std::option::Option::Some("OUTPUT_ONLY"),
13267            Self::InputOnly => std::option::Option::Some("INPUT_ONLY"),
13268            Self::Immutable => std::option::Option::Some("IMMUTABLE"),
13269            Self::UnorderedList => std::option::Option::Some("UNORDERED_LIST"),
13270            Self::NonEmptyDefault => std::option::Option::Some("NON_EMPTY_DEFAULT"),
13271            Self::Identifier => std::option::Option::Some("IDENTIFIER"),
13272            Self::UnknownValue(u) => u.0.name(),
13273        }
13274    }
13275}
13276
13277impl std::default::Default for FieldBehavior {
13278    fn default() -> Self {
13279        use std::convert::From;
13280        Self::from(0)
13281    }
13282}
13283
13284impl std::fmt::Display for FieldBehavior {
13285    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
13286        wkt::internal::display_enum(f, self.name(), self.value())
13287    }
13288}
13289
13290impl std::convert::From<i32> for FieldBehavior {
13291    fn from(value: i32) -> Self {
13292        match value {
13293            0 => Self::Unspecified,
13294            1 => Self::Optional,
13295            2 => Self::Required,
13296            3 => Self::OutputOnly,
13297            4 => Self::InputOnly,
13298            5 => Self::Immutable,
13299            6 => Self::UnorderedList,
13300            7 => Self::NonEmptyDefault,
13301            8 => Self::Identifier,
13302            _ => Self::UnknownValue(field_behavior::UnknownValue(
13303                wkt::internal::UnknownEnumValue::Integer(value),
13304            )),
13305        }
13306    }
13307}
13308
13309impl std::convert::From<&str> for FieldBehavior {
13310    fn from(value: &str) -> Self {
13311        use std::string::ToString;
13312        match value {
13313            "FIELD_BEHAVIOR_UNSPECIFIED" => Self::Unspecified,
13314            "OPTIONAL" => Self::Optional,
13315            "REQUIRED" => Self::Required,
13316            "OUTPUT_ONLY" => Self::OutputOnly,
13317            "INPUT_ONLY" => Self::InputOnly,
13318            "IMMUTABLE" => Self::Immutable,
13319            "UNORDERED_LIST" => Self::UnorderedList,
13320            "NON_EMPTY_DEFAULT" => Self::NonEmptyDefault,
13321            "IDENTIFIER" => Self::Identifier,
13322            _ => Self::UnknownValue(field_behavior::UnknownValue(
13323                wkt::internal::UnknownEnumValue::String(value.to_string()),
13324            )),
13325        }
13326    }
13327}
13328
13329impl serde::ser::Serialize for FieldBehavior {
13330    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13331    where
13332        S: serde::Serializer,
13333    {
13334        match self {
13335            Self::Unspecified => serializer.serialize_i32(0),
13336            Self::Optional => serializer.serialize_i32(1),
13337            Self::Required => serializer.serialize_i32(2),
13338            Self::OutputOnly => serializer.serialize_i32(3),
13339            Self::InputOnly => serializer.serialize_i32(4),
13340            Self::Immutable => serializer.serialize_i32(5),
13341            Self::UnorderedList => serializer.serialize_i32(6),
13342            Self::NonEmptyDefault => serializer.serialize_i32(7),
13343            Self::Identifier => serializer.serialize_i32(8),
13344            Self::UnknownValue(u) => u.0.serialize(serializer),
13345        }
13346    }
13347}
13348
13349impl<'de> serde::de::Deserialize<'de> for FieldBehavior {
13350    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13351    where
13352        D: serde::Deserializer<'de>,
13353    {
13354        deserializer.deserialize_any(wkt::internal::EnumVisitor::<FieldBehavior>::new(
13355            ".google.api.FieldBehavior",
13356        ))
13357    }
13358}
13359
13360/// The launch stage as defined by [Google Cloud Platform
13361/// Launch Stages](https://cloud.google.com/terms/launch-stages).
13362///
13363/// # Working with unknown values
13364///
13365/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
13366/// additional enum variants at any time. Adding new variants is not considered
13367/// a breaking change. Applications should write their code in anticipation of:
13368///
13369/// - New values appearing in future releases of the client library, **and**
13370/// - New values received dynamically, without application changes.
13371///
13372/// Please consult the [Working with enums] section in the user guide for some
13373/// guidelines.
13374///
13375/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
13376#[derive(Clone, Debug, PartialEq)]
13377#[non_exhaustive]
13378pub enum LaunchStage {
13379    /// Do not use this default value.
13380    Unspecified,
13381    /// The feature is not yet implemented. Users can not use it.
13382    Unimplemented,
13383    /// Prelaunch features are hidden from users and are only visible internally.
13384    Prelaunch,
13385    /// Early Access features are limited to a closed group of testers. To use
13386    /// these features, you must sign up in advance and sign a Trusted Tester
13387    /// agreement (which includes confidentiality provisions). These features may
13388    /// be unstable, changed in backward-incompatible ways, and are not
13389    /// guaranteed to be released.
13390    EarlyAccess,
13391    /// Alpha is a limited availability test for releases before they are cleared
13392    /// for widespread use. By Alpha, all significant design issues are resolved
13393    /// and we are in the process of verifying functionality. Alpha customers
13394    /// need to apply for access, agree to applicable terms, and have their
13395    /// projects allowlisted. Alpha releases don't have to be feature complete,
13396    /// no SLAs are provided, and there are no technical support obligations, but
13397    /// they will be far enough along that customers can actually use them in
13398    /// test environments or for limited-use tests -- just like they would in
13399    /// normal production cases.
13400    Alpha,
13401    /// Beta is the point at which we are ready to open a release for any
13402    /// customer to use. There are no SLA or technical support obligations in a
13403    /// Beta release. Products will be complete from a feature perspective, but
13404    /// may have some open outstanding issues. Beta releases are suitable for
13405    /// limited production use cases.
13406    Beta,
13407    /// GA features are open to all developers and are considered stable and
13408    /// fully qualified for production use.
13409    Ga,
13410    /// Deprecated features are scheduled to be shut down and removed. For more
13411    /// information, see the "Deprecation Policy" section of our [Terms of
13412    /// Service](https://cloud.google.com/terms/)
13413    /// and the [Google Cloud Platform Subject to the Deprecation
13414    /// Policy](https://cloud.google.com/terms/deprecation) documentation.
13415    Deprecated,
13416    /// If set, the enum was initialized with an unknown value.
13417    ///
13418    /// Applications can examine the value using [LaunchStage::value] or
13419    /// [LaunchStage::name].
13420    UnknownValue(launch_stage::UnknownValue),
13421}
13422
13423#[doc(hidden)]
13424pub mod launch_stage {
13425    #[allow(unused_imports)]
13426    use super::*;
13427    #[derive(Clone, Debug, PartialEq)]
13428    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13429}
13430
13431impl LaunchStage {
13432    /// Gets the enum value.
13433    ///
13434    /// Returns `None` if the enum contains an unknown value deserialized from
13435    /// the string representation of enums.
13436    pub fn value(&self) -> std::option::Option<i32> {
13437        match self {
13438            Self::Unspecified => std::option::Option::Some(0),
13439            Self::Unimplemented => std::option::Option::Some(6),
13440            Self::Prelaunch => std::option::Option::Some(7),
13441            Self::EarlyAccess => std::option::Option::Some(1),
13442            Self::Alpha => std::option::Option::Some(2),
13443            Self::Beta => std::option::Option::Some(3),
13444            Self::Ga => std::option::Option::Some(4),
13445            Self::Deprecated => std::option::Option::Some(5),
13446            Self::UnknownValue(u) => u.0.value(),
13447        }
13448    }
13449
13450    /// Gets the enum value as a string.
13451    ///
13452    /// Returns `None` if the enum contains an unknown value deserialized from
13453    /// the integer representation of enums.
13454    pub fn name(&self) -> std::option::Option<&str> {
13455        match self {
13456            Self::Unspecified => std::option::Option::Some("LAUNCH_STAGE_UNSPECIFIED"),
13457            Self::Unimplemented => std::option::Option::Some("UNIMPLEMENTED"),
13458            Self::Prelaunch => std::option::Option::Some("PRELAUNCH"),
13459            Self::EarlyAccess => std::option::Option::Some("EARLY_ACCESS"),
13460            Self::Alpha => std::option::Option::Some("ALPHA"),
13461            Self::Beta => std::option::Option::Some("BETA"),
13462            Self::Ga => std::option::Option::Some("GA"),
13463            Self::Deprecated => std::option::Option::Some("DEPRECATED"),
13464            Self::UnknownValue(u) => u.0.name(),
13465        }
13466    }
13467}
13468
13469impl std::default::Default for LaunchStage {
13470    fn default() -> Self {
13471        use std::convert::From;
13472        Self::from(0)
13473    }
13474}
13475
13476impl std::fmt::Display for LaunchStage {
13477    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
13478        wkt::internal::display_enum(f, self.name(), self.value())
13479    }
13480}
13481
13482impl std::convert::From<i32> for LaunchStage {
13483    fn from(value: i32) -> Self {
13484        match value {
13485            0 => Self::Unspecified,
13486            1 => Self::EarlyAccess,
13487            2 => Self::Alpha,
13488            3 => Self::Beta,
13489            4 => Self::Ga,
13490            5 => Self::Deprecated,
13491            6 => Self::Unimplemented,
13492            7 => Self::Prelaunch,
13493            _ => Self::UnknownValue(launch_stage::UnknownValue(
13494                wkt::internal::UnknownEnumValue::Integer(value),
13495            )),
13496        }
13497    }
13498}
13499
13500impl std::convert::From<&str> for LaunchStage {
13501    fn from(value: &str) -> Self {
13502        use std::string::ToString;
13503        match value {
13504            "LAUNCH_STAGE_UNSPECIFIED" => Self::Unspecified,
13505            "UNIMPLEMENTED" => Self::Unimplemented,
13506            "PRELAUNCH" => Self::Prelaunch,
13507            "EARLY_ACCESS" => Self::EarlyAccess,
13508            "ALPHA" => Self::Alpha,
13509            "BETA" => Self::Beta,
13510            "GA" => Self::Ga,
13511            "DEPRECATED" => Self::Deprecated,
13512            _ => Self::UnknownValue(launch_stage::UnknownValue(
13513                wkt::internal::UnknownEnumValue::String(value.to_string()),
13514            )),
13515        }
13516    }
13517}
13518
13519impl serde::ser::Serialize for LaunchStage {
13520    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13521    where
13522        S: serde::Serializer,
13523    {
13524        match self {
13525            Self::Unspecified => serializer.serialize_i32(0),
13526            Self::Unimplemented => serializer.serialize_i32(6),
13527            Self::Prelaunch => serializer.serialize_i32(7),
13528            Self::EarlyAccess => serializer.serialize_i32(1),
13529            Self::Alpha => serializer.serialize_i32(2),
13530            Self::Beta => serializer.serialize_i32(3),
13531            Self::Ga => serializer.serialize_i32(4),
13532            Self::Deprecated => serializer.serialize_i32(5),
13533            Self::UnknownValue(u) => u.0.serialize(serializer),
13534        }
13535    }
13536}
13537
13538impl<'de> serde::de::Deserialize<'de> for LaunchStage {
13539    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13540    where
13541        D: serde::Deserializer<'de>,
13542    {
13543        deserializer.deserialize_any(wkt::internal::EnumVisitor::<LaunchStage>::new(
13544            ".google.api.LaunchStage",
13545        ))
13546    }
13547}