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    pub fn set_rules<T, V>(mut self, v: T) -> Self
72    where
73        T: std::iter::IntoIterator<Item = V>,
74        V: std::convert::Into<crate::model::AuthenticationRule>,
75    {
76        use std::iter::Iterator;
77        self.rules = v.into_iter().map(|i| i.into()).collect();
78        self
79    }
80
81    /// Sets the value of [providers][crate::model::Authentication::providers].
82    pub fn set_providers<T, V>(mut self, v: T) -> Self
83    where
84        T: std::iter::IntoIterator<Item = V>,
85        V: std::convert::Into<crate::model::AuthProvider>,
86    {
87        use std::iter::Iterator;
88        self.providers = v.into_iter().map(|i| i.into()).collect();
89        self
90    }
91}
92
93impl wkt::message::Message for Authentication {
94    fn typename() -> &'static str {
95        "type.googleapis.com/google.api.Authentication"
96    }
97}
98
99/// Authentication rules for the service.
100///
101/// By default, if a method has any authentication requirements, every request
102/// must include a valid credential matching one of the requirements.
103/// It's an error to include more than one kind of credential in a single
104/// request.
105///
106/// If a method doesn't have any auth requirements, request credentials will be
107/// ignored.
108#[derive(Clone, Default, PartialEq)]
109#[non_exhaustive]
110pub struct AuthenticationRule {
111    /// Selects the methods to which this rule applies.
112    ///
113    /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
114    /// details.
115    ///
116    /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
117    pub selector: std::string::String,
118
119    /// The requirements for OAuth credentials.
120    pub oauth: std::option::Option<crate::model::OAuthRequirements>,
121
122    /// If true, the service accepts API keys without any other credential.
123    /// This flag only applies to HTTP and gRPC requests.
124    pub allow_without_credential: bool,
125
126    /// Requirements for additional authentication providers.
127    pub requirements: std::vec::Vec<crate::model::AuthRequirement>,
128
129    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
130}
131
132impl AuthenticationRule {
133    pub fn new() -> Self {
134        std::default::Default::default()
135    }
136
137    /// Sets the value of [selector][crate::model::AuthenticationRule::selector].
138    pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
139        self.selector = v.into();
140        self
141    }
142
143    /// Sets the value of [oauth][crate::model::AuthenticationRule::oauth].
144    pub fn set_oauth<T>(mut self, v: T) -> Self
145    where
146        T: std::convert::Into<crate::model::OAuthRequirements>,
147    {
148        self.oauth = std::option::Option::Some(v.into());
149        self
150    }
151
152    /// Sets or clears the value of [oauth][crate::model::AuthenticationRule::oauth].
153    pub fn set_or_clear_oauth<T>(mut self, v: std::option::Option<T>) -> Self
154    where
155        T: std::convert::Into<crate::model::OAuthRequirements>,
156    {
157        self.oauth = v.map(|x| x.into());
158        self
159    }
160
161    /// Sets the value of [allow_without_credential][crate::model::AuthenticationRule::allow_without_credential].
162    pub fn set_allow_without_credential<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
163        self.allow_without_credential = v.into();
164        self
165    }
166
167    /// Sets the value of [requirements][crate::model::AuthenticationRule::requirements].
168    pub fn set_requirements<T, V>(mut self, v: T) -> Self
169    where
170        T: std::iter::IntoIterator<Item = V>,
171        V: std::convert::Into<crate::model::AuthRequirement>,
172    {
173        use std::iter::Iterator;
174        self.requirements = v.into_iter().map(|i| i.into()).collect();
175        self
176    }
177}
178
179impl wkt::message::Message for AuthenticationRule {
180    fn typename() -> &'static str {
181        "type.googleapis.com/google.api.AuthenticationRule"
182    }
183}
184
185/// Specifies a location to extract JWT from an API request.
186#[derive(Clone, Default, PartialEq)]
187#[non_exhaustive]
188pub struct JwtLocation {
189    /// The value prefix. The value format is "value_prefix{token}"
190    /// Only applies to "in" header type. Must be empty for "in" query type.
191    /// If not empty, the header value has to match (case sensitive) this prefix.
192    /// If not matched, JWT will not be extracted. If matched, JWT will be
193    /// extracted after the prefix is removed.
194    ///
195    /// For example, for "Authorization: Bearer {JWT}",
196    /// value_prefix="Bearer " with a space at the end.
197    pub value_prefix: std::string::String,
198
199    pub r#in: std::option::Option<crate::model::jwt_location::In>,
200
201    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
202}
203
204impl JwtLocation {
205    pub fn new() -> Self {
206        std::default::Default::default()
207    }
208
209    /// Sets the value of [value_prefix][crate::model::JwtLocation::value_prefix].
210    pub fn set_value_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
211        self.value_prefix = v.into();
212        self
213    }
214
215    /// Sets the value of [r#in][crate::model::JwtLocation::in].
216    ///
217    /// Note that all the setters affecting `r#in` are mutually
218    /// exclusive.
219    pub fn set_in<T: std::convert::Into<std::option::Option<crate::model::jwt_location::In>>>(
220        mut self,
221        v: T,
222    ) -> Self {
223        self.r#in = v.into();
224        self
225    }
226
227    /// The value of [r#in][crate::model::JwtLocation::r#in]
228    /// if it holds a `Header`, `None` if the field is not set or
229    /// holds a different branch.
230    pub fn header(&self) -> std::option::Option<&std::string::String> {
231        #[allow(unreachable_patterns)]
232        self.r#in.as_ref().and_then(|v| match v {
233            crate::model::jwt_location::In::Header(v) => std::option::Option::Some(v),
234            _ => std::option::Option::None,
235        })
236    }
237
238    /// Sets the value of [r#in][crate::model::JwtLocation::r#in]
239    /// to hold a `Header`.
240    ///
241    /// Note that all the setters affecting `r#in` are
242    /// mutually exclusive.
243    pub fn set_header<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
244        self.r#in = std::option::Option::Some(crate::model::jwt_location::In::Header(v.into()));
245        self
246    }
247
248    /// The value of [r#in][crate::model::JwtLocation::r#in]
249    /// if it holds a `Query`, `None` if the field is not set or
250    /// holds a different branch.
251    pub fn query(&self) -> std::option::Option<&std::string::String> {
252        #[allow(unreachable_patterns)]
253        self.r#in.as_ref().and_then(|v| match v {
254            crate::model::jwt_location::In::Query(v) => std::option::Option::Some(v),
255            _ => std::option::Option::None,
256        })
257    }
258
259    /// Sets the value of [r#in][crate::model::JwtLocation::r#in]
260    /// to hold a `Query`.
261    ///
262    /// Note that all the setters affecting `r#in` are
263    /// mutually exclusive.
264    pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
265        self.r#in = std::option::Option::Some(crate::model::jwt_location::In::Query(v.into()));
266        self
267    }
268
269    /// The value of [r#in][crate::model::JwtLocation::r#in]
270    /// if it holds a `Cookie`, `None` if the field is not set or
271    /// holds a different branch.
272    pub fn cookie(&self) -> std::option::Option<&std::string::String> {
273        #[allow(unreachable_patterns)]
274        self.r#in.as_ref().and_then(|v| match v {
275            crate::model::jwt_location::In::Cookie(v) => std::option::Option::Some(v),
276            _ => std::option::Option::None,
277        })
278    }
279
280    /// Sets the value of [r#in][crate::model::JwtLocation::r#in]
281    /// to hold a `Cookie`.
282    ///
283    /// Note that all the setters affecting `r#in` are
284    /// mutually exclusive.
285    pub fn set_cookie<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
286        self.r#in = std::option::Option::Some(crate::model::jwt_location::In::Cookie(v.into()));
287        self
288    }
289}
290
291impl wkt::message::Message for JwtLocation {
292    fn typename() -> &'static str {
293        "type.googleapis.com/google.api.JwtLocation"
294    }
295}
296
297/// Defines additional types related to [JwtLocation].
298pub mod jwt_location {
299    #[allow(unused_imports)]
300    use super::*;
301
302    #[derive(Clone, Debug, PartialEq)]
303    #[non_exhaustive]
304    pub enum In {
305        /// Specifies HTTP header name to extract JWT token.
306        Header(std::string::String),
307        /// Specifies URL query parameter name to extract JWT token.
308        Query(std::string::String),
309        /// Specifies cookie name to extract JWT token.
310        Cookie(std::string::String),
311    }
312}
313
314/// Configuration for an authentication provider, including support for
315/// [JSON Web Token
316/// (JWT)](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32).
317#[derive(Clone, Default, PartialEq)]
318#[non_exhaustive]
319pub struct AuthProvider {
320    /// The unique identifier of the auth provider. It will be referred to by
321    /// `AuthRequirement.provider_id`.
322    ///
323    /// Example: "bookstore_auth".
324    pub id: std::string::String,
325
326    /// Identifies the principal that issued the JWT. See
327    /// <https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.1>
328    /// Usually a URL or an email address.
329    ///
330    /// Example: <https://securetoken.google.com>
331    /// Example: 1234567-compute@developer.gserviceaccount.com
332    pub issuer: std::string::String,
333
334    /// URL of the provider's public key set to validate signature of the JWT. See
335    /// [OpenID
336    /// Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata).
337    /// Optional if the key set document:
338    ///
339    /// - can be retrieved from
340    ///   [OpenID
341    ///   Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html)
342    ///   of the issuer.
343    /// - can be inferred from the email domain of the issuer (e.g. a Google
344    ///   service account).
345    ///
346    /// Example: <https://www.googleapis.com/oauth2/v1/certs>
347    pub jwks_uri: std::string::String,
348
349    /// The list of JWT
350    /// [audiences](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.3).
351    /// that are allowed to access. A JWT containing any of these audiences will
352    /// be accepted. When this setting is absent, JWTs with audiences:
353    ///
354    /// - "https://[service.name]/[google.protobuf.Api.name]"
355    /// - "https://[service.name]/"
356    ///   will be accepted.
357    ///   For example, if no audiences are in the setting, LibraryService API will
358    ///   accept JWTs with the following audiences:
359    ///
360    /// <https://library-example.googleapis.com/google.example.library.v1.LibraryService>
361    ///
362    /// - <https://library-example.googleapis.com/>
363    ///
364    /// Example:
365    ///
366    /// ```norust
367    /// audiences: bookstore_android.apps.googleusercontent.com,
368    ///            bookstore_web.apps.googleusercontent.com
369    /// ```
370    pub audiences: std::string::String,
371
372    /// Redirect URL if JWT token is required but not present or is expired.
373    /// Implement authorizationUrl of securityDefinitions in OpenAPI spec.
374    pub authorization_url: std::string::String,
375
376    /// Defines the locations to extract the JWT.  For now it is only used by the
377    /// Cloud Endpoints to store the OpenAPI extension [x-google-jwt-locations]
378    /// (<https://cloud.google.com/endpoints/docs/openapi/openapi-extensions#x-google-jwt-locations>)
379    ///
380    /// JWT locations can be one of HTTP headers, URL query parameters or
381    /// cookies. The rule is that the first match wins.
382    ///
383    /// If not specified,  default to use following 3 locations:
384    ///
385    /// 1. Authorization: Bearer
386    /// 1. x-goog-iap-jwt-assertion
387    /// 1. access_token query parameter
388    ///
389    /// Default locations can be specified as followings:
390    /// jwt_locations:
391    ///
392    /// - header: Authorization
393    ///   value_prefix: "Bearer "
394    /// - header: x-goog-iap-jwt-assertion
395    /// - query: access_token
396    pub jwt_locations: std::vec::Vec<crate::model::JwtLocation>,
397
398    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
399}
400
401impl AuthProvider {
402    pub fn new() -> Self {
403        std::default::Default::default()
404    }
405
406    /// Sets the value of [id][crate::model::AuthProvider::id].
407    pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
408        self.id = v.into();
409        self
410    }
411
412    /// Sets the value of [issuer][crate::model::AuthProvider::issuer].
413    pub fn set_issuer<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
414        self.issuer = v.into();
415        self
416    }
417
418    /// Sets the value of [jwks_uri][crate::model::AuthProvider::jwks_uri].
419    pub fn set_jwks_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
420        self.jwks_uri = v.into();
421        self
422    }
423
424    /// Sets the value of [audiences][crate::model::AuthProvider::audiences].
425    pub fn set_audiences<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
426        self.audiences = v.into();
427        self
428    }
429
430    /// Sets the value of [authorization_url][crate::model::AuthProvider::authorization_url].
431    pub fn set_authorization_url<T: std::convert::Into<std::string::String>>(
432        mut self,
433        v: T,
434    ) -> Self {
435        self.authorization_url = v.into();
436        self
437    }
438
439    /// Sets the value of [jwt_locations][crate::model::AuthProvider::jwt_locations].
440    pub fn set_jwt_locations<T, V>(mut self, v: T) -> Self
441    where
442        T: std::iter::IntoIterator<Item = V>,
443        V: std::convert::Into<crate::model::JwtLocation>,
444    {
445        use std::iter::Iterator;
446        self.jwt_locations = v.into_iter().map(|i| i.into()).collect();
447        self
448    }
449}
450
451impl wkt::message::Message for AuthProvider {
452    fn typename() -> &'static str {
453        "type.googleapis.com/google.api.AuthProvider"
454    }
455}
456
457/// OAuth scopes are a way to define data and permissions on data. For example,
458/// there are scopes defined for "Read-only access to Google Calendar" and
459/// "Access to Cloud Platform". Users can consent to a scope for an application,
460/// giving it permission to access that data on their behalf.
461///
462/// OAuth scope specifications should be fairly coarse grained; a user will need
463/// to see and understand the text description of what your scope means.
464///
465/// In most cases: use one or at most two OAuth scopes for an entire family of
466/// products. If your product has multiple APIs, you should probably be sharing
467/// the OAuth scope across all of those APIs.
468///
469/// When you need finer grained OAuth consent screens: talk with your product
470/// management about how developers will use them in practice.
471///
472/// Please note that even though each of the canonical scopes is enough for a
473/// request to be accepted and passed to the backend, a request can still fail
474/// due to the backend requiring additional scopes or permissions.
475#[derive(Clone, Default, PartialEq)]
476#[non_exhaustive]
477pub struct OAuthRequirements {
478    /// The list of publicly documented OAuth scopes that are allowed access. An
479    /// OAuth token containing any of these scopes will be accepted.
480    ///
481    /// Example:
482    ///
483    /// ```norust
484    ///  canonical_scopes: https://www.googleapis.com/auth/calendar,
485    ///                    https://www.googleapis.com/auth/calendar.read
486    /// ```
487    pub canonical_scopes: std::string::String,
488
489    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
490}
491
492impl OAuthRequirements {
493    pub fn new() -> Self {
494        std::default::Default::default()
495    }
496
497    /// Sets the value of [canonical_scopes][crate::model::OAuthRequirements::canonical_scopes].
498    pub fn set_canonical_scopes<T: std::convert::Into<std::string::String>>(
499        mut self,
500        v: T,
501    ) -> Self {
502        self.canonical_scopes = v.into();
503        self
504    }
505}
506
507impl wkt::message::Message for OAuthRequirements {
508    fn typename() -> &'static str {
509        "type.googleapis.com/google.api.OAuthRequirements"
510    }
511}
512
513/// User-defined authentication requirements, including support for
514/// [JSON Web Token
515/// (JWT)](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32).
516#[derive(Clone, Default, PartialEq)]
517#[non_exhaustive]
518pub struct AuthRequirement {
519    /// [id][google.api.AuthProvider.id] from authentication provider.
520    ///
521    /// Example:
522    ///
523    /// ```norust
524    /// provider_id: bookstore_auth
525    /// ```
526    ///
527    /// [google.api.AuthProvider.id]: crate::model::AuthProvider::id
528    pub provider_id: std::string::String,
529
530    /// NOTE: This will be deprecated soon, once AuthProvider.audiences is
531    /// implemented and accepted in all the runtime components.
532    ///
533    /// The list of JWT
534    /// [audiences](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.3).
535    /// that are allowed to access. A JWT containing any of these audiences will
536    /// be accepted. When this setting is absent, only JWTs with audience
537    /// "https://[Service_name][google.api.Service.name]/[API_name][google.protobuf.Api.name]"
538    /// will be accepted. For example, if no audiences are in the setting,
539    /// LibraryService API will only accept JWTs with the following audience
540    /// `https://library-example.googleapis.com/google.example.library.v1.LibraryService`.
541    ///
542    /// Example:
543    ///
544    /// ```norust
545    /// audiences: bookstore_android.apps.googleusercontent.com,
546    ///            bookstore_web.apps.googleusercontent.com
547    /// ```
548    ///
549    /// [google.api.Service.name]: crate::model::Service::name
550    /// [google.protobuf.Api.name]: wkt::Api::name
551    pub audiences: std::string::String,
552
553    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
554}
555
556impl AuthRequirement {
557    pub fn new() -> Self {
558        std::default::Default::default()
559    }
560
561    /// Sets the value of [provider_id][crate::model::AuthRequirement::provider_id].
562    pub fn set_provider_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
563        self.provider_id = v.into();
564        self
565    }
566
567    /// Sets the value of [audiences][crate::model::AuthRequirement::audiences].
568    pub fn set_audiences<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
569        self.audiences = v.into();
570        self
571    }
572}
573
574impl wkt::message::Message for AuthRequirement {
575    fn typename() -> &'static str {
576        "type.googleapis.com/google.api.AuthRequirement"
577    }
578}
579
580/// `Backend` defines the backend configuration for a service.
581#[derive(Clone, Default, PartialEq)]
582#[non_exhaustive]
583pub struct Backend {
584    /// A list of API backend rules that apply to individual API methods.
585    ///
586    /// **NOTE:** All service configuration rules follow "last one wins" order.
587    pub rules: std::vec::Vec<crate::model::BackendRule>,
588
589    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
590}
591
592impl Backend {
593    pub fn new() -> Self {
594        std::default::Default::default()
595    }
596
597    /// Sets the value of [rules][crate::model::Backend::rules].
598    pub fn set_rules<T, V>(mut self, v: T) -> Self
599    where
600        T: std::iter::IntoIterator<Item = V>,
601        V: std::convert::Into<crate::model::BackendRule>,
602    {
603        use std::iter::Iterator;
604        self.rules = v.into_iter().map(|i| i.into()).collect();
605        self
606    }
607}
608
609impl wkt::message::Message for Backend {
610    fn typename() -> &'static str {
611        "type.googleapis.com/google.api.Backend"
612    }
613}
614
615/// A backend rule provides configuration for an individual API element.
616#[derive(Clone, Default, PartialEq)]
617#[non_exhaustive]
618pub struct BackendRule {
619    /// Selects the methods to which this rule applies.
620    ///
621    /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
622    /// details.
623    ///
624    /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
625    pub selector: std::string::String,
626
627    /// The address of the API backend.
628    ///
629    /// The scheme is used to determine the backend protocol and security.
630    /// The following schemes are accepted:
631    ///
632    /// SCHEME        PROTOCOL    SECURITY
633    /// http://       HTTP        None
634    /// https://      HTTP        TLS
635    /// grpc://       gRPC        None
636    /// grpcs://      gRPC        TLS
637    ///
638    /// It is recommended to explicitly include a scheme. Leaving out the scheme
639    /// may cause constrasting behaviors across platforms.
640    ///
641    /// If the port is unspecified, the default is:
642    ///
643    /// - 80 for schemes without TLS
644    /// - 443 for schemes with TLS
645    ///
646    /// For HTTP backends, use [protocol][google.api.BackendRule.protocol]
647    /// to specify the protocol version.
648    ///
649    /// [google.api.BackendRule.protocol]: crate::model::BackendRule::protocol
650    pub address: std::string::String,
651
652    /// The number of seconds to wait for a response from a request. The default
653    /// varies based on the request protocol and deployment environment.
654    pub deadline: f64,
655
656    /// Deprecated, do not use.
657    #[deprecated]
658    pub min_deadline: f64,
659
660    /// The number of seconds to wait for the completion of a long running
661    /// operation. The default is no deadline.
662    pub operation_deadline: f64,
663
664    pub path_translation: crate::model::backend_rule::PathTranslation,
665
666    /// The protocol used for sending a request to the backend.
667    /// The supported values are "http/1.1" and "h2".
668    ///
669    /// The default value is inferred from the scheme in the
670    /// [address][google.api.BackendRule.address] field:
671    ///
672    /// SCHEME        PROTOCOL
673    /// http://       http/1.1
674    /// https://      http/1.1
675    /// grpc://       h2
676    /// grpcs://      h2
677    ///
678    /// For secure HTTP backends (https://) that support HTTP/2, set this field
679    /// to "h2" for improved performance.
680    ///
681    /// Configuring this field to non-default values is only supported for secure
682    /// HTTP backends. This field will be ignored for all other backends.
683    ///
684    /// See
685    /// <https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml#alpn-protocol-ids>
686    /// for more details on the supported values.
687    ///
688    /// [google.api.BackendRule.address]: crate::model::BackendRule::address
689    pub protocol: std::string::String,
690
691    /// The map between request protocol and the backend address.
692    pub overrides_by_request_protocol:
693        std::collections::HashMap<std::string::String, crate::model::BackendRule>,
694
695    /// Authentication settings used by the backend.
696    ///
697    /// These are typically used to provide service management functionality to
698    /// a backend served on a publicly-routable URL. The `authentication`
699    /// details should match the authentication behavior used by the backend.
700    ///
701    /// For example, specifying `jwt_audience` implies that the backend expects
702    /// authentication via a JWT.
703    ///
704    /// When authentication is unspecified, the resulting behavior is the same
705    /// as `disable_auth` set to `true`.
706    ///
707    /// Refer to <https://developers.google.com/identity/protocols/OpenIDConnect> for
708    /// JWT ID token.
709    pub authentication: std::option::Option<crate::model::backend_rule::Authentication>,
710
711    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
712}
713
714impl BackendRule {
715    pub fn new() -> Self {
716        std::default::Default::default()
717    }
718
719    /// Sets the value of [selector][crate::model::BackendRule::selector].
720    pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
721        self.selector = v.into();
722        self
723    }
724
725    /// Sets the value of [address][crate::model::BackendRule::address].
726    pub fn set_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
727        self.address = v.into();
728        self
729    }
730
731    /// Sets the value of [deadline][crate::model::BackendRule::deadline].
732    pub fn set_deadline<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
733        self.deadline = v.into();
734        self
735    }
736
737    /// Sets the value of [min_deadline][crate::model::BackendRule::min_deadline].
738    #[deprecated]
739    pub fn set_min_deadline<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
740        self.min_deadline = v.into();
741        self
742    }
743
744    /// Sets the value of [operation_deadline][crate::model::BackendRule::operation_deadline].
745    pub fn set_operation_deadline<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
746        self.operation_deadline = v.into();
747        self
748    }
749
750    /// Sets the value of [path_translation][crate::model::BackendRule::path_translation].
751    pub fn set_path_translation<
752        T: std::convert::Into<crate::model::backend_rule::PathTranslation>,
753    >(
754        mut self,
755        v: T,
756    ) -> Self {
757        self.path_translation = v.into();
758        self
759    }
760
761    /// Sets the value of [protocol][crate::model::BackendRule::protocol].
762    pub fn set_protocol<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
763        self.protocol = v.into();
764        self
765    }
766
767    /// Sets the value of [overrides_by_request_protocol][crate::model::BackendRule::overrides_by_request_protocol].
768    pub fn set_overrides_by_request_protocol<T, K, V>(mut self, v: T) -> Self
769    where
770        T: std::iter::IntoIterator<Item = (K, V)>,
771        K: std::convert::Into<std::string::String>,
772        V: std::convert::Into<crate::model::BackendRule>,
773    {
774        use std::iter::Iterator;
775        self.overrides_by_request_protocol =
776            v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
777        self
778    }
779
780    /// Sets the value of [authentication][crate::model::BackendRule::authentication].
781    ///
782    /// Note that all the setters affecting `authentication` are mutually
783    /// exclusive.
784    pub fn set_authentication<
785        T: std::convert::Into<std::option::Option<crate::model::backend_rule::Authentication>>,
786    >(
787        mut self,
788        v: T,
789    ) -> Self {
790        self.authentication = v.into();
791        self
792    }
793
794    /// The value of [authentication][crate::model::BackendRule::authentication]
795    /// if it holds a `JwtAudience`, `None` if the field is not set or
796    /// holds a different branch.
797    pub fn jwt_audience(&self) -> std::option::Option<&std::string::String> {
798        #[allow(unreachable_patterns)]
799        self.authentication.as_ref().and_then(|v| match v {
800            crate::model::backend_rule::Authentication::JwtAudience(v) => {
801                std::option::Option::Some(v)
802            }
803            _ => std::option::Option::None,
804        })
805    }
806
807    /// Sets the value of [authentication][crate::model::BackendRule::authentication]
808    /// to hold a `JwtAudience`.
809    ///
810    /// Note that all the setters affecting `authentication` are
811    /// mutually exclusive.
812    pub fn set_jwt_audience<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
813        self.authentication = std::option::Option::Some(
814            crate::model::backend_rule::Authentication::JwtAudience(v.into()),
815        );
816        self
817    }
818
819    /// The value of [authentication][crate::model::BackendRule::authentication]
820    /// if it holds a `DisableAuth`, `None` if the field is not set or
821    /// holds a different branch.
822    pub fn disable_auth(&self) -> std::option::Option<&bool> {
823        #[allow(unreachable_patterns)]
824        self.authentication.as_ref().and_then(|v| match v {
825            crate::model::backend_rule::Authentication::DisableAuth(v) => {
826                std::option::Option::Some(v)
827            }
828            _ => std::option::Option::None,
829        })
830    }
831
832    /// Sets the value of [authentication][crate::model::BackendRule::authentication]
833    /// to hold a `DisableAuth`.
834    ///
835    /// Note that all the setters affecting `authentication` are
836    /// mutually exclusive.
837    pub fn set_disable_auth<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
838        self.authentication = std::option::Option::Some(
839            crate::model::backend_rule::Authentication::DisableAuth(v.into()),
840        );
841        self
842    }
843}
844
845impl wkt::message::Message for BackendRule {
846    fn typename() -> &'static str {
847        "type.googleapis.com/google.api.BackendRule"
848    }
849}
850
851/// Defines additional types related to [BackendRule].
852pub mod backend_rule {
853    #[allow(unused_imports)]
854    use super::*;
855
856    /// Path Translation specifies how to combine the backend address with the
857    /// request path in order to produce the appropriate forwarding URL for the
858    /// request.
859    ///
860    /// Path Translation is applicable only to HTTP-based backends. Backends which
861    /// do not accept requests over HTTP/HTTPS should leave `path_translation`
862    /// unspecified.
863    ///
864    /// # Working with unknown values
865    ///
866    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
867    /// additional enum variants at any time. Adding new variants is not considered
868    /// a breaking change. Applications should write their code in anticipation of:
869    ///
870    /// - New values appearing in future releases of the client library, **and**
871    /// - New values received dynamically, without application changes.
872    ///
873    /// Please consult the [Working with enums] section in the user guide for some
874    /// guidelines.
875    ///
876    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
877    #[derive(Clone, Debug, PartialEq)]
878    #[non_exhaustive]
879    pub enum PathTranslation {
880        Unspecified,
881        /// Use the backend address as-is, with no modification to the path. If the
882        /// URL pattern contains variables, the variable names and values will be
883        /// appended to the query string. If a query string parameter and a URL
884        /// pattern variable have the same name, this may result in duplicate keys in
885        /// the query string.
886        ///
887        /// # Examples
888        ///
889        /// Given the following operation config:
890        ///
891        /// ```norust
892        /// Method path:        /api/company/{cid}/user/{uid}
893        /// Backend address:    https://example.cloudfunctions.net/getUser
894        /// ```
895        ///
896        /// Requests to the following request paths will call the backend at the
897        /// translated path:
898        ///
899        /// ```norust
900        /// Request path: /api/company/widgetworks/user/johndoe
901        /// Translated:
902        /// https://example.cloudfunctions.net/getUser?cid=widgetworks&uid=johndoe
903        ///
904        /// Request path: /api/company/widgetworks/user/johndoe?timezone=EST
905        /// Translated:
906        /// https://example.cloudfunctions.net/getUser?timezone=EST&cid=widgetworks&uid=johndoe
907        /// ```
908        ConstantAddress,
909        /// The request path will be appended to the backend address.
910        ///
911        /// # Examples
912        ///
913        /// Given the following operation config:
914        ///
915        /// ```norust
916        /// Method path:        /api/company/{cid}/user/{uid}
917        /// Backend address:    https://example.appspot.com
918        /// ```
919        ///
920        /// Requests to the following request paths will call the backend at the
921        /// translated path:
922        ///
923        /// ```norust
924        /// Request path: /api/company/widgetworks/user/johndoe
925        /// Translated:
926        /// https://example.appspot.com/api/company/widgetworks/user/johndoe
927        ///
928        /// Request path: /api/company/widgetworks/user/johndoe?timezone=EST
929        /// Translated:
930        /// https://example.appspot.com/api/company/widgetworks/user/johndoe?timezone=EST
931        /// ```
932        AppendPathToAddress,
933        /// If set, the enum was initialized with an unknown value.
934        ///
935        /// Applications can examine the value using [PathTranslation::value] or
936        /// [PathTranslation::name].
937        UnknownValue(path_translation::UnknownValue),
938    }
939
940    #[doc(hidden)]
941    pub mod path_translation {
942        #[allow(unused_imports)]
943        use super::*;
944        #[derive(Clone, Debug, PartialEq)]
945        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
946    }
947
948    impl PathTranslation {
949        /// Gets the enum value.
950        ///
951        /// Returns `None` if the enum contains an unknown value deserialized from
952        /// the string representation of enums.
953        pub fn value(&self) -> std::option::Option<i32> {
954            match self {
955                Self::Unspecified => std::option::Option::Some(0),
956                Self::ConstantAddress => std::option::Option::Some(1),
957                Self::AppendPathToAddress => std::option::Option::Some(2),
958                Self::UnknownValue(u) => u.0.value(),
959            }
960        }
961
962        /// Gets the enum value as a string.
963        ///
964        /// Returns `None` if the enum contains an unknown value deserialized from
965        /// the integer representation of enums.
966        pub fn name(&self) -> std::option::Option<&str> {
967            match self {
968                Self::Unspecified => std::option::Option::Some("PATH_TRANSLATION_UNSPECIFIED"),
969                Self::ConstantAddress => std::option::Option::Some("CONSTANT_ADDRESS"),
970                Self::AppendPathToAddress => std::option::Option::Some("APPEND_PATH_TO_ADDRESS"),
971                Self::UnknownValue(u) => u.0.name(),
972            }
973        }
974    }
975
976    impl std::default::Default for PathTranslation {
977        fn default() -> Self {
978            use std::convert::From;
979            Self::from(0)
980        }
981    }
982
983    impl std::fmt::Display for PathTranslation {
984        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
985            wkt::internal::display_enum(f, self.name(), self.value())
986        }
987    }
988
989    impl std::convert::From<i32> for PathTranslation {
990        fn from(value: i32) -> Self {
991            match value {
992                0 => Self::Unspecified,
993                1 => Self::ConstantAddress,
994                2 => Self::AppendPathToAddress,
995                _ => Self::UnknownValue(path_translation::UnknownValue(
996                    wkt::internal::UnknownEnumValue::Integer(value),
997                )),
998            }
999        }
1000    }
1001
1002    impl std::convert::From<&str> for PathTranslation {
1003        fn from(value: &str) -> Self {
1004            use std::string::ToString;
1005            match value {
1006                "PATH_TRANSLATION_UNSPECIFIED" => Self::Unspecified,
1007                "CONSTANT_ADDRESS" => Self::ConstantAddress,
1008                "APPEND_PATH_TO_ADDRESS" => Self::AppendPathToAddress,
1009                _ => Self::UnknownValue(path_translation::UnknownValue(
1010                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1011                )),
1012            }
1013        }
1014    }
1015
1016    impl serde::ser::Serialize for PathTranslation {
1017        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1018        where
1019            S: serde::Serializer,
1020        {
1021            match self {
1022                Self::Unspecified => serializer.serialize_i32(0),
1023                Self::ConstantAddress => serializer.serialize_i32(1),
1024                Self::AppendPathToAddress => serializer.serialize_i32(2),
1025                Self::UnknownValue(u) => u.0.serialize(serializer),
1026            }
1027        }
1028    }
1029
1030    impl<'de> serde::de::Deserialize<'de> for PathTranslation {
1031        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1032        where
1033            D: serde::Deserializer<'de>,
1034        {
1035            deserializer.deserialize_any(wkt::internal::EnumVisitor::<PathTranslation>::new(
1036                ".google.api.BackendRule.PathTranslation",
1037            ))
1038        }
1039    }
1040
1041    /// Authentication settings used by the backend.
1042    ///
1043    /// These are typically used to provide service management functionality to
1044    /// a backend served on a publicly-routable URL. The `authentication`
1045    /// details should match the authentication behavior used by the backend.
1046    ///
1047    /// For example, specifying `jwt_audience` implies that the backend expects
1048    /// authentication via a JWT.
1049    ///
1050    /// When authentication is unspecified, the resulting behavior is the same
1051    /// as `disable_auth` set to `true`.
1052    ///
1053    /// Refer to <https://developers.google.com/identity/protocols/OpenIDConnect> for
1054    /// JWT ID token.
1055    #[derive(Clone, Debug, PartialEq)]
1056    #[non_exhaustive]
1057    pub enum Authentication {
1058        /// The JWT audience is used when generating a JWT ID token for the backend.
1059        /// This ID token will be added in the HTTP "authorization" header, and sent
1060        /// to the backend.
1061        JwtAudience(std::string::String),
1062        /// When disable_auth is true, a JWT ID token won't be generated and the
1063        /// original "Authorization" HTTP header will be preserved. If the header is
1064        /// used to carry the original token and is expected by the backend, this
1065        /// field must be set to true to preserve the header.
1066        DisableAuth(bool),
1067    }
1068}
1069
1070/// Billing related configuration of the service.
1071///
1072/// The following example shows how to configure monitored resources and metrics
1073/// for billing, `consumer_destinations` is the only supported destination and
1074/// the monitored resources need at least one label key
1075/// `cloud.googleapis.com/location` to indicate the location of the billing
1076/// usage, using different monitored resources between monitoring and billing is
1077/// recommended so they can be evolved independently:
1078///
1079/// ```norust
1080/// monitored_resources:
1081/// - type: library.googleapis.com/billing_branch
1082///   labels:
1083///   - key: cloud.googleapis.com/location
1084///     description: |
1085///       Predefined label to support billing location restriction.
1086///   - key: city
1087///     description: |
1088///       Custom label to define the city where the library branch is located
1089///       in.
1090///   - key: name
1091///     description: Custom label to define the name of the library branch.
1092/// metrics:
1093/// - name: library.googleapis.com/book/borrowed_count
1094///   metric_kind: DELTA
1095///   value_type: INT64
1096///   unit: "1"
1097/// billing:
1098///   consumer_destinations:
1099///   - monitored_resource: library.googleapis.com/billing_branch
1100///     metrics:
1101///     - library.googleapis.com/book/borrowed_count
1102/// ```
1103#[derive(Clone, Default, PartialEq)]
1104#[non_exhaustive]
1105pub struct Billing {
1106    /// Billing configurations for sending metrics to the consumer project.
1107    /// There can be multiple consumer destinations per service, each one must have
1108    /// a different monitored resource type. A metric can be used in at most
1109    /// one consumer destination.
1110    pub consumer_destinations: std::vec::Vec<crate::model::billing::BillingDestination>,
1111
1112    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1113}
1114
1115impl Billing {
1116    pub fn new() -> Self {
1117        std::default::Default::default()
1118    }
1119
1120    /// Sets the value of [consumer_destinations][crate::model::Billing::consumer_destinations].
1121    pub fn set_consumer_destinations<T, V>(mut self, v: T) -> Self
1122    where
1123        T: std::iter::IntoIterator<Item = V>,
1124        V: std::convert::Into<crate::model::billing::BillingDestination>,
1125    {
1126        use std::iter::Iterator;
1127        self.consumer_destinations = v.into_iter().map(|i| i.into()).collect();
1128        self
1129    }
1130}
1131
1132impl wkt::message::Message for Billing {
1133    fn typename() -> &'static str {
1134        "type.googleapis.com/google.api.Billing"
1135    }
1136}
1137
1138/// Defines additional types related to [Billing].
1139pub mod billing {
1140    #[allow(unused_imports)]
1141    use super::*;
1142
1143    /// Configuration of a specific billing destination (Currently only support
1144    /// bill against consumer project).
1145    #[derive(Clone, Default, PartialEq)]
1146    #[non_exhaustive]
1147    pub struct BillingDestination {
1148        /// The monitored resource type. The type must be defined in
1149        /// [Service.monitored_resources][google.api.Service.monitored_resources]
1150        /// section.
1151        ///
1152        /// [google.api.Service.monitored_resources]: crate::model::Service::monitored_resources
1153        pub monitored_resource: std::string::String,
1154
1155        /// Names of the metrics to report to this billing destination.
1156        /// Each name must be defined in
1157        /// [Service.metrics][google.api.Service.metrics] section.
1158        ///
1159        /// [google.api.Service.metrics]: crate::model::Service::metrics
1160        pub metrics: std::vec::Vec<std::string::String>,
1161
1162        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1163    }
1164
1165    impl BillingDestination {
1166        pub fn new() -> Self {
1167            std::default::Default::default()
1168        }
1169
1170        /// Sets the value of [monitored_resource][crate::model::billing::BillingDestination::monitored_resource].
1171        pub fn set_monitored_resource<T: std::convert::Into<std::string::String>>(
1172            mut self,
1173            v: T,
1174        ) -> Self {
1175            self.monitored_resource = v.into();
1176            self
1177        }
1178
1179        /// Sets the value of [metrics][crate::model::billing::BillingDestination::metrics].
1180        pub fn set_metrics<T, V>(mut self, v: T) -> Self
1181        where
1182            T: std::iter::IntoIterator<Item = V>,
1183            V: std::convert::Into<std::string::String>,
1184        {
1185            use std::iter::Iterator;
1186            self.metrics = v.into_iter().map(|i| i.into()).collect();
1187            self
1188        }
1189    }
1190
1191    impl wkt::message::Message for BillingDestination {
1192        fn typename() -> &'static str {
1193            "type.googleapis.com/google.api.Billing.BillingDestination"
1194        }
1195    }
1196}
1197
1198/// Required information for every language.
1199#[derive(Clone, Default, PartialEq)]
1200#[non_exhaustive]
1201pub struct CommonLanguageSettings {
1202    /// Link to automatically generated reference documentation.  Example:
1203    /// <https://cloud.google.com/nodejs/docs/reference/asset/latest>
1204    #[deprecated]
1205    pub reference_docs_uri: std::string::String,
1206
1207    /// The destination where API teams want this client library to be published.
1208    pub destinations: std::vec::Vec<crate::model::ClientLibraryDestination>,
1209
1210    /// Configuration for which RPCs should be generated in the GAPIC client.
1211    pub selective_gapic_generation: std::option::Option<crate::model::SelectiveGapicGeneration>,
1212
1213    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1214}
1215
1216impl CommonLanguageSettings {
1217    pub fn new() -> Self {
1218        std::default::Default::default()
1219    }
1220
1221    /// Sets the value of [reference_docs_uri][crate::model::CommonLanguageSettings::reference_docs_uri].
1222    #[deprecated]
1223    pub fn set_reference_docs_uri<T: std::convert::Into<std::string::String>>(
1224        mut self,
1225        v: T,
1226    ) -> Self {
1227        self.reference_docs_uri = v.into();
1228        self
1229    }
1230
1231    /// Sets the value of [destinations][crate::model::CommonLanguageSettings::destinations].
1232    pub fn set_destinations<T, V>(mut self, v: T) -> Self
1233    where
1234        T: std::iter::IntoIterator<Item = V>,
1235        V: std::convert::Into<crate::model::ClientLibraryDestination>,
1236    {
1237        use std::iter::Iterator;
1238        self.destinations = v.into_iter().map(|i| i.into()).collect();
1239        self
1240    }
1241
1242    /// Sets the value of [selective_gapic_generation][crate::model::CommonLanguageSettings::selective_gapic_generation].
1243    pub fn set_selective_gapic_generation<T>(mut self, v: T) -> Self
1244    where
1245        T: std::convert::Into<crate::model::SelectiveGapicGeneration>,
1246    {
1247        self.selective_gapic_generation = std::option::Option::Some(v.into());
1248        self
1249    }
1250
1251    /// Sets or clears the value of [selective_gapic_generation][crate::model::CommonLanguageSettings::selective_gapic_generation].
1252    pub fn set_or_clear_selective_gapic_generation<T>(mut self, v: std::option::Option<T>) -> Self
1253    where
1254        T: std::convert::Into<crate::model::SelectiveGapicGeneration>,
1255    {
1256        self.selective_gapic_generation = v.map(|x| x.into());
1257        self
1258    }
1259}
1260
1261impl wkt::message::Message for CommonLanguageSettings {
1262    fn typename() -> &'static str {
1263        "type.googleapis.com/google.api.CommonLanguageSettings"
1264    }
1265}
1266
1267/// Details about how and where to publish client libraries.
1268#[derive(Clone, Default, PartialEq)]
1269#[non_exhaustive]
1270pub struct ClientLibrarySettings {
1271    /// Version of the API to apply these settings to. This is the full protobuf
1272    /// package for the API, ending in the version element.
1273    /// Examples: "google.cloud.speech.v1" and "google.spanner.admin.database.v1".
1274    pub version: std::string::String,
1275
1276    /// Launch stage of this version of the API.
1277    pub launch_stage: crate::model::LaunchStage,
1278
1279    /// When using transport=rest, the client request will encode enums as
1280    /// numbers rather than strings.
1281    pub rest_numeric_enums: bool,
1282
1283    /// Settings for legacy Java features, supported in the Service YAML.
1284    pub java_settings: std::option::Option<crate::model::JavaSettings>,
1285
1286    /// Settings for C++ client libraries.
1287    pub cpp_settings: std::option::Option<crate::model::CppSettings>,
1288
1289    /// Settings for PHP client libraries.
1290    pub php_settings: std::option::Option<crate::model::PhpSettings>,
1291
1292    /// Settings for Python client libraries.
1293    pub python_settings: std::option::Option<crate::model::PythonSettings>,
1294
1295    /// Settings for Node client libraries.
1296    pub node_settings: std::option::Option<crate::model::NodeSettings>,
1297
1298    /// Settings for .NET client libraries.
1299    pub dotnet_settings: std::option::Option<crate::model::DotnetSettings>,
1300
1301    /// Settings for Ruby client libraries.
1302    pub ruby_settings: std::option::Option<crate::model::RubySettings>,
1303
1304    /// Settings for Go client libraries.
1305    pub go_settings: std::option::Option<crate::model::GoSettings>,
1306
1307    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1308}
1309
1310impl ClientLibrarySettings {
1311    pub fn new() -> Self {
1312        std::default::Default::default()
1313    }
1314
1315    /// Sets the value of [version][crate::model::ClientLibrarySettings::version].
1316    pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1317        self.version = v.into();
1318        self
1319    }
1320
1321    /// Sets the value of [launch_stage][crate::model::ClientLibrarySettings::launch_stage].
1322    pub fn set_launch_stage<T: std::convert::Into<crate::model::LaunchStage>>(
1323        mut self,
1324        v: T,
1325    ) -> Self {
1326        self.launch_stage = v.into();
1327        self
1328    }
1329
1330    /// Sets the value of [rest_numeric_enums][crate::model::ClientLibrarySettings::rest_numeric_enums].
1331    pub fn set_rest_numeric_enums<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1332        self.rest_numeric_enums = v.into();
1333        self
1334    }
1335
1336    /// Sets the value of [java_settings][crate::model::ClientLibrarySettings::java_settings].
1337    pub fn set_java_settings<T>(mut self, v: T) -> Self
1338    where
1339        T: std::convert::Into<crate::model::JavaSettings>,
1340    {
1341        self.java_settings = std::option::Option::Some(v.into());
1342        self
1343    }
1344
1345    /// Sets or clears the value of [java_settings][crate::model::ClientLibrarySettings::java_settings].
1346    pub fn set_or_clear_java_settings<T>(mut self, v: std::option::Option<T>) -> Self
1347    where
1348        T: std::convert::Into<crate::model::JavaSettings>,
1349    {
1350        self.java_settings = v.map(|x| x.into());
1351        self
1352    }
1353
1354    /// Sets the value of [cpp_settings][crate::model::ClientLibrarySettings::cpp_settings].
1355    pub fn set_cpp_settings<T>(mut self, v: T) -> Self
1356    where
1357        T: std::convert::Into<crate::model::CppSettings>,
1358    {
1359        self.cpp_settings = std::option::Option::Some(v.into());
1360        self
1361    }
1362
1363    /// Sets or clears the value of [cpp_settings][crate::model::ClientLibrarySettings::cpp_settings].
1364    pub fn set_or_clear_cpp_settings<T>(mut self, v: std::option::Option<T>) -> Self
1365    where
1366        T: std::convert::Into<crate::model::CppSettings>,
1367    {
1368        self.cpp_settings = v.map(|x| x.into());
1369        self
1370    }
1371
1372    /// Sets the value of [php_settings][crate::model::ClientLibrarySettings::php_settings].
1373    pub fn set_php_settings<T>(mut self, v: T) -> Self
1374    where
1375        T: std::convert::Into<crate::model::PhpSettings>,
1376    {
1377        self.php_settings = std::option::Option::Some(v.into());
1378        self
1379    }
1380
1381    /// Sets or clears the value of [php_settings][crate::model::ClientLibrarySettings::php_settings].
1382    pub fn set_or_clear_php_settings<T>(mut self, v: std::option::Option<T>) -> Self
1383    where
1384        T: std::convert::Into<crate::model::PhpSettings>,
1385    {
1386        self.php_settings = v.map(|x| x.into());
1387        self
1388    }
1389
1390    /// Sets the value of [python_settings][crate::model::ClientLibrarySettings::python_settings].
1391    pub fn set_python_settings<T>(mut self, v: T) -> Self
1392    where
1393        T: std::convert::Into<crate::model::PythonSettings>,
1394    {
1395        self.python_settings = std::option::Option::Some(v.into());
1396        self
1397    }
1398
1399    /// Sets or clears the value of [python_settings][crate::model::ClientLibrarySettings::python_settings].
1400    pub fn set_or_clear_python_settings<T>(mut self, v: std::option::Option<T>) -> Self
1401    where
1402        T: std::convert::Into<crate::model::PythonSettings>,
1403    {
1404        self.python_settings = v.map(|x| x.into());
1405        self
1406    }
1407
1408    /// Sets the value of [node_settings][crate::model::ClientLibrarySettings::node_settings].
1409    pub fn set_node_settings<T>(mut self, v: T) -> Self
1410    where
1411        T: std::convert::Into<crate::model::NodeSettings>,
1412    {
1413        self.node_settings = std::option::Option::Some(v.into());
1414        self
1415    }
1416
1417    /// Sets or clears the value of [node_settings][crate::model::ClientLibrarySettings::node_settings].
1418    pub fn set_or_clear_node_settings<T>(mut self, v: std::option::Option<T>) -> Self
1419    where
1420        T: std::convert::Into<crate::model::NodeSettings>,
1421    {
1422        self.node_settings = v.map(|x| x.into());
1423        self
1424    }
1425
1426    /// Sets the value of [dotnet_settings][crate::model::ClientLibrarySettings::dotnet_settings].
1427    pub fn set_dotnet_settings<T>(mut self, v: T) -> Self
1428    where
1429        T: std::convert::Into<crate::model::DotnetSettings>,
1430    {
1431        self.dotnet_settings = std::option::Option::Some(v.into());
1432        self
1433    }
1434
1435    /// Sets or clears the value of [dotnet_settings][crate::model::ClientLibrarySettings::dotnet_settings].
1436    pub fn set_or_clear_dotnet_settings<T>(mut self, v: std::option::Option<T>) -> Self
1437    where
1438        T: std::convert::Into<crate::model::DotnetSettings>,
1439    {
1440        self.dotnet_settings = v.map(|x| x.into());
1441        self
1442    }
1443
1444    /// Sets the value of [ruby_settings][crate::model::ClientLibrarySettings::ruby_settings].
1445    pub fn set_ruby_settings<T>(mut self, v: T) -> Self
1446    where
1447        T: std::convert::Into<crate::model::RubySettings>,
1448    {
1449        self.ruby_settings = std::option::Option::Some(v.into());
1450        self
1451    }
1452
1453    /// Sets or clears the value of [ruby_settings][crate::model::ClientLibrarySettings::ruby_settings].
1454    pub fn set_or_clear_ruby_settings<T>(mut self, v: std::option::Option<T>) -> Self
1455    where
1456        T: std::convert::Into<crate::model::RubySettings>,
1457    {
1458        self.ruby_settings = v.map(|x| x.into());
1459        self
1460    }
1461
1462    /// Sets the value of [go_settings][crate::model::ClientLibrarySettings::go_settings].
1463    pub fn set_go_settings<T>(mut self, v: T) -> Self
1464    where
1465        T: std::convert::Into<crate::model::GoSettings>,
1466    {
1467        self.go_settings = std::option::Option::Some(v.into());
1468        self
1469    }
1470
1471    /// Sets or clears the value of [go_settings][crate::model::ClientLibrarySettings::go_settings].
1472    pub fn set_or_clear_go_settings<T>(mut self, v: std::option::Option<T>) -> Self
1473    where
1474        T: std::convert::Into<crate::model::GoSettings>,
1475    {
1476        self.go_settings = v.map(|x| x.into());
1477        self
1478    }
1479}
1480
1481impl wkt::message::Message for ClientLibrarySettings {
1482    fn typename() -> &'static str {
1483        "type.googleapis.com/google.api.ClientLibrarySettings"
1484    }
1485}
1486
1487/// This message configures the settings for publishing [Google Cloud Client
1488/// libraries](https://cloud.google.com/apis/docs/cloud-client-libraries)
1489/// generated from the service config.
1490#[derive(Clone, Default, PartialEq)]
1491#[non_exhaustive]
1492pub struct Publishing {
1493    /// A list of API method settings, e.g. the behavior for methods that use the
1494    /// long-running operation pattern.
1495    pub method_settings: std::vec::Vec<crate::model::MethodSettings>,
1496
1497    /// Link to a *public* URI where users can report issues.  Example:
1498    /// <https://issuetracker.google.com/issues/new?component=190865&template=1161103>
1499    pub new_issue_uri: std::string::String,
1500
1501    /// Link to product home page.  Example:
1502    /// <https://cloud.google.com/asset-inventory/docs/overview>
1503    pub documentation_uri: std::string::String,
1504
1505    /// Used as a tracking tag when collecting data about the APIs developer
1506    /// relations artifacts like docs, packages delivered to package managers,
1507    /// etc.  Example: "speech".
1508    pub api_short_name: std::string::String,
1509
1510    /// GitHub label to apply to issues and pull requests opened for this API.
1511    pub github_label: std::string::String,
1512
1513    /// GitHub teams to be added to CODEOWNERS in the directory in GitHub
1514    /// containing source code for the client libraries for this API.
1515    pub codeowner_github_teams: std::vec::Vec<std::string::String>,
1516
1517    /// A prefix used in sample code when demarking regions to be included in
1518    /// documentation.
1519    pub doc_tag_prefix: std::string::String,
1520
1521    /// For whom the client library is being published.
1522    pub organization: crate::model::ClientLibraryOrganization,
1523
1524    /// Client library settings.  If the same version string appears multiple
1525    /// times in this list, then the last one wins.  Settings from earlier
1526    /// settings with the same version string are discarded.
1527    pub library_settings: std::vec::Vec<crate::model::ClientLibrarySettings>,
1528
1529    /// Optional link to proto reference documentation.  Example:
1530    /// <https://cloud.google.com/pubsub/lite/docs/reference/rpc>
1531    pub proto_reference_documentation_uri: std::string::String,
1532
1533    /// Optional link to REST reference documentation.  Example:
1534    /// <https://cloud.google.com/pubsub/lite/docs/reference/rest>
1535    pub rest_reference_documentation_uri: std::string::String,
1536
1537    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1538}
1539
1540impl Publishing {
1541    pub fn new() -> Self {
1542        std::default::Default::default()
1543    }
1544
1545    /// Sets the value of [method_settings][crate::model::Publishing::method_settings].
1546    pub fn set_method_settings<T, V>(mut self, v: T) -> Self
1547    where
1548        T: std::iter::IntoIterator<Item = V>,
1549        V: std::convert::Into<crate::model::MethodSettings>,
1550    {
1551        use std::iter::Iterator;
1552        self.method_settings = v.into_iter().map(|i| i.into()).collect();
1553        self
1554    }
1555
1556    /// Sets the value of [new_issue_uri][crate::model::Publishing::new_issue_uri].
1557    pub fn set_new_issue_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1558        self.new_issue_uri = v.into();
1559        self
1560    }
1561
1562    /// Sets the value of [documentation_uri][crate::model::Publishing::documentation_uri].
1563    pub fn set_documentation_uri<T: std::convert::Into<std::string::String>>(
1564        mut self,
1565        v: T,
1566    ) -> Self {
1567        self.documentation_uri = v.into();
1568        self
1569    }
1570
1571    /// Sets the value of [api_short_name][crate::model::Publishing::api_short_name].
1572    pub fn set_api_short_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1573        self.api_short_name = v.into();
1574        self
1575    }
1576
1577    /// Sets the value of [github_label][crate::model::Publishing::github_label].
1578    pub fn set_github_label<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1579        self.github_label = v.into();
1580        self
1581    }
1582
1583    /// Sets the value of [codeowner_github_teams][crate::model::Publishing::codeowner_github_teams].
1584    pub fn set_codeowner_github_teams<T, V>(mut self, v: T) -> Self
1585    where
1586        T: std::iter::IntoIterator<Item = V>,
1587        V: std::convert::Into<std::string::String>,
1588    {
1589        use std::iter::Iterator;
1590        self.codeowner_github_teams = v.into_iter().map(|i| i.into()).collect();
1591        self
1592    }
1593
1594    /// Sets the value of [doc_tag_prefix][crate::model::Publishing::doc_tag_prefix].
1595    pub fn set_doc_tag_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1596        self.doc_tag_prefix = v.into();
1597        self
1598    }
1599
1600    /// Sets the value of [organization][crate::model::Publishing::organization].
1601    pub fn set_organization<T: std::convert::Into<crate::model::ClientLibraryOrganization>>(
1602        mut self,
1603        v: T,
1604    ) -> Self {
1605        self.organization = v.into();
1606        self
1607    }
1608
1609    /// Sets the value of [library_settings][crate::model::Publishing::library_settings].
1610    pub fn set_library_settings<T, V>(mut self, v: T) -> Self
1611    where
1612        T: std::iter::IntoIterator<Item = V>,
1613        V: std::convert::Into<crate::model::ClientLibrarySettings>,
1614    {
1615        use std::iter::Iterator;
1616        self.library_settings = v.into_iter().map(|i| i.into()).collect();
1617        self
1618    }
1619
1620    /// Sets the value of [proto_reference_documentation_uri][crate::model::Publishing::proto_reference_documentation_uri].
1621    pub fn set_proto_reference_documentation_uri<T: std::convert::Into<std::string::String>>(
1622        mut self,
1623        v: T,
1624    ) -> Self {
1625        self.proto_reference_documentation_uri = v.into();
1626        self
1627    }
1628
1629    /// Sets the value of [rest_reference_documentation_uri][crate::model::Publishing::rest_reference_documentation_uri].
1630    pub fn set_rest_reference_documentation_uri<T: std::convert::Into<std::string::String>>(
1631        mut self,
1632        v: T,
1633    ) -> Self {
1634        self.rest_reference_documentation_uri = v.into();
1635        self
1636    }
1637}
1638
1639impl wkt::message::Message for Publishing {
1640    fn typename() -> &'static str {
1641        "type.googleapis.com/google.api.Publishing"
1642    }
1643}
1644
1645/// Settings for Java client libraries.
1646#[derive(Clone, Default, PartialEq)]
1647#[non_exhaustive]
1648pub struct JavaSettings {
1649    /// The package name to use in Java. Clobbers the java_package option
1650    /// set in the protobuf. This should be used **only** by APIs
1651    /// who have already set the language_settings.java.package_name" field
1652    /// in gapic.yaml. API teams should use the protobuf java_package option
1653    /// where possible.
1654    ///
1655    /// Example of a YAML configuration::
1656    ///
1657    /// publishing:
1658    /// java_settings:
1659    /// library_package: com.google.cloud.pubsub.v1
1660    pub library_package: std::string::String,
1661
1662    /// Configure the Java class name to use instead of the service's for its
1663    /// corresponding generated GAPIC client. Keys are fully-qualified
1664    /// service names as they appear in the protobuf (including the full
1665    /// the language_settings.java.interface_names" field in gapic.yaml. API
1666    /// teams should otherwise use the service name as it appears in the
1667    /// protobuf.
1668    ///
1669    /// Example of a YAML configuration::
1670    ///
1671    /// publishing:
1672    /// java_settings:
1673    /// service_class_names:
1674    /// - google.pubsub.v1.Publisher: TopicAdmin
1675    /// - google.pubsub.v1.Subscriber: SubscriptionAdmin
1676    pub service_class_names: std::collections::HashMap<std::string::String, std::string::String>,
1677
1678    /// Some settings.
1679    pub common: std::option::Option<crate::model::CommonLanguageSettings>,
1680
1681    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1682}
1683
1684impl JavaSettings {
1685    pub fn new() -> Self {
1686        std::default::Default::default()
1687    }
1688
1689    /// Sets the value of [library_package][crate::model::JavaSettings::library_package].
1690    pub fn set_library_package<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1691        self.library_package = v.into();
1692        self
1693    }
1694
1695    /// Sets the value of [service_class_names][crate::model::JavaSettings::service_class_names].
1696    pub fn set_service_class_names<T, K, V>(mut self, v: T) -> Self
1697    where
1698        T: std::iter::IntoIterator<Item = (K, V)>,
1699        K: std::convert::Into<std::string::String>,
1700        V: std::convert::Into<std::string::String>,
1701    {
1702        use std::iter::Iterator;
1703        self.service_class_names = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1704        self
1705    }
1706
1707    /// Sets the value of [common][crate::model::JavaSettings::common].
1708    pub fn set_common<T>(mut self, v: T) -> Self
1709    where
1710        T: std::convert::Into<crate::model::CommonLanguageSettings>,
1711    {
1712        self.common = std::option::Option::Some(v.into());
1713        self
1714    }
1715
1716    /// Sets or clears the value of [common][crate::model::JavaSettings::common].
1717    pub fn set_or_clear_common<T>(mut self, v: std::option::Option<T>) -> Self
1718    where
1719        T: std::convert::Into<crate::model::CommonLanguageSettings>,
1720    {
1721        self.common = v.map(|x| x.into());
1722        self
1723    }
1724}
1725
1726impl wkt::message::Message for JavaSettings {
1727    fn typename() -> &'static str {
1728        "type.googleapis.com/google.api.JavaSettings"
1729    }
1730}
1731
1732/// Settings for C++ client libraries.
1733#[derive(Clone, Default, PartialEq)]
1734#[non_exhaustive]
1735pub struct CppSettings {
1736    /// Some settings.
1737    pub common: std::option::Option<crate::model::CommonLanguageSettings>,
1738
1739    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1740}
1741
1742impl CppSettings {
1743    pub fn new() -> Self {
1744        std::default::Default::default()
1745    }
1746
1747    /// Sets the value of [common][crate::model::CppSettings::common].
1748    pub fn set_common<T>(mut self, v: T) -> Self
1749    where
1750        T: std::convert::Into<crate::model::CommonLanguageSettings>,
1751    {
1752        self.common = std::option::Option::Some(v.into());
1753        self
1754    }
1755
1756    /// Sets or clears the value of [common][crate::model::CppSettings::common].
1757    pub fn set_or_clear_common<T>(mut self, v: std::option::Option<T>) -> Self
1758    where
1759        T: std::convert::Into<crate::model::CommonLanguageSettings>,
1760    {
1761        self.common = v.map(|x| x.into());
1762        self
1763    }
1764}
1765
1766impl wkt::message::Message for CppSettings {
1767    fn typename() -> &'static str {
1768        "type.googleapis.com/google.api.CppSettings"
1769    }
1770}
1771
1772/// Settings for Php client libraries.
1773#[derive(Clone, Default, PartialEq)]
1774#[non_exhaustive]
1775pub struct PhpSettings {
1776    /// Some settings.
1777    pub common: std::option::Option<crate::model::CommonLanguageSettings>,
1778
1779    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1780}
1781
1782impl PhpSettings {
1783    pub fn new() -> Self {
1784        std::default::Default::default()
1785    }
1786
1787    /// Sets the value of [common][crate::model::PhpSettings::common].
1788    pub fn set_common<T>(mut self, v: T) -> Self
1789    where
1790        T: std::convert::Into<crate::model::CommonLanguageSettings>,
1791    {
1792        self.common = std::option::Option::Some(v.into());
1793        self
1794    }
1795
1796    /// Sets or clears the value of [common][crate::model::PhpSettings::common].
1797    pub fn set_or_clear_common<T>(mut self, v: std::option::Option<T>) -> Self
1798    where
1799        T: std::convert::Into<crate::model::CommonLanguageSettings>,
1800    {
1801        self.common = v.map(|x| x.into());
1802        self
1803    }
1804}
1805
1806impl wkt::message::Message for PhpSettings {
1807    fn typename() -> &'static str {
1808        "type.googleapis.com/google.api.PhpSettings"
1809    }
1810}
1811
1812/// Settings for Python client libraries.
1813#[derive(Clone, Default, PartialEq)]
1814#[non_exhaustive]
1815pub struct PythonSettings {
1816    /// Some settings.
1817    pub common: std::option::Option<crate::model::CommonLanguageSettings>,
1818
1819    /// Experimental features to be included during client library generation.
1820    pub experimental_features:
1821        std::option::Option<crate::model::python_settings::ExperimentalFeatures>,
1822
1823    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1824}
1825
1826impl PythonSettings {
1827    pub fn new() -> Self {
1828        std::default::Default::default()
1829    }
1830
1831    /// Sets the value of [common][crate::model::PythonSettings::common].
1832    pub fn set_common<T>(mut self, v: T) -> Self
1833    where
1834        T: std::convert::Into<crate::model::CommonLanguageSettings>,
1835    {
1836        self.common = std::option::Option::Some(v.into());
1837        self
1838    }
1839
1840    /// Sets or clears the value of [common][crate::model::PythonSettings::common].
1841    pub fn set_or_clear_common<T>(mut self, v: std::option::Option<T>) -> Self
1842    where
1843        T: std::convert::Into<crate::model::CommonLanguageSettings>,
1844    {
1845        self.common = v.map(|x| x.into());
1846        self
1847    }
1848
1849    /// Sets the value of [experimental_features][crate::model::PythonSettings::experimental_features].
1850    pub fn set_experimental_features<T>(mut self, v: T) -> Self
1851    where
1852        T: std::convert::Into<crate::model::python_settings::ExperimentalFeatures>,
1853    {
1854        self.experimental_features = std::option::Option::Some(v.into());
1855        self
1856    }
1857
1858    /// Sets or clears the value of [experimental_features][crate::model::PythonSettings::experimental_features].
1859    pub fn set_or_clear_experimental_features<T>(mut self, v: std::option::Option<T>) -> Self
1860    where
1861        T: std::convert::Into<crate::model::python_settings::ExperimentalFeatures>,
1862    {
1863        self.experimental_features = v.map(|x| x.into());
1864        self
1865    }
1866}
1867
1868impl wkt::message::Message for PythonSettings {
1869    fn typename() -> &'static str {
1870        "type.googleapis.com/google.api.PythonSettings"
1871    }
1872}
1873
1874/// Defines additional types related to [PythonSettings].
1875pub mod python_settings {
1876    #[allow(unused_imports)]
1877    use super::*;
1878
1879    /// Experimental features to be included during client library generation.
1880    /// These fields will be deprecated once the feature graduates and is enabled
1881    /// by default.
1882    #[derive(Clone, Default, PartialEq)]
1883    #[non_exhaustive]
1884    pub struct ExperimentalFeatures {
1885        /// Enables generation of asynchronous REST clients if `rest` transport is
1886        /// enabled. By default, asynchronous REST clients will not be generated.
1887        /// This feature will be enabled by default 1 month after launching the
1888        /// feature in preview packages.
1889        pub rest_async_io_enabled: bool,
1890
1891        /// Enables generation of protobuf code using new types that are more
1892        /// Pythonic which are included in `protobuf>=5.29.x`. This feature will be
1893        /// enabled by default 1 month after launching the feature in preview
1894        /// packages.
1895        pub protobuf_pythonic_types_enabled: bool,
1896
1897        /// Disables generation of an unversioned Python package for this client
1898        /// library. This means that the module names will need to be versioned in
1899        /// import statements. For example `import google.cloud.library_v2` instead
1900        /// of `import google.cloud.library`.
1901        pub unversioned_package_disabled: bool,
1902
1903        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1904    }
1905
1906    impl ExperimentalFeatures {
1907        pub fn new() -> Self {
1908            std::default::Default::default()
1909        }
1910
1911        /// Sets the value of [rest_async_io_enabled][crate::model::python_settings::ExperimentalFeatures::rest_async_io_enabled].
1912        pub fn set_rest_async_io_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1913            self.rest_async_io_enabled = v.into();
1914            self
1915        }
1916
1917        /// Sets the value of [protobuf_pythonic_types_enabled][crate::model::python_settings::ExperimentalFeatures::protobuf_pythonic_types_enabled].
1918        pub fn set_protobuf_pythonic_types_enabled<T: std::convert::Into<bool>>(
1919            mut self,
1920            v: T,
1921        ) -> Self {
1922            self.protobuf_pythonic_types_enabled = v.into();
1923            self
1924        }
1925
1926        /// Sets the value of [unversioned_package_disabled][crate::model::python_settings::ExperimentalFeatures::unversioned_package_disabled].
1927        pub fn set_unversioned_package_disabled<T: std::convert::Into<bool>>(
1928            mut self,
1929            v: T,
1930        ) -> Self {
1931            self.unversioned_package_disabled = v.into();
1932            self
1933        }
1934    }
1935
1936    impl wkt::message::Message for ExperimentalFeatures {
1937        fn typename() -> &'static str {
1938            "type.googleapis.com/google.api.PythonSettings.ExperimentalFeatures"
1939        }
1940    }
1941}
1942
1943/// Settings for Node client libraries.
1944#[derive(Clone, Default, PartialEq)]
1945#[non_exhaustive]
1946pub struct NodeSettings {
1947    /// Some settings.
1948    pub common: std::option::Option<crate::model::CommonLanguageSettings>,
1949
1950    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1951}
1952
1953impl NodeSettings {
1954    pub fn new() -> Self {
1955        std::default::Default::default()
1956    }
1957
1958    /// Sets the value of [common][crate::model::NodeSettings::common].
1959    pub fn set_common<T>(mut self, v: T) -> Self
1960    where
1961        T: std::convert::Into<crate::model::CommonLanguageSettings>,
1962    {
1963        self.common = std::option::Option::Some(v.into());
1964        self
1965    }
1966
1967    /// Sets or clears the value of [common][crate::model::NodeSettings::common].
1968    pub fn set_or_clear_common<T>(mut self, v: std::option::Option<T>) -> Self
1969    where
1970        T: std::convert::Into<crate::model::CommonLanguageSettings>,
1971    {
1972        self.common = v.map(|x| x.into());
1973        self
1974    }
1975}
1976
1977impl wkt::message::Message for NodeSettings {
1978    fn typename() -> &'static str {
1979        "type.googleapis.com/google.api.NodeSettings"
1980    }
1981}
1982
1983/// Settings for Dotnet client libraries.
1984#[derive(Clone, Default, PartialEq)]
1985#[non_exhaustive]
1986pub struct DotnetSettings {
1987    /// Some settings.
1988    pub common: std::option::Option<crate::model::CommonLanguageSettings>,
1989
1990    /// Map from original service names to renamed versions.
1991    /// This is used when the default generated types
1992    /// would cause a naming conflict. (Neither name is
1993    /// fully-qualified.)
1994    /// Example: Subscriber to SubscriberServiceApi.
1995    pub renamed_services: std::collections::HashMap<std::string::String, std::string::String>,
1996
1997    /// Map from full resource types to the effective short name
1998    /// for the resource. This is used when otherwise resource
1999    /// named from different services would cause naming collisions.
2000    /// Example entry:
2001    /// "datalabeling.googleapis.com/Dataset": "DataLabelingDataset"
2002    pub renamed_resources: std::collections::HashMap<std::string::String, std::string::String>,
2003
2004    /// List of full resource types to ignore during generation.
2005    /// This is typically used for API-specific Location resources,
2006    /// which should be handled by the generator as if they were actually
2007    /// the common Location resources.
2008    /// Example entry: "documentai.googleapis.com/Location"
2009    pub ignored_resources: std::vec::Vec<std::string::String>,
2010
2011    /// Namespaces which must be aliased in snippets due to
2012    /// a known (but non-generator-predictable) naming collision
2013    pub forced_namespace_aliases: std::vec::Vec<std::string::String>,
2014
2015    /// Method signatures (in the form "service.method(signature)")
2016    /// which are provided separately, so shouldn't be generated.
2017    /// Snippets *calling* these methods are still generated, however.
2018    pub handwritten_signatures: std::vec::Vec<std::string::String>,
2019
2020    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2021}
2022
2023impl DotnetSettings {
2024    pub fn new() -> Self {
2025        std::default::Default::default()
2026    }
2027
2028    /// Sets the value of [common][crate::model::DotnetSettings::common].
2029    pub fn set_common<T>(mut self, v: T) -> Self
2030    where
2031        T: std::convert::Into<crate::model::CommonLanguageSettings>,
2032    {
2033        self.common = std::option::Option::Some(v.into());
2034        self
2035    }
2036
2037    /// Sets or clears the value of [common][crate::model::DotnetSettings::common].
2038    pub fn set_or_clear_common<T>(mut self, v: std::option::Option<T>) -> Self
2039    where
2040        T: std::convert::Into<crate::model::CommonLanguageSettings>,
2041    {
2042        self.common = v.map(|x| x.into());
2043        self
2044    }
2045
2046    /// Sets the value of [renamed_services][crate::model::DotnetSettings::renamed_services].
2047    pub fn set_renamed_services<T, K, V>(mut self, v: T) -> Self
2048    where
2049        T: std::iter::IntoIterator<Item = (K, V)>,
2050        K: std::convert::Into<std::string::String>,
2051        V: std::convert::Into<std::string::String>,
2052    {
2053        use std::iter::Iterator;
2054        self.renamed_services = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2055        self
2056    }
2057
2058    /// Sets the value of [renamed_resources][crate::model::DotnetSettings::renamed_resources].
2059    pub fn set_renamed_resources<T, K, V>(mut self, v: T) -> Self
2060    where
2061        T: std::iter::IntoIterator<Item = (K, V)>,
2062        K: std::convert::Into<std::string::String>,
2063        V: std::convert::Into<std::string::String>,
2064    {
2065        use std::iter::Iterator;
2066        self.renamed_resources = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2067        self
2068    }
2069
2070    /// Sets the value of [ignored_resources][crate::model::DotnetSettings::ignored_resources].
2071    pub fn set_ignored_resources<T, V>(mut self, v: T) -> Self
2072    where
2073        T: std::iter::IntoIterator<Item = V>,
2074        V: std::convert::Into<std::string::String>,
2075    {
2076        use std::iter::Iterator;
2077        self.ignored_resources = v.into_iter().map(|i| i.into()).collect();
2078        self
2079    }
2080
2081    /// Sets the value of [forced_namespace_aliases][crate::model::DotnetSettings::forced_namespace_aliases].
2082    pub fn set_forced_namespace_aliases<T, V>(mut self, v: T) -> Self
2083    where
2084        T: std::iter::IntoIterator<Item = V>,
2085        V: std::convert::Into<std::string::String>,
2086    {
2087        use std::iter::Iterator;
2088        self.forced_namespace_aliases = v.into_iter().map(|i| i.into()).collect();
2089        self
2090    }
2091
2092    /// Sets the value of [handwritten_signatures][crate::model::DotnetSettings::handwritten_signatures].
2093    pub fn set_handwritten_signatures<T, V>(mut self, v: T) -> Self
2094    where
2095        T: std::iter::IntoIterator<Item = V>,
2096        V: std::convert::Into<std::string::String>,
2097    {
2098        use std::iter::Iterator;
2099        self.handwritten_signatures = v.into_iter().map(|i| i.into()).collect();
2100        self
2101    }
2102}
2103
2104impl wkt::message::Message for DotnetSettings {
2105    fn typename() -> &'static str {
2106        "type.googleapis.com/google.api.DotnetSettings"
2107    }
2108}
2109
2110/// Settings for Ruby client libraries.
2111#[derive(Clone, Default, PartialEq)]
2112#[non_exhaustive]
2113pub struct RubySettings {
2114    /// Some settings.
2115    pub common: std::option::Option<crate::model::CommonLanguageSettings>,
2116
2117    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2118}
2119
2120impl RubySettings {
2121    pub fn new() -> Self {
2122        std::default::Default::default()
2123    }
2124
2125    /// Sets the value of [common][crate::model::RubySettings::common].
2126    pub fn set_common<T>(mut self, v: T) -> Self
2127    where
2128        T: std::convert::Into<crate::model::CommonLanguageSettings>,
2129    {
2130        self.common = std::option::Option::Some(v.into());
2131        self
2132    }
2133
2134    /// Sets or clears the value of [common][crate::model::RubySettings::common].
2135    pub fn set_or_clear_common<T>(mut self, v: std::option::Option<T>) -> Self
2136    where
2137        T: std::convert::Into<crate::model::CommonLanguageSettings>,
2138    {
2139        self.common = v.map(|x| x.into());
2140        self
2141    }
2142}
2143
2144impl wkt::message::Message for RubySettings {
2145    fn typename() -> &'static str {
2146        "type.googleapis.com/google.api.RubySettings"
2147    }
2148}
2149
2150/// Settings for Go client libraries.
2151#[derive(Clone, Default, PartialEq)]
2152#[non_exhaustive]
2153pub struct GoSettings {
2154    /// Some settings.
2155    pub common: std::option::Option<crate::model::CommonLanguageSettings>,
2156
2157    /// Map of service names to renamed services. Keys are the package relative
2158    /// service names and values are the name to be used for the service client
2159    /// and call options.
2160    ///
2161    /// publishing:
2162    /// go_settings:
2163    /// renamed_services:
2164    /// Publisher: TopicAdmin
2165    pub renamed_services: std::collections::HashMap<std::string::String, std::string::String>,
2166
2167    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2168}
2169
2170impl GoSettings {
2171    pub fn new() -> Self {
2172        std::default::Default::default()
2173    }
2174
2175    /// Sets the value of [common][crate::model::GoSettings::common].
2176    pub fn set_common<T>(mut self, v: T) -> Self
2177    where
2178        T: std::convert::Into<crate::model::CommonLanguageSettings>,
2179    {
2180        self.common = std::option::Option::Some(v.into());
2181        self
2182    }
2183
2184    /// Sets or clears the value of [common][crate::model::GoSettings::common].
2185    pub fn set_or_clear_common<T>(mut self, v: std::option::Option<T>) -> Self
2186    where
2187        T: std::convert::Into<crate::model::CommonLanguageSettings>,
2188    {
2189        self.common = v.map(|x| x.into());
2190        self
2191    }
2192
2193    /// Sets the value of [renamed_services][crate::model::GoSettings::renamed_services].
2194    pub fn set_renamed_services<T, K, V>(mut self, v: T) -> Self
2195    where
2196        T: std::iter::IntoIterator<Item = (K, V)>,
2197        K: std::convert::Into<std::string::String>,
2198        V: std::convert::Into<std::string::String>,
2199    {
2200        use std::iter::Iterator;
2201        self.renamed_services = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2202        self
2203    }
2204}
2205
2206impl wkt::message::Message for GoSettings {
2207    fn typename() -> &'static str {
2208        "type.googleapis.com/google.api.GoSettings"
2209    }
2210}
2211
2212/// Describes the generator configuration for a method.
2213#[derive(Clone, Default, PartialEq)]
2214#[non_exhaustive]
2215pub struct MethodSettings {
2216    /// The fully qualified name of the method, for which the options below apply.
2217    /// This is used to find the method to apply the options.
2218    ///
2219    /// Example:
2220    ///
2221    /// ```norust
2222    /// publishing:
2223    ///   method_settings:
2224    ///   - selector: google.storage.control.v2.StorageControl.CreateFolder
2225    ///     # method settings for CreateFolder...
2226    /// ```
2227    pub selector: std::string::String,
2228
2229    /// Describes settings to use for long-running operations when generating
2230    /// API methods for RPCs. Complements RPCs that use the annotations in
2231    /// google/longrunning/operations.proto.
2232    ///
2233    /// Example of a YAML configuration::
2234    ///
2235    /// ```norust
2236    /// publishing:
2237    ///   method_settings:
2238    ///   - selector: google.cloud.speech.v2.Speech.BatchRecognize
2239    ///     long_running:
2240    ///       initial_poll_delay: 60s # 1 minute
2241    ///       poll_delay_multiplier: 1.5
2242    ///       max_poll_delay: 360s # 6 minutes
2243    ///       total_poll_timeout: 54000s # 90 minutes
2244    /// ```
2245    pub long_running: std::option::Option<crate::model::method_settings::LongRunning>,
2246
2247    /// List of top-level fields of the request message, that should be
2248    /// automatically populated by the client libraries based on their
2249    /// (google.api.field_info).format. Currently supported format: UUID4.
2250    ///
2251    /// Example of a YAML configuration:
2252    ///
2253    /// ```norust
2254    /// publishing:
2255    ///   method_settings:
2256    ///   - selector: google.example.v1.ExampleService.CreateExample
2257    ///     auto_populated_fields:
2258    ///     - request_id
2259    /// ```
2260    pub auto_populated_fields: std::vec::Vec<std::string::String>,
2261
2262    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2263}
2264
2265impl MethodSettings {
2266    pub fn new() -> Self {
2267        std::default::Default::default()
2268    }
2269
2270    /// Sets the value of [selector][crate::model::MethodSettings::selector].
2271    pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2272        self.selector = v.into();
2273        self
2274    }
2275
2276    /// Sets the value of [long_running][crate::model::MethodSettings::long_running].
2277    pub fn set_long_running<T>(mut self, v: T) -> Self
2278    where
2279        T: std::convert::Into<crate::model::method_settings::LongRunning>,
2280    {
2281        self.long_running = std::option::Option::Some(v.into());
2282        self
2283    }
2284
2285    /// Sets or clears the value of [long_running][crate::model::MethodSettings::long_running].
2286    pub fn set_or_clear_long_running<T>(mut self, v: std::option::Option<T>) -> Self
2287    where
2288        T: std::convert::Into<crate::model::method_settings::LongRunning>,
2289    {
2290        self.long_running = v.map(|x| x.into());
2291        self
2292    }
2293
2294    /// Sets the value of [auto_populated_fields][crate::model::MethodSettings::auto_populated_fields].
2295    pub fn set_auto_populated_fields<T, V>(mut self, v: T) -> Self
2296    where
2297        T: std::iter::IntoIterator<Item = V>,
2298        V: std::convert::Into<std::string::String>,
2299    {
2300        use std::iter::Iterator;
2301        self.auto_populated_fields = v.into_iter().map(|i| i.into()).collect();
2302        self
2303    }
2304}
2305
2306impl wkt::message::Message for MethodSettings {
2307    fn typename() -> &'static str {
2308        "type.googleapis.com/google.api.MethodSettings"
2309    }
2310}
2311
2312/// Defines additional types related to [MethodSettings].
2313pub mod method_settings {
2314    #[allow(unused_imports)]
2315    use super::*;
2316
2317    /// Describes settings to use when generating API methods that use the
2318    /// long-running operation pattern.
2319    /// All default values below are from those used in the client library
2320    /// generators (e.g.
2321    /// [Java](https://github.com/googleapis/gapic-generator-java/blob/04c2faa191a9b5a10b92392fe8482279c4404803/src/main/java/com/google/api/generator/gapic/composer/common/RetrySettingsComposer.java)).
2322    #[derive(Clone, Default, PartialEq)]
2323    #[non_exhaustive]
2324    pub struct LongRunning {
2325        /// Initial delay after which the first poll request will be made.
2326        /// Default value: 5 seconds.
2327        pub initial_poll_delay: std::option::Option<wkt::Duration>,
2328
2329        /// Multiplier to gradually increase delay between subsequent polls until it
2330        /// reaches max_poll_delay.
2331        /// Default value: 1.5.
2332        pub poll_delay_multiplier: f32,
2333
2334        /// Maximum time between two subsequent poll requests.
2335        /// Default value: 45 seconds.
2336        pub max_poll_delay: std::option::Option<wkt::Duration>,
2337
2338        /// Total polling timeout.
2339        /// Default value: 5 minutes.
2340        pub total_poll_timeout: std::option::Option<wkt::Duration>,
2341
2342        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2343    }
2344
2345    impl LongRunning {
2346        pub fn new() -> Self {
2347            std::default::Default::default()
2348        }
2349
2350        /// Sets the value of [initial_poll_delay][crate::model::method_settings::LongRunning::initial_poll_delay].
2351        pub fn set_initial_poll_delay<T>(mut self, v: T) -> Self
2352        where
2353            T: std::convert::Into<wkt::Duration>,
2354        {
2355            self.initial_poll_delay = std::option::Option::Some(v.into());
2356            self
2357        }
2358
2359        /// Sets or clears the value of [initial_poll_delay][crate::model::method_settings::LongRunning::initial_poll_delay].
2360        pub fn set_or_clear_initial_poll_delay<T>(mut self, v: std::option::Option<T>) -> Self
2361        where
2362            T: std::convert::Into<wkt::Duration>,
2363        {
2364            self.initial_poll_delay = v.map(|x| x.into());
2365            self
2366        }
2367
2368        /// Sets the value of [poll_delay_multiplier][crate::model::method_settings::LongRunning::poll_delay_multiplier].
2369        pub fn set_poll_delay_multiplier<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
2370            self.poll_delay_multiplier = v.into();
2371            self
2372        }
2373
2374        /// Sets the value of [max_poll_delay][crate::model::method_settings::LongRunning::max_poll_delay].
2375        pub fn set_max_poll_delay<T>(mut self, v: T) -> Self
2376        where
2377            T: std::convert::Into<wkt::Duration>,
2378        {
2379            self.max_poll_delay = std::option::Option::Some(v.into());
2380            self
2381        }
2382
2383        /// Sets or clears the value of [max_poll_delay][crate::model::method_settings::LongRunning::max_poll_delay].
2384        pub fn set_or_clear_max_poll_delay<T>(mut self, v: std::option::Option<T>) -> Self
2385        where
2386            T: std::convert::Into<wkt::Duration>,
2387        {
2388            self.max_poll_delay = v.map(|x| x.into());
2389            self
2390        }
2391
2392        /// Sets the value of [total_poll_timeout][crate::model::method_settings::LongRunning::total_poll_timeout].
2393        pub fn set_total_poll_timeout<T>(mut self, v: T) -> Self
2394        where
2395            T: std::convert::Into<wkt::Duration>,
2396        {
2397            self.total_poll_timeout = std::option::Option::Some(v.into());
2398            self
2399        }
2400
2401        /// Sets or clears the value of [total_poll_timeout][crate::model::method_settings::LongRunning::total_poll_timeout].
2402        pub fn set_or_clear_total_poll_timeout<T>(mut self, v: std::option::Option<T>) -> Self
2403        where
2404            T: std::convert::Into<wkt::Duration>,
2405        {
2406            self.total_poll_timeout = v.map(|x| x.into());
2407            self
2408        }
2409    }
2410
2411    impl wkt::message::Message for LongRunning {
2412        fn typename() -> &'static str {
2413            "type.googleapis.com/google.api.MethodSettings.LongRunning"
2414        }
2415    }
2416}
2417
2418/// This message is used to configure the generation of a subset of the RPCs in
2419/// a service for client libraries.
2420#[derive(Clone, Default, PartialEq)]
2421#[non_exhaustive]
2422pub struct SelectiveGapicGeneration {
2423    /// An allowlist of the fully qualified names of RPCs that should be included
2424    /// on public client surfaces.
2425    pub methods: std::vec::Vec<std::string::String>,
2426
2427    /// Setting this to true indicates to the client generators that methods
2428    /// that would be excluded from the generation should instead be generated
2429    /// in a way that indicates these methods should not be consumed by
2430    /// end users. How this is expressed is up to individual language
2431    /// implementations to decide. Some examples may be: added annotations,
2432    /// obfuscated identifiers, or other language idiomatic patterns.
2433    pub generate_omitted_as_internal: bool,
2434
2435    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2436}
2437
2438impl SelectiveGapicGeneration {
2439    pub fn new() -> Self {
2440        std::default::Default::default()
2441    }
2442
2443    /// Sets the value of [methods][crate::model::SelectiveGapicGeneration::methods].
2444    pub fn set_methods<T, V>(mut self, v: T) -> Self
2445    where
2446        T: std::iter::IntoIterator<Item = V>,
2447        V: std::convert::Into<std::string::String>,
2448    {
2449        use std::iter::Iterator;
2450        self.methods = v.into_iter().map(|i| i.into()).collect();
2451        self
2452    }
2453
2454    /// Sets the value of [generate_omitted_as_internal][crate::model::SelectiveGapicGeneration::generate_omitted_as_internal].
2455    pub fn set_generate_omitted_as_internal<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2456        self.generate_omitted_as_internal = v.into();
2457        self
2458    }
2459}
2460
2461impl wkt::message::Message for SelectiveGapicGeneration {
2462    fn typename() -> &'static str {
2463        "type.googleapis.com/google.api.SelectiveGapicGeneration"
2464    }
2465}
2466
2467/// Output generated from semantically comparing two versions of a service
2468/// configuration.
2469///
2470/// Includes detailed information about a field that have changed with
2471/// applicable advice about potential consequences for the change, such as
2472/// backwards-incompatibility.
2473#[derive(Clone, Default, PartialEq)]
2474#[non_exhaustive]
2475pub struct ConfigChange {
2476    /// Object hierarchy path to the change, with levels separated by a '.'
2477    /// character. For repeated fields, an applicable unique identifier field is
2478    /// used for the index (usually selector, name, or id). For maps, the term
2479    /// 'key' is used. If the field has no unique identifier, the numeric index
2480    /// is used.
2481    /// Examples:
2482    ///
2483    /// - visibility.rules[selector=="google.LibraryService.ListBooks"].restriction
2484    /// - quota.metric_rules[selector=="google"].metric_costs[key=="reads"].value
2485    /// - logging.producer_destinations[0]
2486    pub element: std::string::String,
2487
2488    /// Value of the changed object in the old Service configuration,
2489    /// in JSON format. This field will not be populated if ChangeType == ADDED.
2490    pub old_value: std::string::String,
2491
2492    /// Value of the changed object in the new Service configuration,
2493    /// in JSON format. This field will not be populated if ChangeType == REMOVED.
2494    pub new_value: std::string::String,
2495
2496    /// The type for this change, either ADDED, REMOVED, or MODIFIED.
2497    pub change_type: crate::model::ChangeType,
2498
2499    /// Collection of advice provided for this change, useful for determining the
2500    /// possible impact of this change.
2501    pub advices: std::vec::Vec<crate::model::Advice>,
2502
2503    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2504}
2505
2506impl ConfigChange {
2507    pub fn new() -> Self {
2508        std::default::Default::default()
2509    }
2510
2511    /// Sets the value of [element][crate::model::ConfigChange::element].
2512    pub fn set_element<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2513        self.element = v.into();
2514        self
2515    }
2516
2517    /// Sets the value of [old_value][crate::model::ConfigChange::old_value].
2518    pub fn set_old_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2519        self.old_value = v.into();
2520        self
2521    }
2522
2523    /// Sets the value of [new_value][crate::model::ConfigChange::new_value].
2524    pub fn set_new_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2525        self.new_value = v.into();
2526        self
2527    }
2528
2529    /// Sets the value of [change_type][crate::model::ConfigChange::change_type].
2530    pub fn set_change_type<T: std::convert::Into<crate::model::ChangeType>>(
2531        mut self,
2532        v: T,
2533    ) -> Self {
2534        self.change_type = v.into();
2535        self
2536    }
2537
2538    /// Sets the value of [advices][crate::model::ConfigChange::advices].
2539    pub fn set_advices<T, V>(mut self, v: T) -> Self
2540    where
2541        T: std::iter::IntoIterator<Item = V>,
2542        V: std::convert::Into<crate::model::Advice>,
2543    {
2544        use std::iter::Iterator;
2545        self.advices = v.into_iter().map(|i| i.into()).collect();
2546        self
2547    }
2548}
2549
2550impl wkt::message::Message for ConfigChange {
2551    fn typename() -> &'static str {
2552        "type.googleapis.com/google.api.ConfigChange"
2553    }
2554}
2555
2556/// Generated advice about this change, used for providing more
2557/// information about how a change will affect the existing service.
2558#[derive(Clone, Default, PartialEq)]
2559#[non_exhaustive]
2560pub struct Advice {
2561    /// Useful description for why this advice was applied and what actions should
2562    /// be taken to mitigate any implied risks.
2563    pub description: std::string::String,
2564
2565    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2566}
2567
2568impl Advice {
2569    pub fn new() -> Self {
2570        std::default::Default::default()
2571    }
2572
2573    /// Sets the value of [description][crate::model::Advice::description].
2574    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2575        self.description = v.into();
2576        self
2577    }
2578}
2579
2580impl wkt::message::Message for Advice {
2581    fn typename() -> &'static str {
2582        "type.googleapis.com/google.api.Advice"
2583    }
2584}
2585
2586/// A descriptor for defining project properties for a service. One service may
2587/// have many consumer projects, and the service may want to behave differently
2588/// depending on some properties on the project. For example, a project may be
2589/// associated with a school, or a business, or a government agency, a business
2590/// type property on the project may affect how a service responds to the client.
2591/// This descriptor defines which properties are allowed to be set on a project.
2592///
2593/// Example:
2594///
2595/// ```norust
2596/// project_properties:
2597///   properties:
2598///   - name: NO_WATERMARK
2599///     type: BOOL
2600///     description: Allows usage of the API without watermarks.
2601///   - name: EXTENDED_TILE_CACHE_PERIOD
2602///     type: INT64
2603/// ```
2604#[derive(Clone, Default, PartialEq)]
2605#[non_exhaustive]
2606pub struct ProjectProperties {
2607    /// List of per consumer project-specific properties.
2608    pub properties: std::vec::Vec<crate::model::Property>,
2609
2610    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2611}
2612
2613impl ProjectProperties {
2614    pub fn new() -> Self {
2615        std::default::Default::default()
2616    }
2617
2618    /// Sets the value of [properties][crate::model::ProjectProperties::properties].
2619    pub fn set_properties<T, V>(mut self, v: T) -> Self
2620    where
2621        T: std::iter::IntoIterator<Item = V>,
2622        V: std::convert::Into<crate::model::Property>,
2623    {
2624        use std::iter::Iterator;
2625        self.properties = v.into_iter().map(|i| i.into()).collect();
2626        self
2627    }
2628}
2629
2630impl wkt::message::Message for ProjectProperties {
2631    fn typename() -> &'static str {
2632        "type.googleapis.com/google.api.ProjectProperties"
2633    }
2634}
2635
2636/// Defines project properties.
2637///
2638/// API services can define properties that can be assigned to consumer projects
2639/// so that backends can perform response customization without having to make
2640/// additional calls or maintain additional storage. For example, Maps API
2641/// defines properties that controls map tile cache period, or whether to embed a
2642/// watermark in a result.
2643///
2644/// These values can be set via API producer console. Only API providers can
2645/// define and set these properties.
2646#[derive(Clone, Default, PartialEq)]
2647#[non_exhaustive]
2648pub struct Property {
2649    /// The name of the property (a.k.a key).
2650    pub name: std::string::String,
2651
2652    /// The type of this property.
2653    pub r#type: crate::model::property::PropertyType,
2654
2655    /// The description of the property
2656    pub description: std::string::String,
2657
2658    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2659}
2660
2661impl Property {
2662    pub fn new() -> Self {
2663        std::default::Default::default()
2664    }
2665
2666    /// Sets the value of [name][crate::model::Property::name].
2667    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2668        self.name = v.into();
2669        self
2670    }
2671
2672    /// Sets the value of [r#type][crate::model::Property::type].
2673    pub fn set_type<T: std::convert::Into<crate::model::property::PropertyType>>(
2674        mut self,
2675        v: T,
2676    ) -> Self {
2677        self.r#type = v.into();
2678        self
2679    }
2680
2681    /// Sets the value of [description][crate::model::Property::description].
2682    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2683        self.description = v.into();
2684        self
2685    }
2686}
2687
2688impl wkt::message::Message for Property {
2689    fn typename() -> &'static str {
2690        "type.googleapis.com/google.api.Property"
2691    }
2692}
2693
2694/// Defines additional types related to [Property].
2695pub mod property {
2696    #[allow(unused_imports)]
2697    use super::*;
2698
2699    /// Supported data type of the property values
2700    ///
2701    /// # Working with unknown values
2702    ///
2703    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2704    /// additional enum variants at any time. Adding new variants is not considered
2705    /// a breaking change. Applications should write their code in anticipation of:
2706    ///
2707    /// - New values appearing in future releases of the client library, **and**
2708    /// - New values received dynamically, without application changes.
2709    ///
2710    /// Please consult the [Working with enums] section in the user guide for some
2711    /// guidelines.
2712    ///
2713    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2714    #[derive(Clone, Debug, PartialEq)]
2715    #[non_exhaustive]
2716    pub enum PropertyType {
2717        /// The type is unspecified, and will result in an error.
2718        Unspecified,
2719        /// The type is `int64`.
2720        Int64,
2721        /// The type is `bool`.
2722        Bool,
2723        /// The type is `string`.
2724        String,
2725        /// The type is 'double'.
2726        Double,
2727        /// If set, the enum was initialized with an unknown value.
2728        ///
2729        /// Applications can examine the value using [PropertyType::value] or
2730        /// [PropertyType::name].
2731        UnknownValue(property_type::UnknownValue),
2732    }
2733
2734    #[doc(hidden)]
2735    pub mod property_type {
2736        #[allow(unused_imports)]
2737        use super::*;
2738        #[derive(Clone, Debug, PartialEq)]
2739        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2740    }
2741
2742    impl PropertyType {
2743        /// Gets the enum value.
2744        ///
2745        /// Returns `None` if the enum contains an unknown value deserialized from
2746        /// the string representation of enums.
2747        pub fn value(&self) -> std::option::Option<i32> {
2748            match self {
2749                Self::Unspecified => std::option::Option::Some(0),
2750                Self::Int64 => std::option::Option::Some(1),
2751                Self::Bool => std::option::Option::Some(2),
2752                Self::String => std::option::Option::Some(3),
2753                Self::Double => std::option::Option::Some(4),
2754                Self::UnknownValue(u) => u.0.value(),
2755            }
2756        }
2757
2758        /// Gets the enum value as a string.
2759        ///
2760        /// Returns `None` if the enum contains an unknown value deserialized from
2761        /// the integer representation of enums.
2762        pub fn name(&self) -> std::option::Option<&str> {
2763            match self {
2764                Self::Unspecified => std::option::Option::Some("UNSPECIFIED"),
2765                Self::Int64 => std::option::Option::Some("INT64"),
2766                Self::Bool => std::option::Option::Some("BOOL"),
2767                Self::String => std::option::Option::Some("STRING"),
2768                Self::Double => std::option::Option::Some("DOUBLE"),
2769                Self::UnknownValue(u) => u.0.name(),
2770            }
2771        }
2772    }
2773
2774    impl std::default::Default for PropertyType {
2775        fn default() -> Self {
2776            use std::convert::From;
2777            Self::from(0)
2778        }
2779    }
2780
2781    impl std::fmt::Display for PropertyType {
2782        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2783            wkt::internal::display_enum(f, self.name(), self.value())
2784        }
2785    }
2786
2787    impl std::convert::From<i32> for PropertyType {
2788        fn from(value: i32) -> Self {
2789            match value {
2790                0 => Self::Unspecified,
2791                1 => Self::Int64,
2792                2 => Self::Bool,
2793                3 => Self::String,
2794                4 => Self::Double,
2795                _ => Self::UnknownValue(property_type::UnknownValue(
2796                    wkt::internal::UnknownEnumValue::Integer(value),
2797                )),
2798            }
2799        }
2800    }
2801
2802    impl std::convert::From<&str> for PropertyType {
2803        fn from(value: &str) -> Self {
2804            use std::string::ToString;
2805            match value {
2806                "UNSPECIFIED" => Self::Unspecified,
2807                "INT64" => Self::Int64,
2808                "BOOL" => Self::Bool,
2809                "STRING" => Self::String,
2810                "DOUBLE" => Self::Double,
2811                _ => Self::UnknownValue(property_type::UnknownValue(
2812                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2813                )),
2814            }
2815        }
2816    }
2817
2818    impl serde::ser::Serialize for PropertyType {
2819        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2820        where
2821            S: serde::Serializer,
2822        {
2823            match self {
2824                Self::Unspecified => serializer.serialize_i32(0),
2825                Self::Int64 => serializer.serialize_i32(1),
2826                Self::Bool => serializer.serialize_i32(2),
2827                Self::String => serializer.serialize_i32(3),
2828                Self::Double => serializer.serialize_i32(4),
2829                Self::UnknownValue(u) => u.0.serialize(serializer),
2830            }
2831        }
2832    }
2833
2834    impl<'de> serde::de::Deserialize<'de> for PropertyType {
2835        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2836        where
2837            D: serde::Deserializer<'de>,
2838        {
2839            deserializer.deserialize_any(wkt::internal::EnumVisitor::<PropertyType>::new(
2840                ".google.api.Property.PropertyType",
2841            ))
2842        }
2843    }
2844}
2845
2846/// `Context` defines which contexts an API requests.
2847///
2848/// Example:
2849///
2850/// ```norust
2851/// context:
2852///   rules:
2853///   - selector: "*"
2854///     requested:
2855///     - google.rpc.context.ProjectContext
2856///     - google.rpc.context.OriginContext
2857/// ```
2858///
2859/// The above specifies that all methods in the API request
2860/// `google.rpc.context.ProjectContext` and
2861/// `google.rpc.context.OriginContext`.
2862///
2863/// Available context types are defined in package
2864/// `google.rpc.context`.
2865///
2866/// This also provides mechanism to allowlist any protobuf message extension that
2867/// can be sent in grpc metadata using “x-goog-ext-<extension_id>-bin” and
2868/// “x-goog-ext-<extension_id>-jspb” format. For example, list any service
2869/// specific protobuf types that can appear in grpc metadata as follows in your
2870/// yaml file:
2871///
2872/// Example:
2873///
2874/// ```norust
2875/// context:
2876///   rules:
2877///    - selector: "google.example.library.v1.LibraryService.CreateBook"
2878///      allowed_request_extensions:
2879///      - google.foo.v1.NewExtension
2880///      allowed_response_extensions:
2881///      - google.foo.v1.NewExtension
2882/// ```
2883///
2884/// You can also specify extension ID instead of fully qualified extension name
2885/// here.
2886#[derive(Clone, Default, PartialEq)]
2887#[non_exhaustive]
2888pub struct Context {
2889    /// A list of RPC context rules that apply to individual API methods.
2890    ///
2891    /// **NOTE:** All service configuration rules follow "last one wins" order.
2892    pub rules: std::vec::Vec<crate::model::ContextRule>,
2893
2894    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2895}
2896
2897impl Context {
2898    pub fn new() -> Self {
2899        std::default::Default::default()
2900    }
2901
2902    /// Sets the value of [rules][crate::model::Context::rules].
2903    pub fn set_rules<T, V>(mut self, v: T) -> Self
2904    where
2905        T: std::iter::IntoIterator<Item = V>,
2906        V: std::convert::Into<crate::model::ContextRule>,
2907    {
2908        use std::iter::Iterator;
2909        self.rules = v.into_iter().map(|i| i.into()).collect();
2910        self
2911    }
2912}
2913
2914impl wkt::message::Message for Context {
2915    fn typename() -> &'static str {
2916        "type.googleapis.com/google.api.Context"
2917    }
2918}
2919
2920/// A context rule provides information about the context for an individual API
2921/// element.
2922#[derive(Clone, Default, PartialEq)]
2923#[non_exhaustive]
2924pub struct ContextRule {
2925    /// Selects the methods to which this rule applies.
2926    ///
2927    /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
2928    /// details.
2929    ///
2930    /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
2931    pub selector: std::string::String,
2932
2933    /// A list of full type names of requested contexts, only the requested context
2934    /// will be made available to the backend.
2935    pub requested: std::vec::Vec<std::string::String>,
2936
2937    /// A list of full type names of provided contexts. It is used to support
2938    /// propagating HTTP headers and ETags from the response extension.
2939    pub provided: std::vec::Vec<std::string::String>,
2940
2941    /// A list of full type names or extension IDs of extensions allowed in grpc
2942    /// side channel from client to backend.
2943    pub allowed_request_extensions: std::vec::Vec<std::string::String>,
2944
2945    /// A list of full type names or extension IDs of extensions allowed in grpc
2946    /// side channel from backend to client.
2947    pub allowed_response_extensions: std::vec::Vec<std::string::String>,
2948
2949    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2950}
2951
2952impl ContextRule {
2953    pub fn new() -> Self {
2954        std::default::Default::default()
2955    }
2956
2957    /// Sets the value of [selector][crate::model::ContextRule::selector].
2958    pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2959        self.selector = v.into();
2960        self
2961    }
2962
2963    /// Sets the value of [requested][crate::model::ContextRule::requested].
2964    pub fn set_requested<T, V>(mut self, v: T) -> Self
2965    where
2966        T: std::iter::IntoIterator<Item = V>,
2967        V: std::convert::Into<std::string::String>,
2968    {
2969        use std::iter::Iterator;
2970        self.requested = v.into_iter().map(|i| i.into()).collect();
2971        self
2972    }
2973
2974    /// Sets the value of [provided][crate::model::ContextRule::provided].
2975    pub fn set_provided<T, V>(mut self, v: T) -> Self
2976    where
2977        T: std::iter::IntoIterator<Item = V>,
2978        V: std::convert::Into<std::string::String>,
2979    {
2980        use std::iter::Iterator;
2981        self.provided = v.into_iter().map(|i| i.into()).collect();
2982        self
2983    }
2984
2985    /// Sets the value of [allowed_request_extensions][crate::model::ContextRule::allowed_request_extensions].
2986    pub fn set_allowed_request_extensions<T, V>(mut self, v: T) -> Self
2987    where
2988        T: std::iter::IntoIterator<Item = V>,
2989        V: std::convert::Into<std::string::String>,
2990    {
2991        use std::iter::Iterator;
2992        self.allowed_request_extensions = v.into_iter().map(|i| i.into()).collect();
2993        self
2994    }
2995
2996    /// Sets the value of [allowed_response_extensions][crate::model::ContextRule::allowed_response_extensions].
2997    pub fn set_allowed_response_extensions<T, V>(mut self, v: T) -> Self
2998    where
2999        T: std::iter::IntoIterator<Item = V>,
3000        V: std::convert::Into<std::string::String>,
3001    {
3002        use std::iter::Iterator;
3003        self.allowed_response_extensions = v.into_iter().map(|i| i.into()).collect();
3004        self
3005    }
3006}
3007
3008impl wkt::message::Message for ContextRule {
3009    fn typename() -> &'static str {
3010        "type.googleapis.com/google.api.ContextRule"
3011    }
3012}
3013
3014/// Selects and configures the service controller used by the service.
3015///
3016/// Example:
3017///
3018/// ```norust
3019/// control:
3020///   environment: servicecontrol.googleapis.com
3021/// ```
3022#[derive(Clone, Default, PartialEq)]
3023#[non_exhaustive]
3024pub struct Control {
3025    /// The service controller environment to use. If empty, no control plane
3026    /// feature (like quota and billing) will be enabled. The recommended value for
3027    /// most services is servicecontrol.googleapis.com
3028    pub environment: std::string::String,
3029
3030    /// Defines policies applying to the API methods of the service.
3031    pub method_policies: std::vec::Vec<crate::model::MethodPolicy>,
3032
3033    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3034}
3035
3036impl Control {
3037    pub fn new() -> Self {
3038        std::default::Default::default()
3039    }
3040
3041    /// Sets the value of [environment][crate::model::Control::environment].
3042    pub fn set_environment<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3043        self.environment = v.into();
3044        self
3045    }
3046
3047    /// Sets the value of [method_policies][crate::model::Control::method_policies].
3048    pub fn set_method_policies<T, V>(mut self, v: T) -> Self
3049    where
3050        T: std::iter::IntoIterator<Item = V>,
3051        V: std::convert::Into<crate::model::MethodPolicy>,
3052    {
3053        use std::iter::Iterator;
3054        self.method_policies = v.into_iter().map(|i| i.into()).collect();
3055        self
3056    }
3057}
3058
3059impl wkt::message::Message for Control {
3060    fn typename() -> &'static str {
3061        "type.googleapis.com/google.api.Control"
3062    }
3063}
3064
3065/// `Distribution` contains summary statistics for a population of values. It
3066/// optionally contains a histogram representing the distribution of those values
3067/// across a set of buckets.
3068///
3069/// The summary statistics are the count, mean, sum of the squared deviation from
3070/// the mean, the minimum, and the maximum of the set of population of values.
3071/// The histogram is based on a sequence of buckets and gives a count of values
3072/// that fall into each bucket. The boundaries of the buckets are given either
3073/// explicitly or by formulas for buckets of fixed or exponentially increasing
3074/// widths.
3075///
3076/// Although it is not forbidden, it is generally a bad idea to include
3077/// non-finite values (infinities or NaNs) in the population of values, as this
3078/// will render the `mean` and `sum_of_squared_deviation` fields meaningless.
3079#[derive(Clone, Default, PartialEq)]
3080#[non_exhaustive]
3081pub struct Distribution {
3082    /// The number of values in the population. Must be non-negative. This value
3083    /// must equal the sum of the values in `bucket_counts` if a histogram is
3084    /// provided.
3085    pub count: i64,
3086
3087    /// The arithmetic mean of the values in the population. If `count` is zero
3088    /// then this field must be zero.
3089    pub mean: f64,
3090
3091    /// The sum of squared deviations from the mean of the values in the
3092    /// population. For values x_i this is:
3093    ///
3094    /// ```norust
3095    /// Sum[i=1..n]((x_i - mean)^2)
3096    /// ```
3097    ///
3098    /// Knuth, "The Art of Computer Programming", Vol. 2, page 232, 3rd edition
3099    /// describes Welford's method for accumulating this sum in one pass.
3100    ///
3101    /// If `count` is zero then this field must be zero.
3102    pub sum_of_squared_deviation: f64,
3103
3104    /// If specified, contains the range of the population values. The field
3105    /// must not be present if the `count` is zero.
3106    pub range: std::option::Option<crate::model::distribution::Range>,
3107
3108    /// Defines the histogram bucket boundaries. If the distribution does not
3109    /// contain a histogram, then omit this field.
3110    pub bucket_options: std::option::Option<crate::model::distribution::BucketOptions>,
3111
3112    /// The number of values in each bucket of the histogram, as described in
3113    /// `bucket_options`. If the distribution does not have a histogram, then omit
3114    /// this field. If there is a histogram, then the sum of the values in
3115    /// `bucket_counts` must equal the value in the `count` field of the
3116    /// distribution.
3117    ///
3118    /// If present, `bucket_counts` should contain N values, where N is the number
3119    /// of buckets specified in `bucket_options`. If you supply fewer than N
3120    /// values, the remaining values are assumed to be 0.
3121    ///
3122    /// The order of the values in `bucket_counts` follows the bucket numbering
3123    /// schemes described for the three bucket types. The first value must be the
3124    /// count for the underflow bucket (number 0). The next N-2 values are the
3125    /// counts for the finite buckets (number 1 through N-2). The N'th value in
3126    /// `bucket_counts` is the count for the overflow bucket (number N-1).
3127    pub bucket_counts: std::vec::Vec<i64>,
3128
3129    /// Must be in increasing order of `value` field.
3130    pub exemplars: std::vec::Vec<crate::model::distribution::Exemplar>,
3131
3132    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3133}
3134
3135impl Distribution {
3136    pub fn new() -> Self {
3137        std::default::Default::default()
3138    }
3139
3140    /// Sets the value of [count][crate::model::Distribution::count].
3141    pub fn set_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
3142        self.count = v.into();
3143        self
3144    }
3145
3146    /// Sets the value of [mean][crate::model::Distribution::mean].
3147    pub fn set_mean<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
3148        self.mean = v.into();
3149        self
3150    }
3151
3152    /// Sets the value of [sum_of_squared_deviation][crate::model::Distribution::sum_of_squared_deviation].
3153    pub fn set_sum_of_squared_deviation<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
3154        self.sum_of_squared_deviation = v.into();
3155        self
3156    }
3157
3158    /// Sets the value of [range][crate::model::Distribution::range].
3159    pub fn set_range<T>(mut self, v: T) -> Self
3160    where
3161        T: std::convert::Into<crate::model::distribution::Range>,
3162    {
3163        self.range = std::option::Option::Some(v.into());
3164        self
3165    }
3166
3167    /// Sets or clears the value of [range][crate::model::Distribution::range].
3168    pub fn set_or_clear_range<T>(mut self, v: std::option::Option<T>) -> Self
3169    where
3170        T: std::convert::Into<crate::model::distribution::Range>,
3171    {
3172        self.range = v.map(|x| x.into());
3173        self
3174    }
3175
3176    /// Sets the value of [bucket_options][crate::model::Distribution::bucket_options].
3177    pub fn set_bucket_options<T>(mut self, v: T) -> Self
3178    where
3179        T: std::convert::Into<crate::model::distribution::BucketOptions>,
3180    {
3181        self.bucket_options = std::option::Option::Some(v.into());
3182        self
3183    }
3184
3185    /// Sets or clears the value of [bucket_options][crate::model::Distribution::bucket_options].
3186    pub fn set_or_clear_bucket_options<T>(mut self, v: std::option::Option<T>) -> Self
3187    where
3188        T: std::convert::Into<crate::model::distribution::BucketOptions>,
3189    {
3190        self.bucket_options = v.map(|x| x.into());
3191        self
3192    }
3193
3194    /// Sets the value of [bucket_counts][crate::model::Distribution::bucket_counts].
3195    pub fn set_bucket_counts<T, V>(mut self, v: T) -> Self
3196    where
3197        T: std::iter::IntoIterator<Item = V>,
3198        V: std::convert::Into<i64>,
3199    {
3200        use std::iter::Iterator;
3201        self.bucket_counts = v.into_iter().map(|i| i.into()).collect();
3202        self
3203    }
3204
3205    /// Sets the value of [exemplars][crate::model::Distribution::exemplars].
3206    pub fn set_exemplars<T, V>(mut self, v: T) -> Self
3207    where
3208        T: std::iter::IntoIterator<Item = V>,
3209        V: std::convert::Into<crate::model::distribution::Exemplar>,
3210    {
3211        use std::iter::Iterator;
3212        self.exemplars = v.into_iter().map(|i| i.into()).collect();
3213        self
3214    }
3215}
3216
3217impl wkt::message::Message for Distribution {
3218    fn typename() -> &'static str {
3219        "type.googleapis.com/google.api.Distribution"
3220    }
3221}
3222
3223/// Defines additional types related to [Distribution].
3224pub mod distribution {
3225    #[allow(unused_imports)]
3226    use super::*;
3227
3228    /// The range of the population values.
3229    #[derive(Clone, Default, PartialEq)]
3230    #[non_exhaustive]
3231    pub struct Range {
3232        /// The minimum of the population values.
3233        pub min: f64,
3234
3235        /// The maximum of the population values.
3236        pub max: f64,
3237
3238        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3239    }
3240
3241    impl Range {
3242        pub fn new() -> Self {
3243            std::default::Default::default()
3244        }
3245
3246        /// Sets the value of [min][crate::model::distribution::Range::min].
3247        pub fn set_min<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
3248            self.min = v.into();
3249            self
3250        }
3251
3252        /// Sets the value of [max][crate::model::distribution::Range::max].
3253        pub fn set_max<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
3254            self.max = v.into();
3255            self
3256        }
3257    }
3258
3259    impl wkt::message::Message for Range {
3260        fn typename() -> &'static str {
3261            "type.googleapis.com/google.api.Distribution.Range"
3262        }
3263    }
3264
3265    /// `BucketOptions` describes the bucket boundaries used to create a histogram
3266    /// for the distribution. The buckets can be in a linear sequence, an
3267    /// exponential sequence, or each bucket can be specified explicitly.
3268    /// `BucketOptions` does not include the number of values in each bucket.
3269    ///
3270    /// A bucket has an inclusive lower bound and exclusive upper bound for the
3271    /// values that are counted for that bucket. The upper bound of a bucket must
3272    /// be strictly greater than the lower bound. The sequence of N buckets for a
3273    /// distribution consists of an underflow bucket (number 0), zero or more
3274    /// finite buckets (number 1 through N - 2) and an overflow bucket (number N -
3275    /// 1). The buckets are contiguous: the lower bound of bucket i (i > 0) is the
3276    /// same as the upper bound of bucket i - 1. The buckets span the whole range
3277    /// of finite values: lower bound of the underflow bucket is -infinity and the
3278    /// upper bound of the overflow bucket is +infinity. The finite buckets are
3279    /// so-called because both bounds are finite.
3280    #[derive(Clone, Default, PartialEq)]
3281    #[non_exhaustive]
3282    pub struct BucketOptions {
3283        /// Exactly one of these three fields must be set.
3284        pub options: std::option::Option<crate::model::distribution::bucket_options::Options>,
3285
3286        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3287    }
3288
3289    impl BucketOptions {
3290        pub fn new() -> Self {
3291            std::default::Default::default()
3292        }
3293
3294        /// Sets the value of [options][crate::model::distribution::BucketOptions::options].
3295        ///
3296        /// Note that all the setters affecting `options` are mutually
3297        /// exclusive.
3298        pub fn set_options<
3299            T: std::convert::Into<
3300                    std::option::Option<crate::model::distribution::bucket_options::Options>,
3301                >,
3302        >(
3303            mut self,
3304            v: T,
3305        ) -> Self {
3306            self.options = v.into();
3307            self
3308        }
3309
3310        /// The value of [options][crate::model::distribution::BucketOptions::options]
3311        /// if it holds a `LinearBuckets`, `None` if the field is not set or
3312        /// holds a different branch.
3313        pub fn linear_buckets(
3314            &self,
3315        ) -> std::option::Option<&std::boxed::Box<crate::model::distribution::bucket_options::Linear>>
3316        {
3317            #[allow(unreachable_patterns)]
3318            self.options.as_ref().and_then(|v| match v {
3319                crate::model::distribution::bucket_options::Options::LinearBuckets(v) => {
3320                    std::option::Option::Some(v)
3321                }
3322                _ => std::option::Option::None,
3323            })
3324        }
3325
3326        /// Sets the value of [options][crate::model::distribution::BucketOptions::options]
3327        /// to hold a `LinearBuckets`.
3328        ///
3329        /// Note that all the setters affecting `options` are
3330        /// mutually exclusive.
3331        pub fn set_linear_buckets<
3332            T: std::convert::Into<std::boxed::Box<crate::model::distribution::bucket_options::Linear>>,
3333        >(
3334            mut self,
3335            v: T,
3336        ) -> Self {
3337            self.options = std::option::Option::Some(
3338                crate::model::distribution::bucket_options::Options::LinearBuckets(v.into()),
3339            );
3340            self
3341        }
3342
3343        /// The value of [options][crate::model::distribution::BucketOptions::options]
3344        /// if it holds a `ExponentialBuckets`, `None` if the field is not set or
3345        /// holds a different branch.
3346        pub fn exponential_buckets(
3347            &self,
3348        ) -> std::option::Option<
3349            &std::boxed::Box<crate::model::distribution::bucket_options::Exponential>,
3350        > {
3351            #[allow(unreachable_patterns)]
3352            self.options.as_ref().and_then(|v| match v {
3353                crate::model::distribution::bucket_options::Options::ExponentialBuckets(v) => {
3354                    std::option::Option::Some(v)
3355                }
3356                _ => std::option::Option::None,
3357            })
3358        }
3359
3360        /// Sets the value of [options][crate::model::distribution::BucketOptions::options]
3361        /// to hold a `ExponentialBuckets`.
3362        ///
3363        /// Note that all the setters affecting `options` are
3364        /// mutually exclusive.
3365        pub fn set_exponential_buckets<
3366            T: std::convert::Into<
3367                    std::boxed::Box<crate::model::distribution::bucket_options::Exponential>,
3368                >,
3369        >(
3370            mut self,
3371            v: T,
3372        ) -> Self {
3373            self.options = std::option::Option::Some(
3374                crate::model::distribution::bucket_options::Options::ExponentialBuckets(v.into()),
3375            );
3376            self
3377        }
3378
3379        /// The value of [options][crate::model::distribution::BucketOptions::options]
3380        /// if it holds a `ExplicitBuckets`, `None` if the field is not set or
3381        /// holds a different branch.
3382        pub fn explicit_buckets(
3383            &self,
3384        ) -> std::option::Option<
3385            &std::boxed::Box<crate::model::distribution::bucket_options::Explicit>,
3386        > {
3387            #[allow(unreachable_patterns)]
3388            self.options.as_ref().and_then(|v| match v {
3389                crate::model::distribution::bucket_options::Options::ExplicitBuckets(v) => {
3390                    std::option::Option::Some(v)
3391                }
3392                _ => std::option::Option::None,
3393            })
3394        }
3395
3396        /// Sets the value of [options][crate::model::distribution::BucketOptions::options]
3397        /// to hold a `ExplicitBuckets`.
3398        ///
3399        /// Note that all the setters affecting `options` are
3400        /// mutually exclusive.
3401        pub fn set_explicit_buckets<
3402            T: std::convert::Into<
3403                    std::boxed::Box<crate::model::distribution::bucket_options::Explicit>,
3404                >,
3405        >(
3406            mut self,
3407            v: T,
3408        ) -> Self {
3409            self.options = std::option::Option::Some(
3410                crate::model::distribution::bucket_options::Options::ExplicitBuckets(v.into()),
3411            );
3412            self
3413        }
3414    }
3415
3416    impl wkt::message::Message for BucketOptions {
3417        fn typename() -> &'static str {
3418            "type.googleapis.com/google.api.Distribution.BucketOptions"
3419        }
3420    }
3421
3422    /// Defines additional types related to [BucketOptions].
3423    pub mod bucket_options {
3424        #[allow(unused_imports)]
3425        use super::*;
3426
3427        /// Specifies a linear sequence of buckets that all have the same width
3428        /// (except overflow and underflow). Each bucket represents a constant
3429        /// absolute uncertainty on the specific value in the bucket.
3430        ///
3431        /// There are `num_finite_buckets + 2` (= N) buckets. Bucket `i` has the
3432        /// following boundaries:
3433        ///
3434        /// Upper bound (0 <= i < N-1):     offset + (width * i).
3435        ///
3436        /// Lower bound (1 <= i < N):       offset + (width * (i - 1)).
3437        #[derive(Clone, Default, PartialEq)]
3438        #[non_exhaustive]
3439        pub struct Linear {
3440            /// Must be greater than 0.
3441            pub num_finite_buckets: i32,
3442
3443            /// Must be greater than 0.
3444            pub width: f64,
3445
3446            /// Lower bound of the first bucket.
3447            pub offset: f64,
3448
3449            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3450        }
3451
3452        impl Linear {
3453            pub fn new() -> Self {
3454                std::default::Default::default()
3455            }
3456
3457            /// Sets the value of [num_finite_buckets][crate::model::distribution::bucket_options::Linear::num_finite_buckets].
3458            pub fn set_num_finite_buckets<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3459                self.num_finite_buckets = v.into();
3460                self
3461            }
3462
3463            /// Sets the value of [width][crate::model::distribution::bucket_options::Linear::width].
3464            pub fn set_width<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
3465                self.width = v.into();
3466                self
3467            }
3468
3469            /// Sets the value of [offset][crate::model::distribution::bucket_options::Linear::offset].
3470            pub fn set_offset<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
3471                self.offset = v.into();
3472                self
3473            }
3474        }
3475
3476        impl wkt::message::Message for Linear {
3477            fn typename() -> &'static str {
3478                "type.googleapis.com/google.api.Distribution.BucketOptions.Linear"
3479            }
3480        }
3481
3482        /// Specifies an exponential sequence of buckets that have a width that is
3483        /// proportional to the value of the lower bound. Each bucket represents a
3484        /// constant relative uncertainty on a specific value in the bucket.
3485        ///
3486        /// There are `num_finite_buckets + 2` (= N) buckets. Bucket `i` has the
3487        /// following boundaries:
3488        ///
3489        /// Upper bound (0 <= i < N-1):     scale * (growth_factor ^ i).
3490        ///
3491        /// Lower bound (1 <= i < N):       scale * (growth_factor ^ (i - 1)).
3492        #[derive(Clone, Default, PartialEq)]
3493        #[non_exhaustive]
3494        pub struct Exponential {
3495            /// Must be greater than 0.
3496            pub num_finite_buckets: i32,
3497
3498            /// Must be greater than 1.
3499            pub growth_factor: f64,
3500
3501            /// Must be greater than 0.
3502            pub scale: f64,
3503
3504            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3505        }
3506
3507        impl Exponential {
3508            pub fn new() -> Self {
3509                std::default::Default::default()
3510            }
3511
3512            /// Sets the value of [num_finite_buckets][crate::model::distribution::bucket_options::Exponential::num_finite_buckets].
3513            pub fn set_num_finite_buckets<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3514                self.num_finite_buckets = v.into();
3515                self
3516            }
3517
3518            /// Sets the value of [growth_factor][crate::model::distribution::bucket_options::Exponential::growth_factor].
3519            pub fn set_growth_factor<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
3520                self.growth_factor = v.into();
3521                self
3522            }
3523
3524            /// Sets the value of [scale][crate::model::distribution::bucket_options::Exponential::scale].
3525            pub fn set_scale<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
3526                self.scale = v.into();
3527                self
3528            }
3529        }
3530
3531        impl wkt::message::Message for Exponential {
3532            fn typename() -> &'static str {
3533                "type.googleapis.com/google.api.Distribution.BucketOptions.Exponential"
3534            }
3535        }
3536
3537        /// Specifies a set of buckets with arbitrary widths.
3538        ///
3539        /// There are `size(bounds) + 1` (= N) buckets. Bucket `i` has the following
3540        /// boundaries:
3541        ///
3542        /// Upper bound (0 <= i < N-1):     bounds[i]
3543        /// Lower bound (1 <= i < N);       bounds[i - 1]
3544        ///
3545        /// The `bounds` field must contain at least one element. If `bounds` has
3546        /// only one element, then there are no finite buckets, and that single
3547        /// element is the common boundary of the overflow and underflow buckets.
3548        #[derive(Clone, Default, PartialEq)]
3549        #[non_exhaustive]
3550        pub struct Explicit {
3551            /// The values must be monotonically increasing.
3552            pub bounds: std::vec::Vec<f64>,
3553
3554            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3555        }
3556
3557        impl Explicit {
3558            pub fn new() -> Self {
3559                std::default::Default::default()
3560            }
3561
3562            /// Sets the value of [bounds][crate::model::distribution::bucket_options::Explicit::bounds].
3563            pub fn set_bounds<T, V>(mut self, v: T) -> Self
3564            where
3565                T: std::iter::IntoIterator<Item = V>,
3566                V: std::convert::Into<f64>,
3567            {
3568                use std::iter::Iterator;
3569                self.bounds = v.into_iter().map(|i| i.into()).collect();
3570                self
3571            }
3572        }
3573
3574        impl wkt::message::Message for Explicit {
3575            fn typename() -> &'static str {
3576                "type.googleapis.com/google.api.Distribution.BucketOptions.Explicit"
3577            }
3578        }
3579
3580        /// Exactly one of these three fields must be set.
3581        #[derive(Clone, Debug, PartialEq)]
3582        #[non_exhaustive]
3583        pub enum Options {
3584            /// The linear bucket.
3585            LinearBuckets(std::boxed::Box<crate::model::distribution::bucket_options::Linear>),
3586            /// The exponential buckets.
3587            ExponentialBuckets(
3588                std::boxed::Box<crate::model::distribution::bucket_options::Exponential>,
3589            ),
3590            /// The explicit buckets.
3591            ExplicitBuckets(std::boxed::Box<crate::model::distribution::bucket_options::Explicit>),
3592        }
3593    }
3594
3595    /// Exemplars are example points that may be used to annotate aggregated
3596    /// distribution values. They are metadata that gives information about a
3597    /// particular value added to a Distribution bucket, such as a trace ID that
3598    /// was active when a value was added. They may contain further information,
3599    /// such as a example values and timestamps, origin, etc.
3600    #[derive(Clone, Default, PartialEq)]
3601    #[non_exhaustive]
3602    pub struct Exemplar {
3603        /// Value of the exemplar point. This value determines to which bucket the
3604        /// exemplar belongs.
3605        pub value: f64,
3606
3607        /// The observation (sampling) time of the above value.
3608        pub timestamp: std::option::Option<wkt::Timestamp>,
3609
3610        /// Contextual information about the example value. Examples are:
3611        ///
3612        /// Trace: type.googleapis.com/google.monitoring.v3.SpanContext
3613        ///
3614        /// Literal string: type.googleapis.com/google.protobuf.StringValue
3615        ///
3616        /// Labels dropped during aggregation:
3617        /// type.googleapis.com/google.monitoring.v3.DroppedLabels
3618        ///
3619        /// There may be only a single attachment of any given message type in a
3620        /// single exemplar, and this is enforced by the system.
3621        pub attachments: std::vec::Vec<wkt::Any>,
3622
3623        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3624    }
3625
3626    impl Exemplar {
3627        pub fn new() -> Self {
3628            std::default::Default::default()
3629        }
3630
3631        /// Sets the value of [value][crate::model::distribution::Exemplar::value].
3632        pub fn set_value<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
3633            self.value = v.into();
3634            self
3635        }
3636
3637        /// Sets the value of [timestamp][crate::model::distribution::Exemplar::timestamp].
3638        pub fn set_timestamp<T>(mut self, v: T) -> Self
3639        where
3640            T: std::convert::Into<wkt::Timestamp>,
3641        {
3642            self.timestamp = std::option::Option::Some(v.into());
3643            self
3644        }
3645
3646        /// Sets or clears the value of [timestamp][crate::model::distribution::Exemplar::timestamp].
3647        pub fn set_or_clear_timestamp<T>(mut self, v: std::option::Option<T>) -> Self
3648        where
3649            T: std::convert::Into<wkt::Timestamp>,
3650        {
3651            self.timestamp = v.map(|x| x.into());
3652            self
3653        }
3654
3655        /// Sets the value of [attachments][crate::model::distribution::Exemplar::attachments].
3656        pub fn set_attachments<T, V>(mut self, v: T) -> Self
3657        where
3658            T: std::iter::IntoIterator<Item = V>,
3659            V: std::convert::Into<wkt::Any>,
3660        {
3661            use std::iter::Iterator;
3662            self.attachments = v.into_iter().map(|i| i.into()).collect();
3663            self
3664        }
3665    }
3666
3667    impl wkt::message::Message for Exemplar {
3668        fn typename() -> &'static str {
3669            "type.googleapis.com/google.api.Distribution.Exemplar"
3670        }
3671    }
3672}
3673
3674/// `Documentation` provides the information for describing a service.
3675///
3676/// Example:
3677///
3678/// Documentation is provided in markdown syntax. In addition to
3679/// standard markdown features, definition lists, tables and fenced
3680/// code blocks are supported. Section headers can be provided and are
3681/// interpreted relative to the section nesting of the context where
3682/// a documentation fragment is embedded.
3683///
3684/// Documentation from the IDL is merged with documentation defined
3685/// via the config at normalization time, where documentation provided
3686/// by config rules overrides IDL provided.
3687///
3688/// A number of constructs specific to the API platform are supported
3689/// in documentation text.
3690///
3691/// In order to reference a proto element, the following
3692/// notation can be used:
3693///
3694/// To override the display text used for the link, this can be used:
3695///
3696/// Text can be excluded from doc using the following notation:
3697///
3698/// A few directives are available in documentation. Note that
3699/// directives must appear on a single line to be properly
3700/// identified. The `include` directive includes a markdown file from
3701/// an external source:
3702///
3703/// The `resource_for` directive marks a message to be the resource of
3704/// a collection in REST view. If it is not specified, tools attempt
3705/// to infer the resource from the operations in a collection:
3706///
3707/// The directive `suppress_warning` does not directly affect documentation
3708/// and is documented together with service config validation.
3709#[derive(Clone, Default, PartialEq)]
3710#[non_exhaustive]
3711pub struct Documentation {
3712    /// A short description of what the service does. The summary must be plain
3713    /// text. It becomes the overview of the service displayed in Google Cloud
3714    /// Console.
3715    /// NOTE: This field is equivalent to the standard field `description`.
3716    pub summary: std::string::String,
3717
3718    /// The top level pages for the documentation set.
3719    pub pages: std::vec::Vec<crate::model::Page>,
3720
3721    /// A list of documentation rules that apply to individual API elements.
3722    ///
3723    /// **NOTE:** All service configuration rules follow "last one wins" order.
3724    pub rules: std::vec::Vec<crate::model::DocumentationRule>,
3725
3726    /// The URL to the root of documentation.
3727    pub documentation_root_url: std::string::String,
3728
3729    /// Specifies the service root url if the default one (the service name
3730    /// from the yaml file) is not suitable. This can be seen in any fully
3731    /// specified service urls as well as sections that show a base that other
3732    /// urls are relative to.
3733    pub service_root_url: std::string::String,
3734
3735    /// Declares a single overview page. For example:
3736    ///
3737    /// This is a shortcut for the following declaration (using pages style):
3738    ///
3739    /// Note: you cannot specify both `overview` field and `pages` field.
3740    pub overview: std::string::String,
3741
3742    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3743}
3744
3745impl Documentation {
3746    pub fn new() -> Self {
3747        std::default::Default::default()
3748    }
3749
3750    /// Sets the value of [summary][crate::model::Documentation::summary].
3751    pub fn set_summary<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3752        self.summary = v.into();
3753        self
3754    }
3755
3756    /// Sets the value of [pages][crate::model::Documentation::pages].
3757    pub fn set_pages<T, V>(mut self, v: T) -> Self
3758    where
3759        T: std::iter::IntoIterator<Item = V>,
3760        V: std::convert::Into<crate::model::Page>,
3761    {
3762        use std::iter::Iterator;
3763        self.pages = v.into_iter().map(|i| i.into()).collect();
3764        self
3765    }
3766
3767    /// Sets the value of [rules][crate::model::Documentation::rules].
3768    pub fn set_rules<T, V>(mut self, v: T) -> Self
3769    where
3770        T: std::iter::IntoIterator<Item = V>,
3771        V: std::convert::Into<crate::model::DocumentationRule>,
3772    {
3773        use std::iter::Iterator;
3774        self.rules = v.into_iter().map(|i| i.into()).collect();
3775        self
3776    }
3777
3778    /// Sets the value of [documentation_root_url][crate::model::Documentation::documentation_root_url].
3779    pub fn set_documentation_root_url<T: std::convert::Into<std::string::String>>(
3780        mut self,
3781        v: T,
3782    ) -> Self {
3783        self.documentation_root_url = v.into();
3784        self
3785    }
3786
3787    /// Sets the value of [service_root_url][crate::model::Documentation::service_root_url].
3788    pub fn set_service_root_url<T: std::convert::Into<std::string::String>>(
3789        mut self,
3790        v: T,
3791    ) -> Self {
3792        self.service_root_url = v.into();
3793        self
3794    }
3795
3796    /// Sets the value of [overview][crate::model::Documentation::overview].
3797    pub fn set_overview<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3798        self.overview = v.into();
3799        self
3800    }
3801}
3802
3803impl wkt::message::Message for Documentation {
3804    fn typename() -> &'static str {
3805        "type.googleapis.com/google.api.Documentation"
3806    }
3807}
3808
3809/// A documentation rule provides information about individual API elements.
3810#[derive(Clone, Default, PartialEq)]
3811#[non_exhaustive]
3812pub struct DocumentationRule {
3813    /// The selector is a comma-separated list of patterns for any element such as
3814    /// a method, a field, an enum value. Each pattern is a qualified name of the
3815    /// element which may end in "*", indicating a wildcard. Wildcards are only
3816    /// allowed at the end and for a whole component of the qualified name,
3817    /// i.e. "foo.*" is ok, but not "foo.b*" or "foo.*.bar". A wildcard will match
3818    /// one or more components. To specify a default for all applicable elements,
3819    /// the whole pattern "*" is used.
3820    pub selector: std::string::String,
3821
3822    /// Description of the selected proto element (e.g. a message, a method, a
3823    /// 'service' definition, or a field). Defaults to leading & trailing comments
3824    /// taken from the proto source definition of the proto element.
3825    pub description: std::string::String,
3826
3827    /// Deprecation description of the selected element(s). It can be provided if
3828    /// an element is marked as `deprecated`.
3829    pub deprecation_description: std::string::String,
3830
3831    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3832}
3833
3834impl DocumentationRule {
3835    pub fn new() -> Self {
3836        std::default::Default::default()
3837    }
3838
3839    /// Sets the value of [selector][crate::model::DocumentationRule::selector].
3840    pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3841        self.selector = v.into();
3842        self
3843    }
3844
3845    /// Sets the value of [description][crate::model::DocumentationRule::description].
3846    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3847        self.description = v.into();
3848        self
3849    }
3850
3851    /// Sets the value of [deprecation_description][crate::model::DocumentationRule::deprecation_description].
3852    pub fn set_deprecation_description<T: std::convert::Into<std::string::String>>(
3853        mut self,
3854        v: T,
3855    ) -> Self {
3856        self.deprecation_description = v.into();
3857        self
3858    }
3859}
3860
3861impl wkt::message::Message for DocumentationRule {
3862    fn typename() -> &'static str {
3863        "type.googleapis.com/google.api.DocumentationRule"
3864    }
3865}
3866
3867/// Represents a documentation page. A page can contain subpages to represent
3868/// nested documentation set structure.
3869#[derive(Clone, Default, PartialEq)]
3870#[non_exhaustive]
3871pub struct Page {
3872    /// The name of the page. It will be used as an identity of the page to
3873    /// generate URI of the page, text of the link to this page in navigation,
3874    /// etc. The full page name (start from the root page name to this page
3875    /// concatenated with `.`) can be used as reference to the page in your
3876    /// documentation. For example:
3877    ///
3878    /// You can reference `Java` page using Markdown reference link syntax:
3879    /// `[Java][Tutorial.Java]`.
3880    pub name: std::string::String,
3881
3882    /// The Markdown content of the page. You can use ```(== include {path}
3883    /// ==)``` to include content from a Markdown file. The content can be used
3884    /// to produce the documentation page such as HTML format page.
3885    pub content: std::string::String,
3886
3887    /// Subpages of this page. The order of subpages specified here will be
3888    /// honored in the generated docset.
3889    pub subpages: std::vec::Vec<crate::model::Page>,
3890
3891    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3892}
3893
3894impl Page {
3895    pub fn new() -> Self {
3896        std::default::Default::default()
3897    }
3898
3899    /// Sets the value of [name][crate::model::Page::name].
3900    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3901        self.name = v.into();
3902        self
3903    }
3904
3905    /// Sets the value of [content][crate::model::Page::content].
3906    pub fn set_content<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3907        self.content = v.into();
3908        self
3909    }
3910
3911    /// Sets the value of [subpages][crate::model::Page::subpages].
3912    pub fn set_subpages<T, V>(mut self, v: T) -> Self
3913    where
3914        T: std::iter::IntoIterator<Item = V>,
3915        V: std::convert::Into<crate::model::Page>,
3916    {
3917        use std::iter::Iterator;
3918        self.subpages = v.into_iter().map(|i| i.into()).collect();
3919        self
3920    }
3921}
3922
3923impl wkt::message::Message for Page {
3924    fn typename() -> &'static str {
3925        "type.googleapis.com/google.api.Page"
3926    }
3927}
3928
3929/// `Endpoint` describes a network address of a service that serves a set of
3930/// APIs. It is commonly known as a service endpoint. A service may expose
3931/// any number of service endpoints, and all service endpoints share the same
3932/// service definition, such as quota limits and monitoring metrics.
3933///
3934/// Example:
3935///
3936/// ```norust
3937/// type: google.api.Service
3938/// name: library-example.googleapis.com
3939/// endpoints:
3940///   # Declares network address `https://library-example.googleapis.com`
3941///   # for service `library-example.googleapis.com`. The `https` scheme
3942///   # is implicit for all service endpoints. Other schemes may be
3943///   # supported in the future.
3944/// - name: library-example.googleapis.com
3945///   allow_cors: false
3946/// - name: content-staging-library-example.googleapis.com
3947///   # Allows HTTP OPTIONS calls to be passed to the API frontend, for it
3948///   # to decide whether the subsequent cross-origin request is allowed
3949///   # to proceed.
3950///   allow_cors: true
3951/// ```
3952#[derive(Clone, Default, PartialEq)]
3953#[non_exhaustive]
3954pub struct Endpoint {
3955    /// The canonical name of this endpoint.
3956    pub name: std::string::String,
3957
3958    /// Aliases for this endpoint, these will be served by the same UrlMap as the
3959    /// parent endpoint, and will be provisioned in the GCP stack for the Regional
3960    /// Endpoints.
3961    pub aliases: std::vec::Vec<std::string::String>,
3962
3963    /// The specification of an Internet routable address of API frontend that will
3964    /// handle requests to this [API
3965    /// Endpoint](https://cloud.google.com/apis/design/glossary). It should be
3966    /// either a valid IPv4 address or a fully-qualified domain name. For example,
3967    /// "8.8.8.8" or "myservice.appspot.com".
3968    pub target: std::string::String,
3969
3970    /// Allowing
3971    /// [CORS](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing), aka
3972    /// cross-domain traffic, would allow the backends served from this endpoint to
3973    /// receive and respond to HTTP OPTIONS requests. The response will be used by
3974    /// the browser to determine whether the subsequent cross-origin request is
3975    /// allowed to proceed.
3976    pub allow_cors: bool,
3977
3978    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3979}
3980
3981impl Endpoint {
3982    pub fn new() -> Self {
3983        std::default::Default::default()
3984    }
3985
3986    /// Sets the value of [name][crate::model::Endpoint::name].
3987    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3988        self.name = v.into();
3989        self
3990    }
3991
3992    /// Sets the value of [aliases][crate::model::Endpoint::aliases].
3993    pub fn set_aliases<T, V>(mut self, v: T) -> Self
3994    where
3995        T: std::iter::IntoIterator<Item = V>,
3996        V: std::convert::Into<std::string::String>,
3997    {
3998        use std::iter::Iterator;
3999        self.aliases = v.into_iter().map(|i| i.into()).collect();
4000        self
4001    }
4002
4003    /// Sets the value of [target][crate::model::Endpoint::target].
4004    pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4005        self.target = v.into();
4006        self
4007    }
4008
4009    /// Sets the value of [allow_cors][crate::model::Endpoint::allow_cors].
4010    pub fn set_allow_cors<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4011        self.allow_cors = v.into();
4012        self
4013    }
4014}
4015
4016impl wkt::message::Message for Endpoint {
4017    fn typename() -> &'static str {
4018        "type.googleapis.com/google.api.Endpoint"
4019    }
4020}
4021
4022/// Rich semantic information of an API field beyond basic typing.
4023#[derive(Clone, Default, PartialEq)]
4024#[non_exhaustive]
4025pub struct FieldInfo {
4026    /// The standard format of a field value. This does not explicitly configure
4027    /// any API consumer, just documents the API's format for the field it is
4028    /// applied to.
4029    pub format: crate::model::field_info::Format,
4030
4031    /// The type(s) that the annotated, generic field may represent.
4032    ///
4033    /// Currently, this must only be used on fields of type `google.protobuf.Any`.
4034    /// Supporting other generic types may be considered in the future.
4035    pub referenced_types: std::vec::Vec<crate::model::TypeReference>,
4036
4037    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4038}
4039
4040impl FieldInfo {
4041    pub fn new() -> Self {
4042        std::default::Default::default()
4043    }
4044
4045    /// Sets the value of [format][crate::model::FieldInfo::format].
4046    pub fn set_format<T: std::convert::Into<crate::model::field_info::Format>>(
4047        mut self,
4048        v: T,
4049    ) -> Self {
4050        self.format = v.into();
4051        self
4052    }
4053
4054    /// Sets the value of [referenced_types][crate::model::FieldInfo::referenced_types].
4055    pub fn set_referenced_types<T, V>(mut self, v: T) -> Self
4056    where
4057        T: std::iter::IntoIterator<Item = V>,
4058        V: std::convert::Into<crate::model::TypeReference>,
4059    {
4060        use std::iter::Iterator;
4061        self.referenced_types = v.into_iter().map(|i| i.into()).collect();
4062        self
4063    }
4064}
4065
4066impl wkt::message::Message for FieldInfo {
4067    fn typename() -> &'static str {
4068        "type.googleapis.com/google.api.FieldInfo"
4069    }
4070}
4071
4072/// Defines additional types related to [FieldInfo].
4073pub mod field_info {
4074    #[allow(unused_imports)]
4075    use super::*;
4076
4077    /// The standard format of a field value. The supported formats are all backed
4078    /// by either an RFC defined by the IETF or a Google-defined AIP.
4079    ///
4080    /// # Working with unknown values
4081    ///
4082    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4083    /// additional enum variants at any time. Adding new variants is not considered
4084    /// a breaking change. Applications should write their code in anticipation of:
4085    ///
4086    /// - New values appearing in future releases of the client library, **and**
4087    /// - New values received dynamically, without application changes.
4088    ///
4089    /// Please consult the [Working with enums] section in the user guide for some
4090    /// guidelines.
4091    ///
4092    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
4093    #[derive(Clone, Debug, PartialEq)]
4094    #[non_exhaustive]
4095    pub enum Format {
4096        /// Default, unspecified value.
4097        Unspecified,
4098        /// Universally Unique Identifier, version 4, value as defined by
4099        /// <https://datatracker.ietf.org/doc/html/rfc4122>. The value may be
4100        /// normalized to entirely lowercase letters. For example, the value
4101        /// `F47AC10B-58CC-0372-8567-0E02B2C3D479` would be normalized to
4102        /// `f47ac10b-58cc-0372-8567-0e02b2c3d479`.
4103        Uuid4,
4104        /// Internet Protocol v4 value as defined by [RFC
4105        /// 791](https://datatracker.ietf.org/doc/html/rfc791). The value may be
4106        /// condensed, with leading zeros in each octet stripped. For example,
4107        /// `001.022.233.040` would be condensed to `1.22.233.40`.
4108        Ipv4,
4109        /// Internet Protocol v6 value as defined by [RFC
4110        /// 2460](https://datatracker.ietf.org/doc/html/rfc2460). The value may be
4111        /// normalized to entirely lowercase letters with zeros compressed, following
4112        /// [RFC 5952](https://datatracker.ietf.org/doc/html/rfc5952). For example,
4113        /// the value `2001:0DB8:0::0` would be normalized to `2001:db8::`.
4114        Ipv6,
4115        /// An IP address in either v4 or v6 format as described by the individual
4116        /// values defined herein. See the comments on the IPV4 and IPV6 types for
4117        /// allowed normalizations of each.
4118        Ipv4OrIpv6,
4119        /// If set, the enum was initialized with an unknown value.
4120        ///
4121        /// Applications can examine the value using [Format::value] or
4122        /// [Format::name].
4123        UnknownValue(format::UnknownValue),
4124    }
4125
4126    #[doc(hidden)]
4127    pub mod format {
4128        #[allow(unused_imports)]
4129        use super::*;
4130        #[derive(Clone, Debug, PartialEq)]
4131        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4132    }
4133
4134    impl Format {
4135        /// Gets the enum value.
4136        ///
4137        /// Returns `None` if the enum contains an unknown value deserialized from
4138        /// the string representation of enums.
4139        pub fn value(&self) -> std::option::Option<i32> {
4140            match self {
4141                Self::Unspecified => std::option::Option::Some(0),
4142                Self::Uuid4 => std::option::Option::Some(1),
4143                Self::Ipv4 => std::option::Option::Some(2),
4144                Self::Ipv6 => std::option::Option::Some(3),
4145                Self::Ipv4OrIpv6 => std::option::Option::Some(4),
4146                Self::UnknownValue(u) => u.0.value(),
4147            }
4148        }
4149
4150        /// Gets the enum value as a string.
4151        ///
4152        /// Returns `None` if the enum contains an unknown value deserialized from
4153        /// the integer representation of enums.
4154        pub fn name(&self) -> std::option::Option<&str> {
4155            match self {
4156                Self::Unspecified => std::option::Option::Some("FORMAT_UNSPECIFIED"),
4157                Self::Uuid4 => std::option::Option::Some("UUID4"),
4158                Self::Ipv4 => std::option::Option::Some("IPV4"),
4159                Self::Ipv6 => std::option::Option::Some("IPV6"),
4160                Self::Ipv4OrIpv6 => std::option::Option::Some("IPV4_OR_IPV6"),
4161                Self::UnknownValue(u) => u.0.name(),
4162            }
4163        }
4164    }
4165
4166    impl std::default::Default for Format {
4167        fn default() -> Self {
4168            use std::convert::From;
4169            Self::from(0)
4170        }
4171    }
4172
4173    impl std::fmt::Display for Format {
4174        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4175            wkt::internal::display_enum(f, self.name(), self.value())
4176        }
4177    }
4178
4179    impl std::convert::From<i32> for Format {
4180        fn from(value: i32) -> Self {
4181            match value {
4182                0 => Self::Unspecified,
4183                1 => Self::Uuid4,
4184                2 => Self::Ipv4,
4185                3 => Self::Ipv6,
4186                4 => Self::Ipv4OrIpv6,
4187                _ => Self::UnknownValue(format::UnknownValue(
4188                    wkt::internal::UnknownEnumValue::Integer(value),
4189                )),
4190            }
4191        }
4192    }
4193
4194    impl std::convert::From<&str> for Format {
4195        fn from(value: &str) -> Self {
4196            use std::string::ToString;
4197            match value {
4198                "FORMAT_UNSPECIFIED" => Self::Unspecified,
4199                "UUID4" => Self::Uuid4,
4200                "IPV4" => Self::Ipv4,
4201                "IPV6" => Self::Ipv6,
4202                "IPV4_OR_IPV6" => Self::Ipv4OrIpv6,
4203                _ => Self::UnknownValue(format::UnknownValue(
4204                    wkt::internal::UnknownEnumValue::String(value.to_string()),
4205                )),
4206            }
4207        }
4208    }
4209
4210    impl serde::ser::Serialize for Format {
4211        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4212        where
4213            S: serde::Serializer,
4214        {
4215            match self {
4216                Self::Unspecified => serializer.serialize_i32(0),
4217                Self::Uuid4 => serializer.serialize_i32(1),
4218                Self::Ipv4 => serializer.serialize_i32(2),
4219                Self::Ipv6 => serializer.serialize_i32(3),
4220                Self::Ipv4OrIpv6 => serializer.serialize_i32(4),
4221                Self::UnknownValue(u) => u.0.serialize(serializer),
4222            }
4223        }
4224    }
4225
4226    impl<'de> serde::de::Deserialize<'de> for Format {
4227        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4228        where
4229            D: serde::Deserializer<'de>,
4230        {
4231            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Format>::new(
4232                ".google.api.FieldInfo.Format",
4233            ))
4234        }
4235    }
4236}
4237
4238/// A reference to a message type, for use in [FieldInfo][google.api.FieldInfo].
4239///
4240/// [google.api.FieldInfo]: crate::model::FieldInfo
4241#[derive(Clone, Default, PartialEq)]
4242#[non_exhaustive]
4243pub struct TypeReference {
4244    /// The name of the type that the annotated, generic field may represent.
4245    /// If the type is in the same protobuf package, the value can be the simple
4246    /// message name e.g., `"MyMessage"`. Otherwise, the value must be the
4247    /// fully-qualified message name e.g., `"google.library.v1.Book"`.
4248    ///
4249    /// If the type(s) are unknown to the service (e.g. the field accepts generic
4250    /// user input), use the wildcard `"*"` to denote this behavior.
4251    ///
4252    /// See [AIP-202](https://google.aip.dev/202#type-references) for more details.
4253    pub type_name: std::string::String,
4254
4255    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4256}
4257
4258impl TypeReference {
4259    pub fn new() -> Self {
4260        std::default::Default::default()
4261    }
4262
4263    /// Sets the value of [type_name][crate::model::TypeReference::type_name].
4264    pub fn set_type_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4265        self.type_name = v.into();
4266        self
4267    }
4268}
4269
4270impl wkt::message::Message for TypeReference {
4271    fn typename() -> &'static str {
4272        "type.googleapis.com/google.api.TypeReference"
4273    }
4274}
4275
4276/// Defines the HTTP configuration for an API service. It contains a list of
4277/// [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method
4278/// to one or more HTTP REST API methods.
4279///
4280/// [google.api.HttpRule]: crate::model::HttpRule
4281#[derive(Clone, Default, PartialEq)]
4282#[non_exhaustive]
4283pub struct Http {
4284    /// A list of HTTP configuration rules that apply to individual API methods.
4285    ///
4286    /// **NOTE:** All service configuration rules follow "last one wins" order.
4287    pub rules: std::vec::Vec<crate::model::HttpRule>,
4288
4289    /// When set to true, URL path parameters will be fully URI-decoded except in
4290    /// cases of single segment matches in reserved expansion, where "%2F" will be
4291    /// left encoded.
4292    ///
4293    /// The default behavior is to not decode RFC 6570 reserved characters in multi
4294    /// segment matches.
4295    pub fully_decode_reserved_expansion: bool,
4296
4297    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4298}
4299
4300impl Http {
4301    pub fn new() -> Self {
4302        std::default::Default::default()
4303    }
4304
4305    /// Sets the value of [rules][crate::model::Http::rules].
4306    pub fn set_rules<T, V>(mut self, v: T) -> Self
4307    where
4308        T: std::iter::IntoIterator<Item = V>,
4309        V: std::convert::Into<crate::model::HttpRule>,
4310    {
4311        use std::iter::Iterator;
4312        self.rules = v.into_iter().map(|i| i.into()).collect();
4313        self
4314    }
4315
4316    /// Sets the value of [fully_decode_reserved_expansion][crate::model::Http::fully_decode_reserved_expansion].
4317    pub fn set_fully_decode_reserved_expansion<T: std::convert::Into<bool>>(
4318        mut self,
4319        v: T,
4320    ) -> Self {
4321        self.fully_decode_reserved_expansion = v.into();
4322        self
4323    }
4324}
4325
4326impl wkt::message::Message for Http {
4327    fn typename() -> &'static str {
4328        "type.googleapis.com/google.api.Http"
4329    }
4330}
4331
4332/// gRPC Transcoding
4333///
4334/// gRPC Transcoding is a feature for mapping between a gRPC method and one or
4335/// more HTTP REST endpoints. It allows developers to build a single API service
4336/// that supports both gRPC APIs and REST APIs. Many systems, including [Google
4337/// APIs](https://github.com/googleapis/googleapis),
4338/// [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC
4339/// Gateway](https://github.com/grpc-ecosystem/grpc-gateway),
4340/// and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature
4341/// and use it for large scale production services.
4342///
4343/// `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies
4344/// how different portions of the gRPC request message are mapped to the URL
4345/// path, URL query parameters, and HTTP request body. It also controls how the
4346/// gRPC response message is mapped to the HTTP response body. `HttpRule` is
4347/// typically specified as an `google.api.http` annotation on the gRPC method.
4348///
4349/// Each mapping specifies a URL path template and an HTTP method. The path
4350/// template may refer to one or more fields in the gRPC request message, as long
4351/// as each field is a non-repeated field with a primitive (non-message) type.
4352/// The path template controls how fields of the request message are mapped to
4353/// the URL path.
4354///
4355/// Example:
4356///
4357/// ```norust
4358/// service Messaging {
4359///   rpc GetMessage(GetMessageRequest) returns (Message) {
4360///     option (google.api.http) = {
4361///         get: "/v1/{name=messages/*}"
4362///     };
4363///   }
4364/// }
4365/// message GetMessageRequest {
4366///   string name = 1; // Mapped to URL path.
4367/// }
4368/// message Message {
4369///   string text = 1; // The resource content.
4370/// }
4371/// ```
4372///
4373/// This enables an HTTP REST to gRPC mapping as below:
4374///
4375/// - HTTP: `GET /v1/messages/123456`
4376/// - gRPC: `GetMessage(name: "messages/123456")`
4377///
4378/// Any fields in the request message which are not bound by the path template
4379/// automatically become HTTP query parameters if there is no HTTP request body.
4380/// For example:
4381///
4382/// ```norust
4383/// service Messaging {
4384///   rpc GetMessage(GetMessageRequest) returns (Message) {
4385///     option (google.api.http) = {
4386///         get:"/v1/messages/{message_id}"
4387///     };
4388///   }
4389/// }
4390/// message GetMessageRequest {
4391///   message SubMessage {
4392///     string subfield = 1;
4393///   }
4394///   string message_id = 1; // Mapped to URL path.
4395///   int64 revision = 2;    // Mapped to URL query parameter `revision`.
4396///   SubMessage sub = 3;    // Mapped to URL query parameter `sub.subfield`.
4397/// }
4398/// ```
4399///
4400/// This enables a HTTP JSON to RPC mapping as below:
4401///
4402/// - HTTP: `GET /v1/messages/123456?revision=2&sub.subfield=foo`
4403/// - gRPC: `GetMessage(message_id: "123456" revision: 2 sub:
4404///   SubMessage(subfield: "foo"))`
4405///
4406/// Note that fields which are mapped to URL query parameters must have a
4407/// primitive type or a repeated primitive type or a non-repeated message type.
4408/// In the case of a repeated type, the parameter can be repeated in the URL
4409/// as `...?param=A&param=B`. In the case of a message type, each field of the
4410/// message is mapped to a separate parameter, such as
4411/// `...?foo.a=A&foo.b=B&foo.c=C`.
4412///
4413/// For HTTP methods that allow a request body, the `body` field
4414/// specifies the mapping. Consider a REST update method on the
4415/// message resource collection:
4416///
4417/// ```norust
4418/// service Messaging {
4419///   rpc UpdateMessage(UpdateMessageRequest) returns (Message) {
4420///     option (google.api.http) = {
4421///       patch: "/v1/messages/{message_id}"
4422///       body: "message"
4423///     };
4424///   }
4425/// }
4426/// message UpdateMessageRequest {
4427///   string message_id = 1; // mapped to the URL
4428///   Message message = 2;   // mapped to the body
4429/// }
4430/// ```
4431///
4432/// The following HTTP JSON to RPC mapping is enabled, where the
4433/// representation of the JSON in the request body is determined by
4434/// protos JSON encoding:
4435///
4436/// - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }`
4437/// - gRPC: `UpdateMessage(message_id: "123456" message { text: "Hi!" })`
4438///
4439/// The special name `*` can be used in the body mapping to define that
4440/// every field not bound by the path template should be mapped to the
4441/// request body.  This enables the following alternative definition of
4442/// the update method:
4443///
4444/// ```norust
4445/// service Messaging {
4446///   rpc UpdateMessage(Message) returns (Message) {
4447///     option (google.api.http) = {
4448///       patch: "/v1/messages/{message_id}"
4449///       body: "*"
4450///     };
4451///   }
4452/// }
4453/// message Message {
4454///   string message_id = 1;
4455///   string text = 2;
4456/// }
4457/// ```
4458///
4459/// The following HTTP JSON to RPC mapping is enabled:
4460///
4461/// - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }`
4462/// - gRPC: `UpdateMessage(message_id: "123456" text: "Hi!")`
4463///
4464/// Note that when using `*` in the body mapping, it is not possible to
4465/// have HTTP parameters, as all fields not bound by the path end in
4466/// the body. This makes this option more rarely used in practice when
4467/// defining REST APIs. The common usage of `*` is in custom methods
4468/// which don't use the URL at all for transferring data.
4469///
4470/// It is possible to define multiple HTTP methods for one RPC by using
4471/// the `additional_bindings` option. Example:
4472///
4473/// ```norust
4474/// service Messaging {
4475///   rpc GetMessage(GetMessageRequest) returns (Message) {
4476///     option (google.api.http) = {
4477///       get: "/v1/messages/{message_id}"
4478///       additional_bindings {
4479///         get: "/v1/users/{user_id}/messages/{message_id}"
4480///       }
4481///     };
4482///   }
4483/// }
4484/// message GetMessageRequest {
4485///   string message_id = 1;
4486///   string user_id = 2;
4487/// }
4488/// ```
4489///
4490/// This enables the following two alternative HTTP JSON to RPC mappings:
4491///
4492/// - HTTP: `GET /v1/messages/123456`
4493///
4494/// - gRPC: `GetMessage(message_id: "123456")`
4495///
4496/// - HTTP: `GET /v1/users/me/messages/123456`
4497///
4498/// - gRPC: `GetMessage(user_id: "me" message_id: "123456")`
4499///
4500///
4501/// Rules for HTTP mapping
4502///
4503/// 1. Leaf request fields (recursive expansion nested messages in the request
4504///    message) are classified into three categories:
4505///    - Fields referred by the path template. They are passed via the URL path.
4506///    - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They
4507///      are passed via the HTTP
4508///      request body.
4509///    - All other fields are passed via the URL query parameters, and the
4510///      parameter name is the field path in the request message. A repeated
4511///      field can be represented as multiple query parameters under the same
4512///      name.
4513/// 1. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL
4514///    query parameter, all fields
4515///    are passed via URL path and HTTP request body.
4516/// 1. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP
4517///    request body, all
4518///    fields are passed via URL path and URL query parameters.
4519///
4520/// Path template syntax
4521///
4522/// ```norust
4523/// Template = "/" Segments [ Verb ] ;
4524/// Segments = Segment { "/" Segment } ;
4525/// Segment  = "*" | "**" | LITERAL | Variable ;
4526/// Variable = "{" FieldPath [ "=" Segments ] "}" ;
4527/// FieldPath = IDENT { "." IDENT } ;
4528/// Verb     = ":" LITERAL ;
4529/// ```
4530///
4531/// The syntax `*` matches a single URL path segment. The syntax `**` matches
4532/// zero or more URL path segments, which must be the last part of the URL path
4533/// except the `Verb`.
4534///
4535/// The syntax `Variable` matches part of the URL path as specified by its
4536/// template. A variable template must not contain other variables. If a variable
4537/// matches a single path segment, its template may be omitted, e.g. `{var}`
4538/// is equivalent to `{var=*}`.
4539///
4540/// The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL`
4541/// contains any reserved character, such characters should be percent-encoded
4542/// before the matching.
4543///
4544/// If a variable contains exactly one path segment, such as `"{var}"` or
4545/// `"{var=*}"`, when such a variable is expanded into a URL path on the client
4546/// side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The
4547/// server side does the reverse decoding. Such variables show up in the
4548/// [Discovery
4549/// Document](https://developers.google.com/discovery/v1/reference/apis) as
4550/// `{var}`.
4551///
4552/// If a variable contains multiple path segments, such as `"{var=foo/*}"`
4553/// or `"{var=**}"`, when such a variable is expanded into a URL path on the
4554/// client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded.
4555/// The server side does the reverse decoding, except "%2F" and "%2f" are left
4556/// unchanged. Such variables show up in the
4557/// [Discovery
4558/// Document](https://developers.google.com/discovery/v1/reference/apis) as
4559/// `{+var}`.
4560///
4561/// Using gRPC API Service Configuration
4562///
4563/// gRPC API Service Configuration (service config) is a configuration language
4564/// for configuring a gRPC service to become a user-facing product. The
4565/// service config is simply the YAML representation of the `google.api.Service`
4566/// proto message.
4567///
4568/// As an alternative to annotating your proto file, you can configure gRPC
4569/// transcoding in your service config YAML files. You do this by specifying a
4570/// `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same
4571/// effect as the proto annotation. This can be particularly useful if you
4572/// have a proto that is reused in multiple services. Note that any transcoding
4573/// specified in the service config will override any matching transcoding
4574/// configuration in the proto.
4575///
4576/// The following example selects a gRPC method and applies an `HttpRule` to it:
4577///
4578/// ```norust
4579/// http:
4580///   rules:
4581///     - selector: example.v1.Messaging.GetMessage
4582///       get: /v1/messages/{message_id}/{sub.subfield}
4583/// ```
4584///
4585/// Special notes
4586///
4587/// When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the
4588/// proto to JSON conversion must follow the [proto3
4589/// specification](https://developers.google.com/protocol-buffers/docs/proto3#json).
4590///
4591/// While the single segment variable follows the semantics of
4592/// [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String
4593/// Expansion, the multi segment variable **does not** follow RFC 6570 Section
4594/// 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion
4595/// does not expand special characters like `?` and `#`, which would lead
4596/// to invalid URLs. As the result, gRPC Transcoding uses a custom encoding
4597/// for multi segment variables.
4598///
4599/// The path variables **must not** refer to any repeated or mapped field,
4600/// because client libraries are not capable of handling such variable expansion.
4601///
4602/// The path variables **must not** capture the leading "/" character. The reason
4603/// is that the most common use case "{var}" does not capture the leading "/"
4604/// character. For consistency, all path variables must share the same behavior.
4605///
4606/// Repeated message fields must not be mapped to URL query parameters, because
4607/// no client library can support such complicated mapping.
4608///
4609/// If an API needs to use a JSON array for request or response body, it can map
4610/// the request or response body to a repeated field. However, some gRPC
4611/// Transcoding implementations may not support this feature.
4612///
4613/// [google.api.HttpRule.body]: crate::model::HttpRule::body
4614#[derive(Clone, Default, PartialEq)]
4615#[non_exhaustive]
4616pub struct HttpRule {
4617    /// Selects a method to which this rule applies.
4618    ///
4619    /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
4620    /// details.
4621    ///
4622    /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
4623    pub selector: std::string::String,
4624
4625    /// The name of the request field whose value is mapped to the HTTP request
4626    /// body, or `*` for mapping all request fields not captured by the path
4627    /// pattern to the HTTP body, or omitted for not having any HTTP request body.
4628    ///
4629    /// NOTE: the referred field must be present at the top-level of the request
4630    /// message type.
4631    pub body: std::string::String,
4632
4633    /// Optional. The name of the response field whose value is mapped to the HTTP
4634    /// response body. When omitted, the entire response message will be used
4635    /// as the HTTP response body.
4636    ///
4637    /// NOTE: The referred field must be present at the top-level of the response
4638    /// message type.
4639    pub response_body: std::string::String,
4640
4641    /// Additional HTTP bindings for the selector. Nested bindings must
4642    /// not contain an `additional_bindings` field themselves (that is,
4643    /// the nesting may only be one level deep).
4644    pub additional_bindings: std::vec::Vec<crate::model::HttpRule>,
4645
4646    /// Determines the URL pattern is matched by this rules. This pattern can be
4647    /// used with any of the {get|put|post|delete|patch} methods. A custom method
4648    /// can be defined using the 'custom' field.
4649    pub pattern: std::option::Option<crate::model::http_rule::Pattern>,
4650
4651    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4652}
4653
4654impl HttpRule {
4655    pub fn new() -> Self {
4656        std::default::Default::default()
4657    }
4658
4659    /// Sets the value of [selector][crate::model::HttpRule::selector].
4660    pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4661        self.selector = v.into();
4662        self
4663    }
4664
4665    /// Sets the value of [body][crate::model::HttpRule::body].
4666    pub fn set_body<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4667        self.body = v.into();
4668        self
4669    }
4670
4671    /// Sets the value of [response_body][crate::model::HttpRule::response_body].
4672    pub fn set_response_body<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4673        self.response_body = v.into();
4674        self
4675    }
4676
4677    /// Sets the value of [additional_bindings][crate::model::HttpRule::additional_bindings].
4678    pub fn set_additional_bindings<T, V>(mut self, v: T) -> Self
4679    where
4680        T: std::iter::IntoIterator<Item = V>,
4681        V: std::convert::Into<crate::model::HttpRule>,
4682    {
4683        use std::iter::Iterator;
4684        self.additional_bindings = v.into_iter().map(|i| i.into()).collect();
4685        self
4686    }
4687
4688    /// Sets the value of [pattern][crate::model::HttpRule::pattern].
4689    ///
4690    /// Note that all the setters affecting `pattern` are mutually
4691    /// exclusive.
4692    pub fn set_pattern<
4693        T: std::convert::Into<std::option::Option<crate::model::http_rule::Pattern>>,
4694    >(
4695        mut self,
4696        v: T,
4697    ) -> Self {
4698        self.pattern = v.into();
4699        self
4700    }
4701
4702    /// The value of [pattern][crate::model::HttpRule::pattern]
4703    /// if it holds a `Get`, `None` if the field is not set or
4704    /// holds a different branch.
4705    pub fn get(&self) -> std::option::Option<&std::string::String> {
4706        #[allow(unreachable_patterns)]
4707        self.pattern.as_ref().and_then(|v| match v {
4708            crate::model::http_rule::Pattern::Get(v) => std::option::Option::Some(v),
4709            _ => std::option::Option::None,
4710        })
4711    }
4712
4713    /// Sets the value of [pattern][crate::model::HttpRule::pattern]
4714    /// to hold a `Get`.
4715    ///
4716    /// Note that all the setters affecting `pattern` are
4717    /// mutually exclusive.
4718    pub fn set_get<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4719        self.pattern = std::option::Option::Some(crate::model::http_rule::Pattern::Get(v.into()));
4720        self
4721    }
4722
4723    /// The value of [pattern][crate::model::HttpRule::pattern]
4724    /// if it holds a `Put`, `None` if the field is not set or
4725    /// holds a different branch.
4726    pub fn put(&self) -> std::option::Option<&std::string::String> {
4727        #[allow(unreachable_patterns)]
4728        self.pattern.as_ref().and_then(|v| match v {
4729            crate::model::http_rule::Pattern::Put(v) => std::option::Option::Some(v),
4730            _ => std::option::Option::None,
4731        })
4732    }
4733
4734    /// Sets the value of [pattern][crate::model::HttpRule::pattern]
4735    /// to hold a `Put`.
4736    ///
4737    /// Note that all the setters affecting `pattern` are
4738    /// mutually exclusive.
4739    pub fn set_put<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4740        self.pattern = std::option::Option::Some(crate::model::http_rule::Pattern::Put(v.into()));
4741        self
4742    }
4743
4744    /// The value of [pattern][crate::model::HttpRule::pattern]
4745    /// if it holds a `Post`, `None` if the field is not set or
4746    /// holds a different branch.
4747    pub fn post(&self) -> std::option::Option<&std::string::String> {
4748        #[allow(unreachable_patterns)]
4749        self.pattern.as_ref().and_then(|v| match v {
4750            crate::model::http_rule::Pattern::Post(v) => std::option::Option::Some(v),
4751            _ => std::option::Option::None,
4752        })
4753    }
4754
4755    /// Sets the value of [pattern][crate::model::HttpRule::pattern]
4756    /// to hold a `Post`.
4757    ///
4758    /// Note that all the setters affecting `pattern` are
4759    /// mutually exclusive.
4760    pub fn set_post<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4761        self.pattern = std::option::Option::Some(crate::model::http_rule::Pattern::Post(v.into()));
4762        self
4763    }
4764
4765    /// The value of [pattern][crate::model::HttpRule::pattern]
4766    /// if it holds a `Delete`, `None` if the field is not set or
4767    /// holds a different branch.
4768    pub fn delete(&self) -> std::option::Option<&std::string::String> {
4769        #[allow(unreachable_patterns)]
4770        self.pattern.as_ref().and_then(|v| match v {
4771            crate::model::http_rule::Pattern::Delete(v) => std::option::Option::Some(v),
4772            _ => std::option::Option::None,
4773        })
4774    }
4775
4776    /// Sets the value of [pattern][crate::model::HttpRule::pattern]
4777    /// to hold a `Delete`.
4778    ///
4779    /// Note that all the setters affecting `pattern` are
4780    /// mutually exclusive.
4781    pub fn set_delete<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4782        self.pattern =
4783            std::option::Option::Some(crate::model::http_rule::Pattern::Delete(v.into()));
4784        self
4785    }
4786
4787    /// The value of [pattern][crate::model::HttpRule::pattern]
4788    /// if it holds a `Patch`, `None` if the field is not set or
4789    /// holds a different branch.
4790    pub fn patch(&self) -> std::option::Option<&std::string::String> {
4791        #[allow(unreachable_patterns)]
4792        self.pattern.as_ref().and_then(|v| match v {
4793            crate::model::http_rule::Pattern::Patch(v) => std::option::Option::Some(v),
4794            _ => std::option::Option::None,
4795        })
4796    }
4797
4798    /// Sets the value of [pattern][crate::model::HttpRule::pattern]
4799    /// to hold a `Patch`.
4800    ///
4801    /// Note that all the setters affecting `pattern` are
4802    /// mutually exclusive.
4803    pub fn set_patch<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4804        self.pattern = std::option::Option::Some(crate::model::http_rule::Pattern::Patch(v.into()));
4805        self
4806    }
4807
4808    /// The value of [pattern][crate::model::HttpRule::pattern]
4809    /// if it holds a `Custom`, `None` if the field is not set or
4810    /// holds a different branch.
4811    pub fn custom(&self) -> std::option::Option<&std::boxed::Box<crate::model::CustomHttpPattern>> {
4812        #[allow(unreachable_patterns)]
4813        self.pattern.as_ref().and_then(|v| match v {
4814            crate::model::http_rule::Pattern::Custom(v) => std::option::Option::Some(v),
4815            _ => std::option::Option::None,
4816        })
4817    }
4818
4819    /// Sets the value of [pattern][crate::model::HttpRule::pattern]
4820    /// to hold a `Custom`.
4821    ///
4822    /// Note that all the setters affecting `pattern` are
4823    /// mutually exclusive.
4824    pub fn set_custom<T: std::convert::Into<std::boxed::Box<crate::model::CustomHttpPattern>>>(
4825        mut self,
4826        v: T,
4827    ) -> Self {
4828        self.pattern =
4829            std::option::Option::Some(crate::model::http_rule::Pattern::Custom(v.into()));
4830        self
4831    }
4832}
4833
4834impl wkt::message::Message for HttpRule {
4835    fn typename() -> &'static str {
4836        "type.googleapis.com/google.api.HttpRule"
4837    }
4838}
4839
4840/// Defines additional types related to [HttpRule].
4841pub mod http_rule {
4842    #[allow(unused_imports)]
4843    use super::*;
4844
4845    /// Determines the URL pattern is matched by this rules. This pattern can be
4846    /// used with any of the {get|put|post|delete|patch} methods. A custom method
4847    /// can be defined using the 'custom' field.
4848    #[derive(Clone, Debug, PartialEq)]
4849    #[non_exhaustive]
4850    pub enum Pattern {
4851        /// Maps to HTTP GET. Used for listing and getting information about
4852        /// resources.
4853        Get(std::string::String),
4854        /// Maps to HTTP PUT. Used for replacing a resource.
4855        Put(std::string::String),
4856        /// Maps to HTTP POST. Used for creating a resource or performing an action.
4857        Post(std::string::String),
4858        /// Maps to HTTP DELETE. Used for deleting a resource.
4859        Delete(std::string::String),
4860        /// Maps to HTTP PATCH. Used for updating a resource.
4861        Patch(std::string::String),
4862        /// The custom pattern is used for specifying an HTTP method that is not
4863        /// included in the `pattern` field, such as HEAD, or "*" to leave the
4864        /// HTTP method unspecified for this rule. The wild-card rule is useful
4865        /// for services that provide content to Web (HTML) clients.
4866        Custom(std::boxed::Box<crate::model::CustomHttpPattern>),
4867    }
4868}
4869
4870/// A custom pattern is used for defining custom HTTP verb.
4871#[derive(Clone, Default, PartialEq)]
4872#[non_exhaustive]
4873pub struct CustomHttpPattern {
4874    /// The name of this custom HTTP verb.
4875    pub kind: std::string::String,
4876
4877    /// The path matched by this custom verb.
4878    pub path: std::string::String,
4879
4880    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4881}
4882
4883impl CustomHttpPattern {
4884    pub fn new() -> Self {
4885        std::default::Default::default()
4886    }
4887
4888    /// Sets the value of [kind][crate::model::CustomHttpPattern::kind].
4889    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4890        self.kind = v.into();
4891        self
4892    }
4893
4894    /// Sets the value of [path][crate::model::CustomHttpPattern::path].
4895    pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4896        self.path = v.into();
4897        self
4898    }
4899}
4900
4901impl wkt::message::Message for CustomHttpPattern {
4902    fn typename() -> &'static str {
4903        "type.googleapis.com/google.api.CustomHttpPattern"
4904    }
4905}
4906
4907/// Message that represents an arbitrary HTTP body. It should only be used for
4908/// payload formats that can't be represented as JSON, such as raw binary or
4909/// an HTML page.
4910///
4911/// This message can be used both in streaming and non-streaming API methods in
4912/// the request as well as the response.
4913///
4914/// It can be used as a top-level request field, which is convenient if one
4915/// wants to extract parameters from either the URL or HTTP template into the
4916/// request fields and also want access to the raw HTTP body.
4917///
4918/// Example:
4919///
4920/// ```norust
4921/// message GetResourceRequest {
4922///   // A unique request id.
4923///   string request_id = 1;
4924///
4925///   // The raw HTTP body is bound to this field.
4926///   google.api.HttpBody http_body = 2;
4927///
4928/// }
4929///
4930/// service ResourceService {
4931///   rpc GetResource(GetResourceRequest)
4932///     returns (google.api.HttpBody);
4933///   rpc UpdateResource(google.api.HttpBody)
4934///     returns (google.protobuf.Empty);
4935///
4936/// }
4937/// ```
4938///
4939/// Example with streaming methods:
4940///
4941/// ```norust
4942/// service CaldavService {
4943///   rpc GetCalendar(stream google.api.HttpBody)
4944///     returns (stream google.api.HttpBody);
4945///   rpc UpdateCalendar(stream google.api.HttpBody)
4946///     returns (stream google.api.HttpBody);
4947///
4948/// }
4949/// ```
4950///
4951/// Use of this type only changes how the request and response bodies are
4952/// handled, all other features will continue to work unchanged.
4953#[derive(Clone, Default, PartialEq)]
4954#[non_exhaustive]
4955pub struct HttpBody {
4956    /// The HTTP Content-Type header value specifying the content type of the body.
4957    pub content_type: std::string::String,
4958
4959    /// The HTTP request/response body as raw binary.
4960    pub data: ::bytes::Bytes,
4961
4962    /// Application specific response metadata. Must be set in the first response
4963    /// for streaming APIs.
4964    pub extensions: std::vec::Vec<wkt::Any>,
4965
4966    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4967}
4968
4969impl HttpBody {
4970    pub fn new() -> Self {
4971        std::default::Default::default()
4972    }
4973
4974    /// Sets the value of [content_type][crate::model::HttpBody::content_type].
4975    pub fn set_content_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4976        self.content_type = v.into();
4977        self
4978    }
4979
4980    /// Sets the value of [data][crate::model::HttpBody::data].
4981    pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
4982        self.data = v.into();
4983        self
4984    }
4985
4986    /// Sets the value of [extensions][crate::model::HttpBody::extensions].
4987    pub fn set_extensions<T, V>(mut self, v: T) -> Self
4988    where
4989        T: std::iter::IntoIterator<Item = V>,
4990        V: std::convert::Into<wkt::Any>,
4991    {
4992        use std::iter::Iterator;
4993        self.extensions = v.into_iter().map(|i| i.into()).collect();
4994        self
4995    }
4996}
4997
4998impl wkt::message::Message for HttpBody {
4999    fn typename() -> &'static str {
5000        "type.googleapis.com/google.api.HttpBody"
5001    }
5002}
5003
5004/// A description of a label.
5005#[derive(Clone, Default, PartialEq)]
5006#[non_exhaustive]
5007pub struct LabelDescriptor {
5008    /// The label key.
5009    pub key: std::string::String,
5010
5011    /// The type of data that can be assigned to the label.
5012    pub value_type: crate::model::label_descriptor::ValueType,
5013
5014    /// A human-readable description for the label.
5015    pub description: std::string::String,
5016
5017    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5018}
5019
5020impl LabelDescriptor {
5021    pub fn new() -> Self {
5022        std::default::Default::default()
5023    }
5024
5025    /// Sets the value of [key][crate::model::LabelDescriptor::key].
5026    pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5027        self.key = v.into();
5028        self
5029    }
5030
5031    /// Sets the value of [value_type][crate::model::LabelDescriptor::value_type].
5032    pub fn set_value_type<T: std::convert::Into<crate::model::label_descriptor::ValueType>>(
5033        mut self,
5034        v: T,
5035    ) -> Self {
5036        self.value_type = v.into();
5037        self
5038    }
5039
5040    /// Sets the value of [description][crate::model::LabelDescriptor::description].
5041    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5042        self.description = v.into();
5043        self
5044    }
5045}
5046
5047impl wkt::message::Message for LabelDescriptor {
5048    fn typename() -> &'static str {
5049        "type.googleapis.com/google.api.LabelDescriptor"
5050    }
5051}
5052
5053/// Defines additional types related to [LabelDescriptor].
5054pub mod label_descriptor {
5055    #[allow(unused_imports)]
5056    use super::*;
5057
5058    /// Value types that can be used as label values.
5059    ///
5060    /// # Working with unknown values
5061    ///
5062    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5063    /// additional enum variants at any time. Adding new variants is not considered
5064    /// a breaking change. Applications should write their code in anticipation of:
5065    ///
5066    /// - New values appearing in future releases of the client library, **and**
5067    /// - New values received dynamically, without application changes.
5068    ///
5069    /// Please consult the [Working with enums] section in the user guide for some
5070    /// guidelines.
5071    ///
5072    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
5073    #[derive(Clone, Debug, PartialEq)]
5074    #[non_exhaustive]
5075    pub enum ValueType {
5076        /// A variable-length string. This is the default.
5077        String,
5078        /// Boolean; true or false.
5079        Bool,
5080        /// A 64-bit signed integer.
5081        Int64,
5082        /// If set, the enum was initialized with an unknown value.
5083        ///
5084        /// Applications can examine the value using [ValueType::value] or
5085        /// [ValueType::name].
5086        UnknownValue(value_type::UnknownValue),
5087    }
5088
5089    #[doc(hidden)]
5090    pub mod value_type {
5091        #[allow(unused_imports)]
5092        use super::*;
5093        #[derive(Clone, Debug, PartialEq)]
5094        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5095    }
5096
5097    impl ValueType {
5098        /// Gets the enum value.
5099        ///
5100        /// Returns `None` if the enum contains an unknown value deserialized from
5101        /// the string representation of enums.
5102        pub fn value(&self) -> std::option::Option<i32> {
5103            match self {
5104                Self::String => std::option::Option::Some(0),
5105                Self::Bool => std::option::Option::Some(1),
5106                Self::Int64 => std::option::Option::Some(2),
5107                Self::UnknownValue(u) => u.0.value(),
5108            }
5109        }
5110
5111        /// Gets the enum value as a string.
5112        ///
5113        /// Returns `None` if the enum contains an unknown value deserialized from
5114        /// the integer representation of enums.
5115        pub fn name(&self) -> std::option::Option<&str> {
5116            match self {
5117                Self::String => std::option::Option::Some("STRING"),
5118                Self::Bool => std::option::Option::Some("BOOL"),
5119                Self::Int64 => std::option::Option::Some("INT64"),
5120                Self::UnknownValue(u) => u.0.name(),
5121            }
5122        }
5123    }
5124
5125    impl std::default::Default for ValueType {
5126        fn default() -> Self {
5127            use std::convert::From;
5128            Self::from(0)
5129        }
5130    }
5131
5132    impl std::fmt::Display for ValueType {
5133        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5134            wkt::internal::display_enum(f, self.name(), self.value())
5135        }
5136    }
5137
5138    impl std::convert::From<i32> for ValueType {
5139        fn from(value: i32) -> Self {
5140            match value {
5141                0 => Self::String,
5142                1 => Self::Bool,
5143                2 => Self::Int64,
5144                _ => Self::UnknownValue(value_type::UnknownValue(
5145                    wkt::internal::UnknownEnumValue::Integer(value),
5146                )),
5147            }
5148        }
5149    }
5150
5151    impl std::convert::From<&str> for ValueType {
5152        fn from(value: &str) -> Self {
5153            use std::string::ToString;
5154            match value {
5155                "STRING" => Self::String,
5156                "BOOL" => Self::Bool,
5157                "INT64" => Self::Int64,
5158                _ => Self::UnknownValue(value_type::UnknownValue(
5159                    wkt::internal::UnknownEnumValue::String(value.to_string()),
5160                )),
5161            }
5162        }
5163    }
5164
5165    impl serde::ser::Serialize for ValueType {
5166        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5167        where
5168            S: serde::Serializer,
5169        {
5170            match self {
5171                Self::String => serializer.serialize_i32(0),
5172                Self::Bool => serializer.serialize_i32(1),
5173                Self::Int64 => serializer.serialize_i32(2),
5174                Self::UnknownValue(u) => u.0.serialize(serializer),
5175            }
5176        }
5177    }
5178
5179    impl<'de> serde::de::Deserialize<'de> for ValueType {
5180        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5181        where
5182            D: serde::Deserializer<'de>,
5183        {
5184            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ValueType>::new(
5185                ".google.api.LabelDescriptor.ValueType",
5186            ))
5187        }
5188    }
5189}
5190
5191/// A description of a log type. Example in YAML format:
5192///
5193/// ```norust
5194/// - name: library.googleapis.com/activity_history
5195///   description: The history of borrowing and returning library items.
5196///   display_name: Activity
5197///   labels:
5198///   - key: /customer_id
5199///     description: Identifier of a library customer
5200/// ```
5201#[derive(Clone, Default, PartialEq)]
5202#[non_exhaustive]
5203pub struct LogDescriptor {
5204    /// The name of the log. It must be less than 512 characters long and can
5205    /// include the following characters: upper- and lower-case alphanumeric
5206    /// characters [A-Za-z0-9], and punctuation characters including
5207    /// slash, underscore, hyphen, period [/_-.].
5208    pub name: std::string::String,
5209
5210    /// The set of labels that are available to describe a specific log entry.
5211    /// Runtime requests that contain labels not specified here are
5212    /// considered invalid.
5213    pub labels: std::vec::Vec<crate::model::LabelDescriptor>,
5214
5215    /// A human-readable description of this log. This information appears in
5216    /// the documentation and can contain details.
5217    pub description: std::string::String,
5218
5219    /// The human-readable name for this log. This information appears on
5220    /// the user interface and should be concise.
5221    pub display_name: std::string::String,
5222
5223    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5224}
5225
5226impl LogDescriptor {
5227    pub fn new() -> Self {
5228        std::default::Default::default()
5229    }
5230
5231    /// Sets the value of [name][crate::model::LogDescriptor::name].
5232    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5233        self.name = v.into();
5234        self
5235    }
5236
5237    /// Sets the value of [labels][crate::model::LogDescriptor::labels].
5238    pub fn set_labels<T, V>(mut self, v: T) -> Self
5239    where
5240        T: std::iter::IntoIterator<Item = V>,
5241        V: std::convert::Into<crate::model::LabelDescriptor>,
5242    {
5243        use std::iter::Iterator;
5244        self.labels = v.into_iter().map(|i| i.into()).collect();
5245        self
5246    }
5247
5248    /// Sets the value of [description][crate::model::LogDescriptor::description].
5249    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5250        self.description = v.into();
5251        self
5252    }
5253
5254    /// Sets the value of [display_name][crate::model::LogDescriptor::display_name].
5255    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5256        self.display_name = v.into();
5257        self
5258    }
5259}
5260
5261impl wkt::message::Message for LogDescriptor {
5262    fn typename() -> &'static str {
5263        "type.googleapis.com/google.api.LogDescriptor"
5264    }
5265}
5266
5267/// Logging configuration of the service.
5268///
5269/// The following example shows how to configure logs to be sent to the
5270/// producer and consumer projects. In the example, the `activity_history`
5271/// log is sent to both the producer and consumer projects, whereas the
5272/// `purchase_history` log is only sent to the producer project.
5273///
5274/// ```norust
5275/// monitored_resources:
5276/// - type: library.googleapis.com/branch
5277///   labels:
5278///   - key: /city
5279///     description: The city where the library branch is located in.
5280///   - key: /name
5281///     description: The name of the branch.
5282/// logs:
5283/// - name: activity_history
5284///   labels:
5285///   - key: /customer_id
5286/// - name: purchase_history
5287/// logging:
5288///   producer_destinations:
5289///   - monitored_resource: library.googleapis.com/branch
5290///     logs:
5291///     - activity_history
5292///     - purchase_history
5293///   consumer_destinations:
5294///   - monitored_resource: library.googleapis.com/branch
5295///     logs:
5296///     - activity_history
5297/// ```
5298#[derive(Clone, Default, PartialEq)]
5299#[non_exhaustive]
5300pub struct Logging {
5301    /// Logging configurations for sending logs to the producer project.
5302    /// There can be multiple producer destinations, each one must have a
5303    /// different monitored resource type. A log can be used in at most
5304    /// one producer destination.
5305    pub producer_destinations: std::vec::Vec<crate::model::logging::LoggingDestination>,
5306
5307    /// Logging configurations for sending logs to the consumer project.
5308    /// There can be multiple consumer destinations, each one must have a
5309    /// different monitored resource type. A log can be used in at most
5310    /// one consumer destination.
5311    pub consumer_destinations: std::vec::Vec<crate::model::logging::LoggingDestination>,
5312
5313    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5314}
5315
5316impl Logging {
5317    pub fn new() -> Self {
5318        std::default::Default::default()
5319    }
5320
5321    /// Sets the value of [producer_destinations][crate::model::Logging::producer_destinations].
5322    pub fn set_producer_destinations<T, V>(mut self, v: T) -> Self
5323    where
5324        T: std::iter::IntoIterator<Item = V>,
5325        V: std::convert::Into<crate::model::logging::LoggingDestination>,
5326    {
5327        use std::iter::Iterator;
5328        self.producer_destinations = v.into_iter().map(|i| i.into()).collect();
5329        self
5330    }
5331
5332    /// Sets the value of [consumer_destinations][crate::model::Logging::consumer_destinations].
5333    pub fn set_consumer_destinations<T, V>(mut self, v: T) -> Self
5334    where
5335        T: std::iter::IntoIterator<Item = V>,
5336        V: std::convert::Into<crate::model::logging::LoggingDestination>,
5337    {
5338        use std::iter::Iterator;
5339        self.consumer_destinations = v.into_iter().map(|i| i.into()).collect();
5340        self
5341    }
5342}
5343
5344impl wkt::message::Message for Logging {
5345    fn typename() -> &'static str {
5346        "type.googleapis.com/google.api.Logging"
5347    }
5348}
5349
5350/// Defines additional types related to [Logging].
5351pub mod logging {
5352    #[allow(unused_imports)]
5353    use super::*;
5354
5355    /// Configuration of a specific logging destination (the producer project
5356    /// or the consumer project).
5357    #[derive(Clone, Default, PartialEq)]
5358    #[non_exhaustive]
5359    pub struct LoggingDestination {
5360        /// The monitored resource type. The type must be defined in the
5361        /// [Service.monitored_resources][google.api.Service.monitored_resources]
5362        /// section.
5363        ///
5364        /// [google.api.Service.monitored_resources]: crate::model::Service::monitored_resources
5365        pub monitored_resource: std::string::String,
5366
5367        /// Names of the logs to be sent to this destination. Each name must
5368        /// be defined in the [Service.logs][google.api.Service.logs] section. If the
5369        /// log name is not a domain scoped name, it will be automatically prefixed
5370        /// with the service name followed by "/".
5371        ///
5372        /// [google.api.Service.logs]: crate::model::Service::logs
5373        pub logs: std::vec::Vec<std::string::String>,
5374
5375        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5376    }
5377
5378    impl LoggingDestination {
5379        pub fn new() -> Self {
5380            std::default::Default::default()
5381        }
5382
5383        /// Sets the value of [monitored_resource][crate::model::logging::LoggingDestination::monitored_resource].
5384        pub fn set_monitored_resource<T: std::convert::Into<std::string::String>>(
5385            mut self,
5386            v: T,
5387        ) -> Self {
5388            self.monitored_resource = v.into();
5389            self
5390        }
5391
5392        /// Sets the value of [logs][crate::model::logging::LoggingDestination::logs].
5393        pub fn set_logs<T, V>(mut self, v: T) -> Self
5394        where
5395            T: std::iter::IntoIterator<Item = V>,
5396            V: std::convert::Into<std::string::String>,
5397        {
5398            use std::iter::Iterator;
5399            self.logs = v.into_iter().map(|i| i.into()).collect();
5400            self
5401        }
5402    }
5403
5404    impl wkt::message::Message for LoggingDestination {
5405        fn typename() -> &'static str {
5406            "type.googleapis.com/google.api.Logging.LoggingDestination"
5407        }
5408    }
5409}
5410
5411/// Defines a metric type and its schema. Once a metric descriptor is created,
5412/// deleting or altering it stops data collection and makes the metric type's
5413/// existing data unusable.
5414#[derive(Clone, Default, PartialEq)]
5415#[non_exhaustive]
5416pub struct MetricDescriptor {
5417    /// The resource name of the metric descriptor.
5418    pub name: std::string::String,
5419
5420    /// The metric type, including its DNS name prefix. The type is not
5421    /// URL-encoded. All user-defined metric types have the DNS name
5422    /// `custom.googleapis.com` or `external.googleapis.com`. Metric types should
5423    /// use a natural hierarchical grouping. For example:
5424    ///
5425    /// ```norust
5426    /// "custom.googleapis.com/invoice/paid/amount"
5427    /// "external.googleapis.com/prometheus/up"
5428    /// "appengine.googleapis.com/http/server/response_latencies"
5429    /// ```
5430    pub r#type: std::string::String,
5431
5432    /// The set of labels that can be used to describe a specific
5433    /// instance of this metric type. For example, the
5434    /// `appengine.googleapis.com/http/server/response_latencies` metric
5435    /// type has a label for the HTTP response code, `response_code`, so
5436    /// you can look at latencies for successful responses or just
5437    /// for responses that failed.
5438    pub labels: std::vec::Vec<crate::model::LabelDescriptor>,
5439
5440    /// Whether the metric records instantaneous values, changes to a value, etc.
5441    /// Some combinations of `metric_kind` and `value_type` might not be supported.
5442    pub metric_kind: crate::model::metric_descriptor::MetricKind,
5443
5444    /// Whether the measurement is an integer, a floating-point number, etc.
5445    /// Some combinations of `metric_kind` and `value_type` might not be supported.
5446    pub value_type: crate::model::metric_descriptor::ValueType,
5447
5448    /// The units in which the metric value is reported. It is only applicable
5449    /// if the `value_type` is `INT64`, `DOUBLE`, or `DISTRIBUTION`. The `unit`
5450    /// defines the representation of the stored metric values.
5451    ///
5452    /// Different systems might scale the values to be more easily displayed (so a
5453    /// value of `0.02kBy` _might_ be displayed as `20By`, and a value of
5454    /// `3523kBy` _might_ be displayed as `3.5MBy`). However, if the `unit` is
5455    /// `kBy`, then the value of the metric is always in thousands of bytes, no
5456    /// matter how it might be displayed.
5457    ///
5458    /// If you want a custom metric to record the exact number of CPU-seconds used
5459    /// by a job, you can create an `INT64 CUMULATIVE` metric whose `unit` is
5460    /// `s{CPU}` (or equivalently `1s{CPU}` or just `s`). If the job uses 12,005
5461    /// CPU-seconds, then the value is written as `12005`.
5462    ///
5463    /// Alternatively, if you want a custom metric to record data in a more
5464    /// granular way, you can create a `DOUBLE CUMULATIVE` metric whose `unit` is
5465    /// `ks{CPU}`, and then write the value `12.005` (which is `12005/1000`),
5466    /// or use `Kis{CPU}` and write `11.723` (which is `12005/1024`).
5467    ///
5468    /// The supported units are a subset of [The Unified Code for Units of
5469    /// Measure](https://unitsofmeasure.org/ucum.html) standard:
5470    ///
5471    /// **Basic units (UNIT)**
5472    ///
5473    /// * `bit`   bit
5474    /// * `By`    byte
5475    /// * `s`     second
5476    /// * `min`   minute
5477    /// * `h`     hour
5478    /// * `d`     day
5479    /// * `1`     dimensionless
5480    ///
5481    /// **Prefixes (PREFIX)**
5482    ///
5483    /// * `k`     kilo    (10^3)
5484    ///
5485    /// * `M`     mega    (10^6)
5486    ///
5487    /// * `G`     giga    (10^9)
5488    ///
5489    /// * `T`     tera    (10^12)
5490    ///
5491    /// * `P`     peta    (10^15)
5492    ///
5493    /// * `E`     exa     (10^18)
5494    ///
5495    /// * `Z`     zetta   (10^21)
5496    ///
5497    /// * `Y`     yotta   (10^24)
5498    ///
5499    /// * `m`     milli   (10^-3)
5500    ///
5501    /// * `u`     micro   (10^-6)
5502    ///
5503    /// * `n`     nano    (10^-9)
5504    ///
5505    /// * `p`     pico    (10^-12)
5506    ///
5507    /// * `f`     femto   (10^-15)
5508    ///
5509    /// * `a`     atto    (10^-18)
5510    ///
5511    /// * `z`     zepto   (10^-21)
5512    ///
5513    /// * `y`     yocto   (10^-24)
5514    ///
5515    /// * `Ki`    kibi    (2^10)
5516    ///
5517    /// * `Mi`    mebi    (2^20)
5518    ///
5519    /// * `Gi`    gibi    (2^30)
5520    ///
5521    /// * `Ti`    tebi    (2^40)
5522    ///
5523    /// * `Pi`    pebi    (2^50)
5524    ///
5525    ///
5526    /// **Grammar**
5527    ///
5528    /// The grammar also includes these connectors:
5529    ///
5530    /// * `/`    division or ratio (as an infix operator). For examples,
5531    ///   `kBy/{email}` or `MiBy/10ms` (although you should almost never
5532    ///   have `/s` in a metric `unit`; rates should always be computed at
5533    ///   query time from the underlying cumulative or delta value).
5534    /// * `.`    multiplication or composition (as an infix operator). For
5535    ///   examples, `GBy.d` or `k{watt}.h`.
5536    ///
5537    /// The grammar for a unit is as follows:
5538    ///
5539    /// ```norust
5540    /// Expression = Component { "." Component } { "/" Component } ;
5541    ///
5542    /// Component = ( [ PREFIX ] UNIT | "%" ) [ Annotation ]
5543    ///           | Annotation
5544    ///           | "1"
5545    ///           ;
5546    ///
5547    /// Annotation = "{" NAME "}" ;
5548    /// ```
5549    ///
5550    /// Notes:
5551    ///
5552    /// * `Annotation` is just a comment if it follows a `UNIT`. If the annotation
5553    ///   is used alone, then the unit is equivalent to `1`. For examples,
5554    ///   `{request}/s == 1/s`, `By{transmitted}/s == By/s`.
5555    /// * `NAME` is a sequence of non-blank printable ASCII characters not
5556    ///   containing `{` or `}`.
5557    /// * `1` represents a unitary [dimensionless
5558    ///   unit](https://en.wikipedia.org/wiki/Dimensionless_quantity) of 1, such
5559    ///   as in `1/s`. It is typically used when none of the basic units are
5560    ///   appropriate. For example, "new users per day" can be represented as
5561    ///   `1/d` or `{new-users}/d` (and a metric value `5` would mean "5 new
5562    ///   users). Alternatively, "thousands of page views per day" would be
5563    ///   represented as `1000/d` or `k1/d` or `k{page_views}/d` (and a metric
5564    ///   value of `5.3` would mean "5300 page views per day").
5565    /// * `%` represents dimensionless value of 1/100, and annotates values giving
5566    ///   a percentage (so the metric values are typically in the range of 0..100,
5567    ///   and a metric value `3` means "3 percent").
5568    /// * `10^2.%` indicates a metric contains a ratio, typically in the range
5569    ///   0..1, that will be multiplied by 100 and displayed as a percentage
5570    ///   (so a metric value `0.03` means "3 percent").
5571    pub unit: std::string::String,
5572
5573    /// A detailed description of the metric, which can be used in documentation.
5574    pub description: std::string::String,
5575
5576    /// A concise name for the metric, which can be displayed in user interfaces.
5577    /// Use sentence case without an ending period, for example "Request count".
5578    /// This field is optional but it is recommended to be set for any metrics
5579    /// associated with user-visible concepts, such as Quota.
5580    pub display_name: std::string::String,
5581
5582    /// Optional. Metadata which can be used to guide usage of the metric.
5583    pub metadata: std::option::Option<crate::model::metric_descriptor::MetricDescriptorMetadata>,
5584
5585    /// Optional. The launch stage of the metric definition.
5586    pub launch_stage: crate::model::LaunchStage,
5587
5588    /// Read-only. If present, then a [time
5589    /// series][google.monitoring.v3.TimeSeries], which is identified partially by
5590    /// a metric type and a
5591    /// [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor], that
5592    /// is associated with this metric type can only be associated with one of the
5593    /// monitored resource types listed here.
5594    ///
5595    /// [google.api.MonitoredResourceDescriptor]: crate::model::MonitoredResourceDescriptor
5596    pub monitored_resource_types: std::vec::Vec<std::string::String>,
5597
5598    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5599}
5600
5601impl MetricDescriptor {
5602    pub fn new() -> Self {
5603        std::default::Default::default()
5604    }
5605
5606    /// Sets the value of [name][crate::model::MetricDescriptor::name].
5607    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5608        self.name = v.into();
5609        self
5610    }
5611
5612    /// Sets the value of [r#type][crate::model::MetricDescriptor::type].
5613    pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5614        self.r#type = v.into();
5615        self
5616    }
5617
5618    /// Sets the value of [labels][crate::model::MetricDescriptor::labels].
5619    pub fn set_labels<T, V>(mut self, v: T) -> Self
5620    where
5621        T: std::iter::IntoIterator<Item = V>,
5622        V: std::convert::Into<crate::model::LabelDescriptor>,
5623    {
5624        use std::iter::Iterator;
5625        self.labels = v.into_iter().map(|i| i.into()).collect();
5626        self
5627    }
5628
5629    /// Sets the value of [metric_kind][crate::model::MetricDescriptor::metric_kind].
5630    pub fn set_metric_kind<T: std::convert::Into<crate::model::metric_descriptor::MetricKind>>(
5631        mut self,
5632        v: T,
5633    ) -> Self {
5634        self.metric_kind = v.into();
5635        self
5636    }
5637
5638    /// Sets the value of [value_type][crate::model::MetricDescriptor::value_type].
5639    pub fn set_value_type<T: std::convert::Into<crate::model::metric_descriptor::ValueType>>(
5640        mut self,
5641        v: T,
5642    ) -> Self {
5643        self.value_type = v.into();
5644        self
5645    }
5646
5647    /// Sets the value of [unit][crate::model::MetricDescriptor::unit].
5648    pub fn set_unit<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5649        self.unit = v.into();
5650        self
5651    }
5652
5653    /// Sets the value of [description][crate::model::MetricDescriptor::description].
5654    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5655        self.description = v.into();
5656        self
5657    }
5658
5659    /// Sets the value of [display_name][crate::model::MetricDescriptor::display_name].
5660    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5661        self.display_name = v.into();
5662        self
5663    }
5664
5665    /// Sets the value of [metadata][crate::model::MetricDescriptor::metadata].
5666    pub fn set_metadata<T>(mut self, v: T) -> Self
5667    where
5668        T: std::convert::Into<crate::model::metric_descriptor::MetricDescriptorMetadata>,
5669    {
5670        self.metadata = std::option::Option::Some(v.into());
5671        self
5672    }
5673
5674    /// Sets or clears the value of [metadata][crate::model::MetricDescriptor::metadata].
5675    pub fn set_or_clear_metadata<T>(mut self, v: std::option::Option<T>) -> Self
5676    where
5677        T: std::convert::Into<crate::model::metric_descriptor::MetricDescriptorMetadata>,
5678    {
5679        self.metadata = v.map(|x| x.into());
5680        self
5681    }
5682
5683    /// Sets the value of [launch_stage][crate::model::MetricDescriptor::launch_stage].
5684    pub fn set_launch_stage<T: std::convert::Into<crate::model::LaunchStage>>(
5685        mut self,
5686        v: T,
5687    ) -> Self {
5688        self.launch_stage = v.into();
5689        self
5690    }
5691
5692    /// Sets the value of [monitored_resource_types][crate::model::MetricDescriptor::monitored_resource_types].
5693    pub fn set_monitored_resource_types<T, V>(mut self, v: T) -> Self
5694    where
5695        T: std::iter::IntoIterator<Item = V>,
5696        V: std::convert::Into<std::string::String>,
5697    {
5698        use std::iter::Iterator;
5699        self.monitored_resource_types = v.into_iter().map(|i| i.into()).collect();
5700        self
5701    }
5702}
5703
5704impl wkt::message::Message for MetricDescriptor {
5705    fn typename() -> &'static str {
5706        "type.googleapis.com/google.api.MetricDescriptor"
5707    }
5708}
5709
5710/// Defines additional types related to [MetricDescriptor].
5711pub mod metric_descriptor {
5712    #[allow(unused_imports)]
5713    use super::*;
5714
5715    /// Additional annotations that can be used to guide the usage of a metric.
5716    #[derive(Clone, Default, PartialEq)]
5717    #[non_exhaustive]
5718    pub struct MetricDescriptorMetadata {
5719
5720        /// Deprecated. Must use the
5721        /// [MetricDescriptor.launch_stage][google.api.MetricDescriptor.launch_stage]
5722        /// instead.
5723        ///
5724        /// [google.api.MetricDescriptor.launch_stage]: crate::model::MetricDescriptor::launch_stage
5725        #[deprecated]
5726        pub launch_stage: crate::model::LaunchStage,
5727
5728        /// The sampling period of metric data points. For metrics which are written
5729        /// periodically, consecutive data points are stored at this time interval,
5730        /// excluding data loss due to errors. Metrics with a higher granularity have
5731        /// a smaller sampling period.
5732        pub sample_period: std::option::Option<wkt::Duration>,
5733
5734        /// The delay of data points caused by ingestion. Data points older than this
5735        /// age are guaranteed to be ingested and available to be read, excluding
5736        /// data loss due to errors.
5737        pub ingest_delay: std::option::Option<wkt::Duration>,
5738
5739        /// The scope of the timeseries data of the metric.
5740        pub time_series_resource_hierarchy_level: std::vec::Vec<crate::model::metric_descriptor::metric_descriptor_metadata::TimeSeriesResourceHierarchyLevel>,
5741
5742        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5743    }
5744
5745    impl MetricDescriptorMetadata {
5746        pub fn new() -> Self {
5747            std::default::Default::default()
5748        }
5749
5750        /// Sets the value of [launch_stage][crate::model::metric_descriptor::MetricDescriptorMetadata::launch_stage].
5751        #[deprecated]
5752        pub fn set_launch_stage<T: std::convert::Into<crate::model::LaunchStage>>(
5753            mut self,
5754            v: T,
5755        ) -> Self {
5756            self.launch_stage = v.into();
5757            self
5758        }
5759
5760        /// Sets the value of [sample_period][crate::model::metric_descriptor::MetricDescriptorMetadata::sample_period].
5761        pub fn set_sample_period<T>(mut self, v: T) -> Self
5762        where
5763            T: std::convert::Into<wkt::Duration>,
5764        {
5765            self.sample_period = std::option::Option::Some(v.into());
5766            self
5767        }
5768
5769        /// Sets or clears the value of [sample_period][crate::model::metric_descriptor::MetricDescriptorMetadata::sample_period].
5770        pub fn set_or_clear_sample_period<T>(mut self, v: std::option::Option<T>) -> Self
5771        where
5772            T: std::convert::Into<wkt::Duration>,
5773        {
5774            self.sample_period = v.map(|x| x.into());
5775            self
5776        }
5777
5778        /// Sets the value of [ingest_delay][crate::model::metric_descriptor::MetricDescriptorMetadata::ingest_delay].
5779        pub fn set_ingest_delay<T>(mut self, v: T) -> Self
5780        where
5781            T: std::convert::Into<wkt::Duration>,
5782        {
5783            self.ingest_delay = std::option::Option::Some(v.into());
5784            self
5785        }
5786
5787        /// Sets or clears the value of [ingest_delay][crate::model::metric_descriptor::MetricDescriptorMetadata::ingest_delay].
5788        pub fn set_or_clear_ingest_delay<T>(mut self, v: std::option::Option<T>) -> Self
5789        where
5790            T: std::convert::Into<wkt::Duration>,
5791        {
5792            self.ingest_delay = v.map(|x| x.into());
5793            self
5794        }
5795
5796        /// Sets the value of [time_series_resource_hierarchy_level][crate::model::metric_descriptor::MetricDescriptorMetadata::time_series_resource_hierarchy_level].
5797        pub fn set_time_series_resource_hierarchy_level<T, V>(mut self, v: T) -> Self
5798        where
5799            T: std::iter::IntoIterator<Item = V>,
5800            V: std::convert::Into<crate::model::metric_descriptor::metric_descriptor_metadata::TimeSeriesResourceHierarchyLevel>
5801        {
5802            use std::iter::Iterator;
5803            self.time_series_resource_hierarchy_level = v.into_iter().map(|i| i.into()).collect();
5804            self
5805        }
5806    }
5807
5808    impl wkt::message::Message for MetricDescriptorMetadata {
5809        fn typename() -> &'static str {
5810            "type.googleapis.com/google.api.MetricDescriptor.MetricDescriptorMetadata"
5811        }
5812    }
5813
5814    /// Defines additional types related to [MetricDescriptorMetadata].
5815    pub mod metric_descriptor_metadata {
5816        #[allow(unused_imports)]
5817        use super::*;
5818
5819        /// The resource hierarchy level of the timeseries data of a metric.
5820        ///
5821        /// # Working with unknown values
5822        ///
5823        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5824        /// additional enum variants at any time. Adding new variants is not considered
5825        /// a breaking change. Applications should write their code in anticipation of:
5826        ///
5827        /// - New values appearing in future releases of the client library, **and**
5828        /// - New values received dynamically, without application changes.
5829        ///
5830        /// Please consult the [Working with enums] section in the user guide for some
5831        /// guidelines.
5832        ///
5833        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
5834        #[derive(Clone, Debug, PartialEq)]
5835        #[non_exhaustive]
5836        pub enum TimeSeriesResourceHierarchyLevel {
5837            /// Do not use this default value.
5838            Unspecified,
5839            /// Scopes a metric to a project.
5840            Project,
5841            /// Scopes a metric to an organization.
5842            Organization,
5843            /// Scopes a metric to a folder.
5844            Folder,
5845            /// If set, the enum was initialized with an unknown value.
5846            ///
5847            /// Applications can examine the value using [TimeSeriesResourceHierarchyLevel::value] or
5848            /// [TimeSeriesResourceHierarchyLevel::name].
5849            UnknownValue(time_series_resource_hierarchy_level::UnknownValue),
5850        }
5851
5852        #[doc(hidden)]
5853        pub mod time_series_resource_hierarchy_level {
5854            #[allow(unused_imports)]
5855            use super::*;
5856            #[derive(Clone, Debug, PartialEq)]
5857            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5858        }
5859
5860        impl TimeSeriesResourceHierarchyLevel {
5861            /// Gets the enum value.
5862            ///
5863            /// Returns `None` if the enum contains an unknown value deserialized from
5864            /// the string representation of enums.
5865            pub fn value(&self) -> std::option::Option<i32> {
5866                match self {
5867                    Self::Unspecified => std::option::Option::Some(0),
5868                    Self::Project => std::option::Option::Some(1),
5869                    Self::Organization => std::option::Option::Some(2),
5870                    Self::Folder => std::option::Option::Some(3),
5871                    Self::UnknownValue(u) => u.0.value(),
5872                }
5873            }
5874
5875            /// Gets the enum value as a string.
5876            ///
5877            /// Returns `None` if the enum contains an unknown value deserialized from
5878            /// the integer representation of enums.
5879            pub fn name(&self) -> std::option::Option<&str> {
5880                match self {
5881                    Self::Unspecified => std::option::Option::Some(
5882                        "TIME_SERIES_RESOURCE_HIERARCHY_LEVEL_UNSPECIFIED",
5883                    ),
5884                    Self::Project => std::option::Option::Some("PROJECT"),
5885                    Self::Organization => std::option::Option::Some("ORGANIZATION"),
5886                    Self::Folder => std::option::Option::Some("FOLDER"),
5887                    Self::UnknownValue(u) => u.0.name(),
5888                }
5889            }
5890        }
5891
5892        impl std::default::Default for TimeSeriesResourceHierarchyLevel {
5893            fn default() -> Self {
5894                use std::convert::From;
5895                Self::from(0)
5896            }
5897        }
5898
5899        impl std::fmt::Display for TimeSeriesResourceHierarchyLevel {
5900            fn fmt(
5901                &self,
5902                f: &mut std::fmt::Formatter<'_>,
5903            ) -> std::result::Result<(), std::fmt::Error> {
5904                wkt::internal::display_enum(f, self.name(), self.value())
5905            }
5906        }
5907
5908        impl std::convert::From<i32> for TimeSeriesResourceHierarchyLevel {
5909            fn from(value: i32) -> Self {
5910                match value {
5911                    0 => Self::Unspecified,
5912                    1 => Self::Project,
5913                    2 => Self::Organization,
5914                    3 => Self::Folder,
5915                    _ => Self::UnknownValue(time_series_resource_hierarchy_level::UnknownValue(
5916                        wkt::internal::UnknownEnumValue::Integer(value),
5917                    )),
5918                }
5919            }
5920        }
5921
5922        impl std::convert::From<&str> for TimeSeriesResourceHierarchyLevel {
5923            fn from(value: &str) -> Self {
5924                use std::string::ToString;
5925                match value {
5926                    "TIME_SERIES_RESOURCE_HIERARCHY_LEVEL_UNSPECIFIED" => Self::Unspecified,
5927                    "PROJECT" => Self::Project,
5928                    "ORGANIZATION" => Self::Organization,
5929                    "FOLDER" => Self::Folder,
5930                    _ => Self::UnknownValue(time_series_resource_hierarchy_level::UnknownValue(
5931                        wkt::internal::UnknownEnumValue::String(value.to_string()),
5932                    )),
5933                }
5934            }
5935        }
5936
5937        impl serde::ser::Serialize for TimeSeriesResourceHierarchyLevel {
5938            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5939            where
5940                S: serde::Serializer,
5941            {
5942                match self {
5943                    Self::Unspecified => serializer.serialize_i32(0),
5944                    Self::Project => serializer.serialize_i32(1),
5945                    Self::Organization => serializer.serialize_i32(2),
5946                    Self::Folder => serializer.serialize_i32(3),
5947                    Self::UnknownValue(u) => u.0.serialize(serializer),
5948                }
5949            }
5950        }
5951
5952        impl<'de> serde::de::Deserialize<'de> for TimeSeriesResourceHierarchyLevel {
5953            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5954            where
5955                D: serde::Deserializer<'de>,
5956            {
5957                deserializer.deserialize_any(wkt::internal::EnumVisitor::<TimeSeriesResourceHierarchyLevel>::new(
5958                    ".google.api.MetricDescriptor.MetricDescriptorMetadata.TimeSeriesResourceHierarchyLevel"))
5959            }
5960        }
5961    }
5962
5963    /// The kind of measurement. It describes how the data is reported.
5964    /// For information on setting the start time and end time based on
5965    /// the MetricKind, see [TimeInterval][google.monitoring.v3.TimeInterval].
5966    ///
5967    /// # Working with unknown values
5968    ///
5969    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5970    /// additional enum variants at any time. Adding new variants is not considered
5971    /// a breaking change. Applications should write their code in anticipation of:
5972    ///
5973    /// - New values appearing in future releases of the client library, **and**
5974    /// - New values received dynamically, without application changes.
5975    ///
5976    /// Please consult the [Working with enums] section in the user guide for some
5977    /// guidelines.
5978    ///
5979    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
5980    #[derive(Clone, Debug, PartialEq)]
5981    #[non_exhaustive]
5982    pub enum MetricKind {
5983        /// Do not use this default value.
5984        Unspecified,
5985        /// An instantaneous measurement of a value.
5986        Gauge,
5987        /// The change in a value during a time interval.
5988        Delta,
5989        /// A value accumulated over a time interval.  Cumulative
5990        /// measurements in a time series should have the same start time
5991        /// and increasing end times, until an event resets the cumulative
5992        /// value to zero and sets a new start time for the following
5993        /// points.
5994        Cumulative,
5995        /// If set, the enum was initialized with an unknown value.
5996        ///
5997        /// Applications can examine the value using [MetricKind::value] or
5998        /// [MetricKind::name].
5999        UnknownValue(metric_kind::UnknownValue),
6000    }
6001
6002    #[doc(hidden)]
6003    pub mod metric_kind {
6004        #[allow(unused_imports)]
6005        use super::*;
6006        #[derive(Clone, Debug, PartialEq)]
6007        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6008    }
6009
6010    impl MetricKind {
6011        /// Gets the enum value.
6012        ///
6013        /// Returns `None` if the enum contains an unknown value deserialized from
6014        /// the string representation of enums.
6015        pub fn value(&self) -> std::option::Option<i32> {
6016            match self {
6017                Self::Unspecified => std::option::Option::Some(0),
6018                Self::Gauge => std::option::Option::Some(1),
6019                Self::Delta => std::option::Option::Some(2),
6020                Self::Cumulative => std::option::Option::Some(3),
6021                Self::UnknownValue(u) => u.0.value(),
6022            }
6023        }
6024
6025        /// Gets the enum value as a string.
6026        ///
6027        /// Returns `None` if the enum contains an unknown value deserialized from
6028        /// the integer representation of enums.
6029        pub fn name(&self) -> std::option::Option<&str> {
6030            match self {
6031                Self::Unspecified => std::option::Option::Some("METRIC_KIND_UNSPECIFIED"),
6032                Self::Gauge => std::option::Option::Some("GAUGE"),
6033                Self::Delta => std::option::Option::Some("DELTA"),
6034                Self::Cumulative => std::option::Option::Some("CUMULATIVE"),
6035                Self::UnknownValue(u) => u.0.name(),
6036            }
6037        }
6038    }
6039
6040    impl std::default::Default for MetricKind {
6041        fn default() -> Self {
6042            use std::convert::From;
6043            Self::from(0)
6044        }
6045    }
6046
6047    impl std::fmt::Display for MetricKind {
6048        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6049            wkt::internal::display_enum(f, self.name(), self.value())
6050        }
6051    }
6052
6053    impl std::convert::From<i32> for MetricKind {
6054        fn from(value: i32) -> Self {
6055            match value {
6056                0 => Self::Unspecified,
6057                1 => Self::Gauge,
6058                2 => Self::Delta,
6059                3 => Self::Cumulative,
6060                _ => Self::UnknownValue(metric_kind::UnknownValue(
6061                    wkt::internal::UnknownEnumValue::Integer(value),
6062                )),
6063            }
6064        }
6065    }
6066
6067    impl std::convert::From<&str> for MetricKind {
6068        fn from(value: &str) -> Self {
6069            use std::string::ToString;
6070            match value {
6071                "METRIC_KIND_UNSPECIFIED" => Self::Unspecified,
6072                "GAUGE" => Self::Gauge,
6073                "DELTA" => Self::Delta,
6074                "CUMULATIVE" => Self::Cumulative,
6075                _ => Self::UnknownValue(metric_kind::UnknownValue(
6076                    wkt::internal::UnknownEnumValue::String(value.to_string()),
6077                )),
6078            }
6079        }
6080    }
6081
6082    impl serde::ser::Serialize for MetricKind {
6083        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6084        where
6085            S: serde::Serializer,
6086        {
6087            match self {
6088                Self::Unspecified => serializer.serialize_i32(0),
6089                Self::Gauge => serializer.serialize_i32(1),
6090                Self::Delta => serializer.serialize_i32(2),
6091                Self::Cumulative => serializer.serialize_i32(3),
6092                Self::UnknownValue(u) => u.0.serialize(serializer),
6093            }
6094        }
6095    }
6096
6097    impl<'de> serde::de::Deserialize<'de> for MetricKind {
6098        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6099        where
6100            D: serde::Deserializer<'de>,
6101        {
6102            deserializer.deserialize_any(wkt::internal::EnumVisitor::<MetricKind>::new(
6103                ".google.api.MetricDescriptor.MetricKind",
6104            ))
6105        }
6106    }
6107
6108    /// The value type of a metric.
6109    ///
6110    /// # Working with unknown values
6111    ///
6112    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6113    /// additional enum variants at any time. Adding new variants is not considered
6114    /// a breaking change. Applications should write their code in anticipation of:
6115    ///
6116    /// - New values appearing in future releases of the client library, **and**
6117    /// - New values received dynamically, without application changes.
6118    ///
6119    /// Please consult the [Working with enums] section in the user guide for some
6120    /// guidelines.
6121    ///
6122    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
6123    #[derive(Clone, Debug, PartialEq)]
6124    #[non_exhaustive]
6125    pub enum ValueType {
6126        /// Do not use this default value.
6127        Unspecified,
6128        /// The value is a boolean.
6129        /// This value type can be used only if the metric kind is `GAUGE`.
6130        Bool,
6131        /// The value is a signed 64-bit integer.
6132        Int64,
6133        /// The value is a double precision floating point number.
6134        Double,
6135        /// The value is a text string.
6136        /// This value type can be used only if the metric kind is `GAUGE`.
6137        String,
6138        /// The value is a [`Distribution`][google.api.Distribution].
6139        ///
6140        /// [google.api.Distribution]: crate::model::Distribution
6141        Distribution,
6142        /// The value is money.
6143        Money,
6144        /// If set, the enum was initialized with an unknown value.
6145        ///
6146        /// Applications can examine the value using [ValueType::value] or
6147        /// [ValueType::name].
6148        UnknownValue(value_type::UnknownValue),
6149    }
6150
6151    #[doc(hidden)]
6152    pub mod value_type {
6153        #[allow(unused_imports)]
6154        use super::*;
6155        #[derive(Clone, Debug, PartialEq)]
6156        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6157    }
6158
6159    impl ValueType {
6160        /// Gets the enum value.
6161        ///
6162        /// Returns `None` if the enum contains an unknown value deserialized from
6163        /// the string representation of enums.
6164        pub fn value(&self) -> std::option::Option<i32> {
6165            match self {
6166                Self::Unspecified => std::option::Option::Some(0),
6167                Self::Bool => std::option::Option::Some(1),
6168                Self::Int64 => std::option::Option::Some(2),
6169                Self::Double => std::option::Option::Some(3),
6170                Self::String => std::option::Option::Some(4),
6171                Self::Distribution => std::option::Option::Some(5),
6172                Self::Money => std::option::Option::Some(6),
6173                Self::UnknownValue(u) => u.0.value(),
6174            }
6175        }
6176
6177        /// Gets the enum value as a string.
6178        ///
6179        /// Returns `None` if the enum contains an unknown value deserialized from
6180        /// the integer representation of enums.
6181        pub fn name(&self) -> std::option::Option<&str> {
6182            match self {
6183                Self::Unspecified => std::option::Option::Some("VALUE_TYPE_UNSPECIFIED"),
6184                Self::Bool => std::option::Option::Some("BOOL"),
6185                Self::Int64 => std::option::Option::Some("INT64"),
6186                Self::Double => std::option::Option::Some("DOUBLE"),
6187                Self::String => std::option::Option::Some("STRING"),
6188                Self::Distribution => std::option::Option::Some("DISTRIBUTION"),
6189                Self::Money => std::option::Option::Some("MONEY"),
6190                Self::UnknownValue(u) => u.0.name(),
6191            }
6192        }
6193    }
6194
6195    impl std::default::Default for ValueType {
6196        fn default() -> Self {
6197            use std::convert::From;
6198            Self::from(0)
6199        }
6200    }
6201
6202    impl std::fmt::Display for ValueType {
6203        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6204            wkt::internal::display_enum(f, self.name(), self.value())
6205        }
6206    }
6207
6208    impl std::convert::From<i32> for ValueType {
6209        fn from(value: i32) -> Self {
6210            match value {
6211                0 => Self::Unspecified,
6212                1 => Self::Bool,
6213                2 => Self::Int64,
6214                3 => Self::Double,
6215                4 => Self::String,
6216                5 => Self::Distribution,
6217                6 => Self::Money,
6218                _ => Self::UnknownValue(value_type::UnknownValue(
6219                    wkt::internal::UnknownEnumValue::Integer(value),
6220                )),
6221            }
6222        }
6223    }
6224
6225    impl std::convert::From<&str> for ValueType {
6226        fn from(value: &str) -> Self {
6227            use std::string::ToString;
6228            match value {
6229                "VALUE_TYPE_UNSPECIFIED" => Self::Unspecified,
6230                "BOOL" => Self::Bool,
6231                "INT64" => Self::Int64,
6232                "DOUBLE" => Self::Double,
6233                "STRING" => Self::String,
6234                "DISTRIBUTION" => Self::Distribution,
6235                "MONEY" => Self::Money,
6236                _ => Self::UnknownValue(value_type::UnknownValue(
6237                    wkt::internal::UnknownEnumValue::String(value.to_string()),
6238                )),
6239            }
6240        }
6241    }
6242
6243    impl serde::ser::Serialize for ValueType {
6244        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6245        where
6246            S: serde::Serializer,
6247        {
6248            match self {
6249                Self::Unspecified => serializer.serialize_i32(0),
6250                Self::Bool => serializer.serialize_i32(1),
6251                Self::Int64 => serializer.serialize_i32(2),
6252                Self::Double => serializer.serialize_i32(3),
6253                Self::String => serializer.serialize_i32(4),
6254                Self::Distribution => serializer.serialize_i32(5),
6255                Self::Money => serializer.serialize_i32(6),
6256                Self::UnknownValue(u) => u.0.serialize(serializer),
6257            }
6258        }
6259    }
6260
6261    impl<'de> serde::de::Deserialize<'de> for ValueType {
6262        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6263        where
6264            D: serde::Deserializer<'de>,
6265        {
6266            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ValueType>::new(
6267                ".google.api.MetricDescriptor.ValueType",
6268            ))
6269        }
6270    }
6271}
6272
6273/// A specific metric, identified by specifying values for all of the
6274/// labels of a [`MetricDescriptor`][google.api.MetricDescriptor].
6275///
6276/// [google.api.MetricDescriptor]: crate::model::MetricDescriptor
6277#[derive(Clone, Default, PartialEq)]
6278#[non_exhaustive]
6279pub struct Metric {
6280    /// An existing metric type, see
6281    /// [google.api.MetricDescriptor][google.api.MetricDescriptor]. For example,
6282    /// `custom.googleapis.com/invoice/paid/amount`.
6283    ///
6284    /// [google.api.MetricDescriptor]: crate::model::MetricDescriptor
6285    pub r#type: std::string::String,
6286
6287    /// The set of label values that uniquely identify this metric. All
6288    /// labels listed in the `MetricDescriptor` must be assigned values.
6289    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
6290
6291    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6292}
6293
6294impl Metric {
6295    pub fn new() -> Self {
6296        std::default::Default::default()
6297    }
6298
6299    /// Sets the value of [r#type][crate::model::Metric::type].
6300    pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6301        self.r#type = v.into();
6302        self
6303    }
6304
6305    /// Sets the value of [labels][crate::model::Metric::labels].
6306    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
6307    where
6308        T: std::iter::IntoIterator<Item = (K, V)>,
6309        K: std::convert::Into<std::string::String>,
6310        V: std::convert::Into<std::string::String>,
6311    {
6312        use std::iter::Iterator;
6313        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6314        self
6315    }
6316}
6317
6318impl wkt::message::Message for Metric {
6319    fn typename() -> &'static str {
6320        "type.googleapis.com/google.api.Metric"
6321    }
6322}
6323
6324/// An object that describes the schema of a
6325/// [MonitoredResource][google.api.MonitoredResource] object using a type name
6326/// and a set of labels.  For example, the monitored resource descriptor for
6327/// Google Compute Engine VM instances has a type of
6328/// `"gce_instance"` and specifies the use of the labels `"instance_id"` and
6329/// `"zone"` to identify particular VM instances.
6330///
6331/// Different APIs can support different monitored resource types. APIs generally
6332/// provide a `list` method that returns the monitored resource descriptors used
6333/// by the API.
6334///
6335/// [google.api.MonitoredResource]: crate::model::MonitoredResource
6336#[derive(Clone, Default, PartialEq)]
6337#[non_exhaustive]
6338pub struct MonitoredResourceDescriptor {
6339    /// Optional. The resource name of the monitored resource descriptor:
6340    /// `"projects/{project_id}/monitoredResourceDescriptors/{type}"` where
6341    /// {type} is the value of the `type` field in this object and
6342    /// {project_id} is a project ID that provides API-specific context for
6343    /// accessing the type.  APIs that do not use project information can use the
6344    /// resource name format `"monitoredResourceDescriptors/{type}"`.
6345    pub name: std::string::String,
6346
6347    /// Required. The monitored resource type. For example, the type
6348    /// `"cloudsql_database"` represents databases in Google Cloud SQL.
6349    /// For a list of types, see [Monitored resource
6350    /// types](https://cloud.google.com/monitoring/api/resources)
6351    /// and [Logging resource
6352    /// types](https://cloud.google.com/logging/docs/api/v2/resource-list).
6353    pub r#type: std::string::String,
6354
6355    /// Optional. A concise name for the monitored resource type that might be
6356    /// displayed in user interfaces. It should be a Title Cased Noun Phrase,
6357    /// without any article or other determiners. For example,
6358    /// `"Google Cloud SQL Database"`.
6359    pub display_name: std::string::String,
6360
6361    /// Optional. A detailed description of the monitored resource type that might
6362    /// be used in documentation.
6363    pub description: std::string::String,
6364
6365    /// Required. A set of labels used to describe instances of this monitored
6366    /// resource type. For example, an individual Google Cloud SQL database is
6367    /// identified by values for the labels `"database_id"` and `"zone"`.
6368    pub labels: std::vec::Vec<crate::model::LabelDescriptor>,
6369
6370    /// Optional. The launch stage of the monitored resource definition.
6371    pub launch_stage: crate::model::LaunchStage,
6372
6373    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6374}
6375
6376impl MonitoredResourceDescriptor {
6377    pub fn new() -> Self {
6378        std::default::Default::default()
6379    }
6380
6381    /// Sets the value of [name][crate::model::MonitoredResourceDescriptor::name].
6382    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6383        self.name = v.into();
6384        self
6385    }
6386
6387    /// Sets the value of [r#type][crate::model::MonitoredResourceDescriptor::type].
6388    pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6389        self.r#type = v.into();
6390        self
6391    }
6392
6393    /// Sets the value of [display_name][crate::model::MonitoredResourceDescriptor::display_name].
6394    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6395        self.display_name = v.into();
6396        self
6397    }
6398
6399    /// Sets the value of [description][crate::model::MonitoredResourceDescriptor::description].
6400    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6401        self.description = v.into();
6402        self
6403    }
6404
6405    /// Sets the value of [labels][crate::model::MonitoredResourceDescriptor::labels].
6406    pub fn set_labels<T, V>(mut self, v: T) -> Self
6407    where
6408        T: std::iter::IntoIterator<Item = V>,
6409        V: std::convert::Into<crate::model::LabelDescriptor>,
6410    {
6411        use std::iter::Iterator;
6412        self.labels = v.into_iter().map(|i| i.into()).collect();
6413        self
6414    }
6415
6416    /// Sets the value of [launch_stage][crate::model::MonitoredResourceDescriptor::launch_stage].
6417    pub fn set_launch_stage<T: std::convert::Into<crate::model::LaunchStage>>(
6418        mut self,
6419        v: T,
6420    ) -> Self {
6421        self.launch_stage = v.into();
6422        self
6423    }
6424}
6425
6426impl wkt::message::Message for MonitoredResourceDescriptor {
6427    fn typename() -> &'static str {
6428        "type.googleapis.com/google.api.MonitoredResourceDescriptor"
6429    }
6430}
6431
6432/// An object representing a resource that can be used for monitoring, logging,
6433/// billing, or other purposes. Examples include virtual machine instances,
6434/// databases, and storage devices such as disks. The `type` field identifies a
6435/// [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] object
6436/// that describes the resource's schema. Information in the `labels` field
6437/// identifies the actual resource and its attributes according to the schema.
6438/// For example, a particular Compute Engine VM instance could be represented by
6439/// the following object, because the
6440/// [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] for
6441/// `"gce_instance"` has labels
6442/// `"project_id"`, `"instance_id"` and `"zone"`:
6443///
6444/// ```norust
6445/// { "type": "gce_instance",
6446///   "labels": { "project_id": "my-project",
6447///               "instance_id": "12345678901234",
6448///               "zone": "us-central1-a" }}
6449/// ```
6450///
6451/// [google.api.MonitoredResourceDescriptor]: crate::model::MonitoredResourceDescriptor
6452#[derive(Clone, Default, PartialEq)]
6453#[non_exhaustive]
6454pub struct MonitoredResource {
6455    /// Required. The monitored resource type. This field must match
6456    /// the `type` field of a
6457    /// [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor]
6458    /// object. For example, the type of a Compute Engine VM instance is
6459    /// `gce_instance`. Some descriptors include the service name in the type; for
6460    /// example, the type of a Datastream stream is
6461    /// `datastream.googleapis.com/Stream`.
6462    ///
6463    /// [google.api.MonitoredResourceDescriptor]: crate::model::MonitoredResourceDescriptor
6464    pub r#type: std::string::String,
6465
6466    /// Required. Values for all of the labels listed in the associated monitored
6467    /// resource descriptor. For example, Compute Engine VM instances use the
6468    /// labels `"project_id"`, `"instance_id"`, and `"zone"`.
6469    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
6470
6471    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6472}
6473
6474impl MonitoredResource {
6475    pub fn new() -> Self {
6476        std::default::Default::default()
6477    }
6478
6479    /// Sets the value of [r#type][crate::model::MonitoredResource::type].
6480    pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6481        self.r#type = v.into();
6482        self
6483    }
6484
6485    /// Sets the value of [labels][crate::model::MonitoredResource::labels].
6486    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
6487    where
6488        T: std::iter::IntoIterator<Item = (K, V)>,
6489        K: std::convert::Into<std::string::String>,
6490        V: std::convert::Into<std::string::String>,
6491    {
6492        use std::iter::Iterator;
6493        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6494        self
6495    }
6496}
6497
6498impl wkt::message::Message for MonitoredResource {
6499    fn typename() -> &'static str {
6500        "type.googleapis.com/google.api.MonitoredResource"
6501    }
6502}
6503
6504/// Auxiliary metadata for a [MonitoredResource][google.api.MonitoredResource]
6505/// object. [MonitoredResource][google.api.MonitoredResource] objects contain the
6506/// minimum set of information to uniquely identify a monitored resource
6507/// instance. There is some other useful auxiliary metadata. Monitoring and
6508/// Logging use an ingestion pipeline to extract metadata for cloud resources of
6509/// all types, and store the metadata in this message.
6510///
6511/// [google.api.MonitoredResource]: crate::model::MonitoredResource
6512#[derive(Clone, Default, PartialEq)]
6513#[non_exhaustive]
6514pub struct MonitoredResourceMetadata {
6515    /// Output only. Values for predefined system metadata labels.
6516    /// System labels are a kind of metadata extracted by Google, including
6517    /// "machine_image", "vpc", "subnet_id",
6518    /// "security_group", "name", etc.
6519    /// System label values can be only strings, Boolean values, or a list of
6520    /// strings. For example:
6521    ///
6522    /// ```norust
6523    /// { "name": "my-test-instance",
6524    ///   "security_group": ["a", "b", "c"],
6525    ///   "spot_instance": false }
6526    /// ```
6527    pub system_labels: std::option::Option<wkt::Struct>,
6528
6529    /// Output only. A map of user-defined metadata labels.
6530    pub user_labels: std::collections::HashMap<std::string::String, std::string::String>,
6531
6532    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6533}
6534
6535impl MonitoredResourceMetadata {
6536    pub fn new() -> Self {
6537        std::default::Default::default()
6538    }
6539
6540    /// Sets the value of [system_labels][crate::model::MonitoredResourceMetadata::system_labels].
6541    pub fn set_system_labels<T>(mut self, v: T) -> Self
6542    where
6543        T: std::convert::Into<wkt::Struct>,
6544    {
6545        self.system_labels = std::option::Option::Some(v.into());
6546        self
6547    }
6548
6549    /// Sets or clears the value of [system_labels][crate::model::MonitoredResourceMetadata::system_labels].
6550    pub fn set_or_clear_system_labels<T>(mut self, v: std::option::Option<T>) -> Self
6551    where
6552        T: std::convert::Into<wkt::Struct>,
6553    {
6554        self.system_labels = v.map(|x| x.into());
6555        self
6556    }
6557
6558    /// Sets the value of [user_labels][crate::model::MonitoredResourceMetadata::user_labels].
6559    pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
6560    where
6561        T: std::iter::IntoIterator<Item = (K, V)>,
6562        K: std::convert::Into<std::string::String>,
6563        V: std::convert::Into<std::string::String>,
6564    {
6565        use std::iter::Iterator;
6566        self.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6567        self
6568    }
6569}
6570
6571impl wkt::message::Message for MonitoredResourceMetadata {
6572    fn typename() -> &'static str {
6573        "type.googleapis.com/google.api.MonitoredResourceMetadata"
6574    }
6575}
6576
6577/// Monitoring configuration of the service.
6578///
6579/// The example below shows how to configure monitored resources and metrics
6580/// for monitoring. In the example, a monitored resource and two metrics are
6581/// defined. The `library.googleapis.com/book/returned_count` metric is sent
6582/// to both producer and consumer projects, whereas the
6583/// `library.googleapis.com/book/num_overdue` metric is only sent to the
6584/// consumer project.
6585///
6586/// ```norust
6587/// monitored_resources:
6588/// - type: library.googleapis.com/Branch
6589///   display_name: "Library Branch"
6590///   description: "A branch of a library."
6591///   launch_stage: GA
6592///   labels:
6593///   - key: resource_container
6594///     description: "The Cloud container (ie. project id) for the Branch."
6595///   - key: location
6596///     description: "The location of the library branch."
6597///   - key: branch_id
6598///     description: "The id of the branch."
6599/// metrics:
6600/// - name: library.googleapis.com/book/returned_count
6601///   display_name: "Books Returned"
6602///   description: "The count of books that have been returned."
6603///   launch_stage: GA
6604///   metric_kind: DELTA
6605///   value_type: INT64
6606///   unit: "1"
6607///   labels:
6608///   - key: customer_id
6609///     description: "The id of the customer."
6610/// - name: library.googleapis.com/book/num_overdue
6611///   display_name: "Books Overdue"
6612///   description: "The current number of overdue books."
6613///   launch_stage: GA
6614///   metric_kind: GAUGE
6615///   value_type: INT64
6616///   unit: "1"
6617///   labels:
6618///   - key: customer_id
6619///     description: "The id of the customer."
6620/// monitoring:
6621///   producer_destinations:
6622///   - monitored_resource: library.googleapis.com/Branch
6623///     metrics:
6624///     - library.googleapis.com/book/returned_count
6625///   consumer_destinations:
6626///   - monitored_resource: library.googleapis.com/Branch
6627///     metrics:
6628///     - library.googleapis.com/book/returned_count
6629///     - library.googleapis.com/book/num_overdue
6630/// ```
6631#[derive(Clone, Default, PartialEq)]
6632#[non_exhaustive]
6633pub struct Monitoring {
6634    /// Monitoring configurations for sending metrics to the producer project.
6635    /// There can be multiple producer destinations. A monitored resource type may
6636    /// appear in multiple monitoring destinations if different aggregations are
6637    /// needed for different sets of metrics associated with that monitored
6638    /// resource type. A monitored resource and metric pair may only be used once
6639    /// in the Monitoring configuration.
6640    pub producer_destinations: std::vec::Vec<crate::model::monitoring::MonitoringDestination>,
6641
6642    /// Monitoring configurations for sending metrics to the consumer project.
6643    /// There can be multiple consumer destinations. A monitored resource type may
6644    /// appear in multiple monitoring destinations if different aggregations are
6645    /// needed for different sets of metrics associated with that monitored
6646    /// resource type. A monitored resource and metric pair may only be used once
6647    /// in the Monitoring configuration.
6648    pub consumer_destinations: std::vec::Vec<crate::model::monitoring::MonitoringDestination>,
6649
6650    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6651}
6652
6653impl Monitoring {
6654    pub fn new() -> Self {
6655        std::default::Default::default()
6656    }
6657
6658    /// Sets the value of [producer_destinations][crate::model::Monitoring::producer_destinations].
6659    pub fn set_producer_destinations<T, V>(mut self, v: T) -> Self
6660    where
6661        T: std::iter::IntoIterator<Item = V>,
6662        V: std::convert::Into<crate::model::monitoring::MonitoringDestination>,
6663    {
6664        use std::iter::Iterator;
6665        self.producer_destinations = v.into_iter().map(|i| i.into()).collect();
6666        self
6667    }
6668
6669    /// Sets the value of [consumer_destinations][crate::model::Monitoring::consumer_destinations].
6670    pub fn set_consumer_destinations<T, V>(mut self, v: T) -> Self
6671    where
6672        T: std::iter::IntoIterator<Item = V>,
6673        V: std::convert::Into<crate::model::monitoring::MonitoringDestination>,
6674    {
6675        use std::iter::Iterator;
6676        self.consumer_destinations = v.into_iter().map(|i| i.into()).collect();
6677        self
6678    }
6679}
6680
6681impl wkt::message::Message for Monitoring {
6682    fn typename() -> &'static str {
6683        "type.googleapis.com/google.api.Monitoring"
6684    }
6685}
6686
6687/// Defines additional types related to [Monitoring].
6688pub mod monitoring {
6689    #[allow(unused_imports)]
6690    use super::*;
6691
6692    /// Configuration of a specific monitoring destination (the producer project
6693    /// or the consumer project).
6694    #[derive(Clone, Default, PartialEq)]
6695    #[non_exhaustive]
6696    pub struct MonitoringDestination {
6697        /// The monitored resource type. The type must be defined in
6698        /// [Service.monitored_resources][google.api.Service.monitored_resources]
6699        /// section.
6700        ///
6701        /// [google.api.Service.monitored_resources]: crate::model::Service::monitored_resources
6702        pub monitored_resource: std::string::String,
6703
6704        /// Types of the metrics to report to this monitoring destination.
6705        /// Each type must be defined in
6706        /// [Service.metrics][google.api.Service.metrics] section.
6707        ///
6708        /// [google.api.Service.metrics]: crate::model::Service::metrics
6709        pub metrics: std::vec::Vec<std::string::String>,
6710
6711        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6712    }
6713
6714    impl MonitoringDestination {
6715        pub fn new() -> Self {
6716            std::default::Default::default()
6717        }
6718
6719        /// Sets the value of [monitored_resource][crate::model::monitoring::MonitoringDestination::monitored_resource].
6720        pub fn set_monitored_resource<T: std::convert::Into<std::string::String>>(
6721            mut self,
6722            v: T,
6723        ) -> Self {
6724            self.monitored_resource = v.into();
6725            self
6726        }
6727
6728        /// Sets the value of [metrics][crate::model::monitoring::MonitoringDestination::metrics].
6729        pub fn set_metrics<T, V>(mut self, v: T) -> Self
6730        where
6731            T: std::iter::IntoIterator<Item = V>,
6732            V: std::convert::Into<std::string::String>,
6733        {
6734            use std::iter::Iterator;
6735            self.metrics = v.into_iter().map(|i| i.into()).collect();
6736            self
6737        }
6738    }
6739
6740    impl wkt::message::Message for MonitoringDestination {
6741        fn typename() -> &'static str {
6742            "type.googleapis.com/google.api.Monitoring.MonitoringDestination"
6743        }
6744    }
6745}
6746
6747/// Google API Policy Annotation
6748///
6749/// This message defines a simple API policy annotation that can be used to
6750/// annotate API request and response message fields with applicable policies.
6751/// One field may have multiple applicable policies that must all be satisfied
6752/// before a request can be processed. This policy annotation is used to
6753/// generate the overall policy that will be used for automatic runtime
6754/// policy enforcement and documentation generation.
6755#[derive(Clone, Default, PartialEq)]
6756#[non_exhaustive]
6757pub struct FieldPolicy {
6758    /// Selects one or more request or response message fields to apply this
6759    /// `FieldPolicy`.
6760    ///
6761    /// When a `FieldPolicy` is used in proto annotation, the selector must
6762    /// be left as empty. The service config generator will automatically fill
6763    /// the correct value.
6764    ///
6765    /// When a `FieldPolicy` is used in service config, the selector must be a
6766    /// comma-separated string with valid request or response field paths,
6767    /// such as "foo.bar" or "foo.bar,foo.baz".
6768    pub selector: std::string::String,
6769
6770    /// Specifies the required permission(s) for the resource referred to by the
6771    /// field. It requires the field contains a valid resource reference, and
6772    /// the request must pass the permission checks to proceed. For example,
6773    /// "resourcemanager.projects.get".
6774    pub resource_permission: std::string::String,
6775
6776    /// Specifies the resource type for the resource referred to by the field.
6777    pub resource_type: std::string::String,
6778
6779    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6780}
6781
6782impl FieldPolicy {
6783    pub fn new() -> Self {
6784        std::default::Default::default()
6785    }
6786
6787    /// Sets the value of [selector][crate::model::FieldPolicy::selector].
6788    pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6789        self.selector = v.into();
6790        self
6791    }
6792
6793    /// Sets the value of [resource_permission][crate::model::FieldPolicy::resource_permission].
6794    pub fn set_resource_permission<T: std::convert::Into<std::string::String>>(
6795        mut self,
6796        v: T,
6797    ) -> Self {
6798        self.resource_permission = v.into();
6799        self
6800    }
6801
6802    /// Sets the value of [resource_type][crate::model::FieldPolicy::resource_type].
6803    pub fn set_resource_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6804        self.resource_type = v.into();
6805        self
6806    }
6807}
6808
6809impl wkt::message::Message for FieldPolicy {
6810    fn typename() -> &'static str {
6811        "type.googleapis.com/google.api.FieldPolicy"
6812    }
6813}
6814
6815/// Defines policies applying to an RPC method.
6816#[derive(Clone, Default, PartialEq)]
6817#[non_exhaustive]
6818pub struct MethodPolicy {
6819    /// Selects a method to which these policies should be enforced, for example,
6820    /// "google.pubsub.v1.Subscriber.CreateSubscription".
6821    ///
6822    /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
6823    /// details.
6824    ///
6825    /// NOTE: This field must not be set in the proto annotation. It will be
6826    /// automatically filled by the service config compiler .
6827    ///
6828    /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
6829    pub selector: std::string::String,
6830
6831    /// Policies that are applicable to the request message.
6832    pub request_policies: std::vec::Vec<crate::model::FieldPolicy>,
6833
6834    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6835}
6836
6837impl MethodPolicy {
6838    pub fn new() -> Self {
6839        std::default::Default::default()
6840    }
6841
6842    /// Sets the value of [selector][crate::model::MethodPolicy::selector].
6843    pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6844        self.selector = v.into();
6845        self
6846    }
6847
6848    /// Sets the value of [request_policies][crate::model::MethodPolicy::request_policies].
6849    pub fn set_request_policies<T, V>(mut self, v: T) -> Self
6850    where
6851        T: std::iter::IntoIterator<Item = V>,
6852        V: std::convert::Into<crate::model::FieldPolicy>,
6853    {
6854        use std::iter::Iterator;
6855        self.request_policies = v.into_iter().map(|i| i.into()).collect();
6856        self
6857    }
6858}
6859
6860impl wkt::message::Message for MethodPolicy {
6861    fn typename() -> &'static str {
6862        "type.googleapis.com/google.api.MethodPolicy"
6863    }
6864}
6865
6866/// Quota configuration helps to achieve fairness and budgeting in service
6867/// usage.
6868///
6869/// The metric based quota configuration works this way:
6870///
6871/// - The service configuration defines a set of metrics.
6872/// - For API calls, the quota.metric_rules maps methods to metrics with
6873///   corresponding costs.
6874/// - The quota.limits defines limits on the metrics, which will be used for
6875///   quota checks at runtime.
6876///
6877/// An example quota configuration in yaml format:
6878///
6879/// quota:
6880/// limits:
6881///
6882/// ```norust
6883///  - name: apiWriteQpsPerProject
6884///    metric: library.googleapis.com/write_calls
6885///    unit: "1/min/{project}"  # rate limit for consumer projects
6886///    values:
6887///      STANDARD: 10000
6888///
6889///
6890///  (The metric rules bind all methods to the read_calls metric,
6891///   except for the UpdateBook and DeleteBook methods. These two methods
6892///   are mapped to the write_calls metric, with the UpdateBook method
6893///   consuming at twice rate as the DeleteBook method.)
6894///  metric_rules:
6895///  - selector: "*"
6896///    metric_costs:
6897///      library.googleapis.com/read_calls: 1
6898///  - selector: google.example.library.v1.LibraryService.UpdateBook
6899///    metric_costs:
6900///      library.googleapis.com/write_calls: 2
6901///  - selector: google.example.library.v1.LibraryService.DeleteBook
6902///    metric_costs:
6903///      library.googleapis.com/write_calls: 1
6904/// ```
6905///
6906/// Corresponding Metric definition:
6907///
6908/// ```norust
6909///  metrics:
6910///  - name: library.googleapis.com/read_calls
6911///    display_name: Read requests
6912///    metric_kind: DELTA
6913///    value_type: INT64
6914///
6915///  - name: library.googleapis.com/write_calls
6916///    display_name: Write requests
6917///    metric_kind: DELTA
6918///    value_type: INT64
6919/// ```
6920#[derive(Clone, Default, PartialEq)]
6921#[non_exhaustive]
6922pub struct Quota {
6923    /// List of QuotaLimit definitions for the service.
6924    pub limits: std::vec::Vec<crate::model::QuotaLimit>,
6925
6926    /// List of MetricRule definitions, each one mapping a selected method to one
6927    /// or more metrics.
6928    pub metric_rules: std::vec::Vec<crate::model::MetricRule>,
6929
6930    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6931}
6932
6933impl Quota {
6934    pub fn new() -> Self {
6935        std::default::Default::default()
6936    }
6937
6938    /// Sets the value of [limits][crate::model::Quota::limits].
6939    pub fn set_limits<T, V>(mut self, v: T) -> Self
6940    where
6941        T: std::iter::IntoIterator<Item = V>,
6942        V: std::convert::Into<crate::model::QuotaLimit>,
6943    {
6944        use std::iter::Iterator;
6945        self.limits = v.into_iter().map(|i| i.into()).collect();
6946        self
6947    }
6948
6949    /// Sets the value of [metric_rules][crate::model::Quota::metric_rules].
6950    pub fn set_metric_rules<T, V>(mut self, v: T) -> Self
6951    where
6952        T: std::iter::IntoIterator<Item = V>,
6953        V: std::convert::Into<crate::model::MetricRule>,
6954    {
6955        use std::iter::Iterator;
6956        self.metric_rules = v.into_iter().map(|i| i.into()).collect();
6957        self
6958    }
6959}
6960
6961impl wkt::message::Message for Quota {
6962    fn typename() -> &'static str {
6963        "type.googleapis.com/google.api.Quota"
6964    }
6965}
6966
6967/// Bind API methods to metrics. Binding a method to a metric causes that
6968/// metric's configured quota behaviors to apply to the method call.
6969#[derive(Clone, Default, PartialEq)]
6970#[non_exhaustive]
6971pub struct MetricRule {
6972    /// Selects the methods to which this rule applies.
6973    ///
6974    /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
6975    /// details.
6976    ///
6977    /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
6978    pub selector: std::string::String,
6979
6980    /// Metrics to update when the selected methods are called, and the associated
6981    /// cost applied to each metric.
6982    ///
6983    /// The key of the map is the metric name, and the values are the amount
6984    /// increased for the metric against which the quota limits are defined.
6985    /// The value must not be negative.
6986    pub metric_costs: std::collections::HashMap<std::string::String, i64>,
6987
6988    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6989}
6990
6991impl MetricRule {
6992    pub fn new() -> Self {
6993        std::default::Default::default()
6994    }
6995
6996    /// Sets the value of [selector][crate::model::MetricRule::selector].
6997    pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6998        self.selector = v.into();
6999        self
7000    }
7001
7002    /// Sets the value of [metric_costs][crate::model::MetricRule::metric_costs].
7003    pub fn set_metric_costs<T, K, V>(mut self, v: T) -> Self
7004    where
7005        T: std::iter::IntoIterator<Item = (K, V)>,
7006        K: std::convert::Into<std::string::String>,
7007        V: std::convert::Into<i64>,
7008    {
7009        use std::iter::Iterator;
7010        self.metric_costs = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7011        self
7012    }
7013}
7014
7015impl wkt::message::Message for MetricRule {
7016    fn typename() -> &'static str {
7017        "type.googleapis.com/google.api.MetricRule"
7018    }
7019}
7020
7021/// `QuotaLimit` defines a specific limit that applies over a specified duration
7022/// for a limit type. There can be at most one limit for a duration and limit
7023/// type combination defined within a `QuotaGroup`.
7024#[derive(Clone, Default, PartialEq)]
7025#[non_exhaustive]
7026pub struct QuotaLimit {
7027    /// Name of the quota limit.
7028    ///
7029    /// The name must be provided, and it must be unique within the service. The
7030    /// name can only include alphanumeric characters as well as '-'.
7031    ///
7032    /// The maximum length of the limit name is 64 characters.
7033    pub name: std::string::String,
7034
7035    /// Optional. User-visible, extended description for this quota limit.
7036    /// Should be used only when more context is needed to understand this limit
7037    /// than provided by the limit's display name (see: `display_name`).
7038    pub description: std::string::String,
7039
7040    /// Default number of tokens that can be consumed during the specified
7041    /// duration. This is the number of tokens assigned when a client
7042    /// application developer activates the service for his/her project.
7043    ///
7044    /// Specifying a value of 0 will block all requests. This can be used if you
7045    /// are provisioning quota to selected consumers and blocking others.
7046    /// Similarly, a value of -1 will indicate an unlimited quota. No other
7047    /// negative values are allowed.
7048    ///
7049    /// Used by group-based quotas only.
7050    pub default_limit: i64,
7051
7052    /// Maximum number of tokens that can be consumed during the specified
7053    /// duration. Client application developers can override the default limit up
7054    /// to this maximum. If specified, this value cannot be set to a value less
7055    /// than the default limit. If not specified, it is set to the default limit.
7056    ///
7057    /// To allow clients to apply overrides with no upper bound, set this to -1,
7058    /// indicating unlimited maximum quota.
7059    ///
7060    /// Used by group-based quotas only.
7061    pub max_limit: i64,
7062
7063    /// Free tier value displayed in the Developers Console for this limit.
7064    /// The free tier is the number of tokens that will be subtracted from the
7065    /// billed amount when billing is enabled.
7066    /// This field can only be set on a limit with duration "1d", in a billable
7067    /// group; it is invalid on any other limit. If this field is not set, it
7068    /// defaults to 0, indicating that there is no free tier for this service.
7069    ///
7070    /// Used by group-based quotas only.
7071    pub free_tier: i64,
7072
7073    /// Duration of this limit in textual notation. Must be "100s" or "1d".
7074    ///
7075    /// Used by group-based quotas only.
7076    pub duration: std::string::String,
7077
7078    /// The name of the metric this quota limit applies to. The quota limits with
7079    /// the same metric will be checked together during runtime. The metric must be
7080    /// defined within the service config.
7081    pub metric: std::string::String,
7082
7083    /// Specify the unit of the quota limit. It uses the same syntax as
7084    /// [MetricDescriptor.unit][google.api.MetricDescriptor.unit]. The supported
7085    /// unit kinds are determined by the quota backend system.
7086    ///
7087    /// Here are some examples:
7088    ///
7089    /// * "1/min/{project}" for quota per minute per project.
7090    ///
7091    /// Note: the order of unit components is insignificant.
7092    /// The "1" at the beginning is required to follow the metric unit syntax.
7093    ///
7094    /// [google.api.MetricDescriptor.unit]: crate::model::MetricDescriptor::unit
7095    pub unit: std::string::String,
7096
7097    /// Tiered limit values. You must specify this as a key:value pair, with an
7098    /// integer value that is the maximum number of requests allowed for the
7099    /// specified unit. Currently only STANDARD is supported.
7100    pub values: std::collections::HashMap<std::string::String, i64>,
7101
7102    /// User-visible display name for this limit.
7103    /// Optional. If not set, the UI will provide a default display name based on
7104    /// the quota configuration. This field can be used to override the default
7105    /// display name generated from the configuration.
7106    pub display_name: std::string::String,
7107
7108    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7109}
7110
7111impl QuotaLimit {
7112    pub fn new() -> Self {
7113        std::default::Default::default()
7114    }
7115
7116    /// Sets the value of [name][crate::model::QuotaLimit::name].
7117    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7118        self.name = v.into();
7119        self
7120    }
7121
7122    /// Sets the value of [description][crate::model::QuotaLimit::description].
7123    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7124        self.description = v.into();
7125        self
7126    }
7127
7128    /// Sets the value of [default_limit][crate::model::QuotaLimit::default_limit].
7129    pub fn set_default_limit<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
7130        self.default_limit = v.into();
7131        self
7132    }
7133
7134    /// Sets the value of [max_limit][crate::model::QuotaLimit::max_limit].
7135    pub fn set_max_limit<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
7136        self.max_limit = v.into();
7137        self
7138    }
7139
7140    /// Sets the value of [free_tier][crate::model::QuotaLimit::free_tier].
7141    pub fn set_free_tier<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
7142        self.free_tier = v.into();
7143        self
7144    }
7145
7146    /// Sets the value of [duration][crate::model::QuotaLimit::duration].
7147    pub fn set_duration<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7148        self.duration = v.into();
7149        self
7150    }
7151
7152    /// Sets the value of [metric][crate::model::QuotaLimit::metric].
7153    pub fn set_metric<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7154        self.metric = v.into();
7155        self
7156    }
7157
7158    /// Sets the value of [unit][crate::model::QuotaLimit::unit].
7159    pub fn set_unit<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7160        self.unit = v.into();
7161        self
7162    }
7163
7164    /// Sets the value of [values][crate::model::QuotaLimit::values].
7165    pub fn set_values<T, K, V>(mut self, v: T) -> Self
7166    where
7167        T: std::iter::IntoIterator<Item = (K, V)>,
7168        K: std::convert::Into<std::string::String>,
7169        V: std::convert::Into<i64>,
7170    {
7171        use std::iter::Iterator;
7172        self.values = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7173        self
7174    }
7175
7176    /// Sets the value of [display_name][crate::model::QuotaLimit::display_name].
7177    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7178        self.display_name = v.into();
7179        self
7180    }
7181}
7182
7183impl wkt::message::Message for QuotaLimit {
7184    fn typename() -> &'static str {
7185        "type.googleapis.com/google.api.QuotaLimit"
7186    }
7187}
7188
7189/// A simple descriptor of a resource type.
7190///
7191/// ResourceDescriptor annotates a resource message (either by means of a
7192/// protobuf annotation or use in the service config), and associates the
7193/// resource's schema, the resource type, and the pattern of the resource name.
7194///
7195/// Example:
7196///
7197/// ```norust
7198/// message Topic {
7199///   // Indicates this message defines a resource schema.
7200///   // Declares the resource type in the format of {service}/{kind}.
7201///   // For Kubernetes resources, the format is {api group}/{kind}.
7202///   option (google.api.resource) = {
7203///     type: "pubsub.googleapis.com/Topic"
7204///     pattern: "projects/{project}/topics/{topic}"
7205///   };
7206/// }
7207/// ```
7208///
7209/// The ResourceDescriptor Yaml config will look like:
7210///
7211/// ```norust
7212/// resources:
7213/// - type: "pubsub.googleapis.com/Topic"
7214///   pattern: "projects/{project}/topics/{topic}"
7215/// ```
7216///
7217/// Sometimes, resources have multiple patterns, typically because they can
7218/// live under multiple parents.
7219///
7220/// Example:
7221///
7222/// ```norust
7223/// message LogEntry {
7224///   option (google.api.resource) = {
7225///     type: "logging.googleapis.com/LogEntry"
7226///     pattern: "projects/{project}/logs/{log}"
7227///     pattern: "folders/{folder}/logs/{log}"
7228///     pattern: "organizations/{organization}/logs/{log}"
7229///     pattern: "billingAccounts/{billing_account}/logs/{log}"
7230///   };
7231/// }
7232/// ```
7233///
7234/// The ResourceDescriptor Yaml config will look like:
7235///
7236/// ```norust
7237/// resources:
7238/// - type: 'logging.googleapis.com/LogEntry'
7239///   pattern: "projects/{project}/logs/{log}"
7240///   pattern: "folders/{folder}/logs/{log}"
7241///   pattern: "organizations/{organization}/logs/{log}"
7242///   pattern: "billingAccounts/{billing_account}/logs/{log}"
7243/// ```
7244#[derive(Clone, Default, PartialEq)]
7245#[non_exhaustive]
7246pub struct ResourceDescriptor {
7247    /// The resource type. It must be in the format of
7248    /// {service_name}/{resource_type_kind}. The `resource_type_kind` must be
7249    /// singular and must not include version numbers.
7250    ///
7251    /// Example: `storage.googleapis.com/Bucket`
7252    ///
7253    /// The value of the resource_type_kind must follow the regular expression
7254    /// /[A-Za-z][a-zA-Z0-9]+/. It should start with an upper case character and
7255    /// should use PascalCase (UpperCamelCase). The maximum number of
7256    /// characters allowed for the `resource_type_kind` is 100.
7257    pub r#type: std::string::String,
7258
7259    /// Optional. The relative resource name pattern associated with this resource
7260    /// type. The DNS prefix of the full resource name shouldn't be specified here.
7261    ///
7262    /// The path pattern must follow the syntax, which aligns with HTTP binding
7263    /// syntax:
7264    ///
7265    /// ```norust
7266    /// Template = Segment { "/" Segment } ;
7267    /// Segment = LITERAL | Variable ;
7268    /// Variable = "{" LITERAL "}" ;
7269    /// ```
7270    ///
7271    /// Examples:
7272    ///
7273    /// ```norust
7274    /// - "projects/{project}/topics/{topic}"
7275    /// - "projects/{project}/knowledgeBases/{knowledge_base}"
7276    /// ```
7277    ///
7278    /// The components in braces correspond to the IDs for each resource in the
7279    /// hierarchy. It is expected that, if multiple patterns are provided,
7280    /// the same component name (e.g. "project") refers to IDs of the same
7281    /// type of resource.
7282    pub pattern: std::vec::Vec<std::string::String>,
7283
7284    /// Optional. The field on the resource that designates the resource name
7285    /// field. If omitted, this is assumed to be "name".
7286    pub name_field: std::string::String,
7287
7288    /// Optional. The historical or future-looking state of the resource pattern.
7289    ///
7290    /// Example:
7291    ///
7292    /// ```norust
7293    /// // The InspectTemplate message originally only supported resource
7294    /// // names with organization, and project was added later.
7295    /// message InspectTemplate {
7296    ///   option (google.api.resource) = {
7297    ///     type: "dlp.googleapis.com/InspectTemplate"
7298    ///     pattern:
7299    ///     "organizations/{organization}/inspectTemplates/{inspect_template}"
7300    ///     pattern: "projects/{project}/inspectTemplates/{inspect_template}"
7301    ///     history: ORIGINALLY_SINGLE_PATTERN
7302    ///   };
7303    /// }
7304    /// ```
7305    pub history: crate::model::resource_descriptor::History,
7306
7307    /// The plural name used in the resource name and permission names, such as
7308    /// 'projects' for the resource name of 'projects/{project}' and the permission
7309    /// name of 'cloudresourcemanager.googleapis.com/projects.get'. One exception
7310    /// to this is for Nested Collections that have stuttering names, as defined
7311    /// in [AIP-122](https://google.aip.dev/122#nested-collections), where the
7312    /// collection ID in the resource name pattern does not necessarily directly
7313    /// match the `plural` value.
7314    ///
7315    /// It is the same concept of the `plural` field in k8s CRD spec
7316    /// <https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/>
7317    ///
7318    /// Note: The plural form is required even for singleton resources. See
7319    /// <https://aip.dev/156>
7320    pub plural: std::string::String,
7321
7322    /// The same concept of the `singular` field in k8s CRD spec
7323    /// <https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/>
7324    /// Such as "project" for the `resourcemanager.googleapis.com/Project` type.
7325    pub singular: std::string::String,
7326
7327    /// Style flag(s) for this resource.
7328    /// These indicate that a resource is expected to conform to a given
7329    /// style. See the specific style flags for additional information.
7330    pub style: std::vec::Vec<crate::model::resource_descriptor::Style>,
7331
7332    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7333}
7334
7335impl ResourceDescriptor {
7336    pub fn new() -> Self {
7337        std::default::Default::default()
7338    }
7339
7340    /// Sets the value of [r#type][crate::model::ResourceDescriptor::type].
7341    pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7342        self.r#type = v.into();
7343        self
7344    }
7345
7346    /// Sets the value of [pattern][crate::model::ResourceDescriptor::pattern].
7347    pub fn set_pattern<T, V>(mut self, v: T) -> Self
7348    where
7349        T: std::iter::IntoIterator<Item = V>,
7350        V: std::convert::Into<std::string::String>,
7351    {
7352        use std::iter::Iterator;
7353        self.pattern = v.into_iter().map(|i| i.into()).collect();
7354        self
7355    }
7356
7357    /// Sets the value of [name_field][crate::model::ResourceDescriptor::name_field].
7358    pub fn set_name_field<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7359        self.name_field = v.into();
7360        self
7361    }
7362
7363    /// Sets the value of [history][crate::model::ResourceDescriptor::history].
7364    pub fn set_history<T: std::convert::Into<crate::model::resource_descriptor::History>>(
7365        mut self,
7366        v: T,
7367    ) -> Self {
7368        self.history = v.into();
7369        self
7370    }
7371
7372    /// Sets the value of [plural][crate::model::ResourceDescriptor::plural].
7373    pub fn set_plural<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7374        self.plural = v.into();
7375        self
7376    }
7377
7378    /// Sets the value of [singular][crate::model::ResourceDescriptor::singular].
7379    pub fn set_singular<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7380        self.singular = v.into();
7381        self
7382    }
7383
7384    /// Sets the value of [style][crate::model::ResourceDescriptor::style].
7385    pub fn set_style<T, V>(mut self, v: T) -> Self
7386    where
7387        T: std::iter::IntoIterator<Item = V>,
7388        V: std::convert::Into<crate::model::resource_descriptor::Style>,
7389    {
7390        use std::iter::Iterator;
7391        self.style = v.into_iter().map(|i| i.into()).collect();
7392        self
7393    }
7394}
7395
7396impl wkt::message::Message for ResourceDescriptor {
7397    fn typename() -> &'static str {
7398        "type.googleapis.com/google.api.ResourceDescriptor"
7399    }
7400}
7401
7402/// Defines additional types related to [ResourceDescriptor].
7403pub mod resource_descriptor {
7404    #[allow(unused_imports)]
7405    use super::*;
7406
7407    /// A description of the historical or future-looking state of the
7408    /// resource pattern.
7409    ///
7410    /// # Working with unknown values
7411    ///
7412    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7413    /// additional enum variants at any time. Adding new variants is not considered
7414    /// a breaking change. Applications should write their code in anticipation of:
7415    ///
7416    /// - New values appearing in future releases of the client library, **and**
7417    /// - New values received dynamically, without application changes.
7418    ///
7419    /// Please consult the [Working with enums] section in the user guide for some
7420    /// guidelines.
7421    ///
7422    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
7423    #[derive(Clone, Debug, PartialEq)]
7424    #[non_exhaustive]
7425    pub enum History {
7426        /// The "unset" value.
7427        Unspecified,
7428        /// The resource originally had one pattern and launched as such, and
7429        /// additional patterns were added later.
7430        OriginallySinglePattern,
7431        /// The resource has one pattern, but the API owner expects to add more
7432        /// later. (This is the inverse of ORIGINALLY_SINGLE_PATTERN, and prevents
7433        /// that from being necessary once there are multiple patterns.)
7434        FutureMultiPattern,
7435        /// If set, the enum was initialized with an unknown value.
7436        ///
7437        /// Applications can examine the value using [History::value] or
7438        /// [History::name].
7439        UnknownValue(history::UnknownValue),
7440    }
7441
7442    #[doc(hidden)]
7443    pub mod history {
7444        #[allow(unused_imports)]
7445        use super::*;
7446        #[derive(Clone, Debug, PartialEq)]
7447        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7448    }
7449
7450    impl History {
7451        /// Gets the enum value.
7452        ///
7453        /// Returns `None` if the enum contains an unknown value deserialized from
7454        /// the string representation of enums.
7455        pub fn value(&self) -> std::option::Option<i32> {
7456            match self {
7457                Self::Unspecified => std::option::Option::Some(0),
7458                Self::OriginallySinglePattern => std::option::Option::Some(1),
7459                Self::FutureMultiPattern => std::option::Option::Some(2),
7460                Self::UnknownValue(u) => u.0.value(),
7461            }
7462        }
7463
7464        /// Gets the enum value as a string.
7465        ///
7466        /// Returns `None` if the enum contains an unknown value deserialized from
7467        /// the integer representation of enums.
7468        pub fn name(&self) -> std::option::Option<&str> {
7469            match self {
7470                Self::Unspecified => std::option::Option::Some("HISTORY_UNSPECIFIED"),
7471                Self::OriginallySinglePattern => {
7472                    std::option::Option::Some("ORIGINALLY_SINGLE_PATTERN")
7473                }
7474                Self::FutureMultiPattern => std::option::Option::Some("FUTURE_MULTI_PATTERN"),
7475                Self::UnknownValue(u) => u.0.name(),
7476            }
7477        }
7478    }
7479
7480    impl std::default::Default for History {
7481        fn default() -> Self {
7482            use std::convert::From;
7483            Self::from(0)
7484        }
7485    }
7486
7487    impl std::fmt::Display for History {
7488        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7489            wkt::internal::display_enum(f, self.name(), self.value())
7490        }
7491    }
7492
7493    impl std::convert::From<i32> for History {
7494        fn from(value: i32) -> Self {
7495            match value {
7496                0 => Self::Unspecified,
7497                1 => Self::OriginallySinglePattern,
7498                2 => Self::FutureMultiPattern,
7499                _ => Self::UnknownValue(history::UnknownValue(
7500                    wkt::internal::UnknownEnumValue::Integer(value),
7501                )),
7502            }
7503        }
7504    }
7505
7506    impl std::convert::From<&str> for History {
7507        fn from(value: &str) -> Self {
7508            use std::string::ToString;
7509            match value {
7510                "HISTORY_UNSPECIFIED" => Self::Unspecified,
7511                "ORIGINALLY_SINGLE_PATTERN" => Self::OriginallySinglePattern,
7512                "FUTURE_MULTI_PATTERN" => Self::FutureMultiPattern,
7513                _ => Self::UnknownValue(history::UnknownValue(
7514                    wkt::internal::UnknownEnumValue::String(value.to_string()),
7515                )),
7516            }
7517        }
7518    }
7519
7520    impl serde::ser::Serialize for History {
7521        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7522        where
7523            S: serde::Serializer,
7524        {
7525            match self {
7526                Self::Unspecified => serializer.serialize_i32(0),
7527                Self::OriginallySinglePattern => serializer.serialize_i32(1),
7528                Self::FutureMultiPattern => serializer.serialize_i32(2),
7529                Self::UnknownValue(u) => u.0.serialize(serializer),
7530            }
7531        }
7532    }
7533
7534    impl<'de> serde::de::Deserialize<'de> for History {
7535        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7536        where
7537            D: serde::Deserializer<'de>,
7538        {
7539            deserializer.deserialize_any(wkt::internal::EnumVisitor::<History>::new(
7540                ".google.api.ResourceDescriptor.History",
7541            ))
7542        }
7543    }
7544
7545    /// A flag representing a specific style that a resource claims to conform to.
7546    ///
7547    /// # Working with unknown values
7548    ///
7549    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7550    /// additional enum variants at any time. Adding new variants is not considered
7551    /// a breaking change. Applications should write their code in anticipation of:
7552    ///
7553    /// - New values appearing in future releases of the client library, **and**
7554    /// - New values received dynamically, without application changes.
7555    ///
7556    /// Please consult the [Working with enums] section in the user guide for some
7557    /// guidelines.
7558    ///
7559    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
7560    #[derive(Clone, Debug, PartialEq)]
7561    #[non_exhaustive]
7562    pub enum Style {
7563        /// The unspecified value. Do not use.
7564        Unspecified,
7565        /// This resource is intended to be "declarative-friendly".
7566        ///
7567        /// Declarative-friendly resources must be more strictly consistent, and
7568        /// setting this to true communicates to tools that this resource should
7569        /// adhere to declarative-friendly expectations.
7570        ///
7571        /// Note: This is used by the API linter (linter.aip.dev) to enable
7572        /// additional checks.
7573        DeclarativeFriendly,
7574        /// If set, the enum was initialized with an unknown value.
7575        ///
7576        /// Applications can examine the value using [Style::value] or
7577        /// [Style::name].
7578        UnknownValue(style::UnknownValue),
7579    }
7580
7581    #[doc(hidden)]
7582    pub mod style {
7583        #[allow(unused_imports)]
7584        use super::*;
7585        #[derive(Clone, Debug, PartialEq)]
7586        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7587    }
7588
7589    impl Style {
7590        /// Gets the enum value.
7591        ///
7592        /// Returns `None` if the enum contains an unknown value deserialized from
7593        /// the string representation of enums.
7594        pub fn value(&self) -> std::option::Option<i32> {
7595            match self {
7596                Self::Unspecified => std::option::Option::Some(0),
7597                Self::DeclarativeFriendly => std::option::Option::Some(1),
7598                Self::UnknownValue(u) => u.0.value(),
7599            }
7600        }
7601
7602        /// Gets the enum value as a string.
7603        ///
7604        /// Returns `None` if the enum contains an unknown value deserialized from
7605        /// the integer representation of enums.
7606        pub fn name(&self) -> std::option::Option<&str> {
7607            match self {
7608                Self::Unspecified => std::option::Option::Some("STYLE_UNSPECIFIED"),
7609                Self::DeclarativeFriendly => std::option::Option::Some("DECLARATIVE_FRIENDLY"),
7610                Self::UnknownValue(u) => u.0.name(),
7611            }
7612        }
7613    }
7614
7615    impl std::default::Default for Style {
7616        fn default() -> Self {
7617            use std::convert::From;
7618            Self::from(0)
7619        }
7620    }
7621
7622    impl std::fmt::Display for Style {
7623        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7624            wkt::internal::display_enum(f, self.name(), self.value())
7625        }
7626    }
7627
7628    impl std::convert::From<i32> for Style {
7629        fn from(value: i32) -> Self {
7630            match value {
7631                0 => Self::Unspecified,
7632                1 => Self::DeclarativeFriendly,
7633                _ => Self::UnknownValue(style::UnknownValue(
7634                    wkt::internal::UnknownEnumValue::Integer(value),
7635                )),
7636            }
7637        }
7638    }
7639
7640    impl std::convert::From<&str> for Style {
7641        fn from(value: &str) -> Self {
7642            use std::string::ToString;
7643            match value {
7644                "STYLE_UNSPECIFIED" => Self::Unspecified,
7645                "DECLARATIVE_FRIENDLY" => Self::DeclarativeFriendly,
7646                _ => Self::UnknownValue(style::UnknownValue(
7647                    wkt::internal::UnknownEnumValue::String(value.to_string()),
7648                )),
7649            }
7650        }
7651    }
7652
7653    impl serde::ser::Serialize for Style {
7654        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7655        where
7656            S: serde::Serializer,
7657        {
7658            match self {
7659                Self::Unspecified => serializer.serialize_i32(0),
7660                Self::DeclarativeFriendly => serializer.serialize_i32(1),
7661                Self::UnknownValue(u) => u.0.serialize(serializer),
7662            }
7663        }
7664    }
7665
7666    impl<'de> serde::de::Deserialize<'de> for Style {
7667        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7668        where
7669            D: serde::Deserializer<'de>,
7670        {
7671            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Style>::new(
7672                ".google.api.ResourceDescriptor.Style",
7673            ))
7674        }
7675    }
7676}
7677
7678/// Defines a proto annotation that describes a string field that refers to
7679/// an API resource.
7680#[derive(Clone, Default, PartialEq)]
7681#[non_exhaustive]
7682pub struct ResourceReference {
7683    /// The resource type that the annotated field references.
7684    ///
7685    /// Example:
7686    ///
7687    /// ```norust
7688    /// message Subscription {
7689    ///   string topic = 2 [(google.api.resource_reference) = {
7690    ///     type: "pubsub.googleapis.com/Topic"
7691    ///   }];
7692    /// }
7693    /// ```
7694    ///
7695    /// Occasionally, a field may reference an arbitrary resource. In this case,
7696    /// APIs use the special value * in their resource reference.
7697    ///
7698    /// Example:
7699    ///
7700    /// ```norust
7701    /// message GetIamPolicyRequest {
7702    ///   string resource = 2 [(google.api.resource_reference) = {
7703    ///     type: "*"
7704    ///   }];
7705    /// }
7706    /// ```
7707    pub r#type: std::string::String,
7708
7709    /// The resource type of a child collection that the annotated field
7710    /// references. This is useful for annotating the `parent` field that
7711    /// doesn't have a fixed resource type.
7712    ///
7713    /// Example:
7714    ///
7715    /// ```norust
7716    /// message ListLogEntriesRequest {
7717    ///   string parent = 1 [(google.api.resource_reference) = {
7718    ///     child_type: "logging.googleapis.com/LogEntry"
7719    ///   };
7720    /// }
7721    /// ```
7722    pub child_type: std::string::String,
7723
7724    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7725}
7726
7727impl ResourceReference {
7728    pub fn new() -> Self {
7729        std::default::Default::default()
7730    }
7731
7732    /// Sets the value of [r#type][crate::model::ResourceReference::type].
7733    pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7734        self.r#type = v.into();
7735        self
7736    }
7737
7738    /// Sets the value of [child_type][crate::model::ResourceReference::child_type].
7739    pub fn set_child_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7740        self.child_type = v.into();
7741        self
7742    }
7743}
7744
7745impl wkt::message::Message for ResourceReference {
7746    fn typename() -> &'static str {
7747        "type.googleapis.com/google.api.ResourceReference"
7748    }
7749}
7750
7751/// Specifies the routing information that should be sent along with the request
7752/// in the form of routing header.
7753/// **NOTE:** All service configuration rules follow the "last one wins" order.
7754///
7755/// The examples below will apply to an RPC which has the following request type:
7756///
7757/// Message Definition:
7758///
7759/// ```norust
7760/// message Request {
7761///   // The name of the Table
7762///   // Values can be of the following formats:
7763///   // - `projects/<project>/tables/<table>`
7764///   // - `projects/<project>/instances/<instance>/tables/<table>`
7765///   // - `region/<region>/zones/<zone>/tables/<table>`
7766///   string table_name = 1;
7767///
7768///   // This value specifies routing for replication.
7769///   // It can be in the following formats:
7770///   // - `profiles/<profile_id>`
7771///   // - a legacy `profile_id` that can be any string
7772///   string app_profile_id = 2;
7773/// }
7774/// ```
7775///
7776/// Example message:
7777///
7778/// ```norust
7779/// {
7780///   table_name: projects/proj_foo/instances/instance_bar/table/table_baz,
7781///   app_profile_id: profiles/prof_qux
7782/// }
7783/// ```
7784///
7785/// The routing header consists of one or multiple key-value pairs. Every key
7786/// and value must be percent-encoded, and joined together in the format of
7787/// `key1=value1&key2=value2`.
7788/// The examples below skip the percent-encoding for readability.
7789///
7790/// Example 1
7791///
7792/// Extracting a field from the request to put into the routing header
7793/// unchanged, with the key equal to the field name.
7794///
7795/// annotation:
7796///
7797/// ```norust
7798/// option (google.api.routing) = {
7799///   // Take the `app_profile_id`.
7800///   routing_parameters {
7801///     field: "app_profile_id"
7802///   }
7803/// };
7804/// ```
7805///
7806/// result:
7807///
7808/// ```norust
7809/// x-goog-request-params: app_profile_id=profiles/prof_qux
7810/// ```
7811///
7812/// Example 2
7813///
7814/// Extracting a field from the request to put into the routing header
7815/// unchanged, with the key different from the field name.
7816///
7817/// annotation:
7818///
7819/// ```norust
7820/// option (google.api.routing) = {
7821///   // Take the `app_profile_id`, but name it `routing_id` in the header.
7822///   routing_parameters {
7823///     field: "app_profile_id"
7824///     path_template: "{routing_id=**}"
7825///   }
7826/// };
7827/// ```
7828///
7829/// result:
7830///
7831/// ```norust
7832/// x-goog-request-params: routing_id=profiles/prof_qux
7833/// ```
7834///
7835/// Example 3
7836///
7837/// Extracting a field from the request to put into the routing
7838/// header, while matching a path template syntax on the field's value.
7839///
7840/// NB: it is more useful to send nothing than to send garbage for the purpose
7841/// of dynamic routing, since garbage pollutes cache. Thus the matching.
7842///
7843/// Sub-example 3a
7844///
7845/// The field matches the template.
7846///
7847/// annotation:
7848///
7849/// ```norust
7850/// option (google.api.routing) = {
7851///   // Take the `table_name`, if it's well-formed (with project-based
7852///   // syntax).
7853///   routing_parameters {
7854///     field: "table_name"
7855///     path_template: "{table_name=projects/*/instances/*/**}"
7856///   }
7857/// };
7858/// ```
7859///
7860/// result:
7861///
7862/// ```norust
7863/// x-goog-request-params:
7864/// table_name=projects/proj_foo/instances/instance_bar/table/table_baz
7865/// ```
7866///
7867/// Sub-example 3b
7868///
7869/// The field does not match the template.
7870///
7871/// annotation:
7872///
7873/// ```norust
7874/// option (google.api.routing) = {
7875///   // Take the `table_name`, if it's well-formed (with region-based
7876///   // syntax).
7877///   routing_parameters {
7878///     field: "table_name"
7879///     path_template: "{table_name=regions/*/zones/*/**}"
7880///   }
7881/// };
7882/// ```
7883///
7884/// result:
7885///
7886/// ```norust
7887/// <no routing header will be sent>
7888/// ```
7889///
7890/// Sub-example 3c
7891///
7892/// Multiple alternative conflictingly named path templates are
7893/// specified. The one that matches is used to construct the header.
7894///
7895/// annotation:
7896///
7897/// ```norust
7898/// option (google.api.routing) = {
7899///   // Take the `table_name`, if it's well-formed, whether
7900///   // using the region- or projects-based syntax.
7901///
7902///   routing_parameters {
7903///     field: "table_name"
7904///     path_template: "{table_name=regions/*/zones/*/**}"
7905///   }
7906///   routing_parameters {
7907///     field: "table_name"
7908///     path_template: "{table_name=projects/*/instances/*/**}"
7909///   }
7910/// };
7911/// ```
7912///
7913/// result:
7914///
7915/// ```norust
7916/// x-goog-request-params:
7917/// table_name=projects/proj_foo/instances/instance_bar/table/table_baz
7918/// ```
7919///
7920/// Example 4
7921///
7922/// Extracting a single routing header key-value pair by matching a
7923/// template syntax on (a part of) a single request field.
7924///
7925/// annotation:
7926///
7927/// ```norust
7928/// option (google.api.routing) = {
7929///   // Take just the project id from the `table_name` field.
7930///   routing_parameters {
7931///     field: "table_name"
7932///     path_template: "{routing_id=projects/*}/**"
7933///   }
7934/// };
7935/// ```
7936///
7937/// result:
7938///
7939/// ```norust
7940/// x-goog-request-params: routing_id=projects/proj_foo
7941/// ```
7942///
7943/// Example 5
7944///
7945/// Extracting a single routing header key-value pair by matching
7946/// several conflictingly named path templates on (parts of) a single request
7947/// field. The last template to match "wins" the conflict.
7948///
7949/// annotation:
7950///
7951/// ```norust
7952/// option (google.api.routing) = {
7953///   // If the `table_name` does not have instances information,
7954///   // take just the project id for routing.
7955///   // Otherwise take project + instance.
7956///
7957///   routing_parameters {
7958///     field: "table_name"
7959///     path_template: "{routing_id=projects/*}/**"
7960///   }
7961///   routing_parameters {
7962///     field: "table_name"
7963///     path_template: "{routing_id=projects/*/instances/*}/**"
7964///   }
7965/// };
7966/// ```
7967///
7968/// result:
7969///
7970/// ```norust
7971/// x-goog-request-params:
7972/// routing_id=projects/proj_foo/instances/instance_bar
7973/// ```
7974///
7975/// Example 6
7976///
7977/// Extracting multiple routing header key-value pairs by matching
7978/// several non-conflicting path templates on (parts of) a single request field.
7979///
7980/// Sub-example 6a
7981///
7982/// Make the templates strict, so that if the `table_name` does not
7983/// have an instance information, nothing is sent.
7984///
7985/// annotation:
7986///
7987/// ```norust
7988/// option (google.api.routing) = {
7989///   // The routing code needs two keys instead of one composite
7990///   // but works only for the tables with the "project-instance" name
7991///   // syntax.
7992///
7993///   routing_parameters {
7994///     field: "table_name"
7995///     path_template: "{project_id=projects/*}/instances/*/**"
7996///   }
7997///   routing_parameters {
7998///     field: "table_name"
7999///     path_template: "projects/*/{instance_id=instances/*}/**"
8000///   }
8001/// };
8002/// ```
8003///
8004/// result:
8005///
8006/// ```norust
8007/// x-goog-request-params:
8008/// project_id=projects/proj_foo&instance_id=instances/instance_bar
8009/// ```
8010///
8011/// Sub-example 6b
8012///
8013/// Make the templates loose, so that if the `table_name` does not
8014/// have an instance information, just the project id part is sent.
8015///
8016/// annotation:
8017///
8018/// ```norust
8019/// option (google.api.routing) = {
8020///   // The routing code wants two keys instead of one composite
8021///   // but will work with just the `project_id` for tables without
8022///   // an instance in the `table_name`.
8023///
8024///   routing_parameters {
8025///     field: "table_name"
8026///     path_template: "{project_id=projects/*}/**"
8027///   }
8028///   routing_parameters {
8029///     field: "table_name"
8030///     path_template: "projects/*/{instance_id=instances/*}/**"
8031///   }
8032/// };
8033/// ```
8034///
8035/// result (is the same as 6a for our example message because it has the instance
8036/// information):
8037///
8038/// ```norust
8039/// x-goog-request-params:
8040/// project_id=projects/proj_foo&instance_id=instances/instance_bar
8041/// ```
8042///
8043/// Example 7
8044///
8045/// Extracting multiple routing header key-value pairs by matching
8046/// several path templates on multiple request fields.
8047///
8048/// NB: note that here there is no way to specify sending nothing if one of the
8049/// fields does not match its template. E.g. if the `table_name` is in the wrong
8050/// format, the `project_id` will not be sent, but the `routing_id` will be.
8051/// The backend routing code has to be aware of that and be prepared to not
8052/// receive a full complement of keys if it expects multiple.
8053///
8054/// annotation:
8055///
8056/// ```norust
8057/// option (google.api.routing) = {
8058///   // The routing needs both `project_id` and `routing_id`
8059///   // (from the `app_profile_id` field) for routing.
8060///
8061///   routing_parameters {
8062///     field: "table_name"
8063///     path_template: "{project_id=projects/*}/**"
8064///   }
8065///   routing_parameters {
8066///     field: "app_profile_id"
8067///     path_template: "{routing_id=**}"
8068///   }
8069/// };
8070/// ```
8071///
8072/// result:
8073///
8074/// ```norust
8075/// x-goog-request-params:
8076/// project_id=projects/proj_foo&routing_id=profiles/prof_qux
8077/// ```
8078///
8079/// Example 8
8080///
8081/// Extracting a single routing header key-value pair by matching
8082/// several conflictingly named path templates on several request fields. The
8083/// last template to match "wins" the conflict.
8084///
8085/// annotation:
8086///
8087/// ```norust
8088/// option (google.api.routing) = {
8089///   // The `routing_id` can be a project id or a region id depending on
8090///   // the table name format, but only if the `app_profile_id` is not set.
8091///   // If `app_profile_id` is set it should be used instead.
8092///
8093///   routing_parameters {
8094///     field: "table_name"
8095///     path_template: "{routing_id=projects/*}/**"
8096///   }
8097///   routing_parameters {
8098///      field: "table_name"
8099///      path_template: "{routing_id=regions/*}/**"
8100///   }
8101///   routing_parameters {
8102///     field: "app_profile_id"
8103///     path_template: "{routing_id=**}"
8104///   }
8105/// };
8106/// ```
8107///
8108/// result:
8109///
8110/// ```norust
8111/// x-goog-request-params: routing_id=profiles/prof_qux
8112/// ```
8113///
8114/// Example 9
8115///
8116/// Bringing it all together.
8117///
8118/// annotation:
8119///
8120/// ```norust
8121/// option (google.api.routing) = {
8122///   // For routing both `table_location` and a `routing_id` are needed.
8123///   //
8124///   // table_location can be either an instance id or a region+zone id.
8125///   //
8126///   // For `routing_id`, take the value of `app_profile_id`
8127///   // - If it's in the format `profiles/<profile_id>`, send
8128///   // just the `<profile_id>` part.
8129///   // - If it's any other literal, send it as is.
8130///   // If the `app_profile_id` is empty, and the `table_name` starts with
8131///   // the project_id, send that instead.
8132///
8133///   routing_parameters {
8134///     field: "table_name"
8135///     path_template: "projects/*/{table_location=instances/*}/tables/*"
8136///   }
8137///   routing_parameters {
8138///     field: "table_name"
8139///     path_template: "{table_location=regions/*/zones/*}/tables/*"
8140///   }
8141///   routing_parameters {
8142///     field: "table_name"
8143///     path_template: "{routing_id=projects/*}/**"
8144///   }
8145///   routing_parameters {
8146///     field: "app_profile_id"
8147///     path_template: "{routing_id=**}"
8148///   }
8149///   routing_parameters {
8150///     field: "app_profile_id"
8151///     path_template: "profiles/{routing_id=*}"
8152///   }
8153/// };
8154/// ```
8155///
8156/// result:
8157///
8158/// ```norust
8159/// x-goog-request-params:
8160/// table_location=instances/instance_bar&routing_id=prof_qux
8161/// ```
8162#[derive(Clone, Default, PartialEq)]
8163#[non_exhaustive]
8164pub struct RoutingRule {
8165    /// A collection of Routing Parameter specifications.
8166    /// **NOTE:** If multiple Routing Parameters describe the same key
8167    /// (via the `path_template` field or via the `field` field when
8168    /// `path_template` is not provided), "last one wins" rule
8169    /// determines which Parameter gets used.
8170    /// See the examples for more details.
8171    pub routing_parameters: std::vec::Vec<crate::model::RoutingParameter>,
8172
8173    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8174}
8175
8176impl RoutingRule {
8177    pub fn new() -> Self {
8178        std::default::Default::default()
8179    }
8180
8181    /// Sets the value of [routing_parameters][crate::model::RoutingRule::routing_parameters].
8182    pub fn set_routing_parameters<T, V>(mut self, v: T) -> Self
8183    where
8184        T: std::iter::IntoIterator<Item = V>,
8185        V: std::convert::Into<crate::model::RoutingParameter>,
8186    {
8187        use std::iter::Iterator;
8188        self.routing_parameters = v.into_iter().map(|i| i.into()).collect();
8189        self
8190    }
8191}
8192
8193impl wkt::message::Message for RoutingRule {
8194    fn typename() -> &'static str {
8195        "type.googleapis.com/google.api.RoutingRule"
8196    }
8197}
8198
8199/// A projection from an input message to the GRPC or REST header.
8200#[derive(Clone, Default, PartialEq)]
8201#[non_exhaustive]
8202pub struct RoutingParameter {
8203    /// A request field to extract the header key-value pair from.
8204    pub field: std::string::String,
8205
8206    /// A pattern matching the key-value field. Optional.
8207    /// If not specified, the whole field specified in the `field` field will be
8208    /// taken as value, and its name used as key. If specified, it MUST contain
8209    /// exactly one named segment (along with any number of unnamed segments) The
8210    /// pattern will be matched over the field specified in the `field` field, then
8211    /// if the match is successful:
8212    ///
8213    /// - the name of the single named segment will be used as a header name,
8214    /// - the match value of the segment will be used as a header value;
8215    ///   if the match is NOT successful, nothing will be sent.
8216    ///
8217    /// Example:
8218    ///
8219    /// ```norust
8220    ///           -- This is a field in the request message
8221    ///          |   that the header value will be extracted from.
8222    ///          |
8223    ///          |                     -- This is the key name in the
8224    ///          |                    |   routing header.
8225    ///          V                    |
8226    /// field: "table_name"           v
8227    /// path_template: "projects/*/{table_location=instances/*}/tables/*"
8228    ///                                            ^            ^
8229    ///                                            |            |
8230    ///   In the {} brackets is the pattern that --             |
8231    ///   specifies what to extract from the                    |
8232    ///   field as a value to be sent.                          |
8233    ///                                                         |
8234    ///  The string in the field must match the whole pattern --
8235    ///  before brackets, inside brackets, after brackets.
8236    /// ```
8237    ///
8238    /// When looking at this specific example, we can see that:
8239    ///
8240    /// - A key-value pair with the key `table_location`
8241    ///   and the value matching `instances/*` should be added
8242    ///   to the x-goog-request-params routing header.
8243    /// - The value is extracted from the request message's `table_name` field
8244    ///   if it matches the full pattern specified:
8245    ///   `projects/*/instances/*/tables/*`.
8246    ///
8247    /// **NB:** If the `path_template` field is not provided, the key name is
8248    /// equal to the field name, and the whole field should be sent as a value.
8249    /// This makes the pattern for the field and the value functionally equivalent
8250    /// to `**`, and the configuration
8251    ///
8252    /// ```norust
8253    /// {
8254    ///   field: "table_name"
8255    /// }
8256    /// ```
8257    ///
8258    /// is a functionally equivalent shorthand to:
8259    ///
8260    /// ```norust
8261    /// {
8262    ///   field: "table_name"
8263    ///   path_template: "{table_name=**}"
8264    /// }
8265    /// ```
8266    ///
8267    /// See Example 1 for more details.
8268    pub path_template: std::string::String,
8269
8270    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8271}
8272
8273impl RoutingParameter {
8274    pub fn new() -> Self {
8275        std::default::Default::default()
8276    }
8277
8278    /// Sets the value of [field][crate::model::RoutingParameter::field].
8279    pub fn set_field<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8280        self.field = v.into();
8281        self
8282    }
8283
8284    /// Sets the value of [path_template][crate::model::RoutingParameter::path_template].
8285    pub fn set_path_template<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8286        self.path_template = v.into();
8287        self
8288    }
8289}
8290
8291impl wkt::message::Message for RoutingParameter {
8292    fn typename() -> &'static str {
8293        "type.googleapis.com/google.api.RoutingParameter"
8294    }
8295}
8296
8297/// `Service` is the root object of Google API service configuration (service
8298/// config). It describes the basic information about a logical service,
8299/// such as the service name and the user-facing title, and delegates other
8300/// aspects to sub-sections. Each sub-section is either a proto message or a
8301/// repeated proto message that configures a specific aspect, such as auth.
8302/// For more information, see each proto message definition.
8303///
8304/// Example:
8305///
8306/// ```norust
8307/// type: google.api.Service
8308/// name: calendar.googleapis.com
8309/// title: Google Calendar API
8310/// apis:
8311/// - name: google.calendar.v3.Calendar
8312///
8313/// visibility:
8314///   rules:
8315///   - selector: "google.calendar.v3.*"
8316///     restriction: PREVIEW
8317/// backend:
8318///   rules:
8319///   - selector: "google.calendar.v3.*"
8320///     address: calendar.example.com
8321///
8322/// authentication:
8323///   providers:
8324///   - id: google_calendar_auth
8325///     jwks_uri: https://www.googleapis.com/oauth2/v1/certs
8326///     issuer: https://securetoken.google.com
8327///   rules:
8328///   - selector: "*"
8329///     requirements:
8330///       provider_id: google_calendar_auth
8331/// ```
8332#[derive(Clone, Default, PartialEq)]
8333#[non_exhaustive]
8334pub struct Service {
8335    /// The service name, which is a DNS-like logical identifier for the
8336    /// service, such as `calendar.googleapis.com`. The service name
8337    /// typically goes through DNS verification to make sure the owner
8338    /// of the service also owns the DNS name.
8339    pub name: std::string::String,
8340
8341    /// The product title for this service, it is the name displayed in Google
8342    /// Cloud Console.
8343    pub title: std::string::String,
8344
8345    /// The Google project that owns this service.
8346    pub producer_project_id: std::string::String,
8347
8348    /// A unique ID for a specific instance of this message, typically assigned
8349    /// by the client for tracking purpose. Must be no longer than 63 characters
8350    /// and only lower case letters, digits, '.', '_' and '-' are allowed. If
8351    /// empty, the server may choose to generate one instead.
8352    pub id: std::string::String,
8353
8354    /// A list of API interfaces exported by this service. Only the `name` field
8355    /// of the [google.protobuf.Api][google.protobuf.Api] needs to be provided by
8356    /// the configuration author, as the remaining fields will be derived from the
8357    /// IDL during the normalization process. It is an error to specify an API
8358    /// interface here which cannot be resolved against the associated IDL files.
8359    ///
8360    /// [google.protobuf.Api]: wkt::Api
8361    pub apis: std::vec::Vec<wkt::Api>,
8362
8363    /// A list of all proto message types included in this API service.
8364    /// Types referenced directly or indirectly by the `apis` are automatically
8365    /// included.  Messages which are not referenced but shall be included, such as
8366    /// types used by the `google.protobuf.Any` type, should be listed here by
8367    /// name by the configuration author. Example:
8368    ///
8369    /// ```norust
8370    /// types:
8371    /// - name: google.protobuf.Int32
8372    /// ```
8373    pub types: std::vec::Vec<wkt::Type>,
8374
8375    /// A list of all enum types included in this API service.  Enums referenced
8376    /// directly or indirectly by the `apis` are automatically included.  Enums
8377    /// which are not referenced but shall be included should be listed here by
8378    /// name by the configuration author. Example:
8379    ///
8380    /// ```norust
8381    /// enums:
8382    /// - name: google.someapi.v1.SomeEnum
8383    /// ```
8384    pub enums: std::vec::Vec<wkt::Enum>,
8385
8386    /// Additional API documentation.
8387    pub documentation: std::option::Option<crate::model::Documentation>,
8388
8389    /// API backend configuration.
8390    pub backend: std::option::Option<crate::model::Backend>,
8391
8392    /// HTTP configuration.
8393    pub http: std::option::Option<crate::model::Http>,
8394
8395    /// Quota configuration.
8396    pub quota: std::option::Option<crate::model::Quota>,
8397
8398    /// Auth configuration.
8399    pub authentication: std::option::Option<crate::model::Authentication>,
8400
8401    /// Context configuration.
8402    pub context: std::option::Option<crate::model::Context>,
8403
8404    /// Configuration controlling usage of this service.
8405    pub usage: std::option::Option<crate::model::Usage>,
8406
8407    /// Configuration for network endpoints.  If this is empty, then an endpoint
8408    /// with the same name as the service is automatically generated to service all
8409    /// defined APIs.
8410    pub endpoints: std::vec::Vec<crate::model::Endpoint>,
8411
8412    /// Configuration for the service control plane.
8413    pub control: std::option::Option<crate::model::Control>,
8414
8415    /// Defines the logs used by this service.
8416    pub logs: std::vec::Vec<crate::model::LogDescriptor>,
8417
8418    /// Defines the metrics used by this service.
8419    pub metrics: std::vec::Vec<crate::model::MetricDescriptor>,
8420
8421    /// Defines the monitored resources used by this service. This is required
8422    /// by the [Service.monitoring][google.api.Service.monitoring] and
8423    /// [Service.logging][google.api.Service.logging] configurations.
8424    ///
8425    /// [google.api.Service.logging]: crate::model::Service::logging
8426    /// [google.api.Service.monitoring]: crate::model::Service::monitoring
8427    pub monitored_resources: std::vec::Vec<crate::model::MonitoredResourceDescriptor>,
8428
8429    /// Billing configuration.
8430    pub billing: std::option::Option<crate::model::Billing>,
8431
8432    /// Logging configuration.
8433    pub logging: std::option::Option<crate::model::Logging>,
8434
8435    /// Monitoring configuration.
8436    pub monitoring: std::option::Option<crate::model::Monitoring>,
8437
8438    /// System parameter configuration.
8439    pub system_parameters: std::option::Option<crate::model::SystemParameters>,
8440
8441    /// Output only. The source information for this configuration if available.
8442    pub source_info: std::option::Option<crate::model::SourceInfo>,
8443
8444    /// Settings for [Google Cloud Client
8445    /// libraries](https://cloud.google.com/apis/docs/cloud-client-libraries)
8446    /// generated from APIs defined as protocol buffers.
8447    pub publishing: std::option::Option<crate::model::Publishing>,
8448
8449    /// Obsolete. Do not use.
8450    ///
8451    /// This field has no semantic meaning. The service config compiler always
8452    /// sets this field to `3`.
8453    pub config_version: std::option::Option<wkt::UInt32Value>,
8454
8455    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8456}
8457
8458impl Service {
8459    pub fn new() -> Self {
8460        std::default::Default::default()
8461    }
8462
8463    /// Sets the value of [name][crate::model::Service::name].
8464    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8465        self.name = v.into();
8466        self
8467    }
8468
8469    /// Sets the value of [title][crate::model::Service::title].
8470    pub fn set_title<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8471        self.title = v.into();
8472        self
8473    }
8474
8475    /// Sets the value of [producer_project_id][crate::model::Service::producer_project_id].
8476    pub fn set_producer_project_id<T: std::convert::Into<std::string::String>>(
8477        mut self,
8478        v: T,
8479    ) -> Self {
8480        self.producer_project_id = v.into();
8481        self
8482    }
8483
8484    /// Sets the value of [id][crate::model::Service::id].
8485    pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8486        self.id = v.into();
8487        self
8488    }
8489
8490    /// Sets the value of [apis][crate::model::Service::apis].
8491    pub fn set_apis<T, V>(mut self, v: T) -> Self
8492    where
8493        T: std::iter::IntoIterator<Item = V>,
8494        V: std::convert::Into<wkt::Api>,
8495    {
8496        use std::iter::Iterator;
8497        self.apis = v.into_iter().map(|i| i.into()).collect();
8498        self
8499    }
8500
8501    /// Sets the value of [types][crate::model::Service::types].
8502    pub fn set_types<T, V>(mut self, v: T) -> Self
8503    where
8504        T: std::iter::IntoIterator<Item = V>,
8505        V: std::convert::Into<wkt::Type>,
8506    {
8507        use std::iter::Iterator;
8508        self.types = v.into_iter().map(|i| i.into()).collect();
8509        self
8510    }
8511
8512    /// Sets the value of [enums][crate::model::Service::enums].
8513    pub fn set_enums<T, V>(mut self, v: T) -> Self
8514    where
8515        T: std::iter::IntoIterator<Item = V>,
8516        V: std::convert::Into<wkt::Enum>,
8517    {
8518        use std::iter::Iterator;
8519        self.enums = v.into_iter().map(|i| i.into()).collect();
8520        self
8521    }
8522
8523    /// Sets the value of [documentation][crate::model::Service::documentation].
8524    pub fn set_documentation<T>(mut self, v: T) -> Self
8525    where
8526        T: std::convert::Into<crate::model::Documentation>,
8527    {
8528        self.documentation = std::option::Option::Some(v.into());
8529        self
8530    }
8531
8532    /// Sets or clears the value of [documentation][crate::model::Service::documentation].
8533    pub fn set_or_clear_documentation<T>(mut self, v: std::option::Option<T>) -> Self
8534    where
8535        T: std::convert::Into<crate::model::Documentation>,
8536    {
8537        self.documentation = v.map(|x| x.into());
8538        self
8539    }
8540
8541    /// Sets the value of [backend][crate::model::Service::backend].
8542    pub fn set_backend<T>(mut self, v: T) -> Self
8543    where
8544        T: std::convert::Into<crate::model::Backend>,
8545    {
8546        self.backend = std::option::Option::Some(v.into());
8547        self
8548    }
8549
8550    /// Sets or clears the value of [backend][crate::model::Service::backend].
8551    pub fn set_or_clear_backend<T>(mut self, v: std::option::Option<T>) -> Self
8552    where
8553        T: std::convert::Into<crate::model::Backend>,
8554    {
8555        self.backend = v.map(|x| x.into());
8556        self
8557    }
8558
8559    /// Sets the value of [http][crate::model::Service::http].
8560    pub fn set_http<T>(mut self, v: T) -> Self
8561    where
8562        T: std::convert::Into<crate::model::Http>,
8563    {
8564        self.http = std::option::Option::Some(v.into());
8565        self
8566    }
8567
8568    /// Sets or clears the value of [http][crate::model::Service::http].
8569    pub fn set_or_clear_http<T>(mut self, v: std::option::Option<T>) -> Self
8570    where
8571        T: std::convert::Into<crate::model::Http>,
8572    {
8573        self.http = v.map(|x| x.into());
8574        self
8575    }
8576
8577    /// Sets the value of [quota][crate::model::Service::quota].
8578    pub fn set_quota<T>(mut self, v: T) -> Self
8579    where
8580        T: std::convert::Into<crate::model::Quota>,
8581    {
8582        self.quota = std::option::Option::Some(v.into());
8583        self
8584    }
8585
8586    /// Sets or clears the value of [quota][crate::model::Service::quota].
8587    pub fn set_or_clear_quota<T>(mut self, v: std::option::Option<T>) -> Self
8588    where
8589        T: std::convert::Into<crate::model::Quota>,
8590    {
8591        self.quota = v.map(|x| x.into());
8592        self
8593    }
8594
8595    /// Sets the value of [authentication][crate::model::Service::authentication].
8596    pub fn set_authentication<T>(mut self, v: T) -> Self
8597    where
8598        T: std::convert::Into<crate::model::Authentication>,
8599    {
8600        self.authentication = std::option::Option::Some(v.into());
8601        self
8602    }
8603
8604    /// Sets or clears the value of [authentication][crate::model::Service::authentication].
8605    pub fn set_or_clear_authentication<T>(mut self, v: std::option::Option<T>) -> Self
8606    where
8607        T: std::convert::Into<crate::model::Authentication>,
8608    {
8609        self.authentication = v.map(|x| x.into());
8610        self
8611    }
8612
8613    /// Sets the value of [context][crate::model::Service::context].
8614    pub fn set_context<T>(mut self, v: T) -> Self
8615    where
8616        T: std::convert::Into<crate::model::Context>,
8617    {
8618        self.context = std::option::Option::Some(v.into());
8619        self
8620    }
8621
8622    /// Sets or clears the value of [context][crate::model::Service::context].
8623    pub fn set_or_clear_context<T>(mut self, v: std::option::Option<T>) -> Self
8624    where
8625        T: std::convert::Into<crate::model::Context>,
8626    {
8627        self.context = v.map(|x| x.into());
8628        self
8629    }
8630
8631    /// Sets the value of [usage][crate::model::Service::usage].
8632    pub fn set_usage<T>(mut self, v: T) -> Self
8633    where
8634        T: std::convert::Into<crate::model::Usage>,
8635    {
8636        self.usage = std::option::Option::Some(v.into());
8637        self
8638    }
8639
8640    /// Sets or clears the value of [usage][crate::model::Service::usage].
8641    pub fn set_or_clear_usage<T>(mut self, v: std::option::Option<T>) -> Self
8642    where
8643        T: std::convert::Into<crate::model::Usage>,
8644    {
8645        self.usage = v.map(|x| x.into());
8646        self
8647    }
8648
8649    /// Sets the value of [endpoints][crate::model::Service::endpoints].
8650    pub fn set_endpoints<T, V>(mut self, v: T) -> Self
8651    where
8652        T: std::iter::IntoIterator<Item = V>,
8653        V: std::convert::Into<crate::model::Endpoint>,
8654    {
8655        use std::iter::Iterator;
8656        self.endpoints = v.into_iter().map(|i| i.into()).collect();
8657        self
8658    }
8659
8660    /// Sets the value of [control][crate::model::Service::control].
8661    pub fn set_control<T>(mut self, v: T) -> Self
8662    where
8663        T: std::convert::Into<crate::model::Control>,
8664    {
8665        self.control = std::option::Option::Some(v.into());
8666        self
8667    }
8668
8669    /// Sets or clears the value of [control][crate::model::Service::control].
8670    pub fn set_or_clear_control<T>(mut self, v: std::option::Option<T>) -> Self
8671    where
8672        T: std::convert::Into<crate::model::Control>,
8673    {
8674        self.control = v.map(|x| x.into());
8675        self
8676    }
8677
8678    /// Sets the value of [logs][crate::model::Service::logs].
8679    pub fn set_logs<T, V>(mut self, v: T) -> Self
8680    where
8681        T: std::iter::IntoIterator<Item = V>,
8682        V: std::convert::Into<crate::model::LogDescriptor>,
8683    {
8684        use std::iter::Iterator;
8685        self.logs = v.into_iter().map(|i| i.into()).collect();
8686        self
8687    }
8688
8689    /// Sets the value of [metrics][crate::model::Service::metrics].
8690    pub fn set_metrics<T, V>(mut self, v: T) -> Self
8691    where
8692        T: std::iter::IntoIterator<Item = V>,
8693        V: std::convert::Into<crate::model::MetricDescriptor>,
8694    {
8695        use std::iter::Iterator;
8696        self.metrics = v.into_iter().map(|i| i.into()).collect();
8697        self
8698    }
8699
8700    /// Sets the value of [monitored_resources][crate::model::Service::monitored_resources].
8701    pub fn set_monitored_resources<T, V>(mut self, v: T) -> Self
8702    where
8703        T: std::iter::IntoIterator<Item = V>,
8704        V: std::convert::Into<crate::model::MonitoredResourceDescriptor>,
8705    {
8706        use std::iter::Iterator;
8707        self.monitored_resources = v.into_iter().map(|i| i.into()).collect();
8708        self
8709    }
8710
8711    /// Sets the value of [billing][crate::model::Service::billing].
8712    pub fn set_billing<T>(mut self, v: T) -> Self
8713    where
8714        T: std::convert::Into<crate::model::Billing>,
8715    {
8716        self.billing = std::option::Option::Some(v.into());
8717        self
8718    }
8719
8720    /// Sets or clears the value of [billing][crate::model::Service::billing].
8721    pub fn set_or_clear_billing<T>(mut self, v: std::option::Option<T>) -> Self
8722    where
8723        T: std::convert::Into<crate::model::Billing>,
8724    {
8725        self.billing = v.map(|x| x.into());
8726        self
8727    }
8728
8729    /// Sets the value of [logging][crate::model::Service::logging].
8730    pub fn set_logging<T>(mut self, v: T) -> Self
8731    where
8732        T: std::convert::Into<crate::model::Logging>,
8733    {
8734        self.logging = std::option::Option::Some(v.into());
8735        self
8736    }
8737
8738    /// Sets or clears the value of [logging][crate::model::Service::logging].
8739    pub fn set_or_clear_logging<T>(mut self, v: std::option::Option<T>) -> Self
8740    where
8741        T: std::convert::Into<crate::model::Logging>,
8742    {
8743        self.logging = v.map(|x| x.into());
8744        self
8745    }
8746
8747    /// Sets the value of [monitoring][crate::model::Service::monitoring].
8748    pub fn set_monitoring<T>(mut self, v: T) -> Self
8749    where
8750        T: std::convert::Into<crate::model::Monitoring>,
8751    {
8752        self.monitoring = std::option::Option::Some(v.into());
8753        self
8754    }
8755
8756    /// Sets or clears the value of [monitoring][crate::model::Service::monitoring].
8757    pub fn set_or_clear_monitoring<T>(mut self, v: std::option::Option<T>) -> Self
8758    where
8759        T: std::convert::Into<crate::model::Monitoring>,
8760    {
8761        self.monitoring = v.map(|x| x.into());
8762        self
8763    }
8764
8765    /// Sets the value of [system_parameters][crate::model::Service::system_parameters].
8766    pub fn set_system_parameters<T>(mut self, v: T) -> Self
8767    where
8768        T: std::convert::Into<crate::model::SystemParameters>,
8769    {
8770        self.system_parameters = std::option::Option::Some(v.into());
8771        self
8772    }
8773
8774    /// Sets or clears the value of [system_parameters][crate::model::Service::system_parameters].
8775    pub fn set_or_clear_system_parameters<T>(mut self, v: std::option::Option<T>) -> Self
8776    where
8777        T: std::convert::Into<crate::model::SystemParameters>,
8778    {
8779        self.system_parameters = v.map(|x| x.into());
8780        self
8781    }
8782
8783    /// Sets the value of [source_info][crate::model::Service::source_info].
8784    pub fn set_source_info<T>(mut self, v: T) -> Self
8785    where
8786        T: std::convert::Into<crate::model::SourceInfo>,
8787    {
8788        self.source_info = std::option::Option::Some(v.into());
8789        self
8790    }
8791
8792    /// Sets or clears the value of [source_info][crate::model::Service::source_info].
8793    pub fn set_or_clear_source_info<T>(mut self, v: std::option::Option<T>) -> Self
8794    where
8795        T: std::convert::Into<crate::model::SourceInfo>,
8796    {
8797        self.source_info = v.map(|x| x.into());
8798        self
8799    }
8800
8801    /// Sets the value of [publishing][crate::model::Service::publishing].
8802    pub fn set_publishing<T>(mut self, v: T) -> Self
8803    where
8804        T: std::convert::Into<crate::model::Publishing>,
8805    {
8806        self.publishing = std::option::Option::Some(v.into());
8807        self
8808    }
8809
8810    /// Sets or clears the value of [publishing][crate::model::Service::publishing].
8811    pub fn set_or_clear_publishing<T>(mut self, v: std::option::Option<T>) -> Self
8812    where
8813        T: std::convert::Into<crate::model::Publishing>,
8814    {
8815        self.publishing = v.map(|x| x.into());
8816        self
8817    }
8818
8819    /// Sets the value of [config_version][crate::model::Service::config_version].
8820    pub fn set_config_version<T>(mut self, v: T) -> Self
8821    where
8822        T: std::convert::Into<wkt::UInt32Value>,
8823    {
8824        self.config_version = std::option::Option::Some(v.into());
8825        self
8826    }
8827
8828    /// Sets or clears the value of [config_version][crate::model::Service::config_version].
8829    pub fn set_or_clear_config_version<T>(mut self, v: std::option::Option<T>) -> Self
8830    where
8831        T: std::convert::Into<wkt::UInt32Value>,
8832    {
8833        self.config_version = v.map(|x| x.into());
8834        self
8835    }
8836}
8837
8838impl wkt::message::Message for Service {
8839    fn typename() -> &'static str {
8840        "type.googleapis.com/google.api.Service"
8841    }
8842}
8843
8844/// Source information used to create a Service Config
8845#[derive(Clone, Default, PartialEq)]
8846#[non_exhaustive]
8847pub struct SourceInfo {
8848    /// All files used during config generation.
8849    pub source_files: std::vec::Vec<wkt::Any>,
8850
8851    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8852}
8853
8854impl SourceInfo {
8855    pub fn new() -> Self {
8856        std::default::Default::default()
8857    }
8858
8859    /// Sets the value of [source_files][crate::model::SourceInfo::source_files].
8860    pub fn set_source_files<T, V>(mut self, v: T) -> Self
8861    where
8862        T: std::iter::IntoIterator<Item = V>,
8863        V: std::convert::Into<wkt::Any>,
8864    {
8865        use std::iter::Iterator;
8866        self.source_files = v.into_iter().map(|i| i.into()).collect();
8867        self
8868    }
8869}
8870
8871impl wkt::message::Message for SourceInfo {
8872    fn typename() -> &'static str {
8873        "type.googleapis.com/google.api.SourceInfo"
8874    }
8875}
8876
8877/// ### System parameter configuration
8878///
8879/// A system parameter is a special kind of parameter defined by the API
8880/// system, not by an individual API. It is typically mapped to an HTTP header
8881/// and/or a URL query parameter. This configuration specifies which methods
8882/// change the names of the system parameters.
8883#[derive(Clone, Default, PartialEq)]
8884#[non_exhaustive]
8885pub struct SystemParameters {
8886    /// Define system parameters.
8887    ///
8888    /// The parameters defined here will override the default parameters
8889    /// implemented by the system. If this field is missing from the service
8890    /// config, default system parameters will be used. Default system parameters
8891    /// and names is implementation-dependent.
8892    ///
8893    /// Example: define api key for all methods
8894    ///
8895    /// ```norust
8896    /// system_parameters
8897    ///   rules:
8898    ///     - selector: "*"
8899    ///       parameters:
8900    ///         - name: api_key
8901    ///           url_query_parameter: api_key
8902    /// ```
8903    ///
8904    /// Example: define 2 api key names for a specific method.
8905    ///
8906    /// ```norust
8907    /// system_parameters
8908    ///   rules:
8909    ///     - selector: "/ListShelves"
8910    ///       parameters:
8911    ///         - name: api_key
8912    ///           http_header: Api-Key1
8913    ///         - name: api_key
8914    ///           http_header: Api-Key2
8915    /// ```
8916    ///
8917    /// **NOTE:** All service configuration rules follow "last one wins" order.
8918    pub rules: std::vec::Vec<crate::model::SystemParameterRule>,
8919
8920    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8921}
8922
8923impl SystemParameters {
8924    pub fn new() -> Self {
8925        std::default::Default::default()
8926    }
8927
8928    /// Sets the value of [rules][crate::model::SystemParameters::rules].
8929    pub fn set_rules<T, V>(mut self, v: T) -> Self
8930    where
8931        T: std::iter::IntoIterator<Item = V>,
8932        V: std::convert::Into<crate::model::SystemParameterRule>,
8933    {
8934        use std::iter::Iterator;
8935        self.rules = v.into_iter().map(|i| i.into()).collect();
8936        self
8937    }
8938}
8939
8940impl wkt::message::Message for SystemParameters {
8941    fn typename() -> &'static str {
8942        "type.googleapis.com/google.api.SystemParameters"
8943    }
8944}
8945
8946/// Define a system parameter rule mapping system parameter definitions to
8947/// methods.
8948#[derive(Clone, Default, PartialEq)]
8949#[non_exhaustive]
8950pub struct SystemParameterRule {
8951    /// Selects the methods to which this rule applies. Use '*' to indicate all
8952    /// methods in all APIs.
8953    ///
8954    /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
8955    /// details.
8956    ///
8957    /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
8958    pub selector: std::string::String,
8959
8960    /// Define parameters. Multiple names may be defined for a parameter.
8961    /// For a given method call, only one of them should be used. If multiple
8962    /// names are used the behavior is implementation-dependent.
8963    /// If none of the specified names are present the behavior is
8964    /// parameter-dependent.
8965    pub parameters: std::vec::Vec<crate::model::SystemParameter>,
8966
8967    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8968}
8969
8970impl SystemParameterRule {
8971    pub fn new() -> Self {
8972        std::default::Default::default()
8973    }
8974
8975    /// Sets the value of [selector][crate::model::SystemParameterRule::selector].
8976    pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8977        self.selector = v.into();
8978        self
8979    }
8980
8981    /// Sets the value of [parameters][crate::model::SystemParameterRule::parameters].
8982    pub fn set_parameters<T, V>(mut self, v: T) -> Self
8983    where
8984        T: std::iter::IntoIterator<Item = V>,
8985        V: std::convert::Into<crate::model::SystemParameter>,
8986    {
8987        use std::iter::Iterator;
8988        self.parameters = v.into_iter().map(|i| i.into()).collect();
8989        self
8990    }
8991}
8992
8993impl wkt::message::Message for SystemParameterRule {
8994    fn typename() -> &'static str {
8995        "type.googleapis.com/google.api.SystemParameterRule"
8996    }
8997}
8998
8999/// Define a parameter's name and location. The parameter may be passed as either
9000/// an HTTP header or a URL query parameter, and if both are passed the behavior
9001/// is implementation-dependent.
9002#[derive(Clone, Default, PartialEq)]
9003#[non_exhaustive]
9004pub struct SystemParameter {
9005    /// Define the name of the parameter, such as "api_key" . It is case sensitive.
9006    pub name: std::string::String,
9007
9008    /// Define the HTTP header name to use for the parameter. It is case
9009    /// insensitive.
9010    pub http_header: std::string::String,
9011
9012    /// Define the URL query parameter name to use for the parameter. It is case
9013    /// sensitive.
9014    pub url_query_parameter: std::string::String,
9015
9016    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9017}
9018
9019impl SystemParameter {
9020    pub fn new() -> Self {
9021        std::default::Default::default()
9022    }
9023
9024    /// Sets the value of [name][crate::model::SystemParameter::name].
9025    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9026        self.name = v.into();
9027        self
9028    }
9029
9030    /// Sets the value of [http_header][crate::model::SystemParameter::http_header].
9031    pub fn set_http_header<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9032        self.http_header = v.into();
9033        self
9034    }
9035
9036    /// Sets the value of [url_query_parameter][crate::model::SystemParameter::url_query_parameter].
9037    pub fn set_url_query_parameter<T: std::convert::Into<std::string::String>>(
9038        mut self,
9039        v: T,
9040    ) -> Self {
9041        self.url_query_parameter = v.into();
9042        self
9043    }
9044}
9045
9046impl wkt::message::Message for SystemParameter {
9047    fn typename() -> &'static str {
9048        "type.googleapis.com/google.api.SystemParameter"
9049    }
9050}
9051
9052/// Configuration controlling usage of a service.
9053#[derive(Clone, Default, PartialEq)]
9054#[non_exhaustive]
9055pub struct Usage {
9056    /// Requirements that must be satisfied before a consumer project can use the
9057    /// service. Each requirement is of the form <service.name>/\<requirement-id\>;
9058    /// for example 'serviceusage.googleapis.com/billing-enabled'.
9059    ///
9060    /// For Google APIs, a Terms of Service requirement must be included here.
9061    /// Google Cloud APIs must include "serviceusage.googleapis.com/tos/cloud".
9062    /// Other Google APIs should include
9063    /// "serviceusage.googleapis.com/tos/universal". Additional ToS can be
9064    /// included based on the business needs.
9065    pub requirements: std::vec::Vec<std::string::String>,
9066
9067    /// A list of usage rules that apply to individual API methods.
9068    ///
9069    /// **NOTE:** All service configuration rules follow "last one wins" order.
9070    pub rules: std::vec::Vec<crate::model::UsageRule>,
9071
9072    /// The full resource name of a channel used for sending notifications to the
9073    /// service producer.
9074    ///
9075    /// Google Service Management currently only supports
9076    /// [Google Cloud Pub/Sub](https://cloud.google.com/pubsub) as a notification
9077    /// channel. To use Google Cloud Pub/Sub as the channel, this must be the name
9078    /// of a Cloud Pub/Sub topic that uses the Cloud Pub/Sub topic name format
9079    /// documented in <https://cloud.google.com/pubsub/docs/overview>.
9080    pub producer_notification_channel: std::string::String,
9081
9082    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9083}
9084
9085impl Usage {
9086    pub fn new() -> Self {
9087        std::default::Default::default()
9088    }
9089
9090    /// Sets the value of [requirements][crate::model::Usage::requirements].
9091    pub fn set_requirements<T, V>(mut self, v: T) -> Self
9092    where
9093        T: std::iter::IntoIterator<Item = V>,
9094        V: std::convert::Into<std::string::String>,
9095    {
9096        use std::iter::Iterator;
9097        self.requirements = v.into_iter().map(|i| i.into()).collect();
9098        self
9099    }
9100
9101    /// Sets the value of [rules][crate::model::Usage::rules].
9102    pub fn set_rules<T, V>(mut self, v: T) -> Self
9103    where
9104        T: std::iter::IntoIterator<Item = V>,
9105        V: std::convert::Into<crate::model::UsageRule>,
9106    {
9107        use std::iter::Iterator;
9108        self.rules = v.into_iter().map(|i| i.into()).collect();
9109        self
9110    }
9111
9112    /// Sets the value of [producer_notification_channel][crate::model::Usage::producer_notification_channel].
9113    pub fn set_producer_notification_channel<T: std::convert::Into<std::string::String>>(
9114        mut self,
9115        v: T,
9116    ) -> Self {
9117        self.producer_notification_channel = v.into();
9118        self
9119    }
9120}
9121
9122impl wkt::message::Message for Usage {
9123    fn typename() -> &'static str {
9124        "type.googleapis.com/google.api.Usage"
9125    }
9126}
9127
9128/// Usage configuration rules for the service.
9129///
9130/// NOTE: Under development.
9131///
9132/// Use this rule to configure unregistered calls for the service. Unregistered
9133/// calls are calls that do not contain consumer project identity.
9134/// (Example: calls that do not contain an API key).
9135/// By default, API methods do not allow unregistered calls, and each method call
9136/// must be identified by a consumer project identity. Use this rule to
9137/// allow/disallow unregistered calls.
9138///
9139/// Example of an API that wants to allow unregistered calls for entire service.
9140///
9141/// ```norust
9142/// usage:
9143///   rules:
9144///   - selector: "*"
9145///     allow_unregistered_calls: true
9146/// ```
9147///
9148/// Example of a method that wants to allow unregistered calls.
9149///
9150/// ```norust
9151/// usage:
9152///   rules:
9153///   - selector: "google.example.library.v1.LibraryService.CreateBook"
9154///     allow_unregistered_calls: true
9155/// ```
9156#[derive(Clone, Default, PartialEq)]
9157#[non_exhaustive]
9158pub struct UsageRule {
9159    /// Selects the methods to which this rule applies. Use '*' to indicate all
9160    /// methods in all APIs.
9161    ///
9162    /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
9163    /// details.
9164    ///
9165    /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
9166    pub selector: std::string::String,
9167
9168    /// If true, the selected method allows unregistered calls, e.g. calls
9169    /// that don't identify any user or application.
9170    pub allow_unregistered_calls: bool,
9171
9172    /// If true, the selected method should skip service control and the control
9173    /// plane features, such as quota and billing, will not be available.
9174    /// This flag is used by Google Cloud Endpoints to bypass checks for internal
9175    /// methods, such as service health check methods.
9176    pub skip_service_control: bool,
9177
9178    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9179}
9180
9181impl UsageRule {
9182    pub fn new() -> Self {
9183        std::default::Default::default()
9184    }
9185
9186    /// Sets the value of [selector][crate::model::UsageRule::selector].
9187    pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9188        self.selector = v.into();
9189        self
9190    }
9191
9192    /// Sets the value of [allow_unregistered_calls][crate::model::UsageRule::allow_unregistered_calls].
9193    pub fn set_allow_unregistered_calls<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9194        self.allow_unregistered_calls = v.into();
9195        self
9196    }
9197
9198    /// Sets the value of [skip_service_control][crate::model::UsageRule::skip_service_control].
9199    pub fn set_skip_service_control<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9200        self.skip_service_control = v.into();
9201        self
9202    }
9203}
9204
9205impl wkt::message::Message for UsageRule {
9206    fn typename() -> &'static str {
9207        "type.googleapis.com/google.api.UsageRule"
9208    }
9209}
9210
9211/// `Visibility` restricts service consumer's access to service elements,
9212/// such as whether an application can call a visibility-restricted method.
9213/// The restriction is expressed by applying visibility labels on service
9214/// elements. The visibility labels are elsewhere linked to service consumers.
9215///
9216/// A service can define multiple visibility labels, but a service consumer
9217/// should be granted at most one visibility label. Multiple visibility
9218/// labels for a single service consumer are not supported.
9219///
9220/// If an element and all its parents have no visibility label, its visibility
9221/// is unconditionally granted.
9222///
9223/// Example:
9224///
9225/// ```norust
9226/// visibility:
9227///   rules:
9228///   - selector: google.calendar.Calendar.EnhancedSearch
9229///     restriction: PREVIEW
9230///   - selector: google.calendar.Calendar.Delegate
9231///     restriction: INTERNAL
9232/// ```
9233///
9234/// Here, all methods are publicly visible except for the restricted methods
9235/// EnhancedSearch and Delegate.
9236#[derive(Clone, Default, PartialEq)]
9237#[non_exhaustive]
9238pub struct Visibility {
9239    /// A list of visibility rules that apply to individual API elements.
9240    ///
9241    /// **NOTE:** All service configuration rules follow "last one wins" order.
9242    pub rules: std::vec::Vec<crate::model::VisibilityRule>,
9243
9244    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9245}
9246
9247impl Visibility {
9248    pub fn new() -> Self {
9249        std::default::Default::default()
9250    }
9251
9252    /// Sets the value of [rules][crate::model::Visibility::rules].
9253    pub fn set_rules<T, V>(mut self, v: T) -> Self
9254    where
9255        T: std::iter::IntoIterator<Item = V>,
9256        V: std::convert::Into<crate::model::VisibilityRule>,
9257    {
9258        use std::iter::Iterator;
9259        self.rules = v.into_iter().map(|i| i.into()).collect();
9260        self
9261    }
9262}
9263
9264impl wkt::message::Message for Visibility {
9265    fn typename() -> &'static str {
9266        "type.googleapis.com/google.api.Visibility"
9267    }
9268}
9269
9270/// A visibility rule provides visibility configuration for an individual API
9271/// element.
9272#[derive(Clone, Default, PartialEq)]
9273#[non_exhaustive]
9274pub struct VisibilityRule {
9275    /// Selects methods, messages, fields, enums, etc. to which this rule applies.
9276    ///
9277    /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
9278    /// details.
9279    ///
9280    /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
9281    pub selector: std::string::String,
9282
9283    /// A comma-separated list of visibility labels that apply to the `selector`.
9284    /// Any of the listed labels can be used to grant the visibility.
9285    ///
9286    /// If a rule has multiple labels, removing one of the labels but not all of
9287    /// them can break clients.
9288    ///
9289    /// Example:
9290    ///
9291    /// ```norust
9292    /// visibility:
9293    ///   rules:
9294    ///   - selector: google.calendar.Calendar.EnhancedSearch
9295    ///     restriction: INTERNAL, PREVIEW
9296    /// ```
9297    ///
9298    /// Removing INTERNAL from this restriction will break clients that rely on
9299    /// this method and only had access to it through INTERNAL.
9300    pub restriction: std::string::String,
9301
9302    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9303}
9304
9305impl VisibilityRule {
9306    pub fn new() -> Self {
9307        std::default::Default::default()
9308    }
9309
9310    /// Sets the value of [selector][crate::model::VisibilityRule::selector].
9311    pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9312        self.selector = v.into();
9313        self
9314    }
9315
9316    /// Sets the value of [restriction][crate::model::VisibilityRule::restriction].
9317    pub fn set_restriction<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9318        self.restriction = v.into();
9319        self
9320    }
9321}
9322
9323impl wkt::message::Message for VisibilityRule {
9324    fn typename() -> &'static str {
9325        "type.googleapis.com/google.api.VisibilityRule"
9326    }
9327}
9328
9329/// The organization for which the client libraries are being published.
9330/// Affects the url where generated docs are published, etc.
9331///
9332/// # Working with unknown values
9333///
9334/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9335/// additional enum variants at any time. Adding new variants is not considered
9336/// a breaking change. Applications should write their code in anticipation of:
9337///
9338/// - New values appearing in future releases of the client library, **and**
9339/// - New values received dynamically, without application changes.
9340///
9341/// Please consult the [Working with enums] section in the user guide for some
9342/// guidelines.
9343///
9344/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9345#[derive(Clone, Debug, PartialEq)]
9346#[non_exhaustive]
9347pub enum ClientLibraryOrganization {
9348    /// Not useful.
9349    Unspecified,
9350    /// Google Cloud Platform Org.
9351    Cloud,
9352    /// Ads (Advertising) Org.
9353    Ads,
9354    /// Photos Org.
9355    Photos,
9356    /// Street View Org.
9357    StreetView,
9358    /// Shopping Org.
9359    Shopping,
9360    /// Geo Org.
9361    Geo,
9362    /// Generative AI - <https://developers.generativeai.google>
9363    GenerativeAi,
9364    /// If set, the enum was initialized with an unknown value.
9365    ///
9366    /// Applications can examine the value using [ClientLibraryOrganization::value] or
9367    /// [ClientLibraryOrganization::name].
9368    UnknownValue(client_library_organization::UnknownValue),
9369}
9370
9371#[doc(hidden)]
9372pub mod client_library_organization {
9373    #[allow(unused_imports)]
9374    use super::*;
9375    #[derive(Clone, Debug, PartialEq)]
9376    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9377}
9378
9379impl ClientLibraryOrganization {
9380    /// Gets the enum value.
9381    ///
9382    /// Returns `None` if the enum contains an unknown value deserialized from
9383    /// the string representation of enums.
9384    pub fn value(&self) -> std::option::Option<i32> {
9385        match self {
9386            Self::Unspecified => std::option::Option::Some(0),
9387            Self::Cloud => std::option::Option::Some(1),
9388            Self::Ads => std::option::Option::Some(2),
9389            Self::Photos => std::option::Option::Some(3),
9390            Self::StreetView => std::option::Option::Some(4),
9391            Self::Shopping => std::option::Option::Some(5),
9392            Self::Geo => std::option::Option::Some(6),
9393            Self::GenerativeAi => std::option::Option::Some(7),
9394            Self::UnknownValue(u) => u.0.value(),
9395        }
9396    }
9397
9398    /// Gets the enum value as a string.
9399    ///
9400    /// Returns `None` if the enum contains an unknown value deserialized from
9401    /// the integer representation of enums.
9402    pub fn name(&self) -> std::option::Option<&str> {
9403        match self {
9404            Self::Unspecified => {
9405                std::option::Option::Some("CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED")
9406            }
9407            Self::Cloud => std::option::Option::Some("CLOUD"),
9408            Self::Ads => std::option::Option::Some("ADS"),
9409            Self::Photos => std::option::Option::Some("PHOTOS"),
9410            Self::StreetView => std::option::Option::Some("STREET_VIEW"),
9411            Self::Shopping => std::option::Option::Some("SHOPPING"),
9412            Self::Geo => std::option::Option::Some("GEO"),
9413            Self::GenerativeAi => std::option::Option::Some("GENERATIVE_AI"),
9414            Self::UnknownValue(u) => u.0.name(),
9415        }
9416    }
9417}
9418
9419impl std::default::Default for ClientLibraryOrganization {
9420    fn default() -> Self {
9421        use std::convert::From;
9422        Self::from(0)
9423    }
9424}
9425
9426impl std::fmt::Display for ClientLibraryOrganization {
9427    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9428        wkt::internal::display_enum(f, self.name(), self.value())
9429    }
9430}
9431
9432impl std::convert::From<i32> for ClientLibraryOrganization {
9433    fn from(value: i32) -> Self {
9434        match value {
9435            0 => Self::Unspecified,
9436            1 => Self::Cloud,
9437            2 => Self::Ads,
9438            3 => Self::Photos,
9439            4 => Self::StreetView,
9440            5 => Self::Shopping,
9441            6 => Self::Geo,
9442            7 => Self::GenerativeAi,
9443            _ => Self::UnknownValue(client_library_organization::UnknownValue(
9444                wkt::internal::UnknownEnumValue::Integer(value),
9445            )),
9446        }
9447    }
9448}
9449
9450impl std::convert::From<&str> for ClientLibraryOrganization {
9451    fn from(value: &str) -> Self {
9452        use std::string::ToString;
9453        match value {
9454            "CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED" => Self::Unspecified,
9455            "CLOUD" => Self::Cloud,
9456            "ADS" => Self::Ads,
9457            "PHOTOS" => Self::Photos,
9458            "STREET_VIEW" => Self::StreetView,
9459            "SHOPPING" => Self::Shopping,
9460            "GEO" => Self::Geo,
9461            "GENERATIVE_AI" => Self::GenerativeAi,
9462            _ => Self::UnknownValue(client_library_organization::UnknownValue(
9463                wkt::internal::UnknownEnumValue::String(value.to_string()),
9464            )),
9465        }
9466    }
9467}
9468
9469impl serde::ser::Serialize for ClientLibraryOrganization {
9470    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9471    where
9472        S: serde::Serializer,
9473    {
9474        match self {
9475            Self::Unspecified => serializer.serialize_i32(0),
9476            Self::Cloud => serializer.serialize_i32(1),
9477            Self::Ads => serializer.serialize_i32(2),
9478            Self::Photos => serializer.serialize_i32(3),
9479            Self::StreetView => serializer.serialize_i32(4),
9480            Self::Shopping => serializer.serialize_i32(5),
9481            Self::Geo => serializer.serialize_i32(6),
9482            Self::GenerativeAi => serializer.serialize_i32(7),
9483            Self::UnknownValue(u) => u.0.serialize(serializer),
9484        }
9485    }
9486}
9487
9488impl<'de> serde::de::Deserialize<'de> for ClientLibraryOrganization {
9489    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9490    where
9491        D: serde::Deserializer<'de>,
9492    {
9493        deserializer.deserialize_any(
9494            wkt::internal::EnumVisitor::<ClientLibraryOrganization>::new(
9495                ".google.api.ClientLibraryOrganization",
9496            ),
9497        )
9498    }
9499}
9500
9501/// To where should client libraries be published?
9502///
9503/// # Working with unknown values
9504///
9505/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9506/// additional enum variants at any time. Adding new variants is not considered
9507/// a breaking change. Applications should write their code in anticipation of:
9508///
9509/// - New values appearing in future releases of the client library, **and**
9510/// - New values received dynamically, without application changes.
9511///
9512/// Please consult the [Working with enums] section in the user guide for some
9513/// guidelines.
9514///
9515/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9516#[derive(Clone, Debug, PartialEq)]
9517#[non_exhaustive]
9518pub enum ClientLibraryDestination {
9519    /// Client libraries will neither be generated nor published to package
9520    /// managers.
9521    Unspecified,
9522    /// Generate the client library in a repo under github.com/googleapis,
9523    /// but don't publish it to package managers.
9524    Github,
9525    /// Publish the library to package managers like nuget.org and npmjs.com.
9526    PackageManager,
9527    /// If set, the enum was initialized with an unknown value.
9528    ///
9529    /// Applications can examine the value using [ClientLibraryDestination::value] or
9530    /// [ClientLibraryDestination::name].
9531    UnknownValue(client_library_destination::UnknownValue),
9532}
9533
9534#[doc(hidden)]
9535pub mod client_library_destination {
9536    #[allow(unused_imports)]
9537    use super::*;
9538    #[derive(Clone, Debug, PartialEq)]
9539    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9540}
9541
9542impl ClientLibraryDestination {
9543    /// Gets the enum value.
9544    ///
9545    /// Returns `None` if the enum contains an unknown value deserialized from
9546    /// the string representation of enums.
9547    pub fn value(&self) -> std::option::Option<i32> {
9548        match self {
9549            Self::Unspecified => std::option::Option::Some(0),
9550            Self::Github => std::option::Option::Some(10),
9551            Self::PackageManager => std::option::Option::Some(20),
9552            Self::UnknownValue(u) => u.0.value(),
9553        }
9554    }
9555
9556    /// Gets the enum value as a string.
9557    ///
9558    /// Returns `None` if the enum contains an unknown value deserialized from
9559    /// the integer representation of enums.
9560    pub fn name(&self) -> std::option::Option<&str> {
9561        match self {
9562            Self::Unspecified => {
9563                std::option::Option::Some("CLIENT_LIBRARY_DESTINATION_UNSPECIFIED")
9564            }
9565            Self::Github => std::option::Option::Some("GITHUB"),
9566            Self::PackageManager => std::option::Option::Some("PACKAGE_MANAGER"),
9567            Self::UnknownValue(u) => u.0.name(),
9568        }
9569    }
9570}
9571
9572impl std::default::Default for ClientLibraryDestination {
9573    fn default() -> Self {
9574        use std::convert::From;
9575        Self::from(0)
9576    }
9577}
9578
9579impl std::fmt::Display for ClientLibraryDestination {
9580    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9581        wkt::internal::display_enum(f, self.name(), self.value())
9582    }
9583}
9584
9585impl std::convert::From<i32> for ClientLibraryDestination {
9586    fn from(value: i32) -> Self {
9587        match value {
9588            0 => Self::Unspecified,
9589            10 => Self::Github,
9590            20 => Self::PackageManager,
9591            _ => Self::UnknownValue(client_library_destination::UnknownValue(
9592                wkt::internal::UnknownEnumValue::Integer(value),
9593            )),
9594        }
9595    }
9596}
9597
9598impl std::convert::From<&str> for ClientLibraryDestination {
9599    fn from(value: &str) -> Self {
9600        use std::string::ToString;
9601        match value {
9602            "CLIENT_LIBRARY_DESTINATION_UNSPECIFIED" => Self::Unspecified,
9603            "GITHUB" => Self::Github,
9604            "PACKAGE_MANAGER" => Self::PackageManager,
9605            _ => Self::UnknownValue(client_library_destination::UnknownValue(
9606                wkt::internal::UnknownEnumValue::String(value.to_string()),
9607            )),
9608        }
9609    }
9610}
9611
9612impl serde::ser::Serialize for ClientLibraryDestination {
9613    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9614    where
9615        S: serde::Serializer,
9616    {
9617        match self {
9618            Self::Unspecified => serializer.serialize_i32(0),
9619            Self::Github => serializer.serialize_i32(10),
9620            Self::PackageManager => serializer.serialize_i32(20),
9621            Self::UnknownValue(u) => u.0.serialize(serializer),
9622        }
9623    }
9624}
9625
9626impl<'de> serde::de::Deserialize<'de> for ClientLibraryDestination {
9627    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9628    where
9629        D: serde::Deserializer<'de>,
9630    {
9631        deserializer.deserialize_any(wkt::internal::EnumVisitor::<ClientLibraryDestination>::new(
9632            ".google.api.ClientLibraryDestination",
9633        ))
9634    }
9635}
9636
9637/// Classifies set of possible modifications to an object in the service
9638/// configuration.
9639///
9640/// # Working with unknown values
9641///
9642/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9643/// additional enum variants at any time. Adding new variants is not considered
9644/// a breaking change. Applications should write their code in anticipation of:
9645///
9646/// - New values appearing in future releases of the client library, **and**
9647/// - New values received dynamically, without application changes.
9648///
9649/// Please consult the [Working with enums] section in the user guide for some
9650/// guidelines.
9651///
9652/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9653#[derive(Clone, Debug, PartialEq)]
9654#[non_exhaustive]
9655pub enum ChangeType {
9656    /// No value was provided.
9657    Unspecified,
9658    /// The changed object exists in the 'new' service configuration, but not
9659    /// in the 'old' service configuration.
9660    Added,
9661    /// The changed object exists in the 'old' service configuration, but not
9662    /// in the 'new' service configuration.
9663    Removed,
9664    /// The changed object exists in both service configurations, but its value
9665    /// is different.
9666    Modified,
9667    /// If set, the enum was initialized with an unknown value.
9668    ///
9669    /// Applications can examine the value using [ChangeType::value] or
9670    /// [ChangeType::name].
9671    UnknownValue(change_type::UnknownValue),
9672}
9673
9674#[doc(hidden)]
9675pub mod change_type {
9676    #[allow(unused_imports)]
9677    use super::*;
9678    #[derive(Clone, Debug, PartialEq)]
9679    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9680}
9681
9682impl ChangeType {
9683    /// Gets the enum value.
9684    ///
9685    /// Returns `None` if the enum contains an unknown value deserialized from
9686    /// the string representation of enums.
9687    pub fn value(&self) -> std::option::Option<i32> {
9688        match self {
9689            Self::Unspecified => std::option::Option::Some(0),
9690            Self::Added => std::option::Option::Some(1),
9691            Self::Removed => std::option::Option::Some(2),
9692            Self::Modified => std::option::Option::Some(3),
9693            Self::UnknownValue(u) => u.0.value(),
9694        }
9695    }
9696
9697    /// Gets the enum value as a string.
9698    ///
9699    /// Returns `None` if the enum contains an unknown value deserialized from
9700    /// the integer representation of enums.
9701    pub fn name(&self) -> std::option::Option<&str> {
9702        match self {
9703            Self::Unspecified => std::option::Option::Some("CHANGE_TYPE_UNSPECIFIED"),
9704            Self::Added => std::option::Option::Some("ADDED"),
9705            Self::Removed => std::option::Option::Some("REMOVED"),
9706            Self::Modified => std::option::Option::Some("MODIFIED"),
9707            Self::UnknownValue(u) => u.0.name(),
9708        }
9709    }
9710}
9711
9712impl std::default::Default for ChangeType {
9713    fn default() -> Self {
9714        use std::convert::From;
9715        Self::from(0)
9716    }
9717}
9718
9719impl std::fmt::Display for ChangeType {
9720    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9721        wkt::internal::display_enum(f, self.name(), self.value())
9722    }
9723}
9724
9725impl std::convert::From<i32> for ChangeType {
9726    fn from(value: i32) -> Self {
9727        match value {
9728            0 => Self::Unspecified,
9729            1 => Self::Added,
9730            2 => Self::Removed,
9731            3 => Self::Modified,
9732            _ => Self::UnknownValue(change_type::UnknownValue(
9733                wkt::internal::UnknownEnumValue::Integer(value),
9734            )),
9735        }
9736    }
9737}
9738
9739impl std::convert::From<&str> for ChangeType {
9740    fn from(value: &str) -> Self {
9741        use std::string::ToString;
9742        match value {
9743            "CHANGE_TYPE_UNSPECIFIED" => Self::Unspecified,
9744            "ADDED" => Self::Added,
9745            "REMOVED" => Self::Removed,
9746            "MODIFIED" => Self::Modified,
9747            _ => Self::UnknownValue(change_type::UnknownValue(
9748                wkt::internal::UnknownEnumValue::String(value.to_string()),
9749            )),
9750        }
9751    }
9752}
9753
9754impl serde::ser::Serialize for ChangeType {
9755    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9756    where
9757        S: serde::Serializer,
9758    {
9759        match self {
9760            Self::Unspecified => serializer.serialize_i32(0),
9761            Self::Added => serializer.serialize_i32(1),
9762            Self::Removed => serializer.serialize_i32(2),
9763            Self::Modified => serializer.serialize_i32(3),
9764            Self::UnknownValue(u) => u.0.serialize(serializer),
9765        }
9766    }
9767}
9768
9769impl<'de> serde::de::Deserialize<'de> for ChangeType {
9770    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9771    where
9772        D: serde::Deserializer<'de>,
9773    {
9774        deserializer.deserialize_any(wkt::internal::EnumVisitor::<ChangeType>::new(
9775            ".google.api.ChangeType",
9776        ))
9777    }
9778}
9779
9780/// Defines the supported values for `google.rpc.ErrorInfo.reason` for the
9781/// `googleapis.com` error domain. This error domain is reserved for [Service
9782/// Infrastructure](https://cloud.google.com/service-infrastructure/docs/overview).
9783/// For each error info of this domain, the metadata key "service" refers to the
9784/// logical identifier of an API service, such as "pubsub.googleapis.com". The
9785/// "consumer" refers to the entity that consumes an API Service. It typically is
9786/// a Google project that owns the client application or the server resource,
9787/// such as "projects/123". Other metadata keys are specific to each error
9788/// reason. For more information, see the definition of the specific error
9789/// reason.
9790///
9791/// # Working with unknown values
9792///
9793/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9794/// additional enum variants at any time. Adding new variants is not considered
9795/// a breaking change. Applications should write their code in anticipation of:
9796///
9797/// - New values appearing in future releases of the client library, **and**
9798/// - New values received dynamically, without application changes.
9799///
9800/// Please consult the [Working with enums] section in the user guide for some
9801/// guidelines.
9802///
9803/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9804#[derive(Clone, Debug, PartialEq)]
9805#[non_exhaustive]
9806pub enum ErrorReason {
9807    /// Do not use this default value.
9808    Unspecified,
9809    /// The request is calling a disabled service for a consumer.
9810    ///
9811    /// Example of an ErrorInfo when the consumer "projects/123" contacting
9812    /// "pubsub.googleapis.com" service which is disabled:
9813    ///
9814    /// ```norust
9815    /// { "reason": "SERVICE_DISABLED",
9816    ///   "domain": "googleapis.com",
9817    ///   "metadata": {
9818    ///     "consumer": "projects/123",
9819    ///     "service": "pubsub.googleapis.com"
9820    ///   }
9821    /// }
9822    /// ```
9823    ///
9824    /// This response indicates the "pubsub.googleapis.com" has been disabled in
9825    /// "projects/123".
9826    ServiceDisabled,
9827    /// The request whose associated billing account is disabled.
9828    ///
9829    /// Example of an ErrorInfo when the consumer "projects/123" fails to contact
9830    /// "pubsub.googleapis.com" service because the associated billing account is
9831    /// disabled:
9832    ///
9833    /// ```norust
9834    /// { "reason": "BILLING_DISABLED",
9835    ///   "domain": "googleapis.com",
9836    ///   "metadata": {
9837    ///     "consumer": "projects/123",
9838    ///     "service": "pubsub.googleapis.com"
9839    ///   }
9840    /// }
9841    /// ```
9842    ///
9843    /// This response indicates the billing account associated has been disabled.
9844    BillingDisabled,
9845    /// The request is denied because the provided [API
9846    /// key](https://cloud.google.com/docs/authentication/api-keys) is invalid. It
9847    /// may be in a bad format, cannot be found, or has been expired).
9848    ///
9849    /// Example of an ErrorInfo when the request is contacting
9850    /// "storage.googleapis.com" service with an invalid API key:
9851    ///
9852    /// ```norust
9853    /// { "reason": "API_KEY_INVALID",
9854    ///   "domain": "googleapis.com",
9855    ///   "metadata": {
9856    ///     "service": "storage.googleapis.com",
9857    ///   }
9858    /// }
9859    /// ```
9860    ApiKeyInvalid,
9861    /// The request is denied because it violates [API key API
9862    /// restrictions](https://cloud.google.com/docs/authentication/api-keys#adding_api_restrictions).
9863    ///
9864    /// Example of an ErrorInfo when the consumer "projects/123" fails to call the
9865    /// "storage.googleapis.com" service because this service is restricted in the
9866    /// API key:
9867    ///
9868    /// ```norust
9869    /// { "reason": "API_KEY_SERVICE_BLOCKED",
9870    ///   "domain": "googleapis.com",
9871    ///   "metadata": {
9872    ///     "consumer": "projects/123",
9873    ///     "service": "storage.googleapis.com"
9874    ///   }
9875    /// }
9876    /// ```
9877    ApiKeyServiceBlocked,
9878    /// The request is denied because it violates [API key HTTP
9879    /// restrictions](https://cloud.google.com/docs/authentication/api-keys#adding_http_restrictions).
9880    ///
9881    /// Example of an ErrorInfo when the consumer "projects/123" fails to call
9882    /// "storage.googleapis.com" service because the http referrer of the request
9883    /// violates API key HTTP restrictions:
9884    ///
9885    /// ```norust
9886    /// { "reason": "API_KEY_HTTP_REFERRER_BLOCKED",
9887    ///   "domain": "googleapis.com",
9888    ///   "metadata": {
9889    ///     "consumer": "projects/123",
9890    ///     "service": "storage.googleapis.com",
9891    ///   }
9892    /// }
9893    /// ```
9894    ApiKeyHttpReferrerBlocked,
9895    /// The request is denied because it violates [API key IP address
9896    /// restrictions](https://cloud.google.com/docs/authentication/api-keys#adding_application_restrictions).
9897    ///
9898    /// Example of an ErrorInfo when the consumer "projects/123" fails to call
9899    /// "storage.googleapis.com" service because the caller IP of the request
9900    /// violates API key IP address restrictions:
9901    ///
9902    /// ```norust
9903    /// { "reason": "API_KEY_IP_ADDRESS_BLOCKED",
9904    ///   "domain": "googleapis.com",
9905    ///   "metadata": {
9906    ///     "consumer": "projects/123",
9907    ///     "service": "storage.googleapis.com",
9908    ///   }
9909    /// }
9910    /// ```
9911    ApiKeyIpAddressBlocked,
9912    /// The request is denied because it violates [API key Android application
9913    /// restrictions](https://cloud.google.com/docs/authentication/api-keys#adding_application_restrictions).
9914    ///
9915    /// Example of an ErrorInfo when the consumer "projects/123" fails to call
9916    /// "storage.googleapis.com" service because the request from the Android apps
9917    /// violates the API key Android application restrictions:
9918    ///
9919    /// ```norust
9920    /// { "reason": "API_KEY_ANDROID_APP_BLOCKED",
9921    ///   "domain": "googleapis.com",
9922    ///   "metadata": {
9923    ///     "consumer": "projects/123",
9924    ///     "service": "storage.googleapis.com"
9925    ///   }
9926    /// }
9927    /// ```
9928    ApiKeyAndroidAppBlocked,
9929    /// The request is denied because it violates [API key iOS application
9930    /// restrictions](https://cloud.google.com/docs/authentication/api-keys#adding_application_restrictions).
9931    ///
9932    /// Example of an ErrorInfo when the consumer "projects/123" fails to call
9933    /// "storage.googleapis.com" service because the request from the iOS apps
9934    /// violates the API key iOS application restrictions:
9935    ///
9936    /// ```norust
9937    /// { "reason": "API_KEY_IOS_APP_BLOCKED",
9938    ///   "domain": "googleapis.com",
9939    ///   "metadata": {
9940    ///     "consumer": "projects/123",
9941    ///     "service": "storage.googleapis.com"
9942    ///   }
9943    /// }
9944    /// ```
9945    ApiKeyIosAppBlocked,
9946    /// The request is denied because there is not enough rate quota for the
9947    /// consumer.
9948    ///
9949    /// Example of an ErrorInfo when the consumer "projects/123" fails to contact
9950    /// "pubsub.googleapis.com" service because consumer's rate quota usage has
9951    /// reached the maximum value set for the quota limit
9952    /// "ReadsPerMinutePerProject" on the quota metric
9953    /// "pubsub.googleapis.com/read_requests":
9954    ///
9955    /// ```norust
9956    /// { "reason": "RATE_LIMIT_EXCEEDED",
9957    ///   "domain": "googleapis.com",
9958    ///   "metadata": {
9959    ///     "consumer": "projects/123",
9960    ///     "service": "pubsub.googleapis.com",
9961    ///     "quota_metric": "pubsub.googleapis.com/read_requests",
9962    ///     "quota_limit": "ReadsPerMinutePerProject"
9963    ///   }
9964    /// }
9965    /// ```
9966    ///
9967    /// Example of an ErrorInfo when the consumer "projects/123" checks quota on
9968    /// the service "dataflow.googleapis.com" and hits the organization quota
9969    /// limit "DefaultRequestsPerMinutePerOrganization" on the metric
9970    /// "dataflow.googleapis.com/default_requests".
9971    ///
9972    /// ```norust
9973    /// { "reason": "RATE_LIMIT_EXCEEDED",
9974    ///   "domain": "googleapis.com",
9975    ///   "metadata": {
9976    ///     "consumer": "projects/123",
9977    ///     "service": "dataflow.googleapis.com",
9978    ///     "quota_metric": "dataflow.googleapis.com/default_requests",
9979    ///     "quota_limit": "DefaultRequestsPerMinutePerOrganization"
9980    ///   }
9981    /// }
9982    /// ```
9983    RateLimitExceeded,
9984    /// The request is denied because there is not enough resource quota for the
9985    /// consumer.
9986    ///
9987    /// Example of an ErrorInfo when the consumer "projects/123" fails to contact
9988    /// "compute.googleapis.com" service because consumer's resource quota usage
9989    /// has reached the maximum value set for the quota limit "VMsPerProject"
9990    /// on the quota metric "compute.googleapis.com/vms":
9991    ///
9992    /// ```norust
9993    /// { "reason": "RESOURCE_QUOTA_EXCEEDED",
9994    ///   "domain": "googleapis.com",
9995    ///   "metadata": {
9996    ///     "consumer": "projects/123",
9997    ///     "service": "compute.googleapis.com",
9998    ///     "quota_metric": "compute.googleapis.com/vms",
9999    ///     "quota_limit": "VMsPerProject"
10000    ///   }
10001    /// }
10002    /// ```
10003    ///
10004    /// Example of an ErrorInfo when the consumer "projects/123" checks resource
10005    /// quota on the service "dataflow.googleapis.com" and hits the organization
10006    /// quota limit "jobs-per-organization" on the metric
10007    /// "dataflow.googleapis.com/job_count".
10008    ///
10009    /// ```norust
10010    /// { "reason": "RESOURCE_QUOTA_EXCEEDED",
10011    ///   "domain": "googleapis.com",
10012    ///   "metadata": {
10013    ///     "consumer": "projects/123",
10014    ///     "service": "dataflow.googleapis.com",
10015    ///     "quota_metric": "dataflow.googleapis.com/job_count",
10016    ///     "quota_limit": "jobs-per-organization"
10017    ///   }
10018    /// }
10019    /// ```
10020    ResourceQuotaExceeded,
10021    /// The request whose associated billing account address is in a tax restricted
10022    /// location, violates the local tax restrictions when creating resources in
10023    /// the restricted region.
10024    ///
10025    /// Example of an ErrorInfo when creating the Cloud Storage Bucket in the
10026    /// container "projects/123" under a tax restricted region
10027    /// "locations/asia-northeast3":
10028    ///
10029    /// ```norust
10030    /// { "reason": "LOCATION_TAX_POLICY_VIOLATED",
10031    ///   "domain": "googleapis.com",
10032    ///   "metadata": {
10033    ///     "consumer": "projects/123",
10034    ///     "service": "storage.googleapis.com",
10035    ///     "location": "locations/asia-northeast3"
10036    ///   }
10037    /// }
10038    /// ```
10039    ///
10040    /// This response indicates creating the Cloud Storage Bucket in
10041    /// "locations/asia-northeast3" violates the location tax restriction.
10042    LocationTaxPolicyViolated,
10043    /// The request is denied because the caller does not have required permission
10044    /// on the user project "projects/123" or the user project is invalid. For more
10045    /// information, check the [userProject System
10046    /// Parameters](https://cloud.google.com/apis/docs/system-parameters).
10047    ///
10048    /// Example of an ErrorInfo when the caller is calling Cloud Storage service
10049    /// with insufficient permissions on the user project:
10050    ///
10051    /// ```norust
10052    /// { "reason": "USER_PROJECT_DENIED",
10053    ///   "domain": "googleapis.com",
10054    ///   "metadata": {
10055    ///     "consumer": "projects/123",
10056    ///     "service": "storage.googleapis.com"
10057    ///   }
10058    /// }
10059    /// ```
10060    UserProjectDenied,
10061    /// The request is denied because the consumer "projects/123" is suspended due
10062    /// to Terms of Service(Tos) violations. Check [Project suspension
10063    /// guidelines](https://cloud.google.com/resource-manager/docs/project-suspension-guidelines)
10064    /// for more information.
10065    ///
10066    /// Example of an ErrorInfo when calling Cloud Storage service with the
10067    /// suspended consumer "projects/123":
10068    ///
10069    /// ```norust
10070    /// { "reason": "CONSUMER_SUSPENDED",
10071    ///   "domain": "googleapis.com",
10072    ///   "metadata": {
10073    ///     "consumer": "projects/123",
10074    ///     "service": "storage.googleapis.com"
10075    ///   }
10076    /// }
10077    /// ```
10078    ConsumerSuspended,
10079    /// The request is denied because the associated consumer is invalid. It may be
10080    /// in a bad format, cannot be found, or have been deleted.
10081    ///
10082    /// Example of an ErrorInfo when calling Cloud Storage service with the
10083    /// invalid consumer "projects/123":
10084    ///
10085    /// ```norust
10086    /// { "reason": "CONSUMER_INVALID",
10087    ///   "domain": "googleapis.com",
10088    ///   "metadata": {
10089    ///     "consumer": "projects/123",
10090    ///     "service": "storage.googleapis.com"
10091    ///   }
10092    /// }
10093    /// ```
10094    ConsumerInvalid,
10095    /// The request is denied because it violates [VPC Service
10096    /// Controls](https://cloud.google.com/vpc-service-controls/docs/overview).
10097    /// The 'uid' field is a random generated identifier that customer can use it
10098    /// to search the audit log for a request rejected by VPC Service Controls. For
10099    /// more information, please refer [VPC Service Controls
10100    /// Troubleshooting](https://cloud.google.com/vpc-service-controls/docs/troubleshooting#unique-id)
10101    ///
10102    /// Example of an ErrorInfo when the consumer "projects/123" fails to call
10103    /// Cloud Storage service because the request is prohibited by the VPC Service
10104    /// Controls.
10105    ///
10106    /// ```norust
10107    /// { "reason": "SECURITY_POLICY_VIOLATED",
10108    ///   "domain": "googleapis.com",
10109    ///   "metadata": {
10110    ///     "uid": "123456789abcde",
10111    ///     "consumer": "projects/123",
10112    ///     "service": "storage.googleapis.com"
10113    ///   }
10114    /// }
10115    /// ```
10116    SecurityPolicyViolated,
10117    /// The request is denied because the provided access token has expired.
10118    ///
10119    /// Example of an ErrorInfo when the request is calling Cloud Storage service
10120    /// with an expired access token:
10121    ///
10122    /// ```norust
10123    /// { "reason": "ACCESS_TOKEN_EXPIRED",
10124    ///   "domain": "googleapis.com",
10125    ///   "metadata": {
10126    ///     "service": "storage.googleapis.com",
10127    ///     "method": "google.storage.v1.Storage.GetObject"
10128    ///   }
10129    /// }
10130    /// ```
10131    AccessTokenExpired,
10132    /// The request is denied because the provided access token doesn't have at
10133    /// least one of the acceptable scopes required for the API. Please check
10134    /// [OAuth 2.0 Scopes for Google
10135    /// APIs](https://developers.google.com/identity/protocols/oauth2/scopes) for
10136    /// the list of the OAuth 2.0 scopes that you might need to request to access
10137    /// the API.
10138    ///
10139    /// Example of an ErrorInfo when the request is calling Cloud Storage service
10140    /// with an access token that is missing required scopes:
10141    ///
10142    /// ```norust
10143    /// { "reason": "ACCESS_TOKEN_SCOPE_INSUFFICIENT",
10144    ///   "domain": "googleapis.com",
10145    ///   "metadata": {
10146    ///     "service": "storage.googleapis.com",
10147    ///     "method": "google.storage.v1.Storage.GetObject"
10148    ///   }
10149    /// }
10150    /// ```
10151    AccessTokenScopeInsufficient,
10152    /// The request is denied because the account associated with the provided
10153    /// access token is in an invalid state, such as disabled or deleted.
10154    /// For more information, see <https://cloud.google.com/docs/authentication>.
10155    ///
10156    /// Warning: For privacy reasons, the server may not be able to disclose the
10157    /// email address for some accounts. The client MUST NOT depend on the
10158    /// availability of the `email` attribute.
10159    ///
10160    /// Example of an ErrorInfo when the request is to the Cloud Storage API with
10161    /// an access token that is associated with a disabled or deleted [service
10162    /// account](http://cloud/iam/docs/service-accounts):
10163    ///
10164    /// ```norust
10165    /// { "reason": "ACCOUNT_STATE_INVALID",
10166    ///   "domain": "googleapis.com",
10167    ///   "metadata": {
10168    ///     "service": "storage.googleapis.com",
10169    ///     "method": "google.storage.v1.Storage.GetObject",
10170    ///     "email": "user@123.iam.gserviceaccount.com"
10171    ///   }
10172    /// }
10173    /// ```
10174    AccountStateInvalid,
10175    /// The request is denied because the type of the provided access token is not
10176    /// supported by the API being called.
10177    ///
10178    /// Example of an ErrorInfo when the request is to the Cloud Storage API with
10179    /// an unsupported token type.
10180    ///
10181    /// ```norust
10182    /// { "reason": "ACCESS_TOKEN_TYPE_UNSUPPORTED",
10183    ///   "domain": "googleapis.com",
10184    ///   "metadata": {
10185    ///     "service": "storage.googleapis.com",
10186    ///     "method": "google.storage.v1.Storage.GetObject"
10187    ///   }
10188    /// }
10189    /// ```
10190    AccessTokenTypeUnsupported,
10191    /// The request is denied because the request doesn't have any authentication
10192    /// credentials. For more information regarding the supported authentication
10193    /// strategies for Google Cloud APIs, see
10194    /// <https://cloud.google.com/docs/authentication>.
10195    ///
10196    /// Example of an ErrorInfo when the request is to the Cloud Storage API
10197    /// without any authentication credentials.
10198    ///
10199    /// ```norust
10200    /// { "reason": "CREDENTIALS_MISSING",
10201    ///   "domain": "googleapis.com",
10202    ///   "metadata": {
10203    ///     "service": "storage.googleapis.com",
10204    ///     "method": "google.storage.v1.Storage.GetObject"
10205    ///   }
10206    /// }
10207    /// ```
10208    CredentialsMissing,
10209    /// The request is denied because the provided project owning the resource
10210    /// which acts as the [API
10211    /// consumer](https://cloud.google.com/apis/design/glossary#api_consumer) is
10212    /// invalid. It may be in a bad format or empty.
10213    ///
10214    /// Example of an ErrorInfo when the request is to the Cloud Functions API,
10215    /// but the offered resource project in the request in a bad format which can't
10216    /// perform the ListFunctions method.
10217    ///
10218    /// ```norust
10219    /// { "reason": "RESOURCE_PROJECT_INVALID",
10220    ///   "domain": "googleapis.com",
10221    ///   "metadata": {
10222    ///     "service": "cloudfunctions.googleapis.com",
10223    ///     "method":
10224    ///     "google.cloud.functions.v1.CloudFunctionsService.ListFunctions"
10225    ///   }
10226    /// }
10227    /// ```
10228    ResourceProjectInvalid,
10229    /// The request is denied because the provided session cookie is missing,
10230    /// invalid or failed to decode.
10231    ///
10232    /// Example of an ErrorInfo when the request is calling Cloud Storage service
10233    /// with a SID cookie which can't be decoded.
10234    ///
10235    /// ```norust
10236    /// { "reason": "SESSION_COOKIE_INVALID",
10237    ///   "domain": "googleapis.com",
10238    ///   "metadata": {
10239    ///     "service": "storage.googleapis.com",
10240    ///     "method": "google.storage.v1.Storage.GetObject",
10241    ///     "cookie": "SID"
10242    ///   }
10243    /// }
10244    /// ```
10245    SessionCookieInvalid,
10246    /// The request is denied because the user is from a Google Workspace customer
10247    /// that blocks their users from accessing a particular service.
10248    ///
10249    /// Example scenario: <https://support.google.com/a/answer/9197205?hl=en>
10250    ///
10251    /// Example of an ErrorInfo when access to Google Cloud Storage service is
10252    /// blocked by the Google Workspace administrator:
10253    ///
10254    /// ```norust
10255    /// { "reason": "USER_BLOCKED_BY_ADMIN",
10256    ///   "domain": "googleapis.com",
10257    ///   "metadata": {
10258    ///     "service": "storage.googleapis.com",
10259    ///     "method": "google.storage.v1.Storage.GetObject",
10260    ///   }
10261    /// }
10262    /// ```
10263    UserBlockedByAdmin,
10264    /// The request is denied because the resource service usage is restricted
10265    /// by administrators according to the organization policy constraint.
10266    /// For more information see
10267    /// <https://cloud.google.com/resource-manager/docs/organization-policy/restricting-services>.
10268    ///
10269    /// Example of an ErrorInfo when access to Google Cloud Storage service is
10270    /// restricted by Resource Usage Restriction policy:
10271    ///
10272    /// ```norust
10273    /// { "reason": "RESOURCE_USAGE_RESTRICTION_VIOLATED",
10274    ///   "domain": "googleapis.com",
10275    ///   "metadata": {
10276    ///     "consumer": "projects/project-123",
10277    ///     "service": "storage.googleapis.com"
10278    ///   }
10279    /// }
10280    /// ```
10281    ResourceUsageRestrictionViolated,
10282    /// Unimplemented. Do not use.
10283    ///
10284    /// The request is denied because it contains unsupported system parameters in
10285    /// URL query parameters or HTTP headers. For more information,
10286    /// see <https://cloud.google.com/apis/docs/system-parameters>
10287    ///
10288    /// Example of an ErrorInfo when access "pubsub.googleapis.com" service with
10289    /// a request header of "x-goog-user-ip":
10290    ///
10291    /// ```norust
10292    /// { "reason": "SYSTEM_PARAMETER_UNSUPPORTED",
10293    ///   "domain": "googleapis.com",
10294    ///   "metadata": {
10295    ///     "service": "pubsub.googleapis.com"
10296    ///     "parameter": "x-goog-user-ip"
10297    ///   }
10298    /// }
10299    /// ```
10300    SystemParameterUnsupported,
10301    /// The request is denied because it violates Org Restriction: the requested
10302    /// resource does not belong to allowed organizations specified in
10303    /// "X-Goog-Allowed-Resources" header.
10304    ///
10305    /// Example of an ErrorInfo when accessing a GCP resource that is restricted by
10306    /// Org Restriction for "pubsub.googleapis.com" service.
10307    ///
10308    /// {
10309    /// reason: "ORG_RESTRICTION_VIOLATION"
10310    /// domain: "googleapis.com"
10311    /// metadata {
10312    /// "consumer":"projects/123456"
10313    /// "service": "pubsub.googleapis.com"
10314    /// }
10315    /// }
10316    OrgRestrictionViolation,
10317    /// The request is denied because "X-Goog-Allowed-Resources" header is in a bad
10318    /// format.
10319    ///
10320    /// Example of an ErrorInfo when
10321    /// accessing "pubsub.googleapis.com" service with an invalid
10322    /// "X-Goog-Allowed-Resources" request header.
10323    ///
10324    /// {
10325    /// reason: "ORG_RESTRICTION_HEADER_INVALID"
10326    /// domain: "googleapis.com"
10327    /// metadata {
10328    /// "consumer":"projects/123456"
10329    /// "service": "pubsub.googleapis.com"
10330    /// }
10331    /// }
10332    OrgRestrictionHeaderInvalid,
10333    /// Unimplemented. Do not use.
10334    ///
10335    /// The request is calling a service that is not visible to the consumer.
10336    ///
10337    /// Example of an ErrorInfo when the consumer "projects/123" contacting
10338    /// "pubsub.googleapis.com" service which is not visible to the consumer.
10339    ///
10340    /// ```norust
10341    /// { "reason": "SERVICE_NOT_VISIBLE",
10342    ///   "domain": "googleapis.com",
10343    ///   "metadata": {
10344    ///     "consumer": "projects/123",
10345    ///     "service": "pubsub.googleapis.com"
10346    ///   }
10347    /// }
10348    /// ```
10349    ///
10350    /// This response indicates the "pubsub.googleapis.com" is not visible to
10351    /// "projects/123" (or it may not exist).
10352    ServiceNotVisible,
10353    /// The request is related to a project for which GCP access is suspended.
10354    ///
10355    /// Example of an ErrorInfo when the consumer "projects/123" fails to contact
10356    /// "pubsub.googleapis.com" service because GCP access is suspended:
10357    ///
10358    /// ```norust
10359    /// { "reason": "GCP_SUSPENDED",
10360    ///   "domain": "googleapis.com",
10361    ///   "metadata": {
10362    ///     "consumer": "projects/123",
10363    ///     "service": "pubsub.googleapis.com"
10364    ///   }
10365    /// }
10366    /// ```
10367    ///
10368    /// This response indicates the associated GCP account has been suspended.
10369    GcpSuspended,
10370    /// The request violates the location policies when creating resources in
10371    /// the restricted region.
10372    ///
10373    /// Example of an ErrorInfo when creating the Cloud Storage Bucket by
10374    /// "projects/123" for service storage.googleapis.com:
10375    ///
10376    /// ```norust
10377    /// { "reason": "LOCATION_POLICY_VIOLATED",
10378    ///   "domain": "googleapis.com",
10379    ///   "metadata": {
10380    ///     "consumer": "projects/123",
10381    ///     "service": "storage.googleapis.com",
10382    ///   }
10383    /// }
10384    /// ```
10385    ///
10386    /// This response indicates creating the Cloud Storage Bucket in
10387    /// "locations/asia-northeast3" violates at least one location policy.
10388    /// The troubleshooting guidance is provided in the Help links.
10389    LocationPolicyViolated,
10390    /// The request is denied because origin request header is missing.
10391    ///
10392    /// Example of an ErrorInfo when
10393    /// accessing "pubsub.googleapis.com" service with an empty "Origin" request
10394    /// header.
10395    ///
10396    /// {
10397    /// reason: "MISSING_ORIGIN"
10398    /// domain: "googleapis.com"
10399    /// metadata {
10400    /// "consumer":"projects/123456"
10401    /// "service": "pubsub.googleapis.com"
10402    /// }
10403    /// }
10404    MissingOrigin,
10405    /// The request is denied because the request contains more than one credential
10406    /// type that are individually acceptable, but not together. The customer
10407    /// should retry their request with only one set of credentials.
10408    ///
10409    /// Example of an ErrorInfo when
10410    /// accessing "pubsub.googleapis.com" service with overloaded credentials.
10411    ///
10412    /// {
10413    /// reason: "OVERLOADED_CREDENTIALS"
10414    /// domain: "googleapis.com"
10415    /// metadata {
10416    /// "consumer":"projects/123456"
10417    /// "service": "pubsub.googleapis.com"
10418    /// }
10419    /// }
10420    OverloadedCredentials,
10421    /// If set, the enum was initialized with an unknown value.
10422    ///
10423    /// Applications can examine the value using [ErrorReason::value] or
10424    /// [ErrorReason::name].
10425    UnknownValue(error_reason::UnknownValue),
10426}
10427
10428#[doc(hidden)]
10429pub mod error_reason {
10430    #[allow(unused_imports)]
10431    use super::*;
10432    #[derive(Clone, Debug, PartialEq)]
10433    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10434}
10435
10436impl ErrorReason {
10437    /// Gets the enum value.
10438    ///
10439    /// Returns `None` if the enum contains an unknown value deserialized from
10440    /// the string representation of enums.
10441    pub fn value(&self) -> std::option::Option<i32> {
10442        match self {
10443            Self::Unspecified => std::option::Option::Some(0),
10444            Self::ServiceDisabled => std::option::Option::Some(1),
10445            Self::BillingDisabled => std::option::Option::Some(2),
10446            Self::ApiKeyInvalid => std::option::Option::Some(3),
10447            Self::ApiKeyServiceBlocked => std::option::Option::Some(4),
10448            Self::ApiKeyHttpReferrerBlocked => std::option::Option::Some(7),
10449            Self::ApiKeyIpAddressBlocked => std::option::Option::Some(8),
10450            Self::ApiKeyAndroidAppBlocked => std::option::Option::Some(9),
10451            Self::ApiKeyIosAppBlocked => std::option::Option::Some(13),
10452            Self::RateLimitExceeded => std::option::Option::Some(5),
10453            Self::ResourceQuotaExceeded => std::option::Option::Some(6),
10454            Self::LocationTaxPolicyViolated => std::option::Option::Some(10),
10455            Self::UserProjectDenied => std::option::Option::Some(11),
10456            Self::ConsumerSuspended => std::option::Option::Some(12),
10457            Self::ConsumerInvalid => std::option::Option::Some(14),
10458            Self::SecurityPolicyViolated => std::option::Option::Some(15),
10459            Self::AccessTokenExpired => std::option::Option::Some(16),
10460            Self::AccessTokenScopeInsufficient => std::option::Option::Some(17),
10461            Self::AccountStateInvalid => std::option::Option::Some(18),
10462            Self::AccessTokenTypeUnsupported => std::option::Option::Some(19),
10463            Self::CredentialsMissing => std::option::Option::Some(20),
10464            Self::ResourceProjectInvalid => std::option::Option::Some(21),
10465            Self::SessionCookieInvalid => std::option::Option::Some(23),
10466            Self::UserBlockedByAdmin => std::option::Option::Some(24),
10467            Self::ResourceUsageRestrictionViolated => std::option::Option::Some(25),
10468            Self::SystemParameterUnsupported => std::option::Option::Some(26),
10469            Self::OrgRestrictionViolation => std::option::Option::Some(27),
10470            Self::OrgRestrictionHeaderInvalid => std::option::Option::Some(28),
10471            Self::ServiceNotVisible => std::option::Option::Some(29),
10472            Self::GcpSuspended => std::option::Option::Some(30),
10473            Self::LocationPolicyViolated => std::option::Option::Some(31),
10474            Self::MissingOrigin => std::option::Option::Some(33),
10475            Self::OverloadedCredentials => std::option::Option::Some(34),
10476            Self::UnknownValue(u) => u.0.value(),
10477        }
10478    }
10479
10480    /// Gets the enum value as a string.
10481    ///
10482    /// Returns `None` if the enum contains an unknown value deserialized from
10483    /// the integer representation of enums.
10484    pub fn name(&self) -> std::option::Option<&str> {
10485        match self {
10486            Self::Unspecified => std::option::Option::Some("ERROR_REASON_UNSPECIFIED"),
10487            Self::ServiceDisabled => std::option::Option::Some("SERVICE_DISABLED"),
10488            Self::BillingDisabled => std::option::Option::Some("BILLING_DISABLED"),
10489            Self::ApiKeyInvalid => std::option::Option::Some("API_KEY_INVALID"),
10490            Self::ApiKeyServiceBlocked => std::option::Option::Some("API_KEY_SERVICE_BLOCKED"),
10491            Self::ApiKeyHttpReferrerBlocked => {
10492                std::option::Option::Some("API_KEY_HTTP_REFERRER_BLOCKED")
10493            }
10494            Self::ApiKeyIpAddressBlocked => std::option::Option::Some("API_KEY_IP_ADDRESS_BLOCKED"),
10495            Self::ApiKeyAndroidAppBlocked => {
10496                std::option::Option::Some("API_KEY_ANDROID_APP_BLOCKED")
10497            }
10498            Self::ApiKeyIosAppBlocked => std::option::Option::Some("API_KEY_IOS_APP_BLOCKED"),
10499            Self::RateLimitExceeded => std::option::Option::Some("RATE_LIMIT_EXCEEDED"),
10500            Self::ResourceQuotaExceeded => std::option::Option::Some("RESOURCE_QUOTA_EXCEEDED"),
10501            Self::LocationTaxPolicyViolated => {
10502                std::option::Option::Some("LOCATION_TAX_POLICY_VIOLATED")
10503            }
10504            Self::UserProjectDenied => std::option::Option::Some("USER_PROJECT_DENIED"),
10505            Self::ConsumerSuspended => std::option::Option::Some("CONSUMER_SUSPENDED"),
10506            Self::ConsumerInvalid => std::option::Option::Some("CONSUMER_INVALID"),
10507            Self::SecurityPolicyViolated => std::option::Option::Some("SECURITY_POLICY_VIOLATED"),
10508            Self::AccessTokenExpired => std::option::Option::Some("ACCESS_TOKEN_EXPIRED"),
10509            Self::AccessTokenScopeInsufficient => {
10510                std::option::Option::Some("ACCESS_TOKEN_SCOPE_INSUFFICIENT")
10511            }
10512            Self::AccountStateInvalid => std::option::Option::Some("ACCOUNT_STATE_INVALID"),
10513            Self::AccessTokenTypeUnsupported => {
10514                std::option::Option::Some("ACCESS_TOKEN_TYPE_UNSUPPORTED")
10515            }
10516            Self::CredentialsMissing => std::option::Option::Some("CREDENTIALS_MISSING"),
10517            Self::ResourceProjectInvalid => std::option::Option::Some("RESOURCE_PROJECT_INVALID"),
10518            Self::SessionCookieInvalid => std::option::Option::Some("SESSION_COOKIE_INVALID"),
10519            Self::UserBlockedByAdmin => std::option::Option::Some("USER_BLOCKED_BY_ADMIN"),
10520            Self::ResourceUsageRestrictionViolated => {
10521                std::option::Option::Some("RESOURCE_USAGE_RESTRICTION_VIOLATED")
10522            }
10523            Self::SystemParameterUnsupported => {
10524                std::option::Option::Some("SYSTEM_PARAMETER_UNSUPPORTED")
10525            }
10526            Self::OrgRestrictionViolation => std::option::Option::Some("ORG_RESTRICTION_VIOLATION"),
10527            Self::OrgRestrictionHeaderInvalid => {
10528                std::option::Option::Some("ORG_RESTRICTION_HEADER_INVALID")
10529            }
10530            Self::ServiceNotVisible => std::option::Option::Some("SERVICE_NOT_VISIBLE"),
10531            Self::GcpSuspended => std::option::Option::Some("GCP_SUSPENDED"),
10532            Self::LocationPolicyViolated => std::option::Option::Some("LOCATION_POLICY_VIOLATED"),
10533            Self::MissingOrigin => std::option::Option::Some("MISSING_ORIGIN"),
10534            Self::OverloadedCredentials => std::option::Option::Some("OVERLOADED_CREDENTIALS"),
10535            Self::UnknownValue(u) => u.0.name(),
10536        }
10537    }
10538}
10539
10540impl std::default::Default for ErrorReason {
10541    fn default() -> Self {
10542        use std::convert::From;
10543        Self::from(0)
10544    }
10545}
10546
10547impl std::fmt::Display for ErrorReason {
10548    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10549        wkt::internal::display_enum(f, self.name(), self.value())
10550    }
10551}
10552
10553impl std::convert::From<i32> for ErrorReason {
10554    fn from(value: i32) -> Self {
10555        match value {
10556            0 => Self::Unspecified,
10557            1 => Self::ServiceDisabled,
10558            2 => Self::BillingDisabled,
10559            3 => Self::ApiKeyInvalid,
10560            4 => Self::ApiKeyServiceBlocked,
10561            5 => Self::RateLimitExceeded,
10562            6 => Self::ResourceQuotaExceeded,
10563            7 => Self::ApiKeyHttpReferrerBlocked,
10564            8 => Self::ApiKeyIpAddressBlocked,
10565            9 => Self::ApiKeyAndroidAppBlocked,
10566            10 => Self::LocationTaxPolicyViolated,
10567            11 => Self::UserProjectDenied,
10568            12 => Self::ConsumerSuspended,
10569            13 => Self::ApiKeyIosAppBlocked,
10570            14 => Self::ConsumerInvalid,
10571            15 => Self::SecurityPolicyViolated,
10572            16 => Self::AccessTokenExpired,
10573            17 => Self::AccessTokenScopeInsufficient,
10574            18 => Self::AccountStateInvalid,
10575            19 => Self::AccessTokenTypeUnsupported,
10576            20 => Self::CredentialsMissing,
10577            21 => Self::ResourceProjectInvalid,
10578            23 => Self::SessionCookieInvalid,
10579            24 => Self::UserBlockedByAdmin,
10580            25 => Self::ResourceUsageRestrictionViolated,
10581            26 => Self::SystemParameterUnsupported,
10582            27 => Self::OrgRestrictionViolation,
10583            28 => Self::OrgRestrictionHeaderInvalid,
10584            29 => Self::ServiceNotVisible,
10585            30 => Self::GcpSuspended,
10586            31 => Self::LocationPolicyViolated,
10587            33 => Self::MissingOrigin,
10588            34 => Self::OverloadedCredentials,
10589            _ => Self::UnknownValue(error_reason::UnknownValue(
10590                wkt::internal::UnknownEnumValue::Integer(value),
10591            )),
10592        }
10593    }
10594}
10595
10596impl std::convert::From<&str> for ErrorReason {
10597    fn from(value: &str) -> Self {
10598        use std::string::ToString;
10599        match value {
10600            "ERROR_REASON_UNSPECIFIED" => Self::Unspecified,
10601            "SERVICE_DISABLED" => Self::ServiceDisabled,
10602            "BILLING_DISABLED" => Self::BillingDisabled,
10603            "API_KEY_INVALID" => Self::ApiKeyInvalid,
10604            "API_KEY_SERVICE_BLOCKED" => Self::ApiKeyServiceBlocked,
10605            "API_KEY_HTTP_REFERRER_BLOCKED" => Self::ApiKeyHttpReferrerBlocked,
10606            "API_KEY_IP_ADDRESS_BLOCKED" => Self::ApiKeyIpAddressBlocked,
10607            "API_KEY_ANDROID_APP_BLOCKED" => Self::ApiKeyAndroidAppBlocked,
10608            "API_KEY_IOS_APP_BLOCKED" => Self::ApiKeyIosAppBlocked,
10609            "RATE_LIMIT_EXCEEDED" => Self::RateLimitExceeded,
10610            "RESOURCE_QUOTA_EXCEEDED" => Self::ResourceQuotaExceeded,
10611            "LOCATION_TAX_POLICY_VIOLATED" => Self::LocationTaxPolicyViolated,
10612            "USER_PROJECT_DENIED" => Self::UserProjectDenied,
10613            "CONSUMER_SUSPENDED" => Self::ConsumerSuspended,
10614            "CONSUMER_INVALID" => Self::ConsumerInvalid,
10615            "SECURITY_POLICY_VIOLATED" => Self::SecurityPolicyViolated,
10616            "ACCESS_TOKEN_EXPIRED" => Self::AccessTokenExpired,
10617            "ACCESS_TOKEN_SCOPE_INSUFFICIENT" => Self::AccessTokenScopeInsufficient,
10618            "ACCOUNT_STATE_INVALID" => Self::AccountStateInvalid,
10619            "ACCESS_TOKEN_TYPE_UNSUPPORTED" => Self::AccessTokenTypeUnsupported,
10620            "CREDENTIALS_MISSING" => Self::CredentialsMissing,
10621            "RESOURCE_PROJECT_INVALID" => Self::ResourceProjectInvalid,
10622            "SESSION_COOKIE_INVALID" => Self::SessionCookieInvalid,
10623            "USER_BLOCKED_BY_ADMIN" => Self::UserBlockedByAdmin,
10624            "RESOURCE_USAGE_RESTRICTION_VIOLATED" => Self::ResourceUsageRestrictionViolated,
10625            "SYSTEM_PARAMETER_UNSUPPORTED" => Self::SystemParameterUnsupported,
10626            "ORG_RESTRICTION_VIOLATION" => Self::OrgRestrictionViolation,
10627            "ORG_RESTRICTION_HEADER_INVALID" => Self::OrgRestrictionHeaderInvalid,
10628            "SERVICE_NOT_VISIBLE" => Self::ServiceNotVisible,
10629            "GCP_SUSPENDED" => Self::GcpSuspended,
10630            "LOCATION_POLICY_VIOLATED" => Self::LocationPolicyViolated,
10631            "MISSING_ORIGIN" => Self::MissingOrigin,
10632            "OVERLOADED_CREDENTIALS" => Self::OverloadedCredentials,
10633            _ => Self::UnknownValue(error_reason::UnknownValue(
10634                wkt::internal::UnknownEnumValue::String(value.to_string()),
10635            )),
10636        }
10637    }
10638}
10639
10640impl serde::ser::Serialize for ErrorReason {
10641    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10642    where
10643        S: serde::Serializer,
10644    {
10645        match self {
10646            Self::Unspecified => serializer.serialize_i32(0),
10647            Self::ServiceDisabled => serializer.serialize_i32(1),
10648            Self::BillingDisabled => serializer.serialize_i32(2),
10649            Self::ApiKeyInvalid => serializer.serialize_i32(3),
10650            Self::ApiKeyServiceBlocked => serializer.serialize_i32(4),
10651            Self::ApiKeyHttpReferrerBlocked => serializer.serialize_i32(7),
10652            Self::ApiKeyIpAddressBlocked => serializer.serialize_i32(8),
10653            Self::ApiKeyAndroidAppBlocked => serializer.serialize_i32(9),
10654            Self::ApiKeyIosAppBlocked => serializer.serialize_i32(13),
10655            Self::RateLimitExceeded => serializer.serialize_i32(5),
10656            Self::ResourceQuotaExceeded => serializer.serialize_i32(6),
10657            Self::LocationTaxPolicyViolated => serializer.serialize_i32(10),
10658            Self::UserProjectDenied => serializer.serialize_i32(11),
10659            Self::ConsumerSuspended => serializer.serialize_i32(12),
10660            Self::ConsumerInvalid => serializer.serialize_i32(14),
10661            Self::SecurityPolicyViolated => serializer.serialize_i32(15),
10662            Self::AccessTokenExpired => serializer.serialize_i32(16),
10663            Self::AccessTokenScopeInsufficient => serializer.serialize_i32(17),
10664            Self::AccountStateInvalid => serializer.serialize_i32(18),
10665            Self::AccessTokenTypeUnsupported => serializer.serialize_i32(19),
10666            Self::CredentialsMissing => serializer.serialize_i32(20),
10667            Self::ResourceProjectInvalid => serializer.serialize_i32(21),
10668            Self::SessionCookieInvalid => serializer.serialize_i32(23),
10669            Self::UserBlockedByAdmin => serializer.serialize_i32(24),
10670            Self::ResourceUsageRestrictionViolated => serializer.serialize_i32(25),
10671            Self::SystemParameterUnsupported => serializer.serialize_i32(26),
10672            Self::OrgRestrictionViolation => serializer.serialize_i32(27),
10673            Self::OrgRestrictionHeaderInvalid => serializer.serialize_i32(28),
10674            Self::ServiceNotVisible => serializer.serialize_i32(29),
10675            Self::GcpSuspended => serializer.serialize_i32(30),
10676            Self::LocationPolicyViolated => serializer.serialize_i32(31),
10677            Self::MissingOrigin => serializer.serialize_i32(33),
10678            Self::OverloadedCredentials => serializer.serialize_i32(34),
10679            Self::UnknownValue(u) => u.0.serialize(serializer),
10680        }
10681    }
10682}
10683
10684impl<'de> serde::de::Deserialize<'de> for ErrorReason {
10685    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10686    where
10687        D: serde::Deserializer<'de>,
10688    {
10689        deserializer.deserialize_any(wkt::internal::EnumVisitor::<ErrorReason>::new(
10690            ".google.api.ErrorReason",
10691        ))
10692    }
10693}
10694
10695/// An indicator of the behavior of a given field (for example, that a field
10696/// is required in requests, or given as output but ignored as input).
10697/// This **does not** change the behavior in protocol buffers itself; it only
10698/// denotes the behavior and may affect how API tooling handles the field.
10699///
10700/// Note: This enum **may** receive new values in the future.
10701///
10702/// # Working with unknown values
10703///
10704/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10705/// additional enum variants at any time. Adding new variants is not considered
10706/// a breaking change. Applications should write their code in anticipation of:
10707///
10708/// - New values appearing in future releases of the client library, **and**
10709/// - New values received dynamically, without application changes.
10710///
10711/// Please consult the [Working with enums] section in the user guide for some
10712/// guidelines.
10713///
10714/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
10715#[derive(Clone, Debug, PartialEq)]
10716#[non_exhaustive]
10717pub enum FieldBehavior {
10718    /// Conventional default for enums. Do not use this.
10719    Unspecified,
10720    /// Specifically denotes a field as optional.
10721    /// While all fields in protocol buffers are optional, this may be specified
10722    /// for emphasis if appropriate.
10723    Optional,
10724    /// Denotes a field as required.
10725    /// This indicates that the field **must** be provided as part of the request,
10726    /// and failure to do so will cause an error (usually `INVALID_ARGUMENT`).
10727    Required,
10728    /// Denotes a field as output only.
10729    /// This indicates that the field is provided in responses, but including the
10730    /// field in a request does nothing (the server *must* ignore it and
10731    /// *must not* throw an error as a result of the field's presence).
10732    OutputOnly,
10733    /// Denotes a field as input only.
10734    /// This indicates that the field is provided in requests, and the
10735    /// corresponding field is not included in output.
10736    InputOnly,
10737    /// Denotes a field as immutable.
10738    /// This indicates that the field may be set once in a request to create a
10739    /// resource, but may not be changed thereafter.
10740    Immutable,
10741    /// Denotes that a (repeated) field is an unordered list.
10742    /// This indicates that the service may provide the elements of the list
10743    /// in any arbitrary  order, rather than the order the user originally
10744    /// provided. Additionally, the list's order may or may not be stable.
10745    UnorderedList,
10746    /// Denotes that this field returns a non-empty default value if not set.
10747    /// This indicates that if the user provides the empty value in a request,
10748    /// a non-empty value will be returned. The user will not be aware of what
10749    /// non-empty value to expect.
10750    NonEmptyDefault,
10751    /// Denotes that the field in a resource (a message annotated with
10752    /// google.api.resource) is used in the resource name to uniquely identify the
10753    /// resource. For AIP-compliant APIs, this should only be applied to the
10754    /// `name` field on the resource.
10755    ///
10756    /// This behavior should not be applied to references to other resources within
10757    /// the message.
10758    ///
10759    /// The identifier field of resources often have different field behavior
10760    /// depending on the request it is embedded in (e.g. for Create methods name
10761    /// is optional and unused, while for Update methods it is required). Instead
10762    /// of method-specific annotations, only `IDENTIFIER` is required.
10763    Identifier,
10764    /// If set, the enum was initialized with an unknown value.
10765    ///
10766    /// Applications can examine the value using [FieldBehavior::value] or
10767    /// [FieldBehavior::name].
10768    UnknownValue(field_behavior::UnknownValue),
10769}
10770
10771#[doc(hidden)]
10772pub mod field_behavior {
10773    #[allow(unused_imports)]
10774    use super::*;
10775    #[derive(Clone, Debug, PartialEq)]
10776    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10777}
10778
10779impl FieldBehavior {
10780    /// Gets the enum value.
10781    ///
10782    /// Returns `None` if the enum contains an unknown value deserialized from
10783    /// the string representation of enums.
10784    pub fn value(&self) -> std::option::Option<i32> {
10785        match self {
10786            Self::Unspecified => std::option::Option::Some(0),
10787            Self::Optional => std::option::Option::Some(1),
10788            Self::Required => std::option::Option::Some(2),
10789            Self::OutputOnly => std::option::Option::Some(3),
10790            Self::InputOnly => std::option::Option::Some(4),
10791            Self::Immutable => std::option::Option::Some(5),
10792            Self::UnorderedList => std::option::Option::Some(6),
10793            Self::NonEmptyDefault => std::option::Option::Some(7),
10794            Self::Identifier => std::option::Option::Some(8),
10795            Self::UnknownValue(u) => u.0.value(),
10796        }
10797    }
10798
10799    /// Gets the enum value as a string.
10800    ///
10801    /// Returns `None` if the enum contains an unknown value deserialized from
10802    /// the integer representation of enums.
10803    pub fn name(&self) -> std::option::Option<&str> {
10804        match self {
10805            Self::Unspecified => std::option::Option::Some("FIELD_BEHAVIOR_UNSPECIFIED"),
10806            Self::Optional => std::option::Option::Some("OPTIONAL"),
10807            Self::Required => std::option::Option::Some("REQUIRED"),
10808            Self::OutputOnly => std::option::Option::Some("OUTPUT_ONLY"),
10809            Self::InputOnly => std::option::Option::Some("INPUT_ONLY"),
10810            Self::Immutable => std::option::Option::Some("IMMUTABLE"),
10811            Self::UnorderedList => std::option::Option::Some("UNORDERED_LIST"),
10812            Self::NonEmptyDefault => std::option::Option::Some("NON_EMPTY_DEFAULT"),
10813            Self::Identifier => std::option::Option::Some("IDENTIFIER"),
10814            Self::UnknownValue(u) => u.0.name(),
10815        }
10816    }
10817}
10818
10819impl std::default::Default for FieldBehavior {
10820    fn default() -> Self {
10821        use std::convert::From;
10822        Self::from(0)
10823    }
10824}
10825
10826impl std::fmt::Display for FieldBehavior {
10827    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10828        wkt::internal::display_enum(f, self.name(), self.value())
10829    }
10830}
10831
10832impl std::convert::From<i32> for FieldBehavior {
10833    fn from(value: i32) -> Self {
10834        match value {
10835            0 => Self::Unspecified,
10836            1 => Self::Optional,
10837            2 => Self::Required,
10838            3 => Self::OutputOnly,
10839            4 => Self::InputOnly,
10840            5 => Self::Immutable,
10841            6 => Self::UnorderedList,
10842            7 => Self::NonEmptyDefault,
10843            8 => Self::Identifier,
10844            _ => Self::UnknownValue(field_behavior::UnknownValue(
10845                wkt::internal::UnknownEnumValue::Integer(value),
10846            )),
10847        }
10848    }
10849}
10850
10851impl std::convert::From<&str> for FieldBehavior {
10852    fn from(value: &str) -> Self {
10853        use std::string::ToString;
10854        match value {
10855            "FIELD_BEHAVIOR_UNSPECIFIED" => Self::Unspecified,
10856            "OPTIONAL" => Self::Optional,
10857            "REQUIRED" => Self::Required,
10858            "OUTPUT_ONLY" => Self::OutputOnly,
10859            "INPUT_ONLY" => Self::InputOnly,
10860            "IMMUTABLE" => Self::Immutable,
10861            "UNORDERED_LIST" => Self::UnorderedList,
10862            "NON_EMPTY_DEFAULT" => Self::NonEmptyDefault,
10863            "IDENTIFIER" => Self::Identifier,
10864            _ => Self::UnknownValue(field_behavior::UnknownValue(
10865                wkt::internal::UnknownEnumValue::String(value.to_string()),
10866            )),
10867        }
10868    }
10869}
10870
10871impl serde::ser::Serialize for FieldBehavior {
10872    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10873    where
10874        S: serde::Serializer,
10875    {
10876        match self {
10877            Self::Unspecified => serializer.serialize_i32(0),
10878            Self::Optional => serializer.serialize_i32(1),
10879            Self::Required => serializer.serialize_i32(2),
10880            Self::OutputOnly => serializer.serialize_i32(3),
10881            Self::InputOnly => serializer.serialize_i32(4),
10882            Self::Immutable => serializer.serialize_i32(5),
10883            Self::UnorderedList => serializer.serialize_i32(6),
10884            Self::NonEmptyDefault => serializer.serialize_i32(7),
10885            Self::Identifier => serializer.serialize_i32(8),
10886            Self::UnknownValue(u) => u.0.serialize(serializer),
10887        }
10888    }
10889}
10890
10891impl<'de> serde::de::Deserialize<'de> for FieldBehavior {
10892    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10893    where
10894        D: serde::Deserializer<'de>,
10895    {
10896        deserializer.deserialize_any(wkt::internal::EnumVisitor::<FieldBehavior>::new(
10897            ".google.api.FieldBehavior",
10898        ))
10899    }
10900}
10901
10902/// The launch stage as defined by [Google Cloud Platform
10903/// Launch Stages](https://cloud.google.com/terms/launch-stages).
10904///
10905/// # Working with unknown values
10906///
10907/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10908/// additional enum variants at any time. Adding new variants is not considered
10909/// a breaking change. Applications should write their code in anticipation of:
10910///
10911/// - New values appearing in future releases of the client library, **and**
10912/// - New values received dynamically, without application changes.
10913///
10914/// Please consult the [Working with enums] section in the user guide for some
10915/// guidelines.
10916///
10917/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
10918#[derive(Clone, Debug, PartialEq)]
10919#[non_exhaustive]
10920pub enum LaunchStage {
10921    /// Do not use this default value.
10922    Unspecified,
10923    /// The feature is not yet implemented. Users can not use it.
10924    Unimplemented,
10925    /// Prelaunch features are hidden from users and are only visible internally.
10926    Prelaunch,
10927    /// Early Access features are limited to a closed group of testers. To use
10928    /// these features, you must sign up in advance and sign a Trusted Tester
10929    /// agreement (which includes confidentiality provisions). These features may
10930    /// be unstable, changed in backward-incompatible ways, and are not
10931    /// guaranteed to be released.
10932    EarlyAccess,
10933    /// Alpha is a limited availability test for releases before they are cleared
10934    /// for widespread use. By Alpha, all significant design issues are resolved
10935    /// and we are in the process of verifying functionality. Alpha customers
10936    /// need to apply for access, agree to applicable terms, and have their
10937    /// projects allowlisted. Alpha releases don't have to be feature complete,
10938    /// no SLAs are provided, and there are no technical support obligations, but
10939    /// they will be far enough along that customers can actually use them in
10940    /// test environments or for limited-use tests -- just like they would in
10941    /// normal production cases.
10942    Alpha,
10943    /// Beta is the point at which we are ready to open a release for any
10944    /// customer to use. There are no SLA or technical support obligations in a
10945    /// Beta release. Products will be complete from a feature perspective, but
10946    /// may have some open outstanding issues. Beta releases are suitable for
10947    /// limited production use cases.
10948    Beta,
10949    /// GA features are open to all developers and are considered stable and
10950    /// fully qualified for production use.
10951    Ga,
10952    /// Deprecated features are scheduled to be shut down and removed. For more
10953    /// information, see the "Deprecation Policy" section of our [Terms of
10954    /// Service](https://cloud.google.com/terms/)
10955    /// and the [Google Cloud Platform Subject to the Deprecation
10956    /// Policy](https://cloud.google.com/terms/deprecation) documentation.
10957    Deprecated,
10958    /// If set, the enum was initialized with an unknown value.
10959    ///
10960    /// Applications can examine the value using [LaunchStage::value] or
10961    /// [LaunchStage::name].
10962    UnknownValue(launch_stage::UnknownValue),
10963}
10964
10965#[doc(hidden)]
10966pub mod launch_stage {
10967    #[allow(unused_imports)]
10968    use super::*;
10969    #[derive(Clone, Debug, PartialEq)]
10970    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10971}
10972
10973impl LaunchStage {
10974    /// Gets the enum value.
10975    ///
10976    /// Returns `None` if the enum contains an unknown value deserialized from
10977    /// the string representation of enums.
10978    pub fn value(&self) -> std::option::Option<i32> {
10979        match self {
10980            Self::Unspecified => std::option::Option::Some(0),
10981            Self::Unimplemented => std::option::Option::Some(6),
10982            Self::Prelaunch => std::option::Option::Some(7),
10983            Self::EarlyAccess => std::option::Option::Some(1),
10984            Self::Alpha => std::option::Option::Some(2),
10985            Self::Beta => std::option::Option::Some(3),
10986            Self::Ga => std::option::Option::Some(4),
10987            Self::Deprecated => std::option::Option::Some(5),
10988            Self::UnknownValue(u) => u.0.value(),
10989        }
10990    }
10991
10992    /// Gets the enum value as a string.
10993    ///
10994    /// Returns `None` if the enum contains an unknown value deserialized from
10995    /// the integer representation of enums.
10996    pub fn name(&self) -> std::option::Option<&str> {
10997        match self {
10998            Self::Unspecified => std::option::Option::Some("LAUNCH_STAGE_UNSPECIFIED"),
10999            Self::Unimplemented => std::option::Option::Some("UNIMPLEMENTED"),
11000            Self::Prelaunch => std::option::Option::Some("PRELAUNCH"),
11001            Self::EarlyAccess => std::option::Option::Some("EARLY_ACCESS"),
11002            Self::Alpha => std::option::Option::Some("ALPHA"),
11003            Self::Beta => std::option::Option::Some("BETA"),
11004            Self::Ga => std::option::Option::Some("GA"),
11005            Self::Deprecated => std::option::Option::Some("DEPRECATED"),
11006            Self::UnknownValue(u) => u.0.name(),
11007        }
11008    }
11009}
11010
11011impl std::default::Default for LaunchStage {
11012    fn default() -> Self {
11013        use std::convert::From;
11014        Self::from(0)
11015    }
11016}
11017
11018impl std::fmt::Display for LaunchStage {
11019    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11020        wkt::internal::display_enum(f, self.name(), self.value())
11021    }
11022}
11023
11024impl std::convert::From<i32> for LaunchStage {
11025    fn from(value: i32) -> Self {
11026        match value {
11027            0 => Self::Unspecified,
11028            1 => Self::EarlyAccess,
11029            2 => Self::Alpha,
11030            3 => Self::Beta,
11031            4 => Self::Ga,
11032            5 => Self::Deprecated,
11033            6 => Self::Unimplemented,
11034            7 => Self::Prelaunch,
11035            _ => Self::UnknownValue(launch_stage::UnknownValue(
11036                wkt::internal::UnknownEnumValue::Integer(value),
11037            )),
11038        }
11039    }
11040}
11041
11042impl std::convert::From<&str> for LaunchStage {
11043    fn from(value: &str) -> Self {
11044        use std::string::ToString;
11045        match value {
11046            "LAUNCH_STAGE_UNSPECIFIED" => Self::Unspecified,
11047            "UNIMPLEMENTED" => Self::Unimplemented,
11048            "PRELAUNCH" => Self::Prelaunch,
11049            "EARLY_ACCESS" => Self::EarlyAccess,
11050            "ALPHA" => Self::Alpha,
11051            "BETA" => Self::Beta,
11052            "GA" => Self::Ga,
11053            "DEPRECATED" => Self::Deprecated,
11054            _ => Self::UnknownValue(launch_stage::UnknownValue(
11055                wkt::internal::UnknownEnumValue::String(value.to_string()),
11056            )),
11057        }
11058    }
11059}
11060
11061impl serde::ser::Serialize for LaunchStage {
11062    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11063    where
11064        S: serde::Serializer,
11065    {
11066        match self {
11067            Self::Unspecified => serializer.serialize_i32(0),
11068            Self::Unimplemented => serializer.serialize_i32(6),
11069            Self::Prelaunch => serializer.serialize_i32(7),
11070            Self::EarlyAccess => serializer.serialize_i32(1),
11071            Self::Alpha => serializer.serialize_i32(2),
11072            Self::Beta => serializer.serialize_i32(3),
11073            Self::Ga => serializer.serialize_i32(4),
11074            Self::Deprecated => serializer.serialize_i32(5),
11075            Self::UnknownValue(u) => u.0.serialize(serializer),
11076        }
11077    }
11078}
11079
11080impl<'de> serde::de::Deserialize<'de> for LaunchStage {
11081    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11082    where
11083        D: serde::Deserializer<'de>,
11084    {
11085        deserializer.deserialize_any(wkt::internal::EnumVisitor::<LaunchStage>::new(
11086            ".google.api.LaunchStage",
11087        ))
11088    }
11089}