google_cloud_api/model.rs
1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate bytes;
21extern crate serde;
22extern crate serde_json;
23extern crate serde_with;
24extern crate std;
25extern crate wkt;
26
27mod debug;
28mod deserialize;
29mod serialize;
30
31/// `Authentication` defines the authentication configuration for API methods
32/// provided by an API service.
33///
34/// Example:
35///
36/// ```norust
37/// name: calendar.googleapis.com
38/// authentication:
39/// providers:
40/// - id: google_calendar_auth
41/// jwks_uri: https://www.googleapis.com/oauth2/v1/certs
42/// issuer: https://securetoken.google.com
43/// rules:
44/// - selector: "*"
45/// requirements:
46/// provider_id: google_calendar_auth
47/// - selector: google.calendar.Delegate
48/// oauth:
49/// canonical_scopes: https://www.googleapis.com/auth/calendar.read
50/// ```
51#[derive(Clone, Default, PartialEq)]
52#[non_exhaustive]
53pub struct Authentication {
54 /// A list of authentication rules that apply to individual API methods.
55 ///
56 /// **NOTE:** All service configuration rules follow "last one wins" order.
57 pub rules: std::vec::Vec<crate::model::AuthenticationRule>,
58
59 /// Defines a set of authentication providers that a service supports.
60 pub providers: std::vec::Vec<crate::model::AuthProvider>,
61
62 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
63}
64
65impl Authentication {
66 pub fn new() -> Self {
67 std::default::Default::default()
68 }
69
70 /// Sets the value of [rules][crate::model::Authentication::rules].
71 ///
72 /// # Example
73 /// ```ignore,no_run
74 /// # use google_cloud_api::model::Authentication;
75 /// use google_cloud_api::model::AuthenticationRule;
76 /// let x = Authentication::new()
77 /// .set_rules([
78 /// AuthenticationRule::default()/* use setters */,
79 /// AuthenticationRule::default()/* use (different) setters */,
80 /// ]);
81 /// ```
82 pub fn set_rules<T, V>(mut self, v: T) -> Self
83 where
84 T: std::iter::IntoIterator<Item = V>,
85 V: std::convert::Into<crate::model::AuthenticationRule>,
86 {
87 use std::iter::Iterator;
88 self.rules = v.into_iter().map(|i| i.into()).collect();
89 self
90 }
91
92 /// Sets the value of [providers][crate::model::Authentication::providers].
93 ///
94 /// # Example
95 /// ```ignore,no_run
96 /// # use google_cloud_api::model::Authentication;
97 /// use google_cloud_api::model::AuthProvider;
98 /// let x = Authentication::new()
99 /// .set_providers([
100 /// AuthProvider::default()/* use setters */,
101 /// AuthProvider::default()/* use (different) setters */,
102 /// ]);
103 /// ```
104 pub fn set_providers<T, V>(mut self, v: T) -> Self
105 where
106 T: std::iter::IntoIterator<Item = V>,
107 V: std::convert::Into<crate::model::AuthProvider>,
108 {
109 use std::iter::Iterator;
110 self.providers = v.into_iter().map(|i| i.into()).collect();
111 self
112 }
113}
114
115impl wkt::message::Message for Authentication {
116 fn typename() -> &'static str {
117 "type.googleapis.com/google.api.Authentication"
118 }
119}
120
121/// Authentication rules for the service.
122///
123/// By default, if a method has any authentication requirements, every request
124/// must include a valid credential matching one of the requirements.
125/// It's an error to include more than one kind of credential in a single
126/// request.
127///
128/// If a method doesn't have any auth requirements, request credentials will be
129/// ignored.
130#[derive(Clone, Default, PartialEq)]
131#[non_exhaustive]
132pub struct AuthenticationRule {
133 /// Selects the methods to which this rule applies.
134 ///
135 /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
136 /// details.
137 ///
138 /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
139 pub selector: std::string::String,
140
141 /// The requirements for OAuth credentials.
142 pub oauth: std::option::Option<crate::model::OAuthRequirements>,
143
144 /// If true, the service accepts API keys without any other credential.
145 /// This flag only applies to HTTP and gRPC requests.
146 pub allow_without_credential: bool,
147
148 /// Requirements for additional authentication providers.
149 pub requirements: std::vec::Vec<crate::model::AuthRequirement>,
150
151 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
152}
153
154impl AuthenticationRule {
155 pub fn new() -> Self {
156 std::default::Default::default()
157 }
158
159 /// Sets the value of [selector][crate::model::AuthenticationRule::selector].
160 ///
161 /// # Example
162 /// ```ignore,no_run
163 /// # use google_cloud_api::model::AuthenticationRule;
164 /// let x = AuthenticationRule::new().set_selector("example");
165 /// ```
166 pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
167 self.selector = v.into();
168 self
169 }
170
171 /// Sets the value of [oauth][crate::model::AuthenticationRule::oauth].
172 ///
173 /// # Example
174 /// ```ignore,no_run
175 /// # use google_cloud_api::model::AuthenticationRule;
176 /// use google_cloud_api::model::OAuthRequirements;
177 /// let x = AuthenticationRule::new().set_oauth(OAuthRequirements::default()/* use setters */);
178 /// ```
179 pub fn set_oauth<T>(mut self, v: T) -> Self
180 where
181 T: std::convert::Into<crate::model::OAuthRequirements>,
182 {
183 self.oauth = std::option::Option::Some(v.into());
184 self
185 }
186
187 /// Sets or clears the value of [oauth][crate::model::AuthenticationRule::oauth].
188 ///
189 /// # Example
190 /// ```ignore,no_run
191 /// # use google_cloud_api::model::AuthenticationRule;
192 /// use google_cloud_api::model::OAuthRequirements;
193 /// let x = AuthenticationRule::new().set_or_clear_oauth(Some(OAuthRequirements::default()/* use setters */));
194 /// let x = AuthenticationRule::new().set_or_clear_oauth(None::<OAuthRequirements>);
195 /// ```
196 pub fn set_or_clear_oauth<T>(mut self, v: std::option::Option<T>) -> Self
197 where
198 T: std::convert::Into<crate::model::OAuthRequirements>,
199 {
200 self.oauth = v.map(|x| x.into());
201 self
202 }
203
204 /// Sets the value of [allow_without_credential][crate::model::AuthenticationRule::allow_without_credential].
205 ///
206 /// # Example
207 /// ```ignore,no_run
208 /// # use google_cloud_api::model::AuthenticationRule;
209 /// let x = AuthenticationRule::new().set_allow_without_credential(true);
210 /// ```
211 pub fn set_allow_without_credential<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
212 self.allow_without_credential = v.into();
213 self
214 }
215
216 /// Sets the value of [requirements][crate::model::AuthenticationRule::requirements].
217 ///
218 /// # Example
219 /// ```ignore,no_run
220 /// # use google_cloud_api::model::AuthenticationRule;
221 /// use google_cloud_api::model::AuthRequirement;
222 /// let x = AuthenticationRule::new()
223 /// .set_requirements([
224 /// AuthRequirement::default()/* use setters */,
225 /// AuthRequirement::default()/* use (different) setters */,
226 /// ]);
227 /// ```
228 pub fn set_requirements<T, V>(mut self, v: T) -> Self
229 where
230 T: std::iter::IntoIterator<Item = V>,
231 V: std::convert::Into<crate::model::AuthRequirement>,
232 {
233 use std::iter::Iterator;
234 self.requirements = v.into_iter().map(|i| i.into()).collect();
235 self
236 }
237}
238
239impl wkt::message::Message for AuthenticationRule {
240 fn typename() -> &'static str {
241 "type.googleapis.com/google.api.AuthenticationRule"
242 }
243}
244
245/// Specifies a location to extract JWT from an API request.
246#[derive(Clone, Default, PartialEq)]
247#[non_exhaustive]
248pub struct JwtLocation {
249 /// The value prefix. The value format is "value_prefix{token}"
250 /// Only applies to "in" header type. Must be empty for "in" query type.
251 /// If not empty, the header value has to match (case sensitive) this prefix.
252 /// If not matched, JWT will not be extracted. If matched, JWT will be
253 /// extracted after the prefix is removed.
254 ///
255 /// For example, for "Authorization: Bearer {JWT}",
256 /// value_prefix="Bearer " with a space at the end.
257 pub value_prefix: std::string::String,
258
259 pub r#in: std::option::Option<crate::model::jwt_location::In>,
260
261 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
262}
263
264impl JwtLocation {
265 pub fn new() -> Self {
266 std::default::Default::default()
267 }
268
269 /// Sets the value of [value_prefix][crate::model::JwtLocation::value_prefix].
270 ///
271 /// # Example
272 /// ```ignore,no_run
273 /// # use google_cloud_api::model::JwtLocation;
274 /// let x = JwtLocation::new().set_value_prefix("example");
275 /// ```
276 pub fn set_value_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
277 self.value_prefix = v.into();
278 self
279 }
280
281 /// Sets the value of [r#in][crate::model::JwtLocation::in].
282 ///
283 /// Note that all the setters affecting `r#in` are mutually
284 /// exclusive.
285 ///
286 /// # Example
287 /// ```ignore,no_run
288 /// # use google_cloud_api::model::JwtLocation;
289 /// use google_cloud_api::model::jwt_location::In;
290 /// let x = JwtLocation::new().set_in(Some(In::Header("example".to_string())));
291 /// ```
292 pub fn set_in<T: std::convert::Into<std::option::Option<crate::model::jwt_location::In>>>(
293 mut self,
294 v: T,
295 ) -> Self {
296 self.r#in = v.into();
297 self
298 }
299
300 /// The value of [r#in][crate::model::JwtLocation::r#in]
301 /// if it holds a `Header`, `None` if the field is not set or
302 /// holds a different branch.
303 pub fn header(&self) -> std::option::Option<&std::string::String> {
304 #[allow(unreachable_patterns)]
305 self.r#in.as_ref().and_then(|v| match v {
306 crate::model::jwt_location::In::Header(v) => std::option::Option::Some(v),
307 _ => std::option::Option::None,
308 })
309 }
310
311 /// Sets the value of [r#in][crate::model::JwtLocation::r#in]
312 /// to hold a `Header`.
313 ///
314 /// Note that all the setters affecting `r#in` are
315 /// mutually exclusive.
316 ///
317 /// # Example
318 /// ```ignore,no_run
319 /// # use google_cloud_api::model::JwtLocation;
320 /// let x = JwtLocation::new().set_header("example");
321 /// assert!(x.header().is_some());
322 /// assert!(x.query().is_none());
323 /// assert!(x.cookie().is_none());
324 /// ```
325 pub fn set_header<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
326 self.r#in = std::option::Option::Some(crate::model::jwt_location::In::Header(v.into()));
327 self
328 }
329
330 /// The value of [r#in][crate::model::JwtLocation::r#in]
331 /// if it holds a `Query`, `None` if the field is not set or
332 /// holds a different branch.
333 pub fn query(&self) -> std::option::Option<&std::string::String> {
334 #[allow(unreachable_patterns)]
335 self.r#in.as_ref().and_then(|v| match v {
336 crate::model::jwt_location::In::Query(v) => std::option::Option::Some(v),
337 _ => std::option::Option::None,
338 })
339 }
340
341 /// Sets the value of [r#in][crate::model::JwtLocation::r#in]
342 /// to hold a `Query`.
343 ///
344 /// Note that all the setters affecting `r#in` are
345 /// mutually exclusive.
346 ///
347 /// # Example
348 /// ```ignore,no_run
349 /// # use google_cloud_api::model::JwtLocation;
350 /// let x = JwtLocation::new().set_query("example");
351 /// assert!(x.query().is_some());
352 /// assert!(x.header().is_none());
353 /// assert!(x.cookie().is_none());
354 /// ```
355 pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
356 self.r#in = std::option::Option::Some(crate::model::jwt_location::In::Query(v.into()));
357 self
358 }
359
360 /// The value of [r#in][crate::model::JwtLocation::r#in]
361 /// if it holds a `Cookie`, `None` if the field is not set or
362 /// holds a different branch.
363 pub fn cookie(&self) -> std::option::Option<&std::string::String> {
364 #[allow(unreachable_patterns)]
365 self.r#in.as_ref().and_then(|v| match v {
366 crate::model::jwt_location::In::Cookie(v) => std::option::Option::Some(v),
367 _ => std::option::Option::None,
368 })
369 }
370
371 /// Sets the value of [r#in][crate::model::JwtLocation::r#in]
372 /// to hold a `Cookie`.
373 ///
374 /// Note that all the setters affecting `r#in` are
375 /// mutually exclusive.
376 ///
377 /// # Example
378 /// ```ignore,no_run
379 /// # use google_cloud_api::model::JwtLocation;
380 /// let x = JwtLocation::new().set_cookie("example");
381 /// assert!(x.cookie().is_some());
382 /// assert!(x.header().is_none());
383 /// assert!(x.query().is_none());
384 /// ```
385 pub fn set_cookie<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
386 self.r#in = std::option::Option::Some(crate::model::jwt_location::In::Cookie(v.into()));
387 self
388 }
389}
390
391impl wkt::message::Message for JwtLocation {
392 fn typename() -> &'static str {
393 "type.googleapis.com/google.api.JwtLocation"
394 }
395}
396
397/// Defines additional types related to [JwtLocation].
398pub mod jwt_location {
399 #[allow(unused_imports)]
400 use super::*;
401
402 #[derive(Clone, Debug, PartialEq)]
403 #[non_exhaustive]
404 pub enum In {
405 /// Specifies HTTP header name to extract JWT token.
406 Header(std::string::String),
407 /// Specifies URL query parameter name to extract JWT token.
408 Query(std::string::String),
409 /// Specifies cookie name to extract JWT token.
410 Cookie(std::string::String),
411 }
412}
413
414/// Configuration for an authentication provider, including support for
415/// [JSON Web Token
416/// (JWT)](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32).
417#[derive(Clone, Default, PartialEq)]
418#[non_exhaustive]
419pub struct AuthProvider {
420 /// The unique identifier of the auth provider. It will be referred to by
421 /// `AuthRequirement.provider_id`.
422 ///
423 /// Example: "bookstore_auth".
424 pub id: std::string::String,
425
426 /// Identifies the principal that issued the JWT. See
427 /// <https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.1>
428 /// Usually a URL or an email address.
429 ///
430 /// Example: <https://securetoken.google.com>
431 /// Example: 1234567-compute@developer.gserviceaccount.com
432 pub issuer: std::string::String,
433
434 /// URL of the provider's public key set to validate signature of the JWT. See
435 /// [OpenID
436 /// Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata).
437 /// Optional if the key set document:
438 ///
439 /// - can be retrieved from
440 /// [OpenID
441 /// Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html)
442 /// of the issuer.
443 /// - can be inferred from the email domain of the issuer (e.g. a Google
444 /// service account).
445 ///
446 /// Example: <https://www.googleapis.com/oauth2/v1/certs>
447 pub jwks_uri: std::string::String,
448
449 /// The list of JWT
450 /// [audiences](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.3).
451 /// that are allowed to access. A JWT containing any of these audiences will
452 /// be accepted. When this setting is absent, JWTs with audiences:
453 ///
454 /// - "https://[service.name]/[google.protobuf.Api.name]"
455 /// - "https://[service.name]/"
456 /// will be accepted.
457 /// For example, if no audiences are in the setting, LibraryService API will
458 /// accept JWTs with the following audiences:
459 /// - <https://library-example.googleapis.com/google.example.library.v1.LibraryService>
460 /// - <https://library-example.googleapis.com/>
461 ///
462 /// Example:
463 ///
464 /// ```norust
465 /// audiences: bookstore_android.apps.googleusercontent.com,
466 /// bookstore_web.apps.googleusercontent.com
467 /// ```
468 pub audiences: std::string::String,
469
470 /// Redirect URL if JWT token is required but not present or is expired.
471 /// Implement authorizationUrl of securityDefinitions in OpenAPI spec.
472 pub authorization_url: std::string::String,
473
474 /// Defines the locations to extract the JWT. For now it is only used by the
475 /// Cloud Endpoints to store the OpenAPI extension [x-google-jwt-locations]
476 /// (<https://cloud.google.com/endpoints/docs/openapi/openapi-extensions#x-google-jwt-locations>)
477 ///
478 /// JWT locations can be one of HTTP headers, URL query parameters or
479 /// cookies. The rule is that the first match wins.
480 ///
481 /// If not specified, default to use following 3 locations:
482 ///
483 /// 1. Authorization: Bearer
484 /// 1. x-goog-iap-jwt-assertion
485 /// 1. access_token query parameter
486 ///
487 /// Default locations can be specified as followings:
488 /// jwt_locations:
489 ///
490 /// - header: Authorization
491 /// value_prefix: "Bearer "
492 /// - header: x-goog-iap-jwt-assertion
493 /// - query: access_token
494 pub jwt_locations: std::vec::Vec<crate::model::JwtLocation>,
495
496 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
497}
498
499impl AuthProvider {
500 pub fn new() -> Self {
501 std::default::Default::default()
502 }
503
504 /// Sets the value of [id][crate::model::AuthProvider::id].
505 ///
506 /// # Example
507 /// ```ignore,no_run
508 /// # use google_cloud_api::model::AuthProvider;
509 /// let x = AuthProvider::new().set_id("example");
510 /// ```
511 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
512 self.id = v.into();
513 self
514 }
515
516 /// Sets the value of [issuer][crate::model::AuthProvider::issuer].
517 ///
518 /// # Example
519 /// ```ignore,no_run
520 /// # use google_cloud_api::model::AuthProvider;
521 /// let x = AuthProvider::new().set_issuer("example");
522 /// ```
523 pub fn set_issuer<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
524 self.issuer = v.into();
525 self
526 }
527
528 /// Sets the value of [jwks_uri][crate::model::AuthProvider::jwks_uri].
529 ///
530 /// # Example
531 /// ```ignore,no_run
532 /// # use google_cloud_api::model::AuthProvider;
533 /// let x = AuthProvider::new().set_jwks_uri("example");
534 /// ```
535 pub fn set_jwks_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
536 self.jwks_uri = v.into();
537 self
538 }
539
540 /// Sets the value of [audiences][crate::model::AuthProvider::audiences].
541 ///
542 /// # Example
543 /// ```ignore,no_run
544 /// # use google_cloud_api::model::AuthProvider;
545 /// let x = AuthProvider::new().set_audiences("example");
546 /// ```
547 pub fn set_audiences<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
548 self.audiences = v.into();
549 self
550 }
551
552 /// Sets the value of [authorization_url][crate::model::AuthProvider::authorization_url].
553 ///
554 /// # Example
555 /// ```ignore,no_run
556 /// # use google_cloud_api::model::AuthProvider;
557 /// let x = AuthProvider::new().set_authorization_url("example");
558 /// ```
559 pub fn set_authorization_url<T: std::convert::Into<std::string::String>>(
560 mut self,
561 v: T,
562 ) -> Self {
563 self.authorization_url = v.into();
564 self
565 }
566
567 /// Sets the value of [jwt_locations][crate::model::AuthProvider::jwt_locations].
568 ///
569 /// # Example
570 /// ```ignore,no_run
571 /// # use google_cloud_api::model::AuthProvider;
572 /// use google_cloud_api::model::JwtLocation;
573 /// let x = AuthProvider::new()
574 /// .set_jwt_locations([
575 /// JwtLocation::default()/* use setters */,
576 /// JwtLocation::default()/* use (different) setters */,
577 /// ]);
578 /// ```
579 pub fn set_jwt_locations<T, V>(mut self, v: T) -> Self
580 where
581 T: std::iter::IntoIterator<Item = V>,
582 V: std::convert::Into<crate::model::JwtLocation>,
583 {
584 use std::iter::Iterator;
585 self.jwt_locations = v.into_iter().map(|i| i.into()).collect();
586 self
587 }
588}
589
590impl wkt::message::Message for AuthProvider {
591 fn typename() -> &'static str {
592 "type.googleapis.com/google.api.AuthProvider"
593 }
594}
595
596/// OAuth scopes are a way to define data and permissions on data. For example,
597/// there are scopes defined for "Read-only access to Google Calendar" and
598/// "Access to Cloud Platform". Users can consent to a scope for an application,
599/// giving it permission to access that data on their behalf.
600///
601/// OAuth scope specifications should be fairly coarse grained; a user will need
602/// to see and understand the text description of what your scope means.
603///
604/// In most cases: use one or at most two OAuth scopes for an entire family of
605/// products. If your product has multiple APIs, you should probably be sharing
606/// the OAuth scope across all of those APIs.
607///
608/// When you need finer grained OAuth consent screens: talk with your product
609/// management about how developers will use them in practice.
610///
611/// Please note that even though each of the canonical scopes is enough for a
612/// request to be accepted and passed to the backend, a request can still fail
613/// due to the backend requiring additional scopes or permissions.
614#[derive(Clone, Default, PartialEq)]
615#[non_exhaustive]
616pub struct OAuthRequirements {
617 /// The list of publicly documented OAuth scopes that are allowed access. An
618 /// OAuth token containing any of these scopes will be accepted.
619 ///
620 /// Example:
621 ///
622 /// ```norust
623 /// canonical_scopes: https://www.googleapis.com/auth/calendar,
624 /// https://www.googleapis.com/auth/calendar.read
625 /// ```
626 pub canonical_scopes: std::string::String,
627
628 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
629}
630
631impl OAuthRequirements {
632 pub fn new() -> Self {
633 std::default::Default::default()
634 }
635
636 /// Sets the value of [canonical_scopes][crate::model::OAuthRequirements::canonical_scopes].
637 ///
638 /// # Example
639 /// ```ignore,no_run
640 /// # use google_cloud_api::model::OAuthRequirements;
641 /// let x = OAuthRequirements::new().set_canonical_scopes("example");
642 /// ```
643 pub fn set_canonical_scopes<T: std::convert::Into<std::string::String>>(
644 mut self,
645 v: T,
646 ) -> Self {
647 self.canonical_scopes = v.into();
648 self
649 }
650}
651
652impl wkt::message::Message for OAuthRequirements {
653 fn typename() -> &'static str {
654 "type.googleapis.com/google.api.OAuthRequirements"
655 }
656}
657
658/// User-defined authentication requirements, including support for
659/// [JSON Web Token
660/// (JWT)](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32).
661#[derive(Clone, Default, PartialEq)]
662#[non_exhaustive]
663pub struct AuthRequirement {
664 /// [id][google.api.AuthProvider.id] from authentication provider.
665 ///
666 /// Example:
667 ///
668 /// ```norust
669 /// provider_id: bookstore_auth
670 /// ```
671 ///
672 /// [google.api.AuthProvider.id]: crate::model::AuthProvider::id
673 pub provider_id: std::string::String,
674
675 /// NOTE: This will be deprecated soon, once AuthProvider.audiences is
676 /// implemented and accepted in all the runtime components.
677 ///
678 /// The list of JWT
679 /// [audiences](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.3).
680 /// that are allowed to access. A JWT containing any of these audiences will
681 /// be accepted. When this setting is absent, only JWTs with audience
682 /// "https://[Service_name][google.api.Service.name]/[API_name][google.protobuf.Api.name]"
683 /// will be accepted. For example, if no audiences are in the setting,
684 /// LibraryService API will only accept JWTs with the following audience
685 /// `https://library-example.googleapis.com/google.example.library.v1.LibraryService`.
686 ///
687 /// Example:
688 ///
689 /// ```norust
690 /// audiences: bookstore_android.apps.googleusercontent.com,
691 /// bookstore_web.apps.googleusercontent.com
692 /// ```
693 ///
694 /// [google.api.Service.name]: crate::model::Service::name
695 /// [google.protobuf.Api.name]: wkt::Api::name
696 pub audiences: std::string::String,
697
698 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
699}
700
701impl AuthRequirement {
702 pub fn new() -> Self {
703 std::default::Default::default()
704 }
705
706 /// Sets the value of [provider_id][crate::model::AuthRequirement::provider_id].
707 ///
708 /// # Example
709 /// ```ignore,no_run
710 /// # use google_cloud_api::model::AuthRequirement;
711 /// let x = AuthRequirement::new().set_provider_id("example");
712 /// ```
713 pub fn set_provider_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
714 self.provider_id = v.into();
715 self
716 }
717
718 /// Sets the value of [audiences][crate::model::AuthRequirement::audiences].
719 ///
720 /// # Example
721 /// ```ignore,no_run
722 /// # use google_cloud_api::model::AuthRequirement;
723 /// let x = AuthRequirement::new().set_audiences("example");
724 /// ```
725 pub fn set_audiences<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
726 self.audiences = v.into();
727 self
728 }
729}
730
731impl wkt::message::Message for AuthRequirement {
732 fn typename() -> &'static str {
733 "type.googleapis.com/google.api.AuthRequirement"
734 }
735}
736
737/// `Backend` defines the backend configuration for a service.
738#[derive(Clone, Default, PartialEq)]
739#[non_exhaustive]
740pub struct Backend {
741 /// A list of API backend rules that apply to individual API methods.
742 ///
743 /// **NOTE:** All service configuration rules follow "last one wins" order.
744 pub rules: std::vec::Vec<crate::model::BackendRule>,
745
746 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
747}
748
749impl Backend {
750 pub fn new() -> Self {
751 std::default::Default::default()
752 }
753
754 /// Sets the value of [rules][crate::model::Backend::rules].
755 ///
756 /// # Example
757 /// ```ignore,no_run
758 /// # use google_cloud_api::model::Backend;
759 /// use google_cloud_api::model::BackendRule;
760 /// let x = Backend::new()
761 /// .set_rules([
762 /// BackendRule::default()/* use setters */,
763 /// BackendRule::default()/* use (different) setters */,
764 /// ]);
765 /// ```
766 pub fn set_rules<T, V>(mut self, v: T) -> Self
767 where
768 T: std::iter::IntoIterator<Item = V>,
769 V: std::convert::Into<crate::model::BackendRule>,
770 {
771 use std::iter::Iterator;
772 self.rules = v.into_iter().map(|i| i.into()).collect();
773 self
774 }
775}
776
777impl wkt::message::Message for Backend {
778 fn typename() -> &'static str {
779 "type.googleapis.com/google.api.Backend"
780 }
781}
782
783/// A backend rule provides configuration for an individual API element.
784#[derive(Clone, Default, PartialEq)]
785#[non_exhaustive]
786pub struct BackendRule {
787 /// Selects the methods to which this rule applies.
788 ///
789 /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
790 /// details.
791 ///
792 /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
793 pub selector: std::string::String,
794
795 /// The address of the API backend.
796 ///
797 /// The scheme is used to determine the backend protocol and security.
798 /// The following schemes are accepted:
799 ///
800 /// SCHEME PROTOCOL SECURITY
801 /// http:// HTTP None
802 /// https:// HTTP TLS
803 /// grpc:// gRPC None
804 /// grpcs:// gRPC TLS
805 ///
806 /// It is recommended to explicitly include a scheme. Leaving out the scheme
807 /// may cause constrasting behaviors across platforms.
808 ///
809 /// If the port is unspecified, the default is:
810 ///
811 /// - 80 for schemes without TLS
812 /// - 443 for schemes with TLS
813 ///
814 /// For HTTP backends, use [protocol][google.api.BackendRule.protocol]
815 /// to specify the protocol version.
816 ///
817 /// [google.api.BackendRule.protocol]: crate::model::BackendRule::protocol
818 pub address: std::string::String,
819
820 /// The number of seconds to wait for a response from a request. The default
821 /// varies based on the request protocol and deployment environment.
822 pub deadline: f64,
823
824 /// Deprecated, do not use.
825 #[deprecated]
826 pub min_deadline: f64,
827
828 /// The number of seconds to wait for the completion of a long running
829 /// operation. The default is no deadline.
830 pub operation_deadline: f64,
831
832 /// Path translation specifies how to combine the backend address with the
833 /// request path in order to produce the appropriate forwarding URL for the
834 /// request. See [PathTranslation][google.api.BackendRule.PathTranslation] for
835 /// more details.
836 ///
837 /// [google.api.BackendRule.PathTranslation]: crate::model::backend_rule::PathTranslation
838 pub path_translation: crate::model::backend_rule::PathTranslation,
839
840 /// The protocol used for sending a request to the backend.
841 /// The supported values are "http/1.1" and "h2".
842 ///
843 /// The default value is inferred from the scheme in the
844 /// [address][google.api.BackendRule.address] field:
845 ///
846 /// SCHEME PROTOCOL
847 /// http:// http/1.1
848 /// https:// http/1.1
849 /// grpc:// h2
850 /// grpcs:// h2
851 ///
852 /// For secure HTTP backends (https://) that support HTTP/2, set this field
853 /// to "h2" for improved performance.
854 ///
855 /// Configuring this field to non-default values is only supported for secure
856 /// HTTP backends. This field will be ignored for all other backends.
857 ///
858 /// See
859 /// <https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml#alpn-protocol-ids>
860 /// for more details on the supported values.
861 ///
862 /// [google.api.BackendRule.address]: crate::model::BackendRule::address
863 pub protocol: std::string::String,
864
865 /// The map between request protocol and the backend address.
866 pub overrides_by_request_protocol:
867 std::collections::HashMap<std::string::String, crate::model::BackendRule>,
868
869 /// The load balancing policy used for connection to the application backend.
870 ///
871 /// Defined as an arbitrary string to accomondate custom load balancing
872 /// policies supported by the underlying channel, but suggest most users use
873 /// one of the standard policies, such as the default, "RoundRobin".
874 pub load_balancing_policy: std::string::String,
875
876 /// Authentication settings used by the backend.
877 ///
878 /// These are typically used to provide service management functionality to
879 /// a backend served on a publicly-routable URL. The `authentication`
880 /// details should match the authentication behavior used by the backend.
881 ///
882 /// For example, specifying `jwt_audience` implies that the backend expects
883 /// authentication via a JWT.
884 ///
885 /// When authentication is unspecified, the resulting behavior is the same
886 /// as `disable_auth` set to `true`.
887 ///
888 /// Refer to <https://developers.google.com/identity/protocols/OpenIDConnect> for
889 /// JWT ID token.
890 pub authentication: std::option::Option<crate::model::backend_rule::Authentication>,
891
892 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
893}
894
895impl BackendRule {
896 pub fn new() -> Self {
897 std::default::Default::default()
898 }
899
900 /// Sets the value of [selector][crate::model::BackendRule::selector].
901 ///
902 /// # Example
903 /// ```ignore,no_run
904 /// # use google_cloud_api::model::BackendRule;
905 /// let x = BackendRule::new().set_selector("example");
906 /// ```
907 pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
908 self.selector = v.into();
909 self
910 }
911
912 /// Sets the value of [address][crate::model::BackendRule::address].
913 ///
914 /// # Example
915 /// ```ignore,no_run
916 /// # use google_cloud_api::model::BackendRule;
917 /// let x = BackendRule::new().set_address("example");
918 /// ```
919 pub fn set_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
920 self.address = v.into();
921 self
922 }
923
924 /// Sets the value of [deadline][crate::model::BackendRule::deadline].
925 ///
926 /// # Example
927 /// ```ignore,no_run
928 /// # use google_cloud_api::model::BackendRule;
929 /// let x = BackendRule::new().set_deadline(42.0);
930 /// ```
931 pub fn set_deadline<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
932 self.deadline = v.into();
933 self
934 }
935
936 /// Sets the value of [min_deadline][crate::model::BackendRule::min_deadline].
937 ///
938 /// # Example
939 /// ```ignore,no_run
940 /// # use google_cloud_api::model::BackendRule;
941 /// let x = BackendRule::new().set_min_deadline(42.0);
942 /// ```
943 #[deprecated]
944 pub fn set_min_deadline<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
945 self.min_deadline = v.into();
946 self
947 }
948
949 /// Sets the value of [operation_deadline][crate::model::BackendRule::operation_deadline].
950 ///
951 /// # Example
952 /// ```ignore,no_run
953 /// # use google_cloud_api::model::BackendRule;
954 /// let x = BackendRule::new().set_operation_deadline(42.0);
955 /// ```
956 pub fn set_operation_deadline<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
957 self.operation_deadline = v.into();
958 self
959 }
960
961 /// Sets the value of [path_translation][crate::model::BackendRule::path_translation].
962 ///
963 /// # Example
964 /// ```ignore,no_run
965 /// # use google_cloud_api::model::BackendRule;
966 /// use google_cloud_api::model::backend_rule::PathTranslation;
967 /// let x0 = BackendRule::new().set_path_translation(PathTranslation::ConstantAddress);
968 /// let x1 = BackendRule::new().set_path_translation(PathTranslation::AppendPathToAddress);
969 /// ```
970 pub fn set_path_translation<
971 T: std::convert::Into<crate::model::backend_rule::PathTranslation>,
972 >(
973 mut self,
974 v: T,
975 ) -> Self {
976 self.path_translation = v.into();
977 self
978 }
979
980 /// Sets the value of [protocol][crate::model::BackendRule::protocol].
981 ///
982 /// # Example
983 /// ```ignore,no_run
984 /// # use google_cloud_api::model::BackendRule;
985 /// let x = BackendRule::new().set_protocol("example");
986 /// ```
987 pub fn set_protocol<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
988 self.protocol = v.into();
989 self
990 }
991
992 /// Sets the value of [overrides_by_request_protocol][crate::model::BackendRule::overrides_by_request_protocol].
993 ///
994 /// # Example
995 /// ```ignore,no_run
996 /// # use google_cloud_api::model::BackendRule;
997 /// let x = BackendRule::new().set_overrides_by_request_protocol([
998 /// ("key0", BackendRule::default()/* use setters */),
999 /// ("key1", BackendRule::default()/* use (different) setters */),
1000 /// ]);
1001 /// ```
1002 pub fn set_overrides_by_request_protocol<T, K, V>(mut self, v: T) -> Self
1003 where
1004 T: std::iter::IntoIterator<Item = (K, V)>,
1005 K: std::convert::Into<std::string::String>,
1006 V: std::convert::Into<crate::model::BackendRule>,
1007 {
1008 use std::iter::Iterator;
1009 self.overrides_by_request_protocol =
1010 v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1011 self
1012 }
1013
1014 /// Sets the value of [load_balancing_policy][crate::model::BackendRule::load_balancing_policy].
1015 ///
1016 /// # Example
1017 /// ```ignore,no_run
1018 /// # use google_cloud_api::model::BackendRule;
1019 /// let x = BackendRule::new().set_load_balancing_policy("example");
1020 /// ```
1021 pub fn set_load_balancing_policy<T: std::convert::Into<std::string::String>>(
1022 mut self,
1023 v: T,
1024 ) -> Self {
1025 self.load_balancing_policy = v.into();
1026 self
1027 }
1028
1029 /// Sets the value of [authentication][crate::model::BackendRule::authentication].
1030 ///
1031 /// Note that all the setters affecting `authentication` are mutually
1032 /// exclusive.
1033 ///
1034 /// # Example
1035 /// ```ignore,no_run
1036 /// # use google_cloud_api::model::BackendRule;
1037 /// use google_cloud_api::model::backend_rule::Authentication;
1038 /// let x = BackendRule::new().set_authentication(Some(Authentication::JwtAudience("example".to_string())));
1039 /// ```
1040 pub fn set_authentication<
1041 T: std::convert::Into<std::option::Option<crate::model::backend_rule::Authentication>>,
1042 >(
1043 mut self,
1044 v: T,
1045 ) -> Self {
1046 self.authentication = v.into();
1047 self
1048 }
1049
1050 /// The value of [authentication][crate::model::BackendRule::authentication]
1051 /// if it holds a `JwtAudience`, `None` if the field is not set or
1052 /// holds a different branch.
1053 pub fn jwt_audience(&self) -> std::option::Option<&std::string::String> {
1054 #[allow(unreachable_patterns)]
1055 self.authentication.as_ref().and_then(|v| match v {
1056 crate::model::backend_rule::Authentication::JwtAudience(v) => {
1057 std::option::Option::Some(v)
1058 }
1059 _ => std::option::Option::None,
1060 })
1061 }
1062
1063 /// Sets the value of [authentication][crate::model::BackendRule::authentication]
1064 /// to hold a `JwtAudience`.
1065 ///
1066 /// Note that all the setters affecting `authentication` are
1067 /// mutually exclusive.
1068 ///
1069 /// # Example
1070 /// ```ignore,no_run
1071 /// # use google_cloud_api::model::BackendRule;
1072 /// let x = BackendRule::new().set_jwt_audience("example");
1073 /// assert!(x.jwt_audience().is_some());
1074 /// assert!(x.disable_auth().is_none());
1075 /// ```
1076 pub fn set_jwt_audience<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1077 self.authentication = std::option::Option::Some(
1078 crate::model::backend_rule::Authentication::JwtAudience(v.into()),
1079 );
1080 self
1081 }
1082
1083 /// The value of [authentication][crate::model::BackendRule::authentication]
1084 /// if it holds a `DisableAuth`, `None` if the field is not set or
1085 /// holds a different branch.
1086 pub fn disable_auth(&self) -> std::option::Option<&bool> {
1087 #[allow(unreachable_patterns)]
1088 self.authentication.as_ref().and_then(|v| match v {
1089 crate::model::backend_rule::Authentication::DisableAuth(v) => {
1090 std::option::Option::Some(v)
1091 }
1092 _ => std::option::Option::None,
1093 })
1094 }
1095
1096 /// Sets the value of [authentication][crate::model::BackendRule::authentication]
1097 /// to hold a `DisableAuth`.
1098 ///
1099 /// Note that all the setters affecting `authentication` are
1100 /// mutually exclusive.
1101 ///
1102 /// # Example
1103 /// ```ignore,no_run
1104 /// # use google_cloud_api::model::BackendRule;
1105 /// let x = BackendRule::new().set_disable_auth(true);
1106 /// assert!(x.disable_auth().is_some());
1107 /// assert!(x.jwt_audience().is_none());
1108 /// ```
1109 pub fn set_disable_auth<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1110 self.authentication = std::option::Option::Some(
1111 crate::model::backend_rule::Authentication::DisableAuth(v.into()),
1112 );
1113 self
1114 }
1115}
1116
1117impl wkt::message::Message for BackendRule {
1118 fn typename() -> &'static str {
1119 "type.googleapis.com/google.api.BackendRule"
1120 }
1121}
1122
1123/// Defines additional types related to [BackendRule].
1124pub mod backend_rule {
1125 #[allow(unused_imports)]
1126 use super::*;
1127
1128 /// Path Translation specifies how to combine the backend address with the
1129 /// request path in order to produce the appropriate forwarding URL for the
1130 /// request.
1131 ///
1132 /// Path Translation is applicable only to HTTP-based backends. Backends which
1133 /// do not accept requests over HTTP/HTTPS should leave `path_translation`
1134 /// unspecified.
1135 ///
1136 /// # Working with unknown values
1137 ///
1138 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1139 /// additional enum variants at any time. Adding new variants is not considered
1140 /// a breaking change. Applications should write their code in anticipation of:
1141 ///
1142 /// - New values appearing in future releases of the client library, **and**
1143 /// - New values received dynamically, without application changes.
1144 ///
1145 /// Please consult the [Working with enums] section in the user guide for some
1146 /// guidelines.
1147 ///
1148 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1149 #[derive(Clone, Debug, PartialEq)]
1150 #[non_exhaustive]
1151 pub enum PathTranslation {
1152 Unspecified,
1153 /// Use the backend address as-is, with no modification to the path. If the
1154 /// URL pattern contains variables, the variable names and values will be
1155 /// appended to the query string. If a query string parameter and a URL
1156 /// pattern variable have the same name, this may result in duplicate keys in
1157 /// the query string.
1158 ///
1159 /// # Examples
1160 ///
1161 /// Given the following operation config:
1162 ///
1163 /// ```norust
1164 /// Method path: /api/company/{cid}/user/{uid}
1165 /// Backend address: https://example.cloudfunctions.net/getUser
1166 /// ```
1167 ///
1168 /// Requests to the following request paths will call the backend at the
1169 /// translated path:
1170 ///
1171 /// ```norust
1172 /// Request path: /api/company/widgetworks/user/johndoe
1173 /// Translated:
1174 /// https://example.cloudfunctions.net/getUser?cid=widgetworks&uid=johndoe
1175 ///
1176 /// Request path: /api/company/widgetworks/user/johndoe?timezone=EST
1177 /// Translated:
1178 /// https://example.cloudfunctions.net/getUser?timezone=EST&cid=widgetworks&uid=johndoe
1179 /// ```
1180 ConstantAddress,
1181 /// The request path will be appended to the backend address.
1182 ///
1183 /// # Examples
1184 ///
1185 /// Given the following operation config:
1186 ///
1187 /// ```norust
1188 /// Method path: /api/company/{cid}/user/{uid}
1189 /// Backend address: https://example.appspot.com
1190 /// ```
1191 ///
1192 /// Requests to the following request paths will call the backend at the
1193 /// translated path:
1194 ///
1195 /// ```norust
1196 /// Request path: /api/company/widgetworks/user/johndoe
1197 /// Translated:
1198 /// https://example.appspot.com/api/company/widgetworks/user/johndoe
1199 ///
1200 /// Request path: /api/company/widgetworks/user/johndoe?timezone=EST
1201 /// Translated:
1202 /// https://example.appspot.com/api/company/widgetworks/user/johndoe?timezone=EST
1203 /// ```
1204 AppendPathToAddress,
1205 /// If set, the enum was initialized with an unknown value.
1206 ///
1207 /// Applications can examine the value using [PathTranslation::value] or
1208 /// [PathTranslation::name].
1209 UnknownValue(path_translation::UnknownValue),
1210 }
1211
1212 #[doc(hidden)]
1213 pub mod path_translation {
1214 #[allow(unused_imports)]
1215 use super::*;
1216 #[derive(Clone, Debug, PartialEq)]
1217 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1218 }
1219
1220 impl PathTranslation {
1221 /// Gets the enum value.
1222 ///
1223 /// Returns `None` if the enum contains an unknown value deserialized from
1224 /// the string representation of enums.
1225 pub fn value(&self) -> std::option::Option<i32> {
1226 match self {
1227 Self::Unspecified => std::option::Option::Some(0),
1228 Self::ConstantAddress => std::option::Option::Some(1),
1229 Self::AppendPathToAddress => std::option::Option::Some(2),
1230 Self::UnknownValue(u) => u.0.value(),
1231 }
1232 }
1233
1234 /// Gets the enum value as a string.
1235 ///
1236 /// Returns `None` if the enum contains an unknown value deserialized from
1237 /// the integer representation of enums.
1238 pub fn name(&self) -> std::option::Option<&str> {
1239 match self {
1240 Self::Unspecified => std::option::Option::Some("PATH_TRANSLATION_UNSPECIFIED"),
1241 Self::ConstantAddress => std::option::Option::Some("CONSTANT_ADDRESS"),
1242 Self::AppendPathToAddress => std::option::Option::Some("APPEND_PATH_TO_ADDRESS"),
1243 Self::UnknownValue(u) => u.0.name(),
1244 }
1245 }
1246 }
1247
1248 impl std::default::Default for PathTranslation {
1249 fn default() -> Self {
1250 use std::convert::From;
1251 Self::from(0)
1252 }
1253 }
1254
1255 impl std::fmt::Display for PathTranslation {
1256 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1257 wkt::internal::display_enum(f, self.name(), self.value())
1258 }
1259 }
1260
1261 impl std::convert::From<i32> for PathTranslation {
1262 fn from(value: i32) -> Self {
1263 match value {
1264 0 => Self::Unspecified,
1265 1 => Self::ConstantAddress,
1266 2 => Self::AppendPathToAddress,
1267 _ => Self::UnknownValue(path_translation::UnknownValue(
1268 wkt::internal::UnknownEnumValue::Integer(value),
1269 )),
1270 }
1271 }
1272 }
1273
1274 impl std::convert::From<&str> for PathTranslation {
1275 fn from(value: &str) -> Self {
1276 use std::string::ToString;
1277 match value {
1278 "PATH_TRANSLATION_UNSPECIFIED" => Self::Unspecified,
1279 "CONSTANT_ADDRESS" => Self::ConstantAddress,
1280 "APPEND_PATH_TO_ADDRESS" => Self::AppendPathToAddress,
1281 _ => Self::UnknownValue(path_translation::UnknownValue(
1282 wkt::internal::UnknownEnumValue::String(value.to_string()),
1283 )),
1284 }
1285 }
1286 }
1287
1288 impl serde::ser::Serialize for PathTranslation {
1289 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1290 where
1291 S: serde::Serializer,
1292 {
1293 match self {
1294 Self::Unspecified => serializer.serialize_i32(0),
1295 Self::ConstantAddress => serializer.serialize_i32(1),
1296 Self::AppendPathToAddress => serializer.serialize_i32(2),
1297 Self::UnknownValue(u) => u.0.serialize(serializer),
1298 }
1299 }
1300 }
1301
1302 impl<'de> serde::de::Deserialize<'de> for PathTranslation {
1303 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1304 where
1305 D: serde::Deserializer<'de>,
1306 {
1307 deserializer.deserialize_any(wkt::internal::EnumVisitor::<PathTranslation>::new(
1308 ".google.api.BackendRule.PathTranslation",
1309 ))
1310 }
1311 }
1312
1313 /// Authentication settings used by the backend.
1314 ///
1315 /// These are typically used to provide service management functionality to
1316 /// a backend served on a publicly-routable URL. The `authentication`
1317 /// details should match the authentication behavior used by the backend.
1318 ///
1319 /// For example, specifying `jwt_audience` implies that the backend expects
1320 /// authentication via a JWT.
1321 ///
1322 /// When authentication is unspecified, the resulting behavior is the same
1323 /// as `disable_auth` set to `true`.
1324 ///
1325 /// Refer to <https://developers.google.com/identity/protocols/OpenIDConnect> for
1326 /// JWT ID token.
1327 #[derive(Clone, Debug, PartialEq)]
1328 #[non_exhaustive]
1329 pub enum Authentication {
1330 /// The JWT audience is used when generating a JWT ID token for the backend.
1331 /// This ID token will be added in the HTTP "authorization" header, and sent
1332 /// to the backend.
1333 JwtAudience(std::string::String),
1334 /// When disable_auth is true, a JWT ID token won't be generated and the
1335 /// original "Authorization" HTTP header will be preserved. If the header is
1336 /// used to carry the original token and is expected by the backend, this
1337 /// field must be set to true to preserve the header.
1338 DisableAuth(bool),
1339 }
1340}
1341
1342/// Billing related configuration of the service.
1343///
1344/// The following example shows how to configure monitored resources and metrics
1345/// for billing, `consumer_destinations` is the only supported destination and
1346/// the monitored resources need at least one label key
1347/// `cloud.googleapis.com/location` to indicate the location of the billing
1348/// usage, using different monitored resources between monitoring and billing is
1349/// recommended so they can be evolved independently:
1350///
1351/// ```norust
1352/// monitored_resources:
1353/// - type: library.googleapis.com/billing_branch
1354/// labels:
1355/// - key: cloud.googleapis.com/location
1356/// description: |
1357/// Predefined label to support billing location restriction.
1358/// - key: city
1359/// description: |
1360/// Custom label to define the city where the library branch is located
1361/// in.
1362/// - key: name
1363/// description: Custom label to define the name of the library branch.
1364/// metrics:
1365/// - name: library.googleapis.com/book/borrowed_count
1366/// metric_kind: DELTA
1367/// value_type: INT64
1368/// unit: "1"
1369/// billing:
1370/// consumer_destinations:
1371/// - monitored_resource: library.googleapis.com/billing_branch
1372/// metrics:
1373/// - library.googleapis.com/book/borrowed_count
1374/// ```
1375#[derive(Clone, Default, PartialEq)]
1376#[non_exhaustive]
1377pub struct Billing {
1378 /// Billing configurations for sending metrics to the consumer project.
1379 /// There can be multiple consumer destinations per service, each one must have
1380 /// a different monitored resource type. A metric can be used in at most
1381 /// one consumer destination.
1382 pub consumer_destinations: std::vec::Vec<crate::model::billing::BillingDestination>,
1383
1384 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1385}
1386
1387impl Billing {
1388 pub fn new() -> Self {
1389 std::default::Default::default()
1390 }
1391
1392 /// Sets the value of [consumer_destinations][crate::model::Billing::consumer_destinations].
1393 ///
1394 /// # Example
1395 /// ```ignore,no_run
1396 /// # use google_cloud_api::model::Billing;
1397 /// use google_cloud_api::model::billing::BillingDestination;
1398 /// let x = Billing::new()
1399 /// .set_consumer_destinations([
1400 /// BillingDestination::default()/* use setters */,
1401 /// BillingDestination::default()/* use (different) setters */,
1402 /// ]);
1403 /// ```
1404 pub fn set_consumer_destinations<T, V>(mut self, v: T) -> Self
1405 where
1406 T: std::iter::IntoIterator<Item = V>,
1407 V: std::convert::Into<crate::model::billing::BillingDestination>,
1408 {
1409 use std::iter::Iterator;
1410 self.consumer_destinations = v.into_iter().map(|i| i.into()).collect();
1411 self
1412 }
1413}
1414
1415impl wkt::message::Message for Billing {
1416 fn typename() -> &'static str {
1417 "type.googleapis.com/google.api.Billing"
1418 }
1419}
1420
1421/// Defines additional types related to [Billing].
1422pub mod billing {
1423 #[allow(unused_imports)]
1424 use super::*;
1425
1426 /// Configuration of a specific billing destination (Currently only support
1427 /// bill against consumer project).
1428 #[derive(Clone, Default, PartialEq)]
1429 #[non_exhaustive]
1430 pub struct BillingDestination {
1431 /// The monitored resource type. The type must be defined in
1432 /// [Service.monitored_resources][google.api.Service.monitored_resources]
1433 /// section.
1434 ///
1435 /// [google.api.Service.monitored_resources]: crate::model::Service::monitored_resources
1436 pub monitored_resource: std::string::String,
1437
1438 /// Names of the metrics to report to this billing destination.
1439 /// Each name must be defined in
1440 /// [Service.metrics][google.api.Service.metrics] section.
1441 ///
1442 /// [google.api.Service.metrics]: crate::model::Service::metrics
1443 pub metrics: std::vec::Vec<std::string::String>,
1444
1445 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1446 }
1447
1448 impl BillingDestination {
1449 pub fn new() -> Self {
1450 std::default::Default::default()
1451 }
1452
1453 /// Sets the value of [monitored_resource][crate::model::billing::BillingDestination::monitored_resource].
1454 ///
1455 /// # Example
1456 /// ```ignore,no_run
1457 /// # use google_cloud_api::model::billing::BillingDestination;
1458 /// let x = BillingDestination::new().set_monitored_resource("example");
1459 /// ```
1460 pub fn set_monitored_resource<T: std::convert::Into<std::string::String>>(
1461 mut self,
1462 v: T,
1463 ) -> Self {
1464 self.monitored_resource = v.into();
1465 self
1466 }
1467
1468 /// Sets the value of [metrics][crate::model::billing::BillingDestination::metrics].
1469 ///
1470 /// # Example
1471 /// ```ignore,no_run
1472 /// # use google_cloud_api::model::billing::BillingDestination;
1473 /// let x = BillingDestination::new().set_metrics(["a", "b", "c"]);
1474 /// ```
1475 pub fn set_metrics<T, V>(mut self, v: T) -> Self
1476 where
1477 T: std::iter::IntoIterator<Item = V>,
1478 V: std::convert::Into<std::string::String>,
1479 {
1480 use std::iter::Iterator;
1481 self.metrics = v.into_iter().map(|i| i.into()).collect();
1482 self
1483 }
1484 }
1485
1486 impl wkt::message::Message for BillingDestination {
1487 fn typename() -> &'static str {
1488 "type.googleapis.com/google.api.Billing.BillingDestination"
1489 }
1490 }
1491}
1492
1493/// Required information for every language.
1494#[derive(Clone, Default, PartialEq)]
1495#[non_exhaustive]
1496pub struct CommonLanguageSettings {
1497 /// Link to automatically generated reference documentation. Example:
1498 /// <https://cloud.google.com/nodejs/docs/reference/asset/latest>
1499 #[deprecated]
1500 pub reference_docs_uri: std::string::String,
1501
1502 /// The destination where API teams want this client library to be published.
1503 pub destinations: std::vec::Vec<crate::model::ClientLibraryDestination>,
1504
1505 /// Configuration for which RPCs should be generated in the GAPIC client.
1506 ///
1507 /// Note: This field should not be used in most cases.
1508 pub selective_gapic_generation: std::option::Option<crate::model::SelectiveGapicGeneration>,
1509
1510 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1511}
1512
1513impl CommonLanguageSettings {
1514 pub fn new() -> Self {
1515 std::default::Default::default()
1516 }
1517
1518 /// Sets the value of [reference_docs_uri][crate::model::CommonLanguageSettings::reference_docs_uri].
1519 ///
1520 /// # Example
1521 /// ```ignore,no_run
1522 /// # use google_cloud_api::model::CommonLanguageSettings;
1523 /// let x = CommonLanguageSettings::new().set_reference_docs_uri("example");
1524 /// ```
1525 #[deprecated]
1526 pub fn set_reference_docs_uri<T: std::convert::Into<std::string::String>>(
1527 mut self,
1528 v: T,
1529 ) -> Self {
1530 self.reference_docs_uri = v.into();
1531 self
1532 }
1533
1534 /// Sets the value of [destinations][crate::model::CommonLanguageSettings::destinations].
1535 ///
1536 /// # Example
1537 /// ```ignore,no_run
1538 /// # use google_cloud_api::model::CommonLanguageSettings;
1539 /// use google_cloud_api::model::ClientLibraryDestination;
1540 /// let x = CommonLanguageSettings::new().set_destinations([
1541 /// ClientLibraryDestination::Github,
1542 /// ClientLibraryDestination::PackageManager,
1543 /// ]);
1544 /// ```
1545 pub fn set_destinations<T, V>(mut self, v: T) -> Self
1546 where
1547 T: std::iter::IntoIterator<Item = V>,
1548 V: std::convert::Into<crate::model::ClientLibraryDestination>,
1549 {
1550 use std::iter::Iterator;
1551 self.destinations = v.into_iter().map(|i| i.into()).collect();
1552 self
1553 }
1554
1555 /// Sets the value of [selective_gapic_generation][crate::model::CommonLanguageSettings::selective_gapic_generation].
1556 ///
1557 /// # Example
1558 /// ```ignore,no_run
1559 /// # use google_cloud_api::model::CommonLanguageSettings;
1560 /// use google_cloud_api::model::SelectiveGapicGeneration;
1561 /// let x = CommonLanguageSettings::new().set_selective_gapic_generation(SelectiveGapicGeneration::default()/* use setters */);
1562 /// ```
1563 pub fn set_selective_gapic_generation<T>(mut self, v: T) -> Self
1564 where
1565 T: std::convert::Into<crate::model::SelectiveGapicGeneration>,
1566 {
1567 self.selective_gapic_generation = std::option::Option::Some(v.into());
1568 self
1569 }
1570
1571 /// Sets or clears the value of [selective_gapic_generation][crate::model::CommonLanguageSettings::selective_gapic_generation].
1572 ///
1573 /// # Example
1574 /// ```ignore,no_run
1575 /// # use google_cloud_api::model::CommonLanguageSettings;
1576 /// use google_cloud_api::model::SelectiveGapicGeneration;
1577 /// let x = CommonLanguageSettings::new().set_or_clear_selective_gapic_generation(Some(SelectiveGapicGeneration::default()/* use setters */));
1578 /// let x = CommonLanguageSettings::new().set_or_clear_selective_gapic_generation(None::<SelectiveGapicGeneration>);
1579 /// ```
1580 pub fn set_or_clear_selective_gapic_generation<T>(mut self, v: std::option::Option<T>) -> Self
1581 where
1582 T: std::convert::Into<crate::model::SelectiveGapicGeneration>,
1583 {
1584 self.selective_gapic_generation = v.map(|x| x.into());
1585 self
1586 }
1587}
1588
1589impl wkt::message::Message for CommonLanguageSettings {
1590 fn typename() -> &'static str {
1591 "type.googleapis.com/google.api.CommonLanguageSettings"
1592 }
1593}
1594
1595/// Details about how and where to publish client libraries.
1596#[derive(Clone, Default, PartialEq)]
1597#[non_exhaustive]
1598pub struct ClientLibrarySettings {
1599 /// Version of the API to apply these settings to. This is the full protobuf
1600 /// package for the API, ending in the version element.
1601 /// Examples: "google.cloud.speech.v1" and "google.spanner.admin.database.v1".
1602 pub version: std::string::String,
1603
1604 /// Launch stage of this version of the API.
1605 pub launch_stage: crate::model::LaunchStage,
1606
1607 /// When using transport=rest, the client request will encode enums as
1608 /// numbers rather than strings.
1609 pub rest_numeric_enums: bool,
1610
1611 /// Settings for legacy Java features, supported in the Service YAML.
1612 pub java_settings: std::option::Option<crate::model::JavaSettings>,
1613
1614 /// Settings for C++ client libraries.
1615 pub cpp_settings: std::option::Option<crate::model::CppSettings>,
1616
1617 /// Settings for PHP client libraries.
1618 pub php_settings: std::option::Option<crate::model::PhpSettings>,
1619
1620 /// Settings for Python client libraries.
1621 pub python_settings: std::option::Option<crate::model::PythonSettings>,
1622
1623 /// Settings for Node client libraries.
1624 pub node_settings: std::option::Option<crate::model::NodeSettings>,
1625
1626 /// Settings for .NET client libraries.
1627 pub dotnet_settings: std::option::Option<crate::model::DotnetSettings>,
1628
1629 /// Settings for Ruby client libraries.
1630 pub ruby_settings: std::option::Option<crate::model::RubySettings>,
1631
1632 /// Settings for Go client libraries.
1633 pub go_settings: std::option::Option<crate::model::GoSettings>,
1634
1635 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1636}
1637
1638impl ClientLibrarySettings {
1639 pub fn new() -> Self {
1640 std::default::Default::default()
1641 }
1642
1643 /// Sets the value of [version][crate::model::ClientLibrarySettings::version].
1644 ///
1645 /// # Example
1646 /// ```ignore,no_run
1647 /// # use google_cloud_api::model::ClientLibrarySettings;
1648 /// let x = ClientLibrarySettings::new().set_version("example");
1649 /// ```
1650 pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1651 self.version = v.into();
1652 self
1653 }
1654
1655 /// Sets the value of [launch_stage][crate::model::ClientLibrarySettings::launch_stage].
1656 ///
1657 /// # Example
1658 /// ```ignore,no_run
1659 /// # use google_cloud_api::model::ClientLibrarySettings;
1660 /// use google_cloud_api::model::LaunchStage;
1661 /// let x0 = ClientLibrarySettings::new().set_launch_stage(LaunchStage::Unimplemented);
1662 /// let x1 = ClientLibrarySettings::new().set_launch_stage(LaunchStage::Prelaunch);
1663 /// let x2 = ClientLibrarySettings::new().set_launch_stage(LaunchStage::EarlyAccess);
1664 /// ```
1665 pub fn set_launch_stage<T: std::convert::Into<crate::model::LaunchStage>>(
1666 mut self,
1667 v: T,
1668 ) -> Self {
1669 self.launch_stage = v.into();
1670 self
1671 }
1672
1673 /// Sets the value of [rest_numeric_enums][crate::model::ClientLibrarySettings::rest_numeric_enums].
1674 ///
1675 /// # Example
1676 /// ```ignore,no_run
1677 /// # use google_cloud_api::model::ClientLibrarySettings;
1678 /// let x = ClientLibrarySettings::new().set_rest_numeric_enums(true);
1679 /// ```
1680 pub fn set_rest_numeric_enums<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1681 self.rest_numeric_enums = v.into();
1682 self
1683 }
1684
1685 /// Sets the value of [java_settings][crate::model::ClientLibrarySettings::java_settings].
1686 ///
1687 /// # Example
1688 /// ```ignore,no_run
1689 /// # use google_cloud_api::model::ClientLibrarySettings;
1690 /// use google_cloud_api::model::JavaSettings;
1691 /// let x = ClientLibrarySettings::new().set_java_settings(JavaSettings::default()/* use setters */);
1692 /// ```
1693 pub fn set_java_settings<T>(mut self, v: T) -> Self
1694 where
1695 T: std::convert::Into<crate::model::JavaSettings>,
1696 {
1697 self.java_settings = std::option::Option::Some(v.into());
1698 self
1699 }
1700
1701 /// Sets or clears the value of [java_settings][crate::model::ClientLibrarySettings::java_settings].
1702 ///
1703 /// # Example
1704 /// ```ignore,no_run
1705 /// # use google_cloud_api::model::ClientLibrarySettings;
1706 /// use google_cloud_api::model::JavaSettings;
1707 /// let x = ClientLibrarySettings::new().set_or_clear_java_settings(Some(JavaSettings::default()/* use setters */));
1708 /// let x = ClientLibrarySettings::new().set_or_clear_java_settings(None::<JavaSettings>);
1709 /// ```
1710 pub fn set_or_clear_java_settings<T>(mut self, v: std::option::Option<T>) -> Self
1711 where
1712 T: std::convert::Into<crate::model::JavaSettings>,
1713 {
1714 self.java_settings = v.map(|x| x.into());
1715 self
1716 }
1717
1718 /// Sets the value of [cpp_settings][crate::model::ClientLibrarySettings::cpp_settings].
1719 ///
1720 /// # Example
1721 /// ```ignore,no_run
1722 /// # use google_cloud_api::model::ClientLibrarySettings;
1723 /// use google_cloud_api::model::CppSettings;
1724 /// let x = ClientLibrarySettings::new().set_cpp_settings(CppSettings::default()/* use setters */);
1725 /// ```
1726 pub fn set_cpp_settings<T>(mut self, v: T) -> Self
1727 where
1728 T: std::convert::Into<crate::model::CppSettings>,
1729 {
1730 self.cpp_settings = std::option::Option::Some(v.into());
1731 self
1732 }
1733
1734 /// Sets or clears the value of [cpp_settings][crate::model::ClientLibrarySettings::cpp_settings].
1735 ///
1736 /// # Example
1737 /// ```ignore,no_run
1738 /// # use google_cloud_api::model::ClientLibrarySettings;
1739 /// use google_cloud_api::model::CppSettings;
1740 /// let x = ClientLibrarySettings::new().set_or_clear_cpp_settings(Some(CppSettings::default()/* use setters */));
1741 /// let x = ClientLibrarySettings::new().set_or_clear_cpp_settings(None::<CppSettings>);
1742 /// ```
1743 pub fn set_or_clear_cpp_settings<T>(mut self, v: std::option::Option<T>) -> Self
1744 where
1745 T: std::convert::Into<crate::model::CppSettings>,
1746 {
1747 self.cpp_settings = v.map(|x| x.into());
1748 self
1749 }
1750
1751 /// Sets the value of [php_settings][crate::model::ClientLibrarySettings::php_settings].
1752 ///
1753 /// # Example
1754 /// ```ignore,no_run
1755 /// # use google_cloud_api::model::ClientLibrarySettings;
1756 /// use google_cloud_api::model::PhpSettings;
1757 /// let x = ClientLibrarySettings::new().set_php_settings(PhpSettings::default()/* use setters */);
1758 /// ```
1759 pub fn set_php_settings<T>(mut self, v: T) -> Self
1760 where
1761 T: std::convert::Into<crate::model::PhpSettings>,
1762 {
1763 self.php_settings = std::option::Option::Some(v.into());
1764 self
1765 }
1766
1767 /// Sets or clears the value of [php_settings][crate::model::ClientLibrarySettings::php_settings].
1768 ///
1769 /// # Example
1770 /// ```ignore,no_run
1771 /// # use google_cloud_api::model::ClientLibrarySettings;
1772 /// use google_cloud_api::model::PhpSettings;
1773 /// let x = ClientLibrarySettings::new().set_or_clear_php_settings(Some(PhpSettings::default()/* use setters */));
1774 /// let x = ClientLibrarySettings::new().set_or_clear_php_settings(None::<PhpSettings>);
1775 /// ```
1776 pub fn set_or_clear_php_settings<T>(mut self, v: std::option::Option<T>) -> Self
1777 where
1778 T: std::convert::Into<crate::model::PhpSettings>,
1779 {
1780 self.php_settings = v.map(|x| x.into());
1781 self
1782 }
1783
1784 /// Sets the value of [python_settings][crate::model::ClientLibrarySettings::python_settings].
1785 ///
1786 /// # Example
1787 /// ```ignore,no_run
1788 /// # use google_cloud_api::model::ClientLibrarySettings;
1789 /// use google_cloud_api::model::PythonSettings;
1790 /// let x = ClientLibrarySettings::new().set_python_settings(PythonSettings::default()/* use setters */);
1791 /// ```
1792 pub fn set_python_settings<T>(mut self, v: T) -> Self
1793 where
1794 T: std::convert::Into<crate::model::PythonSettings>,
1795 {
1796 self.python_settings = std::option::Option::Some(v.into());
1797 self
1798 }
1799
1800 /// Sets or clears the value of [python_settings][crate::model::ClientLibrarySettings::python_settings].
1801 ///
1802 /// # Example
1803 /// ```ignore,no_run
1804 /// # use google_cloud_api::model::ClientLibrarySettings;
1805 /// use google_cloud_api::model::PythonSettings;
1806 /// let x = ClientLibrarySettings::new().set_or_clear_python_settings(Some(PythonSettings::default()/* use setters */));
1807 /// let x = ClientLibrarySettings::new().set_or_clear_python_settings(None::<PythonSettings>);
1808 /// ```
1809 pub fn set_or_clear_python_settings<T>(mut self, v: std::option::Option<T>) -> Self
1810 where
1811 T: std::convert::Into<crate::model::PythonSettings>,
1812 {
1813 self.python_settings = v.map(|x| x.into());
1814 self
1815 }
1816
1817 /// Sets the value of [node_settings][crate::model::ClientLibrarySettings::node_settings].
1818 ///
1819 /// # Example
1820 /// ```ignore,no_run
1821 /// # use google_cloud_api::model::ClientLibrarySettings;
1822 /// use google_cloud_api::model::NodeSettings;
1823 /// let x = ClientLibrarySettings::new().set_node_settings(NodeSettings::default()/* use setters */);
1824 /// ```
1825 pub fn set_node_settings<T>(mut self, v: T) -> Self
1826 where
1827 T: std::convert::Into<crate::model::NodeSettings>,
1828 {
1829 self.node_settings = std::option::Option::Some(v.into());
1830 self
1831 }
1832
1833 /// Sets or clears the value of [node_settings][crate::model::ClientLibrarySettings::node_settings].
1834 ///
1835 /// # Example
1836 /// ```ignore,no_run
1837 /// # use google_cloud_api::model::ClientLibrarySettings;
1838 /// use google_cloud_api::model::NodeSettings;
1839 /// let x = ClientLibrarySettings::new().set_or_clear_node_settings(Some(NodeSettings::default()/* use setters */));
1840 /// let x = ClientLibrarySettings::new().set_or_clear_node_settings(None::<NodeSettings>);
1841 /// ```
1842 pub fn set_or_clear_node_settings<T>(mut self, v: std::option::Option<T>) -> Self
1843 where
1844 T: std::convert::Into<crate::model::NodeSettings>,
1845 {
1846 self.node_settings = v.map(|x| x.into());
1847 self
1848 }
1849
1850 /// Sets the value of [dotnet_settings][crate::model::ClientLibrarySettings::dotnet_settings].
1851 ///
1852 /// # Example
1853 /// ```ignore,no_run
1854 /// # use google_cloud_api::model::ClientLibrarySettings;
1855 /// use google_cloud_api::model::DotnetSettings;
1856 /// let x = ClientLibrarySettings::new().set_dotnet_settings(DotnetSettings::default()/* use setters */);
1857 /// ```
1858 pub fn set_dotnet_settings<T>(mut self, v: T) -> Self
1859 where
1860 T: std::convert::Into<crate::model::DotnetSettings>,
1861 {
1862 self.dotnet_settings = std::option::Option::Some(v.into());
1863 self
1864 }
1865
1866 /// Sets or clears the value of [dotnet_settings][crate::model::ClientLibrarySettings::dotnet_settings].
1867 ///
1868 /// # Example
1869 /// ```ignore,no_run
1870 /// # use google_cloud_api::model::ClientLibrarySettings;
1871 /// use google_cloud_api::model::DotnetSettings;
1872 /// let x = ClientLibrarySettings::new().set_or_clear_dotnet_settings(Some(DotnetSettings::default()/* use setters */));
1873 /// let x = ClientLibrarySettings::new().set_or_clear_dotnet_settings(None::<DotnetSettings>);
1874 /// ```
1875 pub fn set_or_clear_dotnet_settings<T>(mut self, v: std::option::Option<T>) -> Self
1876 where
1877 T: std::convert::Into<crate::model::DotnetSettings>,
1878 {
1879 self.dotnet_settings = v.map(|x| x.into());
1880 self
1881 }
1882
1883 /// Sets the value of [ruby_settings][crate::model::ClientLibrarySettings::ruby_settings].
1884 ///
1885 /// # Example
1886 /// ```ignore,no_run
1887 /// # use google_cloud_api::model::ClientLibrarySettings;
1888 /// use google_cloud_api::model::RubySettings;
1889 /// let x = ClientLibrarySettings::new().set_ruby_settings(RubySettings::default()/* use setters */);
1890 /// ```
1891 pub fn set_ruby_settings<T>(mut self, v: T) -> Self
1892 where
1893 T: std::convert::Into<crate::model::RubySettings>,
1894 {
1895 self.ruby_settings = std::option::Option::Some(v.into());
1896 self
1897 }
1898
1899 /// Sets or clears the value of [ruby_settings][crate::model::ClientLibrarySettings::ruby_settings].
1900 ///
1901 /// # Example
1902 /// ```ignore,no_run
1903 /// # use google_cloud_api::model::ClientLibrarySettings;
1904 /// use google_cloud_api::model::RubySettings;
1905 /// let x = ClientLibrarySettings::new().set_or_clear_ruby_settings(Some(RubySettings::default()/* use setters */));
1906 /// let x = ClientLibrarySettings::new().set_or_clear_ruby_settings(None::<RubySettings>);
1907 /// ```
1908 pub fn set_or_clear_ruby_settings<T>(mut self, v: std::option::Option<T>) -> Self
1909 where
1910 T: std::convert::Into<crate::model::RubySettings>,
1911 {
1912 self.ruby_settings = v.map(|x| x.into());
1913 self
1914 }
1915
1916 /// Sets the value of [go_settings][crate::model::ClientLibrarySettings::go_settings].
1917 ///
1918 /// # Example
1919 /// ```ignore,no_run
1920 /// # use google_cloud_api::model::ClientLibrarySettings;
1921 /// use google_cloud_api::model::GoSettings;
1922 /// let x = ClientLibrarySettings::new().set_go_settings(GoSettings::default()/* use setters */);
1923 /// ```
1924 pub fn set_go_settings<T>(mut self, v: T) -> Self
1925 where
1926 T: std::convert::Into<crate::model::GoSettings>,
1927 {
1928 self.go_settings = std::option::Option::Some(v.into());
1929 self
1930 }
1931
1932 /// Sets or clears the value of [go_settings][crate::model::ClientLibrarySettings::go_settings].
1933 ///
1934 /// # Example
1935 /// ```ignore,no_run
1936 /// # use google_cloud_api::model::ClientLibrarySettings;
1937 /// use google_cloud_api::model::GoSettings;
1938 /// let x = ClientLibrarySettings::new().set_or_clear_go_settings(Some(GoSettings::default()/* use setters */));
1939 /// let x = ClientLibrarySettings::new().set_or_clear_go_settings(None::<GoSettings>);
1940 /// ```
1941 pub fn set_or_clear_go_settings<T>(mut self, v: std::option::Option<T>) -> Self
1942 where
1943 T: std::convert::Into<crate::model::GoSettings>,
1944 {
1945 self.go_settings = v.map(|x| x.into());
1946 self
1947 }
1948}
1949
1950impl wkt::message::Message for ClientLibrarySettings {
1951 fn typename() -> &'static str {
1952 "type.googleapis.com/google.api.ClientLibrarySettings"
1953 }
1954}
1955
1956/// This message configures the settings for publishing [Google Cloud Client
1957/// libraries](https://cloud.google.com/apis/docs/cloud-client-libraries)
1958/// generated from the service config.
1959#[derive(Clone, Default, PartialEq)]
1960#[non_exhaustive]
1961pub struct Publishing {
1962 /// A list of API method settings, e.g. the behavior for methods that use the
1963 /// long-running operation pattern.
1964 pub method_settings: std::vec::Vec<crate::model::MethodSettings>,
1965
1966 /// Link to a *public* URI where users can report issues. Example:
1967 /// <https://issuetracker.google.com/issues/new?component=190865&template=1161103>
1968 pub new_issue_uri: std::string::String,
1969
1970 /// Link to product home page. Example:
1971 /// <https://cloud.google.com/asset-inventory/docs/overview>
1972 pub documentation_uri: std::string::String,
1973
1974 /// Used as a tracking tag when collecting data about the APIs developer
1975 /// relations artifacts like docs, packages delivered to package managers,
1976 /// etc. Example: "speech".
1977 pub api_short_name: std::string::String,
1978
1979 /// GitHub label to apply to issues and pull requests opened for this API.
1980 pub github_label: std::string::String,
1981
1982 /// GitHub teams to be added to CODEOWNERS in the directory in GitHub
1983 /// containing source code for the client libraries for this API.
1984 pub codeowner_github_teams: std::vec::Vec<std::string::String>,
1985
1986 /// A prefix used in sample code when demarking regions to be included in
1987 /// documentation.
1988 pub doc_tag_prefix: std::string::String,
1989
1990 /// For whom the client library is being published.
1991 pub organization: crate::model::ClientLibraryOrganization,
1992
1993 /// Client library settings. If the same version string appears multiple
1994 /// times in this list, then the last one wins. Settings from earlier
1995 /// settings with the same version string are discarded.
1996 pub library_settings: std::vec::Vec<crate::model::ClientLibrarySettings>,
1997
1998 /// Optional link to proto reference documentation. Example:
1999 /// <https://cloud.google.com/pubsub/lite/docs/reference/rpc>
2000 pub proto_reference_documentation_uri: std::string::String,
2001
2002 /// Optional link to REST reference documentation. Example:
2003 /// <https://cloud.google.com/pubsub/lite/docs/reference/rest>
2004 pub rest_reference_documentation_uri: std::string::String,
2005
2006 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2007}
2008
2009impl Publishing {
2010 pub fn new() -> Self {
2011 std::default::Default::default()
2012 }
2013
2014 /// Sets the value of [method_settings][crate::model::Publishing::method_settings].
2015 ///
2016 /// # Example
2017 /// ```ignore,no_run
2018 /// # use google_cloud_api::model::Publishing;
2019 /// use google_cloud_api::model::MethodSettings;
2020 /// let x = Publishing::new()
2021 /// .set_method_settings([
2022 /// MethodSettings::default()/* use setters */,
2023 /// MethodSettings::default()/* use (different) setters */,
2024 /// ]);
2025 /// ```
2026 pub fn set_method_settings<T, V>(mut self, v: T) -> Self
2027 where
2028 T: std::iter::IntoIterator<Item = V>,
2029 V: std::convert::Into<crate::model::MethodSettings>,
2030 {
2031 use std::iter::Iterator;
2032 self.method_settings = v.into_iter().map(|i| i.into()).collect();
2033 self
2034 }
2035
2036 /// Sets the value of [new_issue_uri][crate::model::Publishing::new_issue_uri].
2037 ///
2038 /// # Example
2039 /// ```ignore,no_run
2040 /// # use google_cloud_api::model::Publishing;
2041 /// let x = Publishing::new().set_new_issue_uri("example");
2042 /// ```
2043 pub fn set_new_issue_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2044 self.new_issue_uri = v.into();
2045 self
2046 }
2047
2048 /// Sets the value of [documentation_uri][crate::model::Publishing::documentation_uri].
2049 ///
2050 /// # Example
2051 /// ```ignore,no_run
2052 /// # use google_cloud_api::model::Publishing;
2053 /// let x = Publishing::new().set_documentation_uri("example");
2054 /// ```
2055 pub fn set_documentation_uri<T: std::convert::Into<std::string::String>>(
2056 mut self,
2057 v: T,
2058 ) -> Self {
2059 self.documentation_uri = v.into();
2060 self
2061 }
2062
2063 /// Sets the value of [api_short_name][crate::model::Publishing::api_short_name].
2064 ///
2065 /// # Example
2066 /// ```ignore,no_run
2067 /// # use google_cloud_api::model::Publishing;
2068 /// let x = Publishing::new().set_api_short_name("example");
2069 /// ```
2070 pub fn set_api_short_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2071 self.api_short_name = v.into();
2072 self
2073 }
2074
2075 /// Sets the value of [github_label][crate::model::Publishing::github_label].
2076 ///
2077 /// # Example
2078 /// ```ignore,no_run
2079 /// # use google_cloud_api::model::Publishing;
2080 /// let x = Publishing::new().set_github_label("example");
2081 /// ```
2082 pub fn set_github_label<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2083 self.github_label = v.into();
2084 self
2085 }
2086
2087 /// Sets the value of [codeowner_github_teams][crate::model::Publishing::codeowner_github_teams].
2088 ///
2089 /// # Example
2090 /// ```ignore,no_run
2091 /// # use google_cloud_api::model::Publishing;
2092 /// let x = Publishing::new().set_codeowner_github_teams(["a", "b", "c"]);
2093 /// ```
2094 pub fn set_codeowner_github_teams<T, V>(mut self, v: T) -> Self
2095 where
2096 T: std::iter::IntoIterator<Item = V>,
2097 V: std::convert::Into<std::string::String>,
2098 {
2099 use std::iter::Iterator;
2100 self.codeowner_github_teams = v.into_iter().map(|i| i.into()).collect();
2101 self
2102 }
2103
2104 /// Sets the value of [doc_tag_prefix][crate::model::Publishing::doc_tag_prefix].
2105 ///
2106 /// # Example
2107 /// ```ignore,no_run
2108 /// # use google_cloud_api::model::Publishing;
2109 /// let x = Publishing::new().set_doc_tag_prefix("example");
2110 /// ```
2111 pub fn set_doc_tag_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2112 self.doc_tag_prefix = v.into();
2113 self
2114 }
2115
2116 /// Sets the value of [organization][crate::model::Publishing::organization].
2117 ///
2118 /// # Example
2119 /// ```ignore,no_run
2120 /// # use google_cloud_api::model::Publishing;
2121 /// use google_cloud_api::model::ClientLibraryOrganization;
2122 /// let x0 = Publishing::new().set_organization(ClientLibraryOrganization::Cloud);
2123 /// let x1 = Publishing::new().set_organization(ClientLibraryOrganization::Ads);
2124 /// let x2 = Publishing::new().set_organization(ClientLibraryOrganization::Photos);
2125 /// ```
2126 pub fn set_organization<T: std::convert::Into<crate::model::ClientLibraryOrganization>>(
2127 mut self,
2128 v: T,
2129 ) -> Self {
2130 self.organization = v.into();
2131 self
2132 }
2133
2134 /// Sets the value of [library_settings][crate::model::Publishing::library_settings].
2135 ///
2136 /// # Example
2137 /// ```ignore,no_run
2138 /// # use google_cloud_api::model::Publishing;
2139 /// use google_cloud_api::model::ClientLibrarySettings;
2140 /// let x = Publishing::new()
2141 /// .set_library_settings([
2142 /// ClientLibrarySettings::default()/* use setters */,
2143 /// ClientLibrarySettings::default()/* use (different) setters */,
2144 /// ]);
2145 /// ```
2146 pub fn set_library_settings<T, V>(mut self, v: T) -> Self
2147 where
2148 T: std::iter::IntoIterator<Item = V>,
2149 V: std::convert::Into<crate::model::ClientLibrarySettings>,
2150 {
2151 use std::iter::Iterator;
2152 self.library_settings = v.into_iter().map(|i| i.into()).collect();
2153 self
2154 }
2155
2156 /// Sets the value of [proto_reference_documentation_uri][crate::model::Publishing::proto_reference_documentation_uri].
2157 ///
2158 /// # Example
2159 /// ```ignore,no_run
2160 /// # use google_cloud_api::model::Publishing;
2161 /// let x = Publishing::new().set_proto_reference_documentation_uri("example");
2162 /// ```
2163 pub fn set_proto_reference_documentation_uri<T: std::convert::Into<std::string::String>>(
2164 mut self,
2165 v: T,
2166 ) -> Self {
2167 self.proto_reference_documentation_uri = v.into();
2168 self
2169 }
2170
2171 /// Sets the value of [rest_reference_documentation_uri][crate::model::Publishing::rest_reference_documentation_uri].
2172 ///
2173 /// # Example
2174 /// ```ignore,no_run
2175 /// # use google_cloud_api::model::Publishing;
2176 /// let x = Publishing::new().set_rest_reference_documentation_uri("example");
2177 /// ```
2178 pub fn set_rest_reference_documentation_uri<T: std::convert::Into<std::string::String>>(
2179 mut self,
2180 v: T,
2181 ) -> Self {
2182 self.rest_reference_documentation_uri = v.into();
2183 self
2184 }
2185}
2186
2187impl wkt::message::Message for Publishing {
2188 fn typename() -> &'static str {
2189 "type.googleapis.com/google.api.Publishing"
2190 }
2191}
2192
2193/// Settings for Java client libraries.
2194#[derive(Clone, Default, PartialEq)]
2195#[non_exhaustive]
2196pub struct JavaSettings {
2197 /// The package name to use in Java. Clobbers the java_package option
2198 /// set in the protobuf. This should be used **only** by APIs
2199 /// who have already set the language_settings.java.package_name" field
2200 /// in gapic.yaml. API teams should use the protobuf java_package option
2201 /// where possible.
2202 ///
2203 /// Example of a YAML configuration::
2204 ///
2205 /// ```norust
2206 /// publishing:
2207 /// library_settings:
2208 /// java_settings:
2209 /// library_package: com.google.cloud.pubsub.v1
2210 /// ```
2211 pub library_package: std::string::String,
2212
2213 /// Configure the Java class name to use instead of the service's for its
2214 /// corresponding generated GAPIC client. Keys are fully-qualified
2215 /// service names as they appear in the protobuf (including the full
2216 /// the language_settings.java.interface_names" field in gapic.yaml. API
2217 /// teams should otherwise use the service name as it appears in the
2218 /// protobuf.
2219 ///
2220 /// Example of a YAML configuration::
2221 ///
2222 /// ```norust
2223 /// publishing:
2224 /// java_settings:
2225 /// service_class_names:
2226 /// - google.pubsub.v1.Publisher: TopicAdmin
2227 /// - google.pubsub.v1.Subscriber: SubscriptionAdmin
2228 /// ```
2229 pub service_class_names: std::collections::HashMap<std::string::String, std::string::String>,
2230
2231 /// Some settings.
2232 pub common: std::option::Option<crate::model::CommonLanguageSettings>,
2233
2234 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2235}
2236
2237impl JavaSettings {
2238 pub fn new() -> Self {
2239 std::default::Default::default()
2240 }
2241
2242 /// Sets the value of [library_package][crate::model::JavaSettings::library_package].
2243 ///
2244 /// # Example
2245 /// ```ignore,no_run
2246 /// # use google_cloud_api::model::JavaSettings;
2247 /// let x = JavaSettings::new().set_library_package("example");
2248 /// ```
2249 pub fn set_library_package<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2250 self.library_package = v.into();
2251 self
2252 }
2253
2254 /// Sets the value of [service_class_names][crate::model::JavaSettings::service_class_names].
2255 ///
2256 /// # Example
2257 /// ```ignore,no_run
2258 /// # use google_cloud_api::model::JavaSettings;
2259 /// let x = JavaSettings::new().set_service_class_names([
2260 /// ("key0", "abc"),
2261 /// ("key1", "xyz"),
2262 /// ]);
2263 /// ```
2264 pub fn set_service_class_names<T, K, V>(mut self, v: T) -> Self
2265 where
2266 T: std::iter::IntoIterator<Item = (K, V)>,
2267 K: std::convert::Into<std::string::String>,
2268 V: std::convert::Into<std::string::String>,
2269 {
2270 use std::iter::Iterator;
2271 self.service_class_names = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2272 self
2273 }
2274
2275 /// Sets the value of [common][crate::model::JavaSettings::common].
2276 ///
2277 /// # Example
2278 /// ```ignore,no_run
2279 /// # use google_cloud_api::model::JavaSettings;
2280 /// use google_cloud_api::model::CommonLanguageSettings;
2281 /// let x = JavaSettings::new().set_common(CommonLanguageSettings::default()/* use setters */);
2282 /// ```
2283 pub fn set_common<T>(mut self, v: T) -> Self
2284 where
2285 T: std::convert::Into<crate::model::CommonLanguageSettings>,
2286 {
2287 self.common = std::option::Option::Some(v.into());
2288 self
2289 }
2290
2291 /// Sets or clears the value of [common][crate::model::JavaSettings::common].
2292 ///
2293 /// # Example
2294 /// ```ignore,no_run
2295 /// # use google_cloud_api::model::JavaSettings;
2296 /// use google_cloud_api::model::CommonLanguageSettings;
2297 /// let x = JavaSettings::new().set_or_clear_common(Some(CommonLanguageSettings::default()/* use setters */));
2298 /// let x = JavaSettings::new().set_or_clear_common(None::<CommonLanguageSettings>);
2299 /// ```
2300 pub fn set_or_clear_common<T>(mut self, v: std::option::Option<T>) -> Self
2301 where
2302 T: std::convert::Into<crate::model::CommonLanguageSettings>,
2303 {
2304 self.common = v.map(|x| x.into());
2305 self
2306 }
2307}
2308
2309impl wkt::message::Message for JavaSettings {
2310 fn typename() -> &'static str {
2311 "type.googleapis.com/google.api.JavaSettings"
2312 }
2313}
2314
2315/// Settings for C++ client libraries.
2316#[derive(Clone, Default, PartialEq)]
2317#[non_exhaustive]
2318pub struct CppSettings {
2319 /// Some settings.
2320 pub common: std::option::Option<crate::model::CommonLanguageSettings>,
2321
2322 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2323}
2324
2325impl CppSettings {
2326 pub fn new() -> Self {
2327 std::default::Default::default()
2328 }
2329
2330 /// Sets the value of [common][crate::model::CppSettings::common].
2331 ///
2332 /// # Example
2333 /// ```ignore,no_run
2334 /// # use google_cloud_api::model::CppSettings;
2335 /// use google_cloud_api::model::CommonLanguageSettings;
2336 /// let x = CppSettings::new().set_common(CommonLanguageSettings::default()/* use setters */);
2337 /// ```
2338 pub fn set_common<T>(mut self, v: T) -> Self
2339 where
2340 T: std::convert::Into<crate::model::CommonLanguageSettings>,
2341 {
2342 self.common = std::option::Option::Some(v.into());
2343 self
2344 }
2345
2346 /// Sets or clears the value of [common][crate::model::CppSettings::common].
2347 ///
2348 /// # Example
2349 /// ```ignore,no_run
2350 /// # use google_cloud_api::model::CppSettings;
2351 /// use google_cloud_api::model::CommonLanguageSettings;
2352 /// let x = CppSettings::new().set_or_clear_common(Some(CommonLanguageSettings::default()/* use setters */));
2353 /// let x = CppSettings::new().set_or_clear_common(None::<CommonLanguageSettings>);
2354 /// ```
2355 pub fn set_or_clear_common<T>(mut self, v: std::option::Option<T>) -> Self
2356 where
2357 T: std::convert::Into<crate::model::CommonLanguageSettings>,
2358 {
2359 self.common = v.map(|x| x.into());
2360 self
2361 }
2362}
2363
2364impl wkt::message::Message for CppSettings {
2365 fn typename() -> &'static str {
2366 "type.googleapis.com/google.api.CppSettings"
2367 }
2368}
2369
2370/// Settings for Php client libraries.
2371#[derive(Clone, Default, PartialEq)]
2372#[non_exhaustive]
2373pub struct PhpSettings {
2374 /// Some settings.
2375 pub common: std::option::Option<crate::model::CommonLanguageSettings>,
2376
2377 /// The package name to use in Php. Clobbers the php_namespace option
2378 /// set in the protobuf. This should be used **only** by APIs
2379 /// who have already set the language_settings.php.package_name" field
2380 /// in gapic.yaml. API teams should use the protobuf php_namespace option
2381 /// where possible.
2382 ///
2383 /// Example of a YAML configuration::
2384 ///
2385 /// ```norust
2386 /// publishing:
2387 /// library_settings:
2388 /// php_settings:
2389 /// library_package: Google\Cloud\PubSub\V1
2390 /// ```
2391 pub library_package: std::string::String,
2392
2393 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2394}
2395
2396impl PhpSettings {
2397 pub fn new() -> Self {
2398 std::default::Default::default()
2399 }
2400
2401 /// Sets the value of [common][crate::model::PhpSettings::common].
2402 ///
2403 /// # Example
2404 /// ```ignore,no_run
2405 /// # use google_cloud_api::model::PhpSettings;
2406 /// use google_cloud_api::model::CommonLanguageSettings;
2407 /// let x = PhpSettings::new().set_common(CommonLanguageSettings::default()/* use setters */);
2408 /// ```
2409 pub fn set_common<T>(mut self, v: T) -> Self
2410 where
2411 T: std::convert::Into<crate::model::CommonLanguageSettings>,
2412 {
2413 self.common = std::option::Option::Some(v.into());
2414 self
2415 }
2416
2417 /// Sets or clears the value of [common][crate::model::PhpSettings::common].
2418 ///
2419 /// # Example
2420 /// ```ignore,no_run
2421 /// # use google_cloud_api::model::PhpSettings;
2422 /// use google_cloud_api::model::CommonLanguageSettings;
2423 /// let x = PhpSettings::new().set_or_clear_common(Some(CommonLanguageSettings::default()/* use setters */));
2424 /// let x = PhpSettings::new().set_or_clear_common(None::<CommonLanguageSettings>);
2425 /// ```
2426 pub fn set_or_clear_common<T>(mut self, v: std::option::Option<T>) -> Self
2427 where
2428 T: std::convert::Into<crate::model::CommonLanguageSettings>,
2429 {
2430 self.common = v.map(|x| x.into());
2431 self
2432 }
2433
2434 /// Sets the value of [library_package][crate::model::PhpSettings::library_package].
2435 ///
2436 /// # Example
2437 /// ```ignore,no_run
2438 /// # use google_cloud_api::model::PhpSettings;
2439 /// let x = PhpSettings::new().set_library_package("example");
2440 /// ```
2441 pub fn set_library_package<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2442 self.library_package = v.into();
2443 self
2444 }
2445}
2446
2447impl wkt::message::Message for PhpSettings {
2448 fn typename() -> &'static str {
2449 "type.googleapis.com/google.api.PhpSettings"
2450 }
2451}
2452
2453/// Settings for Python client libraries.
2454#[derive(Clone, Default, PartialEq)]
2455#[non_exhaustive]
2456pub struct PythonSettings {
2457 /// Some settings.
2458 pub common: std::option::Option<crate::model::CommonLanguageSettings>,
2459
2460 /// Experimental features to be included during client library generation.
2461 pub experimental_features:
2462 std::option::Option<crate::model::python_settings::ExperimentalFeatures>,
2463
2464 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2465}
2466
2467impl PythonSettings {
2468 pub fn new() -> Self {
2469 std::default::Default::default()
2470 }
2471
2472 /// Sets the value of [common][crate::model::PythonSettings::common].
2473 ///
2474 /// # Example
2475 /// ```ignore,no_run
2476 /// # use google_cloud_api::model::PythonSettings;
2477 /// use google_cloud_api::model::CommonLanguageSettings;
2478 /// let x = PythonSettings::new().set_common(CommonLanguageSettings::default()/* use setters */);
2479 /// ```
2480 pub fn set_common<T>(mut self, v: T) -> Self
2481 where
2482 T: std::convert::Into<crate::model::CommonLanguageSettings>,
2483 {
2484 self.common = std::option::Option::Some(v.into());
2485 self
2486 }
2487
2488 /// Sets or clears the value of [common][crate::model::PythonSettings::common].
2489 ///
2490 /// # Example
2491 /// ```ignore,no_run
2492 /// # use google_cloud_api::model::PythonSettings;
2493 /// use google_cloud_api::model::CommonLanguageSettings;
2494 /// let x = PythonSettings::new().set_or_clear_common(Some(CommonLanguageSettings::default()/* use setters */));
2495 /// let x = PythonSettings::new().set_or_clear_common(None::<CommonLanguageSettings>);
2496 /// ```
2497 pub fn set_or_clear_common<T>(mut self, v: std::option::Option<T>) -> Self
2498 where
2499 T: std::convert::Into<crate::model::CommonLanguageSettings>,
2500 {
2501 self.common = v.map(|x| x.into());
2502 self
2503 }
2504
2505 /// Sets the value of [experimental_features][crate::model::PythonSettings::experimental_features].
2506 ///
2507 /// # Example
2508 /// ```ignore,no_run
2509 /// # use google_cloud_api::model::PythonSettings;
2510 /// use google_cloud_api::model::python_settings::ExperimentalFeatures;
2511 /// let x = PythonSettings::new().set_experimental_features(ExperimentalFeatures::default()/* use setters */);
2512 /// ```
2513 pub fn set_experimental_features<T>(mut self, v: T) -> Self
2514 where
2515 T: std::convert::Into<crate::model::python_settings::ExperimentalFeatures>,
2516 {
2517 self.experimental_features = std::option::Option::Some(v.into());
2518 self
2519 }
2520
2521 /// Sets or clears the value of [experimental_features][crate::model::PythonSettings::experimental_features].
2522 ///
2523 /// # Example
2524 /// ```ignore,no_run
2525 /// # use google_cloud_api::model::PythonSettings;
2526 /// use google_cloud_api::model::python_settings::ExperimentalFeatures;
2527 /// let x = PythonSettings::new().set_or_clear_experimental_features(Some(ExperimentalFeatures::default()/* use setters */));
2528 /// let x = PythonSettings::new().set_or_clear_experimental_features(None::<ExperimentalFeatures>);
2529 /// ```
2530 pub fn set_or_clear_experimental_features<T>(mut self, v: std::option::Option<T>) -> Self
2531 where
2532 T: std::convert::Into<crate::model::python_settings::ExperimentalFeatures>,
2533 {
2534 self.experimental_features = v.map(|x| x.into());
2535 self
2536 }
2537}
2538
2539impl wkt::message::Message for PythonSettings {
2540 fn typename() -> &'static str {
2541 "type.googleapis.com/google.api.PythonSettings"
2542 }
2543}
2544
2545/// Defines additional types related to [PythonSettings].
2546pub mod python_settings {
2547 #[allow(unused_imports)]
2548 use super::*;
2549
2550 /// Experimental features to be included during client library generation.
2551 /// These fields will be deprecated once the feature graduates and is enabled
2552 /// by default.
2553 #[derive(Clone, Default, PartialEq)]
2554 #[non_exhaustive]
2555 pub struct ExperimentalFeatures {
2556 /// Enables generation of asynchronous REST clients if `rest` transport is
2557 /// enabled. By default, asynchronous REST clients will not be generated.
2558 /// This feature will be enabled by default 1 month after launching the
2559 /// feature in preview packages.
2560 pub rest_async_io_enabled: bool,
2561
2562 /// Enables generation of protobuf code using new types that are more
2563 /// Pythonic which are included in `protobuf>=5.29.x`. This feature will be
2564 /// enabled by default 1 month after launching the feature in preview
2565 /// packages.
2566 pub protobuf_pythonic_types_enabled: bool,
2567
2568 /// Disables generation of an unversioned Python package for this client
2569 /// library. This means that the module names will need to be versioned in
2570 /// import statements. For example `import google.cloud.library_v2` instead
2571 /// of `import google.cloud.library`.
2572 pub unversioned_package_disabled: bool,
2573
2574 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2575 }
2576
2577 impl ExperimentalFeatures {
2578 pub fn new() -> Self {
2579 std::default::Default::default()
2580 }
2581
2582 /// Sets the value of [rest_async_io_enabled][crate::model::python_settings::ExperimentalFeatures::rest_async_io_enabled].
2583 ///
2584 /// # Example
2585 /// ```ignore,no_run
2586 /// # use google_cloud_api::model::python_settings::ExperimentalFeatures;
2587 /// let x = ExperimentalFeatures::new().set_rest_async_io_enabled(true);
2588 /// ```
2589 pub fn set_rest_async_io_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2590 self.rest_async_io_enabled = v.into();
2591 self
2592 }
2593
2594 /// Sets the value of [protobuf_pythonic_types_enabled][crate::model::python_settings::ExperimentalFeatures::protobuf_pythonic_types_enabled].
2595 ///
2596 /// # Example
2597 /// ```ignore,no_run
2598 /// # use google_cloud_api::model::python_settings::ExperimentalFeatures;
2599 /// let x = ExperimentalFeatures::new().set_protobuf_pythonic_types_enabled(true);
2600 /// ```
2601 pub fn set_protobuf_pythonic_types_enabled<T: std::convert::Into<bool>>(
2602 mut self,
2603 v: T,
2604 ) -> Self {
2605 self.protobuf_pythonic_types_enabled = v.into();
2606 self
2607 }
2608
2609 /// Sets the value of [unversioned_package_disabled][crate::model::python_settings::ExperimentalFeatures::unversioned_package_disabled].
2610 ///
2611 /// # Example
2612 /// ```ignore,no_run
2613 /// # use google_cloud_api::model::python_settings::ExperimentalFeatures;
2614 /// let x = ExperimentalFeatures::new().set_unversioned_package_disabled(true);
2615 /// ```
2616 pub fn set_unversioned_package_disabled<T: std::convert::Into<bool>>(
2617 mut self,
2618 v: T,
2619 ) -> Self {
2620 self.unversioned_package_disabled = v.into();
2621 self
2622 }
2623 }
2624
2625 impl wkt::message::Message for ExperimentalFeatures {
2626 fn typename() -> &'static str {
2627 "type.googleapis.com/google.api.PythonSettings.ExperimentalFeatures"
2628 }
2629 }
2630}
2631
2632/// Settings for Node client libraries.
2633#[derive(Clone, Default, PartialEq)]
2634#[non_exhaustive]
2635pub struct NodeSettings {
2636 /// Some settings.
2637 pub common: std::option::Option<crate::model::CommonLanguageSettings>,
2638
2639 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2640}
2641
2642impl NodeSettings {
2643 pub fn new() -> Self {
2644 std::default::Default::default()
2645 }
2646
2647 /// Sets the value of [common][crate::model::NodeSettings::common].
2648 ///
2649 /// # Example
2650 /// ```ignore,no_run
2651 /// # use google_cloud_api::model::NodeSettings;
2652 /// use google_cloud_api::model::CommonLanguageSettings;
2653 /// let x = NodeSettings::new().set_common(CommonLanguageSettings::default()/* use setters */);
2654 /// ```
2655 pub fn set_common<T>(mut self, v: T) -> Self
2656 where
2657 T: std::convert::Into<crate::model::CommonLanguageSettings>,
2658 {
2659 self.common = std::option::Option::Some(v.into());
2660 self
2661 }
2662
2663 /// Sets or clears the value of [common][crate::model::NodeSettings::common].
2664 ///
2665 /// # Example
2666 /// ```ignore,no_run
2667 /// # use google_cloud_api::model::NodeSettings;
2668 /// use google_cloud_api::model::CommonLanguageSettings;
2669 /// let x = NodeSettings::new().set_or_clear_common(Some(CommonLanguageSettings::default()/* use setters */));
2670 /// let x = NodeSettings::new().set_or_clear_common(None::<CommonLanguageSettings>);
2671 /// ```
2672 pub fn set_or_clear_common<T>(mut self, v: std::option::Option<T>) -> Self
2673 where
2674 T: std::convert::Into<crate::model::CommonLanguageSettings>,
2675 {
2676 self.common = v.map(|x| x.into());
2677 self
2678 }
2679}
2680
2681impl wkt::message::Message for NodeSettings {
2682 fn typename() -> &'static str {
2683 "type.googleapis.com/google.api.NodeSettings"
2684 }
2685}
2686
2687/// Settings for Dotnet client libraries.
2688#[derive(Clone, Default, PartialEq)]
2689#[non_exhaustive]
2690pub struct DotnetSettings {
2691 /// Some settings.
2692 pub common: std::option::Option<crate::model::CommonLanguageSettings>,
2693
2694 /// Map from original service names to renamed versions.
2695 /// This is used when the default generated types
2696 /// would cause a naming conflict. (Neither name is
2697 /// fully-qualified.)
2698 /// Example: Subscriber to SubscriberServiceApi.
2699 pub renamed_services: std::collections::HashMap<std::string::String, std::string::String>,
2700
2701 /// Map from full resource types to the effective short name
2702 /// for the resource. This is used when otherwise resource
2703 /// named from different services would cause naming collisions.
2704 /// Example entry:
2705 /// "datalabeling.googleapis.com/Dataset": "DataLabelingDataset"
2706 pub renamed_resources: std::collections::HashMap<std::string::String, std::string::String>,
2707
2708 /// List of full resource types to ignore during generation.
2709 /// This is typically used for API-specific Location resources,
2710 /// which should be handled by the generator as if they were actually
2711 /// the common Location resources.
2712 /// Example entry: "documentai.googleapis.com/Location"
2713 pub ignored_resources: std::vec::Vec<std::string::String>,
2714
2715 /// Namespaces which must be aliased in snippets due to
2716 /// a known (but non-generator-predictable) naming collision
2717 pub forced_namespace_aliases: std::vec::Vec<std::string::String>,
2718
2719 /// Method signatures (in the form "service.method(signature)")
2720 /// which are provided separately, so shouldn't be generated.
2721 /// Snippets *calling* these methods are still generated, however.
2722 pub handwritten_signatures: std::vec::Vec<std::string::String>,
2723
2724 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2725}
2726
2727impl DotnetSettings {
2728 pub fn new() -> Self {
2729 std::default::Default::default()
2730 }
2731
2732 /// Sets the value of [common][crate::model::DotnetSettings::common].
2733 ///
2734 /// # Example
2735 /// ```ignore,no_run
2736 /// # use google_cloud_api::model::DotnetSettings;
2737 /// use google_cloud_api::model::CommonLanguageSettings;
2738 /// let x = DotnetSettings::new().set_common(CommonLanguageSettings::default()/* use setters */);
2739 /// ```
2740 pub fn set_common<T>(mut self, v: T) -> Self
2741 where
2742 T: std::convert::Into<crate::model::CommonLanguageSettings>,
2743 {
2744 self.common = std::option::Option::Some(v.into());
2745 self
2746 }
2747
2748 /// Sets or clears the value of [common][crate::model::DotnetSettings::common].
2749 ///
2750 /// # Example
2751 /// ```ignore,no_run
2752 /// # use google_cloud_api::model::DotnetSettings;
2753 /// use google_cloud_api::model::CommonLanguageSettings;
2754 /// let x = DotnetSettings::new().set_or_clear_common(Some(CommonLanguageSettings::default()/* use setters */));
2755 /// let x = DotnetSettings::new().set_or_clear_common(None::<CommonLanguageSettings>);
2756 /// ```
2757 pub fn set_or_clear_common<T>(mut self, v: std::option::Option<T>) -> Self
2758 where
2759 T: std::convert::Into<crate::model::CommonLanguageSettings>,
2760 {
2761 self.common = v.map(|x| x.into());
2762 self
2763 }
2764
2765 /// Sets the value of [renamed_services][crate::model::DotnetSettings::renamed_services].
2766 ///
2767 /// # Example
2768 /// ```ignore,no_run
2769 /// # use google_cloud_api::model::DotnetSettings;
2770 /// let x = DotnetSettings::new().set_renamed_services([
2771 /// ("key0", "abc"),
2772 /// ("key1", "xyz"),
2773 /// ]);
2774 /// ```
2775 pub fn set_renamed_services<T, K, V>(mut self, v: T) -> Self
2776 where
2777 T: std::iter::IntoIterator<Item = (K, V)>,
2778 K: std::convert::Into<std::string::String>,
2779 V: std::convert::Into<std::string::String>,
2780 {
2781 use std::iter::Iterator;
2782 self.renamed_services = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2783 self
2784 }
2785
2786 /// Sets the value of [renamed_resources][crate::model::DotnetSettings::renamed_resources].
2787 ///
2788 /// # Example
2789 /// ```ignore,no_run
2790 /// # use google_cloud_api::model::DotnetSettings;
2791 /// let x = DotnetSettings::new().set_renamed_resources([
2792 /// ("key0", "abc"),
2793 /// ("key1", "xyz"),
2794 /// ]);
2795 /// ```
2796 pub fn set_renamed_resources<T, K, V>(mut self, v: T) -> Self
2797 where
2798 T: std::iter::IntoIterator<Item = (K, V)>,
2799 K: std::convert::Into<std::string::String>,
2800 V: std::convert::Into<std::string::String>,
2801 {
2802 use std::iter::Iterator;
2803 self.renamed_resources = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2804 self
2805 }
2806
2807 /// Sets the value of [ignored_resources][crate::model::DotnetSettings::ignored_resources].
2808 ///
2809 /// # Example
2810 /// ```ignore,no_run
2811 /// # use google_cloud_api::model::DotnetSettings;
2812 /// let x = DotnetSettings::new().set_ignored_resources(["a", "b", "c"]);
2813 /// ```
2814 pub fn set_ignored_resources<T, V>(mut self, v: T) -> Self
2815 where
2816 T: std::iter::IntoIterator<Item = V>,
2817 V: std::convert::Into<std::string::String>,
2818 {
2819 use std::iter::Iterator;
2820 self.ignored_resources = v.into_iter().map(|i| i.into()).collect();
2821 self
2822 }
2823
2824 /// Sets the value of [forced_namespace_aliases][crate::model::DotnetSettings::forced_namespace_aliases].
2825 ///
2826 /// # Example
2827 /// ```ignore,no_run
2828 /// # use google_cloud_api::model::DotnetSettings;
2829 /// let x = DotnetSettings::new().set_forced_namespace_aliases(["a", "b", "c"]);
2830 /// ```
2831 pub fn set_forced_namespace_aliases<T, V>(mut self, v: T) -> Self
2832 where
2833 T: std::iter::IntoIterator<Item = V>,
2834 V: std::convert::Into<std::string::String>,
2835 {
2836 use std::iter::Iterator;
2837 self.forced_namespace_aliases = v.into_iter().map(|i| i.into()).collect();
2838 self
2839 }
2840
2841 /// Sets the value of [handwritten_signatures][crate::model::DotnetSettings::handwritten_signatures].
2842 ///
2843 /// # Example
2844 /// ```ignore,no_run
2845 /// # use google_cloud_api::model::DotnetSettings;
2846 /// let x = DotnetSettings::new().set_handwritten_signatures(["a", "b", "c"]);
2847 /// ```
2848 pub fn set_handwritten_signatures<T, V>(mut self, v: T) -> Self
2849 where
2850 T: std::iter::IntoIterator<Item = V>,
2851 V: std::convert::Into<std::string::String>,
2852 {
2853 use std::iter::Iterator;
2854 self.handwritten_signatures = v.into_iter().map(|i| i.into()).collect();
2855 self
2856 }
2857}
2858
2859impl wkt::message::Message for DotnetSettings {
2860 fn typename() -> &'static str {
2861 "type.googleapis.com/google.api.DotnetSettings"
2862 }
2863}
2864
2865/// Settings for Ruby client libraries.
2866#[derive(Clone, Default, PartialEq)]
2867#[non_exhaustive]
2868pub struct RubySettings {
2869 /// Some settings.
2870 pub common: std::option::Option<crate::model::CommonLanguageSettings>,
2871
2872 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2873}
2874
2875impl RubySettings {
2876 pub fn new() -> Self {
2877 std::default::Default::default()
2878 }
2879
2880 /// Sets the value of [common][crate::model::RubySettings::common].
2881 ///
2882 /// # Example
2883 /// ```ignore,no_run
2884 /// # use google_cloud_api::model::RubySettings;
2885 /// use google_cloud_api::model::CommonLanguageSettings;
2886 /// let x = RubySettings::new().set_common(CommonLanguageSettings::default()/* use setters */);
2887 /// ```
2888 pub fn set_common<T>(mut self, v: T) -> Self
2889 where
2890 T: std::convert::Into<crate::model::CommonLanguageSettings>,
2891 {
2892 self.common = std::option::Option::Some(v.into());
2893 self
2894 }
2895
2896 /// Sets or clears the value of [common][crate::model::RubySettings::common].
2897 ///
2898 /// # Example
2899 /// ```ignore,no_run
2900 /// # use google_cloud_api::model::RubySettings;
2901 /// use google_cloud_api::model::CommonLanguageSettings;
2902 /// let x = RubySettings::new().set_or_clear_common(Some(CommonLanguageSettings::default()/* use setters */));
2903 /// let x = RubySettings::new().set_or_clear_common(None::<CommonLanguageSettings>);
2904 /// ```
2905 pub fn set_or_clear_common<T>(mut self, v: std::option::Option<T>) -> Self
2906 where
2907 T: std::convert::Into<crate::model::CommonLanguageSettings>,
2908 {
2909 self.common = v.map(|x| x.into());
2910 self
2911 }
2912}
2913
2914impl wkt::message::Message for RubySettings {
2915 fn typename() -> &'static str {
2916 "type.googleapis.com/google.api.RubySettings"
2917 }
2918}
2919
2920/// Settings for Go client libraries.
2921#[derive(Clone, Default, PartialEq)]
2922#[non_exhaustive]
2923pub struct GoSettings {
2924 /// Some settings.
2925 pub common: std::option::Option<crate::model::CommonLanguageSettings>,
2926
2927 /// Map of service names to renamed services. Keys are the package relative
2928 /// service names and values are the name to be used for the service client
2929 /// and call options.
2930 ///
2931 /// Example:
2932 ///
2933 /// ```norust
2934 /// publishing:
2935 /// go_settings:
2936 /// renamed_services:
2937 /// Publisher: TopicAdmin
2938 /// ```
2939 pub renamed_services: std::collections::HashMap<std::string::String, std::string::String>,
2940
2941 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2942}
2943
2944impl GoSettings {
2945 pub fn new() -> Self {
2946 std::default::Default::default()
2947 }
2948
2949 /// Sets the value of [common][crate::model::GoSettings::common].
2950 ///
2951 /// # Example
2952 /// ```ignore,no_run
2953 /// # use google_cloud_api::model::GoSettings;
2954 /// use google_cloud_api::model::CommonLanguageSettings;
2955 /// let x = GoSettings::new().set_common(CommonLanguageSettings::default()/* use setters */);
2956 /// ```
2957 pub fn set_common<T>(mut self, v: T) -> Self
2958 where
2959 T: std::convert::Into<crate::model::CommonLanguageSettings>,
2960 {
2961 self.common = std::option::Option::Some(v.into());
2962 self
2963 }
2964
2965 /// Sets or clears the value of [common][crate::model::GoSettings::common].
2966 ///
2967 /// # Example
2968 /// ```ignore,no_run
2969 /// # use google_cloud_api::model::GoSettings;
2970 /// use google_cloud_api::model::CommonLanguageSettings;
2971 /// let x = GoSettings::new().set_or_clear_common(Some(CommonLanguageSettings::default()/* use setters */));
2972 /// let x = GoSettings::new().set_or_clear_common(None::<CommonLanguageSettings>);
2973 /// ```
2974 pub fn set_or_clear_common<T>(mut self, v: std::option::Option<T>) -> Self
2975 where
2976 T: std::convert::Into<crate::model::CommonLanguageSettings>,
2977 {
2978 self.common = v.map(|x| x.into());
2979 self
2980 }
2981
2982 /// Sets the value of [renamed_services][crate::model::GoSettings::renamed_services].
2983 ///
2984 /// # Example
2985 /// ```ignore,no_run
2986 /// # use google_cloud_api::model::GoSettings;
2987 /// let x = GoSettings::new().set_renamed_services([
2988 /// ("key0", "abc"),
2989 /// ("key1", "xyz"),
2990 /// ]);
2991 /// ```
2992 pub fn set_renamed_services<T, K, V>(mut self, v: T) -> Self
2993 where
2994 T: std::iter::IntoIterator<Item = (K, V)>,
2995 K: std::convert::Into<std::string::String>,
2996 V: std::convert::Into<std::string::String>,
2997 {
2998 use std::iter::Iterator;
2999 self.renamed_services = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3000 self
3001 }
3002}
3003
3004impl wkt::message::Message for GoSettings {
3005 fn typename() -> &'static str {
3006 "type.googleapis.com/google.api.GoSettings"
3007 }
3008}
3009
3010/// Describes the generator configuration for a method.
3011#[derive(Clone, Default, PartialEq)]
3012#[non_exhaustive]
3013pub struct MethodSettings {
3014 /// The fully qualified name of the method, for which the options below apply.
3015 /// This is used to find the method to apply the options.
3016 ///
3017 /// Example:
3018 ///
3019 /// ```norust
3020 /// publishing:
3021 /// method_settings:
3022 /// - selector: google.storage.control.v2.StorageControl.CreateFolder
3023 /// # method settings for CreateFolder...
3024 /// ```
3025 pub selector: std::string::String,
3026
3027 /// Describes settings to use for long-running operations when generating
3028 /// API methods for RPCs. Complements RPCs that use the annotations in
3029 /// google/longrunning/operations.proto.
3030 ///
3031 /// Example of a YAML configuration::
3032 ///
3033 /// ```norust
3034 /// publishing:
3035 /// method_settings:
3036 /// - selector: google.cloud.speech.v2.Speech.BatchRecognize
3037 /// long_running:
3038 /// initial_poll_delay: 60s # 1 minute
3039 /// poll_delay_multiplier: 1.5
3040 /// max_poll_delay: 360s # 6 minutes
3041 /// total_poll_timeout: 54000s # 90 minutes
3042 /// ```
3043 pub long_running: std::option::Option<crate::model::method_settings::LongRunning>,
3044
3045 /// List of top-level fields of the request message, that should be
3046 /// automatically populated by the client libraries based on their
3047 /// (google.api.field_info).format. Currently supported format: UUID4.
3048 ///
3049 /// Example of a YAML configuration:
3050 ///
3051 /// ```norust
3052 /// publishing:
3053 /// method_settings:
3054 /// - selector: google.example.v1.ExampleService.CreateExample
3055 /// auto_populated_fields:
3056 /// - request_id
3057 /// ```
3058 pub auto_populated_fields: std::vec::Vec<std::string::String>,
3059
3060 /// Batching configuration for an API method in client libraries.
3061 ///
3062 /// Example of a YAML configuration:
3063 ///
3064 /// ```norust
3065 /// publishing:
3066 /// method_settings:
3067 /// - selector: google.example.v1.ExampleService.BatchCreateExample
3068 /// batching:
3069 /// element_count_threshold: 1000
3070 /// request_byte_threshold: 100000000
3071 /// delay_threshold_millis: 10
3072 /// ```
3073 pub batching: std::option::Option<crate::model::BatchingConfigProto>,
3074
3075 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3076}
3077
3078impl MethodSettings {
3079 pub fn new() -> Self {
3080 std::default::Default::default()
3081 }
3082
3083 /// Sets the value of [selector][crate::model::MethodSettings::selector].
3084 ///
3085 /// # Example
3086 /// ```ignore,no_run
3087 /// # use google_cloud_api::model::MethodSettings;
3088 /// let x = MethodSettings::new().set_selector("example");
3089 /// ```
3090 pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3091 self.selector = v.into();
3092 self
3093 }
3094
3095 /// Sets the value of [long_running][crate::model::MethodSettings::long_running].
3096 ///
3097 /// # Example
3098 /// ```ignore,no_run
3099 /// # use google_cloud_api::model::MethodSettings;
3100 /// use google_cloud_api::model::method_settings::LongRunning;
3101 /// let x = MethodSettings::new().set_long_running(LongRunning::default()/* use setters */);
3102 /// ```
3103 pub fn set_long_running<T>(mut self, v: T) -> Self
3104 where
3105 T: std::convert::Into<crate::model::method_settings::LongRunning>,
3106 {
3107 self.long_running = std::option::Option::Some(v.into());
3108 self
3109 }
3110
3111 /// Sets or clears the value of [long_running][crate::model::MethodSettings::long_running].
3112 ///
3113 /// # Example
3114 /// ```ignore,no_run
3115 /// # use google_cloud_api::model::MethodSettings;
3116 /// use google_cloud_api::model::method_settings::LongRunning;
3117 /// let x = MethodSettings::new().set_or_clear_long_running(Some(LongRunning::default()/* use setters */));
3118 /// let x = MethodSettings::new().set_or_clear_long_running(None::<LongRunning>);
3119 /// ```
3120 pub fn set_or_clear_long_running<T>(mut self, v: std::option::Option<T>) -> Self
3121 where
3122 T: std::convert::Into<crate::model::method_settings::LongRunning>,
3123 {
3124 self.long_running = v.map(|x| x.into());
3125 self
3126 }
3127
3128 /// Sets the value of [auto_populated_fields][crate::model::MethodSettings::auto_populated_fields].
3129 ///
3130 /// # Example
3131 /// ```ignore,no_run
3132 /// # use google_cloud_api::model::MethodSettings;
3133 /// let x = MethodSettings::new().set_auto_populated_fields(["a", "b", "c"]);
3134 /// ```
3135 pub fn set_auto_populated_fields<T, V>(mut self, v: T) -> Self
3136 where
3137 T: std::iter::IntoIterator<Item = V>,
3138 V: std::convert::Into<std::string::String>,
3139 {
3140 use std::iter::Iterator;
3141 self.auto_populated_fields = v.into_iter().map(|i| i.into()).collect();
3142 self
3143 }
3144
3145 /// Sets the value of [batching][crate::model::MethodSettings::batching].
3146 ///
3147 /// # Example
3148 /// ```ignore,no_run
3149 /// # use google_cloud_api::model::MethodSettings;
3150 /// use google_cloud_api::model::BatchingConfigProto;
3151 /// let x = MethodSettings::new().set_batching(BatchingConfigProto::default()/* use setters */);
3152 /// ```
3153 pub fn set_batching<T>(mut self, v: T) -> Self
3154 where
3155 T: std::convert::Into<crate::model::BatchingConfigProto>,
3156 {
3157 self.batching = std::option::Option::Some(v.into());
3158 self
3159 }
3160
3161 /// Sets or clears the value of [batching][crate::model::MethodSettings::batching].
3162 ///
3163 /// # Example
3164 /// ```ignore,no_run
3165 /// # use google_cloud_api::model::MethodSettings;
3166 /// use google_cloud_api::model::BatchingConfigProto;
3167 /// let x = MethodSettings::new().set_or_clear_batching(Some(BatchingConfigProto::default()/* use setters */));
3168 /// let x = MethodSettings::new().set_or_clear_batching(None::<BatchingConfigProto>);
3169 /// ```
3170 pub fn set_or_clear_batching<T>(mut self, v: std::option::Option<T>) -> Self
3171 where
3172 T: std::convert::Into<crate::model::BatchingConfigProto>,
3173 {
3174 self.batching = v.map(|x| x.into());
3175 self
3176 }
3177}
3178
3179impl wkt::message::Message for MethodSettings {
3180 fn typename() -> &'static str {
3181 "type.googleapis.com/google.api.MethodSettings"
3182 }
3183}
3184
3185/// Defines additional types related to [MethodSettings].
3186pub mod method_settings {
3187 #[allow(unused_imports)]
3188 use super::*;
3189
3190 /// Describes settings to use when generating API methods that use the
3191 /// long-running operation pattern.
3192 /// All default values below are from those used in the client library
3193 /// generators (e.g.
3194 /// [Java](https://github.com/googleapis/gapic-generator-java/blob/04c2faa191a9b5a10b92392fe8482279c4404803/src/main/java/com/google/api/generator/gapic/composer/common/RetrySettingsComposer.java)).
3195 #[derive(Clone, Default, PartialEq)]
3196 #[non_exhaustive]
3197 pub struct LongRunning {
3198 /// Initial delay after which the first poll request will be made.
3199 /// Default value: 5 seconds.
3200 pub initial_poll_delay: std::option::Option<wkt::Duration>,
3201
3202 /// Multiplier to gradually increase delay between subsequent polls until it
3203 /// reaches max_poll_delay.
3204 /// Default value: 1.5.
3205 pub poll_delay_multiplier: f32,
3206
3207 /// Maximum time between two subsequent poll requests.
3208 /// Default value: 45 seconds.
3209 pub max_poll_delay: std::option::Option<wkt::Duration>,
3210
3211 /// Total polling timeout.
3212 /// Default value: 5 minutes.
3213 pub total_poll_timeout: std::option::Option<wkt::Duration>,
3214
3215 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3216 }
3217
3218 impl LongRunning {
3219 pub fn new() -> Self {
3220 std::default::Default::default()
3221 }
3222
3223 /// Sets the value of [initial_poll_delay][crate::model::method_settings::LongRunning::initial_poll_delay].
3224 ///
3225 /// # Example
3226 /// ```ignore,no_run
3227 /// # use google_cloud_api::model::method_settings::LongRunning;
3228 /// use wkt::Duration;
3229 /// let x = LongRunning::new().set_initial_poll_delay(Duration::default()/* use setters */);
3230 /// ```
3231 pub fn set_initial_poll_delay<T>(mut self, v: T) -> Self
3232 where
3233 T: std::convert::Into<wkt::Duration>,
3234 {
3235 self.initial_poll_delay = std::option::Option::Some(v.into());
3236 self
3237 }
3238
3239 /// Sets or clears the value of [initial_poll_delay][crate::model::method_settings::LongRunning::initial_poll_delay].
3240 ///
3241 /// # Example
3242 /// ```ignore,no_run
3243 /// # use google_cloud_api::model::method_settings::LongRunning;
3244 /// use wkt::Duration;
3245 /// let x = LongRunning::new().set_or_clear_initial_poll_delay(Some(Duration::default()/* use setters */));
3246 /// let x = LongRunning::new().set_or_clear_initial_poll_delay(None::<Duration>);
3247 /// ```
3248 pub fn set_or_clear_initial_poll_delay<T>(mut self, v: std::option::Option<T>) -> Self
3249 where
3250 T: std::convert::Into<wkt::Duration>,
3251 {
3252 self.initial_poll_delay = v.map(|x| x.into());
3253 self
3254 }
3255
3256 /// Sets the value of [poll_delay_multiplier][crate::model::method_settings::LongRunning::poll_delay_multiplier].
3257 ///
3258 /// # Example
3259 /// ```ignore,no_run
3260 /// # use google_cloud_api::model::method_settings::LongRunning;
3261 /// let x = LongRunning::new().set_poll_delay_multiplier(42.0);
3262 /// ```
3263 pub fn set_poll_delay_multiplier<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
3264 self.poll_delay_multiplier = v.into();
3265 self
3266 }
3267
3268 /// Sets the value of [max_poll_delay][crate::model::method_settings::LongRunning::max_poll_delay].
3269 ///
3270 /// # Example
3271 /// ```ignore,no_run
3272 /// # use google_cloud_api::model::method_settings::LongRunning;
3273 /// use wkt::Duration;
3274 /// let x = LongRunning::new().set_max_poll_delay(Duration::default()/* use setters */);
3275 /// ```
3276 pub fn set_max_poll_delay<T>(mut self, v: T) -> Self
3277 where
3278 T: std::convert::Into<wkt::Duration>,
3279 {
3280 self.max_poll_delay = std::option::Option::Some(v.into());
3281 self
3282 }
3283
3284 /// Sets or clears the value of [max_poll_delay][crate::model::method_settings::LongRunning::max_poll_delay].
3285 ///
3286 /// # Example
3287 /// ```ignore,no_run
3288 /// # use google_cloud_api::model::method_settings::LongRunning;
3289 /// use wkt::Duration;
3290 /// let x = LongRunning::new().set_or_clear_max_poll_delay(Some(Duration::default()/* use setters */));
3291 /// let x = LongRunning::new().set_or_clear_max_poll_delay(None::<Duration>);
3292 /// ```
3293 pub fn set_or_clear_max_poll_delay<T>(mut self, v: std::option::Option<T>) -> Self
3294 where
3295 T: std::convert::Into<wkt::Duration>,
3296 {
3297 self.max_poll_delay = v.map(|x| x.into());
3298 self
3299 }
3300
3301 /// Sets the value of [total_poll_timeout][crate::model::method_settings::LongRunning::total_poll_timeout].
3302 ///
3303 /// # Example
3304 /// ```ignore,no_run
3305 /// # use google_cloud_api::model::method_settings::LongRunning;
3306 /// use wkt::Duration;
3307 /// let x = LongRunning::new().set_total_poll_timeout(Duration::default()/* use setters */);
3308 /// ```
3309 pub fn set_total_poll_timeout<T>(mut self, v: T) -> Self
3310 where
3311 T: std::convert::Into<wkt::Duration>,
3312 {
3313 self.total_poll_timeout = std::option::Option::Some(v.into());
3314 self
3315 }
3316
3317 /// Sets or clears the value of [total_poll_timeout][crate::model::method_settings::LongRunning::total_poll_timeout].
3318 ///
3319 /// # Example
3320 /// ```ignore,no_run
3321 /// # use google_cloud_api::model::method_settings::LongRunning;
3322 /// use wkt::Duration;
3323 /// let x = LongRunning::new().set_or_clear_total_poll_timeout(Some(Duration::default()/* use setters */));
3324 /// let x = LongRunning::new().set_or_clear_total_poll_timeout(None::<Duration>);
3325 /// ```
3326 pub fn set_or_clear_total_poll_timeout<T>(mut self, v: std::option::Option<T>) -> Self
3327 where
3328 T: std::convert::Into<wkt::Duration>,
3329 {
3330 self.total_poll_timeout = v.map(|x| x.into());
3331 self
3332 }
3333 }
3334
3335 impl wkt::message::Message for LongRunning {
3336 fn typename() -> &'static str {
3337 "type.googleapis.com/google.api.MethodSettings.LongRunning"
3338 }
3339 }
3340}
3341
3342/// This message is used to configure the generation of a subset of the RPCs in
3343/// a service for client libraries.
3344///
3345/// Note: This feature should not be used in most cases.
3346#[derive(Clone, Default, PartialEq)]
3347#[non_exhaustive]
3348pub struct SelectiveGapicGeneration {
3349 /// An allowlist of the fully qualified names of RPCs that should be included
3350 /// on public client surfaces.
3351 pub methods: std::vec::Vec<std::string::String>,
3352
3353 /// Setting this to true indicates to the client generators that methods
3354 /// that would be excluded from the generation should instead be generated
3355 /// in a way that indicates these methods should not be consumed by
3356 /// end users. How this is expressed is up to individual language
3357 /// implementations to decide. Some examples may be: added annotations,
3358 /// obfuscated identifiers, or other language idiomatic patterns.
3359 pub generate_omitted_as_internal: bool,
3360
3361 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3362}
3363
3364impl SelectiveGapicGeneration {
3365 pub fn new() -> Self {
3366 std::default::Default::default()
3367 }
3368
3369 /// Sets the value of [methods][crate::model::SelectiveGapicGeneration::methods].
3370 ///
3371 /// # Example
3372 /// ```ignore,no_run
3373 /// # use google_cloud_api::model::SelectiveGapicGeneration;
3374 /// let x = SelectiveGapicGeneration::new().set_methods(["a", "b", "c"]);
3375 /// ```
3376 pub fn set_methods<T, V>(mut self, v: T) -> Self
3377 where
3378 T: std::iter::IntoIterator<Item = V>,
3379 V: std::convert::Into<std::string::String>,
3380 {
3381 use std::iter::Iterator;
3382 self.methods = v.into_iter().map(|i| i.into()).collect();
3383 self
3384 }
3385
3386 /// Sets the value of [generate_omitted_as_internal][crate::model::SelectiveGapicGeneration::generate_omitted_as_internal].
3387 ///
3388 /// # Example
3389 /// ```ignore,no_run
3390 /// # use google_cloud_api::model::SelectiveGapicGeneration;
3391 /// let x = SelectiveGapicGeneration::new().set_generate_omitted_as_internal(true);
3392 /// ```
3393 pub fn set_generate_omitted_as_internal<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3394 self.generate_omitted_as_internal = v.into();
3395 self
3396 }
3397}
3398
3399impl wkt::message::Message for SelectiveGapicGeneration {
3400 fn typename() -> &'static str {
3401 "type.googleapis.com/google.api.SelectiveGapicGeneration"
3402 }
3403}
3404
3405/// `BatchingConfigProto` defines the batching configuration for an API method.
3406#[derive(Clone, Default, PartialEq)]
3407#[non_exhaustive]
3408pub struct BatchingConfigProto {
3409 /// The thresholds which trigger a batched request to be sent.
3410 pub thresholds: std::option::Option<crate::model::BatchingSettingsProto>,
3411
3412 /// The request and response fields used in batching.
3413 pub batch_descriptor: std::option::Option<crate::model::BatchingDescriptorProto>,
3414
3415 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3416}
3417
3418impl BatchingConfigProto {
3419 pub fn new() -> Self {
3420 std::default::Default::default()
3421 }
3422
3423 /// Sets the value of [thresholds][crate::model::BatchingConfigProto::thresholds].
3424 ///
3425 /// # Example
3426 /// ```ignore,no_run
3427 /// # use google_cloud_api::model::BatchingConfigProto;
3428 /// use google_cloud_api::model::BatchingSettingsProto;
3429 /// let x = BatchingConfigProto::new().set_thresholds(BatchingSettingsProto::default()/* use setters */);
3430 /// ```
3431 pub fn set_thresholds<T>(mut self, v: T) -> Self
3432 where
3433 T: std::convert::Into<crate::model::BatchingSettingsProto>,
3434 {
3435 self.thresholds = std::option::Option::Some(v.into());
3436 self
3437 }
3438
3439 /// Sets or clears the value of [thresholds][crate::model::BatchingConfigProto::thresholds].
3440 ///
3441 /// # Example
3442 /// ```ignore,no_run
3443 /// # use google_cloud_api::model::BatchingConfigProto;
3444 /// use google_cloud_api::model::BatchingSettingsProto;
3445 /// let x = BatchingConfigProto::new().set_or_clear_thresholds(Some(BatchingSettingsProto::default()/* use setters */));
3446 /// let x = BatchingConfigProto::new().set_or_clear_thresholds(None::<BatchingSettingsProto>);
3447 /// ```
3448 pub fn set_or_clear_thresholds<T>(mut self, v: std::option::Option<T>) -> Self
3449 where
3450 T: std::convert::Into<crate::model::BatchingSettingsProto>,
3451 {
3452 self.thresholds = v.map(|x| x.into());
3453 self
3454 }
3455
3456 /// Sets the value of [batch_descriptor][crate::model::BatchingConfigProto::batch_descriptor].
3457 ///
3458 /// # Example
3459 /// ```ignore,no_run
3460 /// # use google_cloud_api::model::BatchingConfigProto;
3461 /// use google_cloud_api::model::BatchingDescriptorProto;
3462 /// let x = BatchingConfigProto::new().set_batch_descriptor(BatchingDescriptorProto::default()/* use setters */);
3463 /// ```
3464 pub fn set_batch_descriptor<T>(mut self, v: T) -> Self
3465 where
3466 T: std::convert::Into<crate::model::BatchingDescriptorProto>,
3467 {
3468 self.batch_descriptor = std::option::Option::Some(v.into());
3469 self
3470 }
3471
3472 /// Sets or clears the value of [batch_descriptor][crate::model::BatchingConfigProto::batch_descriptor].
3473 ///
3474 /// # Example
3475 /// ```ignore,no_run
3476 /// # use google_cloud_api::model::BatchingConfigProto;
3477 /// use google_cloud_api::model::BatchingDescriptorProto;
3478 /// let x = BatchingConfigProto::new().set_or_clear_batch_descriptor(Some(BatchingDescriptorProto::default()/* use setters */));
3479 /// let x = BatchingConfigProto::new().set_or_clear_batch_descriptor(None::<BatchingDescriptorProto>);
3480 /// ```
3481 pub fn set_or_clear_batch_descriptor<T>(mut self, v: std::option::Option<T>) -> Self
3482 where
3483 T: std::convert::Into<crate::model::BatchingDescriptorProto>,
3484 {
3485 self.batch_descriptor = v.map(|x| x.into());
3486 self
3487 }
3488}
3489
3490impl wkt::message::Message for BatchingConfigProto {
3491 fn typename() -> &'static str {
3492 "type.googleapis.com/google.api.BatchingConfigProto"
3493 }
3494}
3495
3496/// `BatchingSettingsProto` specifies a set of batching thresholds, each of
3497/// which acts as a trigger to send a batch of messages as a request. At least
3498/// one threshold must be positive nonzero.
3499#[derive(Clone, Default, PartialEq)]
3500#[non_exhaustive]
3501pub struct BatchingSettingsProto {
3502 /// The number of elements of a field collected into a batch which, if
3503 /// exceeded, causes the batch to be sent.
3504 pub element_count_threshold: i32,
3505
3506 /// The aggregated size of the batched field which, if exceeded, causes the
3507 /// batch to be sent. This size is computed by aggregating the sizes of the
3508 /// request field to be batched, not of the entire request message.
3509 pub request_byte_threshold: i64,
3510
3511 /// The duration after which a batch should be sent, starting from the addition
3512 /// of the first message to that batch.
3513 pub delay_threshold: std::option::Option<wkt::Duration>,
3514
3515 /// The maximum number of elements collected in a batch that could be accepted
3516 /// by server.
3517 pub element_count_limit: i32,
3518
3519 /// The maximum size of the request that could be accepted by server.
3520 pub request_byte_limit: i32,
3521
3522 /// The maximum number of elements allowed by flow control.
3523 pub flow_control_element_limit: i32,
3524
3525 /// The maximum size of data allowed by flow control.
3526 pub flow_control_byte_limit: i32,
3527
3528 /// The behavior to take when the flow control limit is exceeded.
3529 pub flow_control_limit_exceeded_behavior: crate::model::FlowControlLimitExceededBehaviorProto,
3530
3531 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3532}
3533
3534impl BatchingSettingsProto {
3535 pub fn new() -> Self {
3536 std::default::Default::default()
3537 }
3538
3539 /// Sets the value of [element_count_threshold][crate::model::BatchingSettingsProto::element_count_threshold].
3540 ///
3541 /// # Example
3542 /// ```ignore,no_run
3543 /// # use google_cloud_api::model::BatchingSettingsProto;
3544 /// let x = BatchingSettingsProto::new().set_element_count_threshold(42);
3545 /// ```
3546 pub fn set_element_count_threshold<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3547 self.element_count_threshold = v.into();
3548 self
3549 }
3550
3551 /// Sets the value of [request_byte_threshold][crate::model::BatchingSettingsProto::request_byte_threshold].
3552 ///
3553 /// # Example
3554 /// ```ignore,no_run
3555 /// # use google_cloud_api::model::BatchingSettingsProto;
3556 /// let x = BatchingSettingsProto::new().set_request_byte_threshold(42);
3557 /// ```
3558 pub fn set_request_byte_threshold<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
3559 self.request_byte_threshold = v.into();
3560 self
3561 }
3562
3563 /// Sets the value of [delay_threshold][crate::model::BatchingSettingsProto::delay_threshold].
3564 ///
3565 /// # Example
3566 /// ```ignore,no_run
3567 /// # use google_cloud_api::model::BatchingSettingsProto;
3568 /// use wkt::Duration;
3569 /// let x = BatchingSettingsProto::new().set_delay_threshold(Duration::default()/* use setters */);
3570 /// ```
3571 pub fn set_delay_threshold<T>(mut self, v: T) -> Self
3572 where
3573 T: std::convert::Into<wkt::Duration>,
3574 {
3575 self.delay_threshold = std::option::Option::Some(v.into());
3576 self
3577 }
3578
3579 /// Sets or clears the value of [delay_threshold][crate::model::BatchingSettingsProto::delay_threshold].
3580 ///
3581 /// # Example
3582 /// ```ignore,no_run
3583 /// # use google_cloud_api::model::BatchingSettingsProto;
3584 /// use wkt::Duration;
3585 /// let x = BatchingSettingsProto::new().set_or_clear_delay_threshold(Some(Duration::default()/* use setters */));
3586 /// let x = BatchingSettingsProto::new().set_or_clear_delay_threshold(None::<Duration>);
3587 /// ```
3588 pub fn set_or_clear_delay_threshold<T>(mut self, v: std::option::Option<T>) -> Self
3589 where
3590 T: std::convert::Into<wkt::Duration>,
3591 {
3592 self.delay_threshold = v.map(|x| x.into());
3593 self
3594 }
3595
3596 /// Sets the value of [element_count_limit][crate::model::BatchingSettingsProto::element_count_limit].
3597 ///
3598 /// # Example
3599 /// ```ignore,no_run
3600 /// # use google_cloud_api::model::BatchingSettingsProto;
3601 /// let x = BatchingSettingsProto::new().set_element_count_limit(42);
3602 /// ```
3603 pub fn set_element_count_limit<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3604 self.element_count_limit = v.into();
3605 self
3606 }
3607
3608 /// Sets the value of [request_byte_limit][crate::model::BatchingSettingsProto::request_byte_limit].
3609 ///
3610 /// # Example
3611 /// ```ignore,no_run
3612 /// # use google_cloud_api::model::BatchingSettingsProto;
3613 /// let x = BatchingSettingsProto::new().set_request_byte_limit(42);
3614 /// ```
3615 pub fn set_request_byte_limit<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3616 self.request_byte_limit = v.into();
3617 self
3618 }
3619
3620 /// Sets the value of [flow_control_element_limit][crate::model::BatchingSettingsProto::flow_control_element_limit].
3621 ///
3622 /// # Example
3623 /// ```ignore,no_run
3624 /// # use google_cloud_api::model::BatchingSettingsProto;
3625 /// let x = BatchingSettingsProto::new().set_flow_control_element_limit(42);
3626 /// ```
3627 pub fn set_flow_control_element_limit<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3628 self.flow_control_element_limit = v.into();
3629 self
3630 }
3631
3632 /// Sets the value of [flow_control_byte_limit][crate::model::BatchingSettingsProto::flow_control_byte_limit].
3633 ///
3634 /// # Example
3635 /// ```ignore,no_run
3636 /// # use google_cloud_api::model::BatchingSettingsProto;
3637 /// let x = BatchingSettingsProto::new().set_flow_control_byte_limit(42);
3638 /// ```
3639 pub fn set_flow_control_byte_limit<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3640 self.flow_control_byte_limit = v.into();
3641 self
3642 }
3643
3644 /// Sets the value of [flow_control_limit_exceeded_behavior][crate::model::BatchingSettingsProto::flow_control_limit_exceeded_behavior].
3645 ///
3646 /// # Example
3647 /// ```ignore,no_run
3648 /// # use google_cloud_api::model::BatchingSettingsProto;
3649 /// use google_cloud_api::model::FlowControlLimitExceededBehaviorProto;
3650 /// let x0 = BatchingSettingsProto::new().set_flow_control_limit_exceeded_behavior(FlowControlLimitExceededBehaviorProto::ThrowException);
3651 /// let x1 = BatchingSettingsProto::new().set_flow_control_limit_exceeded_behavior(FlowControlLimitExceededBehaviorProto::Block);
3652 /// let x2 = BatchingSettingsProto::new().set_flow_control_limit_exceeded_behavior(FlowControlLimitExceededBehaviorProto::Ignore);
3653 /// ```
3654 pub fn set_flow_control_limit_exceeded_behavior<
3655 T: std::convert::Into<crate::model::FlowControlLimitExceededBehaviorProto>,
3656 >(
3657 mut self,
3658 v: T,
3659 ) -> Self {
3660 self.flow_control_limit_exceeded_behavior = v.into();
3661 self
3662 }
3663}
3664
3665impl wkt::message::Message for BatchingSettingsProto {
3666 fn typename() -> &'static str {
3667 "type.googleapis.com/google.api.BatchingSettingsProto"
3668 }
3669}
3670
3671/// `BatchingDescriptorProto` specifies the fields of the request message to be
3672/// used for batching, and, optionally, the fields of the response message to be
3673/// used for demultiplexing.
3674#[derive(Clone, Default, PartialEq)]
3675#[non_exhaustive]
3676pub struct BatchingDescriptorProto {
3677 /// The repeated field in the request message to be aggregated by batching.
3678 pub batched_field: std::string::String,
3679
3680 /// A list of the fields in the request message. Two requests will be batched
3681 /// together only if the values of every field specified in
3682 /// `request_discriminator_fields` is equal between the two requests.
3683 pub discriminator_fields: std::vec::Vec<std::string::String>,
3684
3685 /// Optional. When present, indicates the field in the response message to be
3686 /// used to demultiplex the response into multiple response messages, in
3687 /// correspondence with the multiple request messages originally batched
3688 /// together.
3689 pub subresponse_field: std::string::String,
3690
3691 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3692}
3693
3694impl BatchingDescriptorProto {
3695 pub fn new() -> Self {
3696 std::default::Default::default()
3697 }
3698
3699 /// Sets the value of [batched_field][crate::model::BatchingDescriptorProto::batched_field].
3700 ///
3701 /// # Example
3702 /// ```ignore,no_run
3703 /// # use google_cloud_api::model::BatchingDescriptorProto;
3704 /// let x = BatchingDescriptorProto::new().set_batched_field("example");
3705 /// ```
3706 pub fn set_batched_field<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3707 self.batched_field = v.into();
3708 self
3709 }
3710
3711 /// Sets the value of [discriminator_fields][crate::model::BatchingDescriptorProto::discriminator_fields].
3712 ///
3713 /// # Example
3714 /// ```ignore,no_run
3715 /// # use google_cloud_api::model::BatchingDescriptorProto;
3716 /// let x = BatchingDescriptorProto::new().set_discriminator_fields(["a", "b", "c"]);
3717 /// ```
3718 pub fn set_discriminator_fields<T, V>(mut self, v: T) -> Self
3719 where
3720 T: std::iter::IntoIterator<Item = V>,
3721 V: std::convert::Into<std::string::String>,
3722 {
3723 use std::iter::Iterator;
3724 self.discriminator_fields = v.into_iter().map(|i| i.into()).collect();
3725 self
3726 }
3727
3728 /// Sets the value of [subresponse_field][crate::model::BatchingDescriptorProto::subresponse_field].
3729 ///
3730 /// # Example
3731 /// ```ignore,no_run
3732 /// # use google_cloud_api::model::BatchingDescriptorProto;
3733 /// let x = BatchingDescriptorProto::new().set_subresponse_field("example");
3734 /// ```
3735 pub fn set_subresponse_field<T: std::convert::Into<std::string::String>>(
3736 mut self,
3737 v: T,
3738 ) -> Self {
3739 self.subresponse_field = v.into();
3740 self
3741 }
3742}
3743
3744impl wkt::message::Message for BatchingDescriptorProto {
3745 fn typename() -> &'static str {
3746 "type.googleapis.com/google.api.BatchingDescriptorProto"
3747 }
3748}
3749
3750/// Output generated from semantically comparing two versions of a service
3751/// configuration.
3752///
3753/// Includes detailed information about a field that have changed with
3754/// applicable advice about potential consequences for the change, such as
3755/// backwards-incompatibility.
3756#[derive(Clone, Default, PartialEq)]
3757#[non_exhaustive]
3758pub struct ConfigChange {
3759 /// Object hierarchy path to the change, with levels separated by a '.'
3760 /// character. For repeated fields, an applicable unique identifier field is
3761 /// used for the index (usually selector, name, or id). For maps, the term
3762 /// 'key' is used. If the field has no unique identifier, the numeric index
3763 /// is used.
3764 /// Examples:
3765 ///
3766 /// - visibility.rules[selector=="google.LibraryService.ListBooks"].restriction
3767 /// - quota.metric_rules[selector=="google"].metric_costs[key=="reads"].value
3768 /// - logging.producer_destinations[0]
3769 pub element: std::string::String,
3770
3771 /// Value of the changed object in the old Service configuration,
3772 /// in JSON format. This field will not be populated if ChangeType == ADDED.
3773 pub old_value: std::string::String,
3774
3775 /// Value of the changed object in the new Service configuration,
3776 /// in JSON format. This field will not be populated if ChangeType == REMOVED.
3777 pub new_value: std::string::String,
3778
3779 /// The type for this change, either ADDED, REMOVED, or MODIFIED.
3780 pub change_type: crate::model::ChangeType,
3781
3782 /// Collection of advice provided for this change, useful for determining the
3783 /// possible impact of this change.
3784 pub advices: std::vec::Vec<crate::model::Advice>,
3785
3786 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3787}
3788
3789impl ConfigChange {
3790 pub fn new() -> Self {
3791 std::default::Default::default()
3792 }
3793
3794 /// Sets the value of [element][crate::model::ConfigChange::element].
3795 ///
3796 /// # Example
3797 /// ```ignore,no_run
3798 /// # use google_cloud_api::model::ConfigChange;
3799 /// let x = ConfigChange::new().set_element("example");
3800 /// ```
3801 pub fn set_element<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3802 self.element = v.into();
3803 self
3804 }
3805
3806 /// Sets the value of [old_value][crate::model::ConfigChange::old_value].
3807 ///
3808 /// # Example
3809 /// ```ignore,no_run
3810 /// # use google_cloud_api::model::ConfigChange;
3811 /// let x = ConfigChange::new().set_old_value("example");
3812 /// ```
3813 pub fn set_old_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3814 self.old_value = v.into();
3815 self
3816 }
3817
3818 /// Sets the value of [new_value][crate::model::ConfigChange::new_value].
3819 ///
3820 /// # Example
3821 /// ```ignore,no_run
3822 /// # use google_cloud_api::model::ConfigChange;
3823 /// let x = ConfigChange::new().set_new_value("example");
3824 /// ```
3825 pub fn set_new_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3826 self.new_value = v.into();
3827 self
3828 }
3829
3830 /// Sets the value of [change_type][crate::model::ConfigChange::change_type].
3831 ///
3832 /// # Example
3833 /// ```ignore,no_run
3834 /// # use google_cloud_api::model::ConfigChange;
3835 /// use google_cloud_api::model::ChangeType;
3836 /// let x0 = ConfigChange::new().set_change_type(ChangeType::Added);
3837 /// let x1 = ConfigChange::new().set_change_type(ChangeType::Removed);
3838 /// let x2 = ConfigChange::new().set_change_type(ChangeType::Modified);
3839 /// ```
3840 pub fn set_change_type<T: std::convert::Into<crate::model::ChangeType>>(
3841 mut self,
3842 v: T,
3843 ) -> Self {
3844 self.change_type = v.into();
3845 self
3846 }
3847
3848 /// Sets the value of [advices][crate::model::ConfigChange::advices].
3849 ///
3850 /// # Example
3851 /// ```ignore,no_run
3852 /// # use google_cloud_api::model::ConfigChange;
3853 /// use google_cloud_api::model::Advice;
3854 /// let x = ConfigChange::new()
3855 /// .set_advices([
3856 /// Advice::default()/* use setters */,
3857 /// Advice::default()/* use (different) setters */,
3858 /// ]);
3859 /// ```
3860 pub fn set_advices<T, V>(mut self, v: T) -> Self
3861 where
3862 T: std::iter::IntoIterator<Item = V>,
3863 V: std::convert::Into<crate::model::Advice>,
3864 {
3865 use std::iter::Iterator;
3866 self.advices = v.into_iter().map(|i| i.into()).collect();
3867 self
3868 }
3869}
3870
3871impl wkt::message::Message for ConfigChange {
3872 fn typename() -> &'static str {
3873 "type.googleapis.com/google.api.ConfigChange"
3874 }
3875}
3876
3877/// Generated advice about this change, used for providing more
3878/// information about how a change will affect the existing service.
3879#[derive(Clone, Default, PartialEq)]
3880#[non_exhaustive]
3881pub struct Advice {
3882 /// Useful description for why this advice was applied and what actions should
3883 /// be taken to mitigate any implied risks.
3884 pub description: std::string::String,
3885
3886 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3887}
3888
3889impl Advice {
3890 pub fn new() -> Self {
3891 std::default::Default::default()
3892 }
3893
3894 /// Sets the value of [description][crate::model::Advice::description].
3895 ///
3896 /// # Example
3897 /// ```ignore,no_run
3898 /// # use google_cloud_api::model::Advice;
3899 /// let x = Advice::new().set_description("example");
3900 /// ```
3901 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3902 self.description = v.into();
3903 self
3904 }
3905}
3906
3907impl wkt::message::Message for Advice {
3908 fn typename() -> &'static str {
3909 "type.googleapis.com/google.api.Advice"
3910 }
3911}
3912
3913/// A descriptor for defining project properties for a service. One service may
3914/// have many consumer projects, and the service may want to behave differently
3915/// depending on some properties on the project. For example, a project may be
3916/// associated with a school, or a business, or a government agency, a business
3917/// type property on the project may affect how a service responds to the client.
3918/// This descriptor defines which properties are allowed to be set on a project.
3919///
3920/// Example:
3921///
3922/// ```norust
3923/// project_properties:
3924/// properties:
3925/// - name: NO_WATERMARK
3926/// type: BOOL
3927/// description: Allows usage of the API without watermarks.
3928/// - name: EXTENDED_TILE_CACHE_PERIOD
3929/// type: INT64
3930/// ```
3931#[derive(Clone, Default, PartialEq)]
3932#[non_exhaustive]
3933pub struct ProjectProperties {
3934 /// List of per consumer project-specific properties.
3935 pub properties: std::vec::Vec<crate::model::Property>,
3936
3937 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3938}
3939
3940impl ProjectProperties {
3941 pub fn new() -> Self {
3942 std::default::Default::default()
3943 }
3944
3945 /// Sets the value of [properties][crate::model::ProjectProperties::properties].
3946 ///
3947 /// # Example
3948 /// ```ignore,no_run
3949 /// # use google_cloud_api::model::ProjectProperties;
3950 /// use google_cloud_api::model::Property;
3951 /// let x = ProjectProperties::new()
3952 /// .set_properties([
3953 /// Property::default()/* use setters */,
3954 /// Property::default()/* use (different) setters */,
3955 /// ]);
3956 /// ```
3957 pub fn set_properties<T, V>(mut self, v: T) -> Self
3958 where
3959 T: std::iter::IntoIterator<Item = V>,
3960 V: std::convert::Into<crate::model::Property>,
3961 {
3962 use std::iter::Iterator;
3963 self.properties = v.into_iter().map(|i| i.into()).collect();
3964 self
3965 }
3966}
3967
3968impl wkt::message::Message for ProjectProperties {
3969 fn typename() -> &'static str {
3970 "type.googleapis.com/google.api.ProjectProperties"
3971 }
3972}
3973
3974/// Defines project properties.
3975///
3976/// API services can define properties that can be assigned to consumer projects
3977/// so that backends can perform response customization without having to make
3978/// additional calls or maintain additional storage. For example, Maps API
3979/// defines properties that controls map tile cache period, or whether to embed a
3980/// watermark in a result.
3981///
3982/// These values can be set via API producer console. Only API providers can
3983/// define and set these properties.
3984#[derive(Clone, Default, PartialEq)]
3985#[non_exhaustive]
3986pub struct Property {
3987 /// The name of the property (a.k.a key).
3988 pub name: std::string::String,
3989
3990 /// The type of this property.
3991 pub r#type: crate::model::property::PropertyType,
3992
3993 /// The description of the property
3994 pub description: std::string::String,
3995
3996 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3997}
3998
3999impl Property {
4000 pub fn new() -> Self {
4001 std::default::Default::default()
4002 }
4003
4004 /// Sets the value of [name][crate::model::Property::name].
4005 ///
4006 /// # Example
4007 /// ```ignore,no_run
4008 /// # use google_cloud_api::model::Property;
4009 /// let x = Property::new().set_name("example");
4010 /// ```
4011 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4012 self.name = v.into();
4013 self
4014 }
4015
4016 /// Sets the value of [r#type][crate::model::Property::type].
4017 ///
4018 /// # Example
4019 /// ```ignore,no_run
4020 /// # use google_cloud_api::model::Property;
4021 /// use google_cloud_api::model::property::PropertyType;
4022 /// let x0 = Property::new().set_type(PropertyType::Int64);
4023 /// let x1 = Property::new().set_type(PropertyType::Bool);
4024 /// let x2 = Property::new().set_type(PropertyType::String);
4025 /// ```
4026 pub fn set_type<T: std::convert::Into<crate::model::property::PropertyType>>(
4027 mut self,
4028 v: T,
4029 ) -> Self {
4030 self.r#type = v.into();
4031 self
4032 }
4033
4034 /// Sets the value of [description][crate::model::Property::description].
4035 ///
4036 /// # Example
4037 /// ```ignore,no_run
4038 /// # use google_cloud_api::model::Property;
4039 /// let x = Property::new().set_description("example");
4040 /// ```
4041 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4042 self.description = v.into();
4043 self
4044 }
4045}
4046
4047impl wkt::message::Message for Property {
4048 fn typename() -> &'static str {
4049 "type.googleapis.com/google.api.Property"
4050 }
4051}
4052
4053/// Defines additional types related to [Property].
4054pub mod property {
4055 #[allow(unused_imports)]
4056 use super::*;
4057
4058 /// Supported data type of the property values
4059 ///
4060 /// # Working with unknown values
4061 ///
4062 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4063 /// additional enum variants at any time. Adding new variants is not considered
4064 /// a breaking change. Applications should write their code in anticipation of:
4065 ///
4066 /// - New values appearing in future releases of the client library, **and**
4067 /// - New values received dynamically, without application changes.
4068 ///
4069 /// Please consult the [Working with enums] section in the user guide for some
4070 /// guidelines.
4071 ///
4072 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
4073 #[derive(Clone, Debug, PartialEq)]
4074 #[non_exhaustive]
4075 pub enum PropertyType {
4076 /// The type is unspecified, and will result in an error.
4077 Unspecified,
4078 /// The type is `int64`.
4079 Int64,
4080 /// The type is `bool`.
4081 Bool,
4082 /// The type is `string`.
4083 String,
4084 /// The type is 'double'.
4085 Double,
4086 /// If set, the enum was initialized with an unknown value.
4087 ///
4088 /// Applications can examine the value using [PropertyType::value] or
4089 /// [PropertyType::name].
4090 UnknownValue(property_type::UnknownValue),
4091 }
4092
4093 #[doc(hidden)]
4094 pub mod property_type {
4095 #[allow(unused_imports)]
4096 use super::*;
4097 #[derive(Clone, Debug, PartialEq)]
4098 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4099 }
4100
4101 impl PropertyType {
4102 /// Gets the enum value.
4103 ///
4104 /// Returns `None` if the enum contains an unknown value deserialized from
4105 /// the string representation of enums.
4106 pub fn value(&self) -> std::option::Option<i32> {
4107 match self {
4108 Self::Unspecified => std::option::Option::Some(0),
4109 Self::Int64 => std::option::Option::Some(1),
4110 Self::Bool => std::option::Option::Some(2),
4111 Self::String => std::option::Option::Some(3),
4112 Self::Double => std::option::Option::Some(4),
4113 Self::UnknownValue(u) => u.0.value(),
4114 }
4115 }
4116
4117 /// Gets the enum value as a string.
4118 ///
4119 /// Returns `None` if the enum contains an unknown value deserialized from
4120 /// the integer representation of enums.
4121 pub fn name(&self) -> std::option::Option<&str> {
4122 match self {
4123 Self::Unspecified => std::option::Option::Some("UNSPECIFIED"),
4124 Self::Int64 => std::option::Option::Some("INT64"),
4125 Self::Bool => std::option::Option::Some("BOOL"),
4126 Self::String => std::option::Option::Some("STRING"),
4127 Self::Double => std::option::Option::Some("DOUBLE"),
4128 Self::UnknownValue(u) => u.0.name(),
4129 }
4130 }
4131 }
4132
4133 impl std::default::Default for PropertyType {
4134 fn default() -> Self {
4135 use std::convert::From;
4136 Self::from(0)
4137 }
4138 }
4139
4140 impl std::fmt::Display for PropertyType {
4141 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4142 wkt::internal::display_enum(f, self.name(), self.value())
4143 }
4144 }
4145
4146 impl std::convert::From<i32> for PropertyType {
4147 fn from(value: i32) -> Self {
4148 match value {
4149 0 => Self::Unspecified,
4150 1 => Self::Int64,
4151 2 => Self::Bool,
4152 3 => Self::String,
4153 4 => Self::Double,
4154 _ => Self::UnknownValue(property_type::UnknownValue(
4155 wkt::internal::UnknownEnumValue::Integer(value),
4156 )),
4157 }
4158 }
4159 }
4160
4161 impl std::convert::From<&str> for PropertyType {
4162 fn from(value: &str) -> Self {
4163 use std::string::ToString;
4164 match value {
4165 "UNSPECIFIED" => Self::Unspecified,
4166 "INT64" => Self::Int64,
4167 "BOOL" => Self::Bool,
4168 "STRING" => Self::String,
4169 "DOUBLE" => Self::Double,
4170 _ => Self::UnknownValue(property_type::UnknownValue(
4171 wkt::internal::UnknownEnumValue::String(value.to_string()),
4172 )),
4173 }
4174 }
4175 }
4176
4177 impl serde::ser::Serialize for PropertyType {
4178 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4179 where
4180 S: serde::Serializer,
4181 {
4182 match self {
4183 Self::Unspecified => serializer.serialize_i32(0),
4184 Self::Int64 => serializer.serialize_i32(1),
4185 Self::Bool => serializer.serialize_i32(2),
4186 Self::String => serializer.serialize_i32(3),
4187 Self::Double => serializer.serialize_i32(4),
4188 Self::UnknownValue(u) => u.0.serialize(serializer),
4189 }
4190 }
4191 }
4192
4193 impl<'de> serde::de::Deserialize<'de> for PropertyType {
4194 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4195 where
4196 D: serde::Deserializer<'de>,
4197 {
4198 deserializer.deserialize_any(wkt::internal::EnumVisitor::<PropertyType>::new(
4199 ".google.api.Property.PropertyType",
4200 ))
4201 }
4202 }
4203}
4204
4205/// `Context` defines which contexts an API requests.
4206///
4207/// Example:
4208///
4209/// ```norust
4210/// context:
4211/// rules:
4212/// - selector: "*"
4213/// requested:
4214/// - google.rpc.context.ProjectContext
4215/// - google.rpc.context.OriginContext
4216/// ```
4217///
4218/// The above specifies that all methods in the API request
4219/// `google.rpc.context.ProjectContext` and
4220/// `google.rpc.context.OriginContext`.
4221///
4222/// Available context types are defined in package
4223/// `google.rpc.context`.
4224///
4225/// This also provides mechanism to allowlist any protobuf message extension that
4226/// can be sent in grpc metadata using “x-goog-ext-<extension_id>-bin” and
4227/// “x-goog-ext-<extension_id>-jspb” format. For example, list any service
4228/// specific protobuf types that can appear in grpc metadata as follows in your
4229/// yaml file:
4230///
4231/// Example:
4232///
4233/// ```norust
4234/// context:
4235/// rules:
4236/// - selector: "google.example.library.v1.LibraryService.CreateBook"
4237/// allowed_request_extensions:
4238/// - google.foo.v1.NewExtension
4239/// allowed_response_extensions:
4240/// - google.foo.v1.NewExtension
4241/// ```
4242///
4243/// You can also specify extension ID instead of fully qualified extension name
4244/// here.
4245#[derive(Clone, Default, PartialEq)]
4246#[non_exhaustive]
4247pub struct Context {
4248 /// A list of RPC context rules that apply to individual API methods.
4249 ///
4250 /// **NOTE:** All service configuration rules follow "last one wins" order.
4251 pub rules: std::vec::Vec<crate::model::ContextRule>,
4252
4253 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4254}
4255
4256impl Context {
4257 pub fn new() -> Self {
4258 std::default::Default::default()
4259 }
4260
4261 /// Sets the value of [rules][crate::model::Context::rules].
4262 ///
4263 /// # Example
4264 /// ```ignore,no_run
4265 /// # use google_cloud_api::model::Context;
4266 /// use google_cloud_api::model::ContextRule;
4267 /// let x = Context::new()
4268 /// .set_rules([
4269 /// ContextRule::default()/* use setters */,
4270 /// ContextRule::default()/* use (different) setters */,
4271 /// ]);
4272 /// ```
4273 pub fn set_rules<T, V>(mut self, v: T) -> Self
4274 where
4275 T: std::iter::IntoIterator<Item = V>,
4276 V: std::convert::Into<crate::model::ContextRule>,
4277 {
4278 use std::iter::Iterator;
4279 self.rules = v.into_iter().map(|i| i.into()).collect();
4280 self
4281 }
4282}
4283
4284impl wkt::message::Message for Context {
4285 fn typename() -> &'static str {
4286 "type.googleapis.com/google.api.Context"
4287 }
4288}
4289
4290/// A context rule provides information about the context for an individual API
4291/// element.
4292#[derive(Clone, Default, PartialEq)]
4293#[non_exhaustive]
4294pub struct ContextRule {
4295 /// Selects the methods to which this rule applies.
4296 ///
4297 /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
4298 /// details.
4299 ///
4300 /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
4301 pub selector: std::string::String,
4302
4303 /// A list of full type names of requested contexts, only the requested context
4304 /// will be made available to the backend.
4305 pub requested: std::vec::Vec<std::string::String>,
4306
4307 /// A list of full type names of provided contexts. It is used to support
4308 /// propagating HTTP headers and ETags from the response extension.
4309 pub provided: std::vec::Vec<std::string::String>,
4310
4311 /// A list of full type names or extension IDs of extensions allowed in grpc
4312 /// side channel from client to backend.
4313 pub allowed_request_extensions: std::vec::Vec<std::string::String>,
4314
4315 /// A list of full type names or extension IDs of extensions allowed in grpc
4316 /// side channel from backend to client.
4317 pub allowed_response_extensions: std::vec::Vec<std::string::String>,
4318
4319 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4320}
4321
4322impl ContextRule {
4323 pub fn new() -> Self {
4324 std::default::Default::default()
4325 }
4326
4327 /// Sets the value of [selector][crate::model::ContextRule::selector].
4328 ///
4329 /// # Example
4330 /// ```ignore,no_run
4331 /// # use google_cloud_api::model::ContextRule;
4332 /// let x = ContextRule::new().set_selector("example");
4333 /// ```
4334 pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4335 self.selector = v.into();
4336 self
4337 }
4338
4339 /// Sets the value of [requested][crate::model::ContextRule::requested].
4340 ///
4341 /// # Example
4342 /// ```ignore,no_run
4343 /// # use google_cloud_api::model::ContextRule;
4344 /// let x = ContextRule::new().set_requested(["a", "b", "c"]);
4345 /// ```
4346 pub fn set_requested<T, V>(mut self, v: T) -> Self
4347 where
4348 T: std::iter::IntoIterator<Item = V>,
4349 V: std::convert::Into<std::string::String>,
4350 {
4351 use std::iter::Iterator;
4352 self.requested = v.into_iter().map(|i| i.into()).collect();
4353 self
4354 }
4355
4356 /// Sets the value of [provided][crate::model::ContextRule::provided].
4357 ///
4358 /// # Example
4359 /// ```ignore,no_run
4360 /// # use google_cloud_api::model::ContextRule;
4361 /// let x = ContextRule::new().set_provided(["a", "b", "c"]);
4362 /// ```
4363 pub fn set_provided<T, V>(mut self, v: T) -> Self
4364 where
4365 T: std::iter::IntoIterator<Item = V>,
4366 V: std::convert::Into<std::string::String>,
4367 {
4368 use std::iter::Iterator;
4369 self.provided = v.into_iter().map(|i| i.into()).collect();
4370 self
4371 }
4372
4373 /// Sets the value of [allowed_request_extensions][crate::model::ContextRule::allowed_request_extensions].
4374 ///
4375 /// # Example
4376 /// ```ignore,no_run
4377 /// # use google_cloud_api::model::ContextRule;
4378 /// let x = ContextRule::new().set_allowed_request_extensions(["a", "b", "c"]);
4379 /// ```
4380 pub fn set_allowed_request_extensions<T, V>(mut self, v: T) -> Self
4381 where
4382 T: std::iter::IntoIterator<Item = V>,
4383 V: std::convert::Into<std::string::String>,
4384 {
4385 use std::iter::Iterator;
4386 self.allowed_request_extensions = v.into_iter().map(|i| i.into()).collect();
4387 self
4388 }
4389
4390 /// Sets the value of [allowed_response_extensions][crate::model::ContextRule::allowed_response_extensions].
4391 ///
4392 /// # Example
4393 /// ```ignore,no_run
4394 /// # use google_cloud_api::model::ContextRule;
4395 /// let x = ContextRule::new().set_allowed_response_extensions(["a", "b", "c"]);
4396 /// ```
4397 pub fn set_allowed_response_extensions<T, V>(mut self, v: T) -> Self
4398 where
4399 T: std::iter::IntoIterator<Item = V>,
4400 V: std::convert::Into<std::string::String>,
4401 {
4402 use std::iter::Iterator;
4403 self.allowed_response_extensions = v.into_iter().map(|i| i.into()).collect();
4404 self
4405 }
4406}
4407
4408impl wkt::message::Message for ContextRule {
4409 fn typename() -> &'static str {
4410 "type.googleapis.com/google.api.ContextRule"
4411 }
4412}
4413
4414/// Selects and configures the service controller used by the service.
4415///
4416/// Example:
4417///
4418/// ```norust
4419/// control:
4420/// environment: servicecontrol.googleapis.com
4421/// ```
4422#[derive(Clone, Default, PartialEq)]
4423#[non_exhaustive]
4424pub struct Control {
4425 /// The service controller environment to use. If empty, no control plane
4426 /// features (like quota and billing) will be enabled. The recommended value
4427 /// for most services is servicecontrol.googleapis.com.
4428 pub environment: std::string::String,
4429
4430 /// Defines policies applying to the API methods of the service.
4431 pub method_policies: std::vec::Vec<crate::model::MethodPolicy>,
4432
4433 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4434}
4435
4436impl Control {
4437 pub fn new() -> Self {
4438 std::default::Default::default()
4439 }
4440
4441 /// Sets the value of [environment][crate::model::Control::environment].
4442 ///
4443 /// # Example
4444 /// ```ignore,no_run
4445 /// # use google_cloud_api::model::Control;
4446 /// let x = Control::new().set_environment("example");
4447 /// ```
4448 pub fn set_environment<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4449 self.environment = v.into();
4450 self
4451 }
4452
4453 /// Sets the value of [method_policies][crate::model::Control::method_policies].
4454 ///
4455 /// # Example
4456 /// ```ignore,no_run
4457 /// # use google_cloud_api::model::Control;
4458 /// use google_cloud_api::model::MethodPolicy;
4459 /// let x = Control::new()
4460 /// .set_method_policies([
4461 /// MethodPolicy::default()/* use setters */,
4462 /// MethodPolicy::default()/* use (different) setters */,
4463 /// ]);
4464 /// ```
4465 pub fn set_method_policies<T, V>(mut self, v: T) -> Self
4466 where
4467 T: std::iter::IntoIterator<Item = V>,
4468 V: std::convert::Into<crate::model::MethodPolicy>,
4469 {
4470 use std::iter::Iterator;
4471 self.method_policies = v.into_iter().map(|i| i.into()).collect();
4472 self
4473 }
4474}
4475
4476impl wkt::message::Message for Control {
4477 fn typename() -> &'static str {
4478 "type.googleapis.com/google.api.Control"
4479 }
4480}
4481
4482/// `Distribution` contains summary statistics for a population of values. It
4483/// optionally contains a histogram representing the distribution of those values
4484/// across a set of buckets.
4485///
4486/// The summary statistics are the count, mean, sum of the squared deviation from
4487/// the mean, the minimum, and the maximum of the set of population of values.
4488/// The histogram is based on a sequence of buckets and gives a count of values
4489/// that fall into each bucket. The boundaries of the buckets are given either
4490/// explicitly or by formulas for buckets of fixed or exponentially increasing
4491/// widths.
4492///
4493/// Although it is not forbidden, it is generally a bad idea to include
4494/// non-finite values (infinities or NaNs) in the population of values, as this
4495/// will render the `mean` and `sum_of_squared_deviation` fields meaningless.
4496#[derive(Clone, Default, PartialEq)]
4497#[non_exhaustive]
4498pub struct Distribution {
4499 /// The number of values in the population. Must be non-negative. This value
4500 /// must equal the sum of the values in `bucket_counts` if a histogram is
4501 /// provided.
4502 pub count: i64,
4503
4504 /// The arithmetic mean of the values in the population. If `count` is zero
4505 /// then this field must be zero.
4506 pub mean: f64,
4507
4508 /// The sum of squared deviations from the mean of the values in the
4509 /// population. For values x_i this is:
4510 ///
4511 /// ```norust
4512 /// Sum[i=1..n]((x_i - mean)^2)
4513 /// ```
4514 ///
4515 /// Knuth, "The Art of Computer Programming", Vol. 2, page 232, 3rd edition
4516 /// describes Welford's method for accumulating this sum in one pass.
4517 ///
4518 /// If `count` is zero then this field must be zero.
4519 pub sum_of_squared_deviation: f64,
4520
4521 /// If specified, contains the range of the population values. The field
4522 /// must not be present if the `count` is zero.
4523 pub range: std::option::Option<crate::model::distribution::Range>,
4524
4525 /// Defines the histogram bucket boundaries. If the distribution does not
4526 /// contain a histogram, then omit this field.
4527 pub bucket_options: std::option::Option<crate::model::distribution::BucketOptions>,
4528
4529 /// The number of values in each bucket of the histogram, as described in
4530 /// `bucket_options`. If the distribution does not have a histogram, then omit
4531 /// this field. If there is a histogram, then the sum of the values in
4532 /// `bucket_counts` must equal the value in the `count` field of the
4533 /// distribution.
4534 ///
4535 /// If present, `bucket_counts` should contain N values, where N is the number
4536 /// of buckets specified in `bucket_options`. If you supply fewer than N
4537 /// values, the remaining values are assumed to be 0.
4538 ///
4539 /// The order of the values in `bucket_counts` follows the bucket numbering
4540 /// schemes described for the three bucket types. The first value must be the
4541 /// count for the underflow bucket (number 0). The next N-2 values are the
4542 /// counts for the finite buckets (number 1 through N-2). The N'th value in
4543 /// `bucket_counts` is the count for the overflow bucket (number N-1).
4544 pub bucket_counts: std::vec::Vec<i64>,
4545
4546 /// Must be in increasing order of `value` field.
4547 pub exemplars: std::vec::Vec<crate::model::distribution::Exemplar>,
4548
4549 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4550}
4551
4552impl Distribution {
4553 pub fn new() -> Self {
4554 std::default::Default::default()
4555 }
4556
4557 /// Sets the value of [count][crate::model::Distribution::count].
4558 ///
4559 /// # Example
4560 /// ```ignore,no_run
4561 /// # use google_cloud_api::model::Distribution;
4562 /// let x = Distribution::new().set_count(42);
4563 /// ```
4564 pub fn set_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
4565 self.count = v.into();
4566 self
4567 }
4568
4569 /// Sets the value of [mean][crate::model::Distribution::mean].
4570 ///
4571 /// # Example
4572 /// ```ignore,no_run
4573 /// # use google_cloud_api::model::Distribution;
4574 /// let x = Distribution::new().set_mean(42.0);
4575 /// ```
4576 pub fn set_mean<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
4577 self.mean = v.into();
4578 self
4579 }
4580
4581 /// Sets the value of [sum_of_squared_deviation][crate::model::Distribution::sum_of_squared_deviation].
4582 ///
4583 /// # Example
4584 /// ```ignore,no_run
4585 /// # use google_cloud_api::model::Distribution;
4586 /// let x = Distribution::new().set_sum_of_squared_deviation(42.0);
4587 /// ```
4588 pub fn set_sum_of_squared_deviation<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
4589 self.sum_of_squared_deviation = v.into();
4590 self
4591 }
4592
4593 /// Sets the value of [range][crate::model::Distribution::range].
4594 ///
4595 /// # Example
4596 /// ```ignore,no_run
4597 /// # use google_cloud_api::model::Distribution;
4598 /// use google_cloud_api::model::distribution::Range;
4599 /// let x = Distribution::new().set_range(Range::default()/* use setters */);
4600 /// ```
4601 pub fn set_range<T>(mut self, v: T) -> Self
4602 where
4603 T: std::convert::Into<crate::model::distribution::Range>,
4604 {
4605 self.range = std::option::Option::Some(v.into());
4606 self
4607 }
4608
4609 /// Sets or clears the value of [range][crate::model::Distribution::range].
4610 ///
4611 /// # Example
4612 /// ```ignore,no_run
4613 /// # use google_cloud_api::model::Distribution;
4614 /// use google_cloud_api::model::distribution::Range;
4615 /// let x = Distribution::new().set_or_clear_range(Some(Range::default()/* use setters */));
4616 /// let x = Distribution::new().set_or_clear_range(None::<Range>);
4617 /// ```
4618 pub fn set_or_clear_range<T>(mut self, v: std::option::Option<T>) -> Self
4619 where
4620 T: std::convert::Into<crate::model::distribution::Range>,
4621 {
4622 self.range = v.map(|x| x.into());
4623 self
4624 }
4625
4626 /// Sets the value of [bucket_options][crate::model::Distribution::bucket_options].
4627 ///
4628 /// # Example
4629 /// ```ignore,no_run
4630 /// # use google_cloud_api::model::Distribution;
4631 /// use google_cloud_api::model::distribution::BucketOptions;
4632 /// let x = Distribution::new().set_bucket_options(BucketOptions::default()/* use setters */);
4633 /// ```
4634 pub fn set_bucket_options<T>(mut self, v: T) -> Self
4635 where
4636 T: std::convert::Into<crate::model::distribution::BucketOptions>,
4637 {
4638 self.bucket_options = std::option::Option::Some(v.into());
4639 self
4640 }
4641
4642 /// Sets or clears the value of [bucket_options][crate::model::Distribution::bucket_options].
4643 ///
4644 /// # Example
4645 /// ```ignore,no_run
4646 /// # use google_cloud_api::model::Distribution;
4647 /// use google_cloud_api::model::distribution::BucketOptions;
4648 /// let x = Distribution::new().set_or_clear_bucket_options(Some(BucketOptions::default()/* use setters */));
4649 /// let x = Distribution::new().set_or_clear_bucket_options(None::<BucketOptions>);
4650 /// ```
4651 pub fn set_or_clear_bucket_options<T>(mut self, v: std::option::Option<T>) -> Self
4652 where
4653 T: std::convert::Into<crate::model::distribution::BucketOptions>,
4654 {
4655 self.bucket_options = v.map(|x| x.into());
4656 self
4657 }
4658
4659 /// Sets the value of [bucket_counts][crate::model::Distribution::bucket_counts].
4660 ///
4661 /// # Example
4662 /// ```ignore,no_run
4663 /// # use google_cloud_api::model::Distribution;
4664 /// let x = Distribution::new().set_bucket_counts([1, 2, 3]);
4665 /// ```
4666 pub fn set_bucket_counts<T, V>(mut self, v: T) -> Self
4667 where
4668 T: std::iter::IntoIterator<Item = V>,
4669 V: std::convert::Into<i64>,
4670 {
4671 use std::iter::Iterator;
4672 self.bucket_counts = v.into_iter().map(|i| i.into()).collect();
4673 self
4674 }
4675
4676 /// Sets the value of [exemplars][crate::model::Distribution::exemplars].
4677 ///
4678 /// # Example
4679 /// ```ignore,no_run
4680 /// # use google_cloud_api::model::Distribution;
4681 /// use google_cloud_api::model::distribution::Exemplar;
4682 /// let x = Distribution::new()
4683 /// .set_exemplars([
4684 /// Exemplar::default()/* use setters */,
4685 /// Exemplar::default()/* use (different) setters */,
4686 /// ]);
4687 /// ```
4688 pub fn set_exemplars<T, V>(mut self, v: T) -> Self
4689 where
4690 T: std::iter::IntoIterator<Item = V>,
4691 V: std::convert::Into<crate::model::distribution::Exemplar>,
4692 {
4693 use std::iter::Iterator;
4694 self.exemplars = v.into_iter().map(|i| i.into()).collect();
4695 self
4696 }
4697}
4698
4699impl wkt::message::Message for Distribution {
4700 fn typename() -> &'static str {
4701 "type.googleapis.com/google.api.Distribution"
4702 }
4703}
4704
4705/// Defines additional types related to [Distribution].
4706pub mod distribution {
4707 #[allow(unused_imports)]
4708 use super::*;
4709
4710 /// The range of the population values.
4711 #[derive(Clone, Default, PartialEq)]
4712 #[non_exhaustive]
4713 pub struct Range {
4714 /// The minimum of the population values.
4715 pub min: f64,
4716
4717 /// The maximum of the population values.
4718 pub max: f64,
4719
4720 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4721 }
4722
4723 impl Range {
4724 pub fn new() -> Self {
4725 std::default::Default::default()
4726 }
4727
4728 /// Sets the value of [min][crate::model::distribution::Range::min].
4729 ///
4730 /// # Example
4731 /// ```ignore,no_run
4732 /// # use google_cloud_api::model::distribution::Range;
4733 /// let x = Range::new().set_min(42.0);
4734 /// ```
4735 pub fn set_min<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
4736 self.min = v.into();
4737 self
4738 }
4739
4740 /// Sets the value of [max][crate::model::distribution::Range::max].
4741 ///
4742 /// # Example
4743 /// ```ignore,no_run
4744 /// # use google_cloud_api::model::distribution::Range;
4745 /// let x = Range::new().set_max(42.0);
4746 /// ```
4747 pub fn set_max<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
4748 self.max = v.into();
4749 self
4750 }
4751 }
4752
4753 impl wkt::message::Message for Range {
4754 fn typename() -> &'static str {
4755 "type.googleapis.com/google.api.Distribution.Range"
4756 }
4757 }
4758
4759 /// `BucketOptions` describes the bucket boundaries used to create a histogram
4760 /// for the distribution. The buckets can be in a linear sequence, an
4761 /// exponential sequence, or each bucket can be specified explicitly.
4762 /// `BucketOptions` does not include the number of values in each bucket.
4763 ///
4764 /// A bucket has an inclusive lower bound and exclusive upper bound for the
4765 /// values that are counted for that bucket. The upper bound of a bucket must
4766 /// be strictly greater than the lower bound. The sequence of N buckets for a
4767 /// distribution consists of an underflow bucket (number 0), zero or more
4768 /// finite buckets (number 1 through N - 2) and an overflow bucket (number N -
4769 /// 1). The buckets are contiguous: the lower bound of bucket i (i > 0) is the
4770 /// same as the upper bound of bucket i - 1. The buckets span the whole range
4771 /// of finite values: lower bound of the underflow bucket is -infinity and the
4772 /// upper bound of the overflow bucket is +infinity. The finite buckets are
4773 /// so-called because both bounds are finite.
4774 #[derive(Clone, Default, PartialEq)]
4775 #[non_exhaustive]
4776 pub struct BucketOptions {
4777 /// Exactly one of these three fields must be set.
4778 pub options: std::option::Option<crate::model::distribution::bucket_options::Options>,
4779
4780 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4781 }
4782
4783 impl BucketOptions {
4784 pub fn new() -> Self {
4785 std::default::Default::default()
4786 }
4787
4788 /// Sets the value of [options][crate::model::distribution::BucketOptions::options].
4789 ///
4790 /// Note that all the setters affecting `options` are mutually
4791 /// exclusive.
4792 ///
4793 /// # Example
4794 /// ```ignore,no_run
4795 /// # use google_cloud_api::model::distribution::BucketOptions;
4796 /// use google_cloud_api::model::distribution::bucket_options::Linear;
4797 /// let x = BucketOptions::new().set_options(Some(
4798 /// google_cloud_api::model::distribution::bucket_options::Options::LinearBuckets(Linear::default().into())));
4799 /// ```
4800 pub fn set_options<
4801 T: std::convert::Into<
4802 std::option::Option<crate::model::distribution::bucket_options::Options>,
4803 >,
4804 >(
4805 mut self,
4806 v: T,
4807 ) -> Self {
4808 self.options = v.into();
4809 self
4810 }
4811
4812 /// The value of [options][crate::model::distribution::BucketOptions::options]
4813 /// if it holds a `LinearBuckets`, `None` if the field is not set or
4814 /// holds a different branch.
4815 pub fn linear_buckets(
4816 &self,
4817 ) -> std::option::Option<&std::boxed::Box<crate::model::distribution::bucket_options::Linear>>
4818 {
4819 #[allow(unreachable_patterns)]
4820 self.options.as_ref().and_then(|v| match v {
4821 crate::model::distribution::bucket_options::Options::LinearBuckets(v) => {
4822 std::option::Option::Some(v)
4823 }
4824 _ => std::option::Option::None,
4825 })
4826 }
4827
4828 /// Sets the value of [options][crate::model::distribution::BucketOptions::options]
4829 /// to hold a `LinearBuckets`.
4830 ///
4831 /// Note that all the setters affecting `options` are
4832 /// mutually exclusive.
4833 ///
4834 /// # Example
4835 /// ```ignore,no_run
4836 /// # use google_cloud_api::model::distribution::BucketOptions;
4837 /// use google_cloud_api::model::distribution::bucket_options::Linear;
4838 /// let x = BucketOptions::new().set_linear_buckets(Linear::default()/* use setters */);
4839 /// assert!(x.linear_buckets().is_some());
4840 /// assert!(x.exponential_buckets().is_none());
4841 /// assert!(x.explicit_buckets().is_none());
4842 /// ```
4843 pub fn set_linear_buckets<
4844 T: std::convert::Into<std::boxed::Box<crate::model::distribution::bucket_options::Linear>>,
4845 >(
4846 mut self,
4847 v: T,
4848 ) -> Self {
4849 self.options = std::option::Option::Some(
4850 crate::model::distribution::bucket_options::Options::LinearBuckets(v.into()),
4851 );
4852 self
4853 }
4854
4855 /// The value of [options][crate::model::distribution::BucketOptions::options]
4856 /// if it holds a `ExponentialBuckets`, `None` if the field is not set or
4857 /// holds a different branch.
4858 pub fn exponential_buckets(
4859 &self,
4860 ) -> std::option::Option<
4861 &std::boxed::Box<crate::model::distribution::bucket_options::Exponential>,
4862 > {
4863 #[allow(unreachable_patterns)]
4864 self.options.as_ref().and_then(|v| match v {
4865 crate::model::distribution::bucket_options::Options::ExponentialBuckets(v) => {
4866 std::option::Option::Some(v)
4867 }
4868 _ => std::option::Option::None,
4869 })
4870 }
4871
4872 /// Sets the value of [options][crate::model::distribution::BucketOptions::options]
4873 /// to hold a `ExponentialBuckets`.
4874 ///
4875 /// Note that all the setters affecting `options` are
4876 /// mutually exclusive.
4877 ///
4878 /// # Example
4879 /// ```ignore,no_run
4880 /// # use google_cloud_api::model::distribution::BucketOptions;
4881 /// use google_cloud_api::model::distribution::bucket_options::Exponential;
4882 /// let x = BucketOptions::new().set_exponential_buckets(Exponential::default()/* use setters */);
4883 /// assert!(x.exponential_buckets().is_some());
4884 /// assert!(x.linear_buckets().is_none());
4885 /// assert!(x.explicit_buckets().is_none());
4886 /// ```
4887 pub fn set_exponential_buckets<
4888 T: std::convert::Into<
4889 std::boxed::Box<crate::model::distribution::bucket_options::Exponential>,
4890 >,
4891 >(
4892 mut self,
4893 v: T,
4894 ) -> Self {
4895 self.options = std::option::Option::Some(
4896 crate::model::distribution::bucket_options::Options::ExponentialBuckets(v.into()),
4897 );
4898 self
4899 }
4900
4901 /// The value of [options][crate::model::distribution::BucketOptions::options]
4902 /// if it holds a `ExplicitBuckets`, `None` if the field is not set or
4903 /// holds a different branch.
4904 pub fn explicit_buckets(
4905 &self,
4906 ) -> std::option::Option<
4907 &std::boxed::Box<crate::model::distribution::bucket_options::Explicit>,
4908 > {
4909 #[allow(unreachable_patterns)]
4910 self.options.as_ref().and_then(|v| match v {
4911 crate::model::distribution::bucket_options::Options::ExplicitBuckets(v) => {
4912 std::option::Option::Some(v)
4913 }
4914 _ => std::option::Option::None,
4915 })
4916 }
4917
4918 /// Sets the value of [options][crate::model::distribution::BucketOptions::options]
4919 /// to hold a `ExplicitBuckets`.
4920 ///
4921 /// Note that all the setters affecting `options` are
4922 /// mutually exclusive.
4923 ///
4924 /// # Example
4925 /// ```ignore,no_run
4926 /// # use google_cloud_api::model::distribution::BucketOptions;
4927 /// use google_cloud_api::model::distribution::bucket_options::Explicit;
4928 /// let x = BucketOptions::new().set_explicit_buckets(Explicit::default()/* use setters */);
4929 /// assert!(x.explicit_buckets().is_some());
4930 /// assert!(x.linear_buckets().is_none());
4931 /// assert!(x.exponential_buckets().is_none());
4932 /// ```
4933 pub fn set_explicit_buckets<
4934 T: std::convert::Into<
4935 std::boxed::Box<crate::model::distribution::bucket_options::Explicit>,
4936 >,
4937 >(
4938 mut self,
4939 v: T,
4940 ) -> Self {
4941 self.options = std::option::Option::Some(
4942 crate::model::distribution::bucket_options::Options::ExplicitBuckets(v.into()),
4943 );
4944 self
4945 }
4946 }
4947
4948 impl wkt::message::Message for BucketOptions {
4949 fn typename() -> &'static str {
4950 "type.googleapis.com/google.api.Distribution.BucketOptions"
4951 }
4952 }
4953
4954 /// Defines additional types related to [BucketOptions].
4955 pub mod bucket_options {
4956 #[allow(unused_imports)]
4957 use super::*;
4958
4959 /// Specifies a linear sequence of buckets that all have the same width
4960 /// (except overflow and underflow). Each bucket represents a constant
4961 /// absolute uncertainty on the specific value in the bucket.
4962 ///
4963 /// There are `num_finite_buckets + 2` (= N) buckets. Bucket `i` has the
4964 /// following boundaries:
4965 ///
4966 /// Upper bound (0 <= i < N-1): offset + (width * i).
4967 ///
4968 /// Lower bound (1 <= i < N): offset + (width * (i - 1)).
4969 #[derive(Clone, Default, PartialEq)]
4970 #[non_exhaustive]
4971 pub struct Linear {
4972 /// Must be greater than 0.
4973 pub num_finite_buckets: i32,
4974
4975 /// Must be greater than 0.
4976 pub width: f64,
4977
4978 /// Lower bound of the first bucket.
4979 pub offset: f64,
4980
4981 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4982 }
4983
4984 impl Linear {
4985 pub fn new() -> Self {
4986 std::default::Default::default()
4987 }
4988
4989 /// Sets the value of [num_finite_buckets][crate::model::distribution::bucket_options::Linear::num_finite_buckets].
4990 ///
4991 /// # Example
4992 /// ```ignore,no_run
4993 /// # use google_cloud_api::model::distribution::bucket_options::Linear;
4994 /// let x = Linear::new().set_num_finite_buckets(42);
4995 /// ```
4996 pub fn set_num_finite_buckets<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4997 self.num_finite_buckets = v.into();
4998 self
4999 }
5000
5001 /// Sets the value of [width][crate::model::distribution::bucket_options::Linear::width].
5002 ///
5003 /// # Example
5004 /// ```ignore,no_run
5005 /// # use google_cloud_api::model::distribution::bucket_options::Linear;
5006 /// let x = Linear::new().set_width(42.0);
5007 /// ```
5008 pub fn set_width<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
5009 self.width = v.into();
5010 self
5011 }
5012
5013 /// Sets the value of [offset][crate::model::distribution::bucket_options::Linear::offset].
5014 ///
5015 /// # Example
5016 /// ```ignore,no_run
5017 /// # use google_cloud_api::model::distribution::bucket_options::Linear;
5018 /// let x = Linear::new().set_offset(42.0);
5019 /// ```
5020 pub fn set_offset<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
5021 self.offset = v.into();
5022 self
5023 }
5024 }
5025
5026 impl wkt::message::Message for Linear {
5027 fn typename() -> &'static str {
5028 "type.googleapis.com/google.api.Distribution.BucketOptions.Linear"
5029 }
5030 }
5031
5032 /// Specifies an exponential sequence of buckets that have a width that is
5033 /// proportional to the value of the lower bound. Each bucket represents a
5034 /// constant relative uncertainty on a specific value in the bucket.
5035 ///
5036 /// There are `num_finite_buckets + 2` (= N) buckets. Bucket `i` has the
5037 /// following boundaries:
5038 ///
5039 /// Upper bound (0 <= i < N-1): scale * (growth_factor ^ i).
5040 ///
5041 /// Lower bound (1 <= i < N): scale * (growth_factor ^ (i - 1)).
5042 #[derive(Clone, Default, PartialEq)]
5043 #[non_exhaustive]
5044 pub struct Exponential {
5045 /// Must be greater than 0.
5046 pub num_finite_buckets: i32,
5047
5048 /// Must be greater than 1.
5049 pub growth_factor: f64,
5050
5051 /// Must be greater than 0.
5052 pub scale: f64,
5053
5054 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5055 }
5056
5057 impl Exponential {
5058 pub fn new() -> Self {
5059 std::default::Default::default()
5060 }
5061
5062 /// Sets the value of [num_finite_buckets][crate::model::distribution::bucket_options::Exponential::num_finite_buckets].
5063 ///
5064 /// # Example
5065 /// ```ignore,no_run
5066 /// # use google_cloud_api::model::distribution::bucket_options::Exponential;
5067 /// let x = Exponential::new().set_num_finite_buckets(42);
5068 /// ```
5069 pub fn set_num_finite_buckets<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5070 self.num_finite_buckets = v.into();
5071 self
5072 }
5073
5074 /// Sets the value of [growth_factor][crate::model::distribution::bucket_options::Exponential::growth_factor].
5075 ///
5076 /// # Example
5077 /// ```ignore,no_run
5078 /// # use google_cloud_api::model::distribution::bucket_options::Exponential;
5079 /// let x = Exponential::new().set_growth_factor(42.0);
5080 /// ```
5081 pub fn set_growth_factor<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
5082 self.growth_factor = v.into();
5083 self
5084 }
5085
5086 /// Sets the value of [scale][crate::model::distribution::bucket_options::Exponential::scale].
5087 ///
5088 /// # Example
5089 /// ```ignore,no_run
5090 /// # use google_cloud_api::model::distribution::bucket_options::Exponential;
5091 /// let x = Exponential::new().set_scale(42.0);
5092 /// ```
5093 pub fn set_scale<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
5094 self.scale = v.into();
5095 self
5096 }
5097 }
5098
5099 impl wkt::message::Message for Exponential {
5100 fn typename() -> &'static str {
5101 "type.googleapis.com/google.api.Distribution.BucketOptions.Exponential"
5102 }
5103 }
5104
5105 /// Specifies a set of buckets with arbitrary widths.
5106 ///
5107 /// There are `size(bounds) + 1` (= N) buckets. Bucket `i` has the following
5108 /// boundaries:
5109 ///
5110 /// Upper bound (0 <= i < N-1): bounds[i]
5111 /// Lower bound (1 <= i < N); bounds[i - 1]
5112 ///
5113 /// The `bounds` field must contain at least one element. If `bounds` has
5114 /// only one element, then there are no finite buckets, and that single
5115 /// element is the common boundary of the overflow and underflow buckets.
5116 #[derive(Clone, Default, PartialEq)]
5117 #[non_exhaustive]
5118 pub struct Explicit {
5119 /// The values must be monotonically increasing.
5120 pub bounds: std::vec::Vec<f64>,
5121
5122 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5123 }
5124
5125 impl Explicit {
5126 pub fn new() -> Self {
5127 std::default::Default::default()
5128 }
5129
5130 /// Sets the value of [bounds][crate::model::distribution::bucket_options::Explicit::bounds].
5131 ///
5132 /// # Example
5133 /// ```ignore,no_run
5134 /// # use google_cloud_api::model::distribution::bucket_options::Explicit;
5135 /// let x = Explicit::new().set_bounds([1.0, 2.0, 3.0]);
5136 /// ```
5137 pub fn set_bounds<T, V>(mut self, v: T) -> Self
5138 where
5139 T: std::iter::IntoIterator<Item = V>,
5140 V: std::convert::Into<f64>,
5141 {
5142 use std::iter::Iterator;
5143 self.bounds = v.into_iter().map(|i| i.into()).collect();
5144 self
5145 }
5146 }
5147
5148 impl wkt::message::Message for Explicit {
5149 fn typename() -> &'static str {
5150 "type.googleapis.com/google.api.Distribution.BucketOptions.Explicit"
5151 }
5152 }
5153
5154 /// Exactly one of these three fields must be set.
5155 #[derive(Clone, Debug, PartialEq)]
5156 #[non_exhaustive]
5157 pub enum Options {
5158 /// The linear bucket.
5159 LinearBuckets(std::boxed::Box<crate::model::distribution::bucket_options::Linear>),
5160 /// The exponential buckets.
5161 ExponentialBuckets(
5162 std::boxed::Box<crate::model::distribution::bucket_options::Exponential>,
5163 ),
5164 /// The explicit buckets.
5165 ExplicitBuckets(std::boxed::Box<crate::model::distribution::bucket_options::Explicit>),
5166 }
5167 }
5168
5169 /// Exemplars are example points that may be used to annotate aggregated
5170 /// distribution values. They are metadata that gives information about a
5171 /// particular value added to a Distribution bucket, such as a trace ID that
5172 /// was active when a value was added. They may contain further information,
5173 /// such as a example values and timestamps, origin, etc.
5174 #[derive(Clone, Default, PartialEq)]
5175 #[non_exhaustive]
5176 pub struct Exemplar {
5177 /// Value of the exemplar point. This value determines to which bucket the
5178 /// exemplar belongs.
5179 pub value: f64,
5180
5181 /// The observation (sampling) time of the above value.
5182 pub timestamp: std::option::Option<wkt::Timestamp>,
5183
5184 /// Contextual information about the example value. Examples are:
5185 ///
5186 /// Trace: type.googleapis.com/google.monitoring.v3.SpanContext
5187 ///
5188 /// Literal string: type.googleapis.com/google.protobuf.StringValue
5189 ///
5190 /// Labels dropped during aggregation:
5191 /// type.googleapis.com/google.monitoring.v3.DroppedLabels
5192 ///
5193 /// There may be only a single attachment of any given message type in a
5194 /// single exemplar, and this is enforced by the system.
5195 pub attachments: std::vec::Vec<wkt::Any>,
5196
5197 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5198 }
5199
5200 impl Exemplar {
5201 pub fn new() -> Self {
5202 std::default::Default::default()
5203 }
5204
5205 /// Sets the value of [value][crate::model::distribution::Exemplar::value].
5206 ///
5207 /// # Example
5208 /// ```ignore,no_run
5209 /// # use google_cloud_api::model::distribution::Exemplar;
5210 /// let x = Exemplar::new().set_value(42.0);
5211 /// ```
5212 pub fn set_value<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
5213 self.value = v.into();
5214 self
5215 }
5216
5217 /// Sets the value of [timestamp][crate::model::distribution::Exemplar::timestamp].
5218 ///
5219 /// # Example
5220 /// ```ignore,no_run
5221 /// # use google_cloud_api::model::distribution::Exemplar;
5222 /// use wkt::Timestamp;
5223 /// let x = Exemplar::new().set_timestamp(Timestamp::default()/* use setters */);
5224 /// ```
5225 pub fn set_timestamp<T>(mut self, v: T) -> Self
5226 where
5227 T: std::convert::Into<wkt::Timestamp>,
5228 {
5229 self.timestamp = std::option::Option::Some(v.into());
5230 self
5231 }
5232
5233 /// Sets or clears the value of [timestamp][crate::model::distribution::Exemplar::timestamp].
5234 ///
5235 /// # Example
5236 /// ```ignore,no_run
5237 /// # use google_cloud_api::model::distribution::Exemplar;
5238 /// use wkt::Timestamp;
5239 /// let x = Exemplar::new().set_or_clear_timestamp(Some(Timestamp::default()/* use setters */));
5240 /// let x = Exemplar::new().set_or_clear_timestamp(None::<Timestamp>);
5241 /// ```
5242 pub fn set_or_clear_timestamp<T>(mut self, v: std::option::Option<T>) -> Self
5243 where
5244 T: std::convert::Into<wkt::Timestamp>,
5245 {
5246 self.timestamp = v.map(|x| x.into());
5247 self
5248 }
5249
5250 /// Sets the value of [attachments][crate::model::distribution::Exemplar::attachments].
5251 ///
5252 /// # Example
5253 /// ```ignore,no_run
5254 /// # use google_cloud_api::model::distribution::Exemplar;
5255 /// use wkt::Any;
5256 /// let x = Exemplar::new()
5257 /// .set_attachments([
5258 /// Any::default()/* use setters */,
5259 /// Any::default()/* use (different) setters */,
5260 /// ]);
5261 /// ```
5262 pub fn set_attachments<T, V>(mut self, v: T) -> Self
5263 where
5264 T: std::iter::IntoIterator<Item = V>,
5265 V: std::convert::Into<wkt::Any>,
5266 {
5267 use std::iter::Iterator;
5268 self.attachments = v.into_iter().map(|i| i.into()).collect();
5269 self
5270 }
5271 }
5272
5273 impl wkt::message::Message for Exemplar {
5274 fn typename() -> &'static str {
5275 "type.googleapis.com/google.api.Distribution.Exemplar"
5276 }
5277 }
5278}
5279
5280/// `Documentation` provides the information for describing a service.
5281///
5282/// Example:
5283///
5284/// Documentation is provided in markdown syntax. In addition to
5285/// standard markdown features, definition lists, tables and fenced
5286/// code blocks are supported. Section headers can be provided and are
5287/// interpreted relative to the section nesting of the context where
5288/// a documentation fragment is embedded.
5289///
5290/// Documentation from the IDL is merged with documentation defined
5291/// via the config at normalization time, where documentation provided
5292/// by config rules overrides IDL provided.
5293///
5294/// A number of constructs specific to the API platform are supported
5295/// in documentation text.
5296///
5297/// In order to reference a proto element, the following
5298/// notation can be used:
5299///
5300/// To override the display text used for the link, this can be used:
5301///
5302/// Text can be excluded from doc using the following notation:
5303///
5304/// A few directives are available in documentation. Note that
5305/// directives must appear on a single line to be properly
5306/// identified. The `include` directive includes a markdown file from
5307/// an external source:
5308///
5309/// The `resource_for` directive marks a message to be the resource of
5310/// a collection in REST view. If it is not specified, tools attempt
5311/// to infer the resource from the operations in a collection:
5312///
5313/// The directive `suppress_warning` does not directly affect documentation
5314/// and is documented together with service config validation.
5315#[derive(Clone, Default, PartialEq)]
5316#[non_exhaustive]
5317pub struct Documentation {
5318 /// A short description of what the service does. The summary must be plain
5319 /// text. It becomes the overview of the service displayed in Google Cloud
5320 /// Console.
5321 /// NOTE: This field is equivalent to the standard field `description`.
5322 pub summary: std::string::String,
5323
5324 /// The top level pages for the documentation set.
5325 pub pages: std::vec::Vec<crate::model::Page>,
5326
5327 /// A list of documentation rules that apply to individual API elements.
5328 ///
5329 /// **NOTE:** All service configuration rules follow "last one wins" order.
5330 pub rules: std::vec::Vec<crate::model::DocumentationRule>,
5331
5332 /// The URL to the root of documentation.
5333 pub documentation_root_url: std::string::String,
5334
5335 /// Specifies the service root url if the default one (the service name
5336 /// from the yaml file) is not suitable. This can be seen in any fully
5337 /// specified service urls as well as sections that show a base that other
5338 /// urls are relative to.
5339 pub service_root_url: std::string::String,
5340
5341 /// Declares a single overview page. For example:
5342 ///
5343 /// This is a shortcut for the following declaration (using pages style):
5344 ///
5345 /// Note: you cannot specify both `overview` field and `pages` field.
5346 pub overview: std::string::String,
5347
5348 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5349}
5350
5351impl Documentation {
5352 pub fn new() -> Self {
5353 std::default::Default::default()
5354 }
5355
5356 /// Sets the value of [summary][crate::model::Documentation::summary].
5357 ///
5358 /// # Example
5359 /// ```ignore,no_run
5360 /// # use google_cloud_api::model::Documentation;
5361 /// let x = Documentation::new().set_summary("example");
5362 /// ```
5363 pub fn set_summary<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5364 self.summary = v.into();
5365 self
5366 }
5367
5368 /// Sets the value of [pages][crate::model::Documentation::pages].
5369 ///
5370 /// # Example
5371 /// ```ignore,no_run
5372 /// # use google_cloud_api::model::Documentation;
5373 /// use google_cloud_api::model::Page;
5374 /// let x = Documentation::new()
5375 /// .set_pages([
5376 /// Page::default()/* use setters */,
5377 /// Page::default()/* use (different) setters */,
5378 /// ]);
5379 /// ```
5380 pub fn set_pages<T, V>(mut self, v: T) -> Self
5381 where
5382 T: std::iter::IntoIterator<Item = V>,
5383 V: std::convert::Into<crate::model::Page>,
5384 {
5385 use std::iter::Iterator;
5386 self.pages = v.into_iter().map(|i| i.into()).collect();
5387 self
5388 }
5389
5390 /// Sets the value of [rules][crate::model::Documentation::rules].
5391 ///
5392 /// # Example
5393 /// ```ignore,no_run
5394 /// # use google_cloud_api::model::Documentation;
5395 /// use google_cloud_api::model::DocumentationRule;
5396 /// let x = Documentation::new()
5397 /// .set_rules([
5398 /// DocumentationRule::default()/* use setters */,
5399 /// DocumentationRule::default()/* use (different) setters */,
5400 /// ]);
5401 /// ```
5402 pub fn set_rules<T, V>(mut self, v: T) -> Self
5403 where
5404 T: std::iter::IntoIterator<Item = V>,
5405 V: std::convert::Into<crate::model::DocumentationRule>,
5406 {
5407 use std::iter::Iterator;
5408 self.rules = v.into_iter().map(|i| i.into()).collect();
5409 self
5410 }
5411
5412 /// Sets the value of [documentation_root_url][crate::model::Documentation::documentation_root_url].
5413 ///
5414 /// # Example
5415 /// ```ignore,no_run
5416 /// # use google_cloud_api::model::Documentation;
5417 /// let x = Documentation::new().set_documentation_root_url("example");
5418 /// ```
5419 pub fn set_documentation_root_url<T: std::convert::Into<std::string::String>>(
5420 mut self,
5421 v: T,
5422 ) -> Self {
5423 self.documentation_root_url = v.into();
5424 self
5425 }
5426
5427 /// Sets the value of [service_root_url][crate::model::Documentation::service_root_url].
5428 ///
5429 /// # Example
5430 /// ```ignore,no_run
5431 /// # use google_cloud_api::model::Documentation;
5432 /// let x = Documentation::new().set_service_root_url("example");
5433 /// ```
5434 pub fn set_service_root_url<T: std::convert::Into<std::string::String>>(
5435 mut self,
5436 v: T,
5437 ) -> Self {
5438 self.service_root_url = v.into();
5439 self
5440 }
5441
5442 /// Sets the value of [overview][crate::model::Documentation::overview].
5443 ///
5444 /// # Example
5445 /// ```ignore,no_run
5446 /// # use google_cloud_api::model::Documentation;
5447 /// let x = Documentation::new().set_overview("example");
5448 /// ```
5449 pub fn set_overview<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5450 self.overview = v.into();
5451 self
5452 }
5453}
5454
5455impl wkt::message::Message for Documentation {
5456 fn typename() -> &'static str {
5457 "type.googleapis.com/google.api.Documentation"
5458 }
5459}
5460
5461/// A documentation rule provides information about individual API elements.
5462#[derive(Clone, Default, PartialEq)]
5463#[non_exhaustive]
5464pub struct DocumentationRule {
5465 /// The selector is a comma-separated list of patterns for any element such as
5466 /// a method, a field, an enum value. Each pattern is a qualified name of the
5467 /// element which may end in "*", indicating a wildcard. Wildcards are only
5468 /// allowed at the end and for a whole component of the qualified name,
5469 /// i.e. "foo.*" is ok, but not "foo.b*" or "foo.*.bar". A wildcard will match
5470 /// one or more components. To specify a default for all applicable elements,
5471 /// the whole pattern "*" is used.
5472 pub selector: std::string::String,
5473
5474 /// Description of the selected proto element (e.g. a message, a method, a
5475 /// 'service' definition, or a field). Defaults to leading & trailing comments
5476 /// taken from the proto source definition of the proto element.
5477 pub description: std::string::String,
5478
5479 /// Deprecation description of the selected element(s). It can be provided if
5480 /// an element is marked as `deprecated`.
5481 pub deprecation_description: std::string::String,
5482
5483 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5484}
5485
5486impl DocumentationRule {
5487 pub fn new() -> Self {
5488 std::default::Default::default()
5489 }
5490
5491 /// Sets the value of [selector][crate::model::DocumentationRule::selector].
5492 ///
5493 /// # Example
5494 /// ```ignore,no_run
5495 /// # use google_cloud_api::model::DocumentationRule;
5496 /// let x = DocumentationRule::new().set_selector("example");
5497 /// ```
5498 pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5499 self.selector = v.into();
5500 self
5501 }
5502
5503 /// Sets the value of [description][crate::model::DocumentationRule::description].
5504 ///
5505 /// # Example
5506 /// ```ignore,no_run
5507 /// # use google_cloud_api::model::DocumentationRule;
5508 /// let x = DocumentationRule::new().set_description("example");
5509 /// ```
5510 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5511 self.description = v.into();
5512 self
5513 }
5514
5515 /// Sets the value of [deprecation_description][crate::model::DocumentationRule::deprecation_description].
5516 ///
5517 /// # Example
5518 /// ```ignore,no_run
5519 /// # use google_cloud_api::model::DocumentationRule;
5520 /// let x = DocumentationRule::new().set_deprecation_description("example");
5521 /// ```
5522 pub fn set_deprecation_description<T: std::convert::Into<std::string::String>>(
5523 mut self,
5524 v: T,
5525 ) -> Self {
5526 self.deprecation_description = v.into();
5527 self
5528 }
5529}
5530
5531impl wkt::message::Message for DocumentationRule {
5532 fn typename() -> &'static str {
5533 "type.googleapis.com/google.api.DocumentationRule"
5534 }
5535}
5536
5537/// Represents a documentation page. A page can contain subpages to represent
5538/// nested documentation set structure.
5539#[derive(Clone, Default, PartialEq)]
5540#[non_exhaustive]
5541pub struct Page {
5542 /// The name of the page. It will be used as an identity of the page to
5543 /// generate URI of the page, text of the link to this page in navigation,
5544 /// etc. The full page name (start from the root page name to this page
5545 /// concatenated with `.`) can be used as reference to the page in your
5546 /// documentation. For example:
5547 ///
5548 /// You can reference `Java` page using Markdown reference link syntax:
5549 /// `[Java][Tutorial.Java]`.
5550 pub name: std::string::String,
5551
5552 /// The Markdown content of the page. You can use ```(== include {path}
5553 /// ==)``` to include content from a Markdown file. The content can be used
5554 /// to produce the documentation page such as HTML format page.
5555 pub content: std::string::String,
5556
5557 /// Subpages of this page. The order of subpages specified here will be
5558 /// honored in the generated docset.
5559 pub subpages: std::vec::Vec<crate::model::Page>,
5560
5561 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5562}
5563
5564impl Page {
5565 pub fn new() -> Self {
5566 std::default::Default::default()
5567 }
5568
5569 /// Sets the value of [name][crate::model::Page::name].
5570 ///
5571 /// # Example
5572 /// ```ignore,no_run
5573 /// # use google_cloud_api::model::Page;
5574 /// let x = Page::new().set_name("example");
5575 /// ```
5576 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5577 self.name = v.into();
5578 self
5579 }
5580
5581 /// Sets the value of [content][crate::model::Page::content].
5582 ///
5583 /// # Example
5584 /// ```ignore,no_run
5585 /// # use google_cloud_api::model::Page;
5586 /// let x = Page::new().set_content("example");
5587 /// ```
5588 pub fn set_content<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5589 self.content = v.into();
5590 self
5591 }
5592
5593 /// Sets the value of [subpages][crate::model::Page::subpages].
5594 ///
5595 /// # Example
5596 /// ```ignore,no_run
5597 /// # use google_cloud_api::model::Page;
5598 /// let x = Page::new()
5599 /// .set_subpages([
5600 /// Page::default()/* use setters */,
5601 /// Page::default()/* use (different) setters */,
5602 /// ]);
5603 /// ```
5604 pub fn set_subpages<T, V>(mut self, v: T) -> Self
5605 where
5606 T: std::iter::IntoIterator<Item = V>,
5607 V: std::convert::Into<crate::model::Page>,
5608 {
5609 use std::iter::Iterator;
5610 self.subpages = v.into_iter().map(|i| i.into()).collect();
5611 self
5612 }
5613}
5614
5615impl wkt::message::Message for Page {
5616 fn typename() -> &'static str {
5617 "type.googleapis.com/google.api.Page"
5618 }
5619}
5620
5621/// `Endpoint` describes a network address of a service that serves a set of
5622/// APIs. It is commonly known as a service endpoint. A service may expose
5623/// any number of service endpoints, and all service endpoints share the same
5624/// service definition, such as quota limits and monitoring metrics.
5625///
5626/// Example:
5627///
5628/// ```norust
5629/// type: google.api.Service
5630/// name: library-example.googleapis.com
5631/// endpoints:
5632/// # Declares network address `https://library-example.googleapis.com`
5633/// # for service `library-example.googleapis.com`. The `https` scheme
5634/// # is implicit for all service endpoints. Other schemes may be
5635/// # supported in the future.
5636/// - name: library-example.googleapis.com
5637/// allow_cors: false
5638/// - name: content-staging-library-example.googleapis.com
5639/// # Allows HTTP OPTIONS calls to be passed to the API frontend, for it
5640/// # to decide whether the subsequent cross-origin request is allowed
5641/// # to proceed.
5642/// allow_cors: true
5643/// ```
5644#[derive(Clone, Default, PartialEq)]
5645#[non_exhaustive]
5646pub struct Endpoint {
5647 /// The canonical name of this endpoint.
5648 pub name: std::string::String,
5649
5650 /// Aliases for this endpoint, these will be served by the same UrlMap as the
5651 /// parent endpoint, and will be provisioned in the GCP stack for the Regional
5652 /// Endpoints.
5653 pub aliases: std::vec::Vec<std::string::String>,
5654
5655 /// The specification of an Internet routable address of API frontend that will
5656 /// handle requests to this [API
5657 /// Endpoint](https://cloud.google.com/apis/design/glossary). It should be
5658 /// either a valid IPv4 address or a fully-qualified domain name. For example,
5659 /// "8.8.8.8" or "myservice.appspot.com".
5660 pub target: std::string::String,
5661
5662 /// Allowing
5663 /// [CORS](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing), aka
5664 /// cross-domain traffic, would allow the backends served from this endpoint to
5665 /// receive and respond to HTTP OPTIONS requests. The response will be used by
5666 /// the browser to determine whether the subsequent cross-origin request is
5667 /// allowed to proceed.
5668 pub allow_cors: bool,
5669
5670 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5671}
5672
5673impl Endpoint {
5674 pub fn new() -> Self {
5675 std::default::Default::default()
5676 }
5677
5678 /// Sets the value of [name][crate::model::Endpoint::name].
5679 ///
5680 /// # Example
5681 /// ```ignore,no_run
5682 /// # use google_cloud_api::model::Endpoint;
5683 /// let x = Endpoint::new().set_name("example");
5684 /// ```
5685 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5686 self.name = v.into();
5687 self
5688 }
5689
5690 /// Sets the value of [aliases][crate::model::Endpoint::aliases].
5691 ///
5692 /// # Example
5693 /// ```ignore,no_run
5694 /// # use google_cloud_api::model::Endpoint;
5695 /// let x = Endpoint::new().set_aliases(["a", "b", "c"]);
5696 /// ```
5697 pub fn set_aliases<T, V>(mut self, v: T) -> Self
5698 where
5699 T: std::iter::IntoIterator<Item = V>,
5700 V: std::convert::Into<std::string::String>,
5701 {
5702 use std::iter::Iterator;
5703 self.aliases = v.into_iter().map(|i| i.into()).collect();
5704 self
5705 }
5706
5707 /// Sets the value of [target][crate::model::Endpoint::target].
5708 ///
5709 /// # Example
5710 /// ```ignore,no_run
5711 /// # use google_cloud_api::model::Endpoint;
5712 /// let x = Endpoint::new().set_target("example");
5713 /// ```
5714 pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5715 self.target = v.into();
5716 self
5717 }
5718
5719 /// Sets the value of [allow_cors][crate::model::Endpoint::allow_cors].
5720 ///
5721 /// # Example
5722 /// ```ignore,no_run
5723 /// # use google_cloud_api::model::Endpoint;
5724 /// let x = Endpoint::new().set_allow_cors(true);
5725 /// ```
5726 pub fn set_allow_cors<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5727 self.allow_cors = v.into();
5728 self
5729 }
5730}
5731
5732impl wkt::message::Message for Endpoint {
5733 fn typename() -> &'static str {
5734 "type.googleapis.com/google.api.Endpoint"
5735 }
5736}
5737
5738/// Rich semantic information of an API field beyond basic typing.
5739#[derive(Clone, Default, PartialEq)]
5740#[non_exhaustive]
5741pub struct FieldInfo {
5742 /// The standard format of a field value. This does not explicitly configure
5743 /// any API consumer, just documents the API's format for the field it is
5744 /// applied to.
5745 pub format: crate::model::field_info::Format,
5746
5747 /// The type(s) that the annotated, generic field may represent.
5748 ///
5749 /// Currently, this must only be used on fields of type `google.protobuf.Any`.
5750 /// Supporting other generic types may be considered in the future.
5751 pub referenced_types: std::vec::Vec<crate::model::TypeReference>,
5752
5753 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5754}
5755
5756impl FieldInfo {
5757 pub fn new() -> Self {
5758 std::default::Default::default()
5759 }
5760
5761 /// Sets the value of [format][crate::model::FieldInfo::format].
5762 ///
5763 /// # Example
5764 /// ```ignore,no_run
5765 /// # use google_cloud_api::model::FieldInfo;
5766 /// use google_cloud_api::model::field_info::Format;
5767 /// let x0 = FieldInfo::new().set_format(Format::Uuid4);
5768 /// let x1 = FieldInfo::new().set_format(Format::Ipv4);
5769 /// let x2 = FieldInfo::new().set_format(Format::Ipv6);
5770 /// ```
5771 pub fn set_format<T: std::convert::Into<crate::model::field_info::Format>>(
5772 mut self,
5773 v: T,
5774 ) -> Self {
5775 self.format = v.into();
5776 self
5777 }
5778
5779 /// Sets the value of [referenced_types][crate::model::FieldInfo::referenced_types].
5780 ///
5781 /// # Example
5782 /// ```ignore,no_run
5783 /// # use google_cloud_api::model::FieldInfo;
5784 /// use google_cloud_api::model::TypeReference;
5785 /// let x = FieldInfo::new()
5786 /// .set_referenced_types([
5787 /// TypeReference::default()/* use setters */,
5788 /// TypeReference::default()/* use (different) setters */,
5789 /// ]);
5790 /// ```
5791 pub fn set_referenced_types<T, V>(mut self, v: T) -> Self
5792 where
5793 T: std::iter::IntoIterator<Item = V>,
5794 V: std::convert::Into<crate::model::TypeReference>,
5795 {
5796 use std::iter::Iterator;
5797 self.referenced_types = v.into_iter().map(|i| i.into()).collect();
5798 self
5799 }
5800}
5801
5802impl wkt::message::Message for FieldInfo {
5803 fn typename() -> &'static str {
5804 "type.googleapis.com/google.api.FieldInfo"
5805 }
5806}
5807
5808/// Defines additional types related to [FieldInfo].
5809pub mod field_info {
5810 #[allow(unused_imports)]
5811 use super::*;
5812
5813 /// The standard format of a field value. The supported formats are all backed
5814 /// by either an RFC defined by the IETF or a Google-defined AIP.
5815 ///
5816 /// # Working with unknown values
5817 ///
5818 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5819 /// additional enum variants at any time. Adding new variants is not considered
5820 /// a breaking change. Applications should write their code in anticipation of:
5821 ///
5822 /// - New values appearing in future releases of the client library, **and**
5823 /// - New values received dynamically, without application changes.
5824 ///
5825 /// Please consult the [Working with enums] section in the user guide for some
5826 /// guidelines.
5827 ///
5828 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5829 #[derive(Clone, Debug, PartialEq)]
5830 #[non_exhaustive]
5831 pub enum Format {
5832 /// Default, unspecified value.
5833 Unspecified,
5834 /// Universally Unique Identifier, version 4, value as defined by
5835 /// <https://datatracker.ietf.org/doc/html/rfc4122>. The value may be
5836 /// normalized to entirely lowercase letters. For example, the value
5837 /// `F47AC10B-58CC-0372-8567-0E02B2C3D479` would be normalized to
5838 /// `f47ac10b-58cc-0372-8567-0e02b2c3d479`.
5839 Uuid4,
5840 /// Internet Protocol v4 value as defined by [RFC
5841 /// 791](https://datatracker.ietf.org/doc/html/rfc791). The value may be
5842 /// condensed, with leading zeros in each octet stripped. For example,
5843 /// `001.022.233.040` would be condensed to `1.22.233.40`.
5844 Ipv4,
5845 /// Internet Protocol v6 value as defined by [RFC
5846 /// 2460](https://datatracker.ietf.org/doc/html/rfc2460). The value may be
5847 /// normalized to entirely lowercase letters with zeros compressed, following
5848 /// [RFC 5952](https://datatracker.ietf.org/doc/html/rfc5952). For example,
5849 /// the value `2001:0DB8:0::0` would be normalized to `2001:db8::`.
5850 Ipv6,
5851 /// An IP address in either v4 or v6 format as described by the individual
5852 /// values defined herein. See the comments on the IPV4 and IPV6 types for
5853 /// allowed normalizations of each.
5854 Ipv4OrIpv6,
5855 /// If set, the enum was initialized with an unknown value.
5856 ///
5857 /// Applications can examine the value using [Format::value] or
5858 /// [Format::name].
5859 UnknownValue(format::UnknownValue),
5860 }
5861
5862 #[doc(hidden)]
5863 pub mod format {
5864 #[allow(unused_imports)]
5865 use super::*;
5866 #[derive(Clone, Debug, PartialEq)]
5867 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5868 }
5869
5870 impl Format {
5871 /// Gets the enum value.
5872 ///
5873 /// Returns `None` if the enum contains an unknown value deserialized from
5874 /// the string representation of enums.
5875 pub fn value(&self) -> std::option::Option<i32> {
5876 match self {
5877 Self::Unspecified => std::option::Option::Some(0),
5878 Self::Uuid4 => std::option::Option::Some(1),
5879 Self::Ipv4 => std::option::Option::Some(2),
5880 Self::Ipv6 => std::option::Option::Some(3),
5881 Self::Ipv4OrIpv6 => std::option::Option::Some(4),
5882 Self::UnknownValue(u) => u.0.value(),
5883 }
5884 }
5885
5886 /// Gets the enum value as a string.
5887 ///
5888 /// Returns `None` if the enum contains an unknown value deserialized from
5889 /// the integer representation of enums.
5890 pub fn name(&self) -> std::option::Option<&str> {
5891 match self {
5892 Self::Unspecified => std::option::Option::Some("FORMAT_UNSPECIFIED"),
5893 Self::Uuid4 => std::option::Option::Some("UUID4"),
5894 Self::Ipv4 => std::option::Option::Some("IPV4"),
5895 Self::Ipv6 => std::option::Option::Some("IPV6"),
5896 Self::Ipv4OrIpv6 => std::option::Option::Some("IPV4_OR_IPV6"),
5897 Self::UnknownValue(u) => u.0.name(),
5898 }
5899 }
5900 }
5901
5902 impl std::default::Default for Format {
5903 fn default() -> Self {
5904 use std::convert::From;
5905 Self::from(0)
5906 }
5907 }
5908
5909 impl std::fmt::Display for Format {
5910 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5911 wkt::internal::display_enum(f, self.name(), self.value())
5912 }
5913 }
5914
5915 impl std::convert::From<i32> for Format {
5916 fn from(value: i32) -> Self {
5917 match value {
5918 0 => Self::Unspecified,
5919 1 => Self::Uuid4,
5920 2 => Self::Ipv4,
5921 3 => Self::Ipv6,
5922 4 => Self::Ipv4OrIpv6,
5923 _ => Self::UnknownValue(format::UnknownValue(
5924 wkt::internal::UnknownEnumValue::Integer(value),
5925 )),
5926 }
5927 }
5928 }
5929
5930 impl std::convert::From<&str> for Format {
5931 fn from(value: &str) -> Self {
5932 use std::string::ToString;
5933 match value {
5934 "FORMAT_UNSPECIFIED" => Self::Unspecified,
5935 "UUID4" => Self::Uuid4,
5936 "IPV4" => Self::Ipv4,
5937 "IPV6" => Self::Ipv6,
5938 "IPV4_OR_IPV6" => Self::Ipv4OrIpv6,
5939 _ => Self::UnknownValue(format::UnknownValue(
5940 wkt::internal::UnknownEnumValue::String(value.to_string()),
5941 )),
5942 }
5943 }
5944 }
5945
5946 impl serde::ser::Serialize for Format {
5947 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5948 where
5949 S: serde::Serializer,
5950 {
5951 match self {
5952 Self::Unspecified => serializer.serialize_i32(0),
5953 Self::Uuid4 => serializer.serialize_i32(1),
5954 Self::Ipv4 => serializer.serialize_i32(2),
5955 Self::Ipv6 => serializer.serialize_i32(3),
5956 Self::Ipv4OrIpv6 => serializer.serialize_i32(4),
5957 Self::UnknownValue(u) => u.0.serialize(serializer),
5958 }
5959 }
5960 }
5961
5962 impl<'de> serde::de::Deserialize<'de> for Format {
5963 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5964 where
5965 D: serde::Deserializer<'de>,
5966 {
5967 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Format>::new(
5968 ".google.api.FieldInfo.Format",
5969 ))
5970 }
5971 }
5972}
5973
5974/// A reference to a message type, for use in [FieldInfo][google.api.FieldInfo].
5975///
5976/// [google.api.FieldInfo]: crate::model::FieldInfo
5977#[derive(Clone, Default, PartialEq)]
5978#[non_exhaustive]
5979pub struct TypeReference {
5980 /// The name of the type that the annotated, generic field may represent.
5981 /// If the type is in the same protobuf package, the value can be the simple
5982 /// message name e.g., `"MyMessage"`. Otherwise, the value must be the
5983 /// fully-qualified message name e.g., `"google.library.v1.Book"`.
5984 ///
5985 /// If the type(s) are unknown to the service (e.g. the field accepts generic
5986 /// user input), use the wildcard `"*"` to denote this behavior.
5987 ///
5988 /// See [AIP-202](https://google.aip.dev/202#type-references) for more details.
5989 pub type_name: std::string::String,
5990
5991 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5992}
5993
5994impl TypeReference {
5995 pub fn new() -> Self {
5996 std::default::Default::default()
5997 }
5998
5999 /// Sets the value of [type_name][crate::model::TypeReference::type_name].
6000 ///
6001 /// # Example
6002 /// ```ignore,no_run
6003 /// # use google_cloud_api::model::TypeReference;
6004 /// let x = TypeReference::new().set_type_name("example");
6005 /// ```
6006 pub fn set_type_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6007 self.type_name = v.into();
6008 self
6009 }
6010}
6011
6012impl wkt::message::Message for TypeReference {
6013 fn typename() -> &'static str {
6014 "type.googleapis.com/google.api.TypeReference"
6015 }
6016}
6017
6018/// Defines the HTTP configuration for an API service. It contains a list of
6019/// [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method
6020/// to one or more HTTP REST API methods.
6021///
6022/// [google.api.HttpRule]: crate::model::HttpRule
6023#[derive(Clone, Default, PartialEq)]
6024#[non_exhaustive]
6025pub struct Http {
6026 /// A list of HTTP configuration rules that apply to individual API methods.
6027 ///
6028 /// **NOTE:** All service configuration rules follow "last one wins" order.
6029 pub rules: std::vec::Vec<crate::model::HttpRule>,
6030
6031 /// When set to true, URL path parameters will be fully URI-decoded except in
6032 /// cases of single segment matches in reserved expansion, where "%2F" will be
6033 /// left encoded.
6034 ///
6035 /// The default behavior is to not decode RFC 6570 reserved characters in multi
6036 /// segment matches.
6037 pub fully_decode_reserved_expansion: bool,
6038
6039 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6040}
6041
6042impl Http {
6043 pub fn new() -> Self {
6044 std::default::Default::default()
6045 }
6046
6047 /// Sets the value of [rules][crate::model::Http::rules].
6048 ///
6049 /// # Example
6050 /// ```ignore,no_run
6051 /// # use google_cloud_api::model::Http;
6052 /// use google_cloud_api::model::HttpRule;
6053 /// let x = Http::new()
6054 /// .set_rules([
6055 /// HttpRule::default()/* use setters */,
6056 /// HttpRule::default()/* use (different) setters */,
6057 /// ]);
6058 /// ```
6059 pub fn set_rules<T, V>(mut self, v: T) -> Self
6060 where
6061 T: std::iter::IntoIterator<Item = V>,
6062 V: std::convert::Into<crate::model::HttpRule>,
6063 {
6064 use std::iter::Iterator;
6065 self.rules = v.into_iter().map(|i| i.into()).collect();
6066 self
6067 }
6068
6069 /// Sets the value of [fully_decode_reserved_expansion][crate::model::Http::fully_decode_reserved_expansion].
6070 ///
6071 /// # Example
6072 /// ```ignore,no_run
6073 /// # use google_cloud_api::model::Http;
6074 /// let x = Http::new().set_fully_decode_reserved_expansion(true);
6075 /// ```
6076 pub fn set_fully_decode_reserved_expansion<T: std::convert::Into<bool>>(
6077 mut self,
6078 v: T,
6079 ) -> Self {
6080 self.fully_decode_reserved_expansion = v.into();
6081 self
6082 }
6083}
6084
6085impl wkt::message::Message for Http {
6086 fn typename() -> &'static str {
6087 "type.googleapis.com/google.api.Http"
6088 }
6089}
6090
6091/// gRPC Transcoding
6092///
6093/// gRPC Transcoding is a feature for mapping between a gRPC method and one or
6094/// more HTTP REST endpoints. It allows developers to build a single API service
6095/// that supports both gRPC APIs and REST APIs. Many systems, including [Google
6096/// APIs](https://github.com/googleapis/googleapis),
6097/// [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC
6098/// Gateway](https://github.com/grpc-ecosystem/grpc-gateway),
6099/// and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature
6100/// and use it for large scale production services.
6101///
6102/// `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies
6103/// how different portions of the gRPC request message are mapped to the URL
6104/// path, URL query parameters, and HTTP request body. It also controls how the
6105/// gRPC response message is mapped to the HTTP response body. `HttpRule` is
6106/// typically specified as an `google.api.http` annotation on the gRPC method.
6107///
6108/// Each mapping specifies a URL path template and an HTTP method. The path
6109/// template may refer to one or more fields in the gRPC request message, as long
6110/// as each field is a non-repeated field with a primitive (non-message) type.
6111/// The path template controls how fields of the request message are mapped to
6112/// the URL path.
6113///
6114/// Example:
6115///
6116/// ```norust
6117/// service Messaging {
6118/// rpc GetMessage(GetMessageRequest) returns (Message) {
6119/// option (google.api.http) = {
6120/// get: "/v1/{name=messages/*}"
6121/// };
6122/// }
6123/// }
6124/// message GetMessageRequest {
6125/// string name = 1; // Mapped to URL path.
6126/// }
6127/// message Message {
6128/// string text = 1; // The resource content.
6129/// }
6130/// ```
6131///
6132/// This enables an HTTP REST to gRPC mapping as below:
6133///
6134/// - HTTP: `GET /v1/messages/123456`
6135/// - gRPC: `GetMessage(name: "messages/123456")`
6136///
6137/// Any fields in the request message which are not bound by the path template
6138/// automatically become HTTP query parameters if there is no HTTP request body.
6139/// For example:
6140///
6141/// ```norust
6142/// service Messaging {
6143/// rpc GetMessage(GetMessageRequest) returns (Message) {
6144/// option (google.api.http) = {
6145/// get:"/v1/messages/{message_id}"
6146/// };
6147/// }
6148/// }
6149/// message GetMessageRequest {
6150/// message SubMessage {
6151/// string subfield = 1;
6152/// }
6153/// string message_id = 1; // Mapped to URL path.
6154/// int64 revision = 2; // Mapped to URL query parameter `revision`.
6155/// SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`.
6156/// }
6157/// ```
6158///
6159/// This enables a HTTP JSON to RPC mapping as below:
6160///
6161/// - HTTP: `GET /v1/messages/123456?revision=2&sub.subfield=foo`
6162/// - gRPC: `GetMessage(message_id: "123456" revision: 2 sub:
6163/// SubMessage(subfield: "foo"))`
6164///
6165/// Note that fields which are mapped to URL query parameters must have a
6166/// primitive type or a repeated primitive type or a non-repeated message type.
6167/// In the case of a repeated type, the parameter can be repeated in the URL
6168/// as `...?param=A¶m=B`. In the case of a message type, each field of the
6169/// message is mapped to a separate parameter, such as
6170/// `...?foo.a=A&foo.b=B&foo.c=C`.
6171///
6172/// For HTTP methods that allow a request body, the `body` field
6173/// specifies the mapping. Consider a REST update method on the
6174/// message resource collection:
6175///
6176/// ```norust
6177/// service Messaging {
6178/// rpc UpdateMessage(UpdateMessageRequest) returns (Message) {
6179/// option (google.api.http) = {
6180/// patch: "/v1/messages/{message_id}"
6181/// body: "message"
6182/// };
6183/// }
6184/// }
6185/// message UpdateMessageRequest {
6186/// string message_id = 1; // mapped to the URL
6187/// Message message = 2; // mapped to the body
6188/// }
6189/// ```
6190///
6191/// The following HTTP JSON to RPC mapping is enabled, where the
6192/// representation of the JSON in the request body is determined by
6193/// protos JSON encoding:
6194///
6195/// - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }`
6196/// - gRPC: `UpdateMessage(message_id: "123456" message { text: "Hi!" })`
6197///
6198/// The special name `*` can be used in the body mapping to define that
6199/// every field not bound by the path template should be mapped to the
6200/// request body. This enables the following alternative definition of
6201/// the update method:
6202///
6203/// ```norust
6204/// service Messaging {
6205/// rpc UpdateMessage(Message) returns (Message) {
6206/// option (google.api.http) = {
6207/// patch: "/v1/messages/{message_id}"
6208/// body: "*"
6209/// };
6210/// }
6211/// }
6212/// message Message {
6213/// string message_id = 1;
6214/// string text = 2;
6215/// }
6216/// ```
6217///
6218/// The following HTTP JSON to RPC mapping is enabled:
6219///
6220/// - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }`
6221/// - gRPC: `UpdateMessage(message_id: "123456" text: "Hi!")`
6222///
6223/// Note that when using `*` in the body mapping, it is not possible to
6224/// have HTTP parameters, as all fields not bound by the path end in
6225/// the body. This makes this option more rarely used in practice when
6226/// defining REST APIs. The common usage of `*` is in custom methods
6227/// which don't use the URL at all for transferring data.
6228///
6229/// It is possible to define multiple HTTP methods for one RPC by using
6230/// the `additional_bindings` option. Example:
6231///
6232/// ```norust
6233/// service Messaging {
6234/// rpc GetMessage(GetMessageRequest) returns (Message) {
6235/// option (google.api.http) = {
6236/// get: "/v1/messages/{message_id}"
6237/// additional_bindings {
6238/// get: "/v1/users/{user_id}/messages/{message_id}"
6239/// }
6240/// };
6241/// }
6242/// }
6243/// message GetMessageRequest {
6244/// string message_id = 1;
6245/// string user_id = 2;
6246/// }
6247/// ```
6248///
6249/// This enables the following two alternative HTTP JSON to RPC mappings:
6250///
6251/// - HTTP: `GET /v1/messages/123456`
6252///
6253/// - gRPC: `GetMessage(message_id: "123456")`
6254///
6255/// - HTTP: `GET /v1/users/me/messages/123456`
6256///
6257/// - gRPC: `GetMessage(user_id: "me" message_id: "123456")`
6258///
6259///
6260/// Rules for HTTP mapping
6261///
6262/// 1. Leaf request fields (recursive expansion nested messages in the request
6263/// message) are classified into three categories:
6264/// - Fields referred by the path template. They are passed via the URL path.
6265/// - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They
6266/// are passed via the HTTP
6267/// request body.
6268/// - All other fields are passed via the URL query parameters, and the
6269/// parameter name is the field path in the request message. A repeated
6270/// field can be represented as multiple query parameters under the same
6271/// name.
6272/// 1. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL
6273/// query parameter, all fields
6274/// are passed via URL path and HTTP request body.
6275/// 1. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP
6276/// request body, all
6277/// fields are passed via URL path and URL query parameters.
6278///
6279/// Path template syntax
6280///
6281/// ```norust
6282/// Template = "/" Segments [ Verb ] ;
6283/// Segments = Segment { "/" Segment } ;
6284/// Segment = "*" | "**" | LITERAL | Variable ;
6285/// Variable = "{" FieldPath [ "=" Segments ] "}" ;
6286/// FieldPath = IDENT { "." IDENT } ;
6287/// Verb = ":" LITERAL ;
6288/// ```
6289///
6290/// The syntax `*` matches a single URL path segment. The syntax `**` matches
6291/// zero or more URL path segments, which must be the last part of the URL path
6292/// except the `Verb`.
6293///
6294/// The syntax `Variable` matches part of the URL path as specified by its
6295/// template. A variable template must not contain other variables. If a variable
6296/// matches a single path segment, its template may be omitted, e.g. `{var}`
6297/// is equivalent to `{var=*}`.
6298///
6299/// The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL`
6300/// contains any reserved character, such characters should be percent-encoded
6301/// before the matching.
6302///
6303/// If a variable contains exactly one path segment, such as `"{var}"` or
6304/// `"{var=*}"`, when such a variable is expanded into a URL path on the client
6305/// side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The
6306/// server side does the reverse decoding. Such variables show up in the
6307/// [Discovery
6308/// Document](https://developers.google.com/discovery/v1/reference/apis) as
6309/// `{var}`.
6310///
6311/// If a variable contains multiple path segments, such as `"{var=foo/*}"`
6312/// or `"{var=**}"`, when such a variable is expanded into a URL path on the
6313/// client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded.
6314/// The server side does the reverse decoding, except "%2F" and "%2f" are left
6315/// unchanged. Such variables show up in the
6316/// [Discovery
6317/// Document](https://developers.google.com/discovery/v1/reference/apis) as
6318/// `{+var}`.
6319///
6320/// Using gRPC API Service Configuration
6321///
6322/// gRPC API Service Configuration (service config) is a configuration language
6323/// for configuring a gRPC service to become a user-facing product. The
6324/// service config is simply the YAML representation of the `google.api.Service`
6325/// proto message.
6326///
6327/// As an alternative to annotating your proto file, you can configure gRPC
6328/// transcoding in your service config YAML files. You do this by specifying a
6329/// `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same
6330/// effect as the proto annotation. This can be particularly useful if you
6331/// have a proto that is reused in multiple services. Note that any transcoding
6332/// specified in the service config will override any matching transcoding
6333/// configuration in the proto.
6334///
6335/// The following example selects a gRPC method and applies an `HttpRule` to it:
6336///
6337/// ```norust
6338/// http:
6339/// rules:
6340/// - selector: example.v1.Messaging.GetMessage
6341/// get: /v1/messages/{message_id}/{sub.subfield}
6342/// ```
6343///
6344/// Special notes
6345///
6346/// When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the
6347/// proto to JSON conversion must follow the [proto3
6348/// specification](https://developers.google.com/protocol-buffers/docs/proto3#json).
6349///
6350/// While the single segment variable follows the semantics of
6351/// [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String
6352/// Expansion, the multi segment variable **does not** follow RFC 6570 Section
6353/// 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion
6354/// does not expand special characters like `?` and `#`, which would lead
6355/// to invalid URLs. As the result, gRPC Transcoding uses a custom encoding
6356/// for multi segment variables.
6357///
6358/// The path variables **must not** refer to any repeated or mapped field,
6359/// because client libraries are not capable of handling such variable expansion.
6360///
6361/// The path variables **must not** capture the leading "/" character. The reason
6362/// is that the most common use case "{var}" does not capture the leading "/"
6363/// character. For consistency, all path variables must share the same behavior.
6364///
6365/// Repeated message fields must not be mapped to URL query parameters, because
6366/// no client library can support such complicated mapping.
6367///
6368/// If an API needs to use a JSON array for request or response body, it can map
6369/// the request or response body to a repeated field. However, some gRPC
6370/// Transcoding implementations may not support this feature.
6371///
6372/// [google.api.HttpRule.body]: crate::model::HttpRule::body
6373#[derive(Clone, Default, PartialEq)]
6374#[non_exhaustive]
6375pub struct HttpRule {
6376 /// Selects a method to which this rule applies.
6377 ///
6378 /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
6379 /// details.
6380 ///
6381 /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
6382 pub selector: std::string::String,
6383
6384 /// The name of the request field whose value is mapped to the HTTP request
6385 /// body, or `*` for mapping all request fields not captured by the path
6386 /// pattern to the HTTP body, or omitted for not having any HTTP request body.
6387 ///
6388 /// NOTE: the referred field must be present at the top-level of the request
6389 /// message type.
6390 pub body: std::string::String,
6391
6392 /// Optional. The name of the response field whose value is mapped to the HTTP
6393 /// response body. When omitted, the entire response message will be used
6394 /// as the HTTP response body.
6395 ///
6396 /// NOTE: The referred field must be present at the top-level of the response
6397 /// message type.
6398 pub response_body: std::string::String,
6399
6400 /// Additional HTTP bindings for the selector. Nested bindings must
6401 /// not contain an `additional_bindings` field themselves (that is,
6402 /// the nesting may only be one level deep).
6403 pub additional_bindings: std::vec::Vec<crate::model::HttpRule>,
6404
6405 /// Determines the URL pattern is matched by this rules. This pattern can be
6406 /// used with any of the {get|put|post|delete|patch} methods. A custom method
6407 /// can be defined using the 'custom' field.
6408 pub pattern: std::option::Option<crate::model::http_rule::Pattern>,
6409
6410 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6411}
6412
6413impl HttpRule {
6414 pub fn new() -> Self {
6415 std::default::Default::default()
6416 }
6417
6418 /// Sets the value of [selector][crate::model::HttpRule::selector].
6419 ///
6420 /// # Example
6421 /// ```ignore,no_run
6422 /// # use google_cloud_api::model::HttpRule;
6423 /// let x = HttpRule::new().set_selector("example");
6424 /// ```
6425 pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6426 self.selector = v.into();
6427 self
6428 }
6429
6430 /// Sets the value of [body][crate::model::HttpRule::body].
6431 ///
6432 /// # Example
6433 /// ```ignore,no_run
6434 /// # use google_cloud_api::model::HttpRule;
6435 /// let x = HttpRule::new().set_body("example");
6436 /// ```
6437 pub fn set_body<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6438 self.body = v.into();
6439 self
6440 }
6441
6442 /// Sets the value of [response_body][crate::model::HttpRule::response_body].
6443 ///
6444 /// # Example
6445 /// ```ignore,no_run
6446 /// # use google_cloud_api::model::HttpRule;
6447 /// let x = HttpRule::new().set_response_body("example");
6448 /// ```
6449 pub fn set_response_body<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6450 self.response_body = v.into();
6451 self
6452 }
6453
6454 /// Sets the value of [additional_bindings][crate::model::HttpRule::additional_bindings].
6455 ///
6456 /// # Example
6457 /// ```ignore,no_run
6458 /// # use google_cloud_api::model::HttpRule;
6459 /// let x = HttpRule::new()
6460 /// .set_additional_bindings([
6461 /// HttpRule::default()/* use setters */,
6462 /// HttpRule::default()/* use (different) setters */,
6463 /// ]);
6464 /// ```
6465 pub fn set_additional_bindings<T, V>(mut self, v: T) -> Self
6466 where
6467 T: std::iter::IntoIterator<Item = V>,
6468 V: std::convert::Into<crate::model::HttpRule>,
6469 {
6470 use std::iter::Iterator;
6471 self.additional_bindings = v.into_iter().map(|i| i.into()).collect();
6472 self
6473 }
6474
6475 /// Sets the value of [pattern][crate::model::HttpRule::pattern].
6476 ///
6477 /// Note that all the setters affecting `pattern` are mutually
6478 /// exclusive.
6479 ///
6480 /// # Example
6481 /// ```ignore,no_run
6482 /// # use google_cloud_api::model::HttpRule;
6483 /// use google_cloud_api::model::http_rule::Pattern;
6484 /// let x = HttpRule::new().set_pattern(Some(Pattern::Get("example".to_string())));
6485 /// ```
6486 pub fn set_pattern<
6487 T: std::convert::Into<std::option::Option<crate::model::http_rule::Pattern>>,
6488 >(
6489 mut self,
6490 v: T,
6491 ) -> Self {
6492 self.pattern = v.into();
6493 self
6494 }
6495
6496 /// The value of [pattern][crate::model::HttpRule::pattern]
6497 /// if it holds a `Get`, `None` if the field is not set or
6498 /// holds a different branch.
6499 pub fn get(&self) -> std::option::Option<&std::string::String> {
6500 #[allow(unreachable_patterns)]
6501 self.pattern.as_ref().and_then(|v| match v {
6502 crate::model::http_rule::Pattern::Get(v) => std::option::Option::Some(v),
6503 _ => std::option::Option::None,
6504 })
6505 }
6506
6507 /// Sets the value of [pattern][crate::model::HttpRule::pattern]
6508 /// to hold a `Get`.
6509 ///
6510 /// Note that all the setters affecting `pattern` are
6511 /// mutually exclusive.
6512 ///
6513 /// # Example
6514 /// ```ignore,no_run
6515 /// # use google_cloud_api::model::HttpRule;
6516 /// let x = HttpRule::new().set_get("example");
6517 /// assert!(x.get().is_some());
6518 /// assert!(x.put().is_none());
6519 /// assert!(x.post().is_none());
6520 /// assert!(x.delete().is_none());
6521 /// assert!(x.patch().is_none());
6522 /// assert!(x.custom().is_none());
6523 /// ```
6524 pub fn set_get<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6525 self.pattern = std::option::Option::Some(crate::model::http_rule::Pattern::Get(v.into()));
6526 self
6527 }
6528
6529 /// The value of [pattern][crate::model::HttpRule::pattern]
6530 /// if it holds a `Put`, `None` if the field is not set or
6531 /// holds a different branch.
6532 pub fn put(&self) -> std::option::Option<&std::string::String> {
6533 #[allow(unreachable_patterns)]
6534 self.pattern.as_ref().and_then(|v| match v {
6535 crate::model::http_rule::Pattern::Put(v) => std::option::Option::Some(v),
6536 _ => std::option::Option::None,
6537 })
6538 }
6539
6540 /// Sets the value of [pattern][crate::model::HttpRule::pattern]
6541 /// to hold a `Put`.
6542 ///
6543 /// Note that all the setters affecting `pattern` are
6544 /// mutually exclusive.
6545 ///
6546 /// # Example
6547 /// ```ignore,no_run
6548 /// # use google_cloud_api::model::HttpRule;
6549 /// let x = HttpRule::new().set_put("example");
6550 /// assert!(x.put().is_some());
6551 /// assert!(x.get().is_none());
6552 /// assert!(x.post().is_none());
6553 /// assert!(x.delete().is_none());
6554 /// assert!(x.patch().is_none());
6555 /// assert!(x.custom().is_none());
6556 /// ```
6557 pub fn set_put<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6558 self.pattern = std::option::Option::Some(crate::model::http_rule::Pattern::Put(v.into()));
6559 self
6560 }
6561
6562 /// The value of [pattern][crate::model::HttpRule::pattern]
6563 /// if it holds a `Post`, `None` if the field is not set or
6564 /// holds a different branch.
6565 pub fn post(&self) -> std::option::Option<&std::string::String> {
6566 #[allow(unreachable_patterns)]
6567 self.pattern.as_ref().and_then(|v| match v {
6568 crate::model::http_rule::Pattern::Post(v) => std::option::Option::Some(v),
6569 _ => std::option::Option::None,
6570 })
6571 }
6572
6573 /// Sets the value of [pattern][crate::model::HttpRule::pattern]
6574 /// to hold a `Post`.
6575 ///
6576 /// Note that all the setters affecting `pattern` are
6577 /// mutually exclusive.
6578 ///
6579 /// # Example
6580 /// ```ignore,no_run
6581 /// # use google_cloud_api::model::HttpRule;
6582 /// let x = HttpRule::new().set_post("example");
6583 /// assert!(x.post().is_some());
6584 /// assert!(x.get().is_none());
6585 /// assert!(x.put().is_none());
6586 /// assert!(x.delete().is_none());
6587 /// assert!(x.patch().is_none());
6588 /// assert!(x.custom().is_none());
6589 /// ```
6590 pub fn set_post<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6591 self.pattern = std::option::Option::Some(crate::model::http_rule::Pattern::Post(v.into()));
6592 self
6593 }
6594
6595 /// The value of [pattern][crate::model::HttpRule::pattern]
6596 /// if it holds a `Delete`, `None` if the field is not set or
6597 /// holds a different branch.
6598 pub fn delete(&self) -> std::option::Option<&std::string::String> {
6599 #[allow(unreachable_patterns)]
6600 self.pattern.as_ref().and_then(|v| match v {
6601 crate::model::http_rule::Pattern::Delete(v) => std::option::Option::Some(v),
6602 _ => std::option::Option::None,
6603 })
6604 }
6605
6606 /// Sets the value of [pattern][crate::model::HttpRule::pattern]
6607 /// to hold a `Delete`.
6608 ///
6609 /// Note that all the setters affecting `pattern` are
6610 /// mutually exclusive.
6611 ///
6612 /// # Example
6613 /// ```ignore,no_run
6614 /// # use google_cloud_api::model::HttpRule;
6615 /// let x = HttpRule::new().set_delete("example");
6616 /// assert!(x.delete().is_some());
6617 /// assert!(x.get().is_none());
6618 /// assert!(x.put().is_none());
6619 /// assert!(x.post().is_none());
6620 /// assert!(x.patch().is_none());
6621 /// assert!(x.custom().is_none());
6622 /// ```
6623 pub fn set_delete<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6624 self.pattern =
6625 std::option::Option::Some(crate::model::http_rule::Pattern::Delete(v.into()));
6626 self
6627 }
6628
6629 /// The value of [pattern][crate::model::HttpRule::pattern]
6630 /// if it holds a `Patch`, `None` if the field is not set or
6631 /// holds a different branch.
6632 pub fn patch(&self) -> std::option::Option<&std::string::String> {
6633 #[allow(unreachable_patterns)]
6634 self.pattern.as_ref().and_then(|v| match v {
6635 crate::model::http_rule::Pattern::Patch(v) => std::option::Option::Some(v),
6636 _ => std::option::Option::None,
6637 })
6638 }
6639
6640 /// Sets the value of [pattern][crate::model::HttpRule::pattern]
6641 /// to hold a `Patch`.
6642 ///
6643 /// Note that all the setters affecting `pattern` are
6644 /// mutually exclusive.
6645 ///
6646 /// # Example
6647 /// ```ignore,no_run
6648 /// # use google_cloud_api::model::HttpRule;
6649 /// let x = HttpRule::new().set_patch("example");
6650 /// assert!(x.patch().is_some());
6651 /// assert!(x.get().is_none());
6652 /// assert!(x.put().is_none());
6653 /// assert!(x.post().is_none());
6654 /// assert!(x.delete().is_none());
6655 /// assert!(x.custom().is_none());
6656 /// ```
6657 pub fn set_patch<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6658 self.pattern = std::option::Option::Some(crate::model::http_rule::Pattern::Patch(v.into()));
6659 self
6660 }
6661
6662 /// The value of [pattern][crate::model::HttpRule::pattern]
6663 /// if it holds a `Custom`, `None` if the field is not set or
6664 /// holds a different branch.
6665 pub fn custom(&self) -> std::option::Option<&std::boxed::Box<crate::model::CustomHttpPattern>> {
6666 #[allow(unreachable_patterns)]
6667 self.pattern.as_ref().and_then(|v| match v {
6668 crate::model::http_rule::Pattern::Custom(v) => std::option::Option::Some(v),
6669 _ => std::option::Option::None,
6670 })
6671 }
6672
6673 /// Sets the value of [pattern][crate::model::HttpRule::pattern]
6674 /// to hold a `Custom`.
6675 ///
6676 /// Note that all the setters affecting `pattern` are
6677 /// mutually exclusive.
6678 ///
6679 /// # Example
6680 /// ```ignore,no_run
6681 /// # use google_cloud_api::model::HttpRule;
6682 /// use google_cloud_api::model::CustomHttpPattern;
6683 /// let x = HttpRule::new().set_custom(CustomHttpPattern::default()/* use setters */);
6684 /// assert!(x.custom().is_some());
6685 /// assert!(x.get().is_none());
6686 /// assert!(x.put().is_none());
6687 /// assert!(x.post().is_none());
6688 /// assert!(x.delete().is_none());
6689 /// assert!(x.patch().is_none());
6690 /// ```
6691 pub fn set_custom<T: std::convert::Into<std::boxed::Box<crate::model::CustomHttpPattern>>>(
6692 mut self,
6693 v: T,
6694 ) -> Self {
6695 self.pattern =
6696 std::option::Option::Some(crate::model::http_rule::Pattern::Custom(v.into()));
6697 self
6698 }
6699}
6700
6701impl wkt::message::Message for HttpRule {
6702 fn typename() -> &'static str {
6703 "type.googleapis.com/google.api.HttpRule"
6704 }
6705}
6706
6707/// Defines additional types related to [HttpRule].
6708pub mod http_rule {
6709 #[allow(unused_imports)]
6710 use super::*;
6711
6712 /// Determines the URL pattern is matched by this rules. This pattern can be
6713 /// used with any of the {get|put|post|delete|patch} methods. A custom method
6714 /// can be defined using the 'custom' field.
6715 #[derive(Clone, Debug, PartialEq)]
6716 #[non_exhaustive]
6717 pub enum Pattern {
6718 /// Maps to HTTP GET. Used for listing and getting information about
6719 /// resources.
6720 Get(std::string::String),
6721 /// Maps to HTTP PUT. Used for replacing a resource.
6722 Put(std::string::String),
6723 /// Maps to HTTP POST. Used for creating a resource or performing an action.
6724 Post(std::string::String),
6725 /// Maps to HTTP DELETE. Used for deleting a resource.
6726 Delete(std::string::String),
6727 /// Maps to HTTP PATCH. Used for updating a resource.
6728 Patch(std::string::String),
6729 /// The custom pattern is used for specifying an HTTP method that is not
6730 /// included in the `pattern` field, such as HEAD, or "*" to leave the
6731 /// HTTP method unspecified for this rule. The wild-card rule is useful
6732 /// for services that provide content to Web (HTML) clients.
6733 Custom(std::boxed::Box<crate::model::CustomHttpPattern>),
6734 }
6735}
6736
6737/// A custom pattern is used for defining custom HTTP verb.
6738#[derive(Clone, Default, PartialEq)]
6739#[non_exhaustive]
6740pub struct CustomHttpPattern {
6741 /// The name of this custom HTTP verb.
6742 pub kind: std::string::String,
6743
6744 /// The path matched by this custom verb.
6745 pub path: std::string::String,
6746
6747 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6748}
6749
6750impl CustomHttpPattern {
6751 pub fn new() -> Self {
6752 std::default::Default::default()
6753 }
6754
6755 /// Sets the value of [kind][crate::model::CustomHttpPattern::kind].
6756 ///
6757 /// # Example
6758 /// ```ignore,no_run
6759 /// # use google_cloud_api::model::CustomHttpPattern;
6760 /// let x = CustomHttpPattern::new().set_kind("example");
6761 /// ```
6762 pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6763 self.kind = v.into();
6764 self
6765 }
6766
6767 /// Sets the value of [path][crate::model::CustomHttpPattern::path].
6768 ///
6769 /// # Example
6770 /// ```ignore,no_run
6771 /// # use google_cloud_api::model::CustomHttpPattern;
6772 /// let x = CustomHttpPattern::new().set_path("example");
6773 /// ```
6774 pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6775 self.path = v.into();
6776 self
6777 }
6778}
6779
6780impl wkt::message::Message for CustomHttpPattern {
6781 fn typename() -> &'static str {
6782 "type.googleapis.com/google.api.CustomHttpPattern"
6783 }
6784}
6785
6786/// Message that represents an arbitrary HTTP body. It should only be used for
6787/// payload formats that can't be represented as JSON, such as raw binary or
6788/// an HTML page.
6789///
6790/// This message can be used both in streaming and non-streaming API methods in
6791/// the request as well as the response.
6792///
6793/// It can be used as a top-level request field, which is convenient if one
6794/// wants to extract parameters from either the URL or HTTP template into the
6795/// request fields and also want access to the raw HTTP body.
6796///
6797/// Example:
6798///
6799/// ```norust
6800/// message GetResourceRequest {
6801/// // A unique request id.
6802/// string request_id = 1;
6803///
6804/// // The raw HTTP body is bound to this field.
6805/// google.api.HttpBody http_body = 2;
6806///
6807/// }
6808///
6809/// service ResourceService {
6810/// rpc GetResource(GetResourceRequest)
6811/// returns (google.api.HttpBody);
6812/// rpc UpdateResource(google.api.HttpBody)
6813/// returns (google.protobuf.Empty);
6814///
6815/// }
6816/// ```
6817///
6818/// Example with streaming methods:
6819///
6820/// ```norust
6821/// service CaldavService {
6822/// rpc GetCalendar(stream google.api.HttpBody)
6823/// returns (stream google.api.HttpBody);
6824/// rpc UpdateCalendar(stream google.api.HttpBody)
6825/// returns (stream google.api.HttpBody);
6826///
6827/// }
6828/// ```
6829///
6830/// Use of this type only changes how the request and response bodies are
6831/// handled, all other features will continue to work unchanged.
6832#[derive(Clone, Default, PartialEq)]
6833#[non_exhaustive]
6834pub struct HttpBody {
6835 /// The HTTP Content-Type header value specifying the content type of the body.
6836 pub content_type: std::string::String,
6837
6838 /// The HTTP request/response body as raw binary.
6839 pub data: ::bytes::Bytes,
6840
6841 /// Application specific response metadata. Must be set in the first response
6842 /// for streaming APIs.
6843 pub extensions: std::vec::Vec<wkt::Any>,
6844
6845 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6846}
6847
6848impl HttpBody {
6849 pub fn new() -> Self {
6850 std::default::Default::default()
6851 }
6852
6853 /// Sets the value of [content_type][crate::model::HttpBody::content_type].
6854 ///
6855 /// # Example
6856 /// ```ignore,no_run
6857 /// # use google_cloud_api::model::HttpBody;
6858 /// let x = HttpBody::new().set_content_type("example");
6859 /// ```
6860 pub fn set_content_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6861 self.content_type = v.into();
6862 self
6863 }
6864
6865 /// Sets the value of [data][crate::model::HttpBody::data].
6866 ///
6867 /// # Example
6868 /// ```ignore,no_run
6869 /// # use google_cloud_api::model::HttpBody;
6870 /// let x = HttpBody::new().set_data(bytes::Bytes::from_static(b"example"));
6871 /// ```
6872 pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
6873 self.data = v.into();
6874 self
6875 }
6876
6877 /// Sets the value of [extensions][crate::model::HttpBody::extensions].
6878 ///
6879 /// # Example
6880 /// ```ignore,no_run
6881 /// # use google_cloud_api::model::HttpBody;
6882 /// use wkt::Any;
6883 /// let x = HttpBody::new()
6884 /// .set_extensions([
6885 /// Any::default()/* use setters */,
6886 /// Any::default()/* use (different) setters */,
6887 /// ]);
6888 /// ```
6889 pub fn set_extensions<T, V>(mut self, v: T) -> Self
6890 where
6891 T: std::iter::IntoIterator<Item = V>,
6892 V: std::convert::Into<wkt::Any>,
6893 {
6894 use std::iter::Iterator;
6895 self.extensions = v.into_iter().map(|i| i.into()).collect();
6896 self
6897 }
6898}
6899
6900impl wkt::message::Message for HttpBody {
6901 fn typename() -> &'static str {
6902 "type.googleapis.com/google.api.HttpBody"
6903 }
6904}
6905
6906/// A description of a label.
6907#[derive(Clone, Default, PartialEq)]
6908#[non_exhaustive]
6909pub struct LabelDescriptor {
6910 /// The label key.
6911 pub key: std::string::String,
6912
6913 /// The type of data that can be assigned to the label.
6914 pub value_type: crate::model::label_descriptor::ValueType,
6915
6916 /// A human-readable description for the label.
6917 pub description: std::string::String,
6918
6919 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6920}
6921
6922impl LabelDescriptor {
6923 pub fn new() -> Self {
6924 std::default::Default::default()
6925 }
6926
6927 /// Sets the value of [key][crate::model::LabelDescriptor::key].
6928 ///
6929 /// # Example
6930 /// ```ignore,no_run
6931 /// # use google_cloud_api::model::LabelDescriptor;
6932 /// let x = LabelDescriptor::new().set_key("example");
6933 /// ```
6934 pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6935 self.key = v.into();
6936 self
6937 }
6938
6939 /// Sets the value of [value_type][crate::model::LabelDescriptor::value_type].
6940 ///
6941 /// # Example
6942 /// ```ignore,no_run
6943 /// # use google_cloud_api::model::LabelDescriptor;
6944 /// use google_cloud_api::model::label_descriptor::ValueType;
6945 /// let x0 = LabelDescriptor::new().set_value_type(ValueType::Bool);
6946 /// let x1 = LabelDescriptor::new().set_value_type(ValueType::Int64);
6947 /// ```
6948 pub fn set_value_type<T: std::convert::Into<crate::model::label_descriptor::ValueType>>(
6949 mut self,
6950 v: T,
6951 ) -> Self {
6952 self.value_type = v.into();
6953 self
6954 }
6955
6956 /// Sets the value of [description][crate::model::LabelDescriptor::description].
6957 ///
6958 /// # Example
6959 /// ```ignore,no_run
6960 /// # use google_cloud_api::model::LabelDescriptor;
6961 /// let x = LabelDescriptor::new().set_description("example");
6962 /// ```
6963 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6964 self.description = v.into();
6965 self
6966 }
6967}
6968
6969impl wkt::message::Message for LabelDescriptor {
6970 fn typename() -> &'static str {
6971 "type.googleapis.com/google.api.LabelDescriptor"
6972 }
6973}
6974
6975/// Defines additional types related to [LabelDescriptor].
6976pub mod label_descriptor {
6977 #[allow(unused_imports)]
6978 use super::*;
6979
6980 /// Value types that can be used as label values.
6981 ///
6982 /// # Working with unknown values
6983 ///
6984 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6985 /// additional enum variants at any time. Adding new variants is not considered
6986 /// a breaking change. Applications should write their code in anticipation of:
6987 ///
6988 /// - New values appearing in future releases of the client library, **and**
6989 /// - New values received dynamically, without application changes.
6990 ///
6991 /// Please consult the [Working with enums] section in the user guide for some
6992 /// guidelines.
6993 ///
6994 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
6995 #[derive(Clone, Debug, PartialEq)]
6996 #[non_exhaustive]
6997 pub enum ValueType {
6998 /// A variable-length string. This is the default.
6999 String,
7000 /// Boolean; true or false.
7001 Bool,
7002 /// A 64-bit signed integer.
7003 Int64,
7004 /// If set, the enum was initialized with an unknown value.
7005 ///
7006 /// Applications can examine the value using [ValueType::value] or
7007 /// [ValueType::name].
7008 UnknownValue(value_type::UnknownValue),
7009 }
7010
7011 #[doc(hidden)]
7012 pub mod value_type {
7013 #[allow(unused_imports)]
7014 use super::*;
7015 #[derive(Clone, Debug, PartialEq)]
7016 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7017 }
7018
7019 impl ValueType {
7020 /// Gets the enum value.
7021 ///
7022 /// Returns `None` if the enum contains an unknown value deserialized from
7023 /// the string representation of enums.
7024 pub fn value(&self) -> std::option::Option<i32> {
7025 match self {
7026 Self::String => std::option::Option::Some(0),
7027 Self::Bool => std::option::Option::Some(1),
7028 Self::Int64 => std::option::Option::Some(2),
7029 Self::UnknownValue(u) => u.0.value(),
7030 }
7031 }
7032
7033 /// Gets the enum value as a string.
7034 ///
7035 /// Returns `None` if the enum contains an unknown value deserialized from
7036 /// the integer representation of enums.
7037 pub fn name(&self) -> std::option::Option<&str> {
7038 match self {
7039 Self::String => std::option::Option::Some("STRING"),
7040 Self::Bool => std::option::Option::Some("BOOL"),
7041 Self::Int64 => std::option::Option::Some("INT64"),
7042 Self::UnknownValue(u) => u.0.name(),
7043 }
7044 }
7045 }
7046
7047 impl std::default::Default for ValueType {
7048 fn default() -> Self {
7049 use std::convert::From;
7050 Self::from(0)
7051 }
7052 }
7053
7054 impl std::fmt::Display for ValueType {
7055 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7056 wkt::internal::display_enum(f, self.name(), self.value())
7057 }
7058 }
7059
7060 impl std::convert::From<i32> for ValueType {
7061 fn from(value: i32) -> Self {
7062 match value {
7063 0 => Self::String,
7064 1 => Self::Bool,
7065 2 => Self::Int64,
7066 _ => Self::UnknownValue(value_type::UnknownValue(
7067 wkt::internal::UnknownEnumValue::Integer(value),
7068 )),
7069 }
7070 }
7071 }
7072
7073 impl std::convert::From<&str> for ValueType {
7074 fn from(value: &str) -> Self {
7075 use std::string::ToString;
7076 match value {
7077 "STRING" => Self::String,
7078 "BOOL" => Self::Bool,
7079 "INT64" => Self::Int64,
7080 _ => Self::UnknownValue(value_type::UnknownValue(
7081 wkt::internal::UnknownEnumValue::String(value.to_string()),
7082 )),
7083 }
7084 }
7085 }
7086
7087 impl serde::ser::Serialize for ValueType {
7088 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7089 where
7090 S: serde::Serializer,
7091 {
7092 match self {
7093 Self::String => serializer.serialize_i32(0),
7094 Self::Bool => serializer.serialize_i32(1),
7095 Self::Int64 => serializer.serialize_i32(2),
7096 Self::UnknownValue(u) => u.0.serialize(serializer),
7097 }
7098 }
7099 }
7100
7101 impl<'de> serde::de::Deserialize<'de> for ValueType {
7102 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7103 where
7104 D: serde::Deserializer<'de>,
7105 {
7106 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ValueType>::new(
7107 ".google.api.LabelDescriptor.ValueType",
7108 ))
7109 }
7110 }
7111}
7112
7113/// A description of a log type. Example in YAML format:
7114///
7115/// ```norust
7116/// - name: library.googleapis.com/activity_history
7117/// description: The history of borrowing and returning library items.
7118/// display_name: Activity
7119/// labels:
7120/// - key: /customer_id
7121/// description: Identifier of a library customer
7122/// ```
7123#[derive(Clone, Default, PartialEq)]
7124#[non_exhaustive]
7125pub struct LogDescriptor {
7126 /// The name of the log. It must be less than 512 characters long and can
7127 /// include the following characters: upper- and lower-case alphanumeric
7128 /// characters [A-Za-z0-9], and punctuation characters including
7129 /// slash, underscore, hyphen, period [/_-.].
7130 pub name: std::string::String,
7131
7132 /// The set of labels that are available to describe a specific log entry.
7133 /// Runtime requests that contain labels not specified here are
7134 /// considered invalid.
7135 pub labels: std::vec::Vec<crate::model::LabelDescriptor>,
7136
7137 /// A human-readable description of this log. This information appears in
7138 /// the documentation and can contain details.
7139 pub description: std::string::String,
7140
7141 /// The human-readable name for this log. This information appears on
7142 /// the user interface and should be concise.
7143 pub display_name: std::string::String,
7144
7145 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7146}
7147
7148impl LogDescriptor {
7149 pub fn new() -> Self {
7150 std::default::Default::default()
7151 }
7152
7153 /// Sets the value of [name][crate::model::LogDescriptor::name].
7154 ///
7155 /// # Example
7156 /// ```ignore,no_run
7157 /// # use google_cloud_api::model::LogDescriptor;
7158 /// let x = LogDescriptor::new().set_name("example");
7159 /// ```
7160 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7161 self.name = v.into();
7162 self
7163 }
7164
7165 /// Sets the value of [labels][crate::model::LogDescriptor::labels].
7166 ///
7167 /// # Example
7168 /// ```ignore,no_run
7169 /// # use google_cloud_api::model::LogDescriptor;
7170 /// use google_cloud_api::model::LabelDescriptor;
7171 /// let x = LogDescriptor::new()
7172 /// .set_labels([
7173 /// LabelDescriptor::default()/* use setters */,
7174 /// LabelDescriptor::default()/* use (different) setters */,
7175 /// ]);
7176 /// ```
7177 pub fn set_labels<T, V>(mut self, v: T) -> Self
7178 where
7179 T: std::iter::IntoIterator<Item = V>,
7180 V: std::convert::Into<crate::model::LabelDescriptor>,
7181 {
7182 use std::iter::Iterator;
7183 self.labels = v.into_iter().map(|i| i.into()).collect();
7184 self
7185 }
7186
7187 /// Sets the value of [description][crate::model::LogDescriptor::description].
7188 ///
7189 /// # Example
7190 /// ```ignore,no_run
7191 /// # use google_cloud_api::model::LogDescriptor;
7192 /// let x = LogDescriptor::new().set_description("example");
7193 /// ```
7194 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7195 self.description = v.into();
7196 self
7197 }
7198
7199 /// Sets the value of [display_name][crate::model::LogDescriptor::display_name].
7200 ///
7201 /// # Example
7202 /// ```ignore,no_run
7203 /// # use google_cloud_api::model::LogDescriptor;
7204 /// let x = LogDescriptor::new().set_display_name("example");
7205 /// ```
7206 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7207 self.display_name = v.into();
7208 self
7209 }
7210}
7211
7212impl wkt::message::Message for LogDescriptor {
7213 fn typename() -> &'static str {
7214 "type.googleapis.com/google.api.LogDescriptor"
7215 }
7216}
7217
7218/// Logging configuration of the service.
7219///
7220/// The following example shows how to configure logs to be sent to the
7221/// producer and consumer projects. In the example, the `activity_history`
7222/// log is sent to both the producer and consumer projects, whereas the
7223/// `purchase_history` log is only sent to the producer project.
7224///
7225/// ```norust
7226/// monitored_resources:
7227/// - type: library.googleapis.com/branch
7228/// labels:
7229/// - key: /city
7230/// description: The city where the library branch is located in.
7231/// - key: /name
7232/// description: The name of the branch.
7233/// logs:
7234/// - name: activity_history
7235/// labels:
7236/// - key: /customer_id
7237/// - name: purchase_history
7238/// logging:
7239/// producer_destinations:
7240/// - monitored_resource: library.googleapis.com/branch
7241/// logs:
7242/// - activity_history
7243/// - purchase_history
7244/// consumer_destinations:
7245/// - monitored_resource: library.googleapis.com/branch
7246/// logs:
7247/// - activity_history
7248/// ```
7249#[derive(Clone, Default, PartialEq)]
7250#[non_exhaustive]
7251pub struct Logging {
7252 /// Logging configurations for sending logs to the producer project.
7253 /// There can be multiple producer destinations, each one must have a
7254 /// different monitored resource type. A log can be used in at most
7255 /// one producer destination.
7256 pub producer_destinations: std::vec::Vec<crate::model::logging::LoggingDestination>,
7257
7258 /// Logging configurations for sending logs to the consumer project.
7259 /// There can be multiple consumer destinations, each one must have a
7260 /// different monitored resource type. A log can be used in at most
7261 /// one consumer destination.
7262 pub consumer_destinations: std::vec::Vec<crate::model::logging::LoggingDestination>,
7263
7264 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7265}
7266
7267impl Logging {
7268 pub fn new() -> Self {
7269 std::default::Default::default()
7270 }
7271
7272 /// Sets the value of [producer_destinations][crate::model::Logging::producer_destinations].
7273 ///
7274 /// # Example
7275 /// ```ignore,no_run
7276 /// # use google_cloud_api::model::Logging;
7277 /// use google_cloud_api::model::logging::LoggingDestination;
7278 /// let x = Logging::new()
7279 /// .set_producer_destinations([
7280 /// LoggingDestination::default()/* use setters */,
7281 /// LoggingDestination::default()/* use (different) setters */,
7282 /// ]);
7283 /// ```
7284 pub fn set_producer_destinations<T, V>(mut self, v: T) -> Self
7285 where
7286 T: std::iter::IntoIterator<Item = V>,
7287 V: std::convert::Into<crate::model::logging::LoggingDestination>,
7288 {
7289 use std::iter::Iterator;
7290 self.producer_destinations = v.into_iter().map(|i| i.into()).collect();
7291 self
7292 }
7293
7294 /// Sets the value of [consumer_destinations][crate::model::Logging::consumer_destinations].
7295 ///
7296 /// # Example
7297 /// ```ignore,no_run
7298 /// # use google_cloud_api::model::Logging;
7299 /// use google_cloud_api::model::logging::LoggingDestination;
7300 /// let x = Logging::new()
7301 /// .set_consumer_destinations([
7302 /// LoggingDestination::default()/* use setters */,
7303 /// LoggingDestination::default()/* use (different) setters */,
7304 /// ]);
7305 /// ```
7306 pub fn set_consumer_destinations<T, V>(mut self, v: T) -> Self
7307 where
7308 T: std::iter::IntoIterator<Item = V>,
7309 V: std::convert::Into<crate::model::logging::LoggingDestination>,
7310 {
7311 use std::iter::Iterator;
7312 self.consumer_destinations = v.into_iter().map(|i| i.into()).collect();
7313 self
7314 }
7315}
7316
7317impl wkt::message::Message for Logging {
7318 fn typename() -> &'static str {
7319 "type.googleapis.com/google.api.Logging"
7320 }
7321}
7322
7323/// Defines additional types related to [Logging].
7324pub mod logging {
7325 #[allow(unused_imports)]
7326 use super::*;
7327
7328 /// Configuration of a specific logging destination (the producer project
7329 /// or the consumer project).
7330 #[derive(Clone, Default, PartialEq)]
7331 #[non_exhaustive]
7332 pub struct LoggingDestination {
7333 /// The monitored resource type. The type must be defined in the
7334 /// [Service.monitored_resources][google.api.Service.monitored_resources]
7335 /// section.
7336 ///
7337 /// [google.api.Service.monitored_resources]: crate::model::Service::monitored_resources
7338 pub monitored_resource: std::string::String,
7339
7340 /// Names of the logs to be sent to this destination. Each name must
7341 /// be defined in the [Service.logs][google.api.Service.logs] section. If the
7342 /// log name is not a domain scoped name, it will be automatically prefixed
7343 /// with the service name followed by "/".
7344 ///
7345 /// [google.api.Service.logs]: crate::model::Service::logs
7346 pub logs: std::vec::Vec<std::string::String>,
7347
7348 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7349 }
7350
7351 impl LoggingDestination {
7352 pub fn new() -> Self {
7353 std::default::Default::default()
7354 }
7355
7356 /// Sets the value of [monitored_resource][crate::model::logging::LoggingDestination::monitored_resource].
7357 ///
7358 /// # Example
7359 /// ```ignore,no_run
7360 /// # use google_cloud_api::model::logging::LoggingDestination;
7361 /// let x = LoggingDestination::new().set_monitored_resource("example");
7362 /// ```
7363 pub fn set_monitored_resource<T: std::convert::Into<std::string::String>>(
7364 mut self,
7365 v: T,
7366 ) -> Self {
7367 self.monitored_resource = v.into();
7368 self
7369 }
7370
7371 /// Sets the value of [logs][crate::model::logging::LoggingDestination::logs].
7372 ///
7373 /// # Example
7374 /// ```ignore,no_run
7375 /// # use google_cloud_api::model::logging::LoggingDestination;
7376 /// let x = LoggingDestination::new().set_logs(["a", "b", "c"]);
7377 /// ```
7378 pub fn set_logs<T, V>(mut self, v: T) -> Self
7379 where
7380 T: std::iter::IntoIterator<Item = V>,
7381 V: std::convert::Into<std::string::String>,
7382 {
7383 use std::iter::Iterator;
7384 self.logs = v.into_iter().map(|i| i.into()).collect();
7385 self
7386 }
7387 }
7388
7389 impl wkt::message::Message for LoggingDestination {
7390 fn typename() -> &'static str {
7391 "type.googleapis.com/google.api.Logging.LoggingDestination"
7392 }
7393 }
7394}
7395
7396/// Defines a metric type and its schema. Once a metric descriptor is created,
7397/// deleting or altering it stops data collection and makes the metric type's
7398/// existing data unusable.
7399#[derive(Clone, Default, PartialEq)]
7400#[non_exhaustive]
7401pub struct MetricDescriptor {
7402 /// The resource name of the metric descriptor.
7403 pub name: std::string::String,
7404
7405 /// The metric type, including its DNS name prefix. The type is not
7406 /// URL-encoded. All user-defined metric types have the DNS name
7407 /// `custom.googleapis.com` or `external.googleapis.com`. Metric types should
7408 /// use a natural hierarchical grouping. For example:
7409 ///
7410 /// ```norust
7411 /// "custom.googleapis.com/invoice/paid/amount"
7412 /// "external.googleapis.com/prometheus/up"
7413 /// "appengine.googleapis.com/http/server/response_latencies"
7414 /// ```
7415 pub r#type: std::string::String,
7416
7417 /// The set of labels that can be used to describe a specific
7418 /// instance of this metric type. For example, the
7419 /// `appengine.googleapis.com/http/server/response_latencies` metric
7420 /// type has a label for the HTTP response code, `response_code`, so
7421 /// you can look at latencies for successful responses or just
7422 /// for responses that failed.
7423 pub labels: std::vec::Vec<crate::model::LabelDescriptor>,
7424
7425 /// Whether the metric records instantaneous values, changes to a value, etc.
7426 /// Some combinations of `metric_kind` and `value_type` might not be supported.
7427 pub metric_kind: crate::model::metric_descriptor::MetricKind,
7428
7429 /// Whether the measurement is an integer, a floating-point number, etc.
7430 /// Some combinations of `metric_kind` and `value_type` might not be supported.
7431 pub value_type: crate::model::metric_descriptor::ValueType,
7432
7433 /// The units in which the metric value is reported. It is only applicable
7434 /// if the `value_type` is `INT64`, `DOUBLE`, or `DISTRIBUTION`. The `unit`
7435 /// defines the representation of the stored metric values.
7436 ///
7437 /// Different systems might scale the values to be more easily displayed (so a
7438 /// value of `0.02kBy` _might_ be displayed as `20By`, and a value of
7439 /// `3523kBy` _might_ be displayed as `3.5MBy`). However, if the `unit` is
7440 /// `kBy`, then the value of the metric is always in thousands of bytes, no
7441 /// matter how it might be displayed.
7442 ///
7443 /// If you want a custom metric to record the exact number of CPU-seconds used
7444 /// by a job, you can create an `INT64 CUMULATIVE` metric whose `unit` is
7445 /// `s{CPU}` (or equivalently `1s{CPU}` or just `s`). If the job uses 12,005
7446 /// CPU-seconds, then the value is written as `12005`.
7447 ///
7448 /// Alternatively, if you want a custom metric to record data in a more
7449 /// granular way, you can create a `DOUBLE CUMULATIVE` metric whose `unit` is
7450 /// `ks{CPU}`, and then write the value `12.005` (which is `12005/1000`),
7451 /// or use `Kis{CPU}` and write `11.723` (which is `12005/1024`).
7452 ///
7453 /// The supported units are a subset of [The Unified Code for Units of
7454 /// Measure](https://unitsofmeasure.org/ucum.html) standard:
7455 ///
7456 /// **Basic units (UNIT)**
7457 ///
7458 /// * `bit` bit
7459 /// * `By` byte
7460 /// * `s` second
7461 /// * `min` minute
7462 /// * `h` hour
7463 /// * `d` day
7464 /// * `1` dimensionless
7465 ///
7466 /// **Prefixes (PREFIX)**
7467 ///
7468 /// * `k` kilo (10^3)
7469 ///
7470 /// * `M` mega (10^6)
7471 ///
7472 /// * `G` giga (10^9)
7473 ///
7474 /// * `T` tera (10^12)
7475 ///
7476 /// * `P` peta (10^15)
7477 ///
7478 /// * `E` exa (10^18)
7479 ///
7480 /// * `Z` zetta (10^21)
7481 ///
7482 /// * `Y` yotta (10^24)
7483 ///
7484 /// * `m` milli (10^-3)
7485 ///
7486 /// * `u` micro (10^-6)
7487 ///
7488 /// * `n` nano (10^-9)
7489 ///
7490 /// * `p` pico (10^-12)
7491 ///
7492 /// * `f` femto (10^-15)
7493 ///
7494 /// * `a` atto (10^-18)
7495 ///
7496 /// * `z` zepto (10^-21)
7497 ///
7498 /// * `y` yocto (10^-24)
7499 ///
7500 /// * `Ki` kibi (2^10)
7501 ///
7502 /// * `Mi` mebi (2^20)
7503 ///
7504 /// * `Gi` gibi (2^30)
7505 ///
7506 /// * `Ti` tebi (2^40)
7507 ///
7508 /// * `Pi` pebi (2^50)
7509 ///
7510 ///
7511 /// **Grammar**
7512 ///
7513 /// The grammar also includes these connectors:
7514 ///
7515 /// * `/` division or ratio (as an infix operator). For examples,
7516 /// `kBy/{email}` or `MiBy/10ms` (although you should almost never
7517 /// have `/s` in a metric `unit`; rates should always be computed at
7518 /// query time from the underlying cumulative or delta value).
7519 /// * `.` multiplication or composition (as an infix operator). For
7520 /// examples, `GBy.d` or `k{watt}.h`.
7521 ///
7522 /// The grammar for a unit is as follows:
7523 ///
7524 /// ```norust
7525 /// Expression = Component { "." Component } { "/" Component } ;
7526 ///
7527 /// Component = ( [ PREFIX ] UNIT | "%" ) [ Annotation ]
7528 /// | Annotation
7529 /// | "1"
7530 /// ;
7531 ///
7532 /// Annotation = "{" NAME "}" ;
7533 /// ```
7534 ///
7535 /// Notes:
7536 ///
7537 /// * `Annotation` is just a comment if it follows a `UNIT`. If the annotation
7538 /// is used alone, then the unit is equivalent to `1`. For examples,
7539 /// `{request}/s == 1/s`, `By{transmitted}/s == By/s`.
7540 /// * `NAME` is a sequence of non-blank printable ASCII characters not
7541 /// containing `{` or `}`.
7542 /// * `1` represents a unitary [dimensionless
7543 /// unit](https://en.wikipedia.org/wiki/Dimensionless_quantity) of 1, such
7544 /// as in `1/s`. It is typically used when none of the basic units are
7545 /// appropriate. For example, "new users per day" can be represented as
7546 /// `1/d` or `{new-users}/d` (and a metric value `5` would mean "5 new
7547 /// users). Alternatively, "thousands of page views per day" would be
7548 /// represented as `1000/d` or `k1/d` or `k{page_views}/d` (and a metric
7549 /// value of `5.3` would mean "5300 page views per day").
7550 /// * `%` represents dimensionless value of 1/100, and annotates values giving
7551 /// a percentage (so the metric values are typically in the range of 0..100,
7552 /// and a metric value `3` means "3 percent").
7553 /// * `10^2.%` indicates a metric contains a ratio, typically in the range
7554 /// 0..1, that will be multiplied by 100 and displayed as a percentage
7555 /// (so a metric value `0.03` means "3 percent").
7556 pub unit: std::string::String,
7557
7558 /// A detailed description of the metric, which can be used in documentation.
7559 pub description: std::string::String,
7560
7561 /// A concise name for the metric, which can be displayed in user interfaces.
7562 /// Use sentence case without an ending period, for example "Request count".
7563 /// This field is optional but it is recommended to be set for any metrics
7564 /// associated with user-visible concepts, such as Quota.
7565 pub display_name: std::string::String,
7566
7567 /// Optional. Metadata which can be used to guide usage of the metric.
7568 pub metadata: std::option::Option<crate::model::metric_descriptor::MetricDescriptorMetadata>,
7569
7570 /// Optional. The launch stage of the metric definition.
7571 pub launch_stage: crate::model::LaunchStage,
7572
7573 /// Read-only. If present, then a [time
7574 /// series][google.monitoring.v3.TimeSeries], which is identified partially by
7575 /// a metric type and a
7576 /// [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor], that
7577 /// is associated with this metric type can only be associated with one of the
7578 /// monitored resource types listed here.
7579 ///
7580 /// [google.api.MonitoredResourceDescriptor]: crate::model::MonitoredResourceDescriptor
7581 pub monitored_resource_types: std::vec::Vec<std::string::String>,
7582
7583 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7584}
7585
7586impl MetricDescriptor {
7587 pub fn new() -> Self {
7588 std::default::Default::default()
7589 }
7590
7591 /// Sets the value of [name][crate::model::MetricDescriptor::name].
7592 ///
7593 /// # Example
7594 /// ```ignore,no_run
7595 /// # use google_cloud_api::model::MetricDescriptor;
7596 /// let x = MetricDescriptor::new().set_name("example");
7597 /// ```
7598 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7599 self.name = v.into();
7600 self
7601 }
7602
7603 /// Sets the value of [r#type][crate::model::MetricDescriptor::type].
7604 ///
7605 /// # Example
7606 /// ```ignore,no_run
7607 /// # use google_cloud_api::model::MetricDescriptor;
7608 /// let x = MetricDescriptor::new().set_type("example");
7609 /// ```
7610 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7611 self.r#type = v.into();
7612 self
7613 }
7614
7615 /// Sets the value of [labels][crate::model::MetricDescriptor::labels].
7616 ///
7617 /// # Example
7618 /// ```ignore,no_run
7619 /// # use google_cloud_api::model::MetricDescriptor;
7620 /// use google_cloud_api::model::LabelDescriptor;
7621 /// let x = MetricDescriptor::new()
7622 /// .set_labels([
7623 /// LabelDescriptor::default()/* use setters */,
7624 /// LabelDescriptor::default()/* use (different) setters */,
7625 /// ]);
7626 /// ```
7627 pub fn set_labels<T, V>(mut self, v: T) -> Self
7628 where
7629 T: std::iter::IntoIterator<Item = V>,
7630 V: std::convert::Into<crate::model::LabelDescriptor>,
7631 {
7632 use std::iter::Iterator;
7633 self.labels = v.into_iter().map(|i| i.into()).collect();
7634 self
7635 }
7636
7637 /// Sets the value of [metric_kind][crate::model::MetricDescriptor::metric_kind].
7638 ///
7639 /// # Example
7640 /// ```ignore,no_run
7641 /// # use google_cloud_api::model::MetricDescriptor;
7642 /// use google_cloud_api::model::metric_descriptor::MetricKind;
7643 /// let x0 = MetricDescriptor::new().set_metric_kind(MetricKind::Gauge);
7644 /// let x1 = MetricDescriptor::new().set_metric_kind(MetricKind::Delta);
7645 /// let x2 = MetricDescriptor::new().set_metric_kind(MetricKind::Cumulative);
7646 /// ```
7647 pub fn set_metric_kind<T: std::convert::Into<crate::model::metric_descriptor::MetricKind>>(
7648 mut self,
7649 v: T,
7650 ) -> Self {
7651 self.metric_kind = v.into();
7652 self
7653 }
7654
7655 /// Sets the value of [value_type][crate::model::MetricDescriptor::value_type].
7656 ///
7657 /// # Example
7658 /// ```ignore,no_run
7659 /// # use google_cloud_api::model::MetricDescriptor;
7660 /// use google_cloud_api::model::metric_descriptor::ValueType;
7661 /// let x0 = MetricDescriptor::new().set_value_type(ValueType::Bool);
7662 /// let x1 = MetricDescriptor::new().set_value_type(ValueType::Int64);
7663 /// let x2 = MetricDescriptor::new().set_value_type(ValueType::Double);
7664 /// ```
7665 pub fn set_value_type<T: std::convert::Into<crate::model::metric_descriptor::ValueType>>(
7666 mut self,
7667 v: T,
7668 ) -> Self {
7669 self.value_type = v.into();
7670 self
7671 }
7672
7673 /// Sets the value of [unit][crate::model::MetricDescriptor::unit].
7674 ///
7675 /// # Example
7676 /// ```ignore,no_run
7677 /// # use google_cloud_api::model::MetricDescriptor;
7678 /// let x = MetricDescriptor::new().set_unit("example");
7679 /// ```
7680 pub fn set_unit<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7681 self.unit = v.into();
7682 self
7683 }
7684
7685 /// Sets the value of [description][crate::model::MetricDescriptor::description].
7686 ///
7687 /// # Example
7688 /// ```ignore,no_run
7689 /// # use google_cloud_api::model::MetricDescriptor;
7690 /// let x = MetricDescriptor::new().set_description("example");
7691 /// ```
7692 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7693 self.description = v.into();
7694 self
7695 }
7696
7697 /// Sets the value of [display_name][crate::model::MetricDescriptor::display_name].
7698 ///
7699 /// # Example
7700 /// ```ignore,no_run
7701 /// # use google_cloud_api::model::MetricDescriptor;
7702 /// let x = MetricDescriptor::new().set_display_name("example");
7703 /// ```
7704 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7705 self.display_name = v.into();
7706 self
7707 }
7708
7709 /// Sets the value of [metadata][crate::model::MetricDescriptor::metadata].
7710 ///
7711 /// # Example
7712 /// ```ignore,no_run
7713 /// # use google_cloud_api::model::MetricDescriptor;
7714 /// use google_cloud_api::model::metric_descriptor::MetricDescriptorMetadata;
7715 /// let x = MetricDescriptor::new().set_metadata(MetricDescriptorMetadata::default()/* use setters */);
7716 /// ```
7717 pub fn set_metadata<T>(mut self, v: T) -> Self
7718 where
7719 T: std::convert::Into<crate::model::metric_descriptor::MetricDescriptorMetadata>,
7720 {
7721 self.metadata = std::option::Option::Some(v.into());
7722 self
7723 }
7724
7725 /// Sets or clears the value of [metadata][crate::model::MetricDescriptor::metadata].
7726 ///
7727 /// # Example
7728 /// ```ignore,no_run
7729 /// # use google_cloud_api::model::MetricDescriptor;
7730 /// use google_cloud_api::model::metric_descriptor::MetricDescriptorMetadata;
7731 /// let x = MetricDescriptor::new().set_or_clear_metadata(Some(MetricDescriptorMetadata::default()/* use setters */));
7732 /// let x = MetricDescriptor::new().set_or_clear_metadata(None::<MetricDescriptorMetadata>);
7733 /// ```
7734 pub fn set_or_clear_metadata<T>(mut self, v: std::option::Option<T>) -> Self
7735 where
7736 T: std::convert::Into<crate::model::metric_descriptor::MetricDescriptorMetadata>,
7737 {
7738 self.metadata = v.map(|x| x.into());
7739 self
7740 }
7741
7742 /// Sets the value of [launch_stage][crate::model::MetricDescriptor::launch_stage].
7743 ///
7744 /// # Example
7745 /// ```ignore,no_run
7746 /// # use google_cloud_api::model::MetricDescriptor;
7747 /// use google_cloud_api::model::LaunchStage;
7748 /// let x0 = MetricDescriptor::new().set_launch_stage(LaunchStage::Unimplemented);
7749 /// let x1 = MetricDescriptor::new().set_launch_stage(LaunchStage::Prelaunch);
7750 /// let x2 = MetricDescriptor::new().set_launch_stage(LaunchStage::EarlyAccess);
7751 /// ```
7752 pub fn set_launch_stage<T: std::convert::Into<crate::model::LaunchStage>>(
7753 mut self,
7754 v: T,
7755 ) -> Self {
7756 self.launch_stage = v.into();
7757 self
7758 }
7759
7760 /// Sets the value of [monitored_resource_types][crate::model::MetricDescriptor::monitored_resource_types].
7761 ///
7762 /// # Example
7763 /// ```ignore,no_run
7764 /// # use google_cloud_api::model::MetricDescriptor;
7765 /// let x = MetricDescriptor::new().set_monitored_resource_types(["a", "b", "c"]);
7766 /// ```
7767 pub fn set_monitored_resource_types<T, V>(mut self, v: T) -> Self
7768 where
7769 T: std::iter::IntoIterator<Item = V>,
7770 V: std::convert::Into<std::string::String>,
7771 {
7772 use std::iter::Iterator;
7773 self.monitored_resource_types = v.into_iter().map(|i| i.into()).collect();
7774 self
7775 }
7776}
7777
7778impl wkt::message::Message for MetricDescriptor {
7779 fn typename() -> &'static str {
7780 "type.googleapis.com/google.api.MetricDescriptor"
7781 }
7782}
7783
7784/// Defines additional types related to [MetricDescriptor].
7785pub mod metric_descriptor {
7786 #[allow(unused_imports)]
7787 use super::*;
7788
7789 /// Additional annotations that can be used to guide the usage of a metric.
7790 #[derive(Clone, Default, PartialEq)]
7791 #[non_exhaustive]
7792 pub struct MetricDescriptorMetadata {
7793
7794 /// Deprecated. Must use the
7795 /// [MetricDescriptor.launch_stage][google.api.MetricDescriptor.launch_stage]
7796 /// instead.
7797 ///
7798 /// [google.api.MetricDescriptor.launch_stage]: crate::model::MetricDescriptor::launch_stage
7799 #[deprecated]
7800 pub launch_stage: crate::model::LaunchStage,
7801
7802 /// The sampling period of metric data points. For metrics which are written
7803 /// periodically, consecutive data points are stored at this time interval,
7804 /// excluding data loss due to errors. Metrics with a higher granularity have
7805 /// a smaller sampling period.
7806 pub sample_period: std::option::Option<wkt::Duration>,
7807
7808 /// The delay of data points caused by ingestion. Data points older than this
7809 /// age are guaranteed to be ingested and available to be read, excluding
7810 /// data loss due to errors.
7811 pub ingest_delay: std::option::Option<wkt::Duration>,
7812
7813 /// The scope of the timeseries data of the metric.
7814 pub time_series_resource_hierarchy_level: std::vec::Vec<crate::model::metric_descriptor::metric_descriptor_metadata::TimeSeriesResourceHierarchyLevel>,
7815
7816 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7817 }
7818
7819 impl MetricDescriptorMetadata {
7820 pub fn new() -> Self {
7821 std::default::Default::default()
7822 }
7823
7824 /// Sets the value of [launch_stage][crate::model::metric_descriptor::MetricDescriptorMetadata::launch_stage].
7825 ///
7826 /// # Example
7827 /// ```ignore,no_run
7828 /// # use google_cloud_api::model::metric_descriptor::MetricDescriptorMetadata;
7829 /// use google_cloud_api::model::LaunchStage;
7830 /// let x0 = MetricDescriptorMetadata::new().set_launch_stage(LaunchStage::Unimplemented);
7831 /// let x1 = MetricDescriptorMetadata::new().set_launch_stage(LaunchStage::Prelaunch);
7832 /// let x2 = MetricDescriptorMetadata::new().set_launch_stage(LaunchStage::EarlyAccess);
7833 /// ```
7834 #[deprecated]
7835 pub fn set_launch_stage<T: std::convert::Into<crate::model::LaunchStage>>(
7836 mut self,
7837 v: T,
7838 ) -> Self {
7839 self.launch_stage = v.into();
7840 self
7841 }
7842
7843 /// Sets the value of [sample_period][crate::model::metric_descriptor::MetricDescriptorMetadata::sample_period].
7844 ///
7845 /// # Example
7846 /// ```ignore,no_run
7847 /// # use google_cloud_api::model::metric_descriptor::MetricDescriptorMetadata;
7848 /// use wkt::Duration;
7849 /// let x = MetricDescriptorMetadata::new().set_sample_period(Duration::default()/* use setters */);
7850 /// ```
7851 pub fn set_sample_period<T>(mut self, v: T) -> Self
7852 where
7853 T: std::convert::Into<wkt::Duration>,
7854 {
7855 self.sample_period = std::option::Option::Some(v.into());
7856 self
7857 }
7858
7859 /// Sets or clears the value of [sample_period][crate::model::metric_descriptor::MetricDescriptorMetadata::sample_period].
7860 ///
7861 /// # Example
7862 /// ```ignore,no_run
7863 /// # use google_cloud_api::model::metric_descriptor::MetricDescriptorMetadata;
7864 /// use wkt::Duration;
7865 /// let x = MetricDescriptorMetadata::new().set_or_clear_sample_period(Some(Duration::default()/* use setters */));
7866 /// let x = MetricDescriptorMetadata::new().set_or_clear_sample_period(None::<Duration>);
7867 /// ```
7868 pub fn set_or_clear_sample_period<T>(mut self, v: std::option::Option<T>) -> Self
7869 where
7870 T: std::convert::Into<wkt::Duration>,
7871 {
7872 self.sample_period = v.map(|x| x.into());
7873 self
7874 }
7875
7876 /// Sets the value of [ingest_delay][crate::model::metric_descriptor::MetricDescriptorMetadata::ingest_delay].
7877 ///
7878 /// # Example
7879 /// ```ignore,no_run
7880 /// # use google_cloud_api::model::metric_descriptor::MetricDescriptorMetadata;
7881 /// use wkt::Duration;
7882 /// let x = MetricDescriptorMetadata::new().set_ingest_delay(Duration::default()/* use setters */);
7883 /// ```
7884 pub fn set_ingest_delay<T>(mut self, v: T) -> Self
7885 where
7886 T: std::convert::Into<wkt::Duration>,
7887 {
7888 self.ingest_delay = std::option::Option::Some(v.into());
7889 self
7890 }
7891
7892 /// Sets or clears the value of [ingest_delay][crate::model::metric_descriptor::MetricDescriptorMetadata::ingest_delay].
7893 ///
7894 /// # Example
7895 /// ```ignore,no_run
7896 /// # use google_cloud_api::model::metric_descriptor::MetricDescriptorMetadata;
7897 /// use wkt::Duration;
7898 /// let x = MetricDescriptorMetadata::new().set_or_clear_ingest_delay(Some(Duration::default()/* use setters */));
7899 /// let x = MetricDescriptorMetadata::new().set_or_clear_ingest_delay(None::<Duration>);
7900 /// ```
7901 pub fn set_or_clear_ingest_delay<T>(mut self, v: std::option::Option<T>) -> Self
7902 where
7903 T: std::convert::Into<wkt::Duration>,
7904 {
7905 self.ingest_delay = v.map(|x| x.into());
7906 self
7907 }
7908
7909 /// Sets the value of [time_series_resource_hierarchy_level][crate::model::metric_descriptor::MetricDescriptorMetadata::time_series_resource_hierarchy_level].
7910 ///
7911 /// # Example
7912 /// ```ignore,no_run
7913 /// # use google_cloud_api::model::metric_descriptor::MetricDescriptorMetadata;
7914 /// use google_cloud_api::model::metric_descriptor::metric_descriptor_metadata::TimeSeriesResourceHierarchyLevel;
7915 /// let x = MetricDescriptorMetadata::new().set_time_series_resource_hierarchy_level([
7916 /// TimeSeriesResourceHierarchyLevel::Project,
7917 /// TimeSeriesResourceHierarchyLevel::Organization,
7918 /// TimeSeriesResourceHierarchyLevel::Folder,
7919 /// ]);
7920 /// ```
7921 pub fn set_time_series_resource_hierarchy_level<T, V>(mut self, v: T) -> Self
7922 where
7923 T: std::iter::IntoIterator<Item = V>,
7924 V: std::convert::Into<crate::model::metric_descriptor::metric_descriptor_metadata::TimeSeriesResourceHierarchyLevel>
7925 {
7926 use std::iter::Iterator;
7927 self.time_series_resource_hierarchy_level = v.into_iter().map(|i| i.into()).collect();
7928 self
7929 }
7930 }
7931
7932 impl wkt::message::Message for MetricDescriptorMetadata {
7933 fn typename() -> &'static str {
7934 "type.googleapis.com/google.api.MetricDescriptor.MetricDescriptorMetadata"
7935 }
7936 }
7937
7938 /// Defines additional types related to [MetricDescriptorMetadata].
7939 pub mod metric_descriptor_metadata {
7940 #[allow(unused_imports)]
7941 use super::*;
7942
7943 /// The resource hierarchy level of the timeseries data of a metric.
7944 ///
7945 /// # Working with unknown values
7946 ///
7947 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7948 /// additional enum variants at any time. Adding new variants is not considered
7949 /// a breaking change. Applications should write their code in anticipation of:
7950 ///
7951 /// - New values appearing in future releases of the client library, **and**
7952 /// - New values received dynamically, without application changes.
7953 ///
7954 /// Please consult the [Working with enums] section in the user guide for some
7955 /// guidelines.
7956 ///
7957 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
7958 #[derive(Clone, Debug, PartialEq)]
7959 #[non_exhaustive]
7960 pub enum TimeSeriesResourceHierarchyLevel {
7961 /// Do not use this default value.
7962 Unspecified,
7963 /// Scopes a metric to a project.
7964 Project,
7965 /// Scopes a metric to an organization.
7966 Organization,
7967 /// Scopes a metric to a folder.
7968 Folder,
7969 /// If set, the enum was initialized with an unknown value.
7970 ///
7971 /// Applications can examine the value using [TimeSeriesResourceHierarchyLevel::value] or
7972 /// [TimeSeriesResourceHierarchyLevel::name].
7973 UnknownValue(time_series_resource_hierarchy_level::UnknownValue),
7974 }
7975
7976 #[doc(hidden)]
7977 pub mod time_series_resource_hierarchy_level {
7978 #[allow(unused_imports)]
7979 use super::*;
7980 #[derive(Clone, Debug, PartialEq)]
7981 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7982 }
7983
7984 impl TimeSeriesResourceHierarchyLevel {
7985 /// Gets the enum value.
7986 ///
7987 /// Returns `None` if the enum contains an unknown value deserialized from
7988 /// the string representation of enums.
7989 pub fn value(&self) -> std::option::Option<i32> {
7990 match self {
7991 Self::Unspecified => std::option::Option::Some(0),
7992 Self::Project => std::option::Option::Some(1),
7993 Self::Organization => std::option::Option::Some(2),
7994 Self::Folder => std::option::Option::Some(3),
7995 Self::UnknownValue(u) => u.0.value(),
7996 }
7997 }
7998
7999 /// Gets the enum value as a string.
8000 ///
8001 /// Returns `None` if the enum contains an unknown value deserialized from
8002 /// the integer representation of enums.
8003 pub fn name(&self) -> std::option::Option<&str> {
8004 match self {
8005 Self::Unspecified => std::option::Option::Some(
8006 "TIME_SERIES_RESOURCE_HIERARCHY_LEVEL_UNSPECIFIED",
8007 ),
8008 Self::Project => std::option::Option::Some("PROJECT"),
8009 Self::Organization => std::option::Option::Some("ORGANIZATION"),
8010 Self::Folder => std::option::Option::Some("FOLDER"),
8011 Self::UnknownValue(u) => u.0.name(),
8012 }
8013 }
8014 }
8015
8016 impl std::default::Default for TimeSeriesResourceHierarchyLevel {
8017 fn default() -> Self {
8018 use std::convert::From;
8019 Self::from(0)
8020 }
8021 }
8022
8023 impl std::fmt::Display for TimeSeriesResourceHierarchyLevel {
8024 fn fmt(
8025 &self,
8026 f: &mut std::fmt::Formatter<'_>,
8027 ) -> std::result::Result<(), std::fmt::Error> {
8028 wkt::internal::display_enum(f, self.name(), self.value())
8029 }
8030 }
8031
8032 impl std::convert::From<i32> for TimeSeriesResourceHierarchyLevel {
8033 fn from(value: i32) -> Self {
8034 match value {
8035 0 => Self::Unspecified,
8036 1 => Self::Project,
8037 2 => Self::Organization,
8038 3 => Self::Folder,
8039 _ => Self::UnknownValue(time_series_resource_hierarchy_level::UnknownValue(
8040 wkt::internal::UnknownEnumValue::Integer(value),
8041 )),
8042 }
8043 }
8044 }
8045
8046 impl std::convert::From<&str> for TimeSeriesResourceHierarchyLevel {
8047 fn from(value: &str) -> Self {
8048 use std::string::ToString;
8049 match value {
8050 "TIME_SERIES_RESOURCE_HIERARCHY_LEVEL_UNSPECIFIED" => Self::Unspecified,
8051 "PROJECT" => Self::Project,
8052 "ORGANIZATION" => Self::Organization,
8053 "FOLDER" => Self::Folder,
8054 _ => Self::UnknownValue(time_series_resource_hierarchy_level::UnknownValue(
8055 wkt::internal::UnknownEnumValue::String(value.to_string()),
8056 )),
8057 }
8058 }
8059 }
8060
8061 impl serde::ser::Serialize for TimeSeriesResourceHierarchyLevel {
8062 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8063 where
8064 S: serde::Serializer,
8065 {
8066 match self {
8067 Self::Unspecified => serializer.serialize_i32(0),
8068 Self::Project => serializer.serialize_i32(1),
8069 Self::Organization => serializer.serialize_i32(2),
8070 Self::Folder => serializer.serialize_i32(3),
8071 Self::UnknownValue(u) => u.0.serialize(serializer),
8072 }
8073 }
8074 }
8075
8076 impl<'de> serde::de::Deserialize<'de> for TimeSeriesResourceHierarchyLevel {
8077 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8078 where
8079 D: serde::Deserializer<'de>,
8080 {
8081 deserializer.deserialize_any(wkt::internal::EnumVisitor::<TimeSeriesResourceHierarchyLevel>::new(
8082 ".google.api.MetricDescriptor.MetricDescriptorMetadata.TimeSeriesResourceHierarchyLevel"))
8083 }
8084 }
8085 }
8086
8087 /// The kind of measurement. It describes how the data is reported.
8088 /// For information on setting the start time and end time based on
8089 /// the MetricKind, see [TimeInterval][google.monitoring.v3.TimeInterval].
8090 ///
8091 /// # Working with unknown values
8092 ///
8093 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8094 /// additional enum variants at any time. Adding new variants is not considered
8095 /// a breaking change. Applications should write their code in anticipation of:
8096 ///
8097 /// - New values appearing in future releases of the client library, **and**
8098 /// - New values received dynamically, without application changes.
8099 ///
8100 /// Please consult the [Working with enums] section in the user guide for some
8101 /// guidelines.
8102 ///
8103 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8104 #[derive(Clone, Debug, PartialEq)]
8105 #[non_exhaustive]
8106 pub enum MetricKind {
8107 /// Do not use this default value.
8108 Unspecified,
8109 /// An instantaneous measurement of a value.
8110 Gauge,
8111 /// The change in a value during a time interval.
8112 Delta,
8113 /// A value accumulated over a time interval. Cumulative
8114 /// measurements in a time series should have the same start time
8115 /// and increasing end times, until an event resets the cumulative
8116 /// value to zero and sets a new start time for the following
8117 /// points.
8118 Cumulative,
8119 /// If set, the enum was initialized with an unknown value.
8120 ///
8121 /// Applications can examine the value using [MetricKind::value] or
8122 /// [MetricKind::name].
8123 UnknownValue(metric_kind::UnknownValue),
8124 }
8125
8126 #[doc(hidden)]
8127 pub mod metric_kind {
8128 #[allow(unused_imports)]
8129 use super::*;
8130 #[derive(Clone, Debug, PartialEq)]
8131 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8132 }
8133
8134 impl MetricKind {
8135 /// Gets the enum value.
8136 ///
8137 /// Returns `None` if the enum contains an unknown value deserialized from
8138 /// the string representation of enums.
8139 pub fn value(&self) -> std::option::Option<i32> {
8140 match self {
8141 Self::Unspecified => std::option::Option::Some(0),
8142 Self::Gauge => std::option::Option::Some(1),
8143 Self::Delta => std::option::Option::Some(2),
8144 Self::Cumulative => std::option::Option::Some(3),
8145 Self::UnknownValue(u) => u.0.value(),
8146 }
8147 }
8148
8149 /// Gets the enum value as a string.
8150 ///
8151 /// Returns `None` if the enum contains an unknown value deserialized from
8152 /// the integer representation of enums.
8153 pub fn name(&self) -> std::option::Option<&str> {
8154 match self {
8155 Self::Unspecified => std::option::Option::Some("METRIC_KIND_UNSPECIFIED"),
8156 Self::Gauge => std::option::Option::Some("GAUGE"),
8157 Self::Delta => std::option::Option::Some("DELTA"),
8158 Self::Cumulative => std::option::Option::Some("CUMULATIVE"),
8159 Self::UnknownValue(u) => u.0.name(),
8160 }
8161 }
8162 }
8163
8164 impl std::default::Default for MetricKind {
8165 fn default() -> Self {
8166 use std::convert::From;
8167 Self::from(0)
8168 }
8169 }
8170
8171 impl std::fmt::Display for MetricKind {
8172 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8173 wkt::internal::display_enum(f, self.name(), self.value())
8174 }
8175 }
8176
8177 impl std::convert::From<i32> for MetricKind {
8178 fn from(value: i32) -> Self {
8179 match value {
8180 0 => Self::Unspecified,
8181 1 => Self::Gauge,
8182 2 => Self::Delta,
8183 3 => Self::Cumulative,
8184 _ => Self::UnknownValue(metric_kind::UnknownValue(
8185 wkt::internal::UnknownEnumValue::Integer(value),
8186 )),
8187 }
8188 }
8189 }
8190
8191 impl std::convert::From<&str> for MetricKind {
8192 fn from(value: &str) -> Self {
8193 use std::string::ToString;
8194 match value {
8195 "METRIC_KIND_UNSPECIFIED" => Self::Unspecified,
8196 "GAUGE" => Self::Gauge,
8197 "DELTA" => Self::Delta,
8198 "CUMULATIVE" => Self::Cumulative,
8199 _ => Self::UnknownValue(metric_kind::UnknownValue(
8200 wkt::internal::UnknownEnumValue::String(value.to_string()),
8201 )),
8202 }
8203 }
8204 }
8205
8206 impl serde::ser::Serialize for MetricKind {
8207 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8208 where
8209 S: serde::Serializer,
8210 {
8211 match self {
8212 Self::Unspecified => serializer.serialize_i32(0),
8213 Self::Gauge => serializer.serialize_i32(1),
8214 Self::Delta => serializer.serialize_i32(2),
8215 Self::Cumulative => serializer.serialize_i32(3),
8216 Self::UnknownValue(u) => u.0.serialize(serializer),
8217 }
8218 }
8219 }
8220
8221 impl<'de> serde::de::Deserialize<'de> for MetricKind {
8222 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8223 where
8224 D: serde::Deserializer<'de>,
8225 {
8226 deserializer.deserialize_any(wkt::internal::EnumVisitor::<MetricKind>::new(
8227 ".google.api.MetricDescriptor.MetricKind",
8228 ))
8229 }
8230 }
8231
8232 /// The value type of a metric.
8233 ///
8234 /// # Working with unknown values
8235 ///
8236 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8237 /// additional enum variants at any time. Adding new variants is not considered
8238 /// a breaking change. Applications should write their code in anticipation of:
8239 ///
8240 /// - New values appearing in future releases of the client library, **and**
8241 /// - New values received dynamically, without application changes.
8242 ///
8243 /// Please consult the [Working with enums] section in the user guide for some
8244 /// guidelines.
8245 ///
8246 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8247 #[derive(Clone, Debug, PartialEq)]
8248 #[non_exhaustive]
8249 pub enum ValueType {
8250 /// Do not use this default value.
8251 Unspecified,
8252 /// The value is a boolean.
8253 /// This value type can be used only if the metric kind is `GAUGE`.
8254 Bool,
8255 /// The value is a signed 64-bit integer.
8256 Int64,
8257 /// The value is a double precision floating point number.
8258 Double,
8259 /// The value is a text string.
8260 /// This value type can be used only if the metric kind is `GAUGE`.
8261 String,
8262 /// The value is a [`Distribution`][google.api.Distribution].
8263 ///
8264 /// [google.api.Distribution]: crate::model::Distribution
8265 Distribution,
8266 /// The value is money.
8267 Money,
8268 /// If set, the enum was initialized with an unknown value.
8269 ///
8270 /// Applications can examine the value using [ValueType::value] or
8271 /// [ValueType::name].
8272 UnknownValue(value_type::UnknownValue),
8273 }
8274
8275 #[doc(hidden)]
8276 pub mod value_type {
8277 #[allow(unused_imports)]
8278 use super::*;
8279 #[derive(Clone, Debug, PartialEq)]
8280 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8281 }
8282
8283 impl ValueType {
8284 /// Gets the enum value.
8285 ///
8286 /// Returns `None` if the enum contains an unknown value deserialized from
8287 /// the string representation of enums.
8288 pub fn value(&self) -> std::option::Option<i32> {
8289 match self {
8290 Self::Unspecified => std::option::Option::Some(0),
8291 Self::Bool => std::option::Option::Some(1),
8292 Self::Int64 => std::option::Option::Some(2),
8293 Self::Double => std::option::Option::Some(3),
8294 Self::String => std::option::Option::Some(4),
8295 Self::Distribution => std::option::Option::Some(5),
8296 Self::Money => std::option::Option::Some(6),
8297 Self::UnknownValue(u) => u.0.value(),
8298 }
8299 }
8300
8301 /// Gets the enum value as a string.
8302 ///
8303 /// Returns `None` if the enum contains an unknown value deserialized from
8304 /// the integer representation of enums.
8305 pub fn name(&self) -> std::option::Option<&str> {
8306 match self {
8307 Self::Unspecified => std::option::Option::Some("VALUE_TYPE_UNSPECIFIED"),
8308 Self::Bool => std::option::Option::Some("BOOL"),
8309 Self::Int64 => std::option::Option::Some("INT64"),
8310 Self::Double => std::option::Option::Some("DOUBLE"),
8311 Self::String => std::option::Option::Some("STRING"),
8312 Self::Distribution => std::option::Option::Some("DISTRIBUTION"),
8313 Self::Money => std::option::Option::Some("MONEY"),
8314 Self::UnknownValue(u) => u.0.name(),
8315 }
8316 }
8317 }
8318
8319 impl std::default::Default for ValueType {
8320 fn default() -> Self {
8321 use std::convert::From;
8322 Self::from(0)
8323 }
8324 }
8325
8326 impl std::fmt::Display for ValueType {
8327 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8328 wkt::internal::display_enum(f, self.name(), self.value())
8329 }
8330 }
8331
8332 impl std::convert::From<i32> for ValueType {
8333 fn from(value: i32) -> Self {
8334 match value {
8335 0 => Self::Unspecified,
8336 1 => Self::Bool,
8337 2 => Self::Int64,
8338 3 => Self::Double,
8339 4 => Self::String,
8340 5 => Self::Distribution,
8341 6 => Self::Money,
8342 _ => Self::UnknownValue(value_type::UnknownValue(
8343 wkt::internal::UnknownEnumValue::Integer(value),
8344 )),
8345 }
8346 }
8347 }
8348
8349 impl std::convert::From<&str> for ValueType {
8350 fn from(value: &str) -> Self {
8351 use std::string::ToString;
8352 match value {
8353 "VALUE_TYPE_UNSPECIFIED" => Self::Unspecified,
8354 "BOOL" => Self::Bool,
8355 "INT64" => Self::Int64,
8356 "DOUBLE" => Self::Double,
8357 "STRING" => Self::String,
8358 "DISTRIBUTION" => Self::Distribution,
8359 "MONEY" => Self::Money,
8360 _ => Self::UnknownValue(value_type::UnknownValue(
8361 wkt::internal::UnknownEnumValue::String(value.to_string()),
8362 )),
8363 }
8364 }
8365 }
8366
8367 impl serde::ser::Serialize for ValueType {
8368 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8369 where
8370 S: serde::Serializer,
8371 {
8372 match self {
8373 Self::Unspecified => serializer.serialize_i32(0),
8374 Self::Bool => serializer.serialize_i32(1),
8375 Self::Int64 => serializer.serialize_i32(2),
8376 Self::Double => serializer.serialize_i32(3),
8377 Self::String => serializer.serialize_i32(4),
8378 Self::Distribution => serializer.serialize_i32(5),
8379 Self::Money => serializer.serialize_i32(6),
8380 Self::UnknownValue(u) => u.0.serialize(serializer),
8381 }
8382 }
8383 }
8384
8385 impl<'de> serde::de::Deserialize<'de> for ValueType {
8386 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8387 where
8388 D: serde::Deserializer<'de>,
8389 {
8390 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ValueType>::new(
8391 ".google.api.MetricDescriptor.ValueType",
8392 ))
8393 }
8394 }
8395}
8396
8397/// A specific metric, identified by specifying values for all of the
8398/// labels of a [`MetricDescriptor`][google.api.MetricDescriptor].
8399///
8400/// [google.api.MetricDescriptor]: crate::model::MetricDescriptor
8401#[derive(Clone, Default, PartialEq)]
8402#[non_exhaustive]
8403pub struct Metric {
8404 /// An existing metric type, see
8405 /// [google.api.MetricDescriptor][google.api.MetricDescriptor]. For example,
8406 /// `custom.googleapis.com/invoice/paid/amount`.
8407 ///
8408 /// [google.api.MetricDescriptor]: crate::model::MetricDescriptor
8409 pub r#type: std::string::String,
8410
8411 /// The set of label values that uniquely identify this metric. All
8412 /// labels listed in the `MetricDescriptor` must be assigned values.
8413 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
8414
8415 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8416}
8417
8418impl Metric {
8419 pub fn new() -> Self {
8420 std::default::Default::default()
8421 }
8422
8423 /// Sets the value of [r#type][crate::model::Metric::type].
8424 ///
8425 /// # Example
8426 /// ```ignore,no_run
8427 /// # use google_cloud_api::model::Metric;
8428 /// let x = Metric::new().set_type("example");
8429 /// ```
8430 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8431 self.r#type = v.into();
8432 self
8433 }
8434
8435 /// Sets the value of [labels][crate::model::Metric::labels].
8436 ///
8437 /// # Example
8438 /// ```ignore,no_run
8439 /// # use google_cloud_api::model::Metric;
8440 /// let x = Metric::new().set_labels([
8441 /// ("key0", "abc"),
8442 /// ("key1", "xyz"),
8443 /// ]);
8444 /// ```
8445 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
8446 where
8447 T: std::iter::IntoIterator<Item = (K, V)>,
8448 K: std::convert::Into<std::string::String>,
8449 V: std::convert::Into<std::string::String>,
8450 {
8451 use std::iter::Iterator;
8452 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8453 self
8454 }
8455}
8456
8457impl wkt::message::Message for Metric {
8458 fn typename() -> &'static str {
8459 "type.googleapis.com/google.api.Metric"
8460 }
8461}
8462
8463/// An object that describes the schema of a
8464/// [MonitoredResource][google.api.MonitoredResource] object using a type name
8465/// and a set of labels. For example, the monitored resource descriptor for
8466/// Google Compute Engine VM instances has a type of
8467/// `"gce_instance"` and specifies the use of the labels `"instance_id"` and
8468/// `"zone"` to identify particular VM instances.
8469///
8470/// Different APIs can support different monitored resource types. APIs generally
8471/// provide a `list` method that returns the monitored resource descriptors used
8472/// by the API.
8473///
8474/// [google.api.MonitoredResource]: crate::model::MonitoredResource
8475#[derive(Clone, Default, PartialEq)]
8476#[non_exhaustive]
8477pub struct MonitoredResourceDescriptor {
8478 /// Optional. The resource name of the monitored resource descriptor:
8479 /// `"projects/{project_id}/monitoredResourceDescriptors/{type}"` where
8480 /// {type} is the value of the `type` field in this object and
8481 /// {project_id} is a project ID that provides API-specific context for
8482 /// accessing the type. APIs that do not use project information can use the
8483 /// resource name format `"monitoredResourceDescriptors/{type}"`.
8484 pub name: std::string::String,
8485
8486 /// Required. The monitored resource type. For example, the type
8487 /// `"cloudsql_database"` represents databases in Google Cloud SQL.
8488 /// For a list of types, see [Monitored resource
8489 /// types](https://cloud.google.com/monitoring/api/resources)
8490 /// and [Logging resource
8491 /// types](https://cloud.google.com/logging/docs/api/v2/resource-list).
8492 pub r#type: std::string::String,
8493
8494 /// Optional. A concise name for the monitored resource type that might be
8495 /// displayed in user interfaces. It should be a Title Cased Noun Phrase,
8496 /// without any article or other determiners. For example,
8497 /// `"Google Cloud SQL Database"`.
8498 pub display_name: std::string::String,
8499
8500 /// Optional. A detailed description of the monitored resource type that might
8501 /// be used in documentation.
8502 pub description: std::string::String,
8503
8504 /// Required. A set of labels used to describe instances of this monitored
8505 /// resource type. For example, an individual Google Cloud SQL database is
8506 /// identified by values for the labels `"database_id"` and `"zone"`.
8507 pub labels: std::vec::Vec<crate::model::LabelDescriptor>,
8508
8509 /// Optional. The launch stage of the monitored resource definition.
8510 pub launch_stage: crate::model::LaunchStage,
8511
8512 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8513}
8514
8515impl MonitoredResourceDescriptor {
8516 pub fn new() -> Self {
8517 std::default::Default::default()
8518 }
8519
8520 /// Sets the value of [name][crate::model::MonitoredResourceDescriptor::name].
8521 ///
8522 /// # Example
8523 /// ```ignore,no_run
8524 /// # use google_cloud_api::model::MonitoredResourceDescriptor;
8525 /// let x = MonitoredResourceDescriptor::new().set_name("example");
8526 /// ```
8527 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8528 self.name = v.into();
8529 self
8530 }
8531
8532 /// Sets the value of [r#type][crate::model::MonitoredResourceDescriptor::type].
8533 ///
8534 /// # Example
8535 /// ```ignore,no_run
8536 /// # use google_cloud_api::model::MonitoredResourceDescriptor;
8537 /// let x = MonitoredResourceDescriptor::new().set_type("example");
8538 /// ```
8539 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8540 self.r#type = v.into();
8541 self
8542 }
8543
8544 /// Sets the value of [display_name][crate::model::MonitoredResourceDescriptor::display_name].
8545 ///
8546 /// # Example
8547 /// ```ignore,no_run
8548 /// # use google_cloud_api::model::MonitoredResourceDescriptor;
8549 /// let x = MonitoredResourceDescriptor::new().set_display_name("example");
8550 /// ```
8551 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8552 self.display_name = v.into();
8553 self
8554 }
8555
8556 /// Sets the value of [description][crate::model::MonitoredResourceDescriptor::description].
8557 ///
8558 /// # Example
8559 /// ```ignore,no_run
8560 /// # use google_cloud_api::model::MonitoredResourceDescriptor;
8561 /// let x = MonitoredResourceDescriptor::new().set_description("example");
8562 /// ```
8563 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8564 self.description = v.into();
8565 self
8566 }
8567
8568 /// Sets the value of [labels][crate::model::MonitoredResourceDescriptor::labels].
8569 ///
8570 /// # Example
8571 /// ```ignore,no_run
8572 /// # use google_cloud_api::model::MonitoredResourceDescriptor;
8573 /// use google_cloud_api::model::LabelDescriptor;
8574 /// let x = MonitoredResourceDescriptor::new()
8575 /// .set_labels([
8576 /// LabelDescriptor::default()/* use setters */,
8577 /// LabelDescriptor::default()/* use (different) setters */,
8578 /// ]);
8579 /// ```
8580 pub fn set_labels<T, V>(mut self, v: T) -> Self
8581 where
8582 T: std::iter::IntoIterator<Item = V>,
8583 V: std::convert::Into<crate::model::LabelDescriptor>,
8584 {
8585 use std::iter::Iterator;
8586 self.labels = v.into_iter().map(|i| i.into()).collect();
8587 self
8588 }
8589
8590 /// Sets the value of [launch_stage][crate::model::MonitoredResourceDescriptor::launch_stage].
8591 ///
8592 /// # Example
8593 /// ```ignore,no_run
8594 /// # use google_cloud_api::model::MonitoredResourceDescriptor;
8595 /// use google_cloud_api::model::LaunchStage;
8596 /// let x0 = MonitoredResourceDescriptor::new().set_launch_stage(LaunchStage::Unimplemented);
8597 /// let x1 = MonitoredResourceDescriptor::new().set_launch_stage(LaunchStage::Prelaunch);
8598 /// let x2 = MonitoredResourceDescriptor::new().set_launch_stage(LaunchStage::EarlyAccess);
8599 /// ```
8600 pub fn set_launch_stage<T: std::convert::Into<crate::model::LaunchStage>>(
8601 mut self,
8602 v: T,
8603 ) -> Self {
8604 self.launch_stage = v.into();
8605 self
8606 }
8607}
8608
8609impl wkt::message::Message for MonitoredResourceDescriptor {
8610 fn typename() -> &'static str {
8611 "type.googleapis.com/google.api.MonitoredResourceDescriptor"
8612 }
8613}
8614
8615/// An object representing a resource that can be used for monitoring, logging,
8616/// billing, or other purposes. Examples include virtual machine instances,
8617/// databases, and storage devices such as disks. The `type` field identifies a
8618/// [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] object
8619/// that describes the resource's schema. Information in the `labels` field
8620/// identifies the actual resource and its attributes according to the schema.
8621/// For example, a particular Compute Engine VM instance could be represented by
8622/// the following object, because the
8623/// [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] for
8624/// `"gce_instance"` has labels
8625/// `"project_id"`, `"instance_id"` and `"zone"`:
8626///
8627/// ```norust
8628/// { "type": "gce_instance",
8629/// "labels": { "project_id": "my-project",
8630/// "instance_id": "12345678901234",
8631/// "zone": "us-central1-a" }}
8632/// ```
8633///
8634/// [google.api.MonitoredResourceDescriptor]: crate::model::MonitoredResourceDescriptor
8635#[derive(Clone, Default, PartialEq)]
8636#[non_exhaustive]
8637pub struct MonitoredResource {
8638 /// Required. The monitored resource type. This field must match
8639 /// the `type` field of a
8640 /// [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor]
8641 /// object. For example, the type of a Compute Engine VM instance is
8642 /// `gce_instance`. Some descriptors include the service name in the type; for
8643 /// example, the type of a Datastream stream is
8644 /// `datastream.googleapis.com/Stream`.
8645 ///
8646 /// [google.api.MonitoredResourceDescriptor]: crate::model::MonitoredResourceDescriptor
8647 pub r#type: std::string::String,
8648
8649 /// Required. Values for all of the labels listed in the associated monitored
8650 /// resource descriptor. For example, Compute Engine VM instances use the
8651 /// labels `"project_id"`, `"instance_id"`, and `"zone"`.
8652 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
8653
8654 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8655}
8656
8657impl MonitoredResource {
8658 pub fn new() -> Self {
8659 std::default::Default::default()
8660 }
8661
8662 /// Sets the value of [r#type][crate::model::MonitoredResource::type].
8663 ///
8664 /// # Example
8665 /// ```ignore,no_run
8666 /// # use google_cloud_api::model::MonitoredResource;
8667 /// let x = MonitoredResource::new().set_type("example");
8668 /// ```
8669 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8670 self.r#type = v.into();
8671 self
8672 }
8673
8674 /// Sets the value of [labels][crate::model::MonitoredResource::labels].
8675 ///
8676 /// # Example
8677 /// ```ignore,no_run
8678 /// # use google_cloud_api::model::MonitoredResource;
8679 /// let x = MonitoredResource::new().set_labels([
8680 /// ("key0", "abc"),
8681 /// ("key1", "xyz"),
8682 /// ]);
8683 /// ```
8684 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
8685 where
8686 T: std::iter::IntoIterator<Item = (K, V)>,
8687 K: std::convert::Into<std::string::String>,
8688 V: std::convert::Into<std::string::String>,
8689 {
8690 use std::iter::Iterator;
8691 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8692 self
8693 }
8694}
8695
8696impl wkt::message::Message for MonitoredResource {
8697 fn typename() -> &'static str {
8698 "type.googleapis.com/google.api.MonitoredResource"
8699 }
8700}
8701
8702/// Auxiliary metadata for a [MonitoredResource][google.api.MonitoredResource]
8703/// object. [MonitoredResource][google.api.MonitoredResource] objects contain the
8704/// minimum set of information to uniquely identify a monitored resource
8705/// instance. There is some other useful auxiliary metadata. Monitoring and
8706/// Logging use an ingestion pipeline to extract metadata for cloud resources of
8707/// all types, and store the metadata in this message.
8708///
8709/// [google.api.MonitoredResource]: crate::model::MonitoredResource
8710#[derive(Clone, Default, PartialEq)]
8711#[non_exhaustive]
8712pub struct MonitoredResourceMetadata {
8713 /// Output only. Values for predefined system metadata labels.
8714 /// System labels are a kind of metadata extracted by Google, including
8715 /// "machine_image", "vpc", "subnet_id",
8716 /// "security_group", "name", etc.
8717 /// System label values can be only strings, Boolean values, or a list of
8718 /// strings. For example:
8719 ///
8720 /// ```norust
8721 /// { "name": "my-test-instance",
8722 /// "security_group": ["a", "b", "c"],
8723 /// "spot_instance": false }
8724 /// ```
8725 pub system_labels: std::option::Option<wkt::Struct>,
8726
8727 /// Output only. A map of user-defined metadata labels.
8728 pub user_labels: std::collections::HashMap<std::string::String, std::string::String>,
8729
8730 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8731}
8732
8733impl MonitoredResourceMetadata {
8734 pub fn new() -> Self {
8735 std::default::Default::default()
8736 }
8737
8738 /// Sets the value of [system_labels][crate::model::MonitoredResourceMetadata::system_labels].
8739 ///
8740 /// # Example
8741 /// ```ignore,no_run
8742 /// # use google_cloud_api::model::MonitoredResourceMetadata;
8743 /// use wkt::Struct;
8744 /// let x = MonitoredResourceMetadata::new().set_system_labels(Struct::default()/* use setters */);
8745 /// ```
8746 pub fn set_system_labels<T>(mut self, v: T) -> Self
8747 where
8748 T: std::convert::Into<wkt::Struct>,
8749 {
8750 self.system_labels = std::option::Option::Some(v.into());
8751 self
8752 }
8753
8754 /// Sets or clears the value of [system_labels][crate::model::MonitoredResourceMetadata::system_labels].
8755 ///
8756 /// # Example
8757 /// ```ignore,no_run
8758 /// # use google_cloud_api::model::MonitoredResourceMetadata;
8759 /// use wkt::Struct;
8760 /// let x = MonitoredResourceMetadata::new().set_or_clear_system_labels(Some(Struct::default()/* use setters */));
8761 /// let x = MonitoredResourceMetadata::new().set_or_clear_system_labels(None::<Struct>);
8762 /// ```
8763 pub fn set_or_clear_system_labels<T>(mut self, v: std::option::Option<T>) -> Self
8764 where
8765 T: std::convert::Into<wkt::Struct>,
8766 {
8767 self.system_labels = v.map(|x| x.into());
8768 self
8769 }
8770
8771 /// Sets the value of [user_labels][crate::model::MonitoredResourceMetadata::user_labels].
8772 ///
8773 /// # Example
8774 /// ```ignore,no_run
8775 /// # use google_cloud_api::model::MonitoredResourceMetadata;
8776 /// let x = MonitoredResourceMetadata::new().set_user_labels([
8777 /// ("key0", "abc"),
8778 /// ("key1", "xyz"),
8779 /// ]);
8780 /// ```
8781 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
8782 where
8783 T: std::iter::IntoIterator<Item = (K, V)>,
8784 K: std::convert::Into<std::string::String>,
8785 V: std::convert::Into<std::string::String>,
8786 {
8787 use std::iter::Iterator;
8788 self.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8789 self
8790 }
8791}
8792
8793impl wkt::message::Message for MonitoredResourceMetadata {
8794 fn typename() -> &'static str {
8795 "type.googleapis.com/google.api.MonitoredResourceMetadata"
8796 }
8797}
8798
8799/// Monitoring configuration of the service.
8800///
8801/// The example below shows how to configure monitored resources and metrics
8802/// for monitoring. In the example, a monitored resource and two metrics are
8803/// defined. The `library.googleapis.com/book/returned_count` metric is sent
8804/// to both producer and consumer projects, whereas the
8805/// `library.googleapis.com/book/num_overdue` metric is only sent to the
8806/// consumer project.
8807///
8808/// ```norust
8809/// monitored_resources:
8810/// - type: library.googleapis.com/Branch
8811/// display_name: "Library Branch"
8812/// description: "A branch of a library."
8813/// launch_stage: GA
8814/// labels:
8815/// - key: resource_container
8816/// description: "The Cloud container (ie. project id) for the Branch."
8817/// - key: location
8818/// description: "The location of the library branch."
8819/// - key: branch_id
8820/// description: "The id of the branch."
8821/// metrics:
8822/// - name: library.googleapis.com/book/returned_count
8823/// display_name: "Books Returned"
8824/// description: "The count of books that have been returned."
8825/// launch_stage: GA
8826/// metric_kind: DELTA
8827/// value_type: INT64
8828/// unit: "1"
8829/// labels:
8830/// - key: customer_id
8831/// description: "The id of the customer."
8832/// - name: library.googleapis.com/book/num_overdue
8833/// display_name: "Books Overdue"
8834/// description: "The current number of overdue books."
8835/// launch_stage: GA
8836/// metric_kind: GAUGE
8837/// value_type: INT64
8838/// unit: "1"
8839/// labels:
8840/// - key: customer_id
8841/// description: "The id of the customer."
8842/// monitoring:
8843/// producer_destinations:
8844/// - monitored_resource: library.googleapis.com/Branch
8845/// metrics:
8846/// - library.googleapis.com/book/returned_count
8847/// consumer_destinations:
8848/// - monitored_resource: library.googleapis.com/Branch
8849/// metrics:
8850/// - library.googleapis.com/book/returned_count
8851/// - library.googleapis.com/book/num_overdue
8852/// ```
8853#[derive(Clone, Default, PartialEq)]
8854#[non_exhaustive]
8855pub struct Monitoring {
8856 /// Monitoring configurations for sending metrics to the producer project.
8857 /// There can be multiple producer destinations. A monitored resource type may
8858 /// appear in multiple monitoring destinations if different aggregations are
8859 /// needed for different sets of metrics associated with that monitored
8860 /// resource type. A monitored resource and metric pair may only be used once
8861 /// in the Monitoring configuration.
8862 pub producer_destinations: std::vec::Vec<crate::model::monitoring::MonitoringDestination>,
8863
8864 /// Monitoring configurations for sending metrics to the consumer project.
8865 /// There can be multiple consumer destinations. A monitored resource type may
8866 /// appear in multiple monitoring destinations if different aggregations are
8867 /// needed for different sets of metrics associated with that monitored
8868 /// resource type. A monitored resource and metric pair may only be used once
8869 /// in the Monitoring configuration.
8870 pub consumer_destinations: std::vec::Vec<crate::model::monitoring::MonitoringDestination>,
8871
8872 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8873}
8874
8875impl Monitoring {
8876 pub fn new() -> Self {
8877 std::default::Default::default()
8878 }
8879
8880 /// Sets the value of [producer_destinations][crate::model::Monitoring::producer_destinations].
8881 ///
8882 /// # Example
8883 /// ```ignore,no_run
8884 /// # use google_cloud_api::model::Monitoring;
8885 /// use google_cloud_api::model::monitoring::MonitoringDestination;
8886 /// let x = Monitoring::new()
8887 /// .set_producer_destinations([
8888 /// MonitoringDestination::default()/* use setters */,
8889 /// MonitoringDestination::default()/* use (different) setters */,
8890 /// ]);
8891 /// ```
8892 pub fn set_producer_destinations<T, V>(mut self, v: T) -> Self
8893 where
8894 T: std::iter::IntoIterator<Item = V>,
8895 V: std::convert::Into<crate::model::monitoring::MonitoringDestination>,
8896 {
8897 use std::iter::Iterator;
8898 self.producer_destinations = v.into_iter().map(|i| i.into()).collect();
8899 self
8900 }
8901
8902 /// Sets the value of [consumer_destinations][crate::model::Monitoring::consumer_destinations].
8903 ///
8904 /// # Example
8905 /// ```ignore,no_run
8906 /// # use google_cloud_api::model::Monitoring;
8907 /// use google_cloud_api::model::monitoring::MonitoringDestination;
8908 /// let x = Monitoring::new()
8909 /// .set_consumer_destinations([
8910 /// MonitoringDestination::default()/* use setters */,
8911 /// MonitoringDestination::default()/* use (different) setters */,
8912 /// ]);
8913 /// ```
8914 pub fn set_consumer_destinations<T, V>(mut self, v: T) -> Self
8915 where
8916 T: std::iter::IntoIterator<Item = V>,
8917 V: std::convert::Into<crate::model::monitoring::MonitoringDestination>,
8918 {
8919 use std::iter::Iterator;
8920 self.consumer_destinations = v.into_iter().map(|i| i.into()).collect();
8921 self
8922 }
8923}
8924
8925impl wkt::message::Message for Monitoring {
8926 fn typename() -> &'static str {
8927 "type.googleapis.com/google.api.Monitoring"
8928 }
8929}
8930
8931/// Defines additional types related to [Monitoring].
8932pub mod monitoring {
8933 #[allow(unused_imports)]
8934 use super::*;
8935
8936 /// Configuration of a specific monitoring destination (the producer project
8937 /// or the consumer project).
8938 #[derive(Clone, Default, PartialEq)]
8939 #[non_exhaustive]
8940 pub struct MonitoringDestination {
8941 /// The monitored resource type. The type must be defined in
8942 /// [Service.monitored_resources][google.api.Service.monitored_resources]
8943 /// section.
8944 ///
8945 /// [google.api.Service.monitored_resources]: crate::model::Service::monitored_resources
8946 pub monitored_resource: std::string::String,
8947
8948 /// Types of the metrics to report to this monitoring destination.
8949 /// Each type must be defined in
8950 /// [Service.metrics][google.api.Service.metrics] section.
8951 ///
8952 /// [google.api.Service.metrics]: crate::model::Service::metrics
8953 pub metrics: std::vec::Vec<std::string::String>,
8954
8955 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8956 }
8957
8958 impl MonitoringDestination {
8959 pub fn new() -> Self {
8960 std::default::Default::default()
8961 }
8962
8963 /// Sets the value of [monitored_resource][crate::model::monitoring::MonitoringDestination::monitored_resource].
8964 ///
8965 /// # Example
8966 /// ```ignore,no_run
8967 /// # use google_cloud_api::model::monitoring::MonitoringDestination;
8968 /// let x = MonitoringDestination::new().set_monitored_resource("example");
8969 /// ```
8970 pub fn set_monitored_resource<T: std::convert::Into<std::string::String>>(
8971 mut self,
8972 v: T,
8973 ) -> Self {
8974 self.monitored_resource = v.into();
8975 self
8976 }
8977
8978 /// Sets the value of [metrics][crate::model::monitoring::MonitoringDestination::metrics].
8979 ///
8980 /// # Example
8981 /// ```ignore,no_run
8982 /// # use google_cloud_api::model::monitoring::MonitoringDestination;
8983 /// let x = MonitoringDestination::new().set_metrics(["a", "b", "c"]);
8984 /// ```
8985 pub fn set_metrics<T, V>(mut self, v: T) -> Self
8986 where
8987 T: std::iter::IntoIterator<Item = V>,
8988 V: std::convert::Into<std::string::String>,
8989 {
8990 use std::iter::Iterator;
8991 self.metrics = v.into_iter().map(|i| i.into()).collect();
8992 self
8993 }
8994 }
8995
8996 impl wkt::message::Message for MonitoringDestination {
8997 fn typename() -> &'static str {
8998 "type.googleapis.com/google.api.Monitoring.MonitoringDestination"
8999 }
9000 }
9001}
9002
9003/// Google API Policy Annotation
9004///
9005/// This message defines a simple API policy annotation that can be used to
9006/// annotate API request and response message fields with applicable policies.
9007/// One field may have multiple applicable policies that must all be satisfied
9008/// before a request can be processed. This policy annotation is used to
9009/// generate the overall policy that will be used for automatic runtime
9010/// policy enforcement and documentation generation.
9011#[derive(Clone, Default, PartialEq)]
9012#[non_exhaustive]
9013pub struct FieldPolicy {
9014 /// Selects one or more request or response message fields to apply this
9015 /// `FieldPolicy`.
9016 ///
9017 /// When a `FieldPolicy` is used in proto annotation, the selector must
9018 /// be left as empty. The service config generator will automatically fill
9019 /// the correct value.
9020 ///
9021 /// When a `FieldPolicy` is used in service config, the selector must be a
9022 /// comma-separated string with valid request or response field paths,
9023 /// such as "foo.bar" or "foo.bar,foo.baz".
9024 pub selector: std::string::String,
9025
9026 /// Specifies the required permission(s) for the resource referred to by the
9027 /// field. It requires the field contains a valid resource reference, and
9028 /// the request must pass the permission checks to proceed. For example,
9029 /// "resourcemanager.projects.get".
9030 pub resource_permission: std::string::String,
9031
9032 /// Specifies the resource type for the resource referred to by the field.
9033 pub resource_type: std::string::String,
9034
9035 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9036}
9037
9038impl FieldPolicy {
9039 pub fn new() -> Self {
9040 std::default::Default::default()
9041 }
9042
9043 /// Sets the value of [selector][crate::model::FieldPolicy::selector].
9044 ///
9045 /// # Example
9046 /// ```ignore,no_run
9047 /// # use google_cloud_api::model::FieldPolicy;
9048 /// let x = FieldPolicy::new().set_selector("example");
9049 /// ```
9050 pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9051 self.selector = v.into();
9052 self
9053 }
9054
9055 /// Sets the value of [resource_permission][crate::model::FieldPolicy::resource_permission].
9056 ///
9057 /// # Example
9058 /// ```ignore,no_run
9059 /// # use google_cloud_api::model::FieldPolicy;
9060 /// let x = FieldPolicy::new().set_resource_permission("example");
9061 /// ```
9062 pub fn set_resource_permission<T: std::convert::Into<std::string::String>>(
9063 mut self,
9064 v: T,
9065 ) -> Self {
9066 self.resource_permission = v.into();
9067 self
9068 }
9069
9070 /// Sets the value of [resource_type][crate::model::FieldPolicy::resource_type].
9071 ///
9072 /// # Example
9073 /// ```ignore,no_run
9074 /// # use google_cloud_api::model::FieldPolicy;
9075 /// let x = FieldPolicy::new().set_resource_type("example");
9076 /// ```
9077 pub fn set_resource_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9078 self.resource_type = v.into();
9079 self
9080 }
9081}
9082
9083impl wkt::message::Message for FieldPolicy {
9084 fn typename() -> &'static str {
9085 "type.googleapis.com/google.api.FieldPolicy"
9086 }
9087}
9088
9089/// Defines policies applying to an RPC method.
9090#[derive(Clone, Default, PartialEq)]
9091#[non_exhaustive]
9092pub struct MethodPolicy {
9093 /// Selects a method to which these policies should be enforced, for example,
9094 /// "google.pubsub.v1.Subscriber.CreateSubscription".
9095 ///
9096 /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
9097 /// details.
9098 ///
9099 /// NOTE: This field must not be set in the proto annotation. It will be
9100 /// automatically filled by the service config compiler .
9101 ///
9102 /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
9103 pub selector: std::string::String,
9104
9105 /// Policies that are applicable to the request message.
9106 pub request_policies: std::vec::Vec<crate::model::FieldPolicy>,
9107
9108 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9109}
9110
9111impl MethodPolicy {
9112 pub fn new() -> Self {
9113 std::default::Default::default()
9114 }
9115
9116 /// Sets the value of [selector][crate::model::MethodPolicy::selector].
9117 ///
9118 /// # Example
9119 /// ```ignore,no_run
9120 /// # use google_cloud_api::model::MethodPolicy;
9121 /// let x = MethodPolicy::new().set_selector("example");
9122 /// ```
9123 pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9124 self.selector = v.into();
9125 self
9126 }
9127
9128 /// Sets the value of [request_policies][crate::model::MethodPolicy::request_policies].
9129 ///
9130 /// # Example
9131 /// ```ignore,no_run
9132 /// # use google_cloud_api::model::MethodPolicy;
9133 /// use google_cloud_api::model::FieldPolicy;
9134 /// let x = MethodPolicy::new()
9135 /// .set_request_policies([
9136 /// FieldPolicy::default()/* use setters */,
9137 /// FieldPolicy::default()/* use (different) setters */,
9138 /// ]);
9139 /// ```
9140 pub fn set_request_policies<T, V>(mut self, v: T) -> Self
9141 where
9142 T: std::iter::IntoIterator<Item = V>,
9143 V: std::convert::Into<crate::model::FieldPolicy>,
9144 {
9145 use std::iter::Iterator;
9146 self.request_policies = v.into_iter().map(|i| i.into()).collect();
9147 self
9148 }
9149}
9150
9151impl wkt::message::Message for MethodPolicy {
9152 fn typename() -> &'static str {
9153 "type.googleapis.com/google.api.MethodPolicy"
9154 }
9155}
9156
9157/// Quota configuration helps to achieve fairness and budgeting in service
9158/// usage.
9159///
9160/// The metric based quota configuration works this way:
9161///
9162/// - The service configuration defines a set of metrics.
9163/// - For API calls, the quota.metric_rules maps methods to metrics with
9164/// corresponding costs.
9165/// - The quota.limits defines limits on the metrics, which will be used for
9166/// quota checks at runtime.
9167///
9168/// An example quota configuration in yaml format:
9169///
9170/// quota:
9171/// limits:
9172///
9173/// ```norust
9174/// - name: apiWriteQpsPerProject
9175/// metric: library.googleapis.com/write_calls
9176/// unit: "1/min/{project}" # rate limit for consumer projects
9177/// values:
9178/// STANDARD: 10000
9179///
9180///
9181/// (The metric rules bind all methods to the read_calls metric,
9182/// except for the UpdateBook and DeleteBook methods. These two methods
9183/// are mapped to the write_calls metric, with the UpdateBook method
9184/// consuming at twice rate as the DeleteBook method.)
9185/// metric_rules:
9186/// - selector: "*"
9187/// metric_costs:
9188/// library.googleapis.com/read_calls: 1
9189/// - selector: google.example.library.v1.LibraryService.UpdateBook
9190/// metric_costs:
9191/// library.googleapis.com/write_calls: 2
9192/// - selector: google.example.library.v1.LibraryService.DeleteBook
9193/// metric_costs:
9194/// library.googleapis.com/write_calls: 1
9195/// ```
9196///
9197/// Corresponding Metric definition:
9198///
9199/// ```norust
9200/// metrics:
9201/// - name: library.googleapis.com/read_calls
9202/// display_name: Read requests
9203/// metric_kind: DELTA
9204/// value_type: INT64
9205///
9206/// - name: library.googleapis.com/write_calls
9207/// display_name: Write requests
9208/// metric_kind: DELTA
9209/// value_type: INT64
9210/// ```
9211#[derive(Clone, Default, PartialEq)]
9212#[non_exhaustive]
9213pub struct Quota {
9214 /// List of QuotaLimit definitions for the service.
9215 pub limits: std::vec::Vec<crate::model::QuotaLimit>,
9216
9217 /// List of MetricRule definitions, each one mapping a selected method to one
9218 /// or more metrics.
9219 pub metric_rules: std::vec::Vec<crate::model::MetricRule>,
9220
9221 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9222}
9223
9224impl Quota {
9225 pub fn new() -> Self {
9226 std::default::Default::default()
9227 }
9228
9229 /// Sets the value of [limits][crate::model::Quota::limits].
9230 ///
9231 /// # Example
9232 /// ```ignore,no_run
9233 /// # use google_cloud_api::model::Quota;
9234 /// use google_cloud_api::model::QuotaLimit;
9235 /// let x = Quota::new()
9236 /// .set_limits([
9237 /// QuotaLimit::default()/* use setters */,
9238 /// QuotaLimit::default()/* use (different) setters */,
9239 /// ]);
9240 /// ```
9241 pub fn set_limits<T, V>(mut self, v: T) -> Self
9242 where
9243 T: std::iter::IntoIterator<Item = V>,
9244 V: std::convert::Into<crate::model::QuotaLimit>,
9245 {
9246 use std::iter::Iterator;
9247 self.limits = v.into_iter().map(|i| i.into()).collect();
9248 self
9249 }
9250
9251 /// Sets the value of [metric_rules][crate::model::Quota::metric_rules].
9252 ///
9253 /// # Example
9254 /// ```ignore,no_run
9255 /// # use google_cloud_api::model::Quota;
9256 /// use google_cloud_api::model::MetricRule;
9257 /// let x = Quota::new()
9258 /// .set_metric_rules([
9259 /// MetricRule::default()/* use setters */,
9260 /// MetricRule::default()/* use (different) setters */,
9261 /// ]);
9262 /// ```
9263 pub fn set_metric_rules<T, V>(mut self, v: T) -> Self
9264 where
9265 T: std::iter::IntoIterator<Item = V>,
9266 V: std::convert::Into<crate::model::MetricRule>,
9267 {
9268 use std::iter::Iterator;
9269 self.metric_rules = v.into_iter().map(|i| i.into()).collect();
9270 self
9271 }
9272}
9273
9274impl wkt::message::Message for Quota {
9275 fn typename() -> &'static str {
9276 "type.googleapis.com/google.api.Quota"
9277 }
9278}
9279
9280/// Bind API methods to metrics. Binding a method to a metric causes that
9281/// metric's configured quota behaviors to apply to the method call.
9282#[derive(Clone, Default, PartialEq)]
9283#[non_exhaustive]
9284pub struct MetricRule {
9285 /// Selects the methods to which this rule applies.
9286 ///
9287 /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
9288 /// details.
9289 ///
9290 /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
9291 pub selector: std::string::String,
9292
9293 /// Metrics to update when the selected methods are called, and the associated
9294 /// cost applied to each metric.
9295 ///
9296 /// The key of the map is the metric name, and the values are the amount
9297 /// increased for the metric against which the quota limits are defined.
9298 /// The value must not be negative.
9299 pub metric_costs: std::collections::HashMap<std::string::String, i64>,
9300
9301 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9302}
9303
9304impl MetricRule {
9305 pub fn new() -> Self {
9306 std::default::Default::default()
9307 }
9308
9309 /// Sets the value of [selector][crate::model::MetricRule::selector].
9310 ///
9311 /// # Example
9312 /// ```ignore,no_run
9313 /// # use google_cloud_api::model::MetricRule;
9314 /// let x = MetricRule::new().set_selector("example");
9315 /// ```
9316 pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9317 self.selector = v.into();
9318 self
9319 }
9320
9321 /// Sets the value of [metric_costs][crate::model::MetricRule::metric_costs].
9322 ///
9323 /// # Example
9324 /// ```ignore,no_run
9325 /// # use google_cloud_api::model::MetricRule;
9326 /// let x = MetricRule::new().set_metric_costs([
9327 /// ("key0", 123),
9328 /// ("key1", 456),
9329 /// ]);
9330 /// ```
9331 pub fn set_metric_costs<T, K, V>(mut self, v: T) -> Self
9332 where
9333 T: std::iter::IntoIterator<Item = (K, V)>,
9334 K: std::convert::Into<std::string::String>,
9335 V: std::convert::Into<i64>,
9336 {
9337 use std::iter::Iterator;
9338 self.metric_costs = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9339 self
9340 }
9341}
9342
9343impl wkt::message::Message for MetricRule {
9344 fn typename() -> &'static str {
9345 "type.googleapis.com/google.api.MetricRule"
9346 }
9347}
9348
9349/// `QuotaLimit` defines a specific limit that applies over a specified duration
9350/// for a limit type. There can be at most one limit for a duration and limit
9351/// type combination defined within a `QuotaGroup`.
9352#[derive(Clone, Default, PartialEq)]
9353#[non_exhaustive]
9354pub struct QuotaLimit {
9355 /// Name of the quota limit.
9356 ///
9357 /// The name must be provided, and it must be unique within the service. The
9358 /// name can only include alphanumeric characters as well as '-'.
9359 ///
9360 /// The maximum length of the limit name is 64 characters.
9361 pub name: std::string::String,
9362
9363 /// Optional. User-visible, extended description for this quota limit.
9364 /// Should be used only when more context is needed to understand this limit
9365 /// than provided by the limit's display name (see: `display_name`).
9366 pub description: std::string::String,
9367
9368 /// Default number of tokens that can be consumed during the specified
9369 /// duration. This is the number of tokens assigned when a client
9370 /// application developer activates the service for his/her project.
9371 ///
9372 /// Specifying a value of 0 will block all requests. This can be used if you
9373 /// are provisioning quota to selected consumers and blocking others.
9374 /// Similarly, a value of -1 will indicate an unlimited quota. No other
9375 /// negative values are allowed.
9376 ///
9377 /// Used by group-based quotas only.
9378 pub default_limit: i64,
9379
9380 /// Maximum number of tokens that can be consumed during the specified
9381 /// duration. Client application developers can override the default limit up
9382 /// to this maximum. If specified, this value cannot be set to a value less
9383 /// than the default limit. If not specified, it is set to the default limit.
9384 ///
9385 /// To allow clients to apply overrides with no upper bound, set this to -1,
9386 /// indicating unlimited maximum quota.
9387 ///
9388 /// Used by group-based quotas only.
9389 pub max_limit: i64,
9390
9391 /// Free tier value displayed in the Developers Console for this limit.
9392 /// The free tier is the number of tokens that will be subtracted from the
9393 /// billed amount when billing is enabled.
9394 /// This field can only be set on a limit with duration "1d", in a billable
9395 /// group; it is invalid on any other limit. If this field is not set, it
9396 /// defaults to 0, indicating that there is no free tier for this service.
9397 ///
9398 /// Used by group-based quotas only.
9399 pub free_tier: i64,
9400
9401 /// Duration of this limit in textual notation. Must be "100s" or "1d".
9402 ///
9403 /// Used by group-based quotas only.
9404 pub duration: std::string::String,
9405
9406 /// The name of the metric this quota limit applies to. The quota limits with
9407 /// the same metric will be checked together during runtime. The metric must be
9408 /// defined within the service config.
9409 pub metric: std::string::String,
9410
9411 /// Specify the unit of the quota limit. It uses the same syntax as
9412 /// [MetricDescriptor.unit][google.api.MetricDescriptor.unit]. The supported
9413 /// unit kinds are determined by the quota backend system.
9414 ///
9415 /// Here are some examples:
9416 ///
9417 /// * "1/min/{project}" for quota per minute per project.
9418 ///
9419 /// Note: the order of unit components is insignificant.
9420 /// The "1" at the beginning is required to follow the metric unit syntax.
9421 ///
9422 /// [google.api.MetricDescriptor.unit]: crate::model::MetricDescriptor::unit
9423 pub unit: std::string::String,
9424
9425 /// Tiered limit values. You must specify this as a key:value pair, with an
9426 /// integer value that is the maximum number of requests allowed for the
9427 /// specified unit. Currently only STANDARD is supported.
9428 pub values: std::collections::HashMap<std::string::String, i64>,
9429
9430 /// User-visible display name for this limit.
9431 /// Optional. If not set, the UI will provide a default display name based on
9432 /// the quota configuration. This field can be used to override the default
9433 /// display name generated from the configuration.
9434 pub display_name: std::string::String,
9435
9436 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9437}
9438
9439impl QuotaLimit {
9440 pub fn new() -> Self {
9441 std::default::Default::default()
9442 }
9443
9444 /// Sets the value of [name][crate::model::QuotaLimit::name].
9445 ///
9446 /// # Example
9447 /// ```ignore,no_run
9448 /// # use google_cloud_api::model::QuotaLimit;
9449 /// let x = QuotaLimit::new().set_name("example");
9450 /// ```
9451 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9452 self.name = v.into();
9453 self
9454 }
9455
9456 /// Sets the value of [description][crate::model::QuotaLimit::description].
9457 ///
9458 /// # Example
9459 /// ```ignore,no_run
9460 /// # use google_cloud_api::model::QuotaLimit;
9461 /// let x = QuotaLimit::new().set_description("example");
9462 /// ```
9463 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9464 self.description = v.into();
9465 self
9466 }
9467
9468 /// Sets the value of [default_limit][crate::model::QuotaLimit::default_limit].
9469 ///
9470 /// # Example
9471 /// ```ignore,no_run
9472 /// # use google_cloud_api::model::QuotaLimit;
9473 /// let x = QuotaLimit::new().set_default_limit(42);
9474 /// ```
9475 pub fn set_default_limit<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
9476 self.default_limit = v.into();
9477 self
9478 }
9479
9480 /// Sets the value of [max_limit][crate::model::QuotaLimit::max_limit].
9481 ///
9482 /// # Example
9483 /// ```ignore,no_run
9484 /// # use google_cloud_api::model::QuotaLimit;
9485 /// let x = QuotaLimit::new().set_max_limit(42);
9486 /// ```
9487 pub fn set_max_limit<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
9488 self.max_limit = v.into();
9489 self
9490 }
9491
9492 /// Sets the value of [free_tier][crate::model::QuotaLimit::free_tier].
9493 ///
9494 /// # Example
9495 /// ```ignore,no_run
9496 /// # use google_cloud_api::model::QuotaLimit;
9497 /// let x = QuotaLimit::new().set_free_tier(42);
9498 /// ```
9499 pub fn set_free_tier<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
9500 self.free_tier = v.into();
9501 self
9502 }
9503
9504 /// Sets the value of [duration][crate::model::QuotaLimit::duration].
9505 ///
9506 /// # Example
9507 /// ```ignore,no_run
9508 /// # use google_cloud_api::model::QuotaLimit;
9509 /// let x = QuotaLimit::new().set_duration("example");
9510 /// ```
9511 pub fn set_duration<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9512 self.duration = v.into();
9513 self
9514 }
9515
9516 /// Sets the value of [metric][crate::model::QuotaLimit::metric].
9517 ///
9518 /// # Example
9519 /// ```ignore,no_run
9520 /// # use google_cloud_api::model::QuotaLimit;
9521 /// let x = QuotaLimit::new().set_metric("example");
9522 /// ```
9523 pub fn set_metric<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9524 self.metric = v.into();
9525 self
9526 }
9527
9528 /// Sets the value of [unit][crate::model::QuotaLimit::unit].
9529 ///
9530 /// # Example
9531 /// ```ignore,no_run
9532 /// # use google_cloud_api::model::QuotaLimit;
9533 /// let x = QuotaLimit::new().set_unit("example");
9534 /// ```
9535 pub fn set_unit<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9536 self.unit = v.into();
9537 self
9538 }
9539
9540 /// Sets the value of [values][crate::model::QuotaLimit::values].
9541 ///
9542 /// # Example
9543 /// ```ignore,no_run
9544 /// # use google_cloud_api::model::QuotaLimit;
9545 /// let x = QuotaLimit::new().set_values([
9546 /// ("key0", 123),
9547 /// ("key1", 456),
9548 /// ]);
9549 /// ```
9550 pub fn set_values<T, K, V>(mut self, v: T) -> Self
9551 where
9552 T: std::iter::IntoIterator<Item = (K, V)>,
9553 K: std::convert::Into<std::string::String>,
9554 V: std::convert::Into<i64>,
9555 {
9556 use std::iter::Iterator;
9557 self.values = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9558 self
9559 }
9560
9561 /// Sets the value of [display_name][crate::model::QuotaLimit::display_name].
9562 ///
9563 /// # Example
9564 /// ```ignore,no_run
9565 /// # use google_cloud_api::model::QuotaLimit;
9566 /// let x = QuotaLimit::new().set_display_name("example");
9567 /// ```
9568 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9569 self.display_name = v.into();
9570 self
9571 }
9572}
9573
9574impl wkt::message::Message for QuotaLimit {
9575 fn typename() -> &'static str {
9576 "type.googleapis.com/google.api.QuotaLimit"
9577 }
9578}
9579
9580/// A simple descriptor of a resource type.
9581///
9582/// ResourceDescriptor annotates a resource message (either by means of a
9583/// protobuf annotation or use in the service config), and associates the
9584/// resource's schema, the resource type, and the pattern of the resource name.
9585///
9586/// Example:
9587///
9588/// ```norust
9589/// message Topic {
9590/// // Indicates this message defines a resource schema.
9591/// // Declares the resource type in the format of {service}/{kind}.
9592/// // For Kubernetes resources, the format is {api group}/{kind}.
9593/// option (google.api.resource) = {
9594/// type: "pubsub.googleapis.com/Topic"
9595/// pattern: "projects/{project}/topics/{topic}"
9596/// };
9597/// }
9598/// ```
9599///
9600/// The ResourceDescriptor Yaml config will look like:
9601///
9602/// ```norust
9603/// resources:
9604/// - type: "pubsub.googleapis.com/Topic"
9605/// pattern: "projects/{project}/topics/{topic}"
9606/// ```
9607///
9608/// Sometimes, resources have multiple patterns, typically because they can
9609/// live under multiple parents.
9610///
9611/// Example:
9612///
9613/// ```norust
9614/// message LogEntry {
9615/// option (google.api.resource) = {
9616/// type: "logging.googleapis.com/LogEntry"
9617/// pattern: "projects/{project}/logs/{log}"
9618/// pattern: "folders/{folder}/logs/{log}"
9619/// pattern: "organizations/{organization}/logs/{log}"
9620/// pattern: "billingAccounts/{billing_account}/logs/{log}"
9621/// };
9622/// }
9623/// ```
9624///
9625/// The ResourceDescriptor Yaml config will look like:
9626///
9627/// ```norust
9628/// resources:
9629/// - type: 'logging.googleapis.com/LogEntry'
9630/// pattern: "projects/{project}/logs/{log}"
9631/// pattern: "folders/{folder}/logs/{log}"
9632/// pattern: "organizations/{organization}/logs/{log}"
9633/// pattern: "billingAccounts/{billing_account}/logs/{log}"
9634/// ```
9635#[derive(Clone, Default, PartialEq)]
9636#[non_exhaustive]
9637pub struct ResourceDescriptor {
9638 /// The resource type. It must be in the format of
9639 /// {service_name}/{resource_type_kind}. The `resource_type_kind` must be
9640 /// singular and must not include version numbers.
9641 ///
9642 /// Example: `storage.googleapis.com/Bucket`
9643 ///
9644 /// The value of the resource_type_kind must follow the regular expression
9645 /// /[A-Za-z][a-zA-Z0-9]+/. It should start with an upper case character and
9646 /// should use PascalCase (UpperCamelCase). The maximum number of
9647 /// characters allowed for the `resource_type_kind` is 100.
9648 pub r#type: std::string::String,
9649
9650 /// Optional. The relative resource name pattern associated with this resource
9651 /// type. The DNS prefix of the full resource name shouldn't be specified here.
9652 ///
9653 /// The path pattern must follow the syntax, which aligns with HTTP binding
9654 /// syntax:
9655 ///
9656 /// ```norust
9657 /// Template = Segment { "/" Segment } ;
9658 /// Segment = LITERAL | Variable ;
9659 /// Variable = "{" LITERAL "}" ;
9660 /// ```
9661 ///
9662 /// Examples:
9663 ///
9664 /// ```norust
9665 /// - "projects/{project}/topics/{topic}"
9666 /// - "projects/{project}/knowledgeBases/{knowledge_base}"
9667 /// ```
9668 ///
9669 /// The components in braces correspond to the IDs for each resource in the
9670 /// hierarchy. It is expected that, if multiple patterns are provided,
9671 /// the same component name (e.g. "project") refers to IDs of the same
9672 /// type of resource.
9673 pub pattern: std::vec::Vec<std::string::String>,
9674
9675 /// Optional. The field on the resource that designates the resource name
9676 /// field. If omitted, this is assumed to be "name".
9677 pub name_field: std::string::String,
9678
9679 /// Optional. The historical or future-looking state of the resource pattern.
9680 ///
9681 /// Example:
9682 ///
9683 /// ```norust
9684 /// // The InspectTemplate message originally only supported resource
9685 /// // names with organization, and project was added later.
9686 /// message InspectTemplate {
9687 /// option (google.api.resource) = {
9688 /// type: "dlp.googleapis.com/InspectTemplate"
9689 /// pattern:
9690 /// "organizations/{organization}/inspectTemplates/{inspect_template}"
9691 /// pattern: "projects/{project}/inspectTemplates/{inspect_template}"
9692 /// history: ORIGINALLY_SINGLE_PATTERN
9693 /// };
9694 /// }
9695 /// ```
9696 pub history: crate::model::resource_descriptor::History,
9697
9698 /// The plural name used in the resource name and permission names, such as
9699 /// 'projects' for the resource name of 'projects/{project}' and the permission
9700 /// name of 'cloudresourcemanager.googleapis.com/projects.get'. One exception
9701 /// to this is for Nested Collections that have stuttering names, as defined
9702 /// in [AIP-122](https://google.aip.dev/122#nested-collections), where the
9703 /// collection ID in the resource name pattern does not necessarily directly
9704 /// match the `plural` value.
9705 ///
9706 /// It is the same concept of the `plural` field in k8s CRD spec
9707 /// <https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/>
9708 ///
9709 /// Note: The plural form is required even for singleton resources. See
9710 /// <https://aip.dev/156>
9711 pub plural: std::string::String,
9712
9713 /// The same concept of the `singular` field in k8s CRD spec
9714 /// <https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/>
9715 /// Such as "project" for the `resourcemanager.googleapis.com/Project` type.
9716 pub singular: std::string::String,
9717
9718 /// Style flag(s) for this resource.
9719 /// These indicate that a resource is expected to conform to a given
9720 /// style. See the specific style flags for additional information.
9721 pub style: std::vec::Vec<crate::model::resource_descriptor::Style>,
9722
9723 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9724}
9725
9726impl ResourceDescriptor {
9727 pub fn new() -> Self {
9728 std::default::Default::default()
9729 }
9730
9731 /// Sets the value of [r#type][crate::model::ResourceDescriptor::type].
9732 ///
9733 /// # Example
9734 /// ```ignore,no_run
9735 /// # use google_cloud_api::model::ResourceDescriptor;
9736 /// let x = ResourceDescriptor::new().set_type("example");
9737 /// ```
9738 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9739 self.r#type = v.into();
9740 self
9741 }
9742
9743 /// Sets the value of [pattern][crate::model::ResourceDescriptor::pattern].
9744 ///
9745 /// # Example
9746 /// ```ignore,no_run
9747 /// # use google_cloud_api::model::ResourceDescriptor;
9748 /// let x = ResourceDescriptor::new().set_pattern(["a", "b", "c"]);
9749 /// ```
9750 pub fn set_pattern<T, V>(mut self, v: T) -> Self
9751 where
9752 T: std::iter::IntoIterator<Item = V>,
9753 V: std::convert::Into<std::string::String>,
9754 {
9755 use std::iter::Iterator;
9756 self.pattern = v.into_iter().map(|i| i.into()).collect();
9757 self
9758 }
9759
9760 /// Sets the value of [name_field][crate::model::ResourceDescriptor::name_field].
9761 ///
9762 /// # Example
9763 /// ```ignore,no_run
9764 /// # use google_cloud_api::model::ResourceDescriptor;
9765 /// let x = ResourceDescriptor::new().set_name_field("example");
9766 /// ```
9767 pub fn set_name_field<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9768 self.name_field = v.into();
9769 self
9770 }
9771
9772 /// Sets the value of [history][crate::model::ResourceDescriptor::history].
9773 ///
9774 /// # Example
9775 /// ```ignore,no_run
9776 /// # use google_cloud_api::model::ResourceDescriptor;
9777 /// use google_cloud_api::model::resource_descriptor::History;
9778 /// let x0 = ResourceDescriptor::new().set_history(History::OriginallySinglePattern);
9779 /// let x1 = ResourceDescriptor::new().set_history(History::FutureMultiPattern);
9780 /// ```
9781 pub fn set_history<T: std::convert::Into<crate::model::resource_descriptor::History>>(
9782 mut self,
9783 v: T,
9784 ) -> Self {
9785 self.history = v.into();
9786 self
9787 }
9788
9789 /// Sets the value of [plural][crate::model::ResourceDescriptor::plural].
9790 ///
9791 /// # Example
9792 /// ```ignore,no_run
9793 /// # use google_cloud_api::model::ResourceDescriptor;
9794 /// let x = ResourceDescriptor::new().set_plural("example");
9795 /// ```
9796 pub fn set_plural<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9797 self.plural = v.into();
9798 self
9799 }
9800
9801 /// Sets the value of [singular][crate::model::ResourceDescriptor::singular].
9802 ///
9803 /// # Example
9804 /// ```ignore,no_run
9805 /// # use google_cloud_api::model::ResourceDescriptor;
9806 /// let x = ResourceDescriptor::new().set_singular("example");
9807 /// ```
9808 pub fn set_singular<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9809 self.singular = v.into();
9810 self
9811 }
9812
9813 /// Sets the value of [style][crate::model::ResourceDescriptor::style].
9814 ///
9815 /// # Example
9816 /// ```ignore,no_run
9817 /// # use google_cloud_api::model::ResourceDescriptor;
9818 /// use google_cloud_api::model::resource_descriptor::Style;
9819 /// let x = ResourceDescriptor::new().set_style([
9820 /// Style::DeclarativeFriendly,
9821 /// ]);
9822 /// ```
9823 pub fn set_style<T, V>(mut self, v: T) -> Self
9824 where
9825 T: std::iter::IntoIterator<Item = V>,
9826 V: std::convert::Into<crate::model::resource_descriptor::Style>,
9827 {
9828 use std::iter::Iterator;
9829 self.style = v.into_iter().map(|i| i.into()).collect();
9830 self
9831 }
9832}
9833
9834impl wkt::message::Message for ResourceDescriptor {
9835 fn typename() -> &'static str {
9836 "type.googleapis.com/google.api.ResourceDescriptor"
9837 }
9838}
9839
9840/// Defines additional types related to [ResourceDescriptor].
9841pub mod resource_descriptor {
9842 #[allow(unused_imports)]
9843 use super::*;
9844
9845 /// A description of the historical or future-looking state of the
9846 /// resource pattern.
9847 ///
9848 /// # Working with unknown values
9849 ///
9850 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9851 /// additional enum variants at any time. Adding new variants is not considered
9852 /// a breaking change. Applications should write their code in anticipation of:
9853 ///
9854 /// - New values appearing in future releases of the client library, **and**
9855 /// - New values received dynamically, without application changes.
9856 ///
9857 /// Please consult the [Working with enums] section in the user guide for some
9858 /// guidelines.
9859 ///
9860 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
9861 #[derive(Clone, Debug, PartialEq)]
9862 #[non_exhaustive]
9863 pub enum History {
9864 /// The "unset" value.
9865 Unspecified,
9866 /// The resource originally had one pattern and launched as such, and
9867 /// additional patterns were added later.
9868 OriginallySinglePattern,
9869 /// The resource has one pattern, but the API owner expects to add more
9870 /// later. (This is the inverse of ORIGINALLY_SINGLE_PATTERN, and prevents
9871 /// that from being necessary once there are multiple patterns.)
9872 FutureMultiPattern,
9873 /// If set, the enum was initialized with an unknown value.
9874 ///
9875 /// Applications can examine the value using [History::value] or
9876 /// [History::name].
9877 UnknownValue(history::UnknownValue),
9878 }
9879
9880 #[doc(hidden)]
9881 pub mod history {
9882 #[allow(unused_imports)]
9883 use super::*;
9884 #[derive(Clone, Debug, PartialEq)]
9885 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9886 }
9887
9888 impl History {
9889 /// Gets the enum value.
9890 ///
9891 /// Returns `None` if the enum contains an unknown value deserialized from
9892 /// the string representation of enums.
9893 pub fn value(&self) -> std::option::Option<i32> {
9894 match self {
9895 Self::Unspecified => std::option::Option::Some(0),
9896 Self::OriginallySinglePattern => std::option::Option::Some(1),
9897 Self::FutureMultiPattern => std::option::Option::Some(2),
9898 Self::UnknownValue(u) => u.0.value(),
9899 }
9900 }
9901
9902 /// Gets the enum value as a string.
9903 ///
9904 /// Returns `None` if the enum contains an unknown value deserialized from
9905 /// the integer representation of enums.
9906 pub fn name(&self) -> std::option::Option<&str> {
9907 match self {
9908 Self::Unspecified => std::option::Option::Some("HISTORY_UNSPECIFIED"),
9909 Self::OriginallySinglePattern => {
9910 std::option::Option::Some("ORIGINALLY_SINGLE_PATTERN")
9911 }
9912 Self::FutureMultiPattern => std::option::Option::Some("FUTURE_MULTI_PATTERN"),
9913 Self::UnknownValue(u) => u.0.name(),
9914 }
9915 }
9916 }
9917
9918 impl std::default::Default for History {
9919 fn default() -> Self {
9920 use std::convert::From;
9921 Self::from(0)
9922 }
9923 }
9924
9925 impl std::fmt::Display for History {
9926 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9927 wkt::internal::display_enum(f, self.name(), self.value())
9928 }
9929 }
9930
9931 impl std::convert::From<i32> for History {
9932 fn from(value: i32) -> Self {
9933 match value {
9934 0 => Self::Unspecified,
9935 1 => Self::OriginallySinglePattern,
9936 2 => Self::FutureMultiPattern,
9937 _ => Self::UnknownValue(history::UnknownValue(
9938 wkt::internal::UnknownEnumValue::Integer(value),
9939 )),
9940 }
9941 }
9942 }
9943
9944 impl std::convert::From<&str> for History {
9945 fn from(value: &str) -> Self {
9946 use std::string::ToString;
9947 match value {
9948 "HISTORY_UNSPECIFIED" => Self::Unspecified,
9949 "ORIGINALLY_SINGLE_PATTERN" => Self::OriginallySinglePattern,
9950 "FUTURE_MULTI_PATTERN" => Self::FutureMultiPattern,
9951 _ => Self::UnknownValue(history::UnknownValue(
9952 wkt::internal::UnknownEnumValue::String(value.to_string()),
9953 )),
9954 }
9955 }
9956 }
9957
9958 impl serde::ser::Serialize for History {
9959 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9960 where
9961 S: serde::Serializer,
9962 {
9963 match self {
9964 Self::Unspecified => serializer.serialize_i32(0),
9965 Self::OriginallySinglePattern => serializer.serialize_i32(1),
9966 Self::FutureMultiPattern => serializer.serialize_i32(2),
9967 Self::UnknownValue(u) => u.0.serialize(serializer),
9968 }
9969 }
9970 }
9971
9972 impl<'de> serde::de::Deserialize<'de> for History {
9973 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9974 where
9975 D: serde::Deserializer<'de>,
9976 {
9977 deserializer.deserialize_any(wkt::internal::EnumVisitor::<History>::new(
9978 ".google.api.ResourceDescriptor.History",
9979 ))
9980 }
9981 }
9982
9983 /// A flag representing a specific style that a resource claims to conform to.
9984 ///
9985 /// # Working with unknown values
9986 ///
9987 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9988 /// additional enum variants at any time. Adding new variants is not considered
9989 /// a breaking change. Applications should write their code in anticipation of:
9990 ///
9991 /// - New values appearing in future releases of the client library, **and**
9992 /// - New values received dynamically, without application changes.
9993 ///
9994 /// Please consult the [Working with enums] section in the user guide for some
9995 /// guidelines.
9996 ///
9997 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
9998 #[derive(Clone, Debug, PartialEq)]
9999 #[non_exhaustive]
10000 pub enum Style {
10001 /// The unspecified value. Do not use.
10002 Unspecified,
10003 /// This resource is intended to be "declarative-friendly".
10004 ///
10005 /// Declarative-friendly resources must be more strictly consistent, and
10006 /// setting this to true communicates to tools that this resource should
10007 /// adhere to declarative-friendly expectations.
10008 ///
10009 /// Note: This is used by the API linter (linter.aip.dev) to enable
10010 /// additional checks.
10011 DeclarativeFriendly,
10012 /// If set, the enum was initialized with an unknown value.
10013 ///
10014 /// Applications can examine the value using [Style::value] or
10015 /// [Style::name].
10016 UnknownValue(style::UnknownValue),
10017 }
10018
10019 #[doc(hidden)]
10020 pub mod style {
10021 #[allow(unused_imports)]
10022 use super::*;
10023 #[derive(Clone, Debug, PartialEq)]
10024 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10025 }
10026
10027 impl Style {
10028 /// Gets the enum value.
10029 ///
10030 /// Returns `None` if the enum contains an unknown value deserialized from
10031 /// the string representation of enums.
10032 pub fn value(&self) -> std::option::Option<i32> {
10033 match self {
10034 Self::Unspecified => std::option::Option::Some(0),
10035 Self::DeclarativeFriendly => std::option::Option::Some(1),
10036 Self::UnknownValue(u) => u.0.value(),
10037 }
10038 }
10039
10040 /// Gets the enum value as a string.
10041 ///
10042 /// Returns `None` if the enum contains an unknown value deserialized from
10043 /// the integer representation of enums.
10044 pub fn name(&self) -> std::option::Option<&str> {
10045 match self {
10046 Self::Unspecified => std::option::Option::Some("STYLE_UNSPECIFIED"),
10047 Self::DeclarativeFriendly => std::option::Option::Some("DECLARATIVE_FRIENDLY"),
10048 Self::UnknownValue(u) => u.0.name(),
10049 }
10050 }
10051 }
10052
10053 impl std::default::Default for Style {
10054 fn default() -> Self {
10055 use std::convert::From;
10056 Self::from(0)
10057 }
10058 }
10059
10060 impl std::fmt::Display for Style {
10061 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10062 wkt::internal::display_enum(f, self.name(), self.value())
10063 }
10064 }
10065
10066 impl std::convert::From<i32> for Style {
10067 fn from(value: i32) -> Self {
10068 match value {
10069 0 => Self::Unspecified,
10070 1 => Self::DeclarativeFriendly,
10071 _ => Self::UnknownValue(style::UnknownValue(
10072 wkt::internal::UnknownEnumValue::Integer(value),
10073 )),
10074 }
10075 }
10076 }
10077
10078 impl std::convert::From<&str> for Style {
10079 fn from(value: &str) -> Self {
10080 use std::string::ToString;
10081 match value {
10082 "STYLE_UNSPECIFIED" => Self::Unspecified,
10083 "DECLARATIVE_FRIENDLY" => Self::DeclarativeFriendly,
10084 _ => Self::UnknownValue(style::UnknownValue(
10085 wkt::internal::UnknownEnumValue::String(value.to_string()),
10086 )),
10087 }
10088 }
10089 }
10090
10091 impl serde::ser::Serialize for Style {
10092 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10093 where
10094 S: serde::Serializer,
10095 {
10096 match self {
10097 Self::Unspecified => serializer.serialize_i32(0),
10098 Self::DeclarativeFriendly => serializer.serialize_i32(1),
10099 Self::UnknownValue(u) => u.0.serialize(serializer),
10100 }
10101 }
10102 }
10103
10104 impl<'de> serde::de::Deserialize<'de> for Style {
10105 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10106 where
10107 D: serde::Deserializer<'de>,
10108 {
10109 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Style>::new(
10110 ".google.api.ResourceDescriptor.Style",
10111 ))
10112 }
10113 }
10114}
10115
10116/// Defines a proto annotation that describes a string field that refers to
10117/// an API resource.
10118#[derive(Clone, Default, PartialEq)]
10119#[non_exhaustive]
10120pub struct ResourceReference {
10121 /// The resource type that the annotated field references.
10122 ///
10123 /// Example:
10124 ///
10125 /// ```norust
10126 /// message Subscription {
10127 /// string topic = 2 [(google.api.resource_reference) = {
10128 /// type: "pubsub.googleapis.com/Topic"
10129 /// }];
10130 /// }
10131 /// ```
10132 ///
10133 /// Occasionally, a field may reference an arbitrary resource. In this case,
10134 /// APIs use the special value * in their resource reference.
10135 ///
10136 /// Example:
10137 ///
10138 /// ```norust
10139 /// message GetIamPolicyRequest {
10140 /// string resource = 2 [(google.api.resource_reference) = {
10141 /// type: "*"
10142 /// }];
10143 /// }
10144 /// ```
10145 pub r#type: std::string::String,
10146
10147 /// The resource type of a child collection that the annotated field
10148 /// references. This is useful for annotating the `parent` field that
10149 /// doesn't have a fixed resource type.
10150 ///
10151 /// Example:
10152 ///
10153 /// ```norust
10154 /// message ListLogEntriesRequest {
10155 /// string parent = 1 [(google.api.resource_reference) = {
10156 /// child_type: "logging.googleapis.com/LogEntry"
10157 /// };
10158 /// }
10159 /// ```
10160 pub child_type: std::string::String,
10161
10162 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10163}
10164
10165impl ResourceReference {
10166 pub fn new() -> Self {
10167 std::default::Default::default()
10168 }
10169
10170 /// Sets the value of [r#type][crate::model::ResourceReference::type].
10171 ///
10172 /// # Example
10173 /// ```ignore,no_run
10174 /// # use google_cloud_api::model::ResourceReference;
10175 /// let x = ResourceReference::new().set_type("example");
10176 /// ```
10177 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10178 self.r#type = v.into();
10179 self
10180 }
10181
10182 /// Sets the value of [child_type][crate::model::ResourceReference::child_type].
10183 ///
10184 /// # Example
10185 /// ```ignore,no_run
10186 /// # use google_cloud_api::model::ResourceReference;
10187 /// let x = ResourceReference::new().set_child_type("example");
10188 /// ```
10189 pub fn set_child_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10190 self.child_type = v.into();
10191 self
10192 }
10193}
10194
10195impl wkt::message::Message for ResourceReference {
10196 fn typename() -> &'static str {
10197 "type.googleapis.com/google.api.ResourceReference"
10198 }
10199}
10200
10201/// Specifies the routing information that should be sent along with the request
10202/// in the form of routing header.
10203/// **NOTE:** All service configuration rules follow the "last one wins" order.
10204///
10205/// The examples below will apply to an RPC which has the following request type:
10206///
10207/// Message Definition:
10208///
10209/// ```norust
10210/// message Request {
10211/// // The name of the Table
10212/// // Values can be of the following formats:
10213/// // - `projects/<project>/tables/<table>`
10214/// // - `projects/<project>/instances/<instance>/tables/<table>`
10215/// // - `region/<region>/zones/<zone>/tables/<table>`
10216/// string table_name = 1;
10217///
10218/// // This value specifies routing for replication.
10219/// // It can be in the following formats:
10220/// // - `profiles/<profile_id>`
10221/// // - a legacy `profile_id` that can be any string
10222/// string app_profile_id = 2;
10223/// }
10224/// ```
10225///
10226/// Example message:
10227///
10228/// ```norust
10229/// {
10230/// table_name: projects/proj_foo/instances/instance_bar/table/table_baz,
10231/// app_profile_id: profiles/prof_qux
10232/// }
10233/// ```
10234///
10235/// The routing header consists of one or multiple key-value pairs. The order of
10236/// the key-value pairs is undefined, the order of the `routing_parameters` in
10237/// the `RoutingRule` only matters for the evaluation order of the path
10238/// templates when `field` is the same. See the examples below for more details.
10239///
10240/// Every key and value in the routing header must be percent-encoded,
10241/// and joined together in the following format: `key1=value1&key2=value2`.
10242/// The examples below skip the percent-encoding for readability.
10243///
10244/// Example 1
10245///
10246/// Extracting a field from the request to put into the routing header
10247/// unchanged, with the key equal to the field name.
10248///
10249/// annotation:
10250///
10251/// ```norust
10252/// option (google.api.routing) = {
10253/// // Take the `app_profile_id`.
10254/// routing_parameters {
10255/// field: "app_profile_id"
10256/// }
10257/// };
10258/// ```
10259///
10260/// result:
10261///
10262/// ```norust
10263/// x-goog-request-params: app_profile_id=profiles/prof_qux
10264/// ```
10265///
10266/// Example 2
10267///
10268/// Extracting a field from the request to put into the routing header
10269/// unchanged, with the key different from the field name.
10270///
10271/// annotation:
10272///
10273/// ```norust
10274/// option (google.api.routing) = {
10275/// // Take the `app_profile_id`, but name it `routing_id` in the header.
10276/// routing_parameters {
10277/// field: "app_profile_id"
10278/// path_template: "{routing_id=**}"
10279/// }
10280/// };
10281/// ```
10282///
10283/// result:
10284///
10285/// ```norust
10286/// x-goog-request-params: routing_id=profiles/prof_qux
10287/// ```
10288///
10289/// Example 3
10290///
10291/// Extracting a field from the request to put into the routing
10292/// header, while matching a path template syntax on the field's value.
10293///
10294/// NB: it is more useful to send nothing than to send garbage for the purpose
10295/// of dynamic routing, since garbage pollutes cache. Thus the matching.
10296///
10297/// Sub-example 3a
10298///
10299/// The field matches the template.
10300///
10301/// annotation:
10302///
10303/// ```norust
10304/// option (google.api.routing) = {
10305/// // Take the `table_name`, if it's well-formed (with project-based
10306/// // syntax).
10307/// routing_parameters {
10308/// field: "table_name"
10309/// path_template: "{table_name=projects/*/instances/*/**}"
10310/// }
10311/// };
10312/// ```
10313///
10314/// result:
10315///
10316/// ```norust
10317/// x-goog-request-params:
10318/// table_name=projects/proj_foo/instances/instance_bar/table/table_baz
10319/// ```
10320///
10321/// Sub-example 3b
10322///
10323/// The field does not match the template.
10324///
10325/// annotation:
10326///
10327/// ```norust
10328/// option (google.api.routing) = {
10329/// // Take the `table_name`, if it's well-formed (with region-based
10330/// // syntax).
10331/// routing_parameters {
10332/// field: "table_name"
10333/// path_template: "{table_name=regions/*/zones/*/**}"
10334/// }
10335/// };
10336/// ```
10337///
10338/// result:
10339///
10340/// ```norust
10341/// <no routing header will be sent>
10342/// ```
10343///
10344/// Sub-example 3c
10345///
10346/// Multiple alternative conflictingly named path templates are
10347/// specified. The one that matches is used to construct the header.
10348///
10349/// annotation:
10350///
10351/// ```norust
10352/// option (google.api.routing) = {
10353/// // Take the `table_name`, if it's well-formed, whether
10354/// // using the region- or projects-based syntax.
10355///
10356/// routing_parameters {
10357/// field: "table_name"
10358/// path_template: "{table_name=regions/*/zones/*/**}"
10359/// }
10360/// routing_parameters {
10361/// field: "table_name"
10362/// path_template: "{table_name=projects/*/instances/*/**}"
10363/// }
10364/// };
10365/// ```
10366///
10367/// result:
10368///
10369/// ```norust
10370/// x-goog-request-params:
10371/// table_name=projects/proj_foo/instances/instance_bar/table/table_baz
10372/// ```
10373///
10374/// Example 4
10375///
10376/// Extracting a single routing header key-value pair by matching a
10377/// template syntax on (a part of) a single request field.
10378///
10379/// annotation:
10380///
10381/// ```norust
10382/// option (google.api.routing) = {
10383/// // Take just the project id from the `table_name` field.
10384/// routing_parameters {
10385/// field: "table_name"
10386/// path_template: "{routing_id=projects/*}/**"
10387/// }
10388/// };
10389/// ```
10390///
10391/// result:
10392///
10393/// ```norust
10394/// x-goog-request-params: routing_id=projects/proj_foo
10395/// ```
10396///
10397/// Example 5
10398///
10399/// Extracting a single routing header key-value pair by matching
10400/// several conflictingly named path templates on (parts of) a single request
10401/// field. The last template to match "wins" the conflict.
10402///
10403/// annotation:
10404///
10405/// ```norust
10406/// option (google.api.routing) = {
10407/// // If the `table_name` does not have instances information,
10408/// // take just the project id for routing.
10409/// // Otherwise take project + instance.
10410///
10411/// routing_parameters {
10412/// field: "table_name"
10413/// path_template: "{routing_id=projects/*}/**"
10414/// }
10415/// routing_parameters {
10416/// field: "table_name"
10417/// path_template: "{routing_id=projects/*/instances/*}/**"
10418/// }
10419/// };
10420/// ```
10421///
10422/// result:
10423///
10424/// ```norust
10425/// x-goog-request-params:
10426/// routing_id=projects/proj_foo/instances/instance_bar
10427/// ```
10428///
10429/// Example 6
10430///
10431/// Extracting multiple routing header key-value pairs by matching
10432/// several non-conflicting path templates on (parts of) a single request field.
10433///
10434/// Sub-example 6a
10435///
10436/// Make the templates strict, so that if the `table_name` does not
10437/// have an instance information, nothing is sent.
10438///
10439/// annotation:
10440///
10441/// ```norust
10442/// option (google.api.routing) = {
10443/// // The routing code needs two keys instead of one composite
10444/// // but works only for the tables with the "project-instance" name
10445/// // syntax.
10446///
10447/// routing_parameters {
10448/// field: "table_name"
10449/// path_template: "{project_id=projects/*}/instances/*/**"
10450/// }
10451/// routing_parameters {
10452/// field: "table_name"
10453/// path_template: "projects/*/{instance_id=instances/*}/**"
10454/// }
10455/// };
10456/// ```
10457///
10458/// result:
10459///
10460/// ```norust
10461/// x-goog-request-params:
10462/// project_id=projects/proj_foo&instance_id=instances/instance_bar
10463/// ```
10464///
10465/// Sub-example 6b
10466///
10467/// Make the templates loose, so that if the `table_name` does not
10468/// have an instance information, just the project id part is sent.
10469///
10470/// annotation:
10471///
10472/// ```norust
10473/// option (google.api.routing) = {
10474/// // The routing code wants two keys instead of one composite
10475/// // but will work with just the `project_id` for tables without
10476/// // an instance in the `table_name`.
10477///
10478/// routing_parameters {
10479/// field: "table_name"
10480/// path_template: "{project_id=projects/*}/**"
10481/// }
10482/// routing_parameters {
10483/// field: "table_name"
10484/// path_template: "projects/*/{instance_id=instances/*}/**"
10485/// }
10486/// };
10487/// ```
10488///
10489/// result (is the same as 6a for our example message because it has the instance
10490/// information):
10491///
10492/// ```norust
10493/// x-goog-request-params:
10494/// project_id=projects/proj_foo&instance_id=instances/instance_bar
10495/// ```
10496///
10497/// Example 7
10498///
10499/// Extracting multiple routing header key-value pairs by matching
10500/// several path templates on multiple request fields.
10501///
10502/// NB: note that here there is no way to specify sending nothing if one of the
10503/// fields does not match its template. E.g. if the `table_name` is in the wrong
10504/// format, the `project_id` will not be sent, but the `routing_id` will be.
10505/// The backend routing code has to be aware of that and be prepared to not
10506/// receive a full complement of keys if it expects multiple.
10507///
10508/// annotation:
10509///
10510/// ```norust
10511/// option (google.api.routing) = {
10512/// // The routing needs both `project_id` and `routing_id`
10513/// // (from the `app_profile_id` field) for routing.
10514///
10515/// routing_parameters {
10516/// field: "table_name"
10517/// path_template: "{project_id=projects/*}/**"
10518/// }
10519/// routing_parameters {
10520/// field: "app_profile_id"
10521/// path_template: "{routing_id=**}"
10522/// }
10523/// };
10524/// ```
10525///
10526/// result:
10527///
10528/// ```norust
10529/// x-goog-request-params:
10530/// project_id=projects/proj_foo&routing_id=profiles/prof_qux
10531/// ```
10532///
10533/// Example 8
10534///
10535/// Extracting a single routing header key-value pair by matching
10536/// several conflictingly named path templates on several request fields. The
10537/// last template to match "wins" the conflict.
10538///
10539/// annotation:
10540///
10541/// ```norust
10542/// option (google.api.routing) = {
10543/// // The `routing_id` can be a project id or a region id depending on
10544/// // the table name format, but only if the `app_profile_id` is not set.
10545/// // If `app_profile_id` is set it should be used instead.
10546///
10547/// routing_parameters {
10548/// field: "table_name"
10549/// path_template: "{routing_id=projects/*}/**"
10550/// }
10551/// routing_parameters {
10552/// field: "table_name"
10553/// path_template: "{routing_id=regions/*}/**"
10554/// }
10555/// routing_parameters {
10556/// field: "app_profile_id"
10557/// path_template: "{routing_id=**}"
10558/// }
10559/// };
10560/// ```
10561///
10562/// result:
10563///
10564/// ```norust
10565/// x-goog-request-params: routing_id=profiles/prof_qux
10566/// ```
10567///
10568/// Example 9
10569///
10570/// Bringing it all together.
10571///
10572/// annotation:
10573///
10574/// ```norust
10575/// option (google.api.routing) = {
10576/// // For routing both `table_location` and a `routing_id` are needed.
10577/// //
10578/// // table_location can be either an instance id or a region+zone id.
10579/// //
10580/// // For `routing_id`, take the value of `app_profile_id`
10581/// // - If it's in the format `profiles/<profile_id>`, send
10582/// // just the `<profile_id>` part.
10583/// // - If it's any other literal, send it as is.
10584/// // If the `app_profile_id` is empty, and the `table_name` starts with
10585/// // the project_id, send that instead.
10586///
10587/// routing_parameters {
10588/// field: "table_name"
10589/// path_template: "projects/*/{table_location=instances/*}/tables/*"
10590/// }
10591/// routing_parameters {
10592/// field: "table_name"
10593/// path_template: "{table_location=regions/*/zones/*}/tables/*"
10594/// }
10595/// routing_parameters {
10596/// field: "table_name"
10597/// path_template: "{routing_id=projects/*}/**"
10598/// }
10599/// routing_parameters {
10600/// field: "app_profile_id"
10601/// path_template: "{routing_id=**}"
10602/// }
10603/// routing_parameters {
10604/// field: "app_profile_id"
10605/// path_template: "profiles/{routing_id=*}"
10606/// }
10607/// };
10608/// ```
10609///
10610/// result:
10611///
10612/// ```norust
10613/// x-goog-request-params:
10614/// table_location=instances/instance_bar&routing_id=prof_qux
10615/// ```
10616#[derive(Clone, Default, PartialEq)]
10617#[non_exhaustive]
10618pub struct RoutingRule {
10619 /// A collection of Routing Parameter specifications.
10620 /// **NOTE:** If multiple Routing Parameters describe the same key
10621 /// (via the `path_template` field or via the `field` field when
10622 /// `path_template` is not provided), "last one wins" rule
10623 /// determines which Parameter gets used.
10624 /// See the examples for more details.
10625 pub routing_parameters: std::vec::Vec<crate::model::RoutingParameter>,
10626
10627 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10628}
10629
10630impl RoutingRule {
10631 pub fn new() -> Self {
10632 std::default::Default::default()
10633 }
10634
10635 /// Sets the value of [routing_parameters][crate::model::RoutingRule::routing_parameters].
10636 ///
10637 /// # Example
10638 /// ```ignore,no_run
10639 /// # use google_cloud_api::model::RoutingRule;
10640 /// use google_cloud_api::model::RoutingParameter;
10641 /// let x = RoutingRule::new()
10642 /// .set_routing_parameters([
10643 /// RoutingParameter::default()/* use setters */,
10644 /// RoutingParameter::default()/* use (different) setters */,
10645 /// ]);
10646 /// ```
10647 pub fn set_routing_parameters<T, V>(mut self, v: T) -> Self
10648 where
10649 T: std::iter::IntoIterator<Item = V>,
10650 V: std::convert::Into<crate::model::RoutingParameter>,
10651 {
10652 use std::iter::Iterator;
10653 self.routing_parameters = v.into_iter().map(|i| i.into()).collect();
10654 self
10655 }
10656}
10657
10658impl wkt::message::Message for RoutingRule {
10659 fn typename() -> &'static str {
10660 "type.googleapis.com/google.api.RoutingRule"
10661 }
10662}
10663
10664/// A projection from an input message to the GRPC or REST header.
10665#[derive(Clone, Default, PartialEq)]
10666#[non_exhaustive]
10667pub struct RoutingParameter {
10668 /// A request field to extract the header key-value pair from.
10669 pub field: std::string::String,
10670
10671 /// A pattern matching the key-value field. Optional.
10672 /// If not specified, the whole field specified in the `field` field will be
10673 /// taken as value, and its name used as key. If specified, it MUST contain
10674 /// exactly one named segment (along with any number of unnamed segments) The
10675 /// pattern will be matched over the field specified in the `field` field, then
10676 /// if the match is successful:
10677 ///
10678 /// - the name of the single named segment will be used as a header name,
10679 /// - the match value of the segment will be used as a header value;
10680 /// if the match is NOT successful, nothing will be sent.
10681 ///
10682 /// Example:
10683 ///
10684 /// ```norust
10685 /// -- This is a field in the request message
10686 /// | that the header value will be extracted from.
10687 /// |
10688 /// | -- This is the key name in the
10689 /// | | routing header.
10690 /// V |
10691 /// field: "table_name" v
10692 /// path_template: "projects/*/{table_location=instances/*}/tables/*"
10693 /// ^ ^
10694 /// | |
10695 /// In the {} brackets is the pattern that -- |
10696 /// specifies what to extract from the |
10697 /// field as a value to be sent. |
10698 /// |
10699 /// The string in the field must match the whole pattern --
10700 /// before brackets, inside brackets, after brackets.
10701 /// ```
10702 ///
10703 /// When looking at this specific example, we can see that:
10704 ///
10705 /// - A key-value pair with the key `table_location`
10706 /// and the value matching `instances/*` should be added
10707 /// to the x-goog-request-params routing header.
10708 /// - The value is extracted from the request message's `table_name` field
10709 /// if it matches the full pattern specified:
10710 /// `projects/*/instances/*/tables/*`.
10711 ///
10712 /// **NB:** If the `path_template` field is not provided, the key name is
10713 /// equal to the field name, and the whole field should be sent as a value.
10714 /// This makes the pattern for the field and the value functionally equivalent
10715 /// to `**`, and the configuration
10716 ///
10717 /// ```norust
10718 /// {
10719 /// field: "table_name"
10720 /// }
10721 /// ```
10722 ///
10723 /// is a functionally equivalent shorthand to:
10724 ///
10725 /// ```norust
10726 /// {
10727 /// field: "table_name"
10728 /// path_template: "{table_name=**}"
10729 /// }
10730 /// ```
10731 ///
10732 /// See Example 1 for more details.
10733 pub path_template: std::string::String,
10734
10735 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10736}
10737
10738impl RoutingParameter {
10739 pub fn new() -> Self {
10740 std::default::Default::default()
10741 }
10742
10743 /// Sets the value of [field][crate::model::RoutingParameter::field].
10744 ///
10745 /// # Example
10746 /// ```ignore,no_run
10747 /// # use google_cloud_api::model::RoutingParameter;
10748 /// let x = RoutingParameter::new().set_field("example");
10749 /// ```
10750 pub fn set_field<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10751 self.field = v.into();
10752 self
10753 }
10754
10755 /// Sets the value of [path_template][crate::model::RoutingParameter::path_template].
10756 ///
10757 /// # Example
10758 /// ```ignore,no_run
10759 /// # use google_cloud_api::model::RoutingParameter;
10760 /// let x = RoutingParameter::new().set_path_template("example");
10761 /// ```
10762 pub fn set_path_template<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10763 self.path_template = v.into();
10764 self
10765 }
10766}
10767
10768impl wkt::message::Message for RoutingParameter {
10769 fn typename() -> &'static str {
10770 "type.googleapis.com/google.api.RoutingParameter"
10771 }
10772}
10773
10774/// `Service` is the root object of Google API service configuration (service
10775/// config). It describes the basic information about a logical service,
10776/// such as the service name and the user-facing title, and delegates other
10777/// aspects to sub-sections. Each sub-section is either a proto message or a
10778/// repeated proto message that configures a specific aspect, such as auth.
10779/// For more information, see each proto message definition.
10780///
10781/// Example:
10782///
10783/// ```norust
10784/// type: google.api.Service
10785/// name: calendar.googleapis.com
10786/// title: Google Calendar API
10787/// apis:
10788/// - name: google.calendar.v3.Calendar
10789///
10790/// visibility:
10791/// rules:
10792/// - selector: "google.calendar.v3.*"
10793/// restriction: PREVIEW
10794/// backend:
10795/// rules:
10796/// - selector: "google.calendar.v3.*"
10797/// address: calendar.example.com
10798///
10799/// authentication:
10800/// providers:
10801/// - id: google_calendar_auth
10802/// jwks_uri: https://www.googleapis.com/oauth2/v1/certs
10803/// issuer: https://securetoken.google.com
10804/// rules:
10805/// - selector: "*"
10806/// requirements:
10807/// provider_id: google_calendar_auth
10808/// ```
10809#[derive(Clone, Default, PartialEq)]
10810#[non_exhaustive]
10811pub struct Service {
10812 /// The service name, which is a DNS-like logical identifier for the
10813 /// service, such as `calendar.googleapis.com`. The service name
10814 /// typically goes through DNS verification to make sure the owner
10815 /// of the service also owns the DNS name.
10816 pub name: std::string::String,
10817
10818 /// The product title for this service, it is the name displayed in Google
10819 /// Cloud Console.
10820 pub title: std::string::String,
10821
10822 /// The Google project that owns this service.
10823 pub producer_project_id: std::string::String,
10824
10825 /// A unique ID for a specific instance of this message, typically assigned
10826 /// by the client for tracking purpose. Must be no longer than 63 characters
10827 /// and only lower case letters, digits, '.', '_' and '-' are allowed. If
10828 /// empty, the server may choose to generate one instead.
10829 pub id: std::string::String,
10830
10831 /// A list of API interfaces exported by this service. Only the `name` field
10832 /// of the [google.protobuf.Api][google.protobuf.Api] needs to be provided by
10833 /// the configuration author, as the remaining fields will be derived from the
10834 /// IDL during the normalization process. It is an error to specify an API
10835 /// interface here which cannot be resolved against the associated IDL files.
10836 ///
10837 /// [google.protobuf.Api]: wkt::Api
10838 pub apis: std::vec::Vec<wkt::Api>,
10839
10840 /// A list of all proto message types included in this API service.
10841 /// Types referenced directly or indirectly by the `apis` are automatically
10842 /// included. Messages which are not referenced but shall be included, such as
10843 /// types used by the `google.protobuf.Any` type, should be listed here by
10844 /// name by the configuration author. Example:
10845 ///
10846 /// ```norust
10847 /// types:
10848 /// - name: google.protobuf.Int32
10849 /// ```
10850 pub types: std::vec::Vec<wkt::Type>,
10851
10852 /// A list of all enum types included in this API service. Enums referenced
10853 /// directly or indirectly by the `apis` are automatically included. Enums
10854 /// which are not referenced but shall be included should be listed here by
10855 /// name by the configuration author. Example:
10856 ///
10857 /// ```norust
10858 /// enums:
10859 /// - name: google.someapi.v1.SomeEnum
10860 /// ```
10861 pub enums: std::vec::Vec<wkt::Enum>,
10862
10863 /// Additional API documentation.
10864 pub documentation: std::option::Option<crate::model::Documentation>,
10865
10866 /// API backend configuration.
10867 pub backend: std::option::Option<crate::model::Backend>,
10868
10869 /// HTTP configuration.
10870 pub http: std::option::Option<crate::model::Http>,
10871
10872 /// Quota configuration.
10873 pub quota: std::option::Option<crate::model::Quota>,
10874
10875 /// Auth configuration.
10876 pub authentication: std::option::Option<crate::model::Authentication>,
10877
10878 /// Context configuration.
10879 pub context: std::option::Option<crate::model::Context>,
10880
10881 /// Configuration controlling usage of this service.
10882 pub usage: std::option::Option<crate::model::Usage>,
10883
10884 /// Configuration for network endpoints. If this is empty, then an endpoint
10885 /// with the same name as the service is automatically generated to service all
10886 /// defined APIs.
10887 pub endpoints: std::vec::Vec<crate::model::Endpoint>,
10888
10889 /// Configuration for the service control plane.
10890 pub control: std::option::Option<crate::model::Control>,
10891
10892 /// Defines the logs used by this service.
10893 pub logs: std::vec::Vec<crate::model::LogDescriptor>,
10894
10895 /// Defines the metrics used by this service.
10896 pub metrics: std::vec::Vec<crate::model::MetricDescriptor>,
10897
10898 /// Defines the monitored resources used by this service. This is required
10899 /// by the `Service.monitoring` and `Service.logging` configurations.
10900 pub monitored_resources: std::vec::Vec<crate::model::MonitoredResourceDescriptor>,
10901
10902 /// Billing configuration.
10903 pub billing: std::option::Option<crate::model::Billing>,
10904
10905 /// Logging configuration.
10906 pub logging: std::option::Option<crate::model::Logging>,
10907
10908 /// Monitoring configuration.
10909 pub monitoring: std::option::Option<crate::model::Monitoring>,
10910
10911 /// System parameter configuration.
10912 pub system_parameters: std::option::Option<crate::model::SystemParameters>,
10913
10914 /// Output only. The source information for this configuration if available.
10915 pub source_info: std::option::Option<crate::model::SourceInfo>,
10916
10917 /// Settings for [Google Cloud Client
10918 /// libraries](https://cloud.google.com/apis/docs/cloud-client-libraries)
10919 /// generated from APIs defined as protocol buffers.
10920 pub publishing: std::option::Option<crate::model::Publishing>,
10921
10922 /// Obsolete. Do not use.
10923 ///
10924 /// This field has no semantic meaning. The service config compiler always
10925 /// sets this field to `3`.
10926 pub config_version: std::option::Option<wkt::UInt32Value>,
10927
10928 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10929}
10930
10931impl Service {
10932 pub fn new() -> Self {
10933 std::default::Default::default()
10934 }
10935
10936 /// Sets the value of [name][crate::model::Service::name].
10937 ///
10938 /// # Example
10939 /// ```ignore,no_run
10940 /// # use google_cloud_api::model::Service;
10941 /// let x = Service::new().set_name("example");
10942 /// ```
10943 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10944 self.name = v.into();
10945 self
10946 }
10947
10948 /// Sets the value of [title][crate::model::Service::title].
10949 ///
10950 /// # Example
10951 /// ```ignore,no_run
10952 /// # use google_cloud_api::model::Service;
10953 /// let x = Service::new().set_title("example");
10954 /// ```
10955 pub fn set_title<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10956 self.title = v.into();
10957 self
10958 }
10959
10960 /// Sets the value of [producer_project_id][crate::model::Service::producer_project_id].
10961 ///
10962 /// # Example
10963 /// ```ignore,no_run
10964 /// # use google_cloud_api::model::Service;
10965 /// let x = Service::new().set_producer_project_id("example");
10966 /// ```
10967 pub fn set_producer_project_id<T: std::convert::Into<std::string::String>>(
10968 mut self,
10969 v: T,
10970 ) -> Self {
10971 self.producer_project_id = v.into();
10972 self
10973 }
10974
10975 /// Sets the value of [id][crate::model::Service::id].
10976 ///
10977 /// # Example
10978 /// ```ignore,no_run
10979 /// # use google_cloud_api::model::Service;
10980 /// let x = Service::new().set_id("example");
10981 /// ```
10982 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10983 self.id = v.into();
10984 self
10985 }
10986
10987 /// Sets the value of [apis][crate::model::Service::apis].
10988 ///
10989 /// # Example
10990 /// ```ignore,no_run
10991 /// # use google_cloud_api::model::Service;
10992 /// use wkt::Api;
10993 /// let x = Service::new()
10994 /// .set_apis([
10995 /// Api::default()/* use setters */,
10996 /// Api::default()/* use (different) setters */,
10997 /// ]);
10998 /// ```
10999 pub fn set_apis<T, V>(mut self, v: T) -> Self
11000 where
11001 T: std::iter::IntoIterator<Item = V>,
11002 V: std::convert::Into<wkt::Api>,
11003 {
11004 use std::iter::Iterator;
11005 self.apis = v.into_iter().map(|i| i.into()).collect();
11006 self
11007 }
11008
11009 /// Sets the value of [types][crate::model::Service::types].
11010 ///
11011 /// # Example
11012 /// ```ignore,no_run
11013 /// # use google_cloud_api::model::Service;
11014 /// use wkt::Type;
11015 /// let x = Service::new()
11016 /// .set_types([
11017 /// Type::default()/* use setters */,
11018 /// Type::default()/* use (different) setters */,
11019 /// ]);
11020 /// ```
11021 pub fn set_types<T, V>(mut self, v: T) -> Self
11022 where
11023 T: std::iter::IntoIterator<Item = V>,
11024 V: std::convert::Into<wkt::Type>,
11025 {
11026 use std::iter::Iterator;
11027 self.types = v.into_iter().map(|i| i.into()).collect();
11028 self
11029 }
11030
11031 /// Sets the value of [enums][crate::model::Service::enums].
11032 ///
11033 /// # Example
11034 /// ```ignore,no_run
11035 /// # use google_cloud_api::model::Service;
11036 /// use wkt::Enum;
11037 /// let x = Service::new()
11038 /// .set_enums([
11039 /// Enum::default()/* use setters */,
11040 /// Enum::default()/* use (different) setters */,
11041 /// ]);
11042 /// ```
11043 pub fn set_enums<T, V>(mut self, v: T) -> Self
11044 where
11045 T: std::iter::IntoIterator<Item = V>,
11046 V: std::convert::Into<wkt::Enum>,
11047 {
11048 use std::iter::Iterator;
11049 self.enums = v.into_iter().map(|i| i.into()).collect();
11050 self
11051 }
11052
11053 /// Sets the value of [documentation][crate::model::Service::documentation].
11054 ///
11055 /// # Example
11056 /// ```ignore,no_run
11057 /// # use google_cloud_api::model::Service;
11058 /// use google_cloud_api::model::Documentation;
11059 /// let x = Service::new().set_documentation(Documentation::default()/* use setters */);
11060 /// ```
11061 pub fn set_documentation<T>(mut self, v: T) -> Self
11062 where
11063 T: std::convert::Into<crate::model::Documentation>,
11064 {
11065 self.documentation = std::option::Option::Some(v.into());
11066 self
11067 }
11068
11069 /// Sets or clears the value of [documentation][crate::model::Service::documentation].
11070 ///
11071 /// # Example
11072 /// ```ignore,no_run
11073 /// # use google_cloud_api::model::Service;
11074 /// use google_cloud_api::model::Documentation;
11075 /// let x = Service::new().set_or_clear_documentation(Some(Documentation::default()/* use setters */));
11076 /// let x = Service::new().set_or_clear_documentation(None::<Documentation>);
11077 /// ```
11078 pub fn set_or_clear_documentation<T>(mut self, v: std::option::Option<T>) -> Self
11079 where
11080 T: std::convert::Into<crate::model::Documentation>,
11081 {
11082 self.documentation = v.map(|x| x.into());
11083 self
11084 }
11085
11086 /// Sets the value of [backend][crate::model::Service::backend].
11087 ///
11088 /// # Example
11089 /// ```ignore,no_run
11090 /// # use google_cloud_api::model::Service;
11091 /// use google_cloud_api::model::Backend;
11092 /// let x = Service::new().set_backend(Backend::default()/* use setters */);
11093 /// ```
11094 pub fn set_backend<T>(mut self, v: T) -> Self
11095 where
11096 T: std::convert::Into<crate::model::Backend>,
11097 {
11098 self.backend = std::option::Option::Some(v.into());
11099 self
11100 }
11101
11102 /// Sets or clears the value of [backend][crate::model::Service::backend].
11103 ///
11104 /// # Example
11105 /// ```ignore,no_run
11106 /// # use google_cloud_api::model::Service;
11107 /// use google_cloud_api::model::Backend;
11108 /// let x = Service::new().set_or_clear_backend(Some(Backend::default()/* use setters */));
11109 /// let x = Service::new().set_or_clear_backend(None::<Backend>);
11110 /// ```
11111 pub fn set_or_clear_backend<T>(mut self, v: std::option::Option<T>) -> Self
11112 where
11113 T: std::convert::Into<crate::model::Backend>,
11114 {
11115 self.backend = v.map(|x| x.into());
11116 self
11117 }
11118
11119 /// Sets the value of [http][crate::model::Service::http].
11120 ///
11121 /// # Example
11122 /// ```ignore,no_run
11123 /// # use google_cloud_api::model::Service;
11124 /// use google_cloud_api::model::Http;
11125 /// let x = Service::new().set_http(Http::default()/* use setters */);
11126 /// ```
11127 pub fn set_http<T>(mut self, v: T) -> Self
11128 where
11129 T: std::convert::Into<crate::model::Http>,
11130 {
11131 self.http = std::option::Option::Some(v.into());
11132 self
11133 }
11134
11135 /// Sets or clears the value of [http][crate::model::Service::http].
11136 ///
11137 /// # Example
11138 /// ```ignore,no_run
11139 /// # use google_cloud_api::model::Service;
11140 /// use google_cloud_api::model::Http;
11141 /// let x = Service::new().set_or_clear_http(Some(Http::default()/* use setters */));
11142 /// let x = Service::new().set_or_clear_http(None::<Http>);
11143 /// ```
11144 pub fn set_or_clear_http<T>(mut self, v: std::option::Option<T>) -> Self
11145 where
11146 T: std::convert::Into<crate::model::Http>,
11147 {
11148 self.http = v.map(|x| x.into());
11149 self
11150 }
11151
11152 /// Sets the value of [quota][crate::model::Service::quota].
11153 ///
11154 /// # Example
11155 /// ```ignore,no_run
11156 /// # use google_cloud_api::model::Service;
11157 /// use google_cloud_api::model::Quota;
11158 /// let x = Service::new().set_quota(Quota::default()/* use setters */);
11159 /// ```
11160 pub fn set_quota<T>(mut self, v: T) -> Self
11161 where
11162 T: std::convert::Into<crate::model::Quota>,
11163 {
11164 self.quota = std::option::Option::Some(v.into());
11165 self
11166 }
11167
11168 /// Sets or clears the value of [quota][crate::model::Service::quota].
11169 ///
11170 /// # Example
11171 /// ```ignore,no_run
11172 /// # use google_cloud_api::model::Service;
11173 /// use google_cloud_api::model::Quota;
11174 /// let x = Service::new().set_or_clear_quota(Some(Quota::default()/* use setters */));
11175 /// let x = Service::new().set_or_clear_quota(None::<Quota>);
11176 /// ```
11177 pub fn set_or_clear_quota<T>(mut self, v: std::option::Option<T>) -> Self
11178 where
11179 T: std::convert::Into<crate::model::Quota>,
11180 {
11181 self.quota = v.map(|x| x.into());
11182 self
11183 }
11184
11185 /// Sets the value of [authentication][crate::model::Service::authentication].
11186 ///
11187 /// # Example
11188 /// ```ignore,no_run
11189 /// # use google_cloud_api::model::Service;
11190 /// use google_cloud_api::model::Authentication;
11191 /// let x = Service::new().set_authentication(Authentication::default()/* use setters */);
11192 /// ```
11193 pub fn set_authentication<T>(mut self, v: T) -> Self
11194 where
11195 T: std::convert::Into<crate::model::Authentication>,
11196 {
11197 self.authentication = std::option::Option::Some(v.into());
11198 self
11199 }
11200
11201 /// Sets or clears the value of [authentication][crate::model::Service::authentication].
11202 ///
11203 /// # Example
11204 /// ```ignore,no_run
11205 /// # use google_cloud_api::model::Service;
11206 /// use google_cloud_api::model::Authentication;
11207 /// let x = Service::new().set_or_clear_authentication(Some(Authentication::default()/* use setters */));
11208 /// let x = Service::new().set_or_clear_authentication(None::<Authentication>);
11209 /// ```
11210 pub fn set_or_clear_authentication<T>(mut self, v: std::option::Option<T>) -> Self
11211 where
11212 T: std::convert::Into<crate::model::Authentication>,
11213 {
11214 self.authentication = v.map(|x| x.into());
11215 self
11216 }
11217
11218 /// Sets the value of [context][crate::model::Service::context].
11219 ///
11220 /// # Example
11221 /// ```ignore,no_run
11222 /// # use google_cloud_api::model::Service;
11223 /// use google_cloud_api::model::Context;
11224 /// let x = Service::new().set_context(Context::default()/* use setters */);
11225 /// ```
11226 pub fn set_context<T>(mut self, v: T) -> Self
11227 where
11228 T: std::convert::Into<crate::model::Context>,
11229 {
11230 self.context = std::option::Option::Some(v.into());
11231 self
11232 }
11233
11234 /// Sets or clears the value of [context][crate::model::Service::context].
11235 ///
11236 /// # Example
11237 /// ```ignore,no_run
11238 /// # use google_cloud_api::model::Service;
11239 /// use google_cloud_api::model::Context;
11240 /// let x = Service::new().set_or_clear_context(Some(Context::default()/* use setters */));
11241 /// let x = Service::new().set_or_clear_context(None::<Context>);
11242 /// ```
11243 pub fn set_or_clear_context<T>(mut self, v: std::option::Option<T>) -> Self
11244 where
11245 T: std::convert::Into<crate::model::Context>,
11246 {
11247 self.context = v.map(|x| x.into());
11248 self
11249 }
11250
11251 /// Sets the value of [usage][crate::model::Service::usage].
11252 ///
11253 /// # Example
11254 /// ```ignore,no_run
11255 /// # use google_cloud_api::model::Service;
11256 /// use google_cloud_api::model::Usage;
11257 /// let x = Service::new().set_usage(Usage::default()/* use setters */);
11258 /// ```
11259 pub fn set_usage<T>(mut self, v: T) -> Self
11260 where
11261 T: std::convert::Into<crate::model::Usage>,
11262 {
11263 self.usage = std::option::Option::Some(v.into());
11264 self
11265 }
11266
11267 /// Sets or clears the value of [usage][crate::model::Service::usage].
11268 ///
11269 /// # Example
11270 /// ```ignore,no_run
11271 /// # use google_cloud_api::model::Service;
11272 /// use google_cloud_api::model::Usage;
11273 /// let x = Service::new().set_or_clear_usage(Some(Usage::default()/* use setters */));
11274 /// let x = Service::new().set_or_clear_usage(None::<Usage>);
11275 /// ```
11276 pub fn set_or_clear_usage<T>(mut self, v: std::option::Option<T>) -> Self
11277 where
11278 T: std::convert::Into<crate::model::Usage>,
11279 {
11280 self.usage = v.map(|x| x.into());
11281 self
11282 }
11283
11284 /// Sets the value of [endpoints][crate::model::Service::endpoints].
11285 ///
11286 /// # Example
11287 /// ```ignore,no_run
11288 /// # use google_cloud_api::model::Service;
11289 /// use google_cloud_api::model::Endpoint;
11290 /// let x = Service::new()
11291 /// .set_endpoints([
11292 /// Endpoint::default()/* use setters */,
11293 /// Endpoint::default()/* use (different) setters */,
11294 /// ]);
11295 /// ```
11296 pub fn set_endpoints<T, V>(mut self, v: T) -> Self
11297 where
11298 T: std::iter::IntoIterator<Item = V>,
11299 V: std::convert::Into<crate::model::Endpoint>,
11300 {
11301 use std::iter::Iterator;
11302 self.endpoints = v.into_iter().map(|i| i.into()).collect();
11303 self
11304 }
11305
11306 /// Sets the value of [control][crate::model::Service::control].
11307 ///
11308 /// # Example
11309 /// ```ignore,no_run
11310 /// # use google_cloud_api::model::Service;
11311 /// use google_cloud_api::model::Control;
11312 /// let x = Service::new().set_control(Control::default()/* use setters */);
11313 /// ```
11314 pub fn set_control<T>(mut self, v: T) -> Self
11315 where
11316 T: std::convert::Into<crate::model::Control>,
11317 {
11318 self.control = std::option::Option::Some(v.into());
11319 self
11320 }
11321
11322 /// Sets or clears the value of [control][crate::model::Service::control].
11323 ///
11324 /// # Example
11325 /// ```ignore,no_run
11326 /// # use google_cloud_api::model::Service;
11327 /// use google_cloud_api::model::Control;
11328 /// let x = Service::new().set_or_clear_control(Some(Control::default()/* use setters */));
11329 /// let x = Service::new().set_or_clear_control(None::<Control>);
11330 /// ```
11331 pub fn set_or_clear_control<T>(mut self, v: std::option::Option<T>) -> Self
11332 where
11333 T: std::convert::Into<crate::model::Control>,
11334 {
11335 self.control = v.map(|x| x.into());
11336 self
11337 }
11338
11339 /// Sets the value of [logs][crate::model::Service::logs].
11340 ///
11341 /// # Example
11342 /// ```ignore,no_run
11343 /// # use google_cloud_api::model::Service;
11344 /// use google_cloud_api::model::LogDescriptor;
11345 /// let x = Service::new()
11346 /// .set_logs([
11347 /// LogDescriptor::default()/* use setters */,
11348 /// LogDescriptor::default()/* use (different) setters */,
11349 /// ]);
11350 /// ```
11351 pub fn set_logs<T, V>(mut self, v: T) -> Self
11352 where
11353 T: std::iter::IntoIterator<Item = V>,
11354 V: std::convert::Into<crate::model::LogDescriptor>,
11355 {
11356 use std::iter::Iterator;
11357 self.logs = v.into_iter().map(|i| i.into()).collect();
11358 self
11359 }
11360
11361 /// Sets the value of [metrics][crate::model::Service::metrics].
11362 ///
11363 /// # Example
11364 /// ```ignore,no_run
11365 /// # use google_cloud_api::model::Service;
11366 /// use google_cloud_api::model::MetricDescriptor;
11367 /// let x = Service::new()
11368 /// .set_metrics([
11369 /// MetricDescriptor::default()/* use setters */,
11370 /// MetricDescriptor::default()/* use (different) setters */,
11371 /// ]);
11372 /// ```
11373 pub fn set_metrics<T, V>(mut self, v: T) -> Self
11374 where
11375 T: std::iter::IntoIterator<Item = V>,
11376 V: std::convert::Into<crate::model::MetricDescriptor>,
11377 {
11378 use std::iter::Iterator;
11379 self.metrics = v.into_iter().map(|i| i.into()).collect();
11380 self
11381 }
11382
11383 /// Sets the value of [monitored_resources][crate::model::Service::monitored_resources].
11384 ///
11385 /// # Example
11386 /// ```ignore,no_run
11387 /// # use google_cloud_api::model::Service;
11388 /// use google_cloud_api::model::MonitoredResourceDescriptor;
11389 /// let x = Service::new()
11390 /// .set_monitored_resources([
11391 /// MonitoredResourceDescriptor::default()/* use setters */,
11392 /// MonitoredResourceDescriptor::default()/* use (different) setters */,
11393 /// ]);
11394 /// ```
11395 pub fn set_monitored_resources<T, V>(mut self, v: T) -> Self
11396 where
11397 T: std::iter::IntoIterator<Item = V>,
11398 V: std::convert::Into<crate::model::MonitoredResourceDescriptor>,
11399 {
11400 use std::iter::Iterator;
11401 self.monitored_resources = v.into_iter().map(|i| i.into()).collect();
11402 self
11403 }
11404
11405 /// Sets the value of [billing][crate::model::Service::billing].
11406 ///
11407 /// # Example
11408 /// ```ignore,no_run
11409 /// # use google_cloud_api::model::Service;
11410 /// use google_cloud_api::model::Billing;
11411 /// let x = Service::new().set_billing(Billing::default()/* use setters */);
11412 /// ```
11413 pub fn set_billing<T>(mut self, v: T) -> Self
11414 where
11415 T: std::convert::Into<crate::model::Billing>,
11416 {
11417 self.billing = std::option::Option::Some(v.into());
11418 self
11419 }
11420
11421 /// Sets or clears the value of [billing][crate::model::Service::billing].
11422 ///
11423 /// # Example
11424 /// ```ignore,no_run
11425 /// # use google_cloud_api::model::Service;
11426 /// use google_cloud_api::model::Billing;
11427 /// let x = Service::new().set_or_clear_billing(Some(Billing::default()/* use setters */));
11428 /// let x = Service::new().set_or_clear_billing(None::<Billing>);
11429 /// ```
11430 pub fn set_or_clear_billing<T>(mut self, v: std::option::Option<T>) -> Self
11431 where
11432 T: std::convert::Into<crate::model::Billing>,
11433 {
11434 self.billing = v.map(|x| x.into());
11435 self
11436 }
11437
11438 /// Sets the value of [logging][crate::model::Service::logging].
11439 ///
11440 /// # Example
11441 /// ```ignore,no_run
11442 /// # use google_cloud_api::model::Service;
11443 /// use google_cloud_api::model::Logging;
11444 /// let x = Service::new().set_logging(Logging::default()/* use setters */);
11445 /// ```
11446 pub fn set_logging<T>(mut self, v: T) -> Self
11447 where
11448 T: std::convert::Into<crate::model::Logging>,
11449 {
11450 self.logging = std::option::Option::Some(v.into());
11451 self
11452 }
11453
11454 /// Sets or clears the value of [logging][crate::model::Service::logging].
11455 ///
11456 /// # Example
11457 /// ```ignore,no_run
11458 /// # use google_cloud_api::model::Service;
11459 /// use google_cloud_api::model::Logging;
11460 /// let x = Service::new().set_or_clear_logging(Some(Logging::default()/* use setters */));
11461 /// let x = Service::new().set_or_clear_logging(None::<Logging>);
11462 /// ```
11463 pub fn set_or_clear_logging<T>(mut self, v: std::option::Option<T>) -> Self
11464 where
11465 T: std::convert::Into<crate::model::Logging>,
11466 {
11467 self.logging = v.map(|x| x.into());
11468 self
11469 }
11470
11471 /// Sets the value of [monitoring][crate::model::Service::monitoring].
11472 ///
11473 /// # Example
11474 /// ```ignore,no_run
11475 /// # use google_cloud_api::model::Service;
11476 /// use google_cloud_api::model::Monitoring;
11477 /// let x = Service::new().set_monitoring(Monitoring::default()/* use setters */);
11478 /// ```
11479 pub fn set_monitoring<T>(mut self, v: T) -> Self
11480 where
11481 T: std::convert::Into<crate::model::Monitoring>,
11482 {
11483 self.monitoring = std::option::Option::Some(v.into());
11484 self
11485 }
11486
11487 /// Sets or clears the value of [monitoring][crate::model::Service::monitoring].
11488 ///
11489 /// # Example
11490 /// ```ignore,no_run
11491 /// # use google_cloud_api::model::Service;
11492 /// use google_cloud_api::model::Monitoring;
11493 /// let x = Service::new().set_or_clear_monitoring(Some(Monitoring::default()/* use setters */));
11494 /// let x = Service::new().set_or_clear_monitoring(None::<Monitoring>);
11495 /// ```
11496 pub fn set_or_clear_monitoring<T>(mut self, v: std::option::Option<T>) -> Self
11497 where
11498 T: std::convert::Into<crate::model::Monitoring>,
11499 {
11500 self.monitoring = v.map(|x| x.into());
11501 self
11502 }
11503
11504 /// Sets the value of [system_parameters][crate::model::Service::system_parameters].
11505 ///
11506 /// # Example
11507 /// ```ignore,no_run
11508 /// # use google_cloud_api::model::Service;
11509 /// use google_cloud_api::model::SystemParameters;
11510 /// let x = Service::new().set_system_parameters(SystemParameters::default()/* use setters */);
11511 /// ```
11512 pub fn set_system_parameters<T>(mut self, v: T) -> Self
11513 where
11514 T: std::convert::Into<crate::model::SystemParameters>,
11515 {
11516 self.system_parameters = std::option::Option::Some(v.into());
11517 self
11518 }
11519
11520 /// Sets or clears the value of [system_parameters][crate::model::Service::system_parameters].
11521 ///
11522 /// # Example
11523 /// ```ignore,no_run
11524 /// # use google_cloud_api::model::Service;
11525 /// use google_cloud_api::model::SystemParameters;
11526 /// let x = Service::new().set_or_clear_system_parameters(Some(SystemParameters::default()/* use setters */));
11527 /// let x = Service::new().set_or_clear_system_parameters(None::<SystemParameters>);
11528 /// ```
11529 pub fn set_or_clear_system_parameters<T>(mut self, v: std::option::Option<T>) -> Self
11530 where
11531 T: std::convert::Into<crate::model::SystemParameters>,
11532 {
11533 self.system_parameters = v.map(|x| x.into());
11534 self
11535 }
11536
11537 /// Sets the value of [source_info][crate::model::Service::source_info].
11538 ///
11539 /// # Example
11540 /// ```ignore,no_run
11541 /// # use google_cloud_api::model::Service;
11542 /// use google_cloud_api::model::SourceInfo;
11543 /// let x = Service::new().set_source_info(SourceInfo::default()/* use setters */);
11544 /// ```
11545 pub fn set_source_info<T>(mut self, v: T) -> Self
11546 where
11547 T: std::convert::Into<crate::model::SourceInfo>,
11548 {
11549 self.source_info = std::option::Option::Some(v.into());
11550 self
11551 }
11552
11553 /// Sets or clears the value of [source_info][crate::model::Service::source_info].
11554 ///
11555 /// # Example
11556 /// ```ignore,no_run
11557 /// # use google_cloud_api::model::Service;
11558 /// use google_cloud_api::model::SourceInfo;
11559 /// let x = Service::new().set_or_clear_source_info(Some(SourceInfo::default()/* use setters */));
11560 /// let x = Service::new().set_or_clear_source_info(None::<SourceInfo>);
11561 /// ```
11562 pub fn set_or_clear_source_info<T>(mut self, v: std::option::Option<T>) -> Self
11563 where
11564 T: std::convert::Into<crate::model::SourceInfo>,
11565 {
11566 self.source_info = v.map(|x| x.into());
11567 self
11568 }
11569
11570 /// Sets the value of [publishing][crate::model::Service::publishing].
11571 ///
11572 /// # Example
11573 /// ```ignore,no_run
11574 /// # use google_cloud_api::model::Service;
11575 /// use google_cloud_api::model::Publishing;
11576 /// let x = Service::new().set_publishing(Publishing::default()/* use setters */);
11577 /// ```
11578 pub fn set_publishing<T>(mut self, v: T) -> Self
11579 where
11580 T: std::convert::Into<crate::model::Publishing>,
11581 {
11582 self.publishing = std::option::Option::Some(v.into());
11583 self
11584 }
11585
11586 /// Sets or clears the value of [publishing][crate::model::Service::publishing].
11587 ///
11588 /// # Example
11589 /// ```ignore,no_run
11590 /// # use google_cloud_api::model::Service;
11591 /// use google_cloud_api::model::Publishing;
11592 /// let x = Service::new().set_or_clear_publishing(Some(Publishing::default()/* use setters */));
11593 /// let x = Service::new().set_or_clear_publishing(None::<Publishing>);
11594 /// ```
11595 pub fn set_or_clear_publishing<T>(mut self, v: std::option::Option<T>) -> Self
11596 where
11597 T: std::convert::Into<crate::model::Publishing>,
11598 {
11599 self.publishing = v.map(|x| x.into());
11600 self
11601 }
11602
11603 /// Sets the value of [config_version][crate::model::Service::config_version].
11604 ///
11605 /// # Example
11606 /// ```ignore,no_run
11607 /// # use google_cloud_api::model::Service;
11608 /// use wkt::UInt32Value;
11609 /// let x = Service::new().set_config_version(UInt32Value::default()/* use setters */);
11610 /// ```
11611 pub fn set_config_version<T>(mut self, v: T) -> Self
11612 where
11613 T: std::convert::Into<wkt::UInt32Value>,
11614 {
11615 self.config_version = std::option::Option::Some(v.into());
11616 self
11617 }
11618
11619 /// Sets or clears the value of [config_version][crate::model::Service::config_version].
11620 ///
11621 /// # Example
11622 /// ```ignore,no_run
11623 /// # use google_cloud_api::model::Service;
11624 /// use wkt::UInt32Value;
11625 /// let x = Service::new().set_or_clear_config_version(Some(UInt32Value::default()/* use setters */));
11626 /// let x = Service::new().set_or_clear_config_version(None::<UInt32Value>);
11627 /// ```
11628 pub fn set_or_clear_config_version<T>(mut self, v: std::option::Option<T>) -> Self
11629 where
11630 T: std::convert::Into<wkt::UInt32Value>,
11631 {
11632 self.config_version = v.map(|x| x.into());
11633 self
11634 }
11635}
11636
11637impl wkt::message::Message for Service {
11638 fn typename() -> &'static str {
11639 "type.googleapis.com/google.api.Service"
11640 }
11641}
11642
11643/// Source information used to create a Service Config
11644#[derive(Clone, Default, PartialEq)]
11645#[non_exhaustive]
11646pub struct SourceInfo {
11647 /// All files used during config generation.
11648 pub source_files: std::vec::Vec<wkt::Any>,
11649
11650 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11651}
11652
11653impl SourceInfo {
11654 pub fn new() -> Self {
11655 std::default::Default::default()
11656 }
11657
11658 /// Sets the value of [source_files][crate::model::SourceInfo::source_files].
11659 ///
11660 /// # Example
11661 /// ```ignore,no_run
11662 /// # use google_cloud_api::model::SourceInfo;
11663 /// use wkt::Any;
11664 /// let x = SourceInfo::new()
11665 /// .set_source_files([
11666 /// Any::default()/* use setters */,
11667 /// Any::default()/* use (different) setters */,
11668 /// ]);
11669 /// ```
11670 pub fn set_source_files<T, V>(mut self, v: T) -> Self
11671 where
11672 T: std::iter::IntoIterator<Item = V>,
11673 V: std::convert::Into<wkt::Any>,
11674 {
11675 use std::iter::Iterator;
11676 self.source_files = v.into_iter().map(|i| i.into()).collect();
11677 self
11678 }
11679}
11680
11681impl wkt::message::Message for SourceInfo {
11682 fn typename() -> &'static str {
11683 "type.googleapis.com/google.api.SourceInfo"
11684 }
11685}
11686
11687/// ### System parameter configuration
11688///
11689/// A system parameter is a special kind of parameter defined by the API
11690/// system, not by an individual API. It is typically mapped to an HTTP header
11691/// and/or a URL query parameter. This configuration specifies which methods
11692/// change the names of the system parameters.
11693#[derive(Clone, Default, PartialEq)]
11694#[non_exhaustive]
11695pub struct SystemParameters {
11696 /// Define system parameters.
11697 ///
11698 /// The parameters defined here will override the default parameters
11699 /// implemented by the system. If this field is missing from the service
11700 /// config, default system parameters will be used. Default system parameters
11701 /// and names is implementation-dependent.
11702 ///
11703 /// Example: define api key for all methods
11704 ///
11705 /// ```norust
11706 /// system_parameters
11707 /// rules:
11708 /// - selector: "*"
11709 /// parameters:
11710 /// - name: api_key
11711 /// url_query_parameter: api_key
11712 /// ```
11713 ///
11714 /// Example: define 2 api key names for a specific method.
11715 ///
11716 /// ```norust
11717 /// system_parameters
11718 /// rules:
11719 /// - selector: "/ListShelves"
11720 /// parameters:
11721 /// - name: api_key
11722 /// http_header: Api-Key1
11723 /// - name: api_key
11724 /// http_header: Api-Key2
11725 /// ```
11726 ///
11727 /// **NOTE:** All service configuration rules follow "last one wins" order.
11728 pub rules: std::vec::Vec<crate::model::SystemParameterRule>,
11729
11730 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11731}
11732
11733impl SystemParameters {
11734 pub fn new() -> Self {
11735 std::default::Default::default()
11736 }
11737
11738 /// Sets the value of [rules][crate::model::SystemParameters::rules].
11739 ///
11740 /// # Example
11741 /// ```ignore,no_run
11742 /// # use google_cloud_api::model::SystemParameters;
11743 /// use google_cloud_api::model::SystemParameterRule;
11744 /// let x = SystemParameters::new()
11745 /// .set_rules([
11746 /// SystemParameterRule::default()/* use setters */,
11747 /// SystemParameterRule::default()/* use (different) setters */,
11748 /// ]);
11749 /// ```
11750 pub fn set_rules<T, V>(mut self, v: T) -> Self
11751 where
11752 T: std::iter::IntoIterator<Item = V>,
11753 V: std::convert::Into<crate::model::SystemParameterRule>,
11754 {
11755 use std::iter::Iterator;
11756 self.rules = v.into_iter().map(|i| i.into()).collect();
11757 self
11758 }
11759}
11760
11761impl wkt::message::Message for SystemParameters {
11762 fn typename() -> &'static str {
11763 "type.googleapis.com/google.api.SystemParameters"
11764 }
11765}
11766
11767/// Define a system parameter rule mapping system parameter definitions to
11768/// methods.
11769#[derive(Clone, Default, PartialEq)]
11770#[non_exhaustive]
11771pub struct SystemParameterRule {
11772 /// Selects the methods to which this rule applies. Use '*' to indicate all
11773 /// methods in all APIs.
11774 ///
11775 /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
11776 /// details.
11777 ///
11778 /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
11779 pub selector: std::string::String,
11780
11781 /// Define parameters. Multiple names may be defined for a parameter.
11782 /// For a given method call, only one of them should be used. If multiple
11783 /// names are used the behavior is implementation-dependent.
11784 /// If none of the specified names are present the behavior is
11785 /// parameter-dependent.
11786 pub parameters: std::vec::Vec<crate::model::SystemParameter>,
11787
11788 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11789}
11790
11791impl SystemParameterRule {
11792 pub fn new() -> Self {
11793 std::default::Default::default()
11794 }
11795
11796 /// Sets the value of [selector][crate::model::SystemParameterRule::selector].
11797 ///
11798 /// # Example
11799 /// ```ignore,no_run
11800 /// # use google_cloud_api::model::SystemParameterRule;
11801 /// let x = SystemParameterRule::new().set_selector("example");
11802 /// ```
11803 pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11804 self.selector = v.into();
11805 self
11806 }
11807
11808 /// Sets the value of [parameters][crate::model::SystemParameterRule::parameters].
11809 ///
11810 /// # Example
11811 /// ```ignore,no_run
11812 /// # use google_cloud_api::model::SystemParameterRule;
11813 /// use google_cloud_api::model::SystemParameter;
11814 /// let x = SystemParameterRule::new()
11815 /// .set_parameters([
11816 /// SystemParameter::default()/* use setters */,
11817 /// SystemParameter::default()/* use (different) setters */,
11818 /// ]);
11819 /// ```
11820 pub fn set_parameters<T, V>(mut self, v: T) -> Self
11821 where
11822 T: std::iter::IntoIterator<Item = V>,
11823 V: std::convert::Into<crate::model::SystemParameter>,
11824 {
11825 use std::iter::Iterator;
11826 self.parameters = v.into_iter().map(|i| i.into()).collect();
11827 self
11828 }
11829}
11830
11831impl wkt::message::Message for SystemParameterRule {
11832 fn typename() -> &'static str {
11833 "type.googleapis.com/google.api.SystemParameterRule"
11834 }
11835}
11836
11837/// Define a parameter's name and location. The parameter may be passed as either
11838/// an HTTP header or a URL query parameter, and if both are passed the behavior
11839/// is implementation-dependent.
11840#[derive(Clone, Default, PartialEq)]
11841#[non_exhaustive]
11842pub struct SystemParameter {
11843 /// Define the name of the parameter, such as "api_key" . It is case sensitive.
11844 pub name: std::string::String,
11845
11846 /// Define the HTTP header name to use for the parameter. It is case
11847 /// insensitive.
11848 pub http_header: std::string::String,
11849
11850 /// Define the URL query parameter name to use for the parameter. It is case
11851 /// sensitive.
11852 pub url_query_parameter: std::string::String,
11853
11854 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11855}
11856
11857impl SystemParameter {
11858 pub fn new() -> Self {
11859 std::default::Default::default()
11860 }
11861
11862 /// Sets the value of [name][crate::model::SystemParameter::name].
11863 ///
11864 /// # Example
11865 /// ```ignore,no_run
11866 /// # use google_cloud_api::model::SystemParameter;
11867 /// let x = SystemParameter::new().set_name("example");
11868 /// ```
11869 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11870 self.name = v.into();
11871 self
11872 }
11873
11874 /// Sets the value of [http_header][crate::model::SystemParameter::http_header].
11875 ///
11876 /// # Example
11877 /// ```ignore,no_run
11878 /// # use google_cloud_api::model::SystemParameter;
11879 /// let x = SystemParameter::new().set_http_header("example");
11880 /// ```
11881 pub fn set_http_header<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11882 self.http_header = v.into();
11883 self
11884 }
11885
11886 /// Sets the value of [url_query_parameter][crate::model::SystemParameter::url_query_parameter].
11887 ///
11888 /// # Example
11889 /// ```ignore,no_run
11890 /// # use google_cloud_api::model::SystemParameter;
11891 /// let x = SystemParameter::new().set_url_query_parameter("example");
11892 /// ```
11893 pub fn set_url_query_parameter<T: std::convert::Into<std::string::String>>(
11894 mut self,
11895 v: T,
11896 ) -> Self {
11897 self.url_query_parameter = v.into();
11898 self
11899 }
11900}
11901
11902impl wkt::message::Message for SystemParameter {
11903 fn typename() -> &'static str {
11904 "type.googleapis.com/google.api.SystemParameter"
11905 }
11906}
11907
11908/// Configuration controlling usage of a service.
11909#[derive(Clone, Default, PartialEq)]
11910#[non_exhaustive]
11911pub struct Usage {
11912 /// Requirements that must be satisfied before a consumer project can use the
11913 /// service. Each requirement is of the form <service.name>/\<requirement-id\>;
11914 /// for example 'serviceusage.googleapis.com/billing-enabled'.
11915 ///
11916 /// For Google APIs, a Terms of Service requirement must be included here.
11917 /// Google Cloud APIs must include "serviceusage.googleapis.com/tos/cloud".
11918 /// Other Google APIs should include
11919 /// "serviceusage.googleapis.com/tos/universal". Additional ToS can be
11920 /// included based on the business needs.
11921 pub requirements: std::vec::Vec<std::string::String>,
11922
11923 /// A list of usage rules that apply to individual API methods.
11924 ///
11925 /// **NOTE:** All service configuration rules follow "last one wins" order.
11926 pub rules: std::vec::Vec<crate::model::UsageRule>,
11927
11928 /// The full resource name of a channel used for sending notifications to the
11929 /// service producer.
11930 ///
11931 /// Google Service Management currently only supports
11932 /// [Google Cloud Pub/Sub](https://cloud.google.com/pubsub) as a notification
11933 /// channel. To use Google Cloud Pub/Sub as the channel, this must be the name
11934 /// of a Cloud Pub/Sub topic that uses the Cloud Pub/Sub topic name format
11935 /// documented in <https://cloud.google.com/pubsub/docs/overview>.
11936 pub producer_notification_channel: std::string::String,
11937
11938 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11939}
11940
11941impl Usage {
11942 pub fn new() -> Self {
11943 std::default::Default::default()
11944 }
11945
11946 /// Sets the value of [requirements][crate::model::Usage::requirements].
11947 ///
11948 /// # Example
11949 /// ```ignore,no_run
11950 /// # use google_cloud_api::model::Usage;
11951 /// let x = Usage::new().set_requirements(["a", "b", "c"]);
11952 /// ```
11953 pub fn set_requirements<T, V>(mut self, v: T) -> Self
11954 where
11955 T: std::iter::IntoIterator<Item = V>,
11956 V: std::convert::Into<std::string::String>,
11957 {
11958 use std::iter::Iterator;
11959 self.requirements = v.into_iter().map(|i| i.into()).collect();
11960 self
11961 }
11962
11963 /// Sets the value of [rules][crate::model::Usage::rules].
11964 ///
11965 /// # Example
11966 /// ```ignore,no_run
11967 /// # use google_cloud_api::model::Usage;
11968 /// use google_cloud_api::model::UsageRule;
11969 /// let x = Usage::new()
11970 /// .set_rules([
11971 /// UsageRule::default()/* use setters */,
11972 /// UsageRule::default()/* use (different) setters */,
11973 /// ]);
11974 /// ```
11975 pub fn set_rules<T, V>(mut self, v: T) -> Self
11976 where
11977 T: std::iter::IntoIterator<Item = V>,
11978 V: std::convert::Into<crate::model::UsageRule>,
11979 {
11980 use std::iter::Iterator;
11981 self.rules = v.into_iter().map(|i| i.into()).collect();
11982 self
11983 }
11984
11985 /// Sets the value of [producer_notification_channel][crate::model::Usage::producer_notification_channel].
11986 ///
11987 /// # Example
11988 /// ```ignore,no_run
11989 /// # use google_cloud_api::model::Usage;
11990 /// let x = Usage::new().set_producer_notification_channel("example");
11991 /// ```
11992 pub fn set_producer_notification_channel<T: std::convert::Into<std::string::String>>(
11993 mut self,
11994 v: T,
11995 ) -> Self {
11996 self.producer_notification_channel = v.into();
11997 self
11998 }
11999}
12000
12001impl wkt::message::Message for Usage {
12002 fn typename() -> &'static str {
12003 "type.googleapis.com/google.api.Usage"
12004 }
12005}
12006
12007/// Usage configuration rules for the service.
12008#[derive(Clone, Default, PartialEq)]
12009#[non_exhaustive]
12010pub struct UsageRule {
12011 /// Selects the methods to which this rule applies. Use '*' to indicate all
12012 /// methods in all APIs.
12013 ///
12014 /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
12015 /// details.
12016 ///
12017 /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
12018 pub selector: std::string::String,
12019
12020 /// Use this rule to configure unregistered calls for the service. Unregistered
12021 /// calls are calls that do not contain consumer project identity.
12022 /// (Example: calls that do not contain an API key).
12023 ///
12024 /// WARNING: By default, API methods do not allow unregistered calls, and each
12025 /// method call must be identified by a consumer project identity.
12026 pub allow_unregistered_calls: bool,
12027
12028 /// If true, the selected method should skip service control and the control
12029 /// plane features, such as quota and billing, will not be available.
12030 /// This flag is used by Google Cloud Endpoints to bypass checks for internal
12031 /// methods, such as service health check methods.
12032 pub skip_service_control: bool,
12033
12034 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12035}
12036
12037impl UsageRule {
12038 pub fn new() -> Self {
12039 std::default::Default::default()
12040 }
12041
12042 /// Sets the value of [selector][crate::model::UsageRule::selector].
12043 ///
12044 /// # Example
12045 /// ```ignore,no_run
12046 /// # use google_cloud_api::model::UsageRule;
12047 /// let x = UsageRule::new().set_selector("example");
12048 /// ```
12049 pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12050 self.selector = v.into();
12051 self
12052 }
12053
12054 /// Sets the value of [allow_unregistered_calls][crate::model::UsageRule::allow_unregistered_calls].
12055 ///
12056 /// # Example
12057 /// ```ignore,no_run
12058 /// # use google_cloud_api::model::UsageRule;
12059 /// let x = UsageRule::new().set_allow_unregistered_calls(true);
12060 /// ```
12061 pub fn set_allow_unregistered_calls<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12062 self.allow_unregistered_calls = v.into();
12063 self
12064 }
12065
12066 /// Sets the value of [skip_service_control][crate::model::UsageRule::skip_service_control].
12067 ///
12068 /// # Example
12069 /// ```ignore,no_run
12070 /// # use google_cloud_api::model::UsageRule;
12071 /// let x = UsageRule::new().set_skip_service_control(true);
12072 /// ```
12073 pub fn set_skip_service_control<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12074 self.skip_service_control = v.into();
12075 self
12076 }
12077}
12078
12079impl wkt::message::Message for UsageRule {
12080 fn typename() -> &'static str {
12081 "type.googleapis.com/google.api.UsageRule"
12082 }
12083}
12084
12085/// `Visibility` restricts service consumer's access to service elements,
12086/// such as whether an application can call a visibility-restricted method.
12087/// The restriction is expressed by applying visibility labels on service
12088/// elements. The visibility labels are elsewhere linked to service consumers.
12089///
12090/// A service can define multiple visibility labels, but a service consumer
12091/// should be granted at most one visibility label. Multiple visibility
12092/// labels for a single service consumer are not supported.
12093///
12094/// If an element and all its parents have no visibility label, its visibility
12095/// is unconditionally granted.
12096///
12097/// Example:
12098///
12099/// ```norust
12100/// visibility:
12101/// rules:
12102/// - selector: google.calendar.Calendar.EnhancedSearch
12103/// restriction: PREVIEW
12104/// - selector: google.calendar.Calendar.Delegate
12105/// restriction: INTERNAL
12106/// ```
12107///
12108/// Here, all methods are publicly visible except for the restricted methods
12109/// EnhancedSearch and Delegate.
12110#[derive(Clone, Default, PartialEq)]
12111#[non_exhaustive]
12112pub struct Visibility {
12113 /// A list of visibility rules that apply to individual API elements.
12114 ///
12115 /// **NOTE:** All service configuration rules follow "last one wins" order.
12116 pub rules: std::vec::Vec<crate::model::VisibilityRule>,
12117
12118 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12119}
12120
12121impl Visibility {
12122 pub fn new() -> Self {
12123 std::default::Default::default()
12124 }
12125
12126 /// Sets the value of [rules][crate::model::Visibility::rules].
12127 ///
12128 /// # Example
12129 /// ```ignore,no_run
12130 /// # use google_cloud_api::model::Visibility;
12131 /// use google_cloud_api::model::VisibilityRule;
12132 /// let x = Visibility::new()
12133 /// .set_rules([
12134 /// VisibilityRule::default()/* use setters */,
12135 /// VisibilityRule::default()/* use (different) setters */,
12136 /// ]);
12137 /// ```
12138 pub fn set_rules<T, V>(mut self, v: T) -> Self
12139 where
12140 T: std::iter::IntoIterator<Item = V>,
12141 V: std::convert::Into<crate::model::VisibilityRule>,
12142 {
12143 use std::iter::Iterator;
12144 self.rules = v.into_iter().map(|i| i.into()).collect();
12145 self
12146 }
12147}
12148
12149impl wkt::message::Message for Visibility {
12150 fn typename() -> &'static str {
12151 "type.googleapis.com/google.api.Visibility"
12152 }
12153}
12154
12155/// A visibility rule provides visibility configuration for an individual API
12156/// element.
12157#[derive(Clone, Default, PartialEq)]
12158#[non_exhaustive]
12159pub struct VisibilityRule {
12160 /// Selects methods, messages, fields, enums, etc. to which this rule applies.
12161 ///
12162 /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
12163 /// details.
12164 ///
12165 /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
12166 pub selector: std::string::String,
12167
12168 /// A comma-separated list of visibility labels that apply to the `selector`.
12169 /// Any of the listed labels can be used to grant the visibility.
12170 ///
12171 /// If a rule has multiple labels, removing one of the labels but not all of
12172 /// them can break clients.
12173 ///
12174 /// Example:
12175 ///
12176 /// ```norust
12177 /// visibility:
12178 /// rules:
12179 /// - selector: google.calendar.Calendar.EnhancedSearch
12180 /// restriction: INTERNAL, PREVIEW
12181 /// ```
12182 ///
12183 /// Removing INTERNAL from this restriction will break clients that rely on
12184 /// this method and only had access to it through INTERNAL.
12185 pub restriction: std::string::String,
12186
12187 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12188}
12189
12190impl VisibilityRule {
12191 pub fn new() -> Self {
12192 std::default::Default::default()
12193 }
12194
12195 /// Sets the value of [selector][crate::model::VisibilityRule::selector].
12196 ///
12197 /// # Example
12198 /// ```ignore,no_run
12199 /// # use google_cloud_api::model::VisibilityRule;
12200 /// let x = VisibilityRule::new().set_selector("example");
12201 /// ```
12202 pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12203 self.selector = v.into();
12204 self
12205 }
12206
12207 /// Sets the value of [restriction][crate::model::VisibilityRule::restriction].
12208 ///
12209 /// # Example
12210 /// ```ignore,no_run
12211 /// # use google_cloud_api::model::VisibilityRule;
12212 /// let x = VisibilityRule::new().set_restriction("example");
12213 /// ```
12214 pub fn set_restriction<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12215 self.restriction = v.into();
12216 self
12217 }
12218}
12219
12220impl wkt::message::Message for VisibilityRule {
12221 fn typename() -> &'static str {
12222 "type.googleapis.com/google.api.VisibilityRule"
12223 }
12224}
12225
12226/// The organization for which the client libraries are being published.
12227/// Affects the url where generated docs are published, etc.
12228///
12229/// # Working with unknown values
12230///
12231/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12232/// additional enum variants at any time. Adding new variants is not considered
12233/// a breaking change. Applications should write their code in anticipation of:
12234///
12235/// - New values appearing in future releases of the client library, **and**
12236/// - New values received dynamically, without application changes.
12237///
12238/// Please consult the [Working with enums] section in the user guide for some
12239/// guidelines.
12240///
12241/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
12242#[derive(Clone, Debug, PartialEq)]
12243#[non_exhaustive]
12244pub enum ClientLibraryOrganization {
12245 /// Not useful.
12246 Unspecified,
12247 /// Google Cloud Platform Org.
12248 Cloud,
12249 /// Ads (Advertising) Org.
12250 Ads,
12251 /// Photos Org.
12252 Photos,
12253 /// Street View Org.
12254 StreetView,
12255 /// Shopping Org.
12256 Shopping,
12257 /// Geo Org.
12258 Geo,
12259 /// Generative AI - <https://developers.generativeai.google>
12260 GenerativeAi,
12261 /// If set, the enum was initialized with an unknown value.
12262 ///
12263 /// Applications can examine the value using [ClientLibraryOrganization::value] or
12264 /// [ClientLibraryOrganization::name].
12265 UnknownValue(client_library_organization::UnknownValue),
12266}
12267
12268#[doc(hidden)]
12269pub mod client_library_organization {
12270 #[allow(unused_imports)]
12271 use super::*;
12272 #[derive(Clone, Debug, PartialEq)]
12273 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
12274}
12275
12276impl ClientLibraryOrganization {
12277 /// Gets the enum value.
12278 ///
12279 /// Returns `None` if the enum contains an unknown value deserialized from
12280 /// the string representation of enums.
12281 pub fn value(&self) -> std::option::Option<i32> {
12282 match self {
12283 Self::Unspecified => std::option::Option::Some(0),
12284 Self::Cloud => std::option::Option::Some(1),
12285 Self::Ads => std::option::Option::Some(2),
12286 Self::Photos => std::option::Option::Some(3),
12287 Self::StreetView => std::option::Option::Some(4),
12288 Self::Shopping => std::option::Option::Some(5),
12289 Self::Geo => std::option::Option::Some(6),
12290 Self::GenerativeAi => std::option::Option::Some(7),
12291 Self::UnknownValue(u) => u.0.value(),
12292 }
12293 }
12294
12295 /// Gets the enum value as a string.
12296 ///
12297 /// Returns `None` if the enum contains an unknown value deserialized from
12298 /// the integer representation of enums.
12299 pub fn name(&self) -> std::option::Option<&str> {
12300 match self {
12301 Self::Unspecified => {
12302 std::option::Option::Some("CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED")
12303 }
12304 Self::Cloud => std::option::Option::Some("CLOUD"),
12305 Self::Ads => std::option::Option::Some("ADS"),
12306 Self::Photos => std::option::Option::Some("PHOTOS"),
12307 Self::StreetView => std::option::Option::Some("STREET_VIEW"),
12308 Self::Shopping => std::option::Option::Some("SHOPPING"),
12309 Self::Geo => std::option::Option::Some("GEO"),
12310 Self::GenerativeAi => std::option::Option::Some("GENERATIVE_AI"),
12311 Self::UnknownValue(u) => u.0.name(),
12312 }
12313 }
12314}
12315
12316impl std::default::Default for ClientLibraryOrganization {
12317 fn default() -> Self {
12318 use std::convert::From;
12319 Self::from(0)
12320 }
12321}
12322
12323impl std::fmt::Display for ClientLibraryOrganization {
12324 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
12325 wkt::internal::display_enum(f, self.name(), self.value())
12326 }
12327}
12328
12329impl std::convert::From<i32> for ClientLibraryOrganization {
12330 fn from(value: i32) -> Self {
12331 match value {
12332 0 => Self::Unspecified,
12333 1 => Self::Cloud,
12334 2 => Self::Ads,
12335 3 => Self::Photos,
12336 4 => Self::StreetView,
12337 5 => Self::Shopping,
12338 6 => Self::Geo,
12339 7 => Self::GenerativeAi,
12340 _ => Self::UnknownValue(client_library_organization::UnknownValue(
12341 wkt::internal::UnknownEnumValue::Integer(value),
12342 )),
12343 }
12344 }
12345}
12346
12347impl std::convert::From<&str> for ClientLibraryOrganization {
12348 fn from(value: &str) -> Self {
12349 use std::string::ToString;
12350 match value {
12351 "CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED" => Self::Unspecified,
12352 "CLOUD" => Self::Cloud,
12353 "ADS" => Self::Ads,
12354 "PHOTOS" => Self::Photos,
12355 "STREET_VIEW" => Self::StreetView,
12356 "SHOPPING" => Self::Shopping,
12357 "GEO" => Self::Geo,
12358 "GENERATIVE_AI" => Self::GenerativeAi,
12359 _ => Self::UnknownValue(client_library_organization::UnknownValue(
12360 wkt::internal::UnknownEnumValue::String(value.to_string()),
12361 )),
12362 }
12363 }
12364}
12365
12366impl serde::ser::Serialize for ClientLibraryOrganization {
12367 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12368 where
12369 S: serde::Serializer,
12370 {
12371 match self {
12372 Self::Unspecified => serializer.serialize_i32(0),
12373 Self::Cloud => serializer.serialize_i32(1),
12374 Self::Ads => serializer.serialize_i32(2),
12375 Self::Photos => serializer.serialize_i32(3),
12376 Self::StreetView => serializer.serialize_i32(4),
12377 Self::Shopping => serializer.serialize_i32(5),
12378 Self::Geo => serializer.serialize_i32(6),
12379 Self::GenerativeAi => serializer.serialize_i32(7),
12380 Self::UnknownValue(u) => u.0.serialize(serializer),
12381 }
12382 }
12383}
12384
12385impl<'de> serde::de::Deserialize<'de> for ClientLibraryOrganization {
12386 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12387 where
12388 D: serde::Deserializer<'de>,
12389 {
12390 deserializer.deserialize_any(
12391 wkt::internal::EnumVisitor::<ClientLibraryOrganization>::new(
12392 ".google.api.ClientLibraryOrganization",
12393 ),
12394 )
12395 }
12396}
12397
12398/// To where should client libraries be published?
12399///
12400/// # Working with unknown values
12401///
12402/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12403/// additional enum variants at any time. Adding new variants is not considered
12404/// a breaking change. Applications should write their code in anticipation of:
12405///
12406/// - New values appearing in future releases of the client library, **and**
12407/// - New values received dynamically, without application changes.
12408///
12409/// Please consult the [Working with enums] section in the user guide for some
12410/// guidelines.
12411///
12412/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
12413#[derive(Clone, Debug, PartialEq)]
12414#[non_exhaustive]
12415pub enum ClientLibraryDestination {
12416 /// Client libraries will neither be generated nor published to package
12417 /// managers.
12418 Unspecified,
12419 /// Generate the client library in a repo under github.com/googleapis,
12420 /// but don't publish it to package managers.
12421 Github,
12422 /// Publish the library to package managers like nuget.org and npmjs.com.
12423 PackageManager,
12424 /// If set, the enum was initialized with an unknown value.
12425 ///
12426 /// Applications can examine the value using [ClientLibraryDestination::value] or
12427 /// [ClientLibraryDestination::name].
12428 UnknownValue(client_library_destination::UnknownValue),
12429}
12430
12431#[doc(hidden)]
12432pub mod client_library_destination {
12433 #[allow(unused_imports)]
12434 use super::*;
12435 #[derive(Clone, Debug, PartialEq)]
12436 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
12437}
12438
12439impl ClientLibraryDestination {
12440 /// Gets the enum value.
12441 ///
12442 /// Returns `None` if the enum contains an unknown value deserialized from
12443 /// the string representation of enums.
12444 pub fn value(&self) -> std::option::Option<i32> {
12445 match self {
12446 Self::Unspecified => std::option::Option::Some(0),
12447 Self::Github => std::option::Option::Some(10),
12448 Self::PackageManager => std::option::Option::Some(20),
12449 Self::UnknownValue(u) => u.0.value(),
12450 }
12451 }
12452
12453 /// Gets the enum value as a string.
12454 ///
12455 /// Returns `None` if the enum contains an unknown value deserialized from
12456 /// the integer representation of enums.
12457 pub fn name(&self) -> std::option::Option<&str> {
12458 match self {
12459 Self::Unspecified => {
12460 std::option::Option::Some("CLIENT_LIBRARY_DESTINATION_UNSPECIFIED")
12461 }
12462 Self::Github => std::option::Option::Some("GITHUB"),
12463 Self::PackageManager => std::option::Option::Some("PACKAGE_MANAGER"),
12464 Self::UnknownValue(u) => u.0.name(),
12465 }
12466 }
12467}
12468
12469impl std::default::Default for ClientLibraryDestination {
12470 fn default() -> Self {
12471 use std::convert::From;
12472 Self::from(0)
12473 }
12474}
12475
12476impl std::fmt::Display for ClientLibraryDestination {
12477 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
12478 wkt::internal::display_enum(f, self.name(), self.value())
12479 }
12480}
12481
12482impl std::convert::From<i32> for ClientLibraryDestination {
12483 fn from(value: i32) -> Self {
12484 match value {
12485 0 => Self::Unspecified,
12486 10 => Self::Github,
12487 20 => Self::PackageManager,
12488 _ => Self::UnknownValue(client_library_destination::UnknownValue(
12489 wkt::internal::UnknownEnumValue::Integer(value),
12490 )),
12491 }
12492 }
12493}
12494
12495impl std::convert::From<&str> for ClientLibraryDestination {
12496 fn from(value: &str) -> Self {
12497 use std::string::ToString;
12498 match value {
12499 "CLIENT_LIBRARY_DESTINATION_UNSPECIFIED" => Self::Unspecified,
12500 "GITHUB" => Self::Github,
12501 "PACKAGE_MANAGER" => Self::PackageManager,
12502 _ => Self::UnknownValue(client_library_destination::UnknownValue(
12503 wkt::internal::UnknownEnumValue::String(value.to_string()),
12504 )),
12505 }
12506 }
12507}
12508
12509impl serde::ser::Serialize for ClientLibraryDestination {
12510 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12511 where
12512 S: serde::Serializer,
12513 {
12514 match self {
12515 Self::Unspecified => serializer.serialize_i32(0),
12516 Self::Github => serializer.serialize_i32(10),
12517 Self::PackageManager => serializer.serialize_i32(20),
12518 Self::UnknownValue(u) => u.0.serialize(serializer),
12519 }
12520 }
12521}
12522
12523impl<'de> serde::de::Deserialize<'de> for ClientLibraryDestination {
12524 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12525 where
12526 D: serde::Deserializer<'de>,
12527 {
12528 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ClientLibraryDestination>::new(
12529 ".google.api.ClientLibraryDestination",
12530 ))
12531 }
12532}
12533
12534/// The behavior to take when the flow control limit is exceeded.
12535///
12536/// # Working with unknown values
12537///
12538/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12539/// additional enum variants at any time. Adding new variants is not considered
12540/// a breaking change. Applications should write their code in anticipation of:
12541///
12542/// - New values appearing in future releases of the client library, **and**
12543/// - New values received dynamically, without application changes.
12544///
12545/// Please consult the [Working with enums] section in the user guide for some
12546/// guidelines.
12547///
12548/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
12549#[derive(Clone, Debug, PartialEq)]
12550#[non_exhaustive]
12551pub enum FlowControlLimitExceededBehaviorProto {
12552 /// Default behavior, system-defined.
12553 UnsetBehavior,
12554 /// Stop operation, raise error.
12555 ThrowException,
12556 /// Pause operation until limit clears.
12557 Block,
12558 /// Continue operation, disregard limit.
12559 Ignore,
12560 /// If set, the enum was initialized with an unknown value.
12561 ///
12562 /// Applications can examine the value using [FlowControlLimitExceededBehaviorProto::value] or
12563 /// [FlowControlLimitExceededBehaviorProto::name].
12564 UnknownValue(flow_control_limit_exceeded_behavior_proto::UnknownValue),
12565}
12566
12567#[doc(hidden)]
12568pub mod flow_control_limit_exceeded_behavior_proto {
12569 #[allow(unused_imports)]
12570 use super::*;
12571 #[derive(Clone, Debug, PartialEq)]
12572 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
12573}
12574
12575impl FlowControlLimitExceededBehaviorProto {
12576 /// Gets the enum value.
12577 ///
12578 /// Returns `None` if the enum contains an unknown value deserialized from
12579 /// the string representation of enums.
12580 pub fn value(&self) -> std::option::Option<i32> {
12581 match self {
12582 Self::UnsetBehavior => std::option::Option::Some(0),
12583 Self::ThrowException => std::option::Option::Some(1),
12584 Self::Block => std::option::Option::Some(2),
12585 Self::Ignore => std::option::Option::Some(3),
12586 Self::UnknownValue(u) => u.0.value(),
12587 }
12588 }
12589
12590 /// Gets the enum value as a string.
12591 ///
12592 /// Returns `None` if the enum contains an unknown value deserialized from
12593 /// the integer representation of enums.
12594 pub fn name(&self) -> std::option::Option<&str> {
12595 match self {
12596 Self::UnsetBehavior => std::option::Option::Some("UNSET_BEHAVIOR"),
12597 Self::ThrowException => std::option::Option::Some("THROW_EXCEPTION"),
12598 Self::Block => std::option::Option::Some("BLOCK"),
12599 Self::Ignore => std::option::Option::Some("IGNORE"),
12600 Self::UnknownValue(u) => u.0.name(),
12601 }
12602 }
12603}
12604
12605impl std::default::Default for FlowControlLimitExceededBehaviorProto {
12606 fn default() -> Self {
12607 use std::convert::From;
12608 Self::from(0)
12609 }
12610}
12611
12612impl std::fmt::Display for FlowControlLimitExceededBehaviorProto {
12613 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
12614 wkt::internal::display_enum(f, self.name(), self.value())
12615 }
12616}
12617
12618impl std::convert::From<i32> for FlowControlLimitExceededBehaviorProto {
12619 fn from(value: i32) -> Self {
12620 match value {
12621 0 => Self::UnsetBehavior,
12622 1 => Self::ThrowException,
12623 2 => Self::Block,
12624 3 => Self::Ignore,
12625 _ => Self::UnknownValue(flow_control_limit_exceeded_behavior_proto::UnknownValue(
12626 wkt::internal::UnknownEnumValue::Integer(value),
12627 )),
12628 }
12629 }
12630}
12631
12632impl std::convert::From<&str> for FlowControlLimitExceededBehaviorProto {
12633 fn from(value: &str) -> Self {
12634 use std::string::ToString;
12635 match value {
12636 "UNSET_BEHAVIOR" => Self::UnsetBehavior,
12637 "THROW_EXCEPTION" => Self::ThrowException,
12638 "BLOCK" => Self::Block,
12639 "IGNORE" => Self::Ignore,
12640 _ => Self::UnknownValue(flow_control_limit_exceeded_behavior_proto::UnknownValue(
12641 wkt::internal::UnknownEnumValue::String(value.to_string()),
12642 )),
12643 }
12644 }
12645}
12646
12647impl serde::ser::Serialize for FlowControlLimitExceededBehaviorProto {
12648 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12649 where
12650 S: serde::Serializer,
12651 {
12652 match self {
12653 Self::UnsetBehavior => serializer.serialize_i32(0),
12654 Self::ThrowException => serializer.serialize_i32(1),
12655 Self::Block => serializer.serialize_i32(2),
12656 Self::Ignore => serializer.serialize_i32(3),
12657 Self::UnknownValue(u) => u.0.serialize(serializer),
12658 }
12659 }
12660}
12661
12662impl<'de> serde::de::Deserialize<'de> for FlowControlLimitExceededBehaviorProto {
12663 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12664 where
12665 D: serde::Deserializer<'de>,
12666 {
12667 deserializer.deserialize_any(wkt::internal::EnumVisitor::<
12668 FlowControlLimitExceededBehaviorProto,
12669 >::new(
12670 ".google.api.FlowControlLimitExceededBehaviorProto"
12671 ))
12672 }
12673}
12674
12675/// Classifies set of possible modifications to an object in the service
12676/// configuration.
12677///
12678/// # Working with unknown values
12679///
12680/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12681/// additional enum variants at any time. Adding new variants is not considered
12682/// a breaking change. Applications should write their code in anticipation of:
12683///
12684/// - New values appearing in future releases of the client library, **and**
12685/// - New values received dynamically, without application changes.
12686///
12687/// Please consult the [Working with enums] section in the user guide for some
12688/// guidelines.
12689///
12690/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
12691#[derive(Clone, Debug, PartialEq)]
12692#[non_exhaustive]
12693pub enum ChangeType {
12694 /// No value was provided.
12695 Unspecified,
12696 /// The changed object exists in the 'new' service configuration, but not
12697 /// in the 'old' service configuration.
12698 Added,
12699 /// The changed object exists in the 'old' service configuration, but not
12700 /// in the 'new' service configuration.
12701 Removed,
12702 /// The changed object exists in both service configurations, but its value
12703 /// is different.
12704 Modified,
12705 /// If set, the enum was initialized with an unknown value.
12706 ///
12707 /// Applications can examine the value using [ChangeType::value] or
12708 /// [ChangeType::name].
12709 UnknownValue(change_type::UnknownValue),
12710}
12711
12712#[doc(hidden)]
12713pub mod change_type {
12714 #[allow(unused_imports)]
12715 use super::*;
12716 #[derive(Clone, Debug, PartialEq)]
12717 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
12718}
12719
12720impl ChangeType {
12721 /// Gets the enum value.
12722 ///
12723 /// Returns `None` if the enum contains an unknown value deserialized from
12724 /// the string representation of enums.
12725 pub fn value(&self) -> std::option::Option<i32> {
12726 match self {
12727 Self::Unspecified => std::option::Option::Some(0),
12728 Self::Added => std::option::Option::Some(1),
12729 Self::Removed => std::option::Option::Some(2),
12730 Self::Modified => std::option::Option::Some(3),
12731 Self::UnknownValue(u) => u.0.value(),
12732 }
12733 }
12734
12735 /// Gets the enum value as a string.
12736 ///
12737 /// Returns `None` if the enum contains an unknown value deserialized from
12738 /// the integer representation of enums.
12739 pub fn name(&self) -> std::option::Option<&str> {
12740 match self {
12741 Self::Unspecified => std::option::Option::Some("CHANGE_TYPE_UNSPECIFIED"),
12742 Self::Added => std::option::Option::Some("ADDED"),
12743 Self::Removed => std::option::Option::Some("REMOVED"),
12744 Self::Modified => std::option::Option::Some("MODIFIED"),
12745 Self::UnknownValue(u) => u.0.name(),
12746 }
12747 }
12748}
12749
12750impl std::default::Default for ChangeType {
12751 fn default() -> Self {
12752 use std::convert::From;
12753 Self::from(0)
12754 }
12755}
12756
12757impl std::fmt::Display for ChangeType {
12758 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
12759 wkt::internal::display_enum(f, self.name(), self.value())
12760 }
12761}
12762
12763impl std::convert::From<i32> for ChangeType {
12764 fn from(value: i32) -> Self {
12765 match value {
12766 0 => Self::Unspecified,
12767 1 => Self::Added,
12768 2 => Self::Removed,
12769 3 => Self::Modified,
12770 _ => Self::UnknownValue(change_type::UnknownValue(
12771 wkt::internal::UnknownEnumValue::Integer(value),
12772 )),
12773 }
12774 }
12775}
12776
12777impl std::convert::From<&str> for ChangeType {
12778 fn from(value: &str) -> Self {
12779 use std::string::ToString;
12780 match value {
12781 "CHANGE_TYPE_UNSPECIFIED" => Self::Unspecified,
12782 "ADDED" => Self::Added,
12783 "REMOVED" => Self::Removed,
12784 "MODIFIED" => Self::Modified,
12785 _ => Self::UnknownValue(change_type::UnknownValue(
12786 wkt::internal::UnknownEnumValue::String(value.to_string()),
12787 )),
12788 }
12789 }
12790}
12791
12792impl serde::ser::Serialize for ChangeType {
12793 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12794 where
12795 S: serde::Serializer,
12796 {
12797 match self {
12798 Self::Unspecified => serializer.serialize_i32(0),
12799 Self::Added => serializer.serialize_i32(1),
12800 Self::Removed => serializer.serialize_i32(2),
12801 Self::Modified => serializer.serialize_i32(3),
12802 Self::UnknownValue(u) => u.0.serialize(serializer),
12803 }
12804 }
12805}
12806
12807impl<'de> serde::de::Deserialize<'de> for ChangeType {
12808 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12809 where
12810 D: serde::Deserializer<'de>,
12811 {
12812 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ChangeType>::new(
12813 ".google.api.ChangeType",
12814 ))
12815 }
12816}
12817
12818/// Defines the supported values for `google.rpc.ErrorInfo.reason` for the
12819/// `googleapis.com` error domain. This error domain is reserved for [Service
12820/// Infrastructure](https://cloud.google.com/service-infrastructure/docs/overview).
12821/// For each error info of this domain, the metadata key "service" refers to the
12822/// logical identifier of an API service, such as "pubsub.googleapis.com". The
12823/// "consumer" refers to the entity that consumes an API Service. It typically is
12824/// a Google project that owns the client application or the server resource,
12825/// such as "projects/123". Other metadata keys are specific to each error
12826/// reason. For more information, see the definition of the specific error
12827/// reason.
12828///
12829/// # Working with unknown values
12830///
12831/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12832/// additional enum variants at any time. Adding new variants is not considered
12833/// a breaking change. Applications should write their code in anticipation of:
12834///
12835/// - New values appearing in future releases of the client library, **and**
12836/// - New values received dynamically, without application changes.
12837///
12838/// Please consult the [Working with enums] section in the user guide for some
12839/// guidelines.
12840///
12841/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
12842#[derive(Clone, Debug, PartialEq)]
12843#[non_exhaustive]
12844pub enum ErrorReason {
12845 /// Do not use this default value.
12846 Unspecified,
12847 /// The request is calling a disabled service for a consumer.
12848 ///
12849 /// Example of an ErrorInfo when the consumer "projects/123" contacting
12850 /// "pubsub.googleapis.com" service which is disabled:
12851 ///
12852 /// ```norust
12853 /// { "reason": "SERVICE_DISABLED",
12854 /// "domain": "googleapis.com",
12855 /// "metadata": {
12856 /// "consumer": "projects/123",
12857 /// "service": "pubsub.googleapis.com"
12858 /// }
12859 /// }
12860 /// ```
12861 ///
12862 /// This response indicates the "pubsub.googleapis.com" has been disabled in
12863 /// "projects/123".
12864 ServiceDisabled,
12865 /// The request whose associated billing account is disabled.
12866 ///
12867 /// Example of an ErrorInfo when the consumer "projects/123" fails to contact
12868 /// "pubsub.googleapis.com" service because the associated billing account is
12869 /// disabled:
12870 ///
12871 /// ```norust
12872 /// { "reason": "BILLING_DISABLED",
12873 /// "domain": "googleapis.com",
12874 /// "metadata": {
12875 /// "consumer": "projects/123",
12876 /// "service": "pubsub.googleapis.com"
12877 /// }
12878 /// }
12879 /// ```
12880 ///
12881 /// This response indicates the billing account associated has been disabled.
12882 BillingDisabled,
12883 /// The request is denied because the provided [API
12884 /// key](https://cloud.google.com/docs/authentication/api-keys) is invalid. It
12885 /// may be in a bad format, cannot be found, or has been expired).
12886 ///
12887 /// Example of an ErrorInfo when the request is contacting
12888 /// "storage.googleapis.com" service with an invalid API key:
12889 ///
12890 /// ```norust
12891 /// { "reason": "API_KEY_INVALID",
12892 /// "domain": "googleapis.com",
12893 /// "metadata": {
12894 /// "service": "storage.googleapis.com",
12895 /// }
12896 /// }
12897 /// ```
12898 ApiKeyInvalid,
12899 /// The request is denied because it violates [API key API
12900 /// restrictions](https://cloud.google.com/docs/authentication/api-keys#adding_api_restrictions).
12901 ///
12902 /// Example of an ErrorInfo when the consumer "projects/123" fails to call the
12903 /// "storage.googleapis.com" service because this service is restricted in the
12904 /// API key:
12905 ///
12906 /// ```norust
12907 /// { "reason": "API_KEY_SERVICE_BLOCKED",
12908 /// "domain": "googleapis.com",
12909 /// "metadata": {
12910 /// "consumer": "projects/123",
12911 /// "service": "storage.googleapis.com"
12912 /// }
12913 /// }
12914 /// ```
12915 ApiKeyServiceBlocked,
12916 /// The request is denied because it violates [API key HTTP
12917 /// restrictions](https://cloud.google.com/docs/authentication/api-keys#adding_http_restrictions).
12918 ///
12919 /// Example of an ErrorInfo when the consumer "projects/123" fails to call
12920 /// "storage.googleapis.com" service because the http referrer of the request
12921 /// violates API key HTTP restrictions:
12922 ///
12923 /// ```norust
12924 /// { "reason": "API_KEY_HTTP_REFERRER_BLOCKED",
12925 /// "domain": "googleapis.com",
12926 /// "metadata": {
12927 /// "consumer": "projects/123",
12928 /// "service": "storage.googleapis.com",
12929 /// }
12930 /// }
12931 /// ```
12932 ApiKeyHttpReferrerBlocked,
12933 /// The request is denied because it violates [API key IP address
12934 /// restrictions](https://cloud.google.com/docs/authentication/api-keys#adding_application_restrictions).
12935 ///
12936 /// Example of an ErrorInfo when the consumer "projects/123" fails to call
12937 /// "storage.googleapis.com" service because the caller IP of the request
12938 /// violates API key IP address restrictions:
12939 ///
12940 /// ```norust
12941 /// { "reason": "API_KEY_IP_ADDRESS_BLOCKED",
12942 /// "domain": "googleapis.com",
12943 /// "metadata": {
12944 /// "consumer": "projects/123",
12945 /// "service": "storage.googleapis.com",
12946 /// }
12947 /// }
12948 /// ```
12949 ApiKeyIpAddressBlocked,
12950 /// The request is denied because it violates [API key Android application
12951 /// restrictions](https://cloud.google.com/docs/authentication/api-keys#adding_application_restrictions).
12952 ///
12953 /// Example of an ErrorInfo when the consumer "projects/123" fails to call
12954 /// "storage.googleapis.com" service because the request from the Android apps
12955 /// violates the API key Android application restrictions:
12956 ///
12957 /// ```norust
12958 /// { "reason": "API_KEY_ANDROID_APP_BLOCKED",
12959 /// "domain": "googleapis.com",
12960 /// "metadata": {
12961 /// "consumer": "projects/123",
12962 /// "service": "storage.googleapis.com"
12963 /// }
12964 /// }
12965 /// ```
12966 ApiKeyAndroidAppBlocked,
12967 /// The request is denied because it violates [API key iOS application
12968 /// restrictions](https://cloud.google.com/docs/authentication/api-keys#adding_application_restrictions).
12969 ///
12970 /// Example of an ErrorInfo when the consumer "projects/123" fails to call
12971 /// "storage.googleapis.com" service because the request from the iOS apps
12972 /// violates the API key iOS application restrictions:
12973 ///
12974 /// ```norust
12975 /// { "reason": "API_KEY_IOS_APP_BLOCKED",
12976 /// "domain": "googleapis.com",
12977 /// "metadata": {
12978 /// "consumer": "projects/123",
12979 /// "service": "storage.googleapis.com"
12980 /// }
12981 /// }
12982 /// ```
12983 ApiKeyIosAppBlocked,
12984 /// The request is denied because there is not enough rate quota for the
12985 /// consumer.
12986 ///
12987 /// Example of an ErrorInfo when the consumer "projects/123" fails to contact
12988 /// "pubsub.googleapis.com" service because consumer's rate quota usage has
12989 /// reached the maximum value set for the quota limit
12990 /// "ReadsPerMinutePerProject" on the quota metric
12991 /// "pubsub.googleapis.com/read_requests":
12992 ///
12993 /// ```norust
12994 /// { "reason": "RATE_LIMIT_EXCEEDED",
12995 /// "domain": "googleapis.com",
12996 /// "metadata": {
12997 /// "consumer": "projects/123",
12998 /// "service": "pubsub.googleapis.com",
12999 /// "quota_metric": "pubsub.googleapis.com/read_requests",
13000 /// "quota_limit": "ReadsPerMinutePerProject"
13001 /// }
13002 /// }
13003 /// ```
13004 ///
13005 /// Example of an ErrorInfo when the consumer "projects/123" checks quota on
13006 /// the service "dataflow.googleapis.com" and hits the organization quota
13007 /// limit "DefaultRequestsPerMinutePerOrganization" on the metric
13008 /// "dataflow.googleapis.com/default_requests".
13009 ///
13010 /// ```norust
13011 /// { "reason": "RATE_LIMIT_EXCEEDED",
13012 /// "domain": "googleapis.com",
13013 /// "metadata": {
13014 /// "consumer": "projects/123",
13015 /// "service": "dataflow.googleapis.com",
13016 /// "quota_metric": "dataflow.googleapis.com/default_requests",
13017 /// "quota_limit": "DefaultRequestsPerMinutePerOrganization"
13018 /// }
13019 /// }
13020 /// ```
13021 RateLimitExceeded,
13022 /// The request is denied because there is not enough resource quota for the
13023 /// consumer.
13024 ///
13025 /// Example of an ErrorInfo when the consumer "projects/123" fails to contact
13026 /// "compute.googleapis.com" service because consumer's resource quota usage
13027 /// has reached the maximum value set for the quota limit "VMsPerProject"
13028 /// on the quota metric "compute.googleapis.com/vms":
13029 ///
13030 /// ```norust
13031 /// { "reason": "RESOURCE_QUOTA_EXCEEDED",
13032 /// "domain": "googleapis.com",
13033 /// "metadata": {
13034 /// "consumer": "projects/123",
13035 /// "service": "compute.googleapis.com",
13036 /// "quota_metric": "compute.googleapis.com/vms",
13037 /// "quota_limit": "VMsPerProject"
13038 /// }
13039 /// }
13040 /// ```
13041 ///
13042 /// Example of an ErrorInfo when the consumer "projects/123" checks resource
13043 /// quota on the service "dataflow.googleapis.com" and hits the organization
13044 /// quota limit "jobs-per-organization" on the metric
13045 /// "dataflow.googleapis.com/job_count".
13046 ///
13047 /// ```norust
13048 /// { "reason": "RESOURCE_QUOTA_EXCEEDED",
13049 /// "domain": "googleapis.com",
13050 /// "metadata": {
13051 /// "consumer": "projects/123",
13052 /// "service": "dataflow.googleapis.com",
13053 /// "quota_metric": "dataflow.googleapis.com/job_count",
13054 /// "quota_limit": "jobs-per-organization"
13055 /// }
13056 /// }
13057 /// ```
13058 ResourceQuotaExceeded,
13059 /// The request whose associated billing account address is in a tax restricted
13060 /// location, violates the local tax restrictions when creating resources in
13061 /// the restricted region.
13062 ///
13063 /// Example of an ErrorInfo when creating the Cloud Storage Bucket in the
13064 /// container "projects/123" under a tax restricted region
13065 /// "locations/asia-northeast3":
13066 ///
13067 /// ```norust
13068 /// { "reason": "LOCATION_TAX_POLICY_VIOLATED",
13069 /// "domain": "googleapis.com",
13070 /// "metadata": {
13071 /// "consumer": "projects/123",
13072 /// "service": "storage.googleapis.com",
13073 /// "location": "locations/asia-northeast3"
13074 /// }
13075 /// }
13076 /// ```
13077 ///
13078 /// This response indicates creating the Cloud Storage Bucket in
13079 /// "locations/asia-northeast3" violates the location tax restriction.
13080 LocationTaxPolicyViolated,
13081 /// The request is denied because the caller does not have required permission
13082 /// on the user project "projects/123" or the user project is invalid. For more
13083 /// information, check the [userProject System
13084 /// Parameters](https://cloud.google.com/apis/docs/system-parameters).
13085 ///
13086 /// Example of an ErrorInfo when the caller is calling Cloud Storage service
13087 /// with insufficient permissions on the user project:
13088 ///
13089 /// ```norust
13090 /// { "reason": "USER_PROJECT_DENIED",
13091 /// "domain": "googleapis.com",
13092 /// "metadata": {
13093 /// "consumer": "projects/123",
13094 /// "service": "storage.googleapis.com"
13095 /// }
13096 /// }
13097 /// ```
13098 UserProjectDenied,
13099 /// The request is denied because the consumer "projects/123" is suspended due
13100 /// to Terms of Service(Tos) violations. Check [Project suspension
13101 /// guidelines](https://cloud.google.com/resource-manager/docs/project-suspension-guidelines)
13102 /// for more information.
13103 ///
13104 /// Example of an ErrorInfo when calling Cloud Storage service with the
13105 /// suspended consumer "projects/123":
13106 ///
13107 /// ```norust
13108 /// { "reason": "CONSUMER_SUSPENDED",
13109 /// "domain": "googleapis.com",
13110 /// "metadata": {
13111 /// "consumer": "projects/123",
13112 /// "service": "storage.googleapis.com"
13113 /// }
13114 /// }
13115 /// ```
13116 ConsumerSuspended,
13117 /// The request is denied because the associated consumer is invalid. It may be
13118 /// in a bad format, cannot be found, or have been deleted.
13119 ///
13120 /// Example of an ErrorInfo when calling Cloud Storage service with the
13121 /// invalid consumer "projects/123":
13122 ///
13123 /// ```norust
13124 /// { "reason": "CONSUMER_INVALID",
13125 /// "domain": "googleapis.com",
13126 /// "metadata": {
13127 /// "consumer": "projects/123",
13128 /// "service": "storage.googleapis.com"
13129 /// }
13130 /// }
13131 /// ```
13132 ConsumerInvalid,
13133 /// The request is denied because it violates [VPC Service
13134 /// Controls](https://cloud.google.com/vpc-service-controls/docs/overview).
13135 /// The 'uid' field is a random generated identifier that customer can use it
13136 /// to search the audit log for a request rejected by VPC Service Controls. For
13137 /// more information, please refer [VPC Service Controls
13138 /// Troubleshooting](https://cloud.google.com/vpc-service-controls/docs/troubleshooting#unique-id)
13139 ///
13140 /// Example of an ErrorInfo when the consumer "projects/123" fails to call
13141 /// Cloud Storage service because the request is prohibited by the VPC Service
13142 /// Controls.
13143 ///
13144 /// ```norust
13145 /// { "reason": "SECURITY_POLICY_VIOLATED",
13146 /// "domain": "googleapis.com",
13147 /// "metadata": {
13148 /// "uid": "123456789abcde",
13149 /// "consumer": "projects/123",
13150 /// "service": "storage.googleapis.com"
13151 /// }
13152 /// }
13153 /// ```
13154 SecurityPolicyViolated,
13155 /// The request is denied because the provided access token has expired.
13156 ///
13157 /// Example of an ErrorInfo when the request is calling Cloud Storage service
13158 /// with an expired access token:
13159 ///
13160 /// ```norust
13161 /// { "reason": "ACCESS_TOKEN_EXPIRED",
13162 /// "domain": "googleapis.com",
13163 /// "metadata": {
13164 /// "service": "storage.googleapis.com",
13165 /// "method": "google.storage.v1.Storage.GetObject"
13166 /// }
13167 /// }
13168 /// ```
13169 AccessTokenExpired,
13170 /// The request is denied because the provided access token doesn't have at
13171 /// least one of the acceptable scopes required for the API. Please check
13172 /// [OAuth 2.0 Scopes for Google
13173 /// APIs](https://developers.google.com/identity/protocols/oauth2/scopes) for
13174 /// the list of the OAuth 2.0 scopes that you might need to request to access
13175 /// the API.
13176 ///
13177 /// Example of an ErrorInfo when the request is calling Cloud Storage service
13178 /// with an access token that is missing required scopes:
13179 ///
13180 /// ```norust
13181 /// { "reason": "ACCESS_TOKEN_SCOPE_INSUFFICIENT",
13182 /// "domain": "googleapis.com",
13183 /// "metadata": {
13184 /// "service": "storage.googleapis.com",
13185 /// "method": "google.storage.v1.Storage.GetObject"
13186 /// }
13187 /// }
13188 /// ```
13189 AccessTokenScopeInsufficient,
13190 /// The request is denied because the account associated with the provided
13191 /// access token is in an invalid state, such as disabled or deleted.
13192 /// For more information, see <https://cloud.google.com/docs/authentication>.
13193 ///
13194 /// Warning: For privacy reasons, the server may not be able to disclose the
13195 /// email address for some accounts. The client MUST NOT depend on the
13196 /// availability of the `email` attribute.
13197 ///
13198 /// Example of an ErrorInfo when the request is to the Cloud Storage API with
13199 /// an access token that is associated with a disabled or deleted [service
13200 /// account](http://cloud/iam/docs/service-accounts):
13201 ///
13202 /// ```norust
13203 /// { "reason": "ACCOUNT_STATE_INVALID",
13204 /// "domain": "googleapis.com",
13205 /// "metadata": {
13206 /// "service": "storage.googleapis.com",
13207 /// "method": "google.storage.v1.Storage.GetObject",
13208 /// "email": "user@123.iam.gserviceaccount.com"
13209 /// }
13210 /// }
13211 /// ```
13212 AccountStateInvalid,
13213 /// The request is denied because the type of the provided access token is not
13214 /// supported by the API being called.
13215 ///
13216 /// Example of an ErrorInfo when the request is to the Cloud Storage API with
13217 /// an unsupported token type.
13218 ///
13219 /// ```norust
13220 /// { "reason": "ACCESS_TOKEN_TYPE_UNSUPPORTED",
13221 /// "domain": "googleapis.com",
13222 /// "metadata": {
13223 /// "service": "storage.googleapis.com",
13224 /// "method": "google.storage.v1.Storage.GetObject"
13225 /// }
13226 /// }
13227 /// ```
13228 AccessTokenTypeUnsupported,
13229 /// The request is denied because the request doesn't have any authentication
13230 /// credentials. For more information regarding the supported authentication
13231 /// strategies for Google Cloud APIs, see
13232 /// <https://cloud.google.com/docs/authentication>.
13233 ///
13234 /// Example of an ErrorInfo when the request is to the Cloud Storage API
13235 /// without any authentication credentials.
13236 ///
13237 /// ```norust
13238 /// { "reason": "CREDENTIALS_MISSING",
13239 /// "domain": "googleapis.com",
13240 /// "metadata": {
13241 /// "service": "storage.googleapis.com",
13242 /// "method": "google.storage.v1.Storage.GetObject"
13243 /// }
13244 /// }
13245 /// ```
13246 CredentialsMissing,
13247 /// The request is denied because the provided project owning the resource
13248 /// which acts as the [API
13249 /// consumer](https://cloud.google.com/apis/design/glossary#api_consumer) is
13250 /// invalid. It may be in a bad format or empty.
13251 ///
13252 /// Example of an ErrorInfo when the request is to the Cloud Functions API,
13253 /// but the offered resource project in the request in a bad format which can't
13254 /// perform the ListFunctions method.
13255 ///
13256 /// ```norust
13257 /// { "reason": "RESOURCE_PROJECT_INVALID",
13258 /// "domain": "googleapis.com",
13259 /// "metadata": {
13260 /// "service": "cloudfunctions.googleapis.com",
13261 /// "method":
13262 /// "google.cloud.functions.v1.CloudFunctionsService.ListFunctions"
13263 /// }
13264 /// }
13265 /// ```
13266 ResourceProjectInvalid,
13267 /// The request is denied because the provided session cookie is missing,
13268 /// invalid or failed to decode.
13269 ///
13270 /// Example of an ErrorInfo when the request is calling Cloud Storage service
13271 /// with a SID cookie which can't be decoded.
13272 ///
13273 /// ```norust
13274 /// { "reason": "SESSION_COOKIE_INVALID",
13275 /// "domain": "googleapis.com",
13276 /// "metadata": {
13277 /// "service": "storage.googleapis.com",
13278 /// "method": "google.storage.v1.Storage.GetObject",
13279 /// "cookie": "SID"
13280 /// }
13281 /// }
13282 /// ```
13283 SessionCookieInvalid,
13284 /// The request is denied because the user is from a Google Workspace customer
13285 /// that blocks their users from accessing a particular service.
13286 ///
13287 /// Example scenario: <https://support.google.com/a/answer/9197205?hl=en>
13288 ///
13289 /// Example of an ErrorInfo when access to Google Cloud Storage service is
13290 /// blocked by the Google Workspace administrator:
13291 ///
13292 /// ```norust
13293 /// { "reason": "USER_BLOCKED_BY_ADMIN",
13294 /// "domain": "googleapis.com",
13295 /// "metadata": {
13296 /// "service": "storage.googleapis.com",
13297 /// "method": "google.storage.v1.Storage.GetObject",
13298 /// }
13299 /// }
13300 /// ```
13301 UserBlockedByAdmin,
13302 /// The request is denied because the resource service usage is restricted
13303 /// by administrators according to the organization policy constraint.
13304 /// For more information see
13305 /// <https://cloud.google.com/resource-manager/docs/organization-policy/restricting-services>.
13306 ///
13307 /// Example of an ErrorInfo when access to Google Cloud Storage service is
13308 /// restricted by Resource Usage Restriction policy:
13309 ///
13310 /// ```norust
13311 /// { "reason": "RESOURCE_USAGE_RESTRICTION_VIOLATED",
13312 /// "domain": "googleapis.com",
13313 /// "metadata": {
13314 /// "consumer": "projects/project-123",
13315 /// "service": "storage.googleapis.com"
13316 /// }
13317 /// }
13318 /// ```
13319 ResourceUsageRestrictionViolated,
13320 /// Unimplemented. Do not use.
13321 ///
13322 /// The request is denied because it contains unsupported system parameters in
13323 /// URL query parameters or HTTP headers. For more information,
13324 /// see <https://cloud.google.com/apis/docs/system-parameters>
13325 ///
13326 /// Example of an ErrorInfo when access "pubsub.googleapis.com" service with
13327 /// a request header of "x-goog-user-ip":
13328 ///
13329 /// ```norust
13330 /// { "reason": "SYSTEM_PARAMETER_UNSUPPORTED",
13331 /// "domain": "googleapis.com",
13332 /// "metadata": {
13333 /// "service": "pubsub.googleapis.com"
13334 /// "parameter": "x-goog-user-ip"
13335 /// }
13336 /// }
13337 /// ```
13338 SystemParameterUnsupported,
13339 /// The request is denied because it violates Org Restriction: the requested
13340 /// resource does not belong to allowed organizations specified in
13341 /// "X-Goog-Allowed-Resources" header.
13342 ///
13343 /// Example of an ErrorInfo when accessing a GCP resource that is restricted by
13344 /// Org Restriction for "pubsub.googleapis.com" service.
13345 ///
13346 /// {
13347 /// reason: "ORG_RESTRICTION_VIOLATION"
13348 /// domain: "googleapis.com"
13349 /// metadata {
13350 /// "consumer":"projects/123456"
13351 /// "service": "pubsub.googleapis.com"
13352 /// }
13353 /// }
13354 OrgRestrictionViolation,
13355 /// The request is denied because "X-Goog-Allowed-Resources" header is in a bad
13356 /// format.
13357 ///
13358 /// Example of an ErrorInfo when
13359 /// accessing "pubsub.googleapis.com" service with an invalid
13360 /// "X-Goog-Allowed-Resources" request header.
13361 ///
13362 /// {
13363 /// reason: "ORG_RESTRICTION_HEADER_INVALID"
13364 /// domain: "googleapis.com"
13365 /// metadata {
13366 /// "consumer":"projects/123456"
13367 /// "service": "pubsub.googleapis.com"
13368 /// }
13369 /// }
13370 OrgRestrictionHeaderInvalid,
13371 /// Unimplemented. Do not use.
13372 ///
13373 /// The request is calling a service that is not visible to the consumer.
13374 ///
13375 /// Example of an ErrorInfo when the consumer "projects/123" contacting
13376 /// "pubsub.googleapis.com" service which is not visible to the consumer.
13377 ///
13378 /// ```norust
13379 /// { "reason": "SERVICE_NOT_VISIBLE",
13380 /// "domain": "googleapis.com",
13381 /// "metadata": {
13382 /// "consumer": "projects/123",
13383 /// "service": "pubsub.googleapis.com"
13384 /// }
13385 /// }
13386 /// ```
13387 ///
13388 /// This response indicates the "pubsub.googleapis.com" is not visible to
13389 /// "projects/123" (or it may not exist).
13390 ServiceNotVisible,
13391 /// The request is related to a project for which GCP access is suspended.
13392 ///
13393 /// Example of an ErrorInfo when the consumer "projects/123" fails to contact
13394 /// "pubsub.googleapis.com" service because GCP access is suspended:
13395 ///
13396 /// ```norust
13397 /// { "reason": "GCP_SUSPENDED",
13398 /// "domain": "googleapis.com",
13399 /// "metadata": {
13400 /// "consumer": "projects/123",
13401 /// "service": "pubsub.googleapis.com"
13402 /// }
13403 /// }
13404 /// ```
13405 ///
13406 /// This response indicates the associated GCP account has been suspended.
13407 GcpSuspended,
13408 /// The request violates the location policies when creating resources in
13409 /// the restricted region.
13410 ///
13411 /// Example of an ErrorInfo when creating the Cloud Storage Bucket by
13412 /// "projects/123" for service storage.googleapis.com:
13413 ///
13414 /// ```norust
13415 /// { "reason": "LOCATION_POLICY_VIOLATED",
13416 /// "domain": "googleapis.com",
13417 /// "metadata": {
13418 /// "consumer": "projects/123",
13419 /// "service": "storage.googleapis.com",
13420 /// }
13421 /// }
13422 /// ```
13423 ///
13424 /// This response indicates creating the Cloud Storage Bucket in
13425 /// "locations/asia-northeast3" violates at least one location policy.
13426 /// The troubleshooting guidance is provided in the Help links.
13427 LocationPolicyViolated,
13428 /// The request is denied because origin request header is missing.
13429 ///
13430 /// Example of an ErrorInfo when
13431 /// accessing "pubsub.googleapis.com" service with an empty "Origin" request
13432 /// header.
13433 ///
13434 /// {
13435 /// reason: "MISSING_ORIGIN"
13436 /// domain: "googleapis.com"
13437 /// metadata {
13438 /// "consumer":"projects/123456"
13439 /// "service": "pubsub.googleapis.com"
13440 /// }
13441 /// }
13442 MissingOrigin,
13443 /// The request is denied because the request contains more than one credential
13444 /// type that are individually acceptable, but not together. The customer
13445 /// should retry their request with only one set of credentials.
13446 ///
13447 /// Example of an ErrorInfo when
13448 /// accessing "pubsub.googleapis.com" service with overloaded credentials.
13449 ///
13450 /// {
13451 /// reason: "OVERLOADED_CREDENTIALS"
13452 /// domain: "googleapis.com"
13453 /// metadata {
13454 /// "consumer":"projects/123456"
13455 /// "service": "pubsub.googleapis.com"
13456 /// }
13457 /// }
13458 OverloadedCredentials,
13459 /// The request whose associated location violates the location org policy
13460 /// restrictions when creating resources in the restricted region.
13461 ///
13462 /// Example of an ErrorInfo when creating the Cloud Storage Bucket in the
13463 /// container "projects/123" under a restricted region
13464 /// "locations/asia-northeast3":
13465 ///
13466 /// ```norust
13467 /// {
13468 /// "reason": "LOCATION_ORG_POLICY_VIOLATED",
13469 /// "domain": "googleapis.com",
13470 /// "metadata": {
13471 /// "resource": "projects/123",
13472 /// "location": "locations/asia-northeast3"
13473 /// }
13474 /// }
13475 /// ```
13476 ///
13477 /// This response indicates creating the Cloud Storage Bucket in
13478 /// "locations/asia-northeast3" violates the location org policy restriction.
13479 LocationOrgPolicyViolated,
13480 /// The request is denied because it access data of regulated customers using
13481 /// TLS 1.0 and 1.1.
13482 ///
13483 /// Example of an ErrorInfo when accessing a GCP resource "projects/123" that
13484 /// is restricted by TLS Version Restriction for "pubsub.googleapis.com"
13485 /// service.
13486 ///
13487 /// ```norust
13488 /// {
13489 /// "reason": "TLS_ORG_POLICY_VIOLATED",
13490 /// "domain": "googleapis.com",
13491 /// "metadata": {
13492 /// "service": "pubsub.googleapis.com"
13493 /// "resource": "projects/123",
13494 /// "policyName": "constraints/gcp.restrictTLSVersion",
13495 /// "tlsVersion": "TLS_VERSION_1"
13496 /// }
13497 /// }
13498 /// ```
13499 TlsOrgPolicyViolated,
13500 /// The request is denied because the associated project has exceeded the
13501 /// emulator quota limit.
13502 ///
13503 /// Example of an ErrorInfo when the associated "projects/123" has exceeded the
13504 /// emulator quota limit.
13505 ///
13506 /// ```norust
13507 /// {
13508 /// "reason": "EMULATOR_QUOTA_EXCEEDED",
13509 /// "domain": "googleapis.com",
13510 /// "metadata": {
13511 /// "service": "pubsub.googleapis.com"
13512 /// "consumer": "projects/123"
13513 /// }
13514 /// }
13515 /// ```
13516 EmulatorQuotaExceeded,
13517 /// The request is denied because the associated application credential header
13518 /// is invalid for an Android applications.
13519 ///
13520 /// Example of an ErrorInfo when the request from an Android application to the
13521 /// "pubsub.googleapis.com" with an invalid application credential header.
13522 ///
13523 /// ```norust
13524 /// {
13525 /// "reason": "CREDENTIAL_ANDROID_APP_INVALID",
13526 /// "domain": "googleapis.com",
13527 /// "metadata": {
13528 /// "service": "pubsub.googleapis.com"
13529 /// }
13530 /// }
13531 /// ```
13532 CredentialAndroidAppInvalid,
13533 /// The request is denied because IAM permission on resource is denied.
13534 ///
13535 /// Example of an ErrorInfo when the IAM permission `aiplatform.datasets.list`
13536 /// is denied on resource `projects/123`.
13537 ///
13538 /// ```norust
13539 /// {
13540 /// "reason": "IAM_PERMISSION_DENIED",
13541 /// "domain": "googleapis.com",
13542 /// "metadata": {
13543 /// "resource": "projects/123"
13544 /// "permission": "aiplatform.datasets.list"
13545 /// }
13546 /// }
13547 /// ```
13548 IamPermissionDenied,
13549 /// The request is denied because it contains the invalid JWT token.
13550 ///
13551 /// Example of an ErrorInfo when the request contains an invalid JWT token for
13552 /// service `storage.googleapis.com`.
13553 ///
13554 /// ```norust
13555 /// {
13556 /// "reason": "JWT_TOKEN_INVALID",
13557 /// "domain": "googleapis.com",
13558 /// "metadata": {
13559 /// "service": "storage.googleapis.com"
13560 /// }
13561 /// }
13562 /// ```
13563 JwtTokenInvalid,
13564 /// The request is denied because it contains credential with type that is
13565 /// unsupported.
13566 ///
13567 /// Example of an ErrorInfo when the request contains an unsupported credential
13568 /// type for service `storage.googleapis.com`.
13569 ///
13570 /// ```norust
13571 /// {
13572 /// "reason": "CREDENTIAL_TYPE_UNSUPPORTED",
13573 /// "domain": "googleapis.com",
13574 /// "metadata": {
13575 /// "service": "storage.googleapis.com"
13576 /// }
13577 /// }
13578 /// ```
13579 CredentialTypeUnsupported,
13580 /// The request is denied because it contains unsupported account type.
13581 ///
13582 /// Example of an ErrorInfo when the request contains an unsupported account
13583 /// type for service `storage.googleapis.com`.
13584 ///
13585 /// ```norust
13586 /// {
13587 /// "reason": "ACCOUNT_TYPE_UNSUPPORTED",
13588 /// "domain": "googleapis.com",
13589 /// "metadata": {
13590 /// "service": "storage.googleapis.com"
13591 /// }
13592 /// }
13593 /// ```
13594 AccountTypeUnsupported,
13595 /// The request is denied because the API endpoint is restricted by
13596 /// administrators according to the organization policy constraint.
13597 /// For more information see
13598 /// <https://cloud.google.com/assured-workloads/docs/restrict-endpoint-usage>.
13599 ///
13600 /// Example of an ErrorInfo when access to Google Cloud Storage service is
13601 /// restricted by Restrict Endpoint Usage policy:
13602 ///
13603 /// ```norust
13604 /// {
13605 /// "reason": "ENDPOINT_USAGE_RESTRICTION_VIOLATED",
13606 /// "domain": "googleapis.com/policies/endpointUsageRestriction",
13607 /// "metadata": {
13608 /// "policy_name": "constraints/gcp.restrictEndpointUsage",
13609 /// "checked_value": "storage.googleapis.com"
13610 /// "consumer": "organization/123"
13611 /// "service": "storage.googleapis.com"
13612 /// }
13613 /// }
13614 /// ```
13615 EndpointUsageRestrictionViolated,
13616 /// The request is denied because the TLS Cipher Suite is restricted by
13617 /// administrators according to the organization policy constraint.
13618 /// For more information see
13619 /// <https://cloud.google.com/assured-workloads/docs/restrict-tls-cipher-suites>
13620 ///
13621 /// Example of an ErrorInfo when access to Google Cloud BigQuery service is
13622 /// restricted by Restrict TLS Cipher Suites policy:
13623 ///
13624 /// ```norust
13625 /// {
13626 /// "reason": "TLS_CIPHER_RESTRICTION_VIOLATED",
13627 /// "domain": "googleapis.com/policies/tlsCipherRestriction",
13628 /// "metadata": {
13629 /// "policy_name": "constraints/gcp.restrictTLSCipherSuites",
13630 /// "checked_value": "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
13631 /// "consumer": "organization/123"
13632 /// "service": "bigquery.googleapis.com"
13633 /// }
13634 /// }
13635 /// ```
13636 TlsCipherRestrictionViolated,
13637 /// The request is denied because the MCP activation check fails.
13638 ///
13639 /// Example of an ErrorInfo when the container "projects/123" contacting
13640 /// "pubsub.googleapis.com" service which is disabled by MCP:
13641 ///
13642 /// ```norust
13643 /// { "reason": "MCP_SERVER_DISABLED",
13644 /// "domain": "googleapis.com",
13645 /// "metadata": {
13646 /// "consumer": "projects/123",
13647 /// "service": "pubsub.googleapis.com"
13648 /// }
13649 /// }
13650 /// ```
13651 ///
13652 /// This response indicates the "pubsub.googleapis.com" has been disabled in
13653 /// "projects/123" for MCP.
13654 McpServerDisabled,
13655 /// If set, the enum was initialized with an unknown value.
13656 ///
13657 /// Applications can examine the value using [ErrorReason::value] or
13658 /// [ErrorReason::name].
13659 UnknownValue(error_reason::UnknownValue),
13660}
13661
13662#[doc(hidden)]
13663pub mod error_reason {
13664 #[allow(unused_imports)]
13665 use super::*;
13666 #[derive(Clone, Debug, PartialEq)]
13667 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13668}
13669
13670impl ErrorReason {
13671 /// Gets the enum value.
13672 ///
13673 /// Returns `None` if the enum contains an unknown value deserialized from
13674 /// the string representation of enums.
13675 pub fn value(&self) -> std::option::Option<i32> {
13676 match self {
13677 Self::Unspecified => std::option::Option::Some(0),
13678 Self::ServiceDisabled => std::option::Option::Some(1),
13679 Self::BillingDisabled => std::option::Option::Some(2),
13680 Self::ApiKeyInvalid => std::option::Option::Some(3),
13681 Self::ApiKeyServiceBlocked => std::option::Option::Some(4),
13682 Self::ApiKeyHttpReferrerBlocked => std::option::Option::Some(7),
13683 Self::ApiKeyIpAddressBlocked => std::option::Option::Some(8),
13684 Self::ApiKeyAndroidAppBlocked => std::option::Option::Some(9),
13685 Self::ApiKeyIosAppBlocked => std::option::Option::Some(13),
13686 Self::RateLimitExceeded => std::option::Option::Some(5),
13687 Self::ResourceQuotaExceeded => std::option::Option::Some(6),
13688 Self::LocationTaxPolicyViolated => std::option::Option::Some(10),
13689 Self::UserProjectDenied => std::option::Option::Some(11),
13690 Self::ConsumerSuspended => std::option::Option::Some(12),
13691 Self::ConsumerInvalid => std::option::Option::Some(14),
13692 Self::SecurityPolicyViolated => std::option::Option::Some(15),
13693 Self::AccessTokenExpired => std::option::Option::Some(16),
13694 Self::AccessTokenScopeInsufficient => std::option::Option::Some(17),
13695 Self::AccountStateInvalid => std::option::Option::Some(18),
13696 Self::AccessTokenTypeUnsupported => std::option::Option::Some(19),
13697 Self::CredentialsMissing => std::option::Option::Some(20),
13698 Self::ResourceProjectInvalid => std::option::Option::Some(21),
13699 Self::SessionCookieInvalid => std::option::Option::Some(23),
13700 Self::UserBlockedByAdmin => std::option::Option::Some(24),
13701 Self::ResourceUsageRestrictionViolated => std::option::Option::Some(25),
13702 Self::SystemParameterUnsupported => std::option::Option::Some(26),
13703 Self::OrgRestrictionViolation => std::option::Option::Some(27),
13704 Self::OrgRestrictionHeaderInvalid => std::option::Option::Some(28),
13705 Self::ServiceNotVisible => std::option::Option::Some(29),
13706 Self::GcpSuspended => std::option::Option::Some(30),
13707 Self::LocationPolicyViolated => std::option::Option::Some(31),
13708 Self::MissingOrigin => std::option::Option::Some(33),
13709 Self::OverloadedCredentials => std::option::Option::Some(34),
13710 Self::LocationOrgPolicyViolated => std::option::Option::Some(35),
13711 Self::TlsOrgPolicyViolated => std::option::Option::Some(36),
13712 Self::EmulatorQuotaExceeded => std::option::Option::Some(38),
13713 Self::CredentialAndroidAppInvalid => std::option::Option::Some(39),
13714 Self::IamPermissionDenied => std::option::Option::Some(41),
13715 Self::JwtTokenInvalid => std::option::Option::Some(42),
13716 Self::CredentialTypeUnsupported => std::option::Option::Some(43),
13717 Self::AccountTypeUnsupported => std::option::Option::Some(44),
13718 Self::EndpointUsageRestrictionViolated => std::option::Option::Some(45),
13719 Self::TlsCipherRestrictionViolated => std::option::Option::Some(46),
13720 Self::McpServerDisabled => std::option::Option::Some(47),
13721 Self::UnknownValue(u) => u.0.value(),
13722 }
13723 }
13724
13725 /// Gets the enum value as a string.
13726 ///
13727 /// Returns `None` if the enum contains an unknown value deserialized from
13728 /// the integer representation of enums.
13729 pub fn name(&self) -> std::option::Option<&str> {
13730 match self {
13731 Self::Unspecified => std::option::Option::Some("ERROR_REASON_UNSPECIFIED"),
13732 Self::ServiceDisabled => std::option::Option::Some("SERVICE_DISABLED"),
13733 Self::BillingDisabled => std::option::Option::Some("BILLING_DISABLED"),
13734 Self::ApiKeyInvalid => std::option::Option::Some("API_KEY_INVALID"),
13735 Self::ApiKeyServiceBlocked => std::option::Option::Some("API_KEY_SERVICE_BLOCKED"),
13736 Self::ApiKeyHttpReferrerBlocked => {
13737 std::option::Option::Some("API_KEY_HTTP_REFERRER_BLOCKED")
13738 }
13739 Self::ApiKeyIpAddressBlocked => std::option::Option::Some("API_KEY_IP_ADDRESS_BLOCKED"),
13740 Self::ApiKeyAndroidAppBlocked => {
13741 std::option::Option::Some("API_KEY_ANDROID_APP_BLOCKED")
13742 }
13743 Self::ApiKeyIosAppBlocked => std::option::Option::Some("API_KEY_IOS_APP_BLOCKED"),
13744 Self::RateLimitExceeded => std::option::Option::Some("RATE_LIMIT_EXCEEDED"),
13745 Self::ResourceQuotaExceeded => std::option::Option::Some("RESOURCE_QUOTA_EXCEEDED"),
13746 Self::LocationTaxPolicyViolated => {
13747 std::option::Option::Some("LOCATION_TAX_POLICY_VIOLATED")
13748 }
13749 Self::UserProjectDenied => std::option::Option::Some("USER_PROJECT_DENIED"),
13750 Self::ConsumerSuspended => std::option::Option::Some("CONSUMER_SUSPENDED"),
13751 Self::ConsumerInvalid => std::option::Option::Some("CONSUMER_INVALID"),
13752 Self::SecurityPolicyViolated => std::option::Option::Some("SECURITY_POLICY_VIOLATED"),
13753 Self::AccessTokenExpired => std::option::Option::Some("ACCESS_TOKEN_EXPIRED"),
13754 Self::AccessTokenScopeInsufficient => {
13755 std::option::Option::Some("ACCESS_TOKEN_SCOPE_INSUFFICIENT")
13756 }
13757 Self::AccountStateInvalid => std::option::Option::Some("ACCOUNT_STATE_INVALID"),
13758 Self::AccessTokenTypeUnsupported => {
13759 std::option::Option::Some("ACCESS_TOKEN_TYPE_UNSUPPORTED")
13760 }
13761 Self::CredentialsMissing => std::option::Option::Some("CREDENTIALS_MISSING"),
13762 Self::ResourceProjectInvalid => std::option::Option::Some("RESOURCE_PROJECT_INVALID"),
13763 Self::SessionCookieInvalid => std::option::Option::Some("SESSION_COOKIE_INVALID"),
13764 Self::UserBlockedByAdmin => std::option::Option::Some("USER_BLOCKED_BY_ADMIN"),
13765 Self::ResourceUsageRestrictionViolated => {
13766 std::option::Option::Some("RESOURCE_USAGE_RESTRICTION_VIOLATED")
13767 }
13768 Self::SystemParameterUnsupported => {
13769 std::option::Option::Some("SYSTEM_PARAMETER_UNSUPPORTED")
13770 }
13771 Self::OrgRestrictionViolation => std::option::Option::Some("ORG_RESTRICTION_VIOLATION"),
13772 Self::OrgRestrictionHeaderInvalid => {
13773 std::option::Option::Some("ORG_RESTRICTION_HEADER_INVALID")
13774 }
13775 Self::ServiceNotVisible => std::option::Option::Some("SERVICE_NOT_VISIBLE"),
13776 Self::GcpSuspended => std::option::Option::Some("GCP_SUSPENDED"),
13777 Self::LocationPolicyViolated => std::option::Option::Some("LOCATION_POLICY_VIOLATED"),
13778 Self::MissingOrigin => std::option::Option::Some("MISSING_ORIGIN"),
13779 Self::OverloadedCredentials => std::option::Option::Some("OVERLOADED_CREDENTIALS"),
13780 Self::LocationOrgPolicyViolated => {
13781 std::option::Option::Some("LOCATION_ORG_POLICY_VIOLATED")
13782 }
13783 Self::TlsOrgPolicyViolated => std::option::Option::Some("TLS_ORG_POLICY_VIOLATED"),
13784 Self::EmulatorQuotaExceeded => std::option::Option::Some("EMULATOR_QUOTA_EXCEEDED"),
13785 Self::CredentialAndroidAppInvalid => {
13786 std::option::Option::Some("CREDENTIAL_ANDROID_APP_INVALID")
13787 }
13788 Self::IamPermissionDenied => std::option::Option::Some("IAM_PERMISSION_DENIED"),
13789 Self::JwtTokenInvalid => std::option::Option::Some("JWT_TOKEN_INVALID"),
13790 Self::CredentialTypeUnsupported => {
13791 std::option::Option::Some("CREDENTIAL_TYPE_UNSUPPORTED")
13792 }
13793 Self::AccountTypeUnsupported => std::option::Option::Some("ACCOUNT_TYPE_UNSUPPORTED"),
13794 Self::EndpointUsageRestrictionViolated => {
13795 std::option::Option::Some("ENDPOINT_USAGE_RESTRICTION_VIOLATED")
13796 }
13797 Self::TlsCipherRestrictionViolated => {
13798 std::option::Option::Some("TLS_CIPHER_RESTRICTION_VIOLATED")
13799 }
13800 Self::McpServerDisabled => std::option::Option::Some("MCP_SERVER_DISABLED"),
13801 Self::UnknownValue(u) => u.0.name(),
13802 }
13803 }
13804}
13805
13806impl std::default::Default for ErrorReason {
13807 fn default() -> Self {
13808 use std::convert::From;
13809 Self::from(0)
13810 }
13811}
13812
13813impl std::fmt::Display for ErrorReason {
13814 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
13815 wkt::internal::display_enum(f, self.name(), self.value())
13816 }
13817}
13818
13819impl std::convert::From<i32> for ErrorReason {
13820 fn from(value: i32) -> Self {
13821 match value {
13822 0 => Self::Unspecified,
13823 1 => Self::ServiceDisabled,
13824 2 => Self::BillingDisabled,
13825 3 => Self::ApiKeyInvalid,
13826 4 => Self::ApiKeyServiceBlocked,
13827 5 => Self::RateLimitExceeded,
13828 6 => Self::ResourceQuotaExceeded,
13829 7 => Self::ApiKeyHttpReferrerBlocked,
13830 8 => Self::ApiKeyIpAddressBlocked,
13831 9 => Self::ApiKeyAndroidAppBlocked,
13832 10 => Self::LocationTaxPolicyViolated,
13833 11 => Self::UserProjectDenied,
13834 12 => Self::ConsumerSuspended,
13835 13 => Self::ApiKeyIosAppBlocked,
13836 14 => Self::ConsumerInvalid,
13837 15 => Self::SecurityPolicyViolated,
13838 16 => Self::AccessTokenExpired,
13839 17 => Self::AccessTokenScopeInsufficient,
13840 18 => Self::AccountStateInvalid,
13841 19 => Self::AccessTokenTypeUnsupported,
13842 20 => Self::CredentialsMissing,
13843 21 => Self::ResourceProjectInvalid,
13844 23 => Self::SessionCookieInvalid,
13845 24 => Self::UserBlockedByAdmin,
13846 25 => Self::ResourceUsageRestrictionViolated,
13847 26 => Self::SystemParameterUnsupported,
13848 27 => Self::OrgRestrictionViolation,
13849 28 => Self::OrgRestrictionHeaderInvalid,
13850 29 => Self::ServiceNotVisible,
13851 30 => Self::GcpSuspended,
13852 31 => Self::LocationPolicyViolated,
13853 33 => Self::MissingOrigin,
13854 34 => Self::OverloadedCredentials,
13855 35 => Self::LocationOrgPolicyViolated,
13856 36 => Self::TlsOrgPolicyViolated,
13857 38 => Self::EmulatorQuotaExceeded,
13858 39 => Self::CredentialAndroidAppInvalid,
13859 41 => Self::IamPermissionDenied,
13860 42 => Self::JwtTokenInvalid,
13861 43 => Self::CredentialTypeUnsupported,
13862 44 => Self::AccountTypeUnsupported,
13863 45 => Self::EndpointUsageRestrictionViolated,
13864 46 => Self::TlsCipherRestrictionViolated,
13865 47 => Self::McpServerDisabled,
13866 _ => Self::UnknownValue(error_reason::UnknownValue(
13867 wkt::internal::UnknownEnumValue::Integer(value),
13868 )),
13869 }
13870 }
13871}
13872
13873impl std::convert::From<&str> for ErrorReason {
13874 fn from(value: &str) -> Self {
13875 use std::string::ToString;
13876 match value {
13877 "ERROR_REASON_UNSPECIFIED" => Self::Unspecified,
13878 "SERVICE_DISABLED" => Self::ServiceDisabled,
13879 "BILLING_DISABLED" => Self::BillingDisabled,
13880 "API_KEY_INVALID" => Self::ApiKeyInvalid,
13881 "API_KEY_SERVICE_BLOCKED" => Self::ApiKeyServiceBlocked,
13882 "API_KEY_HTTP_REFERRER_BLOCKED" => Self::ApiKeyHttpReferrerBlocked,
13883 "API_KEY_IP_ADDRESS_BLOCKED" => Self::ApiKeyIpAddressBlocked,
13884 "API_KEY_ANDROID_APP_BLOCKED" => Self::ApiKeyAndroidAppBlocked,
13885 "API_KEY_IOS_APP_BLOCKED" => Self::ApiKeyIosAppBlocked,
13886 "RATE_LIMIT_EXCEEDED" => Self::RateLimitExceeded,
13887 "RESOURCE_QUOTA_EXCEEDED" => Self::ResourceQuotaExceeded,
13888 "LOCATION_TAX_POLICY_VIOLATED" => Self::LocationTaxPolicyViolated,
13889 "USER_PROJECT_DENIED" => Self::UserProjectDenied,
13890 "CONSUMER_SUSPENDED" => Self::ConsumerSuspended,
13891 "CONSUMER_INVALID" => Self::ConsumerInvalid,
13892 "SECURITY_POLICY_VIOLATED" => Self::SecurityPolicyViolated,
13893 "ACCESS_TOKEN_EXPIRED" => Self::AccessTokenExpired,
13894 "ACCESS_TOKEN_SCOPE_INSUFFICIENT" => Self::AccessTokenScopeInsufficient,
13895 "ACCOUNT_STATE_INVALID" => Self::AccountStateInvalid,
13896 "ACCESS_TOKEN_TYPE_UNSUPPORTED" => Self::AccessTokenTypeUnsupported,
13897 "CREDENTIALS_MISSING" => Self::CredentialsMissing,
13898 "RESOURCE_PROJECT_INVALID" => Self::ResourceProjectInvalid,
13899 "SESSION_COOKIE_INVALID" => Self::SessionCookieInvalid,
13900 "USER_BLOCKED_BY_ADMIN" => Self::UserBlockedByAdmin,
13901 "RESOURCE_USAGE_RESTRICTION_VIOLATED" => Self::ResourceUsageRestrictionViolated,
13902 "SYSTEM_PARAMETER_UNSUPPORTED" => Self::SystemParameterUnsupported,
13903 "ORG_RESTRICTION_VIOLATION" => Self::OrgRestrictionViolation,
13904 "ORG_RESTRICTION_HEADER_INVALID" => Self::OrgRestrictionHeaderInvalid,
13905 "SERVICE_NOT_VISIBLE" => Self::ServiceNotVisible,
13906 "GCP_SUSPENDED" => Self::GcpSuspended,
13907 "LOCATION_POLICY_VIOLATED" => Self::LocationPolicyViolated,
13908 "MISSING_ORIGIN" => Self::MissingOrigin,
13909 "OVERLOADED_CREDENTIALS" => Self::OverloadedCredentials,
13910 "LOCATION_ORG_POLICY_VIOLATED" => Self::LocationOrgPolicyViolated,
13911 "TLS_ORG_POLICY_VIOLATED" => Self::TlsOrgPolicyViolated,
13912 "EMULATOR_QUOTA_EXCEEDED" => Self::EmulatorQuotaExceeded,
13913 "CREDENTIAL_ANDROID_APP_INVALID" => Self::CredentialAndroidAppInvalid,
13914 "IAM_PERMISSION_DENIED" => Self::IamPermissionDenied,
13915 "JWT_TOKEN_INVALID" => Self::JwtTokenInvalid,
13916 "CREDENTIAL_TYPE_UNSUPPORTED" => Self::CredentialTypeUnsupported,
13917 "ACCOUNT_TYPE_UNSUPPORTED" => Self::AccountTypeUnsupported,
13918 "ENDPOINT_USAGE_RESTRICTION_VIOLATED" => Self::EndpointUsageRestrictionViolated,
13919 "TLS_CIPHER_RESTRICTION_VIOLATED" => Self::TlsCipherRestrictionViolated,
13920 "MCP_SERVER_DISABLED" => Self::McpServerDisabled,
13921 _ => Self::UnknownValue(error_reason::UnknownValue(
13922 wkt::internal::UnknownEnumValue::String(value.to_string()),
13923 )),
13924 }
13925 }
13926}
13927
13928impl serde::ser::Serialize for ErrorReason {
13929 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13930 where
13931 S: serde::Serializer,
13932 {
13933 match self {
13934 Self::Unspecified => serializer.serialize_i32(0),
13935 Self::ServiceDisabled => serializer.serialize_i32(1),
13936 Self::BillingDisabled => serializer.serialize_i32(2),
13937 Self::ApiKeyInvalid => serializer.serialize_i32(3),
13938 Self::ApiKeyServiceBlocked => serializer.serialize_i32(4),
13939 Self::ApiKeyHttpReferrerBlocked => serializer.serialize_i32(7),
13940 Self::ApiKeyIpAddressBlocked => serializer.serialize_i32(8),
13941 Self::ApiKeyAndroidAppBlocked => serializer.serialize_i32(9),
13942 Self::ApiKeyIosAppBlocked => serializer.serialize_i32(13),
13943 Self::RateLimitExceeded => serializer.serialize_i32(5),
13944 Self::ResourceQuotaExceeded => serializer.serialize_i32(6),
13945 Self::LocationTaxPolicyViolated => serializer.serialize_i32(10),
13946 Self::UserProjectDenied => serializer.serialize_i32(11),
13947 Self::ConsumerSuspended => serializer.serialize_i32(12),
13948 Self::ConsumerInvalid => serializer.serialize_i32(14),
13949 Self::SecurityPolicyViolated => serializer.serialize_i32(15),
13950 Self::AccessTokenExpired => serializer.serialize_i32(16),
13951 Self::AccessTokenScopeInsufficient => serializer.serialize_i32(17),
13952 Self::AccountStateInvalid => serializer.serialize_i32(18),
13953 Self::AccessTokenTypeUnsupported => serializer.serialize_i32(19),
13954 Self::CredentialsMissing => serializer.serialize_i32(20),
13955 Self::ResourceProjectInvalid => serializer.serialize_i32(21),
13956 Self::SessionCookieInvalid => serializer.serialize_i32(23),
13957 Self::UserBlockedByAdmin => serializer.serialize_i32(24),
13958 Self::ResourceUsageRestrictionViolated => serializer.serialize_i32(25),
13959 Self::SystemParameterUnsupported => serializer.serialize_i32(26),
13960 Self::OrgRestrictionViolation => serializer.serialize_i32(27),
13961 Self::OrgRestrictionHeaderInvalid => serializer.serialize_i32(28),
13962 Self::ServiceNotVisible => serializer.serialize_i32(29),
13963 Self::GcpSuspended => serializer.serialize_i32(30),
13964 Self::LocationPolicyViolated => serializer.serialize_i32(31),
13965 Self::MissingOrigin => serializer.serialize_i32(33),
13966 Self::OverloadedCredentials => serializer.serialize_i32(34),
13967 Self::LocationOrgPolicyViolated => serializer.serialize_i32(35),
13968 Self::TlsOrgPolicyViolated => serializer.serialize_i32(36),
13969 Self::EmulatorQuotaExceeded => serializer.serialize_i32(38),
13970 Self::CredentialAndroidAppInvalid => serializer.serialize_i32(39),
13971 Self::IamPermissionDenied => serializer.serialize_i32(41),
13972 Self::JwtTokenInvalid => serializer.serialize_i32(42),
13973 Self::CredentialTypeUnsupported => serializer.serialize_i32(43),
13974 Self::AccountTypeUnsupported => serializer.serialize_i32(44),
13975 Self::EndpointUsageRestrictionViolated => serializer.serialize_i32(45),
13976 Self::TlsCipherRestrictionViolated => serializer.serialize_i32(46),
13977 Self::McpServerDisabled => serializer.serialize_i32(47),
13978 Self::UnknownValue(u) => u.0.serialize(serializer),
13979 }
13980 }
13981}
13982
13983impl<'de> serde::de::Deserialize<'de> for ErrorReason {
13984 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13985 where
13986 D: serde::Deserializer<'de>,
13987 {
13988 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ErrorReason>::new(
13989 ".google.api.ErrorReason",
13990 ))
13991 }
13992}
13993
13994/// An indicator of the behavior of a given field (for example, that a field
13995/// is required in requests, or given as output but ignored as input).
13996/// This **does not** change the behavior in protocol buffers itself; it only
13997/// denotes the behavior and may affect how API tooling handles the field.
13998///
13999/// Note: This enum **may** receive new values in the future.
14000///
14001/// # Working with unknown values
14002///
14003/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14004/// additional enum variants at any time. Adding new variants is not considered
14005/// a breaking change. Applications should write their code in anticipation of:
14006///
14007/// - New values appearing in future releases of the client library, **and**
14008/// - New values received dynamically, without application changes.
14009///
14010/// Please consult the [Working with enums] section in the user guide for some
14011/// guidelines.
14012///
14013/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
14014#[derive(Clone, Debug, PartialEq)]
14015#[non_exhaustive]
14016pub enum FieldBehavior {
14017 /// Conventional default for enums. Do not use this.
14018 Unspecified,
14019 /// Specifically denotes a field as optional.
14020 /// While all fields in protocol buffers are optional, this may be specified
14021 /// for emphasis if appropriate.
14022 Optional,
14023 /// Denotes a field as required.
14024 /// This indicates that the field **must** be provided as part of the request,
14025 /// and failure to do so will cause an error (usually `INVALID_ARGUMENT`).
14026 Required,
14027 /// Denotes a field as output only.
14028 /// This indicates that the field is provided in responses, but including the
14029 /// field in a request does nothing (the server *must* ignore it and
14030 /// *must not* throw an error as a result of the field's presence).
14031 OutputOnly,
14032 /// Denotes a field as input only.
14033 /// This indicates that the field is provided in requests, and the
14034 /// corresponding field is not included in output.
14035 InputOnly,
14036 /// Denotes a field as immutable.
14037 /// This indicates that the field may be set once in a request to create a
14038 /// resource, but may not be changed thereafter.
14039 Immutable,
14040 /// Denotes that a (repeated) field is an unordered list.
14041 /// This indicates that the service may provide the elements of the list
14042 /// in any arbitrary order, rather than the order the user originally
14043 /// provided. Additionally, the list's order may or may not be stable.
14044 UnorderedList,
14045 /// Denotes that this field returns a non-empty default value if not set.
14046 /// This indicates that if the user provides the empty value in a request,
14047 /// a non-empty value will be returned. The user will not be aware of what
14048 /// non-empty value to expect.
14049 NonEmptyDefault,
14050 /// Denotes that the field in a resource (a message annotated with
14051 /// google.api.resource) is used in the resource name to uniquely identify the
14052 /// resource. For AIP-compliant APIs, this should only be applied to the
14053 /// `name` field on the resource.
14054 ///
14055 /// This behavior should not be applied to references to other resources within
14056 /// the message.
14057 ///
14058 /// The identifier field of resources often have different field behavior
14059 /// depending on the request it is embedded in (e.g. for Create methods name
14060 /// is optional and unused, while for Update methods it is required). Instead
14061 /// of method-specific annotations, only `IDENTIFIER` is required.
14062 Identifier,
14063 /// If set, the enum was initialized with an unknown value.
14064 ///
14065 /// Applications can examine the value using [FieldBehavior::value] or
14066 /// [FieldBehavior::name].
14067 UnknownValue(field_behavior::UnknownValue),
14068}
14069
14070#[doc(hidden)]
14071pub mod field_behavior {
14072 #[allow(unused_imports)]
14073 use super::*;
14074 #[derive(Clone, Debug, PartialEq)]
14075 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14076}
14077
14078impl FieldBehavior {
14079 /// Gets the enum value.
14080 ///
14081 /// Returns `None` if the enum contains an unknown value deserialized from
14082 /// the string representation of enums.
14083 pub fn value(&self) -> std::option::Option<i32> {
14084 match self {
14085 Self::Unspecified => std::option::Option::Some(0),
14086 Self::Optional => std::option::Option::Some(1),
14087 Self::Required => std::option::Option::Some(2),
14088 Self::OutputOnly => std::option::Option::Some(3),
14089 Self::InputOnly => std::option::Option::Some(4),
14090 Self::Immutable => std::option::Option::Some(5),
14091 Self::UnorderedList => std::option::Option::Some(6),
14092 Self::NonEmptyDefault => std::option::Option::Some(7),
14093 Self::Identifier => std::option::Option::Some(8),
14094 Self::UnknownValue(u) => u.0.value(),
14095 }
14096 }
14097
14098 /// Gets the enum value as a string.
14099 ///
14100 /// Returns `None` if the enum contains an unknown value deserialized from
14101 /// the integer representation of enums.
14102 pub fn name(&self) -> std::option::Option<&str> {
14103 match self {
14104 Self::Unspecified => std::option::Option::Some("FIELD_BEHAVIOR_UNSPECIFIED"),
14105 Self::Optional => std::option::Option::Some("OPTIONAL"),
14106 Self::Required => std::option::Option::Some("REQUIRED"),
14107 Self::OutputOnly => std::option::Option::Some("OUTPUT_ONLY"),
14108 Self::InputOnly => std::option::Option::Some("INPUT_ONLY"),
14109 Self::Immutable => std::option::Option::Some("IMMUTABLE"),
14110 Self::UnorderedList => std::option::Option::Some("UNORDERED_LIST"),
14111 Self::NonEmptyDefault => std::option::Option::Some("NON_EMPTY_DEFAULT"),
14112 Self::Identifier => std::option::Option::Some("IDENTIFIER"),
14113 Self::UnknownValue(u) => u.0.name(),
14114 }
14115 }
14116}
14117
14118impl std::default::Default for FieldBehavior {
14119 fn default() -> Self {
14120 use std::convert::From;
14121 Self::from(0)
14122 }
14123}
14124
14125impl std::fmt::Display for FieldBehavior {
14126 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14127 wkt::internal::display_enum(f, self.name(), self.value())
14128 }
14129}
14130
14131impl std::convert::From<i32> for FieldBehavior {
14132 fn from(value: i32) -> Self {
14133 match value {
14134 0 => Self::Unspecified,
14135 1 => Self::Optional,
14136 2 => Self::Required,
14137 3 => Self::OutputOnly,
14138 4 => Self::InputOnly,
14139 5 => Self::Immutable,
14140 6 => Self::UnorderedList,
14141 7 => Self::NonEmptyDefault,
14142 8 => Self::Identifier,
14143 _ => Self::UnknownValue(field_behavior::UnknownValue(
14144 wkt::internal::UnknownEnumValue::Integer(value),
14145 )),
14146 }
14147 }
14148}
14149
14150impl std::convert::From<&str> for FieldBehavior {
14151 fn from(value: &str) -> Self {
14152 use std::string::ToString;
14153 match value {
14154 "FIELD_BEHAVIOR_UNSPECIFIED" => Self::Unspecified,
14155 "OPTIONAL" => Self::Optional,
14156 "REQUIRED" => Self::Required,
14157 "OUTPUT_ONLY" => Self::OutputOnly,
14158 "INPUT_ONLY" => Self::InputOnly,
14159 "IMMUTABLE" => Self::Immutable,
14160 "UNORDERED_LIST" => Self::UnorderedList,
14161 "NON_EMPTY_DEFAULT" => Self::NonEmptyDefault,
14162 "IDENTIFIER" => Self::Identifier,
14163 _ => Self::UnknownValue(field_behavior::UnknownValue(
14164 wkt::internal::UnknownEnumValue::String(value.to_string()),
14165 )),
14166 }
14167 }
14168}
14169
14170impl serde::ser::Serialize for FieldBehavior {
14171 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14172 where
14173 S: serde::Serializer,
14174 {
14175 match self {
14176 Self::Unspecified => serializer.serialize_i32(0),
14177 Self::Optional => serializer.serialize_i32(1),
14178 Self::Required => serializer.serialize_i32(2),
14179 Self::OutputOnly => serializer.serialize_i32(3),
14180 Self::InputOnly => serializer.serialize_i32(4),
14181 Self::Immutable => serializer.serialize_i32(5),
14182 Self::UnorderedList => serializer.serialize_i32(6),
14183 Self::NonEmptyDefault => serializer.serialize_i32(7),
14184 Self::Identifier => serializer.serialize_i32(8),
14185 Self::UnknownValue(u) => u.0.serialize(serializer),
14186 }
14187 }
14188}
14189
14190impl<'de> serde::de::Deserialize<'de> for FieldBehavior {
14191 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14192 where
14193 D: serde::Deserializer<'de>,
14194 {
14195 deserializer.deserialize_any(wkt::internal::EnumVisitor::<FieldBehavior>::new(
14196 ".google.api.FieldBehavior",
14197 ))
14198 }
14199}
14200
14201/// The launch stage as defined by [Google Cloud Platform
14202/// Launch Stages](https://cloud.google.com/terms/launch-stages).
14203///
14204/// # Working with unknown values
14205///
14206/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14207/// additional enum variants at any time. Adding new variants is not considered
14208/// a breaking change. Applications should write their code in anticipation of:
14209///
14210/// - New values appearing in future releases of the client library, **and**
14211/// - New values received dynamically, without application changes.
14212///
14213/// Please consult the [Working with enums] section in the user guide for some
14214/// guidelines.
14215///
14216/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
14217#[derive(Clone, Debug, PartialEq)]
14218#[non_exhaustive]
14219pub enum LaunchStage {
14220 /// Do not use this default value.
14221 Unspecified,
14222 /// The feature is not yet implemented. Users can not use it.
14223 Unimplemented,
14224 /// Prelaunch features are hidden from users and are only visible internally.
14225 Prelaunch,
14226 /// Early Access features are limited to a closed group of testers. To use
14227 /// these features, you must sign up in advance and sign a Trusted Tester
14228 /// agreement (which includes confidentiality provisions). These features may
14229 /// be unstable, changed in backward-incompatible ways, and are not
14230 /// guaranteed to be released.
14231 EarlyAccess,
14232 /// Alpha is a limited availability test for releases before they are cleared
14233 /// for widespread use. By Alpha, all significant design issues are resolved
14234 /// and we are in the process of verifying functionality. Alpha customers
14235 /// need to apply for access, agree to applicable terms, and have their
14236 /// projects allowlisted. Alpha releases don't have to be feature complete,
14237 /// no SLAs are provided, and there are no technical support obligations, but
14238 /// they will be far enough along that customers can actually use them in
14239 /// test environments or for limited-use tests -- just like they would in
14240 /// normal production cases.
14241 Alpha,
14242 /// Beta is the point at which we are ready to open a release for any
14243 /// customer to use. There are no SLA or technical support obligations in a
14244 /// Beta release. Products will be complete from a feature perspective, but
14245 /// may have some open outstanding issues. Beta releases are suitable for
14246 /// limited production use cases.
14247 Beta,
14248 /// GA features are open to all developers and are considered stable and
14249 /// fully qualified for production use.
14250 Ga,
14251 /// Deprecated features are scheduled to be shut down and removed. For more
14252 /// information, see the "Deprecation Policy" section of our [Terms of
14253 /// Service](https://cloud.google.com/terms/)
14254 /// and the [Google Cloud Platform Subject to the Deprecation
14255 /// Policy](https://cloud.google.com/terms/deprecation) documentation.
14256 Deprecated,
14257 /// If set, the enum was initialized with an unknown value.
14258 ///
14259 /// Applications can examine the value using [LaunchStage::value] or
14260 /// [LaunchStage::name].
14261 UnknownValue(launch_stage::UnknownValue),
14262}
14263
14264#[doc(hidden)]
14265pub mod launch_stage {
14266 #[allow(unused_imports)]
14267 use super::*;
14268 #[derive(Clone, Debug, PartialEq)]
14269 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14270}
14271
14272impl LaunchStage {
14273 /// Gets the enum value.
14274 ///
14275 /// Returns `None` if the enum contains an unknown value deserialized from
14276 /// the string representation of enums.
14277 pub fn value(&self) -> std::option::Option<i32> {
14278 match self {
14279 Self::Unspecified => std::option::Option::Some(0),
14280 Self::Unimplemented => std::option::Option::Some(6),
14281 Self::Prelaunch => std::option::Option::Some(7),
14282 Self::EarlyAccess => std::option::Option::Some(1),
14283 Self::Alpha => std::option::Option::Some(2),
14284 Self::Beta => std::option::Option::Some(3),
14285 Self::Ga => std::option::Option::Some(4),
14286 Self::Deprecated => std::option::Option::Some(5),
14287 Self::UnknownValue(u) => u.0.value(),
14288 }
14289 }
14290
14291 /// Gets the enum value as a string.
14292 ///
14293 /// Returns `None` if the enum contains an unknown value deserialized from
14294 /// the integer representation of enums.
14295 pub fn name(&self) -> std::option::Option<&str> {
14296 match self {
14297 Self::Unspecified => std::option::Option::Some("LAUNCH_STAGE_UNSPECIFIED"),
14298 Self::Unimplemented => std::option::Option::Some("UNIMPLEMENTED"),
14299 Self::Prelaunch => std::option::Option::Some("PRELAUNCH"),
14300 Self::EarlyAccess => std::option::Option::Some("EARLY_ACCESS"),
14301 Self::Alpha => std::option::Option::Some("ALPHA"),
14302 Self::Beta => std::option::Option::Some("BETA"),
14303 Self::Ga => std::option::Option::Some("GA"),
14304 Self::Deprecated => std::option::Option::Some("DEPRECATED"),
14305 Self::UnknownValue(u) => u.0.name(),
14306 }
14307 }
14308}
14309
14310impl std::default::Default for LaunchStage {
14311 fn default() -> Self {
14312 use std::convert::From;
14313 Self::from(0)
14314 }
14315}
14316
14317impl std::fmt::Display for LaunchStage {
14318 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14319 wkt::internal::display_enum(f, self.name(), self.value())
14320 }
14321}
14322
14323impl std::convert::From<i32> for LaunchStage {
14324 fn from(value: i32) -> Self {
14325 match value {
14326 0 => Self::Unspecified,
14327 1 => Self::EarlyAccess,
14328 2 => Self::Alpha,
14329 3 => Self::Beta,
14330 4 => Self::Ga,
14331 5 => Self::Deprecated,
14332 6 => Self::Unimplemented,
14333 7 => Self::Prelaunch,
14334 _ => Self::UnknownValue(launch_stage::UnknownValue(
14335 wkt::internal::UnknownEnumValue::Integer(value),
14336 )),
14337 }
14338 }
14339}
14340
14341impl std::convert::From<&str> for LaunchStage {
14342 fn from(value: &str) -> Self {
14343 use std::string::ToString;
14344 match value {
14345 "LAUNCH_STAGE_UNSPECIFIED" => Self::Unspecified,
14346 "UNIMPLEMENTED" => Self::Unimplemented,
14347 "PRELAUNCH" => Self::Prelaunch,
14348 "EARLY_ACCESS" => Self::EarlyAccess,
14349 "ALPHA" => Self::Alpha,
14350 "BETA" => Self::Beta,
14351 "GA" => Self::Ga,
14352 "DEPRECATED" => Self::Deprecated,
14353 _ => Self::UnknownValue(launch_stage::UnknownValue(
14354 wkt::internal::UnknownEnumValue::String(value.to_string()),
14355 )),
14356 }
14357 }
14358}
14359
14360impl serde::ser::Serialize for LaunchStage {
14361 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14362 where
14363 S: serde::Serializer,
14364 {
14365 match self {
14366 Self::Unspecified => serializer.serialize_i32(0),
14367 Self::Unimplemented => serializer.serialize_i32(6),
14368 Self::Prelaunch => serializer.serialize_i32(7),
14369 Self::EarlyAccess => serializer.serialize_i32(1),
14370 Self::Alpha => serializer.serialize_i32(2),
14371 Self::Beta => serializer.serialize_i32(3),
14372 Self::Ga => serializer.serialize_i32(4),
14373 Self::Deprecated => serializer.serialize_i32(5),
14374 Self::UnknownValue(u) => u.0.serialize(serializer),
14375 }
14376 }
14377}
14378
14379impl<'de> serde::de::Deserialize<'de> for LaunchStage {
14380 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14381 where
14382 D: serde::Deserializer<'de>,
14383 {
14384 deserializer.deserialize_any(wkt::internal::EnumVisitor::<LaunchStage>::new(
14385 ".google.api.LaunchStage",
14386 ))
14387 }
14388}