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
27/// `Authentication` defines the authentication configuration for API methods
28/// provided by an API service.
29///
30/// Example:
31///
32/// ```norust
33/// name: calendar.googleapis.com
34/// authentication:
35/// providers:
36/// - id: google_calendar_auth
37/// jwks_uri: https://www.googleapis.com/oauth2/v1/certs
38/// issuer: https://securetoken.google.com
39/// rules:
40/// - selector: "*"
41/// requirements:
42/// provider_id: google_calendar_auth
43/// - selector: google.calendar.Delegate
44/// oauth:
45/// canonical_scopes: https://www.googleapis.com/auth/calendar.read
46/// ```
47#[serde_with::serde_as]
48#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
49#[serde(default, rename_all = "camelCase")]
50#[non_exhaustive]
51pub struct Authentication {
52 /// A list of authentication rules that apply to individual API methods.
53 ///
54 /// **NOTE:** All service configuration rules follow "last one wins" order.
55 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
56 pub rules: std::vec::Vec<crate::model::AuthenticationRule>,
57
58 /// Defines a set of authentication providers that a service supports.
59 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
60 pub providers: std::vec::Vec<crate::model::AuthProvider>,
61
62 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
63 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
64}
65
66impl Authentication {
67 pub fn new() -> Self {
68 std::default::Default::default()
69 }
70
71 /// Sets the value of [rules][crate::model::Authentication::rules].
72 pub fn set_rules<T, V>(mut self, v: T) -> Self
73 where
74 T: std::iter::IntoIterator<Item = V>,
75 V: std::convert::Into<crate::model::AuthenticationRule>,
76 {
77 use std::iter::Iterator;
78 self.rules = v.into_iter().map(|i| i.into()).collect();
79 self
80 }
81
82 /// Sets the value of [providers][crate::model::Authentication::providers].
83 pub fn set_providers<T, V>(mut self, v: T) -> Self
84 where
85 T: std::iter::IntoIterator<Item = V>,
86 V: std::convert::Into<crate::model::AuthProvider>,
87 {
88 use std::iter::Iterator;
89 self.providers = v.into_iter().map(|i| i.into()).collect();
90 self
91 }
92}
93
94impl wkt::message::Message for Authentication {
95 fn typename() -> &'static str {
96 "type.googleapis.com/google.api.Authentication"
97 }
98}
99
100/// Authentication rules for the service.
101///
102/// By default, if a method has any authentication requirements, every request
103/// must include a valid credential matching one of the requirements.
104/// It's an error to include more than one kind of credential in a single
105/// request.
106///
107/// If a method doesn't have any auth requirements, request credentials will be
108/// ignored.
109#[serde_with::serde_as]
110#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
111#[serde(default, rename_all = "camelCase")]
112#[non_exhaustive]
113pub struct AuthenticationRule {
114 /// Selects the methods to which this rule applies.
115 ///
116 /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
117 /// details.
118 ///
119 /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
120 #[serde(skip_serializing_if = "std::string::String::is_empty")]
121 pub selector: std::string::String,
122
123 /// The requirements for OAuth credentials.
124 #[serde(skip_serializing_if = "std::option::Option::is_none")]
125 pub oauth: std::option::Option<crate::model::OAuthRequirements>,
126
127 /// If true, the service accepts API keys without any other credential.
128 /// This flag only applies to HTTP and gRPC requests.
129 #[serde(skip_serializing_if = "wkt::internal::is_default")]
130 pub allow_without_credential: bool,
131
132 /// Requirements for additional authentication providers.
133 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
134 pub requirements: std::vec::Vec<crate::model::AuthRequirement>,
135
136 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
137 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
138}
139
140impl AuthenticationRule {
141 pub fn new() -> Self {
142 std::default::Default::default()
143 }
144
145 /// Sets the value of [selector][crate::model::AuthenticationRule::selector].
146 pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
147 self.selector = v.into();
148 self
149 }
150
151 /// Sets the value of [oauth][crate::model::AuthenticationRule::oauth].
152 pub fn set_oauth<
153 T: std::convert::Into<std::option::Option<crate::model::OAuthRequirements>>,
154 >(
155 mut self,
156 v: T,
157 ) -> Self {
158 self.oauth = v.into();
159 self
160 }
161
162 /// Sets the value of [allow_without_credential][crate::model::AuthenticationRule::allow_without_credential].
163 pub fn set_allow_without_credential<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
164 self.allow_without_credential = v.into();
165 self
166 }
167
168 /// Sets the value of [requirements][crate::model::AuthenticationRule::requirements].
169 pub fn set_requirements<T, V>(mut self, v: T) -> Self
170 where
171 T: std::iter::IntoIterator<Item = V>,
172 V: std::convert::Into<crate::model::AuthRequirement>,
173 {
174 use std::iter::Iterator;
175 self.requirements = v.into_iter().map(|i| i.into()).collect();
176 self
177 }
178}
179
180impl wkt::message::Message for AuthenticationRule {
181 fn typename() -> &'static str {
182 "type.googleapis.com/google.api.AuthenticationRule"
183 }
184}
185
186/// Specifies a location to extract JWT from an API request.
187#[serde_with::serde_as]
188#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
189#[serde(default, rename_all = "camelCase")]
190#[non_exhaustive]
191pub struct JwtLocation {
192 /// The value prefix. The value format is "value_prefix{token}"
193 /// Only applies to "in" header type. Must be empty for "in" query type.
194 /// If not empty, the header value has to match (case sensitive) this prefix.
195 /// If not matched, JWT will not be extracted. If matched, JWT will be
196 /// extracted after the prefix is removed.
197 ///
198 /// For example, for "Authorization: Bearer {JWT}",
199 /// value_prefix="Bearer " with a space at the end.
200 #[serde(skip_serializing_if = "std::string::String::is_empty")]
201 pub value_prefix: std::string::String,
202
203 #[serde(flatten, skip_serializing_if = "std::option::Option::is_none")]
204 pub r#in: std::option::Option<crate::model::jwt_location::In>,
205
206 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
207 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
208}
209
210impl JwtLocation {
211 pub fn new() -> Self {
212 std::default::Default::default()
213 }
214
215 /// Sets the value of [value_prefix][crate::model::JwtLocation::value_prefix].
216 pub fn set_value_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
217 self.value_prefix = v.into();
218 self
219 }
220
221 /// Sets the value of [r#in][crate::model::JwtLocation::in].
222 ///
223 /// Note that all the setters affecting `r#in` are mutually
224 /// exclusive.
225 pub fn set_in<T: std::convert::Into<std::option::Option<crate::model::jwt_location::In>>>(
226 mut self,
227 v: T,
228 ) -> Self {
229 self.r#in = v.into();
230 self
231 }
232
233 /// The value of [r#in][crate::model::JwtLocation::r#in]
234 /// if it holds a `Header`, `None` if the field is not set or
235 /// holds a different branch.
236 pub fn header(&self) -> std::option::Option<&std::string::String> {
237 #[allow(unreachable_patterns)]
238 self.r#in.as_ref().and_then(|v| match v {
239 crate::model::jwt_location::In::Header(v) => std::option::Option::Some(v),
240 _ => std::option::Option::None,
241 })
242 }
243
244 /// Sets the value of [r#in][crate::model::JwtLocation::r#in]
245 /// to hold a `Header`.
246 ///
247 /// Note that all the setters affecting `r#in` are
248 /// mutually exclusive.
249 pub fn set_header<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
250 self.r#in = std::option::Option::Some(crate::model::jwt_location::In::Header(v.into()));
251 self
252 }
253
254 /// The value of [r#in][crate::model::JwtLocation::r#in]
255 /// if it holds a `Query`, `None` if the field is not set or
256 /// holds a different branch.
257 pub fn query(&self) -> std::option::Option<&std::string::String> {
258 #[allow(unreachable_patterns)]
259 self.r#in.as_ref().and_then(|v| match v {
260 crate::model::jwt_location::In::Query(v) => std::option::Option::Some(v),
261 _ => std::option::Option::None,
262 })
263 }
264
265 /// Sets the value of [r#in][crate::model::JwtLocation::r#in]
266 /// to hold a `Query`.
267 ///
268 /// Note that all the setters affecting `r#in` are
269 /// mutually exclusive.
270 pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
271 self.r#in = std::option::Option::Some(crate::model::jwt_location::In::Query(v.into()));
272 self
273 }
274
275 /// The value of [r#in][crate::model::JwtLocation::r#in]
276 /// if it holds a `Cookie`, `None` if the field is not set or
277 /// holds a different branch.
278 pub fn cookie(&self) -> std::option::Option<&std::string::String> {
279 #[allow(unreachable_patterns)]
280 self.r#in.as_ref().and_then(|v| match v {
281 crate::model::jwt_location::In::Cookie(v) => std::option::Option::Some(v),
282 _ => std::option::Option::None,
283 })
284 }
285
286 /// Sets the value of [r#in][crate::model::JwtLocation::r#in]
287 /// to hold a `Cookie`.
288 ///
289 /// Note that all the setters affecting `r#in` are
290 /// mutually exclusive.
291 pub fn set_cookie<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
292 self.r#in = std::option::Option::Some(crate::model::jwt_location::In::Cookie(v.into()));
293 self
294 }
295}
296
297impl wkt::message::Message for JwtLocation {
298 fn typename() -> &'static str {
299 "type.googleapis.com/google.api.JwtLocation"
300 }
301}
302
303/// Defines additional types related to [JwtLocation].
304pub mod jwt_location {
305 #[allow(unused_imports)]
306 use super::*;
307
308 #[serde_with::serde_as]
309 #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
310 #[serde(rename_all = "camelCase")]
311 #[non_exhaustive]
312 pub enum In {
313 /// Specifies HTTP header name to extract JWT token.
314 Header(std::string::String),
315 /// Specifies URL query parameter name to extract JWT token.
316 Query(std::string::String),
317 /// Specifies cookie name to extract JWT token.
318 Cookie(std::string::String),
319 }
320}
321
322/// Configuration for an authentication provider, including support for
323/// [JSON Web Token
324/// (JWT)](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32).
325#[serde_with::serde_as]
326#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
327#[serde(default, rename_all = "camelCase")]
328#[non_exhaustive]
329pub struct AuthProvider {
330 /// The unique identifier of the auth provider. It will be referred to by
331 /// `AuthRequirement.provider_id`.
332 ///
333 /// Example: "bookstore_auth".
334 #[serde(skip_serializing_if = "std::string::String::is_empty")]
335 pub id: std::string::String,
336
337 /// Identifies the principal that issued the JWT. See
338 /// <https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.1>
339 /// Usually a URL or an email address.
340 ///
341 /// Example: <https://securetoken.google.com>
342 /// Example: 1234567-compute@developer.gserviceaccount.com
343 #[serde(skip_serializing_if = "std::string::String::is_empty")]
344 pub issuer: std::string::String,
345
346 /// URL of the provider's public key set to validate signature of the JWT. See
347 /// [OpenID
348 /// Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata).
349 /// Optional if the key set document:
350 ///
351 /// - can be retrieved from
352 /// [OpenID
353 /// Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html)
354 /// of the issuer.
355 /// - can be inferred from the email domain of the issuer (e.g. a Google
356 /// service account).
357 ///
358 /// Example: <https://www.googleapis.com/oauth2/v1/certs>
359 #[serde(skip_serializing_if = "std::string::String::is_empty")]
360 pub jwks_uri: std::string::String,
361
362 /// The list of JWT
363 /// [audiences](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.3).
364 /// that are allowed to access. A JWT containing any of these audiences will
365 /// be accepted. When this setting is absent, JWTs with audiences:
366 ///
367 /// - "https://[service.name]/[google.protobuf.Api.name]"
368 /// - "https://[service.name]/"
369 /// will be accepted.
370 /// For example, if no audiences are in the setting, LibraryService API will
371 /// accept JWTs with the following audiences:
372 ///
373 /// <https://library-example.googleapis.com/google.example.library.v1.LibraryService>
374 ///
375 /// - <https://library-example.googleapis.com/>
376 ///
377 /// Example:
378 ///
379 /// ```norust
380 /// audiences: bookstore_android.apps.googleusercontent.com,
381 /// bookstore_web.apps.googleusercontent.com
382 /// ```
383 #[serde(skip_serializing_if = "std::string::String::is_empty")]
384 pub audiences: std::string::String,
385
386 /// Redirect URL if JWT token is required but not present or is expired.
387 /// Implement authorizationUrl of securityDefinitions in OpenAPI spec.
388 #[serde(skip_serializing_if = "std::string::String::is_empty")]
389 pub authorization_url: std::string::String,
390
391 /// Defines the locations to extract the JWT. For now it is only used by the
392 /// Cloud Endpoints to store the OpenAPI extension [x-google-jwt-locations]
393 /// (<https://cloud.google.com/endpoints/docs/openapi/openapi-extensions#x-google-jwt-locations>)
394 ///
395 /// JWT locations can be one of HTTP headers, URL query parameters or
396 /// cookies. The rule is that the first match wins.
397 ///
398 /// If not specified, default to use following 3 locations:
399 ///
400 /// ) Authorization: Bearer
401 /// ) x-goog-iap-jwt-assertion
402 /// ) access_token query parameter
403 ///
404 /// Default locations can be specified as followings:
405 /// jwt_locations:
406 ///
407 /// - header: Authorization
408 /// value_prefix: "Bearer "
409 /// - header: x-goog-iap-jwt-assertion
410 /// - query: access_token
411 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
412 pub jwt_locations: std::vec::Vec<crate::model::JwtLocation>,
413
414 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
415 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
416}
417
418impl AuthProvider {
419 pub fn new() -> Self {
420 std::default::Default::default()
421 }
422
423 /// Sets the value of [id][crate::model::AuthProvider::id].
424 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
425 self.id = v.into();
426 self
427 }
428
429 /// Sets the value of [issuer][crate::model::AuthProvider::issuer].
430 pub fn set_issuer<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
431 self.issuer = v.into();
432 self
433 }
434
435 /// Sets the value of [jwks_uri][crate::model::AuthProvider::jwks_uri].
436 pub fn set_jwks_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
437 self.jwks_uri = v.into();
438 self
439 }
440
441 /// Sets the value of [audiences][crate::model::AuthProvider::audiences].
442 pub fn set_audiences<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
443 self.audiences = v.into();
444 self
445 }
446
447 /// Sets the value of [authorization_url][crate::model::AuthProvider::authorization_url].
448 pub fn set_authorization_url<T: std::convert::Into<std::string::String>>(
449 mut self,
450 v: T,
451 ) -> Self {
452 self.authorization_url = v.into();
453 self
454 }
455
456 /// Sets the value of [jwt_locations][crate::model::AuthProvider::jwt_locations].
457 pub fn set_jwt_locations<T, V>(mut self, v: T) -> Self
458 where
459 T: std::iter::IntoIterator<Item = V>,
460 V: std::convert::Into<crate::model::JwtLocation>,
461 {
462 use std::iter::Iterator;
463 self.jwt_locations = v.into_iter().map(|i| i.into()).collect();
464 self
465 }
466}
467
468impl wkt::message::Message for AuthProvider {
469 fn typename() -> &'static str {
470 "type.googleapis.com/google.api.AuthProvider"
471 }
472}
473
474/// OAuth scopes are a way to define data and permissions on data. For example,
475/// there are scopes defined for "Read-only access to Google Calendar" and
476/// "Access to Cloud Platform". Users can consent to a scope for an application,
477/// giving it permission to access that data on their behalf.
478///
479/// OAuth scope specifications should be fairly coarse grained; a user will need
480/// to see and understand the text description of what your scope means.
481///
482/// In most cases: use one or at most two OAuth scopes for an entire family of
483/// products. If your product has multiple APIs, you should probably be sharing
484/// the OAuth scope across all of those APIs.
485///
486/// When you need finer grained OAuth consent screens: talk with your product
487/// management about how developers will use them in practice.
488///
489/// Please note that even though each of the canonical scopes is enough for a
490/// request to be accepted and passed to the backend, a request can still fail
491/// due to the backend requiring additional scopes or permissions.
492#[serde_with::serde_as]
493#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
494#[serde(default, rename_all = "camelCase")]
495#[non_exhaustive]
496pub struct OAuthRequirements {
497 /// The list of publicly documented OAuth scopes that are allowed access. An
498 /// OAuth token containing any of these scopes will be accepted.
499 ///
500 /// Example:
501 ///
502 /// ```norust
503 /// canonical_scopes: https://www.googleapis.com/auth/calendar,
504 /// https://www.googleapis.com/auth/calendar.read
505 /// ```
506 #[serde(skip_serializing_if = "std::string::String::is_empty")]
507 pub canonical_scopes: std::string::String,
508
509 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
510 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
511}
512
513impl OAuthRequirements {
514 pub fn new() -> Self {
515 std::default::Default::default()
516 }
517
518 /// Sets the value of [canonical_scopes][crate::model::OAuthRequirements::canonical_scopes].
519 pub fn set_canonical_scopes<T: std::convert::Into<std::string::String>>(
520 mut self,
521 v: T,
522 ) -> Self {
523 self.canonical_scopes = v.into();
524 self
525 }
526}
527
528impl wkt::message::Message for OAuthRequirements {
529 fn typename() -> &'static str {
530 "type.googleapis.com/google.api.OAuthRequirements"
531 }
532}
533
534/// User-defined authentication requirements, including support for
535/// [JSON Web Token
536/// (JWT)](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32).
537#[serde_with::serde_as]
538#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
539#[serde(default, rename_all = "camelCase")]
540#[non_exhaustive]
541pub struct AuthRequirement {
542 /// [id][google.api.AuthProvider.id] from authentication provider.
543 ///
544 /// Example:
545 ///
546 /// ```norust
547 /// provider_id: bookstore_auth
548 /// ```
549 ///
550 /// [google.api.AuthProvider.id]: crate::model::AuthProvider::id
551 #[serde(skip_serializing_if = "std::string::String::is_empty")]
552 pub provider_id: std::string::String,
553
554 /// NOTE: This will be deprecated soon, once AuthProvider.audiences is
555 /// implemented and accepted in all the runtime components.
556 ///
557 /// The list of JWT
558 /// [audiences](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.3).
559 /// that are allowed to access. A JWT containing any of these audiences will
560 /// be accepted. When this setting is absent, only JWTs with audience
561 /// "https://[Service_name][google.api.Service.name]/[API_name][google.protobuf.Api.name]"
562 /// will be accepted. For example, if no audiences are in the setting,
563 /// LibraryService API will only accept JWTs with the following audience
564 /// `https://library-example.googleapis.com/google.example.library.v1.LibraryService`.
565 ///
566 /// Example:
567 ///
568 /// ```norust
569 /// audiences: bookstore_android.apps.googleusercontent.com,
570 /// bookstore_web.apps.googleusercontent.com
571 /// ```
572 ///
573 /// [google.api.Service.name]: crate::model::Service::name
574 /// [google.protobuf.Api.name]: wkt::Api::name
575 #[serde(skip_serializing_if = "std::string::String::is_empty")]
576 pub audiences: std::string::String,
577
578 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
579 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
580}
581
582impl AuthRequirement {
583 pub fn new() -> Self {
584 std::default::Default::default()
585 }
586
587 /// Sets the value of [provider_id][crate::model::AuthRequirement::provider_id].
588 pub fn set_provider_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
589 self.provider_id = v.into();
590 self
591 }
592
593 /// Sets the value of [audiences][crate::model::AuthRequirement::audiences].
594 pub fn set_audiences<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
595 self.audiences = v.into();
596 self
597 }
598}
599
600impl wkt::message::Message for AuthRequirement {
601 fn typename() -> &'static str {
602 "type.googleapis.com/google.api.AuthRequirement"
603 }
604}
605
606/// `Backend` defines the backend configuration for a service.
607#[serde_with::serde_as]
608#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
609#[serde(default, rename_all = "camelCase")]
610#[non_exhaustive]
611pub struct Backend {
612 /// A list of API backend rules that apply to individual API methods.
613 ///
614 /// **NOTE:** All service configuration rules follow "last one wins" order.
615 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
616 pub rules: std::vec::Vec<crate::model::BackendRule>,
617
618 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
619 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
620}
621
622impl Backend {
623 pub fn new() -> Self {
624 std::default::Default::default()
625 }
626
627 /// Sets the value of [rules][crate::model::Backend::rules].
628 pub fn set_rules<T, V>(mut self, v: T) -> Self
629 where
630 T: std::iter::IntoIterator<Item = V>,
631 V: std::convert::Into<crate::model::BackendRule>,
632 {
633 use std::iter::Iterator;
634 self.rules = v.into_iter().map(|i| i.into()).collect();
635 self
636 }
637}
638
639impl wkt::message::Message for Backend {
640 fn typename() -> &'static str {
641 "type.googleapis.com/google.api.Backend"
642 }
643}
644
645/// A backend rule provides configuration for an individual API element.
646#[serde_with::serde_as]
647#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
648#[serde(default, rename_all = "camelCase")]
649#[non_exhaustive]
650pub struct BackendRule {
651 /// Selects the methods to which this rule applies.
652 ///
653 /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
654 /// details.
655 ///
656 /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
657 #[serde(skip_serializing_if = "std::string::String::is_empty")]
658 pub selector: std::string::String,
659
660 /// The address of the API backend.
661 ///
662 /// The scheme is used to determine the backend protocol and security.
663 /// The following schemes are accepted:
664 ///
665 /// SCHEME PROTOCOL SECURITY
666 /// http:// HTTP None
667 /// https:// HTTP TLS
668 /// grpc:// gRPC None
669 /// grpcs:// gRPC TLS
670 ///
671 /// It is recommended to explicitly include a scheme. Leaving out the scheme
672 /// may cause constrasting behaviors across platforms.
673 ///
674 /// If the port is unspecified, the default is:
675 ///
676 /// - 80 for schemes without TLS
677 /// - 443 for schemes with TLS
678 ///
679 /// For HTTP backends, use [protocol][google.api.BackendRule.protocol]
680 /// to specify the protocol version.
681 ///
682 /// [google.api.BackendRule.protocol]: crate::model::BackendRule::protocol
683 #[serde(skip_serializing_if = "std::string::String::is_empty")]
684 pub address: std::string::String,
685
686 /// The number of seconds to wait for a response from a request. The default
687 /// varies based on the request protocol and deployment environment.
688 #[serde(skip_serializing_if = "wkt::internal::is_default")]
689 #[serde_as(as = "wkt::internal::F64")]
690 pub deadline: f64,
691
692 /// Deprecated, do not use.
693 #[serde(skip_serializing_if = "wkt::internal::is_default")]
694 #[serde_as(as = "wkt::internal::F64")]
695 #[deprecated]
696 pub min_deadline: f64,
697
698 /// The number of seconds to wait for the completion of a long running
699 /// operation. The default is no deadline.
700 #[serde(skip_serializing_if = "wkt::internal::is_default")]
701 #[serde_as(as = "wkt::internal::F64")]
702 pub operation_deadline: f64,
703
704 pub path_translation: crate::model::backend_rule::PathTranslation,
705
706 /// The protocol used for sending a request to the backend.
707 /// The supported values are "http/1.1" and "h2".
708 ///
709 /// The default value is inferred from the scheme in the
710 /// [address][google.api.BackendRule.address] field:
711 ///
712 /// SCHEME PROTOCOL
713 /// http:// http/1.1
714 /// https:// http/1.1
715 /// grpc:// h2
716 /// grpcs:// h2
717 ///
718 /// For secure HTTP backends (https://) that support HTTP/2, set this field
719 /// to "h2" for improved performance.
720 ///
721 /// Configuring this field to non-default values is only supported for secure
722 /// HTTP backends. This field will be ignored for all other backends.
723 ///
724 /// See
725 /// <https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml#alpn-protocol-ids>
726 /// for more details on the supported values.
727 ///
728 /// [google.api.BackendRule.address]: crate::model::BackendRule::address
729 #[serde(skip_serializing_if = "std::string::String::is_empty")]
730 pub protocol: std::string::String,
731
732 /// The map between request protocol and the backend address.
733 #[serde(skip_serializing_if = "std::collections::HashMap::is_empty")]
734 pub overrides_by_request_protocol:
735 std::collections::HashMap<std::string::String, crate::model::BackendRule>,
736
737 /// Authentication settings used by the backend.
738 ///
739 /// These are typically used to provide service management functionality to
740 /// a backend served on a publicly-routable URL. The `authentication`
741 /// details should match the authentication behavior used by the backend.
742 ///
743 /// For example, specifying `jwt_audience` implies that the backend expects
744 /// authentication via a JWT.
745 ///
746 /// When authentication is unspecified, the resulting behavior is the same
747 /// as `disable_auth` set to `true`.
748 ///
749 /// Refer to <https://developers.google.com/identity/protocols/OpenIDConnect> for
750 /// JWT ID token.
751 #[serde(flatten, skip_serializing_if = "std::option::Option::is_none")]
752 pub authentication: std::option::Option<crate::model::backend_rule::Authentication>,
753
754 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
755 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
756}
757
758impl BackendRule {
759 pub fn new() -> Self {
760 std::default::Default::default()
761 }
762
763 /// Sets the value of [selector][crate::model::BackendRule::selector].
764 pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
765 self.selector = v.into();
766 self
767 }
768
769 /// Sets the value of [address][crate::model::BackendRule::address].
770 pub fn set_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
771 self.address = v.into();
772 self
773 }
774
775 /// Sets the value of [deadline][crate::model::BackendRule::deadline].
776 pub fn set_deadline<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
777 self.deadline = v.into();
778 self
779 }
780
781 /// Sets the value of [min_deadline][crate::model::BackendRule::min_deadline].
782 #[deprecated]
783 pub fn set_min_deadline<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
784 self.min_deadline = v.into();
785 self
786 }
787
788 /// Sets the value of [operation_deadline][crate::model::BackendRule::operation_deadline].
789 pub fn set_operation_deadline<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
790 self.operation_deadline = v.into();
791 self
792 }
793
794 /// Sets the value of [path_translation][crate::model::BackendRule::path_translation].
795 pub fn set_path_translation<
796 T: std::convert::Into<crate::model::backend_rule::PathTranslation>,
797 >(
798 mut self,
799 v: T,
800 ) -> Self {
801 self.path_translation = v.into();
802 self
803 }
804
805 /// Sets the value of [protocol][crate::model::BackendRule::protocol].
806 pub fn set_protocol<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
807 self.protocol = v.into();
808 self
809 }
810
811 /// Sets the value of [overrides_by_request_protocol][crate::model::BackendRule::overrides_by_request_protocol].
812 pub fn set_overrides_by_request_protocol<T, K, V>(mut self, v: T) -> Self
813 where
814 T: std::iter::IntoIterator<Item = (K, V)>,
815 K: std::convert::Into<std::string::String>,
816 V: std::convert::Into<crate::model::BackendRule>,
817 {
818 use std::iter::Iterator;
819 self.overrides_by_request_protocol =
820 v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
821 self
822 }
823
824 /// Sets the value of [authentication][crate::model::BackendRule::authentication].
825 ///
826 /// Note that all the setters affecting `authentication` are mutually
827 /// exclusive.
828 pub fn set_authentication<
829 T: std::convert::Into<std::option::Option<crate::model::backend_rule::Authentication>>,
830 >(
831 mut self,
832 v: T,
833 ) -> Self {
834 self.authentication = v.into();
835 self
836 }
837
838 /// The value of [authentication][crate::model::BackendRule::authentication]
839 /// if it holds a `JwtAudience`, `None` if the field is not set or
840 /// holds a different branch.
841 pub fn jwt_audience(&self) -> std::option::Option<&std::string::String> {
842 #[allow(unreachable_patterns)]
843 self.authentication.as_ref().and_then(|v| match v {
844 crate::model::backend_rule::Authentication::JwtAudience(v) => {
845 std::option::Option::Some(v)
846 }
847 _ => std::option::Option::None,
848 })
849 }
850
851 /// Sets the value of [authentication][crate::model::BackendRule::authentication]
852 /// to hold a `JwtAudience`.
853 ///
854 /// Note that all the setters affecting `authentication` are
855 /// mutually exclusive.
856 pub fn set_jwt_audience<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
857 self.authentication = std::option::Option::Some(
858 crate::model::backend_rule::Authentication::JwtAudience(v.into()),
859 );
860 self
861 }
862
863 /// The value of [authentication][crate::model::BackendRule::authentication]
864 /// if it holds a `DisableAuth`, `None` if the field is not set or
865 /// holds a different branch.
866 pub fn disable_auth(&self) -> std::option::Option<&bool> {
867 #[allow(unreachable_patterns)]
868 self.authentication.as_ref().and_then(|v| match v {
869 crate::model::backend_rule::Authentication::DisableAuth(v) => {
870 std::option::Option::Some(v)
871 }
872 _ => std::option::Option::None,
873 })
874 }
875
876 /// Sets the value of [authentication][crate::model::BackendRule::authentication]
877 /// to hold a `DisableAuth`.
878 ///
879 /// Note that all the setters affecting `authentication` are
880 /// mutually exclusive.
881 pub fn set_disable_auth<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
882 self.authentication = std::option::Option::Some(
883 crate::model::backend_rule::Authentication::DisableAuth(v.into()),
884 );
885 self
886 }
887}
888
889impl wkt::message::Message for BackendRule {
890 fn typename() -> &'static str {
891 "type.googleapis.com/google.api.BackendRule"
892 }
893}
894
895/// Defines additional types related to [BackendRule].
896pub mod backend_rule {
897 #[allow(unused_imports)]
898 use super::*;
899
900 /// Path Translation specifies how to combine the backend address with the
901 /// request path in order to produce the appropriate forwarding URL for the
902 /// request.
903 ///
904 /// Path Translation is applicable only to HTTP-based backends. Backends which
905 /// do not accept requests over HTTP/HTTPS should leave `path_translation`
906 /// unspecified.
907 ///
908 /// # Working with unknown values
909 ///
910 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
911 /// additional enum variants at any time. Adding new variants is not considered
912 /// a breaking change. Applications should write their code in anticipation of:
913 ///
914 /// - New values appearing in future releases of the client library, **and**
915 /// - New values received dynamically, without application changes.
916 ///
917 /// Please consult the [Working with enums] section in the user guide for some
918 /// guidelines.
919 ///
920 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
921 #[derive(Clone, Debug, PartialEq)]
922 #[non_exhaustive]
923 pub enum PathTranslation {
924 Unspecified,
925 /// Use the backend address as-is, with no modification to the path. If the
926 /// URL pattern contains variables, the variable names and values will be
927 /// appended to the query string. If a query string parameter and a URL
928 /// pattern variable have the same name, this may result in duplicate keys in
929 /// the query string.
930 ///
931 /// # Examples
932 ///
933 /// Given the following operation config:
934 ///
935 /// ```norust
936 /// Method path: /api/company/{cid}/user/{uid}
937 /// Backend address: https://example.cloudfunctions.net/getUser
938 /// ```
939 ///
940 /// Requests to the following request paths will call the backend at the
941 /// translated path:
942 ///
943 /// ```norust
944 /// Request path: /api/company/widgetworks/user/johndoe
945 /// Translated:
946 /// https://example.cloudfunctions.net/getUser?cid=widgetworks&uid=johndoe
947 ///
948 /// Request path: /api/company/widgetworks/user/johndoe?timezone=EST
949 /// Translated:
950 /// https://example.cloudfunctions.net/getUser?timezone=EST&cid=widgetworks&uid=johndoe
951 /// ```
952 ConstantAddress,
953 /// The request path will be appended to the backend address.
954 ///
955 /// # Examples
956 ///
957 /// Given the following operation config:
958 ///
959 /// ```norust
960 /// Method path: /api/company/{cid}/user/{uid}
961 /// Backend address: https://example.appspot.com
962 /// ```
963 ///
964 /// Requests to the following request paths will call the backend at the
965 /// translated path:
966 ///
967 /// ```norust
968 /// Request path: /api/company/widgetworks/user/johndoe
969 /// Translated:
970 /// https://example.appspot.com/api/company/widgetworks/user/johndoe
971 ///
972 /// Request path: /api/company/widgetworks/user/johndoe?timezone=EST
973 /// Translated:
974 /// https://example.appspot.com/api/company/widgetworks/user/johndoe?timezone=EST
975 /// ```
976 AppendPathToAddress,
977 /// If set, the enum was initialized with an unknown value.
978 ///
979 /// Applications can examine the value using [PathTranslation::value] or
980 /// [PathTranslation::name].
981 UnknownValue(path_translation::UnknownValue),
982 }
983
984 #[doc(hidden)]
985 pub mod path_translation {
986 #[allow(unused_imports)]
987 use super::*;
988 #[derive(Clone, Debug, PartialEq)]
989 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
990 }
991
992 impl PathTranslation {
993 /// Gets the enum value.
994 ///
995 /// Returns `None` if the enum contains an unknown value deserialized from
996 /// the string representation of enums.
997 pub fn value(&self) -> std::option::Option<i32> {
998 match self {
999 Self::Unspecified => std::option::Option::Some(0),
1000 Self::ConstantAddress => std::option::Option::Some(1),
1001 Self::AppendPathToAddress => std::option::Option::Some(2),
1002 Self::UnknownValue(u) => u.0.value(),
1003 }
1004 }
1005
1006 /// Gets the enum value as a string.
1007 ///
1008 /// Returns `None` if the enum contains an unknown value deserialized from
1009 /// the integer representation of enums.
1010 pub fn name(&self) -> std::option::Option<&str> {
1011 match self {
1012 Self::Unspecified => std::option::Option::Some("PATH_TRANSLATION_UNSPECIFIED"),
1013 Self::ConstantAddress => std::option::Option::Some("CONSTANT_ADDRESS"),
1014 Self::AppendPathToAddress => std::option::Option::Some("APPEND_PATH_TO_ADDRESS"),
1015 Self::UnknownValue(u) => u.0.name(),
1016 }
1017 }
1018 }
1019
1020 impl std::default::Default for PathTranslation {
1021 fn default() -> Self {
1022 use std::convert::From;
1023 Self::from(0)
1024 }
1025 }
1026
1027 impl std::fmt::Display for PathTranslation {
1028 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1029 wkt::internal::display_enum(f, self.name(), self.value())
1030 }
1031 }
1032
1033 impl std::convert::From<i32> for PathTranslation {
1034 fn from(value: i32) -> Self {
1035 match value {
1036 0 => Self::Unspecified,
1037 1 => Self::ConstantAddress,
1038 2 => Self::AppendPathToAddress,
1039 _ => Self::UnknownValue(path_translation::UnknownValue(
1040 wkt::internal::UnknownEnumValue::Integer(value),
1041 )),
1042 }
1043 }
1044 }
1045
1046 impl std::convert::From<&str> for PathTranslation {
1047 fn from(value: &str) -> Self {
1048 use std::string::ToString;
1049 match value {
1050 "PATH_TRANSLATION_UNSPECIFIED" => Self::Unspecified,
1051 "CONSTANT_ADDRESS" => Self::ConstantAddress,
1052 "APPEND_PATH_TO_ADDRESS" => Self::AppendPathToAddress,
1053 _ => Self::UnknownValue(path_translation::UnknownValue(
1054 wkt::internal::UnknownEnumValue::String(value.to_string()),
1055 )),
1056 }
1057 }
1058 }
1059
1060 impl serde::ser::Serialize for PathTranslation {
1061 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1062 where
1063 S: serde::Serializer,
1064 {
1065 match self {
1066 Self::Unspecified => serializer.serialize_i32(0),
1067 Self::ConstantAddress => serializer.serialize_i32(1),
1068 Self::AppendPathToAddress => serializer.serialize_i32(2),
1069 Self::UnknownValue(u) => u.0.serialize(serializer),
1070 }
1071 }
1072 }
1073
1074 impl<'de> serde::de::Deserialize<'de> for PathTranslation {
1075 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1076 where
1077 D: serde::Deserializer<'de>,
1078 {
1079 deserializer.deserialize_any(wkt::internal::EnumVisitor::<PathTranslation>::new(
1080 ".google.api.BackendRule.PathTranslation",
1081 ))
1082 }
1083 }
1084
1085 /// Authentication settings used by the backend.
1086 ///
1087 /// These are typically used to provide service management functionality to
1088 /// a backend served on a publicly-routable URL. The `authentication`
1089 /// details should match the authentication behavior used by the backend.
1090 ///
1091 /// For example, specifying `jwt_audience` implies that the backend expects
1092 /// authentication via a JWT.
1093 ///
1094 /// When authentication is unspecified, the resulting behavior is the same
1095 /// as `disable_auth` set to `true`.
1096 ///
1097 /// Refer to <https://developers.google.com/identity/protocols/OpenIDConnect> for
1098 /// JWT ID token.
1099 #[serde_with::serde_as]
1100 #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
1101 #[serde(rename_all = "camelCase")]
1102 #[non_exhaustive]
1103 pub enum Authentication {
1104 /// The JWT audience is used when generating a JWT ID token for the backend.
1105 /// This ID token will be added in the HTTP "authorization" header, and sent
1106 /// to the backend.
1107 JwtAudience(std::string::String),
1108 /// When disable_auth is true, a JWT ID token won't be generated and the
1109 /// original "Authorization" HTTP header will be preserved. If the header is
1110 /// used to carry the original token and is expected by the backend, this
1111 /// field must be set to true to preserve the header.
1112 DisableAuth(bool),
1113 }
1114}
1115
1116/// Billing related configuration of the service.
1117///
1118/// The following example shows how to configure monitored resources and metrics
1119/// for billing, `consumer_destinations` is the only supported destination and
1120/// the monitored resources need at least one label key
1121/// `cloud.googleapis.com/location` to indicate the location of the billing
1122/// usage, using different monitored resources between monitoring and billing is
1123/// recommended so they can be evolved independently:
1124///
1125/// ```norust
1126/// monitored_resources:
1127/// - type: library.googleapis.com/billing_branch
1128/// labels:
1129/// - key: cloud.googleapis.com/location
1130/// description: |
1131/// Predefined label to support billing location restriction.
1132/// - key: city
1133/// description: |
1134/// Custom label to define the city where the library branch is located
1135/// in.
1136/// - key: name
1137/// description: Custom label to define the name of the library branch.
1138/// metrics:
1139/// - name: library.googleapis.com/book/borrowed_count
1140/// metric_kind: DELTA
1141/// value_type: INT64
1142/// unit: "1"
1143/// billing:
1144/// consumer_destinations:
1145/// - monitored_resource: library.googleapis.com/billing_branch
1146/// metrics:
1147/// - library.googleapis.com/book/borrowed_count
1148/// ```
1149#[serde_with::serde_as]
1150#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
1151#[serde(default, rename_all = "camelCase")]
1152#[non_exhaustive]
1153pub struct Billing {
1154 /// Billing configurations for sending metrics to the consumer project.
1155 /// There can be multiple consumer destinations per service, each one must have
1156 /// a different monitored resource type. A metric can be used in at most
1157 /// one consumer destination.
1158 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
1159 pub consumer_destinations: std::vec::Vec<crate::model::billing::BillingDestination>,
1160
1161 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1162 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1163}
1164
1165impl Billing {
1166 pub fn new() -> Self {
1167 std::default::Default::default()
1168 }
1169
1170 /// Sets the value of [consumer_destinations][crate::model::Billing::consumer_destinations].
1171 pub fn set_consumer_destinations<T, V>(mut self, v: T) -> Self
1172 where
1173 T: std::iter::IntoIterator<Item = V>,
1174 V: std::convert::Into<crate::model::billing::BillingDestination>,
1175 {
1176 use std::iter::Iterator;
1177 self.consumer_destinations = v.into_iter().map(|i| i.into()).collect();
1178 self
1179 }
1180}
1181
1182impl wkt::message::Message for Billing {
1183 fn typename() -> &'static str {
1184 "type.googleapis.com/google.api.Billing"
1185 }
1186}
1187
1188/// Defines additional types related to [Billing].
1189pub mod billing {
1190 #[allow(unused_imports)]
1191 use super::*;
1192
1193 /// Configuration of a specific billing destination (Currently only support
1194 /// bill against consumer project).
1195 #[serde_with::serde_as]
1196 #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
1197 #[serde(default, rename_all = "camelCase")]
1198 #[non_exhaustive]
1199 pub struct BillingDestination {
1200 /// The monitored resource type. The type must be defined in
1201 /// [Service.monitored_resources][google.api.Service.monitored_resources]
1202 /// section.
1203 ///
1204 /// [google.api.Service.monitored_resources]: crate::model::Service::monitored_resources
1205 #[serde(skip_serializing_if = "std::string::String::is_empty")]
1206 pub monitored_resource: std::string::String,
1207
1208 /// Names of the metrics to report to this billing destination.
1209 /// Each name must be defined in
1210 /// [Service.metrics][google.api.Service.metrics] section.
1211 ///
1212 /// [google.api.Service.metrics]: crate::model::Service::metrics
1213 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
1214 pub metrics: std::vec::Vec<std::string::String>,
1215
1216 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1217 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1218 }
1219
1220 impl BillingDestination {
1221 pub fn new() -> Self {
1222 std::default::Default::default()
1223 }
1224
1225 /// Sets the value of [monitored_resource][crate::model::billing::BillingDestination::monitored_resource].
1226 pub fn set_monitored_resource<T: std::convert::Into<std::string::String>>(
1227 mut self,
1228 v: T,
1229 ) -> Self {
1230 self.monitored_resource = v.into();
1231 self
1232 }
1233
1234 /// Sets the value of [metrics][crate::model::billing::BillingDestination::metrics].
1235 pub fn set_metrics<T, V>(mut self, v: T) -> Self
1236 where
1237 T: std::iter::IntoIterator<Item = V>,
1238 V: std::convert::Into<std::string::String>,
1239 {
1240 use std::iter::Iterator;
1241 self.metrics = v.into_iter().map(|i| i.into()).collect();
1242 self
1243 }
1244 }
1245
1246 impl wkt::message::Message for BillingDestination {
1247 fn typename() -> &'static str {
1248 "type.googleapis.com/google.api.Billing.BillingDestination"
1249 }
1250 }
1251}
1252
1253/// Required information for every language.
1254#[serde_with::serde_as]
1255#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
1256#[serde(default, rename_all = "camelCase")]
1257#[non_exhaustive]
1258pub struct CommonLanguageSettings {
1259 /// Link to automatically generated reference documentation. Example:
1260 /// <https://cloud.google.com/nodejs/docs/reference/asset/latest>
1261 #[serde(skip_serializing_if = "std::string::String::is_empty")]
1262 #[deprecated]
1263 pub reference_docs_uri: std::string::String,
1264
1265 /// The destination where API teams want this client library to be published.
1266 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
1267 pub destinations: std::vec::Vec<crate::model::ClientLibraryDestination>,
1268
1269 /// Configuration for which RPCs should be generated in the GAPIC client.
1270 #[serde(skip_serializing_if = "std::option::Option::is_none")]
1271 pub selective_gapic_generation: std::option::Option<crate::model::SelectiveGapicGeneration>,
1272
1273 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1274 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1275}
1276
1277impl CommonLanguageSettings {
1278 pub fn new() -> Self {
1279 std::default::Default::default()
1280 }
1281
1282 /// Sets the value of [reference_docs_uri][crate::model::CommonLanguageSettings::reference_docs_uri].
1283 #[deprecated]
1284 pub fn set_reference_docs_uri<T: std::convert::Into<std::string::String>>(
1285 mut self,
1286 v: T,
1287 ) -> Self {
1288 self.reference_docs_uri = v.into();
1289 self
1290 }
1291
1292 /// Sets the value of [destinations][crate::model::CommonLanguageSettings::destinations].
1293 pub fn set_destinations<T, V>(mut self, v: T) -> Self
1294 where
1295 T: std::iter::IntoIterator<Item = V>,
1296 V: std::convert::Into<crate::model::ClientLibraryDestination>,
1297 {
1298 use std::iter::Iterator;
1299 self.destinations = v.into_iter().map(|i| i.into()).collect();
1300 self
1301 }
1302
1303 /// Sets the value of [selective_gapic_generation][crate::model::CommonLanguageSettings::selective_gapic_generation].
1304 pub fn set_selective_gapic_generation<
1305 T: std::convert::Into<std::option::Option<crate::model::SelectiveGapicGeneration>>,
1306 >(
1307 mut self,
1308 v: T,
1309 ) -> Self {
1310 self.selective_gapic_generation = v.into();
1311 self
1312 }
1313}
1314
1315impl wkt::message::Message for CommonLanguageSettings {
1316 fn typename() -> &'static str {
1317 "type.googleapis.com/google.api.CommonLanguageSettings"
1318 }
1319}
1320
1321/// Details about how and where to publish client libraries.
1322#[serde_with::serde_as]
1323#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
1324#[serde(default, rename_all = "camelCase")]
1325#[non_exhaustive]
1326pub struct ClientLibrarySettings {
1327 /// Version of the API to apply these settings to. This is the full protobuf
1328 /// package for the API, ending in the version element.
1329 /// Examples: "google.cloud.speech.v1" and "google.spanner.admin.database.v1".
1330 #[serde(skip_serializing_if = "std::string::String::is_empty")]
1331 pub version: std::string::String,
1332
1333 /// Launch stage of this version of the API.
1334 pub launch_stage: crate::model::LaunchStage,
1335
1336 /// When using transport=rest, the client request will encode enums as
1337 /// numbers rather than strings.
1338 #[serde(skip_serializing_if = "wkt::internal::is_default")]
1339 pub rest_numeric_enums: bool,
1340
1341 /// Settings for legacy Java features, supported in the Service YAML.
1342 #[serde(skip_serializing_if = "std::option::Option::is_none")]
1343 pub java_settings: std::option::Option<crate::model::JavaSettings>,
1344
1345 /// Settings for C++ client libraries.
1346 #[serde(skip_serializing_if = "std::option::Option::is_none")]
1347 pub cpp_settings: std::option::Option<crate::model::CppSettings>,
1348
1349 /// Settings for PHP client libraries.
1350 #[serde(skip_serializing_if = "std::option::Option::is_none")]
1351 pub php_settings: std::option::Option<crate::model::PhpSettings>,
1352
1353 /// Settings for Python client libraries.
1354 #[serde(skip_serializing_if = "std::option::Option::is_none")]
1355 pub python_settings: std::option::Option<crate::model::PythonSettings>,
1356
1357 /// Settings for Node client libraries.
1358 #[serde(skip_serializing_if = "std::option::Option::is_none")]
1359 pub node_settings: std::option::Option<crate::model::NodeSettings>,
1360
1361 /// Settings for .NET client libraries.
1362 #[serde(skip_serializing_if = "std::option::Option::is_none")]
1363 pub dotnet_settings: std::option::Option<crate::model::DotnetSettings>,
1364
1365 /// Settings for Ruby client libraries.
1366 #[serde(skip_serializing_if = "std::option::Option::is_none")]
1367 pub ruby_settings: std::option::Option<crate::model::RubySettings>,
1368
1369 /// Settings for Go client libraries.
1370 #[serde(skip_serializing_if = "std::option::Option::is_none")]
1371 pub go_settings: std::option::Option<crate::model::GoSettings>,
1372
1373 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1374 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1375}
1376
1377impl ClientLibrarySettings {
1378 pub fn new() -> Self {
1379 std::default::Default::default()
1380 }
1381
1382 /// Sets the value of [version][crate::model::ClientLibrarySettings::version].
1383 pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1384 self.version = v.into();
1385 self
1386 }
1387
1388 /// Sets the value of [launch_stage][crate::model::ClientLibrarySettings::launch_stage].
1389 pub fn set_launch_stage<T: std::convert::Into<crate::model::LaunchStage>>(
1390 mut self,
1391 v: T,
1392 ) -> Self {
1393 self.launch_stage = v.into();
1394 self
1395 }
1396
1397 /// Sets the value of [rest_numeric_enums][crate::model::ClientLibrarySettings::rest_numeric_enums].
1398 pub fn set_rest_numeric_enums<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1399 self.rest_numeric_enums = v.into();
1400 self
1401 }
1402
1403 /// Sets the value of [java_settings][crate::model::ClientLibrarySettings::java_settings].
1404 pub fn set_java_settings<
1405 T: std::convert::Into<std::option::Option<crate::model::JavaSettings>>,
1406 >(
1407 mut self,
1408 v: T,
1409 ) -> Self {
1410 self.java_settings = v.into();
1411 self
1412 }
1413
1414 /// Sets the value of [cpp_settings][crate::model::ClientLibrarySettings::cpp_settings].
1415 pub fn set_cpp_settings<
1416 T: std::convert::Into<std::option::Option<crate::model::CppSettings>>,
1417 >(
1418 mut self,
1419 v: T,
1420 ) -> Self {
1421 self.cpp_settings = v.into();
1422 self
1423 }
1424
1425 /// Sets the value of [php_settings][crate::model::ClientLibrarySettings::php_settings].
1426 pub fn set_php_settings<
1427 T: std::convert::Into<std::option::Option<crate::model::PhpSettings>>,
1428 >(
1429 mut self,
1430 v: T,
1431 ) -> Self {
1432 self.php_settings = v.into();
1433 self
1434 }
1435
1436 /// Sets the value of [python_settings][crate::model::ClientLibrarySettings::python_settings].
1437 pub fn set_python_settings<
1438 T: std::convert::Into<std::option::Option<crate::model::PythonSettings>>,
1439 >(
1440 mut self,
1441 v: T,
1442 ) -> Self {
1443 self.python_settings = v.into();
1444 self
1445 }
1446
1447 /// Sets the value of [node_settings][crate::model::ClientLibrarySettings::node_settings].
1448 pub fn set_node_settings<
1449 T: std::convert::Into<std::option::Option<crate::model::NodeSettings>>,
1450 >(
1451 mut self,
1452 v: T,
1453 ) -> Self {
1454 self.node_settings = v.into();
1455 self
1456 }
1457
1458 /// Sets the value of [dotnet_settings][crate::model::ClientLibrarySettings::dotnet_settings].
1459 pub fn set_dotnet_settings<
1460 T: std::convert::Into<std::option::Option<crate::model::DotnetSettings>>,
1461 >(
1462 mut self,
1463 v: T,
1464 ) -> Self {
1465 self.dotnet_settings = v.into();
1466 self
1467 }
1468
1469 /// Sets the value of [ruby_settings][crate::model::ClientLibrarySettings::ruby_settings].
1470 pub fn set_ruby_settings<
1471 T: std::convert::Into<std::option::Option<crate::model::RubySettings>>,
1472 >(
1473 mut self,
1474 v: T,
1475 ) -> Self {
1476 self.ruby_settings = v.into();
1477 self
1478 }
1479
1480 /// Sets the value of [go_settings][crate::model::ClientLibrarySettings::go_settings].
1481 pub fn set_go_settings<T: std::convert::Into<std::option::Option<crate::model::GoSettings>>>(
1482 mut self,
1483 v: T,
1484 ) -> Self {
1485 self.go_settings = v.into();
1486 self
1487 }
1488}
1489
1490impl wkt::message::Message for ClientLibrarySettings {
1491 fn typename() -> &'static str {
1492 "type.googleapis.com/google.api.ClientLibrarySettings"
1493 }
1494}
1495
1496/// This message configures the settings for publishing [Google Cloud Client
1497/// libraries](https://cloud.google.com/apis/docs/cloud-client-libraries)
1498/// generated from the service config.
1499#[serde_with::serde_as]
1500#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
1501#[serde(default, rename_all = "camelCase")]
1502#[non_exhaustive]
1503pub struct Publishing {
1504 /// A list of API method settings, e.g. the behavior for methods that use the
1505 /// long-running operation pattern.
1506 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
1507 pub method_settings: std::vec::Vec<crate::model::MethodSettings>,
1508
1509 /// Link to a *public* URI where users can report issues. Example:
1510 /// <https://issuetracker.google.com/issues/new?component=190865&template=1161103>
1511 #[serde(skip_serializing_if = "std::string::String::is_empty")]
1512 pub new_issue_uri: std::string::String,
1513
1514 /// Link to product home page. Example:
1515 /// <https://cloud.google.com/asset-inventory/docs/overview>
1516 #[serde(skip_serializing_if = "std::string::String::is_empty")]
1517 pub documentation_uri: std::string::String,
1518
1519 /// Used as a tracking tag when collecting data about the APIs developer
1520 /// relations artifacts like docs, packages delivered to package managers,
1521 /// etc. Example: "speech".
1522 #[serde(skip_serializing_if = "std::string::String::is_empty")]
1523 pub api_short_name: std::string::String,
1524
1525 /// GitHub label to apply to issues and pull requests opened for this API.
1526 #[serde(skip_serializing_if = "std::string::String::is_empty")]
1527 pub github_label: std::string::String,
1528
1529 /// GitHub teams to be added to CODEOWNERS in the directory in GitHub
1530 /// containing source code for the client libraries for this API.
1531 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
1532 pub codeowner_github_teams: std::vec::Vec<std::string::String>,
1533
1534 /// A prefix used in sample code when demarking regions to be included in
1535 /// documentation.
1536 #[serde(skip_serializing_if = "std::string::String::is_empty")]
1537 pub doc_tag_prefix: std::string::String,
1538
1539 /// For whom the client library is being published.
1540 pub organization: crate::model::ClientLibraryOrganization,
1541
1542 /// Client library settings. If the same version string appears multiple
1543 /// times in this list, then the last one wins. Settings from earlier
1544 /// settings with the same version string are discarded.
1545 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
1546 pub library_settings: std::vec::Vec<crate::model::ClientLibrarySettings>,
1547
1548 /// Optional link to proto reference documentation. Example:
1549 /// <https://cloud.google.com/pubsub/lite/docs/reference/rpc>
1550 #[serde(skip_serializing_if = "std::string::String::is_empty")]
1551 pub proto_reference_documentation_uri: std::string::String,
1552
1553 /// Optional link to REST reference documentation. Example:
1554 /// <https://cloud.google.com/pubsub/lite/docs/reference/rest>
1555 #[serde(skip_serializing_if = "std::string::String::is_empty")]
1556 pub rest_reference_documentation_uri: std::string::String,
1557
1558 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1559 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1560}
1561
1562impl Publishing {
1563 pub fn new() -> Self {
1564 std::default::Default::default()
1565 }
1566
1567 /// Sets the value of [method_settings][crate::model::Publishing::method_settings].
1568 pub fn set_method_settings<T, V>(mut self, v: T) -> Self
1569 where
1570 T: std::iter::IntoIterator<Item = V>,
1571 V: std::convert::Into<crate::model::MethodSettings>,
1572 {
1573 use std::iter::Iterator;
1574 self.method_settings = v.into_iter().map(|i| i.into()).collect();
1575 self
1576 }
1577
1578 /// Sets the value of [new_issue_uri][crate::model::Publishing::new_issue_uri].
1579 pub fn set_new_issue_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1580 self.new_issue_uri = v.into();
1581 self
1582 }
1583
1584 /// Sets the value of [documentation_uri][crate::model::Publishing::documentation_uri].
1585 pub fn set_documentation_uri<T: std::convert::Into<std::string::String>>(
1586 mut self,
1587 v: T,
1588 ) -> Self {
1589 self.documentation_uri = v.into();
1590 self
1591 }
1592
1593 /// Sets the value of [api_short_name][crate::model::Publishing::api_short_name].
1594 pub fn set_api_short_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1595 self.api_short_name = v.into();
1596 self
1597 }
1598
1599 /// Sets the value of [github_label][crate::model::Publishing::github_label].
1600 pub fn set_github_label<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1601 self.github_label = v.into();
1602 self
1603 }
1604
1605 /// Sets the value of [codeowner_github_teams][crate::model::Publishing::codeowner_github_teams].
1606 pub fn set_codeowner_github_teams<T, V>(mut self, v: T) -> Self
1607 where
1608 T: std::iter::IntoIterator<Item = V>,
1609 V: std::convert::Into<std::string::String>,
1610 {
1611 use std::iter::Iterator;
1612 self.codeowner_github_teams = v.into_iter().map(|i| i.into()).collect();
1613 self
1614 }
1615
1616 /// Sets the value of [doc_tag_prefix][crate::model::Publishing::doc_tag_prefix].
1617 pub fn set_doc_tag_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1618 self.doc_tag_prefix = v.into();
1619 self
1620 }
1621
1622 /// Sets the value of [organization][crate::model::Publishing::organization].
1623 pub fn set_organization<T: std::convert::Into<crate::model::ClientLibraryOrganization>>(
1624 mut self,
1625 v: T,
1626 ) -> Self {
1627 self.organization = v.into();
1628 self
1629 }
1630
1631 /// Sets the value of [library_settings][crate::model::Publishing::library_settings].
1632 pub fn set_library_settings<T, V>(mut self, v: T) -> Self
1633 where
1634 T: std::iter::IntoIterator<Item = V>,
1635 V: std::convert::Into<crate::model::ClientLibrarySettings>,
1636 {
1637 use std::iter::Iterator;
1638 self.library_settings = v.into_iter().map(|i| i.into()).collect();
1639 self
1640 }
1641
1642 /// Sets the value of [proto_reference_documentation_uri][crate::model::Publishing::proto_reference_documentation_uri].
1643 pub fn set_proto_reference_documentation_uri<T: std::convert::Into<std::string::String>>(
1644 mut self,
1645 v: T,
1646 ) -> Self {
1647 self.proto_reference_documentation_uri = v.into();
1648 self
1649 }
1650
1651 /// Sets the value of [rest_reference_documentation_uri][crate::model::Publishing::rest_reference_documentation_uri].
1652 pub fn set_rest_reference_documentation_uri<T: std::convert::Into<std::string::String>>(
1653 mut self,
1654 v: T,
1655 ) -> Self {
1656 self.rest_reference_documentation_uri = v.into();
1657 self
1658 }
1659}
1660
1661impl wkt::message::Message for Publishing {
1662 fn typename() -> &'static str {
1663 "type.googleapis.com/google.api.Publishing"
1664 }
1665}
1666
1667/// Settings for Java client libraries.
1668#[serde_with::serde_as]
1669#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
1670#[serde(default, rename_all = "camelCase")]
1671#[non_exhaustive]
1672pub struct JavaSettings {
1673 /// The package name to use in Java. Clobbers the java_package option
1674 /// set in the protobuf. This should be used **only** by APIs
1675 /// who have already set the language_settings.java.package_name" field
1676 /// in gapic.yaml. API teams should use the protobuf java_package option
1677 /// where possible.
1678 ///
1679 /// Example of a YAML configuration::
1680 ///
1681 /// publishing:
1682 /// java_settings:
1683 /// library_package: com.google.cloud.pubsub.v1
1684 #[serde(skip_serializing_if = "std::string::String::is_empty")]
1685 pub library_package: std::string::String,
1686
1687 /// Configure the Java class name to use instead of the service's for its
1688 /// corresponding generated GAPIC client. Keys are fully-qualified
1689 /// service names as they appear in the protobuf (including the full
1690 /// the language_settings.java.interface_names" field in gapic.yaml. API
1691 /// teams should otherwise use the service name as it appears in the
1692 /// protobuf.
1693 ///
1694 /// Example of a YAML configuration::
1695 ///
1696 /// publishing:
1697 /// java_settings:
1698 /// service_class_names:
1699 /// - google.pubsub.v1.Publisher: TopicAdmin
1700 /// - google.pubsub.v1.Subscriber: SubscriptionAdmin
1701 #[serde(skip_serializing_if = "std::collections::HashMap::is_empty")]
1702 pub service_class_names: std::collections::HashMap<std::string::String, std::string::String>,
1703
1704 /// Some settings.
1705 #[serde(skip_serializing_if = "std::option::Option::is_none")]
1706 pub common: std::option::Option<crate::model::CommonLanguageSettings>,
1707
1708 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1709 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1710}
1711
1712impl JavaSettings {
1713 pub fn new() -> Self {
1714 std::default::Default::default()
1715 }
1716
1717 /// Sets the value of [library_package][crate::model::JavaSettings::library_package].
1718 pub fn set_library_package<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1719 self.library_package = v.into();
1720 self
1721 }
1722
1723 /// Sets the value of [service_class_names][crate::model::JavaSettings::service_class_names].
1724 pub fn set_service_class_names<T, K, V>(mut self, v: T) -> Self
1725 where
1726 T: std::iter::IntoIterator<Item = (K, V)>,
1727 K: std::convert::Into<std::string::String>,
1728 V: std::convert::Into<std::string::String>,
1729 {
1730 use std::iter::Iterator;
1731 self.service_class_names = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1732 self
1733 }
1734
1735 /// Sets the value of [common][crate::model::JavaSettings::common].
1736 pub fn set_common<
1737 T: std::convert::Into<std::option::Option<crate::model::CommonLanguageSettings>>,
1738 >(
1739 mut self,
1740 v: T,
1741 ) -> Self {
1742 self.common = v.into();
1743 self
1744 }
1745}
1746
1747impl wkt::message::Message for JavaSettings {
1748 fn typename() -> &'static str {
1749 "type.googleapis.com/google.api.JavaSettings"
1750 }
1751}
1752
1753/// Settings for C++ client libraries.
1754#[serde_with::serde_as]
1755#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
1756#[serde(default, rename_all = "camelCase")]
1757#[non_exhaustive]
1758pub struct CppSettings {
1759 /// Some settings.
1760 #[serde(skip_serializing_if = "std::option::Option::is_none")]
1761 pub common: std::option::Option<crate::model::CommonLanguageSettings>,
1762
1763 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1764 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1765}
1766
1767impl CppSettings {
1768 pub fn new() -> Self {
1769 std::default::Default::default()
1770 }
1771
1772 /// Sets the value of [common][crate::model::CppSettings::common].
1773 pub fn set_common<
1774 T: std::convert::Into<std::option::Option<crate::model::CommonLanguageSettings>>,
1775 >(
1776 mut self,
1777 v: T,
1778 ) -> Self {
1779 self.common = v.into();
1780 self
1781 }
1782}
1783
1784impl wkt::message::Message for CppSettings {
1785 fn typename() -> &'static str {
1786 "type.googleapis.com/google.api.CppSettings"
1787 }
1788}
1789
1790/// Settings for Php client libraries.
1791#[serde_with::serde_as]
1792#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
1793#[serde(default, rename_all = "camelCase")]
1794#[non_exhaustive]
1795pub struct PhpSettings {
1796 /// Some settings.
1797 #[serde(skip_serializing_if = "std::option::Option::is_none")]
1798 pub common: std::option::Option<crate::model::CommonLanguageSettings>,
1799
1800 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1801 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1802}
1803
1804impl PhpSettings {
1805 pub fn new() -> Self {
1806 std::default::Default::default()
1807 }
1808
1809 /// Sets the value of [common][crate::model::PhpSettings::common].
1810 pub fn set_common<
1811 T: std::convert::Into<std::option::Option<crate::model::CommonLanguageSettings>>,
1812 >(
1813 mut self,
1814 v: T,
1815 ) -> Self {
1816 self.common = v.into();
1817 self
1818 }
1819}
1820
1821impl wkt::message::Message for PhpSettings {
1822 fn typename() -> &'static str {
1823 "type.googleapis.com/google.api.PhpSettings"
1824 }
1825}
1826
1827/// Settings for Python client libraries.
1828#[serde_with::serde_as]
1829#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
1830#[serde(default, rename_all = "camelCase")]
1831#[non_exhaustive]
1832pub struct PythonSettings {
1833 /// Some settings.
1834 #[serde(skip_serializing_if = "std::option::Option::is_none")]
1835 pub common: std::option::Option<crate::model::CommonLanguageSettings>,
1836
1837 /// Experimental features to be included during client library generation.
1838 #[serde(skip_serializing_if = "std::option::Option::is_none")]
1839 pub experimental_features:
1840 std::option::Option<crate::model::python_settings::ExperimentalFeatures>,
1841
1842 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1843 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1844}
1845
1846impl PythonSettings {
1847 pub fn new() -> Self {
1848 std::default::Default::default()
1849 }
1850
1851 /// Sets the value of [common][crate::model::PythonSettings::common].
1852 pub fn set_common<
1853 T: std::convert::Into<std::option::Option<crate::model::CommonLanguageSettings>>,
1854 >(
1855 mut self,
1856 v: T,
1857 ) -> Self {
1858 self.common = v.into();
1859 self
1860 }
1861
1862 /// Sets the value of [experimental_features][crate::model::PythonSettings::experimental_features].
1863 pub fn set_experimental_features<
1864 T: std::convert::Into<
1865 std::option::Option<crate::model::python_settings::ExperimentalFeatures>,
1866 >,
1867 >(
1868 mut self,
1869 v: T,
1870 ) -> Self {
1871 self.experimental_features = v.into();
1872 self
1873 }
1874}
1875
1876impl wkt::message::Message for PythonSettings {
1877 fn typename() -> &'static str {
1878 "type.googleapis.com/google.api.PythonSettings"
1879 }
1880}
1881
1882/// Defines additional types related to [PythonSettings].
1883pub mod python_settings {
1884 #[allow(unused_imports)]
1885 use super::*;
1886
1887 /// Experimental features to be included during client library generation.
1888 /// These fields will be deprecated once the feature graduates and is enabled
1889 /// by default.
1890 #[serde_with::serde_as]
1891 #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
1892 #[serde(default, rename_all = "camelCase")]
1893 #[non_exhaustive]
1894 pub struct ExperimentalFeatures {
1895 /// Enables generation of asynchronous REST clients if `rest` transport is
1896 /// enabled. By default, asynchronous REST clients will not be generated.
1897 /// This feature will be enabled by default 1 month after launching the
1898 /// feature in preview packages.
1899 #[serde(skip_serializing_if = "wkt::internal::is_default")]
1900 pub rest_async_io_enabled: bool,
1901
1902 /// Enables generation of protobuf code using new types that are more
1903 /// Pythonic which are included in `protobuf>=5.29.x`. This feature will be
1904 /// enabled by default 1 month after launching the feature in preview
1905 /// packages.
1906 #[serde(skip_serializing_if = "wkt::internal::is_default")]
1907 pub protobuf_pythonic_types_enabled: bool,
1908
1909 /// Disables generation of an unversioned Python package for this client
1910 /// library. This means that the module names will need to be versioned in
1911 /// import statements. For example `import google.cloud.library_v2` instead
1912 /// of `import google.cloud.library`.
1913 #[serde(skip_serializing_if = "wkt::internal::is_default")]
1914 pub unversioned_package_disabled: bool,
1915
1916 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1917 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1918 }
1919
1920 impl ExperimentalFeatures {
1921 pub fn new() -> Self {
1922 std::default::Default::default()
1923 }
1924
1925 /// Sets the value of [rest_async_io_enabled][crate::model::python_settings::ExperimentalFeatures::rest_async_io_enabled].
1926 pub fn set_rest_async_io_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1927 self.rest_async_io_enabled = v.into();
1928 self
1929 }
1930
1931 /// Sets the value of [protobuf_pythonic_types_enabled][crate::model::python_settings::ExperimentalFeatures::protobuf_pythonic_types_enabled].
1932 pub fn set_protobuf_pythonic_types_enabled<T: std::convert::Into<bool>>(
1933 mut self,
1934 v: T,
1935 ) -> Self {
1936 self.protobuf_pythonic_types_enabled = v.into();
1937 self
1938 }
1939
1940 /// Sets the value of [unversioned_package_disabled][crate::model::python_settings::ExperimentalFeatures::unversioned_package_disabled].
1941 pub fn set_unversioned_package_disabled<T: std::convert::Into<bool>>(
1942 mut self,
1943 v: T,
1944 ) -> Self {
1945 self.unversioned_package_disabled = v.into();
1946 self
1947 }
1948 }
1949
1950 impl wkt::message::Message for ExperimentalFeatures {
1951 fn typename() -> &'static str {
1952 "type.googleapis.com/google.api.PythonSettings.ExperimentalFeatures"
1953 }
1954 }
1955}
1956
1957/// Settings for Node client libraries.
1958#[serde_with::serde_as]
1959#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
1960#[serde(default, rename_all = "camelCase")]
1961#[non_exhaustive]
1962pub struct NodeSettings {
1963 /// Some settings.
1964 #[serde(skip_serializing_if = "std::option::Option::is_none")]
1965 pub common: std::option::Option<crate::model::CommonLanguageSettings>,
1966
1967 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1968 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1969}
1970
1971impl NodeSettings {
1972 pub fn new() -> Self {
1973 std::default::Default::default()
1974 }
1975
1976 /// Sets the value of [common][crate::model::NodeSettings::common].
1977 pub fn set_common<
1978 T: std::convert::Into<std::option::Option<crate::model::CommonLanguageSettings>>,
1979 >(
1980 mut self,
1981 v: T,
1982 ) -> Self {
1983 self.common = v.into();
1984 self
1985 }
1986}
1987
1988impl wkt::message::Message for NodeSettings {
1989 fn typename() -> &'static str {
1990 "type.googleapis.com/google.api.NodeSettings"
1991 }
1992}
1993
1994/// Settings for Dotnet client libraries.
1995#[serde_with::serde_as]
1996#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
1997#[serde(default, rename_all = "camelCase")]
1998#[non_exhaustive]
1999pub struct DotnetSettings {
2000 /// Some settings.
2001 #[serde(skip_serializing_if = "std::option::Option::is_none")]
2002 pub common: std::option::Option<crate::model::CommonLanguageSettings>,
2003
2004 /// Map from original service names to renamed versions.
2005 /// This is used when the default generated types
2006 /// would cause a naming conflict. (Neither name is
2007 /// fully-qualified.)
2008 /// Example: Subscriber to SubscriberServiceApi.
2009 #[serde(skip_serializing_if = "std::collections::HashMap::is_empty")]
2010 pub renamed_services: std::collections::HashMap<std::string::String, std::string::String>,
2011
2012 /// Map from full resource types to the effective short name
2013 /// for the resource. This is used when otherwise resource
2014 /// named from different services would cause naming collisions.
2015 /// Example entry:
2016 /// "datalabeling.googleapis.com/Dataset": "DataLabelingDataset"
2017 #[serde(skip_serializing_if = "std::collections::HashMap::is_empty")]
2018 pub renamed_resources: std::collections::HashMap<std::string::String, std::string::String>,
2019
2020 /// List of full resource types to ignore during generation.
2021 /// This is typically used for API-specific Location resources,
2022 /// which should be handled by the generator as if they were actually
2023 /// the common Location resources.
2024 /// Example entry: "documentai.googleapis.com/Location"
2025 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
2026 pub ignored_resources: std::vec::Vec<std::string::String>,
2027
2028 /// Namespaces which must be aliased in snippets due to
2029 /// a known (but non-generator-predictable) naming collision
2030 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
2031 pub forced_namespace_aliases: std::vec::Vec<std::string::String>,
2032
2033 /// Method signatures (in the form "service.method(signature)")
2034 /// which are provided separately, so shouldn't be generated.
2035 /// Snippets *calling* these methods are still generated, however.
2036 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
2037 pub handwritten_signatures: std::vec::Vec<std::string::String>,
2038
2039 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
2040 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2041}
2042
2043impl DotnetSettings {
2044 pub fn new() -> Self {
2045 std::default::Default::default()
2046 }
2047
2048 /// Sets the value of [common][crate::model::DotnetSettings::common].
2049 pub fn set_common<
2050 T: std::convert::Into<std::option::Option<crate::model::CommonLanguageSettings>>,
2051 >(
2052 mut self,
2053 v: T,
2054 ) -> Self {
2055 self.common = v.into();
2056 self
2057 }
2058
2059 /// Sets the value of [renamed_services][crate::model::DotnetSettings::renamed_services].
2060 pub fn set_renamed_services<T, K, V>(mut self, v: T) -> Self
2061 where
2062 T: std::iter::IntoIterator<Item = (K, V)>,
2063 K: std::convert::Into<std::string::String>,
2064 V: std::convert::Into<std::string::String>,
2065 {
2066 use std::iter::Iterator;
2067 self.renamed_services = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2068 self
2069 }
2070
2071 /// Sets the value of [renamed_resources][crate::model::DotnetSettings::renamed_resources].
2072 pub fn set_renamed_resources<T, K, V>(mut self, v: T) -> Self
2073 where
2074 T: std::iter::IntoIterator<Item = (K, V)>,
2075 K: std::convert::Into<std::string::String>,
2076 V: std::convert::Into<std::string::String>,
2077 {
2078 use std::iter::Iterator;
2079 self.renamed_resources = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2080 self
2081 }
2082
2083 /// Sets the value of [ignored_resources][crate::model::DotnetSettings::ignored_resources].
2084 pub fn set_ignored_resources<T, V>(mut self, v: T) -> Self
2085 where
2086 T: std::iter::IntoIterator<Item = V>,
2087 V: std::convert::Into<std::string::String>,
2088 {
2089 use std::iter::Iterator;
2090 self.ignored_resources = v.into_iter().map(|i| i.into()).collect();
2091 self
2092 }
2093
2094 /// Sets the value of [forced_namespace_aliases][crate::model::DotnetSettings::forced_namespace_aliases].
2095 pub fn set_forced_namespace_aliases<T, V>(mut self, v: T) -> Self
2096 where
2097 T: std::iter::IntoIterator<Item = V>,
2098 V: std::convert::Into<std::string::String>,
2099 {
2100 use std::iter::Iterator;
2101 self.forced_namespace_aliases = v.into_iter().map(|i| i.into()).collect();
2102 self
2103 }
2104
2105 /// Sets the value of [handwritten_signatures][crate::model::DotnetSettings::handwritten_signatures].
2106 pub fn set_handwritten_signatures<T, V>(mut self, v: T) -> Self
2107 where
2108 T: std::iter::IntoIterator<Item = V>,
2109 V: std::convert::Into<std::string::String>,
2110 {
2111 use std::iter::Iterator;
2112 self.handwritten_signatures = v.into_iter().map(|i| i.into()).collect();
2113 self
2114 }
2115}
2116
2117impl wkt::message::Message for DotnetSettings {
2118 fn typename() -> &'static str {
2119 "type.googleapis.com/google.api.DotnetSettings"
2120 }
2121}
2122
2123/// Settings for Ruby client libraries.
2124#[serde_with::serde_as]
2125#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
2126#[serde(default, rename_all = "camelCase")]
2127#[non_exhaustive]
2128pub struct RubySettings {
2129 /// Some settings.
2130 #[serde(skip_serializing_if = "std::option::Option::is_none")]
2131 pub common: std::option::Option<crate::model::CommonLanguageSettings>,
2132
2133 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
2134 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2135}
2136
2137impl RubySettings {
2138 pub fn new() -> Self {
2139 std::default::Default::default()
2140 }
2141
2142 /// Sets the value of [common][crate::model::RubySettings::common].
2143 pub fn set_common<
2144 T: std::convert::Into<std::option::Option<crate::model::CommonLanguageSettings>>,
2145 >(
2146 mut self,
2147 v: T,
2148 ) -> Self {
2149 self.common = v.into();
2150 self
2151 }
2152}
2153
2154impl wkt::message::Message for RubySettings {
2155 fn typename() -> &'static str {
2156 "type.googleapis.com/google.api.RubySettings"
2157 }
2158}
2159
2160/// Settings for Go client libraries.
2161#[serde_with::serde_as]
2162#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
2163#[serde(default, rename_all = "camelCase")]
2164#[non_exhaustive]
2165pub struct GoSettings {
2166 /// Some settings.
2167 #[serde(skip_serializing_if = "std::option::Option::is_none")]
2168 pub common: std::option::Option<crate::model::CommonLanguageSettings>,
2169
2170 /// Map of service names to renamed services. Keys are the package relative
2171 /// service names and values are the name to be used for the service client
2172 /// and call options.
2173 ///
2174 /// publishing:
2175 /// go_settings:
2176 /// renamed_services:
2177 /// Publisher: TopicAdmin
2178 #[serde(skip_serializing_if = "std::collections::HashMap::is_empty")]
2179 pub renamed_services: std::collections::HashMap<std::string::String, std::string::String>,
2180
2181 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
2182 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2183}
2184
2185impl GoSettings {
2186 pub fn new() -> Self {
2187 std::default::Default::default()
2188 }
2189
2190 /// Sets the value of [common][crate::model::GoSettings::common].
2191 pub fn set_common<
2192 T: std::convert::Into<std::option::Option<crate::model::CommonLanguageSettings>>,
2193 >(
2194 mut self,
2195 v: T,
2196 ) -> Self {
2197 self.common = v.into();
2198 self
2199 }
2200
2201 /// Sets the value of [renamed_services][crate::model::GoSettings::renamed_services].
2202 pub fn set_renamed_services<T, K, V>(mut self, v: T) -> Self
2203 where
2204 T: std::iter::IntoIterator<Item = (K, V)>,
2205 K: std::convert::Into<std::string::String>,
2206 V: std::convert::Into<std::string::String>,
2207 {
2208 use std::iter::Iterator;
2209 self.renamed_services = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2210 self
2211 }
2212}
2213
2214impl wkt::message::Message for GoSettings {
2215 fn typename() -> &'static str {
2216 "type.googleapis.com/google.api.GoSettings"
2217 }
2218}
2219
2220/// Describes the generator configuration for a method.
2221#[serde_with::serde_as]
2222#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
2223#[serde(default, rename_all = "camelCase")]
2224#[non_exhaustive]
2225pub struct MethodSettings {
2226 /// The fully qualified name of the method, for which the options below apply.
2227 /// This is used to find the method to apply the options.
2228 ///
2229 /// Example:
2230 ///
2231 /// publishing:
2232 /// method_settings:
2233 /// - selector: google.storage.control.v2.StorageControl.CreateFolder
2234 /// # method settings for CreateFolder...
2235 #[serde(skip_serializing_if = "std::string::String::is_empty")]
2236 pub selector: std::string::String,
2237
2238 /// Describes settings to use for long-running operations when generating
2239 /// API methods for RPCs. Complements RPCs that use the annotations in
2240 /// google/longrunning/operations.proto.
2241 ///
2242 /// Example of a YAML configuration::
2243 ///
2244 /// publishing:
2245 /// method_settings:
2246 /// - selector: google.cloud.speech.v2.Speech.BatchRecognize
2247 /// long_running:
2248 /// initial_poll_delay: 60s # 1 minute
2249 /// poll_delay_multiplier: 1.5
2250 /// max_poll_delay: 360s # 6 minutes
2251 /// total_poll_timeout: 54000s # 90 minutes
2252 #[serde(skip_serializing_if = "std::option::Option::is_none")]
2253 pub long_running: std::option::Option<crate::model::method_settings::LongRunning>,
2254
2255 /// List of top-level fields of the request message, that should be
2256 /// automatically populated by the client libraries based on their
2257 /// (google.api.field_info).format. Currently supported format: UUID4.
2258 ///
2259 /// Example of a YAML configuration:
2260 ///
2261 /// publishing:
2262 /// method_settings:
2263 /// - selector: google.example.v1.ExampleService.CreateExample
2264 /// auto_populated_fields:
2265 /// - request_id
2266 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
2267 pub auto_populated_fields: std::vec::Vec<std::string::String>,
2268
2269 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
2270 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2271}
2272
2273impl MethodSettings {
2274 pub fn new() -> Self {
2275 std::default::Default::default()
2276 }
2277
2278 /// Sets the value of [selector][crate::model::MethodSettings::selector].
2279 pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2280 self.selector = v.into();
2281 self
2282 }
2283
2284 /// Sets the value of [long_running][crate::model::MethodSettings::long_running].
2285 pub fn set_long_running<
2286 T: std::convert::Into<std::option::Option<crate::model::method_settings::LongRunning>>,
2287 >(
2288 mut self,
2289 v: T,
2290 ) -> Self {
2291 self.long_running = v.into();
2292 self
2293 }
2294
2295 /// Sets the value of [auto_populated_fields][crate::model::MethodSettings::auto_populated_fields].
2296 pub fn set_auto_populated_fields<T, V>(mut self, v: T) -> Self
2297 where
2298 T: std::iter::IntoIterator<Item = V>,
2299 V: std::convert::Into<std::string::String>,
2300 {
2301 use std::iter::Iterator;
2302 self.auto_populated_fields = v.into_iter().map(|i| i.into()).collect();
2303 self
2304 }
2305}
2306
2307impl wkt::message::Message for MethodSettings {
2308 fn typename() -> &'static str {
2309 "type.googleapis.com/google.api.MethodSettings"
2310 }
2311}
2312
2313/// Defines additional types related to [MethodSettings].
2314pub mod method_settings {
2315 #[allow(unused_imports)]
2316 use super::*;
2317
2318 /// Describes settings to use when generating API methods that use the
2319 /// long-running operation pattern.
2320 /// All default values below are from those used in the client library
2321 /// generators (e.g.
2322 /// [Java](https://github.com/googleapis/gapic-generator-java/blob/04c2faa191a9b5a10b92392fe8482279c4404803/src/main/java/com/google/api/generator/gapic/composer/common/RetrySettingsComposer.java)).
2323 #[serde_with::serde_as]
2324 #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
2325 #[serde(default, rename_all = "camelCase")]
2326 #[non_exhaustive]
2327 pub struct LongRunning {
2328 /// Initial delay after which the first poll request will be made.
2329 /// Default value: 5 seconds.
2330 #[serde(skip_serializing_if = "std::option::Option::is_none")]
2331 pub initial_poll_delay: std::option::Option<wkt::Duration>,
2332
2333 /// Multiplier to gradually increase delay between subsequent polls until it
2334 /// reaches max_poll_delay.
2335 /// Default value: 1.5.
2336 #[serde(skip_serializing_if = "wkt::internal::is_default")]
2337 #[serde_as(as = "wkt::internal::F32")]
2338 pub poll_delay_multiplier: f32,
2339
2340 /// Maximum time between two subsequent poll requests.
2341 /// Default value: 45 seconds.
2342 #[serde(skip_serializing_if = "std::option::Option::is_none")]
2343 pub max_poll_delay: std::option::Option<wkt::Duration>,
2344
2345 /// Total polling timeout.
2346 /// Default value: 5 minutes.
2347 #[serde(skip_serializing_if = "std::option::Option::is_none")]
2348 pub total_poll_timeout: std::option::Option<wkt::Duration>,
2349
2350 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
2351 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2352 }
2353
2354 impl LongRunning {
2355 pub fn new() -> Self {
2356 std::default::Default::default()
2357 }
2358
2359 /// Sets the value of [initial_poll_delay][crate::model::method_settings::LongRunning::initial_poll_delay].
2360 pub fn set_initial_poll_delay<T: std::convert::Into<std::option::Option<wkt::Duration>>>(
2361 mut self,
2362 v: T,
2363 ) -> Self {
2364 self.initial_poll_delay = v.into();
2365 self
2366 }
2367
2368 /// Sets the value of [poll_delay_multiplier][crate::model::method_settings::LongRunning::poll_delay_multiplier].
2369 pub fn set_poll_delay_multiplier<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
2370 self.poll_delay_multiplier = v.into();
2371 self
2372 }
2373
2374 /// Sets the value of [max_poll_delay][crate::model::method_settings::LongRunning::max_poll_delay].
2375 pub fn set_max_poll_delay<T: std::convert::Into<std::option::Option<wkt::Duration>>>(
2376 mut self,
2377 v: T,
2378 ) -> Self {
2379 self.max_poll_delay = v.into();
2380 self
2381 }
2382
2383 /// Sets the value of [total_poll_timeout][crate::model::method_settings::LongRunning::total_poll_timeout].
2384 pub fn set_total_poll_timeout<T: std::convert::Into<std::option::Option<wkt::Duration>>>(
2385 mut self,
2386 v: T,
2387 ) -> Self {
2388 self.total_poll_timeout = v.into();
2389 self
2390 }
2391 }
2392
2393 impl wkt::message::Message for LongRunning {
2394 fn typename() -> &'static str {
2395 "type.googleapis.com/google.api.MethodSettings.LongRunning"
2396 }
2397 }
2398}
2399
2400/// This message is used to configure the generation of a subset of the RPCs in
2401/// a service for client libraries.
2402#[serde_with::serde_as]
2403#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
2404#[serde(default, rename_all = "camelCase")]
2405#[non_exhaustive]
2406pub struct SelectiveGapicGeneration {
2407 /// An allowlist of the fully qualified names of RPCs that should be included
2408 /// on public client surfaces.
2409 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
2410 pub methods: std::vec::Vec<std::string::String>,
2411
2412 /// Setting this to true indicates to the client generators that methods
2413 /// that would be excluded from the generation should instead be generated
2414 /// in a way that indicates these methods should not be consumed by
2415 /// end users. How this is expressed is up to individual language
2416 /// implementations to decide. Some examples may be: added annotations,
2417 /// obfuscated identifiers, or other language idiomatic patterns.
2418 #[serde(skip_serializing_if = "wkt::internal::is_default")]
2419 pub generate_omitted_as_internal: bool,
2420
2421 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
2422 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2423}
2424
2425impl SelectiveGapicGeneration {
2426 pub fn new() -> Self {
2427 std::default::Default::default()
2428 }
2429
2430 /// Sets the value of [methods][crate::model::SelectiveGapicGeneration::methods].
2431 pub fn set_methods<T, V>(mut self, v: T) -> Self
2432 where
2433 T: std::iter::IntoIterator<Item = V>,
2434 V: std::convert::Into<std::string::String>,
2435 {
2436 use std::iter::Iterator;
2437 self.methods = v.into_iter().map(|i| i.into()).collect();
2438 self
2439 }
2440
2441 /// Sets the value of [generate_omitted_as_internal][crate::model::SelectiveGapicGeneration::generate_omitted_as_internal].
2442 pub fn set_generate_omitted_as_internal<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2443 self.generate_omitted_as_internal = v.into();
2444 self
2445 }
2446}
2447
2448impl wkt::message::Message for SelectiveGapicGeneration {
2449 fn typename() -> &'static str {
2450 "type.googleapis.com/google.api.SelectiveGapicGeneration"
2451 }
2452}
2453
2454/// Output generated from semantically comparing two versions of a service
2455/// configuration.
2456///
2457/// Includes detailed information about a field that have changed with
2458/// applicable advice about potential consequences for the change, such as
2459/// backwards-incompatibility.
2460#[serde_with::serde_as]
2461#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
2462#[serde(default, rename_all = "camelCase")]
2463#[non_exhaustive]
2464pub struct ConfigChange {
2465 /// Object hierarchy path to the change, with levels separated by a '.'
2466 /// character. For repeated fields, an applicable unique identifier field is
2467 /// used for the index (usually selector, name, or id). For maps, the term
2468 /// 'key' is used. If the field has no unique identifier, the numeric index
2469 /// is used.
2470 /// Examples:
2471 ///
2472 /// - visibility.rules[selector=="google.LibraryService.ListBooks"].restriction
2473 /// - quota.metric_rules[selector=="google"].metric_costs[key=="reads"].value
2474 /// - logging.producer_destinations[0]
2475 #[serde(skip_serializing_if = "std::string::String::is_empty")]
2476 pub element: std::string::String,
2477
2478 /// Value of the changed object in the old Service configuration,
2479 /// in JSON format. This field will not be populated if ChangeType == ADDED.
2480 #[serde(skip_serializing_if = "std::string::String::is_empty")]
2481 pub old_value: std::string::String,
2482
2483 /// Value of the changed object in the new Service configuration,
2484 /// in JSON format. This field will not be populated if ChangeType == REMOVED.
2485 #[serde(skip_serializing_if = "std::string::String::is_empty")]
2486 pub new_value: std::string::String,
2487
2488 /// The type for this change, either ADDED, REMOVED, or MODIFIED.
2489 pub change_type: crate::model::ChangeType,
2490
2491 /// Collection of advice provided for this change, useful for determining the
2492 /// possible impact of this change.
2493 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
2494 pub advices: std::vec::Vec<crate::model::Advice>,
2495
2496 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
2497 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2498}
2499
2500impl ConfigChange {
2501 pub fn new() -> Self {
2502 std::default::Default::default()
2503 }
2504
2505 /// Sets the value of [element][crate::model::ConfigChange::element].
2506 pub fn set_element<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2507 self.element = v.into();
2508 self
2509 }
2510
2511 /// Sets the value of [old_value][crate::model::ConfigChange::old_value].
2512 pub fn set_old_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2513 self.old_value = v.into();
2514 self
2515 }
2516
2517 /// Sets the value of [new_value][crate::model::ConfigChange::new_value].
2518 pub fn set_new_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2519 self.new_value = v.into();
2520 self
2521 }
2522
2523 /// Sets the value of [change_type][crate::model::ConfigChange::change_type].
2524 pub fn set_change_type<T: std::convert::Into<crate::model::ChangeType>>(
2525 mut self,
2526 v: T,
2527 ) -> Self {
2528 self.change_type = v.into();
2529 self
2530 }
2531
2532 /// Sets the value of [advices][crate::model::ConfigChange::advices].
2533 pub fn set_advices<T, V>(mut self, v: T) -> Self
2534 where
2535 T: std::iter::IntoIterator<Item = V>,
2536 V: std::convert::Into<crate::model::Advice>,
2537 {
2538 use std::iter::Iterator;
2539 self.advices = v.into_iter().map(|i| i.into()).collect();
2540 self
2541 }
2542}
2543
2544impl wkt::message::Message for ConfigChange {
2545 fn typename() -> &'static str {
2546 "type.googleapis.com/google.api.ConfigChange"
2547 }
2548}
2549
2550/// Generated advice about this change, used for providing more
2551/// information about how a change will affect the existing service.
2552#[serde_with::serde_as]
2553#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
2554#[serde(default, rename_all = "camelCase")]
2555#[non_exhaustive]
2556pub struct Advice {
2557 /// Useful description for why this advice was applied and what actions should
2558 /// be taken to mitigate any implied risks.
2559 #[serde(skip_serializing_if = "std::string::String::is_empty")]
2560 pub description: std::string::String,
2561
2562 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
2563 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2564}
2565
2566impl Advice {
2567 pub fn new() -> Self {
2568 std::default::Default::default()
2569 }
2570
2571 /// Sets the value of [description][crate::model::Advice::description].
2572 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2573 self.description = v.into();
2574 self
2575 }
2576}
2577
2578impl wkt::message::Message for Advice {
2579 fn typename() -> &'static str {
2580 "type.googleapis.com/google.api.Advice"
2581 }
2582}
2583
2584/// A descriptor for defining project properties for a service. One service may
2585/// have many consumer projects, and the service may want to behave differently
2586/// depending on some properties on the project. For example, a project may be
2587/// associated with a school, or a business, or a government agency, a business
2588/// type property on the project may affect how a service responds to the client.
2589/// This descriptor defines which properties are allowed to be set on a project.
2590///
2591/// Example:
2592///
2593/// project_properties:
2594/// properties:
2595/// - name: NO_WATERMARK
2596/// type: BOOL
2597/// description: Allows usage of the API without watermarks.
2598/// - name: EXTENDED_TILE_CACHE_PERIOD
2599/// type: INT64
2600#[serde_with::serde_as]
2601#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
2602#[serde(default, rename_all = "camelCase")]
2603#[non_exhaustive]
2604pub struct ProjectProperties {
2605 /// List of per consumer project-specific properties.
2606 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
2607 pub properties: std::vec::Vec<crate::model::Property>,
2608
2609 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
2610 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2611}
2612
2613impl ProjectProperties {
2614 pub fn new() -> Self {
2615 std::default::Default::default()
2616 }
2617
2618 /// Sets the value of [properties][crate::model::ProjectProperties::properties].
2619 pub fn set_properties<T, V>(mut self, v: T) -> Self
2620 where
2621 T: std::iter::IntoIterator<Item = V>,
2622 V: std::convert::Into<crate::model::Property>,
2623 {
2624 use std::iter::Iterator;
2625 self.properties = v.into_iter().map(|i| i.into()).collect();
2626 self
2627 }
2628}
2629
2630impl wkt::message::Message for ProjectProperties {
2631 fn typename() -> &'static str {
2632 "type.googleapis.com/google.api.ProjectProperties"
2633 }
2634}
2635
2636/// Defines project properties.
2637///
2638/// API services can define properties that can be assigned to consumer projects
2639/// so that backends can perform response customization without having to make
2640/// additional calls or maintain additional storage. For example, Maps API
2641/// defines properties that controls map tile cache period, or whether to embed a
2642/// watermark in a result.
2643///
2644/// These values can be set via API producer console. Only API providers can
2645/// define and set these properties.
2646#[serde_with::serde_as]
2647#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
2648#[serde(default, rename_all = "camelCase")]
2649#[non_exhaustive]
2650pub struct Property {
2651 /// The name of the property (a.k.a key).
2652 #[serde(skip_serializing_if = "std::string::String::is_empty")]
2653 pub name: std::string::String,
2654
2655 /// The type of this property.
2656 #[serde(rename = "type")]
2657 pub r#type: crate::model::property::PropertyType,
2658
2659 /// The description of the property
2660 #[serde(skip_serializing_if = "std::string::String::is_empty")]
2661 pub description: std::string::String,
2662
2663 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
2664 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2665}
2666
2667impl Property {
2668 pub fn new() -> Self {
2669 std::default::Default::default()
2670 }
2671
2672 /// Sets the value of [name][crate::model::Property::name].
2673 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2674 self.name = v.into();
2675 self
2676 }
2677
2678 /// Sets the value of [r#type][crate::model::Property::type].
2679 pub fn set_type<T: std::convert::Into<crate::model::property::PropertyType>>(
2680 mut self,
2681 v: T,
2682 ) -> Self {
2683 self.r#type = v.into();
2684 self
2685 }
2686
2687 /// Sets the value of [description][crate::model::Property::description].
2688 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2689 self.description = v.into();
2690 self
2691 }
2692}
2693
2694impl wkt::message::Message for Property {
2695 fn typename() -> &'static str {
2696 "type.googleapis.com/google.api.Property"
2697 }
2698}
2699
2700/// Defines additional types related to [Property].
2701pub mod property {
2702 #[allow(unused_imports)]
2703 use super::*;
2704
2705 /// Supported data type of the property values
2706 ///
2707 /// # Working with unknown values
2708 ///
2709 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2710 /// additional enum variants at any time. Adding new variants is not considered
2711 /// a breaking change. Applications should write their code in anticipation of:
2712 ///
2713 /// - New values appearing in future releases of the client library, **and**
2714 /// - New values received dynamically, without application changes.
2715 ///
2716 /// Please consult the [Working with enums] section in the user guide for some
2717 /// guidelines.
2718 ///
2719 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2720 #[derive(Clone, Debug, PartialEq)]
2721 #[non_exhaustive]
2722 pub enum PropertyType {
2723 /// The type is unspecified, and will result in an error.
2724 Unspecified,
2725 /// The type is `int64`.
2726 Int64,
2727 /// The type is `bool`.
2728 Bool,
2729 /// The type is `string`.
2730 String,
2731 /// The type is 'double'.
2732 Double,
2733 /// If set, the enum was initialized with an unknown value.
2734 ///
2735 /// Applications can examine the value using [PropertyType::value] or
2736 /// [PropertyType::name].
2737 UnknownValue(property_type::UnknownValue),
2738 }
2739
2740 #[doc(hidden)]
2741 pub mod property_type {
2742 #[allow(unused_imports)]
2743 use super::*;
2744 #[derive(Clone, Debug, PartialEq)]
2745 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2746 }
2747
2748 impl PropertyType {
2749 /// Gets the enum value.
2750 ///
2751 /// Returns `None` if the enum contains an unknown value deserialized from
2752 /// the string representation of enums.
2753 pub fn value(&self) -> std::option::Option<i32> {
2754 match self {
2755 Self::Unspecified => std::option::Option::Some(0),
2756 Self::Int64 => std::option::Option::Some(1),
2757 Self::Bool => std::option::Option::Some(2),
2758 Self::String => std::option::Option::Some(3),
2759 Self::Double => std::option::Option::Some(4),
2760 Self::UnknownValue(u) => u.0.value(),
2761 }
2762 }
2763
2764 /// Gets the enum value as a string.
2765 ///
2766 /// Returns `None` if the enum contains an unknown value deserialized from
2767 /// the integer representation of enums.
2768 pub fn name(&self) -> std::option::Option<&str> {
2769 match self {
2770 Self::Unspecified => std::option::Option::Some("UNSPECIFIED"),
2771 Self::Int64 => std::option::Option::Some("INT64"),
2772 Self::Bool => std::option::Option::Some("BOOL"),
2773 Self::String => std::option::Option::Some("STRING"),
2774 Self::Double => std::option::Option::Some("DOUBLE"),
2775 Self::UnknownValue(u) => u.0.name(),
2776 }
2777 }
2778 }
2779
2780 impl std::default::Default for PropertyType {
2781 fn default() -> Self {
2782 use std::convert::From;
2783 Self::from(0)
2784 }
2785 }
2786
2787 impl std::fmt::Display for PropertyType {
2788 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2789 wkt::internal::display_enum(f, self.name(), self.value())
2790 }
2791 }
2792
2793 impl std::convert::From<i32> for PropertyType {
2794 fn from(value: i32) -> Self {
2795 match value {
2796 0 => Self::Unspecified,
2797 1 => Self::Int64,
2798 2 => Self::Bool,
2799 3 => Self::String,
2800 4 => Self::Double,
2801 _ => Self::UnknownValue(property_type::UnknownValue(
2802 wkt::internal::UnknownEnumValue::Integer(value),
2803 )),
2804 }
2805 }
2806 }
2807
2808 impl std::convert::From<&str> for PropertyType {
2809 fn from(value: &str) -> Self {
2810 use std::string::ToString;
2811 match value {
2812 "UNSPECIFIED" => Self::Unspecified,
2813 "INT64" => Self::Int64,
2814 "BOOL" => Self::Bool,
2815 "STRING" => Self::String,
2816 "DOUBLE" => Self::Double,
2817 _ => Self::UnknownValue(property_type::UnknownValue(
2818 wkt::internal::UnknownEnumValue::String(value.to_string()),
2819 )),
2820 }
2821 }
2822 }
2823
2824 impl serde::ser::Serialize for PropertyType {
2825 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2826 where
2827 S: serde::Serializer,
2828 {
2829 match self {
2830 Self::Unspecified => serializer.serialize_i32(0),
2831 Self::Int64 => serializer.serialize_i32(1),
2832 Self::Bool => serializer.serialize_i32(2),
2833 Self::String => serializer.serialize_i32(3),
2834 Self::Double => serializer.serialize_i32(4),
2835 Self::UnknownValue(u) => u.0.serialize(serializer),
2836 }
2837 }
2838 }
2839
2840 impl<'de> serde::de::Deserialize<'de> for PropertyType {
2841 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2842 where
2843 D: serde::Deserializer<'de>,
2844 {
2845 deserializer.deserialize_any(wkt::internal::EnumVisitor::<PropertyType>::new(
2846 ".google.api.Property.PropertyType",
2847 ))
2848 }
2849 }
2850}
2851
2852/// `Context` defines which contexts an API requests.
2853///
2854/// Example:
2855///
2856/// ```norust
2857/// context:
2858/// rules:
2859/// - selector: "*"
2860/// requested:
2861/// - google.rpc.context.ProjectContext
2862/// - google.rpc.context.OriginContext
2863/// ```
2864///
2865/// The above specifies that all methods in the API request
2866/// `google.rpc.context.ProjectContext` and
2867/// `google.rpc.context.OriginContext`.
2868///
2869/// Available context types are defined in package
2870/// `google.rpc.context`.
2871///
2872/// This also provides mechanism to allowlist any protobuf message extension that
2873/// can be sent in grpc metadata using “x-goog-ext-<extension_id>-bin” and
2874/// “x-goog-ext-<extension_id>-jspb” format. For example, list any service
2875/// specific protobuf types that can appear in grpc metadata as follows in your
2876/// yaml file:
2877///
2878/// Example:
2879///
2880/// ```norust
2881/// context:
2882/// rules:
2883/// - selector: "google.example.library.v1.LibraryService.CreateBook"
2884/// allowed_request_extensions:
2885/// - google.foo.v1.NewExtension
2886/// allowed_response_extensions:
2887/// - google.foo.v1.NewExtension
2888/// ```
2889///
2890/// You can also specify extension ID instead of fully qualified extension name
2891/// here.
2892#[serde_with::serde_as]
2893#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
2894#[serde(default, rename_all = "camelCase")]
2895#[non_exhaustive]
2896pub struct Context {
2897 /// A list of RPC context rules that apply to individual API methods.
2898 ///
2899 /// **NOTE:** All service configuration rules follow "last one wins" order.
2900 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
2901 pub rules: std::vec::Vec<crate::model::ContextRule>,
2902
2903 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
2904 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2905}
2906
2907impl Context {
2908 pub fn new() -> Self {
2909 std::default::Default::default()
2910 }
2911
2912 /// Sets the value of [rules][crate::model::Context::rules].
2913 pub fn set_rules<T, V>(mut self, v: T) -> Self
2914 where
2915 T: std::iter::IntoIterator<Item = V>,
2916 V: std::convert::Into<crate::model::ContextRule>,
2917 {
2918 use std::iter::Iterator;
2919 self.rules = v.into_iter().map(|i| i.into()).collect();
2920 self
2921 }
2922}
2923
2924impl wkt::message::Message for Context {
2925 fn typename() -> &'static str {
2926 "type.googleapis.com/google.api.Context"
2927 }
2928}
2929
2930/// A context rule provides information about the context for an individual API
2931/// element.
2932#[serde_with::serde_as]
2933#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
2934#[serde(default, rename_all = "camelCase")]
2935#[non_exhaustive]
2936pub struct ContextRule {
2937 /// Selects the methods to which this rule applies.
2938 ///
2939 /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
2940 /// details.
2941 ///
2942 /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
2943 #[serde(skip_serializing_if = "std::string::String::is_empty")]
2944 pub selector: std::string::String,
2945
2946 /// A list of full type names of requested contexts, only the requested context
2947 /// will be made available to the backend.
2948 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
2949 pub requested: std::vec::Vec<std::string::String>,
2950
2951 /// A list of full type names of provided contexts. It is used to support
2952 /// propagating HTTP headers and ETags from the response extension.
2953 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
2954 pub provided: std::vec::Vec<std::string::String>,
2955
2956 /// A list of full type names or extension IDs of extensions allowed in grpc
2957 /// side channel from client to backend.
2958 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
2959 pub allowed_request_extensions: std::vec::Vec<std::string::String>,
2960
2961 /// A list of full type names or extension IDs of extensions allowed in grpc
2962 /// side channel from backend to client.
2963 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
2964 pub allowed_response_extensions: std::vec::Vec<std::string::String>,
2965
2966 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
2967 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2968}
2969
2970impl ContextRule {
2971 pub fn new() -> Self {
2972 std::default::Default::default()
2973 }
2974
2975 /// Sets the value of [selector][crate::model::ContextRule::selector].
2976 pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2977 self.selector = v.into();
2978 self
2979 }
2980
2981 /// Sets the value of [requested][crate::model::ContextRule::requested].
2982 pub fn set_requested<T, V>(mut self, v: T) -> Self
2983 where
2984 T: std::iter::IntoIterator<Item = V>,
2985 V: std::convert::Into<std::string::String>,
2986 {
2987 use std::iter::Iterator;
2988 self.requested = v.into_iter().map(|i| i.into()).collect();
2989 self
2990 }
2991
2992 /// Sets the value of [provided][crate::model::ContextRule::provided].
2993 pub fn set_provided<T, V>(mut self, v: T) -> Self
2994 where
2995 T: std::iter::IntoIterator<Item = V>,
2996 V: std::convert::Into<std::string::String>,
2997 {
2998 use std::iter::Iterator;
2999 self.provided = v.into_iter().map(|i| i.into()).collect();
3000 self
3001 }
3002
3003 /// Sets the value of [allowed_request_extensions][crate::model::ContextRule::allowed_request_extensions].
3004 pub fn set_allowed_request_extensions<T, V>(mut self, v: T) -> Self
3005 where
3006 T: std::iter::IntoIterator<Item = V>,
3007 V: std::convert::Into<std::string::String>,
3008 {
3009 use std::iter::Iterator;
3010 self.allowed_request_extensions = v.into_iter().map(|i| i.into()).collect();
3011 self
3012 }
3013
3014 /// Sets the value of [allowed_response_extensions][crate::model::ContextRule::allowed_response_extensions].
3015 pub fn set_allowed_response_extensions<T, V>(mut self, v: T) -> Self
3016 where
3017 T: std::iter::IntoIterator<Item = V>,
3018 V: std::convert::Into<std::string::String>,
3019 {
3020 use std::iter::Iterator;
3021 self.allowed_response_extensions = v.into_iter().map(|i| i.into()).collect();
3022 self
3023 }
3024}
3025
3026impl wkt::message::Message for ContextRule {
3027 fn typename() -> &'static str {
3028 "type.googleapis.com/google.api.ContextRule"
3029 }
3030}
3031
3032/// Selects and configures the service controller used by the service.
3033///
3034/// Example:
3035///
3036/// ```norust
3037/// control:
3038/// environment: servicecontrol.googleapis.com
3039/// ```
3040#[serde_with::serde_as]
3041#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
3042#[serde(default, rename_all = "camelCase")]
3043#[non_exhaustive]
3044pub struct Control {
3045 /// The service controller environment to use. If empty, no control plane
3046 /// feature (like quota and billing) will be enabled. The recommended value for
3047 /// most services is servicecontrol.googleapis.com
3048 #[serde(skip_serializing_if = "std::string::String::is_empty")]
3049 pub environment: std::string::String,
3050
3051 /// Defines policies applying to the API methods of the service.
3052 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
3053 pub method_policies: std::vec::Vec<crate::model::MethodPolicy>,
3054
3055 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
3056 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3057}
3058
3059impl Control {
3060 pub fn new() -> Self {
3061 std::default::Default::default()
3062 }
3063
3064 /// Sets the value of [environment][crate::model::Control::environment].
3065 pub fn set_environment<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3066 self.environment = v.into();
3067 self
3068 }
3069
3070 /// Sets the value of [method_policies][crate::model::Control::method_policies].
3071 pub fn set_method_policies<T, V>(mut self, v: T) -> Self
3072 where
3073 T: std::iter::IntoIterator<Item = V>,
3074 V: std::convert::Into<crate::model::MethodPolicy>,
3075 {
3076 use std::iter::Iterator;
3077 self.method_policies = v.into_iter().map(|i| i.into()).collect();
3078 self
3079 }
3080}
3081
3082impl wkt::message::Message for Control {
3083 fn typename() -> &'static str {
3084 "type.googleapis.com/google.api.Control"
3085 }
3086}
3087
3088/// `Distribution` contains summary statistics for a population of values. It
3089/// optionally contains a histogram representing the distribution of those values
3090/// across a set of buckets.
3091///
3092/// The summary statistics are the count, mean, sum of the squared deviation from
3093/// the mean, the minimum, and the maximum of the set of population of values.
3094/// The histogram is based on a sequence of buckets and gives a count of values
3095/// that fall into each bucket. The boundaries of the buckets are given either
3096/// explicitly or by formulas for buckets of fixed or exponentially increasing
3097/// widths.
3098///
3099/// Although it is not forbidden, it is generally a bad idea to include
3100/// non-finite values (infinities or NaNs) in the population of values, as this
3101/// will render the `mean` and `sum_of_squared_deviation` fields meaningless.
3102#[serde_with::serde_as]
3103#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
3104#[serde(default, rename_all = "camelCase")]
3105#[non_exhaustive]
3106pub struct Distribution {
3107 /// The number of values in the population. Must be non-negative. This value
3108 /// must equal the sum of the values in `bucket_counts` if a histogram is
3109 /// provided.
3110 #[serde(skip_serializing_if = "wkt::internal::is_default")]
3111 #[serde_as(as = "serde_with::DisplayFromStr")]
3112 pub count: i64,
3113
3114 /// The arithmetic mean of the values in the population. If `count` is zero
3115 /// then this field must be zero.
3116 #[serde(skip_serializing_if = "wkt::internal::is_default")]
3117 #[serde_as(as = "wkt::internal::F64")]
3118 pub mean: f64,
3119
3120 /// The sum of squared deviations from the mean of the values in the
3121 /// population. For values x_i this is:
3122 ///
3123 /// ```norust
3124 /// Sum[i=1..n]((x_i - mean)^2)
3125 /// ```
3126 ///
3127 /// Knuth, "The Art of Computer Programming", Vol. 2, page 232, 3rd edition
3128 /// describes Welford's method for accumulating this sum in one pass.
3129 ///
3130 /// If `count` is zero then this field must be zero.
3131 #[serde(skip_serializing_if = "wkt::internal::is_default")]
3132 #[serde_as(as = "wkt::internal::F64")]
3133 pub sum_of_squared_deviation: f64,
3134
3135 /// If specified, contains the range of the population values. The field
3136 /// must not be present if the `count` is zero.
3137 #[serde(skip_serializing_if = "std::option::Option::is_none")]
3138 pub range: std::option::Option<crate::model::distribution::Range>,
3139
3140 /// Defines the histogram bucket boundaries. If the distribution does not
3141 /// contain a histogram, then omit this field.
3142 #[serde(skip_serializing_if = "std::option::Option::is_none")]
3143 pub bucket_options: std::option::Option<crate::model::distribution::BucketOptions>,
3144
3145 /// The number of values in each bucket of the histogram, as described in
3146 /// `bucket_options`. If the distribution does not have a histogram, then omit
3147 /// this field. If there is a histogram, then the sum of the values in
3148 /// `bucket_counts` must equal the value in the `count` field of the
3149 /// distribution.
3150 ///
3151 /// If present, `bucket_counts` should contain N values, where N is the number
3152 /// of buckets specified in `bucket_options`. If you supply fewer than N
3153 /// values, the remaining values are assumed to be 0.
3154 ///
3155 /// The order of the values in `bucket_counts` follows the bucket numbering
3156 /// schemes described for the three bucket types. The first value must be the
3157 /// count for the underflow bucket (number 0). The next N-2 values are the
3158 /// counts for the finite buckets (number 1 through N-2). The N'th value in
3159 /// `bucket_counts` is the count for the overflow bucket (number N-1).
3160 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
3161 #[serde_as(as = "std::vec::Vec<serde_with::DisplayFromStr>")]
3162 pub bucket_counts: std::vec::Vec<i64>,
3163
3164 /// Must be in increasing order of `value` field.
3165 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
3166 pub exemplars: std::vec::Vec<crate::model::distribution::Exemplar>,
3167
3168 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
3169 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3170}
3171
3172impl Distribution {
3173 pub fn new() -> Self {
3174 std::default::Default::default()
3175 }
3176
3177 /// Sets the value of [count][crate::model::Distribution::count].
3178 pub fn set_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
3179 self.count = v.into();
3180 self
3181 }
3182
3183 /// Sets the value of [mean][crate::model::Distribution::mean].
3184 pub fn set_mean<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
3185 self.mean = v.into();
3186 self
3187 }
3188
3189 /// Sets the value of [sum_of_squared_deviation][crate::model::Distribution::sum_of_squared_deviation].
3190 pub fn set_sum_of_squared_deviation<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
3191 self.sum_of_squared_deviation = v.into();
3192 self
3193 }
3194
3195 /// Sets the value of [range][crate::model::Distribution::range].
3196 pub fn set_range<
3197 T: std::convert::Into<std::option::Option<crate::model::distribution::Range>>,
3198 >(
3199 mut self,
3200 v: T,
3201 ) -> Self {
3202 self.range = v.into();
3203 self
3204 }
3205
3206 /// Sets the value of [bucket_options][crate::model::Distribution::bucket_options].
3207 pub fn set_bucket_options<
3208 T: std::convert::Into<std::option::Option<crate::model::distribution::BucketOptions>>,
3209 >(
3210 mut self,
3211 v: T,
3212 ) -> Self {
3213 self.bucket_options = v.into();
3214 self
3215 }
3216
3217 /// Sets the value of [bucket_counts][crate::model::Distribution::bucket_counts].
3218 pub fn set_bucket_counts<T, V>(mut self, v: T) -> Self
3219 where
3220 T: std::iter::IntoIterator<Item = V>,
3221 V: std::convert::Into<i64>,
3222 {
3223 use std::iter::Iterator;
3224 self.bucket_counts = v.into_iter().map(|i| i.into()).collect();
3225 self
3226 }
3227
3228 /// Sets the value of [exemplars][crate::model::Distribution::exemplars].
3229 pub fn set_exemplars<T, V>(mut self, v: T) -> Self
3230 where
3231 T: std::iter::IntoIterator<Item = V>,
3232 V: std::convert::Into<crate::model::distribution::Exemplar>,
3233 {
3234 use std::iter::Iterator;
3235 self.exemplars = v.into_iter().map(|i| i.into()).collect();
3236 self
3237 }
3238}
3239
3240impl wkt::message::Message for Distribution {
3241 fn typename() -> &'static str {
3242 "type.googleapis.com/google.api.Distribution"
3243 }
3244}
3245
3246/// Defines additional types related to [Distribution].
3247pub mod distribution {
3248 #[allow(unused_imports)]
3249 use super::*;
3250
3251 /// The range of the population values.
3252 #[serde_with::serde_as]
3253 #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
3254 #[serde(default, rename_all = "camelCase")]
3255 #[non_exhaustive]
3256 pub struct Range {
3257 /// The minimum of the population values.
3258 #[serde(skip_serializing_if = "wkt::internal::is_default")]
3259 #[serde_as(as = "wkt::internal::F64")]
3260 pub min: f64,
3261
3262 /// The maximum of the population values.
3263 #[serde(skip_serializing_if = "wkt::internal::is_default")]
3264 #[serde_as(as = "wkt::internal::F64")]
3265 pub max: f64,
3266
3267 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
3268 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3269 }
3270
3271 impl Range {
3272 pub fn new() -> Self {
3273 std::default::Default::default()
3274 }
3275
3276 /// Sets the value of [min][crate::model::distribution::Range::min].
3277 pub fn set_min<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
3278 self.min = v.into();
3279 self
3280 }
3281
3282 /// Sets the value of [max][crate::model::distribution::Range::max].
3283 pub fn set_max<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
3284 self.max = v.into();
3285 self
3286 }
3287 }
3288
3289 impl wkt::message::Message for Range {
3290 fn typename() -> &'static str {
3291 "type.googleapis.com/google.api.Distribution.Range"
3292 }
3293 }
3294
3295 /// `BucketOptions` describes the bucket boundaries used to create a histogram
3296 /// for the distribution. The buckets can be in a linear sequence, an
3297 /// exponential sequence, or each bucket can be specified explicitly.
3298 /// `BucketOptions` does not include the number of values in each bucket.
3299 ///
3300 /// A bucket has an inclusive lower bound and exclusive upper bound for the
3301 /// values that are counted for that bucket. The upper bound of a bucket must
3302 /// be strictly greater than the lower bound. The sequence of N buckets for a
3303 /// distribution consists of an underflow bucket (number 0), zero or more
3304 /// finite buckets (number 1 through N - 2) and an overflow bucket (number N -
3305 /// 1). The buckets are contiguous: the lower bound of bucket i (i > 0) is the
3306 /// same as the upper bound of bucket i - 1. The buckets span the whole range
3307 /// of finite values: lower bound of the underflow bucket is -infinity and the
3308 /// upper bound of the overflow bucket is +infinity. The finite buckets are
3309 /// so-called because both bounds are finite.
3310 #[serde_with::serde_as]
3311 #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
3312 #[serde(default, rename_all = "camelCase")]
3313 #[non_exhaustive]
3314 pub struct BucketOptions {
3315 /// Exactly one of these three fields must be set.
3316 #[serde(flatten, skip_serializing_if = "std::option::Option::is_none")]
3317 pub options: std::option::Option<crate::model::distribution::bucket_options::Options>,
3318
3319 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
3320 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3321 }
3322
3323 impl BucketOptions {
3324 pub fn new() -> Self {
3325 std::default::Default::default()
3326 }
3327
3328 /// Sets the value of [options][crate::model::distribution::BucketOptions::options].
3329 ///
3330 /// Note that all the setters affecting `options` are mutually
3331 /// exclusive.
3332 pub fn set_options<
3333 T: std::convert::Into<
3334 std::option::Option<crate::model::distribution::bucket_options::Options>,
3335 >,
3336 >(
3337 mut self,
3338 v: T,
3339 ) -> Self {
3340 self.options = v.into();
3341 self
3342 }
3343
3344 /// The value of [options][crate::model::distribution::BucketOptions::options]
3345 /// if it holds a `LinearBuckets`, `None` if the field is not set or
3346 /// holds a different branch.
3347 pub fn linear_buckets(
3348 &self,
3349 ) -> std::option::Option<&std::boxed::Box<crate::model::distribution::bucket_options::Linear>>
3350 {
3351 #[allow(unreachable_patterns)]
3352 self.options.as_ref().and_then(|v| match v {
3353 crate::model::distribution::bucket_options::Options::LinearBuckets(v) => {
3354 std::option::Option::Some(v)
3355 }
3356 _ => std::option::Option::None,
3357 })
3358 }
3359
3360 /// Sets the value of [options][crate::model::distribution::BucketOptions::options]
3361 /// to hold a `LinearBuckets`.
3362 ///
3363 /// Note that all the setters affecting `options` are
3364 /// mutually exclusive.
3365 pub fn set_linear_buckets<
3366 T: std::convert::Into<std::boxed::Box<crate::model::distribution::bucket_options::Linear>>,
3367 >(
3368 mut self,
3369 v: T,
3370 ) -> Self {
3371 self.options = std::option::Option::Some(
3372 crate::model::distribution::bucket_options::Options::LinearBuckets(v.into()),
3373 );
3374 self
3375 }
3376
3377 /// The value of [options][crate::model::distribution::BucketOptions::options]
3378 /// if it holds a `ExponentialBuckets`, `None` if the field is not set or
3379 /// holds a different branch.
3380 pub fn exponential_buckets(
3381 &self,
3382 ) -> std::option::Option<
3383 &std::boxed::Box<crate::model::distribution::bucket_options::Exponential>,
3384 > {
3385 #[allow(unreachable_patterns)]
3386 self.options.as_ref().and_then(|v| match v {
3387 crate::model::distribution::bucket_options::Options::ExponentialBuckets(v) => {
3388 std::option::Option::Some(v)
3389 }
3390 _ => std::option::Option::None,
3391 })
3392 }
3393
3394 /// Sets the value of [options][crate::model::distribution::BucketOptions::options]
3395 /// to hold a `ExponentialBuckets`.
3396 ///
3397 /// Note that all the setters affecting `options` are
3398 /// mutually exclusive.
3399 pub fn set_exponential_buckets<
3400 T: std::convert::Into<
3401 std::boxed::Box<crate::model::distribution::bucket_options::Exponential>,
3402 >,
3403 >(
3404 mut self,
3405 v: T,
3406 ) -> Self {
3407 self.options = std::option::Option::Some(
3408 crate::model::distribution::bucket_options::Options::ExponentialBuckets(v.into()),
3409 );
3410 self
3411 }
3412
3413 /// The value of [options][crate::model::distribution::BucketOptions::options]
3414 /// if it holds a `ExplicitBuckets`, `None` if the field is not set or
3415 /// holds a different branch.
3416 pub fn explicit_buckets(
3417 &self,
3418 ) -> std::option::Option<
3419 &std::boxed::Box<crate::model::distribution::bucket_options::Explicit>,
3420 > {
3421 #[allow(unreachable_patterns)]
3422 self.options.as_ref().and_then(|v| match v {
3423 crate::model::distribution::bucket_options::Options::ExplicitBuckets(v) => {
3424 std::option::Option::Some(v)
3425 }
3426 _ => std::option::Option::None,
3427 })
3428 }
3429
3430 /// Sets the value of [options][crate::model::distribution::BucketOptions::options]
3431 /// to hold a `ExplicitBuckets`.
3432 ///
3433 /// Note that all the setters affecting `options` are
3434 /// mutually exclusive.
3435 pub fn set_explicit_buckets<
3436 T: std::convert::Into<
3437 std::boxed::Box<crate::model::distribution::bucket_options::Explicit>,
3438 >,
3439 >(
3440 mut self,
3441 v: T,
3442 ) -> Self {
3443 self.options = std::option::Option::Some(
3444 crate::model::distribution::bucket_options::Options::ExplicitBuckets(v.into()),
3445 );
3446 self
3447 }
3448 }
3449
3450 impl wkt::message::Message for BucketOptions {
3451 fn typename() -> &'static str {
3452 "type.googleapis.com/google.api.Distribution.BucketOptions"
3453 }
3454 }
3455
3456 /// Defines additional types related to [BucketOptions].
3457 pub mod bucket_options {
3458 #[allow(unused_imports)]
3459 use super::*;
3460
3461 /// Specifies a linear sequence of buckets that all have the same width
3462 /// (except overflow and underflow). Each bucket represents a constant
3463 /// absolute uncertainty on the specific value in the bucket.
3464 ///
3465 /// There are `num_finite_buckets + 2` (= N) buckets. Bucket `i` has the
3466 /// following boundaries:
3467 ///
3468 /// Upper bound (0 <= i < N-1): offset + (width * i).
3469 ///
3470 /// Lower bound (1 <= i < N): offset + (width * (i - 1)).
3471 #[serde_with::serde_as]
3472 #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
3473 #[serde(default, rename_all = "camelCase")]
3474 #[non_exhaustive]
3475 pub struct Linear {
3476 /// Must be greater than 0.
3477 #[serde(skip_serializing_if = "wkt::internal::is_default")]
3478 pub num_finite_buckets: i32,
3479
3480 /// Must be greater than 0.
3481 #[serde(skip_serializing_if = "wkt::internal::is_default")]
3482 #[serde_as(as = "wkt::internal::F64")]
3483 pub width: f64,
3484
3485 /// Lower bound of the first bucket.
3486 #[serde(skip_serializing_if = "wkt::internal::is_default")]
3487 #[serde_as(as = "wkt::internal::F64")]
3488 pub offset: f64,
3489
3490 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
3491 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3492 }
3493
3494 impl Linear {
3495 pub fn new() -> Self {
3496 std::default::Default::default()
3497 }
3498
3499 /// Sets the value of [num_finite_buckets][crate::model::distribution::bucket_options::Linear::num_finite_buckets].
3500 pub fn set_num_finite_buckets<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3501 self.num_finite_buckets = v.into();
3502 self
3503 }
3504
3505 /// Sets the value of [width][crate::model::distribution::bucket_options::Linear::width].
3506 pub fn set_width<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
3507 self.width = v.into();
3508 self
3509 }
3510
3511 /// Sets the value of [offset][crate::model::distribution::bucket_options::Linear::offset].
3512 pub fn set_offset<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
3513 self.offset = v.into();
3514 self
3515 }
3516 }
3517
3518 impl wkt::message::Message for Linear {
3519 fn typename() -> &'static str {
3520 "type.googleapis.com/google.api.Distribution.BucketOptions.Linear"
3521 }
3522 }
3523
3524 /// Specifies an exponential sequence of buckets that have a width that is
3525 /// proportional to the value of the lower bound. Each bucket represents a
3526 /// constant relative uncertainty on a specific value in the bucket.
3527 ///
3528 /// There are `num_finite_buckets + 2` (= N) buckets. Bucket `i` has the
3529 /// following boundaries:
3530 ///
3531 /// Upper bound (0 <= i < N-1): scale * (growth_factor ^ i).
3532 ///
3533 /// Lower bound (1 <= i < N): scale * (growth_factor ^ (i - 1)).
3534 #[serde_with::serde_as]
3535 #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
3536 #[serde(default, rename_all = "camelCase")]
3537 #[non_exhaustive]
3538 pub struct Exponential {
3539 /// Must be greater than 0.
3540 #[serde(skip_serializing_if = "wkt::internal::is_default")]
3541 pub num_finite_buckets: i32,
3542
3543 /// Must be greater than 1.
3544 #[serde(skip_serializing_if = "wkt::internal::is_default")]
3545 #[serde_as(as = "wkt::internal::F64")]
3546 pub growth_factor: f64,
3547
3548 /// Must be greater than 0.
3549 #[serde(skip_serializing_if = "wkt::internal::is_default")]
3550 #[serde_as(as = "wkt::internal::F64")]
3551 pub scale: f64,
3552
3553 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
3554 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3555 }
3556
3557 impl Exponential {
3558 pub fn new() -> Self {
3559 std::default::Default::default()
3560 }
3561
3562 /// Sets the value of [num_finite_buckets][crate::model::distribution::bucket_options::Exponential::num_finite_buckets].
3563 pub fn set_num_finite_buckets<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3564 self.num_finite_buckets = v.into();
3565 self
3566 }
3567
3568 /// Sets the value of [growth_factor][crate::model::distribution::bucket_options::Exponential::growth_factor].
3569 pub fn set_growth_factor<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
3570 self.growth_factor = v.into();
3571 self
3572 }
3573
3574 /// Sets the value of [scale][crate::model::distribution::bucket_options::Exponential::scale].
3575 pub fn set_scale<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
3576 self.scale = v.into();
3577 self
3578 }
3579 }
3580
3581 impl wkt::message::Message for Exponential {
3582 fn typename() -> &'static str {
3583 "type.googleapis.com/google.api.Distribution.BucketOptions.Exponential"
3584 }
3585 }
3586
3587 /// Specifies a set of buckets with arbitrary widths.
3588 ///
3589 /// There are `size(bounds) + 1` (= N) buckets. Bucket `i` has the following
3590 /// boundaries:
3591 ///
3592 /// Upper bound (0 <= i < N-1): bounds[i]
3593 /// Lower bound (1 <= i < N); bounds[i - 1]
3594 ///
3595 /// The `bounds` field must contain at least one element. If `bounds` has
3596 /// only one element, then there are no finite buckets, and that single
3597 /// element is the common boundary of the overflow and underflow buckets.
3598 #[serde_with::serde_as]
3599 #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
3600 #[serde(default, rename_all = "camelCase")]
3601 #[non_exhaustive]
3602 pub struct Explicit {
3603 /// The values must be monotonically increasing.
3604 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
3605 #[serde_as(as = "std::vec::Vec<wkt::internal::F64>")]
3606 pub bounds: std::vec::Vec<f64>,
3607
3608 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
3609 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3610 }
3611
3612 impl Explicit {
3613 pub fn new() -> Self {
3614 std::default::Default::default()
3615 }
3616
3617 /// Sets the value of [bounds][crate::model::distribution::bucket_options::Explicit::bounds].
3618 pub fn set_bounds<T, V>(mut self, v: T) -> Self
3619 where
3620 T: std::iter::IntoIterator<Item = V>,
3621 V: std::convert::Into<f64>,
3622 {
3623 use std::iter::Iterator;
3624 self.bounds = v.into_iter().map(|i| i.into()).collect();
3625 self
3626 }
3627 }
3628
3629 impl wkt::message::Message for Explicit {
3630 fn typename() -> &'static str {
3631 "type.googleapis.com/google.api.Distribution.BucketOptions.Explicit"
3632 }
3633 }
3634
3635 /// Exactly one of these three fields must be set.
3636 #[serde_with::serde_as]
3637 #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
3638 #[serde(rename_all = "camelCase")]
3639 #[non_exhaustive]
3640 pub enum Options {
3641 /// The linear bucket.
3642 LinearBuckets(std::boxed::Box<crate::model::distribution::bucket_options::Linear>),
3643 /// The exponential buckets.
3644 ExponentialBuckets(
3645 std::boxed::Box<crate::model::distribution::bucket_options::Exponential>,
3646 ),
3647 /// The explicit buckets.
3648 ExplicitBuckets(std::boxed::Box<crate::model::distribution::bucket_options::Explicit>),
3649 }
3650 }
3651
3652 /// Exemplars are example points that may be used to annotate aggregated
3653 /// distribution values. They are metadata that gives information about a
3654 /// particular value added to a Distribution bucket, such as a trace ID that
3655 /// was active when a value was added. They may contain further information,
3656 /// such as a example values and timestamps, origin, etc.
3657 #[serde_with::serde_as]
3658 #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
3659 #[serde(default, rename_all = "camelCase")]
3660 #[non_exhaustive]
3661 pub struct Exemplar {
3662 /// Value of the exemplar point. This value determines to which bucket the
3663 /// exemplar belongs.
3664 #[serde(skip_serializing_if = "wkt::internal::is_default")]
3665 #[serde_as(as = "wkt::internal::F64")]
3666 pub value: f64,
3667
3668 /// The observation (sampling) time of the above value.
3669 #[serde(skip_serializing_if = "std::option::Option::is_none")]
3670 pub timestamp: std::option::Option<wkt::Timestamp>,
3671
3672 /// Contextual information about the example value. Examples are:
3673 ///
3674 /// Trace: type.googleapis.com/google.monitoring.v3.SpanContext
3675 ///
3676 /// Literal string: type.googleapis.com/google.protobuf.StringValue
3677 ///
3678 /// Labels dropped during aggregation:
3679 /// type.googleapis.com/google.monitoring.v3.DroppedLabels
3680 ///
3681 /// There may be only a single attachment of any given message type in a
3682 /// single exemplar, and this is enforced by the system.
3683 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
3684 pub attachments: std::vec::Vec<wkt::Any>,
3685
3686 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
3687 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3688 }
3689
3690 impl Exemplar {
3691 pub fn new() -> Self {
3692 std::default::Default::default()
3693 }
3694
3695 /// Sets the value of [value][crate::model::distribution::Exemplar::value].
3696 pub fn set_value<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
3697 self.value = v.into();
3698 self
3699 }
3700
3701 /// Sets the value of [timestamp][crate::model::distribution::Exemplar::timestamp].
3702 pub fn set_timestamp<T: std::convert::Into<std::option::Option<wkt::Timestamp>>>(
3703 mut self,
3704 v: T,
3705 ) -> Self {
3706 self.timestamp = v.into();
3707 self
3708 }
3709
3710 /// Sets the value of [attachments][crate::model::distribution::Exemplar::attachments].
3711 pub fn set_attachments<T, V>(mut self, v: T) -> Self
3712 where
3713 T: std::iter::IntoIterator<Item = V>,
3714 V: std::convert::Into<wkt::Any>,
3715 {
3716 use std::iter::Iterator;
3717 self.attachments = v.into_iter().map(|i| i.into()).collect();
3718 self
3719 }
3720 }
3721
3722 impl wkt::message::Message for Exemplar {
3723 fn typename() -> &'static str {
3724 "type.googleapis.com/google.api.Distribution.Exemplar"
3725 }
3726 }
3727}
3728
3729/// `Documentation` provides the information for describing a service.
3730///
3731/// Example:
3732///
3733/// Documentation is provided in markdown syntax. In addition to
3734/// standard markdown features, definition lists, tables and fenced
3735/// code blocks are supported. Section headers can be provided and are
3736/// interpreted relative to the section nesting of the context where
3737/// a documentation fragment is embedded.
3738///
3739/// Documentation from the IDL is merged with documentation defined
3740/// via the config at normalization time, where documentation provided
3741/// by config rules overrides IDL provided.
3742///
3743/// A number of constructs specific to the API platform are supported
3744/// in documentation text.
3745///
3746/// In order to reference a proto element, the following
3747/// notation can be used:
3748///
3749/// To override the display text used for the link, this can be used:
3750///
3751/// Text can be excluded from doc using the following notation:
3752///
3753/// A few directives are available in documentation. Note that
3754/// directives must appear on a single line to be properly
3755/// identified. The `include` directive includes a markdown file from
3756/// an external source:
3757///
3758/// The `resource_for` directive marks a message to be the resource of
3759/// a collection in REST view. If it is not specified, tools attempt
3760/// to infer the resource from the operations in a collection:
3761///
3762/// The directive `suppress_warning` does not directly affect documentation
3763/// and is documented together with service config validation.
3764#[serde_with::serde_as]
3765#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
3766#[serde(default, rename_all = "camelCase")]
3767#[non_exhaustive]
3768pub struct Documentation {
3769 /// A short description of what the service does. The summary must be plain
3770 /// text. It becomes the overview of the service displayed in Google Cloud
3771 /// Console.
3772 /// NOTE: This field is equivalent to the standard field `description`.
3773 #[serde(skip_serializing_if = "std::string::String::is_empty")]
3774 pub summary: std::string::String,
3775
3776 /// The top level pages for the documentation set.
3777 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
3778 pub pages: std::vec::Vec<crate::model::Page>,
3779
3780 /// A list of documentation rules that apply to individual API elements.
3781 ///
3782 /// **NOTE:** All service configuration rules follow "last one wins" order.
3783 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
3784 pub rules: std::vec::Vec<crate::model::DocumentationRule>,
3785
3786 /// The URL to the root of documentation.
3787 #[serde(skip_serializing_if = "std::string::String::is_empty")]
3788 pub documentation_root_url: std::string::String,
3789
3790 /// Specifies the service root url if the default one (the service name
3791 /// from the yaml file) is not suitable. This can be seen in any fully
3792 /// specified service urls as well as sections that show a base that other
3793 /// urls are relative to.
3794 #[serde(skip_serializing_if = "std::string::String::is_empty")]
3795 pub service_root_url: std::string::String,
3796
3797 /// Declares a single overview page. For example:
3798 ///
3799 /// This is a shortcut for the following declaration (using pages style):
3800 ///
3801 /// Note: you cannot specify both `overview` field and `pages` field.
3802 #[serde(skip_serializing_if = "std::string::String::is_empty")]
3803 pub overview: std::string::String,
3804
3805 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
3806 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3807}
3808
3809impl Documentation {
3810 pub fn new() -> Self {
3811 std::default::Default::default()
3812 }
3813
3814 /// Sets the value of [summary][crate::model::Documentation::summary].
3815 pub fn set_summary<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3816 self.summary = v.into();
3817 self
3818 }
3819
3820 /// Sets the value of [pages][crate::model::Documentation::pages].
3821 pub fn set_pages<T, V>(mut self, v: T) -> Self
3822 where
3823 T: std::iter::IntoIterator<Item = V>,
3824 V: std::convert::Into<crate::model::Page>,
3825 {
3826 use std::iter::Iterator;
3827 self.pages = v.into_iter().map(|i| i.into()).collect();
3828 self
3829 }
3830
3831 /// Sets the value of [rules][crate::model::Documentation::rules].
3832 pub fn set_rules<T, V>(mut self, v: T) -> Self
3833 where
3834 T: std::iter::IntoIterator<Item = V>,
3835 V: std::convert::Into<crate::model::DocumentationRule>,
3836 {
3837 use std::iter::Iterator;
3838 self.rules = v.into_iter().map(|i| i.into()).collect();
3839 self
3840 }
3841
3842 /// Sets the value of [documentation_root_url][crate::model::Documentation::documentation_root_url].
3843 pub fn set_documentation_root_url<T: std::convert::Into<std::string::String>>(
3844 mut self,
3845 v: T,
3846 ) -> Self {
3847 self.documentation_root_url = v.into();
3848 self
3849 }
3850
3851 /// Sets the value of [service_root_url][crate::model::Documentation::service_root_url].
3852 pub fn set_service_root_url<T: std::convert::Into<std::string::String>>(
3853 mut self,
3854 v: T,
3855 ) -> Self {
3856 self.service_root_url = v.into();
3857 self
3858 }
3859
3860 /// Sets the value of [overview][crate::model::Documentation::overview].
3861 pub fn set_overview<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3862 self.overview = v.into();
3863 self
3864 }
3865}
3866
3867impl wkt::message::Message for Documentation {
3868 fn typename() -> &'static str {
3869 "type.googleapis.com/google.api.Documentation"
3870 }
3871}
3872
3873/// A documentation rule provides information about individual API elements.
3874#[serde_with::serde_as]
3875#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
3876#[serde(default, rename_all = "camelCase")]
3877#[non_exhaustive]
3878pub struct DocumentationRule {
3879 /// The selector is a comma-separated list of patterns for any element such as
3880 /// a method, a field, an enum value. Each pattern is a qualified name of the
3881 /// element which may end in "*", indicating a wildcard. Wildcards are only
3882 /// allowed at the end and for a whole component of the qualified name,
3883 /// i.e. "foo.*" is ok, but not "foo.b*" or "foo.*.bar". A wildcard will match
3884 /// one or more components. To specify a default for all applicable elements,
3885 /// the whole pattern "*" is used.
3886 #[serde(skip_serializing_if = "std::string::String::is_empty")]
3887 pub selector: std::string::String,
3888
3889 /// Description of the selected proto element (e.g. a message, a method, a
3890 /// 'service' definition, or a field). Defaults to leading & trailing comments
3891 /// taken from the proto source definition of the proto element.
3892 #[serde(skip_serializing_if = "std::string::String::is_empty")]
3893 pub description: std::string::String,
3894
3895 /// Deprecation description of the selected element(s). It can be provided if
3896 /// an element is marked as `deprecated`.
3897 #[serde(skip_serializing_if = "std::string::String::is_empty")]
3898 pub deprecation_description: std::string::String,
3899
3900 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
3901 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3902}
3903
3904impl DocumentationRule {
3905 pub fn new() -> Self {
3906 std::default::Default::default()
3907 }
3908
3909 /// Sets the value of [selector][crate::model::DocumentationRule::selector].
3910 pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3911 self.selector = v.into();
3912 self
3913 }
3914
3915 /// Sets the value of [description][crate::model::DocumentationRule::description].
3916 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3917 self.description = v.into();
3918 self
3919 }
3920
3921 /// Sets the value of [deprecation_description][crate::model::DocumentationRule::deprecation_description].
3922 pub fn set_deprecation_description<T: std::convert::Into<std::string::String>>(
3923 mut self,
3924 v: T,
3925 ) -> Self {
3926 self.deprecation_description = v.into();
3927 self
3928 }
3929}
3930
3931impl wkt::message::Message for DocumentationRule {
3932 fn typename() -> &'static str {
3933 "type.googleapis.com/google.api.DocumentationRule"
3934 }
3935}
3936
3937/// Represents a documentation page. A page can contain subpages to represent
3938/// nested documentation set structure.
3939#[serde_with::serde_as]
3940#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
3941#[serde(default, rename_all = "camelCase")]
3942#[non_exhaustive]
3943pub struct Page {
3944 /// The name of the page. It will be used as an identity of the page to
3945 /// generate URI of the page, text of the link to this page in navigation,
3946 /// etc. The full page name (start from the root page name to this page
3947 /// concatenated with `.`) can be used as reference to the page in your
3948 /// documentation. For example:
3949 ///
3950 /// You can reference `Java` page using Markdown reference link syntax:
3951 /// `[Java][Tutorial.Java]`.
3952 #[serde(skip_serializing_if = "std::string::String::is_empty")]
3953 pub name: std::string::String,
3954
3955 /// The Markdown content of the page. You can use ```(== include {path}
3956 /// ==)``` to include content from a Markdown file. The content can be used
3957 /// to produce the documentation page such as HTML format page.
3958 #[serde(skip_serializing_if = "std::string::String::is_empty")]
3959 pub content: std::string::String,
3960
3961 /// Subpages of this page. The order of subpages specified here will be
3962 /// honored in the generated docset.
3963 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
3964 pub subpages: std::vec::Vec<crate::model::Page>,
3965
3966 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
3967 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3968}
3969
3970impl Page {
3971 pub fn new() -> Self {
3972 std::default::Default::default()
3973 }
3974
3975 /// Sets the value of [name][crate::model::Page::name].
3976 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3977 self.name = v.into();
3978 self
3979 }
3980
3981 /// Sets the value of [content][crate::model::Page::content].
3982 pub fn set_content<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3983 self.content = v.into();
3984 self
3985 }
3986
3987 /// Sets the value of [subpages][crate::model::Page::subpages].
3988 pub fn set_subpages<T, V>(mut self, v: T) -> Self
3989 where
3990 T: std::iter::IntoIterator<Item = V>,
3991 V: std::convert::Into<crate::model::Page>,
3992 {
3993 use std::iter::Iterator;
3994 self.subpages = v.into_iter().map(|i| i.into()).collect();
3995 self
3996 }
3997}
3998
3999impl wkt::message::Message for Page {
4000 fn typename() -> &'static str {
4001 "type.googleapis.com/google.api.Page"
4002 }
4003}
4004
4005/// `Endpoint` describes a network address of a service that serves a set of
4006/// APIs. It is commonly known as a service endpoint. A service may expose
4007/// any number of service endpoints, and all service endpoints share the same
4008/// service definition, such as quota limits and monitoring metrics.
4009///
4010/// Example:
4011///
4012/// ```norust
4013/// type: google.api.Service
4014/// name: library-example.googleapis.com
4015/// endpoints:
4016/// # Declares network address `https://library-example.googleapis.com`
4017/// # for service `library-example.googleapis.com`. The `https` scheme
4018/// # is implicit for all service endpoints. Other schemes may be
4019/// # supported in the future.
4020/// - name: library-example.googleapis.com
4021/// allow_cors: false
4022/// - name: content-staging-library-example.googleapis.com
4023/// # Allows HTTP OPTIONS calls to be passed to the API frontend, for it
4024/// # to decide whether the subsequent cross-origin request is allowed
4025/// # to proceed.
4026/// allow_cors: true
4027/// ```
4028#[serde_with::serde_as]
4029#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
4030#[serde(default, rename_all = "camelCase")]
4031#[non_exhaustive]
4032pub struct Endpoint {
4033 /// The canonical name of this endpoint.
4034 #[serde(skip_serializing_if = "std::string::String::is_empty")]
4035 pub name: std::string::String,
4036
4037 /// Aliases for this endpoint, these will be served by the same UrlMap as the
4038 /// parent endpoint, and will be provisioned in the GCP stack for the Regional
4039 /// Endpoints.
4040 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
4041 pub aliases: std::vec::Vec<std::string::String>,
4042
4043 /// The specification of an Internet routable address of API frontend that will
4044 /// handle requests to this [API
4045 /// Endpoint](https://cloud.google.com/apis/design/glossary). It should be
4046 /// either a valid IPv4 address or a fully-qualified domain name. For example,
4047 /// "8.8.8.8" or "myservice.appspot.com".
4048 #[serde(skip_serializing_if = "std::string::String::is_empty")]
4049 pub target: std::string::String,
4050
4051 /// Allowing
4052 /// [CORS](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing), aka
4053 /// cross-domain traffic, would allow the backends served from this endpoint to
4054 /// receive and respond to HTTP OPTIONS requests. The response will be used by
4055 /// the browser to determine whether the subsequent cross-origin request is
4056 /// allowed to proceed.
4057 #[serde(skip_serializing_if = "wkt::internal::is_default")]
4058 pub allow_cors: bool,
4059
4060 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
4061 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4062}
4063
4064impl Endpoint {
4065 pub fn new() -> Self {
4066 std::default::Default::default()
4067 }
4068
4069 /// Sets the value of [name][crate::model::Endpoint::name].
4070 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4071 self.name = v.into();
4072 self
4073 }
4074
4075 /// Sets the value of [aliases][crate::model::Endpoint::aliases].
4076 pub fn set_aliases<T, V>(mut self, v: T) -> Self
4077 where
4078 T: std::iter::IntoIterator<Item = V>,
4079 V: std::convert::Into<std::string::String>,
4080 {
4081 use std::iter::Iterator;
4082 self.aliases = v.into_iter().map(|i| i.into()).collect();
4083 self
4084 }
4085
4086 /// Sets the value of [target][crate::model::Endpoint::target].
4087 pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4088 self.target = v.into();
4089 self
4090 }
4091
4092 /// Sets the value of [allow_cors][crate::model::Endpoint::allow_cors].
4093 pub fn set_allow_cors<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4094 self.allow_cors = v.into();
4095 self
4096 }
4097}
4098
4099impl wkt::message::Message for Endpoint {
4100 fn typename() -> &'static str {
4101 "type.googleapis.com/google.api.Endpoint"
4102 }
4103}
4104
4105/// Rich semantic information of an API field beyond basic typing.
4106#[serde_with::serde_as]
4107#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
4108#[serde(default, rename_all = "camelCase")]
4109#[non_exhaustive]
4110pub struct FieldInfo {
4111 /// The standard format of a field value. This does not explicitly configure
4112 /// any API consumer, just documents the API's format for the field it is
4113 /// applied to.
4114 pub format: crate::model::field_info::Format,
4115
4116 /// The type(s) that the annotated, generic field may represent.
4117 ///
4118 /// Currently, this must only be used on fields of type `google.protobuf.Any`.
4119 /// Supporting other generic types may be considered in the future.
4120 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
4121 pub referenced_types: std::vec::Vec<crate::model::TypeReference>,
4122
4123 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
4124 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4125}
4126
4127impl FieldInfo {
4128 pub fn new() -> Self {
4129 std::default::Default::default()
4130 }
4131
4132 /// Sets the value of [format][crate::model::FieldInfo::format].
4133 pub fn set_format<T: std::convert::Into<crate::model::field_info::Format>>(
4134 mut self,
4135 v: T,
4136 ) -> Self {
4137 self.format = v.into();
4138 self
4139 }
4140
4141 /// Sets the value of [referenced_types][crate::model::FieldInfo::referenced_types].
4142 pub fn set_referenced_types<T, V>(mut self, v: T) -> Self
4143 where
4144 T: std::iter::IntoIterator<Item = V>,
4145 V: std::convert::Into<crate::model::TypeReference>,
4146 {
4147 use std::iter::Iterator;
4148 self.referenced_types = v.into_iter().map(|i| i.into()).collect();
4149 self
4150 }
4151}
4152
4153impl wkt::message::Message for FieldInfo {
4154 fn typename() -> &'static str {
4155 "type.googleapis.com/google.api.FieldInfo"
4156 }
4157}
4158
4159/// Defines additional types related to [FieldInfo].
4160pub mod field_info {
4161 #[allow(unused_imports)]
4162 use super::*;
4163
4164 /// The standard format of a field value. The supported formats are all backed
4165 /// by either an RFC defined by the IETF or a Google-defined AIP.
4166 ///
4167 /// # Working with unknown values
4168 ///
4169 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4170 /// additional enum variants at any time. Adding new variants is not considered
4171 /// a breaking change. Applications should write their code in anticipation of:
4172 ///
4173 /// - New values appearing in future releases of the client library, **and**
4174 /// - New values received dynamically, without application changes.
4175 ///
4176 /// Please consult the [Working with enums] section in the user guide for some
4177 /// guidelines.
4178 ///
4179 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
4180 #[derive(Clone, Debug, PartialEq)]
4181 #[non_exhaustive]
4182 pub enum Format {
4183 /// Default, unspecified value.
4184 Unspecified,
4185 /// Universally Unique Identifier, version 4, value as defined by
4186 /// <https://datatracker.ietf.org/doc/html/rfc4122>. The value may be
4187 /// normalized to entirely lowercase letters. For example, the value
4188 /// `F47AC10B-58CC-0372-8567-0E02B2C3D479` would be normalized to
4189 /// `f47ac10b-58cc-0372-8567-0e02b2c3d479`.
4190 Uuid4,
4191 /// Internet Protocol v4 value as defined by [RFC
4192 /// 791](https://datatracker.ietf.org/doc/html/rfc791). The value may be
4193 /// condensed, with leading zeros in each octet stripped. For example,
4194 /// `001.022.233.040` would be condensed to `1.22.233.40`.
4195 Ipv4,
4196 /// Internet Protocol v6 value as defined by [RFC
4197 /// 2460](https://datatracker.ietf.org/doc/html/rfc2460). The value may be
4198 /// normalized to entirely lowercase letters with zeros compressed, following
4199 /// [RFC 5952](https://datatracker.ietf.org/doc/html/rfc5952). For example,
4200 /// the value `2001:0DB8:0::0` would be normalized to `2001:db8::`.
4201 Ipv6,
4202 /// An IP address in either v4 or v6 format as described by the individual
4203 /// values defined herein. See the comments on the IPV4 and IPV6 types for
4204 /// allowed normalizations of each.
4205 Ipv4OrIpv6,
4206 /// If set, the enum was initialized with an unknown value.
4207 ///
4208 /// Applications can examine the value using [Format::value] or
4209 /// [Format::name].
4210 UnknownValue(format::UnknownValue),
4211 }
4212
4213 #[doc(hidden)]
4214 pub mod format {
4215 #[allow(unused_imports)]
4216 use super::*;
4217 #[derive(Clone, Debug, PartialEq)]
4218 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4219 }
4220
4221 impl Format {
4222 /// Gets the enum value.
4223 ///
4224 /// Returns `None` if the enum contains an unknown value deserialized from
4225 /// the string representation of enums.
4226 pub fn value(&self) -> std::option::Option<i32> {
4227 match self {
4228 Self::Unspecified => std::option::Option::Some(0),
4229 Self::Uuid4 => std::option::Option::Some(1),
4230 Self::Ipv4 => std::option::Option::Some(2),
4231 Self::Ipv6 => std::option::Option::Some(3),
4232 Self::Ipv4OrIpv6 => std::option::Option::Some(4),
4233 Self::UnknownValue(u) => u.0.value(),
4234 }
4235 }
4236
4237 /// Gets the enum value as a string.
4238 ///
4239 /// Returns `None` if the enum contains an unknown value deserialized from
4240 /// the integer representation of enums.
4241 pub fn name(&self) -> std::option::Option<&str> {
4242 match self {
4243 Self::Unspecified => std::option::Option::Some("FORMAT_UNSPECIFIED"),
4244 Self::Uuid4 => std::option::Option::Some("UUID4"),
4245 Self::Ipv4 => std::option::Option::Some("IPV4"),
4246 Self::Ipv6 => std::option::Option::Some("IPV6"),
4247 Self::Ipv4OrIpv6 => std::option::Option::Some("IPV4_OR_IPV6"),
4248 Self::UnknownValue(u) => u.0.name(),
4249 }
4250 }
4251 }
4252
4253 impl std::default::Default for Format {
4254 fn default() -> Self {
4255 use std::convert::From;
4256 Self::from(0)
4257 }
4258 }
4259
4260 impl std::fmt::Display for Format {
4261 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4262 wkt::internal::display_enum(f, self.name(), self.value())
4263 }
4264 }
4265
4266 impl std::convert::From<i32> for Format {
4267 fn from(value: i32) -> Self {
4268 match value {
4269 0 => Self::Unspecified,
4270 1 => Self::Uuid4,
4271 2 => Self::Ipv4,
4272 3 => Self::Ipv6,
4273 4 => Self::Ipv4OrIpv6,
4274 _ => Self::UnknownValue(format::UnknownValue(
4275 wkt::internal::UnknownEnumValue::Integer(value),
4276 )),
4277 }
4278 }
4279 }
4280
4281 impl std::convert::From<&str> for Format {
4282 fn from(value: &str) -> Self {
4283 use std::string::ToString;
4284 match value {
4285 "FORMAT_UNSPECIFIED" => Self::Unspecified,
4286 "UUID4" => Self::Uuid4,
4287 "IPV4" => Self::Ipv4,
4288 "IPV6" => Self::Ipv6,
4289 "IPV4_OR_IPV6" => Self::Ipv4OrIpv6,
4290 _ => Self::UnknownValue(format::UnknownValue(
4291 wkt::internal::UnknownEnumValue::String(value.to_string()),
4292 )),
4293 }
4294 }
4295 }
4296
4297 impl serde::ser::Serialize for Format {
4298 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4299 where
4300 S: serde::Serializer,
4301 {
4302 match self {
4303 Self::Unspecified => serializer.serialize_i32(0),
4304 Self::Uuid4 => serializer.serialize_i32(1),
4305 Self::Ipv4 => serializer.serialize_i32(2),
4306 Self::Ipv6 => serializer.serialize_i32(3),
4307 Self::Ipv4OrIpv6 => serializer.serialize_i32(4),
4308 Self::UnknownValue(u) => u.0.serialize(serializer),
4309 }
4310 }
4311 }
4312
4313 impl<'de> serde::de::Deserialize<'de> for Format {
4314 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4315 where
4316 D: serde::Deserializer<'de>,
4317 {
4318 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Format>::new(
4319 ".google.api.FieldInfo.Format",
4320 ))
4321 }
4322 }
4323}
4324
4325/// A reference to a message type, for use in [FieldInfo][google.api.FieldInfo].
4326///
4327/// [google.api.FieldInfo]: crate::model::FieldInfo
4328#[serde_with::serde_as]
4329#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
4330#[serde(default, rename_all = "camelCase")]
4331#[non_exhaustive]
4332pub struct TypeReference {
4333 /// The name of the type that the annotated, generic field may represent.
4334 /// If the type is in the same protobuf package, the value can be the simple
4335 /// message name e.g., `"MyMessage"`. Otherwise, the value must be the
4336 /// fully-qualified message name e.g., `"google.library.v1.Book"`.
4337 ///
4338 /// If the type(s) are unknown to the service (e.g. the field accepts generic
4339 /// user input), use the wildcard `"*"` to denote this behavior.
4340 ///
4341 /// See [AIP-202](https://google.aip.dev/202#type-references) for more details.
4342 #[serde(skip_serializing_if = "std::string::String::is_empty")]
4343 pub type_name: std::string::String,
4344
4345 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
4346 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4347}
4348
4349impl TypeReference {
4350 pub fn new() -> Self {
4351 std::default::Default::default()
4352 }
4353
4354 /// Sets the value of [type_name][crate::model::TypeReference::type_name].
4355 pub fn set_type_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4356 self.type_name = v.into();
4357 self
4358 }
4359}
4360
4361impl wkt::message::Message for TypeReference {
4362 fn typename() -> &'static str {
4363 "type.googleapis.com/google.api.TypeReference"
4364 }
4365}
4366
4367/// Defines the HTTP configuration for an API service. It contains a list of
4368/// [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method
4369/// to one or more HTTP REST API methods.
4370///
4371/// [google.api.HttpRule]: crate::model::HttpRule
4372#[serde_with::serde_as]
4373#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
4374#[serde(default, rename_all = "camelCase")]
4375#[non_exhaustive]
4376pub struct Http {
4377 /// A list of HTTP configuration rules that apply to individual API methods.
4378 ///
4379 /// **NOTE:** All service configuration rules follow "last one wins" order.
4380 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
4381 pub rules: std::vec::Vec<crate::model::HttpRule>,
4382
4383 /// When set to true, URL path parameters will be fully URI-decoded except in
4384 /// cases of single segment matches in reserved expansion, where "%2F" will be
4385 /// left encoded.
4386 ///
4387 /// The default behavior is to not decode RFC 6570 reserved characters in multi
4388 /// segment matches.
4389 #[serde(skip_serializing_if = "wkt::internal::is_default")]
4390 pub fully_decode_reserved_expansion: bool,
4391
4392 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
4393 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4394}
4395
4396impl Http {
4397 pub fn new() -> Self {
4398 std::default::Default::default()
4399 }
4400
4401 /// Sets the value of [rules][crate::model::Http::rules].
4402 pub fn set_rules<T, V>(mut self, v: T) -> Self
4403 where
4404 T: std::iter::IntoIterator<Item = V>,
4405 V: std::convert::Into<crate::model::HttpRule>,
4406 {
4407 use std::iter::Iterator;
4408 self.rules = v.into_iter().map(|i| i.into()).collect();
4409 self
4410 }
4411
4412 /// Sets the value of [fully_decode_reserved_expansion][crate::model::Http::fully_decode_reserved_expansion].
4413 pub fn set_fully_decode_reserved_expansion<T: std::convert::Into<bool>>(
4414 mut self,
4415 v: T,
4416 ) -> Self {
4417 self.fully_decode_reserved_expansion = v.into();
4418 self
4419 }
4420}
4421
4422impl wkt::message::Message for Http {
4423 fn typename() -> &'static str {
4424 "type.googleapis.com/google.api.Http"
4425 }
4426}
4427
4428/// gRPC Transcoding
4429///
4430/// gRPC Transcoding is a feature for mapping between a gRPC method and one or
4431/// more HTTP REST endpoints. It allows developers to build a single API service
4432/// that supports both gRPC APIs and REST APIs. Many systems, including [Google
4433/// APIs](https://github.com/googleapis/googleapis),
4434/// [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC
4435/// Gateway](https://github.com/grpc-ecosystem/grpc-gateway),
4436/// and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature
4437/// and use it for large scale production services.
4438///
4439/// `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies
4440/// how different portions of the gRPC request message are mapped to the URL
4441/// path, URL query parameters, and HTTP request body. It also controls how the
4442/// gRPC response message is mapped to the HTTP response body. `HttpRule` is
4443/// typically specified as an `google.api.http` annotation on the gRPC method.
4444///
4445/// Each mapping specifies a URL path template and an HTTP method. The path
4446/// template may refer to one or more fields in the gRPC request message, as long
4447/// as each field is a non-repeated field with a primitive (non-message) type.
4448/// The path template controls how fields of the request message are mapped to
4449/// the URL path.
4450///
4451/// Example:
4452///
4453/// ```norust
4454/// service Messaging {
4455/// rpc GetMessage(GetMessageRequest) returns (Message) {
4456/// option (google.api.http) = {
4457/// get: "/v1/{name=messages/*}"
4458/// };
4459/// }
4460/// }
4461/// message GetMessageRequest {
4462/// string name = 1; // Mapped to URL path.
4463/// }
4464/// message Message {
4465/// string text = 1; // The resource content.
4466/// }
4467/// ```
4468///
4469/// This enables an HTTP REST to gRPC mapping as below:
4470///
4471/// - HTTP: `GET /v1/messages/123456`
4472/// - gRPC: `GetMessage(name: "messages/123456")`
4473///
4474/// Any fields in the request message which are not bound by the path template
4475/// automatically become HTTP query parameters if there is no HTTP request body.
4476/// For example:
4477///
4478/// ```norust
4479/// service Messaging {
4480/// rpc GetMessage(GetMessageRequest) returns (Message) {
4481/// option (google.api.http) = {
4482/// get:"/v1/messages/{message_id}"
4483/// };
4484/// }
4485/// }
4486/// message GetMessageRequest {
4487/// message SubMessage {
4488/// string subfield = 1;
4489/// }
4490/// string message_id = 1; // Mapped to URL path.
4491/// int64 revision = 2; // Mapped to URL query parameter `revision`.
4492/// SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`.
4493/// }
4494/// ```
4495///
4496/// This enables a HTTP JSON to RPC mapping as below:
4497///
4498/// - HTTP: `GET /v1/messages/123456?revision=2&sub.subfield=foo`
4499/// - gRPC: `GetMessage(message_id: "123456" revision: 2 sub:
4500/// SubMessage(subfield: "foo"))`
4501///
4502/// Note that fields which are mapped to URL query parameters must have a
4503/// primitive type or a repeated primitive type or a non-repeated message type.
4504/// In the case of a repeated type, the parameter can be repeated in the URL
4505/// as `...?param=A¶m=B`. In the case of a message type, each field of the
4506/// message is mapped to a separate parameter, such as
4507/// `...?foo.a=A&foo.b=B&foo.c=C`.
4508///
4509/// For HTTP methods that allow a request body, the `body` field
4510/// specifies the mapping. Consider a REST update method on the
4511/// message resource collection:
4512///
4513/// ```norust
4514/// service Messaging {
4515/// rpc UpdateMessage(UpdateMessageRequest) returns (Message) {
4516/// option (google.api.http) = {
4517/// patch: "/v1/messages/{message_id}"
4518/// body: "message"
4519/// };
4520/// }
4521/// }
4522/// message UpdateMessageRequest {
4523/// string message_id = 1; // mapped to the URL
4524/// Message message = 2; // mapped to the body
4525/// }
4526/// ```
4527///
4528/// The following HTTP JSON to RPC mapping is enabled, where the
4529/// representation of the JSON in the request body is determined by
4530/// protos JSON encoding:
4531///
4532/// - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }`
4533/// - gRPC: `UpdateMessage(message_id: "123456" message { text: "Hi!" })`
4534///
4535/// The special name `*` can be used in the body mapping to define that
4536/// every field not bound by the path template should be mapped to the
4537/// request body. This enables the following alternative definition of
4538/// the update method:
4539///
4540/// ```norust
4541/// service Messaging {
4542/// rpc UpdateMessage(Message) returns (Message) {
4543/// option (google.api.http) = {
4544/// patch: "/v1/messages/{message_id}"
4545/// body: "*"
4546/// };
4547/// }
4548/// }
4549/// message Message {
4550/// string message_id = 1;
4551/// string text = 2;
4552/// }
4553/// ```
4554///
4555/// The following HTTP JSON to RPC mapping is enabled:
4556///
4557/// - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }`
4558/// - gRPC: `UpdateMessage(message_id: "123456" text: "Hi!")`
4559///
4560/// Note that when using `*` in the body mapping, it is not possible to
4561/// have HTTP parameters, as all fields not bound by the path end in
4562/// the body. This makes this option more rarely used in practice when
4563/// defining REST APIs. The common usage of `*` is in custom methods
4564/// which don't use the URL at all for transferring data.
4565///
4566/// It is possible to define multiple HTTP methods for one RPC by using
4567/// the `additional_bindings` option. Example:
4568///
4569/// ```norust
4570/// service Messaging {
4571/// rpc GetMessage(GetMessageRequest) returns (Message) {
4572/// option (google.api.http) = {
4573/// get: "/v1/messages/{message_id}"
4574/// additional_bindings {
4575/// get: "/v1/users/{user_id}/messages/{message_id}"
4576/// }
4577/// };
4578/// }
4579/// }
4580/// message GetMessageRequest {
4581/// string message_id = 1;
4582/// string user_id = 2;
4583/// }
4584/// ```
4585///
4586/// This enables the following two alternative HTTP JSON to RPC mappings:
4587///
4588/// - HTTP: `GET /v1/messages/123456`
4589///
4590/// - gRPC: `GetMessage(message_id: "123456")`
4591///
4592/// - HTTP: `GET /v1/users/me/messages/123456`
4593///
4594/// - gRPC: `GetMessage(user_id: "me" message_id: "123456")`
4595///
4596///
4597/// Rules for HTTP mapping
4598///
4599/// . Leaf request fields (recursive expansion nested messages in the request
4600/// message) are classified into three categories:
4601/// - Fields referred by the path template. They are passed via the URL path.
4602/// - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They
4603/// are passed via the HTTP
4604/// request body.
4605/// - All other fields are passed via the URL query parameters, and the
4606/// parameter name is the field path in the request message. A repeated
4607/// field can be represented as multiple query parameters under the same
4608/// name.
4609/// . If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL
4610/// query parameter, all fields
4611/// are passed via URL path and HTTP request body.
4612/// . If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP
4613/// request body, all
4614/// fields are passed via URL path and URL query parameters.
4615///
4616/// Path template syntax
4617///
4618/// ```norust
4619/// Template = "/" Segments [ Verb ] ;
4620/// Segments = Segment { "/" Segment } ;
4621/// Segment = "*" | "**" | LITERAL | Variable ;
4622/// Variable = "{" FieldPath [ "=" Segments ] "}" ;
4623/// FieldPath = IDENT { "." IDENT } ;
4624/// Verb = ":" LITERAL ;
4625/// ```
4626///
4627/// The syntax `*` matches a single URL path segment. The syntax `**` matches
4628/// zero or more URL path segments, which must be the last part of the URL path
4629/// except the `Verb`.
4630///
4631/// The syntax `Variable` matches part of the URL path as specified by its
4632/// template. A variable template must not contain other variables. If a variable
4633/// matches a single path segment, its template may be omitted, e.g. `{var}`
4634/// is equivalent to `{var=*}`.
4635///
4636/// The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL`
4637/// contains any reserved character, such characters should be percent-encoded
4638/// before the matching.
4639///
4640/// If a variable contains exactly one path segment, such as `"{var}"` or
4641/// `"{var=*}"`, when such a variable is expanded into a URL path on the client
4642/// side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The
4643/// server side does the reverse decoding. Such variables show up in the
4644/// [Discovery
4645/// Document](https://developers.google.com/discovery/v1/reference/apis) as
4646/// `{var}`.
4647///
4648/// If a variable contains multiple path segments, such as `"{var=foo/*}"`
4649/// or `"{var=**}"`, when such a variable is expanded into a URL path on the
4650/// client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded.
4651/// The server side does the reverse decoding, except "%2F" and "%2f" are left
4652/// unchanged. Such variables show up in the
4653/// [Discovery
4654/// Document](https://developers.google.com/discovery/v1/reference/apis) as
4655/// `{+var}`.
4656///
4657/// Using gRPC API Service Configuration
4658///
4659/// gRPC API Service Configuration (service config) is a configuration language
4660/// for configuring a gRPC service to become a user-facing product. The
4661/// service config is simply the YAML representation of the `google.api.Service`
4662/// proto message.
4663///
4664/// As an alternative to annotating your proto file, you can configure gRPC
4665/// transcoding in your service config YAML files. You do this by specifying a
4666/// `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same
4667/// effect as the proto annotation. This can be particularly useful if you
4668/// have a proto that is reused in multiple services. Note that any transcoding
4669/// specified in the service config will override any matching transcoding
4670/// configuration in the proto.
4671///
4672/// The following example selects a gRPC method and applies an `HttpRule` to it:
4673///
4674/// ```norust
4675/// http:
4676/// rules:
4677/// - selector: example.v1.Messaging.GetMessage
4678/// get: /v1/messages/{message_id}/{sub.subfield}
4679/// ```
4680///
4681/// Special notes
4682///
4683/// When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the
4684/// proto to JSON conversion must follow the [proto3
4685/// specification](https://developers.google.com/protocol-buffers/docs/proto3#json).
4686///
4687/// While the single segment variable follows the semantics of
4688/// [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String
4689/// Expansion, the multi segment variable **does not** follow RFC 6570 Section
4690/// 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion
4691/// does not expand special characters like `?` and `#`, which would lead
4692/// to invalid URLs. As the result, gRPC Transcoding uses a custom encoding
4693/// for multi segment variables.
4694///
4695/// The path variables **must not** refer to any repeated or mapped field,
4696/// because client libraries are not capable of handling such variable expansion.
4697///
4698/// The path variables **must not** capture the leading "/" character. The reason
4699/// is that the most common use case "{var}" does not capture the leading "/"
4700/// character. For consistency, all path variables must share the same behavior.
4701///
4702/// Repeated message fields must not be mapped to URL query parameters, because
4703/// no client library can support such complicated mapping.
4704///
4705/// If an API needs to use a JSON array for request or response body, it can map
4706/// the request or response body to a repeated field. However, some gRPC
4707/// Transcoding implementations may not support this feature.
4708///
4709/// [google.api.HttpRule.body]: crate::model::HttpRule::body
4710#[serde_with::serde_as]
4711#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
4712#[serde(default, rename_all = "camelCase")]
4713#[non_exhaustive]
4714pub struct HttpRule {
4715 /// Selects a method to which this rule applies.
4716 ///
4717 /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
4718 /// details.
4719 ///
4720 /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
4721 #[serde(skip_serializing_if = "std::string::String::is_empty")]
4722 pub selector: std::string::String,
4723
4724 /// The name of the request field whose value is mapped to the HTTP request
4725 /// body, or `*` for mapping all request fields not captured by the path
4726 /// pattern to the HTTP body, or omitted for not having any HTTP request body.
4727 ///
4728 /// NOTE: the referred field must be present at the top-level of the request
4729 /// message type.
4730 #[serde(skip_serializing_if = "std::string::String::is_empty")]
4731 pub body: std::string::String,
4732
4733 /// Optional. The name of the response field whose value is mapped to the HTTP
4734 /// response body. When omitted, the entire response message will be used
4735 /// as the HTTP response body.
4736 ///
4737 /// NOTE: The referred field must be present at the top-level of the response
4738 /// message type.
4739 #[serde(skip_serializing_if = "std::string::String::is_empty")]
4740 pub response_body: std::string::String,
4741
4742 /// Additional HTTP bindings for the selector. Nested bindings must
4743 /// not contain an `additional_bindings` field themselves (that is,
4744 /// the nesting may only be one level deep).
4745 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
4746 pub additional_bindings: std::vec::Vec<crate::model::HttpRule>,
4747
4748 /// Determines the URL pattern is matched by this rules. This pattern can be
4749 /// used with any of the {get|put|post|delete|patch} methods. A custom method
4750 /// can be defined using the 'custom' field.
4751 #[serde(flatten, skip_serializing_if = "std::option::Option::is_none")]
4752 pub pattern: std::option::Option<crate::model::http_rule::Pattern>,
4753
4754 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
4755 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4756}
4757
4758impl HttpRule {
4759 pub fn new() -> Self {
4760 std::default::Default::default()
4761 }
4762
4763 /// Sets the value of [selector][crate::model::HttpRule::selector].
4764 pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4765 self.selector = v.into();
4766 self
4767 }
4768
4769 /// Sets the value of [body][crate::model::HttpRule::body].
4770 pub fn set_body<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4771 self.body = v.into();
4772 self
4773 }
4774
4775 /// Sets the value of [response_body][crate::model::HttpRule::response_body].
4776 pub fn set_response_body<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4777 self.response_body = v.into();
4778 self
4779 }
4780
4781 /// Sets the value of [additional_bindings][crate::model::HttpRule::additional_bindings].
4782 pub fn set_additional_bindings<T, V>(mut self, v: T) -> Self
4783 where
4784 T: std::iter::IntoIterator<Item = V>,
4785 V: std::convert::Into<crate::model::HttpRule>,
4786 {
4787 use std::iter::Iterator;
4788 self.additional_bindings = v.into_iter().map(|i| i.into()).collect();
4789 self
4790 }
4791
4792 /// Sets the value of [pattern][crate::model::HttpRule::pattern].
4793 ///
4794 /// Note that all the setters affecting `pattern` are mutually
4795 /// exclusive.
4796 pub fn set_pattern<
4797 T: std::convert::Into<std::option::Option<crate::model::http_rule::Pattern>>,
4798 >(
4799 mut self,
4800 v: T,
4801 ) -> Self {
4802 self.pattern = v.into();
4803 self
4804 }
4805
4806 /// The value of [pattern][crate::model::HttpRule::pattern]
4807 /// if it holds a `Get`, `None` if the field is not set or
4808 /// holds a different branch.
4809 pub fn get(&self) -> std::option::Option<&std::string::String> {
4810 #[allow(unreachable_patterns)]
4811 self.pattern.as_ref().and_then(|v| match v {
4812 crate::model::http_rule::Pattern::Get(v) => std::option::Option::Some(v),
4813 _ => std::option::Option::None,
4814 })
4815 }
4816
4817 /// Sets the value of [pattern][crate::model::HttpRule::pattern]
4818 /// to hold a `Get`.
4819 ///
4820 /// Note that all the setters affecting `pattern` are
4821 /// mutually exclusive.
4822 pub fn set_get<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4823 self.pattern = std::option::Option::Some(crate::model::http_rule::Pattern::Get(v.into()));
4824 self
4825 }
4826
4827 /// The value of [pattern][crate::model::HttpRule::pattern]
4828 /// if it holds a `Put`, `None` if the field is not set or
4829 /// holds a different branch.
4830 pub fn put(&self) -> std::option::Option<&std::string::String> {
4831 #[allow(unreachable_patterns)]
4832 self.pattern.as_ref().and_then(|v| match v {
4833 crate::model::http_rule::Pattern::Put(v) => std::option::Option::Some(v),
4834 _ => std::option::Option::None,
4835 })
4836 }
4837
4838 /// Sets the value of [pattern][crate::model::HttpRule::pattern]
4839 /// to hold a `Put`.
4840 ///
4841 /// Note that all the setters affecting `pattern` are
4842 /// mutually exclusive.
4843 pub fn set_put<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4844 self.pattern = std::option::Option::Some(crate::model::http_rule::Pattern::Put(v.into()));
4845 self
4846 }
4847
4848 /// The value of [pattern][crate::model::HttpRule::pattern]
4849 /// if it holds a `Post`, `None` if the field is not set or
4850 /// holds a different branch.
4851 pub fn post(&self) -> std::option::Option<&std::string::String> {
4852 #[allow(unreachable_patterns)]
4853 self.pattern.as_ref().and_then(|v| match v {
4854 crate::model::http_rule::Pattern::Post(v) => std::option::Option::Some(v),
4855 _ => std::option::Option::None,
4856 })
4857 }
4858
4859 /// Sets the value of [pattern][crate::model::HttpRule::pattern]
4860 /// to hold a `Post`.
4861 ///
4862 /// Note that all the setters affecting `pattern` are
4863 /// mutually exclusive.
4864 pub fn set_post<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4865 self.pattern = std::option::Option::Some(crate::model::http_rule::Pattern::Post(v.into()));
4866 self
4867 }
4868
4869 /// The value of [pattern][crate::model::HttpRule::pattern]
4870 /// if it holds a `Delete`, `None` if the field is not set or
4871 /// holds a different branch.
4872 pub fn delete(&self) -> std::option::Option<&std::string::String> {
4873 #[allow(unreachable_patterns)]
4874 self.pattern.as_ref().and_then(|v| match v {
4875 crate::model::http_rule::Pattern::Delete(v) => std::option::Option::Some(v),
4876 _ => std::option::Option::None,
4877 })
4878 }
4879
4880 /// Sets the value of [pattern][crate::model::HttpRule::pattern]
4881 /// to hold a `Delete`.
4882 ///
4883 /// Note that all the setters affecting `pattern` are
4884 /// mutually exclusive.
4885 pub fn set_delete<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4886 self.pattern =
4887 std::option::Option::Some(crate::model::http_rule::Pattern::Delete(v.into()));
4888 self
4889 }
4890
4891 /// The value of [pattern][crate::model::HttpRule::pattern]
4892 /// if it holds a `Patch`, `None` if the field is not set or
4893 /// holds a different branch.
4894 pub fn patch(&self) -> std::option::Option<&std::string::String> {
4895 #[allow(unreachable_patterns)]
4896 self.pattern.as_ref().and_then(|v| match v {
4897 crate::model::http_rule::Pattern::Patch(v) => std::option::Option::Some(v),
4898 _ => std::option::Option::None,
4899 })
4900 }
4901
4902 /// Sets the value of [pattern][crate::model::HttpRule::pattern]
4903 /// to hold a `Patch`.
4904 ///
4905 /// Note that all the setters affecting `pattern` are
4906 /// mutually exclusive.
4907 pub fn set_patch<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4908 self.pattern = std::option::Option::Some(crate::model::http_rule::Pattern::Patch(v.into()));
4909 self
4910 }
4911
4912 /// The value of [pattern][crate::model::HttpRule::pattern]
4913 /// if it holds a `Custom`, `None` if the field is not set or
4914 /// holds a different branch.
4915 pub fn custom(&self) -> std::option::Option<&std::boxed::Box<crate::model::CustomHttpPattern>> {
4916 #[allow(unreachable_patterns)]
4917 self.pattern.as_ref().and_then(|v| match v {
4918 crate::model::http_rule::Pattern::Custom(v) => std::option::Option::Some(v),
4919 _ => std::option::Option::None,
4920 })
4921 }
4922
4923 /// Sets the value of [pattern][crate::model::HttpRule::pattern]
4924 /// to hold a `Custom`.
4925 ///
4926 /// Note that all the setters affecting `pattern` are
4927 /// mutually exclusive.
4928 pub fn set_custom<T: std::convert::Into<std::boxed::Box<crate::model::CustomHttpPattern>>>(
4929 mut self,
4930 v: T,
4931 ) -> Self {
4932 self.pattern =
4933 std::option::Option::Some(crate::model::http_rule::Pattern::Custom(v.into()));
4934 self
4935 }
4936}
4937
4938impl wkt::message::Message for HttpRule {
4939 fn typename() -> &'static str {
4940 "type.googleapis.com/google.api.HttpRule"
4941 }
4942}
4943
4944/// Defines additional types related to [HttpRule].
4945pub mod http_rule {
4946 #[allow(unused_imports)]
4947 use super::*;
4948
4949 /// Determines the URL pattern is matched by this rules. This pattern can be
4950 /// used with any of the {get|put|post|delete|patch} methods. A custom method
4951 /// can be defined using the 'custom' field.
4952 #[serde_with::serde_as]
4953 #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
4954 #[serde(rename_all = "camelCase")]
4955 #[non_exhaustive]
4956 pub enum Pattern {
4957 /// Maps to HTTP GET. Used for listing and getting information about
4958 /// resources.
4959 Get(std::string::String),
4960 /// Maps to HTTP PUT. Used for replacing a resource.
4961 Put(std::string::String),
4962 /// Maps to HTTP POST. Used for creating a resource or performing an action.
4963 Post(std::string::String),
4964 /// Maps to HTTP DELETE. Used for deleting a resource.
4965 Delete(std::string::String),
4966 /// Maps to HTTP PATCH. Used for updating a resource.
4967 Patch(std::string::String),
4968 /// The custom pattern is used for specifying an HTTP method that is not
4969 /// included in the `pattern` field, such as HEAD, or "*" to leave the
4970 /// HTTP method unspecified for this rule. The wild-card rule is useful
4971 /// for services that provide content to Web (HTML) clients.
4972 Custom(std::boxed::Box<crate::model::CustomHttpPattern>),
4973 }
4974}
4975
4976/// A custom pattern is used for defining custom HTTP verb.
4977#[serde_with::serde_as]
4978#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
4979#[serde(default, rename_all = "camelCase")]
4980#[non_exhaustive]
4981pub struct CustomHttpPattern {
4982 /// The name of this custom HTTP verb.
4983 #[serde(skip_serializing_if = "std::string::String::is_empty")]
4984 pub kind: std::string::String,
4985
4986 /// The path matched by this custom verb.
4987 #[serde(skip_serializing_if = "std::string::String::is_empty")]
4988 pub path: std::string::String,
4989
4990 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
4991 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4992}
4993
4994impl CustomHttpPattern {
4995 pub fn new() -> Self {
4996 std::default::Default::default()
4997 }
4998
4999 /// Sets the value of [kind][crate::model::CustomHttpPattern::kind].
5000 pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5001 self.kind = v.into();
5002 self
5003 }
5004
5005 /// Sets the value of [path][crate::model::CustomHttpPattern::path].
5006 pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5007 self.path = v.into();
5008 self
5009 }
5010}
5011
5012impl wkt::message::Message for CustomHttpPattern {
5013 fn typename() -> &'static str {
5014 "type.googleapis.com/google.api.CustomHttpPattern"
5015 }
5016}
5017
5018/// Message that represents an arbitrary HTTP body. It should only be used for
5019/// payload formats that can't be represented as JSON, such as raw binary or
5020/// an HTML page.
5021///
5022/// This message can be used both in streaming and non-streaming API methods in
5023/// the request as well as the response.
5024///
5025/// It can be used as a top-level request field, which is convenient if one
5026/// wants to extract parameters from either the URL or HTTP template into the
5027/// request fields and also want access to the raw HTTP body.
5028///
5029/// Example:
5030///
5031/// ```norust
5032/// message GetResourceRequest {
5033/// // A unique request id.
5034/// string request_id = 1;
5035///
5036/// // The raw HTTP body is bound to this field.
5037/// google.api.HttpBody http_body = 2;
5038///
5039/// }
5040///
5041/// service ResourceService {
5042/// rpc GetResource(GetResourceRequest)
5043/// returns (google.api.HttpBody);
5044/// rpc UpdateResource(google.api.HttpBody)
5045/// returns (google.protobuf.Empty);
5046///
5047/// }
5048/// ```
5049///
5050/// Example with streaming methods:
5051///
5052/// ```norust
5053/// service CaldavService {
5054/// rpc GetCalendar(stream google.api.HttpBody)
5055/// returns (stream google.api.HttpBody);
5056/// rpc UpdateCalendar(stream google.api.HttpBody)
5057/// returns (stream google.api.HttpBody);
5058///
5059/// }
5060/// ```
5061///
5062/// Use of this type only changes how the request and response bodies are
5063/// handled, all other features will continue to work unchanged.
5064#[serde_with::serde_as]
5065#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
5066#[serde(default, rename_all = "camelCase")]
5067#[non_exhaustive]
5068pub struct HttpBody {
5069 /// The HTTP Content-Type header value specifying the content type of the body.
5070 #[serde(skip_serializing_if = "std::string::String::is_empty")]
5071 pub content_type: std::string::String,
5072
5073 /// The HTTP request/response body as raw binary.
5074 #[serde(skip_serializing_if = "::bytes::Bytes::is_empty")]
5075 #[serde_as(as = "serde_with::base64::Base64")]
5076 pub data: ::bytes::Bytes,
5077
5078 /// Application specific response metadata. Must be set in the first response
5079 /// for streaming APIs.
5080 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
5081 pub extensions: std::vec::Vec<wkt::Any>,
5082
5083 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
5084 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5085}
5086
5087impl HttpBody {
5088 pub fn new() -> Self {
5089 std::default::Default::default()
5090 }
5091
5092 /// Sets the value of [content_type][crate::model::HttpBody::content_type].
5093 pub fn set_content_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5094 self.content_type = v.into();
5095 self
5096 }
5097
5098 /// Sets the value of [data][crate::model::HttpBody::data].
5099 pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
5100 self.data = v.into();
5101 self
5102 }
5103
5104 /// Sets the value of [extensions][crate::model::HttpBody::extensions].
5105 pub fn set_extensions<T, V>(mut self, v: T) -> Self
5106 where
5107 T: std::iter::IntoIterator<Item = V>,
5108 V: std::convert::Into<wkt::Any>,
5109 {
5110 use std::iter::Iterator;
5111 self.extensions = v.into_iter().map(|i| i.into()).collect();
5112 self
5113 }
5114}
5115
5116impl wkt::message::Message for HttpBody {
5117 fn typename() -> &'static str {
5118 "type.googleapis.com/google.api.HttpBody"
5119 }
5120}
5121
5122/// A description of a label.
5123#[serde_with::serde_as]
5124#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
5125#[serde(default, rename_all = "camelCase")]
5126#[non_exhaustive]
5127pub struct LabelDescriptor {
5128 /// The label key.
5129 #[serde(skip_serializing_if = "std::string::String::is_empty")]
5130 pub key: std::string::String,
5131
5132 /// The type of data that can be assigned to the label.
5133 pub value_type: crate::model::label_descriptor::ValueType,
5134
5135 /// A human-readable description for the label.
5136 #[serde(skip_serializing_if = "std::string::String::is_empty")]
5137 pub description: std::string::String,
5138
5139 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
5140 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5141}
5142
5143impl LabelDescriptor {
5144 pub fn new() -> Self {
5145 std::default::Default::default()
5146 }
5147
5148 /// Sets the value of [key][crate::model::LabelDescriptor::key].
5149 pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5150 self.key = v.into();
5151 self
5152 }
5153
5154 /// Sets the value of [value_type][crate::model::LabelDescriptor::value_type].
5155 pub fn set_value_type<T: std::convert::Into<crate::model::label_descriptor::ValueType>>(
5156 mut self,
5157 v: T,
5158 ) -> Self {
5159 self.value_type = v.into();
5160 self
5161 }
5162
5163 /// Sets the value of [description][crate::model::LabelDescriptor::description].
5164 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5165 self.description = v.into();
5166 self
5167 }
5168}
5169
5170impl wkt::message::Message for LabelDescriptor {
5171 fn typename() -> &'static str {
5172 "type.googleapis.com/google.api.LabelDescriptor"
5173 }
5174}
5175
5176/// Defines additional types related to [LabelDescriptor].
5177pub mod label_descriptor {
5178 #[allow(unused_imports)]
5179 use super::*;
5180
5181 /// Value types that can be used as label values.
5182 ///
5183 /// # Working with unknown values
5184 ///
5185 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5186 /// additional enum variants at any time. Adding new variants is not considered
5187 /// a breaking change. Applications should write their code in anticipation of:
5188 ///
5189 /// - New values appearing in future releases of the client library, **and**
5190 /// - New values received dynamically, without application changes.
5191 ///
5192 /// Please consult the [Working with enums] section in the user guide for some
5193 /// guidelines.
5194 ///
5195 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
5196 #[derive(Clone, Debug, PartialEq)]
5197 #[non_exhaustive]
5198 pub enum ValueType {
5199 /// A variable-length string. This is the default.
5200 String,
5201 /// Boolean; true or false.
5202 Bool,
5203 /// A 64-bit signed integer.
5204 Int64,
5205 /// If set, the enum was initialized with an unknown value.
5206 ///
5207 /// Applications can examine the value using [ValueType::value] or
5208 /// [ValueType::name].
5209 UnknownValue(value_type::UnknownValue),
5210 }
5211
5212 #[doc(hidden)]
5213 pub mod value_type {
5214 #[allow(unused_imports)]
5215 use super::*;
5216 #[derive(Clone, Debug, PartialEq)]
5217 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5218 }
5219
5220 impl ValueType {
5221 /// Gets the enum value.
5222 ///
5223 /// Returns `None` if the enum contains an unknown value deserialized from
5224 /// the string representation of enums.
5225 pub fn value(&self) -> std::option::Option<i32> {
5226 match self {
5227 Self::String => std::option::Option::Some(0),
5228 Self::Bool => std::option::Option::Some(1),
5229 Self::Int64 => std::option::Option::Some(2),
5230 Self::UnknownValue(u) => u.0.value(),
5231 }
5232 }
5233
5234 /// Gets the enum value as a string.
5235 ///
5236 /// Returns `None` if the enum contains an unknown value deserialized from
5237 /// the integer representation of enums.
5238 pub fn name(&self) -> std::option::Option<&str> {
5239 match self {
5240 Self::String => std::option::Option::Some("STRING"),
5241 Self::Bool => std::option::Option::Some("BOOL"),
5242 Self::Int64 => std::option::Option::Some("INT64"),
5243 Self::UnknownValue(u) => u.0.name(),
5244 }
5245 }
5246 }
5247
5248 impl std::default::Default for ValueType {
5249 fn default() -> Self {
5250 use std::convert::From;
5251 Self::from(0)
5252 }
5253 }
5254
5255 impl std::fmt::Display for ValueType {
5256 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5257 wkt::internal::display_enum(f, self.name(), self.value())
5258 }
5259 }
5260
5261 impl std::convert::From<i32> for ValueType {
5262 fn from(value: i32) -> Self {
5263 match value {
5264 0 => Self::String,
5265 1 => Self::Bool,
5266 2 => Self::Int64,
5267 _ => Self::UnknownValue(value_type::UnknownValue(
5268 wkt::internal::UnknownEnumValue::Integer(value),
5269 )),
5270 }
5271 }
5272 }
5273
5274 impl std::convert::From<&str> for ValueType {
5275 fn from(value: &str) -> Self {
5276 use std::string::ToString;
5277 match value {
5278 "STRING" => Self::String,
5279 "BOOL" => Self::Bool,
5280 "INT64" => Self::Int64,
5281 _ => Self::UnknownValue(value_type::UnknownValue(
5282 wkt::internal::UnknownEnumValue::String(value.to_string()),
5283 )),
5284 }
5285 }
5286 }
5287
5288 impl serde::ser::Serialize for ValueType {
5289 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5290 where
5291 S: serde::Serializer,
5292 {
5293 match self {
5294 Self::String => serializer.serialize_i32(0),
5295 Self::Bool => serializer.serialize_i32(1),
5296 Self::Int64 => serializer.serialize_i32(2),
5297 Self::UnknownValue(u) => u.0.serialize(serializer),
5298 }
5299 }
5300 }
5301
5302 impl<'de> serde::de::Deserialize<'de> for ValueType {
5303 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5304 where
5305 D: serde::Deserializer<'de>,
5306 {
5307 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ValueType>::new(
5308 ".google.api.LabelDescriptor.ValueType",
5309 ))
5310 }
5311 }
5312}
5313
5314/// A description of a log type. Example in YAML format:
5315///
5316/// ```norust
5317/// - name: library.googleapis.com/activity_history
5318/// description: The history of borrowing and returning library items.
5319/// display_name: Activity
5320/// labels:
5321/// - key: /customer_id
5322/// description: Identifier of a library customer
5323/// ```
5324#[serde_with::serde_as]
5325#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
5326#[serde(default, rename_all = "camelCase")]
5327#[non_exhaustive]
5328pub struct LogDescriptor {
5329 /// The name of the log. It must be less than 512 characters long and can
5330 /// include the following characters: upper- and lower-case alphanumeric
5331 /// characters [A-Za-z0-9], and punctuation characters including
5332 /// slash, underscore, hyphen, period [/_-.].
5333 #[serde(skip_serializing_if = "std::string::String::is_empty")]
5334 pub name: std::string::String,
5335
5336 /// The set of labels that are available to describe a specific log entry.
5337 /// Runtime requests that contain labels not specified here are
5338 /// considered invalid.
5339 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
5340 pub labels: std::vec::Vec<crate::model::LabelDescriptor>,
5341
5342 /// A human-readable description of this log. This information appears in
5343 /// the documentation and can contain details.
5344 #[serde(skip_serializing_if = "std::string::String::is_empty")]
5345 pub description: std::string::String,
5346
5347 /// The human-readable name for this log. This information appears on
5348 /// the user interface and should be concise.
5349 #[serde(skip_serializing_if = "std::string::String::is_empty")]
5350 pub display_name: std::string::String,
5351
5352 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
5353 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5354}
5355
5356impl LogDescriptor {
5357 pub fn new() -> Self {
5358 std::default::Default::default()
5359 }
5360
5361 /// Sets the value of [name][crate::model::LogDescriptor::name].
5362 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5363 self.name = v.into();
5364 self
5365 }
5366
5367 /// Sets the value of [labels][crate::model::LogDescriptor::labels].
5368 pub fn set_labels<T, V>(mut self, v: T) -> Self
5369 where
5370 T: std::iter::IntoIterator<Item = V>,
5371 V: std::convert::Into<crate::model::LabelDescriptor>,
5372 {
5373 use std::iter::Iterator;
5374 self.labels = v.into_iter().map(|i| i.into()).collect();
5375 self
5376 }
5377
5378 /// Sets the value of [description][crate::model::LogDescriptor::description].
5379 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5380 self.description = v.into();
5381 self
5382 }
5383
5384 /// Sets the value of [display_name][crate::model::LogDescriptor::display_name].
5385 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5386 self.display_name = v.into();
5387 self
5388 }
5389}
5390
5391impl wkt::message::Message for LogDescriptor {
5392 fn typename() -> &'static str {
5393 "type.googleapis.com/google.api.LogDescriptor"
5394 }
5395}
5396
5397/// Logging configuration of the service.
5398///
5399/// The following example shows how to configure logs to be sent to the
5400/// producer and consumer projects. In the example, the `activity_history`
5401/// log is sent to both the producer and consumer projects, whereas the
5402/// `purchase_history` log is only sent to the producer project.
5403///
5404/// ```norust
5405/// monitored_resources:
5406/// - type: library.googleapis.com/branch
5407/// labels:
5408/// - key: /city
5409/// description: The city where the library branch is located in.
5410/// - key: /name
5411/// description: The name of the branch.
5412/// logs:
5413/// - name: activity_history
5414/// labels:
5415/// - key: /customer_id
5416/// - name: purchase_history
5417/// logging:
5418/// producer_destinations:
5419/// - monitored_resource: library.googleapis.com/branch
5420/// logs:
5421/// - activity_history
5422/// - purchase_history
5423/// consumer_destinations:
5424/// - monitored_resource: library.googleapis.com/branch
5425/// logs:
5426/// - activity_history
5427/// ```
5428#[serde_with::serde_as]
5429#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
5430#[serde(default, rename_all = "camelCase")]
5431#[non_exhaustive]
5432pub struct Logging {
5433 /// Logging configurations for sending logs to the producer project.
5434 /// There can be multiple producer destinations, each one must have a
5435 /// different monitored resource type. A log can be used in at most
5436 /// one producer destination.
5437 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
5438 pub producer_destinations: std::vec::Vec<crate::model::logging::LoggingDestination>,
5439
5440 /// Logging configurations for sending logs to the consumer project.
5441 /// There can be multiple consumer destinations, each one must have a
5442 /// different monitored resource type. A log can be used in at most
5443 /// one consumer destination.
5444 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
5445 pub consumer_destinations: std::vec::Vec<crate::model::logging::LoggingDestination>,
5446
5447 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
5448 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5449}
5450
5451impl Logging {
5452 pub fn new() -> Self {
5453 std::default::Default::default()
5454 }
5455
5456 /// Sets the value of [producer_destinations][crate::model::Logging::producer_destinations].
5457 pub fn set_producer_destinations<T, V>(mut self, v: T) -> Self
5458 where
5459 T: std::iter::IntoIterator<Item = V>,
5460 V: std::convert::Into<crate::model::logging::LoggingDestination>,
5461 {
5462 use std::iter::Iterator;
5463 self.producer_destinations = v.into_iter().map(|i| i.into()).collect();
5464 self
5465 }
5466
5467 /// Sets the value of [consumer_destinations][crate::model::Logging::consumer_destinations].
5468 pub fn set_consumer_destinations<T, V>(mut self, v: T) -> Self
5469 where
5470 T: std::iter::IntoIterator<Item = V>,
5471 V: std::convert::Into<crate::model::logging::LoggingDestination>,
5472 {
5473 use std::iter::Iterator;
5474 self.consumer_destinations = v.into_iter().map(|i| i.into()).collect();
5475 self
5476 }
5477}
5478
5479impl wkt::message::Message for Logging {
5480 fn typename() -> &'static str {
5481 "type.googleapis.com/google.api.Logging"
5482 }
5483}
5484
5485/// Defines additional types related to [Logging].
5486pub mod logging {
5487 #[allow(unused_imports)]
5488 use super::*;
5489
5490 /// Configuration of a specific logging destination (the producer project
5491 /// or the consumer project).
5492 #[serde_with::serde_as]
5493 #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
5494 #[serde(default, rename_all = "camelCase")]
5495 #[non_exhaustive]
5496 pub struct LoggingDestination {
5497 /// The monitored resource type. The type must be defined in the
5498 /// [Service.monitored_resources][google.api.Service.monitored_resources]
5499 /// section.
5500 ///
5501 /// [google.api.Service.monitored_resources]: crate::model::Service::monitored_resources
5502 #[serde(skip_serializing_if = "std::string::String::is_empty")]
5503 pub monitored_resource: std::string::String,
5504
5505 /// Names of the logs to be sent to this destination. Each name must
5506 /// be defined in the [Service.logs][google.api.Service.logs] section. If the
5507 /// log name is not a domain scoped name, it will be automatically prefixed
5508 /// with the service name followed by "/".
5509 ///
5510 /// [google.api.Service.logs]: crate::model::Service::logs
5511 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
5512 pub logs: std::vec::Vec<std::string::String>,
5513
5514 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
5515 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5516 }
5517
5518 impl LoggingDestination {
5519 pub fn new() -> Self {
5520 std::default::Default::default()
5521 }
5522
5523 /// Sets the value of [monitored_resource][crate::model::logging::LoggingDestination::monitored_resource].
5524 pub fn set_monitored_resource<T: std::convert::Into<std::string::String>>(
5525 mut self,
5526 v: T,
5527 ) -> Self {
5528 self.monitored_resource = v.into();
5529 self
5530 }
5531
5532 /// Sets the value of [logs][crate::model::logging::LoggingDestination::logs].
5533 pub fn set_logs<T, V>(mut self, v: T) -> Self
5534 where
5535 T: std::iter::IntoIterator<Item = V>,
5536 V: std::convert::Into<std::string::String>,
5537 {
5538 use std::iter::Iterator;
5539 self.logs = v.into_iter().map(|i| i.into()).collect();
5540 self
5541 }
5542 }
5543
5544 impl wkt::message::Message for LoggingDestination {
5545 fn typename() -> &'static str {
5546 "type.googleapis.com/google.api.Logging.LoggingDestination"
5547 }
5548 }
5549}
5550
5551/// Defines a metric type and its schema. Once a metric descriptor is created,
5552/// deleting or altering it stops data collection and makes the metric type's
5553/// existing data unusable.
5554#[serde_with::serde_as]
5555#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
5556#[serde(default, rename_all = "camelCase")]
5557#[non_exhaustive]
5558pub struct MetricDescriptor {
5559 /// The resource name of the metric descriptor.
5560 #[serde(skip_serializing_if = "std::string::String::is_empty")]
5561 pub name: std::string::String,
5562
5563 /// The metric type, including its DNS name prefix. The type is not
5564 /// URL-encoded. All user-defined metric types have the DNS name
5565 /// `custom.googleapis.com` or `external.googleapis.com`. Metric types should
5566 /// use a natural hierarchical grouping. For example:
5567 ///
5568 /// ```norust
5569 /// "custom.googleapis.com/invoice/paid/amount"
5570 /// "external.googleapis.com/prometheus/up"
5571 /// "appengine.googleapis.com/http/server/response_latencies"
5572 /// ```
5573 #[serde(rename = "type")]
5574 #[serde(skip_serializing_if = "std::string::String::is_empty")]
5575 pub r#type: std::string::String,
5576
5577 /// The set of labels that can be used to describe a specific
5578 /// instance of this metric type. For example, the
5579 /// `appengine.googleapis.com/http/server/response_latencies` metric
5580 /// type has a label for the HTTP response code, `response_code`, so
5581 /// you can look at latencies for successful responses or just
5582 /// for responses that failed.
5583 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
5584 pub labels: std::vec::Vec<crate::model::LabelDescriptor>,
5585
5586 /// Whether the metric records instantaneous values, changes to a value, etc.
5587 /// Some combinations of `metric_kind` and `value_type` might not be supported.
5588 pub metric_kind: crate::model::metric_descriptor::MetricKind,
5589
5590 /// Whether the measurement is an integer, a floating-point number, etc.
5591 /// Some combinations of `metric_kind` and `value_type` might not be supported.
5592 pub value_type: crate::model::metric_descriptor::ValueType,
5593
5594 /// The units in which the metric value is reported. It is only applicable
5595 /// if the `value_type` is `INT64`, `DOUBLE`, or `DISTRIBUTION`. The `unit`
5596 /// defines the representation of the stored metric values.
5597 ///
5598 /// Different systems might scale the values to be more easily displayed (so a
5599 /// value of `0.02kBy` _might_ be displayed as `20By`, and a value of
5600 /// `3523kBy` _might_ be displayed as `3.5MBy`). However, if the `unit` is
5601 /// `kBy`, then the value of the metric is always in thousands of bytes, no
5602 /// matter how it might be displayed.
5603 ///
5604 /// If you want a custom metric to record the exact number of CPU-seconds used
5605 /// by a job, you can create an `INT64 CUMULATIVE` metric whose `unit` is
5606 /// `s{CPU}` (or equivalently `1s{CPU}` or just `s`). If the job uses 12,005
5607 /// CPU-seconds, then the value is written as `12005`.
5608 ///
5609 /// Alternatively, if you want a custom metric to record data in a more
5610 /// granular way, you can create a `DOUBLE CUMULATIVE` metric whose `unit` is
5611 /// `ks{CPU}`, and then write the value `12.005` (which is `12005/1000`),
5612 /// or use `Kis{CPU}` and write `11.723` (which is `12005/1024`).
5613 ///
5614 /// The supported units are a subset of [The Unified Code for Units of
5615 /// Measure](https://unitsofmeasure.org/ucum.html) standard:
5616 ///
5617 /// **Basic units (UNIT)**
5618 ///
5619 /// * `bit` bit
5620 /// * `By` byte
5621 /// * `s` second
5622 /// * `min` minute
5623 /// * `h` hour
5624 /// * `d` day
5625 /// * `1` dimensionless
5626 ///
5627 /// **Prefixes (PREFIX)**
5628 ///
5629 /// * `k` kilo (10^3)
5630 ///
5631 /// * `M` mega (10^6)
5632 ///
5633 /// * `G` giga (10^9)
5634 ///
5635 /// * `T` tera (10^12)
5636 ///
5637 /// * `P` peta (10^15)
5638 ///
5639 /// * `E` exa (10^18)
5640 ///
5641 /// * `Z` zetta (10^21)
5642 ///
5643 /// * `Y` yotta (10^24)
5644 ///
5645 /// * `m` milli (10^-3)
5646 ///
5647 /// * `u` micro (10^-6)
5648 ///
5649 /// * `n` nano (10^-9)
5650 ///
5651 /// * `p` pico (10^-12)
5652 ///
5653 /// * `f` femto (10^-15)
5654 ///
5655 /// * `a` atto (10^-18)
5656 ///
5657 /// * `z` zepto (10^-21)
5658 ///
5659 /// * `y` yocto (10^-24)
5660 ///
5661 /// * `Ki` kibi (2^10)
5662 ///
5663 /// * `Mi` mebi (2^20)
5664 ///
5665 /// * `Gi` gibi (2^30)
5666 ///
5667 /// * `Ti` tebi (2^40)
5668 ///
5669 /// * `Pi` pebi (2^50)
5670 ///
5671 ///
5672 /// **Grammar**
5673 ///
5674 /// The grammar also includes these connectors:
5675 ///
5676 /// * `/` division or ratio (as an infix operator). For examples,
5677 /// `kBy/{email}` or `MiBy/10ms` (although you should almost never
5678 /// have `/s` in a metric `unit`; rates should always be computed at
5679 /// query time from the underlying cumulative or delta value).
5680 /// * `.` multiplication or composition (as an infix operator). For
5681 /// examples, `GBy.d` or `k{watt}.h`.
5682 ///
5683 /// The grammar for a unit is as follows:
5684 ///
5685 /// ```norust
5686 /// Expression = Component { "." Component } { "/" Component } ;
5687 ///
5688 /// Component = ( [ PREFIX ] UNIT | "%" ) [ Annotation ]
5689 /// | Annotation
5690 /// | "1"
5691 /// ;
5692 ///
5693 /// Annotation = "{" NAME "}" ;
5694 /// ```
5695 ///
5696 /// Notes:
5697 ///
5698 /// * `Annotation` is just a comment if it follows a `UNIT`. If the annotation
5699 /// is used alone, then the unit is equivalent to `1`. For examples,
5700 /// `{request}/s == 1/s`, `By{transmitted}/s == By/s`.
5701 /// * `NAME` is a sequence of non-blank printable ASCII characters not
5702 /// containing `{` or `}`.
5703 /// * `1` represents a unitary [dimensionless
5704 /// unit](https://en.wikipedia.org/wiki/Dimensionless_quantity) of 1, such
5705 /// as in `1/s`. It is typically used when none of the basic units are
5706 /// appropriate. For example, "new users per day" can be represented as
5707 /// `1/d` or `{new-users}/d` (and a metric value `5` would mean "5 new
5708 /// users). Alternatively, "thousands of page views per day" would be
5709 /// represented as `1000/d` or `k1/d` or `k{page_views}/d` (and a metric
5710 /// value of `5.3` would mean "5300 page views per day").
5711 /// * `%` represents dimensionless value of 1/100, and annotates values giving
5712 /// a percentage (so the metric values are typically in the range of 0..100,
5713 /// and a metric value `3` means "3 percent").
5714 /// * `10^2.%` indicates a metric contains a ratio, typically in the range
5715 /// 0..1, that will be multiplied by 100 and displayed as a percentage
5716 /// (so a metric value `0.03` means "3 percent").
5717 #[serde(skip_serializing_if = "std::string::String::is_empty")]
5718 pub unit: std::string::String,
5719
5720 /// A detailed description of the metric, which can be used in documentation.
5721 #[serde(skip_serializing_if = "std::string::String::is_empty")]
5722 pub description: std::string::String,
5723
5724 /// A concise name for the metric, which can be displayed in user interfaces.
5725 /// Use sentence case without an ending period, for example "Request count".
5726 /// This field is optional but it is recommended to be set for any metrics
5727 /// associated with user-visible concepts, such as Quota.
5728 #[serde(skip_serializing_if = "std::string::String::is_empty")]
5729 pub display_name: std::string::String,
5730
5731 /// Optional. Metadata which can be used to guide usage of the metric.
5732 #[serde(skip_serializing_if = "std::option::Option::is_none")]
5733 pub metadata: std::option::Option<crate::model::metric_descriptor::MetricDescriptorMetadata>,
5734
5735 /// Optional. The launch stage of the metric definition.
5736 pub launch_stage: crate::model::LaunchStage,
5737
5738 /// Read-only. If present, then a [time
5739 /// series][google.monitoring.v3.TimeSeries], which is identified partially by
5740 /// a metric type and a
5741 /// [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor], that
5742 /// is associated with this metric type can only be associated with one of the
5743 /// monitored resource types listed here.
5744 ///
5745 /// [google.api.MonitoredResourceDescriptor]: crate::model::MonitoredResourceDescriptor
5746 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
5747 pub monitored_resource_types: std::vec::Vec<std::string::String>,
5748
5749 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
5750 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5751}
5752
5753impl MetricDescriptor {
5754 pub fn new() -> Self {
5755 std::default::Default::default()
5756 }
5757
5758 /// Sets the value of [name][crate::model::MetricDescriptor::name].
5759 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5760 self.name = v.into();
5761 self
5762 }
5763
5764 /// Sets the value of [r#type][crate::model::MetricDescriptor::type].
5765 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5766 self.r#type = v.into();
5767 self
5768 }
5769
5770 /// Sets the value of [labels][crate::model::MetricDescriptor::labels].
5771 pub fn set_labels<T, V>(mut self, v: T) -> Self
5772 where
5773 T: std::iter::IntoIterator<Item = V>,
5774 V: std::convert::Into<crate::model::LabelDescriptor>,
5775 {
5776 use std::iter::Iterator;
5777 self.labels = v.into_iter().map(|i| i.into()).collect();
5778 self
5779 }
5780
5781 /// Sets the value of [metric_kind][crate::model::MetricDescriptor::metric_kind].
5782 pub fn set_metric_kind<T: std::convert::Into<crate::model::metric_descriptor::MetricKind>>(
5783 mut self,
5784 v: T,
5785 ) -> Self {
5786 self.metric_kind = v.into();
5787 self
5788 }
5789
5790 /// Sets the value of [value_type][crate::model::MetricDescriptor::value_type].
5791 pub fn set_value_type<T: std::convert::Into<crate::model::metric_descriptor::ValueType>>(
5792 mut self,
5793 v: T,
5794 ) -> Self {
5795 self.value_type = v.into();
5796 self
5797 }
5798
5799 /// Sets the value of [unit][crate::model::MetricDescriptor::unit].
5800 pub fn set_unit<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5801 self.unit = v.into();
5802 self
5803 }
5804
5805 /// Sets the value of [description][crate::model::MetricDescriptor::description].
5806 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5807 self.description = v.into();
5808 self
5809 }
5810
5811 /// Sets the value of [display_name][crate::model::MetricDescriptor::display_name].
5812 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5813 self.display_name = v.into();
5814 self
5815 }
5816
5817 /// Sets the value of [metadata][crate::model::MetricDescriptor::metadata].
5818 pub fn set_metadata<
5819 T: std::convert::Into<
5820 std::option::Option<crate::model::metric_descriptor::MetricDescriptorMetadata>,
5821 >,
5822 >(
5823 mut self,
5824 v: T,
5825 ) -> Self {
5826 self.metadata = v.into();
5827 self
5828 }
5829
5830 /// Sets the value of [launch_stage][crate::model::MetricDescriptor::launch_stage].
5831 pub fn set_launch_stage<T: std::convert::Into<crate::model::LaunchStage>>(
5832 mut self,
5833 v: T,
5834 ) -> Self {
5835 self.launch_stage = v.into();
5836 self
5837 }
5838
5839 /// Sets the value of [monitored_resource_types][crate::model::MetricDescriptor::monitored_resource_types].
5840 pub fn set_monitored_resource_types<T, V>(mut self, v: T) -> Self
5841 where
5842 T: std::iter::IntoIterator<Item = V>,
5843 V: std::convert::Into<std::string::String>,
5844 {
5845 use std::iter::Iterator;
5846 self.monitored_resource_types = v.into_iter().map(|i| i.into()).collect();
5847 self
5848 }
5849}
5850
5851impl wkt::message::Message for MetricDescriptor {
5852 fn typename() -> &'static str {
5853 "type.googleapis.com/google.api.MetricDescriptor"
5854 }
5855}
5856
5857/// Defines additional types related to [MetricDescriptor].
5858pub mod metric_descriptor {
5859 #[allow(unused_imports)]
5860 use super::*;
5861
5862 /// Additional annotations that can be used to guide the usage of a metric.
5863 #[serde_with::serde_as]
5864 #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
5865 #[serde(default, rename_all = "camelCase")]
5866 #[non_exhaustive]
5867 pub struct MetricDescriptorMetadata {
5868
5869 /// Deprecated. Must use the
5870 /// [MetricDescriptor.launch_stage][google.api.MetricDescriptor.launch_stage]
5871 /// instead.
5872 ///
5873 /// [google.api.MetricDescriptor.launch_stage]: crate::model::MetricDescriptor::launch_stage
5874 #[deprecated]
5875 pub launch_stage: crate::model::LaunchStage,
5876
5877 /// The sampling period of metric data points. For metrics which are written
5878 /// periodically, consecutive data points are stored at this time interval,
5879 /// excluding data loss due to errors. Metrics with a higher granularity have
5880 /// a smaller sampling period.
5881 #[serde(skip_serializing_if = "std::option::Option::is_none")]
5882 pub sample_period: std::option::Option<wkt::Duration>,
5883
5884 /// The delay of data points caused by ingestion. Data points older than this
5885 /// age are guaranteed to be ingested and available to be read, excluding
5886 /// data loss due to errors.
5887 #[serde(skip_serializing_if = "std::option::Option::is_none")]
5888 pub ingest_delay: std::option::Option<wkt::Duration>,
5889
5890 /// The scope of the timeseries data of the metric.
5891 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
5892 pub time_series_resource_hierarchy_level: std::vec::Vec<crate::model::metric_descriptor::metric_descriptor_metadata::TimeSeriesResourceHierarchyLevel>,
5893
5894 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
5895 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5896 }
5897
5898 impl MetricDescriptorMetadata {
5899 pub fn new() -> Self {
5900 std::default::Default::default()
5901 }
5902
5903 /// Sets the value of [launch_stage][crate::model::metric_descriptor::MetricDescriptorMetadata::launch_stage].
5904 #[deprecated]
5905 pub fn set_launch_stage<T: std::convert::Into<crate::model::LaunchStage>>(
5906 mut self,
5907 v: T,
5908 ) -> Self {
5909 self.launch_stage = v.into();
5910 self
5911 }
5912
5913 /// Sets the value of [sample_period][crate::model::metric_descriptor::MetricDescriptorMetadata::sample_period].
5914 pub fn set_sample_period<T: std::convert::Into<std::option::Option<wkt::Duration>>>(
5915 mut self,
5916 v: T,
5917 ) -> Self {
5918 self.sample_period = v.into();
5919 self
5920 }
5921
5922 /// Sets the value of [ingest_delay][crate::model::metric_descriptor::MetricDescriptorMetadata::ingest_delay].
5923 pub fn set_ingest_delay<T: std::convert::Into<std::option::Option<wkt::Duration>>>(
5924 mut self,
5925 v: T,
5926 ) -> Self {
5927 self.ingest_delay = v.into();
5928 self
5929 }
5930
5931 /// Sets the value of [time_series_resource_hierarchy_level][crate::model::metric_descriptor::MetricDescriptorMetadata::time_series_resource_hierarchy_level].
5932 pub fn set_time_series_resource_hierarchy_level<T, V>(mut self, v: T) -> Self
5933 where
5934 T: std::iter::IntoIterator<Item = V>,
5935 V: std::convert::Into<crate::model::metric_descriptor::metric_descriptor_metadata::TimeSeriesResourceHierarchyLevel>
5936 {
5937 use std::iter::Iterator;
5938 self.time_series_resource_hierarchy_level = v.into_iter().map(|i| i.into()).collect();
5939 self
5940 }
5941 }
5942
5943 impl wkt::message::Message for MetricDescriptorMetadata {
5944 fn typename() -> &'static str {
5945 "type.googleapis.com/google.api.MetricDescriptor.MetricDescriptorMetadata"
5946 }
5947 }
5948
5949 /// Defines additional types related to [MetricDescriptorMetadata].
5950 pub mod metric_descriptor_metadata {
5951 #[allow(unused_imports)]
5952 use super::*;
5953
5954 /// The resource hierarchy level of the timeseries data of a metric.
5955 ///
5956 /// # Working with unknown values
5957 ///
5958 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5959 /// additional enum variants at any time. Adding new variants is not considered
5960 /// a breaking change. Applications should write their code in anticipation of:
5961 ///
5962 /// - New values appearing in future releases of the client library, **and**
5963 /// - New values received dynamically, without application changes.
5964 ///
5965 /// Please consult the [Working with enums] section in the user guide for some
5966 /// guidelines.
5967 ///
5968 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
5969 #[derive(Clone, Debug, PartialEq)]
5970 #[non_exhaustive]
5971 pub enum TimeSeriesResourceHierarchyLevel {
5972 /// Do not use this default value.
5973 Unspecified,
5974 /// Scopes a metric to a project.
5975 Project,
5976 /// Scopes a metric to an organization.
5977 Organization,
5978 /// Scopes a metric to a folder.
5979 Folder,
5980 /// If set, the enum was initialized with an unknown value.
5981 ///
5982 /// Applications can examine the value using [TimeSeriesResourceHierarchyLevel::value] or
5983 /// [TimeSeriesResourceHierarchyLevel::name].
5984 UnknownValue(time_series_resource_hierarchy_level::UnknownValue),
5985 }
5986
5987 #[doc(hidden)]
5988 pub mod time_series_resource_hierarchy_level {
5989 #[allow(unused_imports)]
5990 use super::*;
5991 #[derive(Clone, Debug, PartialEq)]
5992 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5993 }
5994
5995 impl TimeSeriesResourceHierarchyLevel {
5996 /// Gets the enum value.
5997 ///
5998 /// Returns `None` if the enum contains an unknown value deserialized from
5999 /// the string representation of enums.
6000 pub fn value(&self) -> std::option::Option<i32> {
6001 match self {
6002 Self::Unspecified => std::option::Option::Some(0),
6003 Self::Project => std::option::Option::Some(1),
6004 Self::Organization => std::option::Option::Some(2),
6005 Self::Folder => std::option::Option::Some(3),
6006 Self::UnknownValue(u) => u.0.value(),
6007 }
6008 }
6009
6010 /// Gets the enum value as a string.
6011 ///
6012 /// Returns `None` if the enum contains an unknown value deserialized from
6013 /// the integer representation of enums.
6014 pub fn name(&self) -> std::option::Option<&str> {
6015 match self {
6016 Self::Unspecified => std::option::Option::Some(
6017 "TIME_SERIES_RESOURCE_HIERARCHY_LEVEL_UNSPECIFIED",
6018 ),
6019 Self::Project => std::option::Option::Some("PROJECT"),
6020 Self::Organization => std::option::Option::Some("ORGANIZATION"),
6021 Self::Folder => std::option::Option::Some("FOLDER"),
6022 Self::UnknownValue(u) => u.0.name(),
6023 }
6024 }
6025 }
6026
6027 impl std::default::Default for TimeSeriesResourceHierarchyLevel {
6028 fn default() -> Self {
6029 use std::convert::From;
6030 Self::from(0)
6031 }
6032 }
6033
6034 impl std::fmt::Display for TimeSeriesResourceHierarchyLevel {
6035 fn fmt(
6036 &self,
6037 f: &mut std::fmt::Formatter<'_>,
6038 ) -> std::result::Result<(), std::fmt::Error> {
6039 wkt::internal::display_enum(f, self.name(), self.value())
6040 }
6041 }
6042
6043 impl std::convert::From<i32> for TimeSeriesResourceHierarchyLevel {
6044 fn from(value: i32) -> Self {
6045 match value {
6046 0 => Self::Unspecified,
6047 1 => Self::Project,
6048 2 => Self::Organization,
6049 3 => Self::Folder,
6050 _ => Self::UnknownValue(time_series_resource_hierarchy_level::UnknownValue(
6051 wkt::internal::UnknownEnumValue::Integer(value),
6052 )),
6053 }
6054 }
6055 }
6056
6057 impl std::convert::From<&str> for TimeSeriesResourceHierarchyLevel {
6058 fn from(value: &str) -> Self {
6059 use std::string::ToString;
6060 match value {
6061 "TIME_SERIES_RESOURCE_HIERARCHY_LEVEL_UNSPECIFIED" => Self::Unspecified,
6062 "PROJECT" => Self::Project,
6063 "ORGANIZATION" => Self::Organization,
6064 "FOLDER" => Self::Folder,
6065 _ => Self::UnknownValue(time_series_resource_hierarchy_level::UnknownValue(
6066 wkt::internal::UnknownEnumValue::String(value.to_string()),
6067 )),
6068 }
6069 }
6070 }
6071
6072 impl serde::ser::Serialize for TimeSeriesResourceHierarchyLevel {
6073 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6074 where
6075 S: serde::Serializer,
6076 {
6077 match self {
6078 Self::Unspecified => serializer.serialize_i32(0),
6079 Self::Project => serializer.serialize_i32(1),
6080 Self::Organization => serializer.serialize_i32(2),
6081 Self::Folder => serializer.serialize_i32(3),
6082 Self::UnknownValue(u) => u.0.serialize(serializer),
6083 }
6084 }
6085 }
6086
6087 impl<'de> serde::de::Deserialize<'de> for TimeSeriesResourceHierarchyLevel {
6088 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6089 where
6090 D: serde::Deserializer<'de>,
6091 {
6092 deserializer.deserialize_any(wkt::internal::EnumVisitor::<TimeSeriesResourceHierarchyLevel>::new(
6093 ".google.api.MetricDescriptor.MetricDescriptorMetadata.TimeSeriesResourceHierarchyLevel"))
6094 }
6095 }
6096 }
6097
6098 /// The kind of measurement. It describes how the data is reported.
6099 /// For information on setting the start time and end time based on
6100 /// the MetricKind, see [TimeInterval][google.monitoring.v3.TimeInterval].
6101 ///
6102 /// # Working with unknown values
6103 ///
6104 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6105 /// additional enum variants at any time. Adding new variants is not considered
6106 /// a breaking change. Applications should write their code in anticipation of:
6107 ///
6108 /// - New values appearing in future releases of the client library, **and**
6109 /// - New values received dynamically, without application changes.
6110 ///
6111 /// Please consult the [Working with enums] section in the user guide for some
6112 /// guidelines.
6113 ///
6114 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
6115 #[derive(Clone, Debug, PartialEq)]
6116 #[non_exhaustive]
6117 pub enum MetricKind {
6118 /// Do not use this default value.
6119 Unspecified,
6120 /// An instantaneous measurement of a value.
6121 Gauge,
6122 /// The change in a value during a time interval.
6123 Delta,
6124 /// A value accumulated over a time interval. Cumulative
6125 /// measurements in a time series should have the same start time
6126 /// and increasing end times, until an event resets the cumulative
6127 /// value to zero and sets a new start time for the following
6128 /// points.
6129 Cumulative,
6130 /// If set, the enum was initialized with an unknown value.
6131 ///
6132 /// Applications can examine the value using [MetricKind::value] or
6133 /// [MetricKind::name].
6134 UnknownValue(metric_kind::UnknownValue),
6135 }
6136
6137 #[doc(hidden)]
6138 pub mod metric_kind {
6139 #[allow(unused_imports)]
6140 use super::*;
6141 #[derive(Clone, Debug, PartialEq)]
6142 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6143 }
6144
6145 impl MetricKind {
6146 /// Gets the enum value.
6147 ///
6148 /// Returns `None` if the enum contains an unknown value deserialized from
6149 /// the string representation of enums.
6150 pub fn value(&self) -> std::option::Option<i32> {
6151 match self {
6152 Self::Unspecified => std::option::Option::Some(0),
6153 Self::Gauge => std::option::Option::Some(1),
6154 Self::Delta => std::option::Option::Some(2),
6155 Self::Cumulative => std::option::Option::Some(3),
6156 Self::UnknownValue(u) => u.0.value(),
6157 }
6158 }
6159
6160 /// Gets the enum value as a string.
6161 ///
6162 /// Returns `None` if the enum contains an unknown value deserialized from
6163 /// the integer representation of enums.
6164 pub fn name(&self) -> std::option::Option<&str> {
6165 match self {
6166 Self::Unspecified => std::option::Option::Some("METRIC_KIND_UNSPECIFIED"),
6167 Self::Gauge => std::option::Option::Some("GAUGE"),
6168 Self::Delta => std::option::Option::Some("DELTA"),
6169 Self::Cumulative => std::option::Option::Some("CUMULATIVE"),
6170 Self::UnknownValue(u) => u.0.name(),
6171 }
6172 }
6173 }
6174
6175 impl std::default::Default for MetricKind {
6176 fn default() -> Self {
6177 use std::convert::From;
6178 Self::from(0)
6179 }
6180 }
6181
6182 impl std::fmt::Display for MetricKind {
6183 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6184 wkt::internal::display_enum(f, self.name(), self.value())
6185 }
6186 }
6187
6188 impl std::convert::From<i32> for MetricKind {
6189 fn from(value: i32) -> Self {
6190 match value {
6191 0 => Self::Unspecified,
6192 1 => Self::Gauge,
6193 2 => Self::Delta,
6194 3 => Self::Cumulative,
6195 _ => Self::UnknownValue(metric_kind::UnknownValue(
6196 wkt::internal::UnknownEnumValue::Integer(value),
6197 )),
6198 }
6199 }
6200 }
6201
6202 impl std::convert::From<&str> for MetricKind {
6203 fn from(value: &str) -> Self {
6204 use std::string::ToString;
6205 match value {
6206 "METRIC_KIND_UNSPECIFIED" => Self::Unspecified,
6207 "GAUGE" => Self::Gauge,
6208 "DELTA" => Self::Delta,
6209 "CUMULATIVE" => Self::Cumulative,
6210 _ => Self::UnknownValue(metric_kind::UnknownValue(
6211 wkt::internal::UnknownEnumValue::String(value.to_string()),
6212 )),
6213 }
6214 }
6215 }
6216
6217 impl serde::ser::Serialize for MetricKind {
6218 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6219 where
6220 S: serde::Serializer,
6221 {
6222 match self {
6223 Self::Unspecified => serializer.serialize_i32(0),
6224 Self::Gauge => serializer.serialize_i32(1),
6225 Self::Delta => serializer.serialize_i32(2),
6226 Self::Cumulative => serializer.serialize_i32(3),
6227 Self::UnknownValue(u) => u.0.serialize(serializer),
6228 }
6229 }
6230 }
6231
6232 impl<'de> serde::de::Deserialize<'de> for MetricKind {
6233 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6234 where
6235 D: serde::Deserializer<'de>,
6236 {
6237 deserializer.deserialize_any(wkt::internal::EnumVisitor::<MetricKind>::new(
6238 ".google.api.MetricDescriptor.MetricKind",
6239 ))
6240 }
6241 }
6242
6243 /// The value type of a metric.
6244 ///
6245 /// # Working with unknown values
6246 ///
6247 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6248 /// additional enum variants at any time. Adding new variants is not considered
6249 /// a breaking change. Applications should write their code in anticipation of:
6250 ///
6251 /// - New values appearing in future releases of the client library, **and**
6252 /// - New values received dynamically, without application changes.
6253 ///
6254 /// Please consult the [Working with enums] section in the user guide for some
6255 /// guidelines.
6256 ///
6257 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
6258 #[derive(Clone, Debug, PartialEq)]
6259 #[non_exhaustive]
6260 pub enum ValueType {
6261 /// Do not use this default value.
6262 Unspecified,
6263 /// The value is a boolean.
6264 /// This value type can be used only if the metric kind is `GAUGE`.
6265 Bool,
6266 /// The value is a signed 64-bit integer.
6267 Int64,
6268 /// The value is a double precision floating point number.
6269 Double,
6270 /// The value is a text string.
6271 /// This value type can be used only if the metric kind is `GAUGE`.
6272 String,
6273 /// The value is a [`Distribution`][google.api.Distribution].
6274 ///
6275 /// [google.api.Distribution]: crate::model::Distribution
6276 Distribution,
6277 /// The value is money.
6278 Money,
6279 /// If set, the enum was initialized with an unknown value.
6280 ///
6281 /// Applications can examine the value using [ValueType::value] or
6282 /// [ValueType::name].
6283 UnknownValue(value_type::UnknownValue),
6284 }
6285
6286 #[doc(hidden)]
6287 pub mod value_type {
6288 #[allow(unused_imports)]
6289 use super::*;
6290 #[derive(Clone, Debug, PartialEq)]
6291 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6292 }
6293
6294 impl ValueType {
6295 /// Gets the enum value.
6296 ///
6297 /// Returns `None` if the enum contains an unknown value deserialized from
6298 /// the string representation of enums.
6299 pub fn value(&self) -> std::option::Option<i32> {
6300 match self {
6301 Self::Unspecified => std::option::Option::Some(0),
6302 Self::Bool => std::option::Option::Some(1),
6303 Self::Int64 => std::option::Option::Some(2),
6304 Self::Double => std::option::Option::Some(3),
6305 Self::String => std::option::Option::Some(4),
6306 Self::Distribution => std::option::Option::Some(5),
6307 Self::Money => std::option::Option::Some(6),
6308 Self::UnknownValue(u) => u.0.value(),
6309 }
6310 }
6311
6312 /// Gets the enum value as a string.
6313 ///
6314 /// Returns `None` if the enum contains an unknown value deserialized from
6315 /// the integer representation of enums.
6316 pub fn name(&self) -> std::option::Option<&str> {
6317 match self {
6318 Self::Unspecified => std::option::Option::Some("VALUE_TYPE_UNSPECIFIED"),
6319 Self::Bool => std::option::Option::Some("BOOL"),
6320 Self::Int64 => std::option::Option::Some("INT64"),
6321 Self::Double => std::option::Option::Some("DOUBLE"),
6322 Self::String => std::option::Option::Some("STRING"),
6323 Self::Distribution => std::option::Option::Some("DISTRIBUTION"),
6324 Self::Money => std::option::Option::Some("MONEY"),
6325 Self::UnknownValue(u) => u.0.name(),
6326 }
6327 }
6328 }
6329
6330 impl std::default::Default for ValueType {
6331 fn default() -> Self {
6332 use std::convert::From;
6333 Self::from(0)
6334 }
6335 }
6336
6337 impl std::fmt::Display for ValueType {
6338 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6339 wkt::internal::display_enum(f, self.name(), self.value())
6340 }
6341 }
6342
6343 impl std::convert::From<i32> for ValueType {
6344 fn from(value: i32) -> Self {
6345 match value {
6346 0 => Self::Unspecified,
6347 1 => Self::Bool,
6348 2 => Self::Int64,
6349 3 => Self::Double,
6350 4 => Self::String,
6351 5 => Self::Distribution,
6352 6 => Self::Money,
6353 _ => Self::UnknownValue(value_type::UnknownValue(
6354 wkt::internal::UnknownEnumValue::Integer(value),
6355 )),
6356 }
6357 }
6358 }
6359
6360 impl std::convert::From<&str> for ValueType {
6361 fn from(value: &str) -> Self {
6362 use std::string::ToString;
6363 match value {
6364 "VALUE_TYPE_UNSPECIFIED" => Self::Unspecified,
6365 "BOOL" => Self::Bool,
6366 "INT64" => Self::Int64,
6367 "DOUBLE" => Self::Double,
6368 "STRING" => Self::String,
6369 "DISTRIBUTION" => Self::Distribution,
6370 "MONEY" => Self::Money,
6371 _ => Self::UnknownValue(value_type::UnknownValue(
6372 wkt::internal::UnknownEnumValue::String(value.to_string()),
6373 )),
6374 }
6375 }
6376 }
6377
6378 impl serde::ser::Serialize for ValueType {
6379 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6380 where
6381 S: serde::Serializer,
6382 {
6383 match self {
6384 Self::Unspecified => serializer.serialize_i32(0),
6385 Self::Bool => serializer.serialize_i32(1),
6386 Self::Int64 => serializer.serialize_i32(2),
6387 Self::Double => serializer.serialize_i32(3),
6388 Self::String => serializer.serialize_i32(4),
6389 Self::Distribution => serializer.serialize_i32(5),
6390 Self::Money => serializer.serialize_i32(6),
6391 Self::UnknownValue(u) => u.0.serialize(serializer),
6392 }
6393 }
6394 }
6395
6396 impl<'de> serde::de::Deserialize<'de> for ValueType {
6397 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6398 where
6399 D: serde::Deserializer<'de>,
6400 {
6401 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ValueType>::new(
6402 ".google.api.MetricDescriptor.ValueType",
6403 ))
6404 }
6405 }
6406}
6407
6408/// A specific metric, identified by specifying values for all of the
6409/// labels of a [`MetricDescriptor`][google.api.MetricDescriptor].
6410///
6411/// [google.api.MetricDescriptor]: crate::model::MetricDescriptor
6412#[serde_with::serde_as]
6413#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
6414#[serde(default, rename_all = "camelCase")]
6415#[non_exhaustive]
6416pub struct Metric {
6417 /// An existing metric type, see
6418 /// [google.api.MetricDescriptor][google.api.MetricDescriptor]. For example,
6419 /// `custom.googleapis.com/invoice/paid/amount`.
6420 ///
6421 /// [google.api.MetricDescriptor]: crate::model::MetricDescriptor
6422 #[serde(rename = "type")]
6423 #[serde(skip_serializing_if = "std::string::String::is_empty")]
6424 pub r#type: std::string::String,
6425
6426 /// The set of label values that uniquely identify this metric. All
6427 /// labels listed in the `MetricDescriptor` must be assigned values.
6428 #[serde(skip_serializing_if = "std::collections::HashMap::is_empty")]
6429 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
6430
6431 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
6432 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6433}
6434
6435impl Metric {
6436 pub fn new() -> Self {
6437 std::default::Default::default()
6438 }
6439
6440 /// Sets the value of [r#type][crate::model::Metric::type].
6441 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6442 self.r#type = v.into();
6443 self
6444 }
6445
6446 /// Sets the value of [labels][crate::model::Metric::labels].
6447 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
6448 where
6449 T: std::iter::IntoIterator<Item = (K, V)>,
6450 K: std::convert::Into<std::string::String>,
6451 V: std::convert::Into<std::string::String>,
6452 {
6453 use std::iter::Iterator;
6454 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6455 self
6456 }
6457}
6458
6459impl wkt::message::Message for Metric {
6460 fn typename() -> &'static str {
6461 "type.googleapis.com/google.api.Metric"
6462 }
6463}
6464
6465/// An object that describes the schema of a
6466/// [MonitoredResource][google.api.MonitoredResource] object using a type name
6467/// and a set of labels. For example, the monitored resource descriptor for
6468/// Google Compute Engine VM instances has a type of
6469/// `"gce_instance"` and specifies the use of the labels `"instance_id"` and
6470/// `"zone"` to identify particular VM instances.
6471///
6472/// Different APIs can support different monitored resource types. APIs generally
6473/// provide a `list` method that returns the monitored resource descriptors used
6474/// by the API.
6475///
6476/// [google.api.MonitoredResource]: crate::model::MonitoredResource
6477#[serde_with::serde_as]
6478#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
6479#[serde(default, rename_all = "camelCase")]
6480#[non_exhaustive]
6481pub struct MonitoredResourceDescriptor {
6482 /// Optional. The resource name of the monitored resource descriptor:
6483 /// `"projects/{project_id}/monitoredResourceDescriptors/{type}"` where
6484 /// {type} is the value of the `type` field in this object and
6485 /// {project_id} is a project ID that provides API-specific context for
6486 /// accessing the type. APIs that do not use project information can use the
6487 /// resource name format `"monitoredResourceDescriptors/{type}"`.
6488 #[serde(skip_serializing_if = "std::string::String::is_empty")]
6489 pub name: std::string::String,
6490
6491 /// Required. The monitored resource type. For example, the type
6492 /// `"cloudsql_database"` represents databases in Google Cloud SQL.
6493 /// For a list of types, see [Monitored resource
6494 /// types](https://cloud.google.com/monitoring/api/resources)
6495 /// and [Logging resource
6496 /// types](https://cloud.google.com/logging/docs/api/v2/resource-list).
6497 #[serde(rename = "type")]
6498 #[serde(skip_serializing_if = "std::string::String::is_empty")]
6499 pub r#type: std::string::String,
6500
6501 /// Optional. A concise name for the monitored resource type that might be
6502 /// displayed in user interfaces. It should be a Title Cased Noun Phrase,
6503 /// without any article or other determiners. For example,
6504 /// `"Google Cloud SQL Database"`.
6505 #[serde(skip_serializing_if = "std::string::String::is_empty")]
6506 pub display_name: std::string::String,
6507
6508 /// Optional. A detailed description of the monitored resource type that might
6509 /// be used in documentation.
6510 #[serde(skip_serializing_if = "std::string::String::is_empty")]
6511 pub description: std::string::String,
6512
6513 /// Required. A set of labels used to describe instances of this monitored
6514 /// resource type. For example, an individual Google Cloud SQL database is
6515 /// identified by values for the labels `"database_id"` and `"zone"`.
6516 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
6517 pub labels: std::vec::Vec<crate::model::LabelDescriptor>,
6518
6519 /// Optional. The launch stage of the monitored resource definition.
6520 pub launch_stage: crate::model::LaunchStage,
6521
6522 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
6523 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6524}
6525
6526impl MonitoredResourceDescriptor {
6527 pub fn new() -> Self {
6528 std::default::Default::default()
6529 }
6530
6531 /// Sets the value of [name][crate::model::MonitoredResourceDescriptor::name].
6532 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6533 self.name = v.into();
6534 self
6535 }
6536
6537 /// Sets the value of [r#type][crate::model::MonitoredResourceDescriptor::type].
6538 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6539 self.r#type = v.into();
6540 self
6541 }
6542
6543 /// Sets the value of [display_name][crate::model::MonitoredResourceDescriptor::display_name].
6544 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6545 self.display_name = v.into();
6546 self
6547 }
6548
6549 /// Sets the value of [description][crate::model::MonitoredResourceDescriptor::description].
6550 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6551 self.description = v.into();
6552 self
6553 }
6554
6555 /// Sets the value of [labels][crate::model::MonitoredResourceDescriptor::labels].
6556 pub fn set_labels<T, V>(mut self, v: T) -> Self
6557 where
6558 T: std::iter::IntoIterator<Item = V>,
6559 V: std::convert::Into<crate::model::LabelDescriptor>,
6560 {
6561 use std::iter::Iterator;
6562 self.labels = v.into_iter().map(|i| i.into()).collect();
6563 self
6564 }
6565
6566 /// Sets the value of [launch_stage][crate::model::MonitoredResourceDescriptor::launch_stage].
6567 pub fn set_launch_stage<T: std::convert::Into<crate::model::LaunchStage>>(
6568 mut self,
6569 v: T,
6570 ) -> Self {
6571 self.launch_stage = v.into();
6572 self
6573 }
6574}
6575
6576impl wkt::message::Message for MonitoredResourceDescriptor {
6577 fn typename() -> &'static str {
6578 "type.googleapis.com/google.api.MonitoredResourceDescriptor"
6579 }
6580}
6581
6582/// An object representing a resource that can be used for monitoring, logging,
6583/// billing, or other purposes. Examples include virtual machine instances,
6584/// databases, and storage devices such as disks. The `type` field identifies a
6585/// [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] object
6586/// that describes the resource's schema. Information in the `labels` field
6587/// identifies the actual resource and its attributes according to the schema.
6588/// For example, a particular Compute Engine VM instance could be represented by
6589/// the following object, because the
6590/// [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] for
6591/// `"gce_instance"` has labels
6592/// `"project_id"`, `"instance_id"` and `"zone"`:
6593///
6594/// ```norust
6595/// { "type": "gce_instance",
6596/// "labels": { "project_id": "my-project",
6597/// "instance_id": "12345678901234",
6598/// "zone": "us-central1-a" }}
6599/// ```
6600///
6601/// [google.api.MonitoredResourceDescriptor]: crate::model::MonitoredResourceDescriptor
6602#[serde_with::serde_as]
6603#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
6604#[serde(default, rename_all = "camelCase")]
6605#[non_exhaustive]
6606pub struct MonitoredResource {
6607 /// Required. The monitored resource type. This field must match
6608 /// the `type` field of a
6609 /// [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor]
6610 /// object. For example, the type of a Compute Engine VM instance is
6611 /// `gce_instance`. Some descriptors include the service name in the type; for
6612 /// example, the type of a Datastream stream is
6613 /// `datastream.googleapis.com/Stream`.
6614 ///
6615 /// [google.api.MonitoredResourceDescriptor]: crate::model::MonitoredResourceDescriptor
6616 #[serde(rename = "type")]
6617 #[serde(skip_serializing_if = "std::string::String::is_empty")]
6618 pub r#type: std::string::String,
6619
6620 /// Required. Values for all of the labels listed in the associated monitored
6621 /// resource descriptor. For example, Compute Engine VM instances use the
6622 /// labels `"project_id"`, `"instance_id"`, and `"zone"`.
6623 #[serde(skip_serializing_if = "std::collections::HashMap::is_empty")]
6624 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
6625
6626 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
6627 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6628}
6629
6630impl MonitoredResource {
6631 pub fn new() -> Self {
6632 std::default::Default::default()
6633 }
6634
6635 /// Sets the value of [r#type][crate::model::MonitoredResource::type].
6636 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6637 self.r#type = v.into();
6638 self
6639 }
6640
6641 /// Sets the value of [labels][crate::model::MonitoredResource::labels].
6642 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
6643 where
6644 T: std::iter::IntoIterator<Item = (K, V)>,
6645 K: std::convert::Into<std::string::String>,
6646 V: std::convert::Into<std::string::String>,
6647 {
6648 use std::iter::Iterator;
6649 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6650 self
6651 }
6652}
6653
6654impl wkt::message::Message for MonitoredResource {
6655 fn typename() -> &'static str {
6656 "type.googleapis.com/google.api.MonitoredResource"
6657 }
6658}
6659
6660/// Auxiliary metadata for a [MonitoredResource][google.api.MonitoredResource]
6661/// object. [MonitoredResource][google.api.MonitoredResource] objects contain the
6662/// minimum set of information to uniquely identify a monitored resource
6663/// instance. There is some other useful auxiliary metadata. Monitoring and
6664/// Logging use an ingestion pipeline to extract metadata for cloud resources of
6665/// all types, and store the metadata in this message.
6666///
6667/// [google.api.MonitoredResource]: crate::model::MonitoredResource
6668#[serde_with::serde_as]
6669#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
6670#[serde(default, rename_all = "camelCase")]
6671#[non_exhaustive]
6672pub struct MonitoredResourceMetadata {
6673 /// Output only. Values for predefined system metadata labels.
6674 /// System labels are a kind of metadata extracted by Google, including
6675 /// "machine_image", "vpc", "subnet_id",
6676 /// "security_group", "name", etc.
6677 /// System label values can be only strings, Boolean values, or a list of
6678 /// strings. For example:
6679 ///
6680 /// ```norust
6681 /// { "name": "my-test-instance",
6682 /// "security_group": ["a", "b", "c"],
6683 /// "spot_instance": false }
6684 /// ```
6685 #[serde(skip_serializing_if = "std::option::Option::is_none")]
6686 pub system_labels: std::option::Option<wkt::Struct>,
6687
6688 /// Output only. A map of user-defined metadata labels.
6689 #[serde(skip_serializing_if = "std::collections::HashMap::is_empty")]
6690 pub user_labels: std::collections::HashMap<std::string::String, std::string::String>,
6691
6692 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
6693 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6694}
6695
6696impl MonitoredResourceMetadata {
6697 pub fn new() -> Self {
6698 std::default::Default::default()
6699 }
6700
6701 /// Sets the value of [system_labels][crate::model::MonitoredResourceMetadata::system_labels].
6702 pub fn set_system_labels<T: std::convert::Into<std::option::Option<wkt::Struct>>>(
6703 mut self,
6704 v: T,
6705 ) -> Self {
6706 self.system_labels = v.into();
6707 self
6708 }
6709
6710 /// Sets the value of [user_labels][crate::model::MonitoredResourceMetadata::user_labels].
6711 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
6712 where
6713 T: std::iter::IntoIterator<Item = (K, V)>,
6714 K: std::convert::Into<std::string::String>,
6715 V: std::convert::Into<std::string::String>,
6716 {
6717 use std::iter::Iterator;
6718 self.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6719 self
6720 }
6721}
6722
6723impl wkt::message::Message for MonitoredResourceMetadata {
6724 fn typename() -> &'static str {
6725 "type.googleapis.com/google.api.MonitoredResourceMetadata"
6726 }
6727}
6728
6729/// Monitoring configuration of the service.
6730///
6731/// The example below shows how to configure monitored resources and metrics
6732/// for monitoring. In the example, a monitored resource and two metrics are
6733/// defined. The `library.googleapis.com/book/returned_count` metric is sent
6734/// to both producer and consumer projects, whereas the
6735/// `library.googleapis.com/book/num_overdue` metric is only sent to the
6736/// consumer project.
6737///
6738/// ```norust
6739/// monitored_resources:
6740/// - type: library.googleapis.com/Branch
6741/// display_name: "Library Branch"
6742/// description: "A branch of a library."
6743/// launch_stage: GA
6744/// labels:
6745/// - key: resource_container
6746/// description: "The Cloud container (ie. project id) for the Branch."
6747/// - key: location
6748/// description: "The location of the library branch."
6749/// - key: branch_id
6750/// description: "The id of the branch."
6751/// metrics:
6752/// - name: library.googleapis.com/book/returned_count
6753/// display_name: "Books Returned"
6754/// description: "The count of books that have been returned."
6755/// launch_stage: GA
6756/// metric_kind: DELTA
6757/// value_type: INT64
6758/// unit: "1"
6759/// labels:
6760/// - key: customer_id
6761/// description: "The id of the customer."
6762/// - name: library.googleapis.com/book/num_overdue
6763/// display_name: "Books Overdue"
6764/// description: "The current number of overdue books."
6765/// launch_stage: GA
6766/// metric_kind: GAUGE
6767/// value_type: INT64
6768/// unit: "1"
6769/// labels:
6770/// - key: customer_id
6771/// description: "The id of the customer."
6772/// monitoring:
6773/// producer_destinations:
6774/// - monitored_resource: library.googleapis.com/Branch
6775/// metrics:
6776/// - library.googleapis.com/book/returned_count
6777/// consumer_destinations:
6778/// - monitored_resource: library.googleapis.com/Branch
6779/// metrics:
6780/// - library.googleapis.com/book/returned_count
6781/// - library.googleapis.com/book/num_overdue
6782/// ```
6783#[serde_with::serde_as]
6784#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
6785#[serde(default, rename_all = "camelCase")]
6786#[non_exhaustive]
6787pub struct Monitoring {
6788 /// Monitoring configurations for sending metrics to the producer project.
6789 /// There can be multiple producer destinations. A monitored resource type may
6790 /// appear in multiple monitoring destinations if different aggregations are
6791 /// needed for different sets of metrics associated with that monitored
6792 /// resource type. A monitored resource and metric pair may only be used once
6793 /// in the Monitoring configuration.
6794 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
6795 pub producer_destinations: std::vec::Vec<crate::model::monitoring::MonitoringDestination>,
6796
6797 /// Monitoring configurations for sending metrics to the consumer project.
6798 /// There can be multiple consumer destinations. A monitored resource type may
6799 /// appear in multiple monitoring destinations if different aggregations are
6800 /// needed for different sets of metrics associated with that monitored
6801 /// resource type. A monitored resource and metric pair may only be used once
6802 /// in the Monitoring configuration.
6803 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
6804 pub consumer_destinations: std::vec::Vec<crate::model::monitoring::MonitoringDestination>,
6805
6806 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
6807 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6808}
6809
6810impl Monitoring {
6811 pub fn new() -> Self {
6812 std::default::Default::default()
6813 }
6814
6815 /// Sets the value of [producer_destinations][crate::model::Monitoring::producer_destinations].
6816 pub fn set_producer_destinations<T, V>(mut self, v: T) -> Self
6817 where
6818 T: std::iter::IntoIterator<Item = V>,
6819 V: std::convert::Into<crate::model::monitoring::MonitoringDestination>,
6820 {
6821 use std::iter::Iterator;
6822 self.producer_destinations = v.into_iter().map(|i| i.into()).collect();
6823 self
6824 }
6825
6826 /// Sets the value of [consumer_destinations][crate::model::Monitoring::consumer_destinations].
6827 pub fn set_consumer_destinations<T, V>(mut self, v: T) -> Self
6828 where
6829 T: std::iter::IntoIterator<Item = V>,
6830 V: std::convert::Into<crate::model::monitoring::MonitoringDestination>,
6831 {
6832 use std::iter::Iterator;
6833 self.consumer_destinations = v.into_iter().map(|i| i.into()).collect();
6834 self
6835 }
6836}
6837
6838impl wkt::message::Message for Monitoring {
6839 fn typename() -> &'static str {
6840 "type.googleapis.com/google.api.Monitoring"
6841 }
6842}
6843
6844/// Defines additional types related to [Monitoring].
6845pub mod monitoring {
6846 #[allow(unused_imports)]
6847 use super::*;
6848
6849 /// Configuration of a specific monitoring destination (the producer project
6850 /// or the consumer project).
6851 #[serde_with::serde_as]
6852 #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
6853 #[serde(default, rename_all = "camelCase")]
6854 #[non_exhaustive]
6855 pub struct MonitoringDestination {
6856 /// The monitored resource type. The type must be defined in
6857 /// [Service.monitored_resources][google.api.Service.monitored_resources]
6858 /// section.
6859 ///
6860 /// [google.api.Service.monitored_resources]: crate::model::Service::monitored_resources
6861 #[serde(skip_serializing_if = "std::string::String::is_empty")]
6862 pub monitored_resource: std::string::String,
6863
6864 /// Types of the metrics to report to this monitoring destination.
6865 /// Each type must be defined in
6866 /// [Service.metrics][google.api.Service.metrics] section.
6867 ///
6868 /// [google.api.Service.metrics]: crate::model::Service::metrics
6869 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
6870 pub metrics: std::vec::Vec<std::string::String>,
6871
6872 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
6873 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6874 }
6875
6876 impl MonitoringDestination {
6877 pub fn new() -> Self {
6878 std::default::Default::default()
6879 }
6880
6881 /// Sets the value of [monitored_resource][crate::model::monitoring::MonitoringDestination::monitored_resource].
6882 pub fn set_monitored_resource<T: std::convert::Into<std::string::String>>(
6883 mut self,
6884 v: T,
6885 ) -> Self {
6886 self.monitored_resource = v.into();
6887 self
6888 }
6889
6890 /// Sets the value of [metrics][crate::model::monitoring::MonitoringDestination::metrics].
6891 pub fn set_metrics<T, V>(mut self, v: T) -> Self
6892 where
6893 T: std::iter::IntoIterator<Item = V>,
6894 V: std::convert::Into<std::string::String>,
6895 {
6896 use std::iter::Iterator;
6897 self.metrics = v.into_iter().map(|i| i.into()).collect();
6898 self
6899 }
6900 }
6901
6902 impl wkt::message::Message for MonitoringDestination {
6903 fn typename() -> &'static str {
6904 "type.googleapis.com/google.api.Monitoring.MonitoringDestination"
6905 }
6906 }
6907}
6908
6909/// Google API Policy Annotation
6910///
6911/// This message defines a simple API policy annotation that can be used to
6912/// annotate API request and response message fields with applicable policies.
6913/// One field may have multiple applicable policies that must all be satisfied
6914/// before a request can be processed. This policy annotation is used to
6915/// generate the overall policy that will be used for automatic runtime
6916/// policy enforcement and documentation generation.
6917#[serde_with::serde_as]
6918#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
6919#[serde(default, rename_all = "camelCase")]
6920#[non_exhaustive]
6921pub struct FieldPolicy {
6922 /// Selects one or more request or response message fields to apply this
6923 /// `FieldPolicy`.
6924 ///
6925 /// When a `FieldPolicy` is used in proto annotation, the selector must
6926 /// be left as empty. The service config generator will automatically fill
6927 /// the correct value.
6928 ///
6929 /// When a `FieldPolicy` is used in service config, the selector must be a
6930 /// comma-separated string with valid request or response field paths,
6931 /// such as "foo.bar" or "foo.bar,foo.baz".
6932 #[serde(skip_serializing_if = "std::string::String::is_empty")]
6933 pub selector: std::string::String,
6934
6935 /// Specifies the required permission(s) for the resource referred to by the
6936 /// field. It requires the field contains a valid resource reference, and
6937 /// the request must pass the permission checks to proceed. For example,
6938 /// "resourcemanager.projects.get".
6939 #[serde(skip_serializing_if = "std::string::String::is_empty")]
6940 pub resource_permission: std::string::String,
6941
6942 /// Specifies the resource type for the resource referred to by the field.
6943 #[serde(skip_serializing_if = "std::string::String::is_empty")]
6944 pub resource_type: std::string::String,
6945
6946 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
6947 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6948}
6949
6950impl FieldPolicy {
6951 pub fn new() -> Self {
6952 std::default::Default::default()
6953 }
6954
6955 /// Sets the value of [selector][crate::model::FieldPolicy::selector].
6956 pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6957 self.selector = v.into();
6958 self
6959 }
6960
6961 /// Sets the value of [resource_permission][crate::model::FieldPolicy::resource_permission].
6962 pub fn set_resource_permission<T: std::convert::Into<std::string::String>>(
6963 mut self,
6964 v: T,
6965 ) -> Self {
6966 self.resource_permission = v.into();
6967 self
6968 }
6969
6970 /// Sets the value of [resource_type][crate::model::FieldPolicy::resource_type].
6971 pub fn set_resource_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6972 self.resource_type = v.into();
6973 self
6974 }
6975}
6976
6977impl wkt::message::Message for FieldPolicy {
6978 fn typename() -> &'static str {
6979 "type.googleapis.com/google.api.FieldPolicy"
6980 }
6981}
6982
6983/// Defines policies applying to an RPC method.
6984#[serde_with::serde_as]
6985#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
6986#[serde(default, rename_all = "camelCase")]
6987#[non_exhaustive]
6988pub struct MethodPolicy {
6989 /// Selects a method to which these policies should be enforced, for example,
6990 /// "google.pubsub.v1.Subscriber.CreateSubscription".
6991 ///
6992 /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
6993 /// details.
6994 ///
6995 /// NOTE: This field must not be set in the proto annotation. It will be
6996 /// automatically filled by the service config compiler .
6997 ///
6998 /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
6999 #[serde(skip_serializing_if = "std::string::String::is_empty")]
7000 pub selector: std::string::String,
7001
7002 /// Policies that are applicable to the request message.
7003 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
7004 pub request_policies: std::vec::Vec<crate::model::FieldPolicy>,
7005
7006 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
7007 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7008}
7009
7010impl MethodPolicy {
7011 pub fn new() -> Self {
7012 std::default::Default::default()
7013 }
7014
7015 /// Sets the value of [selector][crate::model::MethodPolicy::selector].
7016 pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7017 self.selector = v.into();
7018 self
7019 }
7020
7021 /// Sets the value of [request_policies][crate::model::MethodPolicy::request_policies].
7022 pub fn set_request_policies<T, V>(mut self, v: T) -> Self
7023 where
7024 T: std::iter::IntoIterator<Item = V>,
7025 V: std::convert::Into<crate::model::FieldPolicy>,
7026 {
7027 use std::iter::Iterator;
7028 self.request_policies = v.into_iter().map(|i| i.into()).collect();
7029 self
7030 }
7031}
7032
7033impl wkt::message::Message for MethodPolicy {
7034 fn typename() -> &'static str {
7035 "type.googleapis.com/google.api.MethodPolicy"
7036 }
7037}
7038
7039/// Quota configuration helps to achieve fairness and budgeting in service
7040/// usage.
7041///
7042/// The metric based quota configuration works this way:
7043///
7044/// - The service configuration defines a set of metrics.
7045/// - For API calls, the quota.metric_rules maps methods to metrics with
7046/// corresponding costs.
7047/// - The quota.limits defines limits on the metrics, which will be used for
7048/// quota checks at runtime.
7049///
7050/// An example quota configuration in yaml format:
7051///
7052/// quota:
7053/// limits:
7054///
7055/// ```norust
7056/// - name: apiWriteQpsPerProject
7057/// metric: library.googleapis.com/write_calls
7058/// unit: "1/min/{project}" # rate limit for consumer projects
7059/// values:
7060/// STANDARD: 10000
7061///
7062///
7063/// (The metric rules bind all methods to the read_calls metric,
7064/// except for the UpdateBook and DeleteBook methods. These two methods
7065/// are mapped to the write_calls metric, with the UpdateBook method
7066/// consuming at twice rate as the DeleteBook method.)
7067/// metric_rules:
7068/// - selector: "*"
7069/// metric_costs:
7070/// library.googleapis.com/read_calls: 1
7071/// - selector: google.example.library.v1.LibraryService.UpdateBook
7072/// metric_costs:
7073/// library.googleapis.com/write_calls: 2
7074/// - selector: google.example.library.v1.LibraryService.DeleteBook
7075/// metric_costs:
7076/// library.googleapis.com/write_calls: 1
7077/// ```
7078///
7079/// Corresponding Metric definition:
7080///
7081/// ```norust
7082/// metrics:
7083/// - name: library.googleapis.com/read_calls
7084/// display_name: Read requests
7085/// metric_kind: DELTA
7086/// value_type: INT64
7087///
7088/// - name: library.googleapis.com/write_calls
7089/// display_name: Write requests
7090/// metric_kind: DELTA
7091/// value_type: INT64
7092/// ```
7093#[serde_with::serde_as]
7094#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
7095#[serde(default, rename_all = "camelCase")]
7096#[non_exhaustive]
7097pub struct Quota {
7098 /// List of QuotaLimit definitions for the service.
7099 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
7100 pub limits: std::vec::Vec<crate::model::QuotaLimit>,
7101
7102 /// List of MetricRule definitions, each one mapping a selected method to one
7103 /// or more metrics.
7104 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
7105 pub metric_rules: std::vec::Vec<crate::model::MetricRule>,
7106
7107 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
7108 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7109}
7110
7111impl Quota {
7112 pub fn new() -> Self {
7113 std::default::Default::default()
7114 }
7115
7116 /// Sets the value of [limits][crate::model::Quota::limits].
7117 pub fn set_limits<T, V>(mut self, v: T) -> Self
7118 where
7119 T: std::iter::IntoIterator<Item = V>,
7120 V: std::convert::Into<crate::model::QuotaLimit>,
7121 {
7122 use std::iter::Iterator;
7123 self.limits = v.into_iter().map(|i| i.into()).collect();
7124 self
7125 }
7126
7127 /// Sets the value of [metric_rules][crate::model::Quota::metric_rules].
7128 pub fn set_metric_rules<T, V>(mut self, v: T) -> Self
7129 where
7130 T: std::iter::IntoIterator<Item = V>,
7131 V: std::convert::Into<crate::model::MetricRule>,
7132 {
7133 use std::iter::Iterator;
7134 self.metric_rules = v.into_iter().map(|i| i.into()).collect();
7135 self
7136 }
7137}
7138
7139impl wkt::message::Message for Quota {
7140 fn typename() -> &'static str {
7141 "type.googleapis.com/google.api.Quota"
7142 }
7143}
7144
7145/// Bind API methods to metrics. Binding a method to a metric causes that
7146/// metric's configured quota behaviors to apply to the method call.
7147#[serde_with::serde_as]
7148#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
7149#[serde(default, rename_all = "camelCase")]
7150#[non_exhaustive]
7151pub struct MetricRule {
7152 /// Selects the methods to which this rule applies.
7153 ///
7154 /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
7155 /// details.
7156 ///
7157 /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
7158 #[serde(skip_serializing_if = "std::string::String::is_empty")]
7159 pub selector: std::string::String,
7160
7161 /// Metrics to update when the selected methods are called, and the associated
7162 /// cost applied to each metric.
7163 ///
7164 /// The key of the map is the metric name, and the values are the amount
7165 /// increased for the metric against which the quota limits are defined.
7166 /// The value must not be negative.
7167 #[serde(skip_serializing_if = "std::collections::HashMap::is_empty")]
7168 #[serde_as(as = "std::collections::HashMap<_, serde_with::DisplayFromStr>")]
7169 pub metric_costs: std::collections::HashMap<std::string::String, i64>,
7170
7171 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
7172 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7173}
7174
7175impl MetricRule {
7176 pub fn new() -> Self {
7177 std::default::Default::default()
7178 }
7179
7180 /// Sets the value of [selector][crate::model::MetricRule::selector].
7181 pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7182 self.selector = v.into();
7183 self
7184 }
7185
7186 /// Sets the value of [metric_costs][crate::model::MetricRule::metric_costs].
7187 pub fn set_metric_costs<T, K, V>(mut self, v: T) -> Self
7188 where
7189 T: std::iter::IntoIterator<Item = (K, V)>,
7190 K: std::convert::Into<std::string::String>,
7191 V: std::convert::Into<i64>,
7192 {
7193 use std::iter::Iterator;
7194 self.metric_costs = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7195 self
7196 }
7197}
7198
7199impl wkt::message::Message for MetricRule {
7200 fn typename() -> &'static str {
7201 "type.googleapis.com/google.api.MetricRule"
7202 }
7203}
7204
7205/// `QuotaLimit` defines a specific limit that applies over a specified duration
7206/// for a limit type. There can be at most one limit for a duration and limit
7207/// type combination defined within a `QuotaGroup`.
7208#[serde_with::serde_as]
7209#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
7210#[serde(default, rename_all = "camelCase")]
7211#[non_exhaustive]
7212pub struct QuotaLimit {
7213 /// Name of the quota limit.
7214 ///
7215 /// The name must be provided, and it must be unique within the service. The
7216 /// name can only include alphanumeric characters as well as '-'.
7217 ///
7218 /// The maximum length of the limit name is 64 characters.
7219 #[serde(skip_serializing_if = "std::string::String::is_empty")]
7220 pub name: std::string::String,
7221
7222 /// Optional. User-visible, extended description for this quota limit.
7223 /// Should be used only when more context is needed to understand this limit
7224 /// than provided by the limit's display name (see: `display_name`).
7225 #[serde(skip_serializing_if = "std::string::String::is_empty")]
7226 pub description: std::string::String,
7227
7228 /// Default number of tokens that can be consumed during the specified
7229 /// duration. This is the number of tokens assigned when a client
7230 /// application developer activates the service for his/her project.
7231 ///
7232 /// Specifying a value of 0 will block all requests. This can be used if you
7233 /// are provisioning quota to selected consumers and blocking others.
7234 /// Similarly, a value of -1 will indicate an unlimited quota. No other
7235 /// negative values are allowed.
7236 ///
7237 /// Used by group-based quotas only.
7238 #[serde(skip_serializing_if = "wkt::internal::is_default")]
7239 #[serde_as(as = "serde_with::DisplayFromStr")]
7240 pub default_limit: i64,
7241
7242 /// Maximum number of tokens that can be consumed during the specified
7243 /// duration. Client application developers can override the default limit up
7244 /// to this maximum. If specified, this value cannot be set to a value less
7245 /// than the default limit. If not specified, it is set to the default limit.
7246 ///
7247 /// To allow clients to apply overrides with no upper bound, set this to -1,
7248 /// indicating unlimited maximum quota.
7249 ///
7250 /// Used by group-based quotas only.
7251 #[serde(skip_serializing_if = "wkt::internal::is_default")]
7252 #[serde_as(as = "serde_with::DisplayFromStr")]
7253 pub max_limit: i64,
7254
7255 /// Free tier value displayed in the Developers Console for this limit.
7256 /// The free tier is the number of tokens that will be subtracted from the
7257 /// billed amount when billing is enabled.
7258 /// This field can only be set on a limit with duration "1d", in a billable
7259 /// group; it is invalid on any other limit. If this field is not set, it
7260 /// defaults to 0, indicating that there is no free tier for this service.
7261 ///
7262 /// Used by group-based quotas only.
7263 #[serde(skip_serializing_if = "wkt::internal::is_default")]
7264 #[serde_as(as = "serde_with::DisplayFromStr")]
7265 pub free_tier: i64,
7266
7267 /// Duration of this limit in textual notation. Must be "100s" or "1d".
7268 ///
7269 /// Used by group-based quotas only.
7270 #[serde(skip_serializing_if = "std::string::String::is_empty")]
7271 pub duration: std::string::String,
7272
7273 /// The name of the metric this quota limit applies to. The quota limits with
7274 /// the same metric will be checked together during runtime. The metric must be
7275 /// defined within the service config.
7276 #[serde(skip_serializing_if = "std::string::String::is_empty")]
7277 pub metric: std::string::String,
7278
7279 /// Specify the unit of the quota limit. It uses the same syntax as
7280 /// [MetricDescriptor.unit][google.api.MetricDescriptor.unit]. The supported
7281 /// unit kinds are determined by the quota backend system.
7282 ///
7283 /// Here are some examples:
7284 ///
7285 /// * "1/min/{project}" for quota per minute per project.
7286 ///
7287 /// Note: the order of unit components is insignificant.
7288 /// The "1" at the beginning is required to follow the metric unit syntax.
7289 ///
7290 /// [google.api.MetricDescriptor.unit]: crate::model::MetricDescriptor::unit
7291 #[serde(skip_serializing_if = "std::string::String::is_empty")]
7292 pub unit: std::string::String,
7293
7294 /// Tiered limit values. You must specify this as a key:value pair, with an
7295 /// integer value that is the maximum number of requests allowed for the
7296 /// specified unit. Currently only STANDARD is supported.
7297 #[serde(skip_serializing_if = "std::collections::HashMap::is_empty")]
7298 #[serde_as(as = "std::collections::HashMap<_, serde_with::DisplayFromStr>")]
7299 pub values: std::collections::HashMap<std::string::String, i64>,
7300
7301 /// User-visible display name for this limit.
7302 /// Optional. If not set, the UI will provide a default display name based on
7303 /// the quota configuration. This field can be used to override the default
7304 /// display name generated from the configuration.
7305 #[serde(skip_serializing_if = "std::string::String::is_empty")]
7306 pub display_name: std::string::String,
7307
7308 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
7309 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7310}
7311
7312impl QuotaLimit {
7313 pub fn new() -> Self {
7314 std::default::Default::default()
7315 }
7316
7317 /// Sets the value of [name][crate::model::QuotaLimit::name].
7318 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7319 self.name = v.into();
7320 self
7321 }
7322
7323 /// Sets the value of [description][crate::model::QuotaLimit::description].
7324 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7325 self.description = v.into();
7326 self
7327 }
7328
7329 /// Sets the value of [default_limit][crate::model::QuotaLimit::default_limit].
7330 pub fn set_default_limit<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
7331 self.default_limit = v.into();
7332 self
7333 }
7334
7335 /// Sets the value of [max_limit][crate::model::QuotaLimit::max_limit].
7336 pub fn set_max_limit<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
7337 self.max_limit = v.into();
7338 self
7339 }
7340
7341 /// Sets the value of [free_tier][crate::model::QuotaLimit::free_tier].
7342 pub fn set_free_tier<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
7343 self.free_tier = v.into();
7344 self
7345 }
7346
7347 /// Sets the value of [duration][crate::model::QuotaLimit::duration].
7348 pub fn set_duration<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7349 self.duration = v.into();
7350 self
7351 }
7352
7353 /// Sets the value of [metric][crate::model::QuotaLimit::metric].
7354 pub fn set_metric<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7355 self.metric = v.into();
7356 self
7357 }
7358
7359 /// Sets the value of [unit][crate::model::QuotaLimit::unit].
7360 pub fn set_unit<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7361 self.unit = v.into();
7362 self
7363 }
7364
7365 /// Sets the value of [values][crate::model::QuotaLimit::values].
7366 pub fn set_values<T, K, V>(mut self, v: T) -> Self
7367 where
7368 T: std::iter::IntoIterator<Item = (K, V)>,
7369 K: std::convert::Into<std::string::String>,
7370 V: std::convert::Into<i64>,
7371 {
7372 use std::iter::Iterator;
7373 self.values = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7374 self
7375 }
7376
7377 /// Sets the value of [display_name][crate::model::QuotaLimit::display_name].
7378 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7379 self.display_name = v.into();
7380 self
7381 }
7382}
7383
7384impl wkt::message::Message for QuotaLimit {
7385 fn typename() -> &'static str {
7386 "type.googleapis.com/google.api.QuotaLimit"
7387 }
7388}
7389
7390/// A simple descriptor of a resource type.
7391///
7392/// ResourceDescriptor annotates a resource message (either by means of a
7393/// protobuf annotation or use in the service config), and associates the
7394/// resource's schema, the resource type, and the pattern of the resource name.
7395///
7396/// Example:
7397///
7398/// ```norust
7399/// message Topic {
7400/// // Indicates this message defines a resource schema.
7401/// // Declares the resource type in the format of {service}/{kind}.
7402/// // For Kubernetes resources, the format is {api group}/{kind}.
7403/// option (google.api.resource) = {
7404/// type: "pubsub.googleapis.com/Topic"
7405/// pattern: "projects/{project}/topics/{topic}"
7406/// };
7407/// }
7408/// ```
7409///
7410/// The ResourceDescriptor Yaml config will look like:
7411///
7412/// ```norust
7413/// resources:
7414/// - type: "pubsub.googleapis.com/Topic"
7415/// pattern: "projects/{project}/topics/{topic}"
7416/// ```
7417///
7418/// Sometimes, resources have multiple patterns, typically because they can
7419/// live under multiple parents.
7420///
7421/// Example:
7422///
7423/// ```norust
7424/// message LogEntry {
7425/// option (google.api.resource) = {
7426/// type: "logging.googleapis.com/LogEntry"
7427/// pattern: "projects/{project}/logs/{log}"
7428/// pattern: "folders/{folder}/logs/{log}"
7429/// pattern: "organizations/{organization}/logs/{log}"
7430/// pattern: "billingAccounts/{billing_account}/logs/{log}"
7431/// };
7432/// }
7433/// ```
7434///
7435/// The ResourceDescriptor Yaml config will look like:
7436///
7437/// ```norust
7438/// resources:
7439/// - type: 'logging.googleapis.com/LogEntry'
7440/// pattern: "projects/{project}/logs/{log}"
7441/// pattern: "folders/{folder}/logs/{log}"
7442/// pattern: "organizations/{organization}/logs/{log}"
7443/// pattern: "billingAccounts/{billing_account}/logs/{log}"
7444/// ```
7445#[serde_with::serde_as]
7446#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
7447#[serde(default, rename_all = "camelCase")]
7448#[non_exhaustive]
7449pub struct ResourceDescriptor {
7450 /// The resource type. It must be in the format of
7451 /// {service_name}/{resource_type_kind}. The `resource_type_kind` must be
7452 /// singular and must not include version numbers.
7453 ///
7454 /// Example: `storage.googleapis.com/Bucket`
7455 ///
7456 /// The value of the resource_type_kind must follow the regular expression
7457 /// /[A-Za-z][a-zA-Z0-9]+/. It should start with an upper case character and
7458 /// should use PascalCase (UpperCamelCase). The maximum number of
7459 /// characters allowed for the `resource_type_kind` is 100.
7460 #[serde(rename = "type")]
7461 #[serde(skip_serializing_if = "std::string::String::is_empty")]
7462 pub r#type: std::string::String,
7463
7464 /// Optional. The relative resource name pattern associated with this resource
7465 /// type. The DNS prefix of the full resource name shouldn't be specified here.
7466 ///
7467 /// The path pattern must follow the syntax, which aligns with HTTP binding
7468 /// syntax:
7469 ///
7470 /// ```norust
7471 /// Template = Segment { "/" Segment } ;
7472 /// Segment = LITERAL | Variable ;
7473 /// Variable = "{" LITERAL "}" ;
7474 /// ```
7475 ///
7476 /// Examples:
7477 ///
7478 /// ```norust
7479 /// - "projects/{project}/topics/{topic}"
7480 /// - "projects/{project}/knowledgeBases/{knowledge_base}"
7481 /// ```
7482 ///
7483 /// The components in braces correspond to the IDs for each resource in the
7484 /// hierarchy. It is expected that, if multiple patterns are provided,
7485 /// the same component name (e.g. "project") refers to IDs of the same
7486 /// type of resource.
7487 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
7488 pub pattern: std::vec::Vec<std::string::String>,
7489
7490 /// Optional. The field on the resource that designates the resource name
7491 /// field. If omitted, this is assumed to be "name".
7492 #[serde(skip_serializing_if = "std::string::String::is_empty")]
7493 pub name_field: std::string::String,
7494
7495 /// Optional. The historical or future-looking state of the resource pattern.
7496 ///
7497 /// Example:
7498 ///
7499 /// ```norust
7500 /// // The InspectTemplate message originally only supported resource
7501 /// // names with organization, and project was added later.
7502 /// message InspectTemplate {
7503 /// option (google.api.resource) = {
7504 /// type: "dlp.googleapis.com/InspectTemplate"
7505 /// pattern:
7506 /// "organizations/{organization}/inspectTemplates/{inspect_template}"
7507 /// pattern: "projects/{project}/inspectTemplates/{inspect_template}"
7508 /// history: ORIGINALLY_SINGLE_PATTERN
7509 /// };
7510 /// }
7511 /// ```
7512 pub history: crate::model::resource_descriptor::History,
7513
7514 /// The plural name used in the resource name and permission names, such as
7515 /// 'projects' for the resource name of 'projects/{project}' and the permission
7516 /// name of 'cloudresourcemanager.googleapis.com/projects.get'. One exception
7517 /// to this is for Nested Collections that have stuttering names, as defined
7518 /// in [AIP-122](https://google.aip.dev/122#nested-collections), where the
7519 /// collection ID in the resource name pattern does not necessarily directly
7520 /// match the `plural` value.
7521 ///
7522 /// It is the same concept of the `plural` field in k8s CRD spec
7523 /// <https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/>
7524 ///
7525 /// Note: The plural form is required even for singleton resources. See
7526 /// <https://aip.dev/156>
7527 #[serde(skip_serializing_if = "std::string::String::is_empty")]
7528 pub plural: std::string::String,
7529
7530 /// The same concept of the `singular` field in k8s CRD spec
7531 /// <https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/>
7532 /// Such as "project" for the `resourcemanager.googleapis.com/Project` type.
7533 #[serde(skip_serializing_if = "std::string::String::is_empty")]
7534 pub singular: std::string::String,
7535
7536 /// Style flag(s) for this resource.
7537 /// These indicate that a resource is expected to conform to a given
7538 /// style. See the specific style flags for additional information.
7539 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
7540 pub style: std::vec::Vec<crate::model::resource_descriptor::Style>,
7541
7542 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
7543 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7544}
7545
7546impl ResourceDescriptor {
7547 pub fn new() -> Self {
7548 std::default::Default::default()
7549 }
7550
7551 /// Sets the value of [r#type][crate::model::ResourceDescriptor::type].
7552 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7553 self.r#type = v.into();
7554 self
7555 }
7556
7557 /// Sets the value of [pattern][crate::model::ResourceDescriptor::pattern].
7558 pub fn set_pattern<T, V>(mut self, v: T) -> Self
7559 where
7560 T: std::iter::IntoIterator<Item = V>,
7561 V: std::convert::Into<std::string::String>,
7562 {
7563 use std::iter::Iterator;
7564 self.pattern = v.into_iter().map(|i| i.into()).collect();
7565 self
7566 }
7567
7568 /// Sets the value of [name_field][crate::model::ResourceDescriptor::name_field].
7569 pub fn set_name_field<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7570 self.name_field = v.into();
7571 self
7572 }
7573
7574 /// Sets the value of [history][crate::model::ResourceDescriptor::history].
7575 pub fn set_history<T: std::convert::Into<crate::model::resource_descriptor::History>>(
7576 mut self,
7577 v: T,
7578 ) -> Self {
7579 self.history = v.into();
7580 self
7581 }
7582
7583 /// Sets the value of [plural][crate::model::ResourceDescriptor::plural].
7584 pub fn set_plural<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7585 self.plural = v.into();
7586 self
7587 }
7588
7589 /// Sets the value of [singular][crate::model::ResourceDescriptor::singular].
7590 pub fn set_singular<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7591 self.singular = v.into();
7592 self
7593 }
7594
7595 /// Sets the value of [style][crate::model::ResourceDescriptor::style].
7596 pub fn set_style<T, V>(mut self, v: T) -> Self
7597 where
7598 T: std::iter::IntoIterator<Item = V>,
7599 V: std::convert::Into<crate::model::resource_descriptor::Style>,
7600 {
7601 use std::iter::Iterator;
7602 self.style = v.into_iter().map(|i| i.into()).collect();
7603 self
7604 }
7605}
7606
7607impl wkt::message::Message for ResourceDescriptor {
7608 fn typename() -> &'static str {
7609 "type.googleapis.com/google.api.ResourceDescriptor"
7610 }
7611}
7612
7613/// Defines additional types related to [ResourceDescriptor].
7614pub mod resource_descriptor {
7615 #[allow(unused_imports)]
7616 use super::*;
7617
7618 /// A description of the historical or future-looking state of the
7619 /// resource pattern.
7620 ///
7621 /// # Working with unknown values
7622 ///
7623 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7624 /// additional enum variants at any time. Adding new variants is not considered
7625 /// a breaking change. Applications should write their code in anticipation of:
7626 ///
7627 /// - New values appearing in future releases of the client library, **and**
7628 /// - New values received dynamically, without application changes.
7629 ///
7630 /// Please consult the [Working with enums] section in the user guide for some
7631 /// guidelines.
7632 ///
7633 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
7634 #[derive(Clone, Debug, PartialEq)]
7635 #[non_exhaustive]
7636 pub enum History {
7637 /// The "unset" value.
7638 Unspecified,
7639 /// The resource originally had one pattern and launched as such, and
7640 /// additional patterns were added later.
7641 OriginallySinglePattern,
7642 /// The resource has one pattern, but the API owner expects to add more
7643 /// later. (This is the inverse of ORIGINALLY_SINGLE_PATTERN, and prevents
7644 /// that from being necessary once there are multiple patterns.)
7645 FutureMultiPattern,
7646 /// If set, the enum was initialized with an unknown value.
7647 ///
7648 /// Applications can examine the value using [History::value] or
7649 /// [History::name].
7650 UnknownValue(history::UnknownValue),
7651 }
7652
7653 #[doc(hidden)]
7654 pub mod history {
7655 #[allow(unused_imports)]
7656 use super::*;
7657 #[derive(Clone, Debug, PartialEq)]
7658 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7659 }
7660
7661 impl History {
7662 /// Gets the enum value.
7663 ///
7664 /// Returns `None` if the enum contains an unknown value deserialized from
7665 /// the string representation of enums.
7666 pub fn value(&self) -> std::option::Option<i32> {
7667 match self {
7668 Self::Unspecified => std::option::Option::Some(0),
7669 Self::OriginallySinglePattern => std::option::Option::Some(1),
7670 Self::FutureMultiPattern => std::option::Option::Some(2),
7671 Self::UnknownValue(u) => u.0.value(),
7672 }
7673 }
7674
7675 /// Gets the enum value as a string.
7676 ///
7677 /// Returns `None` if the enum contains an unknown value deserialized from
7678 /// the integer representation of enums.
7679 pub fn name(&self) -> std::option::Option<&str> {
7680 match self {
7681 Self::Unspecified => std::option::Option::Some("HISTORY_UNSPECIFIED"),
7682 Self::OriginallySinglePattern => {
7683 std::option::Option::Some("ORIGINALLY_SINGLE_PATTERN")
7684 }
7685 Self::FutureMultiPattern => std::option::Option::Some("FUTURE_MULTI_PATTERN"),
7686 Self::UnknownValue(u) => u.0.name(),
7687 }
7688 }
7689 }
7690
7691 impl std::default::Default for History {
7692 fn default() -> Self {
7693 use std::convert::From;
7694 Self::from(0)
7695 }
7696 }
7697
7698 impl std::fmt::Display for History {
7699 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7700 wkt::internal::display_enum(f, self.name(), self.value())
7701 }
7702 }
7703
7704 impl std::convert::From<i32> for History {
7705 fn from(value: i32) -> Self {
7706 match value {
7707 0 => Self::Unspecified,
7708 1 => Self::OriginallySinglePattern,
7709 2 => Self::FutureMultiPattern,
7710 _ => Self::UnknownValue(history::UnknownValue(
7711 wkt::internal::UnknownEnumValue::Integer(value),
7712 )),
7713 }
7714 }
7715 }
7716
7717 impl std::convert::From<&str> for History {
7718 fn from(value: &str) -> Self {
7719 use std::string::ToString;
7720 match value {
7721 "HISTORY_UNSPECIFIED" => Self::Unspecified,
7722 "ORIGINALLY_SINGLE_PATTERN" => Self::OriginallySinglePattern,
7723 "FUTURE_MULTI_PATTERN" => Self::FutureMultiPattern,
7724 _ => Self::UnknownValue(history::UnknownValue(
7725 wkt::internal::UnknownEnumValue::String(value.to_string()),
7726 )),
7727 }
7728 }
7729 }
7730
7731 impl serde::ser::Serialize for History {
7732 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7733 where
7734 S: serde::Serializer,
7735 {
7736 match self {
7737 Self::Unspecified => serializer.serialize_i32(0),
7738 Self::OriginallySinglePattern => serializer.serialize_i32(1),
7739 Self::FutureMultiPattern => serializer.serialize_i32(2),
7740 Self::UnknownValue(u) => u.0.serialize(serializer),
7741 }
7742 }
7743 }
7744
7745 impl<'de> serde::de::Deserialize<'de> for History {
7746 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7747 where
7748 D: serde::Deserializer<'de>,
7749 {
7750 deserializer.deserialize_any(wkt::internal::EnumVisitor::<History>::new(
7751 ".google.api.ResourceDescriptor.History",
7752 ))
7753 }
7754 }
7755
7756 /// A flag representing a specific style that a resource claims to conform to.
7757 ///
7758 /// # Working with unknown values
7759 ///
7760 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7761 /// additional enum variants at any time. Adding new variants is not considered
7762 /// a breaking change. Applications should write their code in anticipation of:
7763 ///
7764 /// - New values appearing in future releases of the client library, **and**
7765 /// - New values received dynamically, without application changes.
7766 ///
7767 /// Please consult the [Working with enums] section in the user guide for some
7768 /// guidelines.
7769 ///
7770 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
7771 #[derive(Clone, Debug, PartialEq)]
7772 #[non_exhaustive]
7773 pub enum Style {
7774 /// The unspecified value. Do not use.
7775 Unspecified,
7776 /// This resource is intended to be "declarative-friendly".
7777 ///
7778 /// Declarative-friendly resources must be more strictly consistent, and
7779 /// setting this to true communicates to tools that this resource should
7780 /// adhere to declarative-friendly expectations.
7781 ///
7782 /// Note: This is used by the API linter (linter.aip.dev) to enable
7783 /// additional checks.
7784 DeclarativeFriendly,
7785 /// If set, the enum was initialized with an unknown value.
7786 ///
7787 /// Applications can examine the value using [Style::value] or
7788 /// [Style::name].
7789 UnknownValue(style::UnknownValue),
7790 }
7791
7792 #[doc(hidden)]
7793 pub mod style {
7794 #[allow(unused_imports)]
7795 use super::*;
7796 #[derive(Clone, Debug, PartialEq)]
7797 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7798 }
7799
7800 impl Style {
7801 /// Gets the enum value.
7802 ///
7803 /// Returns `None` if the enum contains an unknown value deserialized from
7804 /// the string representation of enums.
7805 pub fn value(&self) -> std::option::Option<i32> {
7806 match self {
7807 Self::Unspecified => std::option::Option::Some(0),
7808 Self::DeclarativeFriendly => std::option::Option::Some(1),
7809 Self::UnknownValue(u) => u.0.value(),
7810 }
7811 }
7812
7813 /// Gets the enum value as a string.
7814 ///
7815 /// Returns `None` if the enum contains an unknown value deserialized from
7816 /// the integer representation of enums.
7817 pub fn name(&self) -> std::option::Option<&str> {
7818 match self {
7819 Self::Unspecified => std::option::Option::Some("STYLE_UNSPECIFIED"),
7820 Self::DeclarativeFriendly => std::option::Option::Some("DECLARATIVE_FRIENDLY"),
7821 Self::UnknownValue(u) => u.0.name(),
7822 }
7823 }
7824 }
7825
7826 impl std::default::Default for Style {
7827 fn default() -> Self {
7828 use std::convert::From;
7829 Self::from(0)
7830 }
7831 }
7832
7833 impl std::fmt::Display for Style {
7834 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7835 wkt::internal::display_enum(f, self.name(), self.value())
7836 }
7837 }
7838
7839 impl std::convert::From<i32> for Style {
7840 fn from(value: i32) -> Self {
7841 match value {
7842 0 => Self::Unspecified,
7843 1 => Self::DeclarativeFriendly,
7844 _ => Self::UnknownValue(style::UnknownValue(
7845 wkt::internal::UnknownEnumValue::Integer(value),
7846 )),
7847 }
7848 }
7849 }
7850
7851 impl std::convert::From<&str> for Style {
7852 fn from(value: &str) -> Self {
7853 use std::string::ToString;
7854 match value {
7855 "STYLE_UNSPECIFIED" => Self::Unspecified,
7856 "DECLARATIVE_FRIENDLY" => Self::DeclarativeFriendly,
7857 _ => Self::UnknownValue(style::UnknownValue(
7858 wkt::internal::UnknownEnumValue::String(value.to_string()),
7859 )),
7860 }
7861 }
7862 }
7863
7864 impl serde::ser::Serialize for Style {
7865 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7866 where
7867 S: serde::Serializer,
7868 {
7869 match self {
7870 Self::Unspecified => serializer.serialize_i32(0),
7871 Self::DeclarativeFriendly => serializer.serialize_i32(1),
7872 Self::UnknownValue(u) => u.0.serialize(serializer),
7873 }
7874 }
7875 }
7876
7877 impl<'de> serde::de::Deserialize<'de> for Style {
7878 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7879 where
7880 D: serde::Deserializer<'de>,
7881 {
7882 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Style>::new(
7883 ".google.api.ResourceDescriptor.Style",
7884 ))
7885 }
7886 }
7887}
7888
7889/// Defines a proto annotation that describes a string field that refers to
7890/// an API resource.
7891#[serde_with::serde_as]
7892#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
7893#[serde(default, rename_all = "camelCase")]
7894#[non_exhaustive]
7895pub struct ResourceReference {
7896 /// The resource type that the annotated field references.
7897 ///
7898 /// Example:
7899 ///
7900 /// ```norust
7901 /// message Subscription {
7902 /// string topic = 2 [(google.api.resource_reference) = {
7903 /// type: "pubsub.googleapis.com/Topic"
7904 /// }];
7905 /// }
7906 /// ```
7907 ///
7908 /// Occasionally, a field may reference an arbitrary resource. In this case,
7909 /// APIs use the special value * in their resource reference.
7910 ///
7911 /// Example:
7912 ///
7913 /// ```norust
7914 /// message GetIamPolicyRequest {
7915 /// string resource = 2 [(google.api.resource_reference) = {
7916 /// type: "*"
7917 /// }];
7918 /// }
7919 /// ```
7920 #[serde(rename = "type")]
7921 #[serde(skip_serializing_if = "std::string::String::is_empty")]
7922 pub r#type: std::string::String,
7923
7924 /// The resource type of a child collection that the annotated field
7925 /// references. This is useful for annotating the `parent` field that
7926 /// doesn't have a fixed resource type.
7927 ///
7928 /// Example:
7929 ///
7930 /// ```norust
7931 /// message ListLogEntriesRequest {
7932 /// string parent = 1 [(google.api.resource_reference) = {
7933 /// child_type: "logging.googleapis.com/LogEntry"
7934 /// };
7935 /// }
7936 /// ```
7937 #[serde(skip_serializing_if = "std::string::String::is_empty")]
7938 pub child_type: std::string::String,
7939
7940 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
7941 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7942}
7943
7944impl ResourceReference {
7945 pub fn new() -> Self {
7946 std::default::Default::default()
7947 }
7948
7949 /// Sets the value of [r#type][crate::model::ResourceReference::type].
7950 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7951 self.r#type = v.into();
7952 self
7953 }
7954
7955 /// Sets the value of [child_type][crate::model::ResourceReference::child_type].
7956 pub fn set_child_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7957 self.child_type = v.into();
7958 self
7959 }
7960}
7961
7962impl wkt::message::Message for ResourceReference {
7963 fn typename() -> &'static str {
7964 "type.googleapis.com/google.api.ResourceReference"
7965 }
7966}
7967
7968/// Specifies the routing information that should be sent along with the request
7969/// in the form of routing header.
7970/// **NOTE:** All service configuration rules follow the "last one wins" order.
7971///
7972/// The examples below will apply to an RPC which has the following request type:
7973///
7974/// Message Definition:
7975///
7976/// ```norust
7977/// message Request {
7978/// // The name of the Table
7979/// // Values can be of the following formats:
7980/// // - `projects/<project>/tables/<table>`
7981/// // - `projects/<project>/instances/<instance>/tables/<table>`
7982/// // - `region/<region>/zones/<zone>/tables/<table>`
7983/// string table_name = 1;
7984///
7985/// // This value specifies routing for replication.
7986/// // It can be in the following formats:
7987/// // - `profiles/<profile_id>`
7988/// // - a legacy `profile_id` that can be any string
7989/// string app_profile_id = 2;
7990/// }
7991/// ```
7992///
7993/// Example message:
7994///
7995/// ```norust
7996/// {
7997/// table_name: projects/proj_foo/instances/instance_bar/table/table_baz,
7998/// app_profile_id: profiles/prof_qux
7999/// }
8000/// ```
8001///
8002/// The routing header consists of one or multiple key-value pairs. Every key
8003/// and value must be percent-encoded, and joined together in the format of
8004/// `key1=value1&key2=value2`.
8005/// The examples below skip the percent-encoding for readability.
8006///
8007/// Example 1
8008///
8009/// Extracting a field from the request to put into the routing header
8010/// unchanged, with the key equal to the field name.
8011///
8012/// annotation:
8013///
8014/// ```norust
8015/// option (google.api.routing) = {
8016/// // Take the `app_profile_id`.
8017/// routing_parameters {
8018/// field: "app_profile_id"
8019/// }
8020/// };
8021/// ```
8022///
8023/// result:
8024///
8025/// ```norust
8026/// x-goog-request-params: app_profile_id=profiles/prof_qux
8027/// ```
8028///
8029/// Example 2
8030///
8031/// Extracting a field from the request to put into the routing header
8032/// unchanged, with the key different from the field name.
8033///
8034/// annotation:
8035///
8036/// ```norust
8037/// option (google.api.routing) = {
8038/// // Take the `app_profile_id`, but name it `routing_id` in the header.
8039/// routing_parameters {
8040/// field: "app_profile_id"
8041/// path_template: "{routing_id=**}"
8042/// }
8043/// };
8044/// ```
8045///
8046/// result:
8047///
8048/// ```norust
8049/// x-goog-request-params: routing_id=profiles/prof_qux
8050/// ```
8051///
8052/// Example 3
8053///
8054/// Extracting a field from the request to put into the routing
8055/// header, while matching a path template syntax on the field's value.
8056///
8057/// NB: it is more useful to send nothing than to send garbage for the purpose
8058/// of dynamic routing, since garbage pollutes cache. Thus the matching.
8059///
8060/// Sub-example 3a
8061///
8062/// The field matches the template.
8063///
8064/// annotation:
8065///
8066/// ```norust
8067/// option (google.api.routing) = {
8068/// // Take the `table_name`, if it's well-formed (with project-based
8069/// // syntax).
8070/// routing_parameters {
8071/// field: "table_name"
8072/// path_template: "{table_name=projects/*/instances/*/**}"
8073/// }
8074/// };
8075/// ```
8076///
8077/// result:
8078///
8079/// ```norust
8080/// x-goog-request-params:
8081/// table_name=projects/proj_foo/instances/instance_bar/table/table_baz
8082/// ```
8083///
8084/// Sub-example 3b
8085///
8086/// The field does not match the template.
8087///
8088/// annotation:
8089///
8090/// ```norust
8091/// option (google.api.routing) = {
8092/// // Take the `table_name`, if it's well-formed (with region-based
8093/// // syntax).
8094/// routing_parameters {
8095/// field: "table_name"
8096/// path_template: "{table_name=regions/*/zones/*/**}"
8097/// }
8098/// };
8099/// ```
8100///
8101/// result:
8102///
8103/// ```norust
8104/// <no routing header will be sent>
8105/// ```
8106///
8107/// Sub-example 3c
8108///
8109/// Multiple alternative conflictingly named path templates are
8110/// specified. The one that matches is used to construct the header.
8111///
8112/// annotation:
8113///
8114/// ```norust
8115/// option (google.api.routing) = {
8116/// // Take the `table_name`, if it's well-formed, whether
8117/// // using the region- or projects-based syntax.
8118///
8119/// routing_parameters {
8120/// field: "table_name"
8121/// path_template: "{table_name=regions/*/zones/*/**}"
8122/// }
8123/// routing_parameters {
8124/// field: "table_name"
8125/// path_template: "{table_name=projects/*/instances/*/**}"
8126/// }
8127/// };
8128/// ```
8129///
8130/// result:
8131///
8132/// ```norust
8133/// x-goog-request-params:
8134/// table_name=projects/proj_foo/instances/instance_bar/table/table_baz
8135/// ```
8136///
8137/// Example 4
8138///
8139/// Extracting a single routing header key-value pair by matching a
8140/// template syntax on (a part of) a single request field.
8141///
8142/// annotation:
8143///
8144/// ```norust
8145/// option (google.api.routing) = {
8146/// // Take just the project id from the `table_name` field.
8147/// routing_parameters {
8148/// field: "table_name"
8149/// path_template: "{routing_id=projects/*}/**"
8150/// }
8151/// };
8152/// ```
8153///
8154/// result:
8155///
8156/// ```norust
8157/// x-goog-request-params: routing_id=projects/proj_foo
8158/// ```
8159///
8160/// Example 5
8161///
8162/// Extracting a single routing header key-value pair by matching
8163/// several conflictingly named path templates on (parts of) a single request
8164/// field. The last template to match "wins" the conflict.
8165///
8166/// annotation:
8167///
8168/// ```norust
8169/// option (google.api.routing) = {
8170/// // If the `table_name` does not have instances information,
8171/// // take just the project id for routing.
8172/// // Otherwise take project + instance.
8173///
8174/// routing_parameters {
8175/// field: "table_name"
8176/// path_template: "{routing_id=projects/*}/**"
8177/// }
8178/// routing_parameters {
8179/// field: "table_name"
8180/// path_template: "{routing_id=projects/*/instances/*}/**"
8181/// }
8182/// };
8183/// ```
8184///
8185/// result:
8186///
8187/// ```norust
8188/// x-goog-request-params:
8189/// routing_id=projects/proj_foo/instances/instance_bar
8190/// ```
8191///
8192/// Example 6
8193///
8194/// Extracting multiple routing header key-value pairs by matching
8195/// several non-conflicting path templates on (parts of) a single request field.
8196///
8197/// Sub-example 6a
8198///
8199/// Make the templates strict, so that if the `table_name` does not
8200/// have an instance information, nothing is sent.
8201///
8202/// annotation:
8203///
8204/// ```norust
8205/// option (google.api.routing) = {
8206/// // The routing code needs two keys instead of one composite
8207/// // but works only for the tables with the "project-instance" name
8208/// // syntax.
8209///
8210/// routing_parameters {
8211/// field: "table_name"
8212/// path_template: "{project_id=projects/*}/instances/*/**"
8213/// }
8214/// routing_parameters {
8215/// field: "table_name"
8216/// path_template: "projects/*/{instance_id=instances/*}/**"
8217/// }
8218/// };
8219/// ```
8220///
8221/// result:
8222///
8223/// ```norust
8224/// x-goog-request-params:
8225/// project_id=projects/proj_foo&instance_id=instances/instance_bar
8226/// ```
8227///
8228/// Sub-example 6b
8229///
8230/// Make the templates loose, so that if the `table_name` does not
8231/// have an instance information, just the project id part is sent.
8232///
8233/// annotation:
8234///
8235/// ```norust
8236/// option (google.api.routing) = {
8237/// // The routing code wants two keys instead of one composite
8238/// // but will work with just the `project_id` for tables without
8239/// // an instance in the `table_name`.
8240///
8241/// routing_parameters {
8242/// field: "table_name"
8243/// path_template: "{project_id=projects/*}/**"
8244/// }
8245/// routing_parameters {
8246/// field: "table_name"
8247/// path_template: "projects/*/{instance_id=instances/*}/**"
8248/// }
8249/// };
8250/// ```
8251///
8252/// result (is the same as 6a for our example message because it has the instance
8253/// information):
8254///
8255/// ```norust
8256/// x-goog-request-params:
8257/// project_id=projects/proj_foo&instance_id=instances/instance_bar
8258/// ```
8259///
8260/// Example 7
8261///
8262/// Extracting multiple routing header key-value pairs by matching
8263/// several path templates on multiple request fields.
8264///
8265/// NB: note that here there is no way to specify sending nothing if one of the
8266/// fields does not match its template. E.g. if the `table_name` is in the wrong
8267/// format, the `project_id` will not be sent, but the `routing_id` will be.
8268/// The backend routing code has to be aware of that and be prepared to not
8269/// receive a full complement of keys if it expects multiple.
8270///
8271/// annotation:
8272///
8273/// ```norust
8274/// option (google.api.routing) = {
8275/// // The routing needs both `project_id` and `routing_id`
8276/// // (from the `app_profile_id` field) for routing.
8277///
8278/// routing_parameters {
8279/// field: "table_name"
8280/// path_template: "{project_id=projects/*}/**"
8281/// }
8282/// routing_parameters {
8283/// field: "app_profile_id"
8284/// path_template: "{routing_id=**}"
8285/// }
8286/// };
8287/// ```
8288///
8289/// result:
8290///
8291/// ```norust
8292/// x-goog-request-params:
8293/// project_id=projects/proj_foo&routing_id=profiles/prof_qux
8294/// ```
8295///
8296/// Example 8
8297///
8298/// Extracting a single routing header key-value pair by matching
8299/// several conflictingly named path templates on several request fields. The
8300/// last template to match "wins" the conflict.
8301///
8302/// annotation:
8303///
8304/// ```norust
8305/// option (google.api.routing) = {
8306/// // The `routing_id` can be a project id or a region id depending on
8307/// // the table name format, but only if the `app_profile_id` is not set.
8308/// // If `app_profile_id` is set it should be used instead.
8309///
8310/// routing_parameters {
8311/// field: "table_name"
8312/// path_template: "{routing_id=projects/*}/**"
8313/// }
8314/// routing_parameters {
8315/// field: "table_name"
8316/// path_template: "{routing_id=regions/*}/**"
8317/// }
8318/// routing_parameters {
8319/// field: "app_profile_id"
8320/// path_template: "{routing_id=**}"
8321/// }
8322/// };
8323/// ```
8324///
8325/// result:
8326///
8327/// ```norust
8328/// x-goog-request-params: routing_id=profiles/prof_qux
8329/// ```
8330///
8331/// Example 9
8332///
8333/// Bringing it all together.
8334///
8335/// annotation:
8336///
8337/// ```norust
8338/// option (google.api.routing) = {
8339/// // For routing both `table_location` and a `routing_id` are needed.
8340/// //
8341/// // table_location can be either an instance id or a region+zone id.
8342/// //
8343/// // For `routing_id`, take the value of `app_profile_id`
8344/// // - If it's in the format `profiles/<profile_id>`, send
8345/// // just the `<profile_id>` part.
8346/// // - If it's any other literal, send it as is.
8347/// // If the `app_profile_id` is empty, and the `table_name` starts with
8348/// // the project_id, send that instead.
8349///
8350/// routing_parameters {
8351/// field: "table_name"
8352/// path_template: "projects/*/{table_location=instances/*}/tables/*"
8353/// }
8354/// routing_parameters {
8355/// field: "table_name"
8356/// path_template: "{table_location=regions/*/zones/*}/tables/*"
8357/// }
8358/// routing_parameters {
8359/// field: "table_name"
8360/// path_template: "{routing_id=projects/*}/**"
8361/// }
8362/// routing_parameters {
8363/// field: "app_profile_id"
8364/// path_template: "{routing_id=**}"
8365/// }
8366/// routing_parameters {
8367/// field: "app_profile_id"
8368/// path_template: "profiles/{routing_id=*}"
8369/// }
8370/// };
8371/// ```
8372///
8373/// result:
8374///
8375/// ```norust
8376/// x-goog-request-params:
8377/// table_location=instances/instance_bar&routing_id=prof_qux
8378/// ```
8379#[serde_with::serde_as]
8380#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
8381#[serde(default, rename_all = "camelCase")]
8382#[non_exhaustive]
8383pub struct RoutingRule {
8384 /// A collection of Routing Parameter specifications.
8385 /// **NOTE:** If multiple Routing Parameters describe the same key
8386 /// (via the `path_template` field or via the `field` field when
8387 /// `path_template` is not provided), "last one wins" rule
8388 /// determines which Parameter gets used.
8389 /// See the examples for more details.
8390 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
8391 pub routing_parameters: std::vec::Vec<crate::model::RoutingParameter>,
8392
8393 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
8394 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8395}
8396
8397impl RoutingRule {
8398 pub fn new() -> Self {
8399 std::default::Default::default()
8400 }
8401
8402 /// Sets the value of [routing_parameters][crate::model::RoutingRule::routing_parameters].
8403 pub fn set_routing_parameters<T, V>(mut self, v: T) -> Self
8404 where
8405 T: std::iter::IntoIterator<Item = V>,
8406 V: std::convert::Into<crate::model::RoutingParameter>,
8407 {
8408 use std::iter::Iterator;
8409 self.routing_parameters = v.into_iter().map(|i| i.into()).collect();
8410 self
8411 }
8412}
8413
8414impl wkt::message::Message for RoutingRule {
8415 fn typename() -> &'static str {
8416 "type.googleapis.com/google.api.RoutingRule"
8417 }
8418}
8419
8420/// A projection from an input message to the GRPC or REST header.
8421#[serde_with::serde_as]
8422#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
8423#[serde(default, rename_all = "camelCase")]
8424#[non_exhaustive]
8425pub struct RoutingParameter {
8426 /// A request field to extract the header key-value pair from.
8427 #[serde(skip_serializing_if = "std::string::String::is_empty")]
8428 pub field: std::string::String,
8429
8430 /// A pattern matching the key-value field. Optional.
8431 /// If not specified, the whole field specified in the `field` field will be
8432 /// taken as value, and its name used as key. If specified, it MUST contain
8433 /// exactly one named segment (along with any number of unnamed segments) The
8434 /// pattern will be matched over the field specified in the `field` field, then
8435 /// if the match is successful:
8436 ///
8437 /// - the name of the single named segment will be used as a header name,
8438 /// - the match value of the segment will be used as a header value;
8439 /// if the match is NOT successful, nothing will be sent.
8440 ///
8441 /// Example:
8442 ///
8443 /// ```norust
8444 /// -- This is a field in the request message
8445 /// | that the header value will be extracted from.
8446 /// |
8447 /// | -- This is the key name in the
8448 /// | | routing header.
8449 /// V |
8450 /// field: "table_name" v
8451 /// path_template: "projects/*/{table_location=instances/*}/tables/*"
8452 /// ^ ^
8453 /// | |
8454 /// In the {} brackets is the pattern that -- |
8455 /// specifies what to extract from the |
8456 /// field as a value to be sent. |
8457 /// |
8458 /// The string in the field must match the whole pattern --
8459 /// before brackets, inside brackets, after brackets.
8460 /// ```
8461 ///
8462 /// When looking at this specific example, we can see that:
8463 ///
8464 /// - A key-value pair with the key `table_location`
8465 /// and the value matching `instances/*` should be added
8466 /// to the x-goog-request-params routing header.
8467 /// - The value is extracted from the request message's `table_name` field
8468 /// if it matches the full pattern specified:
8469 /// `projects/*/instances/*/tables/*`.
8470 ///
8471 /// **NB:** If the `path_template` field is not provided, the key name is
8472 /// equal to the field name, and the whole field should be sent as a value.
8473 /// This makes the pattern for the field and the value functionally equivalent
8474 /// to `**`, and the configuration
8475 ///
8476 /// ```norust
8477 /// {
8478 /// field: "table_name"
8479 /// }
8480 /// ```
8481 ///
8482 /// is a functionally equivalent shorthand to:
8483 ///
8484 /// ```norust
8485 /// {
8486 /// field: "table_name"
8487 /// path_template: "{table_name=**}"
8488 /// }
8489 /// ```
8490 ///
8491 /// See Example 1 for more details.
8492 #[serde(skip_serializing_if = "std::string::String::is_empty")]
8493 pub path_template: std::string::String,
8494
8495 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
8496 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8497}
8498
8499impl RoutingParameter {
8500 pub fn new() -> Self {
8501 std::default::Default::default()
8502 }
8503
8504 /// Sets the value of [field][crate::model::RoutingParameter::field].
8505 pub fn set_field<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8506 self.field = v.into();
8507 self
8508 }
8509
8510 /// Sets the value of [path_template][crate::model::RoutingParameter::path_template].
8511 pub fn set_path_template<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8512 self.path_template = v.into();
8513 self
8514 }
8515}
8516
8517impl wkt::message::Message for RoutingParameter {
8518 fn typename() -> &'static str {
8519 "type.googleapis.com/google.api.RoutingParameter"
8520 }
8521}
8522
8523/// `Service` is the root object of Google API service configuration (service
8524/// config). It describes the basic information about a logical service,
8525/// such as the service name and the user-facing title, and delegates other
8526/// aspects to sub-sections. Each sub-section is either a proto message or a
8527/// repeated proto message that configures a specific aspect, such as auth.
8528/// For more information, see each proto message definition.
8529///
8530/// Example:
8531///
8532/// ```norust
8533/// type: google.api.Service
8534/// name: calendar.googleapis.com
8535/// title: Google Calendar API
8536/// apis:
8537/// - name: google.calendar.v3.Calendar
8538///
8539/// visibility:
8540/// rules:
8541/// - selector: "google.calendar.v3.*"
8542/// restriction: PREVIEW
8543/// backend:
8544/// rules:
8545/// - selector: "google.calendar.v3.*"
8546/// address: calendar.example.com
8547///
8548/// authentication:
8549/// providers:
8550/// - id: google_calendar_auth
8551/// jwks_uri: https://www.googleapis.com/oauth2/v1/certs
8552/// issuer: https://securetoken.google.com
8553/// rules:
8554/// - selector: "*"
8555/// requirements:
8556/// provider_id: google_calendar_auth
8557/// ```
8558#[serde_with::serde_as]
8559#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
8560#[serde(default, rename_all = "camelCase")]
8561#[non_exhaustive]
8562pub struct Service {
8563 /// The service name, which is a DNS-like logical identifier for the
8564 /// service, such as `calendar.googleapis.com`. The service name
8565 /// typically goes through DNS verification to make sure the owner
8566 /// of the service also owns the DNS name.
8567 #[serde(skip_serializing_if = "std::string::String::is_empty")]
8568 pub name: std::string::String,
8569
8570 /// The product title for this service, it is the name displayed in Google
8571 /// Cloud Console.
8572 #[serde(skip_serializing_if = "std::string::String::is_empty")]
8573 pub title: std::string::String,
8574
8575 /// The Google project that owns this service.
8576 #[serde(skip_serializing_if = "std::string::String::is_empty")]
8577 pub producer_project_id: std::string::String,
8578
8579 /// A unique ID for a specific instance of this message, typically assigned
8580 /// by the client for tracking purpose. Must be no longer than 63 characters
8581 /// and only lower case letters, digits, '.', '_' and '-' are allowed. If
8582 /// empty, the server may choose to generate one instead.
8583 #[serde(skip_serializing_if = "std::string::String::is_empty")]
8584 pub id: std::string::String,
8585
8586 /// A list of API interfaces exported by this service. Only the `name` field
8587 /// of the [google.protobuf.Api][google.protobuf.Api] needs to be provided by
8588 /// the configuration author, as the remaining fields will be derived from the
8589 /// IDL during the normalization process. It is an error to specify an API
8590 /// interface here which cannot be resolved against the associated IDL files.
8591 ///
8592 /// [google.protobuf.Api]: wkt::Api
8593 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
8594 pub apis: std::vec::Vec<wkt::Api>,
8595
8596 /// A list of all proto message types included in this API service.
8597 /// Types referenced directly or indirectly by the `apis` are automatically
8598 /// included. Messages which are not referenced but shall be included, such as
8599 /// types used by the `google.protobuf.Any` type, should be listed here by
8600 /// name by the configuration author. Example:
8601 ///
8602 /// ```norust
8603 /// types:
8604 /// - name: google.protobuf.Int32
8605 /// ```
8606 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
8607 pub types: std::vec::Vec<wkt::Type>,
8608
8609 /// A list of all enum types included in this API service. Enums referenced
8610 /// directly or indirectly by the `apis` are automatically included. Enums
8611 /// which are not referenced but shall be included should be listed here by
8612 /// name by the configuration author. Example:
8613 ///
8614 /// ```norust
8615 /// enums:
8616 /// - name: google.someapi.v1.SomeEnum
8617 /// ```
8618 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
8619 pub enums: std::vec::Vec<wkt::Enum>,
8620
8621 /// Additional API documentation.
8622 #[serde(skip_serializing_if = "std::option::Option::is_none")]
8623 pub documentation: std::option::Option<crate::model::Documentation>,
8624
8625 /// API backend configuration.
8626 #[serde(skip_serializing_if = "std::option::Option::is_none")]
8627 pub backend: std::option::Option<crate::model::Backend>,
8628
8629 /// HTTP configuration.
8630 #[serde(skip_serializing_if = "std::option::Option::is_none")]
8631 pub http: std::option::Option<crate::model::Http>,
8632
8633 /// Quota configuration.
8634 #[serde(skip_serializing_if = "std::option::Option::is_none")]
8635 pub quota: std::option::Option<crate::model::Quota>,
8636
8637 /// Auth configuration.
8638 #[serde(skip_serializing_if = "std::option::Option::is_none")]
8639 pub authentication: std::option::Option<crate::model::Authentication>,
8640
8641 /// Context configuration.
8642 #[serde(skip_serializing_if = "std::option::Option::is_none")]
8643 pub context: std::option::Option<crate::model::Context>,
8644
8645 /// Configuration controlling usage of this service.
8646 #[serde(skip_serializing_if = "std::option::Option::is_none")]
8647 pub usage: std::option::Option<crate::model::Usage>,
8648
8649 /// Configuration for network endpoints. If this is empty, then an endpoint
8650 /// with the same name as the service is automatically generated to service all
8651 /// defined APIs.
8652 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
8653 pub endpoints: std::vec::Vec<crate::model::Endpoint>,
8654
8655 /// Configuration for the service control plane.
8656 #[serde(skip_serializing_if = "std::option::Option::is_none")]
8657 pub control: std::option::Option<crate::model::Control>,
8658
8659 /// Defines the logs used by this service.
8660 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
8661 pub logs: std::vec::Vec<crate::model::LogDescriptor>,
8662
8663 /// Defines the metrics used by this service.
8664 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
8665 pub metrics: std::vec::Vec<crate::model::MetricDescriptor>,
8666
8667 /// Defines the monitored resources used by this service. This is required
8668 /// by the [Service.monitoring][google.api.Service.monitoring] and
8669 /// [Service.logging][google.api.Service.logging] configurations.
8670 ///
8671 /// [google.api.Service.logging]: crate::model::Service::logging
8672 /// [google.api.Service.monitoring]: crate::model::Service::monitoring
8673 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
8674 pub monitored_resources: std::vec::Vec<crate::model::MonitoredResourceDescriptor>,
8675
8676 /// Billing configuration.
8677 #[serde(skip_serializing_if = "std::option::Option::is_none")]
8678 pub billing: std::option::Option<crate::model::Billing>,
8679
8680 /// Logging configuration.
8681 #[serde(skip_serializing_if = "std::option::Option::is_none")]
8682 pub logging: std::option::Option<crate::model::Logging>,
8683
8684 /// Monitoring configuration.
8685 #[serde(skip_serializing_if = "std::option::Option::is_none")]
8686 pub monitoring: std::option::Option<crate::model::Monitoring>,
8687
8688 /// System parameter configuration.
8689 #[serde(skip_serializing_if = "std::option::Option::is_none")]
8690 pub system_parameters: std::option::Option<crate::model::SystemParameters>,
8691
8692 /// Output only. The source information for this configuration if available.
8693 #[serde(skip_serializing_if = "std::option::Option::is_none")]
8694 pub source_info: std::option::Option<crate::model::SourceInfo>,
8695
8696 /// Settings for [Google Cloud Client
8697 /// libraries](https://cloud.google.com/apis/docs/cloud-client-libraries)
8698 /// generated from APIs defined as protocol buffers.
8699 #[serde(skip_serializing_if = "std::option::Option::is_none")]
8700 pub publishing: std::option::Option<crate::model::Publishing>,
8701
8702 /// Obsolete. Do not use.
8703 ///
8704 /// This field has no semantic meaning. The service config compiler always
8705 /// sets this field to `3`.
8706 #[serde(skip_serializing_if = "std::option::Option::is_none")]
8707 pub config_version: std::option::Option<wkt::UInt32Value>,
8708
8709 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
8710 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8711}
8712
8713impl Service {
8714 pub fn new() -> Self {
8715 std::default::Default::default()
8716 }
8717
8718 /// Sets the value of [name][crate::model::Service::name].
8719 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8720 self.name = v.into();
8721 self
8722 }
8723
8724 /// Sets the value of [title][crate::model::Service::title].
8725 pub fn set_title<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8726 self.title = v.into();
8727 self
8728 }
8729
8730 /// Sets the value of [producer_project_id][crate::model::Service::producer_project_id].
8731 pub fn set_producer_project_id<T: std::convert::Into<std::string::String>>(
8732 mut self,
8733 v: T,
8734 ) -> Self {
8735 self.producer_project_id = v.into();
8736 self
8737 }
8738
8739 /// Sets the value of [id][crate::model::Service::id].
8740 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8741 self.id = v.into();
8742 self
8743 }
8744
8745 /// Sets the value of [apis][crate::model::Service::apis].
8746 pub fn set_apis<T, V>(mut self, v: T) -> Self
8747 where
8748 T: std::iter::IntoIterator<Item = V>,
8749 V: std::convert::Into<wkt::Api>,
8750 {
8751 use std::iter::Iterator;
8752 self.apis = v.into_iter().map(|i| i.into()).collect();
8753 self
8754 }
8755
8756 /// Sets the value of [types][crate::model::Service::types].
8757 pub fn set_types<T, V>(mut self, v: T) -> Self
8758 where
8759 T: std::iter::IntoIterator<Item = V>,
8760 V: std::convert::Into<wkt::Type>,
8761 {
8762 use std::iter::Iterator;
8763 self.types = v.into_iter().map(|i| i.into()).collect();
8764 self
8765 }
8766
8767 /// Sets the value of [enums][crate::model::Service::enums].
8768 pub fn set_enums<T, V>(mut self, v: T) -> Self
8769 where
8770 T: std::iter::IntoIterator<Item = V>,
8771 V: std::convert::Into<wkt::Enum>,
8772 {
8773 use std::iter::Iterator;
8774 self.enums = v.into_iter().map(|i| i.into()).collect();
8775 self
8776 }
8777
8778 /// Sets the value of [documentation][crate::model::Service::documentation].
8779 pub fn set_documentation<
8780 T: std::convert::Into<std::option::Option<crate::model::Documentation>>,
8781 >(
8782 mut self,
8783 v: T,
8784 ) -> Self {
8785 self.documentation = v.into();
8786 self
8787 }
8788
8789 /// Sets the value of [backend][crate::model::Service::backend].
8790 pub fn set_backend<T: std::convert::Into<std::option::Option<crate::model::Backend>>>(
8791 mut self,
8792 v: T,
8793 ) -> Self {
8794 self.backend = v.into();
8795 self
8796 }
8797
8798 /// Sets the value of [http][crate::model::Service::http].
8799 pub fn set_http<T: std::convert::Into<std::option::Option<crate::model::Http>>>(
8800 mut self,
8801 v: T,
8802 ) -> Self {
8803 self.http = v.into();
8804 self
8805 }
8806
8807 /// Sets the value of [quota][crate::model::Service::quota].
8808 pub fn set_quota<T: std::convert::Into<std::option::Option<crate::model::Quota>>>(
8809 mut self,
8810 v: T,
8811 ) -> Self {
8812 self.quota = v.into();
8813 self
8814 }
8815
8816 /// Sets the value of [authentication][crate::model::Service::authentication].
8817 pub fn set_authentication<
8818 T: std::convert::Into<std::option::Option<crate::model::Authentication>>,
8819 >(
8820 mut self,
8821 v: T,
8822 ) -> Self {
8823 self.authentication = v.into();
8824 self
8825 }
8826
8827 /// Sets the value of [context][crate::model::Service::context].
8828 pub fn set_context<T: std::convert::Into<std::option::Option<crate::model::Context>>>(
8829 mut self,
8830 v: T,
8831 ) -> Self {
8832 self.context = v.into();
8833 self
8834 }
8835
8836 /// Sets the value of [usage][crate::model::Service::usage].
8837 pub fn set_usage<T: std::convert::Into<std::option::Option<crate::model::Usage>>>(
8838 mut self,
8839 v: T,
8840 ) -> Self {
8841 self.usage = v.into();
8842 self
8843 }
8844
8845 /// Sets the value of [endpoints][crate::model::Service::endpoints].
8846 pub fn set_endpoints<T, V>(mut self, v: T) -> Self
8847 where
8848 T: std::iter::IntoIterator<Item = V>,
8849 V: std::convert::Into<crate::model::Endpoint>,
8850 {
8851 use std::iter::Iterator;
8852 self.endpoints = v.into_iter().map(|i| i.into()).collect();
8853 self
8854 }
8855
8856 /// Sets the value of [control][crate::model::Service::control].
8857 pub fn set_control<T: std::convert::Into<std::option::Option<crate::model::Control>>>(
8858 mut self,
8859 v: T,
8860 ) -> Self {
8861 self.control = v.into();
8862 self
8863 }
8864
8865 /// Sets the value of [logs][crate::model::Service::logs].
8866 pub fn set_logs<T, V>(mut self, v: T) -> Self
8867 where
8868 T: std::iter::IntoIterator<Item = V>,
8869 V: std::convert::Into<crate::model::LogDescriptor>,
8870 {
8871 use std::iter::Iterator;
8872 self.logs = v.into_iter().map(|i| i.into()).collect();
8873 self
8874 }
8875
8876 /// Sets the value of [metrics][crate::model::Service::metrics].
8877 pub fn set_metrics<T, V>(mut self, v: T) -> Self
8878 where
8879 T: std::iter::IntoIterator<Item = V>,
8880 V: std::convert::Into<crate::model::MetricDescriptor>,
8881 {
8882 use std::iter::Iterator;
8883 self.metrics = v.into_iter().map(|i| i.into()).collect();
8884 self
8885 }
8886
8887 /// Sets the value of [monitored_resources][crate::model::Service::monitored_resources].
8888 pub fn set_monitored_resources<T, V>(mut self, v: T) -> Self
8889 where
8890 T: std::iter::IntoIterator<Item = V>,
8891 V: std::convert::Into<crate::model::MonitoredResourceDescriptor>,
8892 {
8893 use std::iter::Iterator;
8894 self.monitored_resources = v.into_iter().map(|i| i.into()).collect();
8895 self
8896 }
8897
8898 /// Sets the value of [billing][crate::model::Service::billing].
8899 pub fn set_billing<T: std::convert::Into<std::option::Option<crate::model::Billing>>>(
8900 mut self,
8901 v: T,
8902 ) -> Self {
8903 self.billing = v.into();
8904 self
8905 }
8906
8907 /// Sets the value of [logging][crate::model::Service::logging].
8908 pub fn set_logging<T: std::convert::Into<std::option::Option<crate::model::Logging>>>(
8909 mut self,
8910 v: T,
8911 ) -> Self {
8912 self.logging = v.into();
8913 self
8914 }
8915
8916 /// Sets the value of [monitoring][crate::model::Service::monitoring].
8917 pub fn set_monitoring<T: std::convert::Into<std::option::Option<crate::model::Monitoring>>>(
8918 mut self,
8919 v: T,
8920 ) -> Self {
8921 self.monitoring = v.into();
8922 self
8923 }
8924
8925 /// Sets the value of [system_parameters][crate::model::Service::system_parameters].
8926 pub fn set_system_parameters<
8927 T: std::convert::Into<std::option::Option<crate::model::SystemParameters>>,
8928 >(
8929 mut self,
8930 v: T,
8931 ) -> Self {
8932 self.system_parameters = v.into();
8933 self
8934 }
8935
8936 /// Sets the value of [source_info][crate::model::Service::source_info].
8937 pub fn set_source_info<T: std::convert::Into<std::option::Option<crate::model::SourceInfo>>>(
8938 mut self,
8939 v: T,
8940 ) -> Self {
8941 self.source_info = v.into();
8942 self
8943 }
8944
8945 /// Sets the value of [publishing][crate::model::Service::publishing].
8946 pub fn set_publishing<T: std::convert::Into<std::option::Option<crate::model::Publishing>>>(
8947 mut self,
8948 v: T,
8949 ) -> Self {
8950 self.publishing = v.into();
8951 self
8952 }
8953
8954 /// Sets the value of [config_version][crate::model::Service::config_version].
8955 pub fn set_config_version<T: std::convert::Into<std::option::Option<wkt::UInt32Value>>>(
8956 mut self,
8957 v: T,
8958 ) -> Self {
8959 self.config_version = v.into();
8960 self
8961 }
8962}
8963
8964impl wkt::message::Message for Service {
8965 fn typename() -> &'static str {
8966 "type.googleapis.com/google.api.Service"
8967 }
8968}
8969
8970/// Source information used to create a Service Config
8971#[serde_with::serde_as]
8972#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
8973#[serde(default, rename_all = "camelCase")]
8974#[non_exhaustive]
8975pub struct SourceInfo {
8976 /// All files used during config generation.
8977 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
8978 pub source_files: std::vec::Vec<wkt::Any>,
8979
8980 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
8981 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8982}
8983
8984impl SourceInfo {
8985 pub fn new() -> Self {
8986 std::default::Default::default()
8987 }
8988
8989 /// Sets the value of [source_files][crate::model::SourceInfo::source_files].
8990 pub fn set_source_files<T, V>(mut self, v: T) -> Self
8991 where
8992 T: std::iter::IntoIterator<Item = V>,
8993 V: std::convert::Into<wkt::Any>,
8994 {
8995 use std::iter::Iterator;
8996 self.source_files = v.into_iter().map(|i| i.into()).collect();
8997 self
8998 }
8999}
9000
9001impl wkt::message::Message for SourceInfo {
9002 fn typename() -> &'static str {
9003 "type.googleapis.com/google.api.SourceInfo"
9004 }
9005}
9006
9007/// ### System parameter configuration
9008///
9009/// A system parameter is a special kind of parameter defined by the API
9010/// system, not by an individual API. It is typically mapped to an HTTP header
9011/// and/or a URL query parameter. This configuration specifies which methods
9012/// change the names of the system parameters.
9013#[serde_with::serde_as]
9014#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
9015#[serde(default, rename_all = "camelCase")]
9016#[non_exhaustive]
9017pub struct SystemParameters {
9018 /// Define system parameters.
9019 ///
9020 /// The parameters defined here will override the default parameters
9021 /// implemented by the system. If this field is missing from the service
9022 /// config, default system parameters will be used. Default system parameters
9023 /// and names is implementation-dependent.
9024 ///
9025 /// Example: define api key for all methods
9026 ///
9027 /// ```norust
9028 /// system_parameters
9029 /// rules:
9030 /// - selector: "*"
9031 /// parameters:
9032 /// - name: api_key
9033 /// url_query_parameter: api_key
9034 /// ```
9035 ///
9036 /// Example: define 2 api key names for a specific method.
9037 ///
9038 /// ```norust
9039 /// system_parameters
9040 /// rules:
9041 /// - selector: "/ListShelves"
9042 /// parameters:
9043 /// - name: api_key
9044 /// http_header: Api-Key1
9045 /// - name: api_key
9046 /// http_header: Api-Key2
9047 /// ```
9048 ///
9049 /// **NOTE:** All service configuration rules follow "last one wins" order.
9050 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
9051 pub rules: std::vec::Vec<crate::model::SystemParameterRule>,
9052
9053 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
9054 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9055}
9056
9057impl SystemParameters {
9058 pub fn new() -> Self {
9059 std::default::Default::default()
9060 }
9061
9062 /// Sets the value of [rules][crate::model::SystemParameters::rules].
9063 pub fn set_rules<T, V>(mut self, v: T) -> Self
9064 where
9065 T: std::iter::IntoIterator<Item = V>,
9066 V: std::convert::Into<crate::model::SystemParameterRule>,
9067 {
9068 use std::iter::Iterator;
9069 self.rules = v.into_iter().map(|i| i.into()).collect();
9070 self
9071 }
9072}
9073
9074impl wkt::message::Message for SystemParameters {
9075 fn typename() -> &'static str {
9076 "type.googleapis.com/google.api.SystemParameters"
9077 }
9078}
9079
9080/// Define a system parameter rule mapping system parameter definitions to
9081/// methods.
9082#[serde_with::serde_as]
9083#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
9084#[serde(default, rename_all = "camelCase")]
9085#[non_exhaustive]
9086pub struct SystemParameterRule {
9087 /// Selects the methods to which this rule applies. Use '*' to indicate all
9088 /// methods in all APIs.
9089 ///
9090 /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
9091 /// details.
9092 ///
9093 /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
9094 #[serde(skip_serializing_if = "std::string::String::is_empty")]
9095 pub selector: std::string::String,
9096
9097 /// Define parameters. Multiple names may be defined for a parameter.
9098 /// For a given method call, only one of them should be used. If multiple
9099 /// names are used the behavior is implementation-dependent.
9100 /// If none of the specified names are present the behavior is
9101 /// parameter-dependent.
9102 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
9103 pub parameters: std::vec::Vec<crate::model::SystemParameter>,
9104
9105 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
9106 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9107}
9108
9109impl SystemParameterRule {
9110 pub fn new() -> Self {
9111 std::default::Default::default()
9112 }
9113
9114 /// Sets the value of [selector][crate::model::SystemParameterRule::selector].
9115 pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9116 self.selector = v.into();
9117 self
9118 }
9119
9120 /// Sets the value of [parameters][crate::model::SystemParameterRule::parameters].
9121 pub fn set_parameters<T, V>(mut self, v: T) -> Self
9122 where
9123 T: std::iter::IntoIterator<Item = V>,
9124 V: std::convert::Into<crate::model::SystemParameter>,
9125 {
9126 use std::iter::Iterator;
9127 self.parameters = v.into_iter().map(|i| i.into()).collect();
9128 self
9129 }
9130}
9131
9132impl wkt::message::Message for SystemParameterRule {
9133 fn typename() -> &'static str {
9134 "type.googleapis.com/google.api.SystemParameterRule"
9135 }
9136}
9137
9138/// Define a parameter's name and location. The parameter may be passed as either
9139/// an HTTP header or a URL query parameter, and if both are passed the behavior
9140/// is implementation-dependent.
9141#[serde_with::serde_as]
9142#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
9143#[serde(default, rename_all = "camelCase")]
9144#[non_exhaustive]
9145pub struct SystemParameter {
9146 /// Define the name of the parameter, such as "api_key" . It is case sensitive.
9147 #[serde(skip_serializing_if = "std::string::String::is_empty")]
9148 pub name: std::string::String,
9149
9150 /// Define the HTTP header name to use for the parameter. It is case
9151 /// insensitive.
9152 #[serde(skip_serializing_if = "std::string::String::is_empty")]
9153 pub http_header: std::string::String,
9154
9155 /// Define the URL query parameter name to use for the parameter. It is case
9156 /// sensitive.
9157 #[serde(skip_serializing_if = "std::string::String::is_empty")]
9158 pub url_query_parameter: std::string::String,
9159
9160 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
9161 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9162}
9163
9164impl SystemParameter {
9165 pub fn new() -> Self {
9166 std::default::Default::default()
9167 }
9168
9169 /// Sets the value of [name][crate::model::SystemParameter::name].
9170 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9171 self.name = v.into();
9172 self
9173 }
9174
9175 /// Sets the value of [http_header][crate::model::SystemParameter::http_header].
9176 pub fn set_http_header<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9177 self.http_header = v.into();
9178 self
9179 }
9180
9181 /// Sets the value of [url_query_parameter][crate::model::SystemParameter::url_query_parameter].
9182 pub fn set_url_query_parameter<T: std::convert::Into<std::string::String>>(
9183 mut self,
9184 v: T,
9185 ) -> Self {
9186 self.url_query_parameter = v.into();
9187 self
9188 }
9189}
9190
9191impl wkt::message::Message for SystemParameter {
9192 fn typename() -> &'static str {
9193 "type.googleapis.com/google.api.SystemParameter"
9194 }
9195}
9196
9197/// Configuration controlling usage of a service.
9198#[serde_with::serde_as]
9199#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
9200#[serde(default, rename_all = "camelCase")]
9201#[non_exhaustive]
9202pub struct Usage {
9203 /// Requirements that must be satisfied before a consumer project can use the
9204 /// service. Each requirement is of the form <service.name>/\<requirement-id\>;
9205 /// for example 'serviceusage.googleapis.com/billing-enabled'.
9206 ///
9207 /// For Google APIs, a Terms of Service requirement must be included here.
9208 /// Google Cloud APIs must include "serviceusage.googleapis.com/tos/cloud".
9209 /// Other Google APIs should include
9210 /// "serviceusage.googleapis.com/tos/universal". Additional ToS can be
9211 /// included based on the business needs.
9212 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
9213 pub requirements: std::vec::Vec<std::string::String>,
9214
9215 /// A list of usage rules that apply to individual API methods.
9216 ///
9217 /// **NOTE:** All service configuration rules follow "last one wins" order.
9218 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
9219 pub rules: std::vec::Vec<crate::model::UsageRule>,
9220
9221 /// The full resource name of a channel used for sending notifications to the
9222 /// service producer.
9223 ///
9224 /// Google Service Management currently only supports
9225 /// [Google Cloud Pub/Sub](https://cloud.google.com/pubsub) as a notification
9226 /// channel. To use Google Cloud Pub/Sub as the channel, this must be the name
9227 /// of a Cloud Pub/Sub topic that uses the Cloud Pub/Sub topic name format
9228 /// documented in <https://cloud.google.com/pubsub/docs/overview>.
9229 #[serde(skip_serializing_if = "std::string::String::is_empty")]
9230 pub producer_notification_channel: std::string::String,
9231
9232 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
9233 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9234}
9235
9236impl Usage {
9237 pub fn new() -> Self {
9238 std::default::Default::default()
9239 }
9240
9241 /// Sets the value of [requirements][crate::model::Usage::requirements].
9242 pub fn set_requirements<T, V>(mut self, v: T) -> Self
9243 where
9244 T: std::iter::IntoIterator<Item = V>,
9245 V: std::convert::Into<std::string::String>,
9246 {
9247 use std::iter::Iterator;
9248 self.requirements = v.into_iter().map(|i| i.into()).collect();
9249 self
9250 }
9251
9252 /// Sets the value of [rules][crate::model::Usage::rules].
9253 pub fn set_rules<T, V>(mut self, v: T) -> Self
9254 where
9255 T: std::iter::IntoIterator<Item = V>,
9256 V: std::convert::Into<crate::model::UsageRule>,
9257 {
9258 use std::iter::Iterator;
9259 self.rules = v.into_iter().map(|i| i.into()).collect();
9260 self
9261 }
9262
9263 /// Sets the value of [producer_notification_channel][crate::model::Usage::producer_notification_channel].
9264 pub fn set_producer_notification_channel<T: std::convert::Into<std::string::String>>(
9265 mut self,
9266 v: T,
9267 ) -> Self {
9268 self.producer_notification_channel = v.into();
9269 self
9270 }
9271}
9272
9273impl wkt::message::Message for Usage {
9274 fn typename() -> &'static str {
9275 "type.googleapis.com/google.api.Usage"
9276 }
9277}
9278
9279/// Usage configuration rules for the service.
9280///
9281/// NOTE: Under development.
9282///
9283/// Use this rule to configure unregistered calls for the service. Unregistered
9284/// calls are calls that do not contain consumer project identity.
9285/// (Example: calls that do not contain an API key).
9286/// By default, API methods do not allow unregistered calls, and each method call
9287/// must be identified by a consumer project identity. Use this rule to
9288/// allow/disallow unregistered calls.
9289///
9290/// Example of an API that wants to allow unregistered calls for entire service.
9291///
9292/// ```norust
9293/// usage:
9294/// rules:
9295/// - selector: "*"
9296/// allow_unregistered_calls: true
9297/// ```
9298///
9299/// Example of a method that wants to allow unregistered calls.
9300///
9301/// ```norust
9302/// usage:
9303/// rules:
9304/// - selector: "google.example.library.v1.LibraryService.CreateBook"
9305/// allow_unregistered_calls: true
9306/// ```
9307#[serde_with::serde_as]
9308#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
9309#[serde(default, rename_all = "camelCase")]
9310#[non_exhaustive]
9311pub struct UsageRule {
9312 /// Selects the methods to which this rule applies. Use '*' to indicate all
9313 /// methods in all APIs.
9314 ///
9315 /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
9316 /// details.
9317 ///
9318 /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
9319 #[serde(skip_serializing_if = "std::string::String::is_empty")]
9320 pub selector: std::string::String,
9321
9322 /// If true, the selected method allows unregistered calls, e.g. calls
9323 /// that don't identify any user or application.
9324 #[serde(skip_serializing_if = "wkt::internal::is_default")]
9325 pub allow_unregistered_calls: bool,
9326
9327 /// If true, the selected method should skip service control and the control
9328 /// plane features, such as quota and billing, will not be available.
9329 /// This flag is used by Google Cloud Endpoints to bypass checks for internal
9330 /// methods, such as service health check methods.
9331 #[serde(skip_serializing_if = "wkt::internal::is_default")]
9332 pub skip_service_control: bool,
9333
9334 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
9335 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9336}
9337
9338impl UsageRule {
9339 pub fn new() -> Self {
9340 std::default::Default::default()
9341 }
9342
9343 /// Sets the value of [selector][crate::model::UsageRule::selector].
9344 pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9345 self.selector = v.into();
9346 self
9347 }
9348
9349 /// Sets the value of [allow_unregistered_calls][crate::model::UsageRule::allow_unregistered_calls].
9350 pub fn set_allow_unregistered_calls<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9351 self.allow_unregistered_calls = v.into();
9352 self
9353 }
9354
9355 /// Sets the value of [skip_service_control][crate::model::UsageRule::skip_service_control].
9356 pub fn set_skip_service_control<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9357 self.skip_service_control = v.into();
9358 self
9359 }
9360}
9361
9362impl wkt::message::Message for UsageRule {
9363 fn typename() -> &'static str {
9364 "type.googleapis.com/google.api.UsageRule"
9365 }
9366}
9367
9368/// `Visibility` restricts service consumer's access to service elements,
9369/// such as whether an application can call a visibility-restricted method.
9370/// The restriction is expressed by applying visibility labels on service
9371/// elements. The visibility labels are elsewhere linked to service consumers.
9372///
9373/// A service can define multiple visibility labels, but a service consumer
9374/// should be granted at most one visibility label. Multiple visibility
9375/// labels for a single service consumer are not supported.
9376///
9377/// If an element and all its parents have no visibility label, its visibility
9378/// is unconditionally granted.
9379///
9380/// Example:
9381///
9382/// ```norust
9383/// visibility:
9384/// rules:
9385/// - selector: google.calendar.Calendar.EnhancedSearch
9386/// restriction: PREVIEW
9387/// - selector: google.calendar.Calendar.Delegate
9388/// restriction: INTERNAL
9389/// ```
9390///
9391/// Here, all methods are publicly visible except for the restricted methods
9392/// EnhancedSearch and Delegate.
9393#[serde_with::serde_as]
9394#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
9395#[serde(default, rename_all = "camelCase")]
9396#[non_exhaustive]
9397pub struct Visibility {
9398 /// A list of visibility rules that apply to individual API elements.
9399 ///
9400 /// **NOTE:** All service configuration rules follow "last one wins" order.
9401 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
9402 pub rules: std::vec::Vec<crate::model::VisibilityRule>,
9403
9404 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
9405 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9406}
9407
9408impl Visibility {
9409 pub fn new() -> Self {
9410 std::default::Default::default()
9411 }
9412
9413 /// Sets the value of [rules][crate::model::Visibility::rules].
9414 pub fn set_rules<T, V>(mut self, v: T) -> Self
9415 where
9416 T: std::iter::IntoIterator<Item = V>,
9417 V: std::convert::Into<crate::model::VisibilityRule>,
9418 {
9419 use std::iter::Iterator;
9420 self.rules = v.into_iter().map(|i| i.into()).collect();
9421 self
9422 }
9423}
9424
9425impl wkt::message::Message for Visibility {
9426 fn typename() -> &'static str {
9427 "type.googleapis.com/google.api.Visibility"
9428 }
9429}
9430
9431/// A visibility rule provides visibility configuration for an individual API
9432/// element.
9433#[serde_with::serde_as]
9434#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
9435#[serde(default, rename_all = "camelCase")]
9436#[non_exhaustive]
9437pub struct VisibilityRule {
9438 /// Selects methods, messages, fields, enums, etc. to which this rule applies.
9439 ///
9440 /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
9441 /// details.
9442 ///
9443 /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
9444 #[serde(skip_serializing_if = "std::string::String::is_empty")]
9445 pub selector: std::string::String,
9446
9447 /// A comma-separated list of visibility labels that apply to the `selector`.
9448 /// Any of the listed labels can be used to grant the visibility.
9449 ///
9450 /// If a rule has multiple labels, removing one of the labels but not all of
9451 /// them can break clients.
9452 ///
9453 /// Example:
9454 ///
9455 /// ```norust
9456 /// visibility:
9457 /// rules:
9458 /// - selector: google.calendar.Calendar.EnhancedSearch
9459 /// restriction: INTERNAL, PREVIEW
9460 /// ```
9461 ///
9462 /// Removing INTERNAL from this restriction will break clients that rely on
9463 /// this method and only had access to it through INTERNAL.
9464 #[serde(skip_serializing_if = "std::string::String::is_empty")]
9465 pub restriction: std::string::String,
9466
9467 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
9468 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9469}
9470
9471impl VisibilityRule {
9472 pub fn new() -> Self {
9473 std::default::Default::default()
9474 }
9475
9476 /// Sets the value of [selector][crate::model::VisibilityRule::selector].
9477 pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9478 self.selector = v.into();
9479 self
9480 }
9481
9482 /// Sets the value of [restriction][crate::model::VisibilityRule::restriction].
9483 pub fn set_restriction<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9484 self.restriction = v.into();
9485 self
9486 }
9487}
9488
9489impl wkt::message::Message for VisibilityRule {
9490 fn typename() -> &'static str {
9491 "type.googleapis.com/google.api.VisibilityRule"
9492 }
9493}
9494
9495/// The organization for which the client libraries are being published.
9496/// Affects the url where generated docs are published, etc.
9497///
9498/// # Working with unknown values
9499///
9500/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9501/// additional enum variants at any time. Adding new variants is not considered
9502/// a breaking change. Applications should write their code in anticipation of:
9503///
9504/// - New values appearing in future releases of the client library, **and**
9505/// - New values received dynamically, without application changes.
9506///
9507/// Please consult the [Working with enums] section in the user guide for some
9508/// guidelines.
9509///
9510/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9511#[derive(Clone, Debug, PartialEq)]
9512#[non_exhaustive]
9513pub enum ClientLibraryOrganization {
9514 /// Not useful.
9515 Unspecified,
9516 /// Google Cloud Platform Org.
9517 Cloud,
9518 /// Ads (Advertising) Org.
9519 Ads,
9520 /// Photos Org.
9521 Photos,
9522 /// Street View Org.
9523 StreetView,
9524 /// Shopping Org.
9525 Shopping,
9526 /// Geo Org.
9527 Geo,
9528 /// Generative AI - <https://developers.generativeai.google>
9529 GenerativeAi,
9530 /// If set, the enum was initialized with an unknown value.
9531 ///
9532 /// Applications can examine the value using [ClientLibraryOrganization::value] or
9533 /// [ClientLibraryOrganization::name].
9534 UnknownValue(client_library_organization::UnknownValue),
9535}
9536
9537#[doc(hidden)]
9538pub mod client_library_organization {
9539 #[allow(unused_imports)]
9540 use super::*;
9541 #[derive(Clone, Debug, PartialEq)]
9542 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9543}
9544
9545impl ClientLibraryOrganization {
9546 /// Gets the enum value.
9547 ///
9548 /// Returns `None` if the enum contains an unknown value deserialized from
9549 /// the string representation of enums.
9550 pub fn value(&self) -> std::option::Option<i32> {
9551 match self {
9552 Self::Unspecified => std::option::Option::Some(0),
9553 Self::Cloud => std::option::Option::Some(1),
9554 Self::Ads => std::option::Option::Some(2),
9555 Self::Photos => std::option::Option::Some(3),
9556 Self::StreetView => std::option::Option::Some(4),
9557 Self::Shopping => std::option::Option::Some(5),
9558 Self::Geo => std::option::Option::Some(6),
9559 Self::GenerativeAi => std::option::Option::Some(7),
9560 Self::UnknownValue(u) => u.0.value(),
9561 }
9562 }
9563
9564 /// Gets the enum value as a string.
9565 ///
9566 /// Returns `None` if the enum contains an unknown value deserialized from
9567 /// the integer representation of enums.
9568 pub fn name(&self) -> std::option::Option<&str> {
9569 match self {
9570 Self::Unspecified => {
9571 std::option::Option::Some("CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED")
9572 }
9573 Self::Cloud => std::option::Option::Some("CLOUD"),
9574 Self::Ads => std::option::Option::Some("ADS"),
9575 Self::Photos => std::option::Option::Some("PHOTOS"),
9576 Self::StreetView => std::option::Option::Some("STREET_VIEW"),
9577 Self::Shopping => std::option::Option::Some("SHOPPING"),
9578 Self::Geo => std::option::Option::Some("GEO"),
9579 Self::GenerativeAi => std::option::Option::Some("GENERATIVE_AI"),
9580 Self::UnknownValue(u) => u.0.name(),
9581 }
9582 }
9583}
9584
9585impl std::default::Default for ClientLibraryOrganization {
9586 fn default() -> Self {
9587 use std::convert::From;
9588 Self::from(0)
9589 }
9590}
9591
9592impl std::fmt::Display for ClientLibraryOrganization {
9593 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9594 wkt::internal::display_enum(f, self.name(), self.value())
9595 }
9596}
9597
9598impl std::convert::From<i32> for ClientLibraryOrganization {
9599 fn from(value: i32) -> Self {
9600 match value {
9601 0 => Self::Unspecified,
9602 1 => Self::Cloud,
9603 2 => Self::Ads,
9604 3 => Self::Photos,
9605 4 => Self::StreetView,
9606 5 => Self::Shopping,
9607 6 => Self::Geo,
9608 7 => Self::GenerativeAi,
9609 _ => Self::UnknownValue(client_library_organization::UnknownValue(
9610 wkt::internal::UnknownEnumValue::Integer(value),
9611 )),
9612 }
9613 }
9614}
9615
9616impl std::convert::From<&str> for ClientLibraryOrganization {
9617 fn from(value: &str) -> Self {
9618 use std::string::ToString;
9619 match value {
9620 "CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED" => Self::Unspecified,
9621 "CLOUD" => Self::Cloud,
9622 "ADS" => Self::Ads,
9623 "PHOTOS" => Self::Photos,
9624 "STREET_VIEW" => Self::StreetView,
9625 "SHOPPING" => Self::Shopping,
9626 "GEO" => Self::Geo,
9627 "GENERATIVE_AI" => Self::GenerativeAi,
9628 _ => Self::UnknownValue(client_library_organization::UnknownValue(
9629 wkt::internal::UnknownEnumValue::String(value.to_string()),
9630 )),
9631 }
9632 }
9633}
9634
9635impl serde::ser::Serialize for ClientLibraryOrganization {
9636 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9637 where
9638 S: serde::Serializer,
9639 {
9640 match self {
9641 Self::Unspecified => serializer.serialize_i32(0),
9642 Self::Cloud => serializer.serialize_i32(1),
9643 Self::Ads => serializer.serialize_i32(2),
9644 Self::Photos => serializer.serialize_i32(3),
9645 Self::StreetView => serializer.serialize_i32(4),
9646 Self::Shopping => serializer.serialize_i32(5),
9647 Self::Geo => serializer.serialize_i32(6),
9648 Self::GenerativeAi => serializer.serialize_i32(7),
9649 Self::UnknownValue(u) => u.0.serialize(serializer),
9650 }
9651 }
9652}
9653
9654impl<'de> serde::de::Deserialize<'de> for ClientLibraryOrganization {
9655 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9656 where
9657 D: serde::Deserializer<'de>,
9658 {
9659 deserializer.deserialize_any(
9660 wkt::internal::EnumVisitor::<ClientLibraryOrganization>::new(
9661 ".google.api.ClientLibraryOrganization",
9662 ),
9663 )
9664 }
9665}
9666
9667/// To where should client libraries be published?
9668///
9669/// # Working with unknown values
9670///
9671/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9672/// additional enum variants at any time. Adding new variants is not considered
9673/// a breaking change. Applications should write their code in anticipation of:
9674///
9675/// - New values appearing in future releases of the client library, **and**
9676/// - New values received dynamically, without application changes.
9677///
9678/// Please consult the [Working with enums] section in the user guide for some
9679/// guidelines.
9680///
9681/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9682#[derive(Clone, Debug, PartialEq)]
9683#[non_exhaustive]
9684pub enum ClientLibraryDestination {
9685 /// Client libraries will neither be generated nor published to package
9686 /// managers.
9687 Unspecified,
9688 /// Generate the client library in a repo under github.com/googleapis,
9689 /// but don't publish it to package managers.
9690 Github,
9691 /// Publish the library to package managers like nuget.org and npmjs.com.
9692 PackageManager,
9693 /// If set, the enum was initialized with an unknown value.
9694 ///
9695 /// Applications can examine the value using [ClientLibraryDestination::value] or
9696 /// [ClientLibraryDestination::name].
9697 UnknownValue(client_library_destination::UnknownValue),
9698}
9699
9700#[doc(hidden)]
9701pub mod client_library_destination {
9702 #[allow(unused_imports)]
9703 use super::*;
9704 #[derive(Clone, Debug, PartialEq)]
9705 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9706}
9707
9708impl ClientLibraryDestination {
9709 /// Gets the enum value.
9710 ///
9711 /// Returns `None` if the enum contains an unknown value deserialized from
9712 /// the string representation of enums.
9713 pub fn value(&self) -> std::option::Option<i32> {
9714 match self {
9715 Self::Unspecified => std::option::Option::Some(0),
9716 Self::Github => std::option::Option::Some(10),
9717 Self::PackageManager => std::option::Option::Some(20),
9718 Self::UnknownValue(u) => u.0.value(),
9719 }
9720 }
9721
9722 /// Gets the enum value as a string.
9723 ///
9724 /// Returns `None` if the enum contains an unknown value deserialized from
9725 /// the integer representation of enums.
9726 pub fn name(&self) -> std::option::Option<&str> {
9727 match self {
9728 Self::Unspecified => {
9729 std::option::Option::Some("CLIENT_LIBRARY_DESTINATION_UNSPECIFIED")
9730 }
9731 Self::Github => std::option::Option::Some("GITHUB"),
9732 Self::PackageManager => std::option::Option::Some("PACKAGE_MANAGER"),
9733 Self::UnknownValue(u) => u.0.name(),
9734 }
9735 }
9736}
9737
9738impl std::default::Default for ClientLibraryDestination {
9739 fn default() -> Self {
9740 use std::convert::From;
9741 Self::from(0)
9742 }
9743}
9744
9745impl std::fmt::Display for ClientLibraryDestination {
9746 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9747 wkt::internal::display_enum(f, self.name(), self.value())
9748 }
9749}
9750
9751impl std::convert::From<i32> for ClientLibraryDestination {
9752 fn from(value: i32) -> Self {
9753 match value {
9754 0 => Self::Unspecified,
9755 10 => Self::Github,
9756 20 => Self::PackageManager,
9757 _ => Self::UnknownValue(client_library_destination::UnknownValue(
9758 wkt::internal::UnknownEnumValue::Integer(value),
9759 )),
9760 }
9761 }
9762}
9763
9764impl std::convert::From<&str> for ClientLibraryDestination {
9765 fn from(value: &str) -> Self {
9766 use std::string::ToString;
9767 match value {
9768 "CLIENT_LIBRARY_DESTINATION_UNSPECIFIED" => Self::Unspecified,
9769 "GITHUB" => Self::Github,
9770 "PACKAGE_MANAGER" => Self::PackageManager,
9771 _ => Self::UnknownValue(client_library_destination::UnknownValue(
9772 wkt::internal::UnknownEnumValue::String(value.to_string()),
9773 )),
9774 }
9775 }
9776}
9777
9778impl serde::ser::Serialize for ClientLibraryDestination {
9779 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9780 where
9781 S: serde::Serializer,
9782 {
9783 match self {
9784 Self::Unspecified => serializer.serialize_i32(0),
9785 Self::Github => serializer.serialize_i32(10),
9786 Self::PackageManager => serializer.serialize_i32(20),
9787 Self::UnknownValue(u) => u.0.serialize(serializer),
9788 }
9789 }
9790}
9791
9792impl<'de> serde::de::Deserialize<'de> for ClientLibraryDestination {
9793 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9794 where
9795 D: serde::Deserializer<'de>,
9796 {
9797 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ClientLibraryDestination>::new(
9798 ".google.api.ClientLibraryDestination",
9799 ))
9800 }
9801}
9802
9803/// Classifies set of possible modifications to an object in the service
9804/// configuration.
9805///
9806/// # Working with unknown values
9807///
9808/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9809/// additional enum variants at any time. Adding new variants is not considered
9810/// a breaking change. Applications should write their code in anticipation of:
9811///
9812/// - New values appearing in future releases of the client library, **and**
9813/// - New values received dynamically, without application changes.
9814///
9815/// Please consult the [Working with enums] section in the user guide for some
9816/// guidelines.
9817///
9818/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9819#[derive(Clone, Debug, PartialEq)]
9820#[non_exhaustive]
9821pub enum ChangeType {
9822 /// No value was provided.
9823 Unspecified,
9824 /// The changed object exists in the 'new' service configuration, but not
9825 /// in the 'old' service configuration.
9826 Added,
9827 /// The changed object exists in the 'old' service configuration, but not
9828 /// in the 'new' service configuration.
9829 Removed,
9830 /// The changed object exists in both service configurations, but its value
9831 /// is different.
9832 Modified,
9833 /// If set, the enum was initialized with an unknown value.
9834 ///
9835 /// Applications can examine the value using [ChangeType::value] or
9836 /// [ChangeType::name].
9837 UnknownValue(change_type::UnknownValue),
9838}
9839
9840#[doc(hidden)]
9841pub mod change_type {
9842 #[allow(unused_imports)]
9843 use super::*;
9844 #[derive(Clone, Debug, PartialEq)]
9845 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9846}
9847
9848impl ChangeType {
9849 /// Gets the enum value.
9850 ///
9851 /// Returns `None` if the enum contains an unknown value deserialized from
9852 /// the string representation of enums.
9853 pub fn value(&self) -> std::option::Option<i32> {
9854 match self {
9855 Self::Unspecified => std::option::Option::Some(0),
9856 Self::Added => std::option::Option::Some(1),
9857 Self::Removed => std::option::Option::Some(2),
9858 Self::Modified => std::option::Option::Some(3),
9859 Self::UnknownValue(u) => u.0.value(),
9860 }
9861 }
9862
9863 /// Gets the enum value as a string.
9864 ///
9865 /// Returns `None` if the enum contains an unknown value deserialized from
9866 /// the integer representation of enums.
9867 pub fn name(&self) -> std::option::Option<&str> {
9868 match self {
9869 Self::Unspecified => std::option::Option::Some("CHANGE_TYPE_UNSPECIFIED"),
9870 Self::Added => std::option::Option::Some("ADDED"),
9871 Self::Removed => std::option::Option::Some("REMOVED"),
9872 Self::Modified => std::option::Option::Some("MODIFIED"),
9873 Self::UnknownValue(u) => u.0.name(),
9874 }
9875 }
9876}
9877
9878impl std::default::Default for ChangeType {
9879 fn default() -> Self {
9880 use std::convert::From;
9881 Self::from(0)
9882 }
9883}
9884
9885impl std::fmt::Display for ChangeType {
9886 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9887 wkt::internal::display_enum(f, self.name(), self.value())
9888 }
9889}
9890
9891impl std::convert::From<i32> for ChangeType {
9892 fn from(value: i32) -> Self {
9893 match value {
9894 0 => Self::Unspecified,
9895 1 => Self::Added,
9896 2 => Self::Removed,
9897 3 => Self::Modified,
9898 _ => Self::UnknownValue(change_type::UnknownValue(
9899 wkt::internal::UnknownEnumValue::Integer(value),
9900 )),
9901 }
9902 }
9903}
9904
9905impl std::convert::From<&str> for ChangeType {
9906 fn from(value: &str) -> Self {
9907 use std::string::ToString;
9908 match value {
9909 "CHANGE_TYPE_UNSPECIFIED" => Self::Unspecified,
9910 "ADDED" => Self::Added,
9911 "REMOVED" => Self::Removed,
9912 "MODIFIED" => Self::Modified,
9913 _ => Self::UnknownValue(change_type::UnknownValue(
9914 wkt::internal::UnknownEnumValue::String(value.to_string()),
9915 )),
9916 }
9917 }
9918}
9919
9920impl serde::ser::Serialize for ChangeType {
9921 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9922 where
9923 S: serde::Serializer,
9924 {
9925 match self {
9926 Self::Unspecified => serializer.serialize_i32(0),
9927 Self::Added => serializer.serialize_i32(1),
9928 Self::Removed => serializer.serialize_i32(2),
9929 Self::Modified => serializer.serialize_i32(3),
9930 Self::UnknownValue(u) => u.0.serialize(serializer),
9931 }
9932 }
9933}
9934
9935impl<'de> serde::de::Deserialize<'de> for ChangeType {
9936 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9937 where
9938 D: serde::Deserializer<'de>,
9939 {
9940 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ChangeType>::new(
9941 ".google.api.ChangeType",
9942 ))
9943 }
9944}
9945
9946/// Defines the supported values for `google.rpc.ErrorInfo.reason` for the
9947/// `googleapis.com` error domain. This error domain is reserved for [Service
9948/// Infrastructure](https://cloud.google.com/service-infrastructure/docs/overview).
9949/// For each error info of this domain, the metadata key "service" refers to the
9950/// logical identifier of an API service, such as "pubsub.googleapis.com". The
9951/// "consumer" refers to the entity that consumes an API Service. It typically is
9952/// a Google project that owns the client application or the server resource,
9953/// such as "projects/123". Other metadata keys are specific to each error
9954/// reason. For more information, see the definition of the specific error
9955/// reason.
9956///
9957/// # Working with unknown values
9958///
9959/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9960/// additional enum variants at any time. Adding new variants is not considered
9961/// a breaking change. Applications should write their code in anticipation of:
9962///
9963/// - New values appearing in future releases of the client library, **and**
9964/// - New values received dynamically, without application changes.
9965///
9966/// Please consult the [Working with enums] section in the user guide for some
9967/// guidelines.
9968///
9969/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9970#[derive(Clone, Debug, PartialEq)]
9971#[non_exhaustive]
9972pub enum ErrorReason {
9973 /// Do not use this default value.
9974 Unspecified,
9975 /// The request is calling a disabled service for a consumer.
9976 ///
9977 /// Example of an ErrorInfo when the consumer "projects/123" contacting
9978 /// "pubsub.googleapis.com" service which is disabled:
9979 ///
9980 /// ```norust
9981 /// { "reason": "SERVICE_DISABLED",
9982 /// "domain": "googleapis.com",
9983 /// "metadata": {
9984 /// "consumer": "projects/123",
9985 /// "service": "pubsub.googleapis.com"
9986 /// }
9987 /// }
9988 /// ```
9989 ///
9990 /// This response indicates the "pubsub.googleapis.com" has been disabled in
9991 /// "projects/123".
9992 ServiceDisabled,
9993 /// The request whose associated billing account is disabled.
9994 ///
9995 /// Example of an ErrorInfo when the consumer "projects/123" fails to contact
9996 /// "pubsub.googleapis.com" service because the associated billing account is
9997 /// disabled:
9998 ///
9999 /// ```norust
10000 /// { "reason": "BILLING_DISABLED",
10001 /// "domain": "googleapis.com",
10002 /// "metadata": {
10003 /// "consumer": "projects/123",
10004 /// "service": "pubsub.googleapis.com"
10005 /// }
10006 /// }
10007 /// ```
10008 ///
10009 /// This response indicates the billing account associated has been disabled.
10010 BillingDisabled,
10011 /// The request is denied because the provided [API
10012 /// key](https://cloud.google.com/docs/authentication/api-keys) is invalid. It
10013 /// may be in a bad format, cannot be found, or has been expired).
10014 ///
10015 /// Example of an ErrorInfo when the request is contacting
10016 /// "storage.googleapis.com" service with an invalid API key:
10017 ///
10018 /// ```norust
10019 /// { "reason": "API_KEY_INVALID",
10020 /// "domain": "googleapis.com",
10021 /// "metadata": {
10022 /// "service": "storage.googleapis.com",
10023 /// }
10024 /// }
10025 /// ```
10026 ApiKeyInvalid,
10027 /// The request is denied because it violates [API key API
10028 /// restrictions](https://cloud.google.com/docs/authentication/api-keys#adding_api_restrictions).
10029 ///
10030 /// Example of an ErrorInfo when the consumer "projects/123" fails to call the
10031 /// "storage.googleapis.com" service because this service is restricted in the
10032 /// API key:
10033 ///
10034 /// ```norust
10035 /// { "reason": "API_KEY_SERVICE_BLOCKED",
10036 /// "domain": "googleapis.com",
10037 /// "metadata": {
10038 /// "consumer": "projects/123",
10039 /// "service": "storage.googleapis.com"
10040 /// }
10041 /// }
10042 /// ```
10043 ApiKeyServiceBlocked,
10044 /// The request is denied because it violates [API key HTTP
10045 /// restrictions](https://cloud.google.com/docs/authentication/api-keys#adding_http_restrictions).
10046 ///
10047 /// Example of an ErrorInfo when the consumer "projects/123" fails to call
10048 /// "storage.googleapis.com" service because the http referrer of the request
10049 /// violates API key HTTP restrictions:
10050 ///
10051 /// ```norust
10052 /// { "reason": "API_KEY_HTTP_REFERRER_BLOCKED",
10053 /// "domain": "googleapis.com",
10054 /// "metadata": {
10055 /// "consumer": "projects/123",
10056 /// "service": "storage.googleapis.com",
10057 /// }
10058 /// }
10059 /// ```
10060 ApiKeyHttpReferrerBlocked,
10061 /// The request is denied because it violates [API key IP address
10062 /// restrictions](https://cloud.google.com/docs/authentication/api-keys#adding_application_restrictions).
10063 ///
10064 /// Example of an ErrorInfo when the consumer "projects/123" fails to call
10065 /// "storage.googleapis.com" service because the caller IP of the request
10066 /// violates API key IP address restrictions:
10067 ///
10068 /// ```norust
10069 /// { "reason": "API_KEY_IP_ADDRESS_BLOCKED",
10070 /// "domain": "googleapis.com",
10071 /// "metadata": {
10072 /// "consumer": "projects/123",
10073 /// "service": "storage.googleapis.com",
10074 /// }
10075 /// }
10076 /// ```
10077 ApiKeyIpAddressBlocked,
10078 /// The request is denied because it violates [API key Android application
10079 /// restrictions](https://cloud.google.com/docs/authentication/api-keys#adding_application_restrictions).
10080 ///
10081 /// Example of an ErrorInfo when the consumer "projects/123" fails to call
10082 /// "storage.googleapis.com" service because the request from the Android apps
10083 /// violates the API key Android application restrictions:
10084 ///
10085 /// ```norust
10086 /// { "reason": "API_KEY_ANDROID_APP_BLOCKED",
10087 /// "domain": "googleapis.com",
10088 /// "metadata": {
10089 /// "consumer": "projects/123",
10090 /// "service": "storage.googleapis.com"
10091 /// }
10092 /// }
10093 /// ```
10094 ApiKeyAndroidAppBlocked,
10095 /// The request is denied because it violates [API key iOS application
10096 /// restrictions](https://cloud.google.com/docs/authentication/api-keys#adding_application_restrictions).
10097 ///
10098 /// Example of an ErrorInfo when the consumer "projects/123" fails to call
10099 /// "storage.googleapis.com" service because the request from the iOS apps
10100 /// violates the API key iOS application restrictions:
10101 ///
10102 /// ```norust
10103 /// { "reason": "API_KEY_IOS_APP_BLOCKED",
10104 /// "domain": "googleapis.com",
10105 /// "metadata": {
10106 /// "consumer": "projects/123",
10107 /// "service": "storage.googleapis.com"
10108 /// }
10109 /// }
10110 /// ```
10111 ApiKeyIosAppBlocked,
10112 /// The request is denied because there is not enough rate quota for the
10113 /// consumer.
10114 ///
10115 /// Example of an ErrorInfo when the consumer "projects/123" fails to contact
10116 /// "pubsub.googleapis.com" service because consumer's rate quota usage has
10117 /// reached the maximum value set for the quota limit
10118 /// "ReadsPerMinutePerProject" on the quota metric
10119 /// "pubsub.googleapis.com/read_requests":
10120 ///
10121 /// ```norust
10122 /// { "reason": "RATE_LIMIT_EXCEEDED",
10123 /// "domain": "googleapis.com",
10124 /// "metadata": {
10125 /// "consumer": "projects/123",
10126 /// "service": "pubsub.googleapis.com",
10127 /// "quota_metric": "pubsub.googleapis.com/read_requests",
10128 /// "quota_limit": "ReadsPerMinutePerProject"
10129 /// }
10130 /// }
10131 /// ```
10132 ///
10133 /// Example of an ErrorInfo when the consumer "projects/123" checks quota on
10134 /// the service "dataflow.googleapis.com" and hits the organization quota
10135 /// limit "DefaultRequestsPerMinutePerOrganization" on the metric
10136 /// "dataflow.googleapis.com/default_requests".
10137 ///
10138 /// ```norust
10139 /// { "reason": "RATE_LIMIT_EXCEEDED",
10140 /// "domain": "googleapis.com",
10141 /// "metadata": {
10142 /// "consumer": "projects/123",
10143 /// "service": "dataflow.googleapis.com",
10144 /// "quota_metric": "dataflow.googleapis.com/default_requests",
10145 /// "quota_limit": "DefaultRequestsPerMinutePerOrganization"
10146 /// }
10147 /// }
10148 /// ```
10149 RateLimitExceeded,
10150 /// The request is denied because there is not enough resource quota for the
10151 /// consumer.
10152 ///
10153 /// Example of an ErrorInfo when the consumer "projects/123" fails to contact
10154 /// "compute.googleapis.com" service because consumer's resource quota usage
10155 /// has reached the maximum value set for the quota limit "VMsPerProject"
10156 /// on the quota metric "compute.googleapis.com/vms":
10157 ///
10158 /// ```norust
10159 /// { "reason": "RESOURCE_QUOTA_EXCEEDED",
10160 /// "domain": "googleapis.com",
10161 /// "metadata": {
10162 /// "consumer": "projects/123",
10163 /// "service": "compute.googleapis.com",
10164 /// "quota_metric": "compute.googleapis.com/vms",
10165 /// "quota_limit": "VMsPerProject"
10166 /// }
10167 /// }
10168 /// ```
10169 ///
10170 /// Example of an ErrorInfo when the consumer "projects/123" checks resource
10171 /// quota on the service "dataflow.googleapis.com" and hits the organization
10172 /// quota limit "jobs-per-organization" on the metric
10173 /// "dataflow.googleapis.com/job_count".
10174 ///
10175 /// ```norust
10176 /// { "reason": "RESOURCE_QUOTA_EXCEEDED",
10177 /// "domain": "googleapis.com",
10178 /// "metadata": {
10179 /// "consumer": "projects/123",
10180 /// "service": "dataflow.googleapis.com",
10181 /// "quota_metric": "dataflow.googleapis.com/job_count",
10182 /// "quota_limit": "jobs-per-organization"
10183 /// }
10184 /// }
10185 /// ```
10186 ResourceQuotaExceeded,
10187 /// The request whose associated billing account address is in a tax restricted
10188 /// location, violates the local tax restrictions when creating resources in
10189 /// the restricted region.
10190 ///
10191 /// Example of an ErrorInfo when creating the Cloud Storage Bucket in the
10192 /// container "projects/123" under a tax restricted region
10193 /// "locations/asia-northeast3":
10194 ///
10195 /// ```norust
10196 /// { "reason": "LOCATION_TAX_POLICY_VIOLATED",
10197 /// "domain": "googleapis.com",
10198 /// "metadata": {
10199 /// "consumer": "projects/123",
10200 /// "service": "storage.googleapis.com",
10201 /// "location": "locations/asia-northeast3"
10202 /// }
10203 /// }
10204 /// ```
10205 ///
10206 /// This response indicates creating the Cloud Storage Bucket in
10207 /// "locations/asia-northeast3" violates the location tax restriction.
10208 LocationTaxPolicyViolated,
10209 /// The request is denied because the caller does not have required permission
10210 /// on the user project "projects/123" or the user project is invalid. For more
10211 /// information, check the [userProject System
10212 /// Parameters](https://cloud.google.com/apis/docs/system-parameters).
10213 ///
10214 /// Example of an ErrorInfo when the caller is calling Cloud Storage service
10215 /// with insufficient permissions on the user project:
10216 ///
10217 /// ```norust
10218 /// { "reason": "USER_PROJECT_DENIED",
10219 /// "domain": "googleapis.com",
10220 /// "metadata": {
10221 /// "consumer": "projects/123",
10222 /// "service": "storage.googleapis.com"
10223 /// }
10224 /// }
10225 /// ```
10226 UserProjectDenied,
10227 /// The request is denied because the consumer "projects/123" is suspended due
10228 /// to Terms of Service(Tos) violations. Check [Project suspension
10229 /// guidelines](https://cloud.google.com/resource-manager/docs/project-suspension-guidelines)
10230 /// for more information.
10231 ///
10232 /// Example of an ErrorInfo when calling Cloud Storage service with the
10233 /// suspended consumer "projects/123":
10234 ///
10235 /// ```norust
10236 /// { "reason": "CONSUMER_SUSPENDED",
10237 /// "domain": "googleapis.com",
10238 /// "metadata": {
10239 /// "consumer": "projects/123",
10240 /// "service": "storage.googleapis.com"
10241 /// }
10242 /// }
10243 /// ```
10244 ConsumerSuspended,
10245 /// The request is denied because the associated consumer is invalid. It may be
10246 /// in a bad format, cannot be found, or have been deleted.
10247 ///
10248 /// Example of an ErrorInfo when calling Cloud Storage service with the
10249 /// invalid consumer "projects/123":
10250 ///
10251 /// ```norust
10252 /// { "reason": "CONSUMER_INVALID",
10253 /// "domain": "googleapis.com",
10254 /// "metadata": {
10255 /// "consumer": "projects/123",
10256 /// "service": "storage.googleapis.com"
10257 /// }
10258 /// }
10259 /// ```
10260 ConsumerInvalid,
10261 /// The request is denied because it violates [VPC Service
10262 /// Controls](https://cloud.google.com/vpc-service-controls/docs/overview).
10263 /// The 'uid' field is a random generated identifier that customer can use it
10264 /// to search the audit log for a request rejected by VPC Service Controls. For
10265 /// more information, please refer [VPC Service Controls
10266 /// Troubleshooting](https://cloud.google.com/vpc-service-controls/docs/troubleshooting#unique-id)
10267 ///
10268 /// Example of an ErrorInfo when the consumer "projects/123" fails to call
10269 /// Cloud Storage service because the request is prohibited by the VPC Service
10270 /// Controls.
10271 ///
10272 /// ```norust
10273 /// { "reason": "SECURITY_POLICY_VIOLATED",
10274 /// "domain": "googleapis.com",
10275 /// "metadata": {
10276 /// "uid": "123456789abcde",
10277 /// "consumer": "projects/123",
10278 /// "service": "storage.googleapis.com"
10279 /// }
10280 /// }
10281 /// ```
10282 SecurityPolicyViolated,
10283 /// The request is denied because the provided access token has expired.
10284 ///
10285 /// Example of an ErrorInfo when the request is calling Cloud Storage service
10286 /// with an expired access token:
10287 ///
10288 /// ```norust
10289 /// { "reason": "ACCESS_TOKEN_EXPIRED",
10290 /// "domain": "googleapis.com",
10291 /// "metadata": {
10292 /// "service": "storage.googleapis.com",
10293 /// "method": "google.storage.v1.Storage.GetObject"
10294 /// }
10295 /// }
10296 /// ```
10297 AccessTokenExpired,
10298 /// The request is denied because the provided access token doesn't have at
10299 /// least one of the acceptable scopes required for the API. Please check
10300 /// [OAuth 2.0 Scopes for Google
10301 /// APIs](https://developers.google.com/identity/protocols/oauth2/scopes) for
10302 /// the list of the OAuth 2.0 scopes that you might need to request to access
10303 /// the API.
10304 ///
10305 /// Example of an ErrorInfo when the request is calling Cloud Storage service
10306 /// with an access token that is missing required scopes:
10307 ///
10308 /// ```norust
10309 /// { "reason": "ACCESS_TOKEN_SCOPE_INSUFFICIENT",
10310 /// "domain": "googleapis.com",
10311 /// "metadata": {
10312 /// "service": "storage.googleapis.com",
10313 /// "method": "google.storage.v1.Storage.GetObject"
10314 /// }
10315 /// }
10316 /// ```
10317 AccessTokenScopeInsufficient,
10318 /// The request is denied because the account associated with the provided
10319 /// access token is in an invalid state, such as disabled or deleted.
10320 /// For more information, see <https://cloud.google.com/docs/authentication>.
10321 ///
10322 /// Warning: For privacy reasons, the server may not be able to disclose the
10323 /// email address for some accounts. The client MUST NOT depend on the
10324 /// availability of the `email` attribute.
10325 ///
10326 /// Example of an ErrorInfo when the request is to the Cloud Storage API with
10327 /// an access token that is associated with a disabled or deleted [service
10328 /// account](http://cloud/iam/docs/service-accounts):
10329 ///
10330 /// ```norust
10331 /// { "reason": "ACCOUNT_STATE_INVALID",
10332 /// "domain": "googleapis.com",
10333 /// "metadata": {
10334 /// "service": "storage.googleapis.com",
10335 /// "method": "google.storage.v1.Storage.GetObject",
10336 /// "email": "user@123.iam.gserviceaccount.com"
10337 /// }
10338 /// }
10339 /// ```
10340 AccountStateInvalid,
10341 /// The request is denied because the type of the provided access token is not
10342 /// supported by the API being called.
10343 ///
10344 /// Example of an ErrorInfo when the request is to the Cloud Storage API with
10345 /// an unsupported token type.
10346 ///
10347 /// ```norust
10348 /// { "reason": "ACCESS_TOKEN_TYPE_UNSUPPORTED",
10349 /// "domain": "googleapis.com",
10350 /// "metadata": {
10351 /// "service": "storage.googleapis.com",
10352 /// "method": "google.storage.v1.Storage.GetObject"
10353 /// }
10354 /// }
10355 /// ```
10356 AccessTokenTypeUnsupported,
10357 /// The request is denied because the request doesn't have any authentication
10358 /// credentials. For more information regarding the supported authentication
10359 /// strategies for Google Cloud APIs, see
10360 /// <https://cloud.google.com/docs/authentication>.
10361 ///
10362 /// Example of an ErrorInfo when the request is to the Cloud Storage API
10363 /// without any authentication credentials.
10364 ///
10365 /// ```norust
10366 /// { "reason": "CREDENTIALS_MISSING",
10367 /// "domain": "googleapis.com",
10368 /// "metadata": {
10369 /// "service": "storage.googleapis.com",
10370 /// "method": "google.storage.v1.Storage.GetObject"
10371 /// }
10372 /// }
10373 /// ```
10374 CredentialsMissing,
10375 /// The request is denied because the provided project owning the resource
10376 /// which acts as the [API
10377 /// consumer](https://cloud.google.com/apis/design/glossary#api_consumer) is
10378 /// invalid. It may be in a bad format or empty.
10379 ///
10380 /// Example of an ErrorInfo when the request is to the Cloud Functions API,
10381 /// but the offered resource project in the request in a bad format which can't
10382 /// perform the ListFunctions method.
10383 ///
10384 /// ```norust
10385 /// { "reason": "RESOURCE_PROJECT_INVALID",
10386 /// "domain": "googleapis.com",
10387 /// "metadata": {
10388 /// "service": "cloudfunctions.googleapis.com",
10389 /// "method":
10390 /// "google.cloud.functions.v1.CloudFunctionsService.ListFunctions"
10391 /// }
10392 /// }
10393 /// ```
10394 ResourceProjectInvalid,
10395 /// The request is denied because the provided session cookie is missing,
10396 /// invalid or failed to decode.
10397 ///
10398 /// Example of an ErrorInfo when the request is calling Cloud Storage service
10399 /// with a SID cookie which can't be decoded.
10400 ///
10401 /// ```norust
10402 /// { "reason": "SESSION_COOKIE_INVALID",
10403 /// "domain": "googleapis.com",
10404 /// "metadata": {
10405 /// "service": "storage.googleapis.com",
10406 /// "method": "google.storage.v1.Storage.GetObject",
10407 /// "cookie": "SID"
10408 /// }
10409 /// }
10410 /// ```
10411 SessionCookieInvalid,
10412 /// The request is denied because the user is from a Google Workspace customer
10413 /// that blocks their users from accessing a particular service.
10414 ///
10415 /// Example scenario: <https://support.google.com/a/answer/9197205?hl=en>
10416 ///
10417 /// Example of an ErrorInfo when access to Google Cloud Storage service is
10418 /// blocked by the Google Workspace administrator:
10419 ///
10420 /// ```norust
10421 /// { "reason": "USER_BLOCKED_BY_ADMIN",
10422 /// "domain": "googleapis.com",
10423 /// "metadata": {
10424 /// "service": "storage.googleapis.com",
10425 /// "method": "google.storage.v1.Storage.GetObject",
10426 /// }
10427 /// }
10428 /// ```
10429 UserBlockedByAdmin,
10430 /// The request is denied because the resource service usage is restricted
10431 /// by administrators according to the organization policy constraint.
10432 /// For more information see
10433 /// <https://cloud.google.com/resource-manager/docs/organization-policy/restricting-services>.
10434 ///
10435 /// Example of an ErrorInfo when access to Google Cloud Storage service is
10436 /// restricted by Resource Usage Restriction policy:
10437 ///
10438 /// ```norust
10439 /// { "reason": "RESOURCE_USAGE_RESTRICTION_VIOLATED",
10440 /// "domain": "googleapis.com",
10441 /// "metadata": {
10442 /// "consumer": "projects/project-123",
10443 /// "service": "storage.googleapis.com"
10444 /// }
10445 /// }
10446 /// ```
10447 ResourceUsageRestrictionViolated,
10448 /// Unimplemented. Do not use.
10449 ///
10450 /// The request is denied because it contains unsupported system parameters in
10451 /// URL query parameters or HTTP headers. For more information,
10452 /// see <https://cloud.google.com/apis/docs/system-parameters>
10453 ///
10454 /// Example of an ErrorInfo when access "pubsub.googleapis.com" service with
10455 /// a request header of "x-goog-user-ip":
10456 ///
10457 /// ```norust
10458 /// { "reason": "SYSTEM_PARAMETER_UNSUPPORTED",
10459 /// "domain": "googleapis.com",
10460 /// "metadata": {
10461 /// "service": "pubsub.googleapis.com"
10462 /// "parameter": "x-goog-user-ip"
10463 /// }
10464 /// }
10465 /// ```
10466 SystemParameterUnsupported,
10467 /// The request is denied because it violates Org Restriction: the requested
10468 /// resource does not belong to allowed organizations specified in
10469 /// "X-Goog-Allowed-Resources" header.
10470 ///
10471 /// Example of an ErrorInfo when accessing a GCP resource that is restricted by
10472 /// Org Restriction for "pubsub.googleapis.com" service.
10473 ///
10474 /// {
10475 /// reason: "ORG_RESTRICTION_VIOLATION"
10476 /// domain: "googleapis.com"
10477 /// metadata {
10478 /// "consumer":"projects/123456"
10479 /// "service": "pubsub.googleapis.com"
10480 /// }
10481 /// }
10482 OrgRestrictionViolation,
10483 /// The request is denied because "X-Goog-Allowed-Resources" header is in a bad
10484 /// format.
10485 ///
10486 /// Example of an ErrorInfo when
10487 /// accessing "pubsub.googleapis.com" service with an invalid
10488 /// "X-Goog-Allowed-Resources" request header.
10489 ///
10490 /// {
10491 /// reason: "ORG_RESTRICTION_HEADER_INVALID"
10492 /// domain: "googleapis.com"
10493 /// metadata {
10494 /// "consumer":"projects/123456"
10495 /// "service": "pubsub.googleapis.com"
10496 /// }
10497 /// }
10498 OrgRestrictionHeaderInvalid,
10499 /// Unimplemented. Do not use.
10500 ///
10501 /// The request is calling a service that is not visible to the consumer.
10502 ///
10503 /// Example of an ErrorInfo when the consumer "projects/123" contacting
10504 /// "pubsub.googleapis.com" service which is not visible to the consumer.
10505 ///
10506 /// ```norust
10507 /// { "reason": "SERVICE_NOT_VISIBLE",
10508 /// "domain": "googleapis.com",
10509 /// "metadata": {
10510 /// "consumer": "projects/123",
10511 /// "service": "pubsub.googleapis.com"
10512 /// }
10513 /// }
10514 /// ```
10515 ///
10516 /// This response indicates the "pubsub.googleapis.com" is not visible to
10517 /// "projects/123" (or it may not exist).
10518 ServiceNotVisible,
10519 /// The request is related to a project for which GCP access is suspended.
10520 ///
10521 /// Example of an ErrorInfo when the consumer "projects/123" fails to contact
10522 /// "pubsub.googleapis.com" service because GCP access is suspended:
10523 ///
10524 /// ```norust
10525 /// { "reason": "GCP_SUSPENDED",
10526 /// "domain": "googleapis.com",
10527 /// "metadata": {
10528 /// "consumer": "projects/123",
10529 /// "service": "pubsub.googleapis.com"
10530 /// }
10531 /// }
10532 /// ```
10533 ///
10534 /// This response indicates the associated GCP account has been suspended.
10535 GcpSuspended,
10536 /// The request violates the location policies when creating resources in
10537 /// the restricted region.
10538 ///
10539 /// Example of an ErrorInfo when creating the Cloud Storage Bucket by
10540 /// "projects/123" for service storage.googleapis.com:
10541 ///
10542 /// ```norust
10543 /// { "reason": "LOCATION_POLICY_VIOLATED",
10544 /// "domain": "googleapis.com",
10545 /// "metadata": {
10546 /// "consumer": "projects/123",
10547 /// "service": "storage.googleapis.com",
10548 /// }
10549 /// }
10550 /// ```
10551 ///
10552 /// This response indicates creating the Cloud Storage Bucket in
10553 /// "locations/asia-northeast3" violates at least one location policy.
10554 /// The troubleshooting guidance is provided in the Help links.
10555 LocationPolicyViolated,
10556 /// The request is denied because origin request header is missing.
10557 ///
10558 /// Example of an ErrorInfo when
10559 /// accessing "pubsub.googleapis.com" service with an empty "Origin" request
10560 /// header.
10561 ///
10562 /// {
10563 /// reason: "MISSING_ORIGIN"
10564 /// domain: "googleapis.com"
10565 /// metadata {
10566 /// "consumer":"projects/123456"
10567 /// "service": "pubsub.googleapis.com"
10568 /// }
10569 /// }
10570 MissingOrigin,
10571 /// The request is denied because the request contains more than one credential
10572 /// type that are individually acceptable, but not together. The customer
10573 /// should retry their request with only one set of credentials.
10574 ///
10575 /// Example of an ErrorInfo when
10576 /// accessing "pubsub.googleapis.com" service with overloaded credentials.
10577 ///
10578 /// {
10579 /// reason: "OVERLOADED_CREDENTIALS"
10580 /// domain: "googleapis.com"
10581 /// metadata {
10582 /// "consumer":"projects/123456"
10583 /// "service": "pubsub.googleapis.com"
10584 /// }
10585 /// }
10586 OverloadedCredentials,
10587 /// If set, the enum was initialized with an unknown value.
10588 ///
10589 /// Applications can examine the value using [ErrorReason::value] or
10590 /// [ErrorReason::name].
10591 UnknownValue(error_reason::UnknownValue),
10592}
10593
10594#[doc(hidden)]
10595pub mod error_reason {
10596 #[allow(unused_imports)]
10597 use super::*;
10598 #[derive(Clone, Debug, PartialEq)]
10599 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10600}
10601
10602impl ErrorReason {
10603 /// Gets the enum value.
10604 ///
10605 /// Returns `None` if the enum contains an unknown value deserialized from
10606 /// the string representation of enums.
10607 pub fn value(&self) -> std::option::Option<i32> {
10608 match self {
10609 Self::Unspecified => std::option::Option::Some(0),
10610 Self::ServiceDisabled => std::option::Option::Some(1),
10611 Self::BillingDisabled => std::option::Option::Some(2),
10612 Self::ApiKeyInvalid => std::option::Option::Some(3),
10613 Self::ApiKeyServiceBlocked => std::option::Option::Some(4),
10614 Self::ApiKeyHttpReferrerBlocked => std::option::Option::Some(7),
10615 Self::ApiKeyIpAddressBlocked => std::option::Option::Some(8),
10616 Self::ApiKeyAndroidAppBlocked => std::option::Option::Some(9),
10617 Self::ApiKeyIosAppBlocked => std::option::Option::Some(13),
10618 Self::RateLimitExceeded => std::option::Option::Some(5),
10619 Self::ResourceQuotaExceeded => std::option::Option::Some(6),
10620 Self::LocationTaxPolicyViolated => std::option::Option::Some(10),
10621 Self::UserProjectDenied => std::option::Option::Some(11),
10622 Self::ConsumerSuspended => std::option::Option::Some(12),
10623 Self::ConsumerInvalid => std::option::Option::Some(14),
10624 Self::SecurityPolicyViolated => std::option::Option::Some(15),
10625 Self::AccessTokenExpired => std::option::Option::Some(16),
10626 Self::AccessTokenScopeInsufficient => std::option::Option::Some(17),
10627 Self::AccountStateInvalid => std::option::Option::Some(18),
10628 Self::AccessTokenTypeUnsupported => std::option::Option::Some(19),
10629 Self::CredentialsMissing => std::option::Option::Some(20),
10630 Self::ResourceProjectInvalid => std::option::Option::Some(21),
10631 Self::SessionCookieInvalid => std::option::Option::Some(23),
10632 Self::UserBlockedByAdmin => std::option::Option::Some(24),
10633 Self::ResourceUsageRestrictionViolated => std::option::Option::Some(25),
10634 Self::SystemParameterUnsupported => std::option::Option::Some(26),
10635 Self::OrgRestrictionViolation => std::option::Option::Some(27),
10636 Self::OrgRestrictionHeaderInvalid => std::option::Option::Some(28),
10637 Self::ServiceNotVisible => std::option::Option::Some(29),
10638 Self::GcpSuspended => std::option::Option::Some(30),
10639 Self::LocationPolicyViolated => std::option::Option::Some(31),
10640 Self::MissingOrigin => std::option::Option::Some(33),
10641 Self::OverloadedCredentials => std::option::Option::Some(34),
10642 Self::UnknownValue(u) => u.0.value(),
10643 }
10644 }
10645
10646 /// Gets the enum value as a string.
10647 ///
10648 /// Returns `None` if the enum contains an unknown value deserialized from
10649 /// the integer representation of enums.
10650 pub fn name(&self) -> std::option::Option<&str> {
10651 match self {
10652 Self::Unspecified => std::option::Option::Some("ERROR_REASON_UNSPECIFIED"),
10653 Self::ServiceDisabled => std::option::Option::Some("SERVICE_DISABLED"),
10654 Self::BillingDisabled => std::option::Option::Some("BILLING_DISABLED"),
10655 Self::ApiKeyInvalid => std::option::Option::Some("API_KEY_INVALID"),
10656 Self::ApiKeyServiceBlocked => std::option::Option::Some("API_KEY_SERVICE_BLOCKED"),
10657 Self::ApiKeyHttpReferrerBlocked => {
10658 std::option::Option::Some("API_KEY_HTTP_REFERRER_BLOCKED")
10659 }
10660 Self::ApiKeyIpAddressBlocked => std::option::Option::Some("API_KEY_IP_ADDRESS_BLOCKED"),
10661 Self::ApiKeyAndroidAppBlocked => {
10662 std::option::Option::Some("API_KEY_ANDROID_APP_BLOCKED")
10663 }
10664 Self::ApiKeyIosAppBlocked => std::option::Option::Some("API_KEY_IOS_APP_BLOCKED"),
10665 Self::RateLimitExceeded => std::option::Option::Some("RATE_LIMIT_EXCEEDED"),
10666 Self::ResourceQuotaExceeded => std::option::Option::Some("RESOURCE_QUOTA_EXCEEDED"),
10667 Self::LocationTaxPolicyViolated => {
10668 std::option::Option::Some("LOCATION_TAX_POLICY_VIOLATED")
10669 }
10670 Self::UserProjectDenied => std::option::Option::Some("USER_PROJECT_DENIED"),
10671 Self::ConsumerSuspended => std::option::Option::Some("CONSUMER_SUSPENDED"),
10672 Self::ConsumerInvalid => std::option::Option::Some("CONSUMER_INVALID"),
10673 Self::SecurityPolicyViolated => std::option::Option::Some("SECURITY_POLICY_VIOLATED"),
10674 Self::AccessTokenExpired => std::option::Option::Some("ACCESS_TOKEN_EXPIRED"),
10675 Self::AccessTokenScopeInsufficient => {
10676 std::option::Option::Some("ACCESS_TOKEN_SCOPE_INSUFFICIENT")
10677 }
10678 Self::AccountStateInvalid => std::option::Option::Some("ACCOUNT_STATE_INVALID"),
10679 Self::AccessTokenTypeUnsupported => {
10680 std::option::Option::Some("ACCESS_TOKEN_TYPE_UNSUPPORTED")
10681 }
10682 Self::CredentialsMissing => std::option::Option::Some("CREDENTIALS_MISSING"),
10683 Self::ResourceProjectInvalid => std::option::Option::Some("RESOURCE_PROJECT_INVALID"),
10684 Self::SessionCookieInvalid => std::option::Option::Some("SESSION_COOKIE_INVALID"),
10685 Self::UserBlockedByAdmin => std::option::Option::Some("USER_BLOCKED_BY_ADMIN"),
10686 Self::ResourceUsageRestrictionViolated => {
10687 std::option::Option::Some("RESOURCE_USAGE_RESTRICTION_VIOLATED")
10688 }
10689 Self::SystemParameterUnsupported => {
10690 std::option::Option::Some("SYSTEM_PARAMETER_UNSUPPORTED")
10691 }
10692 Self::OrgRestrictionViolation => std::option::Option::Some("ORG_RESTRICTION_VIOLATION"),
10693 Self::OrgRestrictionHeaderInvalid => {
10694 std::option::Option::Some("ORG_RESTRICTION_HEADER_INVALID")
10695 }
10696 Self::ServiceNotVisible => std::option::Option::Some("SERVICE_NOT_VISIBLE"),
10697 Self::GcpSuspended => std::option::Option::Some("GCP_SUSPENDED"),
10698 Self::LocationPolicyViolated => std::option::Option::Some("LOCATION_POLICY_VIOLATED"),
10699 Self::MissingOrigin => std::option::Option::Some("MISSING_ORIGIN"),
10700 Self::OverloadedCredentials => std::option::Option::Some("OVERLOADED_CREDENTIALS"),
10701 Self::UnknownValue(u) => u.0.name(),
10702 }
10703 }
10704}
10705
10706impl std::default::Default for ErrorReason {
10707 fn default() -> Self {
10708 use std::convert::From;
10709 Self::from(0)
10710 }
10711}
10712
10713impl std::fmt::Display for ErrorReason {
10714 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10715 wkt::internal::display_enum(f, self.name(), self.value())
10716 }
10717}
10718
10719impl std::convert::From<i32> for ErrorReason {
10720 fn from(value: i32) -> Self {
10721 match value {
10722 0 => Self::Unspecified,
10723 1 => Self::ServiceDisabled,
10724 2 => Self::BillingDisabled,
10725 3 => Self::ApiKeyInvalid,
10726 4 => Self::ApiKeyServiceBlocked,
10727 5 => Self::RateLimitExceeded,
10728 6 => Self::ResourceQuotaExceeded,
10729 7 => Self::ApiKeyHttpReferrerBlocked,
10730 8 => Self::ApiKeyIpAddressBlocked,
10731 9 => Self::ApiKeyAndroidAppBlocked,
10732 10 => Self::LocationTaxPolicyViolated,
10733 11 => Self::UserProjectDenied,
10734 12 => Self::ConsumerSuspended,
10735 13 => Self::ApiKeyIosAppBlocked,
10736 14 => Self::ConsumerInvalid,
10737 15 => Self::SecurityPolicyViolated,
10738 16 => Self::AccessTokenExpired,
10739 17 => Self::AccessTokenScopeInsufficient,
10740 18 => Self::AccountStateInvalid,
10741 19 => Self::AccessTokenTypeUnsupported,
10742 20 => Self::CredentialsMissing,
10743 21 => Self::ResourceProjectInvalid,
10744 23 => Self::SessionCookieInvalid,
10745 24 => Self::UserBlockedByAdmin,
10746 25 => Self::ResourceUsageRestrictionViolated,
10747 26 => Self::SystemParameterUnsupported,
10748 27 => Self::OrgRestrictionViolation,
10749 28 => Self::OrgRestrictionHeaderInvalid,
10750 29 => Self::ServiceNotVisible,
10751 30 => Self::GcpSuspended,
10752 31 => Self::LocationPolicyViolated,
10753 33 => Self::MissingOrigin,
10754 34 => Self::OverloadedCredentials,
10755 _ => Self::UnknownValue(error_reason::UnknownValue(
10756 wkt::internal::UnknownEnumValue::Integer(value),
10757 )),
10758 }
10759 }
10760}
10761
10762impl std::convert::From<&str> for ErrorReason {
10763 fn from(value: &str) -> Self {
10764 use std::string::ToString;
10765 match value {
10766 "ERROR_REASON_UNSPECIFIED" => Self::Unspecified,
10767 "SERVICE_DISABLED" => Self::ServiceDisabled,
10768 "BILLING_DISABLED" => Self::BillingDisabled,
10769 "API_KEY_INVALID" => Self::ApiKeyInvalid,
10770 "API_KEY_SERVICE_BLOCKED" => Self::ApiKeyServiceBlocked,
10771 "API_KEY_HTTP_REFERRER_BLOCKED" => Self::ApiKeyHttpReferrerBlocked,
10772 "API_KEY_IP_ADDRESS_BLOCKED" => Self::ApiKeyIpAddressBlocked,
10773 "API_KEY_ANDROID_APP_BLOCKED" => Self::ApiKeyAndroidAppBlocked,
10774 "API_KEY_IOS_APP_BLOCKED" => Self::ApiKeyIosAppBlocked,
10775 "RATE_LIMIT_EXCEEDED" => Self::RateLimitExceeded,
10776 "RESOURCE_QUOTA_EXCEEDED" => Self::ResourceQuotaExceeded,
10777 "LOCATION_TAX_POLICY_VIOLATED" => Self::LocationTaxPolicyViolated,
10778 "USER_PROJECT_DENIED" => Self::UserProjectDenied,
10779 "CONSUMER_SUSPENDED" => Self::ConsumerSuspended,
10780 "CONSUMER_INVALID" => Self::ConsumerInvalid,
10781 "SECURITY_POLICY_VIOLATED" => Self::SecurityPolicyViolated,
10782 "ACCESS_TOKEN_EXPIRED" => Self::AccessTokenExpired,
10783 "ACCESS_TOKEN_SCOPE_INSUFFICIENT" => Self::AccessTokenScopeInsufficient,
10784 "ACCOUNT_STATE_INVALID" => Self::AccountStateInvalid,
10785 "ACCESS_TOKEN_TYPE_UNSUPPORTED" => Self::AccessTokenTypeUnsupported,
10786 "CREDENTIALS_MISSING" => Self::CredentialsMissing,
10787 "RESOURCE_PROJECT_INVALID" => Self::ResourceProjectInvalid,
10788 "SESSION_COOKIE_INVALID" => Self::SessionCookieInvalid,
10789 "USER_BLOCKED_BY_ADMIN" => Self::UserBlockedByAdmin,
10790 "RESOURCE_USAGE_RESTRICTION_VIOLATED" => Self::ResourceUsageRestrictionViolated,
10791 "SYSTEM_PARAMETER_UNSUPPORTED" => Self::SystemParameterUnsupported,
10792 "ORG_RESTRICTION_VIOLATION" => Self::OrgRestrictionViolation,
10793 "ORG_RESTRICTION_HEADER_INVALID" => Self::OrgRestrictionHeaderInvalid,
10794 "SERVICE_NOT_VISIBLE" => Self::ServiceNotVisible,
10795 "GCP_SUSPENDED" => Self::GcpSuspended,
10796 "LOCATION_POLICY_VIOLATED" => Self::LocationPolicyViolated,
10797 "MISSING_ORIGIN" => Self::MissingOrigin,
10798 "OVERLOADED_CREDENTIALS" => Self::OverloadedCredentials,
10799 _ => Self::UnknownValue(error_reason::UnknownValue(
10800 wkt::internal::UnknownEnumValue::String(value.to_string()),
10801 )),
10802 }
10803 }
10804}
10805
10806impl serde::ser::Serialize for ErrorReason {
10807 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10808 where
10809 S: serde::Serializer,
10810 {
10811 match self {
10812 Self::Unspecified => serializer.serialize_i32(0),
10813 Self::ServiceDisabled => serializer.serialize_i32(1),
10814 Self::BillingDisabled => serializer.serialize_i32(2),
10815 Self::ApiKeyInvalid => serializer.serialize_i32(3),
10816 Self::ApiKeyServiceBlocked => serializer.serialize_i32(4),
10817 Self::ApiKeyHttpReferrerBlocked => serializer.serialize_i32(7),
10818 Self::ApiKeyIpAddressBlocked => serializer.serialize_i32(8),
10819 Self::ApiKeyAndroidAppBlocked => serializer.serialize_i32(9),
10820 Self::ApiKeyIosAppBlocked => serializer.serialize_i32(13),
10821 Self::RateLimitExceeded => serializer.serialize_i32(5),
10822 Self::ResourceQuotaExceeded => serializer.serialize_i32(6),
10823 Self::LocationTaxPolicyViolated => serializer.serialize_i32(10),
10824 Self::UserProjectDenied => serializer.serialize_i32(11),
10825 Self::ConsumerSuspended => serializer.serialize_i32(12),
10826 Self::ConsumerInvalid => serializer.serialize_i32(14),
10827 Self::SecurityPolicyViolated => serializer.serialize_i32(15),
10828 Self::AccessTokenExpired => serializer.serialize_i32(16),
10829 Self::AccessTokenScopeInsufficient => serializer.serialize_i32(17),
10830 Self::AccountStateInvalid => serializer.serialize_i32(18),
10831 Self::AccessTokenTypeUnsupported => serializer.serialize_i32(19),
10832 Self::CredentialsMissing => serializer.serialize_i32(20),
10833 Self::ResourceProjectInvalid => serializer.serialize_i32(21),
10834 Self::SessionCookieInvalid => serializer.serialize_i32(23),
10835 Self::UserBlockedByAdmin => serializer.serialize_i32(24),
10836 Self::ResourceUsageRestrictionViolated => serializer.serialize_i32(25),
10837 Self::SystemParameterUnsupported => serializer.serialize_i32(26),
10838 Self::OrgRestrictionViolation => serializer.serialize_i32(27),
10839 Self::OrgRestrictionHeaderInvalid => serializer.serialize_i32(28),
10840 Self::ServiceNotVisible => serializer.serialize_i32(29),
10841 Self::GcpSuspended => serializer.serialize_i32(30),
10842 Self::LocationPolicyViolated => serializer.serialize_i32(31),
10843 Self::MissingOrigin => serializer.serialize_i32(33),
10844 Self::OverloadedCredentials => serializer.serialize_i32(34),
10845 Self::UnknownValue(u) => u.0.serialize(serializer),
10846 }
10847 }
10848}
10849
10850impl<'de> serde::de::Deserialize<'de> for ErrorReason {
10851 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10852 where
10853 D: serde::Deserializer<'de>,
10854 {
10855 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ErrorReason>::new(
10856 ".google.api.ErrorReason",
10857 ))
10858 }
10859}
10860
10861/// An indicator of the behavior of a given field (for example, that a field
10862/// is required in requests, or given as output but ignored as input).
10863/// This **does not** change the behavior in protocol buffers itself; it only
10864/// denotes the behavior and may affect how API tooling handles the field.
10865///
10866/// Note: This enum **may** receive new values in the future.
10867///
10868/// # Working with unknown values
10869///
10870/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10871/// additional enum variants at any time. Adding new variants is not considered
10872/// a breaking change. Applications should write their code in anticipation of:
10873///
10874/// - New values appearing in future releases of the client library, **and**
10875/// - New values received dynamically, without application changes.
10876///
10877/// Please consult the [Working with enums] section in the user guide for some
10878/// guidelines.
10879///
10880/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
10881#[derive(Clone, Debug, PartialEq)]
10882#[non_exhaustive]
10883pub enum FieldBehavior {
10884 /// Conventional default for enums. Do not use this.
10885 Unspecified,
10886 /// Specifically denotes a field as optional.
10887 /// While all fields in protocol buffers are optional, this may be specified
10888 /// for emphasis if appropriate.
10889 Optional,
10890 /// Denotes a field as required.
10891 /// This indicates that the field **must** be provided as part of the request,
10892 /// and failure to do so will cause an error (usually `INVALID_ARGUMENT`).
10893 Required,
10894 /// Denotes a field as output only.
10895 /// This indicates that the field is provided in responses, but including the
10896 /// field in a request does nothing (the server *must* ignore it and
10897 /// *must not* throw an error as a result of the field's presence).
10898 OutputOnly,
10899 /// Denotes a field as input only.
10900 /// This indicates that the field is provided in requests, and the
10901 /// corresponding field is not included in output.
10902 InputOnly,
10903 /// Denotes a field as immutable.
10904 /// This indicates that the field may be set once in a request to create a
10905 /// resource, but may not be changed thereafter.
10906 Immutable,
10907 /// Denotes that a (repeated) field is an unordered list.
10908 /// This indicates that the service may provide the elements of the list
10909 /// in any arbitrary order, rather than the order the user originally
10910 /// provided. Additionally, the list's order may or may not be stable.
10911 UnorderedList,
10912 /// Denotes that this field returns a non-empty default value if not set.
10913 /// This indicates that if the user provides the empty value in a request,
10914 /// a non-empty value will be returned. The user will not be aware of what
10915 /// non-empty value to expect.
10916 NonEmptyDefault,
10917 /// Denotes that the field in a resource (a message annotated with
10918 /// google.api.resource) is used in the resource name to uniquely identify the
10919 /// resource. For AIP-compliant APIs, this should only be applied to the
10920 /// `name` field on the resource.
10921 ///
10922 /// This behavior should not be applied to references to other resources within
10923 /// the message.
10924 ///
10925 /// The identifier field of resources often have different field behavior
10926 /// depending on the request it is embedded in (e.g. for Create methods name
10927 /// is optional and unused, while for Update methods it is required). Instead
10928 /// of method-specific annotations, only `IDENTIFIER` is required.
10929 Identifier,
10930 /// If set, the enum was initialized with an unknown value.
10931 ///
10932 /// Applications can examine the value using [FieldBehavior::value] or
10933 /// [FieldBehavior::name].
10934 UnknownValue(field_behavior::UnknownValue),
10935}
10936
10937#[doc(hidden)]
10938pub mod field_behavior {
10939 #[allow(unused_imports)]
10940 use super::*;
10941 #[derive(Clone, Debug, PartialEq)]
10942 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10943}
10944
10945impl FieldBehavior {
10946 /// Gets the enum value.
10947 ///
10948 /// Returns `None` if the enum contains an unknown value deserialized from
10949 /// the string representation of enums.
10950 pub fn value(&self) -> std::option::Option<i32> {
10951 match self {
10952 Self::Unspecified => std::option::Option::Some(0),
10953 Self::Optional => std::option::Option::Some(1),
10954 Self::Required => std::option::Option::Some(2),
10955 Self::OutputOnly => std::option::Option::Some(3),
10956 Self::InputOnly => std::option::Option::Some(4),
10957 Self::Immutable => std::option::Option::Some(5),
10958 Self::UnorderedList => std::option::Option::Some(6),
10959 Self::NonEmptyDefault => std::option::Option::Some(7),
10960 Self::Identifier => std::option::Option::Some(8),
10961 Self::UnknownValue(u) => u.0.value(),
10962 }
10963 }
10964
10965 /// Gets the enum value as a string.
10966 ///
10967 /// Returns `None` if the enum contains an unknown value deserialized from
10968 /// the integer representation of enums.
10969 pub fn name(&self) -> std::option::Option<&str> {
10970 match self {
10971 Self::Unspecified => std::option::Option::Some("FIELD_BEHAVIOR_UNSPECIFIED"),
10972 Self::Optional => std::option::Option::Some("OPTIONAL"),
10973 Self::Required => std::option::Option::Some("REQUIRED"),
10974 Self::OutputOnly => std::option::Option::Some("OUTPUT_ONLY"),
10975 Self::InputOnly => std::option::Option::Some("INPUT_ONLY"),
10976 Self::Immutable => std::option::Option::Some("IMMUTABLE"),
10977 Self::UnorderedList => std::option::Option::Some("UNORDERED_LIST"),
10978 Self::NonEmptyDefault => std::option::Option::Some("NON_EMPTY_DEFAULT"),
10979 Self::Identifier => std::option::Option::Some("IDENTIFIER"),
10980 Self::UnknownValue(u) => u.0.name(),
10981 }
10982 }
10983}
10984
10985impl std::default::Default for FieldBehavior {
10986 fn default() -> Self {
10987 use std::convert::From;
10988 Self::from(0)
10989 }
10990}
10991
10992impl std::fmt::Display for FieldBehavior {
10993 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10994 wkt::internal::display_enum(f, self.name(), self.value())
10995 }
10996}
10997
10998impl std::convert::From<i32> for FieldBehavior {
10999 fn from(value: i32) -> Self {
11000 match value {
11001 0 => Self::Unspecified,
11002 1 => Self::Optional,
11003 2 => Self::Required,
11004 3 => Self::OutputOnly,
11005 4 => Self::InputOnly,
11006 5 => Self::Immutable,
11007 6 => Self::UnorderedList,
11008 7 => Self::NonEmptyDefault,
11009 8 => Self::Identifier,
11010 _ => Self::UnknownValue(field_behavior::UnknownValue(
11011 wkt::internal::UnknownEnumValue::Integer(value),
11012 )),
11013 }
11014 }
11015}
11016
11017impl std::convert::From<&str> for FieldBehavior {
11018 fn from(value: &str) -> Self {
11019 use std::string::ToString;
11020 match value {
11021 "FIELD_BEHAVIOR_UNSPECIFIED" => Self::Unspecified,
11022 "OPTIONAL" => Self::Optional,
11023 "REQUIRED" => Self::Required,
11024 "OUTPUT_ONLY" => Self::OutputOnly,
11025 "INPUT_ONLY" => Self::InputOnly,
11026 "IMMUTABLE" => Self::Immutable,
11027 "UNORDERED_LIST" => Self::UnorderedList,
11028 "NON_EMPTY_DEFAULT" => Self::NonEmptyDefault,
11029 "IDENTIFIER" => Self::Identifier,
11030 _ => Self::UnknownValue(field_behavior::UnknownValue(
11031 wkt::internal::UnknownEnumValue::String(value.to_string()),
11032 )),
11033 }
11034 }
11035}
11036
11037impl serde::ser::Serialize for FieldBehavior {
11038 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11039 where
11040 S: serde::Serializer,
11041 {
11042 match self {
11043 Self::Unspecified => serializer.serialize_i32(0),
11044 Self::Optional => serializer.serialize_i32(1),
11045 Self::Required => serializer.serialize_i32(2),
11046 Self::OutputOnly => serializer.serialize_i32(3),
11047 Self::InputOnly => serializer.serialize_i32(4),
11048 Self::Immutable => serializer.serialize_i32(5),
11049 Self::UnorderedList => serializer.serialize_i32(6),
11050 Self::NonEmptyDefault => serializer.serialize_i32(7),
11051 Self::Identifier => serializer.serialize_i32(8),
11052 Self::UnknownValue(u) => u.0.serialize(serializer),
11053 }
11054 }
11055}
11056
11057impl<'de> serde::de::Deserialize<'de> for FieldBehavior {
11058 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11059 where
11060 D: serde::Deserializer<'de>,
11061 {
11062 deserializer.deserialize_any(wkt::internal::EnumVisitor::<FieldBehavior>::new(
11063 ".google.api.FieldBehavior",
11064 ))
11065 }
11066}
11067
11068/// The launch stage as defined by [Google Cloud Platform
11069/// Launch Stages](https://cloud.google.com/terms/launch-stages).
11070///
11071/// # Working with unknown values
11072///
11073/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11074/// additional enum variants at any time. Adding new variants is not considered
11075/// a breaking change. Applications should write their code in anticipation of:
11076///
11077/// - New values appearing in future releases of the client library, **and**
11078/// - New values received dynamically, without application changes.
11079///
11080/// Please consult the [Working with enums] section in the user guide for some
11081/// guidelines.
11082///
11083/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
11084#[derive(Clone, Debug, PartialEq)]
11085#[non_exhaustive]
11086pub enum LaunchStage {
11087 /// Do not use this default value.
11088 Unspecified,
11089 /// The feature is not yet implemented. Users can not use it.
11090 Unimplemented,
11091 /// Prelaunch features are hidden from users and are only visible internally.
11092 Prelaunch,
11093 /// Early Access features are limited to a closed group of testers. To use
11094 /// these features, you must sign up in advance and sign a Trusted Tester
11095 /// agreement (which includes confidentiality provisions). These features may
11096 /// be unstable, changed in backward-incompatible ways, and are not
11097 /// guaranteed to be released.
11098 EarlyAccess,
11099 /// Alpha is a limited availability test for releases before they are cleared
11100 /// for widespread use. By Alpha, all significant design issues are resolved
11101 /// and we are in the process of verifying functionality. Alpha customers
11102 /// need to apply for access, agree to applicable terms, and have their
11103 /// projects allowlisted. Alpha releases don't have to be feature complete,
11104 /// no SLAs are provided, and there are no technical support obligations, but
11105 /// they will be far enough along that customers can actually use them in
11106 /// test environments or for limited-use tests -- just like they would in
11107 /// normal production cases.
11108 Alpha,
11109 /// Beta is the point at which we are ready to open a release for any
11110 /// customer to use. There are no SLA or technical support obligations in a
11111 /// Beta release. Products will be complete from a feature perspective, but
11112 /// may have some open outstanding issues. Beta releases are suitable for
11113 /// limited production use cases.
11114 Beta,
11115 /// GA features are open to all developers and are considered stable and
11116 /// fully qualified for production use.
11117 Ga,
11118 /// Deprecated features are scheduled to be shut down and removed. For more
11119 /// information, see the "Deprecation Policy" section of our [Terms of
11120 /// Service](https://cloud.google.com/terms/)
11121 /// and the [Google Cloud Platform Subject to the Deprecation
11122 /// Policy](https://cloud.google.com/terms/deprecation) documentation.
11123 Deprecated,
11124 /// If set, the enum was initialized with an unknown value.
11125 ///
11126 /// Applications can examine the value using [LaunchStage::value] or
11127 /// [LaunchStage::name].
11128 UnknownValue(launch_stage::UnknownValue),
11129}
11130
11131#[doc(hidden)]
11132pub mod launch_stage {
11133 #[allow(unused_imports)]
11134 use super::*;
11135 #[derive(Clone, Debug, PartialEq)]
11136 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11137}
11138
11139impl LaunchStage {
11140 /// Gets the enum value.
11141 ///
11142 /// Returns `None` if the enum contains an unknown value deserialized from
11143 /// the string representation of enums.
11144 pub fn value(&self) -> std::option::Option<i32> {
11145 match self {
11146 Self::Unspecified => std::option::Option::Some(0),
11147 Self::Unimplemented => std::option::Option::Some(6),
11148 Self::Prelaunch => std::option::Option::Some(7),
11149 Self::EarlyAccess => std::option::Option::Some(1),
11150 Self::Alpha => std::option::Option::Some(2),
11151 Self::Beta => std::option::Option::Some(3),
11152 Self::Ga => std::option::Option::Some(4),
11153 Self::Deprecated => std::option::Option::Some(5),
11154 Self::UnknownValue(u) => u.0.value(),
11155 }
11156 }
11157
11158 /// Gets the enum value as a string.
11159 ///
11160 /// Returns `None` if the enum contains an unknown value deserialized from
11161 /// the integer representation of enums.
11162 pub fn name(&self) -> std::option::Option<&str> {
11163 match self {
11164 Self::Unspecified => std::option::Option::Some("LAUNCH_STAGE_UNSPECIFIED"),
11165 Self::Unimplemented => std::option::Option::Some("UNIMPLEMENTED"),
11166 Self::Prelaunch => std::option::Option::Some("PRELAUNCH"),
11167 Self::EarlyAccess => std::option::Option::Some("EARLY_ACCESS"),
11168 Self::Alpha => std::option::Option::Some("ALPHA"),
11169 Self::Beta => std::option::Option::Some("BETA"),
11170 Self::Ga => std::option::Option::Some("GA"),
11171 Self::Deprecated => std::option::Option::Some("DEPRECATED"),
11172 Self::UnknownValue(u) => u.0.name(),
11173 }
11174 }
11175}
11176
11177impl std::default::Default for LaunchStage {
11178 fn default() -> Self {
11179 use std::convert::From;
11180 Self::from(0)
11181 }
11182}
11183
11184impl std::fmt::Display for LaunchStage {
11185 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11186 wkt::internal::display_enum(f, self.name(), self.value())
11187 }
11188}
11189
11190impl std::convert::From<i32> for LaunchStage {
11191 fn from(value: i32) -> Self {
11192 match value {
11193 0 => Self::Unspecified,
11194 1 => Self::EarlyAccess,
11195 2 => Self::Alpha,
11196 3 => Self::Beta,
11197 4 => Self::Ga,
11198 5 => Self::Deprecated,
11199 6 => Self::Unimplemented,
11200 7 => Self::Prelaunch,
11201 _ => Self::UnknownValue(launch_stage::UnknownValue(
11202 wkt::internal::UnknownEnumValue::Integer(value),
11203 )),
11204 }
11205 }
11206}
11207
11208impl std::convert::From<&str> for LaunchStage {
11209 fn from(value: &str) -> Self {
11210 use std::string::ToString;
11211 match value {
11212 "LAUNCH_STAGE_UNSPECIFIED" => Self::Unspecified,
11213 "UNIMPLEMENTED" => Self::Unimplemented,
11214 "PRELAUNCH" => Self::Prelaunch,
11215 "EARLY_ACCESS" => Self::EarlyAccess,
11216 "ALPHA" => Self::Alpha,
11217 "BETA" => Self::Beta,
11218 "GA" => Self::Ga,
11219 "DEPRECATED" => Self::Deprecated,
11220 _ => Self::UnknownValue(launch_stage::UnknownValue(
11221 wkt::internal::UnknownEnumValue::String(value.to_string()),
11222 )),
11223 }
11224 }
11225}
11226
11227impl serde::ser::Serialize for LaunchStage {
11228 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11229 where
11230 S: serde::Serializer,
11231 {
11232 match self {
11233 Self::Unspecified => serializer.serialize_i32(0),
11234 Self::Unimplemented => serializer.serialize_i32(6),
11235 Self::Prelaunch => serializer.serialize_i32(7),
11236 Self::EarlyAccess => serializer.serialize_i32(1),
11237 Self::Alpha => serializer.serialize_i32(2),
11238 Self::Beta => serializer.serialize_i32(3),
11239 Self::Ga => serializer.serialize_i32(4),
11240 Self::Deprecated => serializer.serialize_i32(5),
11241 Self::UnknownValue(u) => u.0.serialize(serializer),
11242 }
11243 }
11244}
11245
11246impl<'de> serde::de::Deserialize<'de> for LaunchStage {
11247 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11248 where
11249 D: serde::Deserializer<'de>,
11250 {
11251 deserializer.deserialize_any(wkt::internal::EnumVisitor::<LaunchStage>::new(
11252 ".google.api.LaunchStage",
11253 ))
11254 }
11255}