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 ///
460 /// <https://library-example.googleapis.com/google.example.library.v1.LibraryService>
461 ///
462 /// - <https://library-example.googleapis.com/>
463 ///
464 /// Example:
465 ///
466 /// ```norust
467 /// audiences: bookstore_android.apps.googleusercontent.com,
468 /// bookstore_web.apps.googleusercontent.com
469 /// ```
470 pub audiences: std::string::String,
471
472 /// Redirect URL if JWT token is required but not present or is expired.
473 /// Implement authorizationUrl of securityDefinitions in OpenAPI spec.
474 pub authorization_url: std::string::String,
475
476 /// Defines the locations to extract the JWT. For now it is only used by the
477 /// Cloud Endpoints to store the OpenAPI extension [x-google-jwt-locations]
478 /// (<https://cloud.google.com/endpoints/docs/openapi/openapi-extensions#x-google-jwt-locations>)
479 ///
480 /// JWT locations can be one of HTTP headers, URL query parameters or
481 /// cookies. The rule is that the first match wins.
482 ///
483 /// If not specified, default to use following 3 locations:
484 ///
485 /// 1. Authorization: Bearer
486 /// 1. x-goog-iap-jwt-assertion
487 /// 1. access_token query parameter
488 ///
489 /// Default locations can be specified as followings:
490 /// jwt_locations:
491 ///
492 /// - header: Authorization
493 /// value_prefix: "Bearer "
494 /// - header: x-goog-iap-jwt-assertion
495 /// - query: access_token
496 pub jwt_locations: std::vec::Vec<crate::model::JwtLocation>,
497
498 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
499}
500
501impl AuthProvider {
502 pub fn new() -> Self {
503 std::default::Default::default()
504 }
505
506 /// Sets the value of [id][crate::model::AuthProvider::id].
507 ///
508 /// # Example
509 /// ```ignore,no_run
510 /// # use google_cloud_api::model::AuthProvider;
511 /// let x = AuthProvider::new().set_id("example");
512 /// ```
513 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
514 self.id = v.into();
515 self
516 }
517
518 /// Sets the value of [issuer][crate::model::AuthProvider::issuer].
519 ///
520 /// # Example
521 /// ```ignore,no_run
522 /// # use google_cloud_api::model::AuthProvider;
523 /// let x = AuthProvider::new().set_issuer("example");
524 /// ```
525 pub fn set_issuer<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
526 self.issuer = v.into();
527 self
528 }
529
530 /// Sets the value of [jwks_uri][crate::model::AuthProvider::jwks_uri].
531 ///
532 /// # Example
533 /// ```ignore,no_run
534 /// # use google_cloud_api::model::AuthProvider;
535 /// let x = AuthProvider::new().set_jwks_uri("example");
536 /// ```
537 pub fn set_jwks_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
538 self.jwks_uri = v.into();
539 self
540 }
541
542 /// Sets the value of [audiences][crate::model::AuthProvider::audiences].
543 ///
544 /// # Example
545 /// ```ignore,no_run
546 /// # use google_cloud_api::model::AuthProvider;
547 /// let x = AuthProvider::new().set_audiences("example");
548 /// ```
549 pub fn set_audiences<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
550 self.audiences = v.into();
551 self
552 }
553
554 /// Sets the value of [authorization_url][crate::model::AuthProvider::authorization_url].
555 ///
556 /// # Example
557 /// ```ignore,no_run
558 /// # use google_cloud_api::model::AuthProvider;
559 /// let x = AuthProvider::new().set_authorization_url("example");
560 /// ```
561 pub fn set_authorization_url<T: std::convert::Into<std::string::String>>(
562 mut self,
563 v: T,
564 ) -> Self {
565 self.authorization_url = v.into();
566 self
567 }
568
569 /// Sets the value of [jwt_locations][crate::model::AuthProvider::jwt_locations].
570 ///
571 /// # Example
572 /// ```ignore,no_run
573 /// # use google_cloud_api::model::AuthProvider;
574 /// use google_cloud_api::model::JwtLocation;
575 /// let x = AuthProvider::new()
576 /// .set_jwt_locations([
577 /// JwtLocation::default()/* use setters */,
578 /// JwtLocation::default()/* use (different) setters */,
579 /// ]);
580 /// ```
581 pub fn set_jwt_locations<T, V>(mut self, v: T) -> Self
582 where
583 T: std::iter::IntoIterator<Item = V>,
584 V: std::convert::Into<crate::model::JwtLocation>,
585 {
586 use std::iter::Iterator;
587 self.jwt_locations = v.into_iter().map(|i| i.into()).collect();
588 self
589 }
590}
591
592impl wkt::message::Message for AuthProvider {
593 fn typename() -> &'static str {
594 "type.googleapis.com/google.api.AuthProvider"
595 }
596}
597
598/// OAuth scopes are a way to define data and permissions on data. For example,
599/// there are scopes defined for "Read-only access to Google Calendar" and
600/// "Access to Cloud Platform". Users can consent to a scope for an application,
601/// giving it permission to access that data on their behalf.
602///
603/// OAuth scope specifications should be fairly coarse grained; a user will need
604/// to see and understand the text description of what your scope means.
605///
606/// In most cases: use one or at most two OAuth scopes for an entire family of
607/// products. If your product has multiple APIs, you should probably be sharing
608/// the OAuth scope across all of those APIs.
609///
610/// When you need finer grained OAuth consent screens: talk with your product
611/// management about how developers will use them in practice.
612///
613/// Please note that even though each of the canonical scopes is enough for a
614/// request to be accepted and passed to the backend, a request can still fail
615/// due to the backend requiring additional scopes or permissions.
616#[derive(Clone, Default, PartialEq)]
617#[non_exhaustive]
618pub struct OAuthRequirements {
619 /// The list of publicly documented OAuth scopes that are allowed access. An
620 /// OAuth token containing any of these scopes will be accepted.
621 ///
622 /// Example:
623 ///
624 /// ```norust
625 /// canonical_scopes: https://www.googleapis.com/auth/calendar,
626 /// https://www.googleapis.com/auth/calendar.read
627 /// ```
628 pub canonical_scopes: std::string::String,
629
630 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
631}
632
633impl OAuthRequirements {
634 pub fn new() -> Self {
635 std::default::Default::default()
636 }
637
638 /// Sets the value of [canonical_scopes][crate::model::OAuthRequirements::canonical_scopes].
639 ///
640 /// # Example
641 /// ```ignore,no_run
642 /// # use google_cloud_api::model::OAuthRequirements;
643 /// let x = OAuthRequirements::new().set_canonical_scopes("example");
644 /// ```
645 pub fn set_canonical_scopes<T: std::convert::Into<std::string::String>>(
646 mut self,
647 v: T,
648 ) -> Self {
649 self.canonical_scopes = v.into();
650 self
651 }
652}
653
654impl wkt::message::Message for OAuthRequirements {
655 fn typename() -> &'static str {
656 "type.googleapis.com/google.api.OAuthRequirements"
657 }
658}
659
660/// User-defined authentication requirements, including support for
661/// [JSON Web Token
662/// (JWT)](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32).
663#[derive(Clone, Default, PartialEq)]
664#[non_exhaustive]
665pub struct AuthRequirement {
666 /// [id][google.api.AuthProvider.id] from authentication provider.
667 ///
668 /// Example:
669 ///
670 /// ```norust
671 /// provider_id: bookstore_auth
672 /// ```
673 ///
674 /// [google.api.AuthProvider.id]: crate::model::AuthProvider::id
675 pub provider_id: std::string::String,
676
677 /// NOTE: This will be deprecated soon, once AuthProvider.audiences is
678 /// implemented and accepted in all the runtime components.
679 ///
680 /// The list of JWT
681 /// [audiences](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.3).
682 /// that are allowed to access. A JWT containing any of these audiences will
683 /// be accepted. When this setting is absent, only JWTs with audience
684 /// "https://[Service_name][google.api.Service.name]/[API_name][google.protobuf.Api.name]"
685 /// will be accepted. For example, if no audiences are in the setting,
686 /// LibraryService API will only accept JWTs with the following audience
687 /// `https://library-example.googleapis.com/google.example.library.v1.LibraryService`.
688 ///
689 /// Example:
690 ///
691 /// ```norust
692 /// audiences: bookstore_android.apps.googleusercontent.com,
693 /// bookstore_web.apps.googleusercontent.com
694 /// ```
695 ///
696 /// [google.api.Service.name]: crate::model::Service::name
697 /// [google.protobuf.Api.name]: wkt::Api::name
698 pub audiences: std::string::String,
699
700 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
701}
702
703impl AuthRequirement {
704 pub fn new() -> Self {
705 std::default::Default::default()
706 }
707
708 /// Sets the value of [provider_id][crate::model::AuthRequirement::provider_id].
709 ///
710 /// # Example
711 /// ```ignore,no_run
712 /// # use google_cloud_api::model::AuthRequirement;
713 /// let x = AuthRequirement::new().set_provider_id("example");
714 /// ```
715 pub fn set_provider_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
716 self.provider_id = v.into();
717 self
718 }
719
720 /// Sets the value of [audiences][crate::model::AuthRequirement::audiences].
721 ///
722 /// # Example
723 /// ```ignore,no_run
724 /// # use google_cloud_api::model::AuthRequirement;
725 /// let x = AuthRequirement::new().set_audiences("example");
726 /// ```
727 pub fn set_audiences<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
728 self.audiences = v.into();
729 self
730 }
731}
732
733impl wkt::message::Message for AuthRequirement {
734 fn typename() -> &'static str {
735 "type.googleapis.com/google.api.AuthRequirement"
736 }
737}
738
739/// `Backend` defines the backend configuration for a service.
740#[derive(Clone, Default, PartialEq)]
741#[non_exhaustive]
742pub struct Backend {
743 /// A list of API backend rules that apply to individual API methods.
744 ///
745 /// **NOTE:** All service configuration rules follow "last one wins" order.
746 pub rules: std::vec::Vec<crate::model::BackendRule>,
747
748 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
749}
750
751impl Backend {
752 pub fn new() -> Self {
753 std::default::Default::default()
754 }
755
756 /// Sets the value of [rules][crate::model::Backend::rules].
757 ///
758 /// # Example
759 /// ```ignore,no_run
760 /// # use google_cloud_api::model::Backend;
761 /// use google_cloud_api::model::BackendRule;
762 /// let x = Backend::new()
763 /// .set_rules([
764 /// BackendRule::default()/* use setters */,
765 /// BackendRule::default()/* use (different) setters */,
766 /// ]);
767 /// ```
768 pub fn set_rules<T, V>(mut self, v: T) -> Self
769 where
770 T: std::iter::IntoIterator<Item = V>,
771 V: std::convert::Into<crate::model::BackendRule>,
772 {
773 use std::iter::Iterator;
774 self.rules = v.into_iter().map(|i| i.into()).collect();
775 self
776 }
777}
778
779impl wkt::message::Message for Backend {
780 fn typename() -> &'static str {
781 "type.googleapis.com/google.api.Backend"
782 }
783}
784
785/// A backend rule provides configuration for an individual API element.
786#[derive(Clone, Default, PartialEq)]
787#[non_exhaustive]
788pub struct BackendRule {
789 /// Selects the methods to which this rule applies.
790 ///
791 /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
792 /// details.
793 ///
794 /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
795 pub selector: std::string::String,
796
797 /// The address of the API backend.
798 ///
799 /// The scheme is used to determine the backend protocol and security.
800 /// The following schemes are accepted:
801 ///
802 /// SCHEME PROTOCOL SECURITY
803 /// http:// HTTP None
804 /// https:// HTTP TLS
805 /// grpc:// gRPC None
806 /// grpcs:// gRPC TLS
807 ///
808 /// It is recommended to explicitly include a scheme. Leaving out the scheme
809 /// may cause constrasting behaviors across platforms.
810 ///
811 /// If the port is unspecified, the default is:
812 ///
813 /// - 80 for schemes without TLS
814 /// - 443 for schemes with TLS
815 ///
816 /// For HTTP backends, use [protocol][google.api.BackendRule.protocol]
817 /// to specify the protocol version.
818 ///
819 /// [google.api.BackendRule.protocol]: crate::model::BackendRule::protocol
820 pub address: std::string::String,
821
822 /// The number of seconds to wait for a response from a request. The default
823 /// varies based on the request protocol and deployment environment.
824 pub deadline: f64,
825
826 /// Deprecated, do not use.
827 #[deprecated]
828 pub min_deadline: f64,
829
830 /// The number of seconds to wait for the completion of a long running
831 /// operation. The default is no deadline.
832 pub operation_deadline: f64,
833
834 pub path_translation: crate::model::backend_rule::PathTranslation,
835
836 /// The protocol used for sending a request to the backend.
837 /// The supported values are "http/1.1" and "h2".
838 ///
839 /// The default value is inferred from the scheme in the
840 /// [address][google.api.BackendRule.address] field:
841 ///
842 /// SCHEME PROTOCOL
843 /// http:// http/1.1
844 /// https:// http/1.1
845 /// grpc:// h2
846 /// grpcs:// h2
847 ///
848 /// For secure HTTP backends (https://) that support HTTP/2, set this field
849 /// to "h2" for improved performance.
850 ///
851 /// Configuring this field to non-default values is only supported for secure
852 /// HTTP backends. This field will be ignored for all other backends.
853 ///
854 /// See
855 /// <https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml#alpn-protocol-ids>
856 /// for more details on the supported values.
857 ///
858 /// [google.api.BackendRule.address]: crate::model::BackendRule::address
859 pub protocol: std::string::String,
860
861 /// The map between request protocol and the backend address.
862 pub overrides_by_request_protocol:
863 std::collections::HashMap<std::string::String, crate::model::BackendRule>,
864
865 /// Authentication settings used by the backend.
866 ///
867 /// These are typically used to provide service management functionality to
868 /// a backend served on a publicly-routable URL. The `authentication`
869 /// details should match the authentication behavior used by the backend.
870 ///
871 /// For example, specifying `jwt_audience` implies that the backend expects
872 /// authentication via a JWT.
873 ///
874 /// When authentication is unspecified, the resulting behavior is the same
875 /// as `disable_auth` set to `true`.
876 ///
877 /// Refer to <https://developers.google.com/identity/protocols/OpenIDConnect> for
878 /// JWT ID token.
879 pub authentication: std::option::Option<crate::model::backend_rule::Authentication>,
880
881 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
882}
883
884impl BackendRule {
885 pub fn new() -> Self {
886 std::default::Default::default()
887 }
888
889 /// Sets the value of [selector][crate::model::BackendRule::selector].
890 ///
891 /// # Example
892 /// ```ignore,no_run
893 /// # use google_cloud_api::model::BackendRule;
894 /// let x = BackendRule::new().set_selector("example");
895 /// ```
896 pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
897 self.selector = v.into();
898 self
899 }
900
901 /// Sets the value of [address][crate::model::BackendRule::address].
902 ///
903 /// # Example
904 /// ```ignore,no_run
905 /// # use google_cloud_api::model::BackendRule;
906 /// let x = BackendRule::new().set_address("example");
907 /// ```
908 pub fn set_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
909 self.address = v.into();
910 self
911 }
912
913 /// Sets the value of [deadline][crate::model::BackendRule::deadline].
914 ///
915 /// # Example
916 /// ```ignore,no_run
917 /// # use google_cloud_api::model::BackendRule;
918 /// let x = BackendRule::new().set_deadline(42.0);
919 /// ```
920 pub fn set_deadline<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
921 self.deadline = v.into();
922 self
923 }
924
925 /// Sets the value of [min_deadline][crate::model::BackendRule::min_deadline].
926 ///
927 /// # Example
928 /// ```ignore,no_run
929 /// # use google_cloud_api::model::BackendRule;
930 /// let x = BackendRule::new().set_min_deadline(42.0);
931 /// ```
932 #[deprecated]
933 pub fn set_min_deadline<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
934 self.min_deadline = v.into();
935 self
936 }
937
938 /// Sets the value of [operation_deadline][crate::model::BackendRule::operation_deadline].
939 ///
940 /// # Example
941 /// ```ignore,no_run
942 /// # use google_cloud_api::model::BackendRule;
943 /// let x = BackendRule::new().set_operation_deadline(42.0);
944 /// ```
945 pub fn set_operation_deadline<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
946 self.operation_deadline = v.into();
947 self
948 }
949
950 /// Sets the value of [path_translation][crate::model::BackendRule::path_translation].
951 ///
952 /// # Example
953 /// ```ignore,no_run
954 /// # use google_cloud_api::model::BackendRule;
955 /// use google_cloud_api::model::backend_rule::PathTranslation;
956 /// let x0 = BackendRule::new().set_path_translation(PathTranslation::ConstantAddress);
957 /// let x1 = BackendRule::new().set_path_translation(PathTranslation::AppendPathToAddress);
958 /// ```
959 pub fn set_path_translation<
960 T: std::convert::Into<crate::model::backend_rule::PathTranslation>,
961 >(
962 mut self,
963 v: T,
964 ) -> Self {
965 self.path_translation = v.into();
966 self
967 }
968
969 /// Sets the value of [protocol][crate::model::BackendRule::protocol].
970 ///
971 /// # Example
972 /// ```ignore,no_run
973 /// # use google_cloud_api::model::BackendRule;
974 /// let x = BackendRule::new().set_protocol("example");
975 /// ```
976 pub fn set_protocol<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
977 self.protocol = v.into();
978 self
979 }
980
981 /// Sets the value of [overrides_by_request_protocol][crate::model::BackendRule::overrides_by_request_protocol].
982 ///
983 /// # Example
984 /// ```ignore,no_run
985 /// # use google_cloud_api::model::BackendRule;
986 /// let x = BackendRule::new().set_overrides_by_request_protocol([
987 /// ("key0", BackendRule::default()/* use setters */),
988 /// ("key1", BackendRule::default()/* use (different) setters */),
989 /// ]);
990 /// ```
991 pub fn set_overrides_by_request_protocol<T, K, V>(mut self, v: T) -> Self
992 where
993 T: std::iter::IntoIterator<Item = (K, V)>,
994 K: std::convert::Into<std::string::String>,
995 V: std::convert::Into<crate::model::BackendRule>,
996 {
997 use std::iter::Iterator;
998 self.overrides_by_request_protocol =
999 v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1000 self
1001 }
1002
1003 /// Sets the value of [authentication][crate::model::BackendRule::authentication].
1004 ///
1005 /// Note that all the setters affecting `authentication` are mutually
1006 /// exclusive.
1007 ///
1008 /// # Example
1009 /// ```ignore,no_run
1010 /// # use google_cloud_api::model::BackendRule;
1011 /// use google_cloud_api::model::backend_rule::Authentication;
1012 /// let x = BackendRule::new().set_authentication(Some(Authentication::JwtAudience("example".to_string())));
1013 /// ```
1014 pub fn set_authentication<
1015 T: std::convert::Into<std::option::Option<crate::model::backend_rule::Authentication>>,
1016 >(
1017 mut self,
1018 v: T,
1019 ) -> Self {
1020 self.authentication = v.into();
1021 self
1022 }
1023
1024 /// The value of [authentication][crate::model::BackendRule::authentication]
1025 /// if it holds a `JwtAudience`, `None` if the field is not set or
1026 /// holds a different branch.
1027 pub fn jwt_audience(&self) -> std::option::Option<&std::string::String> {
1028 #[allow(unreachable_patterns)]
1029 self.authentication.as_ref().and_then(|v| match v {
1030 crate::model::backend_rule::Authentication::JwtAudience(v) => {
1031 std::option::Option::Some(v)
1032 }
1033 _ => std::option::Option::None,
1034 })
1035 }
1036
1037 /// Sets the value of [authentication][crate::model::BackendRule::authentication]
1038 /// to hold a `JwtAudience`.
1039 ///
1040 /// Note that all the setters affecting `authentication` are
1041 /// mutually exclusive.
1042 ///
1043 /// # Example
1044 /// ```ignore,no_run
1045 /// # use google_cloud_api::model::BackendRule;
1046 /// let x = BackendRule::new().set_jwt_audience("example");
1047 /// assert!(x.jwt_audience().is_some());
1048 /// assert!(x.disable_auth().is_none());
1049 /// ```
1050 pub fn set_jwt_audience<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1051 self.authentication = std::option::Option::Some(
1052 crate::model::backend_rule::Authentication::JwtAudience(v.into()),
1053 );
1054 self
1055 }
1056
1057 /// The value of [authentication][crate::model::BackendRule::authentication]
1058 /// if it holds a `DisableAuth`, `None` if the field is not set or
1059 /// holds a different branch.
1060 pub fn disable_auth(&self) -> std::option::Option<&bool> {
1061 #[allow(unreachable_patterns)]
1062 self.authentication.as_ref().and_then(|v| match v {
1063 crate::model::backend_rule::Authentication::DisableAuth(v) => {
1064 std::option::Option::Some(v)
1065 }
1066 _ => std::option::Option::None,
1067 })
1068 }
1069
1070 /// Sets the value of [authentication][crate::model::BackendRule::authentication]
1071 /// to hold a `DisableAuth`.
1072 ///
1073 /// Note that all the setters affecting `authentication` are
1074 /// mutually exclusive.
1075 ///
1076 /// # Example
1077 /// ```ignore,no_run
1078 /// # use google_cloud_api::model::BackendRule;
1079 /// let x = BackendRule::new().set_disable_auth(true);
1080 /// assert!(x.disable_auth().is_some());
1081 /// assert!(x.jwt_audience().is_none());
1082 /// ```
1083 pub fn set_disable_auth<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1084 self.authentication = std::option::Option::Some(
1085 crate::model::backend_rule::Authentication::DisableAuth(v.into()),
1086 );
1087 self
1088 }
1089}
1090
1091impl wkt::message::Message for BackendRule {
1092 fn typename() -> &'static str {
1093 "type.googleapis.com/google.api.BackendRule"
1094 }
1095}
1096
1097/// Defines additional types related to [BackendRule].
1098pub mod backend_rule {
1099 #[allow(unused_imports)]
1100 use super::*;
1101
1102 /// Path Translation specifies how to combine the backend address with the
1103 /// request path in order to produce the appropriate forwarding URL for the
1104 /// request.
1105 ///
1106 /// Path Translation is applicable only to HTTP-based backends. Backends which
1107 /// do not accept requests over HTTP/HTTPS should leave `path_translation`
1108 /// unspecified.
1109 ///
1110 /// # Working with unknown values
1111 ///
1112 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1113 /// additional enum variants at any time. Adding new variants is not considered
1114 /// a breaking change. Applications should write their code in anticipation of:
1115 ///
1116 /// - New values appearing in future releases of the client library, **and**
1117 /// - New values received dynamically, without application changes.
1118 ///
1119 /// Please consult the [Working with enums] section in the user guide for some
1120 /// guidelines.
1121 ///
1122 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1123 #[derive(Clone, Debug, PartialEq)]
1124 #[non_exhaustive]
1125 pub enum PathTranslation {
1126 Unspecified,
1127 /// Use the backend address as-is, with no modification to the path. If the
1128 /// URL pattern contains variables, the variable names and values will be
1129 /// appended to the query string. If a query string parameter and a URL
1130 /// pattern variable have the same name, this may result in duplicate keys in
1131 /// the query string.
1132 ///
1133 /// # Examples
1134 ///
1135 /// Given the following operation config:
1136 ///
1137 /// ```norust
1138 /// Method path: /api/company/{cid}/user/{uid}
1139 /// Backend address: https://example.cloudfunctions.net/getUser
1140 /// ```
1141 ///
1142 /// Requests to the following request paths will call the backend at the
1143 /// translated path:
1144 ///
1145 /// ```norust
1146 /// Request path: /api/company/widgetworks/user/johndoe
1147 /// Translated:
1148 /// https://example.cloudfunctions.net/getUser?cid=widgetworks&uid=johndoe
1149 ///
1150 /// Request path: /api/company/widgetworks/user/johndoe?timezone=EST
1151 /// Translated:
1152 /// https://example.cloudfunctions.net/getUser?timezone=EST&cid=widgetworks&uid=johndoe
1153 /// ```
1154 ConstantAddress,
1155 /// The request path will be appended to the backend address.
1156 ///
1157 /// # Examples
1158 ///
1159 /// Given the following operation config:
1160 ///
1161 /// ```norust
1162 /// Method path: /api/company/{cid}/user/{uid}
1163 /// Backend address: https://example.appspot.com
1164 /// ```
1165 ///
1166 /// Requests to the following request paths will call the backend at the
1167 /// translated path:
1168 ///
1169 /// ```norust
1170 /// Request path: /api/company/widgetworks/user/johndoe
1171 /// Translated:
1172 /// https://example.appspot.com/api/company/widgetworks/user/johndoe
1173 ///
1174 /// Request path: /api/company/widgetworks/user/johndoe?timezone=EST
1175 /// Translated:
1176 /// https://example.appspot.com/api/company/widgetworks/user/johndoe?timezone=EST
1177 /// ```
1178 AppendPathToAddress,
1179 /// If set, the enum was initialized with an unknown value.
1180 ///
1181 /// Applications can examine the value using [PathTranslation::value] or
1182 /// [PathTranslation::name].
1183 UnknownValue(path_translation::UnknownValue),
1184 }
1185
1186 #[doc(hidden)]
1187 pub mod path_translation {
1188 #[allow(unused_imports)]
1189 use super::*;
1190 #[derive(Clone, Debug, PartialEq)]
1191 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1192 }
1193
1194 impl PathTranslation {
1195 /// Gets the enum value.
1196 ///
1197 /// Returns `None` if the enum contains an unknown value deserialized from
1198 /// the string representation of enums.
1199 pub fn value(&self) -> std::option::Option<i32> {
1200 match self {
1201 Self::Unspecified => std::option::Option::Some(0),
1202 Self::ConstantAddress => std::option::Option::Some(1),
1203 Self::AppendPathToAddress => std::option::Option::Some(2),
1204 Self::UnknownValue(u) => u.0.value(),
1205 }
1206 }
1207
1208 /// Gets the enum value as a string.
1209 ///
1210 /// Returns `None` if the enum contains an unknown value deserialized from
1211 /// the integer representation of enums.
1212 pub fn name(&self) -> std::option::Option<&str> {
1213 match self {
1214 Self::Unspecified => std::option::Option::Some("PATH_TRANSLATION_UNSPECIFIED"),
1215 Self::ConstantAddress => std::option::Option::Some("CONSTANT_ADDRESS"),
1216 Self::AppendPathToAddress => std::option::Option::Some("APPEND_PATH_TO_ADDRESS"),
1217 Self::UnknownValue(u) => u.0.name(),
1218 }
1219 }
1220 }
1221
1222 impl std::default::Default for PathTranslation {
1223 fn default() -> Self {
1224 use std::convert::From;
1225 Self::from(0)
1226 }
1227 }
1228
1229 impl std::fmt::Display for PathTranslation {
1230 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1231 wkt::internal::display_enum(f, self.name(), self.value())
1232 }
1233 }
1234
1235 impl std::convert::From<i32> for PathTranslation {
1236 fn from(value: i32) -> Self {
1237 match value {
1238 0 => Self::Unspecified,
1239 1 => Self::ConstantAddress,
1240 2 => Self::AppendPathToAddress,
1241 _ => Self::UnknownValue(path_translation::UnknownValue(
1242 wkt::internal::UnknownEnumValue::Integer(value),
1243 )),
1244 }
1245 }
1246 }
1247
1248 impl std::convert::From<&str> for PathTranslation {
1249 fn from(value: &str) -> Self {
1250 use std::string::ToString;
1251 match value {
1252 "PATH_TRANSLATION_UNSPECIFIED" => Self::Unspecified,
1253 "CONSTANT_ADDRESS" => Self::ConstantAddress,
1254 "APPEND_PATH_TO_ADDRESS" => Self::AppendPathToAddress,
1255 _ => Self::UnknownValue(path_translation::UnknownValue(
1256 wkt::internal::UnknownEnumValue::String(value.to_string()),
1257 )),
1258 }
1259 }
1260 }
1261
1262 impl serde::ser::Serialize for PathTranslation {
1263 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1264 where
1265 S: serde::Serializer,
1266 {
1267 match self {
1268 Self::Unspecified => serializer.serialize_i32(0),
1269 Self::ConstantAddress => serializer.serialize_i32(1),
1270 Self::AppendPathToAddress => serializer.serialize_i32(2),
1271 Self::UnknownValue(u) => u.0.serialize(serializer),
1272 }
1273 }
1274 }
1275
1276 impl<'de> serde::de::Deserialize<'de> for PathTranslation {
1277 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1278 where
1279 D: serde::Deserializer<'de>,
1280 {
1281 deserializer.deserialize_any(wkt::internal::EnumVisitor::<PathTranslation>::new(
1282 ".google.api.BackendRule.PathTranslation",
1283 ))
1284 }
1285 }
1286
1287 /// Authentication settings used by the backend.
1288 ///
1289 /// These are typically used to provide service management functionality to
1290 /// a backend served on a publicly-routable URL. The `authentication`
1291 /// details should match the authentication behavior used by the backend.
1292 ///
1293 /// For example, specifying `jwt_audience` implies that the backend expects
1294 /// authentication via a JWT.
1295 ///
1296 /// When authentication is unspecified, the resulting behavior is the same
1297 /// as `disable_auth` set to `true`.
1298 ///
1299 /// Refer to <https://developers.google.com/identity/protocols/OpenIDConnect> for
1300 /// JWT ID token.
1301 #[derive(Clone, Debug, PartialEq)]
1302 #[non_exhaustive]
1303 pub enum Authentication {
1304 /// The JWT audience is used when generating a JWT ID token for the backend.
1305 /// This ID token will be added in the HTTP "authorization" header, and sent
1306 /// to the backend.
1307 JwtAudience(std::string::String),
1308 /// When disable_auth is true, a JWT ID token won't be generated and the
1309 /// original "Authorization" HTTP header will be preserved. If the header is
1310 /// used to carry the original token and is expected by the backend, this
1311 /// field must be set to true to preserve the header.
1312 DisableAuth(bool),
1313 }
1314}
1315
1316/// Billing related configuration of the service.
1317///
1318/// The following example shows how to configure monitored resources and metrics
1319/// for billing, `consumer_destinations` is the only supported destination and
1320/// the monitored resources need at least one label key
1321/// `cloud.googleapis.com/location` to indicate the location of the billing
1322/// usage, using different monitored resources between monitoring and billing is
1323/// recommended so they can be evolved independently:
1324///
1325/// ```norust
1326/// monitored_resources:
1327/// - type: library.googleapis.com/billing_branch
1328/// labels:
1329/// - key: cloud.googleapis.com/location
1330/// description: |
1331/// Predefined label to support billing location restriction.
1332/// - key: city
1333/// description: |
1334/// Custom label to define the city where the library branch is located
1335/// in.
1336/// - key: name
1337/// description: Custom label to define the name of the library branch.
1338/// metrics:
1339/// - name: library.googleapis.com/book/borrowed_count
1340/// metric_kind: DELTA
1341/// value_type: INT64
1342/// unit: "1"
1343/// billing:
1344/// consumer_destinations:
1345/// - monitored_resource: library.googleapis.com/billing_branch
1346/// metrics:
1347/// - library.googleapis.com/book/borrowed_count
1348/// ```
1349#[derive(Clone, Default, PartialEq)]
1350#[non_exhaustive]
1351pub struct Billing {
1352 /// Billing configurations for sending metrics to the consumer project.
1353 /// There can be multiple consumer destinations per service, each one must have
1354 /// a different monitored resource type. A metric can be used in at most
1355 /// one consumer destination.
1356 pub consumer_destinations: std::vec::Vec<crate::model::billing::BillingDestination>,
1357
1358 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1359}
1360
1361impl Billing {
1362 pub fn new() -> Self {
1363 std::default::Default::default()
1364 }
1365
1366 /// Sets the value of [consumer_destinations][crate::model::Billing::consumer_destinations].
1367 ///
1368 /// # Example
1369 /// ```ignore,no_run
1370 /// # use google_cloud_api::model::Billing;
1371 /// use google_cloud_api::model::billing::BillingDestination;
1372 /// let x = Billing::new()
1373 /// .set_consumer_destinations([
1374 /// BillingDestination::default()/* use setters */,
1375 /// BillingDestination::default()/* use (different) setters */,
1376 /// ]);
1377 /// ```
1378 pub fn set_consumer_destinations<T, V>(mut self, v: T) -> Self
1379 where
1380 T: std::iter::IntoIterator<Item = V>,
1381 V: std::convert::Into<crate::model::billing::BillingDestination>,
1382 {
1383 use std::iter::Iterator;
1384 self.consumer_destinations = v.into_iter().map(|i| i.into()).collect();
1385 self
1386 }
1387}
1388
1389impl wkt::message::Message for Billing {
1390 fn typename() -> &'static str {
1391 "type.googleapis.com/google.api.Billing"
1392 }
1393}
1394
1395/// Defines additional types related to [Billing].
1396pub mod billing {
1397 #[allow(unused_imports)]
1398 use super::*;
1399
1400 /// Configuration of a specific billing destination (Currently only support
1401 /// bill against consumer project).
1402 #[derive(Clone, Default, PartialEq)]
1403 #[non_exhaustive]
1404 pub struct BillingDestination {
1405 /// The monitored resource type. The type must be defined in
1406 /// [Service.monitored_resources][google.api.Service.monitored_resources]
1407 /// section.
1408 ///
1409 /// [google.api.Service.monitored_resources]: crate::model::Service::monitored_resources
1410 pub monitored_resource: std::string::String,
1411
1412 /// Names of the metrics to report to this billing destination.
1413 /// Each name must be defined in
1414 /// [Service.metrics][google.api.Service.metrics] section.
1415 ///
1416 /// [google.api.Service.metrics]: crate::model::Service::metrics
1417 pub metrics: std::vec::Vec<std::string::String>,
1418
1419 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1420 }
1421
1422 impl BillingDestination {
1423 pub fn new() -> Self {
1424 std::default::Default::default()
1425 }
1426
1427 /// Sets the value of [monitored_resource][crate::model::billing::BillingDestination::monitored_resource].
1428 ///
1429 /// # Example
1430 /// ```ignore,no_run
1431 /// # use google_cloud_api::model::billing::BillingDestination;
1432 /// let x = BillingDestination::new().set_monitored_resource("example");
1433 /// ```
1434 pub fn set_monitored_resource<T: std::convert::Into<std::string::String>>(
1435 mut self,
1436 v: T,
1437 ) -> Self {
1438 self.monitored_resource = v.into();
1439 self
1440 }
1441
1442 /// Sets the value of [metrics][crate::model::billing::BillingDestination::metrics].
1443 ///
1444 /// # Example
1445 /// ```ignore,no_run
1446 /// # use google_cloud_api::model::billing::BillingDestination;
1447 /// let x = BillingDestination::new().set_metrics(["a", "b", "c"]);
1448 /// ```
1449 pub fn set_metrics<T, V>(mut self, v: T) -> Self
1450 where
1451 T: std::iter::IntoIterator<Item = V>,
1452 V: std::convert::Into<std::string::String>,
1453 {
1454 use std::iter::Iterator;
1455 self.metrics = v.into_iter().map(|i| i.into()).collect();
1456 self
1457 }
1458 }
1459
1460 impl wkt::message::Message for BillingDestination {
1461 fn typename() -> &'static str {
1462 "type.googleapis.com/google.api.Billing.BillingDestination"
1463 }
1464 }
1465}
1466
1467/// Required information for every language.
1468#[derive(Clone, Default, PartialEq)]
1469#[non_exhaustive]
1470pub struct CommonLanguageSettings {
1471 /// Link to automatically generated reference documentation. Example:
1472 /// <https://cloud.google.com/nodejs/docs/reference/asset/latest>
1473 #[deprecated]
1474 pub reference_docs_uri: std::string::String,
1475
1476 /// The destination where API teams want this client library to be published.
1477 pub destinations: std::vec::Vec<crate::model::ClientLibraryDestination>,
1478
1479 /// Configuration for which RPCs should be generated in the GAPIC client.
1480 pub selective_gapic_generation: std::option::Option<crate::model::SelectiveGapicGeneration>,
1481
1482 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1483}
1484
1485impl CommonLanguageSettings {
1486 pub fn new() -> Self {
1487 std::default::Default::default()
1488 }
1489
1490 /// Sets the value of [reference_docs_uri][crate::model::CommonLanguageSettings::reference_docs_uri].
1491 ///
1492 /// # Example
1493 /// ```ignore,no_run
1494 /// # use google_cloud_api::model::CommonLanguageSettings;
1495 /// let x = CommonLanguageSettings::new().set_reference_docs_uri("example");
1496 /// ```
1497 #[deprecated]
1498 pub fn set_reference_docs_uri<T: std::convert::Into<std::string::String>>(
1499 mut self,
1500 v: T,
1501 ) -> Self {
1502 self.reference_docs_uri = v.into();
1503 self
1504 }
1505
1506 /// Sets the value of [destinations][crate::model::CommonLanguageSettings::destinations].
1507 ///
1508 /// # Example
1509 /// ```ignore,no_run
1510 /// # use google_cloud_api::model::CommonLanguageSettings;
1511 /// use google_cloud_api::model::ClientLibraryDestination;
1512 /// let x = CommonLanguageSettings::new().set_destinations([
1513 /// ClientLibraryDestination::Github,
1514 /// ClientLibraryDestination::PackageManager,
1515 /// ]);
1516 /// ```
1517 pub fn set_destinations<T, V>(mut self, v: T) -> Self
1518 where
1519 T: std::iter::IntoIterator<Item = V>,
1520 V: std::convert::Into<crate::model::ClientLibraryDestination>,
1521 {
1522 use std::iter::Iterator;
1523 self.destinations = v.into_iter().map(|i| i.into()).collect();
1524 self
1525 }
1526
1527 /// Sets the value of [selective_gapic_generation][crate::model::CommonLanguageSettings::selective_gapic_generation].
1528 ///
1529 /// # Example
1530 /// ```ignore,no_run
1531 /// # use google_cloud_api::model::CommonLanguageSettings;
1532 /// use google_cloud_api::model::SelectiveGapicGeneration;
1533 /// let x = CommonLanguageSettings::new().set_selective_gapic_generation(SelectiveGapicGeneration::default()/* use setters */);
1534 /// ```
1535 pub fn set_selective_gapic_generation<T>(mut self, v: T) -> Self
1536 where
1537 T: std::convert::Into<crate::model::SelectiveGapicGeneration>,
1538 {
1539 self.selective_gapic_generation = std::option::Option::Some(v.into());
1540 self
1541 }
1542
1543 /// Sets or clears the value of [selective_gapic_generation][crate::model::CommonLanguageSettings::selective_gapic_generation].
1544 ///
1545 /// # Example
1546 /// ```ignore,no_run
1547 /// # use google_cloud_api::model::CommonLanguageSettings;
1548 /// use google_cloud_api::model::SelectiveGapicGeneration;
1549 /// let x = CommonLanguageSettings::new().set_or_clear_selective_gapic_generation(Some(SelectiveGapicGeneration::default()/* use setters */));
1550 /// let x = CommonLanguageSettings::new().set_or_clear_selective_gapic_generation(None::<SelectiveGapicGeneration>);
1551 /// ```
1552 pub fn set_or_clear_selective_gapic_generation<T>(mut self, v: std::option::Option<T>) -> Self
1553 where
1554 T: std::convert::Into<crate::model::SelectiveGapicGeneration>,
1555 {
1556 self.selective_gapic_generation = v.map(|x| x.into());
1557 self
1558 }
1559}
1560
1561impl wkt::message::Message for CommonLanguageSettings {
1562 fn typename() -> &'static str {
1563 "type.googleapis.com/google.api.CommonLanguageSettings"
1564 }
1565}
1566
1567/// Details about how and where to publish client libraries.
1568#[derive(Clone, Default, PartialEq)]
1569#[non_exhaustive]
1570pub struct ClientLibrarySettings {
1571 /// Version of the API to apply these settings to. This is the full protobuf
1572 /// package for the API, ending in the version element.
1573 /// Examples: "google.cloud.speech.v1" and "google.spanner.admin.database.v1".
1574 pub version: std::string::String,
1575
1576 /// Launch stage of this version of the API.
1577 pub launch_stage: crate::model::LaunchStage,
1578
1579 /// When using transport=rest, the client request will encode enums as
1580 /// numbers rather than strings.
1581 pub rest_numeric_enums: bool,
1582
1583 /// Settings for legacy Java features, supported in the Service YAML.
1584 pub java_settings: std::option::Option<crate::model::JavaSettings>,
1585
1586 /// Settings for C++ client libraries.
1587 pub cpp_settings: std::option::Option<crate::model::CppSettings>,
1588
1589 /// Settings for PHP client libraries.
1590 pub php_settings: std::option::Option<crate::model::PhpSettings>,
1591
1592 /// Settings for Python client libraries.
1593 pub python_settings: std::option::Option<crate::model::PythonSettings>,
1594
1595 /// Settings for Node client libraries.
1596 pub node_settings: std::option::Option<crate::model::NodeSettings>,
1597
1598 /// Settings for .NET client libraries.
1599 pub dotnet_settings: std::option::Option<crate::model::DotnetSettings>,
1600
1601 /// Settings for Ruby client libraries.
1602 pub ruby_settings: std::option::Option<crate::model::RubySettings>,
1603
1604 /// Settings for Go client libraries.
1605 pub go_settings: std::option::Option<crate::model::GoSettings>,
1606
1607 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1608}
1609
1610impl ClientLibrarySettings {
1611 pub fn new() -> Self {
1612 std::default::Default::default()
1613 }
1614
1615 /// Sets the value of [version][crate::model::ClientLibrarySettings::version].
1616 ///
1617 /// # Example
1618 /// ```ignore,no_run
1619 /// # use google_cloud_api::model::ClientLibrarySettings;
1620 /// let x = ClientLibrarySettings::new().set_version("example");
1621 /// ```
1622 pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1623 self.version = v.into();
1624 self
1625 }
1626
1627 /// Sets the value of [launch_stage][crate::model::ClientLibrarySettings::launch_stage].
1628 ///
1629 /// # Example
1630 /// ```ignore,no_run
1631 /// # use google_cloud_api::model::ClientLibrarySettings;
1632 /// use google_cloud_api::model::LaunchStage;
1633 /// let x0 = ClientLibrarySettings::new().set_launch_stage(LaunchStage::Unimplemented);
1634 /// let x1 = ClientLibrarySettings::new().set_launch_stage(LaunchStage::Prelaunch);
1635 /// let x2 = ClientLibrarySettings::new().set_launch_stage(LaunchStage::EarlyAccess);
1636 /// ```
1637 pub fn set_launch_stage<T: std::convert::Into<crate::model::LaunchStage>>(
1638 mut self,
1639 v: T,
1640 ) -> Self {
1641 self.launch_stage = v.into();
1642 self
1643 }
1644
1645 /// Sets the value of [rest_numeric_enums][crate::model::ClientLibrarySettings::rest_numeric_enums].
1646 ///
1647 /// # Example
1648 /// ```ignore,no_run
1649 /// # use google_cloud_api::model::ClientLibrarySettings;
1650 /// let x = ClientLibrarySettings::new().set_rest_numeric_enums(true);
1651 /// ```
1652 pub fn set_rest_numeric_enums<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1653 self.rest_numeric_enums = v.into();
1654 self
1655 }
1656
1657 /// Sets the value of [java_settings][crate::model::ClientLibrarySettings::java_settings].
1658 ///
1659 /// # Example
1660 /// ```ignore,no_run
1661 /// # use google_cloud_api::model::ClientLibrarySettings;
1662 /// use google_cloud_api::model::JavaSettings;
1663 /// let x = ClientLibrarySettings::new().set_java_settings(JavaSettings::default()/* use setters */);
1664 /// ```
1665 pub fn set_java_settings<T>(mut self, v: T) -> Self
1666 where
1667 T: std::convert::Into<crate::model::JavaSettings>,
1668 {
1669 self.java_settings = std::option::Option::Some(v.into());
1670 self
1671 }
1672
1673 /// Sets or clears the value of [java_settings][crate::model::ClientLibrarySettings::java_settings].
1674 ///
1675 /// # Example
1676 /// ```ignore,no_run
1677 /// # use google_cloud_api::model::ClientLibrarySettings;
1678 /// use google_cloud_api::model::JavaSettings;
1679 /// let x = ClientLibrarySettings::new().set_or_clear_java_settings(Some(JavaSettings::default()/* use setters */));
1680 /// let x = ClientLibrarySettings::new().set_or_clear_java_settings(None::<JavaSettings>);
1681 /// ```
1682 pub fn set_or_clear_java_settings<T>(mut self, v: std::option::Option<T>) -> Self
1683 where
1684 T: std::convert::Into<crate::model::JavaSettings>,
1685 {
1686 self.java_settings = v.map(|x| x.into());
1687 self
1688 }
1689
1690 /// Sets the value of [cpp_settings][crate::model::ClientLibrarySettings::cpp_settings].
1691 ///
1692 /// # Example
1693 /// ```ignore,no_run
1694 /// # use google_cloud_api::model::ClientLibrarySettings;
1695 /// use google_cloud_api::model::CppSettings;
1696 /// let x = ClientLibrarySettings::new().set_cpp_settings(CppSettings::default()/* use setters */);
1697 /// ```
1698 pub fn set_cpp_settings<T>(mut self, v: T) -> Self
1699 where
1700 T: std::convert::Into<crate::model::CppSettings>,
1701 {
1702 self.cpp_settings = std::option::Option::Some(v.into());
1703 self
1704 }
1705
1706 /// Sets or clears the value of [cpp_settings][crate::model::ClientLibrarySettings::cpp_settings].
1707 ///
1708 /// # Example
1709 /// ```ignore,no_run
1710 /// # use google_cloud_api::model::ClientLibrarySettings;
1711 /// use google_cloud_api::model::CppSettings;
1712 /// let x = ClientLibrarySettings::new().set_or_clear_cpp_settings(Some(CppSettings::default()/* use setters */));
1713 /// let x = ClientLibrarySettings::new().set_or_clear_cpp_settings(None::<CppSettings>);
1714 /// ```
1715 pub fn set_or_clear_cpp_settings<T>(mut self, v: std::option::Option<T>) -> Self
1716 where
1717 T: std::convert::Into<crate::model::CppSettings>,
1718 {
1719 self.cpp_settings = v.map(|x| x.into());
1720 self
1721 }
1722
1723 /// Sets the value of [php_settings][crate::model::ClientLibrarySettings::php_settings].
1724 ///
1725 /// # Example
1726 /// ```ignore,no_run
1727 /// # use google_cloud_api::model::ClientLibrarySettings;
1728 /// use google_cloud_api::model::PhpSettings;
1729 /// let x = ClientLibrarySettings::new().set_php_settings(PhpSettings::default()/* use setters */);
1730 /// ```
1731 pub fn set_php_settings<T>(mut self, v: T) -> Self
1732 where
1733 T: std::convert::Into<crate::model::PhpSettings>,
1734 {
1735 self.php_settings = std::option::Option::Some(v.into());
1736 self
1737 }
1738
1739 /// Sets or clears the value of [php_settings][crate::model::ClientLibrarySettings::php_settings].
1740 ///
1741 /// # Example
1742 /// ```ignore,no_run
1743 /// # use google_cloud_api::model::ClientLibrarySettings;
1744 /// use google_cloud_api::model::PhpSettings;
1745 /// let x = ClientLibrarySettings::new().set_or_clear_php_settings(Some(PhpSettings::default()/* use setters */));
1746 /// let x = ClientLibrarySettings::new().set_or_clear_php_settings(None::<PhpSettings>);
1747 /// ```
1748 pub fn set_or_clear_php_settings<T>(mut self, v: std::option::Option<T>) -> Self
1749 where
1750 T: std::convert::Into<crate::model::PhpSettings>,
1751 {
1752 self.php_settings = v.map(|x| x.into());
1753 self
1754 }
1755
1756 /// Sets the value of [python_settings][crate::model::ClientLibrarySettings::python_settings].
1757 ///
1758 /// # Example
1759 /// ```ignore,no_run
1760 /// # use google_cloud_api::model::ClientLibrarySettings;
1761 /// use google_cloud_api::model::PythonSettings;
1762 /// let x = ClientLibrarySettings::new().set_python_settings(PythonSettings::default()/* use setters */);
1763 /// ```
1764 pub fn set_python_settings<T>(mut self, v: T) -> Self
1765 where
1766 T: std::convert::Into<crate::model::PythonSettings>,
1767 {
1768 self.python_settings = std::option::Option::Some(v.into());
1769 self
1770 }
1771
1772 /// Sets or clears the value of [python_settings][crate::model::ClientLibrarySettings::python_settings].
1773 ///
1774 /// # Example
1775 /// ```ignore,no_run
1776 /// # use google_cloud_api::model::ClientLibrarySettings;
1777 /// use google_cloud_api::model::PythonSettings;
1778 /// let x = ClientLibrarySettings::new().set_or_clear_python_settings(Some(PythonSettings::default()/* use setters */));
1779 /// let x = ClientLibrarySettings::new().set_or_clear_python_settings(None::<PythonSettings>);
1780 /// ```
1781 pub fn set_or_clear_python_settings<T>(mut self, v: std::option::Option<T>) -> Self
1782 where
1783 T: std::convert::Into<crate::model::PythonSettings>,
1784 {
1785 self.python_settings = v.map(|x| x.into());
1786 self
1787 }
1788
1789 /// Sets the value of [node_settings][crate::model::ClientLibrarySettings::node_settings].
1790 ///
1791 /// # Example
1792 /// ```ignore,no_run
1793 /// # use google_cloud_api::model::ClientLibrarySettings;
1794 /// use google_cloud_api::model::NodeSettings;
1795 /// let x = ClientLibrarySettings::new().set_node_settings(NodeSettings::default()/* use setters */);
1796 /// ```
1797 pub fn set_node_settings<T>(mut self, v: T) -> Self
1798 where
1799 T: std::convert::Into<crate::model::NodeSettings>,
1800 {
1801 self.node_settings = std::option::Option::Some(v.into());
1802 self
1803 }
1804
1805 /// Sets or clears the value of [node_settings][crate::model::ClientLibrarySettings::node_settings].
1806 ///
1807 /// # Example
1808 /// ```ignore,no_run
1809 /// # use google_cloud_api::model::ClientLibrarySettings;
1810 /// use google_cloud_api::model::NodeSettings;
1811 /// let x = ClientLibrarySettings::new().set_or_clear_node_settings(Some(NodeSettings::default()/* use setters */));
1812 /// let x = ClientLibrarySettings::new().set_or_clear_node_settings(None::<NodeSettings>);
1813 /// ```
1814 pub fn set_or_clear_node_settings<T>(mut self, v: std::option::Option<T>) -> Self
1815 where
1816 T: std::convert::Into<crate::model::NodeSettings>,
1817 {
1818 self.node_settings = v.map(|x| x.into());
1819 self
1820 }
1821
1822 /// Sets the value of [dotnet_settings][crate::model::ClientLibrarySettings::dotnet_settings].
1823 ///
1824 /// # Example
1825 /// ```ignore,no_run
1826 /// # use google_cloud_api::model::ClientLibrarySettings;
1827 /// use google_cloud_api::model::DotnetSettings;
1828 /// let x = ClientLibrarySettings::new().set_dotnet_settings(DotnetSettings::default()/* use setters */);
1829 /// ```
1830 pub fn set_dotnet_settings<T>(mut self, v: T) -> Self
1831 where
1832 T: std::convert::Into<crate::model::DotnetSettings>,
1833 {
1834 self.dotnet_settings = std::option::Option::Some(v.into());
1835 self
1836 }
1837
1838 /// Sets or clears the value of [dotnet_settings][crate::model::ClientLibrarySettings::dotnet_settings].
1839 ///
1840 /// # Example
1841 /// ```ignore,no_run
1842 /// # use google_cloud_api::model::ClientLibrarySettings;
1843 /// use google_cloud_api::model::DotnetSettings;
1844 /// let x = ClientLibrarySettings::new().set_or_clear_dotnet_settings(Some(DotnetSettings::default()/* use setters */));
1845 /// let x = ClientLibrarySettings::new().set_or_clear_dotnet_settings(None::<DotnetSettings>);
1846 /// ```
1847 pub fn set_or_clear_dotnet_settings<T>(mut self, v: std::option::Option<T>) -> Self
1848 where
1849 T: std::convert::Into<crate::model::DotnetSettings>,
1850 {
1851 self.dotnet_settings = v.map(|x| x.into());
1852 self
1853 }
1854
1855 /// Sets the value of [ruby_settings][crate::model::ClientLibrarySettings::ruby_settings].
1856 ///
1857 /// # Example
1858 /// ```ignore,no_run
1859 /// # use google_cloud_api::model::ClientLibrarySettings;
1860 /// use google_cloud_api::model::RubySettings;
1861 /// let x = ClientLibrarySettings::new().set_ruby_settings(RubySettings::default()/* use setters */);
1862 /// ```
1863 pub fn set_ruby_settings<T>(mut self, v: T) -> Self
1864 where
1865 T: std::convert::Into<crate::model::RubySettings>,
1866 {
1867 self.ruby_settings = std::option::Option::Some(v.into());
1868 self
1869 }
1870
1871 /// Sets or clears the value of [ruby_settings][crate::model::ClientLibrarySettings::ruby_settings].
1872 ///
1873 /// # Example
1874 /// ```ignore,no_run
1875 /// # use google_cloud_api::model::ClientLibrarySettings;
1876 /// use google_cloud_api::model::RubySettings;
1877 /// let x = ClientLibrarySettings::new().set_or_clear_ruby_settings(Some(RubySettings::default()/* use setters */));
1878 /// let x = ClientLibrarySettings::new().set_or_clear_ruby_settings(None::<RubySettings>);
1879 /// ```
1880 pub fn set_or_clear_ruby_settings<T>(mut self, v: std::option::Option<T>) -> Self
1881 where
1882 T: std::convert::Into<crate::model::RubySettings>,
1883 {
1884 self.ruby_settings = v.map(|x| x.into());
1885 self
1886 }
1887
1888 /// Sets the value of [go_settings][crate::model::ClientLibrarySettings::go_settings].
1889 ///
1890 /// # Example
1891 /// ```ignore,no_run
1892 /// # use google_cloud_api::model::ClientLibrarySettings;
1893 /// use google_cloud_api::model::GoSettings;
1894 /// let x = ClientLibrarySettings::new().set_go_settings(GoSettings::default()/* use setters */);
1895 /// ```
1896 pub fn set_go_settings<T>(mut self, v: T) -> Self
1897 where
1898 T: std::convert::Into<crate::model::GoSettings>,
1899 {
1900 self.go_settings = std::option::Option::Some(v.into());
1901 self
1902 }
1903
1904 /// Sets or clears the value of [go_settings][crate::model::ClientLibrarySettings::go_settings].
1905 ///
1906 /// # Example
1907 /// ```ignore,no_run
1908 /// # use google_cloud_api::model::ClientLibrarySettings;
1909 /// use google_cloud_api::model::GoSettings;
1910 /// let x = ClientLibrarySettings::new().set_or_clear_go_settings(Some(GoSettings::default()/* use setters */));
1911 /// let x = ClientLibrarySettings::new().set_or_clear_go_settings(None::<GoSettings>);
1912 /// ```
1913 pub fn set_or_clear_go_settings<T>(mut self, v: std::option::Option<T>) -> Self
1914 where
1915 T: std::convert::Into<crate::model::GoSettings>,
1916 {
1917 self.go_settings = v.map(|x| x.into());
1918 self
1919 }
1920}
1921
1922impl wkt::message::Message for ClientLibrarySettings {
1923 fn typename() -> &'static str {
1924 "type.googleapis.com/google.api.ClientLibrarySettings"
1925 }
1926}
1927
1928/// This message configures the settings for publishing [Google Cloud Client
1929/// libraries](https://cloud.google.com/apis/docs/cloud-client-libraries)
1930/// generated from the service config.
1931#[derive(Clone, Default, PartialEq)]
1932#[non_exhaustive]
1933pub struct Publishing {
1934 /// A list of API method settings, e.g. the behavior for methods that use the
1935 /// long-running operation pattern.
1936 pub method_settings: std::vec::Vec<crate::model::MethodSettings>,
1937
1938 /// Link to a *public* URI where users can report issues. Example:
1939 /// <https://issuetracker.google.com/issues/new?component=190865&template=1161103>
1940 pub new_issue_uri: std::string::String,
1941
1942 /// Link to product home page. Example:
1943 /// <https://cloud.google.com/asset-inventory/docs/overview>
1944 pub documentation_uri: std::string::String,
1945
1946 /// Used as a tracking tag when collecting data about the APIs developer
1947 /// relations artifacts like docs, packages delivered to package managers,
1948 /// etc. Example: "speech".
1949 pub api_short_name: std::string::String,
1950
1951 /// GitHub label to apply to issues and pull requests opened for this API.
1952 pub github_label: std::string::String,
1953
1954 /// GitHub teams to be added to CODEOWNERS in the directory in GitHub
1955 /// containing source code for the client libraries for this API.
1956 pub codeowner_github_teams: std::vec::Vec<std::string::String>,
1957
1958 /// A prefix used in sample code when demarking regions to be included in
1959 /// documentation.
1960 pub doc_tag_prefix: std::string::String,
1961
1962 /// For whom the client library is being published.
1963 pub organization: crate::model::ClientLibraryOrganization,
1964
1965 /// Client library settings. If the same version string appears multiple
1966 /// times in this list, then the last one wins. Settings from earlier
1967 /// settings with the same version string are discarded.
1968 pub library_settings: std::vec::Vec<crate::model::ClientLibrarySettings>,
1969
1970 /// Optional link to proto reference documentation. Example:
1971 /// <https://cloud.google.com/pubsub/lite/docs/reference/rpc>
1972 pub proto_reference_documentation_uri: std::string::String,
1973
1974 /// Optional link to REST reference documentation. Example:
1975 /// <https://cloud.google.com/pubsub/lite/docs/reference/rest>
1976 pub rest_reference_documentation_uri: std::string::String,
1977
1978 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1979}
1980
1981impl Publishing {
1982 pub fn new() -> Self {
1983 std::default::Default::default()
1984 }
1985
1986 /// Sets the value of [method_settings][crate::model::Publishing::method_settings].
1987 ///
1988 /// # Example
1989 /// ```ignore,no_run
1990 /// # use google_cloud_api::model::Publishing;
1991 /// use google_cloud_api::model::MethodSettings;
1992 /// let x = Publishing::new()
1993 /// .set_method_settings([
1994 /// MethodSettings::default()/* use setters */,
1995 /// MethodSettings::default()/* use (different) setters */,
1996 /// ]);
1997 /// ```
1998 pub fn set_method_settings<T, V>(mut self, v: T) -> Self
1999 where
2000 T: std::iter::IntoIterator<Item = V>,
2001 V: std::convert::Into<crate::model::MethodSettings>,
2002 {
2003 use std::iter::Iterator;
2004 self.method_settings = v.into_iter().map(|i| i.into()).collect();
2005 self
2006 }
2007
2008 /// Sets the value of [new_issue_uri][crate::model::Publishing::new_issue_uri].
2009 ///
2010 /// # Example
2011 /// ```ignore,no_run
2012 /// # use google_cloud_api::model::Publishing;
2013 /// let x = Publishing::new().set_new_issue_uri("example");
2014 /// ```
2015 pub fn set_new_issue_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2016 self.new_issue_uri = v.into();
2017 self
2018 }
2019
2020 /// Sets the value of [documentation_uri][crate::model::Publishing::documentation_uri].
2021 ///
2022 /// # Example
2023 /// ```ignore,no_run
2024 /// # use google_cloud_api::model::Publishing;
2025 /// let x = Publishing::new().set_documentation_uri("example");
2026 /// ```
2027 pub fn set_documentation_uri<T: std::convert::Into<std::string::String>>(
2028 mut self,
2029 v: T,
2030 ) -> Self {
2031 self.documentation_uri = v.into();
2032 self
2033 }
2034
2035 /// Sets the value of [api_short_name][crate::model::Publishing::api_short_name].
2036 ///
2037 /// # Example
2038 /// ```ignore,no_run
2039 /// # use google_cloud_api::model::Publishing;
2040 /// let x = Publishing::new().set_api_short_name("example");
2041 /// ```
2042 pub fn set_api_short_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2043 self.api_short_name = v.into();
2044 self
2045 }
2046
2047 /// Sets the value of [github_label][crate::model::Publishing::github_label].
2048 ///
2049 /// # Example
2050 /// ```ignore,no_run
2051 /// # use google_cloud_api::model::Publishing;
2052 /// let x = Publishing::new().set_github_label("example");
2053 /// ```
2054 pub fn set_github_label<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2055 self.github_label = v.into();
2056 self
2057 }
2058
2059 /// Sets the value of [codeowner_github_teams][crate::model::Publishing::codeowner_github_teams].
2060 ///
2061 /// # Example
2062 /// ```ignore,no_run
2063 /// # use google_cloud_api::model::Publishing;
2064 /// let x = Publishing::new().set_codeowner_github_teams(["a", "b", "c"]);
2065 /// ```
2066 pub fn set_codeowner_github_teams<T, V>(mut self, v: T) -> Self
2067 where
2068 T: std::iter::IntoIterator<Item = V>,
2069 V: std::convert::Into<std::string::String>,
2070 {
2071 use std::iter::Iterator;
2072 self.codeowner_github_teams = v.into_iter().map(|i| i.into()).collect();
2073 self
2074 }
2075
2076 /// Sets the value of [doc_tag_prefix][crate::model::Publishing::doc_tag_prefix].
2077 ///
2078 /// # Example
2079 /// ```ignore,no_run
2080 /// # use google_cloud_api::model::Publishing;
2081 /// let x = Publishing::new().set_doc_tag_prefix("example");
2082 /// ```
2083 pub fn set_doc_tag_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2084 self.doc_tag_prefix = v.into();
2085 self
2086 }
2087
2088 /// Sets the value of [organization][crate::model::Publishing::organization].
2089 ///
2090 /// # Example
2091 /// ```ignore,no_run
2092 /// # use google_cloud_api::model::Publishing;
2093 /// use google_cloud_api::model::ClientLibraryOrganization;
2094 /// let x0 = Publishing::new().set_organization(ClientLibraryOrganization::Cloud);
2095 /// let x1 = Publishing::new().set_organization(ClientLibraryOrganization::Ads);
2096 /// let x2 = Publishing::new().set_organization(ClientLibraryOrganization::Photos);
2097 /// ```
2098 pub fn set_organization<T: std::convert::Into<crate::model::ClientLibraryOrganization>>(
2099 mut self,
2100 v: T,
2101 ) -> Self {
2102 self.organization = v.into();
2103 self
2104 }
2105
2106 /// Sets the value of [library_settings][crate::model::Publishing::library_settings].
2107 ///
2108 /// # Example
2109 /// ```ignore,no_run
2110 /// # use google_cloud_api::model::Publishing;
2111 /// use google_cloud_api::model::ClientLibrarySettings;
2112 /// let x = Publishing::new()
2113 /// .set_library_settings([
2114 /// ClientLibrarySettings::default()/* use setters */,
2115 /// ClientLibrarySettings::default()/* use (different) setters */,
2116 /// ]);
2117 /// ```
2118 pub fn set_library_settings<T, V>(mut self, v: T) -> Self
2119 where
2120 T: std::iter::IntoIterator<Item = V>,
2121 V: std::convert::Into<crate::model::ClientLibrarySettings>,
2122 {
2123 use std::iter::Iterator;
2124 self.library_settings = v.into_iter().map(|i| i.into()).collect();
2125 self
2126 }
2127
2128 /// Sets the value of [proto_reference_documentation_uri][crate::model::Publishing::proto_reference_documentation_uri].
2129 ///
2130 /// # Example
2131 /// ```ignore,no_run
2132 /// # use google_cloud_api::model::Publishing;
2133 /// let x = Publishing::new().set_proto_reference_documentation_uri("example");
2134 /// ```
2135 pub fn set_proto_reference_documentation_uri<T: std::convert::Into<std::string::String>>(
2136 mut self,
2137 v: T,
2138 ) -> Self {
2139 self.proto_reference_documentation_uri = v.into();
2140 self
2141 }
2142
2143 /// Sets the value of [rest_reference_documentation_uri][crate::model::Publishing::rest_reference_documentation_uri].
2144 ///
2145 /// # Example
2146 /// ```ignore,no_run
2147 /// # use google_cloud_api::model::Publishing;
2148 /// let x = Publishing::new().set_rest_reference_documentation_uri("example");
2149 /// ```
2150 pub fn set_rest_reference_documentation_uri<T: std::convert::Into<std::string::String>>(
2151 mut self,
2152 v: T,
2153 ) -> Self {
2154 self.rest_reference_documentation_uri = v.into();
2155 self
2156 }
2157}
2158
2159impl wkt::message::Message for Publishing {
2160 fn typename() -> &'static str {
2161 "type.googleapis.com/google.api.Publishing"
2162 }
2163}
2164
2165/// Settings for Java client libraries.
2166#[derive(Clone, Default, PartialEq)]
2167#[non_exhaustive]
2168pub struct JavaSettings {
2169 /// The package name to use in Java. Clobbers the java_package option
2170 /// set in the protobuf. This should be used **only** by APIs
2171 /// who have already set the language_settings.java.package_name" field
2172 /// in gapic.yaml. API teams should use the protobuf java_package option
2173 /// where possible.
2174 ///
2175 /// Example of a YAML configuration::
2176 ///
2177 /// publishing:
2178 /// java_settings:
2179 /// library_package: com.google.cloud.pubsub.v1
2180 pub library_package: std::string::String,
2181
2182 /// Configure the Java class name to use instead of the service's for its
2183 /// corresponding generated GAPIC client. Keys are fully-qualified
2184 /// service names as they appear in the protobuf (including the full
2185 /// the language_settings.java.interface_names" field in gapic.yaml. API
2186 /// teams should otherwise use the service name as it appears in the
2187 /// protobuf.
2188 ///
2189 /// Example of a YAML configuration::
2190 ///
2191 /// publishing:
2192 /// java_settings:
2193 /// service_class_names:
2194 /// - google.pubsub.v1.Publisher: TopicAdmin
2195 /// - google.pubsub.v1.Subscriber: SubscriptionAdmin
2196 pub service_class_names: std::collections::HashMap<std::string::String, std::string::String>,
2197
2198 /// Some settings.
2199 pub common: std::option::Option<crate::model::CommonLanguageSettings>,
2200
2201 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2202}
2203
2204impl JavaSettings {
2205 pub fn new() -> Self {
2206 std::default::Default::default()
2207 }
2208
2209 /// Sets the value of [library_package][crate::model::JavaSettings::library_package].
2210 ///
2211 /// # Example
2212 /// ```ignore,no_run
2213 /// # use google_cloud_api::model::JavaSettings;
2214 /// let x = JavaSettings::new().set_library_package("example");
2215 /// ```
2216 pub fn set_library_package<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2217 self.library_package = v.into();
2218 self
2219 }
2220
2221 /// Sets the value of [service_class_names][crate::model::JavaSettings::service_class_names].
2222 ///
2223 /// # Example
2224 /// ```ignore,no_run
2225 /// # use google_cloud_api::model::JavaSettings;
2226 /// let x = JavaSettings::new().set_service_class_names([
2227 /// ("key0", "abc"),
2228 /// ("key1", "xyz"),
2229 /// ]);
2230 /// ```
2231 pub fn set_service_class_names<T, K, V>(mut self, v: T) -> Self
2232 where
2233 T: std::iter::IntoIterator<Item = (K, V)>,
2234 K: std::convert::Into<std::string::String>,
2235 V: std::convert::Into<std::string::String>,
2236 {
2237 use std::iter::Iterator;
2238 self.service_class_names = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2239 self
2240 }
2241
2242 /// Sets the value of [common][crate::model::JavaSettings::common].
2243 ///
2244 /// # Example
2245 /// ```ignore,no_run
2246 /// # use google_cloud_api::model::JavaSettings;
2247 /// use google_cloud_api::model::CommonLanguageSettings;
2248 /// let x = JavaSettings::new().set_common(CommonLanguageSettings::default()/* use setters */);
2249 /// ```
2250 pub fn set_common<T>(mut self, v: T) -> Self
2251 where
2252 T: std::convert::Into<crate::model::CommonLanguageSettings>,
2253 {
2254 self.common = std::option::Option::Some(v.into());
2255 self
2256 }
2257
2258 /// Sets or clears the value of [common][crate::model::JavaSettings::common].
2259 ///
2260 /// # Example
2261 /// ```ignore,no_run
2262 /// # use google_cloud_api::model::JavaSettings;
2263 /// use google_cloud_api::model::CommonLanguageSettings;
2264 /// let x = JavaSettings::new().set_or_clear_common(Some(CommonLanguageSettings::default()/* use setters */));
2265 /// let x = JavaSettings::new().set_or_clear_common(None::<CommonLanguageSettings>);
2266 /// ```
2267 pub fn set_or_clear_common<T>(mut self, v: std::option::Option<T>) -> Self
2268 where
2269 T: std::convert::Into<crate::model::CommonLanguageSettings>,
2270 {
2271 self.common = v.map(|x| x.into());
2272 self
2273 }
2274}
2275
2276impl wkt::message::Message for JavaSettings {
2277 fn typename() -> &'static str {
2278 "type.googleapis.com/google.api.JavaSettings"
2279 }
2280}
2281
2282/// Settings for C++ client libraries.
2283#[derive(Clone, Default, PartialEq)]
2284#[non_exhaustive]
2285pub struct CppSettings {
2286 /// Some settings.
2287 pub common: std::option::Option<crate::model::CommonLanguageSettings>,
2288
2289 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2290}
2291
2292impl CppSettings {
2293 pub fn new() -> Self {
2294 std::default::Default::default()
2295 }
2296
2297 /// Sets the value of [common][crate::model::CppSettings::common].
2298 ///
2299 /// # Example
2300 /// ```ignore,no_run
2301 /// # use google_cloud_api::model::CppSettings;
2302 /// use google_cloud_api::model::CommonLanguageSettings;
2303 /// let x = CppSettings::new().set_common(CommonLanguageSettings::default()/* use setters */);
2304 /// ```
2305 pub fn set_common<T>(mut self, v: T) -> Self
2306 where
2307 T: std::convert::Into<crate::model::CommonLanguageSettings>,
2308 {
2309 self.common = std::option::Option::Some(v.into());
2310 self
2311 }
2312
2313 /// Sets or clears the value of [common][crate::model::CppSettings::common].
2314 ///
2315 /// # Example
2316 /// ```ignore,no_run
2317 /// # use google_cloud_api::model::CppSettings;
2318 /// use google_cloud_api::model::CommonLanguageSettings;
2319 /// let x = CppSettings::new().set_or_clear_common(Some(CommonLanguageSettings::default()/* use setters */));
2320 /// let x = CppSettings::new().set_or_clear_common(None::<CommonLanguageSettings>);
2321 /// ```
2322 pub fn set_or_clear_common<T>(mut self, v: std::option::Option<T>) -> Self
2323 where
2324 T: std::convert::Into<crate::model::CommonLanguageSettings>,
2325 {
2326 self.common = v.map(|x| x.into());
2327 self
2328 }
2329}
2330
2331impl wkt::message::Message for CppSettings {
2332 fn typename() -> &'static str {
2333 "type.googleapis.com/google.api.CppSettings"
2334 }
2335}
2336
2337/// Settings for Php client libraries.
2338#[derive(Clone, Default, PartialEq)]
2339#[non_exhaustive]
2340pub struct PhpSettings {
2341 /// Some settings.
2342 pub common: std::option::Option<crate::model::CommonLanguageSettings>,
2343
2344 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2345}
2346
2347impl PhpSettings {
2348 pub fn new() -> Self {
2349 std::default::Default::default()
2350 }
2351
2352 /// Sets the value of [common][crate::model::PhpSettings::common].
2353 ///
2354 /// # Example
2355 /// ```ignore,no_run
2356 /// # use google_cloud_api::model::PhpSettings;
2357 /// use google_cloud_api::model::CommonLanguageSettings;
2358 /// let x = PhpSettings::new().set_common(CommonLanguageSettings::default()/* use setters */);
2359 /// ```
2360 pub fn set_common<T>(mut self, v: T) -> Self
2361 where
2362 T: std::convert::Into<crate::model::CommonLanguageSettings>,
2363 {
2364 self.common = std::option::Option::Some(v.into());
2365 self
2366 }
2367
2368 /// Sets or clears the value of [common][crate::model::PhpSettings::common].
2369 ///
2370 /// # Example
2371 /// ```ignore,no_run
2372 /// # use google_cloud_api::model::PhpSettings;
2373 /// use google_cloud_api::model::CommonLanguageSettings;
2374 /// let x = PhpSettings::new().set_or_clear_common(Some(CommonLanguageSettings::default()/* use setters */));
2375 /// let x = PhpSettings::new().set_or_clear_common(None::<CommonLanguageSettings>);
2376 /// ```
2377 pub fn set_or_clear_common<T>(mut self, v: std::option::Option<T>) -> Self
2378 where
2379 T: std::convert::Into<crate::model::CommonLanguageSettings>,
2380 {
2381 self.common = v.map(|x| x.into());
2382 self
2383 }
2384}
2385
2386impl wkt::message::Message for PhpSettings {
2387 fn typename() -> &'static str {
2388 "type.googleapis.com/google.api.PhpSettings"
2389 }
2390}
2391
2392/// Settings for Python client libraries.
2393#[derive(Clone, Default, PartialEq)]
2394#[non_exhaustive]
2395pub struct PythonSettings {
2396 /// Some settings.
2397 pub common: std::option::Option<crate::model::CommonLanguageSettings>,
2398
2399 /// Experimental features to be included during client library generation.
2400 pub experimental_features:
2401 std::option::Option<crate::model::python_settings::ExperimentalFeatures>,
2402
2403 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2404}
2405
2406impl PythonSettings {
2407 pub fn new() -> Self {
2408 std::default::Default::default()
2409 }
2410
2411 /// Sets the value of [common][crate::model::PythonSettings::common].
2412 ///
2413 /// # Example
2414 /// ```ignore,no_run
2415 /// # use google_cloud_api::model::PythonSettings;
2416 /// use google_cloud_api::model::CommonLanguageSettings;
2417 /// let x = PythonSettings::new().set_common(CommonLanguageSettings::default()/* use setters */);
2418 /// ```
2419 pub fn set_common<T>(mut self, v: T) -> Self
2420 where
2421 T: std::convert::Into<crate::model::CommonLanguageSettings>,
2422 {
2423 self.common = std::option::Option::Some(v.into());
2424 self
2425 }
2426
2427 /// Sets or clears the value of [common][crate::model::PythonSettings::common].
2428 ///
2429 /// # Example
2430 /// ```ignore,no_run
2431 /// # use google_cloud_api::model::PythonSettings;
2432 /// use google_cloud_api::model::CommonLanguageSettings;
2433 /// let x = PythonSettings::new().set_or_clear_common(Some(CommonLanguageSettings::default()/* use setters */));
2434 /// let x = PythonSettings::new().set_or_clear_common(None::<CommonLanguageSettings>);
2435 /// ```
2436 pub fn set_or_clear_common<T>(mut self, v: std::option::Option<T>) -> Self
2437 where
2438 T: std::convert::Into<crate::model::CommonLanguageSettings>,
2439 {
2440 self.common = v.map(|x| x.into());
2441 self
2442 }
2443
2444 /// Sets the value of [experimental_features][crate::model::PythonSettings::experimental_features].
2445 ///
2446 /// # Example
2447 /// ```ignore,no_run
2448 /// # use google_cloud_api::model::PythonSettings;
2449 /// use google_cloud_api::model::python_settings::ExperimentalFeatures;
2450 /// let x = PythonSettings::new().set_experimental_features(ExperimentalFeatures::default()/* use setters */);
2451 /// ```
2452 pub fn set_experimental_features<T>(mut self, v: T) -> Self
2453 where
2454 T: std::convert::Into<crate::model::python_settings::ExperimentalFeatures>,
2455 {
2456 self.experimental_features = std::option::Option::Some(v.into());
2457 self
2458 }
2459
2460 /// Sets or clears the value of [experimental_features][crate::model::PythonSettings::experimental_features].
2461 ///
2462 /// # Example
2463 /// ```ignore,no_run
2464 /// # use google_cloud_api::model::PythonSettings;
2465 /// use google_cloud_api::model::python_settings::ExperimentalFeatures;
2466 /// let x = PythonSettings::new().set_or_clear_experimental_features(Some(ExperimentalFeatures::default()/* use setters */));
2467 /// let x = PythonSettings::new().set_or_clear_experimental_features(None::<ExperimentalFeatures>);
2468 /// ```
2469 pub fn set_or_clear_experimental_features<T>(mut self, v: std::option::Option<T>) -> Self
2470 where
2471 T: std::convert::Into<crate::model::python_settings::ExperimentalFeatures>,
2472 {
2473 self.experimental_features = v.map(|x| x.into());
2474 self
2475 }
2476}
2477
2478impl wkt::message::Message for PythonSettings {
2479 fn typename() -> &'static str {
2480 "type.googleapis.com/google.api.PythonSettings"
2481 }
2482}
2483
2484/// Defines additional types related to [PythonSettings].
2485pub mod python_settings {
2486 #[allow(unused_imports)]
2487 use super::*;
2488
2489 /// Experimental features to be included during client library generation.
2490 /// These fields will be deprecated once the feature graduates and is enabled
2491 /// by default.
2492 #[derive(Clone, Default, PartialEq)]
2493 #[non_exhaustive]
2494 pub struct ExperimentalFeatures {
2495 /// Enables generation of asynchronous REST clients if `rest` transport is
2496 /// enabled. By default, asynchronous REST clients will not be generated.
2497 /// This feature will be enabled by default 1 month after launching the
2498 /// feature in preview packages.
2499 pub rest_async_io_enabled: bool,
2500
2501 /// Enables generation of protobuf code using new types that are more
2502 /// Pythonic which are included in `protobuf>=5.29.x`. This feature will be
2503 /// enabled by default 1 month after launching the feature in preview
2504 /// packages.
2505 pub protobuf_pythonic_types_enabled: bool,
2506
2507 /// Disables generation of an unversioned Python package for this client
2508 /// library. This means that the module names will need to be versioned in
2509 /// import statements. For example `import google.cloud.library_v2` instead
2510 /// of `import google.cloud.library`.
2511 pub unversioned_package_disabled: bool,
2512
2513 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2514 }
2515
2516 impl ExperimentalFeatures {
2517 pub fn new() -> Self {
2518 std::default::Default::default()
2519 }
2520
2521 /// Sets the value of [rest_async_io_enabled][crate::model::python_settings::ExperimentalFeatures::rest_async_io_enabled].
2522 ///
2523 /// # Example
2524 /// ```ignore,no_run
2525 /// # use google_cloud_api::model::python_settings::ExperimentalFeatures;
2526 /// let x = ExperimentalFeatures::new().set_rest_async_io_enabled(true);
2527 /// ```
2528 pub fn set_rest_async_io_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2529 self.rest_async_io_enabled = v.into();
2530 self
2531 }
2532
2533 /// Sets the value of [protobuf_pythonic_types_enabled][crate::model::python_settings::ExperimentalFeatures::protobuf_pythonic_types_enabled].
2534 ///
2535 /// # Example
2536 /// ```ignore,no_run
2537 /// # use google_cloud_api::model::python_settings::ExperimentalFeatures;
2538 /// let x = ExperimentalFeatures::new().set_protobuf_pythonic_types_enabled(true);
2539 /// ```
2540 pub fn set_protobuf_pythonic_types_enabled<T: std::convert::Into<bool>>(
2541 mut self,
2542 v: T,
2543 ) -> Self {
2544 self.protobuf_pythonic_types_enabled = v.into();
2545 self
2546 }
2547
2548 /// Sets the value of [unversioned_package_disabled][crate::model::python_settings::ExperimentalFeatures::unversioned_package_disabled].
2549 ///
2550 /// # Example
2551 /// ```ignore,no_run
2552 /// # use google_cloud_api::model::python_settings::ExperimentalFeatures;
2553 /// let x = ExperimentalFeatures::new().set_unversioned_package_disabled(true);
2554 /// ```
2555 pub fn set_unversioned_package_disabled<T: std::convert::Into<bool>>(
2556 mut self,
2557 v: T,
2558 ) -> Self {
2559 self.unversioned_package_disabled = v.into();
2560 self
2561 }
2562 }
2563
2564 impl wkt::message::Message for ExperimentalFeatures {
2565 fn typename() -> &'static str {
2566 "type.googleapis.com/google.api.PythonSettings.ExperimentalFeatures"
2567 }
2568 }
2569}
2570
2571/// Settings for Node client libraries.
2572#[derive(Clone, Default, PartialEq)]
2573#[non_exhaustive]
2574pub struct NodeSettings {
2575 /// Some settings.
2576 pub common: std::option::Option<crate::model::CommonLanguageSettings>,
2577
2578 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2579}
2580
2581impl NodeSettings {
2582 pub fn new() -> Self {
2583 std::default::Default::default()
2584 }
2585
2586 /// Sets the value of [common][crate::model::NodeSettings::common].
2587 ///
2588 /// # Example
2589 /// ```ignore,no_run
2590 /// # use google_cloud_api::model::NodeSettings;
2591 /// use google_cloud_api::model::CommonLanguageSettings;
2592 /// let x = NodeSettings::new().set_common(CommonLanguageSettings::default()/* use setters */);
2593 /// ```
2594 pub fn set_common<T>(mut self, v: T) -> Self
2595 where
2596 T: std::convert::Into<crate::model::CommonLanguageSettings>,
2597 {
2598 self.common = std::option::Option::Some(v.into());
2599 self
2600 }
2601
2602 /// Sets or clears the value of [common][crate::model::NodeSettings::common].
2603 ///
2604 /// # Example
2605 /// ```ignore,no_run
2606 /// # use google_cloud_api::model::NodeSettings;
2607 /// use google_cloud_api::model::CommonLanguageSettings;
2608 /// let x = NodeSettings::new().set_or_clear_common(Some(CommonLanguageSettings::default()/* use setters */));
2609 /// let x = NodeSettings::new().set_or_clear_common(None::<CommonLanguageSettings>);
2610 /// ```
2611 pub fn set_or_clear_common<T>(mut self, v: std::option::Option<T>) -> Self
2612 where
2613 T: std::convert::Into<crate::model::CommonLanguageSettings>,
2614 {
2615 self.common = v.map(|x| x.into());
2616 self
2617 }
2618}
2619
2620impl wkt::message::Message for NodeSettings {
2621 fn typename() -> &'static str {
2622 "type.googleapis.com/google.api.NodeSettings"
2623 }
2624}
2625
2626/// Settings for Dotnet client libraries.
2627#[derive(Clone, Default, PartialEq)]
2628#[non_exhaustive]
2629pub struct DotnetSettings {
2630 /// Some settings.
2631 pub common: std::option::Option<crate::model::CommonLanguageSettings>,
2632
2633 /// Map from original service names to renamed versions.
2634 /// This is used when the default generated types
2635 /// would cause a naming conflict. (Neither name is
2636 /// fully-qualified.)
2637 /// Example: Subscriber to SubscriberServiceApi.
2638 pub renamed_services: std::collections::HashMap<std::string::String, std::string::String>,
2639
2640 /// Map from full resource types to the effective short name
2641 /// for the resource. This is used when otherwise resource
2642 /// named from different services would cause naming collisions.
2643 /// Example entry:
2644 /// "datalabeling.googleapis.com/Dataset": "DataLabelingDataset"
2645 pub renamed_resources: std::collections::HashMap<std::string::String, std::string::String>,
2646
2647 /// List of full resource types to ignore during generation.
2648 /// This is typically used for API-specific Location resources,
2649 /// which should be handled by the generator as if they were actually
2650 /// the common Location resources.
2651 /// Example entry: "documentai.googleapis.com/Location"
2652 pub ignored_resources: std::vec::Vec<std::string::String>,
2653
2654 /// Namespaces which must be aliased in snippets due to
2655 /// a known (but non-generator-predictable) naming collision
2656 pub forced_namespace_aliases: std::vec::Vec<std::string::String>,
2657
2658 /// Method signatures (in the form "service.method(signature)")
2659 /// which are provided separately, so shouldn't be generated.
2660 /// Snippets *calling* these methods are still generated, however.
2661 pub handwritten_signatures: std::vec::Vec<std::string::String>,
2662
2663 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2664}
2665
2666impl DotnetSettings {
2667 pub fn new() -> Self {
2668 std::default::Default::default()
2669 }
2670
2671 /// Sets the value of [common][crate::model::DotnetSettings::common].
2672 ///
2673 /// # Example
2674 /// ```ignore,no_run
2675 /// # use google_cloud_api::model::DotnetSettings;
2676 /// use google_cloud_api::model::CommonLanguageSettings;
2677 /// let x = DotnetSettings::new().set_common(CommonLanguageSettings::default()/* use setters */);
2678 /// ```
2679 pub fn set_common<T>(mut self, v: T) -> Self
2680 where
2681 T: std::convert::Into<crate::model::CommonLanguageSettings>,
2682 {
2683 self.common = std::option::Option::Some(v.into());
2684 self
2685 }
2686
2687 /// Sets or clears the value of [common][crate::model::DotnetSettings::common].
2688 ///
2689 /// # Example
2690 /// ```ignore,no_run
2691 /// # use google_cloud_api::model::DotnetSettings;
2692 /// use google_cloud_api::model::CommonLanguageSettings;
2693 /// let x = DotnetSettings::new().set_or_clear_common(Some(CommonLanguageSettings::default()/* use setters */));
2694 /// let x = DotnetSettings::new().set_or_clear_common(None::<CommonLanguageSettings>);
2695 /// ```
2696 pub fn set_or_clear_common<T>(mut self, v: std::option::Option<T>) -> Self
2697 where
2698 T: std::convert::Into<crate::model::CommonLanguageSettings>,
2699 {
2700 self.common = v.map(|x| x.into());
2701 self
2702 }
2703
2704 /// Sets the value of [renamed_services][crate::model::DotnetSettings::renamed_services].
2705 ///
2706 /// # Example
2707 /// ```ignore,no_run
2708 /// # use google_cloud_api::model::DotnetSettings;
2709 /// let x = DotnetSettings::new().set_renamed_services([
2710 /// ("key0", "abc"),
2711 /// ("key1", "xyz"),
2712 /// ]);
2713 /// ```
2714 pub fn set_renamed_services<T, K, V>(mut self, v: T) -> Self
2715 where
2716 T: std::iter::IntoIterator<Item = (K, V)>,
2717 K: std::convert::Into<std::string::String>,
2718 V: std::convert::Into<std::string::String>,
2719 {
2720 use std::iter::Iterator;
2721 self.renamed_services = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2722 self
2723 }
2724
2725 /// Sets the value of [renamed_resources][crate::model::DotnetSettings::renamed_resources].
2726 ///
2727 /// # Example
2728 /// ```ignore,no_run
2729 /// # use google_cloud_api::model::DotnetSettings;
2730 /// let x = DotnetSettings::new().set_renamed_resources([
2731 /// ("key0", "abc"),
2732 /// ("key1", "xyz"),
2733 /// ]);
2734 /// ```
2735 pub fn set_renamed_resources<T, K, V>(mut self, v: T) -> Self
2736 where
2737 T: std::iter::IntoIterator<Item = (K, V)>,
2738 K: std::convert::Into<std::string::String>,
2739 V: std::convert::Into<std::string::String>,
2740 {
2741 use std::iter::Iterator;
2742 self.renamed_resources = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2743 self
2744 }
2745
2746 /// Sets the value of [ignored_resources][crate::model::DotnetSettings::ignored_resources].
2747 ///
2748 /// # Example
2749 /// ```ignore,no_run
2750 /// # use google_cloud_api::model::DotnetSettings;
2751 /// let x = DotnetSettings::new().set_ignored_resources(["a", "b", "c"]);
2752 /// ```
2753 pub fn set_ignored_resources<T, V>(mut self, v: T) -> Self
2754 where
2755 T: std::iter::IntoIterator<Item = V>,
2756 V: std::convert::Into<std::string::String>,
2757 {
2758 use std::iter::Iterator;
2759 self.ignored_resources = v.into_iter().map(|i| i.into()).collect();
2760 self
2761 }
2762
2763 /// Sets the value of [forced_namespace_aliases][crate::model::DotnetSettings::forced_namespace_aliases].
2764 ///
2765 /// # Example
2766 /// ```ignore,no_run
2767 /// # use google_cloud_api::model::DotnetSettings;
2768 /// let x = DotnetSettings::new().set_forced_namespace_aliases(["a", "b", "c"]);
2769 /// ```
2770 pub fn set_forced_namespace_aliases<T, V>(mut self, v: T) -> Self
2771 where
2772 T: std::iter::IntoIterator<Item = V>,
2773 V: std::convert::Into<std::string::String>,
2774 {
2775 use std::iter::Iterator;
2776 self.forced_namespace_aliases = v.into_iter().map(|i| i.into()).collect();
2777 self
2778 }
2779
2780 /// Sets the value of [handwritten_signatures][crate::model::DotnetSettings::handwritten_signatures].
2781 ///
2782 /// # Example
2783 /// ```ignore,no_run
2784 /// # use google_cloud_api::model::DotnetSettings;
2785 /// let x = DotnetSettings::new().set_handwritten_signatures(["a", "b", "c"]);
2786 /// ```
2787 pub fn set_handwritten_signatures<T, V>(mut self, v: T) -> Self
2788 where
2789 T: std::iter::IntoIterator<Item = V>,
2790 V: std::convert::Into<std::string::String>,
2791 {
2792 use std::iter::Iterator;
2793 self.handwritten_signatures = v.into_iter().map(|i| i.into()).collect();
2794 self
2795 }
2796}
2797
2798impl wkt::message::Message for DotnetSettings {
2799 fn typename() -> &'static str {
2800 "type.googleapis.com/google.api.DotnetSettings"
2801 }
2802}
2803
2804/// Settings for Ruby client libraries.
2805#[derive(Clone, Default, PartialEq)]
2806#[non_exhaustive]
2807pub struct RubySettings {
2808 /// Some settings.
2809 pub common: std::option::Option<crate::model::CommonLanguageSettings>,
2810
2811 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2812}
2813
2814impl RubySettings {
2815 pub fn new() -> Self {
2816 std::default::Default::default()
2817 }
2818
2819 /// Sets the value of [common][crate::model::RubySettings::common].
2820 ///
2821 /// # Example
2822 /// ```ignore,no_run
2823 /// # use google_cloud_api::model::RubySettings;
2824 /// use google_cloud_api::model::CommonLanguageSettings;
2825 /// let x = RubySettings::new().set_common(CommonLanguageSettings::default()/* use setters */);
2826 /// ```
2827 pub fn set_common<T>(mut self, v: T) -> Self
2828 where
2829 T: std::convert::Into<crate::model::CommonLanguageSettings>,
2830 {
2831 self.common = std::option::Option::Some(v.into());
2832 self
2833 }
2834
2835 /// Sets or clears the value of [common][crate::model::RubySettings::common].
2836 ///
2837 /// # Example
2838 /// ```ignore,no_run
2839 /// # use google_cloud_api::model::RubySettings;
2840 /// use google_cloud_api::model::CommonLanguageSettings;
2841 /// let x = RubySettings::new().set_or_clear_common(Some(CommonLanguageSettings::default()/* use setters */));
2842 /// let x = RubySettings::new().set_or_clear_common(None::<CommonLanguageSettings>);
2843 /// ```
2844 pub fn set_or_clear_common<T>(mut self, v: std::option::Option<T>) -> Self
2845 where
2846 T: std::convert::Into<crate::model::CommonLanguageSettings>,
2847 {
2848 self.common = v.map(|x| x.into());
2849 self
2850 }
2851}
2852
2853impl wkt::message::Message for RubySettings {
2854 fn typename() -> &'static str {
2855 "type.googleapis.com/google.api.RubySettings"
2856 }
2857}
2858
2859/// Settings for Go client libraries.
2860#[derive(Clone, Default, PartialEq)]
2861#[non_exhaustive]
2862pub struct GoSettings {
2863 /// Some settings.
2864 pub common: std::option::Option<crate::model::CommonLanguageSettings>,
2865
2866 /// Map of service names to renamed services. Keys are the package relative
2867 /// service names and values are the name to be used for the service client
2868 /// and call options.
2869 ///
2870 /// publishing:
2871 /// go_settings:
2872 /// renamed_services:
2873 /// Publisher: TopicAdmin
2874 pub renamed_services: std::collections::HashMap<std::string::String, std::string::String>,
2875
2876 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2877}
2878
2879impl GoSettings {
2880 pub fn new() -> Self {
2881 std::default::Default::default()
2882 }
2883
2884 /// Sets the value of [common][crate::model::GoSettings::common].
2885 ///
2886 /// # Example
2887 /// ```ignore,no_run
2888 /// # use google_cloud_api::model::GoSettings;
2889 /// use google_cloud_api::model::CommonLanguageSettings;
2890 /// let x = GoSettings::new().set_common(CommonLanguageSettings::default()/* use setters */);
2891 /// ```
2892 pub fn set_common<T>(mut self, v: T) -> Self
2893 where
2894 T: std::convert::Into<crate::model::CommonLanguageSettings>,
2895 {
2896 self.common = std::option::Option::Some(v.into());
2897 self
2898 }
2899
2900 /// Sets or clears the value of [common][crate::model::GoSettings::common].
2901 ///
2902 /// # Example
2903 /// ```ignore,no_run
2904 /// # use google_cloud_api::model::GoSettings;
2905 /// use google_cloud_api::model::CommonLanguageSettings;
2906 /// let x = GoSettings::new().set_or_clear_common(Some(CommonLanguageSettings::default()/* use setters */));
2907 /// let x = GoSettings::new().set_or_clear_common(None::<CommonLanguageSettings>);
2908 /// ```
2909 pub fn set_or_clear_common<T>(mut self, v: std::option::Option<T>) -> Self
2910 where
2911 T: std::convert::Into<crate::model::CommonLanguageSettings>,
2912 {
2913 self.common = v.map(|x| x.into());
2914 self
2915 }
2916
2917 /// Sets the value of [renamed_services][crate::model::GoSettings::renamed_services].
2918 ///
2919 /// # Example
2920 /// ```ignore,no_run
2921 /// # use google_cloud_api::model::GoSettings;
2922 /// let x = GoSettings::new().set_renamed_services([
2923 /// ("key0", "abc"),
2924 /// ("key1", "xyz"),
2925 /// ]);
2926 /// ```
2927 pub fn set_renamed_services<T, K, V>(mut self, v: T) -> Self
2928 where
2929 T: std::iter::IntoIterator<Item = (K, V)>,
2930 K: std::convert::Into<std::string::String>,
2931 V: std::convert::Into<std::string::String>,
2932 {
2933 use std::iter::Iterator;
2934 self.renamed_services = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2935 self
2936 }
2937}
2938
2939impl wkt::message::Message for GoSettings {
2940 fn typename() -> &'static str {
2941 "type.googleapis.com/google.api.GoSettings"
2942 }
2943}
2944
2945/// Describes the generator configuration for a method.
2946#[derive(Clone, Default, PartialEq)]
2947#[non_exhaustive]
2948pub struct MethodSettings {
2949 /// The fully qualified name of the method, for which the options below apply.
2950 /// This is used to find the method to apply the options.
2951 ///
2952 /// Example:
2953 ///
2954 /// ```norust
2955 /// publishing:
2956 /// method_settings:
2957 /// - selector: google.storage.control.v2.StorageControl.CreateFolder
2958 /// # method settings for CreateFolder...
2959 /// ```
2960 pub selector: std::string::String,
2961
2962 /// Describes settings to use for long-running operations when generating
2963 /// API methods for RPCs. Complements RPCs that use the annotations in
2964 /// google/longrunning/operations.proto.
2965 ///
2966 /// Example of a YAML configuration::
2967 ///
2968 /// ```norust
2969 /// publishing:
2970 /// method_settings:
2971 /// - selector: google.cloud.speech.v2.Speech.BatchRecognize
2972 /// long_running:
2973 /// initial_poll_delay: 60s # 1 minute
2974 /// poll_delay_multiplier: 1.5
2975 /// max_poll_delay: 360s # 6 minutes
2976 /// total_poll_timeout: 54000s # 90 minutes
2977 /// ```
2978 pub long_running: std::option::Option<crate::model::method_settings::LongRunning>,
2979
2980 /// List of top-level fields of the request message, that should be
2981 /// automatically populated by the client libraries based on their
2982 /// (google.api.field_info).format. Currently supported format: UUID4.
2983 ///
2984 /// Example of a YAML configuration:
2985 ///
2986 /// ```norust
2987 /// publishing:
2988 /// method_settings:
2989 /// - selector: google.example.v1.ExampleService.CreateExample
2990 /// auto_populated_fields:
2991 /// - request_id
2992 /// ```
2993 pub auto_populated_fields: std::vec::Vec<std::string::String>,
2994
2995 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2996}
2997
2998impl MethodSettings {
2999 pub fn new() -> Self {
3000 std::default::Default::default()
3001 }
3002
3003 /// Sets the value of [selector][crate::model::MethodSettings::selector].
3004 ///
3005 /// # Example
3006 /// ```ignore,no_run
3007 /// # use google_cloud_api::model::MethodSettings;
3008 /// let x = MethodSettings::new().set_selector("example");
3009 /// ```
3010 pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3011 self.selector = v.into();
3012 self
3013 }
3014
3015 /// Sets the value of [long_running][crate::model::MethodSettings::long_running].
3016 ///
3017 /// # Example
3018 /// ```ignore,no_run
3019 /// # use google_cloud_api::model::MethodSettings;
3020 /// use google_cloud_api::model::method_settings::LongRunning;
3021 /// let x = MethodSettings::new().set_long_running(LongRunning::default()/* use setters */);
3022 /// ```
3023 pub fn set_long_running<T>(mut self, v: T) -> Self
3024 where
3025 T: std::convert::Into<crate::model::method_settings::LongRunning>,
3026 {
3027 self.long_running = std::option::Option::Some(v.into());
3028 self
3029 }
3030
3031 /// Sets or clears the value of [long_running][crate::model::MethodSettings::long_running].
3032 ///
3033 /// # Example
3034 /// ```ignore,no_run
3035 /// # use google_cloud_api::model::MethodSettings;
3036 /// use google_cloud_api::model::method_settings::LongRunning;
3037 /// let x = MethodSettings::new().set_or_clear_long_running(Some(LongRunning::default()/* use setters */));
3038 /// let x = MethodSettings::new().set_or_clear_long_running(None::<LongRunning>);
3039 /// ```
3040 pub fn set_or_clear_long_running<T>(mut self, v: std::option::Option<T>) -> Self
3041 where
3042 T: std::convert::Into<crate::model::method_settings::LongRunning>,
3043 {
3044 self.long_running = v.map(|x| x.into());
3045 self
3046 }
3047
3048 /// Sets the value of [auto_populated_fields][crate::model::MethodSettings::auto_populated_fields].
3049 ///
3050 /// # Example
3051 /// ```ignore,no_run
3052 /// # use google_cloud_api::model::MethodSettings;
3053 /// let x = MethodSettings::new().set_auto_populated_fields(["a", "b", "c"]);
3054 /// ```
3055 pub fn set_auto_populated_fields<T, V>(mut self, v: T) -> Self
3056 where
3057 T: std::iter::IntoIterator<Item = V>,
3058 V: std::convert::Into<std::string::String>,
3059 {
3060 use std::iter::Iterator;
3061 self.auto_populated_fields = v.into_iter().map(|i| i.into()).collect();
3062 self
3063 }
3064}
3065
3066impl wkt::message::Message for MethodSettings {
3067 fn typename() -> &'static str {
3068 "type.googleapis.com/google.api.MethodSettings"
3069 }
3070}
3071
3072/// Defines additional types related to [MethodSettings].
3073pub mod method_settings {
3074 #[allow(unused_imports)]
3075 use super::*;
3076
3077 /// Describes settings to use when generating API methods that use the
3078 /// long-running operation pattern.
3079 /// All default values below are from those used in the client library
3080 /// generators (e.g.
3081 /// [Java](https://github.com/googleapis/gapic-generator-java/blob/04c2faa191a9b5a10b92392fe8482279c4404803/src/main/java/com/google/api/generator/gapic/composer/common/RetrySettingsComposer.java)).
3082 #[derive(Clone, Default, PartialEq)]
3083 #[non_exhaustive]
3084 pub struct LongRunning {
3085 /// Initial delay after which the first poll request will be made.
3086 /// Default value: 5 seconds.
3087 pub initial_poll_delay: std::option::Option<wkt::Duration>,
3088
3089 /// Multiplier to gradually increase delay between subsequent polls until it
3090 /// reaches max_poll_delay.
3091 /// Default value: 1.5.
3092 pub poll_delay_multiplier: f32,
3093
3094 /// Maximum time between two subsequent poll requests.
3095 /// Default value: 45 seconds.
3096 pub max_poll_delay: std::option::Option<wkt::Duration>,
3097
3098 /// Total polling timeout.
3099 /// Default value: 5 minutes.
3100 pub total_poll_timeout: std::option::Option<wkt::Duration>,
3101
3102 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3103 }
3104
3105 impl LongRunning {
3106 pub fn new() -> Self {
3107 std::default::Default::default()
3108 }
3109
3110 /// Sets the value of [initial_poll_delay][crate::model::method_settings::LongRunning::initial_poll_delay].
3111 ///
3112 /// # Example
3113 /// ```ignore,no_run
3114 /// # use google_cloud_api::model::method_settings::LongRunning;
3115 /// use wkt::Duration;
3116 /// let x = LongRunning::new().set_initial_poll_delay(Duration::default()/* use setters */);
3117 /// ```
3118 pub fn set_initial_poll_delay<T>(mut self, v: T) -> Self
3119 where
3120 T: std::convert::Into<wkt::Duration>,
3121 {
3122 self.initial_poll_delay = std::option::Option::Some(v.into());
3123 self
3124 }
3125
3126 /// Sets or clears the value of [initial_poll_delay][crate::model::method_settings::LongRunning::initial_poll_delay].
3127 ///
3128 /// # Example
3129 /// ```ignore,no_run
3130 /// # use google_cloud_api::model::method_settings::LongRunning;
3131 /// use wkt::Duration;
3132 /// let x = LongRunning::new().set_or_clear_initial_poll_delay(Some(Duration::default()/* use setters */));
3133 /// let x = LongRunning::new().set_or_clear_initial_poll_delay(None::<Duration>);
3134 /// ```
3135 pub fn set_or_clear_initial_poll_delay<T>(mut self, v: std::option::Option<T>) -> Self
3136 where
3137 T: std::convert::Into<wkt::Duration>,
3138 {
3139 self.initial_poll_delay = v.map(|x| x.into());
3140 self
3141 }
3142
3143 /// Sets the value of [poll_delay_multiplier][crate::model::method_settings::LongRunning::poll_delay_multiplier].
3144 ///
3145 /// # Example
3146 /// ```ignore,no_run
3147 /// # use google_cloud_api::model::method_settings::LongRunning;
3148 /// let x = LongRunning::new().set_poll_delay_multiplier(42.0);
3149 /// ```
3150 pub fn set_poll_delay_multiplier<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
3151 self.poll_delay_multiplier = v.into();
3152 self
3153 }
3154
3155 /// Sets the value of [max_poll_delay][crate::model::method_settings::LongRunning::max_poll_delay].
3156 ///
3157 /// # Example
3158 /// ```ignore,no_run
3159 /// # use google_cloud_api::model::method_settings::LongRunning;
3160 /// use wkt::Duration;
3161 /// let x = LongRunning::new().set_max_poll_delay(Duration::default()/* use setters */);
3162 /// ```
3163 pub fn set_max_poll_delay<T>(mut self, v: T) -> Self
3164 where
3165 T: std::convert::Into<wkt::Duration>,
3166 {
3167 self.max_poll_delay = std::option::Option::Some(v.into());
3168 self
3169 }
3170
3171 /// Sets or clears the value of [max_poll_delay][crate::model::method_settings::LongRunning::max_poll_delay].
3172 ///
3173 /// # Example
3174 /// ```ignore,no_run
3175 /// # use google_cloud_api::model::method_settings::LongRunning;
3176 /// use wkt::Duration;
3177 /// let x = LongRunning::new().set_or_clear_max_poll_delay(Some(Duration::default()/* use setters */));
3178 /// let x = LongRunning::new().set_or_clear_max_poll_delay(None::<Duration>);
3179 /// ```
3180 pub fn set_or_clear_max_poll_delay<T>(mut self, v: std::option::Option<T>) -> Self
3181 where
3182 T: std::convert::Into<wkt::Duration>,
3183 {
3184 self.max_poll_delay = v.map(|x| x.into());
3185 self
3186 }
3187
3188 /// Sets the value of [total_poll_timeout][crate::model::method_settings::LongRunning::total_poll_timeout].
3189 ///
3190 /// # Example
3191 /// ```ignore,no_run
3192 /// # use google_cloud_api::model::method_settings::LongRunning;
3193 /// use wkt::Duration;
3194 /// let x = LongRunning::new().set_total_poll_timeout(Duration::default()/* use setters */);
3195 /// ```
3196 pub fn set_total_poll_timeout<T>(mut self, v: T) -> Self
3197 where
3198 T: std::convert::Into<wkt::Duration>,
3199 {
3200 self.total_poll_timeout = std::option::Option::Some(v.into());
3201 self
3202 }
3203
3204 /// Sets or clears the value of [total_poll_timeout][crate::model::method_settings::LongRunning::total_poll_timeout].
3205 ///
3206 /// # Example
3207 /// ```ignore,no_run
3208 /// # use google_cloud_api::model::method_settings::LongRunning;
3209 /// use wkt::Duration;
3210 /// let x = LongRunning::new().set_or_clear_total_poll_timeout(Some(Duration::default()/* use setters */));
3211 /// let x = LongRunning::new().set_or_clear_total_poll_timeout(None::<Duration>);
3212 /// ```
3213 pub fn set_or_clear_total_poll_timeout<T>(mut self, v: std::option::Option<T>) -> Self
3214 where
3215 T: std::convert::Into<wkt::Duration>,
3216 {
3217 self.total_poll_timeout = v.map(|x| x.into());
3218 self
3219 }
3220 }
3221
3222 impl wkt::message::Message for LongRunning {
3223 fn typename() -> &'static str {
3224 "type.googleapis.com/google.api.MethodSettings.LongRunning"
3225 }
3226 }
3227}
3228
3229/// This message is used to configure the generation of a subset of the RPCs in
3230/// a service for client libraries.
3231#[derive(Clone, Default, PartialEq)]
3232#[non_exhaustive]
3233pub struct SelectiveGapicGeneration {
3234 /// An allowlist of the fully qualified names of RPCs that should be included
3235 /// on public client surfaces.
3236 pub methods: std::vec::Vec<std::string::String>,
3237
3238 /// Setting this to true indicates to the client generators that methods
3239 /// that would be excluded from the generation should instead be generated
3240 /// in a way that indicates these methods should not be consumed by
3241 /// end users. How this is expressed is up to individual language
3242 /// implementations to decide. Some examples may be: added annotations,
3243 /// obfuscated identifiers, or other language idiomatic patterns.
3244 pub generate_omitted_as_internal: bool,
3245
3246 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3247}
3248
3249impl SelectiveGapicGeneration {
3250 pub fn new() -> Self {
3251 std::default::Default::default()
3252 }
3253
3254 /// Sets the value of [methods][crate::model::SelectiveGapicGeneration::methods].
3255 ///
3256 /// # Example
3257 /// ```ignore,no_run
3258 /// # use google_cloud_api::model::SelectiveGapicGeneration;
3259 /// let x = SelectiveGapicGeneration::new().set_methods(["a", "b", "c"]);
3260 /// ```
3261 pub fn set_methods<T, V>(mut self, v: T) -> Self
3262 where
3263 T: std::iter::IntoIterator<Item = V>,
3264 V: std::convert::Into<std::string::String>,
3265 {
3266 use std::iter::Iterator;
3267 self.methods = v.into_iter().map(|i| i.into()).collect();
3268 self
3269 }
3270
3271 /// Sets the value of [generate_omitted_as_internal][crate::model::SelectiveGapicGeneration::generate_omitted_as_internal].
3272 ///
3273 /// # Example
3274 /// ```ignore,no_run
3275 /// # use google_cloud_api::model::SelectiveGapicGeneration;
3276 /// let x = SelectiveGapicGeneration::new().set_generate_omitted_as_internal(true);
3277 /// ```
3278 pub fn set_generate_omitted_as_internal<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3279 self.generate_omitted_as_internal = v.into();
3280 self
3281 }
3282}
3283
3284impl wkt::message::Message for SelectiveGapicGeneration {
3285 fn typename() -> &'static str {
3286 "type.googleapis.com/google.api.SelectiveGapicGeneration"
3287 }
3288}
3289
3290/// Output generated from semantically comparing two versions of a service
3291/// configuration.
3292///
3293/// Includes detailed information about a field that have changed with
3294/// applicable advice about potential consequences for the change, such as
3295/// backwards-incompatibility.
3296#[derive(Clone, Default, PartialEq)]
3297#[non_exhaustive]
3298pub struct ConfigChange {
3299 /// Object hierarchy path to the change, with levels separated by a '.'
3300 /// character. For repeated fields, an applicable unique identifier field is
3301 /// used for the index (usually selector, name, or id). For maps, the term
3302 /// 'key' is used. If the field has no unique identifier, the numeric index
3303 /// is used.
3304 /// Examples:
3305 ///
3306 /// - visibility.rules[selector=="google.LibraryService.ListBooks"].restriction
3307 /// - quota.metric_rules[selector=="google"].metric_costs[key=="reads"].value
3308 /// - logging.producer_destinations[0]
3309 pub element: std::string::String,
3310
3311 /// Value of the changed object in the old Service configuration,
3312 /// in JSON format. This field will not be populated if ChangeType == ADDED.
3313 pub old_value: std::string::String,
3314
3315 /// Value of the changed object in the new Service configuration,
3316 /// in JSON format. This field will not be populated if ChangeType == REMOVED.
3317 pub new_value: std::string::String,
3318
3319 /// The type for this change, either ADDED, REMOVED, or MODIFIED.
3320 pub change_type: crate::model::ChangeType,
3321
3322 /// Collection of advice provided for this change, useful for determining the
3323 /// possible impact of this change.
3324 pub advices: std::vec::Vec<crate::model::Advice>,
3325
3326 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3327}
3328
3329impl ConfigChange {
3330 pub fn new() -> Self {
3331 std::default::Default::default()
3332 }
3333
3334 /// Sets the value of [element][crate::model::ConfigChange::element].
3335 ///
3336 /// # Example
3337 /// ```ignore,no_run
3338 /// # use google_cloud_api::model::ConfigChange;
3339 /// let x = ConfigChange::new().set_element("example");
3340 /// ```
3341 pub fn set_element<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3342 self.element = v.into();
3343 self
3344 }
3345
3346 /// Sets the value of [old_value][crate::model::ConfigChange::old_value].
3347 ///
3348 /// # Example
3349 /// ```ignore,no_run
3350 /// # use google_cloud_api::model::ConfigChange;
3351 /// let x = ConfigChange::new().set_old_value("example");
3352 /// ```
3353 pub fn set_old_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3354 self.old_value = v.into();
3355 self
3356 }
3357
3358 /// Sets the value of [new_value][crate::model::ConfigChange::new_value].
3359 ///
3360 /// # Example
3361 /// ```ignore,no_run
3362 /// # use google_cloud_api::model::ConfigChange;
3363 /// let x = ConfigChange::new().set_new_value("example");
3364 /// ```
3365 pub fn set_new_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3366 self.new_value = v.into();
3367 self
3368 }
3369
3370 /// Sets the value of [change_type][crate::model::ConfigChange::change_type].
3371 ///
3372 /// # Example
3373 /// ```ignore,no_run
3374 /// # use google_cloud_api::model::ConfigChange;
3375 /// use google_cloud_api::model::ChangeType;
3376 /// let x0 = ConfigChange::new().set_change_type(ChangeType::Added);
3377 /// let x1 = ConfigChange::new().set_change_type(ChangeType::Removed);
3378 /// let x2 = ConfigChange::new().set_change_type(ChangeType::Modified);
3379 /// ```
3380 pub fn set_change_type<T: std::convert::Into<crate::model::ChangeType>>(
3381 mut self,
3382 v: T,
3383 ) -> Self {
3384 self.change_type = v.into();
3385 self
3386 }
3387
3388 /// Sets the value of [advices][crate::model::ConfigChange::advices].
3389 ///
3390 /// # Example
3391 /// ```ignore,no_run
3392 /// # use google_cloud_api::model::ConfigChange;
3393 /// use google_cloud_api::model::Advice;
3394 /// let x = ConfigChange::new()
3395 /// .set_advices([
3396 /// Advice::default()/* use setters */,
3397 /// Advice::default()/* use (different) setters */,
3398 /// ]);
3399 /// ```
3400 pub fn set_advices<T, V>(mut self, v: T) -> Self
3401 where
3402 T: std::iter::IntoIterator<Item = V>,
3403 V: std::convert::Into<crate::model::Advice>,
3404 {
3405 use std::iter::Iterator;
3406 self.advices = v.into_iter().map(|i| i.into()).collect();
3407 self
3408 }
3409}
3410
3411impl wkt::message::Message for ConfigChange {
3412 fn typename() -> &'static str {
3413 "type.googleapis.com/google.api.ConfigChange"
3414 }
3415}
3416
3417/// Generated advice about this change, used for providing more
3418/// information about how a change will affect the existing service.
3419#[derive(Clone, Default, PartialEq)]
3420#[non_exhaustive]
3421pub struct Advice {
3422 /// Useful description for why this advice was applied and what actions should
3423 /// be taken to mitigate any implied risks.
3424 pub description: std::string::String,
3425
3426 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3427}
3428
3429impl Advice {
3430 pub fn new() -> Self {
3431 std::default::Default::default()
3432 }
3433
3434 /// Sets the value of [description][crate::model::Advice::description].
3435 ///
3436 /// # Example
3437 /// ```ignore,no_run
3438 /// # use google_cloud_api::model::Advice;
3439 /// let x = Advice::new().set_description("example");
3440 /// ```
3441 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3442 self.description = v.into();
3443 self
3444 }
3445}
3446
3447impl wkt::message::Message for Advice {
3448 fn typename() -> &'static str {
3449 "type.googleapis.com/google.api.Advice"
3450 }
3451}
3452
3453/// A descriptor for defining project properties for a service. One service may
3454/// have many consumer projects, and the service may want to behave differently
3455/// depending on some properties on the project. For example, a project may be
3456/// associated with a school, or a business, or a government agency, a business
3457/// type property on the project may affect how a service responds to the client.
3458/// This descriptor defines which properties are allowed to be set on a project.
3459///
3460/// Example:
3461///
3462/// ```norust
3463/// project_properties:
3464/// properties:
3465/// - name: NO_WATERMARK
3466/// type: BOOL
3467/// description: Allows usage of the API without watermarks.
3468/// - name: EXTENDED_TILE_CACHE_PERIOD
3469/// type: INT64
3470/// ```
3471#[derive(Clone, Default, PartialEq)]
3472#[non_exhaustive]
3473pub struct ProjectProperties {
3474 /// List of per consumer project-specific properties.
3475 pub properties: std::vec::Vec<crate::model::Property>,
3476
3477 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3478}
3479
3480impl ProjectProperties {
3481 pub fn new() -> Self {
3482 std::default::Default::default()
3483 }
3484
3485 /// Sets the value of [properties][crate::model::ProjectProperties::properties].
3486 ///
3487 /// # Example
3488 /// ```ignore,no_run
3489 /// # use google_cloud_api::model::ProjectProperties;
3490 /// use google_cloud_api::model::Property;
3491 /// let x = ProjectProperties::new()
3492 /// .set_properties([
3493 /// Property::default()/* use setters */,
3494 /// Property::default()/* use (different) setters */,
3495 /// ]);
3496 /// ```
3497 pub fn set_properties<T, V>(mut self, v: T) -> Self
3498 where
3499 T: std::iter::IntoIterator<Item = V>,
3500 V: std::convert::Into<crate::model::Property>,
3501 {
3502 use std::iter::Iterator;
3503 self.properties = v.into_iter().map(|i| i.into()).collect();
3504 self
3505 }
3506}
3507
3508impl wkt::message::Message for ProjectProperties {
3509 fn typename() -> &'static str {
3510 "type.googleapis.com/google.api.ProjectProperties"
3511 }
3512}
3513
3514/// Defines project properties.
3515///
3516/// API services can define properties that can be assigned to consumer projects
3517/// so that backends can perform response customization without having to make
3518/// additional calls or maintain additional storage. For example, Maps API
3519/// defines properties that controls map tile cache period, or whether to embed a
3520/// watermark in a result.
3521///
3522/// These values can be set via API producer console. Only API providers can
3523/// define and set these properties.
3524#[derive(Clone, Default, PartialEq)]
3525#[non_exhaustive]
3526pub struct Property {
3527 /// The name of the property (a.k.a key).
3528 pub name: std::string::String,
3529
3530 /// The type of this property.
3531 pub r#type: crate::model::property::PropertyType,
3532
3533 /// The description of the property
3534 pub description: std::string::String,
3535
3536 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3537}
3538
3539impl Property {
3540 pub fn new() -> Self {
3541 std::default::Default::default()
3542 }
3543
3544 /// Sets the value of [name][crate::model::Property::name].
3545 ///
3546 /// # Example
3547 /// ```ignore,no_run
3548 /// # use google_cloud_api::model::Property;
3549 /// let x = Property::new().set_name("example");
3550 /// ```
3551 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3552 self.name = v.into();
3553 self
3554 }
3555
3556 /// Sets the value of [r#type][crate::model::Property::type].
3557 ///
3558 /// # Example
3559 /// ```ignore,no_run
3560 /// # use google_cloud_api::model::Property;
3561 /// use google_cloud_api::model::property::PropertyType;
3562 /// let x0 = Property::new().set_type(PropertyType::Int64);
3563 /// let x1 = Property::new().set_type(PropertyType::Bool);
3564 /// let x2 = Property::new().set_type(PropertyType::String);
3565 /// ```
3566 pub fn set_type<T: std::convert::Into<crate::model::property::PropertyType>>(
3567 mut self,
3568 v: T,
3569 ) -> Self {
3570 self.r#type = v.into();
3571 self
3572 }
3573
3574 /// Sets the value of [description][crate::model::Property::description].
3575 ///
3576 /// # Example
3577 /// ```ignore,no_run
3578 /// # use google_cloud_api::model::Property;
3579 /// let x = Property::new().set_description("example");
3580 /// ```
3581 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3582 self.description = v.into();
3583 self
3584 }
3585}
3586
3587impl wkt::message::Message for Property {
3588 fn typename() -> &'static str {
3589 "type.googleapis.com/google.api.Property"
3590 }
3591}
3592
3593/// Defines additional types related to [Property].
3594pub mod property {
3595 #[allow(unused_imports)]
3596 use super::*;
3597
3598 /// Supported data type of the property values
3599 ///
3600 /// # Working with unknown values
3601 ///
3602 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3603 /// additional enum variants at any time. Adding new variants is not considered
3604 /// a breaking change. Applications should write their code in anticipation of:
3605 ///
3606 /// - New values appearing in future releases of the client library, **and**
3607 /// - New values received dynamically, without application changes.
3608 ///
3609 /// Please consult the [Working with enums] section in the user guide for some
3610 /// guidelines.
3611 ///
3612 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3613 #[derive(Clone, Debug, PartialEq)]
3614 #[non_exhaustive]
3615 pub enum PropertyType {
3616 /// The type is unspecified, and will result in an error.
3617 Unspecified,
3618 /// The type is `int64`.
3619 Int64,
3620 /// The type is `bool`.
3621 Bool,
3622 /// The type is `string`.
3623 String,
3624 /// The type is 'double'.
3625 Double,
3626 /// If set, the enum was initialized with an unknown value.
3627 ///
3628 /// Applications can examine the value using [PropertyType::value] or
3629 /// [PropertyType::name].
3630 UnknownValue(property_type::UnknownValue),
3631 }
3632
3633 #[doc(hidden)]
3634 pub mod property_type {
3635 #[allow(unused_imports)]
3636 use super::*;
3637 #[derive(Clone, Debug, PartialEq)]
3638 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3639 }
3640
3641 impl PropertyType {
3642 /// Gets the enum value.
3643 ///
3644 /// Returns `None` if the enum contains an unknown value deserialized from
3645 /// the string representation of enums.
3646 pub fn value(&self) -> std::option::Option<i32> {
3647 match self {
3648 Self::Unspecified => std::option::Option::Some(0),
3649 Self::Int64 => std::option::Option::Some(1),
3650 Self::Bool => std::option::Option::Some(2),
3651 Self::String => std::option::Option::Some(3),
3652 Self::Double => std::option::Option::Some(4),
3653 Self::UnknownValue(u) => u.0.value(),
3654 }
3655 }
3656
3657 /// Gets the enum value as a string.
3658 ///
3659 /// Returns `None` if the enum contains an unknown value deserialized from
3660 /// the integer representation of enums.
3661 pub fn name(&self) -> std::option::Option<&str> {
3662 match self {
3663 Self::Unspecified => std::option::Option::Some("UNSPECIFIED"),
3664 Self::Int64 => std::option::Option::Some("INT64"),
3665 Self::Bool => std::option::Option::Some("BOOL"),
3666 Self::String => std::option::Option::Some("STRING"),
3667 Self::Double => std::option::Option::Some("DOUBLE"),
3668 Self::UnknownValue(u) => u.0.name(),
3669 }
3670 }
3671 }
3672
3673 impl std::default::Default for PropertyType {
3674 fn default() -> Self {
3675 use std::convert::From;
3676 Self::from(0)
3677 }
3678 }
3679
3680 impl std::fmt::Display for PropertyType {
3681 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3682 wkt::internal::display_enum(f, self.name(), self.value())
3683 }
3684 }
3685
3686 impl std::convert::From<i32> for PropertyType {
3687 fn from(value: i32) -> Self {
3688 match value {
3689 0 => Self::Unspecified,
3690 1 => Self::Int64,
3691 2 => Self::Bool,
3692 3 => Self::String,
3693 4 => Self::Double,
3694 _ => Self::UnknownValue(property_type::UnknownValue(
3695 wkt::internal::UnknownEnumValue::Integer(value),
3696 )),
3697 }
3698 }
3699 }
3700
3701 impl std::convert::From<&str> for PropertyType {
3702 fn from(value: &str) -> Self {
3703 use std::string::ToString;
3704 match value {
3705 "UNSPECIFIED" => Self::Unspecified,
3706 "INT64" => Self::Int64,
3707 "BOOL" => Self::Bool,
3708 "STRING" => Self::String,
3709 "DOUBLE" => Self::Double,
3710 _ => Self::UnknownValue(property_type::UnknownValue(
3711 wkt::internal::UnknownEnumValue::String(value.to_string()),
3712 )),
3713 }
3714 }
3715 }
3716
3717 impl serde::ser::Serialize for PropertyType {
3718 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3719 where
3720 S: serde::Serializer,
3721 {
3722 match self {
3723 Self::Unspecified => serializer.serialize_i32(0),
3724 Self::Int64 => serializer.serialize_i32(1),
3725 Self::Bool => serializer.serialize_i32(2),
3726 Self::String => serializer.serialize_i32(3),
3727 Self::Double => serializer.serialize_i32(4),
3728 Self::UnknownValue(u) => u.0.serialize(serializer),
3729 }
3730 }
3731 }
3732
3733 impl<'de> serde::de::Deserialize<'de> for PropertyType {
3734 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3735 where
3736 D: serde::Deserializer<'de>,
3737 {
3738 deserializer.deserialize_any(wkt::internal::EnumVisitor::<PropertyType>::new(
3739 ".google.api.Property.PropertyType",
3740 ))
3741 }
3742 }
3743}
3744
3745/// `Context` defines which contexts an API requests.
3746///
3747/// Example:
3748///
3749/// ```norust
3750/// context:
3751/// rules:
3752/// - selector: "*"
3753/// requested:
3754/// - google.rpc.context.ProjectContext
3755/// - google.rpc.context.OriginContext
3756/// ```
3757///
3758/// The above specifies that all methods in the API request
3759/// `google.rpc.context.ProjectContext` and
3760/// `google.rpc.context.OriginContext`.
3761///
3762/// Available context types are defined in package
3763/// `google.rpc.context`.
3764///
3765/// This also provides mechanism to allowlist any protobuf message extension that
3766/// can be sent in grpc metadata using “x-goog-ext-<extension_id>-bin” and
3767/// “x-goog-ext-<extension_id>-jspb” format. For example, list any service
3768/// specific protobuf types that can appear in grpc metadata as follows in your
3769/// yaml file:
3770///
3771/// Example:
3772///
3773/// ```norust
3774/// context:
3775/// rules:
3776/// - selector: "google.example.library.v1.LibraryService.CreateBook"
3777/// allowed_request_extensions:
3778/// - google.foo.v1.NewExtension
3779/// allowed_response_extensions:
3780/// - google.foo.v1.NewExtension
3781/// ```
3782///
3783/// You can also specify extension ID instead of fully qualified extension name
3784/// here.
3785#[derive(Clone, Default, PartialEq)]
3786#[non_exhaustive]
3787pub struct Context {
3788 /// A list of RPC context rules that apply to individual API methods.
3789 ///
3790 /// **NOTE:** All service configuration rules follow "last one wins" order.
3791 pub rules: std::vec::Vec<crate::model::ContextRule>,
3792
3793 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3794}
3795
3796impl Context {
3797 pub fn new() -> Self {
3798 std::default::Default::default()
3799 }
3800
3801 /// Sets the value of [rules][crate::model::Context::rules].
3802 ///
3803 /// # Example
3804 /// ```ignore,no_run
3805 /// # use google_cloud_api::model::Context;
3806 /// use google_cloud_api::model::ContextRule;
3807 /// let x = Context::new()
3808 /// .set_rules([
3809 /// ContextRule::default()/* use setters */,
3810 /// ContextRule::default()/* use (different) setters */,
3811 /// ]);
3812 /// ```
3813 pub fn set_rules<T, V>(mut self, v: T) -> Self
3814 where
3815 T: std::iter::IntoIterator<Item = V>,
3816 V: std::convert::Into<crate::model::ContextRule>,
3817 {
3818 use std::iter::Iterator;
3819 self.rules = v.into_iter().map(|i| i.into()).collect();
3820 self
3821 }
3822}
3823
3824impl wkt::message::Message for Context {
3825 fn typename() -> &'static str {
3826 "type.googleapis.com/google.api.Context"
3827 }
3828}
3829
3830/// A context rule provides information about the context for an individual API
3831/// element.
3832#[derive(Clone, Default, PartialEq)]
3833#[non_exhaustive]
3834pub struct ContextRule {
3835 /// Selects the methods to which this rule applies.
3836 ///
3837 /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
3838 /// details.
3839 ///
3840 /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
3841 pub selector: std::string::String,
3842
3843 /// A list of full type names of requested contexts, only the requested context
3844 /// will be made available to the backend.
3845 pub requested: std::vec::Vec<std::string::String>,
3846
3847 /// A list of full type names of provided contexts. It is used to support
3848 /// propagating HTTP headers and ETags from the response extension.
3849 pub provided: std::vec::Vec<std::string::String>,
3850
3851 /// A list of full type names or extension IDs of extensions allowed in grpc
3852 /// side channel from client to backend.
3853 pub allowed_request_extensions: std::vec::Vec<std::string::String>,
3854
3855 /// A list of full type names or extension IDs of extensions allowed in grpc
3856 /// side channel from backend to client.
3857 pub allowed_response_extensions: std::vec::Vec<std::string::String>,
3858
3859 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3860}
3861
3862impl ContextRule {
3863 pub fn new() -> Self {
3864 std::default::Default::default()
3865 }
3866
3867 /// Sets the value of [selector][crate::model::ContextRule::selector].
3868 ///
3869 /// # Example
3870 /// ```ignore,no_run
3871 /// # use google_cloud_api::model::ContextRule;
3872 /// let x = ContextRule::new().set_selector("example");
3873 /// ```
3874 pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3875 self.selector = v.into();
3876 self
3877 }
3878
3879 /// Sets the value of [requested][crate::model::ContextRule::requested].
3880 ///
3881 /// # Example
3882 /// ```ignore,no_run
3883 /// # use google_cloud_api::model::ContextRule;
3884 /// let x = ContextRule::new().set_requested(["a", "b", "c"]);
3885 /// ```
3886 pub fn set_requested<T, V>(mut self, v: T) -> Self
3887 where
3888 T: std::iter::IntoIterator<Item = V>,
3889 V: std::convert::Into<std::string::String>,
3890 {
3891 use std::iter::Iterator;
3892 self.requested = v.into_iter().map(|i| i.into()).collect();
3893 self
3894 }
3895
3896 /// Sets the value of [provided][crate::model::ContextRule::provided].
3897 ///
3898 /// # Example
3899 /// ```ignore,no_run
3900 /// # use google_cloud_api::model::ContextRule;
3901 /// let x = ContextRule::new().set_provided(["a", "b", "c"]);
3902 /// ```
3903 pub fn set_provided<T, V>(mut self, v: T) -> Self
3904 where
3905 T: std::iter::IntoIterator<Item = V>,
3906 V: std::convert::Into<std::string::String>,
3907 {
3908 use std::iter::Iterator;
3909 self.provided = v.into_iter().map(|i| i.into()).collect();
3910 self
3911 }
3912
3913 /// Sets the value of [allowed_request_extensions][crate::model::ContextRule::allowed_request_extensions].
3914 ///
3915 /// # Example
3916 /// ```ignore,no_run
3917 /// # use google_cloud_api::model::ContextRule;
3918 /// let x = ContextRule::new().set_allowed_request_extensions(["a", "b", "c"]);
3919 /// ```
3920 pub fn set_allowed_request_extensions<T, V>(mut self, v: T) -> Self
3921 where
3922 T: std::iter::IntoIterator<Item = V>,
3923 V: std::convert::Into<std::string::String>,
3924 {
3925 use std::iter::Iterator;
3926 self.allowed_request_extensions = v.into_iter().map(|i| i.into()).collect();
3927 self
3928 }
3929
3930 /// Sets the value of [allowed_response_extensions][crate::model::ContextRule::allowed_response_extensions].
3931 ///
3932 /// # Example
3933 /// ```ignore,no_run
3934 /// # use google_cloud_api::model::ContextRule;
3935 /// let x = ContextRule::new().set_allowed_response_extensions(["a", "b", "c"]);
3936 /// ```
3937 pub fn set_allowed_response_extensions<T, V>(mut self, v: T) -> Self
3938 where
3939 T: std::iter::IntoIterator<Item = V>,
3940 V: std::convert::Into<std::string::String>,
3941 {
3942 use std::iter::Iterator;
3943 self.allowed_response_extensions = v.into_iter().map(|i| i.into()).collect();
3944 self
3945 }
3946}
3947
3948impl wkt::message::Message for ContextRule {
3949 fn typename() -> &'static str {
3950 "type.googleapis.com/google.api.ContextRule"
3951 }
3952}
3953
3954/// Selects and configures the service controller used by the service.
3955///
3956/// Example:
3957///
3958/// ```norust
3959/// control:
3960/// environment: servicecontrol.googleapis.com
3961/// ```
3962#[derive(Clone, Default, PartialEq)]
3963#[non_exhaustive]
3964pub struct Control {
3965 /// The service controller environment to use. If empty, no control plane
3966 /// feature (like quota and billing) will be enabled. The recommended value for
3967 /// most services is servicecontrol.googleapis.com
3968 pub environment: std::string::String,
3969
3970 /// Defines policies applying to the API methods of the service.
3971 pub method_policies: std::vec::Vec<crate::model::MethodPolicy>,
3972
3973 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3974}
3975
3976impl Control {
3977 pub fn new() -> Self {
3978 std::default::Default::default()
3979 }
3980
3981 /// Sets the value of [environment][crate::model::Control::environment].
3982 ///
3983 /// # Example
3984 /// ```ignore,no_run
3985 /// # use google_cloud_api::model::Control;
3986 /// let x = Control::new().set_environment("example");
3987 /// ```
3988 pub fn set_environment<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3989 self.environment = v.into();
3990 self
3991 }
3992
3993 /// Sets the value of [method_policies][crate::model::Control::method_policies].
3994 ///
3995 /// # Example
3996 /// ```ignore,no_run
3997 /// # use google_cloud_api::model::Control;
3998 /// use google_cloud_api::model::MethodPolicy;
3999 /// let x = Control::new()
4000 /// .set_method_policies([
4001 /// MethodPolicy::default()/* use setters */,
4002 /// MethodPolicy::default()/* use (different) setters */,
4003 /// ]);
4004 /// ```
4005 pub fn set_method_policies<T, V>(mut self, v: T) -> Self
4006 where
4007 T: std::iter::IntoIterator<Item = V>,
4008 V: std::convert::Into<crate::model::MethodPolicy>,
4009 {
4010 use std::iter::Iterator;
4011 self.method_policies = v.into_iter().map(|i| i.into()).collect();
4012 self
4013 }
4014}
4015
4016impl wkt::message::Message for Control {
4017 fn typename() -> &'static str {
4018 "type.googleapis.com/google.api.Control"
4019 }
4020}
4021
4022/// `Distribution` contains summary statistics for a population of values. It
4023/// optionally contains a histogram representing the distribution of those values
4024/// across a set of buckets.
4025///
4026/// The summary statistics are the count, mean, sum of the squared deviation from
4027/// the mean, the minimum, and the maximum of the set of population of values.
4028/// The histogram is based on a sequence of buckets and gives a count of values
4029/// that fall into each bucket. The boundaries of the buckets are given either
4030/// explicitly or by formulas for buckets of fixed or exponentially increasing
4031/// widths.
4032///
4033/// Although it is not forbidden, it is generally a bad idea to include
4034/// non-finite values (infinities or NaNs) in the population of values, as this
4035/// will render the `mean` and `sum_of_squared_deviation` fields meaningless.
4036#[derive(Clone, Default, PartialEq)]
4037#[non_exhaustive]
4038pub struct Distribution {
4039 /// The number of values in the population. Must be non-negative. This value
4040 /// must equal the sum of the values in `bucket_counts` if a histogram is
4041 /// provided.
4042 pub count: i64,
4043
4044 /// The arithmetic mean of the values in the population. If `count` is zero
4045 /// then this field must be zero.
4046 pub mean: f64,
4047
4048 /// The sum of squared deviations from the mean of the values in the
4049 /// population. For values x_i this is:
4050 ///
4051 /// ```norust
4052 /// Sum[i=1..n]((x_i - mean)^2)
4053 /// ```
4054 ///
4055 /// Knuth, "The Art of Computer Programming", Vol. 2, page 232, 3rd edition
4056 /// describes Welford's method for accumulating this sum in one pass.
4057 ///
4058 /// If `count` is zero then this field must be zero.
4059 pub sum_of_squared_deviation: f64,
4060
4061 /// If specified, contains the range of the population values. The field
4062 /// must not be present if the `count` is zero.
4063 pub range: std::option::Option<crate::model::distribution::Range>,
4064
4065 /// Defines the histogram bucket boundaries. If the distribution does not
4066 /// contain a histogram, then omit this field.
4067 pub bucket_options: std::option::Option<crate::model::distribution::BucketOptions>,
4068
4069 /// The number of values in each bucket of the histogram, as described in
4070 /// `bucket_options`. If the distribution does not have a histogram, then omit
4071 /// this field. If there is a histogram, then the sum of the values in
4072 /// `bucket_counts` must equal the value in the `count` field of the
4073 /// distribution.
4074 ///
4075 /// If present, `bucket_counts` should contain N values, where N is the number
4076 /// of buckets specified in `bucket_options`. If you supply fewer than N
4077 /// values, the remaining values are assumed to be 0.
4078 ///
4079 /// The order of the values in `bucket_counts` follows the bucket numbering
4080 /// schemes described for the three bucket types. The first value must be the
4081 /// count for the underflow bucket (number 0). The next N-2 values are the
4082 /// counts for the finite buckets (number 1 through N-2). The N'th value in
4083 /// `bucket_counts` is the count for the overflow bucket (number N-1).
4084 pub bucket_counts: std::vec::Vec<i64>,
4085
4086 /// Must be in increasing order of `value` field.
4087 pub exemplars: std::vec::Vec<crate::model::distribution::Exemplar>,
4088
4089 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4090}
4091
4092impl Distribution {
4093 pub fn new() -> Self {
4094 std::default::Default::default()
4095 }
4096
4097 /// Sets the value of [count][crate::model::Distribution::count].
4098 ///
4099 /// # Example
4100 /// ```ignore,no_run
4101 /// # use google_cloud_api::model::Distribution;
4102 /// let x = Distribution::new().set_count(42);
4103 /// ```
4104 pub fn set_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
4105 self.count = v.into();
4106 self
4107 }
4108
4109 /// Sets the value of [mean][crate::model::Distribution::mean].
4110 ///
4111 /// # Example
4112 /// ```ignore,no_run
4113 /// # use google_cloud_api::model::Distribution;
4114 /// let x = Distribution::new().set_mean(42.0);
4115 /// ```
4116 pub fn set_mean<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
4117 self.mean = v.into();
4118 self
4119 }
4120
4121 /// Sets the value of [sum_of_squared_deviation][crate::model::Distribution::sum_of_squared_deviation].
4122 ///
4123 /// # Example
4124 /// ```ignore,no_run
4125 /// # use google_cloud_api::model::Distribution;
4126 /// let x = Distribution::new().set_sum_of_squared_deviation(42.0);
4127 /// ```
4128 pub fn set_sum_of_squared_deviation<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
4129 self.sum_of_squared_deviation = v.into();
4130 self
4131 }
4132
4133 /// Sets the value of [range][crate::model::Distribution::range].
4134 ///
4135 /// # Example
4136 /// ```ignore,no_run
4137 /// # use google_cloud_api::model::Distribution;
4138 /// use google_cloud_api::model::distribution::Range;
4139 /// let x = Distribution::new().set_range(Range::default()/* use setters */);
4140 /// ```
4141 pub fn set_range<T>(mut self, v: T) -> Self
4142 where
4143 T: std::convert::Into<crate::model::distribution::Range>,
4144 {
4145 self.range = std::option::Option::Some(v.into());
4146 self
4147 }
4148
4149 /// Sets or clears the value of [range][crate::model::Distribution::range].
4150 ///
4151 /// # Example
4152 /// ```ignore,no_run
4153 /// # use google_cloud_api::model::Distribution;
4154 /// use google_cloud_api::model::distribution::Range;
4155 /// let x = Distribution::new().set_or_clear_range(Some(Range::default()/* use setters */));
4156 /// let x = Distribution::new().set_or_clear_range(None::<Range>);
4157 /// ```
4158 pub fn set_or_clear_range<T>(mut self, v: std::option::Option<T>) -> Self
4159 where
4160 T: std::convert::Into<crate::model::distribution::Range>,
4161 {
4162 self.range = v.map(|x| x.into());
4163 self
4164 }
4165
4166 /// Sets the value of [bucket_options][crate::model::Distribution::bucket_options].
4167 ///
4168 /// # Example
4169 /// ```ignore,no_run
4170 /// # use google_cloud_api::model::Distribution;
4171 /// use google_cloud_api::model::distribution::BucketOptions;
4172 /// let x = Distribution::new().set_bucket_options(BucketOptions::default()/* use setters */);
4173 /// ```
4174 pub fn set_bucket_options<T>(mut self, v: T) -> Self
4175 where
4176 T: std::convert::Into<crate::model::distribution::BucketOptions>,
4177 {
4178 self.bucket_options = std::option::Option::Some(v.into());
4179 self
4180 }
4181
4182 /// Sets or clears the value of [bucket_options][crate::model::Distribution::bucket_options].
4183 ///
4184 /// # Example
4185 /// ```ignore,no_run
4186 /// # use google_cloud_api::model::Distribution;
4187 /// use google_cloud_api::model::distribution::BucketOptions;
4188 /// let x = Distribution::new().set_or_clear_bucket_options(Some(BucketOptions::default()/* use setters */));
4189 /// let x = Distribution::new().set_or_clear_bucket_options(None::<BucketOptions>);
4190 /// ```
4191 pub fn set_or_clear_bucket_options<T>(mut self, v: std::option::Option<T>) -> Self
4192 where
4193 T: std::convert::Into<crate::model::distribution::BucketOptions>,
4194 {
4195 self.bucket_options = v.map(|x| x.into());
4196 self
4197 }
4198
4199 /// Sets the value of [bucket_counts][crate::model::Distribution::bucket_counts].
4200 ///
4201 /// # Example
4202 /// ```ignore,no_run
4203 /// # use google_cloud_api::model::Distribution;
4204 /// let x = Distribution::new().set_bucket_counts([1, 2, 3]);
4205 /// ```
4206 pub fn set_bucket_counts<T, V>(mut self, v: T) -> Self
4207 where
4208 T: std::iter::IntoIterator<Item = V>,
4209 V: std::convert::Into<i64>,
4210 {
4211 use std::iter::Iterator;
4212 self.bucket_counts = v.into_iter().map(|i| i.into()).collect();
4213 self
4214 }
4215
4216 /// Sets the value of [exemplars][crate::model::Distribution::exemplars].
4217 ///
4218 /// # Example
4219 /// ```ignore,no_run
4220 /// # use google_cloud_api::model::Distribution;
4221 /// use google_cloud_api::model::distribution::Exemplar;
4222 /// let x = Distribution::new()
4223 /// .set_exemplars([
4224 /// Exemplar::default()/* use setters */,
4225 /// Exemplar::default()/* use (different) setters */,
4226 /// ]);
4227 /// ```
4228 pub fn set_exemplars<T, V>(mut self, v: T) -> Self
4229 where
4230 T: std::iter::IntoIterator<Item = V>,
4231 V: std::convert::Into<crate::model::distribution::Exemplar>,
4232 {
4233 use std::iter::Iterator;
4234 self.exemplars = v.into_iter().map(|i| i.into()).collect();
4235 self
4236 }
4237}
4238
4239impl wkt::message::Message for Distribution {
4240 fn typename() -> &'static str {
4241 "type.googleapis.com/google.api.Distribution"
4242 }
4243}
4244
4245/// Defines additional types related to [Distribution].
4246pub mod distribution {
4247 #[allow(unused_imports)]
4248 use super::*;
4249
4250 /// The range of the population values.
4251 #[derive(Clone, Default, PartialEq)]
4252 #[non_exhaustive]
4253 pub struct Range {
4254 /// The minimum of the population values.
4255 pub min: f64,
4256
4257 /// The maximum of the population values.
4258 pub max: f64,
4259
4260 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4261 }
4262
4263 impl Range {
4264 pub fn new() -> Self {
4265 std::default::Default::default()
4266 }
4267
4268 /// Sets the value of [min][crate::model::distribution::Range::min].
4269 ///
4270 /// # Example
4271 /// ```ignore,no_run
4272 /// # use google_cloud_api::model::distribution::Range;
4273 /// let x = Range::new().set_min(42.0);
4274 /// ```
4275 pub fn set_min<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
4276 self.min = v.into();
4277 self
4278 }
4279
4280 /// Sets the value of [max][crate::model::distribution::Range::max].
4281 ///
4282 /// # Example
4283 /// ```ignore,no_run
4284 /// # use google_cloud_api::model::distribution::Range;
4285 /// let x = Range::new().set_max(42.0);
4286 /// ```
4287 pub fn set_max<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
4288 self.max = v.into();
4289 self
4290 }
4291 }
4292
4293 impl wkt::message::Message for Range {
4294 fn typename() -> &'static str {
4295 "type.googleapis.com/google.api.Distribution.Range"
4296 }
4297 }
4298
4299 /// `BucketOptions` describes the bucket boundaries used to create a histogram
4300 /// for the distribution. The buckets can be in a linear sequence, an
4301 /// exponential sequence, or each bucket can be specified explicitly.
4302 /// `BucketOptions` does not include the number of values in each bucket.
4303 ///
4304 /// A bucket has an inclusive lower bound and exclusive upper bound for the
4305 /// values that are counted for that bucket. The upper bound of a bucket must
4306 /// be strictly greater than the lower bound. The sequence of N buckets for a
4307 /// distribution consists of an underflow bucket (number 0), zero or more
4308 /// finite buckets (number 1 through N - 2) and an overflow bucket (number N -
4309 /// 1). The buckets are contiguous: the lower bound of bucket i (i > 0) is the
4310 /// same as the upper bound of bucket i - 1. The buckets span the whole range
4311 /// of finite values: lower bound of the underflow bucket is -infinity and the
4312 /// upper bound of the overflow bucket is +infinity. The finite buckets are
4313 /// so-called because both bounds are finite.
4314 #[derive(Clone, Default, PartialEq)]
4315 #[non_exhaustive]
4316 pub struct BucketOptions {
4317 /// Exactly one of these three fields must be set.
4318 pub options: std::option::Option<crate::model::distribution::bucket_options::Options>,
4319
4320 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4321 }
4322
4323 impl BucketOptions {
4324 pub fn new() -> Self {
4325 std::default::Default::default()
4326 }
4327
4328 /// Sets the value of [options][crate::model::distribution::BucketOptions::options].
4329 ///
4330 /// Note that all the setters affecting `options` are mutually
4331 /// exclusive.
4332 ///
4333 /// # Example
4334 /// ```ignore,no_run
4335 /// # use google_cloud_api::model::distribution::BucketOptions;
4336 /// use google_cloud_api::model::distribution::bucket_options::Linear;
4337 /// let x = BucketOptions::new().set_options(Some(
4338 /// google_cloud_api::model::distribution::bucket_options::Options::LinearBuckets(Linear::default().into())));
4339 /// ```
4340 pub fn set_options<
4341 T: std::convert::Into<
4342 std::option::Option<crate::model::distribution::bucket_options::Options>,
4343 >,
4344 >(
4345 mut self,
4346 v: T,
4347 ) -> Self {
4348 self.options = v.into();
4349 self
4350 }
4351
4352 /// The value of [options][crate::model::distribution::BucketOptions::options]
4353 /// if it holds a `LinearBuckets`, `None` if the field is not set or
4354 /// holds a different branch.
4355 pub fn linear_buckets(
4356 &self,
4357 ) -> std::option::Option<&std::boxed::Box<crate::model::distribution::bucket_options::Linear>>
4358 {
4359 #[allow(unreachable_patterns)]
4360 self.options.as_ref().and_then(|v| match v {
4361 crate::model::distribution::bucket_options::Options::LinearBuckets(v) => {
4362 std::option::Option::Some(v)
4363 }
4364 _ => std::option::Option::None,
4365 })
4366 }
4367
4368 /// Sets the value of [options][crate::model::distribution::BucketOptions::options]
4369 /// to hold a `LinearBuckets`.
4370 ///
4371 /// Note that all the setters affecting `options` are
4372 /// mutually exclusive.
4373 ///
4374 /// # Example
4375 /// ```ignore,no_run
4376 /// # use google_cloud_api::model::distribution::BucketOptions;
4377 /// use google_cloud_api::model::distribution::bucket_options::Linear;
4378 /// let x = BucketOptions::new().set_linear_buckets(Linear::default()/* use setters */);
4379 /// assert!(x.linear_buckets().is_some());
4380 /// assert!(x.exponential_buckets().is_none());
4381 /// assert!(x.explicit_buckets().is_none());
4382 /// ```
4383 pub fn set_linear_buckets<
4384 T: std::convert::Into<std::boxed::Box<crate::model::distribution::bucket_options::Linear>>,
4385 >(
4386 mut self,
4387 v: T,
4388 ) -> Self {
4389 self.options = std::option::Option::Some(
4390 crate::model::distribution::bucket_options::Options::LinearBuckets(v.into()),
4391 );
4392 self
4393 }
4394
4395 /// The value of [options][crate::model::distribution::BucketOptions::options]
4396 /// if it holds a `ExponentialBuckets`, `None` if the field is not set or
4397 /// holds a different branch.
4398 pub fn exponential_buckets(
4399 &self,
4400 ) -> std::option::Option<
4401 &std::boxed::Box<crate::model::distribution::bucket_options::Exponential>,
4402 > {
4403 #[allow(unreachable_patterns)]
4404 self.options.as_ref().and_then(|v| match v {
4405 crate::model::distribution::bucket_options::Options::ExponentialBuckets(v) => {
4406 std::option::Option::Some(v)
4407 }
4408 _ => std::option::Option::None,
4409 })
4410 }
4411
4412 /// Sets the value of [options][crate::model::distribution::BucketOptions::options]
4413 /// to hold a `ExponentialBuckets`.
4414 ///
4415 /// Note that all the setters affecting `options` are
4416 /// mutually exclusive.
4417 ///
4418 /// # Example
4419 /// ```ignore,no_run
4420 /// # use google_cloud_api::model::distribution::BucketOptions;
4421 /// use google_cloud_api::model::distribution::bucket_options::Exponential;
4422 /// let x = BucketOptions::new().set_exponential_buckets(Exponential::default()/* use setters */);
4423 /// assert!(x.exponential_buckets().is_some());
4424 /// assert!(x.linear_buckets().is_none());
4425 /// assert!(x.explicit_buckets().is_none());
4426 /// ```
4427 pub fn set_exponential_buckets<
4428 T: std::convert::Into<
4429 std::boxed::Box<crate::model::distribution::bucket_options::Exponential>,
4430 >,
4431 >(
4432 mut self,
4433 v: T,
4434 ) -> Self {
4435 self.options = std::option::Option::Some(
4436 crate::model::distribution::bucket_options::Options::ExponentialBuckets(v.into()),
4437 );
4438 self
4439 }
4440
4441 /// The value of [options][crate::model::distribution::BucketOptions::options]
4442 /// if it holds a `ExplicitBuckets`, `None` if the field is not set or
4443 /// holds a different branch.
4444 pub fn explicit_buckets(
4445 &self,
4446 ) -> std::option::Option<
4447 &std::boxed::Box<crate::model::distribution::bucket_options::Explicit>,
4448 > {
4449 #[allow(unreachable_patterns)]
4450 self.options.as_ref().and_then(|v| match v {
4451 crate::model::distribution::bucket_options::Options::ExplicitBuckets(v) => {
4452 std::option::Option::Some(v)
4453 }
4454 _ => std::option::Option::None,
4455 })
4456 }
4457
4458 /// Sets the value of [options][crate::model::distribution::BucketOptions::options]
4459 /// to hold a `ExplicitBuckets`.
4460 ///
4461 /// Note that all the setters affecting `options` are
4462 /// mutually exclusive.
4463 ///
4464 /// # Example
4465 /// ```ignore,no_run
4466 /// # use google_cloud_api::model::distribution::BucketOptions;
4467 /// use google_cloud_api::model::distribution::bucket_options::Explicit;
4468 /// let x = BucketOptions::new().set_explicit_buckets(Explicit::default()/* use setters */);
4469 /// assert!(x.explicit_buckets().is_some());
4470 /// assert!(x.linear_buckets().is_none());
4471 /// assert!(x.exponential_buckets().is_none());
4472 /// ```
4473 pub fn set_explicit_buckets<
4474 T: std::convert::Into<
4475 std::boxed::Box<crate::model::distribution::bucket_options::Explicit>,
4476 >,
4477 >(
4478 mut self,
4479 v: T,
4480 ) -> Self {
4481 self.options = std::option::Option::Some(
4482 crate::model::distribution::bucket_options::Options::ExplicitBuckets(v.into()),
4483 );
4484 self
4485 }
4486 }
4487
4488 impl wkt::message::Message for BucketOptions {
4489 fn typename() -> &'static str {
4490 "type.googleapis.com/google.api.Distribution.BucketOptions"
4491 }
4492 }
4493
4494 /// Defines additional types related to [BucketOptions].
4495 pub mod bucket_options {
4496 #[allow(unused_imports)]
4497 use super::*;
4498
4499 /// Specifies a linear sequence of buckets that all have the same width
4500 /// (except overflow and underflow). Each bucket represents a constant
4501 /// absolute uncertainty on the specific value in the bucket.
4502 ///
4503 /// There are `num_finite_buckets + 2` (= N) buckets. Bucket `i` has the
4504 /// following boundaries:
4505 ///
4506 /// Upper bound (0 <= i < N-1): offset + (width * i).
4507 ///
4508 /// Lower bound (1 <= i < N): offset + (width * (i - 1)).
4509 #[derive(Clone, Default, PartialEq)]
4510 #[non_exhaustive]
4511 pub struct Linear {
4512 /// Must be greater than 0.
4513 pub num_finite_buckets: i32,
4514
4515 /// Must be greater than 0.
4516 pub width: f64,
4517
4518 /// Lower bound of the first bucket.
4519 pub offset: f64,
4520
4521 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4522 }
4523
4524 impl Linear {
4525 pub fn new() -> Self {
4526 std::default::Default::default()
4527 }
4528
4529 /// Sets the value of [num_finite_buckets][crate::model::distribution::bucket_options::Linear::num_finite_buckets].
4530 ///
4531 /// # Example
4532 /// ```ignore,no_run
4533 /// # use google_cloud_api::model::distribution::bucket_options::Linear;
4534 /// let x = Linear::new().set_num_finite_buckets(42);
4535 /// ```
4536 pub fn set_num_finite_buckets<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4537 self.num_finite_buckets = v.into();
4538 self
4539 }
4540
4541 /// Sets the value of [width][crate::model::distribution::bucket_options::Linear::width].
4542 ///
4543 /// # Example
4544 /// ```ignore,no_run
4545 /// # use google_cloud_api::model::distribution::bucket_options::Linear;
4546 /// let x = Linear::new().set_width(42.0);
4547 /// ```
4548 pub fn set_width<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
4549 self.width = v.into();
4550 self
4551 }
4552
4553 /// Sets the value of [offset][crate::model::distribution::bucket_options::Linear::offset].
4554 ///
4555 /// # Example
4556 /// ```ignore,no_run
4557 /// # use google_cloud_api::model::distribution::bucket_options::Linear;
4558 /// let x = Linear::new().set_offset(42.0);
4559 /// ```
4560 pub fn set_offset<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
4561 self.offset = v.into();
4562 self
4563 }
4564 }
4565
4566 impl wkt::message::Message for Linear {
4567 fn typename() -> &'static str {
4568 "type.googleapis.com/google.api.Distribution.BucketOptions.Linear"
4569 }
4570 }
4571
4572 /// Specifies an exponential sequence of buckets that have a width that is
4573 /// proportional to the value of the lower bound. Each bucket represents a
4574 /// constant relative uncertainty on a specific value in the bucket.
4575 ///
4576 /// There are `num_finite_buckets + 2` (= N) buckets. Bucket `i` has the
4577 /// following boundaries:
4578 ///
4579 /// Upper bound (0 <= i < N-1): scale * (growth_factor ^ i).
4580 ///
4581 /// Lower bound (1 <= i < N): scale * (growth_factor ^ (i - 1)).
4582 #[derive(Clone, Default, PartialEq)]
4583 #[non_exhaustive]
4584 pub struct Exponential {
4585 /// Must be greater than 0.
4586 pub num_finite_buckets: i32,
4587
4588 /// Must be greater than 1.
4589 pub growth_factor: f64,
4590
4591 /// Must be greater than 0.
4592 pub scale: f64,
4593
4594 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4595 }
4596
4597 impl Exponential {
4598 pub fn new() -> Self {
4599 std::default::Default::default()
4600 }
4601
4602 /// Sets the value of [num_finite_buckets][crate::model::distribution::bucket_options::Exponential::num_finite_buckets].
4603 ///
4604 /// # Example
4605 /// ```ignore,no_run
4606 /// # use google_cloud_api::model::distribution::bucket_options::Exponential;
4607 /// let x = Exponential::new().set_num_finite_buckets(42);
4608 /// ```
4609 pub fn set_num_finite_buckets<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4610 self.num_finite_buckets = v.into();
4611 self
4612 }
4613
4614 /// Sets the value of [growth_factor][crate::model::distribution::bucket_options::Exponential::growth_factor].
4615 ///
4616 /// # Example
4617 /// ```ignore,no_run
4618 /// # use google_cloud_api::model::distribution::bucket_options::Exponential;
4619 /// let x = Exponential::new().set_growth_factor(42.0);
4620 /// ```
4621 pub fn set_growth_factor<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
4622 self.growth_factor = v.into();
4623 self
4624 }
4625
4626 /// Sets the value of [scale][crate::model::distribution::bucket_options::Exponential::scale].
4627 ///
4628 /// # Example
4629 /// ```ignore,no_run
4630 /// # use google_cloud_api::model::distribution::bucket_options::Exponential;
4631 /// let x = Exponential::new().set_scale(42.0);
4632 /// ```
4633 pub fn set_scale<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
4634 self.scale = v.into();
4635 self
4636 }
4637 }
4638
4639 impl wkt::message::Message for Exponential {
4640 fn typename() -> &'static str {
4641 "type.googleapis.com/google.api.Distribution.BucketOptions.Exponential"
4642 }
4643 }
4644
4645 /// Specifies a set of buckets with arbitrary widths.
4646 ///
4647 /// There are `size(bounds) + 1` (= N) buckets. Bucket `i` has the following
4648 /// boundaries:
4649 ///
4650 /// Upper bound (0 <= i < N-1): bounds[i]
4651 /// Lower bound (1 <= i < N); bounds[i - 1]
4652 ///
4653 /// The `bounds` field must contain at least one element. If `bounds` has
4654 /// only one element, then there are no finite buckets, and that single
4655 /// element is the common boundary of the overflow and underflow buckets.
4656 #[derive(Clone, Default, PartialEq)]
4657 #[non_exhaustive]
4658 pub struct Explicit {
4659 /// The values must be monotonically increasing.
4660 pub bounds: std::vec::Vec<f64>,
4661
4662 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4663 }
4664
4665 impl Explicit {
4666 pub fn new() -> Self {
4667 std::default::Default::default()
4668 }
4669
4670 /// Sets the value of [bounds][crate::model::distribution::bucket_options::Explicit::bounds].
4671 ///
4672 /// # Example
4673 /// ```ignore,no_run
4674 /// # use google_cloud_api::model::distribution::bucket_options::Explicit;
4675 /// let x = Explicit::new().set_bounds([1.0, 2.0, 3.0]);
4676 /// ```
4677 pub fn set_bounds<T, V>(mut self, v: T) -> Self
4678 where
4679 T: std::iter::IntoIterator<Item = V>,
4680 V: std::convert::Into<f64>,
4681 {
4682 use std::iter::Iterator;
4683 self.bounds = v.into_iter().map(|i| i.into()).collect();
4684 self
4685 }
4686 }
4687
4688 impl wkt::message::Message for Explicit {
4689 fn typename() -> &'static str {
4690 "type.googleapis.com/google.api.Distribution.BucketOptions.Explicit"
4691 }
4692 }
4693
4694 /// Exactly one of these three fields must be set.
4695 #[derive(Clone, Debug, PartialEq)]
4696 #[non_exhaustive]
4697 pub enum Options {
4698 /// The linear bucket.
4699 LinearBuckets(std::boxed::Box<crate::model::distribution::bucket_options::Linear>),
4700 /// The exponential buckets.
4701 ExponentialBuckets(
4702 std::boxed::Box<crate::model::distribution::bucket_options::Exponential>,
4703 ),
4704 /// The explicit buckets.
4705 ExplicitBuckets(std::boxed::Box<crate::model::distribution::bucket_options::Explicit>),
4706 }
4707 }
4708
4709 /// Exemplars are example points that may be used to annotate aggregated
4710 /// distribution values. They are metadata that gives information about a
4711 /// particular value added to a Distribution bucket, such as a trace ID that
4712 /// was active when a value was added. They may contain further information,
4713 /// such as a example values and timestamps, origin, etc.
4714 #[derive(Clone, Default, PartialEq)]
4715 #[non_exhaustive]
4716 pub struct Exemplar {
4717 /// Value of the exemplar point. This value determines to which bucket the
4718 /// exemplar belongs.
4719 pub value: f64,
4720
4721 /// The observation (sampling) time of the above value.
4722 pub timestamp: std::option::Option<wkt::Timestamp>,
4723
4724 /// Contextual information about the example value. Examples are:
4725 ///
4726 /// Trace: type.googleapis.com/google.monitoring.v3.SpanContext
4727 ///
4728 /// Literal string: type.googleapis.com/google.protobuf.StringValue
4729 ///
4730 /// Labels dropped during aggregation:
4731 /// type.googleapis.com/google.monitoring.v3.DroppedLabels
4732 ///
4733 /// There may be only a single attachment of any given message type in a
4734 /// single exemplar, and this is enforced by the system.
4735 pub attachments: std::vec::Vec<wkt::Any>,
4736
4737 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4738 }
4739
4740 impl Exemplar {
4741 pub fn new() -> Self {
4742 std::default::Default::default()
4743 }
4744
4745 /// Sets the value of [value][crate::model::distribution::Exemplar::value].
4746 ///
4747 /// # Example
4748 /// ```ignore,no_run
4749 /// # use google_cloud_api::model::distribution::Exemplar;
4750 /// let x = Exemplar::new().set_value(42.0);
4751 /// ```
4752 pub fn set_value<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
4753 self.value = v.into();
4754 self
4755 }
4756
4757 /// Sets the value of [timestamp][crate::model::distribution::Exemplar::timestamp].
4758 ///
4759 /// # Example
4760 /// ```ignore,no_run
4761 /// # use google_cloud_api::model::distribution::Exemplar;
4762 /// use wkt::Timestamp;
4763 /// let x = Exemplar::new().set_timestamp(Timestamp::default()/* use setters */);
4764 /// ```
4765 pub fn set_timestamp<T>(mut self, v: T) -> Self
4766 where
4767 T: std::convert::Into<wkt::Timestamp>,
4768 {
4769 self.timestamp = std::option::Option::Some(v.into());
4770 self
4771 }
4772
4773 /// Sets or clears the value of [timestamp][crate::model::distribution::Exemplar::timestamp].
4774 ///
4775 /// # Example
4776 /// ```ignore,no_run
4777 /// # use google_cloud_api::model::distribution::Exemplar;
4778 /// use wkt::Timestamp;
4779 /// let x = Exemplar::new().set_or_clear_timestamp(Some(Timestamp::default()/* use setters */));
4780 /// let x = Exemplar::new().set_or_clear_timestamp(None::<Timestamp>);
4781 /// ```
4782 pub fn set_or_clear_timestamp<T>(mut self, v: std::option::Option<T>) -> Self
4783 where
4784 T: std::convert::Into<wkt::Timestamp>,
4785 {
4786 self.timestamp = v.map(|x| x.into());
4787 self
4788 }
4789
4790 /// Sets the value of [attachments][crate::model::distribution::Exemplar::attachments].
4791 ///
4792 /// # Example
4793 /// ```ignore,no_run
4794 /// # use google_cloud_api::model::distribution::Exemplar;
4795 /// use wkt::Any;
4796 /// let x = Exemplar::new()
4797 /// .set_attachments([
4798 /// Any::default()/* use setters */,
4799 /// Any::default()/* use (different) setters */,
4800 /// ]);
4801 /// ```
4802 pub fn set_attachments<T, V>(mut self, v: T) -> Self
4803 where
4804 T: std::iter::IntoIterator<Item = V>,
4805 V: std::convert::Into<wkt::Any>,
4806 {
4807 use std::iter::Iterator;
4808 self.attachments = v.into_iter().map(|i| i.into()).collect();
4809 self
4810 }
4811 }
4812
4813 impl wkt::message::Message for Exemplar {
4814 fn typename() -> &'static str {
4815 "type.googleapis.com/google.api.Distribution.Exemplar"
4816 }
4817 }
4818}
4819
4820/// `Documentation` provides the information for describing a service.
4821///
4822/// Example:
4823///
4824/// Documentation is provided in markdown syntax. In addition to
4825/// standard markdown features, definition lists, tables and fenced
4826/// code blocks are supported. Section headers can be provided and are
4827/// interpreted relative to the section nesting of the context where
4828/// a documentation fragment is embedded.
4829///
4830/// Documentation from the IDL is merged with documentation defined
4831/// via the config at normalization time, where documentation provided
4832/// by config rules overrides IDL provided.
4833///
4834/// A number of constructs specific to the API platform are supported
4835/// in documentation text.
4836///
4837/// In order to reference a proto element, the following
4838/// notation can be used:
4839///
4840/// To override the display text used for the link, this can be used:
4841///
4842/// Text can be excluded from doc using the following notation:
4843///
4844/// A few directives are available in documentation. Note that
4845/// directives must appear on a single line to be properly
4846/// identified. The `include` directive includes a markdown file from
4847/// an external source:
4848///
4849/// The `resource_for` directive marks a message to be the resource of
4850/// a collection in REST view. If it is not specified, tools attempt
4851/// to infer the resource from the operations in a collection:
4852///
4853/// The directive `suppress_warning` does not directly affect documentation
4854/// and is documented together with service config validation.
4855#[derive(Clone, Default, PartialEq)]
4856#[non_exhaustive]
4857pub struct Documentation {
4858 /// A short description of what the service does. The summary must be plain
4859 /// text. It becomes the overview of the service displayed in Google Cloud
4860 /// Console.
4861 /// NOTE: This field is equivalent to the standard field `description`.
4862 pub summary: std::string::String,
4863
4864 /// The top level pages for the documentation set.
4865 pub pages: std::vec::Vec<crate::model::Page>,
4866
4867 /// A list of documentation rules that apply to individual API elements.
4868 ///
4869 /// **NOTE:** All service configuration rules follow "last one wins" order.
4870 pub rules: std::vec::Vec<crate::model::DocumentationRule>,
4871
4872 /// The URL to the root of documentation.
4873 pub documentation_root_url: std::string::String,
4874
4875 /// Specifies the service root url if the default one (the service name
4876 /// from the yaml file) is not suitable. This can be seen in any fully
4877 /// specified service urls as well as sections that show a base that other
4878 /// urls are relative to.
4879 pub service_root_url: std::string::String,
4880
4881 /// Declares a single overview page. For example:
4882 ///
4883 /// This is a shortcut for the following declaration (using pages style):
4884 ///
4885 /// Note: you cannot specify both `overview` field and `pages` field.
4886 pub overview: std::string::String,
4887
4888 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4889}
4890
4891impl Documentation {
4892 pub fn new() -> Self {
4893 std::default::Default::default()
4894 }
4895
4896 /// Sets the value of [summary][crate::model::Documentation::summary].
4897 ///
4898 /// # Example
4899 /// ```ignore,no_run
4900 /// # use google_cloud_api::model::Documentation;
4901 /// let x = Documentation::new().set_summary("example");
4902 /// ```
4903 pub fn set_summary<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4904 self.summary = v.into();
4905 self
4906 }
4907
4908 /// Sets the value of [pages][crate::model::Documentation::pages].
4909 ///
4910 /// # Example
4911 /// ```ignore,no_run
4912 /// # use google_cloud_api::model::Documentation;
4913 /// use google_cloud_api::model::Page;
4914 /// let x = Documentation::new()
4915 /// .set_pages([
4916 /// Page::default()/* use setters */,
4917 /// Page::default()/* use (different) setters */,
4918 /// ]);
4919 /// ```
4920 pub fn set_pages<T, V>(mut self, v: T) -> Self
4921 where
4922 T: std::iter::IntoIterator<Item = V>,
4923 V: std::convert::Into<crate::model::Page>,
4924 {
4925 use std::iter::Iterator;
4926 self.pages = v.into_iter().map(|i| i.into()).collect();
4927 self
4928 }
4929
4930 /// Sets the value of [rules][crate::model::Documentation::rules].
4931 ///
4932 /// # Example
4933 /// ```ignore,no_run
4934 /// # use google_cloud_api::model::Documentation;
4935 /// use google_cloud_api::model::DocumentationRule;
4936 /// let x = Documentation::new()
4937 /// .set_rules([
4938 /// DocumentationRule::default()/* use setters */,
4939 /// DocumentationRule::default()/* use (different) setters */,
4940 /// ]);
4941 /// ```
4942 pub fn set_rules<T, V>(mut self, v: T) -> Self
4943 where
4944 T: std::iter::IntoIterator<Item = V>,
4945 V: std::convert::Into<crate::model::DocumentationRule>,
4946 {
4947 use std::iter::Iterator;
4948 self.rules = v.into_iter().map(|i| i.into()).collect();
4949 self
4950 }
4951
4952 /// Sets the value of [documentation_root_url][crate::model::Documentation::documentation_root_url].
4953 ///
4954 /// # Example
4955 /// ```ignore,no_run
4956 /// # use google_cloud_api::model::Documentation;
4957 /// let x = Documentation::new().set_documentation_root_url("example");
4958 /// ```
4959 pub fn set_documentation_root_url<T: std::convert::Into<std::string::String>>(
4960 mut self,
4961 v: T,
4962 ) -> Self {
4963 self.documentation_root_url = v.into();
4964 self
4965 }
4966
4967 /// Sets the value of [service_root_url][crate::model::Documentation::service_root_url].
4968 ///
4969 /// # Example
4970 /// ```ignore,no_run
4971 /// # use google_cloud_api::model::Documentation;
4972 /// let x = Documentation::new().set_service_root_url("example");
4973 /// ```
4974 pub fn set_service_root_url<T: std::convert::Into<std::string::String>>(
4975 mut self,
4976 v: T,
4977 ) -> Self {
4978 self.service_root_url = v.into();
4979 self
4980 }
4981
4982 /// Sets the value of [overview][crate::model::Documentation::overview].
4983 ///
4984 /// # Example
4985 /// ```ignore,no_run
4986 /// # use google_cloud_api::model::Documentation;
4987 /// let x = Documentation::new().set_overview("example");
4988 /// ```
4989 pub fn set_overview<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4990 self.overview = v.into();
4991 self
4992 }
4993}
4994
4995impl wkt::message::Message for Documentation {
4996 fn typename() -> &'static str {
4997 "type.googleapis.com/google.api.Documentation"
4998 }
4999}
5000
5001/// A documentation rule provides information about individual API elements.
5002#[derive(Clone, Default, PartialEq)]
5003#[non_exhaustive]
5004pub struct DocumentationRule {
5005 /// The selector is a comma-separated list of patterns for any element such as
5006 /// a method, a field, an enum value. Each pattern is a qualified name of the
5007 /// element which may end in "*", indicating a wildcard. Wildcards are only
5008 /// allowed at the end and for a whole component of the qualified name,
5009 /// i.e. "foo.*" is ok, but not "foo.b*" or "foo.*.bar". A wildcard will match
5010 /// one or more components. To specify a default for all applicable elements,
5011 /// the whole pattern "*" is used.
5012 pub selector: std::string::String,
5013
5014 /// Description of the selected proto element (e.g. a message, a method, a
5015 /// 'service' definition, or a field). Defaults to leading & trailing comments
5016 /// taken from the proto source definition of the proto element.
5017 pub description: std::string::String,
5018
5019 /// Deprecation description of the selected element(s). It can be provided if
5020 /// an element is marked as `deprecated`.
5021 pub deprecation_description: std::string::String,
5022
5023 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5024}
5025
5026impl DocumentationRule {
5027 pub fn new() -> Self {
5028 std::default::Default::default()
5029 }
5030
5031 /// Sets the value of [selector][crate::model::DocumentationRule::selector].
5032 ///
5033 /// # Example
5034 /// ```ignore,no_run
5035 /// # use google_cloud_api::model::DocumentationRule;
5036 /// let x = DocumentationRule::new().set_selector("example");
5037 /// ```
5038 pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5039 self.selector = v.into();
5040 self
5041 }
5042
5043 /// Sets the value of [description][crate::model::DocumentationRule::description].
5044 ///
5045 /// # Example
5046 /// ```ignore,no_run
5047 /// # use google_cloud_api::model::DocumentationRule;
5048 /// let x = DocumentationRule::new().set_description("example");
5049 /// ```
5050 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5051 self.description = v.into();
5052 self
5053 }
5054
5055 /// Sets the value of [deprecation_description][crate::model::DocumentationRule::deprecation_description].
5056 ///
5057 /// # Example
5058 /// ```ignore,no_run
5059 /// # use google_cloud_api::model::DocumentationRule;
5060 /// let x = DocumentationRule::new().set_deprecation_description("example");
5061 /// ```
5062 pub fn set_deprecation_description<T: std::convert::Into<std::string::String>>(
5063 mut self,
5064 v: T,
5065 ) -> Self {
5066 self.deprecation_description = v.into();
5067 self
5068 }
5069}
5070
5071impl wkt::message::Message for DocumentationRule {
5072 fn typename() -> &'static str {
5073 "type.googleapis.com/google.api.DocumentationRule"
5074 }
5075}
5076
5077/// Represents a documentation page. A page can contain subpages to represent
5078/// nested documentation set structure.
5079#[derive(Clone, Default, PartialEq)]
5080#[non_exhaustive]
5081pub struct Page {
5082 /// The name of the page. It will be used as an identity of the page to
5083 /// generate URI of the page, text of the link to this page in navigation,
5084 /// etc. The full page name (start from the root page name to this page
5085 /// concatenated with `.`) can be used as reference to the page in your
5086 /// documentation. For example:
5087 ///
5088 /// You can reference `Java` page using Markdown reference link syntax:
5089 /// `[Java][Tutorial.Java]`.
5090 pub name: std::string::String,
5091
5092 /// The Markdown content of the page. You can use ```(== include {path}
5093 /// ==)``` to include content from a Markdown file. The content can be used
5094 /// to produce the documentation page such as HTML format page.
5095 pub content: std::string::String,
5096
5097 /// Subpages of this page. The order of subpages specified here will be
5098 /// honored in the generated docset.
5099 pub subpages: std::vec::Vec<crate::model::Page>,
5100
5101 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5102}
5103
5104impl Page {
5105 pub fn new() -> Self {
5106 std::default::Default::default()
5107 }
5108
5109 /// Sets the value of [name][crate::model::Page::name].
5110 ///
5111 /// # Example
5112 /// ```ignore,no_run
5113 /// # use google_cloud_api::model::Page;
5114 /// let x = Page::new().set_name("example");
5115 /// ```
5116 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5117 self.name = v.into();
5118 self
5119 }
5120
5121 /// Sets the value of [content][crate::model::Page::content].
5122 ///
5123 /// # Example
5124 /// ```ignore,no_run
5125 /// # use google_cloud_api::model::Page;
5126 /// let x = Page::new().set_content("example");
5127 /// ```
5128 pub fn set_content<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5129 self.content = v.into();
5130 self
5131 }
5132
5133 /// Sets the value of [subpages][crate::model::Page::subpages].
5134 ///
5135 /// # Example
5136 /// ```ignore,no_run
5137 /// # use google_cloud_api::model::Page;
5138 /// let x = Page::new()
5139 /// .set_subpages([
5140 /// Page::default()/* use setters */,
5141 /// Page::default()/* use (different) setters */,
5142 /// ]);
5143 /// ```
5144 pub fn set_subpages<T, V>(mut self, v: T) -> Self
5145 where
5146 T: std::iter::IntoIterator<Item = V>,
5147 V: std::convert::Into<crate::model::Page>,
5148 {
5149 use std::iter::Iterator;
5150 self.subpages = v.into_iter().map(|i| i.into()).collect();
5151 self
5152 }
5153}
5154
5155impl wkt::message::Message for Page {
5156 fn typename() -> &'static str {
5157 "type.googleapis.com/google.api.Page"
5158 }
5159}
5160
5161/// `Endpoint` describes a network address of a service that serves a set of
5162/// APIs. It is commonly known as a service endpoint. A service may expose
5163/// any number of service endpoints, and all service endpoints share the same
5164/// service definition, such as quota limits and monitoring metrics.
5165///
5166/// Example:
5167///
5168/// ```norust
5169/// type: google.api.Service
5170/// name: library-example.googleapis.com
5171/// endpoints:
5172/// # Declares network address `https://library-example.googleapis.com`
5173/// # for service `library-example.googleapis.com`. The `https` scheme
5174/// # is implicit for all service endpoints. Other schemes may be
5175/// # supported in the future.
5176/// - name: library-example.googleapis.com
5177/// allow_cors: false
5178/// - name: content-staging-library-example.googleapis.com
5179/// # Allows HTTP OPTIONS calls to be passed to the API frontend, for it
5180/// # to decide whether the subsequent cross-origin request is allowed
5181/// # to proceed.
5182/// allow_cors: true
5183/// ```
5184#[derive(Clone, Default, PartialEq)]
5185#[non_exhaustive]
5186pub struct Endpoint {
5187 /// The canonical name of this endpoint.
5188 pub name: std::string::String,
5189
5190 /// Aliases for this endpoint, these will be served by the same UrlMap as the
5191 /// parent endpoint, and will be provisioned in the GCP stack for the Regional
5192 /// Endpoints.
5193 pub aliases: std::vec::Vec<std::string::String>,
5194
5195 /// The specification of an Internet routable address of API frontend that will
5196 /// handle requests to this [API
5197 /// Endpoint](https://cloud.google.com/apis/design/glossary). It should be
5198 /// either a valid IPv4 address or a fully-qualified domain name. For example,
5199 /// "8.8.8.8" or "myservice.appspot.com".
5200 pub target: std::string::String,
5201
5202 /// Allowing
5203 /// [CORS](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing), aka
5204 /// cross-domain traffic, would allow the backends served from this endpoint to
5205 /// receive and respond to HTTP OPTIONS requests. The response will be used by
5206 /// the browser to determine whether the subsequent cross-origin request is
5207 /// allowed to proceed.
5208 pub allow_cors: bool,
5209
5210 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5211}
5212
5213impl Endpoint {
5214 pub fn new() -> Self {
5215 std::default::Default::default()
5216 }
5217
5218 /// Sets the value of [name][crate::model::Endpoint::name].
5219 ///
5220 /// # Example
5221 /// ```ignore,no_run
5222 /// # use google_cloud_api::model::Endpoint;
5223 /// let x = Endpoint::new().set_name("example");
5224 /// ```
5225 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5226 self.name = v.into();
5227 self
5228 }
5229
5230 /// Sets the value of [aliases][crate::model::Endpoint::aliases].
5231 ///
5232 /// # Example
5233 /// ```ignore,no_run
5234 /// # use google_cloud_api::model::Endpoint;
5235 /// let x = Endpoint::new().set_aliases(["a", "b", "c"]);
5236 /// ```
5237 pub fn set_aliases<T, V>(mut self, v: T) -> Self
5238 where
5239 T: std::iter::IntoIterator<Item = V>,
5240 V: std::convert::Into<std::string::String>,
5241 {
5242 use std::iter::Iterator;
5243 self.aliases = v.into_iter().map(|i| i.into()).collect();
5244 self
5245 }
5246
5247 /// Sets the value of [target][crate::model::Endpoint::target].
5248 ///
5249 /// # Example
5250 /// ```ignore,no_run
5251 /// # use google_cloud_api::model::Endpoint;
5252 /// let x = Endpoint::new().set_target("example");
5253 /// ```
5254 pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5255 self.target = v.into();
5256 self
5257 }
5258
5259 /// Sets the value of [allow_cors][crate::model::Endpoint::allow_cors].
5260 ///
5261 /// # Example
5262 /// ```ignore,no_run
5263 /// # use google_cloud_api::model::Endpoint;
5264 /// let x = Endpoint::new().set_allow_cors(true);
5265 /// ```
5266 pub fn set_allow_cors<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5267 self.allow_cors = v.into();
5268 self
5269 }
5270}
5271
5272impl wkt::message::Message for Endpoint {
5273 fn typename() -> &'static str {
5274 "type.googleapis.com/google.api.Endpoint"
5275 }
5276}
5277
5278/// Rich semantic information of an API field beyond basic typing.
5279#[derive(Clone, Default, PartialEq)]
5280#[non_exhaustive]
5281pub struct FieldInfo {
5282 /// The standard format of a field value. This does not explicitly configure
5283 /// any API consumer, just documents the API's format for the field it is
5284 /// applied to.
5285 pub format: crate::model::field_info::Format,
5286
5287 /// The type(s) that the annotated, generic field may represent.
5288 ///
5289 /// Currently, this must only be used on fields of type `google.protobuf.Any`.
5290 /// Supporting other generic types may be considered in the future.
5291 pub referenced_types: std::vec::Vec<crate::model::TypeReference>,
5292
5293 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5294}
5295
5296impl FieldInfo {
5297 pub fn new() -> Self {
5298 std::default::Default::default()
5299 }
5300
5301 /// Sets the value of [format][crate::model::FieldInfo::format].
5302 ///
5303 /// # Example
5304 /// ```ignore,no_run
5305 /// # use google_cloud_api::model::FieldInfo;
5306 /// use google_cloud_api::model::field_info::Format;
5307 /// let x0 = FieldInfo::new().set_format(Format::Uuid4);
5308 /// let x1 = FieldInfo::new().set_format(Format::Ipv4);
5309 /// let x2 = FieldInfo::new().set_format(Format::Ipv6);
5310 /// ```
5311 pub fn set_format<T: std::convert::Into<crate::model::field_info::Format>>(
5312 mut self,
5313 v: T,
5314 ) -> Self {
5315 self.format = v.into();
5316 self
5317 }
5318
5319 /// Sets the value of [referenced_types][crate::model::FieldInfo::referenced_types].
5320 ///
5321 /// # Example
5322 /// ```ignore,no_run
5323 /// # use google_cloud_api::model::FieldInfo;
5324 /// use google_cloud_api::model::TypeReference;
5325 /// let x = FieldInfo::new()
5326 /// .set_referenced_types([
5327 /// TypeReference::default()/* use setters */,
5328 /// TypeReference::default()/* use (different) setters */,
5329 /// ]);
5330 /// ```
5331 pub fn set_referenced_types<T, V>(mut self, v: T) -> Self
5332 where
5333 T: std::iter::IntoIterator<Item = V>,
5334 V: std::convert::Into<crate::model::TypeReference>,
5335 {
5336 use std::iter::Iterator;
5337 self.referenced_types = v.into_iter().map(|i| i.into()).collect();
5338 self
5339 }
5340}
5341
5342impl wkt::message::Message for FieldInfo {
5343 fn typename() -> &'static str {
5344 "type.googleapis.com/google.api.FieldInfo"
5345 }
5346}
5347
5348/// Defines additional types related to [FieldInfo].
5349pub mod field_info {
5350 #[allow(unused_imports)]
5351 use super::*;
5352
5353 /// The standard format of a field value. The supported formats are all backed
5354 /// by either an RFC defined by the IETF or a Google-defined AIP.
5355 ///
5356 /// # Working with unknown values
5357 ///
5358 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5359 /// additional enum variants at any time. Adding new variants is not considered
5360 /// a breaking change. Applications should write their code in anticipation of:
5361 ///
5362 /// - New values appearing in future releases of the client library, **and**
5363 /// - New values received dynamically, without application changes.
5364 ///
5365 /// Please consult the [Working with enums] section in the user guide for some
5366 /// guidelines.
5367 ///
5368 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
5369 #[derive(Clone, Debug, PartialEq)]
5370 #[non_exhaustive]
5371 pub enum Format {
5372 /// Default, unspecified value.
5373 Unspecified,
5374 /// Universally Unique Identifier, version 4, value as defined by
5375 /// <https://datatracker.ietf.org/doc/html/rfc4122>. The value may be
5376 /// normalized to entirely lowercase letters. For example, the value
5377 /// `F47AC10B-58CC-0372-8567-0E02B2C3D479` would be normalized to
5378 /// `f47ac10b-58cc-0372-8567-0e02b2c3d479`.
5379 Uuid4,
5380 /// Internet Protocol v4 value as defined by [RFC
5381 /// 791](https://datatracker.ietf.org/doc/html/rfc791). The value may be
5382 /// condensed, with leading zeros in each octet stripped. For example,
5383 /// `001.022.233.040` would be condensed to `1.22.233.40`.
5384 Ipv4,
5385 /// Internet Protocol v6 value as defined by [RFC
5386 /// 2460](https://datatracker.ietf.org/doc/html/rfc2460). The value may be
5387 /// normalized to entirely lowercase letters with zeros compressed, following
5388 /// [RFC 5952](https://datatracker.ietf.org/doc/html/rfc5952). For example,
5389 /// the value `2001:0DB8:0::0` would be normalized to `2001:db8::`.
5390 Ipv6,
5391 /// An IP address in either v4 or v6 format as described by the individual
5392 /// values defined herein. See the comments on the IPV4 and IPV6 types for
5393 /// allowed normalizations of each.
5394 Ipv4OrIpv6,
5395 /// If set, the enum was initialized with an unknown value.
5396 ///
5397 /// Applications can examine the value using [Format::value] or
5398 /// [Format::name].
5399 UnknownValue(format::UnknownValue),
5400 }
5401
5402 #[doc(hidden)]
5403 pub mod format {
5404 #[allow(unused_imports)]
5405 use super::*;
5406 #[derive(Clone, Debug, PartialEq)]
5407 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5408 }
5409
5410 impl Format {
5411 /// Gets the enum value.
5412 ///
5413 /// Returns `None` if the enum contains an unknown value deserialized from
5414 /// the string representation of enums.
5415 pub fn value(&self) -> std::option::Option<i32> {
5416 match self {
5417 Self::Unspecified => std::option::Option::Some(0),
5418 Self::Uuid4 => std::option::Option::Some(1),
5419 Self::Ipv4 => std::option::Option::Some(2),
5420 Self::Ipv6 => std::option::Option::Some(3),
5421 Self::Ipv4OrIpv6 => std::option::Option::Some(4),
5422 Self::UnknownValue(u) => u.0.value(),
5423 }
5424 }
5425
5426 /// Gets the enum value as a string.
5427 ///
5428 /// Returns `None` if the enum contains an unknown value deserialized from
5429 /// the integer representation of enums.
5430 pub fn name(&self) -> std::option::Option<&str> {
5431 match self {
5432 Self::Unspecified => std::option::Option::Some("FORMAT_UNSPECIFIED"),
5433 Self::Uuid4 => std::option::Option::Some("UUID4"),
5434 Self::Ipv4 => std::option::Option::Some("IPV4"),
5435 Self::Ipv6 => std::option::Option::Some("IPV6"),
5436 Self::Ipv4OrIpv6 => std::option::Option::Some("IPV4_OR_IPV6"),
5437 Self::UnknownValue(u) => u.0.name(),
5438 }
5439 }
5440 }
5441
5442 impl std::default::Default for Format {
5443 fn default() -> Self {
5444 use std::convert::From;
5445 Self::from(0)
5446 }
5447 }
5448
5449 impl std::fmt::Display for Format {
5450 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5451 wkt::internal::display_enum(f, self.name(), self.value())
5452 }
5453 }
5454
5455 impl std::convert::From<i32> for Format {
5456 fn from(value: i32) -> Self {
5457 match value {
5458 0 => Self::Unspecified,
5459 1 => Self::Uuid4,
5460 2 => Self::Ipv4,
5461 3 => Self::Ipv6,
5462 4 => Self::Ipv4OrIpv6,
5463 _ => Self::UnknownValue(format::UnknownValue(
5464 wkt::internal::UnknownEnumValue::Integer(value),
5465 )),
5466 }
5467 }
5468 }
5469
5470 impl std::convert::From<&str> for Format {
5471 fn from(value: &str) -> Self {
5472 use std::string::ToString;
5473 match value {
5474 "FORMAT_UNSPECIFIED" => Self::Unspecified,
5475 "UUID4" => Self::Uuid4,
5476 "IPV4" => Self::Ipv4,
5477 "IPV6" => Self::Ipv6,
5478 "IPV4_OR_IPV6" => Self::Ipv4OrIpv6,
5479 _ => Self::UnknownValue(format::UnknownValue(
5480 wkt::internal::UnknownEnumValue::String(value.to_string()),
5481 )),
5482 }
5483 }
5484 }
5485
5486 impl serde::ser::Serialize for Format {
5487 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5488 where
5489 S: serde::Serializer,
5490 {
5491 match self {
5492 Self::Unspecified => serializer.serialize_i32(0),
5493 Self::Uuid4 => serializer.serialize_i32(1),
5494 Self::Ipv4 => serializer.serialize_i32(2),
5495 Self::Ipv6 => serializer.serialize_i32(3),
5496 Self::Ipv4OrIpv6 => serializer.serialize_i32(4),
5497 Self::UnknownValue(u) => u.0.serialize(serializer),
5498 }
5499 }
5500 }
5501
5502 impl<'de> serde::de::Deserialize<'de> for Format {
5503 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5504 where
5505 D: serde::Deserializer<'de>,
5506 {
5507 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Format>::new(
5508 ".google.api.FieldInfo.Format",
5509 ))
5510 }
5511 }
5512}
5513
5514/// A reference to a message type, for use in [FieldInfo][google.api.FieldInfo].
5515///
5516/// [google.api.FieldInfo]: crate::model::FieldInfo
5517#[derive(Clone, Default, PartialEq)]
5518#[non_exhaustive]
5519pub struct TypeReference {
5520 /// The name of the type that the annotated, generic field may represent.
5521 /// If the type is in the same protobuf package, the value can be the simple
5522 /// message name e.g., `"MyMessage"`. Otherwise, the value must be the
5523 /// fully-qualified message name e.g., `"google.library.v1.Book"`.
5524 ///
5525 /// If the type(s) are unknown to the service (e.g. the field accepts generic
5526 /// user input), use the wildcard `"*"` to denote this behavior.
5527 ///
5528 /// See [AIP-202](https://google.aip.dev/202#type-references) for more details.
5529 pub type_name: std::string::String,
5530
5531 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5532}
5533
5534impl TypeReference {
5535 pub fn new() -> Self {
5536 std::default::Default::default()
5537 }
5538
5539 /// Sets the value of [type_name][crate::model::TypeReference::type_name].
5540 ///
5541 /// # Example
5542 /// ```ignore,no_run
5543 /// # use google_cloud_api::model::TypeReference;
5544 /// let x = TypeReference::new().set_type_name("example");
5545 /// ```
5546 pub fn set_type_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5547 self.type_name = v.into();
5548 self
5549 }
5550}
5551
5552impl wkt::message::Message for TypeReference {
5553 fn typename() -> &'static str {
5554 "type.googleapis.com/google.api.TypeReference"
5555 }
5556}
5557
5558/// Defines the HTTP configuration for an API service. It contains a list of
5559/// [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method
5560/// to one or more HTTP REST API methods.
5561///
5562/// [google.api.HttpRule]: crate::model::HttpRule
5563#[derive(Clone, Default, PartialEq)]
5564#[non_exhaustive]
5565pub struct Http {
5566 /// A list of HTTP configuration rules that apply to individual API methods.
5567 ///
5568 /// **NOTE:** All service configuration rules follow "last one wins" order.
5569 pub rules: std::vec::Vec<crate::model::HttpRule>,
5570
5571 /// When set to true, URL path parameters will be fully URI-decoded except in
5572 /// cases of single segment matches in reserved expansion, where "%2F" will be
5573 /// left encoded.
5574 ///
5575 /// The default behavior is to not decode RFC 6570 reserved characters in multi
5576 /// segment matches.
5577 pub fully_decode_reserved_expansion: bool,
5578
5579 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5580}
5581
5582impl Http {
5583 pub fn new() -> Self {
5584 std::default::Default::default()
5585 }
5586
5587 /// Sets the value of [rules][crate::model::Http::rules].
5588 ///
5589 /// # Example
5590 /// ```ignore,no_run
5591 /// # use google_cloud_api::model::Http;
5592 /// use google_cloud_api::model::HttpRule;
5593 /// let x = Http::new()
5594 /// .set_rules([
5595 /// HttpRule::default()/* use setters */,
5596 /// HttpRule::default()/* use (different) setters */,
5597 /// ]);
5598 /// ```
5599 pub fn set_rules<T, V>(mut self, v: T) -> Self
5600 where
5601 T: std::iter::IntoIterator<Item = V>,
5602 V: std::convert::Into<crate::model::HttpRule>,
5603 {
5604 use std::iter::Iterator;
5605 self.rules = v.into_iter().map(|i| i.into()).collect();
5606 self
5607 }
5608
5609 /// Sets the value of [fully_decode_reserved_expansion][crate::model::Http::fully_decode_reserved_expansion].
5610 ///
5611 /// # Example
5612 /// ```ignore,no_run
5613 /// # use google_cloud_api::model::Http;
5614 /// let x = Http::new().set_fully_decode_reserved_expansion(true);
5615 /// ```
5616 pub fn set_fully_decode_reserved_expansion<T: std::convert::Into<bool>>(
5617 mut self,
5618 v: T,
5619 ) -> Self {
5620 self.fully_decode_reserved_expansion = v.into();
5621 self
5622 }
5623}
5624
5625impl wkt::message::Message for Http {
5626 fn typename() -> &'static str {
5627 "type.googleapis.com/google.api.Http"
5628 }
5629}
5630
5631/// gRPC Transcoding
5632///
5633/// gRPC Transcoding is a feature for mapping between a gRPC method and one or
5634/// more HTTP REST endpoints. It allows developers to build a single API service
5635/// that supports both gRPC APIs and REST APIs. Many systems, including [Google
5636/// APIs](https://github.com/googleapis/googleapis),
5637/// [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC
5638/// Gateway](https://github.com/grpc-ecosystem/grpc-gateway),
5639/// and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature
5640/// and use it for large scale production services.
5641///
5642/// `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies
5643/// how different portions of the gRPC request message are mapped to the URL
5644/// path, URL query parameters, and HTTP request body. It also controls how the
5645/// gRPC response message is mapped to the HTTP response body. `HttpRule` is
5646/// typically specified as an `google.api.http` annotation on the gRPC method.
5647///
5648/// Each mapping specifies a URL path template and an HTTP method. The path
5649/// template may refer to one or more fields in the gRPC request message, as long
5650/// as each field is a non-repeated field with a primitive (non-message) type.
5651/// The path template controls how fields of the request message are mapped to
5652/// the URL path.
5653///
5654/// Example:
5655///
5656/// ```norust
5657/// service Messaging {
5658/// rpc GetMessage(GetMessageRequest) returns (Message) {
5659/// option (google.api.http) = {
5660/// get: "/v1/{name=messages/*}"
5661/// };
5662/// }
5663/// }
5664/// message GetMessageRequest {
5665/// string name = 1; // Mapped to URL path.
5666/// }
5667/// message Message {
5668/// string text = 1; // The resource content.
5669/// }
5670/// ```
5671///
5672/// This enables an HTTP REST to gRPC mapping as below:
5673///
5674/// - HTTP: `GET /v1/messages/123456`
5675/// - gRPC: `GetMessage(name: "messages/123456")`
5676///
5677/// Any fields in the request message which are not bound by the path template
5678/// automatically become HTTP query parameters if there is no HTTP request body.
5679/// For example:
5680///
5681/// ```norust
5682/// service Messaging {
5683/// rpc GetMessage(GetMessageRequest) returns (Message) {
5684/// option (google.api.http) = {
5685/// get:"/v1/messages/{message_id}"
5686/// };
5687/// }
5688/// }
5689/// message GetMessageRequest {
5690/// message SubMessage {
5691/// string subfield = 1;
5692/// }
5693/// string message_id = 1; // Mapped to URL path.
5694/// int64 revision = 2; // Mapped to URL query parameter `revision`.
5695/// SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`.
5696/// }
5697/// ```
5698///
5699/// This enables a HTTP JSON to RPC mapping as below:
5700///
5701/// - HTTP: `GET /v1/messages/123456?revision=2&sub.subfield=foo`
5702/// - gRPC: `GetMessage(message_id: "123456" revision: 2 sub:
5703/// SubMessage(subfield: "foo"))`
5704///
5705/// Note that fields which are mapped to URL query parameters must have a
5706/// primitive type or a repeated primitive type or a non-repeated message type.
5707/// In the case of a repeated type, the parameter can be repeated in the URL
5708/// as `...?param=A¶m=B`. In the case of a message type, each field of the
5709/// message is mapped to a separate parameter, such as
5710/// `...?foo.a=A&foo.b=B&foo.c=C`.
5711///
5712/// For HTTP methods that allow a request body, the `body` field
5713/// specifies the mapping. Consider a REST update method on the
5714/// message resource collection:
5715///
5716/// ```norust
5717/// service Messaging {
5718/// rpc UpdateMessage(UpdateMessageRequest) returns (Message) {
5719/// option (google.api.http) = {
5720/// patch: "/v1/messages/{message_id}"
5721/// body: "message"
5722/// };
5723/// }
5724/// }
5725/// message UpdateMessageRequest {
5726/// string message_id = 1; // mapped to the URL
5727/// Message message = 2; // mapped to the body
5728/// }
5729/// ```
5730///
5731/// The following HTTP JSON to RPC mapping is enabled, where the
5732/// representation of the JSON in the request body is determined by
5733/// protos JSON encoding:
5734///
5735/// - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }`
5736/// - gRPC: `UpdateMessage(message_id: "123456" message { text: "Hi!" })`
5737///
5738/// The special name `*` can be used in the body mapping to define that
5739/// every field not bound by the path template should be mapped to the
5740/// request body. This enables the following alternative definition of
5741/// the update method:
5742///
5743/// ```norust
5744/// service Messaging {
5745/// rpc UpdateMessage(Message) returns (Message) {
5746/// option (google.api.http) = {
5747/// patch: "/v1/messages/{message_id}"
5748/// body: "*"
5749/// };
5750/// }
5751/// }
5752/// message Message {
5753/// string message_id = 1;
5754/// string text = 2;
5755/// }
5756/// ```
5757///
5758/// The following HTTP JSON to RPC mapping is enabled:
5759///
5760/// - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }`
5761/// - gRPC: `UpdateMessage(message_id: "123456" text: "Hi!")`
5762///
5763/// Note that when using `*` in the body mapping, it is not possible to
5764/// have HTTP parameters, as all fields not bound by the path end in
5765/// the body. This makes this option more rarely used in practice when
5766/// defining REST APIs. The common usage of `*` is in custom methods
5767/// which don't use the URL at all for transferring data.
5768///
5769/// It is possible to define multiple HTTP methods for one RPC by using
5770/// the `additional_bindings` option. Example:
5771///
5772/// ```norust
5773/// service Messaging {
5774/// rpc GetMessage(GetMessageRequest) returns (Message) {
5775/// option (google.api.http) = {
5776/// get: "/v1/messages/{message_id}"
5777/// additional_bindings {
5778/// get: "/v1/users/{user_id}/messages/{message_id}"
5779/// }
5780/// };
5781/// }
5782/// }
5783/// message GetMessageRequest {
5784/// string message_id = 1;
5785/// string user_id = 2;
5786/// }
5787/// ```
5788///
5789/// This enables the following two alternative HTTP JSON to RPC mappings:
5790///
5791/// - HTTP: `GET /v1/messages/123456`
5792///
5793/// - gRPC: `GetMessage(message_id: "123456")`
5794///
5795/// - HTTP: `GET /v1/users/me/messages/123456`
5796///
5797/// - gRPC: `GetMessage(user_id: "me" message_id: "123456")`
5798///
5799///
5800/// Rules for HTTP mapping
5801///
5802/// 1. Leaf request fields (recursive expansion nested messages in the request
5803/// message) are classified into three categories:
5804/// - Fields referred by the path template. They are passed via the URL path.
5805/// - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They
5806/// are passed via the HTTP
5807/// request body.
5808/// - All other fields are passed via the URL query parameters, and the
5809/// parameter name is the field path in the request message. A repeated
5810/// field can be represented as multiple query parameters under the same
5811/// name.
5812/// 1. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL
5813/// query parameter, all fields
5814/// are passed via URL path and HTTP request body.
5815/// 1. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP
5816/// request body, all
5817/// fields are passed via URL path and URL query parameters.
5818///
5819/// Path template syntax
5820///
5821/// ```norust
5822/// Template = "/" Segments [ Verb ] ;
5823/// Segments = Segment { "/" Segment } ;
5824/// Segment = "*" | "**" | LITERAL | Variable ;
5825/// Variable = "{" FieldPath [ "=" Segments ] "}" ;
5826/// FieldPath = IDENT { "." IDENT } ;
5827/// Verb = ":" LITERAL ;
5828/// ```
5829///
5830/// The syntax `*` matches a single URL path segment. The syntax `**` matches
5831/// zero or more URL path segments, which must be the last part of the URL path
5832/// except the `Verb`.
5833///
5834/// The syntax `Variable` matches part of the URL path as specified by its
5835/// template. A variable template must not contain other variables. If a variable
5836/// matches a single path segment, its template may be omitted, e.g. `{var}`
5837/// is equivalent to `{var=*}`.
5838///
5839/// The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL`
5840/// contains any reserved character, such characters should be percent-encoded
5841/// before the matching.
5842///
5843/// If a variable contains exactly one path segment, such as `"{var}"` or
5844/// `"{var=*}"`, when such a variable is expanded into a URL path on the client
5845/// side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The
5846/// server side does the reverse decoding. Such variables show up in the
5847/// [Discovery
5848/// Document](https://developers.google.com/discovery/v1/reference/apis) as
5849/// `{var}`.
5850///
5851/// If a variable contains multiple path segments, such as `"{var=foo/*}"`
5852/// or `"{var=**}"`, when such a variable is expanded into a URL path on the
5853/// client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded.
5854/// The server side does the reverse decoding, except "%2F" and "%2f" are left
5855/// unchanged. Such variables show up in the
5856/// [Discovery
5857/// Document](https://developers.google.com/discovery/v1/reference/apis) as
5858/// `{+var}`.
5859///
5860/// Using gRPC API Service Configuration
5861///
5862/// gRPC API Service Configuration (service config) is a configuration language
5863/// for configuring a gRPC service to become a user-facing product. The
5864/// service config is simply the YAML representation of the `google.api.Service`
5865/// proto message.
5866///
5867/// As an alternative to annotating your proto file, you can configure gRPC
5868/// transcoding in your service config YAML files. You do this by specifying a
5869/// `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same
5870/// effect as the proto annotation. This can be particularly useful if you
5871/// have a proto that is reused in multiple services. Note that any transcoding
5872/// specified in the service config will override any matching transcoding
5873/// configuration in the proto.
5874///
5875/// The following example selects a gRPC method and applies an `HttpRule` to it:
5876///
5877/// ```norust
5878/// http:
5879/// rules:
5880/// - selector: example.v1.Messaging.GetMessage
5881/// get: /v1/messages/{message_id}/{sub.subfield}
5882/// ```
5883///
5884/// Special notes
5885///
5886/// When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the
5887/// proto to JSON conversion must follow the [proto3
5888/// specification](https://developers.google.com/protocol-buffers/docs/proto3#json).
5889///
5890/// While the single segment variable follows the semantics of
5891/// [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String
5892/// Expansion, the multi segment variable **does not** follow RFC 6570 Section
5893/// 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion
5894/// does not expand special characters like `?` and `#`, which would lead
5895/// to invalid URLs. As the result, gRPC Transcoding uses a custom encoding
5896/// for multi segment variables.
5897///
5898/// The path variables **must not** refer to any repeated or mapped field,
5899/// because client libraries are not capable of handling such variable expansion.
5900///
5901/// The path variables **must not** capture the leading "/" character. The reason
5902/// is that the most common use case "{var}" does not capture the leading "/"
5903/// character. For consistency, all path variables must share the same behavior.
5904///
5905/// Repeated message fields must not be mapped to URL query parameters, because
5906/// no client library can support such complicated mapping.
5907///
5908/// If an API needs to use a JSON array for request or response body, it can map
5909/// the request or response body to a repeated field. However, some gRPC
5910/// Transcoding implementations may not support this feature.
5911///
5912/// [google.api.HttpRule.body]: crate::model::HttpRule::body
5913#[derive(Clone, Default, PartialEq)]
5914#[non_exhaustive]
5915pub struct HttpRule {
5916 /// Selects a method to which this rule applies.
5917 ///
5918 /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
5919 /// details.
5920 ///
5921 /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
5922 pub selector: std::string::String,
5923
5924 /// The name of the request field whose value is mapped to the HTTP request
5925 /// body, or `*` for mapping all request fields not captured by the path
5926 /// pattern to the HTTP body, or omitted for not having any HTTP request body.
5927 ///
5928 /// NOTE: the referred field must be present at the top-level of the request
5929 /// message type.
5930 pub body: std::string::String,
5931
5932 /// Optional. The name of the response field whose value is mapped to the HTTP
5933 /// response body. When omitted, the entire response message will be used
5934 /// as the HTTP response body.
5935 ///
5936 /// NOTE: The referred field must be present at the top-level of the response
5937 /// message type.
5938 pub response_body: std::string::String,
5939
5940 /// Additional HTTP bindings for the selector. Nested bindings must
5941 /// not contain an `additional_bindings` field themselves (that is,
5942 /// the nesting may only be one level deep).
5943 pub additional_bindings: std::vec::Vec<crate::model::HttpRule>,
5944
5945 /// Determines the URL pattern is matched by this rules. This pattern can be
5946 /// used with any of the {get|put|post|delete|patch} methods. A custom method
5947 /// can be defined using the 'custom' field.
5948 pub pattern: std::option::Option<crate::model::http_rule::Pattern>,
5949
5950 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5951}
5952
5953impl HttpRule {
5954 pub fn new() -> Self {
5955 std::default::Default::default()
5956 }
5957
5958 /// Sets the value of [selector][crate::model::HttpRule::selector].
5959 ///
5960 /// # Example
5961 /// ```ignore,no_run
5962 /// # use google_cloud_api::model::HttpRule;
5963 /// let x = HttpRule::new().set_selector("example");
5964 /// ```
5965 pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5966 self.selector = v.into();
5967 self
5968 }
5969
5970 /// Sets the value of [body][crate::model::HttpRule::body].
5971 ///
5972 /// # Example
5973 /// ```ignore,no_run
5974 /// # use google_cloud_api::model::HttpRule;
5975 /// let x = HttpRule::new().set_body("example");
5976 /// ```
5977 pub fn set_body<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5978 self.body = v.into();
5979 self
5980 }
5981
5982 /// Sets the value of [response_body][crate::model::HttpRule::response_body].
5983 ///
5984 /// # Example
5985 /// ```ignore,no_run
5986 /// # use google_cloud_api::model::HttpRule;
5987 /// let x = HttpRule::new().set_response_body("example");
5988 /// ```
5989 pub fn set_response_body<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5990 self.response_body = v.into();
5991 self
5992 }
5993
5994 /// Sets the value of [additional_bindings][crate::model::HttpRule::additional_bindings].
5995 ///
5996 /// # Example
5997 /// ```ignore,no_run
5998 /// # use google_cloud_api::model::HttpRule;
5999 /// let x = HttpRule::new()
6000 /// .set_additional_bindings([
6001 /// HttpRule::default()/* use setters */,
6002 /// HttpRule::default()/* use (different) setters */,
6003 /// ]);
6004 /// ```
6005 pub fn set_additional_bindings<T, V>(mut self, v: T) -> Self
6006 where
6007 T: std::iter::IntoIterator<Item = V>,
6008 V: std::convert::Into<crate::model::HttpRule>,
6009 {
6010 use std::iter::Iterator;
6011 self.additional_bindings = v.into_iter().map(|i| i.into()).collect();
6012 self
6013 }
6014
6015 /// Sets the value of [pattern][crate::model::HttpRule::pattern].
6016 ///
6017 /// Note that all the setters affecting `pattern` are mutually
6018 /// exclusive.
6019 ///
6020 /// # Example
6021 /// ```ignore,no_run
6022 /// # use google_cloud_api::model::HttpRule;
6023 /// use google_cloud_api::model::http_rule::Pattern;
6024 /// let x = HttpRule::new().set_pattern(Some(Pattern::Get("example".to_string())));
6025 /// ```
6026 pub fn set_pattern<
6027 T: std::convert::Into<std::option::Option<crate::model::http_rule::Pattern>>,
6028 >(
6029 mut self,
6030 v: T,
6031 ) -> Self {
6032 self.pattern = v.into();
6033 self
6034 }
6035
6036 /// The value of [pattern][crate::model::HttpRule::pattern]
6037 /// if it holds a `Get`, `None` if the field is not set or
6038 /// holds a different branch.
6039 pub fn get(&self) -> std::option::Option<&std::string::String> {
6040 #[allow(unreachable_patterns)]
6041 self.pattern.as_ref().and_then(|v| match v {
6042 crate::model::http_rule::Pattern::Get(v) => std::option::Option::Some(v),
6043 _ => std::option::Option::None,
6044 })
6045 }
6046
6047 /// Sets the value of [pattern][crate::model::HttpRule::pattern]
6048 /// to hold a `Get`.
6049 ///
6050 /// Note that all the setters affecting `pattern` are
6051 /// mutually exclusive.
6052 ///
6053 /// # Example
6054 /// ```ignore,no_run
6055 /// # use google_cloud_api::model::HttpRule;
6056 /// let x = HttpRule::new().set_get("example");
6057 /// assert!(x.get().is_some());
6058 /// assert!(x.put().is_none());
6059 /// assert!(x.post().is_none());
6060 /// assert!(x.delete().is_none());
6061 /// assert!(x.patch().is_none());
6062 /// assert!(x.custom().is_none());
6063 /// ```
6064 pub fn set_get<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6065 self.pattern = std::option::Option::Some(crate::model::http_rule::Pattern::Get(v.into()));
6066 self
6067 }
6068
6069 /// The value of [pattern][crate::model::HttpRule::pattern]
6070 /// if it holds a `Put`, `None` if the field is not set or
6071 /// holds a different branch.
6072 pub fn put(&self) -> std::option::Option<&std::string::String> {
6073 #[allow(unreachable_patterns)]
6074 self.pattern.as_ref().and_then(|v| match v {
6075 crate::model::http_rule::Pattern::Put(v) => std::option::Option::Some(v),
6076 _ => std::option::Option::None,
6077 })
6078 }
6079
6080 /// Sets the value of [pattern][crate::model::HttpRule::pattern]
6081 /// to hold a `Put`.
6082 ///
6083 /// Note that all the setters affecting `pattern` are
6084 /// mutually exclusive.
6085 ///
6086 /// # Example
6087 /// ```ignore,no_run
6088 /// # use google_cloud_api::model::HttpRule;
6089 /// let x = HttpRule::new().set_put("example");
6090 /// assert!(x.put().is_some());
6091 /// assert!(x.get().is_none());
6092 /// assert!(x.post().is_none());
6093 /// assert!(x.delete().is_none());
6094 /// assert!(x.patch().is_none());
6095 /// assert!(x.custom().is_none());
6096 /// ```
6097 pub fn set_put<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6098 self.pattern = std::option::Option::Some(crate::model::http_rule::Pattern::Put(v.into()));
6099 self
6100 }
6101
6102 /// The value of [pattern][crate::model::HttpRule::pattern]
6103 /// if it holds a `Post`, `None` if the field is not set or
6104 /// holds a different branch.
6105 pub fn post(&self) -> std::option::Option<&std::string::String> {
6106 #[allow(unreachable_patterns)]
6107 self.pattern.as_ref().and_then(|v| match v {
6108 crate::model::http_rule::Pattern::Post(v) => std::option::Option::Some(v),
6109 _ => std::option::Option::None,
6110 })
6111 }
6112
6113 /// Sets the value of [pattern][crate::model::HttpRule::pattern]
6114 /// to hold a `Post`.
6115 ///
6116 /// Note that all the setters affecting `pattern` are
6117 /// mutually exclusive.
6118 ///
6119 /// # Example
6120 /// ```ignore,no_run
6121 /// # use google_cloud_api::model::HttpRule;
6122 /// let x = HttpRule::new().set_post("example");
6123 /// assert!(x.post().is_some());
6124 /// assert!(x.get().is_none());
6125 /// assert!(x.put().is_none());
6126 /// assert!(x.delete().is_none());
6127 /// assert!(x.patch().is_none());
6128 /// assert!(x.custom().is_none());
6129 /// ```
6130 pub fn set_post<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6131 self.pattern = std::option::Option::Some(crate::model::http_rule::Pattern::Post(v.into()));
6132 self
6133 }
6134
6135 /// The value of [pattern][crate::model::HttpRule::pattern]
6136 /// if it holds a `Delete`, `None` if the field is not set or
6137 /// holds a different branch.
6138 pub fn delete(&self) -> std::option::Option<&std::string::String> {
6139 #[allow(unreachable_patterns)]
6140 self.pattern.as_ref().and_then(|v| match v {
6141 crate::model::http_rule::Pattern::Delete(v) => std::option::Option::Some(v),
6142 _ => std::option::Option::None,
6143 })
6144 }
6145
6146 /// Sets the value of [pattern][crate::model::HttpRule::pattern]
6147 /// to hold a `Delete`.
6148 ///
6149 /// Note that all the setters affecting `pattern` are
6150 /// mutually exclusive.
6151 ///
6152 /// # Example
6153 /// ```ignore,no_run
6154 /// # use google_cloud_api::model::HttpRule;
6155 /// let x = HttpRule::new().set_delete("example");
6156 /// assert!(x.delete().is_some());
6157 /// assert!(x.get().is_none());
6158 /// assert!(x.put().is_none());
6159 /// assert!(x.post().is_none());
6160 /// assert!(x.patch().is_none());
6161 /// assert!(x.custom().is_none());
6162 /// ```
6163 pub fn set_delete<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6164 self.pattern =
6165 std::option::Option::Some(crate::model::http_rule::Pattern::Delete(v.into()));
6166 self
6167 }
6168
6169 /// The value of [pattern][crate::model::HttpRule::pattern]
6170 /// if it holds a `Patch`, `None` if the field is not set or
6171 /// holds a different branch.
6172 pub fn patch(&self) -> std::option::Option<&std::string::String> {
6173 #[allow(unreachable_patterns)]
6174 self.pattern.as_ref().and_then(|v| match v {
6175 crate::model::http_rule::Pattern::Patch(v) => std::option::Option::Some(v),
6176 _ => std::option::Option::None,
6177 })
6178 }
6179
6180 /// Sets the value of [pattern][crate::model::HttpRule::pattern]
6181 /// to hold a `Patch`.
6182 ///
6183 /// Note that all the setters affecting `pattern` are
6184 /// mutually exclusive.
6185 ///
6186 /// # Example
6187 /// ```ignore,no_run
6188 /// # use google_cloud_api::model::HttpRule;
6189 /// let x = HttpRule::new().set_patch("example");
6190 /// assert!(x.patch().is_some());
6191 /// assert!(x.get().is_none());
6192 /// assert!(x.put().is_none());
6193 /// assert!(x.post().is_none());
6194 /// assert!(x.delete().is_none());
6195 /// assert!(x.custom().is_none());
6196 /// ```
6197 pub fn set_patch<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6198 self.pattern = std::option::Option::Some(crate::model::http_rule::Pattern::Patch(v.into()));
6199 self
6200 }
6201
6202 /// The value of [pattern][crate::model::HttpRule::pattern]
6203 /// if it holds a `Custom`, `None` if the field is not set or
6204 /// holds a different branch.
6205 pub fn custom(&self) -> std::option::Option<&std::boxed::Box<crate::model::CustomHttpPattern>> {
6206 #[allow(unreachable_patterns)]
6207 self.pattern.as_ref().and_then(|v| match v {
6208 crate::model::http_rule::Pattern::Custom(v) => std::option::Option::Some(v),
6209 _ => std::option::Option::None,
6210 })
6211 }
6212
6213 /// Sets the value of [pattern][crate::model::HttpRule::pattern]
6214 /// to hold a `Custom`.
6215 ///
6216 /// Note that all the setters affecting `pattern` are
6217 /// mutually exclusive.
6218 ///
6219 /// # Example
6220 /// ```ignore,no_run
6221 /// # use google_cloud_api::model::HttpRule;
6222 /// use google_cloud_api::model::CustomHttpPattern;
6223 /// let x = HttpRule::new().set_custom(CustomHttpPattern::default()/* use setters */);
6224 /// assert!(x.custom().is_some());
6225 /// assert!(x.get().is_none());
6226 /// assert!(x.put().is_none());
6227 /// assert!(x.post().is_none());
6228 /// assert!(x.delete().is_none());
6229 /// assert!(x.patch().is_none());
6230 /// ```
6231 pub fn set_custom<T: std::convert::Into<std::boxed::Box<crate::model::CustomHttpPattern>>>(
6232 mut self,
6233 v: T,
6234 ) -> Self {
6235 self.pattern =
6236 std::option::Option::Some(crate::model::http_rule::Pattern::Custom(v.into()));
6237 self
6238 }
6239}
6240
6241impl wkt::message::Message for HttpRule {
6242 fn typename() -> &'static str {
6243 "type.googleapis.com/google.api.HttpRule"
6244 }
6245}
6246
6247/// Defines additional types related to [HttpRule].
6248pub mod http_rule {
6249 #[allow(unused_imports)]
6250 use super::*;
6251
6252 /// Determines the URL pattern is matched by this rules. This pattern can be
6253 /// used with any of the {get|put|post|delete|patch} methods. A custom method
6254 /// can be defined using the 'custom' field.
6255 #[derive(Clone, Debug, PartialEq)]
6256 #[non_exhaustive]
6257 pub enum Pattern {
6258 /// Maps to HTTP GET. Used for listing and getting information about
6259 /// resources.
6260 Get(std::string::String),
6261 /// Maps to HTTP PUT. Used for replacing a resource.
6262 Put(std::string::String),
6263 /// Maps to HTTP POST. Used for creating a resource or performing an action.
6264 Post(std::string::String),
6265 /// Maps to HTTP DELETE. Used for deleting a resource.
6266 Delete(std::string::String),
6267 /// Maps to HTTP PATCH. Used for updating a resource.
6268 Patch(std::string::String),
6269 /// The custom pattern is used for specifying an HTTP method that is not
6270 /// included in the `pattern` field, such as HEAD, or "*" to leave the
6271 /// HTTP method unspecified for this rule. The wild-card rule is useful
6272 /// for services that provide content to Web (HTML) clients.
6273 Custom(std::boxed::Box<crate::model::CustomHttpPattern>),
6274 }
6275}
6276
6277/// A custom pattern is used for defining custom HTTP verb.
6278#[derive(Clone, Default, PartialEq)]
6279#[non_exhaustive]
6280pub struct CustomHttpPattern {
6281 /// The name of this custom HTTP verb.
6282 pub kind: std::string::String,
6283
6284 /// The path matched by this custom verb.
6285 pub path: std::string::String,
6286
6287 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6288}
6289
6290impl CustomHttpPattern {
6291 pub fn new() -> Self {
6292 std::default::Default::default()
6293 }
6294
6295 /// Sets the value of [kind][crate::model::CustomHttpPattern::kind].
6296 ///
6297 /// # Example
6298 /// ```ignore,no_run
6299 /// # use google_cloud_api::model::CustomHttpPattern;
6300 /// let x = CustomHttpPattern::new().set_kind("example");
6301 /// ```
6302 pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6303 self.kind = v.into();
6304 self
6305 }
6306
6307 /// Sets the value of [path][crate::model::CustomHttpPattern::path].
6308 ///
6309 /// # Example
6310 /// ```ignore,no_run
6311 /// # use google_cloud_api::model::CustomHttpPattern;
6312 /// let x = CustomHttpPattern::new().set_path("example");
6313 /// ```
6314 pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6315 self.path = v.into();
6316 self
6317 }
6318}
6319
6320impl wkt::message::Message for CustomHttpPattern {
6321 fn typename() -> &'static str {
6322 "type.googleapis.com/google.api.CustomHttpPattern"
6323 }
6324}
6325
6326/// Message that represents an arbitrary HTTP body. It should only be used for
6327/// payload formats that can't be represented as JSON, such as raw binary or
6328/// an HTML page.
6329///
6330/// This message can be used both in streaming and non-streaming API methods in
6331/// the request as well as the response.
6332///
6333/// It can be used as a top-level request field, which is convenient if one
6334/// wants to extract parameters from either the URL or HTTP template into the
6335/// request fields and also want access to the raw HTTP body.
6336///
6337/// Example:
6338///
6339/// ```norust
6340/// message GetResourceRequest {
6341/// // A unique request id.
6342/// string request_id = 1;
6343///
6344/// // The raw HTTP body is bound to this field.
6345/// google.api.HttpBody http_body = 2;
6346///
6347/// }
6348///
6349/// service ResourceService {
6350/// rpc GetResource(GetResourceRequest)
6351/// returns (google.api.HttpBody);
6352/// rpc UpdateResource(google.api.HttpBody)
6353/// returns (google.protobuf.Empty);
6354///
6355/// }
6356/// ```
6357///
6358/// Example with streaming methods:
6359///
6360/// ```norust
6361/// service CaldavService {
6362/// rpc GetCalendar(stream google.api.HttpBody)
6363/// returns (stream google.api.HttpBody);
6364/// rpc UpdateCalendar(stream google.api.HttpBody)
6365/// returns (stream google.api.HttpBody);
6366///
6367/// }
6368/// ```
6369///
6370/// Use of this type only changes how the request and response bodies are
6371/// handled, all other features will continue to work unchanged.
6372#[derive(Clone, Default, PartialEq)]
6373#[non_exhaustive]
6374pub struct HttpBody {
6375 /// The HTTP Content-Type header value specifying the content type of the body.
6376 pub content_type: std::string::String,
6377
6378 /// The HTTP request/response body as raw binary.
6379 pub data: ::bytes::Bytes,
6380
6381 /// Application specific response metadata. Must be set in the first response
6382 /// for streaming APIs.
6383 pub extensions: std::vec::Vec<wkt::Any>,
6384
6385 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6386}
6387
6388impl HttpBody {
6389 pub fn new() -> Self {
6390 std::default::Default::default()
6391 }
6392
6393 /// Sets the value of [content_type][crate::model::HttpBody::content_type].
6394 ///
6395 /// # Example
6396 /// ```ignore,no_run
6397 /// # use google_cloud_api::model::HttpBody;
6398 /// let x = HttpBody::new().set_content_type("example");
6399 /// ```
6400 pub fn set_content_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6401 self.content_type = v.into();
6402 self
6403 }
6404
6405 /// Sets the value of [data][crate::model::HttpBody::data].
6406 ///
6407 /// # Example
6408 /// ```ignore,no_run
6409 /// # use google_cloud_api::model::HttpBody;
6410 /// let x = HttpBody::new().set_data(bytes::Bytes::from_static(b"example"));
6411 /// ```
6412 pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
6413 self.data = v.into();
6414 self
6415 }
6416
6417 /// Sets the value of [extensions][crate::model::HttpBody::extensions].
6418 ///
6419 /// # Example
6420 /// ```ignore,no_run
6421 /// # use google_cloud_api::model::HttpBody;
6422 /// use wkt::Any;
6423 /// let x = HttpBody::new()
6424 /// .set_extensions([
6425 /// Any::default()/* use setters */,
6426 /// Any::default()/* use (different) setters */,
6427 /// ]);
6428 /// ```
6429 pub fn set_extensions<T, V>(mut self, v: T) -> Self
6430 where
6431 T: std::iter::IntoIterator<Item = V>,
6432 V: std::convert::Into<wkt::Any>,
6433 {
6434 use std::iter::Iterator;
6435 self.extensions = v.into_iter().map(|i| i.into()).collect();
6436 self
6437 }
6438}
6439
6440impl wkt::message::Message for HttpBody {
6441 fn typename() -> &'static str {
6442 "type.googleapis.com/google.api.HttpBody"
6443 }
6444}
6445
6446/// A description of a label.
6447#[derive(Clone, Default, PartialEq)]
6448#[non_exhaustive]
6449pub struct LabelDescriptor {
6450 /// The label key.
6451 pub key: std::string::String,
6452
6453 /// The type of data that can be assigned to the label.
6454 pub value_type: crate::model::label_descriptor::ValueType,
6455
6456 /// A human-readable description for the label.
6457 pub description: std::string::String,
6458
6459 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6460}
6461
6462impl LabelDescriptor {
6463 pub fn new() -> Self {
6464 std::default::Default::default()
6465 }
6466
6467 /// Sets the value of [key][crate::model::LabelDescriptor::key].
6468 ///
6469 /// # Example
6470 /// ```ignore,no_run
6471 /// # use google_cloud_api::model::LabelDescriptor;
6472 /// let x = LabelDescriptor::new().set_key("example");
6473 /// ```
6474 pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6475 self.key = v.into();
6476 self
6477 }
6478
6479 /// Sets the value of [value_type][crate::model::LabelDescriptor::value_type].
6480 ///
6481 /// # Example
6482 /// ```ignore,no_run
6483 /// # use google_cloud_api::model::LabelDescriptor;
6484 /// use google_cloud_api::model::label_descriptor::ValueType;
6485 /// let x0 = LabelDescriptor::new().set_value_type(ValueType::Bool);
6486 /// let x1 = LabelDescriptor::new().set_value_type(ValueType::Int64);
6487 /// ```
6488 pub fn set_value_type<T: std::convert::Into<crate::model::label_descriptor::ValueType>>(
6489 mut self,
6490 v: T,
6491 ) -> Self {
6492 self.value_type = v.into();
6493 self
6494 }
6495
6496 /// Sets the value of [description][crate::model::LabelDescriptor::description].
6497 ///
6498 /// # Example
6499 /// ```ignore,no_run
6500 /// # use google_cloud_api::model::LabelDescriptor;
6501 /// let x = LabelDescriptor::new().set_description("example");
6502 /// ```
6503 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6504 self.description = v.into();
6505 self
6506 }
6507}
6508
6509impl wkt::message::Message for LabelDescriptor {
6510 fn typename() -> &'static str {
6511 "type.googleapis.com/google.api.LabelDescriptor"
6512 }
6513}
6514
6515/// Defines additional types related to [LabelDescriptor].
6516pub mod label_descriptor {
6517 #[allow(unused_imports)]
6518 use super::*;
6519
6520 /// Value types that can be used as label values.
6521 ///
6522 /// # Working with unknown values
6523 ///
6524 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6525 /// additional enum variants at any time. Adding new variants is not considered
6526 /// a breaking change. Applications should write their code in anticipation of:
6527 ///
6528 /// - New values appearing in future releases of the client library, **and**
6529 /// - New values received dynamically, without application changes.
6530 ///
6531 /// Please consult the [Working with enums] section in the user guide for some
6532 /// guidelines.
6533 ///
6534 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
6535 #[derive(Clone, Debug, PartialEq)]
6536 #[non_exhaustive]
6537 pub enum ValueType {
6538 /// A variable-length string. This is the default.
6539 String,
6540 /// Boolean; true or false.
6541 Bool,
6542 /// A 64-bit signed integer.
6543 Int64,
6544 /// If set, the enum was initialized with an unknown value.
6545 ///
6546 /// Applications can examine the value using [ValueType::value] or
6547 /// [ValueType::name].
6548 UnknownValue(value_type::UnknownValue),
6549 }
6550
6551 #[doc(hidden)]
6552 pub mod value_type {
6553 #[allow(unused_imports)]
6554 use super::*;
6555 #[derive(Clone, Debug, PartialEq)]
6556 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6557 }
6558
6559 impl ValueType {
6560 /// Gets the enum value.
6561 ///
6562 /// Returns `None` if the enum contains an unknown value deserialized from
6563 /// the string representation of enums.
6564 pub fn value(&self) -> std::option::Option<i32> {
6565 match self {
6566 Self::String => std::option::Option::Some(0),
6567 Self::Bool => std::option::Option::Some(1),
6568 Self::Int64 => std::option::Option::Some(2),
6569 Self::UnknownValue(u) => u.0.value(),
6570 }
6571 }
6572
6573 /// Gets the enum value as a string.
6574 ///
6575 /// Returns `None` if the enum contains an unknown value deserialized from
6576 /// the integer representation of enums.
6577 pub fn name(&self) -> std::option::Option<&str> {
6578 match self {
6579 Self::String => std::option::Option::Some("STRING"),
6580 Self::Bool => std::option::Option::Some("BOOL"),
6581 Self::Int64 => std::option::Option::Some("INT64"),
6582 Self::UnknownValue(u) => u.0.name(),
6583 }
6584 }
6585 }
6586
6587 impl std::default::Default for ValueType {
6588 fn default() -> Self {
6589 use std::convert::From;
6590 Self::from(0)
6591 }
6592 }
6593
6594 impl std::fmt::Display for ValueType {
6595 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6596 wkt::internal::display_enum(f, self.name(), self.value())
6597 }
6598 }
6599
6600 impl std::convert::From<i32> for ValueType {
6601 fn from(value: i32) -> Self {
6602 match value {
6603 0 => Self::String,
6604 1 => Self::Bool,
6605 2 => Self::Int64,
6606 _ => Self::UnknownValue(value_type::UnknownValue(
6607 wkt::internal::UnknownEnumValue::Integer(value),
6608 )),
6609 }
6610 }
6611 }
6612
6613 impl std::convert::From<&str> for ValueType {
6614 fn from(value: &str) -> Self {
6615 use std::string::ToString;
6616 match value {
6617 "STRING" => Self::String,
6618 "BOOL" => Self::Bool,
6619 "INT64" => Self::Int64,
6620 _ => Self::UnknownValue(value_type::UnknownValue(
6621 wkt::internal::UnknownEnumValue::String(value.to_string()),
6622 )),
6623 }
6624 }
6625 }
6626
6627 impl serde::ser::Serialize for ValueType {
6628 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6629 where
6630 S: serde::Serializer,
6631 {
6632 match self {
6633 Self::String => serializer.serialize_i32(0),
6634 Self::Bool => serializer.serialize_i32(1),
6635 Self::Int64 => serializer.serialize_i32(2),
6636 Self::UnknownValue(u) => u.0.serialize(serializer),
6637 }
6638 }
6639 }
6640
6641 impl<'de> serde::de::Deserialize<'de> for ValueType {
6642 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6643 where
6644 D: serde::Deserializer<'de>,
6645 {
6646 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ValueType>::new(
6647 ".google.api.LabelDescriptor.ValueType",
6648 ))
6649 }
6650 }
6651}
6652
6653/// A description of a log type. Example in YAML format:
6654///
6655/// ```norust
6656/// - name: library.googleapis.com/activity_history
6657/// description: The history of borrowing and returning library items.
6658/// display_name: Activity
6659/// labels:
6660/// - key: /customer_id
6661/// description: Identifier of a library customer
6662/// ```
6663#[derive(Clone, Default, PartialEq)]
6664#[non_exhaustive]
6665pub struct LogDescriptor {
6666 /// The name of the log. It must be less than 512 characters long and can
6667 /// include the following characters: upper- and lower-case alphanumeric
6668 /// characters [A-Za-z0-9], and punctuation characters including
6669 /// slash, underscore, hyphen, period [/_-.].
6670 pub name: std::string::String,
6671
6672 /// The set of labels that are available to describe a specific log entry.
6673 /// Runtime requests that contain labels not specified here are
6674 /// considered invalid.
6675 pub labels: std::vec::Vec<crate::model::LabelDescriptor>,
6676
6677 /// A human-readable description of this log. This information appears in
6678 /// the documentation and can contain details.
6679 pub description: std::string::String,
6680
6681 /// The human-readable name for this log. This information appears on
6682 /// the user interface and should be concise.
6683 pub display_name: std::string::String,
6684
6685 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6686}
6687
6688impl LogDescriptor {
6689 pub fn new() -> Self {
6690 std::default::Default::default()
6691 }
6692
6693 /// Sets the value of [name][crate::model::LogDescriptor::name].
6694 ///
6695 /// # Example
6696 /// ```ignore,no_run
6697 /// # use google_cloud_api::model::LogDescriptor;
6698 /// let x = LogDescriptor::new().set_name("example");
6699 /// ```
6700 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6701 self.name = v.into();
6702 self
6703 }
6704
6705 /// Sets the value of [labels][crate::model::LogDescriptor::labels].
6706 ///
6707 /// # Example
6708 /// ```ignore,no_run
6709 /// # use google_cloud_api::model::LogDescriptor;
6710 /// use google_cloud_api::model::LabelDescriptor;
6711 /// let x = LogDescriptor::new()
6712 /// .set_labels([
6713 /// LabelDescriptor::default()/* use setters */,
6714 /// LabelDescriptor::default()/* use (different) setters */,
6715 /// ]);
6716 /// ```
6717 pub fn set_labels<T, V>(mut self, v: T) -> Self
6718 where
6719 T: std::iter::IntoIterator<Item = V>,
6720 V: std::convert::Into<crate::model::LabelDescriptor>,
6721 {
6722 use std::iter::Iterator;
6723 self.labels = v.into_iter().map(|i| i.into()).collect();
6724 self
6725 }
6726
6727 /// Sets the value of [description][crate::model::LogDescriptor::description].
6728 ///
6729 /// # Example
6730 /// ```ignore,no_run
6731 /// # use google_cloud_api::model::LogDescriptor;
6732 /// let x = LogDescriptor::new().set_description("example");
6733 /// ```
6734 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6735 self.description = v.into();
6736 self
6737 }
6738
6739 /// Sets the value of [display_name][crate::model::LogDescriptor::display_name].
6740 ///
6741 /// # Example
6742 /// ```ignore,no_run
6743 /// # use google_cloud_api::model::LogDescriptor;
6744 /// let x = LogDescriptor::new().set_display_name("example");
6745 /// ```
6746 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6747 self.display_name = v.into();
6748 self
6749 }
6750}
6751
6752impl wkt::message::Message for LogDescriptor {
6753 fn typename() -> &'static str {
6754 "type.googleapis.com/google.api.LogDescriptor"
6755 }
6756}
6757
6758/// Logging configuration of the service.
6759///
6760/// The following example shows how to configure logs to be sent to the
6761/// producer and consumer projects. In the example, the `activity_history`
6762/// log is sent to both the producer and consumer projects, whereas the
6763/// `purchase_history` log is only sent to the producer project.
6764///
6765/// ```norust
6766/// monitored_resources:
6767/// - type: library.googleapis.com/branch
6768/// labels:
6769/// - key: /city
6770/// description: The city where the library branch is located in.
6771/// - key: /name
6772/// description: The name of the branch.
6773/// logs:
6774/// - name: activity_history
6775/// labels:
6776/// - key: /customer_id
6777/// - name: purchase_history
6778/// logging:
6779/// producer_destinations:
6780/// - monitored_resource: library.googleapis.com/branch
6781/// logs:
6782/// - activity_history
6783/// - purchase_history
6784/// consumer_destinations:
6785/// - monitored_resource: library.googleapis.com/branch
6786/// logs:
6787/// - activity_history
6788/// ```
6789#[derive(Clone, Default, PartialEq)]
6790#[non_exhaustive]
6791pub struct Logging {
6792 /// Logging configurations for sending logs to the producer project.
6793 /// There can be multiple producer destinations, each one must have a
6794 /// different monitored resource type. A log can be used in at most
6795 /// one producer destination.
6796 pub producer_destinations: std::vec::Vec<crate::model::logging::LoggingDestination>,
6797
6798 /// Logging configurations for sending logs to the consumer project.
6799 /// There can be multiple consumer destinations, each one must have a
6800 /// different monitored resource type. A log can be used in at most
6801 /// one consumer destination.
6802 pub consumer_destinations: std::vec::Vec<crate::model::logging::LoggingDestination>,
6803
6804 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6805}
6806
6807impl Logging {
6808 pub fn new() -> Self {
6809 std::default::Default::default()
6810 }
6811
6812 /// Sets the value of [producer_destinations][crate::model::Logging::producer_destinations].
6813 ///
6814 /// # Example
6815 /// ```ignore,no_run
6816 /// # use google_cloud_api::model::Logging;
6817 /// use google_cloud_api::model::logging::LoggingDestination;
6818 /// let x = Logging::new()
6819 /// .set_producer_destinations([
6820 /// LoggingDestination::default()/* use setters */,
6821 /// LoggingDestination::default()/* use (different) setters */,
6822 /// ]);
6823 /// ```
6824 pub fn set_producer_destinations<T, V>(mut self, v: T) -> Self
6825 where
6826 T: std::iter::IntoIterator<Item = V>,
6827 V: std::convert::Into<crate::model::logging::LoggingDestination>,
6828 {
6829 use std::iter::Iterator;
6830 self.producer_destinations = v.into_iter().map(|i| i.into()).collect();
6831 self
6832 }
6833
6834 /// Sets the value of [consumer_destinations][crate::model::Logging::consumer_destinations].
6835 ///
6836 /// # Example
6837 /// ```ignore,no_run
6838 /// # use google_cloud_api::model::Logging;
6839 /// use google_cloud_api::model::logging::LoggingDestination;
6840 /// let x = Logging::new()
6841 /// .set_consumer_destinations([
6842 /// LoggingDestination::default()/* use setters */,
6843 /// LoggingDestination::default()/* use (different) setters */,
6844 /// ]);
6845 /// ```
6846 pub fn set_consumer_destinations<T, V>(mut self, v: T) -> Self
6847 where
6848 T: std::iter::IntoIterator<Item = V>,
6849 V: std::convert::Into<crate::model::logging::LoggingDestination>,
6850 {
6851 use std::iter::Iterator;
6852 self.consumer_destinations = v.into_iter().map(|i| i.into()).collect();
6853 self
6854 }
6855}
6856
6857impl wkt::message::Message for Logging {
6858 fn typename() -> &'static str {
6859 "type.googleapis.com/google.api.Logging"
6860 }
6861}
6862
6863/// Defines additional types related to [Logging].
6864pub mod logging {
6865 #[allow(unused_imports)]
6866 use super::*;
6867
6868 /// Configuration of a specific logging destination (the producer project
6869 /// or the consumer project).
6870 #[derive(Clone, Default, PartialEq)]
6871 #[non_exhaustive]
6872 pub struct LoggingDestination {
6873 /// The monitored resource type. The type must be defined in the
6874 /// [Service.monitored_resources][google.api.Service.monitored_resources]
6875 /// section.
6876 ///
6877 /// [google.api.Service.monitored_resources]: crate::model::Service::monitored_resources
6878 pub monitored_resource: std::string::String,
6879
6880 /// Names of the logs to be sent to this destination. Each name must
6881 /// be defined in the [Service.logs][google.api.Service.logs] section. If the
6882 /// log name is not a domain scoped name, it will be automatically prefixed
6883 /// with the service name followed by "/".
6884 ///
6885 /// [google.api.Service.logs]: crate::model::Service::logs
6886 pub logs: std::vec::Vec<std::string::String>,
6887
6888 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6889 }
6890
6891 impl LoggingDestination {
6892 pub fn new() -> Self {
6893 std::default::Default::default()
6894 }
6895
6896 /// Sets the value of [monitored_resource][crate::model::logging::LoggingDestination::monitored_resource].
6897 ///
6898 /// # Example
6899 /// ```ignore,no_run
6900 /// # use google_cloud_api::model::logging::LoggingDestination;
6901 /// let x = LoggingDestination::new().set_monitored_resource("example");
6902 /// ```
6903 pub fn set_monitored_resource<T: std::convert::Into<std::string::String>>(
6904 mut self,
6905 v: T,
6906 ) -> Self {
6907 self.monitored_resource = v.into();
6908 self
6909 }
6910
6911 /// Sets the value of [logs][crate::model::logging::LoggingDestination::logs].
6912 ///
6913 /// # Example
6914 /// ```ignore,no_run
6915 /// # use google_cloud_api::model::logging::LoggingDestination;
6916 /// let x = LoggingDestination::new().set_logs(["a", "b", "c"]);
6917 /// ```
6918 pub fn set_logs<T, V>(mut self, v: T) -> Self
6919 where
6920 T: std::iter::IntoIterator<Item = V>,
6921 V: std::convert::Into<std::string::String>,
6922 {
6923 use std::iter::Iterator;
6924 self.logs = v.into_iter().map(|i| i.into()).collect();
6925 self
6926 }
6927 }
6928
6929 impl wkt::message::Message for LoggingDestination {
6930 fn typename() -> &'static str {
6931 "type.googleapis.com/google.api.Logging.LoggingDestination"
6932 }
6933 }
6934}
6935
6936/// Defines a metric type and its schema. Once a metric descriptor is created,
6937/// deleting or altering it stops data collection and makes the metric type's
6938/// existing data unusable.
6939#[derive(Clone, Default, PartialEq)]
6940#[non_exhaustive]
6941pub struct MetricDescriptor {
6942 /// The resource name of the metric descriptor.
6943 pub name: std::string::String,
6944
6945 /// The metric type, including its DNS name prefix. The type is not
6946 /// URL-encoded. All user-defined metric types have the DNS name
6947 /// `custom.googleapis.com` or `external.googleapis.com`. Metric types should
6948 /// use a natural hierarchical grouping. For example:
6949 ///
6950 /// ```norust
6951 /// "custom.googleapis.com/invoice/paid/amount"
6952 /// "external.googleapis.com/prometheus/up"
6953 /// "appengine.googleapis.com/http/server/response_latencies"
6954 /// ```
6955 pub r#type: std::string::String,
6956
6957 /// The set of labels that can be used to describe a specific
6958 /// instance of this metric type. For example, the
6959 /// `appengine.googleapis.com/http/server/response_latencies` metric
6960 /// type has a label for the HTTP response code, `response_code`, so
6961 /// you can look at latencies for successful responses or just
6962 /// for responses that failed.
6963 pub labels: std::vec::Vec<crate::model::LabelDescriptor>,
6964
6965 /// Whether the metric records instantaneous values, changes to a value, etc.
6966 /// Some combinations of `metric_kind` and `value_type` might not be supported.
6967 pub metric_kind: crate::model::metric_descriptor::MetricKind,
6968
6969 /// Whether the measurement is an integer, a floating-point number, etc.
6970 /// Some combinations of `metric_kind` and `value_type` might not be supported.
6971 pub value_type: crate::model::metric_descriptor::ValueType,
6972
6973 /// The units in which the metric value is reported. It is only applicable
6974 /// if the `value_type` is `INT64`, `DOUBLE`, or `DISTRIBUTION`. The `unit`
6975 /// defines the representation of the stored metric values.
6976 ///
6977 /// Different systems might scale the values to be more easily displayed (so a
6978 /// value of `0.02kBy` _might_ be displayed as `20By`, and a value of
6979 /// `3523kBy` _might_ be displayed as `3.5MBy`). However, if the `unit` is
6980 /// `kBy`, then the value of the metric is always in thousands of bytes, no
6981 /// matter how it might be displayed.
6982 ///
6983 /// If you want a custom metric to record the exact number of CPU-seconds used
6984 /// by a job, you can create an `INT64 CUMULATIVE` metric whose `unit` is
6985 /// `s{CPU}` (or equivalently `1s{CPU}` or just `s`). If the job uses 12,005
6986 /// CPU-seconds, then the value is written as `12005`.
6987 ///
6988 /// Alternatively, if you want a custom metric to record data in a more
6989 /// granular way, you can create a `DOUBLE CUMULATIVE` metric whose `unit` is
6990 /// `ks{CPU}`, and then write the value `12.005` (which is `12005/1000`),
6991 /// or use `Kis{CPU}` and write `11.723` (which is `12005/1024`).
6992 ///
6993 /// The supported units are a subset of [The Unified Code for Units of
6994 /// Measure](https://unitsofmeasure.org/ucum.html) standard:
6995 ///
6996 /// **Basic units (UNIT)**
6997 ///
6998 /// * `bit` bit
6999 /// * `By` byte
7000 /// * `s` second
7001 /// * `min` minute
7002 /// * `h` hour
7003 /// * `d` day
7004 /// * `1` dimensionless
7005 ///
7006 /// **Prefixes (PREFIX)**
7007 ///
7008 /// * `k` kilo (10^3)
7009 ///
7010 /// * `M` mega (10^6)
7011 ///
7012 /// * `G` giga (10^9)
7013 ///
7014 /// * `T` tera (10^12)
7015 ///
7016 /// * `P` peta (10^15)
7017 ///
7018 /// * `E` exa (10^18)
7019 ///
7020 /// * `Z` zetta (10^21)
7021 ///
7022 /// * `Y` yotta (10^24)
7023 ///
7024 /// * `m` milli (10^-3)
7025 ///
7026 /// * `u` micro (10^-6)
7027 ///
7028 /// * `n` nano (10^-9)
7029 ///
7030 /// * `p` pico (10^-12)
7031 ///
7032 /// * `f` femto (10^-15)
7033 ///
7034 /// * `a` atto (10^-18)
7035 ///
7036 /// * `z` zepto (10^-21)
7037 ///
7038 /// * `y` yocto (10^-24)
7039 ///
7040 /// * `Ki` kibi (2^10)
7041 ///
7042 /// * `Mi` mebi (2^20)
7043 ///
7044 /// * `Gi` gibi (2^30)
7045 ///
7046 /// * `Ti` tebi (2^40)
7047 ///
7048 /// * `Pi` pebi (2^50)
7049 ///
7050 ///
7051 /// **Grammar**
7052 ///
7053 /// The grammar also includes these connectors:
7054 ///
7055 /// * `/` division or ratio (as an infix operator). For examples,
7056 /// `kBy/{email}` or `MiBy/10ms` (although you should almost never
7057 /// have `/s` in a metric `unit`; rates should always be computed at
7058 /// query time from the underlying cumulative or delta value).
7059 /// * `.` multiplication or composition (as an infix operator). For
7060 /// examples, `GBy.d` or `k{watt}.h`.
7061 ///
7062 /// The grammar for a unit is as follows:
7063 ///
7064 /// ```norust
7065 /// Expression = Component { "." Component } { "/" Component } ;
7066 ///
7067 /// Component = ( [ PREFIX ] UNIT | "%" ) [ Annotation ]
7068 /// | Annotation
7069 /// | "1"
7070 /// ;
7071 ///
7072 /// Annotation = "{" NAME "}" ;
7073 /// ```
7074 ///
7075 /// Notes:
7076 ///
7077 /// * `Annotation` is just a comment if it follows a `UNIT`. If the annotation
7078 /// is used alone, then the unit is equivalent to `1`. For examples,
7079 /// `{request}/s == 1/s`, `By{transmitted}/s == By/s`.
7080 /// * `NAME` is a sequence of non-blank printable ASCII characters not
7081 /// containing `{` or `}`.
7082 /// * `1` represents a unitary [dimensionless
7083 /// unit](https://en.wikipedia.org/wiki/Dimensionless_quantity) of 1, such
7084 /// as in `1/s`. It is typically used when none of the basic units are
7085 /// appropriate. For example, "new users per day" can be represented as
7086 /// `1/d` or `{new-users}/d` (and a metric value `5` would mean "5 new
7087 /// users). Alternatively, "thousands of page views per day" would be
7088 /// represented as `1000/d` or `k1/d` or `k{page_views}/d` (and a metric
7089 /// value of `5.3` would mean "5300 page views per day").
7090 /// * `%` represents dimensionless value of 1/100, and annotates values giving
7091 /// a percentage (so the metric values are typically in the range of 0..100,
7092 /// and a metric value `3` means "3 percent").
7093 /// * `10^2.%` indicates a metric contains a ratio, typically in the range
7094 /// 0..1, that will be multiplied by 100 and displayed as a percentage
7095 /// (so a metric value `0.03` means "3 percent").
7096 pub unit: std::string::String,
7097
7098 /// A detailed description of the metric, which can be used in documentation.
7099 pub description: std::string::String,
7100
7101 /// A concise name for the metric, which can be displayed in user interfaces.
7102 /// Use sentence case without an ending period, for example "Request count".
7103 /// This field is optional but it is recommended to be set for any metrics
7104 /// associated with user-visible concepts, such as Quota.
7105 pub display_name: std::string::String,
7106
7107 /// Optional. Metadata which can be used to guide usage of the metric.
7108 pub metadata: std::option::Option<crate::model::metric_descriptor::MetricDescriptorMetadata>,
7109
7110 /// Optional. The launch stage of the metric definition.
7111 pub launch_stage: crate::model::LaunchStage,
7112
7113 /// Read-only. If present, then a [time
7114 /// series][google.monitoring.v3.TimeSeries], which is identified partially by
7115 /// a metric type and a
7116 /// [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor], that
7117 /// is associated with this metric type can only be associated with one of the
7118 /// monitored resource types listed here.
7119 ///
7120 /// [google.api.MonitoredResourceDescriptor]: crate::model::MonitoredResourceDescriptor
7121 pub monitored_resource_types: std::vec::Vec<std::string::String>,
7122
7123 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7124}
7125
7126impl MetricDescriptor {
7127 pub fn new() -> Self {
7128 std::default::Default::default()
7129 }
7130
7131 /// Sets the value of [name][crate::model::MetricDescriptor::name].
7132 ///
7133 /// # Example
7134 /// ```ignore,no_run
7135 /// # use google_cloud_api::model::MetricDescriptor;
7136 /// let x = MetricDescriptor::new().set_name("example");
7137 /// ```
7138 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7139 self.name = v.into();
7140 self
7141 }
7142
7143 /// Sets the value of [r#type][crate::model::MetricDescriptor::type].
7144 ///
7145 /// # Example
7146 /// ```ignore,no_run
7147 /// # use google_cloud_api::model::MetricDescriptor;
7148 /// let x = MetricDescriptor::new().set_type("example");
7149 /// ```
7150 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7151 self.r#type = v.into();
7152 self
7153 }
7154
7155 /// Sets the value of [labels][crate::model::MetricDescriptor::labels].
7156 ///
7157 /// # Example
7158 /// ```ignore,no_run
7159 /// # use google_cloud_api::model::MetricDescriptor;
7160 /// use google_cloud_api::model::LabelDescriptor;
7161 /// let x = MetricDescriptor::new()
7162 /// .set_labels([
7163 /// LabelDescriptor::default()/* use setters */,
7164 /// LabelDescriptor::default()/* use (different) setters */,
7165 /// ]);
7166 /// ```
7167 pub fn set_labels<T, V>(mut self, v: T) -> Self
7168 where
7169 T: std::iter::IntoIterator<Item = V>,
7170 V: std::convert::Into<crate::model::LabelDescriptor>,
7171 {
7172 use std::iter::Iterator;
7173 self.labels = v.into_iter().map(|i| i.into()).collect();
7174 self
7175 }
7176
7177 /// Sets the value of [metric_kind][crate::model::MetricDescriptor::metric_kind].
7178 ///
7179 /// # Example
7180 /// ```ignore,no_run
7181 /// # use google_cloud_api::model::MetricDescriptor;
7182 /// use google_cloud_api::model::metric_descriptor::MetricKind;
7183 /// let x0 = MetricDescriptor::new().set_metric_kind(MetricKind::Gauge);
7184 /// let x1 = MetricDescriptor::new().set_metric_kind(MetricKind::Delta);
7185 /// let x2 = MetricDescriptor::new().set_metric_kind(MetricKind::Cumulative);
7186 /// ```
7187 pub fn set_metric_kind<T: std::convert::Into<crate::model::metric_descriptor::MetricKind>>(
7188 mut self,
7189 v: T,
7190 ) -> Self {
7191 self.metric_kind = v.into();
7192 self
7193 }
7194
7195 /// Sets the value of [value_type][crate::model::MetricDescriptor::value_type].
7196 ///
7197 /// # Example
7198 /// ```ignore,no_run
7199 /// # use google_cloud_api::model::MetricDescriptor;
7200 /// use google_cloud_api::model::metric_descriptor::ValueType;
7201 /// let x0 = MetricDescriptor::new().set_value_type(ValueType::Bool);
7202 /// let x1 = MetricDescriptor::new().set_value_type(ValueType::Int64);
7203 /// let x2 = MetricDescriptor::new().set_value_type(ValueType::Double);
7204 /// ```
7205 pub fn set_value_type<T: std::convert::Into<crate::model::metric_descriptor::ValueType>>(
7206 mut self,
7207 v: T,
7208 ) -> Self {
7209 self.value_type = v.into();
7210 self
7211 }
7212
7213 /// Sets the value of [unit][crate::model::MetricDescriptor::unit].
7214 ///
7215 /// # Example
7216 /// ```ignore,no_run
7217 /// # use google_cloud_api::model::MetricDescriptor;
7218 /// let x = MetricDescriptor::new().set_unit("example");
7219 /// ```
7220 pub fn set_unit<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7221 self.unit = v.into();
7222 self
7223 }
7224
7225 /// Sets the value of [description][crate::model::MetricDescriptor::description].
7226 ///
7227 /// # Example
7228 /// ```ignore,no_run
7229 /// # use google_cloud_api::model::MetricDescriptor;
7230 /// let x = MetricDescriptor::new().set_description("example");
7231 /// ```
7232 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7233 self.description = v.into();
7234 self
7235 }
7236
7237 /// Sets the value of [display_name][crate::model::MetricDescriptor::display_name].
7238 ///
7239 /// # Example
7240 /// ```ignore,no_run
7241 /// # use google_cloud_api::model::MetricDescriptor;
7242 /// let x = MetricDescriptor::new().set_display_name("example");
7243 /// ```
7244 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7245 self.display_name = v.into();
7246 self
7247 }
7248
7249 /// Sets the value of [metadata][crate::model::MetricDescriptor::metadata].
7250 ///
7251 /// # Example
7252 /// ```ignore,no_run
7253 /// # use google_cloud_api::model::MetricDescriptor;
7254 /// use google_cloud_api::model::metric_descriptor::MetricDescriptorMetadata;
7255 /// let x = MetricDescriptor::new().set_metadata(MetricDescriptorMetadata::default()/* use setters */);
7256 /// ```
7257 pub fn set_metadata<T>(mut self, v: T) -> Self
7258 where
7259 T: std::convert::Into<crate::model::metric_descriptor::MetricDescriptorMetadata>,
7260 {
7261 self.metadata = std::option::Option::Some(v.into());
7262 self
7263 }
7264
7265 /// Sets or clears the value of [metadata][crate::model::MetricDescriptor::metadata].
7266 ///
7267 /// # Example
7268 /// ```ignore,no_run
7269 /// # use google_cloud_api::model::MetricDescriptor;
7270 /// use google_cloud_api::model::metric_descriptor::MetricDescriptorMetadata;
7271 /// let x = MetricDescriptor::new().set_or_clear_metadata(Some(MetricDescriptorMetadata::default()/* use setters */));
7272 /// let x = MetricDescriptor::new().set_or_clear_metadata(None::<MetricDescriptorMetadata>);
7273 /// ```
7274 pub fn set_or_clear_metadata<T>(mut self, v: std::option::Option<T>) -> Self
7275 where
7276 T: std::convert::Into<crate::model::metric_descriptor::MetricDescriptorMetadata>,
7277 {
7278 self.metadata = v.map(|x| x.into());
7279 self
7280 }
7281
7282 /// Sets the value of [launch_stage][crate::model::MetricDescriptor::launch_stage].
7283 ///
7284 /// # Example
7285 /// ```ignore,no_run
7286 /// # use google_cloud_api::model::MetricDescriptor;
7287 /// use google_cloud_api::model::LaunchStage;
7288 /// let x0 = MetricDescriptor::new().set_launch_stage(LaunchStage::Unimplemented);
7289 /// let x1 = MetricDescriptor::new().set_launch_stage(LaunchStage::Prelaunch);
7290 /// let x2 = MetricDescriptor::new().set_launch_stage(LaunchStage::EarlyAccess);
7291 /// ```
7292 pub fn set_launch_stage<T: std::convert::Into<crate::model::LaunchStage>>(
7293 mut self,
7294 v: T,
7295 ) -> Self {
7296 self.launch_stage = v.into();
7297 self
7298 }
7299
7300 /// Sets the value of [monitored_resource_types][crate::model::MetricDescriptor::monitored_resource_types].
7301 ///
7302 /// # Example
7303 /// ```ignore,no_run
7304 /// # use google_cloud_api::model::MetricDescriptor;
7305 /// let x = MetricDescriptor::new().set_monitored_resource_types(["a", "b", "c"]);
7306 /// ```
7307 pub fn set_monitored_resource_types<T, V>(mut self, v: T) -> Self
7308 where
7309 T: std::iter::IntoIterator<Item = V>,
7310 V: std::convert::Into<std::string::String>,
7311 {
7312 use std::iter::Iterator;
7313 self.monitored_resource_types = v.into_iter().map(|i| i.into()).collect();
7314 self
7315 }
7316}
7317
7318impl wkt::message::Message for MetricDescriptor {
7319 fn typename() -> &'static str {
7320 "type.googleapis.com/google.api.MetricDescriptor"
7321 }
7322}
7323
7324/// Defines additional types related to [MetricDescriptor].
7325pub mod metric_descriptor {
7326 #[allow(unused_imports)]
7327 use super::*;
7328
7329 /// Additional annotations that can be used to guide the usage of a metric.
7330 #[derive(Clone, Default, PartialEq)]
7331 #[non_exhaustive]
7332 pub struct MetricDescriptorMetadata {
7333
7334 /// Deprecated. Must use the
7335 /// [MetricDescriptor.launch_stage][google.api.MetricDescriptor.launch_stage]
7336 /// instead.
7337 ///
7338 /// [google.api.MetricDescriptor.launch_stage]: crate::model::MetricDescriptor::launch_stage
7339 #[deprecated]
7340 pub launch_stage: crate::model::LaunchStage,
7341
7342 /// The sampling period of metric data points. For metrics which are written
7343 /// periodically, consecutive data points are stored at this time interval,
7344 /// excluding data loss due to errors. Metrics with a higher granularity have
7345 /// a smaller sampling period.
7346 pub sample_period: std::option::Option<wkt::Duration>,
7347
7348 /// The delay of data points caused by ingestion. Data points older than this
7349 /// age are guaranteed to be ingested and available to be read, excluding
7350 /// data loss due to errors.
7351 pub ingest_delay: std::option::Option<wkt::Duration>,
7352
7353 /// The scope of the timeseries data of the metric.
7354 pub time_series_resource_hierarchy_level: std::vec::Vec<crate::model::metric_descriptor::metric_descriptor_metadata::TimeSeriesResourceHierarchyLevel>,
7355
7356 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7357 }
7358
7359 impl MetricDescriptorMetadata {
7360 pub fn new() -> Self {
7361 std::default::Default::default()
7362 }
7363
7364 /// Sets the value of [launch_stage][crate::model::metric_descriptor::MetricDescriptorMetadata::launch_stage].
7365 ///
7366 /// # Example
7367 /// ```ignore,no_run
7368 /// # use google_cloud_api::model::metric_descriptor::MetricDescriptorMetadata;
7369 /// use google_cloud_api::model::LaunchStage;
7370 /// let x0 = MetricDescriptorMetadata::new().set_launch_stage(LaunchStage::Unimplemented);
7371 /// let x1 = MetricDescriptorMetadata::new().set_launch_stage(LaunchStage::Prelaunch);
7372 /// let x2 = MetricDescriptorMetadata::new().set_launch_stage(LaunchStage::EarlyAccess);
7373 /// ```
7374 #[deprecated]
7375 pub fn set_launch_stage<T: std::convert::Into<crate::model::LaunchStage>>(
7376 mut self,
7377 v: T,
7378 ) -> Self {
7379 self.launch_stage = v.into();
7380 self
7381 }
7382
7383 /// Sets the value of [sample_period][crate::model::metric_descriptor::MetricDescriptorMetadata::sample_period].
7384 ///
7385 /// # Example
7386 /// ```ignore,no_run
7387 /// # use google_cloud_api::model::metric_descriptor::MetricDescriptorMetadata;
7388 /// use wkt::Duration;
7389 /// let x = MetricDescriptorMetadata::new().set_sample_period(Duration::default()/* use setters */);
7390 /// ```
7391 pub fn set_sample_period<T>(mut self, v: T) -> Self
7392 where
7393 T: std::convert::Into<wkt::Duration>,
7394 {
7395 self.sample_period = std::option::Option::Some(v.into());
7396 self
7397 }
7398
7399 /// Sets or clears the value of [sample_period][crate::model::metric_descriptor::MetricDescriptorMetadata::sample_period].
7400 ///
7401 /// # Example
7402 /// ```ignore,no_run
7403 /// # use google_cloud_api::model::metric_descriptor::MetricDescriptorMetadata;
7404 /// use wkt::Duration;
7405 /// let x = MetricDescriptorMetadata::new().set_or_clear_sample_period(Some(Duration::default()/* use setters */));
7406 /// let x = MetricDescriptorMetadata::new().set_or_clear_sample_period(None::<Duration>);
7407 /// ```
7408 pub fn set_or_clear_sample_period<T>(mut self, v: std::option::Option<T>) -> Self
7409 where
7410 T: std::convert::Into<wkt::Duration>,
7411 {
7412 self.sample_period = v.map(|x| x.into());
7413 self
7414 }
7415
7416 /// Sets the value of [ingest_delay][crate::model::metric_descriptor::MetricDescriptorMetadata::ingest_delay].
7417 ///
7418 /// # Example
7419 /// ```ignore,no_run
7420 /// # use google_cloud_api::model::metric_descriptor::MetricDescriptorMetadata;
7421 /// use wkt::Duration;
7422 /// let x = MetricDescriptorMetadata::new().set_ingest_delay(Duration::default()/* use setters */);
7423 /// ```
7424 pub fn set_ingest_delay<T>(mut self, v: T) -> Self
7425 where
7426 T: std::convert::Into<wkt::Duration>,
7427 {
7428 self.ingest_delay = std::option::Option::Some(v.into());
7429 self
7430 }
7431
7432 /// Sets or clears the value of [ingest_delay][crate::model::metric_descriptor::MetricDescriptorMetadata::ingest_delay].
7433 ///
7434 /// # Example
7435 /// ```ignore,no_run
7436 /// # use google_cloud_api::model::metric_descriptor::MetricDescriptorMetadata;
7437 /// use wkt::Duration;
7438 /// let x = MetricDescriptorMetadata::new().set_or_clear_ingest_delay(Some(Duration::default()/* use setters */));
7439 /// let x = MetricDescriptorMetadata::new().set_or_clear_ingest_delay(None::<Duration>);
7440 /// ```
7441 pub fn set_or_clear_ingest_delay<T>(mut self, v: std::option::Option<T>) -> Self
7442 where
7443 T: std::convert::Into<wkt::Duration>,
7444 {
7445 self.ingest_delay = v.map(|x| x.into());
7446 self
7447 }
7448
7449 /// Sets the value of [time_series_resource_hierarchy_level][crate::model::metric_descriptor::MetricDescriptorMetadata::time_series_resource_hierarchy_level].
7450 ///
7451 /// # Example
7452 /// ```ignore,no_run
7453 /// # use google_cloud_api::model::metric_descriptor::MetricDescriptorMetadata;
7454 /// use google_cloud_api::model::metric_descriptor::metric_descriptor_metadata::TimeSeriesResourceHierarchyLevel;
7455 /// let x = MetricDescriptorMetadata::new().set_time_series_resource_hierarchy_level([
7456 /// TimeSeriesResourceHierarchyLevel::Project,
7457 /// TimeSeriesResourceHierarchyLevel::Organization,
7458 /// TimeSeriesResourceHierarchyLevel::Folder,
7459 /// ]);
7460 /// ```
7461 pub fn set_time_series_resource_hierarchy_level<T, V>(mut self, v: T) -> Self
7462 where
7463 T: std::iter::IntoIterator<Item = V>,
7464 V: std::convert::Into<crate::model::metric_descriptor::metric_descriptor_metadata::TimeSeriesResourceHierarchyLevel>
7465 {
7466 use std::iter::Iterator;
7467 self.time_series_resource_hierarchy_level = v.into_iter().map(|i| i.into()).collect();
7468 self
7469 }
7470 }
7471
7472 impl wkt::message::Message for MetricDescriptorMetadata {
7473 fn typename() -> &'static str {
7474 "type.googleapis.com/google.api.MetricDescriptor.MetricDescriptorMetadata"
7475 }
7476 }
7477
7478 /// Defines additional types related to [MetricDescriptorMetadata].
7479 pub mod metric_descriptor_metadata {
7480 #[allow(unused_imports)]
7481 use super::*;
7482
7483 /// The resource hierarchy level of the timeseries data of a metric.
7484 ///
7485 /// # Working with unknown values
7486 ///
7487 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7488 /// additional enum variants at any time. Adding new variants is not considered
7489 /// a breaking change. Applications should write their code in anticipation of:
7490 ///
7491 /// - New values appearing in future releases of the client library, **and**
7492 /// - New values received dynamically, without application changes.
7493 ///
7494 /// Please consult the [Working with enums] section in the user guide for some
7495 /// guidelines.
7496 ///
7497 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
7498 #[derive(Clone, Debug, PartialEq)]
7499 #[non_exhaustive]
7500 pub enum TimeSeriesResourceHierarchyLevel {
7501 /// Do not use this default value.
7502 Unspecified,
7503 /// Scopes a metric to a project.
7504 Project,
7505 /// Scopes a metric to an organization.
7506 Organization,
7507 /// Scopes a metric to a folder.
7508 Folder,
7509 /// If set, the enum was initialized with an unknown value.
7510 ///
7511 /// Applications can examine the value using [TimeSeriesResourceHierarchyLevel::value] or
7512 /// [TimeSeriesResourceHierarchyLevel::name].
7513 UnknownValue(time_series_resource_hierarchy_level::UnknownValue),
7514 }
7515
7516 #[doc(hidden)]
7517 pub mod time_series_resource_hierarchy_level {
7518 #[allow(unused_imports)]
7519 use super::*;
7520 #[derive(Clone, Debug, PartialEq)]
7521 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7522 }
7523
7524 impl TimeSeriesResourceHierarchyLevel {
7525 /// Gets the enum value.
7526 ///
7527 /// Returns `None` if the enum contains an unknown value deserialized from
7528 /// the string representation of enums.
7529 pub fn value(&self) -> std::option::Option<i32> {
7530 match self {
7531 Self::Unspecified => std::option::Option::Some(0),
7532 Self::Project => std::option::Option::Some(1),
7533 Self::Organization => std::option::Option::Some(2),
7534 Self::Folder => std::option::Option::Some(3),
7535 Self::UnknownValue(u) => u.0.value(),
7536 }
7537 }
7538
7539 /// Gets the enum value as a string.
7540 ///
7541 /// Returns `None` if the enum contains an unknown value deserialized from
7542 /// the integer representation of enums.
7543 pub fn name(&self) -> std::option::Option<&str> {
7544 match self {
7545 Self::Unspecified => std::option::Option::Some(
7546 "TIME_SERIES_RESOURCE_HIERARCHY_LEVEL_UNSPECIFIED",
7547 ),
7548 Self::Project => std::option::Option::Some("PROJECT"),
7549 Self::Organization => std::option::Option::Some("ORGANIZATION"),
7550 Self::Folder => std::option::Option::Some("FOLDER"),
7551 Self::UnknownValue(u) => u.0.name(),
7552 }
7553 }
7554 }
7555
7556 impl std::default::Default for TimeSeriesResourceHierarchyLevel {
7557 fn default() -> Self {
7558 use std::convert::From;
7559 Self::from(0)
7560 }
7561 }
7562
7563 impl std::fmt::Display for TimeSeriesResourceHierarchyLevel {
7564 fn fmt(
7565 &self,
7566 f: &mut std::fmt::Formatter<'_>,
7567 ) -> std::result::Result<(), std::fmt::Error> {
7568 wkt::internal::display_enum(f, self.name(), self.value())
7569 }
7570 }
7571
7572 impl std::convert::From<i32> for TimeSeriesResourceHierarchyLevel {
7573 fn from(value: i32) -> Self {
7574 match value {
7575 0 => Self::Unspecified,
7576 1 => Self::Project,
7577 2 => Self::Organization,
7578 3 => Self::Folder,
7579 _ => Self::UnknownValue(time_series_resource_hierarchy_level::UnknownValue(
7580 wkt::internal::UnknownEnumValue::Integer(value),
7581 )),
7582 }
7583 }
7584 }
7585
7586 impl std::convert::From<&str> for TimeSeriesResourceHierarchyLevel {
7587 fn from(value: &str) -> Self {
7588 use std::string::ToString;
7589 match value {
7590 "TIME_SERIES_RESOURCE_HIERARCHY_LEVEL_UNSPECIFIED" => Self::Unspecified,
7591 "PROJECT" => Self::Project,
7592 "ORGANIZATION" => Self::Organization,
7593 "FOLDER" => Self::Folder,
7594 _ => Self::UnknownValue(time_series_resource_hierarchy_level::UnknownValue(
7595 wkt::internal::UnknownEnumValue::String(value.to_string()),
7596 )),
7597 }
7598 }
7599 }
7600
7601 impl serde::ser::Serialize for TimeSeriesResourceHierarchyLevel {
7602 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7603 where
7604 S: serde::Serializer,
7605 {
7606 match self {
7607 Self::Unspecified => serializer.serialize_i32(0),
7608 Self::Project => serializer.serialize_i32(1),
7609 Self::Organization => serializer.serialize_i32(2),
7610 Self::Folder => serializer.serialize_i32(3),
7611 Self::UnknownValue(u) => u.0.serialize(serializer),
7612 }
7613 }
7614 }
7615
7616 impl<'de> serde::de::Deserialize<'de> for TimeSeriesResourceHierarchyLevel {
7617 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7618 where
7619 D: serde::Deserializer<'de>,
7620 {
7621 deserializer.deserialize_any(wkt::internal::EnumVisitor::<TimeSeriesResourceHierarchyLevel>::new(
7622 ".google.api.MetricDescriptor.MetricDescriptorMetadata.TimeSeriesResourceHierarchyLevel"))
7623 }
7624 }
7625 }
7626
7627 /// The kind of measurement. It describes how the data is reported.
7628 /// For information on setting the start time and end time based on
7629 /// the MetricKind, see [TimeInterval][google.monitoring.v3.TimeInterval].
7630 ///
7631 /// # Working with unknown values
7632 ///
7633 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7634 /// additional enum variants at any time. Adding new variants is not considered
7635 /// a breaking change. Applications should write their code in anticipation of:
7636 ///
7637 /// - New values appearing in future releases of the client library, **and**
7638 /// - New values received dynamically, without application changes.
7639 ///
7640 /// Please consult the [Working with enums] section in the user guide for some
7641 /// guidelines.
7642 ///
7643 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
7644 #[derive(Clone, Debug, PartialEq)]
7645 #[non_exhaustive]
7646 pub enum MetricKind {
7647 /// Do not use this default value.
7648 Unspecified,
7649 /// An instantaneous measurement of a value.
7650 Gauge,
7651 /// The change in a value during a time interval.
7652 Delta,
7653 /// A value accumulated over a time interval. Cumulative
7654 /// measurements in a time series should have the same start time
7655 /// and increasing end times, until an event resets the cumulative
7656 /// value to zero and sets a new start time for the following
7657 /// points.
7658 Cumulative,
7659 /// If set, the enum was initialized with an unknown value.
7660 ///
7661 /// Applications can examine the value using [MetricKind::value] or
7662 /// [MetricKind::name].
7663 UnknownValue(metric_kind::UnknownValue),
7664 }
7665
7666 #[doc(hidden)]
7667 pub mod metric_kind {
7668 #[allow(unused_imports)]
7669 use super::*;
7670 #[derive(Clone, Debug, PartialEq)]
7671 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7672 }
7673
7674 impl MetricKind {
7675 /// Gets the enum value.
7676 ///
7677 /// Returns `None` if the enum contains an unknown value deserialized from
7678 /// the string representation of enums.
7679 pub fn value(&self) -> std::option::Option<i32> {
7680 match self {
7681 Self::Unspecified => std::option::Option::Some(0),
7682 Self::Gauge => std::option::Option::Some(1),
7683 Self::Delta => std::option::Option::Some(2),
7684 Self::Cumulative => std::option::Option::Some(3),
7685 Self::UnknownValue(u) => u.0.value(),
7686 }
7687 }
7688
7689 /// Gets the enum value as a string.
7690 ///
7691 /// Returns `None` if the enum contains an unknown value deserialized from
7692 /// the integer representation of enums.
7693 pub fn name(&self) -> std::option::Option<&str> {
7694 match self {
7695 Self::Unspecified => std::option::Option::Some("METRIC_KIND_UNSPECIFIED"),
7696 Self::Gauge => std::option::Option::Some("GAUGE"),
7697 Self::Delta => std::option::Option::Some("DELTA"),
7698 Self::Cumulative => std::option::Option::Some("CUMULATIVE"),
7699 Self::UnknownValue(u) => u.0.name(),
7700 }
7701 }
7702 }
7703
7704 impl std::default::Default for MetricKind {
7705 fn default() -> Self {
7706 use std::convert::From;
7707 Self::from(0)
7708 }
7709 }
7710
7711 impl std::fmt::Display for MetricKind {
7712 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7713 wkt::internal::display_enum(f, self.name(), self.value())
7714 }
7715 }
7716
7717 impl std::convert::From<i32> for MetricKind {
7718 fn from(value: i32) -> Self {
7719 match value {
7720 0 => Self::Unspecified,
7721 1 => Self::Gauge,
7722 2 => Self::Delta,
7723 3 => Self::Cumulative,
7724 _ => Self::UnknownValue(metric_kind::UnknownValue(
7725 wkt::internal::UnknownEnumValue::Integer(value),
7726 )),
7727 }
7728 }
7729 }
7730
7731 impl std::convert::From<&str> for MetricKind {
7732 fn from(value: &str) -> Self {
7733 use std::string::ToString;
7734 match value {
7735 "METRIC_KIND_UNSPECIFIED" => Self::Unspecified,
7736 "GAUGE" => Self::Gauge,
7737 "DELTA" => Self::Delta,
7738 "CUMULATIVE" => Self::Cumulative,
7739 _ => Self::UnknownValue(metric_kind::UnknownValue(
7740 wkt::internal::UnknownEnumValue::String(value.to_string()),
7741 )),
7742 }
7743 }
7744 }
7745
7746 impl serde::ser::Serialize for MetricKind {
7747 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7748 where
7749 S: serde::Serializer,
7750 {
7751 match self {
7752 Self::Unspecified => serializer.serialize_i32(0),
7753 Self::Gauge => serializer.serialize_i32(1),
7754 Self::Delta => serializer.serialize_i32(2),
7755 Self::Cumulative => serializer.serialize_i32(3),
7756 Self::UnknownValue(u) => u.0.serialize(serializer),
7757 }
7758 }
7759 }
7760
7761 impl<'de> serde::de::Deserialize<'de> for MetricKind {
7762 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7763 where
7764 D: serde::Deserializer<'de>,
7765 {
7766 deserializer.deserialize_any(wkt::internal::EnumVisitor::<MetricKind>::new(
7767 ".google.api.MetricDescriptor.MetricKind",
7768 ))
7769 }
7770 }
7771
7772 /// The value type of a metric.
7773 ///
7774 /// # Working with unknown values
7775 ///
7776 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7777 /// additional enum variants at any time. Adding new variants is not considered
7778 /// a breaking change. Applications should write their code in anticipation of:
7779 ///
7780 /// - New values appearing in future releases of the client library, **and**
7781 /// - New values received dynamically, without application changes.
7782 ///
7783 /// Please consult the [Working with enums] section in the user guide for some
7784 /// guidelines.
7785 ///
7786 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
7787 #[derive(Clone, Debug, PartialEq)]
7788 #[non_exhaustive]
7789 pub enum ValueType {
7790 /// Do not use this default value.
7791 Unspecified,
7792 /// The value is a boolean.
7793 /// This value type can be used only if the metric kind is `GAUGE`.
7794 Bool,
7795 /// The value is a signed 64-bit integer.
7796 Int64,
7797 /// The value is a double precision floating point number.
7798 Double,
7799 /// The value is a text string.
7800 /// This value type can be used only if the metric kind is `GAUGE`.
7801 String,
7802 /// The value is a [`Distribution`][google.api.Distribution].
7803 ///
7804 /// [google.api.Distribution]: crate::model::Distribution
7805 Distribution,
7806 /// The value is money.
7807 Money,
7808 /// If set, the enum was initialized with an unknown value.
7809 ///
7810 /// Applications can examine the value using [ValueType::value] or
7811 /// [ValueType::name].
7812 UnknownValue(value_type::UnknownValue),
7813 }
7814
7815 #[doc(hidden)]
7816 pub mod value_type {
7817 #[allow(unused_imports)]
7818 use super::*;
7819 #[derive(Clone, Debug, PartialEq)]
7820 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7821 }
7822
7823 impl ValueType {
7824 /// Gets the enum value.
7825 ///
7826 /// Returns `None` if the enum contains an unknown value deserialized from
7827 /// the string representation of enums.
7828 pub fn value(&self) -> std::option::Option<i32> {
7829 match self {
7830 Self::Unspecified => std::option::Option::Some(0),
7831 Self::Bool => std::option::Option::Some(1),
7832 Self::Int64 => std::option::Option::Some(2),
7833 Self::Double => std::option::Option::Some(3),
7834 Self::String => std::option::Option::Some(4),
7835 Self::Distribution => std::option::Option::Some(5),
7836 Self::Money => std::option::Option::Some(6),
7837 Self::UnknownValue(u) => u.0.value(),
7838 }
7839 }
7840
7841 /// Gets the enum value as a string.
7842 ///
7843 /// Returns `None` if the enum contains an unknown value deserialized from
7844 /// the integer representation of enums.
7845 pub fn name(&self) -> std::option::Option<&str> {
7846 match self {
7847 Self::Unspecified => std::option::Option::Some("VALUE_TYPE_UNSPECIFIED"),
7848 Self::Bool => std::option::Option::Some("BOOL"),
7849 Self::Int64 => std::option::Option::Some("INT64"),
7850 Self::Double => std::option::Option::Some("DOUBLE"),
7851 Self::String => std::option::Option::Some("STRING"),
7852 Self::Distribution => std::option::Option::Some("DISTRIBUTION"),
7853 Self::Money => std::option::Option::Some("MONEY"),
7854 Self::UnknownValue(u) => u.0.name(),
7855 }
7856 }
7857 }
7858
7859 impl std::default::Default for ValueType {
7860 fn default() -> Self {
7861 use std::convert::From;
7862 Self::from(0)
7863 }
7864 }
7865
7866 impl std::fmt::Display for ValueType {
7867 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7868 wkt::internal::display_enum(f, self.name(), self.value())
7869 }
7870 }
7871
7872 impl std::convert::From<i32> for ValueType {
7873 fn from(value: i32) -> Self {
7874 match value {
7875 0 => Self::Unspecified,
7876 1 => Self::Bool,
7877 2 => Self::Int64,
7878 3 => Self::Double,
7879 4 => Self::String,
7880 5 => Self::Distribution,
7881 6 => Self::Money,
7882 _ => Self::UnknownValue(value_type::UnknownValue(
7883 wkt::internal::UnknownEnumValue::Integer(value),
7884 )),
7885 }
7886 }
7887 }
7888
7889 impl std::convert::From<&str> for ValueType {
7890 fn from(value: &str) -> Self {
7891 use std::string::ToString;
7892 match value {
7893 "VALUE_TYPE_UNSPECIFIED" => Self::Unspecified,
7894 "BOOL" => Self::Bool,
7895 "INT64" => Self::Int64,
7896 "DOUBLE" => Self::Double,
7897 "STRING" => Self::String,
7898 "DISTRIBUTION" => Self::Distribution,
7899 "MONEY" => Self::Money,
7900 _ => Self::UnknownValue(value_type::UnknownValue(
7901 wkt::internal::UnknownEnumValue::String(value.to_string()),
7902 )),
7903 }
7904 }
7905 }
7906
7907 impl serde::ser::Serialize for ValueType {
7908 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7909 where
7910 S: serde::Serializer,
7911 {
7912 match self {
7913 Self::Unspecified => serializer.serialize_i32(0),
7914 Self::Bool => serializer.serialize_i32(1),
7915 Self::Int64 => serializer.serialize_i32(2),
7916 Self::Double => serializer.serialize_i32(3),
7917 Self::String => serializer.serialize_i32(4),
7918 Self::Distribution => serializer.serialize_i32(5),
7919 Self::Money => serializer.serialize_i32(6),
7920 Self::UnknownValue(u) => u.0.serialize(serializer),
7921 }
7922 }
7923 }
7924
7925 impl<'de> serde::de::Deserialize<'de> for ValueType {
7926 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7927 where
7928 D: serde::Deserializer<'de>,
7929 {
7930 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ValueType>::new(
7931 ".google.api.MetricDescriptor.ValueType",
7932 ))
7933 }
7934 }
7935}
7936
7937/// A specific metric, identified by specifying values for all of the
7938/// labels of a [`MetricDescriptor`][google.api.MetricDescriptor].
7939///
7940/// [google.api.MetricDescriptor]: crate::model::MetricDescriptor
7941#[derive(Clone, Default, PartialEq)]
7942#[non_exhaustive]
7943pub struct Metric {
7944 /// An existing metric type, see
7945 /// [google.api.MetricDescriptor][google.api.MetricDescriptor]. For example,
7946 /// `custom.googleapis.com/invoice/paid/amount`.
7947 ///
7948 /// [google.api.MetricDescriptor]: crate::model::MetricDescriptor
7949 pub r#type: std::string::String,
7950
7951 /// The set of label values that uniquely identify this metric. All
7952 /// labels listed in the `MetricDescriptor` must be assigned values.
7953 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
7954
7955 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7956}
7957
7958impl Metric {
7959 pub fn new() -> Self {
7960 std::default::Default::default()
7961 }
7962
7963 /// Sets the value of [r#type][crate::model::Metric::type].
7964 ///
7965 /// # Example
7966 /// ```ignore,no_run
7967 /// # use google_cloud_api::model::Metric;
7968 /// let x = Metric::new().set_type("example");
7969 /// ```
7970 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7971 self.r#type = v.into();
7972 self
7973 }
7974
7975 /// Sets the value of [labels][crate::model::Metric::labels].
7976 ///
7977 /// # Example
7978 /// ```ignore,no_run
7979 /// # use google_cloud_api::model::Metric;
7980 /// let x = Metric::new().set_labels([
7981 /// ("key0", "abc"),
7982 /// ("key1", "xyz"),
7983 /// ]);
7984 /// ```
7985 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
7986 where
7987 T: std::iter::IntoIterator<Item = (K, V)>,
7988 K: std::convert::Into<std::string::String>,
7989 V: std::convert::Into<std::string::String>,
7990 {
7991 use std::iter::Iterator;
7992 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7993 self
7994 }
7995}
7996
7997impl wkt::message::Message for Metric {
7998 fn typename() -> &'static str {
7999 "type.googleapis.com/google.api.Metric"
8000 }
8001}
8002
8003/// An object that describes the schema of a
8004/// [MonitoredResource][google.api.MonitoredResource] object using a type name
8005/// and a set of labels. For example, the monitored resource descriptor for
8006/// Google Compute Engine VM instances has a type of
8007/// `"gce_instance"` and specifies the use of the labels `"instance_id"` and
8008/// `"zone"` to identify particular VM instances.
8009///
8010/// Different APIs can support different monitored resource types. APIs generally
8011/// provide a `list` method that returns the monitored resource descriptors used
8012/// by the API.
8013///
8014/// [google.api.MonitoredResource]: crate::model::MonitoredResource
8015#[derive(Clone, Default, PartialEq)]
8016#[non_exhaustive]
8017pub struct MonitoredResourceDescriptor {
8018 /// Optional. The resource name of the monitored resource descriptor:
8019 /// `"projects/{project_id}/monitoredResourceDescriptors/{type}"` where
8020 /// {type} is the value of the `type` field in this object and
8021 /// {project_id} is a project ID that provides API-specific context for
8022 /// accessing the type. APIs that do not use project information can use the
8023 /// resource name format `"monitoredResourceDescriptors/{type}"`.
8024 pub name: std::string::String,
8025
8026 /// Required. The monitored resource type. For example, the type
8027 /// `"cloudsql_database"` represents databases in Google Cloud SQL.
8028 /// For a list of types, see [Monitored resource
8029 /// types](https://cloud.google.com/monitoring/api/resources)
8030 /// and [Logging resource
8031 /// types](https://cloud.google.com/logging/docs/api/v2/resource-list).
8032 pub r#type: std::string::String,
8033
8034 /// Optional. A concise name for the monitored resource type that might be
8035 /// displayed in user interfaces. It should be a Title Cased Noun Phrase,
8036 /// without any article or other determiners. For example,
8037 /// `"Google Cloud SQL Database"`.
8038 pub display_name: std::string::String,
8039
8040 /// Optional. A detailed description of the monitored resource type that might
8041 /// be used in documentation.
8042 pub description: std::string::String,
8043
8044 /// Required. A set of labels used to describe instances of this monitored
8045 /// resource type. For example, an individual Google Cloud SQL database is
8046 /// identified by values for the labels `"database_id"` and `"zone"`.
8047 pub labels: std::vec::Vec<crate::model::LabelDescriptor>,
8048
8049 /// Optional. The launch stage of the monitored resource definition.
8050 pub launch_stage: crate::model::LaunchStage,
8051
8052 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8053}
8054
8055impl MonitoredResourceDescriptor {
8056 pub fn new() -> Self {
8057 std::default::Default::default()
8058 }
8059
8060 /// Sets the value of [name][crate::model::MonitoredResourceDescriptor::name].
8061 ///
8062 /// # Example
8063 /// ```ignore,no_run
8064 /// # use google_cloud_api::model::MonitoredResourceDescriptor;
8065 /// let x = MonitoredResourceDescriptor::new().set_name("example");
8066 /// ```
8067 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8068 self.name = v.into();
8069 self
8070 }
8071
8072 /// Sets the value of [r#type][crate::model::MonitoredResourceDescriptor::type].
8073 ///
8074 /// # Example
8075 /// ```ignore,no_run
8076 /// # use google_cloud_api::model::MonitoredResourceDescriptor;
8077 /// let x = MonitoredResourceDescriptor::new().set_type("example");
8078 /// ```
8079 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8080 self.r#type = v.into();
8081 self
8082 }
8083
8084 /// Sets the value of [display_name][crate::model::MonitoredResourceDescriptor::display_name].
8085 ///
8086 /// # Example
8087 /// ```ignore,no_run
8088 /// # use google_cloud_api::model::MonitoredResourceDescriptor;
8089 /// let x = MonitoredResourceDescriptor::new().set_display_name("example");
8090 /// ```
8091 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8092 self.display_name = v.into();
8093 self
8094 }
8095
8096 /// Sets the value of [description][crate::model::MonitoredResourceDescriptor::description].
8097 ///
8098 /// # Example
8099 /// ```ignore,no_run
8100 /// # use google_cloud_api::model::MonitoredResourceDescriptor;
8101 /// let x = MonitoredResourceDescriptor::new().set_description("example");
8102 /// ```
8103 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8104 self.description = v.into();
8105 self
8106 }
8107
8108 /// Sets the value of [labels][crate::model::MonitoredResourceDescriptor::labels].
8109 ///
8110 /// # Example
8111 /// ```ignore,no_run
8112 /// # use google_cloud_api::model::MonitoredResourceDescriptor;
8113 /// use google_cloud_api::model::LabelDescriptor;
8114 /// let x = MonitoredResourceDescriptor::new()
8115 /// .set_labels([
8116 /// LabelDescriptor::default()/* use setters */,
8117 /// LabelDescriptor::default()/* use (different) setters */,
8118 /// ]);
8119 /// ```
8120 pub fn set_labels<T, V>(mut self, v: T) -> Self
8121 where
8122 T: std::iter::IntoIterator<Item = V>,
8123 V: std::convert::Into<crate::model::LabelDescriptor>,
8124 {
8125 use std::iter::Iterator;
8126 self.labels = v.into_iter().map(|i| i.into()).collect();
8127 self
8128 }
8129
8130 /// Sets the value of [launch_stage][crate::model::MonitoredResourceDescriptor::launch_stage].
8131 ///
8132 /// # Example
8133 /// ```ignore,no_run
8134 /// # use google_cloud_api::model::MonitoredResourceDescriptor;
8135 /// use google_cloud_api::model::LaunchStage;
8136 /// let x0 = MonitoredResourceDescriptor::new().set_launch_stage(LaunchStage::Unimplemented);
8137 /// let x1 = MonitoredResourceDescriptor::new().set_launch_stage(LaunchStage::Prelaunch);
8138 /// let x2 = MonitoredResourceDescriptor::new().set_launch_stage(LaunchStage::EarlyAccess);
8139 /// ```
8140 pub fn set_launch_stage<T: std::convert::Into<crate::model::LaunchStage>>(
8141 mut self,
8142 v: T,
8143 ) -> Self {
8144 self.launch_stage = v.into();
8145 self
8146 }
8147}
8148
8149impl wkt::message::Message for MonitoredResourceDescriptor {
8150 fn typename() -> &'static str {
8151 "type.googleapis.com/google.api.MonitoredResourceDescriptor"
8152 }
8153}
8154
8155/// An object representing a resource that can be used for monitoring, logging,
8156/// billing, or other purposes. Examples include virtual machine instances,
8157/// databases, and storage devices such as disks. The `type` field identifies a
8158/// [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] object
8159/// that describes the resource's schema. Information in the `labels` field
8160/// identifies the actual resource and its attributes according to the schema.
8161/// For example, a particular Compute Engine VM instance could be represented by
8162/// the following object, because the
8163/// [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] for
8164/// `"gce_instance"` has labels
8165/// `"project_id"`, `"instance_id"` and `"zone"`:
8166///
8167/// ```norust
8168/// { "type": "gce_instance",
8169/// "labels": { "project_id": "my-project",
8170/// "instance_id": "12345678901234",
8171/// "zone": "us-central1-a" }}
8172/// ```
8173///
8174/// [google.api.MonitoredResourceDescriptor]: crate::model::MonitoredResourceDescriptor
8175#[derive(Clone, Default, PartialEq)]
8176#[non_exhaustive]
8177pub struct MonitoredResource {
8178 /// Required. The monitored resource type. This field must match
8179 /// the `type` field of a
8180 /// [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor]
8181 /// object. For example, the type of a Compute Engine VM instance is
8182 /// `gce_instance`. Some descriptors include the service name in the type; for
8183 /// example, the type of a Datastream stream is
8184 /// `datastream.googleapis.com/Stream`.
8185 ///
8186 /// [google.api.MonitoredResourceDescriptor]: crate::model::MonitoredResourceDescriptor
8187 pub r#type: std::string::String,
8188
8189 /// Required. Values for all of the labels listed in the associated monitored
8190 /// resource descriptor. For example, Compute Engine VM instances use the
8191 /// labels `"project_id"`, `"instance_id"`, and `"zone"`.
8192 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
8193
8194 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8195}
8196
8197impl MonitoredResource {
8198 pub fn new() -> Self {
8199 std::default::Default::default()
8200 }
8201
8202 /// Sets the value of [r#type][crate::model::MonitoredResource::type].
8203 ///
8204 /// # Example
8205 /// ```ignore,no_run
8206 /// # use google_cloud_api::model::MonitoredResource;
8207 /// let x = MonitoredResource::new().set_type("example");
8208 /// ```
8209 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8210 self.r#type = v.into();
8211 self
8212 }
8213
8214 /// Sets the value of [labels][crate::model::MonitoredResource::labels].
8215 ///
8216 /// # Example
8217 /// ```ignore,no_run
8218 /// # use google_cloud_api::model::MonitoredResource;
8219 /// let x = MonitoredResource::new().set_labels([
8220 /// ("key0", "abc"),
8221 /// ("key1", "xyz"),
8222 /// ]);
8223 /// ```
8224 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
8225 where
8226 T: std::iter::IntoIterator<Item = (K, V)>,
8227 K: std::convert::Into<std::string::String>,
8228 V: std::convert::Into<std::string::String>,
8229 {
8230 use std::iter::Iterator;
8231 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8232 self
8233 }
8234}
8235
8236impl wkt::message::Message for MonitoredResource {
8237 fn typename() -> &'static str {
8238 "type.googleapis.com/google.api.MonitoredResource"
8239 }
8240}
8241
8242/// Auxiliary metadata for a [MonitoredResource][google.api.MonitoredResource]
8243/// object. [MonitoredResource][google.api.MonitoredResource] objects contain the
8244/// minimum set of information to uniquely identify a monitored resource
8245/// instance. There is some other useful auxiliary metadata. Monitoring and
8246/// Logging use an ingestion pipeline to extract metadata for cloud resources of
8247/// all types, and store the metadata in this message.
8248///
8249/// [google.api.MonitoredResource]: crate::model::MonitoredResource
8250#[derive(Clone, Default, PartialEq)]
8251#[non_exhaustive]
8252pub struct MonitoredResourceMetadata {
8253 /// Output only. Values for predefined system metadata labels.
8254 /// System labels are a kind of metadata extracted by Google, including
8255 /// "machine_image", "vpc", "subnet_id",
8256 /// "security_group", "name", etc.
8257 /// System label values can be only strings, Boolean values, or a list of
8258 /// strings. For example:
8259 ///
8260 /// ```norust
8261 /// { "name": "my-test-instance",
8262 /// "security_group": ["a", "b", "c"],
8263 /// "spot_instance": false }
8264 /// ```
8265 pub system_labels: std::option::Option<wkt::Struct>,
8266
8267 /// Output only. A map of user-defined metadata labels.
8268 pub user_labels: std::collections::HashMap<std::string::String, std::string::String>,
8269
8270 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8271}
8272
8273impl MonitoredResourceMetadata {
8274 pub fn new() -> Self {
8275 std::default::Default::default()
8276 }
8277
8278 /// Sets the value of [system_labels][crate::model::MonitoredResourceMetadata::system_labels].
8279 ///
8280 /// # Example
8281 /// ```ignore,no_run
8282 /// # use google_cloud_api::model::MonitoredResourceMetadata;
8283 /// use wkt::Struct;
8284 /// let x = MonitoredResourceMetadata::new().set_system_labels(Struct::default()/* use setters */);
8285 /// ```
8286 pub fn set_system_labels<T>(mut self, v: T) -> Self
8287 where
8288 T: std::convert::Into<wkt::Struct>,
8289 {
8290 self.system_labels = std::option::Option::Some(v.into());
8291 self
8292 }
8293
8294 /// Sets or clears the value of [system_labels][crate::model::MonitoredResourceMetadata::system_labels].
8295 ///
8296 /// # Example
8297 /// ```ignore,no_run
8298 /// # use google_cloud_api::model::MonitoredResourceMetadata;
8299 /// use wkt::Struct;
8300 /// let x = MonitoredResourceMetadata::new().set_or_clear_system_labels(Some(Struct::default()/* use setters */));
8301 /// let x = MonitoredResourceMetadata::new().set_or_clear_system_labels(None::<Struct>);
8302 /// ```
8303 pub fn set_or_clear_system_labels<T>(mut self, v: std::option::Option<T>) -> Self
8304 where
8305 T: std::convert::Into<wkt::Struct>,
8306 {
8307 self.system_labels = v.map(|x| x.into());
8308 self
8309 }
8310
8311 /// Sets the value of [user_labels][crate::model::MonitoredResourceMetadata::user_labels].
8312 ///
8313 /// # Example
8314 /// ```ignore,no_run
8315 /// # use google_cloud_api::model::MonitoredResourceMetadata;
8316 /// let x = MonitoredResourceMetadata::new().set_user_labels([
8317 /// ("key0", "abc"),
8318 /// ("key1", "xyz"),
8319 /// ]);
8320 /// ```
8321 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
8322 where
8323 T: std::iter::IntoIterator<Item = (K, V)>,
8324 K: std::convert::Into<std::string::String>,
8325 V: std::convert::Into<std::string::String>,
8326 {
8327 use std::iter::Iterator;
8328 self.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8329 self
8330 }
8331}
8332
8333impl wkt::message::Message for MonitoredResourceMetadata {
8334 fn typename() -> &'static str {
8335 "type.googleapis.com/google.api.MonitoredResourceMetadata"
8336 }
8337}
8338
8339/// Monitoring configuration of the service.
8340///
8341/// The example below shows how to configure monitored resources and metrics
8342/// for monitoring. In the example, a monitored resource and two metrics are
8343/// defined. The `library.googleapis.com/book/returned_count` metric is sent
8344/// to both producer and consumer projects, whereas the
8345/// `library.googleapis.com/book/num_overdue` metric is only sent to the
8346/// consumer project.
8347///
8348/// ```norust
8349/// monitored_resources:
8350/// - type: library.googleapis.com/Branch
8351/// display_name: "Library Branch"
8352/// description: "A branch of a library."
8353/// launch_stage: GA
8354/// labels:
8355/// - key: resource_container
8356/// description: "The Cloud container (ie. project id) for the Branch."
8357/// - key: location
8358/// description: "The location of the library branch."
8359/// - key: branch_id
8360/// description: "The id of the branch."
8361/// metrics:
8362/// - name: library.googleapis.com/book/returned_count
8363/// display_name: "Books Returned"
8364/// description: "The count of books that have been returned."
8365/// launch_stage: GA
8366/// metric_kind: DELTA
8367/// value_type: INT64
8368/// unit: "1"
8369/// labels:
8370/// - key: customer_id
8371/// description: "The id of the customer."
8372/// - name: library.googleapis.com/book/num_overdue
8373/// display_name: "Books Overdue"
8374/// description: "The current number of overdue books."
8375/// launch_stage: GA
8376/// metric_kind: GAUGE
8377/// value_type: INT64
8378/// unit: "1"
8379/// labels:
8380/// - key: customer_id
8381/// description: "The id of the customer."
8382/// monitoring:
8383/// producer_destinations:
8384/// - monitored_resource: library.googleapis.com/Branch
8385/// metrics:
8386/// - library.googleapis.com/book/returned_count
8387/// consumer_destinations:
8388/// - monitored_resource: library.googleapis.com/Branch
8389/// metrics:
8390/// - library.googleapis.com/book/returned_count
8391/// - library.googleapis.com/book/num_overdue
8392/// ```
8393#[derive(Clone, Default, PartialEq)]
8394#[non_exhaustive]
8395pub struct Monitoring {
8396 /// Monitoring configurations for sending metrics to the producer project.
8397 /// There can be multiple producer destinations. A monitored resource type may
8398 /// appear in multiple monitoring destinations if different aggregations are
8399 /// needed for different sets of metrics associated with that monitored
8400 /// resource type. A monitored resource and metric pair may only be used once
8401 /// in the Monitoring configuration.
8402 pub producer_destinations: std::vec::Vec<crate::model::monitoring::MonitoringDestination>,
8403
8404 /// Monitoring configurations for sending metrics to the consumer project.
8405 /// There can be multiple consumer destinations. A monitored resource type may
8406 /// appear in multiple monitoring destinations if different aggregations are
8407 /// needed for different sets of metrics associated with that monitored
8408 /// resource type. A monitored resource and metric pair may only be used once
8409 /// in the Monitoring configuration.
8410 pub consumer_destinations: std::vec::Vec<crate::model::monitoring::MonitoringDestination>,
8411
8412 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8413}
8414
8415impl Monitoring {
8416 pub fn new() -> Self {
8417 std::default::Default::default()
8418 }
8419
8420 /// Sets the value of [producer_destinations][crate::model::Monitoring::producer_destinations].
8421 ///
8422 /// # Example
8423 /// ```ignore,no_run
8424 /// # use google_cloud_api::model::Monitoring;
8425 /// use google_cloud_api::model::monitoring::MonitoringDestination;
8426 /// let x = Monitoring::new()
8427 /// .set_producer_destinations([
8428 /// MonitoringDestination::default()/* use setters */,
8429 /// MonitoringDestination::default()/* use (different) setters */,
8430 /// ]);
8431 /// ```
8432 pub fn set_producer_destinations<T, V>(mut self, v: T) -> Self
8433 where
8434 T: std::iter::IntoIterator<Item = V>,
8435 V: std::convert::Into<crate::model::monitoring::MonitoringDestination>,
8436 {
8437 use std::iter::Iterator;
8438 self.producer_destinations = v.into_iter().map(|i| i.into()).collect();
8439 self
8440 }
8441
8442 /// Sets the value of [consumer_destinations][crate::model::Monitoring::consumer_destinations].
8443 ///
8444 /// # Example
8445 /// ```ignore,no_run
8446 /// # use google_cloud_api::model::Monitoring;
8447 /// use google_cloud_api::model::monitoring::MonitoringDestination;
8448 /// let x = Monitoring::new()
8449 /// .set_consumer_destinations([
8450 /// MonitoringDestination::default()/* use setters */,
8451 /// MonitoringDestination::default()/* use (different) setters */,
8452 /// ]);
8453 /// ```
8454 pub fn set_consumer_destinations<T, V>(mut self, v: T) -> Self
8455 where
8456 T: std::iter::IntoIterator<Item = V>,
8457 V: std::convert::Into<crate::model::monitoring::MonitoringDestination>,
8458 {
8459 use std::iter::Iterator;
8460 self.consumer_destinations = v.into_iter().map(|i| i.into()).collect();
8461 self
8462 }
8463}
8464
8465impl wkt::message::Message for Monitoring {
8466 fn typename() -> &'static str {
8467 "type.googleapis.com/google.api.Monitoring"
8468 }
8469}
8470
8471/// Defines additional types related to [Monitoring].
8472pub mod monitoring {
8473 #[allow(unused_imports)]
8474 use super::*;
8475
8476 /// Configuration of a specific monitoring destination (the producer project
8477 /// or the consumer project).
8478 #[derive(Clone, Default, PartialEq)]
8479 #[non_exhaustive]
8480 pub struct MonitoringDestination {
8481 /// The monitored resource type. The type must be defined in
8482 /// [Service.monitored_resources][google.api.Service.monitored_resources]
8483 /// section.
8484 ///
8485 /// [google.api.Service.monitored_resources]: crate::model::Service::monitored_resources
8486 pub monitored_resource: std::string::String,
8487
8488 /// Types of the metrics to report to this monitoring destination.
8489 /// Each type must be defined in
8490 /// [Service.metrics][google.api.Service.metrics] section.
8491 ///
8492 /// [google.api.Service.metrics]: crate::model::Service::metrics
8493 pub metrics: std::vec::Vec<std::string::String>,
8494
8495 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8496 }
8497
8498 impl MonitoringDestination {
8499 pub fn new() -> Self {
8500 std::default::Default::default()
8501 }
8502
8503 /// Sets the value of [monitored_resource][crate::model::monitoring::MonitoringDestination::monitored_resource].
8504 ///
8505 /// # Example
8506 /// ```ignore,no_run
8507 /// # use google_cloud_api::model::monitoring::MonitoringDestination;
8508 /// let x = MonitoringDestination::new().set_monitored_resource("example");
8509 /// ```
8510 pub fn set_monitored_resource<T: std::convert::Into<std::string::String>>(
8511 mut self,
8512 v: T,
8513 ) -> Self {
8514 self.monitored_resource = v.into();
8515 self
8516 }
8517
8518 /// Sets the value of [metrics][crate::model::monitoring::MonitoringDestination::metrics].
8519 ///
8520 /// # Example
8521 /// ```ignore,no_run
8522 /// # use google_cloud_api::model::monitoring::MonitoringDestination;
8523 /// let x = MonitoringDestination::new().set_metrics(["a", "b", "c"]);
8524 /// ```
8525 pub fn set_metrics<T, V>(mut self, v: T) -> Self
8526 where
8527 T: std::iter::IntoIterator<Item = V>,
8528 V: std::convert::Into<std::string::String>,
8529 {
8530 use std::iter::Iterator;
8531 self.metrics = v.into_iter().map(|i| i.into()).collect();
8532 self
8533 }
8534 }
8535
8536 impl wkt::message::Message for MonitoringDestination {
8537 fn typename() -> &'static str {
8538 "type.googleapis.com/google.api.Monitoring.MonitoringDestination"
8539 }
8540 }
8541}
8542
8543/// Google API Policy Annotation
8544///
8545/// This message defines a simple API policy annotation that can be used to
8546/// annotate API request and response message fields with applicable policies.
8547/// One field may have multiple applicable policies that must all be satisfied
8548/// before a request can be processed. This policy annotation is used to
8549/// generate the overall policy that will be used for automatic runtime
8550/// policy enforcement and documentation generation.
8551#[derive(Clone, Default, PartialEq)]
8552#[non_exhaustive]
8553pub struct FieldPolicy {
8554 /// Selects one or more request or response message fields to apply this
8555 /// `FieldPolicy`.
8556 ///
8557 /// When a `FieldPolicy` is used in proto annotation, the selector must
8558 /// be left as empty. The service config generator will automatically fill
8559 /// the correct value.
8560 ///
8561 /// When a `FieldPolicy` is used in service config, the selector must be a
8562 /// comma-separated string with valid request or response field paths,
8563 /// such as "foo.bar" or "foo.bar,foo.baz".
8564 pub selector: std::string::String,
8565
8566 /// Specifies the required permission(s) for the resource referred to by the
8567 /// field. It requires the field contains a valid resource reference, and
8568 /// the request must pass the permission checks to proceed. For example,
8569 /// "resourcemanager.projects.get".
8570 pub resource_permission: std::string::String,
8571
8572 /// Specifies the resource type for the resource referred to by the field.
8573 pub resource_type: std::string::String,
8574
8575 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8576}
8577
8578impl FieldPolicy {
8579 pub fn new() -> Self {
8580 std::default::Default::default()
8581 }
8582
8583 /// Sets the value of [selector][crate::model::FieldPolicy::selector].
8584 ///
8585 /// # Example
8586 /// ```ignore,no_run
8587 /// # use google_cloud_api::model::FieldPolicy;
8588 /// let x = FieldPolicy::new().set_selector("example");
8589 /// ```
8590 pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8591 self.selector = v.into();
8592 self
8593 }
8594
8595 /// Sets the value of [resource_permission][crate::model::FieldPolicy::resource_permission].
8596 ///
8597 /// # Example
8598 /// ```ignore,no_run
8599 /// # use google_cloud_api::model::FieldPolicy;
8600 /// let x = FieldPolicy::new().set_resource_permission("example");
8601 /// ```
8602 pub fn set_resource_permission<T: std::convert::Into<std::string::String>>(
8603 mut self,
8604 v: T,
8605 ) -> Self {
8606 self.resource_permission = v.into();
8607 self
8608 }
8609
8610 /// Sets the value of [resource_type][crate::model::FieldPolicy::resource_type].
8611 ///
8612 /// # Example
8613 /// ```ignore,no_run
8614 /// # use google_cloud_api::model::FieldPolicy;
8615 /// let x = FieldPolicy::new().set_resource_type("example");
8616 /// ```
8617 pub fn set_resource_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8618 self.resource_type = v.into();
8619 self
8620 }
8621}
8622
8623impl wkt::message::Message for FieldPolicy {
8624 fn typename() -> &'static str {
8625 "type.googleapis.com/google.api.FieldPolicy"
8626 }
8627}
8628
8629/// Defines policies applying to an RPC method.
8630#[derive(Clone, Default, PartialEq)]
8631#[non_exhaustive]
8632pub struct MethodPolicy {
8633 /// Selects a method to which these policies should be enforced, for example,
8634 /// "google.pubsub.v1.Subscriber.CreateSubscription".
8635 ///
8636 /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
8637 /// details.
8638 ///
8639 /// NOTE: This field must not be set in the proto annotation. It will be
8640 /// automatically filled by the service config compiler .
8641 ///
8642 /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
8643 pub selector: std::string::String,
8644
8645 /// Policies that are applicable to the request message.
8646 pub request_policies: std::vec::Vec<crate::model::FieldPolicy>,
8647
8648 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8649}
8650
8651impl MethodPolicy {
8652 pub fn new() -> Self {
8653 std::default::Default::default()
8654 }
8655
8656 /// Sets the value of [selector][crate::model::MethodPolicy::selector].
8657 ///
8658 /// # Example
8659 /// ```ignore,no_run
8660 /// # use google_cloud_api::model::MethodPolicy;
8661 /// let x = MethodPolicy::new().set_selector("example");
8662 /// ```
8663 pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8664 self.selector = v.into();
8665 self
8666 }
8667
8668 /// Sets the value of [request_policies][crate::model::MethodPolicy::request_policies].
8669 ///
8670 /// # Example
8671 /// ```ignore,no_run
8672 /// # use google_cloud_api::model::MethodPolicy;
8673 /// use google_cloud_api::model::FieldPolicy;
8674 /// let x = MethodPolicy::new()
8675 /// .set_request_policies([
8676 /// FieldPolicy::default()/* use setters */,
8677 /// FieldPolicy::default()/* use (different) setters */,
8678 /// ]);
8679 /// ```
8680 pub fn set_request_policies<T, V>(mut self, v: T) -> Self
8681 where
8682 T: std::iter::IntoIterator<Item = V>,
8683 V: std::convert::Into<crate::model::FieldPolicy>,
8684 {
8685 use std::iter::Iterator;
8686 self.request_policies = v.into_iter().map(|i| i.into()).collect();
8687 self
8688 }
8689}
8690
8691impl wkt::message::Message for MethodPolicy {
8692 fn typename() -> &'static str {
8693 "type.googleapis.com/google.api.MethodPolicy"
8694 }
8695}
8696
8697/// Quota configuration helps to achieve fairness and budgeting in service
8698/// usage.
8699///
8700/// The metric based quota configuration works this way:
8701///
8702/// - The service configuration defines a set of metrics.
8703/// - For API calls, the quota.metric_rules maps methods to metrics with
8704/// corresponding costs.
8705/// - The quota.limits defines limits on the metrics, which will be used for
8706/// quota checks at runtime.
8707///
8708/// An example quota configuration in yaml format:
8709///
8710/// quota:
8711/// limits:
8712///
8713/// ```norust
8714/// - name: apiWriteQpsPerProject
8715/// metric: library.googleapis.com/write_calls
8716/// unit: "1/min/{project}" # rate limit for consumer projects
8717/// values:
8718/// STANDARD: 10000
8719///
8720///
8721/// (The metric rules bind all methods to the read_calls metric,
8722/// except for the UpdateBook and DeleteBook methods. These two methods
8723/// are mapped to the write_calls metric, with the UpdateBook method
8724/// consuming at twice rate as the DeleteBook method.)
8725/// metric_rules:
8726/// - selector: "*"
8727/// metric_costs:
8728/// library.googleapis.com/read_calls: 1
8729/// - selector: google.example.library.v1.LibraryService.UpdateBook
8730/// metric_costs:
8731/// library.googleapis.com/write_calls: 2
8732/// - selector: google.example.library.v1.LibraryService.DeleteBook
8733/// metric_costs:
8734/// library.googleapis.com/write_calls: 1
8735/// ```
8736///
8737/// Corresponding Metric definition:
8738///
8739/// ```norust
8740/// metrics:
8741/// - name: library.googleapis.com/read_calls
8742/// display_name: Read requests
8743/// metric_kind: DELTA
8744/// value_type: INT64
8745///
8746/// - name: library.googleapis.com/write_calls
8747/// display_name: Write requests
8748/// metric_kind: DELTA
8749/// value_type: INT64
8750/// ```
8751#[derive(Clone, Default, PartialEq)]
8752#[non_exhaustive]
8753pub struct Quota {
8754 /// List of QuotaLimit definitions for the service.
8755 pub limits: std::vec::Vec<crate::model::QuotaLimit>,
8756
8757 /// List of MetricRule definitions, each one mapping a selected method to one
8758 /// or more metrics.
8759 pub metric_rules: std::vec::Vec<crate::model::MetricRule>,
8760
8761 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8762}
8763
8764impl Quota {
8765 pub fn new() -> Self {
8766 std::default::Default::default()
8767 }
8768
8769 /// Sets the value of [limits][crate::model::Quota::limits].
8770 ///
8771 /// # Example
8772 /// ```ignore,no_run
8773 /// # use google_cloud_api::model::Quota;
8774 /// use google_cloud_api::model::QuotaLimit;
8775 /// let x = Quota::new()
8776 /// .set_limits([
8777 /// QuotaLimit::default()/* use setters */,
8778 /// QuotaLimit::default()/* use (different) setters */,
8779 /// ]);
8780 /// ```
8781 pub fn set_limits<T, V>(mut self, v: T) -> Self
8782 where
8783 T: std::iter::IntoIterator<Item = V>,
8784 V: std::convert::Into<crate::model::QuotaLimit>,
8785 {
8786 use std::iter::Iterator;
8787 self.limits = v.into_iter().map(|i| i.into()).collect();
8788 self
8789 }
8790
8791 /// Sets the value of [metric_rules][crate::model::Quota::metric_rules].
8792 ///
8793 /// # Example
8794 /// ```ignore,no_run
8795 /// # use google_cloud_api::model::Quota;
8796 /// use google_cloud_api::model::MetricRule;
8797 /// let x = Quota::new()
8798 /// .set_metric_rules([
8799 /// MetricRule::default()/* use setters */,
8800 /// MetricRule::default()/* use (different) setters */,
8801 /// ]);
8802 /// ```
8803 pub fn set_metric_rules<T, V>(mut self, v: T) -> Self
8804 where
8805 T: std::iter::IntoIterator<Item = V>,
8806 V: std::convert::Into<crate::model::MetricRule>,
8807 {
8808 use std::iter::Iterator;
8809 self.metric_rules = v.into_iter().map(|i| i.into()).collect();
8810 self
8811 }
8812}
8813
8814impl wkt::message::Message for Quota {
8815 fn typename() -> &'static str {
8816 "type.googleapis.com/google.api.Quota"
8817 }
8818}
8819
8820/// Bind API methods to metrics. Binding a method to a metric causes that
8821/// metric's configured quota behaviors to apply to the method call.
8822#[derive(Clone, Default, PartialEq)]
8823#[non_exhaustive]
8824pub struct MetricRule {
8825 /// Selects the methods to which this rule applies.
8826 ///
8827 /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
8828 /// details.
8829 ///
8830 /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
8831 pub selector: std::string::String,
8832
8833 /// Metrics to update when the selected methods are called, and the associated
8834 /// cost applied to each metric.
8835 ///
8836 /// The key of the map is the metric name, and the values are the amount
8837 /// increased for the metric against which the quota limits are defined.
8838 /// The value must not be negative.
8839 pub metric_costs: std::collections::HashMap<std::string::String, i64>,
8840
8841 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8842}
8843
8844impl MetricRule {
8845 pub fn new() -> Self {
8846 std::default::Default::default()
8847 }
8848
8849 /// Sets the value of [selector][crate::model::MetricRule::selector].
8850 ///
8851 /// # Example
8852 /// ```ignore,no_run
8853 /// # use google_cloud_api::model::MetricRule;
8854 /// let x = MetricRule::new().set_selector("example");
8855 /// ```
8856 pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8857 self.selector = v.into();
8858 self
8859 }
8860
8861 /// Sets the value of [metric_costs][crate::model::MetricRule::metric_costs].
8862 ///
8863 /// # Example
8864 /// ```ignore,no_run
8865 /// # use google_cloud_api::model::MetricRule;
8866 /// let x = MetricRule::new().set_metric_costs([
8867 /// ("key0", 123),
8868 /// ("key1", 456),
8869 /// ]);
8870 /// ```
8871 pub fn set_metric_costs<T, K, V>(mut self, v: T) -> Self
8872 where
8873 T: std::iter::IntoIterator<Item = (K, V)>,
8874 K: std::convert::Into<std::string::String>,
8875 V: std::convert::Into<i64>,
8876 {
8877 use std::iter::Iterator;
8878 self.metric_costs = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8879 self
8880 }
8881}
8882
8883impl wkt::message::Message for MetricRule {
8884 fn typename() -> &'static str {
8885 "type.googleapis.com/google.api.MetricRule"
8886 }
8887}
8888
8889/// `QuotaLimit` defines a specific limit that applies over a specified duration
8890/// for a limit type. There can be at most one limit for a duration and limit
8891/// type combination defined within a `QuotaGroup`.
8892#[derive(Clone, Default, PartialEq)]
8893#[non_exhaustive]
8894pub struct QuotaLimit {
8895 /// Name of the quota limit.
8896 ///
8897 /// The name must be provided, and it must be unique within the service. The
8898 /// name can only include alphanumeric characters as well as '-'.
8899 ///
8900 /// The maximum length of the limit name is 64 characters.
8901 pub name: std::string::String,
8902
8903 /// Optional. User-visible, extended description for this quota limit.
8904 /// Should be used only when more context is needed to understand this limit
8905 /// than provided by the limit's display name (see: `display_name`).
8906 pub description: std::string::String,
8907
8908 /// Default number of tokens that can be consumed during the specified
8909 /// duration. This is the number of tokens assigned when a client
8910 /// application developer activates the service for his/her project.
8911 ///
8912 /// Specifying a value of 0 will block all requests. This can be used if you
8913 /// are provisioning quota to selected consumers and blocking others.
8914 /// Similarly, a value of -1 will indicate an unlimited quota. No other
8915 /// negative values are allowed.
8916 ///
8917 /// Used by group-based quotas only.
8918 pub default_limit: i64,
8919
8920 /// Maximum number of tokens that can be consumed during the specified
8921 /// duration. Client application developers can override the default limit up
8922 /// to this maximum. If specified, this value cannot be set to a value less
8923 /// than the default limit. If not specified, it is set to the default limit.
8924 ///
8925 /// To allow clients to apply overrides with no upper bound, set this to -1,
8926 /// indicating unlimited maximum quota.
8927 ///
8928 /// Used by group-based quotas only.
8929 pub max_limit: i64,
8930
8931 /// Free tier value displayed in the Developers Console for this limit.
8932 /// The free tier is the number of tokens that will be subtracted from the
8933 /// billed amount when billing is enabled.
8934 /// This field can only be set on a limit with duration "1d", in a billable
8935 /// group; it is invalid on any other limit. If this field is not set, it
8936 /// defaults to 0, indicating that there is no free tier for this service.
8937 ///
8938 /// Used by group-based quotas only.
8939 pub free_tier: i64,
8940
8941 /// Duration of this limit in textual notation. Must be "100s" or "1d".
8942 ///
8943 /// Used by group-based quotas only.
8944 pub duration: std::string::String,
8945
8946 /// The name of the metric this quota limit applies to. The quota limits with
8947 /// the same metric will be checked together during runtime. The metric must be
8948 /// defined within the service config.
8949 pub metric: std::string::String,
8950
8951 /// Specify the unit of the quota limit. It uses the same syntax as
8952 /// [MetricDescriptor.unit][google.api.MetricDescriptor.unit]. The supported
8953 /// unit kinds are determined by the quota backend system.
8954 ///
8955 /// Here are some examples:
8956 ///
8957 /// * "1/min/{project}" for quota per minute per project.
8958 ///
8959 /// Note: the order of unit components is insignificant.
8960 /// The "1" at the beginning is required to follow the metric unit syntax.
8961 ///
8962 /// [google.api.MetricDescriptor.unit]: crate::model::MetricDescriptor::unit
8963 pub unit: std::string::String,
8964
8965 /// Tiered limit values. You must specify this as a key:value pair, with an
8966 /// integer value that is the maximum number of requests allowed for the
8967 /// specified unit. Currently only STANDARD is supported.
8968 pub values: std::collections::HashMap<std::string::String, i64>,
8969
8970 /// User-visible display name for this limit.
8971 /// Optional. If not set, the UI will provide a default display name based on
8972 /// the quota configuration. This field can be used to override the default
8973 /// display name generated from the configuration.
8974 pub display_name: std::string::String,
8975
8976 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8977}
8978
8979impl QuotaLimit {
8980 pub fn new() -> Self {
8981 std::default::Default::default()
8982 }
8983
8984 /// Sets the value of [name][crate::model::QuotaLimit::name].
8985 ///
8986 /// # Example
8987 /// ```ignore,no_run
8988 /// # use google_cloud_api::model::QuotaLimit;
8989 /// let x = QuotaLimit::new().set_name("example");
8990 /// ```
8991 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8992 self.name = v.into();
8993 self
8994 }
8995
8996 /// Sets the value of [description][crate::model::QuotaLimit::description].
8997 ///
8998 /// # Example
8999 /// ```ignore,no_run
9000 /// # use google_cloud_api::model::QuotaLimit;
9001 /// let x = QuotaLimit::new().set_description("example");
9002 /// ```
9003 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9004 self.description = v.into();
9005 self
9006 }
9007
9008 /// Sets the value of [default_limit][crate::model::QuotaLimit::default_limit].
9009 ///
9010 /// # Example
9011 /// ```ignore,no_run
9012 /// # use google_cloud_api::model::QuotaLimit;
9013 /// let x = QuotaLimit::new().set_default_limit(42);
9014 /// ```
9015 pub fn set_default_limit<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
9016 self.default_limit = v.into();
9017 self
9018 }
9019
9020 /// Sets the value of [max_limit][crate::model::QuotaLimit::max_limit].
9021 ///
9022 /// # Example
9023 /// ```ignore,no_run
9024 /// # use google_cloud_api::model::QuotaLimit;
9025 /// let x = QuotaLimit::new().set_max_limit(42);
9026 /// ```
9027 pub fn set_max_limit<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
9028 self.max_limit = v.into();
9029 self
9030 }
9031
9032 /// Sets the value of [free_tier][crate::model::QuotaLimit::free_tier].
9033 ///
9034 /// # Example
9035 /// ```ignore,no_run
9036 /// # use google_cloud_api::model::QuotaLimit;
9037 /// let x = QuotaLimit::new().set_free_tier(42);
9038 /// ```
9039 pub fn set_free_tier<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
9040 self.free_tier = v.into();
9041 self
9042 }
9043
9044 /// Sets the value of [duration][crate::model::QuotaLimit::duration].
9045 ///
9046 /// # Example
9047 /// ```ignore,no_run
9048 /// # use google_cloud_api::model::QuotaLimit;
9049 /// let x = QuotaLimit::new().set_duration("example");
9050 /// ```
9051 pub fn set_duration<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9052 self.duration = v.into();
9053 self
9054 }
9055
9056 /// Sets the value of [metric][crate::model::QuotaLimit::metric].
9057 ///
9058 /// # Example
9059 /// ```ignore,no_run
9060 /// # use google_cloud_api::model::QuotaLimit;
9061 /// let x = QuotaLimit::new().set_metric("example");
9062 /// ```
9063 pub fn set_metric<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9064 self.metric = v.into();
9065 self
9066 }
9067
9068 /// Sets the value of [unit][crate::model::QuotaLimit::unit].
9069 ///
9070 /// # Example
9071 /// ```ignore,no_run
9072 /// # use google_cloud_api::model::QuotaLimit;
9073 /// let x = QuotaLimit::new().set_unit("example");
9074 /// ```
9075 pub fn set_unit<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9076 self.unit = v.into();
9077 self
9078 }
9079
9080 /// Sets the value of [values][crate::model::QuotaLimit::values].
9081 ///
9082 /// # Example
9083 /// ```ignore,no_run
9084 /// # use google_cloud_api::model::QuotaLimit;
9085 /// let x = QuotaLimit::new().set_values([
9086 /// ("key0", 123),
9087 /// ("key1", 456),
9088 /// ]);
9089 /// ```
9090 pub fn set_values<T, K, V>(mut self, v: T) -> Self
9091 where
9092 T: std::iter::IntoIterator<Item = (K, V)>,
9093 K: std::convert::Into<std::string::String>,
9094 V: std::convert::Into<i64>,
9095 {
9096 use std::iter::Iterator;
9097 self.values = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9098 self
9099 }
9100
9101 /// Sets the value of [display_name][crate::model::QuotaLimit::display_name].
9102 ///
9103 /// # Example
9104 /// ```ignore,no_run
9105 /// # use google_cloud_api::model::QuotaLimit;
9106 /// let x = QuotaLimit::new().set_display_name("example");
9107 /// ```
9108 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9109 self.display_name = v.into();
9110 self
9111 }
9112}
9113
9114impl wkt::message::Message for QuotaLimit {
9115 fn typename() -> &'static str {
9116 "type.googleapis.com/google.api.QuotaLimit"
9117 }
9118}
9119
9120/// A simple descriptor of a resource type.
9121///
9122/// ResourceDescriptor annotates a resource message (either by means of a
9123/// protobuf annotation or use in the service config), and associates the
9124/// resource's schema, the resource type, and the pattern of the resource name.
9125///
9126/// Example:
9127///
9128/// ```norust
9129/// message Topic {
9130/// // Indicates this message defines a resource schema.
9131/// // Declares the resource type in the format of {service}/{kind}.
9132/// // For Kubernetes resources, the format is {api group}/{kind}.
9133/// option (google.api.resource) = {
9134/// type: "pubsub.googleapis.com/Topic"
9135/// pattern: "projects/{project}/topics/{topic}"
9136/// };
9137/// }
9138/// ```
9139///
9140/// The ResourceDescriptor Yaml config will look like:
9141///
9142/// ```norust
9143/// resources:
9144/// - type: "pubsub.googleapis.com/Topic"
9145/// pattern: "projects/{project}/topics/{topic}"
9146/// ```
9147///
9148/// Sometimes, resources have multiple patterns, typically because they can
9149/// live under multiple parents.
9150///
9151/// Example:
9152///
9153/// ```norust
9154/// message LogEntry {
9155/// option (google.api.resource) = {
9156/// type: "logging.googleapis.com/LogEntry"
9157/// pattern: "projects/{project}/logs/{log}"
9158/// pattern: "folders/{folder}/logs/{log}"
9159/// pattern: "organizations/{organization}/logs/{log}"
9160/// pattern: "billingAccounts/{billing_account}/logs/{log}"
9161/// };
9162/// }
9163/// ```
9164///
9165/// The ResourceDescriptor Yaml config will look like:
9166///
9167/// ```norust
9168/// resources:
9169/// - type: 'logging.googleapis.com/LogEntry'
9170/// pattern: "projects/{project}/logs/{log}"
9171/// pattern: "folders/{folder}/logs/{log}"
9172/// pattern: "organizations/{organization}/logs/{log}"
9173/// pattern: "billingAccounts/{billing_account}/logs/{log}"
9174/// ```
9175#[derive(Clone, Default, PartialEq)]
9176#[non_exhaustive]
9177pub struct ResourceDescriptor {
9178 /// The resource type. It must be in the format of
9179 /// {service_name}/{resource_type_kind}. The `resource_type_kind` must be
9180 /// singular and must not include version numbers.
9181 ///
9182 /// Example: `storage.googleapis.com/Bucket`
9183 ///
9184 /// The value of the resource_type_kind must follow the regular expression
9185 /// /[A-Za-z][a-zA-Z0-9]+/. It should start with an upper case character and
9186 /// should use PascalCase (UpperCamelCase). The maximum number of
9187 /// characters allowed for the `resource_type_kind` is 100.
9188 pub r#type: std::string::String,
9189
9190 /// Optional. The relative resource name pattern associated with this resource
9191 /// type. The DNS prefix of the full resource name shouldn't be specified here.
9192 ///
9193 /// The path pattern must follow the syntax, which aligns with HTTP binding
9194 /// syntax:
9195 ///
9196 /// ```norust
9197 /// Template = Segment { "/" Segment } ;
9198 /// Segment = LITERAL | Variable ;
9199 /// Variable = "{" LITERAL "}" ;
9200 /// ```
9201 ///
9202 /// Examples:
9203 ///
9204 /// ```norust
9205 /// - "projects/{project}/topics/{topic}"
9206 /// - "projects/{project}/knowledgeBases/{knowledge_base}"
9207 /// ```
9208 ///
9209 /// The components in braces correspond to the IDs for each resource in the
9210 /// hierarchy. It is expected that, if multiple patterns are provided,
9211 /// the same component name (e.g. "project") refers to IDs of the same
9212 /// type of resource.
9213 pub pattern: std::vec::Vec<std::string::String>,
9214
9215 /// Optional. The field on the resource that designates the resource name
9216 /// field. If omitted, this is assumed to be "name".
9217 pub name_field: std::string::String,
9218
9219 /// Optional. The historical or future-looking state of the resource pattern.
9220 ///
9221 /// Example:
9222 ///
9223 /// ```norust
9224 /// // The InspectTemplate message originally only supported resource
9225 /// // names with organization, and project was added later.
9226 /// message InspectTemplate {
9227 /// option (google.api.resource) = {
9228 /// type: "dlp.googleapis.com/InspectTemplate"
9229 /// pattern:
9230 /// "organizations/{organization}/inspectTemplates/{inspect_template}"
9231 /// pattern: "projects/{project}/inspectTemplates/{inspect_template}"
9232 /// history: ORIGINALLY_SINGLE_PATTERN
9233 /// };
9234 /// }
9235 /// ```
9236 pub history: crate::model::resource_descriptor::History,
9237
9238 /// The plural name used in the resource name and permission names, such as
9239 /// 'projects' for the resource name of 'projects/{project}' and the permission
9240 /// name of 'cloudresourcemanager.googleapis.com/projects.get'. One exception
9241 /// to this is for Nested Collections that have stuttering names, as defined
9242 /// in [AIP-122](https://google.aip.dev/122#nested-collections), where the
9243 /// collection ID in the resource name pattern does not necessarily directly
9244 /// match the `plural` value.
9245 ///
9246 /// It is the same concept of the `plural` field in k8s CRD spec
9247 /// <https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/>
9248 ///
9249 /// Note: The plural form is required even for singleton resources. See
9250 /// <https://aip.dev/156>
9251 pub plural: std::string::String,
9252
9253 /// The same concept of the `singular` field in k8s CRD spec
9254 /// <https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/>
9255 /// Such as "project" for the `resourcemanager.googleapis.com/Project` type.
9256 pub singular: std::string::String,
9257
9258 /// Style flag(s) for this resource.
9259 /// These indicate that a resource is expected to conform to a given
9260 /// style. See the specific style flags for additional information.
9261 pub style: std::vec::Vec<crate::model::resource_descriptor::Style>,
9262
9263 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9264}
9265
9266impl ResourceDescriptor {
9267 pub fn new() -> Self {
9268 std::default::Default::default()
9269 }
9270
9271 /// Sets the value of [r#type][crate::model::ResourceDescriptor::type].
9272 ///
9273 /// # Example
9274 /// ```ignore,no_run
9275 /// # use google_cloud_api::model::ResourceDescriptor;
9276 /// let x = ResourceDescriptor::new().set_type("example");
9277 /// ```
9278 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9279 self.r#type = v.into();
9280 self
9281 }
9282
9283 /// Sets the value of [pattern][crate::model::ResourceDescriptor::pattern].
9284 ///
9285 /// # Example
9286 /// ```ignore,no_run
9287 /// # use google_cloud_api::model::ResourceDescriptor;
9288 /// let x = ResourceDescriptor::new().set_pattern(["a", "b", "c"]);
9289 /// ```
9290 pub fn set_pattern<T, V>(mut self, v: T) -> Self
9291 where
9292 T: std::iter::IntoIterator<Item = V>,
9293 V: std::convert::Into<std::string::String>,
9294 {
9295 use std::iter::Iterator;
9296 self.pattern = v.into_iter().map(|i| i.into()).collect();
9297 self
9298 }
9299
9300 /// Sets the value of [name_field][crate::model::ResourceDescriptor::name_field].
9301 ///
9302 /// # Example
9303 /// ```ignore,no_run
9304 /// # use google_cloud_api::model::ResourceDescriptor;
9305 /// let x = ResourceDescriptor::new().set_name_field("example");
9306 /// ```
9307 pub fn set_name_field<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9308 self.name_field = v.into();
9309 self
9310 }
9311
9312 /// Sets the value of [history][crate::model::ResourceDescriptor::history].
9313 ///
9314 /// # Example
9315 /// ```ignore,no_run
9316 /// # use google_cloud_api::model::ResourceDescriptor;
9317 /// use google_cloud_api::model::resource_descriptor::History;
9318 /// let x0 = ResourceDescriptor::new().set_history(History::OriginallySinglePattern);
9319 /// let x1 = ResourceDescriptor::new().set_history(History::FutureMultiPattern);
9320 /// ```
9321 pub fn set_history<T: std::convert::Into<crate::model::resource_descriptor::History>>(
9322 mut self,
9323 v: T,
9324 ) -> Self {
9325 self.history = v.into();
9326 self
9327 }
9328
9329 /// Sets the value of [plural][crate::model::ResourceDescriptor::plural].
9330 ///
9331 /// # Example
9332 /// ```ignore,no_run
9333 /// # use google_cloud_api::model::ResourceDescriptor;
9334 /// let x = ResourceDescriptor::new().set_plural("example");
9335 /// ```
9336 pub fn set_plural<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9337 self.plural = v.into();
9338 self
9339 }
9340
9341 /// Sets the value of [singular][crate::model::ResourceDescriptor::singular].
9342 ///
9343 /// # Example
9344 /// ```ignore,no_run
9345 /// # use google_cloud_api::model::ResourceDescriptor;
9346 /// let x = ResourceDescriptor::new().set_singular("example");
9347 /// ```
9348 pub fn set_singular<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9349 self.singular = v.into();
9350 self
9351 }
9352
9353 /// Sets the value of [style][crate::model::ResourceDescriptor::style].
9354 ///
9355 /// # Example
9356 /// ```ignore,no_run
9357 /// # use google_cloud_api::model::ResourceDescriptor;
9358 /// use google_cloud_api::model::resource_descriptor::Style;
9359 /// let x = ResourceDescriptor::new().set_style([
9360 /// Style::DeclarativeFriendly,
9361 /// ]);
9362 /// ```
9363 pub fn set_style<T, V>(mut self, v: T) -> Self
9364 where
9365 T: std::iter::IntoIterator<Item = V>,
9366 V: std::convert::Into<crate::model::resource_descriptor::Style>,
9367 {
9368 use std::iter::Iterator;
9369 self.style = v.into_iter().map(|i| i.into()).collect();
9370 self
9371 }
9372}
9373
9374impl wkt::message::Message for ResourceDescriptor {
9375 fn typename() -> &'static str {
9376 "type.googleapis.com/google.api.ResourceDescriptor"
9377 }
9378}
9379
9380/// Defines additional types related to [ResourceDescriptor].
9381pub mod resource_descriptor {
9382 #[allow(unused_imports)]
9383 use super::*;
9384
9385 /// A description of the historical or future-looking state of the
9386 /// resource pattern.
9387 ///
9388 /// # Working with unknown values
9389 ///
9390 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9391 /// additional enum variants at any time. Adding new variants is not considered
9392 /// a breaking change. Applications should write their code in anticipation of:
9393 ///
9394 /// - New values appearing in future releases of the client library, **and**
9395 /// - New values received dynamically, without application changes.
9396 ///
9397 /// Please consult the [Working with enums] section in the user guide for some
9398 /// guidelines.
9399 ///
9400 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9401 #[derive(Clone, Debug, PartialEq)]
9402 #[non_exhaustive]
9403 pub enum History {
9404 /// The "unset" value.
9405 Unspecified,
9406 /// The resource originally had one pattern and launched as such, and
9407 /// additional patterns were added later.
9408 OriginallySinglePattern,
9409 /// The resource has one pattern, but the API owner expects to add more
9410 /// later. (This is the inverse of ORIGINALLY_SINGLE_PATTERN, and prevents
9411 /// that from being necessary once there are multiple patterns.)
9412 FutureMultiPattern,
9413 /// If set, the enum was initialized with an unknown value.
9414 ///
9415 /// Applications can examine the value using [History::value] or
9416 /// [History::name].
9417 UnknownValue(history::UnknownValue),
9418 }
9419
9420 #[doc(hidden)]
9421 pub mod history {
9422 #[allow(unused_imports)]
9423 use super::*;
9424 #[derive(Clone, Debug, PartialEq)]
9425 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9426 }
9427
9428 impl History {
9429 /// Gets the enum value.
9430 ///
9431 /// Returns `None` if the enum contains an unknown value deserialized from
9432 /// the string representation of enums.
9433 pub fn value(&self) -> std::option::Option<i32> {
9434 match self {
9435 Self::Unspecified => std::option::Option::Some(0),
9436 Self::OriginallySinglePattern => std::option::Option::Some(1),
9437 Self::FutureMultiPattern => std::option::Option::Some(2),
9438 Self::UnknownValue(u) => u.0.value(),
9439 }
9440 }
9441
9442 /// Gets the enum value as a string.
9443 ///
9444 /// Returns `None` if the enum contains an unknown value deserialized from
9445 /// the integer representation of enums.
9446 pub fn name(&self) -> std::option::Option<&str> {
9447 match self {
9448 Self::Unspecified => std::option::Option::Some("HISTORY_UNSPECIFIED"),
9449 Self::OriginallySinglePattern => {
9450 std::option::Option::Some("ORIGINALLY_SINGLE_PATTERN")
9451 }
9452 Self::FutureMultiPattern => std::option::Option::Some("FUTURE_MULTI_PATTERN"),
9453 Self::UnknownValue(u) => u.0.name(),
9454 }
9455 }
9456 }
9457
9458 impl std::default::Default for History {
9459 fn default() -> Self {
9460 use std::convert::From;
9461 Self::from(0)
9462 }
9463 }
9464
9465 impl std::fmt::Display for History {
9466 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9467 wkt::internal::display_enum(f, self.name(), self.value())
9468 }
9469 }
9470
9471 impl std::convert::From<i32> for History {
9472 fn from(value: i32) -> Self {
9473 match value {
9474 0 => Self::Unspecified,
9475 1 => Self::OriginallySinglePattern,
9476 2 => Self::FutureMultiPattern,
9477 _ => Self::UnknownValue(history::UnknownValue(
9478 wkt::internal::UnknownEnumValue::Integer(value),
9479 )),
9480 }
9481 }
9482 }
9483
9484 impl std::convert::From<&str> for History {
9485 fn from(value: &str) -> Self {
9486 use std::string::ToString;
9487 match value {
9488 "HISTORY_UNSPECIFIED" => Self::Unspecified,
9489 "ORIGINALLY_SINGLE_PATTERN" => Self::OriginallySinglePattern,
9490 "FUTURE_MULTI_PATTERN" => Self::FutureMultiPattern,
9491 _ => Self::UnknownValue(history::UnknownValue(
9492 wkt::internal::UnknownEnumValue::String(value.to_string()),
9493 )),
9494 }
9495 }
9496 }
9497
9498 impl serde::ser::Serialize for History {
9499 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9500 where
9501 S: serde::Serializer,
9502 {
9503 match self {
9504 Self::Unspecified => serializer.serialize_i32(0),
9505 Self::OriginallySinglePattern => serializer.serialize_i32(1),
9506 Self::FutureMultiPattern => serializer.serialize_i32(2),
9507 Self::UnknownValue(u) => u.0.serialize(serializer),
9508 }
9509 }
9510 }
9511
9512 impl<'de> serde::de::Deserialize<'de> for History {
9513 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9514 where
9515 D: serde::Deserializer<'de>,
9516 {
9517 deserializer.deserialize_any(wkt::internal::EnumVisitor::<History>::new(
9518 ".google.api.ResourceDescriptor.History",
9519 ))
9520 }
9521 }
9522
9523 /// A flag representing a specific style that a resource claims to conform to.
9524 ///
9525 /// # Working with unknown values
9526 ///
9527 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9528 /// additional enum variants at any time. Adding new variants is not considered
9529 /// a breaking change. Applications should write their code in anticipation of:
9530 ///
9531 /// - New values appearing in future releases of the client library, **and**
9532 /// - New values received dynamically, without application changes.
9533 ///
9534 /// Please consult the [Working with enums] section in the user guide for some
9535 /// guidelines.
9536 ///
9537 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9538 #[derive(Clone, Debug, PartialEq)]
9539 #[non_exhaustive]
9540 pub enum Style {
9541 /// The unspecified value. Do not use.
9542 Unspecified,
9543 /// This resource is intended to be "declarative-friendly".
9544 ///
9545 /// Declarative-friendly resources must be more strictly consistent, and
9546 /// setting this to true communicates to tools that this resource should
9547 /// adhere to declarative-friendly expectations.
9548 ///
9549 /// Note: This is used by the API linter (linter.aip.dev) to enable
9550 /// additional checks.
9551 DeclarativeFriendly,
9552 /// If set, the enum was initialized with an unknown value.
9553 ///
9554 /// Applications can examine the value using [Style::value] or
9555 /// [Style::name].
9556 UnknownValue(style::UnknownValue),
9557 }
9558
9559 #[doc(hidden)]
9560 pub mod style {
9561 #[allow(unused_imports)]
9562 use super::*;
9563 #[derive(Clone, Debug, PartialEq)]
9564 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9565 }
9566
9567 impl Style {
9568 /// Gets the enum value.
9569 ///
9570 /// Returns `None` if the enum contains an unknown value deserialized from
9571 /// the string representation of enums.
9572 pub fn value(&self) -> std::option::Option<i32> {
9573 match self {
9574 Self::Unspecified => std::option::Option::Some(0),
9575 Self::DeclarativeFriendly => std::option::Option::Some(1),
9576 Self::UnknownValue(u) => u.0.value(),
9577 }
9578 }
9579
9580 /// Gets the enum value as a string.
9581 ///
9582 /// Returns `None` if the enum contains an unknown value deserialized from
9583 /// the integer representation of enums.
9584 pub fn name(&self) -> std::option::Option<&str> {
9585 match self {
9586 Self::Unspecified => std::option::Option::Some("STYLE_UNSPECIFIED"),
9587 Self::DeclarativeFriendly => std::option::Option::Some("DECLARATIVE_FRIENDLY"),
9588 Self::UnknownValue(u) => u.0.name(),
9589 }
9590 }
9591 }
9592
9593 impl std::default::Default for Style {
9594 fn default() -> Self {
9595 use std::convert::From;
9596 Self::from(0)
9597 }
9598 }
9599
9600 impl std::fmt::Display for Style {
9601 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9602 wkt::internal::display_enum(f, self.name(), self.value())
9603 }
9604 }
9605
9606 impl std::convert::From<i32> for Style {
9607 fn from(value: i32) -> Self {
9608 match value {
9609 0 => Self::Unspecified,
9610 1 => Self::DeclarativeFriendly,
9611 _ => Self::UnknownValue(style::UnknownValue(
9612 wkt::internal::UnknownEnumValue::Integer(value),
9613 )),
9614 }
9615 }
9616 }
9617
9618 impl std::convert::From<&str> for Style {
9619 fn from(value: &str) -> Self {
9620 use std::string::ToString;
9621 match value {
9622 "STYLE_UNSPECIFIED" => Self::Unspecified,
9623 "DECLARATIVE_FRIENDLY" => Self::DeclarativeFriendly,
9624 _ => Self::UnknownValue(style::UnknownValue(
9625 wkt::internal::UnknownEnumValue::String(value.to_string()),
9626 )),
9627 }
9628 }
9629 }
9630
9631 impl serde::ser::Serialize for Style {
9632 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9633 where
9634 S: serde::Serializer,
9635 {
9636 match self {
9637 Self::Unspecified => serializer.serialize_i32(0),
9638 Self::DeclarativeFriendly => serializer.serialize_i32(1),
9639 Self::UnknownValue(u) => u.0.serialize(serializer),
9640 }
9641 }
9642 }
9643
9644 impl<'de> serde::de::Deserialize<'de> for Style {
9645 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9646 where
9647 D: serde::Deserializer<'de>,
9648 {
9649 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Style>::new(
9650 ".google.api.ResourceDescriptor.Style",
9651 ))
9652 }
9653 }
9654}
9655
9656/// Defines a proto annotation that describes a string field that refers to
9657/// an API resource.
9658#[derive(Clone, Default, PartialEq)]
9659#[non_exhaustive]
9660pub struct ResourceReference {
9661 /// The resource type that the annotated field references.
9662 ///
9663 /// Example:
9664 ///
9665 /// ```norust
9666 /// message Subscription {
9667 /// string topic = 2 [(google.api.resource_reference) = {
9668 /// type: "pubsub.googleapis.com/Topic"
9669 /// }];
9670 /// }
9671 /// ```
9672 ///
9673 /// Occasionally, a field may reference an arbitrary resource. In this case,
9674 /// APIs use the special value * in their resource reference.
9675 ///
9676 /// Example:
9677 ///
9678 /// ```norust
9679 /// message GetIamPolicyRequest {
9680 /// string resource = 2 [(google.api.resource_reference) = {
9681 /// type: "*"
9682 /// }];
9683 /// }
9684 /// ```
9685 pub r#type: std::string::String,
9686
9687 /// The resource type of a child collection that the annotated field
9688 /// references. This is useful for annotating the `parent` field that
9689 /// doesn't have a fixed resource type.
9690 ///
9691 /// Example:
9692 ///
9693 /// ```norust
9694 /// message ListLogEntriesRequest {
9695 /// string parent = 1 [(google.api.resource_reference) = {
9696 /// child_type: "logging.googleapis.com/LogEntry"
9697 /// };
9698 /// }
9699 /// ```
9700 pub child_type: std::string::String,
9701
9702 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9703}
9704
9705impl ResourceReference {
9706 pub fn new() -> Self {
9707 std::default::Default::default()
9708 }
9709
9710 /// Sets the value of [r#type][crate::model::ResourceReference::type].
9711 ///
9712 /// # Example
9713 /// ```ignore,no_run
9714 /// # use google_cloud_api::model::ResourceReference;
9715 /// let x = ResourceReference::new().set_type("example");
9716 /// ```
9717 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9718 self.r#type = v.into();
9719 self
9720 }
9721
9722 /// Sets the value of [child_type][crate::model::ResourceReference::child_type].
9723 ///
9724 /// # Example
9725 /// ```ignore,no_run
9726 /// # use google_cloud_api::model::ResourceReference;
9727 /// let x = ResourceReference::new().set_child_type("example");
9728 /// ```
9729 pub fn set_child_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9730 self.child_type = v.into();
9731 self
9732 }
9733}
9734
9735impl wkt::message::Message for ResourceReference {
9736 fn typename() -> &'static str {
9737 "type.googleapis.com/google.api.ResourceReference"
9738 }
9739}
9740
9741/// Specifies the routing information that should be sent along with the request
9742/// in the form of routing header.
9743/// **NOTE:** All service configuration rules follow the "last one wins" order.
9744///
9745/// The examples below will apply to an RPC which has the following request type:
9746///
9747/// Message Definition:
9748///
9749/// ```norust
9750/// message Request {
9751/// // The name of the Table
9752/// // Values can be of the following formats:
9753/// // - `projects/<project>/tables/<table>`
9754/// // - `projects/<project>/instances/<instance>/tables/<table>`
9755/// // - `region/<region>/zones/<zone>/tables/<table>`
9756/// string table_name = 1;
9757///
9758/// // This value specifies routing for replication.
9759/// // It can be in the following formats:
9760/// // - `profiles/<profile_id>`
9761/// // - a legacy `profile_id` that can be any string
9762/// string app_profile_id = 2;
9763/// }
9764/// ```
9765///
9766/// Example message:
9767///
9768/// ```norust
9769/// {
9770/// table_name: projects/proj_foo/instances/instance_bar/table/table_baz,
9771/// app_profile_id: profiles/prof_qux
9772/// }
9773/// ```
9774///
9775/// The routing header consists of one or multiple key-value pairs. Every key
9776/// and value must be percent-encoded, and joined together in the format of
9777/// `key1=value1&key2=value2`.
9778/// The examples below skip the percent-encoding for readability.
9779///
9780/// Example 1
9781///
9782/// Extracting a field from the request to put into the routing header
9783/// unchanged, with the key equal to the field name.
9784///
9785/// annotation:
9786///
9787/// ```norust
9788/// option (google.api.routing) = {
9789/// // Take the `app_profile_id`.
9790/// routing_parameters {
9791/// field: "app_profile_id"
9792/// }
9793/// };
9794/// ```
9795///
9796/// result:
9797///
9798/// ```norust
9799/// x-goog-request-params: app_profile_id=profiles/prof_qux
9800/// ```
9801///
9802/// Example 2
9803///
9804/// Extracting a field from the request to put into the routing header
9805/// unchanged, with the key different from the field name.
9806///
9807/// annotation:
9808///
9809/// ```norust
9810/// option (google.api.routing) = {
9811/// // Take the `app_profile_id`, but name it `routing_id` in the header.
9812/// routing_parameters {
9813/// field: "app_profile_id"
9814/// path_template: "{routing_id=**}"
9815/// }
9816/// };
9817/// ```
9818///
9819/// result:
9820///
9821/// ```norust
9822/// x-goog-request-params: routing_id=profiles/prof_qux
9823/// ```
9824///
9825/// Example 3
9826///
9827/// Extracting a field from the request to put into the routing
9828/// header, while matching a path template syntax on the field's value.
9829///
9830/// NB: it is more useful to send nothing than to send garbage for the purpose
9831/// of dynamic routing, since garbage pollutes cache. Thus the matching.
9832///
9833/// Sub-example 3a
9834///
9835/// The field matches the template.
9836///
9837/// annotation:
9838///
9839/// ```norust
9840/// option (google.api.routing) = {
9841/// // Take the `table_name`, if it's well-formed (with project-based
9842/// // syntax).
9843/// routing_parameters {
9844/// field: "table_name"
9845/// path_template: "{table_name=projects/*/instances/*/**}"
9846/// }
9847/// };
9848/// ```
9849///
9850/// result:
9851///
9852/// ```norust
9853/// x-goog-request-params:
9854/// table_name=projects/proj_foo/instances/instance_bar/table/table_baz
9855/// ```
9856///
9857/// Sub-example 3b
9858///
9859/// The field does not match the template.
9860///
9861/// annotation:
9862///
9863/// ```norust
9864/// option (google.api.routing) = {
9865/// // Take the `table_name`, if it's well-formed (with region-based
9866/// // syntax).
9867/// routing_parameters {
9868/// field: "table_name"
9869/// path_template: "{table_name=regions/*/zones/*/**}"
9870/// }
9871/// };
9872/// ```
9873///
9874/// result:
9875///
9876/// ```norust
9877/// <no routing header will be sent>
9878/// ```
9879///
9880/// Sub-example 3c
9881///
9882/// Multiple alternative conflictingly named path templates are
9883/// specified. The one that matches is used to construct the header.
9884///
9885/// annotation:
9886///
9887/// ```norust
9888/// option (google.api.routing) = {
9889/// // Take the `table_name`, if it's well-formed, whether
9890/// // using the region- or projects-based syntax.
9891///
9892/// routing_parameters {
9893/// field: "table_name"
9894/// path_template: "{table_name=regions/*/zones/*/**}"
9895/// }
9896/// routing_parameters {
9897/// field: "table_name"
9898/// path_template: "{table_name=projects/*/instances/*/**}"
9899/// }
9900/// };
9901/// ```
9902///
9903/// result:
9904///
9905/// ```norust
9906/// x-goog-request-params:
9907/// table_name=projects/proj_foo/instances/instance_bar/table/table_baz
9908/// ```
9909///
9910/// Example 4
9911///
9912/// Extracting a single routing header key-value pair by matching a
9913/// template syntax on (a part of) a single request field.
9914///
9915/// annotation:
9916///
9917/// ```norust
9918/// option (google.api.routing) = {
9919/// // Take just the project id from the `table_name` field.
9920/// routing_parameters {
9921/// field: "table_name"
9922/// path_template: "{routing_id=projects/*}/**"
9923/// }
9924/// };
9925/// ```
9926///
9927/// result:
9928///
9929/// ```norust
9930/// x-goog-request-params: routing_id=projects/proj_foo
9931/// ```
9932///
9933/// Example 5
9934///
9935/// Extracting a single routing header key-value pair by matching
9936/// several conflictingly named path templates on (parts of) a single request
9937/// field. The last template to match "wins" the conflict.
9938///
9939/// annotation:
9940///
9941/// ```norust
9942/// option (google.api.routing) = {
9943/// // If the `table_name` does not have instances information,
9944/// // take just the project id for routing.
9945/// // Otherwise take project + instance.
9946///
9947/// routing_parameters {
9948/// field: "table_name"
9949/// path_template: "{routing_id=projects/*}/**"
9950/// }
9951/// routing_parameters {
9952/// field: "table_name"
9953/// path_template: "{routing_id=projects/*/instances/*}/**"
9954/// }
9955/// };
9956/// ```
9957///
9958/// result:
9959///
9960/// ```norust
9961/// x-goog-request-params:
9962/// routing_id=projects/proj_foo/instances/instance_bar
9963/// ```
9964///
9965/// Example 6
9966///
9967/// Extracting multiple routing header key-value pairs by matching
9968/// several non-conflicting path templates on (parts of) a single request field.
9969///
9970/// Sub-example 6a
9971///
9972/// Make the templates strict, so that if the `table_name` does not
9973/// have an instance information, nothing is sent.
9974///
9975/// annotation:
9976///
9977/// ```norust
9978/// option (google.api.routing) = {
9979/// // The routing code needs two keys instead of one composite
9980/// // but works only for the tables with the "project-instance" name
9981/// // syntax.
9982///
9983/// routing_parameters {
9984/// field: "table_name"
9985/// path_template: "{project_id=projects/*}/instances/*/**"
9986/// }
9987/// routing_parameters {
9988/// field: "table_name"
9989/// path_template: "projects/*/{instance_id=instances/*}/**"
9990/// }
9991/// };
9992/// ```
9993///
9994/// result:
9995///
9996/// ```norust
9997/// x-goog-request-params:
9998/// project_id=projects/proj_foo&instance_id=instances/instance_bar
9999/// ```
10000///
10001/// Sub-example 6b
10002///
10003/// Make the templates loose, so that if the `table_name` does not
10004/// have an instance information, just the project id part is sent.
10005///
10006/// annotation:
10007///
10008/// ```norust
10009/// option (google.api.routing) = {
10010/// // The routing code wants two keys instead of one composite
10011/// // but will work with just the `project_id` for tables without
10012/// // an instance in the `table_name`.
10013///
10014/// routing_parameters {
10015/// field: "table_name"
10016/// path_template: "{project_id=projects/*}/**"
10017/// }
10018/// routing_parameters {
10019/// field: "table_name"
10020/// path_template: "projects/*/{instance_id=instances/*}/**"
10021/// }
10022/// };
10023/// ```
10024///
10025/// result (is the same as 6a for our example message because it has the instance
10026/// information):
10027///
10028/// ```norust
10029/// x-goog-request-params:
10030/// project_id=projects/proj_foo&instance_id=instances/instance_bar
10031/// ```
10032///
10033/// Example 7
10034///
10035/// Extracting multiple routing header key-value pairs by matching
10036/// several path templates on multiple request fields.
10037///
10038/// NB: note that here there is no way to specify sending nothing if one of the
10039/// fields does not match its template. E.g. if the `table_name` is in the wrong
10040/// format, the `project_id` will not be sent, but the `routing_id` will be.
10041/// The backend routing code has to be aware of that and be prepared to not
10042/// receive a full complement of keys if it expects multiple.
10043///
10044/// annotation:
10045///
10046/// ```norust
10047/// option (google.api.routing) = {
10048/// // The routing needs both `project_id` and `routing_id`
10049/// // (from the `app_profile_id` field) for routing.
10050///
10051/// routing_parameters {
10052/// field: "table_name"
10053/// path_template: "{project_id=projects/*}/**"
10054/// }
10055/// routing_parameters {
10056/// field: "app_profile_id"
10057/// path_template: "{routing_id=**}"
10058/// }
10059/// };
10060/// ```
10061///
10062/// result:
10063///
10064/// ```norust
10065/// x-goog-request-params:
10066/// project_id=projects/proj_foo&routing_id=profiles/prof_qux
10067/// ```
10068///
10069/// Example 8
10070///
10071/// Extracting a single routing header key-value pair by matching
10072/// several conflictingly named path templates on several request fields. The
10073/// last template to match "wins" the conflict.
10074///
10075/// annotation:
10076///
10077/// ```norust
10078/// option (google.api.routing) = {
10079/// // The `routing_id` can be a project id or a region id depending on
10080/// // the table name format, but only if the `app_profile_id` is not set.
10081/// // If `app_profile_id` is set it should be used instead.
10082///
10083/// routing_parameters {
10084/// field: "table_name"
10085/// path_template: "{routing_id=projects/*}/**"
10086/// }
10087/// routing_parameters {
10088/// field: "table_name"
10089/// path_template: "{routing_id=regions/*}/**"
10090/// }
10091/// routing_parameters {
10092/// field: "app_profile_id"
10093/// path_template: "{routing_id=**}"
10094/// }
10095/// };
10096/// ```
10097///
10098/// result:
10099///
10100/// ```norust
10101/// x-goog-request-params: routing_id=profiles/prof_qux
10102/// ```
10103///
10104/// Example 9
10105///
10106/// Bringing it all together.
10107///
10108/// annotation:
10109///
10110/// ```norust
10111/// option (google.api.routing) = {
10112/// // For routing both `table_location` and a `routing_id` are needed.
10113/// //
10114/// // table_location can be either an instance id or a region+zone id.
10115/// //
10116/// // For `routing_id`, take the value of `app_profile_id`
10117/// // - If it's in the format `profiles/<profile_id>`, send
10118/// // just the `<profile_id>` part.
10119/// // - If it's any other literal, send it as is.
10120/// // If the `app_profile_id` is empty, and the `table_name` starts with
10121/// // the project_id, send that instead.
10122///
10123/// routing_parameters {
10124/// field: "table_name"
10125/// path_template: "projects/*/{table_location=instances/*}/tables/*"
10126/// }
10127/// routing_parameters {
10128/// field: "table_name"
10129/// path_template: "{table_location=regions/*/zones/*}/tables/*"
10130/// }
10131/// routing_parameters {
10132/// field: "table_name"
10133/// path_template: "{routing_id=projects/*}/**"
10134/// }
10135/// routing_parameters {
10136/// field: "app_profile_id"
10137/// path_template: "{routing_id=**}"
10138/// }
10139/// routing_parameters {
10140/// field: "app_profile_id"
10141/// path_template: "profiles/{routing_id=*}"
10142/// }
10143/// };
10144/// ```
10145///
10146/// result:
10147///
10148/// ```norust
10149/// x-goog-request-params:
10150/// table_location=instances/instance_bar&routing_id=prof_qux
10151/// ```
10152#[derive(Clone, Default, PartialEq)]
10153#[non_exhaustive]
10154pub struct RoutingRule {
10155 /// A collection of Routing Parameter specifications.
10156 /// **NOTE:** If multiple Routing Parameters describe the same key
10157 /// (via the `path_template` field or via the `field` field when
10158 /// `path_template` is not provided), "last one wins" rule
10159 /// determines which Parameter gets used.
10160 /// See the examples for more details.
10161 pub routing_parameters: std::vec::Vec<crate::model::RoutingParameter>,
10162
10163 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10164}
10165
10166impl RoutingRule {
10167 pub fn new() -> Self {
10168 std::default::Default::default()
10169 }
10170
10171 /// Sets the value of [routing_parameters][crate::model::RoutingRule::routing_parameters].
10172 ///
10173 /// # Example
10174 /// ```ignore,no_run
10175 /// # use google_cloud_api::model::RoutingRule;
10176 /// use google_cloud_api::model::RoutingParameter;
10177 /// let x = RoutingRule::new()
10178 /// .set_routing_parameters([
10179 /// RoutingParameter::default()/* use setters */,
10180 /// RoutingParameter::default()/* use (different) setters */,
10181 /// ]);
10182 /// ```
10183 pub fn set_routing_parameters<T, V>(mut self, v: T) -> Self
10184 where
10185 T: std::iter::IntoIterator<Item = V>,
10186 V: std::convert::Into<crate::model::RoutingParameter>,
10187 {
10188 use std::iter::Iterator;
10189 self.routing_parameters = v.into_iter().map(|i| i.into()).collect();
10190 self
10191 }
10192}
10193
10194impl wkt::message::Message for RoutingRule {
10195 fn typename() -> &'static str {
10196 "type.googleapis.com/google.api.RoutingRule"
10197 }
10198}
10199
10200/// A projection from an input message to the GRPC or REST header.
10201#[derive(Clone, Default, PartialEq)]
10202#[non_exhaustive]
10203pub struct RoutingParameter {
10204 /// A request field to extract the header key-value pair from.
10205 pub field: std::string::String,
10206
10207 /// A pattern matching the key-value field. Optional.
10208 /// If not specified, the whole field specified in the `field` field will be
10209 /// taken as value, and its name used as key. If specified, it MUST contain
10210 /// exactly one named segment (along with any number of unnamed segments) The
10211 /// pattern will be matched over the field specified in the `field` field, then
10212 /// if the match is successful:
10213 ///
10214 /// - the name of the single named segment will be used as a header name,
10215 /// - the match value of the segment will be used as a header value;
10216 /// if the match is NOT successful, nothing will be sent.
10217 ///
10218 /// Example:
10219 ///
10220 /// ```norust
10221 /// -- This is a field in the request message
10222 /// | that the header value will be extracted from.
10223 /// |
10224 /// | -- This is the key name in the
10225 /// | | routing header.
10226 /// V |
10227 /// field: "table_name" v
10228 /// path_template: "projects/*/{table_location=instances/*}/tables/*"
10229 /// ^ ^
10230 /// | |
10231 /// In the {} brackets is the pattern that -- |
10232 /// specifies what to extract from the |
10233 /// field as a value to be sent. |
10234 /// |
10235 /// The string in the field must match the whole pattern --
10236 /// before brackets, inside brackets, after brackets.
10237 /// ```
10238 ///
10239 /// When looking at this specific example, we can see that:
10240 ///
10241 /// - A key-value pair with the key `table_location`
10242 /// and the value matching `instances/*` should be added
10243 /// to the x-goog-request-params routing header.
10244 /// - The value is extracted from the request message's `table_name` field
10245 /// if it matches the full pattern specified:
10246 /// `projects/*/instances/*/tables/*`.
10247 ///
10248 /// **NB:** If the `path_template` field is not provided, the key name is
10249 /// equal to the field name, and the whole field should be sent as a value.
10250 /// This makes the pattern for the field and the value functionally equivalent
10251 /// to `**`, and the configuration
10252 ///
10253 /// ```norust
10254 /// {
10255 /// field: "table_name"
10256 /// }
10257 /// ```
10258 ///
10259 /// is a functionally equivalent shorthand to:
10260 ///
10261 /// ```norust
10262 /// {
10263 /// field: "table_name"
10264 /// path_template: "{table_name=**}"
10265 /// }
10266 /// ```
10267 ///
10268 /// See Example 1 for more details.
10269 pub path_template: std::string::String,
10270
10271 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10272}
10273
10274impl RoutingParameter {
10275 pub fn new() -> Self {
10276 std::default::Default::default()
10277 }
10278
10279 /// Sets the value of [field][crate::model::RoutingParameter::field].
10280 ///
10281 /// # Example
10282 /// ```ignore,no_run
10283 /// # use google_cloud_api::model::RoutingParameter;
10284 /// let x = RoutingParameter::new().set_field("example");
10285 /// ```
10286 pub fn set_field<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10287 self.field = v.into();
10288 self
10289 }
10290
10291 /// Sets the value of [path_template][crate::model::RoutingParameter::path_template].
10292 ///
10293 /// # Example
10294 /// ```ignore,no_run
10295 /// # use google_cloud_api::model::RoutingParameter;
10296 /// let x = RoutingParameter::new().set_path_template("example");
10297 /// ```
10298 pub fn set_path_template<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10299 self.path_template = v.into();
10300 self
10301 }
10302}
10303
10304impl wkt::message::Message for RoutingParameter {
10305 fn typename() -> &'static str {
10306 "type.googleapis.com/google.api.RoutingParameter"
10307 }
10308}
10309
10310/// `Service` is the root object of Google API service configuration (service
10311/// config). It describes the basic information about a logical service,
10312/// such as the service name and the user-facing title, and delegates other
10313/// aspects to sub-sections. Each sub-section is either a proto message or a
10314/// repeated proto message that configures a specific aspect, such as auth.
10315/// For more information, see each proto message definition.
10316///
10317/// Example:
10318///
10319/// ```norust
10320/// type: google.api.Service
10321/// name: calendar.googleapis.com
10322/// title: Google Calendar API
10323/// apis:
10324/// - name: google.calendar.v3.Calendar
10325///
10326/// visibility:
10327/// rules:
10328/// - selector: "google.calendar.v3.*"
10329/// restriction: PREVIEW
10330/// backend:
10331/// rules:
10332/// - selector: "google.calendar.v3.*"
10333/// address: calendar.example.com
10334///
10335/// authentication:
10336/// providers:
10337/// - id: google_calendar_auth
10338/// jwks_uri: https://www.googleapis.com/oauth2/v1/certs
10339/// issuer: https://securetoken.google.com
10340/// rules:
10341/// - selector: "*"
10342/// requirements:
10343/// provider_id: google_calendar_auth
10344/// ```
10345#[derive(Clone, Default, PartialEq)]
10346#[non_exhaustive]
10347pub struct Service {
10348 /// The service name, which is a DNS-like logical identifier for the
10349 /// service, such as `calendar.googleapis.com`. The service name
10350 /// typically goes through DNS verification to make sure the owner
10351 /// of the service also owns the DNS name.
10352 pub name: std::string::String,
10353
10354 /// The product title for this service, it is the name displayed in Google
10355 /// Cloud Console.
10356 pub title: std::string::String,
10357
10358 /// The Google project that owns this service.
10359 pub producer_project_id: std::string::String,
10360
10361 /// A unique ID for a specific instance of this message, typically assigned
10362 /// by the client for tracking purpose. Must be no longer than 63 characters
10363 /// and only lower case letters, digits, '.', '_' and '-' are allowed. If
10364 /// empty, the server may choose to generate one instead.
10365 pub id: std::string::String,
10366
10367 /// A list of API interfaces exported by this service. Only the `name` field
10368 /// of the [google.protobuf.Api][google.protobuf.Api] needs to be provided by
10369 /// the configuration author, as the remaining fields will be derived from the
10370 /// IDL during the normalization process. It is an error to specify an API
10371 /// interface here which cannot be resolved against the associated IDL files.
10372 ///
10373 /// [google.protobuf.Api]: wkt::Api
10374 pub apis: std::vec::Vec<wkt::Api>,
10375
10376 /// A list of all proto message types included in this API service.
10377 /// Types referenced directly or indirectly by the `apis` are automatically
10378 /// included. Messages which are not referenced but shall be included, such as
10379 /// types used by the `google.protobuf.Any` type, should be listed here by
10380 /// name by the configuration author. Example:
10381 ///
10382 /// ```norust
10383 /// types:
10384 /// - name: google.protobuf.Int32
10385 /// ```
10386 pub types: std::vec::Vec<wkt::Type>,
10387
10388 /// A list of all enum types included in this API service. Enums referenced
10389 /// directly or indirectly by the `apis` are automatically included. Enums
10390 /// which are not referenced but shall be included should be listed here by
10391 /// name by the configuration author. Example:
10392 ///
10393 /// ```norust
10394 /// enums:
10395 /// - name: google.someapi.v1.SomeEnum
10396 /// ```
10397 pub enums: std::vec::Vec<wkt::Enum>,
10398
10399 /// Additional API documentation.
10400 pub documentation: std::option::Option<crate::model::Documentation>,
10401
10402 /// API backend configuration.
10403 pub backend: std::option::Option<crate::model::Backend>,
10404
10405 /// HTTP configuration.
10406 pub http: std::option::Option<crate::model::Http>,
10407
10408 /// Quota configuration.
10409 pub quota: std::option::Option<crate::model::Quota>,
10410
10411 /// Auth configuration.
10412 pub authentication: std::option::Option<crate::model::Authentication>,
10413
10414 /// Context configuration.
10415 pub context: std::option::Option<crate::model::Context>,
10416
10417 /// Configuration controlling usage of this service.
10418 pub usage: std::option::Option<crate::model::Usage>,
10419
10420 /// Configuration for network endpoints. If this is empty, then an endpoint
10421 /// with the same name as the service is automatically generated to service all
10422 /// defined APIs.
10423 pub endpoints: std::vec::Vec<crate::model::Endpoint>,
10424
10425 /// Configuration for the service control plane.
10426 pub control: std::option::Option<crate::model::Control>,
10427
10428 /// Defines the logs used by this service.
10429 pub logs: std::vec::Vec<crate::model::LogDescriptor>,
10430
10431 /// Defines the metrics used by this service.
10432 pub metrics: std::vec::Vec<crate::model::MetricDescriptor>,
10433
10434 /// Defines the monitored resources used by this service. This is required
10435 /// by the [Service.monitoring][google.api.Service.monitoring] and
10436 /// [Service.logging][google.api.Service.logging] configurations.
10437 ///
10438 /// [google.api.Service.logging]: crate::model::Service::logging
10439 /// [google.api.Service.monitoring]: crate::model::Service::monitoring
10440 pub monitored_resources: std::vec::Vec<crate::model::MonitoredResourceDescriptor>,
10441
10442 /// Billing configuration.
10443 pub billing: std::option::Option<crate::model::Billing>,
10444
10445 /// Logging configuration.
10446 pub logging: std::option::Option<crate::model::Logging>,
10447
10448 /// Monitoring configuration.
10449 pub monitoring: std::option::Option<crate::model::Monitoring>,
10450
10451 /// System parameter configuration.
10452 pub system_parameters: std::option::Option<crate::model::SystemParameters>,
10453
10454 /// Output only. The source information for this configuration if available.
10455 pub source_info: std::option::Option<crate::model::SourceInfo>,
10456
10457 /// Settings for [Google Cloud Client
10458 /// libraries](https://cloud.google.com/apis/docs/cloud-client-libraries)
10459 /// generated from APIs defined as protocol buffers.
10460 pub publishing: std::option::Option<crate::model::Publishing>,
10461
10462 /// Obsolete. Do not use.
10463 ///
10464 /// This field has no semantic meaning. The service config compiler always
10465 /// sets this field to `3`.
10466 pub config_version: std::option::Option<wkt::UInt32Value>,
10467
10468 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10469}
10470
10471impl Service {
10472 pub fn new() -> Self {
10473 std::default::Default::default()
10474 }
10475
10476 /// Sets the value of [name][crate::model::Service::name].
10477 ///
10478 /// # Example
10479 /// ```ignore,no_run
10480 /// # use google_cloud_api::model::Service;
10481 /// let x = Service::new().set_name("example");
10482 /// ```
10483 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10484 self.name = v.into();
10485 self
10486 }
10487
10488 /// Sets the value of [title][crate::model::Service::title].
10489 ///
10490 /// # Example
10491 /// ```ignore,no_run
10492 /// # use google_cloud_api::model::Service;
10493 /// let x = Service::new().set_title("example");
10494 /// ```
10495 pub fn set_title<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10496 self.title = v.into();
10497 self
10498 }
10499
10500 /// Sets the value of [producer_project_id][crate::model::Service::producer_project_id].
10501 ///
10502 /// # Example
10503 /// ```ignore,no_run
10504 /// # use google_cloud_api::model::Service;
10505 /// let x = Service::new().set_producer_project_id("example");
10506 /// ```
10507 pub fn set_producer_project_id<T: std::convert::Into<std::string::String>>(
10508 mut self,
10509 v: T,
10510 ) -> Self {
10511 self.producer_project_id = v.into();
10512 self
10513 }
10514
10515 /// Sets the value of [id][crate::model::Service::id].
10516 ///
10517 /// # Example
10518 /// ```ignore,no_run
10519 /// # use google_cloud_api::model::Service;
10520 /// let x = Service::new().set_id("example");
10521 /// ```
10522 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10523 self.id = v.into();
10524 self
10525 }
10526
10527 /// Sets the value of [apis][crate::model::Service::apis].
10528 ///
10529 /// # Example
10530 /// ```ignore,no_run
10531 /// # use google_cloud_api::model::Service;
10532 /// use wkt::Api;
10533 /// let x = Service::new()
10534 /// .set_apis([
10535 /// Api::default()/* use setters */,
10536 /// Api::default()/* use (different) setters */,
10537 /// ]);
10538 /// ```
10539 pub fn set_apis<T, V>(mut self, v: T) -> Self
10540 where
10541 T: std::iter::IntoIterator<Item = V>,
10542 V: std::convert::Into<wkt::Api>,
10543 {
10544 use std::iter::Iterator;
10545 self.apis = v.into_iter().map(|i| i.into()).collect();
10546 self
10547 }
10548
10549 /// Sets the value of [types][crate::model::Service::types].
10550 ///
10551 /// # Example
10552 /// ```ignore,no_run
10553 /// # use google_cloud_api::model::Service;
10554 /// use wkt::Type;
10555 /// let x = Service::new()
10556 /// .set_types([
10557 /// Type::default()/* use setters */,
10558 /// Type::default()/* use (different) setters */,
10559 /// ]);
10560 /// ```
10561 pub fn set_types<T, V>(mut self, v: T) -> Self
10562 where
10563 T: std::iter::IntoIterator<Item = V>,
10564 V: std::convert::Into<wkt::Type>,
10565 {
10566 use std::iter::Iterator;
10567 self.types = v.into_iter().map(|i| i.into()).collect();
10568 self
10569 }
10570
10571 /// Sets the value of [enums][crate::model::Service::enums].
10572 ///
10573 /// # Example
10574 /// ```ignore,no_run
10575 /// # use google_cloud_api::model::Service;
10576 /// use wkt::Enum;
10577 /// let x = Service::new()
10578 /// .set_enums([
10579 /// Enum::default()/* use setters */,
10580 /// Enum::default()/* use (different) setters */,
10581 /// ]);
10582 /// ```
10583 pub fn set_enums<T, V>(mut self, v: T) -> Self
10584 where
10585 T: std::iter::IntoIterator<Item = V>,
10586 V: std::convert::Into<wkt::Enum>,
10587 {
10588 use std::iter::Iterator;
10589 self.enums = v.into_iter().map(|i| i.into()).collect();
10590 self
10591 }
10592
10593 /// Sets the value of [documentation][crate::model::Service::documentation].
10594 ///
10595 /// # Example
10596 /// ```ignore,no_run
10597 /// # use google_cloud_api::model::Service;
10598 /// use google_cloud_api::model::Documentation;
10599 /// let x = Service::new().set_documentation(Documentation::default()/* use setters */);
10600 /// ```
10601 pub fn set_documentation<T>(mut self, v: T) -> Self
10602 where
10603 T: std::convert::Into<crate::model::Documentation>,
10604 {
10605 self.documentation = std::option::Option::Some(v.into());
10606 self
10607 }
10608
10609 /// Sets or clears the value of [documentation][crate::model::Service::documentation].
10610 ///
10611 /// # Example
10612 /// ```ignore,no_run
10613 /// # use google_cloud_api::model::Service;
10614 /// use google_cloud_api::model::Documentation;
10615 /// let x = Service::new().set_or_clear_documentation(Some(Documentation::default()/* use setters */));
10616 /// let x = Service::new().set_or_clear_documentation(None::<Documentation>);
10617 /// ```
10618 pub fn set_or_clear_documentation<T>(mut self, v: std::option::Option<T>) -> Self
10619 where
10620 T: std::convert::Into<crate::model::Documentation>,
10621 {
10622 self.documentation = v.map(|x| x.into());
10623 self
10624 }
10625
10626 /// Sets the value of [backend][crate::model::Service::backend].
10627 ///
10628 /// # Example
10629 /// ```ignore,no_run
10630 /// # use google_cloud_api::model::Service;
10631 /// use google_cloud_api::model::Backend;
10632 /// let x = Service::new().set_backend(Backend::default()/* use setters */);
10633 /// ```
10634 pub fn set_backend<T>(mut self, v: T) -> Self
10635 where
10636 T: std::convert::Into<crate::model::Backend>,
10637 {
10638 self.backend = std::option::Option::Some(v.into());
10639 self
10640 }
10641
10642 /// Sets or clears the value of [backend][crate::model::Service::backend].
10643 ///
10644 /// # Example
10645 /// ```ignore,no_run
10646 /// # use google_cloud_api::model::Service;
10647 /// use google_cloud_api::model::Backend;
10648 /// let x = Service::new().set_or_clear_backend(Some(Backend::default()/* use setters */));
10649 /// let x = Service::new().set_or_clear_backend(None::<Backend>);
10650 /// ```
10651 pub fn set_or_clear_backend<T>(mut self, v: std::option::Option<T>) -> Self
10652 where
10653 T: std::convert::Into<crate::model::Backend>,
10654 {
10655 self.backend = v.map(|x| x.into());
10656 self
10657 }
10658
10659 /// Sets the value of [http][crate::model::Service::http].
10660 ///
10661 /// # Example
10662 /// ```ignore,no_run
10663 /// # use google_cloud_api::model::Service;
10664 /// use google_cloud_api::model::Http;
10665 /// let x = Service::new().set_http(Http::default()/* use setters */);
10666 /// ```
10667 pub fn set_http<T>(mut self, v: T) -> Self
10668 where
10669 T: std::convert::Into<crate::model::Http>,
10670 {
10671 self.http = std::option::Option::Some(v.into());
10672 self
10673 }
10674
10675 /// Sets or clears the value of [http][crate::model::Service::http].
10676 ///
10677 /// # Example
10678 /// ```ignore,no_run
10679 /// # use google_cloud_api::model::Service;
10680 /// use google_cloud_api::model::Http;
10681 /// let x = Service::new().set_or_clear_http(Some(Http::default()/* use setters */));
10682 /// let x = Service::new().set_or_clear_http(None::<Http>);
10683 /// ```
10684 pub fn set_or_clear_http<T>(mut self, v: std::option::Option<T>) -> Self
10685 where
10686 T: std::convert::Into<crate::model::Http>,
10687 {
10688 self.http = v.map(|x| x.into());
10689 self
10690 }
10691
10692 /// Sets the value of [quota][crate::model::Service::quota].
10693 ///
10694 /// # Example
10695 /// ```ignore,no_run
10696 /// # use google_cloud_api::model::Service;
10697 /// use google_cloud_api::model::Quota;
10698 /// let x = Service::new().set_quota(Quota::default()/* use setters */);
10699 /// ```
10700 pub fn set_quota<T>(mut self, v: T) -> Self
10701 where
10702 T: std::convert::Into<crate::model::Quota>,
10703 {
10704 self.quota = std::option::Option::Some(v.into());
10705 self
10706 }
10707
10708 /// Sets or clears the value of [quota][crate::model::Service::quota].
10709 ///
10710 /// # Example
10711 /// ```ignore,no_run
10712 /// # use google_cloud_api::model::Service;
10713 /// use google_cloud_api::model::Quota;
10714 /// let x = Service::new().set_or_clear_quota(Some(Quota::default()/* use setters */));
10715 /// let x = Service::new().set_or_clear_quota(None::<Quota>);
10716 /// ```
10717 pub fn set_or_clear_quota<T>(mut self, v: std::option::Option<T>) -> Self
10718 where
10719 T: std::convert::Into<crate::model::Quota>,
10720 {
10721 self.quota = v.map(|x| x.into());
10722 self
10723 }
10724
10725 /// Sets the value of [authentication][crate::model::Service::authentication].
10726 ///
10727 /// # Example
10728 /// ```ignore,no_run
10729 /// # use google_cloud_api::model::Service;
10730 /// use google_cloud_api::model::Authentication;
10731 /// let x = Service::new().set_authentication(Authentication::default()/* use setters */);
10732 /// ```
10733 pub fn set_authentication<T>(mut self, v: T) -> Self
10734 where
10735 T: std::convert::Into<crate::model::Authentication>,
10736 {
10737 self.authentication = std::option::Option::Some(v.into());
10738 self
10739 }
10740
10741 /// Sets or clears the value of [authentication][crate::model::Service::authentication].
10742 ///
10743 /// # Example
10744 /// ```ignore,no_run
10745 /// # use google_cloud_api::model::Service;
10746 /// use google_cloud_api::model::Authentication;
10747 /// let x = Service::new().set_or_clear_authentication(Some(Authentication::default()/* use setters */));
10748 /// let x = Service::new().set_or_clear_authentication(None::<Authentication>);
10749 /// ```
10750 pub fn set_or_clear_authentication<T>(mut self, v: std::option::Option<T>) -> Self
10751 where
10752 T: std::convert::Into<crate::model::Authentication>,
10753 {
10754 self.authentication = v.map(|x| x.into());
10755 self
10756 }
10757
10758 /// Sets the value of [context][crate::model::Service::context].
10759 ///
10760 /// # Example
10761 /// ```ignore,no_run
10762 /// # use google_cloud_api::model::Service;
10763 /// use google_cloud_api::model::Context;
10764 /// let x = Service::new().set_context(Context::default()/* use setters */);
10765 /// ```
10766 pub fn set_context<T>(mut self, v: T) -> Self
10767 where
10768 T: std::convert::Into<crate::model::Context>,
10769 {
10770 self.context = std::option::Option::Some(v.into());
10771 self
10772 }
10773
10774 /// Sets or clears the value of [context][crate::model::Service::context].
10775 ///
10776 /// # Example
10777 /// ```ignore,no_run
10778 /// # use google_cloud_api::model::Service;
10779 /// use google_cloud_api::model::Context;
10780 /// let x = Service::new().set_or_clear_context(Some(Context::default()/* use setters */));
10781 /// let x = Service::new().set_or_clear_context(None::<Context>);
10782 /// ```
10783 pub fn set_or_clear_context<T>(mut self, v: std::option::Option<T>) -> Self
10784 where
10785 T: std::convert::Into<crate::model::Context>,
10786 {
10787 self.context = v.map(|x| x.into());
10788 self
10789 }
10790
10791 /// Sets the value of [usage][crate::model::Service::usage].
10792 ///
10793 /// # Example
10794 /// ```ignore,no_run
10795 /// # use google_cloud_api::model::Service;
10796 /// use google_cloud_api::model::Usage;
10797 /// let x = Service::new().set_usage(Usage::default()/* use setters */);
10798 /// ```
10799 pub fn set_usage<T>(mut self, v: T) -> Self
10800 where
10801 T: std::convert::Into<crate::model::Usage>,
10802 {
10803 self.usage = std::option::Option::Some(v.into());
10804 self
10805 }
10806
10807 /// Sets or clears the value of [usage][crate::model::Service::usage].
10808 ///
10809 /// # Example
10810 /// ```ignore,no_run
10811 /// # use google_cloud_api::model::Service;
10812 /// use google_cloud_api::model::Usage;
10813 /// let x = Service::new().set_or_clear_usage(Some(Usage::default()/* use setters */));
10814 /// let x = Service::new().set_or_clear_usage(None::<Usage>);
10815 /// ```
10816 pub fn set_or_clear_usage<T>(mut self, v: std::option::Option<T>) -> Self
10817 where
10818 T: std::convert::Into<crate::model::Usage>,
10819 {
10820 self.usage = v.map(|x| x.into());
10821 self
10822 }
10823
10824 /// Sets the value of [endpoints][crate::model::Service::endpoints].
10825 ///
10826 /// # Example
10827 /// ```ignore,no_run
10828 /// # use google_cloud_api::model::Service;
10829 /// use google_cloud_api::model::Endpoint;
10830 /// let x = Service::new()
10831 /// .set_endpoints([
10832 /// Endpoint::default()/* use setters */,
10833 /// Endpoint::default()/* use (different) setters */,
10834 /// ]);
10835 /// ```
10836 pub fn set_endpoints<T, V>(mut self, v: T) -> Self
10837 where
10838 T: std::iter::IntoIterator<Item = V>,
10839 V: std::convert::Into<crate::model::Endpoint>,
10840 {
10841 use std::iter::Iterator;
10842 self.endpoints = v.into_iter().map(|i| i.into()).collect();
10843 self
10844 }
10845
10846 /// Sets the value of [control][crate::model::Service::control].
10847 ///
10848 /// # Example
10849 /// ```ignore,no_run
10850 /// # use google_cloud_api::model::Service;
10851 /// use google_cloud_api::model::Control;
10852 /// let x = Service::new().set_control(Control::default()/* use setters */);
10853 /// ```
10854 pub fn set_control<T>(mut self, v: T) -> Self
10855 where
10856 T: std::convert::Into<crate::model::Control>,
10857 {
10858 self.control = std::option::Option::Some(v.into());
10859 self
10860 }
10861
10862 /// Sets or clears the value of [control][crate::model::Service::control].
10863 ///
10864 /// # Example
10865 /// ```ignore,no_run
10866 /// # use google_cloud_api::model::Service;
10867 /// use google_cloud_api::model::Control;
10868 /// let x = Service::new().set_or_clear_control(Some(Control::default()/* use setters */));
10869 /// let x = Service::new().set_or_clear_control(None::<Control>);
10870 /// ```
10871 pub fn set_or_clear_control<T>(mut self, v: std::option::Option<T>) -> Self
10872 where
10873 T: std::convert::Into<crate::model::Control>,
10874 {
10875 self.control = v.map(|x| x.into());
10876 self
10877 }
10878
10879 /// Sets the value of [logs][crate::model::Service::logs].
10880 ///
10881 /// # Example
10882 /// ```ignore,no_run
10883 /// # use google_cloud_api::model::Service;
10884 /// use google_cloud_api::model::LogDescriptor;
10885 /// let x = Service::new()
10886 /// .set_logs([
10887 /// LogDescriptor::default()/* use setters */,
10888 /// LogDescriptor::default()/* use (different) setters */,
10889 /// ]);
10890 /// ```
10891 pub fn set_logs<T, V>(mut self, v: T) -> Self
10892 where
10893 T: std::iter::IntoIterator<Item = V>,
10894 V: std::convert::Into<crate::model::LogDescriptor>,
10895 {
10896 use std::iter::Iterator;
10897 self.logs = v.into_iter().map(|i| i.into()).collect();
10898 self
10899 }
10900
10901 /// Sets the value of [metrics][crate::model::Service::metrics].
10902 ///
10903 /// # Example
10904 /// ```ignore,no_run
10905 /// # use google_cloud_api::model::Service;
10906 /// use google_cloud_api::model::MetricDescriptor;
10907 /// let x = Service::new()
10908 /// .set_metrics([
10909 /// MetricDescriptor::default()/* use setters */,
10910 /// MetricDescriptor::default()/* use (different) setters */,
10911 /// ]);
10912 /// ```
10913 pub fn set_metrics<T, V>(mut self, v: T) -> Self
10914 where
10915 T: std::iter::IntoIterator<Item = V>,
10916 V: std::convert::Into<crate::model::MetricDescriptor>,
10917 {
10918 use std::iter::Iterator;
10919 self.metrics = v.into_iter().map(|i| i.into()).collect();
10920 self
10921 }
10922
10923 /// Sets the value of [monitored_resources][crate::model::Service::monitored_resources].
10924 ///
10925 /// # Example
10926 /// ```ignore,no_run
10927 /// # use google_cloud_api::model::Service;
10928 /// use google_cloud_api::model::MonitoredResourceDescriptor;
10929 /// let x = Service::new()
10930 /// .set_monitored_resources([
10931 /// MonitoredResourceDescriptor::default()/* use setters */,
10932 /// MonitoredResourceDescriptor::default()/* use (different) setters */,
10933 /// ]);
10934 /// ```
10935 pub fn set_monitored_resources<T, V>(mut self, v: T) -> Self
10936 where
10937 T: std::iter::IntoIterator<Item = V>,
10938 V: std::convert::Into<crate::model::MonitoredResourceDescriptor>,
10939 {
10940 use std::iter::Iterator;
10941 self.monitored_resources = v.into_iter().map(|i| i.into()).collect();
10942 self
10943 }
10944
10945 /// Sets the value of [billing][crate::model::Service::billing].
10946 ///
10947 /// # Example
10948 /// ```ignore,no_run
10949 /// # use google_cloud_api::model::Service;
10950 /// use google_cloud_api::model::Billing;
10951 /// let x = Service::new().set_billing(Billing::default()/* use setters */);
10952 /// ```
10953 pub fn set_billing<T>(mut self, v: T) -> Self
10954 where
10955 T: std::convert::Into<crate::model::Billing>,
10956 {
10957 self.billing = std::option::Option::Some(v.into());
10958 self
10959 }
10960
10961 /// Sets or clears the value of [billing][crate::model::Service::billing].
10962 ///
10963 /// # Example
10964 /// ```ignore,no_run
10965 /// # use google_cloud_api::model::Service;
10966 /// use google_cloud_api::model::Billing;
10967 /// let x = Service::new().set_or_clear_billing(Some(Billing::default()/* use setters */));
10968 /// let x = Service::new().set_or_clear_billing(None::<Billing>);
10969 /// ```
10970 pub fn set_or_clear_billing<T>(mut self, v: std::option::Option<T>) -> Self
10971 where
10972 T: std::convert::Into<crate::model::Billing>,
10973 {
10974 self.billing = v.map(|x| x.into());
10975 self
10976 }
10977
10978 /// Sets the value of [logging][crate::model::Service::logging].
10979 ///
10980 /// # Example
10981 /// ```ignore,no_run
10982 /// # use google_cloud_api::model::Service;
10983 /// use google_cloud_api::model::Logging;
10984 /// let x = Service::new().set_logging(Logging::default()/* use setters */);
10985 /// ```
10986 pub fn set_logging<T>(mut self, v: T) -> Self
10987 where
10988 T: std::convert::Into<crate::model::Logging>,
10989 {
10990 self.logging = std::option::Option::Some(v.into());
10991 self
10992 }
10993
10994 /// Sets or clears the value of [logging][crate::model::Service::logging].
10995 ///
10996 /// # Example
10997 /// ```ignore,no_run
10998 /// # use google_cloud_api::model::Service;
10999 /// use google_cloud_api::model::Logging;
11000 /// let x = Service::new().set_or_clear_logging(Some(Logging::default()/* use setters */));
11001 /// let x = Service::new().set_or_clear_logging(None::<Logging>);
11002 /// ```
11003 pub fn set_or_clear_logging<T>(mut self, v: std::option::Option<T>) -> Self
11004 where
11005 T: std::convert::Into<crate::model::Logging>,
11006 {
11007 self.logging = v.map(|x| x.into());
11008 self
11009 }
11010
11011 /// Sets the value of [monitoring][crate::model::Service::monitoring].
11012 ///
11013 /// # Example
11014 /// ```ignore,no_run
11015 /// # use google_cloud_api::model::Service;
11016 /// use google_cloud_api::model::Monitoring;
11017 /// let x = Service::new().set_monitoring(Monitoring::default()/* use setters */);
11018 /// ```
11019 pub fn set_monitoring<T>(mut self, v: T) -> Self
11020 where
11021 T: std::convert::Into<crate::model::Monitoring>,
11022 {
11023 self.monitoring = std::option::Option::Some(v.into());
11024 self
11025 }
11026
11027 /// Sets or clears the value of [monitoring][crate::model::Service::monitoring].
11028 ///
11029 /// # Example
11030 /// ```ignore,no_run
11031 /// # use google_cloud_api::model::Service;
11032 /// use google_cloud_api::model::Monitoring;
11033 /// let x = Service::new().set_or_clear_monitoring(Some(Monitoring::default()/* use setters */));
11034 /// let x = Service::new().set_or_clear_monitoring(None::<Monitoring>);
11035 /// ```
11036 pub fn set_or_clear_monitoring<T>(mut self, v: std::option::Option<T>) -> Self
11037 where
11038 T: std::convert::Into<crate::model::Monitoring>,
11039 {
11040 self.monitoring = v.map(|x| x.into());
11041 self
11042 }
11043
11044 /// Sets the value of [system_parameters][crate::model::Service::system_parameters].
11045 ///
11046 /// # Example
11047 /// ```ignore,no_run
11048 /// # use google_cloud_api::model::Service;
11049 /// use google_cloud_api::model::SystemParameters;
11050 /// let x = Service::new().set_system_parameters(SystemParameters::default()/* use setters */);
11051 /// ```
11052 pub fn set_system_parameters<T>(mut self, v: T) -> Self
11053 where
11054 T: std::convert::Into<crate::model::SystemParameters>,
11055 {
11056 self.system_parameters = std::option::Option::Some(v.into());
11057 self
11058 }
11059
11060 /// Sets or clears the value of [system_parameters][crate::model::Service::system_parameters].
11061 ///
11062 /// # Example
11063 /// ```ignore,no_run
11064 /// # use google_cloud_api::model::Service;
11065 /// use google_cloud_api::model::SystemParameters;
11066 /// let x = Service::new().set_or_clear_system_parameters(Some(SystemParameters::default()/* use setters */));
11067 /// let x = Service::new().set_or_clear_system_parameters(None::<SystemParameters>);
11068 /// ```
11069 pub fn set_or_clear_system_parameters<T>(mut self, v: std::option::Option<T>) -> Self
11070 where
11071 T: std::convert::Into<crate::model::SystemParameters>,
11072 {
11073 self.system_parameters = v.map(|x| x.into());
11074 self
11075 }
11076
11077 /// Sets the value of [source_info][crate::model::Service::source_info].
11078 ///
11079 /// # Example
11080 /// ```ignore,no_run
11081 /// # use google_cloud_api::model::Service;
11082 /// use google_cloud_api::model::SourceInfo;
11083 /// let x = Service::new().set_source_info(SourceInfo::default()/* use setters */);
11084 /// ```
11085 pub fn set_source_info<T>(mut self, v: T) -> Self
11086 where
11087 T: std::convert::Into<crate::model::SourceInfo>,
11088 {
11089 self.source_info = std::option::Option::Some(v.into());
11090 self
11091 }
11092
11093 /// Sets or clears the value of [source_info][crate::model::Service::source_info].
11094 ///
11095 /// # Example
11096 /// ```ignore,no_run
11097 /// # use google_cloud_api::model::Service;
11098 /// use google_cloud_api::model::SourceInfo;
11099 /// let x = Service::new().set_or_clear_source_info(Some(SourceInfo::default()/* use setters */));
11100 /// let x = Service::new().set_or_clear_source_info(None::<SourceInfo>);
11101 /// ```
11102 pub fn set_or_clear_source_info<T>(mut self, v: std::option::Option<T>) -> Self
11103 where
11104 T: std::convert::Into<crate::model::SourceInfo>,
11105 {
11106 self.source_info = v.map(|x| x.into());
11107 self
11108 }
11109
11110 /// Sets the value of [publishing][crate::model::Service::publishing].
11111 ///
11112 /// # Example
11113 /// ```ignore,no_run
11114 /// # use google_cloud_api::model::Service;
11115 /// use google_cloud_api::model::Publishing;
11116 /// let x = Service::new().set_publishing(Publishing::default()/* use setters */);
11117 /// ```
11118 pub fn set_publishing<T>(mut self, v: T) -> Self
11119 where
11120 T: std::convert::Into<crate::model::Publishing>,
11121 {
11122 self.publishing = std::option::Option::Some(v.into());
11123 self
11124 }
11125
11126 /// Sets or clears the value of [publishing][crate::model::Service::publishing].
11127 ///
11128 /// # Example
11129 /// ```ignore,no_run
11130 /// # use google_cloud_api::model::Service;
11131 /// use google_cloud_api::model::Publishing;
11132 /// let x = Service::new().set_or_clear_publishing(Some(Publishing::default()/* use setters */));
11133 /// let x = Service::new().set_or_clear_publishing(None::<Publishing>);
11134 /// ```
11135 pub fn set_or_clear_publishing<T>(mut self, v: std::option::Option<T>) -> Self
11136 where
11137 T: std::convert::Into<crate::model::Publishing>,
11138 {
11139 self.publishing = v.map(|x| x.into());
11140 self
11141 }
11142
11143 /// Sets the value of [config_version][crate::model::Service::config_version].
11144 ///
11145 /// # Example
11146 /// ```ignore,no_run
11147 /// # use google_cloud_api::model::Service;
11148 /// use wkt::UInt32Value;
11149 /// let x = Service::new().set_config_version(UInt32Value::default()/* use setters */);
11150 /// ```
11151 pub fn set_config_version<T>(mut self, v: T) -> Self
11152 where
11153 T: std::convert::Into<wkt::UInt32Value>,
11154 {
11155 self.config_version = std::option::Option::Some(v.into());
11156 self
11157 }
11158
11159 /// Sets or clears the value of [config_version][crate::model::Service::config_version].
11160 ///
11161 /// # Example
11162 /// ```ignore,no_run
11163 /// # use google_cloud_api::model::Service;
11164 /// use wkt::UInt32Value;
11165 /// let x = Service::new().set_or_clear_config_version(Some(UInt32Value::default()/* use setters */));
11166 /// let x = Service::new().set_or_clear_config_version(None::<UInt32Value>);
11167 /// ```
11168 pub fn set_or_clear_config_version<T>(mut self, v: std::option::Option<T>) -> Self
11169 where
11170 T: std::convert::Into<wkt::UInt32Value>,
11171 {
11172 self.config_version = v.map(|x| x.into());
11173 self
11174 }
11175}
11176
11177impl wkt::message::Message for Service {
11178 fn typename() -> &'static str {
11179 "type.googleapis.com/google.api.Service"
11180 }
11181}
11182
11183/// Source information used to create a Service Config
11184#[derive(Clone, Default, PartialEq)]
11185#[non_exhaustive]
11186pub struct SourceInfo {
11187 /// All files used during config generation.
11188 pub source_files: std::vec::Vec<wkt::Any>,
11189
11190 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11191}
11192
11193impl SourceInfo {
11194 pub fn new() -> Self {
11195 std::default::Default::default()
11196 }
11197
11198 /// Sets the value of [source_files][crate::model::SourceInfo::source_files].
11199 ///
11200 /// # Example
11201 /// ```ignore,no_run
11202 /// # use google_cloud_api::model::SourceInfo;
11203 /// use wkt::Any;
11204 /// let x = SourceInfo::new()
11205 /// .set_source_files([
11206 /// Any::default()/* use setters */,
11207 /// Any::default()/* use (different) setters */,
11208 /// ]);
11209 /// ```
11210 pub fn set_source_files<T, V>(mut self, v: T) -> Self
11211 where
11212 T: std::iter::IntoIterator<Item = V>,
11213 V: std::convert::Into<wkt::Any>,
11214 {
11215 use std::iter::Iterator;
11216 self.source_files = v.into_iter().map(|i| i.into()).collect();
11217 self
11218 }
11219}
11220
11221impl wkt::message::Message for SourceInfo {
11222 fn typename() -> &'static str {
11223 "type.googleapis.com/google.api.SourceInfo"
11224 }
11225}
11226
11227/// ### System parameter configuration
11228///
11229/// A system parameter is a special kind of parameter defined by the API
11230/// system, not by an individual API. It is typically mapped to an HTTP header
11231/// and/or a URL query parameter. This configuration specifies which methods
11232/// change the names of the system parameters.
11233#[derive(Clone, Default, PartialEq)]
11234#[non_exhaustive]
11235pub struct SystemParameters {
11236 /// Define system parameters.
11237 ///
11238 /// The parameters defined here will override the default parameters
11239 /// implemented by the system. If this field is missing from the service
11240 /// config, default system parameters will be used. Default system parameters
11241 /// and names is implementation-dependent.
11242 ///
11243 /// Example: define api key for all methods
11244 ///
11245 /// ```norust
11246 /// system_parameters
11247 /// rules:
11248 /// - selector: "*"
11249 /// parameters:
11250 /// - name: api_key
11251 /// url_query_parameter: api_key
11252 /// ```
11253 ///
11254 /// Example: define 2 api key names for a specific method.
11255 ///
11256 /// ```norust
11257 /// system_parameters
11258 /// rules:
11259 /// - selector: "/ListShelves"
11260 /// parameters:
11261 /// - name: api_key
11262 /// http_header: Api-Key1
11263 /// - name: api_key
11264 /// http_header: Api-Key2
11265 /// ```
11266 ///
11267 /// **NOTE:** All service configuration rules follow "last one wins" order.
11268 pub rules: std::vec::Vec<crate::model::SystemParameterRule>,
11269
11270 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11271}
11272
11273impl SystemParameters {
11274 pub fn new() -> Self {
11275 std::default::Default::default()
11276 }
11277
11278 /// Sets the value of [rules][crate::model::SystemParameters::rules].
11279 ///
11280 /// # Example
11281 /// ```ignore,no_run
11282 /// # use google_cloud_api::model::SystemParameters;
11283 /// use google_cloud_api::model::SystemParameterRule;
11284 /// let x = SystemParameters::new()
11285 /// .set_rules([
11286 /// SystemParameterRule::default()/* use setters */,
11287 /// SystemParameterRule::default()/* use (different) setters */,
11288 /// ]);
11289 /// ```
11290 pub fn set_rules<T, V>(mut self, v: T) -> Self
11291 where
11292 T: std::iter::IntoIterator<Item = V>,
11293 V: std::convert::Into<crate::model::SystemParameterRule>,
11294 {
11295 use std::iter::Iterator;
11296 self.rules = v.into_iter().map(|i| i.into()).collect();
11297 self
11298 }
11299}
11300
11301impl wkt::message::Message for SystemParameters {
11302 fn typename() -> &'static str {
11303 "type.googleapis.com/google.api.SystemParameters"
11304 }
11305}
11306
11307/// Define a system parameter rule mapping system parameter definitions to
11308/// methods.
11309#[derive(Clone, Default, PartialEq)]
11310#[non_exhaustive]
11311pub struct SystemParameterRule {
11312 /// Selects the methods to which this rule applies. Use '*' to indicate all
11313 /// methods in all APIs.
11314 ///
11315 /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
11316 /// details.
11317 ///
11318 /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
11319 pub selector: std::string::String,
11320
11321 /// Define parameters. Multiple names may be defined for a parameter.
11322 /// For a given method call, only one of them should be used. If multiple
11323 /// names are used the behavior is implementation-dependent.
11324 /// If none of the specified names are present the behavior is
11325 /// parameter-dependent.
11326 pub parameters: std::vec::Vec<crate::model::SystemParameter>,
11327
11328 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11329}
11330
11331impl SystemParameterRule {
11332 pub fn new() -> Self {
11333 std::default::Default::default()
11334 }
11335
11336 /// Sets the value of [selector][crate::model::SystemParameterRule::selector].
11337 ///
11338 /// # Example
11339 /// ```ignore,no_run
11340 /// # use google_cloud_api::model::SystemParameterRule;
11341 /// let x = SystemParameterRule::new().set_selector("example");
11342 /// ```
11343 pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11344 self.selector = v.into();
11345 self
11346 }
11347
11348 /// Sets the value of [parameters][crate::model::SystemParameterRule::parameters].
11349 ///
11350 /// # Example
11351 /// ```ignore,no_run
11352 /// # use google_cloud_api::model::SystemParameterRule;
11353 /// use google_cloud_api::model::SystemParameter;
11354 /// let x = SystemParameterRule::new()
11355 /// .set_parameters([
11356 /// SystemParameter::default()/* use setters */,
11357 /// SystemParameter::default()/* use (different) setters */,
11358 /// ]);
11359 /// ```
11360 pub fn set_parameters<T, V>(mut self, v: T) -> Self
11361 where
11362 T: std::iter::IntoIterator<Item = V>,
11363 V: std::convert::Into<crate::model::SystemParameter>,
11364 {
11365 use std::iter::Iterator;
11366 self.parameters = v.into_iter().map(|i| i.into()).collect();
11367 self
11368 }
11369}
11370
11371impl wkt::message::Message for SystemParameterRule {
11372 fn typename() -> &'static str {
11373 "type.googleapis.com/google.api.SystemParameterRule"
11374 }
11375}
11376
11377/// Define a parameter's name and location. The parameter may be passed as either
11378/// an HTTP header or a URL query parameter, and if both are passed the behavior
11379/// is implementation-dependent.
11380#[derive(Clone, Default, PartialEq)]
11381#[non_exhaustive]
11382pub struct SystemParameter {
11383 /// Define the name of the parameter, such as "api_key" . It is case sensitive.
11384 pub name: std::string::String,
11385
11386 /// Define the HTTP header name to use for the parameter. It is case
11387 /// insensitive.
11388 pub http_header: std::string::String,
11389
11390 /// Define the URL query parameter name to use for the parameter. It is case
11391 /// sensitive.
11392 pub url_query_parameter: std::string::String,
11393
11394 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11395}
11396
11397impl SystemParameter {
11398 pub fn new() -> Self {
11399 std::default::Default::default()
11400 }
11401
11402 /// Sets the value of [name][crate::model::SystemParameter::name].
11403 ///
11404 /// # Example
11405 /// ```ignore,no_run
11406 /// # use google_cloud_api::model::SystemParameter;
11407 /// let x = SystemParameter::new().set_name("example");
11408 /// ```
11409 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11410 self.name = v.into();
11411 self
11412 }
11413
11414 /// Sets the value of [http_header][crate::model::SystemParameter::http_header].
11415 ///
11416 /// # Example
11417 /// ```ignore,no_run
11418 /// # use google_cloud_api::model::SystemParameter;
11419 /// let x = SystemParameter::new().set_http_header("example");
11420 /// ```
11421 pub fn set_http_header<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11422 self.http_header = v.into();
11423 self
11424 }
11425
11426 /// Sets the value of [url_query_parameter][crate::model::SystemParameter::url_query_parameter].
11427 ///
11428 /// # Example
11429 /// ```ignore,no_run
11430 /// # use google_cloud_api::model::SystemParameter;
11431 /// let x = SystemParameter::new().set_url_query_parameter("example");
11432 /// ```
11433 pub fn set_url_query_parameter<T: std::convert::Into<std::string::String>>(
11434 mut self,
11435 v: T,
11436 ) -> Self {
11437 self.url_query_parameter = v.into();
11438 self
11439 }
11440}
11441
11442impl wkt::message::Message for SystemParameter {
11443 fn typename() -> &'static str {
11444 "type.googleapis.com/google.api.SystemParameter"
11445 }
11446}
11447
11448/// Configuration controlling usage of a service.
11449#[derive(Clone, Default, PartialEq)]
11450#[non_exhaustive]
11451pub struct Usage {
11452 /// Requirements that must be satisfied before a consumer project can use the
11453 /// service. Each requirement is of the form <service.name>/\<requirement-id\>;
11454 /// for example 'serviceusage.googleapis.com/billing-enabled'.
11455 ///
11456 /// For Google APIs, a Terms of Service requirement must be included here.
11457 /// Google Cloud APIs must include "serviceusage.googleapis.com/tos/cloud".
11458 /// Other Google APIs should include
11459 /// "serviceusage.googleapis.com/tos/universal". Additional ToS can be
11460 /// included based on the business needs.
11461 pub requirements: std::vec::Vec<std::string::String>,
11462
11463 /// A list of usage rules that apply to individual API methods.
11464 ///
11465 /// **NOTE:** All service configuration rules follow "last one wins" order.
11466 pub rules: std::vec::Vec<crate::model::UsageRule>,
11467
11468 /// The full resource name of a channel used for sending notifications to the
11469 /// service producer.
11470 ///
11471 /// Google Service Management currently only supports
11472 /// [Google Cloud Pub/Sub](https://cloud.google.com/pubsub) as a notification
11473 /// channel. To use Google Cloud Pub/Sub as the channel, this must be the name
11474 /// of a Cloud Pub/Sub topic that uses the Cloud Pub/Sub topic name format
11475 /// documented in <https://cloud.google.com/pubsub/docs/overview>.
11476 pub producer_notification_channel: std::string::String,
11477
11478 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11479}
11480
11481impl Usage {
11482 pub fn new() -> Self {
11483 std::default::Default::default()
11484 }
11485
11486 /// Sets the value of [requirements][crate::model::Usage::requirements].
11487 ///
11488 /// # Example
11489 /// ```ignore,no_run
11490 /// # use google_cloud_api::model::Usage;
11491 /// let x = Usage::new().set_requirements(["a", "b", "c"]);
11492 /// ```
11493 pub fn set_requirements<T, V>(mut self, v: T) -> Self
11494 where
11495 T: std::iter::IntoIterator<Item = V>,
11496 V: std::convert::Into<std::string::String>,
11497 {
11498 use std::iter::Iterator;
11499 self.requirements = v.into_iter().map(|i| i.into()).collect();
11500 self
11501 }
11502
11503 /// Sets the value of [rules][crate::model::Usage::rules].
11504 ///
11505 /// # Example
11506 /// ```ignore,no_run
11507 /// # use google_cloud_api::model::Usage;
11508 /// use google_cloud_api::model::UsageRule;
11509 /// let x = Usage::new()
11510 /// .set_rules([
11511 /// UsageRule::default()/* use setters */,
11512 /// UsageRule::default()/* use (different) setters */,
11513 /// ]);
11514 /// ```
11515 pub fn set_rules<T, V>(mut self, v: T) -> Self
11516 where
11517 T: std::iter::IntoIterator<Item = V>,
11518 V: std::convert::Into<crate::model::UsageRule>,
11519 {
11520 use std::iter::Iterator;
11521 self.rules = v.into_iter().map(|i| i.into()).collect();
11522 self
11523 }
11524
11525 /// Sets the value of [producer_notification_channel][crate::model::Usage::producer_notification_channel].
11526 ///
11527 /// # Example
11528 /// ```ignore,no_run
11529 /// # use google_cloud_api::model::Usage;
11530 /// let x = Usage::new().set_producer_notification_channel("example");
11531 /// ```
11532 pub fn set_producer_notification_channel<T: std::convert::Into<std::string::String>>(
11533 mut self,
11534 v: T,
11535 ) -> Self {
11536 self.producer_notification_channel = v.into();
11537 self
11538 }
11539}
11540
11541impl wkt::message::Message for Usage {
11542 fn typename() -> &'static str {
11543 "type.googleapis.com/google.api.Usage"
11544 }
11545}
11546
11547/// Usage configuration rules for the service.
11548///
11549/// NOTE: Under development.
11550///
11551/// Use this rule to configure unregistered calls for the service. Unregistered
11552/// calls are calls that do not contain consumer project identity.
11553/// (Example: calls that do not contain an API key).
11554/// By default, API methods do not allow unregistered calls, and each method call
11555/// must be identified by a consumer project identity. Use this rule to
11556/// allow/disallow unregistered calls.
11557///
11558/// Example of an API that wants to allow unregistered calls for entire service.
11559///
11560/// ```norust
11561/// usage:
11562/// rules:
11563/// - selector: "*"
11564/// allow_unregistered_calls: true
11565/// ```
11566///
11567/// Example of a method that wants to allow unregistered calls.
11568///
11569/// ```norust
11570/// usage:
11571/// rules:
11572/// - selector: "google.example.library.v1.LibraryService.CreateBook"
11573/// allow_unregistered_calls: true
11574/// ```
11575#[derive(Clone, Default, PartialEq)]
11576#[non_exhaustive]
11577pub struct UsageRule {
11578 /// Selects the methods to which this rule applies. Use '*' to indicate all
11579 /// methods in all APIs.
11580 ///
11581 /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
11582 /// details.
11583 ///
11584 /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
11585 pub selector: std::string::String,
11586
11587 /// If true, the selected method allows unregistered calls, e.g. calls
11588 /// that don't identify any user or application.
11589 pub allow_unregistered_calls: bool,
11590
11591 /// If true, the selected method should skip service control and the control
11592 /// plane features, such as quota and billing, will not be available.
11593 /// This flag is used by Google Cloud Endpoints to bypass checks for internal
11594 /// methods, such as service health check methods.
11595 pub skip_service_control: bool,
11596
11597 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11598}
11599
11600impl UsageRule {
11601 pub fn new() -> Self {
11602 std::default::Default::default()
11603 }
11604
11605 /// Sets the value of [selector][crate::model::UsageRule::selector].
11606 ///
11607 /// # Example
11608 /// ```ignore,no_run
11609 /// # use google_cloud_api::model::UsageRule;
11610 /// let x = UsageRule::new().set_selector("example");
11611 /// ```
11612 pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11613 self.selector = v.into();
11614 self
11615 }
11616
11617 /// Sets the value of [allow_unregistered_calls][crate::model::UsageRule::allow_unregistered_calls].
11618 ///
11619 /// # Example
11620 /// ```ignore,no_run
11621 /// # use google_cloud_api::model::UsageRule;
11622 /// let x = UsageRule::new().set_allow_unregistered_calls(true);
11623 /// ```
11624 pub fn set_allow_unregistered_calls<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11625 self.allow_unregistered_calls = v.into();
11626 self
11627 }
11628
11629 /// Sets the value of [skip_service_control][crate::model::UsageRule::skip_service_control].
11630 ///
11631 /// # Example
11632 /// ```ignore,no_run
11633 /// # use google_cloud_api::model::UsageRule;
11634 /// let x = UsageRule::new().set_skip_service_control(true);
11635 /// ```
11636 pub fn set_skip_service_control<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11637 self.skip_service_control = v.into();
11638 self
11639 }
11640}
11641
11642impl wkt::message::Message for UsageRule {
11643 fn typename() -> &'static str {
11644 "type.googleapis.com/google.api.UsageRule"
11645 }
11646}
11647
11648/// `Visibility` restricts service consumer's access to service elements,
11649/// such as whether an application can call a visibility-restricted method.
11650/// The restriction is expressed by applying visibility labels on service
11651/// elements. The visibility labels are elsewhere linked to service consumers.
11652///
11653/// A service can define multiple visibility labels, but a service consumer
11654/// should be granted at most one visibility label. Multiple visibility
11655/// labels for a single service consumer are not supported.
11656///
11657/// If an element and all its parents have no visibility label, its visibility
11658/// is unconditionally granted.
11659///
11660/// Example:
11661///
11662/// ```norust
11663/// visibility:
11664/// rules:
11665/// - selector: google.calendar.Calendar.EnhancedSearch
11666/// restriction: PREVIEW
11667/// - selector: google.calendar.Calendar.Delegate
11668/// restriction: INTERNAL
11669/// ```
11670///
11671/// Here, all methods are publicly visible except for the restricted methods
11672/// EnhancedSearch and Delegate.
11673#[derive(Clone, Default, PartialEq)]
11674#[non_exhaustive]
11675pub struct Visibility {
11676 /// A list of visibility rules that apply to individual API elements.
11677 ///
11678 /// **NOTE:** All service configuration rules follow "last one wins" order.
11679 pub rules: std::vec::Vec<crate::model::VisibilityRule>,
11680
11681 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11682}
11683
11684impl Visibility {
11685 pub fn new() -> Self {
11686 std::default::Default::default()
11687 }
11688
11689 /// Sets the value of [rules][crate::model::Visibility::rules].
11690 ///
11691 /// # Example
11692 /// ```ignore,no_run
11693 /// # use google_cloud_api::model::Visibility;
11694 /// use google_cloud_api::model::VisibilityRule;
11695 /// let x = Visibility::new()
11696 /// .set_rules([
11697 /// VisibilityRule::default()/* use setters */,
11698 /// VisibilityRule::default()/* use (different) setters */,
11699 /// ]);
11700 /// ```
11701 pub fn set_rules<T, V>(mut self, v: T) -> Self
11702 where
11703 T: std::iter::IntoIterator<Item = V>,
11704 V: std::convert::Into<crate::model::VisibilityRule>,
11705 {
11706 use std::iter::Iterator;
11707 self.rules = v.into_iter().map(|i| i.into()).collect();
11708 self
11709 }
11710}
11711
11712impl wkt::message::Message for Visibility {
11713 fn typename() -> &'static str {
11714 "type.googleapis.com/google.api.Visibility"
11715 }
11716}
11717
11718/// A visibility rule provides visibility configuration for an individual API
11719/// element.
11720#[derive(Clone, Default, PartialEq)]
11721#[non_exhaustive]
11722pub struct VisibilityRule {
11723 /// Selects methods, messages, fields, enums, etc. to which this rule applies.
11724 ///
11725 /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
11726 /// details.
11727 ///
11728 /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
11729 pub selector: std::string::String,
11730
11731 /// A comma-separated list of visibility labels that apply to the `selector`.
11732 /// Any of the listed labels can be used to grant the visibility.
11733 ///
11734 /// If a rule has multiple labels, removing one of the labels but not all of
11735 /// them can break clients.
11736 ///
11737 /// Example:
11738 ///
11739 /// ```norust
11740 /// visibility:
11741 /// rules:
11742 /// - selector: google.calendar.Calendar.EnhancedSearch
11743 /// restriction: INTERNAL, PREVIEW
11744 /// ```
11745 ///
11746 /// Removing INTERNAL from this restriction will break clients that rely on
11747 /// this method and only had access to it through INTERNAL.
11748 pub restriction: std::string::String,
11749
11750 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11751}
11752
11753impl VisibilityRule {
11754 pub fn new() -> Self {
11755 std::default::Default::default()
11756 }
11757
11758 /// Sets the value of [selector][crate::model::VisibilityRule::selector].
11759 ///
11760 /// # Example
11761 /// ```ignore,no_run
11762 /// # use google_cloud_api::model::VisibilityRule;
11763 /// let x = VisibilityRule::new().set_selector("example");
11764 /// ```
11765 pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11766 self.selector = v.into();
11767 self
11768 }
11769
11770 /// Sets the value of [restriction][crate::model::VisibilityRule::restriction].
11771 ///
11772 /// # Example
11773 /// ```ignore,no_run
11774 /// # use google_cloud_api::model::VisibilityRule;
11775 /// let x = VisibilityRule::new().set_restriction("example");
11776 /// ```
11777 pub fn set_restriction<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11778 self.restriction = v.into();
11779 self
11780 }
11781}
11782
11783impl wkt::message::Message for VisibilityRule {
11784 fn typename() -> &'static str {
11785 "type.googleapis.com/google.api.VisibilityRule"
11786 }
11787}
11788
11789/// The organization for which the client libraries are being published.
11790/// Affects the url where generated docs are published, etc.
11791///
11792/// # Working with unknown values
11793///
11794/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11795/// additional enum variants at any time. Adding new variants is not considered
11796/// a breaking change. Applications should write their code in anticipation of:
11797///
11798/// - New values appearing in future releases of the client library, **and**
11799/// - New values received dynamically, without application changes.
11800///
11801/// Please consult the [Working with enums] section in the user guide for some
11802/// guidelines.
11803///
11804/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
11805#[derive(Clone, Debug, PartialEq)]
11806#[non_exhaustive]
11807pub enum ClientLibraryOrganization {
11808 /// Not useful.
11809 Unspecified,
11810 /// Google Cloud Platform Org.
11811 Cloud,
11812 /// Ads (Advertising) Org.
11813 Ads,
11814 /// Photos Org.
11815 Photos,
11816 /// Street View Org.
11817 StreetView,
11818 /// Shopping Org.
11819 Shopping,
11820 /// Geo Org.
11821 Geo,
11822 /// Generative AI - <https://developers.generativeai.google>
11823 GenerativeAi,
11824 /// If set, the enum was initialized with an unknown value.
11825 ///
11826 /// Applications can examine the value using [ClientLibraryOrganization::value] or
11827 /// [ClientLibraryOrganization::name].
11828 UnknownValue(client_library_organization::UnknownValue),
11829}
11830
11831#[doc(hidden)]
11832pub mod client_library_organization {
11833 #[allow(unused_imports)]
11834 use super::*;
11835 #[derive(Clone, Debug, PartialEq)]
11836 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11837}
11838
11839impl ClientLibraryOrganization {
11840 /// Gets the enum value.
11841 ///
11842 /// Returns `None` if the enum contains an unknown value deserialized from
11843 /// the string representation of enums.
11844 pub fn value(&self) -> std::option::Option<i32> {
11845 match self {
11846 Self::Unspecified => std::option::Option::Some(0),
11847 Self::Cloud => std::option::Option::Some(1),
11848 Self::Ads => std::option::Option::Some(2),
11849 Self::Photos => std::option::Option::Some(3),
11850 Self::StreetView => std::option::Option::Some(4),
11851 Self::Shopping => std::option::Option::Some(5),
11852 Self::Geo => std::option::Option::Some(6),
11853 Self::GenerativeAi => std::option::Option::Some(7),
11854 Self::UnknownValue(u) => u.0.value(),
11855 }
11856 }
11857
11858 /// Gets the enum value as a string.
11859 ///
11860 /// Returns `None` if the enum contains an unknown value deserialized from
11861 /// the integer representation of enums.
11862 pub fn name(&self) -> std::option::Option<&str> {
11863 match self {
11864 Self::Unspecified => {
11865 std::option::Option::Some("CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED")
11866 }
11867 Self::Cloud => std::option::Option::Some("CLOUD"),
11868 Self::Ads => std::option::Option::Some("ADS"),
11869 Self::Photos => std::option::Option::Some("PHOTOS"),
11870 Self::StreetView => std::option::Option::Some("STREET_VIEW"),
11871 Self::Shopping => std::option::Option::Some("SHOPPING"),
11872 Self::Geo => std::option::Option::Some("GEO"),
11873 Self::GenerativeAi => std::option::Option::Some("GENERATIVE_AI"),
11874 Self::UnknownValue(u) => u.0.name(),
11875 }
11876 }
11877}
11878
11879impl std::default::Default for ClientLibraryOrganization {
11880 fn default() -> Self {
11881 use std::convert::From;
11882 Self::from(0)
11883 }
11884}
11885
11886impl std::fmt::Display for ClientLibraryOrganization {
11887 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11888 wkt::internal::display_enum(f, self.name(), self.value())
11889 }
11890}
11891
11892impl std::convert::From<i32> for ClientLibraryOrganization {
11893 fn from(value: i32) -> Self {
11894 match value {
11895 0 => Self::Unspecified,
11896 1 => Self::Cloud,
11897 2 => Self::Ads,
11898 3 => Self::Photos,
11899 4 => Self::StreetView,
11900 5 => Self::Shopping,
11901 6 => Self::Geo,
11902 7 => Self::GenerativeAi,
11903 _ => Self::UnknownValue(client_library_organization::UnknownValue(
11904 wkt::internal::UnknownEnumValue::Integer(value),
11905 )),
11906 }
11907 }
11908}
11909
11910impl std::convert::From<&str> for ClientLibraryOrganization {
11911 fn from(value: &str) -> Self {
11912 use std::string::ToString;
11913 match value {
11914 "CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED" => Self::Unspecified,
11915 "CLOUD" => Self::Cloud,
11916 "ADS" => Self::Ads,
11917 "PHOTOS" => Self::Photos,
11918 "STREET_VIEW" => Self::StreetView,
11919 "SHOPPING" => Self::Shopping,
11920 "GEO" => Self::Geo,
11921 "GENERATIVE_AI" => Self::GenerativeAi,
11922 _ => Self::UnknownValue(client_library_organization::UnknownValue(
11923 wkt::internal::UnknownEnumValue::String(value.to_string()),
11924 )),
11925 }
11926 }
11927}
11928
11929impl serde::ser::Serialize for ClientLibraryOrganization {
11930 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11931 where
11932 S: serde::Serializer,
11933 {
11934 match self {
11935 Self::Unspecified => serializer.serialize_i32(0),
11936 Self::Cloud => serializer.serialize_i32(1),
11937 Self::Ads => serializer.serialize_i32(2),
11938 Self::Photos => serializer.serialize_i32(3),
11939 Self::StreetView => serializer.serialize_i32(4),
11940 Self::Shopping => serializer.serialize_i32(5),
11941 Self::Geo => serializer.serialize_i32(6),
11942 Self::GenerativeAi => serializer.serialize_i32(7),
11943 Self::UnknownValue(u) => u.0.serialize(serializer),
11944 }
11945 }
11946}
11947
11948impl<'de> serde::de::Deserialize<'de> for ClientLibraryOrganization {
11949 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11950 where
11951 D: serde::Deserializer<'de>,
11952 {
11953 deserializer.deserialize_any(
11954 wkt::internal::EnumVisitor::<ClientLibraryOrganization>::new(
11955 ".google.api.ClientLibraryOrganization",
11956 ),
11957 )
11958 }
11959}
11960
11961/// To where should client libraries be published?
11962///
11963/// # Working with unknown values
11964///
11965/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11966/// additional enum variants at any time. Adding new variants is not considered
11967/// a breaking change. Applications should write their code in anticipation of:
11968///
11969/// - New values appearing in future releases of the client library, **and**
11970/// - New values received dynamically, without application changes.
11971///
11972/// Please consult the [Working with enums] section in the user guide for some
11973/// guidelines.
11974///
11975/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
11976#[derive(Clone, Debug, PartialEq)]
11977#[non_exhaustive]
11978pub enum ClientLibraryDestination {
11979 /// Client libraries will neither be generated nor published to package
11980 /// managers.
11981 Unspecified,
11982 /// Generate the client library in a repo under github.com/googleapis,
11983 /// but don't publish it to package managers.
11984 Github,
11985 /// Publish the library to package managers like nuget.org and npmjs.com.
11986 PackageManager,
11987 /// If set, the enum was initialized with an unknown value.
11988 ///
11989 /// Applications can examine the value using [ClientLibraryDestination::value] or
11990 /// [ClientLibraryDestination::name].
11991 UnknownValue(client_library_destination::UnknownValue),
11992}
11993
11994#[doc(hidden)]
11995pub mod client_library_destination {
11996 #[allow(unused_imports)]
11997 use super::*;
11998 #[derive(Clone, Debug, PartialEq)]
11999 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
12000}
12001
12002impl ClientLibraryDestination {
12003 /// Gets the enum value.
12004 ///
12005 /// Returns `None` if the enum contains an unknown value deserialized from
12006 /// the string representation of enums.
12007 pub fn value(&self) -> std::option::Option<i32> {
12008 match self {
12009 Self::Unspecified => std::option::Option::Some(0),
12010 Self::Github => std::option::Option::Some(10),
12011 Self::PackageManager => std::option::Option::Some(20),
12012 Self::UnknownValue(u) => u.0.value(),
12013 }
12014 }
12015
12016 /// Gets the enum value as a string.
12017 ///
12018 /// Returns `None` if the enum contains an unknown value deserialized from
12019 /// the integer representation of enums.
12020 pub fn name(&self) -> std::option::Option<&str> {
12021 match self {
12022 Self::Unspecified => {
12023 std::option::Option::Some("CLIENT_LIBRARY_DESTINATION_UNSPECIFIED")
12024 }
12025 Self::Github => std::option::Option::Some("GITHUB"),
12026 Self::PackageManager => std::option::Option::Some("PACKAGE_MANAGER"),
12027 Self::UnknownValue(u) => u.0.name(),
12028 }
12029 }
12030}
12031
12032impl std::default::Default for ClientLibraryDestination {
12033 fn default() -> Self {
12034 use std::convert::From;
12035 Self::from(0)
12036 }
12037}
12038
12039impl std::fmt::Display for ClientLibraryDestination {
12040 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
12041 wkt::internal::display_enum(f, self.name(), self.value())
12042 }
12043}
12044
12045impl std::convert::From<i32> for ClientLibraryDestination {
12046 fn from(value: i32) -> Self {
12047 match value {
12048 0 => Self::Unspecified,
12049 10 => Self::Github,
12050 20 => Self::PackageManager,
12051 _ => Self::UnknownValue(client_library_destination::UnknownValue(
12052 wkt::internal::UnknownEnumValue::Integer(value),
12053 )),
12054 }
12055 }
12056}
12057
12058impl std::convert::From<&str> for ClientLibraryDestination {
12059 fn from(value: &str) -> Self {
12060 use std::string::ToString;
12061 match value {
12062 "CLIENT_LIBRARY_DESTINATION_UNSPECIFIED" => Self::Unspecified,
12063 "GITHUB" => Self::Github,
12064 "PACKAGE_MANAGER" => Self::PackageManager,
12065 _ => Self::UnknownValue(client_library_destination::UnknownValue(
12066 wkt::internal::UnknownEnumValue::String(value.to_string()),
12067 )),
12068 }
12069 }
12070}
12071
12072impl serde::ser::Serialize for ClientLibraryDestination {
12073 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12074 where
12075 S: serde::Serializer,
12076 {
12077 match self {
12078 Self::Unspecified => serializer.serialize_i32(0),
12079 Self::Github => serializer.serialize_i32(10),
12080 Self::PackageManager => serializer.serialize_i32(20),
12081 Self::UnknownValue(u) => u.0.serialize(serializer),
12082 }
12083 }
12084}
12085
12086impl<'de> serde::de::Deserialize<'de> for ClientLibraryDestination {
12087 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12088 where
12089 D: serde::Deserializer<'de>,
12090 {
12091 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ClientLibraryDestination>::new(
12092 ".google.api.ClientLibraryDestination",
12093 ))
12094 }
12095}
12096
12097/// Classifies set of possible modifications to an object in the service
12098/// configuration.
12099///
12100/// # Working with unknown values
12101///
12102/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12103/// additional enum variants at any time. Adding new variants is not considered
12104/// a breaking change. Applications should write their code in anticipation of:
12105///
12106/// - New values appearing in future releases of the client library, **and**
12107/// - New values received dynamically, without application changes.
12108///
12109/// Please consult the [Working with enums] section in the user guide for some
12110/// guidelines.
12111///
12112/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
12113#[derive(Clone, Debug, PartialEq)]
12114#[non_exhaustive]
12115pub enum ChangeType {
12116 /// No value was provided.
12117 Unspecified,
12118 /// The changed object exists in the 'new' service configuration, but not
12119 /// in the 'old' service configuration.
12120 Added,
12121 /// The changed object exists in the 'old' service configuration, but not
12122 /// in the 'new' service configuration.
12123 Removed,
12124 /// The changed object exists in both service configurations, but its value
12125 /// is different.
12126 Modified,
12127 /// If set, the enum was initialized with an unknown value.
12128 ///
12129 /// Applications can examine the value using [ChangeType::value] or
12130 /// [ChangeType::name].
12131 UnknownValue(change_type::UnknownValue),
12132}
12133
12134#[doc(hidden)]
12135pub mod change_type {
12136 #[allow(unused_imports)]
12137 use super::*;
12138 #[derive(Clone, Debug, PartialEq)]
12139 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
12140}
12141
12142impl ChangeType {
12143 /// Gets the enum value.
12144 ///
12145 /// Returns `None` if the enum contains an unknown value deserialized from
12146 /// the string representation of enums.
12147 pub fn value(&self) -> std::option::Option<i32> {
12148 match self {
12149 Self::Unspecified => std::option::Option::Some(0),
12150 Self::Added => std::option::Option::Some(1),
12151 Self::Removed => std::option::Option::Some(2),
12152 Self::Modified => std::option::Option::Some(3),
12153 Self::UnknownValue(u) => u.0.value(),
12154 }
12155 }
12156
12157 /// Gets the enum value as a string.
12158 ///
12159 /// Returns `None` if the enum contains an unknown value deserialized from
12160 /// the integer representation of enums.
12161 pub fn name(&self) -> std::option::Option<&str> {
12162 match self {
12163 Self::Unspecified => std::option::Option::Some("CHANGE_TYPE_UNSPECIFIED"),
12164 Self::Added => std::option::Option::Some("ADDED"),
12165 Self::Removed => std::option::Option::Some("REMOVED"),
12166 Self::Modified => std::option::Option::Some("MODIFIED"),
12167 Self::UnknownValue(u) => u.0.name(),
12168 }
12169 }
12170}
12171
12172impl std::default::Default for ChangeType {
12173 fn default() -> Self {
12174 use std::convert::From;
12175 Self::from(0)
12176 }
12177}
12178
12179impl std::fmt::Display for ChangeType {
12180 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
12181 wkt::internal::display_enum(f, self.name(), self.value())
12182 }
12183}
12184
12185impl std::convert::From<i32> for ChangeType {
12186 fn from(value: i32) -> Self {
12187 match value {
12188 0 => Self::Unspecified,
12189 1 => Self::Added,
12190 2 => Self::Removed,
12191 3 => Self::Modified,
12192 _ => Self::UnknownValue(change_type::UnknownValue(
12193 wkt::internal::UnknownEnumValue::Integer(value),
12194 )),
12195 }
12196 }
12197}
12198
12199impl std::convert::From<&str> for ChangeType {
12200 fn from(value: &str) -> Self {
12201 use std::string::ToString;
12202 match value {
12203 "CHANGE_TYPE_UNSPECIFIED" => Self::Unspecified,
12204 "ADDED" => Self::Added,
12205 "REMOVED" => Self::Removed,
12206 "MODIFIED" => Self::Modified,
12207 _ => Self::UnknownValue(change_type::UnknownValue(
12208 wkt::internal::UnknownEnumValue::String(value.to_string()),
12209 )),
12210 }
12211 }
12212}
12213
12214impl serde::ser::Serialize for ChangeType {
12215 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12216 where
12217 S: serde::Serializer,
12218 {
12219 match self {
12220 Self::Unspecified => serializer.serialize_i32(0),
12221 Self::Added => serializer.serialize_i32(1),
12222 Self::Removed => serializer.serialize_i32(2),
12223 Self::Modified => serializer.serialize_i32(3),
12224 Self::UnknownValue(u) => u.0.serialize(serializer),
12225 }
12226 }
12227}
12228
12229impl<'de> serde::de::Deserialize<'de> for ChangeType {
12230 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12231 where
12232 D: serde::Deserializer<'de>,
12233 {
12234 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ChangeType>::new(
12235 ".google.api.ChangeType",
12236 ))
12237 }
12238}
12239
12240/// Defines the supported values for `google.rpc.ErrorInfo.reason` for the
12241/// `googleapis.com` error domain. This error domain is reserved for [Service
12242/// Infrastructure](https://cloud.google.com/service-infrastructure/docs/overview).
12243/// For each error info of this domain, the metadata key "service" refers to the
12244/// logical identifier of an API service, such as "pubsub.googleapis.com". The
12245/// "consumer" refers to the entity that consumes an API Service. It typically is
12246/// a Google project that owns the client application or the server resource,
12247/// such as "projects/123". Other metadata keys are specific to each error
12248/// reason. For more information, see the definition of the specific error
12249/// reason.
12250///
12251/// # Working with unknown values
12252///
12253/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12254/// additional enum variants at any time. Adding new variants is not considered
12255/// a breaking change. Applications should write their code in anticipation of:
12256///
12257/// - New values appearing in future releases of the client library, **and**
12258/// - New values received dynamically, without application changes.
12259///
12260/// Please consult the [Working with enums] section in the user guide for some
12261/// guidelines.
12262///
12263/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
12264#[derive(Clone, Debug, PartialEq)]
12265#[non_exhaustive]
12266pub enum ErrorReason {
12267 /// Do not use this default value.
12268 Unspecified,
12269 /// The request is calling a disabled service for a consumer.
12270 ///
12271 /// Example of an ErrorInfo when the consumer "projects/123" contacting
12272 /// "pubsub.googleapis.com" service which is disabled:
12273 ///
12274 /// ```norust
12275 /// { "reason": "SERVICE_DISABLED",
12276 /// "domain": "googleapis.com",
12277 /// "metadata": {
12278 /// "consumer": "projects/123",
12279 /// "service": "pubsub.googleapis.com"
12280 /// }
12281 /// }
12282 /// ```
12283 ///
12284 /// This response indicates the "pubsub.googleapis.com" has been disabled in
12285 /// "projects/123".
12286 ServiceDisabled,
12287 /// The request whose associated billing account is disabled.
12288 ///
12289 /// Example of an ErrorInfo when the consumer "projects/123" fails to contact
12290 /// "pubsub.googleapis.com" service because the associated billing account is
12291 /// disabled:
12292 ///
12293 /// ```norust
12294 /// { "reason": "BILLING_DISABLED",
12295 /// "domain": "googleapis.com",
12296 /// "metadata": {
12297 /// "consumer": "projects/123",
12298 /// "service": "pubsub.googleapis.com"
12299 /// }
12300 /// }
12301 /// ```
12302 ///
12303 /// This response indicates the billing account associated has been disabled.
12304 BillingDisabled,
12305 /// The request is denied because the provided [API
12306 /// key](https://cloud.google.com/docs/authentication/api-keys) is invalid. It
12307 /// may be in a bad format, cannot be found, or has been expired).
12308 ///
12309 /// Example of an ErrorInfo when the request is contacting
12310 /// "storage.googleapis.com" service with an invalid API key:
12311 ///
12312 /// ```norust
12313 /// { "reason": "API_KEY_INVALID",
12314 /// "domain": "googleapis.com",
12315 /// "metadata": {
12316 /// "service": "storage.googleapis.com",
12317 /// }
12318 /// }
12319 /// ```
12320 ApiKeyInvalid,
12321 /// The request is denied because it violates [API key API
12322 /// restrictions](https://cloud.google.com/docs/authentication/api-keys#adding_api_restrictions).
12323 ///
12324 /// Example of an ErrorInfo when the consumer "projects/123" fails to call the
12325 /// "storage.googleapis.com" service because this service is restricted in the
12326 /// API key:
12327 ///
12328 /// ```norust
12329 /// { "reason": "API_KEY_SERVICE_BLOCKED",
12330 /// "domain": "googleapis.com",
12331 /// "metadata": {
12332 /// "consumer": "projects/123",
12333 /// "service": "storage.googleapis.com"
12334 /// }
12335 /// }
12336 /// ```
12337 ApiKeyServiceBlocked,
12338 /// The request is denied because it violates [API key HTTP
12339 /// restrictions](https://cloud.google.com/docs/authentication/api-keys#adding_http_restrictions).
12340 ///
12341 /// Example of an ErrorInfo when the consumer "projects/123" fails to call
12342 /// "storage.googleapis.com" service because the http referrer of the request
12343 /// violates API key HTTP restrictions:
12344 ///
12345 /// ```norust
12346 /// { "reason": "API_KEY_HTTP_REFERRER_BLOCKED",
12347 /// "domain": "googleapis.com",
12348 /// "metadata": {
12349 /// "consumer": "projects/123",
12350 /// "service": "storage.googleapis.com",
12351 /// }
12352 /// }
12353 /// ```
12354 ApiKeyHttpReferrerBlocked,
12355 /// The request is denied because it violates [API key IP address
12356 /// restrictions](https://cloud.google.com/docs/authentication/api-keys#adding_application_restrictions).
12357 ///
12358 /// Example of an ErrorInfo when the consumer "projects/123" fails to call
12359 /// "storage.googleapis.com" service because the caller IP of the request
12360 /// violates API key IP address restrictions:
12361 ///
12362 /// ```norust
12363 /// { "reason": "API_KEY_IP_ADDRESS_BLOCKED",
12364 /// "domain": "googleapis.com",
12365 /// "metadata": {
12366 /// "consumer": "projects/123",
12367 /// "service": "storage.googleapis.com",
12368 /// }
12369 /// }
12370 /// ```
12371 ApiKeyIpAddressBlocked,
12372 /// The request is denied because it violates [API key Android application
12373 /// restrictions](https://cloud.google.com/docs/authentication/api-keys#adding_application_restrictions).
12374 ///
12375 /// Example of an ErrorInfo when the consumer "projects/123" fails to call
12376 /// "storage.googleapis.com" service because the request from the Android apps
12377 /// violates the API key Android application restrictions:
12378 ///
12379 /// ```norust
12380 /// { "reason": "API_KEY_ANDROID_APP_BLOCKED",
12381 /// "domain": "googleapis.com",
12382 /// "metadata": {
12383 /// "consumer": "projects/123",
12384 /// "service": "storage.googleapis.com"
12385 /// }
12386 /// }
12387 /// ```
12388 ApiKeyAndroidAppBlocked,
12389 /// The request is denied because it violates [API key iOS application
12390 /// restrictions](https://cloud.google.com/docs/authentication/api-keys#adding_application_restrictions).
12391 ///
12392 /// Example of an ErrorInfo when the consumer "projects/123" fails to call
12393 /// "storage.googleapis.com" service because the request from the iOS apps
12394 /// violates the API key iOS application restrictions:
12395 ///
12396 /// ```norust
12397 /// { "reason": "API_KEY_IOS_APP_BLOCKED",
12398 /// "domain": "googleapis.com",
12399 /// "metadata": {
12400 /// "consumer": "projects/123",
12401 /// "service": "storage.googleapis.com"
12402 /// }
12403 /// }
12404 /// ```
12405 ApiKeyIosAppBlocked,
12406 /// The request is denied because there is not enough rate quota for the
12407 /// consumer.
12408 ///
12409 /// Example of an ErrorInfo when the consumer "projects/123" fails to contact
12410 /// "pubsub.googleapis.com" service because consumer's rate quota usage has
12411 /// reached the maximum value set for the quota limit
12412 /// "ReadsPerMinutePerProject" on the quota metric
12413 /// "pubsub.googleapis.com/read_requests":
12414 ///
12415 /// ```norust
12416 /// { "reason": "RATE_LIMIT_EXCEEDED",
12417 /// "domain": "googleapis.com",
12418 /// "metadata": {
12419 /// "consumer": "projects/123",
12420 /// "service": "pubsub.googleapis.com",
12421 /// "quota_metric": "pubsub.googleapis.com/read_requests",
12422 /// "quota_limit": "ReadsPerMinutePerProject"
12423 /// }
12424 /// }
12425 /// ```
12426 ///
12427 /// Example of an ErrorInfo when the consumer "projects/123" checks quota on
12428 /// the service "dataflow.googleapis.com" and hits the organization quota
12429 /// limit "DefaultRequestsPerMinutePerOrganization" on the metric
12430 /// "dataflow.googleapis.com/default_requests".
12431 ///
12432 /// ```norust
12433 /// { "reason": "RATE_LIMIT_EXCEEDED",
12434 /// "domain": "googleapis.com",
12435 /// "metadata": {
12436 /// "consumer": "projects/123",
12437 /// "service": "dataflow.googleapis.com",
12438 /// "quota_metric": "dataflow.googleapis.com/default_requests",
12439 /// "quota_limit": "DefaultRequestsPerMinutePerOrganization"
12440 /// }
12441 /// }
12442 /// ```
12443 RateLimitExceeded,
12444 /// The request is denied because there is not enough resource quota for the
12445 /// consumer.
12446 ///
12447 /// Example of an ErrorInfo when the consumer "projects/123" fails to contact
12448 /// "compute.googleapis.com" service because consumer's resource quota usage
12449 /// has reached the maximum value set for the quota limit "VMsPerProject"
12450 /// on the quota metric "compute.googleapis.com/vms":
12451 ///
12452 /// ```norust
12453 /// { "reason": "RESOURCE_QUOTA_EXCEEDED",
12454 /// "domain": "googleapis.com",
12455 /// "metadata": {
12456 /// "consumer": "projects/123",
12457 /// "service": "compute.googleapis.com",
12458 /// "quota_metric": "compute.googleapis.com/vms",
12459 /// "quota_limit": "VMsPerProject"
12460 /// }
12461 /// }
12462 /// ```
12463 ///
12464 /// Example of an ErrorInfo when the consumer "projects/123" checks resource
12465 /// quota on the service "dataflow.googleapis.com" and hits the organization
12466 /// quota limit "jobs-per-organization" on the metric
12467 /// "dataflow.googleapis.com/job_count".
12468 ///
12469 /// ```norust
12470 /// { "reason": "RESOURCE_QUOTA_EXCEEDED",
12471 /// "domain": "googleapis.com",
12472 /// "metadata": {
12473 /// "consumer": "projects/123",
12474 /// "service": "dataflow.googleapis.com",
12475 /// "quota_metric": "dataflow.googleapis.com/job_count",
12476 /// "quota_limit": "jobs-per-organization"
12477 /// }
12478 /// }
12479 /// ```
12480 ResourceQuotaExceeded,
12481 /// The request whose associated billing account address is in a tax restricted
12482 /// location, violates the local tax restrictions when creating resources in
12483 /// the restricted region.
12484 ///
12485 /// Example of an ErrorInfo when creating the Cloud Storage Bucket in the
12486 /// container "projects/123" under a tax restricted region
12487 /// "locations/asia-northeast3":
12488 ///
12489 /// ```norust
12490 /// { "reason": "LOCATION_TAX_POLICY_VIOLATED",
12491 /// "domain": "googleapis.com",
12492 /// "metadata": {
12493 /// "consumer": "projects/123",
12494 /// "service": "storage.googleapis.com",
12495 /// "location": "locations/asia-northeast3"
12496 /// }
12497 /// }
12498 /// ```
12499 ///
12500 /// This response indicates creating the Cloud Storage Bucket in
12501 /// "locations/asia-northeast3" violates the location tax restriction.
12502 LocationTaxPolicyViolated,
12503 /// The request is denied because the caller does not have required permission
12504 /// on the user project "projects/123" or the user project is invalid. For more
12505 /// information, check the [userProject System
12506 /// Parameters](https://cloud.google.com/apis/docs/system-parameters).
12507 ///
12508 /// Example of an ErrorInfo when the caller is calling Cloud Storage service
12509 /// with insufficient permissions on the user project:
12510 ///
12511 /// ```norust
12512 /// { "reason": "USER_PROJECT_DENIED",
12513 /// "domain": "googleapis.com",
12514 /// "metadata": {
12515 /// "consumer": "projects/123",
12516 /// "service": "storage.googleapis.com"
12517 /// }
12518 /// }
12519 /// ```
12520 UserProjectDenied,
12521 /// The request is denied because the consumer "projects/123" is suspended due
12522 /// to Terms of Service(Tos) violations. Check [Project suspension
12523 /// guidelines](https://cloud.google.com/resource-manager/docs/project-suspension-guidelines)
12524 /// for more information.
12525 ///
12526 /// Example of an ErrorInfo when calling Cloud Storage service with the
12527 /// suspended consumer "projects/123":
12528 ///
12529 /// ```norust
12530 /// { "reason": "CONSUMER_SUSPENDED",
12531 /// "domain": "googleapis.com",
12532 /// "metadata": {
12533 /// "consumer": "projects/123",
12534 /// "service": "storage.googleapis.com"
12535 /// }
12536 /// }
12537 /// ```
12538 ConsumerSuspended,
12539 /// The request is denied because the associated consumer is invalid. It may be
12540 /// in a bad format, cannot be found, or have been deleted.
12541 ///
12542 /// Example of an ErrorInfo when calling Cloud Storage service with the
12543 /// invalid consumer "projects/123":
12544 ///
12545 /// ```norust
12546 /// { "reason": "CONSUMER_INVALID",
12547 /// "domain": "googleapis.com",
12548 /// "metadata": {
12549 /// "consumer": "projects/123",
12550 /// "service": "storage.googleapis.com"
12551 /// }
12552 /// }
12553 /// ```
12554 ConsumerInvalid,
12555 /// The request is denied because it violates [VPC Service
12556 /// Controls](https://cloud.google.com/vpc-service-controls/docs/overview).
12557 /// The 'uid' field is a random generated identifier that customer can use it
12558 /// to search the audit log for a request rejected by VPC Service Controls. For
12559 /// more information, please refer [VPC Service Controls
12560 /// Troubleshooting](https://cloud.google.com/vpc-service-controls/docs/troubleshooting#unique-id)
12561 ///
12562 /// Example of an ErrorInfo when the consumer "projects/123" fails to call
12563 /// Cloud Storage service because the request is prohibited by the VPC Service
12564 /// Controls.
12565 ///
12566 /// ```norust
12567 /// { "reason": "SECURITY_POLICY_VIOLATED",
12568 /// "domain": "googleapis.com",
12569 /// "metadata": {
12570 /// "uid": "123456789abcde",
12571 /// "consumer": "projects/123",
12572 /// "service": "storage.googleapis.com"
12573 /// }
12574 /// }
12575 /// ```
12576 SecurityPolicyViolated,
12577 /// The request is denied because the provided access token has expired.
12578 ///
12579 /// Example of an ErrorInfo when the request is calling Cloud Storage service
12580 /// with an expired access token:
12581 ///
12582 /// ```norust
12583 /// { "reason": "ACCESS_TOKEN_EXPIRED",
12584 /// "domain": "googleapis.com",
12585 /// "metadata": {
12586 /// "service": "storage.googleapis.com",
12587 /// "method": "google.storage.v1.Storage.GetObject"
12588 /// }
12589 /// }
12590 /// ```
12591 AccessTokenExpired,
12592 /// The request is denied because the provided access token doesn't have at
12593 /// least one of the acceptable scopes required for the API. Please check
12594 /// [OAuth 2.0 Scopes for Google
12595 /// APIs](https://developers.google.com/identity/protocols/oauth2/scopes) for
12596 /// the list of the OAuth 2.0 scopes that you might need to request to access
12597 /// the API.
12598 ///
12599 /// Example of an ErrorInfo when the request is calling Cloud Storage service
12600 /// with an access token that is missing required scopes:
12601 ///
12602 /// ```norust
12603 /// { "reason": "ACCESS_TOKEN_SCOPE_INSUFFICIENT",
12604 /// "domain": "googleapis.com",
12605 /// "metadata": {
12606 /// "service": "storage.googleapis.com",
12607 /// "method": "google.storage.v1.Storage.GetObject"
12608 /// }
12609 /// }
12610 /// ```
12611 AccessTokenScopeInsufficient,
12612 /// The request is denied because the account associated with the provided
12613 /// access token is in an invalid state, such as disabled or deleted.
12614 /// For more information, see <https://cloud.google.com/docs/authentication>.
12615 ///
12616 /// Warning: For privacy reasons, the server may not be able to disclose the
12617 /// email address for some accounts. The client MUST NOT depend on the
12618 /// availability of the `email` attribute.
12619 ///
12620 /// Example of an ErrorInfo when the request is to the Cloud Storage API with
12621 /// an access token that is associated with a disabled or deleted [service
12622 /// account](http://cloud/iam/docs/service-accounts):
12623 ///
12624 /// ```norust
12625 /// { "reason": "ACCOUNT_STATE_INVALID",
12626 /// "domain": "googleapis.com",
12627 /// "metadata": {
12628 /// "service": "storage.googleapis.com",
12629 /// "method": "google.storage.v1.Storage.GetObject",
12630 /// "email": "user@123.iam.gserviceaccount.com"
12631 /// }
12632 /// }
12633 /// ```
12634 AccountStateInvalid,
12635 /// The request is denied because the type of the provided access token is not
12636 /// supported by the API being called.
12637 ///
12638 /// Example of an ErrorInfo when the request is to the Cloud Storage API with
12639 /// an unsupported token type.
12640 ///
12641 /// ```norust
12642 /// { "reason": "ACCESS_TOKEN_TYPE_UNSUPPORTED",
12643 /// "domain": "googleapis.com",
12644 /// "metadata": {
12645 /// "service": "storage.googleapis.com",
12646 /// "method": "google.storage.v1.Storage.GetObject"
12647 /// }
12648 /// }
12649 /// ```
12650 AccessTokenTypeUnsupported,
12651 /// The request is denied because the request doesn't have any authentication
12652 /// credentials. For more information regarding the supported authentication
12653 /// strategies for Google Cloud APIs, see
12654 /// <https://cloud.google.com/docs/authentication>.
12655 ///
12656 /// Example of an ErrorInfo when the request is to the Cloud Storage API
12657 /// without any authentication credentials.
12658 ///
12659 /// ```norust
12660 /// { "reason": "CREDENTIALS_MISSING",
12661 /// "domain": "googleapis.com",
12662 /// "metadata": {
12663 /// "service": "storage.googleapis.com",
12664 /// "method": "google.storage.v1.Storage.GetObject"
12665 /// }
12666 /// }
12667 /// ```
12668 CredentialsMissing,
12669 /// The request is denied because the provided project owning the resource
12670 /// which acts as the [API
12671 /// consumer](https://cloud.google.com/apis/design/glossary#api_consumer) is
12672 /// invalid. It may be in a bad format or empty.
12673 ///
12674 /// Example of an ErrorInfo when the request is to the Cloud Functions API,
12675 /// but the offered resource project in the request in a bad format which can't
12676 /// perform the ListFunctions method.
12677 ///
12678 /// ```norust
12679 /// { "reason": "RESOURCE_PROJECT_INVALID",
12680 /// "domain": "googleapis.com",
12681 /// "metadata": {
12682 /// "service": "cloudfunctions.googleapis.com",
12683 /// "method":
12684 /// "google.cloud.functions.v1.CloudFunctionsService.ListFunctions"
12685 /// }
12686 /// }
12687 /// ```
12688 ResourceProjectInvalid,
12689 /// The request is denied because the provided session cookie is missing,
12690 /// invalid or failed to decode.
12691 ///
12692 /// Example of an ErrorInfo when the request is calling Cloud Storage service
12693 /// with a SID cookie which can't be decoded.
12694 ///
12695 /// ```norust
12696 /// { "reason": "SESSION_COOKIE_INVALID",
12697 /// "domain": "googleapis.com",
12698 /// "metadata": {
12699 /// "service": "storage.googleapis.com",
12700 /// "method": "google.storage.v1.Storage.GetObject",
12701 /// "cookie": "SID"
12702 /// }
12703 /// }
12704 /// ```
12705 SessionCookieInvalid,
12706 /// The request is denied because the user is from a Google Workspace customer
12707 /// that blocks their users from accessing a particular service.
12708 ///
12709 /// Example scenario: <https://support.google.com/a/answer/9197205?hl=en>
12710 ///
12711 /// Example of an ErrorInfo when access to Google Cloud Storage service is
12712 /// blocked by the Google Workspace administrator:
12713 ///
12714 /// ```norust
12715 /// { "reason": "USER_BLOCKED_BY_ADMIN",
12716 /// "domain": "googleapis.com",
12717 /// "metadata": {
12718 /// "service": "storage.googleapis.com",
12719 /// "method": "google.storage.v1.Storage.GetObject",
12720 /// }
12721 /// }
12722 /// ```
12723 UserBlockedByAdmin,
12724 /// The request is denied because the resource service usage is restricted
12725 /// by administrators according to the organization policy constraint.
12726 /// For more information see
12727 /// <https://cloud.google.com/resource-manager/docs/organization-policy/restricting-services>.
12728 ///
12729 /// Example of an ErrorInfo when access to Google Cloud Storage service is
12730 /// restricted by Resource Usage Restriction policy:
12731 ///
12732 /// ```norust
12733 /// { "reason": "RESOURCE_USAGE_RESTRICTION_VIOLATED",
12734 /// "domain": "googleapis.com",
12735 /// "metadata": {
12736 /// "consumer": "projects/project-123",
12737 /// "service": "storage.googleapis.com"
12738 /// }
12739 /// }
12740 /// ```
12741 ResourceUsageRestrictionViolated,
12742 /// Unimplemented. Do not use.
12743 ///
12744 /// The request is denied because it contains unsupported system parameters in
12745 /// URL query parameters or HTTP headers. For more information,
12746 /// see <https://cloud.google.com/apis/docs/system-parameters>
12747 ///
12748 /// Example of an ErrorInfo when access "pubsub.googleapis.com" service with
12749 /// a request header of "x-goog-user-ip":
12750 ///
12751 /// ```norust
12752 /// { "reason": "SYSTEM_PARAMETER_UNSUPPORTED",
12753 /// "domain": "googleapis.com",
12754 /// "metadata": {
12755 /// "service": "pubsub.googleapis.com"
12756 /// "parameter": "x-goog-user-ip"
12757 /// }
12758 /// }
12759 /// ```
12760 SystemParameterUnsupported,
12761 /// The request is denied because it violates Org Restriction: the requested
12762 /// resource does not belong to allowed organizations specified in
12763 /// "X-Goog-Allowed-Resources" header.
12764 ///
12765 /// Example of an ErrorInfo when accessing a GCP resource that is restricted by
12766 /// Org Restriction for "pubsub.googleapis.com" service.
12767 ///
12768 /// {
12769 /// reason: "ORG_RESTRICTION_VIOLATION"
12770 /// domain: "googleapis.com"
12771 /// metadata {
12772 /// "consumer":"projects/123456"
12773 /// "service": "pubsub.googleapis.com"
12774 /// }
12775 /// }
12776 OrgRestrictionViolation,
12777 /// The request is denied because "X-Goog-Allowed-Resources" header is in a bad
12778 /// format.
12779 ///
12780 /// Example of an ErrorInfo when
12781 /// accessing "pubsub.googleapis.com" service with an invalid
12782 /// "X-Goog-Allowed-Resources" request header.
12783 ///
12784 /// {
12785 /// reason: "ORG_RESTRICTION_HEADER_INVALID"
12786 /// domain: "googleapis.com"
12787 /// metadata {
12788 /// "consumer":"projects/123456"
12789 /// "service": "pubsub.googleapis.com"
12790 /// }
12791 /// }
12792 OrgRestrictionHeaderInvalid,
12793 /// Unimplemented. Do not use.
12794 ///
12795 /// The request is calling a service that is not visible to the consumer.
12796 ///
12797 /// Example of an ErrorInfo when the consumer "projects/123" contacting
12798 /// "pubsub.googleapis.com" service which is not visible to the consumer.
12799 ///
12800 /// ```norust
12801 /// { "reason": "SERVICE_NOT_VISIBLE",
12802 /// "domain": "googleapis.com",
12803 /// "metadata": {
12804 /// "consumer": "projects/123",
12805 /// "service": "pubsub.googleapis.com"
12806 /// }
12807 /// }
12808 /// ```
12809 ///
12810 /// This response indicates the "pubsub.googleapis.com" is not visible to
12811 /// "projects/123" (or it may not exist).
12812 ServiceNotVisible,
12813 /// The request is related to a project for which GCP access is suspended.
12814 ///
12815 /// Example of an ErrorInfo when the consumer "projects/123" fails to contact
12816 /// "pubsub.googleapis.com" service because GCP access is suspended:
12817 ///
12818 /// ```norust
12819 /// { "reason": "GCP_SUSPENDED",
12820 /// "domain": "googleapis.com",
12821 /// "metadata": {
12822 /// "consumer": "projects/123",
12823 /// "service": "pubsub.googleapis.com"
12824 /// }
12825 /// }
12826 /// ```
12827 ///
12828 /// This response indicates the associated GCP account has been suspended.
12829 GcpSuspended,
12830 /// The request violates the location policies when creating resources in
12831 /// the restricted region.
12832 ///
12833 /// Example of an ErrorInfo when creating the Cloud Storage Bucket by
12834 /// "projects/123" for service storage.googleapis.com:
12835 ///
12836 /// ```norust
12837 /// { "reason": "LOCATION_POLICY_VIOLATED",
12838 /// "domain": "googleapis.com",
12839 /// "metadata": {
12840 /// "consumer": "projects/123",
12841 /// "service": "storage.googleapis.com",
12842 /// }
12843 /// }
12844 /// ```
12845 ///
12846 /// This response indicates creating the Cloud Storage Bucket in
12847 /// "locations/asia-northeast3" violates at least one location policy.
12848 /// The troubleshooting guidance is provided in the Help links.
12849 LocationPolicyViolated,
12850 /// The request is denied because origin request header is missing.
12851 ///
12852 /// Example of an ErrorInfo when
12853 /// accessing "pubsub.googleapis.com" service with an empty "Origin" request
12854 /// header.
12855 ///
12856 /// {
12857 /// reason: "MISSING_ORIGIN"
12858 /// domain: "googleapis.com"
12859 /// metadata {
12860 /// "consumer":"projects/123456"
12861 /// "service": "pubsub.googleapis.com"
12862 /// }
12863 /// }
12864 MissingOrigin,
12865 /// The request is denied because the request contains more than one credential
12866 /// type that are individually acceptable, but not together. The customer
12867 /// should retry their request with only one set of credentials.
12868 ///
12869 /// Example of an ErrorInfo when
12870 /// accessing "pubsub.googleapis.com" service with overloaded credentials.
12871 ///
12872 /// {
12873 /// reason: "OVERLOADED_CREDENTIALS"
12874 /// domain: "googleapis.com"
12875 /// metadata {
12876 /// "consumer":"projects/123456"
12877 /// "service": "pubsub.googleapis.com"
12878 /// }
12879 /// }
12880 OverloadedCredentials,
12881 /// If set, the enum was initialized with an unknown value.
12882 ///
12883 /// Applications can examine the value using [ErrorReason::value] or
12884 /// [ErrorReason::name].
12885 UnknownValue(error_reason::UnknownValue),
12886}
12887
12888#[doc(hidden)]
12889pub mod error_reason {
12890 #[allow(unused_imports)]
12891 use super::*;
12892 #[derive(Clone, Debug, PartialEq)]
12893 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
12894}
12895
12896impl ErrorReason {
12897 /// Gets the enum value.
12898 ///
12899 /// Returns `None` if the enum contains an unknown value deserialized from
12900 /// the string representation of enums.
12901 pub fn value(&self) -> std::option::Option<i32> {
12902 match self {
12903 Self::Unspecified => std::option::Option::Some(0),
12904 Self::ServiceDisabled => std::option::Option::Some(1),
12905 Self::BillingDisabled => std::option::Option::Some(2),
12906 Self::ApiKeyInvalid => std::option::Option::Some(3),
12907 Self::ApiKeyServiceBlocked => std::option::Option::Some(4),
12908 Self::ApiKeyHttpReferrerBlocked => std::option::Option::Some(7),
12909 Self::ApiKeyIpAddressBlocked => std::option::Option::Some(8),
12910 Self::ApiKeyAndroidAppBlocked => std::option::Option::Some(9),
12911 Self::ApiKeyIosAppBlocked => std::option::Option::Some(13),
12912 Self::RateLimitExceeded => std::option::Option::Some(5),
12913 Self::ResourceQuotaExceeded => std::option::Option::Some(6),
12914 Self::LocationTaxPolicyViolated => std::option::Option::Some(10),
12915 Self::UserProjectDenied => std::option::Option::Some(11),
12916 Self::ConsumerSuspended => std::option::Option::Some(12),
12917 Self::ConsumerInvalid => std::option::Option::Some(14),
12918 Self::SecurityPolicyViolated => std::option::Option::Some(15),
12919 Self::AccessTokenExpired => std::option::Option::Some(16),
12920 Self::AccessTokenScopeInsufficient => std::option::Option::Some(17),
12921 Self::AccountStateInvalid => std::option::Option::Some(18),
12922 Self::AccessTokenTypeUnsupported => std::option::Option::Some(19),
12923 Self::CredentialsMissing => std::option::Option::Some(20),
12924 Self::ResourceProjectInvalid => std::option::Option::Some(21),
12925 Self::SessionCookieInvalid => std::option::Option::Some(23),
12926 Self::UserBlockedByAdmin => std::option::Option::Some(24),
12927 Self::ResourceUsageRestrictionViolated => std::option::Option::Some(25),
12928 Self::SystemParameterUnsupported => std::option::Option::Some(26),
12929 Self::OrgRestrictionViolation => std::option::Option::Some(27),
12930 Self::OrgRestrictionHeaderInvalid => std::option::Option::Some(28),
12931 Self::ServiceNotVisible => std::option::Option::Some(29),
12932 Self::GcpSuspended => std::option::Option::Some(30),
12933 Self::LocationPolicyViolated => std::option::Option::Some(31),
12934 Self::MissingOrigin => std::option::Option::Some(33),
12935 Self::OverloadedCredentials => std::option::Option::Some(34),
12936 Self::UnknownValue(u) => u.0.value(),
12937 }
12938 }
12939
12940 /// Gets the enum value as a string.
12941 ///
12942 /// Returns `None` if the enum contains an unknown value deserialized from
12943 /// the integer representation of enums.
12944 pub fn name(&self) -> std::option::Option<&str> {
12945 match self {
12946 Self::Unspecified => std::option::Option::Some("ERROR_REASON_UNSPECIFIED"),
12947 Self::ServiceDisabled => std::option::Option::Some("SERVICE_DISABLED"),
12948 Self::BillingDisabled => std::option::Option::Some("BILLING_DISABLED"),
12949 Self::ApiKeyInvalid => std::option::Option::Some("API_KEY_INVALID"),
12950 Self::ApiKeyServiceBlocked => std::option::Option::Some("API_KEY_SERVICE_BLOCKED"),
12951 Self::ApiKeyHttpReferrerBlocked => {
12952 std::option::Option::Some("API_KEY_HTTP_REFERRER_BLOCKED")
12953 }
12954 Self::ApiKeyIpAddressBlocked => std::option::Option::Some("API_KEY_IP_ADDRESS_BLOCKED"),
12955 Self::ApiKeyAndroidAppBlocked => {
12956 std::option::Option::Some("API_KEY_ANDROID_APP_BLOCKED")
12957 }
12958 Self::ApiKeyIosAppBlocked => std::option::Option::Some("API_KEY_IOS_APP_BLOCKED"),
12959 Self::RateLimitExceeded => std::option::Option::Some("RATE_LIMIT_EXCEEDED"),
12960 Self::ResourceQuotaExceeded => std::option::Option::Some("RESOURCE_QUOTA_EXCEEDED"),
12961 Self::LocationTaxPolicyViolated => {
12962 std::option::Option::Some("LOCATION_TAX_POLICY_VIOLATED")
12963 }
12964 Self::UserProjectDenied => std::option::Option::Some("USER_PROJECT_DENIED"),
12965 Self::ConsumerSuspended => std::option::Option::Some("CONSUMER_SUSPENDED"),
12966 Self::ConsumerInvalid => std::option::Option::Some("CONSUMER_INVALID"),
12967 Self::SecurityPolicyViolated => std::option::Option::Some("SECURITY_POLICY_VIOLATED"),
12968 Self::AccessTokenExpired => std::option::Option::Some("ACCESS_TOKEN_EXPIRED"),
12969 Self::AccessTokenScopeInsufficient => {
12970 std::option::Option::Some("ACCESS_TOKEN_SCOPE_INSUFFICIENT")
12971 }
12972 Self::AccountStateInvalid => std::option::Option::Some("ACCOUNT_STATE_INVALID"),
12973 Self::AccessTokenTypeUnsupported => {
12974 std::option::Option::Some("ACCESS_TOKEN_TYPE_UNSUPPORTED")
12975 }
12976 Self::CredentialsMissing => std::option::Option::Some("CREDENTIALS_MISSING"),
12977 Self::ResourceProjectInvalid => std::option::Option::Some("RESOURCE_PROJECT_INVALID"),
12978 Self::SessionCookieInvalid => std::option::Option::Some("SESSION_COOKIE_INVALID"),
12979 Self::UserBlockedByAdmin => std::option::Option::Some("USER_BLOCKED_BY_ADMIN"),
12980 Self::ResourceUsageRestrictionViolated => {
12981 std::option::Option::Some("RESOURCE_USAGE_RESTRICTION_VIOLATED")
12982 }
12983 Self::SystemParameterUnsupported => {
12984 std::option::Option::Some("SYSTEM_PARAMETER_UNSUPPORTED")
12985 }
12986 Self::OrgRestrictionViolation => std::option::Option::Some("ORG_RESTRICTION_VIOLATION"),
12987 Self::OrgRestrictionHeaderInvalid => {
12988 std::option::Option::Some("ORG_RESTRICTION_HEADER_INVALID")
12989 }
12990 Self::ServiceNotVisible => std::option::Option::Some("SERVICE_NOT_VISIBLE"),
12991 Self::GcpSuspended => std::option::Option::Some("GCP_SUSPENDED"),
12992 Self::LocationPolicyViolated => std::option::Option::Some("LOCATION_POLICY_VIOLATED"),
12993 Self::MissingOrigin => std::option::Option::Some("MISSING_ORIGIN"),
12994 Self::OverloadedCredentials => std::option::Option::Some("OVERLOADED_CREDENTIALS"),
12995 Self::UnknownValue(u) => u.0.name(),
12996 }
12997 }
12998}
12999
13000impl std::default::Default for ErrorReason {
13001 fn default() -> Self {
13002 use std::convert::From;
13003 Self::from(0)
13004 }
13005}
13006
13007impl std::fmt::Display for ErrorReason {
13008 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
13009 wkt::internal::display_enum(f, self.name(), self.value())
13010 }
13011}
13012
13013impl std::convert::From<i32> for ErrorReason {
13014 fn from(value: i32) -> Self {
13015 match value {
13016 0 => Self::Unspecified,
13017 1 => Self::ServiceDisabled,
13018 2 => Self::BillingDisabled,
13019 3 => Self::ApiKeyInvalid,
13020 4 => Self::ApiKeyServiceBlocked,
13021 5 => Self::RateLimitExceeded,
13022 6 => Self::ResourceQuotaExceeded,
13023 7 => Self::ApiKeyHttpReferrerBlocked,
13024 8 => Self::ApiKeyIpAddressBlocked,
13025 9 => Self::ApiKeyAndroidAppBlocked,
13026 10 => Self::LocationTaxPolicyViolated,
13027 11 => Self::UserProjectDenied,
13028 12 => Self::ConsumerSuspended,
13029 13 => Self::ApiKeyIosAppBlocked,
13030 14 => Self::ConsumerInvalid,
13031 15 => Self::SecurityPolicyViolated,
13032 16 => Self::AccessTokenExpired,
13033 17 => Self::AccessTokenScopeInsufficient,
13034 18 => Self::AccountStateInvalid,
13035 19 => Self::AccessTokenTypeUnsupported,
13036 20 => Self::CredentialsMissing,
13037 21 => Self::ResourceProjectInvalid,
13038 23 => Self::SessionCookieInvalid,
13039 24 => Self::UserBlockedByAdmin,
13040 25 => Self::ResourceUsageRestrictionViolated,
13041 26 => Self::SystemParameterUnsupported,
13042 27 => Self::OrgRestrictionViolation,
13043 28 => Self::OrgRestrictionHeaderInvalid,
13044 29 => Self::ServiceNotVisible,
13045 30 => Self::GcpSuspended,
13046 31 => Self::LocationPolicyViolated,
13047 33 => Self::MissingOrigin,
13048 34 => Self::OverloadedCredentials,
13049 _ => Self::UnknownValue(error_reason::UnknownValue(
13050 wkt::internal::UnknownEnumValue::Integer(value),
13051 )),
13052 }
13053 }
13054}
13055
13056impl std::convert::From<&str> for ErrorReason {
13057 fn from(value: &str) -> Self {
13058 use std::string::ToString;
13059 match value {
13060 "ERROR_REASON_UNSPECIFIED" => Self::Unspecified,
13061 "SERVICE_DISABLED" => Self::ServiceDisabled,
13062 "BILLING_DISABLED" => Self::BillingDisabled,
13063 "API_KEY_INVALID" => Self::ApiKeyInvalid,
13064 "API_KEY_SERVICE_BLOCKED" => Self::ApiKeyServiceBlocked,
13065 "API_KEY_HTTP_REFERRER_BLOCKED" => Self::ApiKeyHttpReferrerBlocked,
13066 "API_KEY_IP_ADDRESS_BLOCKED" => Self::ApiKeyIpAddressBlocked,
13067 "API_KEY_ANDROID_APP_BLOCKED" => Self::ApiKeyAndroidAppBlocked,
13068 "API_KEY_IOS_APP_BLOCKED" => Self::ApiKeyIosAppBlocked,
13069 "RATE_LIMIT_EXCEEDED" => Self::RateLimitExceeded,
13070 "RESOURCE_QUOTA_EXCEEDED" => Self::ResourceQuotaExceeded,
13071 "LOCATION_TAX_POLICY_VIOLATED" => Self::LocationTaxPolicyViolated,
13072 "USER_PROJECT_DENIED" => Self::UserProjectDenied,
13073 "CONSUMER_SUSPENDED" => Self::ConsumerSuspended,
13074 "CONSUMER_INVALID" => Self::ConsumerInvalid,
13075 "SECURITY_POLICY_VIOLATED" => Self::SecurityPolicyViolated,
13076 "ACCESS_TOKEN_EXPIRED" => Self::AccessTokenExpired,
13077 "ACCESS_TOKEN_SCOPE_INSUFFICIENT" => Self::AccessTokenScopeInsufficient,
13078 "ACCOUNT_STATE_INVALID" => Self::AccountStateInvalid,
13079 "ACCESS_TOKEN_TYPE_UNSUPPORTED" => Self::AccessTokenTypeUnsupported,
13080 "CREDENTIALS_MISSING" => Self::CredentialsMissing,
13081 "RESOURCE_PROJECT_INVALID" => Self::ResourceProjectInvalid,
13082 "SESSION_COOKIE_INVALID" => Self::SessionCookieInvalid,
13083 "USER_BLOCKED_BY_ADMIN" => Self::UserBlockedByAdmin,
13084 "RESOURCE_USAGE_RESTRICTION_VIOLATED" => Self::ResourceUsageRestrictionViolated,
13085 "SYSTEM_PARAMETER_UNSUPPORTED" => Self::SystemParameterUnsupported,
13086 "ORG_RESTRICTION_VIOLATION" => Self::OrgRestrictionViolation,
13087 "ORG_RESTRICTION_HEADER_INVALID" => Self::OrgRestrictionHeaderInvalid,
13088 "SERVICE_NOT_VISIBLE" => Self::ServiceNotVisible,
13089 "GCP_SUSPENDED" => Self::GcpSuspended,
13090 "LOCATION_POLICY_VIOLATED" => Self::LocationPolicyViolated,
13091 "MISSING_ORIGIN" => Self::MissingOrigin,
13092 "OVERLOADED_CREDENTIALS" => Self::OverloadedCredentials,
13093 _ => Self::UnknownValue(error_reason::UnknownValue(
13094 wkt::internal::UnknownEnumValue::String(value.to_string()),
13095 )),
13096 }
13097 }
13098}
13099
13100impl serde::ser::Serialize for ErrorReason {
13101 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13102 where
13103 S: serde::Serializer,
13104 {
13105 match self {
13106 Self::Unspecified => serializer.serialize_i32(0),
13107 Self::ServiceDisabled => serializer.serialize_i32(1),
13108 Self::BillingDisabled => serializer.serialize_i32(2),
13109 Self::ApiKeyInvalid => serializer.serialize_i32(3),
13110 Self::ApiKeyServiceBlocked => serializer.serialize_i32(4),
13111 Self::ApiKeyHttpReferrerBlocked => serializer.serialize_i32(7),
13112 Self::ApiKeyIpAddressBlocked => serializer.serialize_i32(8),
13113 Self::ApiKeyAndroidAppBlocked => serializer.serialize_i32(9),
13114 Self::ApiKeyIosAppBlocked => serializer.serialize_i32(13),
13115 Self::RateLimitExceeded => serializer.serialize_i32(5),
13116 Self::ResourceQuotaExceeded => serializer.serialize_i32(6),
13117 Self::LocationTaxPolicyViolated => serializer.serialize_i32(10),
13118 Self::UserProjectDenied => serializer.serialize_i32(11),
13119 Self::ConsumerSuspended => serializer.serialize_i32(12),
13120 Self::ConsumerInvalid => serializer.serialize_i32(14),
13121 Self::SecurityPolicyViolated => serializer.serialize_i32(15),
13122 Self::AccessTokenExpired => serializer.serialize_i32(16),
13123 Self::AccessTokenScopeInsufficient => serializer.serialize_i32(17),
13124 Self::AccountStateInvalid => serializer.serialize_i32(18),
13125 Self::AccessTokenTypeUnsupported => serializer.serialize_i32(19),
13126 Self::CredentialsMissing => serializer.serialize_i32(20),
13127 Self::ResourceProjectInvalid => serializer.serialize_i32(21),
13128 Self::SessionCookieInvalid => serializer.serialize_i32(23),
13129 Self::UserBlockedByAdmin => serializer.serialize_i32(24),
13130 Self::ResourceUsageRestrictionViolated => serializer.serialize_i32(25),
13131 Self::SystemParameterUnsupported => serializer.serialize_i32(26),
13132 Self::OrgRestrictionViolation => serializer.serialize_i32(27),
13133 Self::OrgRestrictionHeaderInvalid => serializer.serialize_i32(28),
13134 Self::ServiceNotVisible => serializer.serialize_i32(29),
13135 Self::GcpSuspended => serializer.serialize_i32(30),
13136 Self::LocationPolicyViolated => serializer.serialize_i32(31),
13137 Self::MissingOrigin => serializer.serialize_i32(33),
13138 Self::OverloadedCredentials => serializer.serialize_i32(34),
13139 Self::UnknownValue(u) => u.0.serialize(serializer),
13140 }
13141 }
13142}
13143
13144impl<'de> serde::de::Deserialize<'de> for ErrorReason {
13145 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13146 where
13147 D: serde::Deserializer<'de>,
13148 {
13149 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ErrorReason>::new(
13150 ".google.api.ErrorReason",
13151 ))
13152 }
13153}
13154
13155/// An indicator of the behavior of a given field (for example, that a field
13156/// is required in requests, or given as output but ignored as input).
13157/// This **does not** change the behavior in protocol buffers itself; it only
13158/// denotes the behavior and may affect how API tooling handles the field.
13159///
13160/// Note: This enum **may** receive new values in the future.
13161///
13162/// # Working with unknown values
13163///
13164/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
13165/// additional enum variants at any time. Adding new variants is not considered
13166/// a breaking change. Applications should write their code in anticipation of:
13167///
13168/// - New values appearing in future releases of the client library, **and**
13169/// - New values received dynamically, without application changes.
13170///
13171/// Please consult the [Working with enums] section in the user guide for some
13172/// guidelines.
13173///
13174/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
13175#[derive(Clone, Debug, PartialEq)]
13176#[non_exhaustive]
13177pub enum FieldBehavior {
13178 /// Conventional default for enums. Do not use this.
13179 Unspecified,
13180 /// Specifically denotes a field as optional.
13181 /// While all fields in protocol buffers are optional, this may be specified
13182 /// for emphasis if appropriate.
13183 Optional,
13184 /// Denotes a field as required.
13185 /// This indicates that the field **must** be provided as part of the request,
13186 /// and failure to do so will cause an error (usually `INVALID_ARGUMENT`).
13187 Required,
13188 /// Denotes a field as output only.
13189 /// This indicates that the field is provided in responses, but including the
13190 /// field in a request does nothing (the server *must* ignore it and
13191 /// *must not* throw an error as a result of the field's presence).
13192 OutputOnly,
13193 /// Denotes a field as input only.
13194 /// This indicates that the field is provided in requests, and the
13195 /// corresponding field is not included in output.
13196 InputOnly,
13197 /// Denotes a field as immutable.
13198 /// This indicates that the field may be set once in a request to create a
13199 /// resource, but may not be changed thereafter.
13200 Immutable,
13201 /// Denotes that a (repeated) field is an unordered list.
13202 /// This indicates that the service may provide the elements of the list
13203 /// in any arbitrary order, rather than the order the user originally
13204 /// provided. Additionally, the list's order may or may not be stable.
13205 UnorderedList,
13206 /// Denotes that this field returns a non-empty default value if not set.
13207 /// This indicates that if the user provides the empty value in a request,
13208 /// a non-empty value will be returned. The user will not be aware of what
13209 /// non-empty value to expect.
13210 NonEmptyDefault,
13211 /// Denotes that the field in a resource (a message annotated with
13212 /// google.api.resource) is used in the resource name to uniquely identify the
13213 /// resource. For AIP-compliant APIs, this should only be applied to the
13214 /// `name` field on the resource.
13215 ///
13216 /// This behavior should not be applied to references to other resources within
13217 /// the message.
13218 ///
13219 /// The identifier field of resources often have different field behavior
13220 /// depending on the request it is embedded in (e.g. for Create methods name
13221 /// is optional and unused, while for Update methods it is required). Instead
13222 /// of method-specific annotations, only `IDENTIFIER` is required.
13223 Identifier,
13224 /// If set, the enum was initialized with an unknown value.
13225 ///
13226 /// Applications can examine the value using [FieldBehavior::value] or
13227 /// [FieldBehavior::name].
13228 UnknownValue(field_behavior::UnknownValue),
13229}
13230
13231#[doc(hidden)]
13232pub mod field_behavior {
13233 #[allow(unused_imports)]
13234 use super::*;
13235 #[derive(Clone, Debug, PartialEq)]
13236 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13237}
13238
13239impl FieldBehavior {
13240 /// Gets the enum value.
13241 ///
13242 /// Returns `None` if the enum contains an unknown value deserialized from
13243 /// the string representation of enums.
13244 pub fn value(&self) -> std::option::Option<i32> {
13245 match self {
13246 Self::Unspecified => std::option::Option::Some(0),
13247 Self::Optional => std::option::Option::Some(1),
13248 Self::Required => std::option::Option::Some(2),
13249 Self::OutputOnly => std::option::Option::Some(3),
13250 Self::InputOnly => std::option::Option::Some(4),
13251 Self::Immutable => std::option::Option::Some(5),
13252 Self::UnorderedList => std::option::Option::Some(6),
13253 Self::NonEmptyDefault => std::option::Option::Some(7),
13254 Self::Identifier => std::option::Option::Some(8),
13255 Self::UnknownValue(u) => u.0.value(),
13256 }
13257 }
13258
13259 /// Gets the enum value as a string.
13260 ///
13261 /// Returns `None` if the enum contains an unknown value deserialized from
13262 /// the integer representation of enums.
13263 pub fn name(&self) -> std::option::Option<&str> {
13264 match self {
13265 Self::Unspecified => std::option::Option::Some("FIELD_BEHAVIOR_UNSPECIFIED"),
13266 Self::Optional => std::option::Option::Some("OPTIONAL"),
13267 Self::Required => std::option::Option::Some("REQUIRED"),
13268 Self::OutputOnly => std::option::Option::Some("OUTPUT_ONLY"),
13269 Self::InputOnly => std::option::Option::Some("INPUT_ONLY"),
13270 Self::Immutable => std::option::Option::Some("IMMUTABLE"),
13271 Self::UnorderedList => std::option::Option::Some("UNORDERED_LIST"),
13272 Self::NonEmptyDefault => std::option::Option::Some("NON_EMPTY_DEFAULT"),
13273 Self::Identifier => std::option::Option::Some("IDENTIFIER"),
13274 Self::UnknownValue(u) => u.0.name(),
13275 }
13276 }
13277}
13278
13279impl std::default::Default for FieldBehavior {
13280 fn default() -> Self {
13281 use std::convert::From;
13282 Self::from(0)
13283 }
13284}
13285
13286impl std::fmt::Display for FieldBehavior {
13287 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
13288 wkt::internal::display_enum(f, self.name(), self.value())
13289 }
13290}
13291
13292impl std::convert::From<i32> for FieldBehavior {
13293 fn from(value: i32) -> Self {
13294 match value {
13295 0 => Self::Unspecified,
13296 1 => Self::Optional,
13297 2 => Self::Required,
13298 3 => Self::OutputOnly,
13299 4 => Self::InputOnly,
13300 5 => Self::Immutable,
13301 6 => Self::UnorderedList,
13302 7 => Self::NonEmptyDefault,
13303 8 => Self::Identifier,
13304 _ => Self::UnknownValue(field_behavior::UnknownValue(
13305 wkt::internal::UnknownEnumValue::Integer(value),
13306 )),
13307 }
13308 }
13309}
13310
13311impl std::convert::From<&str> for FieldBehavior {
13312 fn from(value: &str) -> Self {
13313 use std::string::ToString;
13314 match value {
13315 "FIELD_BEHAVIOR_UNSPECIFIED" => Self::Unspecified,
13316 "OPTIONAL" => Self::Optional,
13317 "REQUIRED" => Self::Required,
13318 "OUTPUT_ONLY" => Self::OutputOnly,
13319 "INPUT_ONLY" => Self::InputOnly,
13320 "IMMUTABLE" => Self::Immutable,
13321 "UNORDERED_LIST" => Self::UnorderedList,
13322 "NON_EMPTY_DEFAULT" => Self::NonEmptyDefault,
13323 "IDENTIFIER" => Self::Identifier,
13324 _ => Self::UnknownValue(field_behavior::UnknownValue(
13325 wkt::internal::UnknownEnumValue::String(value.to_string()),
13326 )),
13327 }
13328 }
13329}
13330
13331impl serde::ser::Serialize for FieldBehavior {
13332 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13333 where
13334 S: serde::Serializer,
13335 {
13336 match self {
13337 Self::Unspecified => serializer.serialize_i32(0),
13338 Self::Optional => serializer.serialize_i32(1),
13339 Self::Required => serializer.serialize_i32(2),
13340 Self::OutputOnly => serializer.serialize_i32(3),
13341 Self::InputOnly => serializer.serialize_i32(4),
13342 Self::Immutable => serializer.serialize_i32(5),
13343 Self::UnorderedList => serializer.serialize_i32(6),
13344 Self::NonEmptyDefault => serializer.serialize_i32(7),
13345 Self::Identifier => serializer.serialize_i32(8),
13346 Self::UnknownValue(u) => u.0.serialize(serializer),
13347 }
13348 }
13349}
13350
13351impl<'de> serde::de::Deserialize<'de> for FieldBehavior {
13352 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13353 where
13354 D: serde::Deserializer<'de>,
13355 {
13356 deserializer.deserialize_any(wkt::internal::EnumVisitor::<FieldBehavior>::new(
13357 ".google.api.FieldBehavior",
13358 ))
13359 }
13360}
13361
13362/// The launch stage as defined by [Google Cloud Platform
13363/// Launch Stages](https://cloud.google.com/terms/launch-stages).
13364///
13365/// # Working with unknown values
13366///
13367/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
13368/// additional enum variants at any time. Adding new variants is not considered
13369/// a breaking change. Applications should write their code in anticipation of:
13370///
13371/// - New values appearing in future releases of the client library, **and**
13372/// - New values received dynamically, without application changes.
13373///
13374/// Please consult the [Working with enums] section in the user guide for some
13375/// guidelines.
13376///
13377/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
13378#[derive(Clone, Debug, PartialEq)]
13379#[non_exhaustive]
13380pub enum LaunchStage {
13381 /// Do not use this default value.
13382 Unspecified,
13383 /// The feature is not yet implemented. Users can not use it.
13384 Unimplemented,
13385 /// Prelaunch features are hidden from users and are only visible internally.
13386 Prelaunch,
13387 /// Early Access features are limited to a closed group of testers. To use
13388 /// these features, you must sign up in advance and sign a Trusted Tester
13389 /// agreement (which includes confidentiality provisions). These features may
13390 /// be unstable, changed in backward-incompatible ways, and are not
13391 /// guaranteed to be released.
13392 EarlyAccess,
13393 /// Alpha is a limited availability test for releases before they are cleared
13394 /// for widespread use. By Alpha, all significant design issues are resolved
13395 /// and we are in the process of verifying functionality. Alpha customers
13396 /// need to apply for access, agree to applicable terms, and have their
13397 /// projects allowlisted. Alpha releases don't have to be feature complete,
13398 /// no SLAs are provided, and there are no technical support obligations, but
13399 /// they will be far enough along that customers can actually use them in
13400 /// test environments or for limited-use tests -- just like they would in
13401 /// normal production cases.
13402 Alpha,
13403 /// Beta is the point at which we are ready to open a release for any
13404 /// customer to use. There are no SLA or technical support obligations in a
13405 /// Beta release. Products will be complete from a feature perspective, but
13406 /// may have some open outstanding issues. Beta releases are suitable for
13407 /// limited production use cases.
13408 Beta,
13409 /// GA features are open to all developers and are considered stable and
13410 /// fully qualified for production use.
13411 Ga,
13412 /// Deprecated features are scheduled to be shut down and removed. For more
13413 /// information, see the "Deprecation Policy" section of our [Terms of
13414 /// Service](https://cloud.google.com/terms/)
13415 /// and the [Google Cloud Platform Subject to the Deprecation
13416 /// Policy](https://cloud.google.com/terms/deprecation) documentation.
13417 Deprecated,
13418 /// If set, the enum was initialized with an unknown value.
13419 ///
13420 /// Applications can examine the value using [LaunchStage::value] or
13421 /// [LaunchStage::name].
13422 UnknownValue(launch_stage::UnknownValue),
13423}
13424
13425#[doc(hidden)]
13426pub mod launch_stage {
13427 #[allow(unused_imports)]
13428 use super::*;
13429 #[derive(Clone, Debug, PartialEq)]
13430 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13431}
13432
13433impl LaunchStage {
13434 /// Gets the enum value.
13435 ///
13436 /// Returns `None` if the enum contains an unknown value deserialized from
13437 /// the string representation of enums.
13438 pub fn value(&self) -> std::option::Option<i32> {
13439 match self {
13440 Self::Unspecified => std::option::Option::Some(0),
13441 Self::Unimplemented => std::option::Option::Some(6),
13442 Self::Prelaunch => std::option::Option::Some(7),
13443 Self::EarlyAccess => std::option::Option::Some(1),
13444 Self::Alpha => std::option::Option::Some(2),
13445 Self::Beta => std::option::Option::Some(3),
13446 Self::Ga => std::option::Option::Some(4),
13447 Self::Deprecated => std::option::Option::Some(5),
13448 Self::UnknownValue(u) => u.0.value(),
13449 }
13450 }
13451
13452 /// Gets the enum value as a string.
13453 ///
13454 /// Returns `None` if the enum contains an unknown value deserialized from
13455 /// the integer representation of enums.
13456 pub fn name(&self) -> std::option::Option<&str> {
13457 match self {
13458 Self::Unspecified => std::option::Option::Some("LAUNCH_STAGE_UNSPECIFIED"),
13459 Self::Unimplemented => std::option::Option::Some("UNIMPLEMENTED"),
13460 Self::Prelaunch => std::option::Option::Some("PRELAUNCH"),
13461 Self::EarlyAccess => std::option::Option::Some("EARLY_ACCESS"),
13462 Self::Alpha => std::option::Option::Some("ALPHA"),
13463 Self::Beta => std::option::Option::Some("BETA"),
13464 Self::Ga => std::option::Option::Some("GA"),
13465 Self::Deprecated => std::option::Option::Some("DEPRECATED"),
13466 Self::UnknownValue(u) => u.0.name(),
13467 }
13468 }
13469}
13470
13471impl std::default::Default for LaunchStage {
13472 fn default() -> Self {
13473 use std::convert::From;
13474 Self::from(0)
13475 }
13476}
13477
13478impl std::fmt::Display for LaunchStage {
13479 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
13480 wkt::internal::display_enum(f, self.name(), self.value())
13481 }
13482}
13483
13484impl std::convert::From<i32> for LaunchStage {
13485 fn from(value: i32) -> Self {
13486 match value {
13487 0 => Self::Unspecified,
13488 1 => Self::EarlyAccess,
13489 2 => Self::Alpha,
13490 3 => Self::Beta,
13491 4 => Self::Ga,
13492 5 => Self::Deprecated,
13493 6 => Self::Unimplemented,
13494 7 => Self::Prelaunch,
13495 _ => Self::UnknownValue(launch_stage::UnknownValue(
13496 wkt::internal::UnknownEnumValue::Integer(value),
13497 )),
13498 }
13499 }
13500}
13501
13502impl std::convert::From<&str> for LaunchStage {
13503 fn from(value: &str) -> Self {
13504 use std::string::ToString;
13505 match value {
13506 "LAUNCH_STAGE_UNSPECIFIED" => Self::Unspecified,
13507 "UNIMPLEMENTED" => Self::Unimplemented,
13508 "PRELAUNCH" => Self::Prelaunch,
13509 "EARLY_ACCESS" => Self::EarlyAccess,
13510 "ALPHA" => Self::Alpha,
13511 "BETA" => Self::Beta,
13512 "GA" => Self::Ga,
13513 "DEPRECATED" => Self::Deprecated,
13514 _ => Self::UnknownValue(launch_stage::UnknownValue(
13515 wkt::internal::UnknownEnumValue::String(value.to_string()),
13516 )),
13517 }
13518 }
13519}
13520
13521impl serde::ser::Serialize for LaunchStage {
13522 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13523 where
13524 S: serde::Serializer,
13525 {
13526 match self {
13527 Self::Unspecified => serializer.serialize_i32(0),
13528 Self::Unimplemented => serializer.serialize_i32(6),
13529 Self::Prelaunch => serializer.serialize_i32(7),
13530 Self::EarlyAccess => serializer.serialize_i32(1),
13531 Self::Alpha => serializer.serialize_i32(2),
13532 Self::Beta => serializer.serialize_i32(3),
13533 Self::Ga => serializer.serialize_i32(4),
13534 Self::Deprecated => serializer.serialize_i32(5),
13535 Self::UnknownValue(u) => u.0.serialize(serializer),
13536 }
13537 }
13538}
13539
13540impl<'de> serde::de::Deserialize<'de> for LaunchStage {
13541 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13542 where
13543 D: serde::Deserializer<'de>,
13544 {
13545 deserializer.deserialize_any(wkt::internal::EnumVisitor::<LaunchStage>::new(
13546 ".google.api.LaunchStage",
13547 ))
13548 }
13549}