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 pub allow_without_credential: bool,
130
131 /// Requirements for additional authentication providers.
132 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
133 pub requirements: std::vec::Vec<crate::model::AuthRequirement>,
134
135 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
136 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
137}
138
139impl AuthenticationRule {
140 pub fn new() -> Self {
141 std::default::Default::default()
142 }
143
144 /// Sets the value of [selector][crate::model::AuthenticationRule::selector].
145 pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
146 self.selector = v.into();
147 self
148 }
149
150 /// Sets the value of [oauth][crate::model::AuthenticationRule::oauth].
151 pub fn set_oauth<
152 T: std::convert::Into<std::option::Option<crate::model::OAuthRequirements>>,
153 >(
154 mut self,
155 v: T,
156 ) -> Self {
157 self.oauth = v.into();
158 self
159 }
160
161 /// Sets the value of [allow_without_credential][crate::model::AuthenticationRule::allow_without_credential].
162 pub fn set_allow_without_credential<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
163 self.allow_without_credential = v.into();
164 self
165 }
166
167 /// Sets the value of [requirements][crate::model::AuthenticationRule::requirements].
168 pub fn set_requirements<T, V>(mut self, v: T) -> Self
169 where
170 T: std::iter::IntoIterator<Item = V>,
171 V: std::convert::Into<crate::model::AuthRequirement>,
172 {
173 use std::iter::Iterator;
174 self.requirements = v.into_iter().map(|i| i.into()).collect();
175 self
176 }
177}
178
179impl wkt::message::Message for AuthenticationRule {
180 fn typename() -> &'static str {
181 "type.googleapis.com/google.api.AuthenticationRule"
182 }
183}
184
185/// Specifies a location to extract JWT from an API request.
186#[serde_with::serde_as]
187#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
188#[serde(default, rename_all = "camelCase")]
189#[non_exhaustive]
190pub struct JwtLocation {
191 /// The value prefix. The value format is "value_prefix{token}"
192 /// Only applies to "in" header type. Must be empty for "in" query type.
193 /// If not empty, the header value has to match (case sensitive) this prefix.
194 /// If not matched, JWT will not be extracted. If matched, JWT will be
195 /// extracted after the prefix is removed.
196 ///
197 /// For example, for "Authorization: Bearer {JWT}",
198 /// value_prefix="Bearer " with a space at the end.
199 #[serde(skip_serializing_if = "std::string::String::is_empty")]
200 pub value_prefix: std::string::String,
201
202 #[serde(flatten, skip_serializing_if = "std::option::Option::is_none")]
203 pub r#in: std::option::Option<crate::model::jwt_location::In>,
204
205 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
206 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
207}
208
209impl JwtLocation {
210 pub fn new() -> Self {
211 std::default::Default::default()
212 }
213
214 /// Sets the value of [value_prefix][crate::model::JwtLocation::value_prefix].
215 pub fn set_value_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
216 self.value_prefix = v.into();
217 self
218 }
219
220 /// Sets the value of [r#in][crate::model::JwtLocation::in].
221 ///
222 /// Note that all the setters affecting `r#in` are mutually
223 /// exclusive.
224 pub fn set_in<T: std::convert::Into<std::option::Option<crate::model::jwt_location::In>>>(
225 mut self,
226 v: T,
227 ) -> Self {
228 self.r#in = v.into();
229 self
230 }
231
232 /// The value of [r#in][crate::model::JwtLocation::r#in]
233 /// if it holds a `Header`, `None` if the field is not set or
234 /// holds a different branch.
235 pub fn header(&self) -> std::option::Option<&std::string::String> {
236 #[allow(unreachable_patterns)]
237 self.r#in.as_ref().and_then(|v| match v {
238 crate::model::jwt_location::In::Header(v) => std::option::Option::Some(v),
239 _ => std::option::Option::None,
240 })
241 }
242
243 /// The value of [r#in][crate::model::JwtLocation::r#in]
244 /// if it holds a `Query`, `None` if the field is not set or
245 /// holds a different branch.
246 pub fn query(&self) -> std::option::Option<&std::string::String> {
247 #[allow(unreachable_patterns)]
248 self.r#in.as_ref().and_then(|v| match v {
249 crate::model::jwt_location::In::Query(v) => std::option::Option::Some(v),
250 _ => std::option::Option::None,
251 })
252 }
253
254 /// The value of [r#in][crate::model::JwtLocation::r#in]
255 /// if it holds a `Cookie`, `None` if the field is not set or
256 /// holds a different branch.
257 pub fn cookie(&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::Cookie(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 `Header`.
267 ///
268 /// Note that all the setters affecting `r#in` are
269 /// mutually exclusive.
270 pub fn set_header<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::Header(v.into()));
272 self
273 }
274
275 /// Sets the value of [r#in][crate::model::JwtLocation::r#in]
276 /// to hold a `Query`.
277 ///
278 /// Note that all the setters affecting `r#in` are
279 /// mutually exclusive.
280 pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
281 self.r#in = std::option::Option::Some(crate::model::jwt_location::In::Query(v.into()));
282 self
283 }
284
285 /// Sets the value of [r#in][crate::model::JwtLocation::r#in]
286 /// to hold a `Cookie`.
287 ///
288 /// Note that all the setters affecting `r#in` are
289 /// mutually exclusive.
290 pub fn set_cookie<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
291 self.r#in = std::option::Option::Some(crate::model::jwt_location::In::Cookie(v.into()));
292 self
293 }
294}
295
296impl wkt::message::Message for JwtLocation {
297 fn typename() -> &'static str {
298 "type.googleapis.com/google.api.JwtLocation"
299 }
300}
301
302/// Defines additional types related to [JwtLocation].
303pub mod jwt_location {
304 #[allow(unused_imports)]
305 use super::*;
306
307 #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
308 #[serde(rename_all = "camelCase")]
309 #[non_exhaustive]
310 pub enum In {
311 /// Specifies HTTP header name to extract JWT token.
312 Header(std::string::String),
313 /// Specifies URL query parameter name to extract JWT token.
314 Query(std::string::String),
315 /// Specifies cookie name to extract JWT token.
316 Cookie(std::string::String),
317 }
318}
319
320/// Configuration for an authentication provider, including support for
321/// [JSON Web Token
322/// (JWT)](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32).
323#[serde_with::serde_as]
324#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
325#[serde(default, rename_all = "camelCase")]
326#[non_exhaustive]
327pub struct AuthProvider {
328 /// The unique identifier of the auth provider. It will be referred to by
329 /// `AuthRequirement.provider_id`.
330 ///
331 /// Example: "bookstore_auth".
332 #[serde(skip_serializing_if = "std::string::String::is_empty")]
333 pub id: std::string::String,
334
335 /// Identifies the principal that issued the JWT. See
336 /// <https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.1>
337 /// Usually a URL or an email address.
338 ///
339 /// Example: <https://securetoken.google.com>
340 /// Example: 1234567-compute@developer.gserviceaccount.com
341 #[serde(skip_serializing_if = "std::string::String::is_empty")]
342 pub issuer: std::string::String,
343
344 /// URL of the provider's public key set to validate signature of the JWT. See
345 /// [OpenID
346 /// Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata).
347 /// Optional if the key set document:
348 ///
349 /// - can be retrieved from
350 /// [OpenID
351 /// Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html)
352 /// of the issuer.
353 /// - can be inferred from the email domain of the issuer (e.g. a Google
354 /// service account).
355 ///
356 /// Example: <https://www.googleapis.com/oauth2/v1/certs>
357 #[serde(skip_serializing_if = "std::string::String::is_empty")]
358 pub jwks_uri: std::string::String,
359
360 /// The list of JWT
361 /// [audiences](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.3).
362 /// that are allowed to access. A JWT containing any of these audiences will
363 /// be accepted. When this setting is absent, JWTs with audiences:
364 ///
365 /// - "https://[service.name]/[google.protobuf.Api.name]"
366 /// - "https://[service.name]/"
367 /// will be accepted.
368 /// For example, if no audiences are in the setting, LibraryService API will
369 /// accept JWTs with the following audiences:
370 ///
371 /// <https://library-example.googleapis.com/google.example.library.v1.LibraryService>
372 ///
373 /// - <https://library-example.googleapis.com/>
374 ///
375 /// Example:
376 ///
377 /// ```norust
378 /// audiences: bookstore_android.apps.googleusercontent.com,
379 /// bookstore_web.apps.googleusercontent.com
380 /// ```
381 #[serde(skip_serializing_if = "std::string::String::is_empty")]
382 pub audiences: std::string::String,
383
384 /// Redirect URL if JWT token is required but not present or is expired.
385 /// Implement authorizationUrl of securityDefinitions in OpenAPI spec.
386 #[serde(skip_serializing_if = "std::string::String::is_empty")]
387 pub authorization_url: std::string::String,
388
389 /// Defines the locations to extract the JWT. For now it is only used by the
390 /// Cloud Endpoints to store the OpenAPI extension [x-google-jwt-locations]
391 /// (<https://cloud.google.com/endpoints/docs/openapi/openapi-extensions#x-google-jwt-locations>)
392 ///
393 /// JWT locations can be one of HTTP headers, URL query parameters or
394 /// cookies. The rule is that the first match wins.
395 ///
396 /// If not specified, default to use following 3 locations:
397 ///
398 /// ) Authorization: Bearer
399 /// ) x-goog-iap-jwt-assertion
400 /// ) access_token query parameter
401 ///
402 /// Default locations can be specified as followings:
403 /// jwt_locations:
404 ///
405 /// - header: Authorization
406 /// value_prefix: "Bearer "
407 /// - header: x-goog-iap-jwt-assertion
408 /// - query: access_token
409 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
410 pub jwt_locations: std::vec::Vec<crate::model::JwtLocation>,
411
412 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
413 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
414}
415
416impl AuthProvider {
417 pub fn new() -> Self {
418 std::default::Default::default()
419 }
420
421 /// Sets the value of [id][crate::model::AuthProvider::id].
422 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
423 self.id = v.into();
424 self
425 }
426
427 /// Sets the value of [issuer][crate::model::AuthProvider::issuer].
428 pub fn set_issuer<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
429 self.issuer = v.into();
430 self
431 }
432
433 /// Sets the value of [jwks_uri][crate::model::AuthProvider::jwks_uri].
434 pub fn set_jwks_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
435 self.jwks_uri = v.into();
436 self
437 }
438
439 /// Sets the value of [audiences][crate::model::AuthProvider::audiences].
440 pub fn set_audiences<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
441 self.audiences = v.into();
442 self
443 }
444
445 /// Sets the value of [authorization_url][crate::model::AuthProvider::authorization_url].
446 pub fn set_authorization_url<T: std::convert::Into<std::string::String>>(
447 mut self,
448 v: T,
449 ) -> Self {
450 self.authorization_url = v.into();
451 self
452 }
453
454 /// Sets the value of [jwt_locations][crate::model::AuthProvider::jwt_locations].
455 pub fn set_jwt_locations<T, V>(mut self, v: T) -> Self
456 where
457 T: std::iter::IntoIterator<Item = V>,
458 V: std::convert::Into<crate::model::JwtLocation>,
459 {
460 use std::iter::Iterator;
461 self.jwt_locations = v.into_iter().map(|i| i.into()).collect();
462 self
463 }
464}
465
466impl wkt::message::Message for AuthProvider {
467 fn typename() -> &'static str {
468 "type.googleapis.com/google.api.AuthProvider"
469 }
470}
471
472/// OAuth scopes are a way to define data and permissions on data. For example,
473/// there are scopes defined for "Read-only access to Google Calendar" and
474/// "Access to Cloud Platform". Users can consent to a scope for an application,
475/// giving it permission to access that data on their behalf.
476///
477/// OAuth scope specifications should be fairly coarse grained; a user will need
478/// to see and understand the text description of what your scope means.
479///
480/// In most cases: use one or at most two OAuth scopes for an entire family of
481/// products. If your product has multiple APIs, you should probably be sharing
482/// the OAuth scope across all of those APIs.
483///
484/// When you need finer grained OAuth consent screens: talk with your product
485/// management about how developers will use them in practice.
486///
487/// Please note that even though each of the canonical scopes is enough for a
488/// request to be accepted and passed to the backend, a request can still fail
489/// due to the backend requiring additional scopes or permissions.
490#[serde_with::serde_as]
491#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
492#[serde(default, rename_all = "camelCase")]
493#[non_exhaustive]
494pub struct OAuthRequirements {
495 /// The list of publicly documented OAuth scopes that are allowed access. An
496 /// OAuth token containing any of these scopes will be accepted.
497 ///
498 /// Example:
499 ///
500 /// ```norust
501 /// canonical_scopes: https://www.googleapis.com/auth/calendar,
502 /// https://www.googleapis.com/auth/calendar.read
503 /// ```
504 #[serde(skip_serializing_if = "std::string::String::is_empty")]
505 pub canonical_scopes: std::string::String,
506
507 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
508 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
509}
510
511impl OAuthRequirements {
512 pub fn new() -> Self {
513 std::default::Default::default()
514 }
515
516 /// Sets the value of [canonical_scopes][crate::model::OAuthRequirements::canonical_scopes].
517 pub fn set_canonical_scopes<T: std::convert::Into<std::string::String>>(
518 mut self,
519 v: T,
520 ) -> Self {
521 self.canonical_scopes = v.into();
522 self
523 }
524}
525
526impl wkt::message::Message for OAuthRequirements {
527 fn typename() -> &'static str {
528 "type.googleapis.com/google.api.OAuthRequirements"
529 }
530}
531
532/// User-defined authentication requirements, including support for
533/// [JSON Web Token
534/// (JWT)](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32).
535#[serde_with::serde_as]
536#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
537#[serde(default, rename_all = "camelCase")]
538#[non_exhaustive]
539pub struct AuthRequirement {
540 /// [id][google.api.AuthProvider.id] from authentication provider.
541 ///
542 /// Example:
543 ///
544 /// ```norust
545 /// provider_id: bookstore_auth
546 /// ```
547 ///
548 /// [google.api.AuthProvider.id]: crate::model::AuthProvider::id
549 #[serde(skip_serializing_if = "std::string::String::is_empty")]
550 pub provider_id: std::string::String,
551
552 /// NOTE: This will be deprecated soon, once AuthProvider.audiences is
553 /// implemented and accepted in all the runtime components.
554 ///
555 /// The list of JWT
556 /// [audiences](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.3).
557 /// that are allowed to access. A JWT containing any of these audiences will
558 /// be accepted. When this setting is absent, only JWTs with audience
559 /// "https://[Service_name][google.api.Service.name]/[API_name][google.protobuf.Api.name]"
560 /// will be accepted. For example, if no audiences are in the setting,
561 /// LibraryService API will only accept JWTs with the following audience
562 /// `https://library-example.googleapis.com/google.example.library.v1.LibraryService`.
563 ///
564 /// Example:
565 ///
566 /// ```norust
567 /// audiences: bookstore_android.apps.googleusercontent.com,
568 /// bookstore_web.apps.googleusercontent.com
569 /// ```
570 ///
571 /// [google.api.Service.name]: crate::model::Service::name
572 /// [google.protobuf.Api.name]: wkt::Api::name
573 #[serde(skip_serializing_if = "std::string::String::is_empty")]
574 pub audiences: std::string::String,
575
576 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
577 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
578}
579
580impl AuthRequirement {
581 pub fn new() -> Self {
582 std::default::Default::default()
583 }
584
585 /// Sets the value of [provider_id][crate::model::AuthRequirement::provider_id].
586 pub fn set_provider_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
587 self.provider_id = v.into();
588 self
589 }
590
591 /// Sets the value of [audiences][crate::model::AuthRequirement::audiences].
592 pub fn set_audiences<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
593 self.audiences = v.into();
594 self
595 }
596}
597
598impl wkt::message::Message for AuthRequirement {
599 fn typename() -> &'static str {
600 "type.googleapis.com/google.api.AuthRequirement"
601 }
602}
603
604/// `Backend` defines the backend configuration for a service.
605#[serde_with::serde_as]
606#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
607#[serde(default, rename_all = "camelCase")]
608#[non_exhaustive]
609pub struct Backend {
610 /// A list of API backend rules that apply to individual API methods.
611 ///
612 /// **NOTE:** All service configuration rules follow "last one wins" order.
613 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
614 pub rules: std::vec::Vec<crate::model::BackendRule>,
615
616 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
617 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
618}
619
620impl Backend {
621 pub fn new() -> Self {
622 std::default::Default::default()
623 }
624
625 /// Sets the value of [rules][crate::model::Backend::rules].
626 pub fn set_rules<T, V>(mut self, v: T) -> Self
627 where
628 T: std::iter::IntoIterator<Item = V>,
629 V: std::convert::Into<crate::model::BackendRule>,
630 {
631 use std::iter::Iterator;
632 self.rules = v.into_iter().map(|i| i.into()).collect();
633 self
634 }
635}
636
637impl wkt::message::Message for Backend {
638 fn typename() -> &'static str {
639 "type.googleapis.com/google.api.Backend"
640 }
641}
642
643/// A backend rule provides configuration for an individual API element.
644#[serde_with::serde_as]
645#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
646#[serde(default, rename_all = "camelCase")]
647#[non_exhaustive]
648pub struct BackendRule {
649 /// Selects the methods to which this rule applies.
650 ///
651 /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
652 /// details.
653 ///
654 /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
655 #[serde(skip_serializing_if = "std::string::String::is_empty")]
656 pub selector: std::string::String,
657
658 /// The address of the API backend.
659 ///
660 /// The scheme is used to determine the backend protocol and security.
661 /// The following schemes are accepted:
662 ///
663 /// SCHEME PROTOCOL SECURITY
664 /// http:// HTTP None
665 /// https:// HTTP TLS
666 /// grpc:// gRPC None
667 /// grpcs:// gRPC TLS
668 ///
669 /// It is recommended to explicitly include a scheme. Leaving out the scheme
670 /// may cause constrasting behaviors across platforms.
671 ///
672 /// If the port is unspecified, the default is:
673 ///
674 /// - 80 for schemes without TLS
675 /// - 443 for schemes with TLS
676 ///
677 /// For HTTP backends, use [protocol][google.api.BackendRule.protocol]
678 /// to specify the protocol version.
679 ///
680 /// [google.api.BackendRule.protocol]: crate::model::BackendRule::protocol
681 #[serde(skip_serializing_if = "std::string::String::is_empty")]
682 pub address: std::string::String,
683
684 /// The number of seconds to wait for a response from a request. The default
685 /// varies based on the request protocol and deployment environment.
686 pub deadline: f64,
687
688 /// Deprecated, do not use.
689 pub min_deadline: f64,
690
691 /// The number of seconds to wait for the completion of a long running
692 /// operation. The default is no deadline.
693 pub operation_deadline: f64,
694
695 pub path_translation: crate::model::backend_rule::PathTranslation,
696
697 /// The protocol used for sending a request to the backend.
698 /// The supported values are "http/1.1" and "h2".
699 ///
700 /// The default value is inferred from the scheme in the
701 /// [address][google.api.BackendRule.address] field:
702 ///
703 /// SCHEME PROTOCOL
704 /// http:// http/1.1
705 /// https:// http/1.1
706 /// grpc:// h2
707 /// grpcs:// h2
708 ///
709 /// For secure HTTP backends (https://) that support HTTP/2, set this field
710 /// to "h2" for improved performance.
711 ///
712 /// Configuring this field to non-default values is only supported for secure
713 /// HTTP backends. This field will be ignored for all other backends.
714 ///
715 /// See
716 /// <https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml#alpn-protocol-ids>
717 /// for more details on the supported values.
718 ///
719 /// [google.api.BackendRule.address]: crate::model::BackendRule::address
720 #[serde(skip_serializing_if = "std::string::String::is_empty")]
721 pub protocol: std::string::String,
722
723 /// The map between request protocol and the backend address.
724 #[serde(skip_serializing_if = "std::collections::HashMap::is_empty")]
725 pub overrides_by_request_protocol:
726 std::collections::HashMap<std::string::String, crate::model::BackendRule>,
727
728 /// Authentication settings used by the backend.
729 ///
730 /// These are typically used to provide service management functionality to
731 /// a backend served on a publicly-routable URL. The `authentication`
732 /// details should match the authentication behavior used by the backend.
733 ///
734 /// For example, specifying `jwt_audience` implies that the backend expects
735 /// authentication via a JWT.
736 ///
737 /// When authentication is unspecified, the resulting behavior is the same
738 /// as `disable_auth` set to `true`.
739 ///
740 /// Refer to <https://developers.google.com/identity/protocols/OpenIDConnect> for
741 /// JWT ID token.
742 #[serde(flatten, skip_serializing_if = "std::option::Option::is_none")]
743 pub authentication: std::option::Option<crate::model::backend_rule::Authentication>,
744
745 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
746 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
747}
748
749impl BackendRule {
750 pub fn new() -> Self {
751 std::default::Default::default()
752 }
753
754 /// Sets the value of [selector][crate::model::BackendRule::selector].
755 pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
756 self.selector = v.into();
757 self
758 }
759
760 /// Sets the value of [address][crate::model::BackendRule::address].
761 pub fn set_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
762 self.address = v.into();
763 self
764 }
765
766 /// Sets the value of [deadline][crate::model::BackendRule::deadline].
767 pub fn set_deadline<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
768 self.deadline = v.into();
769 self
770 }
771
772 /// Sets the value of [min_deadline][crate::model::BackendRule::min_deadline].
773 pub fn set_min_deadline<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
774 self.min_deadline = v.into();
775 self
776 }
777
778 /// Sets the value of [operation_deadline][crate::model::BackendRule::operation_deadline].
779 pub fn set_operation_deadline<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
780 self.operation_deadline = v.into();
781 self
782 }
783
784 /// Sets the value of [path_translation][crate::model::BackendRule::path_translation].
785 pub fn set_path_translation<
786 T: std::convert::Into<crate::model::backend_rule::PathTranslation>,
787 >(
788 mut self,
789 v: T,
790 ) -> Self {
791 self.path_translation = v.into();
792 self
793 }
794
795 /// Sets the value of [protocol][crate::model::BackendRule::protocol].
796 pub fn set_protocol<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
797 self.protocol = v.into();
798 self
799 }
800
801 /// Sets the value of [overrides_by_request_protocol][crate::model::BackendRule::overrides_by_request_protocol].
802 pub fn set_overrides_by_request_protocol<T, K, V>(mut self, v: T) -> Self
803 where
804 T: std::iter::IntoIterator<Item = (K, V)>,
805 K: std::convert::Into<std::string::String>,
806 V: std::convert::Into<crate::model::BackendRule>,
807 {
808 use std::iter::Iterator;
809 self.overrides_by_request_protocol =
810 v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
811 self
812 }
813
814 /// Sets the value of [authentication][crate::model::BackendRule::authentication].
815 ///
816 /// Note that all the setters affecting `authentication` are mutually
817 /// exclusive.
818 pub fn set_authentication<
819 T: std::convert::Into<std::option::Option<crate::model::backend_rule::Authentication>>,
820 >(
821 mut self,
822 v: T,
823 ) -> Self {
824 self.authentication = v.into();
825 self
826 }
827
828 /// The value of [authentication][crate::model::BackendRule::authentication]
829 /// if it holds a `JwtAudience`, `None` if the field is not set or
830 /// holds a different branch.
831 pub fn jwt_audience(&self) -> std::option::Option<&std::string::String> {
832 #[allow(unreachable_patterns)]
833 self.authentication.as_ref().and_then(|v| match v {
834 crate::model::backend_rule::Authentication::JwtAudience(v) => {
835 std::option::Option::Some(v)
836 }
837 _ => std::option::Option::None,
838 })
839 }
840
841 /// The value of [authentication][crate::model::BackendRule::authentication]
842 /// if it holds a `DisableAuth`, `None` if the field is not set or
843 /// holds a different branch.
844 pub fn disable_auth(&self) -> std::option::Option<&bool> {
845 #[allow(unreachable_patterns)]
846 self.authentication.as_ref().and_then(|v| match v {
847 crate::model::backend_rule::Authentication::DisableAuth(v) => {
848 std::option::Option::Some(v)
849 }
850 _ => std::option::Option::None,
851 })
852 }
853
854 /// Sets the value of [authentication][crate::model::BackendRule::authentication]
855 /// to hold a `JwtAudience`.
856 ///
857 /// Note that all the setters affecting `authentication` are
858 /// mutually exclusive.
859 pub fn set_jwt_audience<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
860 self.authentication = std::option::Option::Some(
861 crate::model::backend_rule::Authentication::JwtAudience(v.into()),
862 );
863 self
864 }
865
866 /// Sets the value of [authentication][crate::model::BackendRule::authentication]
867 /// to hold a `DisableAuth`.
868 ///
869 /// Note that all the setters affecting `authentication` are
870 /// mutually exclusive.
871 pub fn set_disable_auth<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
872 self.authentication = std::option::Option::Some(
873 crate::model::backend_rule::Authentication::DisableAuth(v.into()),
874 );
875 self
876 }
877}
878
879impl wkt::message::Message for BackendRule {
880 fn typename() -> &'static str {
881 "type.googleapis.com/google.api.BackendRule"
882 }
883}
884
885/// Defines additional types related to [BackendRule].
886pub mod backend_rule {
887 #[allow(unused_imports)]
888 use super::*;
889
890 /// Path Translation specifies how to combine the backend address with the
891 /// request path in order to produce the appropriate forwarding URL for the
892 /// request.
893 ///
894 /// Path Translation is applicable only to HTTP-based backends. Backends which
895 /// do not accept requests over HTTP/HTTPS should leave `path_translation`
896 /// unspecified.
897 #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
898 pub struct PathTranslation(i32);
899
900 impl PathTranslation {
901 pub const PATH_TRANSLATION_UNSPECIFIED: PathTranslation = PathTranslation::new(0);
902
903 /// Use the backend address as-is, with no modification to the path. If the
904 /// URL pattern contains variables, the variable names and values will be
905 /// appended to the query string. If a query string parameter and a URL
906 /// pattern variable have the same name, this may result in duplicate keys in
907 /// the query string.
908 ///
909 /// # Examples
910 ///
911 /// Given the following operation config:
912 ///
913 /// ```norust
914 /// Method path: /api/company/{cid}/user/{uid}
915 /// Backend address: https://example.cloudfunctions.net/getUser
916 /// ```
917 ///
918 /// Requests to the following request paths will call the backend at the
919 /// translated path:
920 ///
921 /// ```norust
922 /// Request path: /api/company/widgetworks/user/johndoe
923 /// Translated:
924 /// https://example.cloudfunctions.net/getUser?cid=widgetworks&uid=johndoe
925 ///
926 /// Request path: /api/company/widgetworks/user/johndoe?timezone=EST
927 /// Translated:
928 /// https://example.cloudfunctions.net/getUser?timezone=EST&cid=widgetworks&uid=johndoe
929 /// ```
930 pub const CONSTANT_ADDRESS: PathTranslation = PathTranslation::new(1);
931
932 /// The request path will be appended to the backend address.
933 ///
934 /// # Examples
935 ///
936 /// Given the following operation config:
937 ///
938 /// ```norust
939 /// Method path: /api/company/{cid}/user/{uid}
940 /// Backend address: https://example.appspot.com
941 /// ```
942 ///
943 /// Requests to the following request paths will call the backend at the
944 /// translated path:
945 ///
946 /// ```norust
947 /// Request path: /api/company/widgetworks/user/johndoe
948 /// Translated:
949 /// https://example.appspot.com/api/company/widgetworks/user/johndoe
950 ///
951 /// Request path: /api/company/widgetworks/user/johndoe?timezone=EST
952 /// Translated:
953 /// https://example.appspot.com/api/company/widgetworks/user/johndoe?timezone=EST
954 /// ```
955 pub const APPEND_PATH_TO_ADDRESS: PathTranslation = PathTranslation::new(2);
956
957 /// Creates a new PathTranslation instance.
958 pub(crate) const fn new(value: i32) -> Self {
959 Self(value)
960 }
961
962 /// Gets the enum value.
963 pub fn value(&self) -> i32 {
964 self.0
965 }
966
967 /// Gets the enum value as a string.
968 pub fn as_str_name(&self) -> std::borrow::Cow<'static, str> {
969 match self.0 {
970 0 => std::borrow::Cow::Borrowed("PATH_TRANSLATION_UNSPECIFIED"),
971 1 => std::borrow::Cow::Borrowed("CONSTANT_ADDRESS"),
972 2 => std::borrow::Cow::Borrowed("APPEND_PATH_TO_ADDRESS"),
973 _ => std::borrow::Cow::Owned(std::format!("UNKNOWN-VALUE:{}", self.0)),
974 }
975 }
976
977 /// Creates an enum value from the value name.
978 pub fn from_str_name(name: &str) -> std::option::Option<Self> {
979 match name {
980 "PATH_TRANSLATION_UNSPECIFIED" => {
981 std::option::Option::Some(Self::PATH_TRANSLATION_UNSPECIFIED)
982 }
983 "CONSTANT_ADDRESS" => std::option::Option::Some(Self::CONSTANT_ADDRESS),
984 "APPEND_PATH_TO_ADDRESS" => std::option::Option::Some(Self::APPEND_PATH_TO_ADDRESS),
985 _ => std::option::Option::None,
986 }
987 }
988 }
989
990 impl std::convert::From<i32> for PathTranslation {
991 fn from(value: i32) -> Self {
992 Self::new(value)
993 }
994 }
995
996 impl std::default::Default for PathTranslation {
997 fn default() -> Self {
998 Self::new(0)
999 }
1000 }
1001
1002 /// Authentication settings used by the backend.
1003 ///
1004 /// These are typically used to provide service management functionality to
1005 /// a backend served on a publicly-routable URL. The `authentication`
1006 /// details should match the authentication behavior used by the backend.
1007 ///
1008 /// For example, specifying `jwt_audience` implies that the backend expects
1009 /// authentication via a JWT.
1010 ///
1011 /// When authentication is unspecified, the resulting behavior is the same
1012 /// as `disable_auth` set to `true`.
1013 ///
1014 /// Refer to <https://developers.google.com/identity/protocols/OpenIDConnect> for
1015 /// JWT ID token.
1016 #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
1017 #[serde(rename_all = "camelCase")]
1018 #[non_exhaustive]
1019 pub enum Authentication {
1020 /// The JWT audience is used when generating a JWT ID token for the backend.
1021 /// This ID token will be added in the HTTP "authorization" header, and sent
1022 /// to the backend.
1023 JwtAudience(std::string::String),
1024 /// When disable_auth is true, a JWT ID token won't be generated and the
1025 /// original "Authorization" HTTP header will be preserved. If the header is
1026 /// used to carry the original token and is expected by the backend, this
1027 /// field must be set to true to preserve the header.
1028 DisableAuth(bool),
1029 }
1030}
1031
1032/// Billing related configuration of the service.
1033///
1034/// The following example shows how to configure monitored resources and metrics
1035/// for billing, `consumer_destinations` is the only supported destination and
1036/// the monitored resources need at least one label key
1037/// `cloud.googleapis.com/location` to indicate the location of the billing
1038/// usage, using different monitored resources between monitoring and billing is
1039/// recommended so they can be evolved independently:
1040///
1041/// ```norust
1042/// monitored_resources:
1043/// - type: library.googleapis.com/billing_branch
1044/// labels:
1045/// - key: cloud.googleapis.com/location
1046/// description: |
1047/// Predefined label to support billing location restriction.
1048/// - key: city
1049/// description: |
1050/// Custom label to define the city where the library branch is located
1051/// in.
1052/// - key: name
1053/// description: Custom label to define the name of the library branch.
1054/// metrics:
1055/// - name: library.googleapis.com/book/borrowed_count
1056/// metric_kind: DELTA
1057/// value_type: INT64
1058/// unit: "1"
1059/// billing:
1060/// consumer_destinations:
1061/// - monitored_resource: library.googleapis.com/billing_branch
1062/// metrics:
1063/// - library.googleapis.com/book/borrowed_count
1064/// ```
1065#[serde_with::serde_as]
1066#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
1067#[serde(default, rename_all = "camelCase")]
1068#[non_exhaustive]
1069pub struct Billing {
1070 /// Billing configurations for sending metrics to the consumer project.
1071 /// There can be multiple consumer destinations per service, each one must have
1072 /// a different monitored resource type. A metric can be used in at most
1073 /// one consumer destination.
1074 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
1075 pub consumer_destinations: std::vec::Vec<crate::model::billing::BillingDestination>,
1076
1077 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1078 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1079}
1080
1081impl Billing {
1082 pub fn new() -> Self {
1083 std::default::Default::default()
1084 }
1085
1086 /// Sets the value of [consumer_destinations][crate::model::Billing::consumer_destinations].
1087 pub fn set_consumer_destinations<T, V>(mut self, v: T) -> Self
1088 where
1089 T: std::iter::IntoIterator<Item = V>,
1090 V: std::convert::Into<crate::model::billing::BillingDestination>,
1091 {
1092 use std::iter::Iterator;
1093 self.consumer_destinations = v.into_iter().map(|i| i.into()).collect();
1094 self
1095 }
1096}
1097
1098impl wkt::message::Message for Billing {
1099 fn typename() -> &'static str {
1100 "type.googleapis.com/google.api.Billing"
1101 }
1102}
1103
1104/// Defines additional types related to [Billing].
1105pub mod billing {
1106 #[allow(unused_imports)]
1107 use super::*;
1108
1109 /// Configuration of a specific billing destination (Currently only support
1110 /// bill against consumer project).
1111 #[serde_with::serde_as]
1112 #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
1113 #[serde(default, rename_all = "camelCase")]
1114 #[non_exhaustive]
1115 pub struct BillingDestination {
1116 /// The monitored resource type. The type must be defined in
1117 /// [Service.monitored_resources][google.api.Service.monitored_resources]
1118 /// section.
1119 ///
1120 /// [google.api.Service.monitored_resources]: crate::model::Service::monitored_resources
1121 #[serde(skip_serializing_if = "std::string::String::is_empty")]
1122 pub monitored_resource: std::string::String,
1123
1124 /// Names of the metrics to report to this billing destination.
1125 /// Each name must be defined in
1126 /// [Service.metrics][google.api.Service.metrics] section.
1127 ///
1128 /// [google.api.Service.metrics]: crate::model::Service::metrics
1129 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
1130 pub metrics: std::vec::Vec<std::string::String>,
1131
1132 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1133 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1134 }
1135
1136 impl BillingDestination {
1137 pub fn new() -> Self {
1138 std::default::Default::default()
1139 }
1140
1141 /// Sets the value of [monitored_resource][crate::model::billing::BillingDestination::monitored_resource].
1142 pub fn set_monitored_resource<T: std::convert::Into<std::string::String>>(
1143 mut self,
1144 v: T,
1145 ) -> Self {
1146 self.monitored_resource = v.into();
1147 self
1148 }
1149
1150 /// Sets the value of [metrics][crate::model::billing::BillingDestination::metrics].
1151 pub fn set_metrics<T, V>(mut self, v: T) -> Self
1152 where
1153 T: std::iter::IntoIterator<Item = V>,
1154 V: std::convert::Into<std::string::String>,
1155 {
1156 use std::iter::Iterator;
1157 self.metrics = v.into_iter().map(|i| i.into()).collect();
1158 self
1159 }
1160 }
1161
1162 impl wkt::message::Message for BillingDestination {
1163 fn typename() -> &'static str {
1164 "type.googleapis.com/google.api.Billing.BillingDestination"
1165 }
1166 }
1167}
1168
1169/// Required information for every language.
1170#[serde_with::serde_as]
1171#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
1172#[serde(default, rename_all = "camelCase")]
1173#[non_exhaustive]
1174pub struct CommonLanguageSettings {
1175 /// Link to automatically generated reference documentation. Example:
1176 /// <https://cloud.google.com/nodejs/docs/reference/asset/latest>
1177 #[serde(skip_serializing_if = "std::string::String::is_empty")]
1178 pub reference_docs_uri: std::string::String,
1179
1180 /// The destination where API teams want this client library to be published.
1181 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
1182 pub destinations: std::vec::Vec<crate::model::ClientLibraryDestination>,
1183
1184 /// Configuration for which RPCs should be generated in the GAPIC client.
1185 #[serde(skip_serializing_if = "std::option::Option::is_none")]
1186 pub selective_gapic_generation: std::option::Option<crate::model::SelectiveGapicGeneration>,
1187
1188 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1189 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1190}
1191
1192impl CommonLanguageSettings {
1193 pub fn new() -> Self {
1194 std::default::Default::default()
1195 }
1196
1197 /// Sets the value of [reference_docs_uri][crate::model::CommonLanguageSettings::reference_docs_uri].
1198 pub fn set_reference_docs_uri<T: std::convert::Into<std::string::String>>(
1199 mut self,
1200 v: T,
1201 ) -> Self {
1202 self.reference_docs_uri = v.into();
1203 self
1204 }
1205
1206 /// Sets the value of [selective_gapic_generation][crate::model::CommonLanguageSettings::selective_gapic_generation].
1207 pub fn set_selective_gapic_generation<
1208 T: std::convert::Into<std::option::Option<crate::model::SelectiveGapicGeneration>>,
1209 >(
1210 mut self,
1211 v: T,
1212 ) -> Self {
1213 self.selective_gapic_generation = v.into();
1214 self
1215 }
1216
1217 /// Sets the value of [destinations][crate::model::CommonLanguageSettings::destinations].
1218 pub fn set_destinations<T, V>(mut self, v: T) -> Self
1219 where
1220 T: std::iter::IntoIterator<Item = V>,
1221 V: std::convert::Into<crate::model::ClientLibraryDestination>,
1222 {
1223 use std::iter::Iterator;
1224 self.destinations = v.into_iter().map(|i| i.into()).collect();
1225 self
1226 }
1227}
1228
1229impl wkt::message::Message for CommonLanguageSettings {
1230 fn typename() -> &'static str {
1231 "type.googleapis.com/google.api.CommonLanguageSettings"
1232 }
1233}
1234
1235/// Details about how and where to publish client libraries.
1236#[serde_with::serde_as]
1237#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
1238#[serde(default, rename_all = "camelCase")]
1239#[non_exhaustive]
1240pub struct ClientLibrarySettings {
1241 /// Version of the API to apply these settings to. This is the full protobuf
1242 /// package for the API, ending in the version element.
1243 /// Examples: "google.cloud.speech.v1" and "google.spanner.admin.database.v1".
1244 #[serde(skip_serializing_if = "std::string::String::is_empty")]
1245 pub version: std::string::String,
1246
1247 /// Launch stage of this version of the API.
1248 pub launch_stage: crate::model::LaunchStage,
1249
1250 /// When using transport=rest, the client request will encode enums as
1251 /// numbers rather than strings.
1252 pub rest_numeric_enums: bool,
1253
1254 /// Settings for legacy Java features, supported in the Service YAML.
1255 #[serde(skip_serializing_if = "std::option::Option::is_none")]
1256 pub java_settings: std::option::Option<crate::model::JavaSettings>,
1257
1258 /// Settings for C++ client libraries.
1259 #[serde(skip_serializing_if = "std::option::Option::is_none")]
1260 pub cpp_settings: std::option::Option<crate::model::CppSettings>,
1261
1262 /// Settings for PHP client libraries.
1263 #[serde(skip_serializing_if = "std::option::Option::is_none")]
1264 pub php_settings: std::option::Option<crate::model::PhpSettings>,
1265
1266 /// Settings for Python client libraries.
1267 #[serde(skip_serializing_if = "std::option::Option::is_none")]
1268 pub python_settings: std::option::Option<crate::model::PythonSettings>,
1269
1270 /// Settings for Node client libraries.
1271 #[serde(skip_serializing_if = "std::option::Option::is_none")]
1272 pub node_settings: std::option::Option<crate::model::NodeSettings>,
1273
1274 /// Settings for .NET client libraries.
1275 #[serde(skip_serializing_if = "std::option::Option::is_none")]
1276 pub dotnet_settings: std::option::Option<crate::model::DotnetSettings>,
1277
1278 /// Settings for Ruby client libraries.
1279 #[serde(skip_serializing_if = "std::option::Option::is_none")]
1280 pub ruby_settings: std::option::Option<crate::model::RubySettings>,
1281
1282 /// Settings for Go client libraries.
1283 #[serde(skip_serializing_if = "std::option::Option::is_none")]
1284 pub go_settings: std::option::Option<crate::model::GoSettings>,
1285
1286 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1287 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1288}
1289
1290impl ClientLibrarySettings {
1291 pub fn new() -> Self {
1292 std::default::Default::default()
1293 }
1294
1295 /// Sets the value of [version][crate::model::ClientLibrarySettings::version].
1296 pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1297 self.version = v.into();
1298 self
1299 }
1300
1301 /// Sets the value of [launch_stage][crate::model::ClientLibrarySettings::launch_stage].
1302 pub fn set_launch_stage<T: std::convert::Into<crate::model::LaunchStage>>(
1303 mut self,
1304 v: T,
1305 ) -> Self {
1306 self.launch_stage = v.into();
1307 self
1308 }
1309
1310 /// Sets the value of [rest_numeric_enums][crate::model::ClientLibrarySettings::rest_numeric_enums].
1311 pub fn set_rest_numeric_enums<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1312 self.rest_numeric_enums = v.into();
1313 self
1314 }
1315
1316 /// Sets the value of [java_settings][crate::model::ClientLibrarySettings::java_settings].
1317 pub fn set_java_settings<
1318 T: std::convert::Into<std::option::Option<crate::model::JavaSettings>>,
1319 >(
1320 mut self,
1321 v: T,
1322 ) -> Self {
1323 self.java_settings = v.into();
1324 self
1325 }
1326
1327 /// Sets the value of [cpp_settings][crate::model::ClientLibrarySettings::cpp_settings].
1328 pub fn set_cpp_settings<
1329 T: std::convert::Into<std::option::Option<crate::model::CppSettings>>,
1330 >(
1331 mut self,
1332 v: T,
1333 ) -> Self {
1334 self.cpp_settings = v.into();
1335 self
1336 }
1337
1338 /// Sets the value of [php_settings][crate::model::ClientLibrarySettings::php_settings].
1339 pub fn set_php_settings<
1340 T: std::convert::Into<std::option::Option<crate::model::PhpSettings>>,
1341 >(
1342 mut self,
1343 v: T,
1344 ) -> Self {
1345 self.php_settings = v.into();
1346 self
1347 }
1348
1349 /// Sets the value of [python_settings][crate::model::ClientLibrarySettings::python_settings].
1350 pub fn set_python_settings<
1351 T: std::convert::Into<std::option::Option<crate::model::PythonSettings>>,
1352 >(
1353 mut self,
1354 v: T,
1355 ) -> Self {
1356 self.python_settings = v.into();
1357 self
1358 }
1359
1360 /// Sets the value of [node_settings][crate::model::ClientLibrarySettings::node_settings].
1361 pub fn set_node_settings<
1362 T: std::convert::Into<std::option::Option<crate::model::NodeSettings>>,
1363 >(
1364 mut self,
1365 v: T,
1366 ) -> Self {
1367 self.node_settings = v.into();
1368 self
1369 }
1370
1371 /// Sets the value of [dotnet_settings][crate::model::ClientLibrarySettings::dotnet_settings].
1372 pub fn set_dotnet_settings<
1373 T: std::convert::Into<std::option::Option<crate::model::DotnetSettings>>,
1374 >(
1375 mut self,
1376 v: T,
1377 ) -> Self {
1378 self.dotnet_settings = v.into();
1379 self
1380 }
1381
1382 /// Sets the value of [ruby_settings][crate::model::ClientLibrarySettings::ruby_settings].
1383 pub fn set_ruby_settings<
1384 T: std::convert::Into<std::option::Option<crate::model::RubySettings>>,
1385 >(
1386 mut self,
1387 v: T,
1388 ) -> Self {
1389 self.ruby_settings = v.into();
1390 self
1391 }
1392
1393 /// Sets the value of [go_settings][crate::model::ClientLibrarySettings::go_settings].
1394 pub fn set_go_settings<T: std::convert::Into<std::option::Option<crate::model::GoSettings>>>(
1395 mut self,
1396 v: T,
1397 ) -> Self {
1398 self.go_settings = v.into();
1399 self
1400 }
1401}
1402
1403impl wkt::message::Message for ClientLibrarySettings {
1404 fn typename() -> &'static str {
1405 "type.googleapis.com/google.api.ClientLibrarySettings"
1406 }
1407}
1408
1409/// This message configures the settings for publishing [Google Cloud Client
1410/// libraries](https://cloud.google.com/apis/docs/cloud-client-libraries)
1411/// generated from the service config.
1412#[serde_with::serde_as]
1413#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
1414#[serde(default, rename_all = "camelCase")]
1415#[non_exhaustive]
1416pub struct Publishing {
1417 /// A list of API method settings, e.g. the behavior for methods that use the
1418 /// long-running operation pattern.
1419 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
1420 pub method_settings: std::vec::Vec<crate::model::MethodSettings>,
1421
1422 /// Link to a *public* URI where users can report issues. Example:
1423 /// <https://issuetracker.google.com/issues/new?component=190865&template=1161103>
1424 #[serde(skip_serializing_if = "std::string::String::is_empty")]
1425 pub new_issue_uri: std::string::String,
1426
1427 /// Link to product home page. Example:
1428 /// <https://cloud.google.com/asset-inventory/docs/overview>
1429 #[serde(skip_serializing_if = "std::string::String::is_empty")]
1430 pub documentation_uri: std::string::String,
1431
1432 /// Used as a tracking tag when collecting data about the APIs developer
1433 /// relations artifacts like docs, packages delivered to package managers,
1434 /// etc. Example: "speech".
1435 #[serde(skip_serializing_if = "std::string::String::is_empty")]
1436 pub api_short_name: std::string::String,
1437
1438 /// GitHub label to apply to issues and pull requests opened for this API.
1439 #[serde(skip_serializing_if = "std::string::String::is_empty")]
1440 pub github_label: std::string::String,
1441
1442 /// GitHub teams to be added to CODEOWNERS in the directory in GitHub
1443 /// containing source code for the client libraries for this API.
1444 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
1445 pub codeowner_github_teams: std::vec::Vec<std::string::String>,
1446
1447 /// A prefix used in sample code when demarking regions to be included in
1448 /// documentation.
1449 #[serde(skip_serializing_if = "std::string::String::is_empty")]
1450 pub doc_tag_prefix: std::string::String,
1451
1452 /// For whom the client library is being published.
1453 pub organization: crate::model::ClientLibraryOrganization,
1454
1455 /// Client library settings. If the same version string appears multiple
1456 /// times in this list, then the last one wins. Settings from earlier
1457 /// settings with the same version string are discarded.
1458 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
1459 pub library_settings: std::vec::Vec<crate::model::ClientLibrarySettings>,
1460
1461 /// Optional link to proto reference documentation. Example:
1462 /// <https://cloud.google.com/pubsub/lite/docs/reference/rpc>
1463 #[serde(skip_serializing_if = "std::string::String::is_empty")]
1464 pub proto_reference_documentation_uri: std::string::String,
1465
1466 /// Optional link to REST reference documentation. Example:
1467 /// <https://cloud.google.com/pubsub/lite/docs/reference/rest>
1468 #[serde(skip_serializing_if = "std::string::String::is_empty")]
1469 pub rest_reference_documentation_uri: std::string::String,
1470
1471 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1472 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1473}
1474
1475impl Publishing {
1476 pub fn new() -> Self {
1477 std::default::Default::default()
1478 }
1479
1480 /// Sets the value of [new_issue_uri][crate::model::Publishing::new_issue_uri].
1481 pub fn set_new_issue_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1482 self.new_issue_uri = v.into();
1483 self
1484 }
1485
1486 /// Sets the value of [documentation_uri][crate::model::Publishing::documentation_uri].
1487 pub fn set_documentation_uri<T: std::convert::Into<std::string::String>>(
1488 mut self,
1489 v: T,
1490 ) -> Self {
1491 self.documentation_uri = v.into();
1492 self
1493 }
1494
1495 /// Sets the value of [api_short_name][crate::model::Publishing::api_short_name].
1496 pub fn set_api_short_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1497 self.api_short_name = v.into();
1498 self
1499 }
1500
1501 /// Sets the value of [github_label][crate::model::Publishing::github_label].
1502 pub fn set_github_label<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1503 self.github_label = v.into();
1504 self
1505 }
1506
1507 /// Sets the value of [doc_tag_prefix][crate::model::Publishing::doc_tag_prefix].
1508 pub fn set_doc_tag_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1509 self.doc_tag_prefix = v.into();
1510 self
1511 }
1512
1513 /// Sets the value of [organization][crate::model::Publishing::organization].
1514 pub fn set_organization<T: std::convert::Into<crate::model::ClientLibraryOrganization>>(
1515 mut self,
1516 v: T,
1517 ) -> Self {
1518 self.organization = v.into();
1519 self
1520 }
1521
1522 /// Sets the value of [proto_reference_documentation_uri][crate::model::Publishing::proto_reference_documentation_uri].
1523 pub fn set_proto_reference_documentation_uri<T: std::convert::Into<std::string::String>>(
1524 mut self,
1525 v: T,
1526 ) -> Self {
1527 self.proto_reference_documentation_uri = v.into();
1528 self
1529 }
1530
1531 /// Sets the value of [rest_reference_documentation_uri][crate::model::Publishing::rest_reference_documentation_uri].
1532 pub fn set_rest_reference_documentation_uri<T: std::convert::Into<std::string::String>>(
1533 mut self,
1534 v: T,
1535 ) -> Self {
1536 self.rest_reference_documentation_uri = v.into();
1537 self
1538 }
1539
1540 /// Sets the value of [method_settings][crate::model::Publishing::method_settings].
1541 pub fn set_method_settings<T, V>(mut self, v: T) -> Self
1542 where
1543 T: std::iter::IntoIterator<Item = V>,
1544 V: std::convert::Into<crate::model::MethodSettings>,
1545 {
1546 use std::iter::Iterator;
1547 self.method_settings = v.into_iter().map(|i| i.into()).collect();
1548 self
1549 }
1550
1551 /// Sets the value of [codeowner_github_teams][crate::model::Publishing::codeowner_github_teams].
1552 pub fn set_codeowner_github_teams<T, V>(mut self, v: T) -> Self
1553 where
1554 T: std::iter::IntoIterator<Item = V>,
1555 V: std::convert::Into<std::string::String>,
1556 {
1557 use std::iter::Iterator;
1558 self.codeowner_github_teams = v.into_iter().map(|i| i.into()).collect();
1559 self
1560 }
1561
1562 /// Sets the value of [library_settings][crate::model::Publishing::library_settings].
1563 pub fn set_library_settings<T, V>(mut self, v: T) -> Self
1564 where
1565 T: std::iter::IntoIterator<Item = V>,
1566 V: std::convert::Into<crate::model::ClientLibrarySettings>,
1567 {
1568 use std::iter::Iterator;
1569 self.library_settings = v.into_iter().map(|i| i.into()).collect();
1570 self
1571 }
1572}
1573
1574impl wkt::message::Message for Publishing {
1575 fn typename() -> &'static str {
1576 "type.googleapis.com/google.api.Publishing"
1577 }
1578}
1579
1580/// Settings for Java client libraries.
1581#[serde_with::serde_as]
1582#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
1583#[serde(default, rename_all = "camelCase")]
1584#[non_exhaustive]
1585pub struct JavaSettings {
1586 /// The package name to use in Java. Clobbers the java_package option
1587 /// set in the protobuf. This should be used **only** by APIs
1588 /// who have already set the language_settings.java.package_name" field
1589 /// in gapic.yaml. API teams should use the protobuf java_package option
1590 /// where possible.
1591 ///
1592 /// Example of a YAML configuration::
1593 ///
1594 /// publishing:
1595 /// java_settings:
1596 /// library_package: com.google.cloud.pubsub.v1
1597 #[serde(skip_serializing_if = "std::string::String::is_empty")]
1598 pub library_package: std::string::String,
1599
1600 /// Configure the Java class name to use instead of the service's for its
1601 /// corresponding generated GAPIC client. Keys are fully-qualified
1602 /// service names as they appear in the protobuf (including the full
1603 /// the language_settings.java.interface_names" field in gapic.yaml. API
1604 /// teams should otherwise use the service name as it appears in the
1605 /// protobuf.
1606 ///
1607 /// Example of a YAML configuration::
1608 ///
1609 /// publishing:
1610 /// java_settings:
1611 /// service_class_names:
1612 /// - google.pubsub.v1.Publisher: TopicAdmin
1613 /// - google.pubsub.v1.Subscriber: SubscriptionAdmin
1614 #[serde(skip_serializing_if = "std::collections::HashMap::is_empty")]
1615 pub service_class_names: std::collections::HashMap<std::string::String, std::string::String>,
1616
1617 /// Some settings.
1618 #[serde(skip_serializing_if = "std::option::Option::is_none")]
1619 pub common: std::option::Option<crate::model::CommonLanguageSettings>,
1620
1621 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1622 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1623}
1624
1625impl JavaSettings {
1626 pub fn new() -> Self {
1627 std::default::Default::default()
1628 }
1629
1630 /// Sets the value of [library_package][crate::model::JavaSettings::library_package].
1631 pub fn set_library_package<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1632 self.library_package = v.into();
1633 self
1634 }
1635
1636 /// Sets the value of [common][crate::model::JavaSettings::common].
1637 pub fn set_common<
1638 T: std::convert::Into<std::option::Option<crate::model::CommonLanguageSettings>>,
1639 >(
1640 mut self,
1641 v: T,
1642 ) -> Self {
1643 self.common = v.into();
1644 self
1645 }
1646
1647 /// Sets the value of [service_class_names][crate::model::JavaSettings::service_class_names].
1648 pub fn set_service_class_names<T, K, V>(mut self, v: T) -> Self
1649 where
1650 T: std::iter::IntoIterator<Item = (K, V)>,
1651 K: std::convert::Into<std::string::String>,
1652 V: std::convert::Into<std::string::String>,
1653 {
1654 use std::iter::Iterator;
1655 self.service_class_names = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1656 self
1657 }
1658}
1659
1660impl wkt::message::Message for JavaSettings {
1661 fn typename() -> &'static str {
1662 "type.googleapis.com/google.api.JavaSettings"
1663 }
1664}
1665
1666/// Settings for C++ client libraries.
1667#[serde_with::serde_as]
1668#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
1669#[serde(default, rename_all = "camelCase")]
1670#[non_exhaustive]
1671pub struct CppSettings {
1672 /// Some settings.
1673 #[serde(skip_serializing_if = "std::option::Option::is_none")]
1674 pub common: std::option::Option<crate::model::CommonLanguageSettings>,
1675
1676 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1677 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1678}
1679
1680impl CppSettings {
1681 pub fn new() -> Self {
1682 std::default::Default::default()
1683 }
1684
1685 /// Sets the value of [common][crate::model::CppSettings::common].
1686 pub fn set_common<
1687 T: std::convert::Into<std::option::Option<crate::model::CommonLanguageSettings>>,
1688 >(
1689 mut self,
1690 v: T,
1691 ) -> Self {
1692 self.common = v.into();
1693 self
1694 }
1695}
1696
1697impl wkt::message::Message for CppSettings {
1698 fn typename() -> &'static str {
1699 "type.googleapis.com/google.api.CppSettings"
1700 }
1701}
1702
1703/// Settings for Php client libraries.
1704#[serde_with::serde_as]
1705#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
1706#[serde(default, rename_all = "camelCase")]
1707#[non_exhaustive]
1708pub struct PhpSettings {
1709 /// Some settings.
1710 #[serde(skip_serializing_if = "std::option::Option::is_none")]
1711 pub common: std::option::Option<crate::model::CommonLanguageSettings>,
1712
1713 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1714 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1715}
1716
1717impl PhpSettings {
1718 pub fn new() -> Self {
1719 std::default::Default::default()
1720 }
1721
1722 /// Sets the value of [common][crate::model::PhpSettings::common].
1723 pub fn set_common<
1724 T: std::convert::Into<std::option::Option<crate::model::CommonLanguageSettings>>,
1725 >(
1726 mut self,
1727 v: T,
1728 ) -> Self {
1729 self.common = v.into();
1730 self
1731 }
1732}
1733
1734impl wkt::message::Message for PhpSettings {
1735 fn typename() -> &'static str {
1736 "type.googleapis.com/google.api.PhpSettings"
1737 }
1738}
1739
1740/// Settings for Python client libraries.
1741#[serde_with::serde_as]
1742#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
1743#[serde(default, rename_all = "camelCase")]
1744#[non_exhaustive]
1745pub struct PythonSettings {
1746 /// Some settings.
1747 #[serde(skip_serializing_if = "std::option::Option::is_none")]
1748 pub common: std::option::Option<crate::model::CommonLanguageSettings>,
1749
1750 /// Experimental features to be included during client library generation.
1751 #[serde(skip_serializing_if = "std::option::Option::is_none")]
1752 pub experimental_features:
1753 std::option::Option<crate::model::python_settings::ExperimentalFeatures>,
1754
1755 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1756 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1757}
1758
1759impl PythonSettings {
1760 pub fn new() -> Self {
1761 std::default::Default::default()
1762 }
1763
1764 /// Sets the value of [common][crate::model::PythonSettings::common].
1765 pub fn set_common<
1766 T: std::convert::Into<std::option::Option<crate::model::CommonLanguageSettings>>,
1767 >(
1768 mut self,
1769 v: T,
1770 ) -> Self {
1771 self.common = v.into();
1772 self
1773 }
1774
1775 /// Sets the value of [experimental_features][crate::model::PythonSettings::experimental_features].
1776 pub fn set_experimental_features<
1777 T: std::convert::Into<
1778 std::option::Option<crate::model::python_settings::ExperimentalFeatures>,
1779 >,
1780 >(
1781 mut self,
1782 v: T,
1783 ) -> Self {
1784 self.experimental_features = v.into();
1785 self
1786 }
1787}
1788
1789impl wkt::message::Message for PythonSettings {
1790 fn typename() -> &'static str {
1791 "type.googleapis.com/google.api.PythonSettings"
1792 }
1793}
1794
1795/// Defines additional types related to [PythonSettings].
1796pub mod python_settings {
1797 #[allow(unused_imports)]
1798 use super::*;
1799
1800 /// Experimental features to be included during client library generation.
1801 /// These fields will be deprecated once the feature graduates and is enabled
1802 /// by default.
1803 #[serde_with::serde_as]
1804 #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
1805 #[serde(default, rename_all = "camelCase")]
1806 #[non_exhaustive]
1807 pub struct ExperimentalFeatures {
1808 /// Enables generation of asynchronous REST clients if `rest` transport is
1809 /// enabled. By default, asynchronous REST clients will not be generated.
1810 /// This feature will be enabled by default 1 month after launching the
1811 /// feature in preview packages.
1812 pub rest_async_io_enabled: bool,
1813
1814 /// Enables generation of protobuf code using new types that are more
1815 /// Pythonic which are included in `protobuf>=5.29.x`. This feature will be
1816 /// enabled by default 1 month after launching the feature in preview
1817 /// packages.
1818 pub protobuf_pythonic_types_enabled: bool,
1819
1820 /// Disables generation of an unversioned Python package for this client
1821 /// library. This means that the module names will need to be versioned in
1822 /// import statements. For example `import google.cloud.library_v2` instead
1823 /// of `import google.cloud.library`.
1824 pub unversioned_package_disabled: bool,
1825
1826 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1827 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1828 }
1829
1830 impl ExperimentalFeatures {
1831 pub fn new() -> Self {
1832 std::default::Default::default()
1833 }
1834
1835 /// Sets the value of [rest_async_io_enabled][crate::model::python_settings::ExperimentalFeatures::rest_async_io_enabled].
1836 pub fn set_rest_async_io_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1837 self.rest_async_io_enabled = v.into();
1838 self
1839 }
1840
1841 /// Sets the value of [protobuf_pythonic_types_enabled][crate::model::python_settings::ExperimentalFeatures::protobuf_pythonic_types_enabled].
1842 pub fn set_protobuf_pythonic_types_enabled<T: std::convert::Into<bool>>(
1843 mut self,
1844 v: T,
1845 ) -> Self {
1846 self.protobuf_pythonic_types_enabled = v.into();
1847 self
1848 }
1849
1850 /// Sets the value of [unversioned_package_disabled][crate::model::python_settings::ExperimentalFeatures::unversioned_package_disabled].
1851 pub fn set_unversioned_package_disabled<T: std::convert::Into<bool>>(
1852 mut self,
1853 v: T,
1854 ) -> Self {
1855 self.unversioned_package_disabled = v.into();
1856 self
1857 }
1858 }
1859
1860 impl wkt::message::Message for ExperimentalFeatures {
1861 fn typename() -> &'static str {
1862 "type.googleapis.com/google.api.PythonSettings.ExperimentalFeatures"
1863 }
1864 }
1865}
1866
1867/// Settings for Node client libraries.
1868#[serde_with::serde_as]
1869#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
1870#[serde(default, rename_all = "camelCase")]
1871#[non_exhaustive]
1872pub struct NodeSettings {
1873 /// Some settings.
1874 #[serde(skip_serializing_if = "std::option::Option::is_none")]
1875 pub common: std::option::Option<crate::model::CommonLanguageSettings>,
1876
1877 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1878 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1879}
1880
1881impl NodeSettings {
1882 pub fn new() -> Self {
1883 std::default::Default::default()
1884 }
1885
1886 /// Sets the value of [common][crate::model::NodeSettings::common].
1887 pub fn set_common<
1888 T: std::convert::Into<std::option::Option<crate::model::CommonLanguageSettings>>,
1889 >(
1890 mut self,
1891 v: T,
1892 ) -> Self {
1893 self.common = v.into();
1894 self
1895 }
1896}
1897
1898impl wkt::message::Message for NodeSettings {
1899 fn typename() -> &'static str {
1900 "type.googleapis.com/google.api.NodeSettings"
1901 }
1902}
1903
1904/// Settings for Dotnet client libraries.
1905#[serde_with::serde_as]
1906#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
1907#[serde(default, rename_all = "camelCase")]
1908#[non_exhaustive]
1909pub struct DotnetSettings {
1910 /// Some settings.
1911 #[serde(skip_serializing_if = "std::option::Option::is_none")]
1912 pub common: std::option::Option<crate::model::CommonLanguageSettings>,
1913
1914 /// Map from original service names to renamed versions.
1915 /// This is used when the default generated types
1916 /// would cause a naming conflict. (Neither name is
1917 /// fully-qualified.)
1918 /// Example: Subscriber to SubscriberServiceApi.
1919 #[serde(skip_serializing_if = "std::collections::HashMap::is_empty")]
1920 pub renamed_services: std::collections::HashMap<std::string::String, std::string::String>,
1921
1922 /// Map from full resource types to the effective short name
1923 /// for the resource. This is used when otherwise resource
1924 /// named from different services would cause naming collisions.
1925 /// Example entry:
1926 /// "datalabeling.googleapis.com/Dataset": "DataLabelingDataset"
1927 #[serde(skip_serializing_if = "std::collections::HashMap::is_empty")]
1928 pub renamed_resources: std::collections::HashMap<std::string::String, std::string::String>,
1929
1930 /// List of full resource types to ignore during generation.
1931 /// This is typically used for API-specific Location resources,
1932 /// which should be handled by the generator as if they were actually
1933 /// the common Location resources.
1934 /// Example entry: "documentai.googleapis.com/Location"
1935 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
1936 pub ignored_resources: std::vec::Vec<std::string::String>,
1937
1938 /// Namespaces which must be aliased in snippets due to
1939 /// a known (but non-generator-predictable) naming collision
1940 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
1941 pub forced_namespace_aliases: std::vec::Vec<std::string::String>,
1942
1943 /// Method signatures (in the form "service.method(signature)")
1944 /// which are provided separately, so shouldn't be generated.
1945 /// Snippets *calling* these methods are still generated, however.
1946 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
1947 pub handwritten_signatures: std::vec::Vec<std::string::String>,
1948
1949 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1950 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1951}
1952
1953impl DotnetSettings {
1954 pub fn new() -> Self {
1955 std::default::Default::default()
1956 }
1957
1958 /// Sets the value of [common][crate::model::DotnetSettings::common].
1959 pub fn set_common<
1960 T: std::convert::Into<std::option::Option<crate::model::CommonLanguageSettings>>,
1961 >(
1962 mut self,
1963 v: T,
1964 ) -> Self {
1965 self.common = v.into();
1966 self
1967 }
1968
1969 /// Sets the value of [ignored_resources][crate::model::DotnetSettings::ignored_resources].
1970 pub fn set_ignored_resources<T, V>(mut self, v: T) -> Self
1971 where
1972 T: std::iter::IntoIterator<Item = V>,
1973 V: std::convert::Into<std::string::String>,
1974 {
1975 use std::iter::Iterator;
1976 self.ignored_resources = v.into_iter().map(|i| i.into()).collect();
1977 self
1978 }
1979
1980 /// Sets the value of [forced_namespace_aliases][crate::model::DotnetSettings::forced_namespace_aliases].
1981 pub fn set_forced_namespace_aliases<T, V>(mut self, v: T) -> Self
1982 where
1983 T: std::iter::IntoIterator<Item = V>,
1984 V: std::convert::Into<std::string::String>,
1985 {
1986 use std::iter::Iterator;
1987 self.forced_namespace_aliases = v.into_iter().map(|i| i.into()).collect();
1988 self
1989 }
1990
1991 /// Sets the value of [handwritten_signatures][crate::model::DotnetSettings::handwritten_signatures].
1992 pub fn set_handwritten_signatures<T, V>(mut self, v: T) -> Self
1993 where
1994 T: std::iter::IntoIterator<Item = V>,
1995 V: std::convert::Into<std::string::String>,
1996 {
1997 use std::iter::Iterator;
1998 self.handwritten_signatures = v.into_iter().map(|i| i.into()).collect();
1999 self
2000 }
2001
2002 /// Sets the value of [renamed_services][crate::model::DotnetSettings::renamed_services].
2003 pub fn set_renamed_services<T, K, V>(mut self, v: T) -> Self
2004 where
2005 T: std::iter::IntoIterator<Item = (K, V)>,
2006 K: std::convert::Into<std::string::String>,
2007 V: std::convert::Into<std::string::String>,
2008 {
2009 use std::iter::Iterator;
2010 self.renamed_services = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2011 self
2012 }
2013
2014 /// Sets the value of [renamed_resources][crate::model::DotnetSettings::renamed_resources].
2015 pub fn set_renamed_resources<T, K, V>(mut self, v: T) -> Self
2016 where
2017 T: std::iter::IntoIterator<Item = (K, V)>,
2018 K: std::convert::Into<std::string::String>,
2019 V: std::convert::Into<std::string::String>,
2020 {
2021 use std::iter::Iterator;
2022 self.renamed_resources = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2023 self
2024 }
2025}
2026
2027impl wkt::message::Message for DotnetSettings {
2028 fn typename() -> &'static str {
2029 "type.googleapis.com/google.api.DotnetSettings"
2030 }
2031}
2032
2033/// Settings for Ruby client libraries.
2034#[serde_with::serde_as]
2035#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
2036#[serde(default, rename_all = "camelCase")]
2037#[non_exhaustive]
2038pub struct RubySettings {
2039 /// Some settings.
2040 #[serde(skip_serializing_if = "std::option::Option::is_none")]
2041 pub common: std::option::Option<crate::model::CommonLanguageSettings>,
2042
2043 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
2044 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2045}
2046
2047impl RubySettings {
2048 pub fn new() -> Self {
2049 std::default::Default::default()
2050 }
2051
2052 /// Sets the value of [common][crate::model::RubySettings::common].
2053 pub fn set_common<
2054 T: std::convert::Into<std::option::Option<crate::model::CommonLanguageSettings>>,
2055 >(
2056 mut self,
2057 v: T,
2058 ) -> Self {
2059 self.common = v.into();
2060 self
2061 }
2062}
2063
2064impl wkt::message::Message for RubySettings {
2065 fn typename() -> &'static str {
2066 "type.googleapis.com/google.api.RubySettings"
2067 }
2068}
2069
2070/// Settings for Go client libraries.
2071#[serde_with::serde_as]
2072#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
2073#[serde(default, rename_all = "camelCase")]
2074#[non_exhaustive]
2075pub struct GoSettings {
2076 /// Some settings.
2077 #[serde(skip_serializing_if = "std::option::Option::is_none")]
2078 pub common: std::option::Option<crate::model::CommonLanguageSettings>,
2079
2080 /// Map of service names to renamed services. Keys are the package relative
2081 /// service names and values are the name to be used for the service client
2082 /// and call options.
2083 ///
2084 /// publishing:
2085 /// go_settings:
2086 /// renamed_services:
2087 /// Publisher: TopicAdmin
2088 #[serde(skip_serializing_if = "std::collections::HashMap::is_empty")]
2089 pub renamed_services: std::collections::HashMap<std::string::String, std::string::String>,
2090
2091 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
2092 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2093}
2094
2095impl GoSettings {
2096 pub fn new() -> Self {
2097 std::default::Default::default()
2098 }
2099
2100 /// Sets the value of [common][crate::model::GoSettings::common].
2101 pub fn set_common<
2102 T: std::convert::Into<std::option::Option<crate::model::CommonLanguageSettings>>,
2103 >(
2104 mut self,
2105 v: T,
2106 ) -> Self {
2107 self.common = v.into();
2108 self
2109 }
2110
2111 /// Sets the value of [renamed_services][crate::model::GoSettings::renamed_services].
2112 pub fn set_renamed_services<T, K, V>(mut self, v: T) -> Self
2113 where
2114 T: std::iter::IntoIterator<Item = (K, V)>,
2115 K: std::convert::Into<std::string::String>,
2116 V: std::convert::Into<std::string::String>,
2117 {
2118 use std::iter::Iterator;
2119 self.renamed_services = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2120 self
2121 }
2122}
2123
2124impl wkt::message::Message for GoSettings {
2125 fn typename() -> &'static str {
2126 "type.googleapis.com/google.api.GoSettings"
2127 }
2128}
2129
2130/// Describes the generator configuration for a method.
2131#[serde_with::serde_as]
2132#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
2133#[serde(default, rename_all = "camelCase")]
2134#[non_exhaustive]
2135pub struct MethodSettings {
2136 /// The fully qualified name of the method, for which the options below apply.
2137 /// This is used to find the method to apply the options.
2138 ///
2139 /// Example:
2140 ///
2141 /// publishing:
2142 /// method_settings:
2143 /// - selector: google.storage.control.v2.StorageControl.CreateFolder
2144 /// # method settings for CreateFolder...
2145 #[serde(skip_serializing_if = "std::string::String::is_empty")]
2146 pub selector: std::string::String,
2147
2148 /// Describes settings to use for long-running operations when generating
2149 /// API methods for RPCs. Complements RPCs that use the annotations in
2150 /// google/longrunning/operations.proto.
2151 ///
2152 /// Example of a YAML configuration::
2153 ///
2154 /// publishing:
2155 /// method_settings:
2156 /// - selector: google.cloud.speech.v2.Speech.BatchRecognize
2157 /// long_running:
2158 /// initial_poll_delay: 60s # 1 minute
2159 /// poll_delay_multiplier: 1.5
2160 /// max_poll_delay: 360s # 6 minutes
2161 /// total_poll_timeout: 54000s # 90 minutes
2162 #[serde(skip_serializing_if = "std::option::Option::is_none")]
2163 pub long_running: std::option::Option<crate::model::method_settings::LongRunning>,
2164
2165 /// List of top-level fields of the request message, that should be
2166 /// automatically populated by the client libraries based on their
2167 /// (google.api.field_info).format. Currently supported format: UUID4.
2168 ///
2169 /// Example of a YAML configuration:
2170 ///
2171 /// publishing:
2172 /// method_settings:
2173 /// - selector: google.example.v1.ExampleService.CreateExample
2174 /// auto_populated_fields:
2175 /// - request_id
2176 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
2177 pub auto_populated_fields: std::vec::Vec<std::string::String>,
2178
2179 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
2180 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2181}
2182
2183impl MethodSettings {
2184 pub fn new() -> Self {
2185 std::default::Default::default()
2186 }
2187
2188 /// Sets the value of [selector][crate::model::MethodSettings::selector].
2189 pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2190 self.selector = v.into();
2191 self
2192 }
2193
2194 /// Sets the value of [long_running][crate::model::MethodSettings::long_running].
2195 pub fn set_long_running<
2196 T: std::convert::Into<std::option::Option<crate::model::method_settings::LongRunning>>,
2197 >(
2198 mut self,
2199 v: T,
2200 ) -> Self {
2201 self.long_running = v.into();
2202 self
2203 }
2204
2205 /// Sets the value of [auto_populated_fields][crate::model::MethodSettings::auto_populated_fields].
2206 pub fn set_auto_populated_fields<T, V>(mut self, v: T) -> Self
2207 where
2208 T: std::iter::IntoIterator<Item = V>,
2209 V: std::convert::Into<std::string::String>,
2210 {
2211 use std::iter::Iterator;
2212 self.auto_populated_fields = v.into_iter().map(|i| i.into()).collect();
2213 self
2214 }
2215}
2216
2217impl wkt::message::Message for MethodSettings {
2218 fn typename() -> &'static str {
2219 "type.googleapis.com/google.api.MethodSettings"
2220 }
2221}
2222
2223/// Defines additional types related to [MethodSettings].
2224pub mod method_settings {
2225 #[allow(unused_imports)]
2226 use super::*;
2227
2228 /// Describes settings to use when generating API methods that use the
2229 /// long-running operation pattern.
2230 /// All default values below are from those used in the client library
2231 /// generators (e.g.
2232 /// [Java](https://github.com/googleapis/gapic-generator-java/blob/04c2faa191a9b5a10b92392fe8482279c4404803/src/main/java/com/google/api/generator/gapic/composer/common/RetrySettingsComposer.java)).
2233 #[serde_with::serde_as]
2234 #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
2235 #[serde(default, rename_all = "camelCase")]
2236 #[non_exhaustive]
2237 pub struct LongRunning {
2238 /// Initial delay after which the first poll request will be made.
2239 /// Default value: 5 seconds.
2240 #[serde(skip_serializing_if = "std::option::Option::is_none")]
2241 pub initial_poll_delay: std::option::Option<wkt::Duration>,
2242
2243 /// Multiplier to gradually increase delay between subsequent polls until it
2244 /// reaches max_poll_delay.
2245 /// Default value: 1.5.
2246 pub poll_delay_multiplier: f32,
2247
2248 /// Maximum time between two subsequent poll requests.
2249 /// Default value: 45 seconds.
2250 #[serde(skip_serializing_if = "std::option::Option::is_none")]
2251 pub max_poll_delay: std::option::Option<wkt::Duration>,
2252
2253 /// Total polling timeout.
2254 /// Default value: 5 minutes.
2255 #[serde(skip_serializing_if = "std::option::Option::is_none")]
2256 pub total_poll_timeout: std::option::Option<wkt::Duration>,
2257
2258 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
2259 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2260 }
2261
2262 impl LongRunning {
2263 pub fn new() -> Self {
2264 std::default::Default::default()
2265 }
2266
2267 /// Sets the value of [initial_poll_delay][crate::model::method_settings::LongRunning::initial_poll_delay].
2268 pub fn set_initial_poll_delay<T: std::convert::Into<std::option::Option<wkt::Duration>>>(
2269 mut self,
2270 v: T,
2271 ) -> Self {
2272 self.initial_poll_delay = v.into();
2273 self
2274 }
2275
2276 /// Sets the value of [poll_delay_multiplier][crate::model::method_settings::LongRunning::poll_delay_multiplier].
2277 pub fn set_poll_delay_multiplier<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
2278 self.poll_delay_multiplier = v.into();
2279 self
2280 }
2281
2282 /// Sets the value of [max_poll_delay][crate::model::method_settings::LongRunning::max_poll_delay].
2283 pub fn set_max_poll_delay<T: std::convert::Into<std::option::Option<wkt::Duration>>>(
2284 mut self,
2285 v: T,
2286 ) -> Self {
2287 self.max_poll_delay = v.into();
2288 self
2289 }
2290
2291 /// Sets the value of [total_poll_timeout][crate::model::method_settings::LongRunning::total_poll_timeout].
2292 pub fn set_total_poll_timeout<T: std::convert::Into<std::option::Option<wkt::Duration>>>(
2293 mut self,
2294 v: T,
2295 ) -> Self {
2296 self.total_poll_timeout = v.into();
2297 self
2298 }
2299 }
2300
2301 impl wkt::message::Message for LongRunning {
2302 fn typename() -> &'static str {
2303 "type.googleapis.com/google.api.MethodSettings.LongRunning"
2304 }
2305 }
2306}
2307
2308/// This message is used to configure the generation of a subset of the RPCs in
2309/// a service for client libraries.
2310#[serde_with::serde_as]
2311#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
2312#[serde(default, rename_all = "camelCase")]
2313#[non_exhaustive]
2314pub struct SelectiveGapicGeneration {
2315 /// An allowlist of the fully qualified names of RPCs that should be included
2316 /// on public client surfaces.
2317 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
2318 pub methods: std::vec::Vec<std::string::String>,
2319
2320 /// Setting this to true indicates to the client generators that methods
2321 /// that would be excluded from the generation should instead be generated
2322 /// in a way that indicates these methods should not be consumed by
2323 /// end users. How this is expressed is up to individual language
2324 /// implementations to decide. Some examples may be: added annotations,
2325 /// obfuscated identifiers, or other language idiomatic patterns.
2326 pub generate_omitted_as_internal: bool,
2327
2328 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
2329 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2330}
2331
2332impl SelectiveGapicGeneration {
2333 pub fn new() -> Self {
2334 std::default::Default::default()
2335 }
2336
2337 /// Sets the value of [generate_omitted_as_internal][crate::model::SelectiveGapicGeneration::generate_omitted_as_internal].
2338 pub fn set_generate_omitted_as_internal<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2339 self.generate_omitted_as_internal = v.into();
2340 self
2341 }
2342
2343 /// Sets the value of [methods][crate::model::SelectiveGapicGeneration::methods].
2344 pub fn set_methods<T, V>(mut self, v: T) -> Self
2345 where
2346 T: std::iter::IntoIterator<Item = V>,
2347 V: std::convert::Into<std::string::String>,
2348 {
2349 use std::iter::Iterator;
2350 self.methods = v.into_iter().map(|i| i.into()).collect();
2351 self
2352 }
2353}
2354
2355impl wkt::message::Message for SelectiveGapicGeneration {
2356 fn typename() -> &'static str {
2357 "type.googleapis.com/google.api.SelectiveGapicGeneration"
2358 }
2359}
2360
2361/// Output generated from semantically comparing two versions of a service
2362/// configuration.
2363///
2364/// Includes detailed information about a field that have changed with
2365/// applicable advice about potential consequences for the change, such as
2366/// backwards-incompatibility.
2367#[serde_with::serde_as]
2368#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
2369#[serde(default, rename_all = "camelCase")]
2370#[non_exhaustive]
2371pub struct ConfigChange {
2372 /// Object hierarchy path to the change, with levels separated by a '.'
2373 /// character. For repeated fields, an applicable unique identifier field is
2374 /// used for the index (usually selector, name, or id). For maps, the term
2375 /// 'key' is used. If the field has no unique identifier, the numeric index
2376 /// is used.
2377 /// Examples:
2378 ///
2379 /// - visibility.rules[selector=="google.LibraryService.ListBooks"].restriction
2380 /// - quota.metric_rules[selector=="google"].metric_costs[key=="reads"].value
2381 /// - logging.producer_destinations[0]
2382 #[serde(skip_serializing_if = "std::string::String::is_empty")]
2383 pub element: std::string::String,
2384
2385 /// Value of the changed object in the old Service configuration,
2386 /// in JSON format. This field will not be populated if ChangeType == ADDED.
2387 #[serde(skip_serializing_if = "std::string::String::is_empty")]
2388 pub old_value: std::string::String,
2389
2390 /// Value of the changed object in the new Service configuration,
2391 /// in JSON format. This field will not be populated if ChangeType == REMOVED.
2392 #[serde(skip_serializing_if = "std::string::String::is_empty")]
2393 pub new_value: std::string::String,
2394
2395 /// The type for this change, either ADDED, REMOVED, or MODIFIED.
2396 pub change_type: crate::model::ChangeType,
2397
2398 /// Collection of advice provided for this change, useful for determining the
2399 /// possible impact of this change.
2400 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
2401 pub advices: std::vec::Vec<crate::model::Advice>,
2402
2403 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
2404 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2405}
2406
2407impl ConfigChange {
2408 pub fn new() -> Self {
2409 std::default::Default::default()
2410 }
2411
2412 /// Sets the value of [element][crate::model::ConfigChange::element].
2413 pub fn set_element<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2414 self.element = v.into();
2415 self
2416 }
2417
2418 /// Sets the value of [old_value][crate::model::ConfigChange::old_value].
2419 pub fn set_old_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2420 self.old_value = v.into();
2421 self
2422 }
2423
2424 /// Sets the value of [new_value][crate::model::ConfigChange::new_value].
2425 pub fn set_new_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2426 self.new_value = v.into();
2427 self
2428 }
2429
2430 /// Sets the value of [change_type][crate::model::ConfigChange::change_type].
2431 pub fn set_change_type<T: std::convert::Into<crate::model::ChangeType>>(
2432 mut self,
2433 v: T,
2434 ) -> Self {
2435 self.change_type = v.into();
2436 self
2437 }
2438
2439 /// Sets the value of [advices][crate::model::ConfigChange::advices].
2440 pub fn set_advices<T, V>(mut self, v: T) -> Self
2441 where
2442 T: std::iter::IntoIterator<Item = V>,
2443 V: std::convert::Into<crate::model::Advice>,
2444 {
2445 use std::iter::Iterator;
2446 self.advices = v.into_iter().map(|i| i.into()).collect();
2447 self
2448 }
2449}
2450
2451impl wkt::message::Message for ConfigChange {
2452 fn typename() -> &'static str {
2453 "type.googleapis.com/google.api.ConfigChange"
2454 }
2455}
2456
2457/// Generated advice about this change, used for providing more
2458/// information about how a change will affect the existing service.
2459#[serde_with::serde_as]
2460#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
2461#[serde(default, rename_all = "camelCase")]
2462#[non_exhaustive]
2463pub struct Advice {
2464 /// Useful description for why this advice was applied and what actions should
2465 /// be taken to mitigate any implied risks.
2466 #[serde(skip_serializing_if = "std::string::String::is_empty")]
2467 pub description: std::string::String,
2468
2469 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
2470 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2471}
2472
2473impl Advice {
2474 pub fn new() -> Self {
2475 std::default::Default::default()
2476 }
2477
2478 /// Sets the value of [description][crate::model::Advice::description].
2479 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2480 self.description = v.into();
2481 self
2482 }
2483}
2484
2485impl wkt::message::Message for Advice {
2486 fn typename() -> &'static str {
2487 "type.googleapis.com/google.api.Advice"
2488 }
2489}
2490
2491/// A descriptor for defining project properties for a service. One service may
2492/// have many consumer projects, and the service may want to behave differently
2493/// depending on some properties on the project. For example, a project may be
2494/// associated with a school, or a business, or a government agency, a business
2495/// type property on the project may affect how a service responds to the client.
2496/// This descriptor defines which properties are allowed to be set on a project.
2497///
2498/// Example:
2499///
2500/// project_properties:
2501/// properties:
2502/// - name: NO_WATERMARK
2503/// type: BOOL
2504/// description: Allows usage of the API without watermarks.
2505/// - name: EXTENDED_TILE_CACHE_PERIOD
2506/// type: INT64
2507#[serde_with::serde_as]
2508#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
2509#[serde(default, rename_all = "camelCase")]
2510#[non_exhaustive]
2511pub struct ProjectProperties {
2512 /// List of per consumer project-specific properties.
2513 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
2514 pub properties: std::vec::Vec<crate::model::Property>,
2515
2516 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
2517 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2518}
2519
2520impl ProjectProperties {
2521 pub fn new() -> Self {
2522 std::default::Default::default()
2523 }
2524
2525 /// Sets the value of [properties][crate::model::ProjectProperties::properties].
2526 pub fn set_properties<T, V>(mut self, v: T) -> Self
2527 where
2528 T: std::iter::IntoIterator<Item = V>,
2529 V: std::convert::Into<crate::model::Property>,
2530 {
2531 use std::iter::Iterator;
2532 self.properties = v.into_iter().map(|i| i.into()).collect();
2533 self
2534 }
2535}
2536
2537impl wkt::message::Message for ProjectProperties {
2538 fn typename() -> &'static str {
2539 "type.googleapis.com/google.api.ProjectProperties"
2540 }
2541}
2542
2543/// Defines project properties.
2544///
2545/// API services can define properties that can be assigned to consumer projects
2546/// so that backends can perform response customization without having to make
2547/// additional calls or maintain additional storage. For example, Maps API
2548/// defines properties that controls map tile cache period, or whether to embed a
2549/// watermark in a result.
2550///
2551/// These values can be set via API producer console. Only API providers can
2552/// define and set these properties.
2553#[serde_with::serde_as]
2554#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
2555#[serde(default, rename_all = "camelCase")]
2556#[non_exhaustive]
2557pub struct Property {
2558 /// The name of the property (a.k.a key).
2559 #[serde(skip_serializing_if = "std::string::String::is_empty")]
2560 pub name: std::string::String,
2561
2562 /// The type of this property.
2563 #[serde(rename = "type")]
2564 pub r#type: crate::model::property::PropertyType,
2565
2566 /// The description of the property
2567 #[serde(skip_serializing_if = "std::string::String::is_empty")]
2568 pub description: std::string::String,
2569
2570 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
2571 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2572}
2573
2574impl Property {
2575 pub fn new() -> Self {
2576 std::default::Default::default()
2577 }
2578
2579 /// Sets the value of [name][crate::model::Property::name].
2580 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2581 self.name = v.into();
2582 self
2583 }
2584
2585 /// Sets the value of [r#type][crate::model::Property::type].
2586 pub fn set_type<T: std::convert::Into<crate::model::property::PropertyType>>(
2587 mut self,
2588 v: T,
2589 ) -> Self {
2590 self.r#type = v.into();
2591 self
2592 }
2593
2594 /// Sets the value of [description][crate::model::Property::description].
2595 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2596 self.description = v.into();
2597 self
2598 }
2599}
2600
2601impl wkt::message::Message for Property {
2602 fn typename() -> &'static str {
2603 "type.googleapis.com/google.api.Property"
2604 }
2605}
2606
2607/// Defines additional types related to [Property].
2608pub mod property {
2609 #[allow(unused_imports)]
2610 use super::*;
2611
2612 /// Supported data type of the property values
2613 #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
2614 pub struct PropertyType(i32);
2615
2616 impl PropertyType {
2617 /// The type is unspecified, and will result in an error.
2618 pub const UNSPECIFIED: PropertyType = PropertyType::new(0);
2619
2620 /// The type is `int64`.
2621 pub const INT64: PropertyType = PropertyType::new(1);
2622
2623 /// The type is `bool`.
2624 pub const BOOL: PropertyType = PropertyType::new(2);
2625
2626 /// The type is `string`.
2627 pub const STRING: PropertyType = PropertyType::new(3);
2628
2629 /// The type is 'double'.
2630 pub const DOUBLE: PropertyType = PropertyType::new(4);
2631
2632 /// Creates a new PropertyType instance.
2633 pub(crate) const fn new(value: i32) -> Self {
2634 Self(value)
2635 }
2636
2637 /// Gets the enum value.
2638 pub fn value(&self) -> i32 {
2639 self.0
2640 }
2641
2642 /// Gets the enum value as a string.
2643 pub fn as_str_name(&self) -> std::borrow::Cow<'static, str> {
2644 match self.0 {
2645 0 => std::borrow::Cow::Borrowed("UNSPECIFIED"),
2646 1 => std::borrow::Cow::Borrowed("INT64"),
2647 2 => std::borrow::Cow::Borrowed("BOOL"),
2648 3 => std::borrow::Cow::Borrowed("STRING"),
2649 4 => std::borrow::Cow::Borrowed("DOUBLE"),
2650 _ => std::borrow::Cow::Owned(std::format!("UNKNOWN-VALUE:{}", self.0)),
2651 }
2652 }
2653
2654 /// Creates an enum value from the value name.
2655 pub fn from_str_name(name: &str) -> std::option::Option<Self> {
2656 match name {
2657 "UNSPECIFIED" => std::option::Option::Some(Self::UNSPECIFIED),
2658 "INT64" => std::option::Option::Some(Self::INT64),
2659 "BOOL" => std::option::Option::Some(Self::BOOL),
2660 "STRING" => std::option::Option::Some(Self::STRING),
2661 "DOUBLE" => std::option::Option::Some(Self::DOUBLE),
2662 _ => std::option::Option::None,
2663 }
2664 }
2665 }
2666
2667 impl std::convert::From<i32> for PropertyType {
2668 fn from(value: i32) -> Self {
2669 Self::new(value)
2670 }
2671 }
2672
2673 impl std::default::Default for PropertyType {
2674 fn default() -> Self {
2675 Self::new(0)
2676 }
2677 }
2678}
2679
2680/// `Context` defines which contexts an API requests.
2681///
2682/// Example:
2683///
2684/// ```norust
2685/// context:
2686/// rules:
2687/// - selector: "*"
2688/// requested:
2689/// - google.rpc.context.ProjectContext
2690/// - google.rpc.context.OriginContext
2691/// ```
2692///
2693/// The above specifies that all methods in the API request
2694/// `google.rpc.context.ProjectContext` and
2695/// `google.rpc.context.OriginContext`.
2696///
2697/// Available context types are defined in package
2698/// `google.rpc.context`.
2699///
2700/// This also provides mechanism to allowlist any protobuf message extension that
2701/// can be sent in grpc metadata using “x-goog-ext-<extension_id>-bin” and
2702/// “x-goog-ext-<extension_id>-jspb” format. For example, list any service
2703/// specific protobuf types that can appear in grpc metadata as follows in your
2704/// yaml file:
2705///
2706/// Example:
2707///
2708/// ```norust
2709/// context:
2710/// rules:
2711/// - selector: "google.example.library.v1.LibraryService.CreateBook"
2712/// allowed_request_extensions:
2713/// - google.foo.v1.NewExtension
2714/// allowed_response_extensions:
2715/// - google.foo.v1.NewExtension
2716/// ```
2717///
2718/// You can also specify extension ID instead of fully qualified extension name
2719/// here.
2720#[serde_with::serde_as]
2721#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
2722#[serde(default, rename_all = "camelCase")]
2723#[non_exhaustive]
2724pub struct Context {
2725 /// A list of RPC context rules that apply to individual API methods.
2726 ///
2727 /// **NOTE:** All service configuration rules follow "last one wins" order.
2728 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
2729 pub rules: std::vec::Vec<crate::model::ContextRule>,
2730
2731 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
2732 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2733}
2734
2735impl Context {
2736 pub fn new() -> Self {
2737 std::default::Default::default()
2738 }
2739
2740 /// Sets the value of [rules][crate::model::Context::rules].
2741 pub fn set_rules<T, V>(mut self, v: T) -> Self
2742 where
2743 T: std::iter::IntoIterator<Item = V>,
2744 V: std::convert::Into<crate::model::ContextRule>,
2745 {
2746 use std::iter::Iterator;
2747 self.rules = v.into_iter().map(|i| i.into()).collect();
2748 self
2749 }
2750}
2751
2752impl wkt::message::Message for Context {
2753 fn typename() -> &'static str {
2754 "type.googleapis.com/google.api.Context"
2755 }
2756}
2757
2758/// A context rule provides information about the context for an individual API
2759/// element.
2760#[serde_with::serde_as]
2761#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
2762#[serde(default, rename_all = "camelCase")]
2763#[non_exhaustive]
2764pub struct ContextRule {
2765 /// Selects the methods to which this rule applies.
2766 ///
2767 /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
2768 /// details.
2769 ///
2770 /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
2771 #[serde(skip_serializing_if = "std::string::String::is_empty")]
2772 pub selector: std::string::String,
2773
2774 /// A list of full type names of requested contexts, only the requested context
2775 /// will be made available to the backend.
2776 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
2777 pub requested: std::vec::Vec<std::string::String>,
2778
2779 /// A list of full type names of provided contexts. It is used to support
2780 /// propagating HTTP headers and ETags from the response extension.
2781 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
2782 pub provided: std::vec::Vec<std::string::String>,
2783
2784 /// A list of full type names or extension IDs of extensions allowed in grpc
2785 /// side channel from client to backend.
2786 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
2787 pub allowed_request_extensions: std::vec::Vec<std::string::String>,
2788
2789 /// A list of full type names or extension IDs of extensions allowed in grpc
2790 /// side channel from backend to client.
2791 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
2792 pub allowed_response_extensions: std::vec::Vec<std::string::String>,
2793
2794 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
2795 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2796}
2797
2798impl ContextRule {
2799 pub fn new() -> Self {
2800 std::default::Default::default()
2801 }
2802
2803 /// Sets the value of [selector][crate::model::ContextRule::selector].
2804 pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2805 self.selector = v.into();
2806 self
2807 }
2808
2809 /// Sets the value of [requested][crate::model::ContextRule::requested].
2810 pub fn set_requested<T, V>(mut self, v: T) -> Self
2811 where
2812 T: std::iter::IntoIterator<Item = V>,
2813 V: std::convert::Into<std::string::String>,
2814 {
2815 use std::iter::Iterator;
2816 self.requested = v.into_iter().map(|i| i.into()).collect();
2817 self
2818 }
2819
2820 /// Sets the value of [provided][crate::model::ContextRule::provided].
2821 pub fn set_provided<T, V>(mut self, v: T) -> Self
2822 where
2823 T: std::iter::IntoIterator<Item = V>,
2824 V: std::convert::Into<std::string::String>,
2825 {
2826 use std::iter::Iterator;
2827 self.provided = v.into_iter().map(|i| i.into()).collect();
2828 self
2829 }
2830
2831 /// Sets the value of [allowed_request_extensions][crate::model::ContextRule::allowed_request_extensions].
2832 pub fn set_allowed_request_extensions<T, V>(mut self, v: T) -> Self
2833 where
2834 T: std::iter::IntoIterator<Item = V>,
2835 V: std::convert::Into<std::string::String>,
2836 {
2837 use std::iter::Iterator;
2838 self.allowed_request_extensions = v.into_iter().map(|i| i.into()).collect();
2839 self
2840 }
2841
2842 /// Sets the value of [allowed_response_extensions][crate::model::ContextRule::allowed_response_extensions].
2843 pub fn set_allowed_response_extensions<T, V>(mut self, v: T) -> Self
2844 where
2845 T: std::iter::IntoIterator<Item = V>,
2846 V: std::convert::Into<std::string::String>,
2847 {
2848 use std::iter::Iterator;
2849 self.allowed_response_extensions = v.into_iter().map(|i| i.into()).collect();
2850 self
2851 }
2852}
2853
2854impl wkt::message::Message for ContextRule {
2855 fn typename() -> &'static str {
2856 "type.googleapis.com/google.api.ContextRule"
2857 }
2858}
2859
2860/// Selects and configures the service controller used by the service.
2861///
2862/// Example:
2863///
2864/// ```norust
2865/// control:
2866/// environment: servicecontrol.googleapis.com
2867/// ```
2868#[serde_with::serde_as]
2869#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
2870#[serde(default, rename_all = "camelCase")]
2871#[non_exhaustive]
2872pub struct Control {
2873 /// The service controller environment to use. If empty, no control plane
2874 /// feature (like quota and billing) will be enabled. The recommended value for
2875 /// most services is servicecontrol.googleapis.com
2876 #[serde(skip_serializing_if = "std::string::String::is_empty")]
2877 pub environment: std::string::String,
2878
2879 /// Defines policies applying to the API methods of the service.
2880 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
2881 pub method_policies: std::vec::Vec<crate::model::MethodPolicy>,
2882
2883 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
2884 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2885}
2886
2887impl Control {
2888 pub fn new() -> Self {
2889 std::default::Default::default()
2890 }
2891
2892 /// Sets the value of [environment][crate::model::Control::environment].
2893 pub fn set_environment<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2894 self.environment = v.into();
2895 self
2896 }
2897
2898 /// Sets the value of [method_policies][crate::model::Control::method_policies].
2899 pub fn set_method_policies<T, V>(mut self, v: T) -> Self
2900 where
2901 T: std::iter::IntoIterator<Item = V>,
2902 V: std::convert::Into<crate::model::MethodPolicy>,
2903 {
2904 use std::iter::Iterator;
2905 self.method_policies = v.into_iter().map(|i| i.into()).collect();
2906 self
2907 }
2908}
2909
2910impl wkt::message::Message for Control {
2911 fn typename() -> &'static str {
2912 "type.googleapis.com/google.api.Control"
2913 }
2914}
2915
2916/// `Distribution` contains summary statistics for a population of values. It
2917/// optionally contains a histogram representing the distribution of those values
2918/// across a set of buckets.
2919///
2920/// The summary statistics are the count, mean, sum of the squared deviation from
2921/// the mean, the minimum, and the maximum of the set of population of values.
2922/// The histogram is based on a sequence of buckets and gives a count of values
2923/// that fall into each bucket. The boundaries of the buckets are given either
2924/// explicitly or by formulas for buckets of fixed or exponentially increasing
2925/// widths.
2926///
2927/// Although it is not forbidden, it is generally a bad idea to include
2928/// non-finite values (infinities or NaNs) in the population of values, as this
2929/// will render the `mean` and `sum_of_squared_deviation` fields meaningless.
2930#[serde_with::serde_as]
2931#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
2932#[serde(default, rename_all = "camelCase")]
2933#[non_exhaustive]
2934pub struct Distribution {
2935 /// The number of values in the population. Must be non-negative. This value
2936 /// must equal the sum of the values in `bucket_counts` if a histogram is
2937 /// provided.
2938 #[serde_as(as = "serde_with::DisplayFromStr")]
2939 pub count: i64,
2940
2941 /// The arithmetic mean of the values in the population. If `count` is zero
2942 /// then this field must be zero.
2943 pub mean: f64,
2944
2945 /// The sum of squared deviations from the mean of the values in the
2946 /// population. For values x_i this is:
2947 ///
2948 /// ```norust
2949 /// Sum[i=1..n]((x_i - mean)^2)
2950 /// ```
2951 ///
2952 /// Knuth, "The Art of Computer Programming", Vol. 2, page 232, 3rd edition
2953 /// describes Welford's method for accumulating this sum in one pass.
2954 ///
2955 /// If `count` is zero then this field must be zero.
2956 pub sum_of_squared_deviation: f64,
2957
2958 /// If specified, contains the range of the population values. The field
2959 /// must not be present if the `count` is zero.
2960 #[serde(skip_serializing_if = "std::option::Option::is_none")]
2961 pub range: std::option::Option<crate::model::distribution::Range>,
2962
2963 /// Defines the histogram bucket boundaries. If the distribution does not
2964 /// contain a histogram, then omit this field.
2965 #[serde(skip_serializing_if = "std::option::Option::is_none")]
2966 pub bucket_options: std::option::Option<crate::model::distribution::BucketOptions>,
2967
2968 /// The number of values in each bucket of the histogram, as described in
2969 /// `bucket_options`. If the distribution does not have a histogram, then omit
2970 /// this field. If there is a histogram, then the sum of the values in
2971 /// `bucket_counts` must equal the value in the `count` field of the
2972 /// distribution.
2973 ///
2974 /// If present, `bucket_counts` should contain N values, where N is the number
2975 /// of buckets specified in `bucket_options`. If you supply fewer than N
2976 /// values, the remaining values are assumed to be 0.
2977 ///
2978 /// The order of the values in `bucket_counts` follows the bucket numbering
2979 /// schemes described for the three bucket types. The first value must be the
2980 /// count for the underflow bucket (number 0). The next N-2 values are the
2981 /// counts for the finite buckets (number 1 through N-2). The N'th value in
2982 /// `bucket_counts` is the count for the overflow bucket (number N-1).
2983 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
2984 #[serde_as(as = "std::vec::Vec<serde_with::DisplayFromStr>")]
2985 pub bucket_counts: std::vec::Vec<i64>,
2986
2987 /// Must be in increasing order of `value` field.
2988 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
2989 pub exemplars: std::vec::Vec<crate::model::distribution::Exemplar>,
2990
2991 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
2992 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2993}
2994
2995impl Distribution {
2996 pub fn new() -> Self {
2997 std::default::Default::default()
2998 }
2999
3000 /// Sets the value of [count][crate::model::Distribution::count].
3001 pub fn set_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
3002 self.count = v.into();
3003 self
3004 }
3005
3006 /// Sets the value of [mean][crate::model::Distribution::mean].
3007 pub fn set_mean<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
3008 self.mean = v.into();
3009 self
3010 }
3011
3012 /// Sets the value of [sum_of_squared_deviation][crate::model::Distribution::sum_of_squared_deviation].
3013 pub fn set_sum_of_squared_deviation<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
3014 self.sum_of_squared_deviation = v.into();
3015 self
3016 }
3017
3018 /// Sets the value of [range][crate::model::Distribution::range].
3019 pub fn set_range<
3020 T: std::convert::Into<std::option::Option<crate::model::distribution::Range>>,
3021 >(
3022 mut self,
3023 v: T,
3024 ) -> Self {
3025 self.range = v.into();
3026 self
3027 }
3028
3029 /// Sets the value of [bucket_options][crate::model::Distribution::bucket_options].
3030 pub fn set_bucket_options<
3031 T: std::convert::Into<std::option::Option<crate::model::distribution::BucketOptions>>,
3032 >(
3033 mut self,
3034 v: T,
3035 ) -> Self {
3036 self.bucket_options = v.into();
3037 self
3038 }
3039
3040 /// Sets the value of [bucket_counts][crate::model::Distribution::bucket_counts].
3041 pub fn set_bucket_counts<T, V>(mut self, v: T) -> Self
3042 where
3043 T: std::iter::IntoIterator<Item = V>,
3044 V: std::convert::Into<i64>,
3045 {
3046 use std::iter::Iterator;
3047 self.bucket_counts = v.into_iter().map(|i| i.into()).collect();
3048 self
3049 }
3050
3051 /// Sets the value of [exemplars][crate::model::Distribution::exemplars].
3052 pub fn set_exemplars<T, V>(mut self, v: T) -> Self
3053 where
3054 T: std::iter::IntoIterator<Item = V>,
3055 V: std::convert::Into<crate::model::distribution::Exemplar>,
3056 {
3057 use std::iter::Iterator;
3058 self.exemplars = v.into_iter().map(|i| i.into()).collect();
3059 self
3060 }
3061}
3062
3063impl wkt::message::Message for Distribution {
3064 fn typename() -> &'static str {
3065 "type.googleapis.com/google.api.Distribution"
3066 }
3067}
3068
3069/// Defines additional types related to [Distribution].
3070pub mod distribution {
3071 #[allow(unused_imports)]
3072 use super::*;
3073
3074 /// The range of the population values.
3075 #[serde_with::serde_as]
3076 #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
3077 #[serde(default, rename_all = "camelCase")]
3078 #[non_exhaustive]
3079 pub struct Range {
3080 /// The minimum of the population values.
3081 pub min: f64,
3082
3083 /// The maximum of the population values.
3084 pub max: f64,
3085
3086 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
3087 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3088 }
3089
3090 impl Range {
3091 pub fn new() -> Self {
3092 std::default::Default::default()
3093 }
3094
3095 /// Sets the value of [min][crate::model::distribution::Range::min].
3096 pub fn set_min<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
3097 self.min = v.into();
3098 self
3099 }
3100
3101 /// Sets the value of [max][crate::model::distribution::Range::max].
3102 pub fn set_max<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
3103 self.max = v.into();
3104 self
3105 }
3106 }
3107
3108 impl wkt::message::Message for Range {
3109 fn typename() -> &'static str {
3110 "type.googleapis.com/google.api.Distribution.Range"
3111 }
3112 }
3113
3114 /// `BucketOptions` describes the bucket boundaries used to create a histogram
3115 /// for the distribution. The buckets can be in a linear sequence, an
3116 /// exponential sequence, or each bucket can be specified explicitly.
3117 /// `BucketOptions` does not include the number of values in each bucket.
3118 ///
3119 /// A bucket has an inclusive lower bound and exclusive upper bound for the
3120 /// values that are counted for that bucket. The upper bound of a bucket must
3121 /// be strictly greater than the lower bound. The sequence of N buckets for a
3122 /// distribution consists of an underflow bucket (number 0), zero or more
3123 /// finite buckets (number 1 through N - 2) and an overflow bucket (number N -
3124 /// 1). The buckets are contiguous: the lower bound of bucket i (i > 0) is the
3125 /// same as the upper bound of bucket i - 1. The buckets span the whole range
3126 /// of finite values: lower bound of the underflow bucket is -infinity and the
3127 /// upper bound of the overflow bucket is +infinity. The finite buckets are
3128 /// so-called because both bounds are finite.
3129 #[serde_with::serde_as]
3130 #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
3131 #[serde(default, rename_all = "camelCase")]
3132 #[non_exhaustive]
3133 pub struct BucketOptions {
3134 /// Exactly one of these three fields must be set.
3135 #[serde(flatten, skip_serializing_if = "std::option::Option::is_none")]
3136 pub options: std::option::Option<crate::model::distribution::bucket_options::Options>,
3137
3138 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
3139 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3140 }
3141
3142 impl BucketOptions {
3143 pub fn new() -> Self {
3144 std::default::Default::default()
3145 }
3146
3147 /// Sets the value of [options][crate::model::distribution::BucketOptions::options].
3148 ///
3149 /// Note that all the setters affecting `options` are mutually
3150 /// exclusive.
3151 pub fn set_options<
3152 T: std::convert::Into<
3153 std::option::Option<crate::model::distribution::bucket_options::Options>,
3154 >,
3155 >(
3156 mut self,
3157 v: T,
3158 ) -> Self {
3159 self.options = v.into();
3160 self
3161 }
3162
3163 /// The value of [options][crate::model::distribution::BucketOptions::options]
3164 /// if it holds a `LinearBuckets`, `None` if the field is not set or
3165 /// holds a different branch.
3166 pub fn linear_buckets(
3167 &self,
3168 ) -> std::option::Option<&std::boxed::Box<crate::model::distribution::bucket_options::Linear>>
3169 {
3170 #[allow(unreachable_patterns)]
3171 self.options.as_ref().and_then(|v| match v {
3172 crate::model::distribution::bucket_options::Options::LinearBuckets(v) => {
3173 std::option::Option::Some(v)
3174 }
3175 _ => std::option::Option::None,
3176 })
3177 }
3178
3179 /// The value of [options][crate::model::distribution::BucketOptions::options]
3180 /// if it holds a `ExponentialBuckets`, `None` if the field is not set or
3181 /// holds a different branch.
3182 pub fn exponential_buckets(
3183 &self,
3184 ) -> std::option::Option<
3185 &std::boxed::Box<crate::model::distribution::bucket_options::Exponential>,
3186 > {
3187 #[allow(unreachable_patterns)]
3188 self.options.as_ref().and_then(|v| match v {
3189 crate::model::distribution::bucket_options::Options::ExponentialBuckets(v) => {
3190 std::option::Option::Some(v)
3191 }
3192 _ => std::option::Option::None,
3193 })
3194 }
3195
3196 /// The value of [options][crate::model::distribution::BucketOptions::options]
3197 /// if it holds a `ExplicitBuckets`, `None` if the field is not set or
3198 /// holds a different branch.
3199 pub fn explicit_buckets(
3200 &self,
3201 ) -> std::option::Option<
3202 &std::boxed::Box<crate::model::distribution::bucket_options::Explicit>,
3203 > {
3204 #[allow(unreachable_patterns)]
3205 self.options.as_ref().and_then(|v| match v {
3206 crate::model::distribution::bucket_options::Options::ExplicitBuckets(v) => {
3207 std::option::Option::Some(v)
3208 }
3209 _ => std::option::Option::None,
3210 })
3211 }
3212
3213 /// Sets the value of [options][crate::model::distribution::BucketOptions::options]
3214 /// to hold a `LinearBuckets`.
3215 ///
3216 /// Note that all the setters affecting `options` are
3217 /// mutually exclusive.
3218 pub fn set_linear_buckets<
3219 T: std::convert::Into<std::boxed::Box<crate::model::distribution::bucket_options::Linear>>,
3220 >(
3221 mut self,
3222 v: T,
3223 ) -> Self {
3224 self.options = std::option::Option::Some(
3225 crate::model::distribution::bucket_options::Options::LinearBuckets(v.into()),
3226 );
3227 self
3228 }
3229
3230 /// Sets the value of [options][crate::model::distribution::BucketOptions::options]
3231 /// to hold a `ExponentialBuckets`.
3232 ///
3233 /// Note that all the setters affecting `options` are
3234 /// mutually exclusive.
3235 pub fn set_exponential_buckets<
3236 T: std::convert::Into<
3237 std::boxed::Box<crate::model::distribution::bucket_options::Exponential>,
3238 >,
3239 >(
3240 mut self,
3241 v: T,
3242 ) -> Self {
3243 self.options = std::option::Option::Some(
3244 crate::model::distribution::bucket_options::Options::ExponentialBuckets(v.into()),
3245 );
3246 self
3247 }
3248
3249 /// Sets the value of [options][crate::model::distribution::BucketOptions::options]
3250 /// to hold a `ExplicitBuckets`.
3251 ///
3252 /// Note that all the setters affecting `options` are
3253 /// mutually exclusive.
3254 pub fn set_explicit_buckets<
3255 T: std::convert::Into<
3256 std::boxed::Box<crate::model::distribution::bucket_options::Explicit>,
3257 >,
3258 >(
3259 mut self,
3260 v: T,
3261 ) -> Self {
3262 self.options = std::option::Option::Some(
3263 crate::model::distribution::bucket_options::Options::ExplicitBuckets(v.into()),
3264 );
3265 self
3266 }
3267 }
3268
3269 impl wkt::message::Message for BucketOptions {
3270 fn typename() -> &'static str {
3271 "type.googleapis.com/google.api.Distribution.BucketOptions"
3272 }
3273 }
3274
3275 /// Defines additional types related to [BucketOptions].
3276 pub mod bucket_options {
3277 #[allow(unused_imports)]
3278 use super::*;
3279
3280 /// Specifies a linear sequence of buckets that all have the same width
3281 /// (except overflow and underflow). Each bucket represents a constant
3282 /// absolute uncertainty on the specific value in the bucket.
3283 ///
3284 /// There are `num_finite_buckets + 2` (= N) buckets. Bucket `i` has the
3285 /// following boundaries:
3286 ///
3287 /// Upper bound (0 <= i < N-1): offset + (width * i).
3288 ///
3289 /// Lower bound (1 <= i < N): offset + (width * (i - 1)).
3290 #[serde_with::serde_as]
3291 #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
3292 #[serde(default, rename_all = "camelCase")]
3293 #[non_exhaustive]
3294 pub struct Linear {
3295 /// Must be greater than 0.
3296 pub num_finite_buckets: i32,
3297
3298 /// Must be greater than 0.
3299 pub width: f64,
3300
3301 /// Lower bound of the first bucket.
3302 pub offset: f64,
3303
3304 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
3305 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3306 }
3307
3308 impl Linear {
3309 pub fn new() -> Self {
3310 std::default::Default::default()
3311 }
3312
3313 /// Sets the value of [num_finite_buckets][crate::model::distribution::bucket_options::Linear::num_finite_buckets].
3314 pub fn set_num_finite_buckets<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3315 self.num_finite_buckets = v.into();
3316 self
3317 }
3318
3319 /// Sets the value of [width][crate::model::distribution::bucket_options::Linear::width].
3320 pub fn set_width<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
3321 self.width = v.into();
3322 self
3323 }
3324
3325 /// Sets the value of [offset][crate::model::distribution::bucket_options::Linear::offset].
3326 pub fn set_offset<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
3327 self.offset = v.into();
3328 self
3329 }
3330 }
3331
3332 impl wkt::message::Message for Linear {
3333 fn typename() -> &'static str {
3334 "type.googleapis.com/google.api.Distribution.BucketOptions.Linear"
3335 }
3336 }
3337
3338 /// Specifies an exponential sequence of buckets that have a width that is
3339 /// proportional to the value of the lower bound. Each bucket represents a
3340 /// constant relative uncertainty on a specific value in the bucket.
3341 ///
3342 /// There are `num_finite_buckets + 2` (= N) buckets. Bucket `i` has the
3343 /// following boundaries:
3344 ///
3345 /// Upper bound (0 <= i < N-1): scale * (growth_factor ^ i).
3346 ///
3347 /// Lower bound (1 <= i < N): scale * (growth_factor ^ (i - 1)).
3348 #[serde_with::serde_as]
3349 #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
3350 #[serde(default, rename_all = "camelCase")]
3351 #[non_exhaustive]
3352 pub struct Exponential {
3353 /// Must be greater than 0.
3354 pub num_finite_buckets: i32,
3355
3356 /// Must be greater than 1.
3357 pub growth_factor: f64,
3358
3359 /// Must be greater than 0.
3360 pub scale: f64,
3361
3362 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
3363 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3364 }
3365
3366 impl Exponential {
3367 pub fn new() -> Self {
3368 std::default::Default::default()
3369 }
3370
3371 /// Sets the value of [num_finite_buckets][crate::model::distribution::bucket_options::Exponential::num_finite_buckets].
3372 pub fn set_num_finite_buckets<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3373 self.num_finite_buckets = v.into();
3374 self
3375 }
3376
3377 /// Sets the value of [growth_factor][crate::model::distribution::bucket_options::Exponential::growth_factor].
3378 pub fn set_growth_factor<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
3379 self.growth_factor = v.into();
3380 self
3381 }
3382
3383 /// Sets the value of [scale][crate::model::distribution::bucket_options::Exponential::scale].
3384 pub fn set_scale<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
3385 self.scale = v.into();
3386 self
3387 }
3388 }
3389
3390 impl wkt::message::Message for Exponential {
3391 fn typename() -> &'static str {
3392 "type.googleapis.com/google.api.Distribution.BucketOptions.Exponential"
3393 }
3394 }
3395
3396 /// Specifies a set of buckets with arbitrary widths.
3397 ///
3398 /// There are `size(bounds) + 1` (= N) buckets. Bucket `i` has the following
3399 /// boundaries:
3400 ///
3401 /// Upper bound (0 <= i < N-1): bounds[i]
3402 /// Lower bound (1 <= i < N); bounds[i - 1]
3403 ///
3404 /// The `bounds` field must contain at least one element. If `bounds` has
3405 /// only one element, then there are no finite buckets, and that single
3406 /// element is the common boundary of the overflow and underflow buckets.
3407 #[serde_with::serde_as]
3408 #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
3409 #[serde(default, rename_all = "camelCase")]
3410 #[non_exhaustive]
3411 pub struct Explicit {
3412 /// The values must be monotonically increasing.
3413 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
3414 pub bounds: std::vec::Vec<f64>,
3415
3416 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
3417 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3418 }
3419
3420 impl Explicit {
3421 pub fn new() -> Self {
3422 std::default::Default::default()
3423 }
3424
3425 /// Sets the value of [bounds][crate::model::distribution::bucket_options::Explicit::bounds].
3426 pub fn set_bounds<T, V>(mut self, v: T) -> Self
3427 where
3428 T: std::iter::IntoIterator<Item = V>,
3429 V: std::convert::Into<f64>,
3430 {
3431 use std::iter::Iterator;
3432 self.bounds = v.into_iter().map(|i| i.into()).collect();
3433 self
3434 }
3435 }
3436
3437 impl wkt::message::Message for Explicit {
3438 fn typename() -> &'static str {
3439 "type.googleapis.com/google.api.Distribution.BucketOptions.Explicit"
3440 }
3441 }
3442
3443 /// Exactly one of these three fields must be set.
3444 #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
3445 #[serde(rename_all = "camelCase")]
3446 #[non_exhaustive]
3447 pub enum Options {
3448 /// The linear bucket.
3449 LinearBuckets(std::boxed::Box<crate::model::distribution::bucket_options::Linear>),
3450 /// The exponential buckets.
3451 ExponentialBuckets(
3452 std::boxed::Box<crate::model::distribution::bucket_options::Exponential>,
3453 ),
3454 /// The explicit buckets.
3455 ExplicitBuckets(std::boxed::Box<crate::model::distribution::bucket_options::Explicit>),
3456 }
3457 }
3458
3459 /// Exemplars are example points that may be used to annotate aggregated
3460 /// distribution values. They are metadata that gives information about a
3461 /// particular value added to a Distribution bucket, such as a trace ID that
3462 /// was active when a value was added. They may contain further information,
3463 /// such as a example values and timestamps, origin, etc.
3464 #[serde_with::serde_as]
3465 #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
3466 #[serde(default, rename_all = "camelCase")]
3467 #[non_exhaustive]
3468 pub struct Exemplar {
3469 /// Value of the exemplar point. This value determines to which bucket the
3470 /// exemplar belongs.
3471 pub value: f64,
3472
3473 /// The observation (sampling) time of the above value.
3474 #[serde(skip_serializing_if = "std::option::Option::is_none")]
3475 pub timestamp: std::option::Option<wkt::Timestamp>,
3476
3477 /// Contextual information about the example value. Examples are:
3478 ///
3479 /// Trace: type.googleapis.com/google.monitoring.v3.SpanContext
3480 ///
3481 /// Literal string: type.googleapis.com/google.protobuf.StringValue
3482 ///
3483 /// Labels dropped during aggregation:
3484 /// type.googleapis.com/google.monitoring.v3.DroppedLabels
3485 ///
3486 /// There may be only a single attachment of any given message type in a
3487 /// single exemplar, and this is enforced by the system.
3488 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
3489 pub attachments: std::vec::Vec<wkt::Any>,
3490
3491 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
3492 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3493 }
3494
3495 impl Exemplar {
3496 pub fn new() -> Self {
3497 std::default::Default::default()
3498 }
3499
3500 /// Sets the value of [value][crate::model::distribution::Exemplar::value].
3501 pub fn set_value<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
3502 self.value = v.into();
3503 self
3504 }
3505
3506 /// Sets the value of [timestamp][crate::model::distribution::Exemplar::timestamp].
3507 pub fn set_timestamp<T: std::convert::Into<std::option::Option<wkt::Timestamp>>>(
3508 mut self,
3509 v: T,
3510 ) -> Self {
3511 self.timestamp = v.into();
3512 self
3513 }
3514
3515 /// Sets the value of [attachments][crate::model::distribution::Exemplar::attachments].
3516 pub fn set_attachments<T, V>(mut self, v: T) -> Self
3517 where
3518 T: std::iter::IntoIterator<Item = V>,
3519 V: std::convert::Into<wkt::Any>,
3520 {
3521 use std::iter::Iterator;
3522 self.attachments = v.into_iter().map(|i| i.into()).collect();
3523 self
3524 }
3525 }
3526
3527 impl wkt::message::Message for Exemplar {
3528 fn typename() -> &'static str {
3529 "type.googleapis.com/google.api.Distribution.Exemplar"
3530 }
3531 }
3532}
3533
3534/// `Documentation` provides the information for describing a service.
3535///
3536/// Example:
3537///
3538/// Documentation is provided in markdown syntax. In addition to
3539/// standard markdown features, definition lists, tables and fenced
3540/// code blocks are supported. Section headers can be provided and are
3541/// interpreted relative to the section nesting of the context where
3542/// a documentation fragment is embedded.
3543///
3544/// Documentation from the IDL is merged with documentation defined
3545/// via the config at normalization time, where documentation provided
3546/// by config rules overrides IDL provided.
3547///
3548/// A number of constructs specific to the API platform are supported
3549/// in documentation text.
3550///
3551/// In order to reference a proto element, the following
3552/// notation can be used:
3553///
3554/// To override the display text used for the link, this can be used:
3555///
3556/// Text can be excluded from doc using the following notation:
3557///
3558/// A few directives are available in documentation. Note that
3559/// directives must appear on a single line to be properly
3560/// identified. The `include` directive includes a markdown file from
3561/// an external source:
3562///
3563/// The `resource_for` directive marks a message to be the resource of
3564/// a collection in REST view. If it is not specified, tools attempt
3565/// to infer the resource from the operations in a collection:
3566///
3567/// The directive `suppress_warning` does not directly affect documentation
3568/// and is documented together with service config validation.
3569#[serde_with::serde_as]
3570#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
3571#[serde(default, rename_all = "camelCase")]
3572#[non_exhaustive]
3573pub struct Documentation {
3574 /// A short description of what the service does. The summary must be plain
3575 /// text. It becomes the overview of the service displayed in Google Cloud
3576 /// Console.
3577 /// NOTE: This field is equivalent to the standard field `description`.
3578 #[serde(skip_serializing_if = "std::string::String::is_empty")]
3579 pub summary: std::string::String,
3580
3581 /// The top level pages for the documentation set.
3582 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
3583 pub pages: std::vec::Vec<crate::model::Page>,
3584
3585 /// A list of documentation rules that apply to individual API elements.
3586 ///
3587 /// **NOTE:** All service configuration rules follow "last one wins" order.
3588 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
3589 pub rules: std::vec::Vec<crate::model::DocumentationRule>,
3590
3591 /// The URL to the root of documentation.
3592 #[serde(skip_serializing_if = "std::string::String::is_empty")]
3593 pub documentation_root_url: std::string::String,
3594
3595 /// Specifies the service root url if the default one (the service name
3596 /// from the yaml file) is not suitable. This can be seen in any fully
3597 /// specified service urls as well as sections that show a base that other
3598 /// urls are relative to.
3599 #[serde(skip_serializing_if = "std::string::String::is_empty")]
3600 pub service_root_url: std::string::String,
3601
3602 /// Declares a single overview page. For example:
3603 ///
3604 /// This is a shortcut for the following declaration (using pages style):
3605 ///
3606 /// Note: you cannot specify both `overview` field and `pages` field.
3607 #[serde(skip_serializing_if = "std::string::String::is_empty")]
3608 pub overview: std::string::String,
3609
3610 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
3611 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3612}
3613
3614impl Documentation {
3615 pub fn new() -> Self {
3616 std::default::Default::default()
3617 }
3618
3619 /// Sets the value of [summary][crate::model::Documentation::summary].
3620 pub fn set_summary<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3621 self.summary = v.into();
3622 self
3623 }
3624
3625 /// Sets the value of [documentation_root_url][crate::model::Documentation::documentation_root_url].
3626 pub fn set_documentation_root_url<T: std::convert::Into<std::string::String>>(
3627 mut self,
3628 v: T,
3629 ) -> Self {
3630 self.documentation_root_url = v.into();
3631 self
3632 }
3633
3634 /// Sets the value of [service_root_url][crate::model::Documentation::service_root_url].
3635 pub fn set_service_root_url<T: std::convert::Into<std::string::String>>(
3636 mut self,
3637 v: T,
3638 ) -> Self {
3639 self.service_root_url = v.into();
3640 self
3641 }
3642
3643 /// Sets the value of [overview][crate::model::Documentation::overview].
3644 pub fn set_overview<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3645 self.overview = v.into();
3646 self
3647 }
3648
3649 /// Sets the value of [pages][crate::model::Documentation::pages].
3650 pub fn set_pages<T, V>(mut self, v: T) -> Self
3651 where
3652 T: std::iter::IntoIterator<Item = V>,
3653 V: std::convert::Into<crate::model::Page>,
3654 {
3655 use std::iter::Iterator;
3656 self.pages = v.into_iter().map(|i| i.into()).collect();
3657 self
3658 }
3659
3660 /// Sets the value of [rules][crate::model::Documentation::rules].
3661 pub fn set_rules<T, V>(mut self, v: T) -> Self
3662 where
3663 T: std::iter::IntoIterator<Item = V>,
3664 V: std::convert::Into<crate::model::DocumentationRule>,
3665 {
3666 use std::iter::Iterator;
3667 self.rules = v.into_iter().map(|i| i.into()).collect();
3668 self
3669 }
3670}
3671
3672impl wkt::message::Message for Documentation {
3673 fn typename() -> &'static str {
3674 "type.googleapis.com/google.api.Documentation"
3675 }
3676}
3677
3678/// A documentation rule provides information about individual API elements.
3679#[serde_with::serde_as]
3680#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
3681#[serde(default, rename_all = "camelCase")]
3682#[non_exhaustive]
3683pub struct DocumentationRule {
3684 /// The selector is a comma-separated list of patterns for any element such as
3685 /// a method, a field, an enum value. Each pattern is a qualified name of the
3686 /// element which may end in "*", indicating a wildcard. Wildcards are only
3687 /// allowed at the end and for a whole component of the qualified name,
3688 /// i.e. "foo.*" is ok, but not "foo.b*" or "foo.*.bar". A wildcard will match
3689 /// one or more components. To specify a default for all applicable elements,
3690 /// the whole pattern "*" is used.
3691 #[serde(skip_serializing_if = "std::string::String::is_empty")]
3692 pub selector: std::string::String,
3693
3694 /// Description of the selected proto element (e.g. a message, a method, a
3695 /// 'service' definition, or a field). Defaults to leading & trailing comments
3696 /// taken from the proto source definition of the proto element.
3697 #[serde(skip_serializing_if = "std::string::String::is_empty")]
3698 pub description: std::string::String,
3699
3700 /// Deprecation description of the selected element(s). It can be provided if
3701 /// an element is marked as `deprecated`.
3702 #[serde(skip_serializing_if = "std::string::String::is_empty")]
3703 pub deprecation_description: std::string::String,
3704
3705 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
3706 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3707}
3708
3709impl DocumentationRule {
3710 pub fn new() -> Self {
3711 std::default::Default::default()
3712 }
3713
3714 /// Sets the value of [selector][crate::model::DocumentationRule::selector].
3715 pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3716 self.selector = v.into();
3717 self
3718 }
3719
3720 /// Sets the value of [description][crate::model::DocumentationRule::description].
3721 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3722 self.description = v.into();
3723 self
3724 }
3725
3726 /// Sets the value of [deprecation_description][crate::model::DocumentationRule::deprecation_description].
3727 pub fn set_deprecation_description<T: std::convert::Into<std::string::String>>(
3728 mut self,
3729 v: T,
3730 ) -> Self {
3731 self.deprecation_description = v.into();
3732 self
3733 }
3734}
3735
3736impl wkt::message::Message for DocumentationRule {
3737 fn typename() -> &'static str {
3738 "type.googleapis.com/google.api.DocumentationRule"
3739 }
3740}
3741
3742/// Represents a documentation page. A page can contain subpages to represent
3743/// nested documentation set structure.
3744#[serde_with::serde_as]
3745#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
3746#[serde(default, rename_all = "camelCase")]
3747#[non_exhaustive]
3748pub struct Page {
3749 /// The name of the page. It will be used as an identity of the page to
3750 /// generate URI of the page, text of the link to this page in navigation,
3751 /// etc. The full page name (start from the root page name to this page
3752 /// concatenated with `.`) can be used as reference to the page in your
3753 /// documentation. For example:
3754 ///
3755 /// You can reference `Java` page using Markdown reference link syntax:
3756 /// `[Java][Tutorial.Java]`.
3757 #[serde(skip_serializing_if = "std::string::String::is_empty")]
3758 pub name: std::string::String,
3759
3760 /// The Markdown content of the page. You can use ```(== include {path}
3761 /// ==)``` to include content from a Markdown file. The content can be used
3762 /// to produce the documentation page such as HTML format page.
3763 #[serde(skip_serializing_if = "std::string::String::is_empty")]
3764 pub content: std::string::String,
3765
3766 /// Subpages of this page. The order of subpages specified here will be
3767 /// honored in the generated docset.
3768 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
3769 pub subpages: std::vec::Vec<crate::model::Page>,
3770
3771 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
3772 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3773}
3774
3775impl Page {
3776 pub fn new() -> Self {
3777 std::default::Default::default()
3778 }
3779
3780 /// Sets the value of [name][crate::model::Page::name].
3781 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3782 self.name = v.into();
3783 self
3784 }
3785
3786 /// Sets the value of [content][crate::model::Page::content].
3787 pub fn set_content<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3788 self.content = v.into();
3789 self
3790 }
3791
3792 /// Sets the value of [subpages][crate::model::Page::subpages].
3793 pub fn set_subpages<T, V>(mut self, v: T) -> Self
3794 where
3795 T: std::iter::IntoIterator<Item = V>,
3796 V: std::convert::Into<crate::model::Page>,
3797 {
3798 use std::iter::Iterator;
3799 self.subpages = v.into_iter().map(|i| i.into()).collect();
3800 self
3801 }
3802}
3803
3804impl wkt::message::Message for Page {
3805 fn typename() -> &'static str {
3806 "type.googleapis.com/google.api.Page"
3807 }
3808}
3809
3810/// `Endpoint` describes a network address of a service that serves a set of
3811/// APIs. It is commonly known as a service endpoint. A service may expose
3812/// any number of service endpoints, and all service endpoints share the same
3813/// service definition, such as quota limits and monitoring metrics.
3814///
3815/// Example:
3816///
3817/// ```norust
3818/// type: google.api.Service
3819/// name: library-example.googleapis.com
3820/// endpoints:
3821/// # Declares network address `https://library-example.googleapis.com`
3822/// # for service `library-example.googleapis.com`. The `https` scheme
3823/// # is implicit for all service endpoints. Other schemes may be
3824/// # supported in the future.
3825/// - name: library-example.googleapis.com
3826/// allow_cors: false
3827/// - name: content-staging-library-example.googleapis.com
3828/// # Allows HTTP OPTIONS calls to be passed to the API frontend, for it
3829/// # to decide whether the subsequent cross-origin request is allowed
3830/// # to proceed.
3831/// allow_cors: true
3832/// ```
3833#[serde_with::serde_as]
3834#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
3835#[serde(default, rename_all = "camelCase")]
3836#[non_exhaustive]
3837pub struct Endpoint {
3838 /// The canonical name of this endpoint.
3839 #[serde(skip_serializing_if = "std::string::String::is_empty")]
3840 pub name: std::string::String,
3841
3842 /// Aliases for this endpoint, these will be served by the same UrlMap as the
3843 /// parent endpoint, and will be provisioned in the GCP stack for the Regional
3844 /// Endpoints.
3845 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
3846 pub aliases: std::vec::Vec<std::string::String>,
3847
3848 /// The specification of an Internet routable address of API frontend that will
3849 /// handle requests to this [API
3850 /// Endpoint](https://cloud.google.com/apis/design/glossary). It should be
3851 /// either a valid IPv4 address or a fully-qualified domain name. For example,
3852 /// "8.8.8.8" or "myservice.appspot.com".
3853 #[serde(skip_serializing_if = "std::string::String::is_empty")]
3854 pub target: std::string::String,
3855
3856 /// Allowing
3857 /// [CORS](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing), aka
3858 /// cross-domain traffic, would allow the backends served from this endpoint to
3859 /// receive and respond to HTTP OPTIONS requests. The response will be used by
3860 /// the browser to determine whether the subsequent cross-origin request is
3861 /// allowed to proceed.
3862 pub allow_cors: bool,
3863
3864 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
3865 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3866}
3867
3868impl Endpoint {
3869 pub fn new() -> Self {
3870 std::default::Default::default()
3871 }
3872
3873 /// Sets the value of [name][crate::model::Endpoint::name].
3874 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3875 self.name = v.into();
3876 self
3877 }
3878
3879 /// Sets the value of [target][crate::model::Endpoint::target].
3880 pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3881 self.target = v.into();
3882 self
3883 }
3884
3885 /// Sets the value of [allow_cors][crate::model::Endpoint::allow_cors].
3886 pub fn set_allow_cors<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3887 self.allow_cors = v.into();
3888 self
3889 }
3890
3891 /// Sets the value of [aliases][crate::model::Endpoint::aliases].
3892 pub fn set_aliases<T, V>(mut self, v: T) -> Self
3893 where
3894 T: std::iter::IntoIterator<Item = V>,
3895 V: std::convert::Into<std::string::String>,
3896 {
3897 use std::iter::Iterator;
3898 self.aliases = v.into_iter().map(|i| i.into()).collect();
3899 self
3900 }
3901}
3902
3903impl wkt::message::Message for Endpoint {
3904 fn typename() -> &'static str {
3905 "type.googleapis.com/google.api.Endpoint"
3906 }
3907}
3908
3909/// Rich semantic information of an API field beyond basic typing.
3910#[serde_with::serde_as]
3911#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
3912#[serde(default, rename_all = "camelCase")]
3913#[non_exhaustive]
3914pub struct FieldInfo {
3915 /// The standard format of a field value. This does not explicitly configure
3916 /// any API consumer, just documents the API's format for the field it is
3917 /// applied to.
3918 pub format: crate::model::field_info::Format,
3919
3920 /// The type(s) that the annotated, generic field may represent.
3921 ///
3922 /// Currently, this must only be used on fields of type `google.protobuf.Any`.
3923 /// Supporting other generic types may be considered in the future.
3924 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
3925 pub referenced_types: std::vec::Vec<crate::model::TypeReference>,
3926
3927 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
3928 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3929}
3930
3931impl FieldInfo {
3932 pub fn new() -> Self {
3933 std::default::Default::default()
3934 }
3935
3936 /// Sets the value of [format][crate::model::FieldInfo::format].
3937 pub fn set_format<T: std::convert::Into<crate::model::field_info::Format>>(
3938 mut self,
3939 v: T,
3940 ) -> Self {
3941 self.format = v.into();
3942 self
3943 }
3944
3945 /// Sets the value of [referenced_types][crate::model::FieldInfo::referenced_types].
3946 pub fn set_referenced_types<T, V>(mut self, v: T) -> Self
3947 where
3948 T: std::iter::IntoIterator<Item = V>,
3949 V: std::convert::Into<crate::model::TypeReference>,
3950 {
3951 use std::iter::Iterator;
3952 self.referenced_types = v.into_iter().map(|i| i.into()).collect();
3953 self
3954 }
3955}
3956
3957impl wkt::message::Message for FieldInfo {
3958 fn typename() -> &'static str {
3959 "type.googleapis.com/google.api.FieldInfo"
3960 }
3961}
3962
3963/// Defines additional types related to [FieldInfo].
3964pub mod field_info {
3965 #[allow(unused_imports)]
3966 use super::*;
3967
3968 /// The standard format of a field value. The supported formats are all backed
3969 /// by either an RFC defined by the IETF or a Google-defined AIP.
3970 #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
3971 pub struct Format(i32);
3972
3973 impl Format {
3974 /// Default, unspecified value.
3975 pub const FORMAT_UNSPECIFIED: Format = Format::new(0);
3976
3977 /// Universally Unique Identifier, version 4, value as defined by
3978 /// <https://datatracker.ietf.org/doc/html/rfc4122>. The value may be
3979 /// normalized to entirely lowercase letters. For example, the value
3980 /// `F47AC10B-58CC-0372-8567-0E02B2C3D479` would be normalized to
3981 /// `f47ac10b-58cc-0372-8567-0e02b2c3d479`.
3982 pub const UUID4: Format = Format::new(1);
3983
3984 /// Internet Protocol v4 value as defined by [RFC
3985 /// 791](https://datatracker.ietf.org/doc/html/rfc791). The value may be
3986 /// condensed, with leading zeros in each octet stripped. For example,
3987 /// `001.022.233.040` would be condensed to `1.22.233.40`.
3988 pub const IPV4: Format = Format::new(2);
3989
3990 /// Internet Protocol v6 value as defined by [RFC
3991 /// 2460](https://datatracker.ietf.org/doc/html/rfc2460). The value may be
3992 /// normalized to entirely lowercase letters with zeros compressed, following
3993 /// [RFC 5952](https://datatracker.ietf.org/doc/html/rfc5952). For example,
3994 /// the value `2001:0DB8:0::0` would be normalized to `2001:db8::`.
3995 pub const IPV6: Format = Format::new(3);
3996
3997 /// An IP address in either v4 or v6 format as described by the individual
3998 /// values defined herein. See the comments on the IPV4 and IPV6 types for
3999 /// allowed normalizations of each.
4000 pub const IPV4_OR_IPV6: Format = Format::new(4);
4001
4002 /// Creates a new Format instance.
4003 pub(crate) const fn new(value: i32) -> Self {
4004 Self(value)
4005 }
4006
4007 /// Gets the enum value.
4008 pub fn value(&self) -> i32 {
4009 self.0
4010 }
4011
4012 /// Gets the enum value as a string.
4013 pub fn as_str_name(&self) -> std::borrow::Cow<'static, str> {
4014 match self.0 {
4015 0 => std::borrow::Cow::Borrowed("FORMAT_UNSPECIFIED"),
4016 1 => std::borrow::Cow::Borrowed("UUID4"),
4017 2 => std::borrow::Cow::Borrowed("IPV4"),
4018 3 => std::borrow::Cow::Borrowed("IPV6"),
4019 4 => std::borrow::Cow::Borrowed("IPV4_OR_IPV6"),
4020 _ => std::borrow::Cow::Owned(std::format!("UNKNOWN-VALUE:{}", self.0)),
4021 }
4022 }
4023
4024 /// Creates an enum value from the value name.
4025 pub fn from_str_name(name: &str) -> std::option::Option<Self> {
4026 match name {
4027 "FORMAT_UNSPECIFIED" => std::option::Option::Some(Self::FORMAT_UNSPECIFIED),
4028 "UUID4" => std::option::Option::Some(Self::UUID4),
4029 "IPV4" => std::option::Option::Some(Self::IPV4),
4030 "IPV6" => std::option::Option::Some(Self::IPV6),
4031 "IPV4_OR_IPV6" => std::option::Option::Some(Self::IPV4_OR_IPV6),
4032 _ => std::option::Option::None,
4033 }
4034 }
4035 }
4036
4037 impl std::convert::From<i32> for Format {
4038 fn from(value: i32) -> Self {
4039 Self::new(value)
4040 }
4041 }
4042
4043 impl std::default::Default for Format {
4044 fn default() -> Self {
4045 Self::new(0)
4046 }
4047 }
4048}
4049
4050/// A reference to a message type, for use in [FieldInfo][google.api.FieldInfo].
4051///
4052/// [google.api.FieldInfo]: crate::model::FieldInfo
4053#[serde_with::serde_as]
4054#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
4055#[serde(default, rename_all = "camelCase")]
4056#[non_exhaustive]
4057pub struct TypeReference {
4058 /// The name of the type that the annotated, generic field may represent.
4059 /// If the type is in the same protobuf package, the value can be the simple
4060 /// message name e.g., `"MyMessage"`. Otherwise, the value must be the
4061 /// fully-qualified message name e.g., `"google.library.v1.Book"`.
4062 ///
4063 /// If the type(s) are unknown to the service (e.g. the field accepts generic
4064 /// user input), use the wildcard `"*"` to denote this behavior.
4065 ///
4066 /// See [AIP-202](https://google.aip.dev/202#type-references) for more details.
4067 #[serde(skip_serializing_if = "std::string::String::is_empty")]
4068 pub type_name: std::string::String,
4069
4070 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
4071 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4072}
4073
4074impl TypeReference {
4075 pub fn new() -> Self {
4076 std::default::Default::default()
4077 }
4078
4079 /// Sets the value of [type_name][crate::model::TypeReference::type_name].
4080 pub fn set_type_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4081 self.type_name = v.into();
4082 self
4083 }
4084}
4085
4086impl wkt::message::Message for TypeReference {
4087 fn typename() -> &'static str {
4088 "type.googleapis.com/google.api.TypeReference"
4089 }
4090}
4091
4092/// Defines the HTTP configuration for an API service. It contains a list of
4093/// [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method
4094/// to one or more HTTP REST API methods.
4095///
4096/// [google.api.HttpRule]: crate::model::HttpRule
4097#[serde_with::serde_as]
4098#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
4099#[serde(default, rename_all = "camelCase")]
4100#[non_exhaustive]
4101pub struct Http {
4102 /// A list of HTTP configuration rules that apply to individual API methods.
4103 ///
4104 /// **NOTE:** All service configuration rules follow "last one wins" order.
4105 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
4106 pub rules: std::vec::Vec<crate::model::HttpRule>,
4107
4108 /// When set to true, URL path parameters will be fully URI-decoded except in
4109 /// cases of single segment matches in reserved expansion, where "%2F" will be
4110 /// left encoded.
4111 ///
4112 /// The default behavior is to not decode RFC 6570 reserved characters in multi
4113 /// segment matches.
4114 pub fully_decode_reserved_expansion: bool,
4115
4116 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
4117 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4118}
4119
4120impl Http {
4121 pub fn new() -> Self {
4122 std::default::Default::default()
4123 }
4124
4125 /// Sets the value of [fully_decode_reserved_expansion][crate::model::Http::fully_decode_reserved_expansion].
4126 pub fn set_fully_decode_reserved_expansion<T: std::convert::Into<bool>>(
4127 mut self,
4128 v: T,
4129 ) -> Self {
4130 self.fully_decode_reserved_expansion = v.into();
4131 self
4132 }
4133
4134 /// Sets the value of [rules][crate::model::Http::rules].
4135 pub fn set_rules<T, V>(mut self, v: T) -> Self
4136 where
4137 T: std::iter::IntoIterator<Item = V>,
4138 V: std::convert::Into<crate::model::HttpRule>,
4139 {
4140 use std::iter::Iterator;
4141 self.rules = v.into_iter().map(|i| i.into()).collect();
4142 self
4143 }
4144}
4145
4146impl wkt::message::Message for Http {
4147 fn typename() -> &'static str {
4148 "type.googleapis.com/google.api.Http"
4149 }
4150}
4151
4152/// gRPC Transcoding
4153///
4154/// gRPC Transcoding is a feature for mapping between a gRPC method and one or
4155/// more HTTP REST endpoints. It allows developers to build a single API service
4156/// that supports both gRPC APIs and REST APIs. Many systems, including [Google
4157/// APIs](https://github.com/googleapis/googleapis),
4158/// [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC
4159/// Gateway](https://github.com/grpc-ecosystem/grpc-gateway),
4160/// and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature
4161/// and use it for large scale production services.
4162///
4163/// `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies
4164/// how different portions of the gRPC request message are mapped to the URL
4165/// path, URL query parameters, and HTTP request body. It also controls how the
4166/// gRPC response message is mapped to the HTTP response body. `HttpRule` is
4167/// typically specified as an `google.api.http` annotation on the gRPC method.
4168///
4169/// Each mapping specifies a URL path template and an HTTP method. The path
4170/// template may refer to one or more fields in the gRPC request message, as long
4171/// as each field is a non-repeated field with a primitive (non-message) type.
4172/// The path template controls how fields of the request message are mapped to
4173/// the URL path.
4174///
4175/// Example:
4176///
4177/// ```norust
4178/// service Messaging {
4179/// rpc GetMessage(GetMessageRequest) returns (Message) {
4180/// option (google.api.http) = {
4181/// get: "/v1/{name=messages/*}"
4182/// };
4183/// }
4184/// }
4185/// message GetMessageRequest {
4186/// string name = 1; // Mapped to URL path.
4187/// }
4188/// message Message {
4189/// string text = 1; // The resource content.
4190/// }
4191/// ```
4192///
4193/// This enables an HTTP REST to gRPC mapping as below:
4194///
4195/// - HTTP: `GET /v1/messages/123456`
4196/// - gRPC: `GetMessage(name: "messages/123456")`
4197///
4198/// Any fields in the request message which are not bound by the path template
4199/// automatically become HTTP query parameters if there is no HTTP request body.
4200/// For example:
4201///
4202/// ```norust
4203/// service Messaging {
4204/// rpc GetMessage(GetMessageRequest) returns (Message) {
4205/// option (google.api.http) = {
4206/// get:"/v1/messages/{message_id}"
4207/// };
4208/// }
4209/// }
4210/// message GetMessageRequest {
4211/// message SubMessage {
4212/// string subfield = 1;
4213/// }
4214/// string message_id = 1; // Mapped to URL path.
4215/// int64 revision = 2; // Mapped to URL query parameter `revision`.
4216/// SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`.
4217/// }
4218/// ```
4219///
4220/// This enables a HTTP JSON to RPC mapping as below:
4221///
4222/// - HTTP: `GET /v1/messages/123456?revision=2&sub.subfield=foo`
4223/// - gRPC: `GetMessage(message_id: "123456" revision: 2 sub:
4224/// SubMessage(subfield: "foo"))`
4225///
4226/// Note that fields which are mapped to URL query parameters must have a
4227/// primitive type or a repeated primitive type or a non-repeated message type.
4228/// In the case of a repeated type, the parameter can be repeated in the URL
4229/// as `...?param=A¶m=B`. In the case of a message type, each field of the
4230/// message is mapped to a separate parameter, such as
4231/// `...?foo.a=A&foo.b=B&foo.c=C`.
4232///
4233/// For HTTP methods that allow a request body, the `body` field
4234/// specifies the mapping. Consider a REST update method on the
4235/// message resource collection:
4236///
4237/// ```norust
4238/// service Messaging {
4239/// rpc UpdateMessage(UpdateMessageRequest) returns (Message) {
4240/// option (google.api.http) = {
4241/// patch: "/v1/messages/{message_id}"
4242/// body: "message"
4243/// };
4244/// }
4245/// }
4246/// message UpdateMessageRequest {
4247/// string message_id = 1; // mapped to the URL
4248/// Message message = 2; // mapped to the body
4249/// }
4250/// ```
4251///
4252/// The following HTTP JSON to RPC mapping is enabled, where the
4253/// representation of the JSON in the request body is determined by
4254/// protos JSON encoding:
4255///
4256/// - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }`
4257/// - gRPC: `UpdateMessage(message_id: "123456" message { text: "Hi!" })`
4258///
4259/// The special name `*` can be used in the body mapping to define that
4260/// every field not bound by the path template should be mapped to the
4261/// request body. This enables the following alternative definition of
4262/// the update method:
4263///
4264/// ```norust
4265/// service Messaging {
4266/// rpc UpdateMessage(Message) returns (Message) {
4267/// option (google.api.http) = {
4268/// patch: "/v1/messages/{message_id}"
4269/// body: "*"
4270/// };
4271/// }
4272/// }
4273/// message Message {
4274/// string message_id = 1;
4275/// string text = 2;
4276/// }
4277/// ```
4278///
4279/// The following HTTP JSON to RPC mapping is enabled:
4280///
4281/// - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }`
4282/// - gRPC: `UpdateMessage(message_id: "123456" text: "Hi!")`
4283///
4284/// Note that when using `*` in the body mapping, it is not possible to
4285/// have HTTP parameters, as all fields not bound by the path end in
4286/// the body. This makes this option more rarely used in practice when
4287/// defining REST APIs. The common usage of `*` is in custom methods
4288/// which don't use the URL at all for transferring data.
4289///
4290/// It is possible to define multiple HTTP methods for one RPC by using
4291/// the `additional_bindings` option. Example:
4292///
4293/// ```norust
4294/// service Messaging {
4295/// rpc GetMessage(GetMessageRequest) returns (Message) {
4296/// option (google.api.http) = {
4297/// get: "/v1/messages/{message_id}"
4298/// additional_bindings {
4299/// get: "/v1/users/{user_id}/messages/{message_id}"
4300/// }
4301/// };
4302/// }
4303/// }
4304/// message GetMessageRequest {
4305/// string message_id = 1;
4306/// string user_id = 2;
4307/// }
4308/// ```
4309///
4310/// This enables the following two alternative HTTP JSON to RPC mappings:
4311///
4312/// - HTTP: `GET /v1/messages/123456`
4313///
4314/// - gRPC: `GetMessage(message_id: "123456")`
4315///
4316/// - HTTP: `GET /v1/users/me/messages/123456`
4317///
4318/// - gRPC: `GetMessage(user_id: "me" message_id: "123456")`
4319///
4320///
4321/// Rules for HTTP mapping
4322///
4323/// . Leaf request fields (recursive expansion nested messages in the request
4324/// message) are classified into three categories:
4325/// - Fields referred by the path template. They are passed via the URL path.
4326/// - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They
4327/// are passed via the HTTP
4328/// request body.
4329/// - All other fields are passed via the URL query parameters, and the
4330/// parameter name is the field path in the request message. A repeated
4331/// field can be represented as multiple query parameters under the same
4332/// name.
4333/// . If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL
4334/// query parameter, all fields
4335/// are passed via URL path and HTTP request body.
4336/// . If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP
4337/// request body, all
4338/// fields are passed via URL path and URL query parameters.
4339///
4340/// Path template syntax
4341///
4342/// ```norust
4343/// Template = "/" Segments [ Verb ] ;
4344/// Segments = Segment { "/" Segment } ;
4345/// Segment = "*" | "**" | LITERAL | Variable ;
4346/// Variable = "{" FieldPath [ "=" Segments ] "}" ;
4347/// FieldPath = IDENT { "." IDENT } ;
4348/// Verb = ":" LITERAL ;
4349/// ```
4350///
4351/// The syntax `*` matches a single URL path segment. The syntax `**` matches
4352/// zero or more URL path segments, which must be the last part of the URL path
4353/// except the `Verb`.
4354///
4355/// The syntax `Variable` matches part of the URL path as specified by its
4356/// template. A variable template must not contain other variables. If a variable
4357/// matches a single path segment, its template may be omitted, e.g. `{var}`
4358/// is equivalent to `{var=*}`.
4359///
4360/// The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL`
4361/// contains any reserved character, such characters should be percent-encoded
4362/// before the matching.
4363///
4364/// If a variable contains exactly one path segment, such as `"{var}"` or
4365/// `"{var=*}"`, when such a variable is expanded into a URL path on the client
4366/// side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The
4367/// server side does the reverse decoding. Such variables show up in the
4368/// [Discovery
4369/// Document](https://developers.google.com/discovery/v1/reference/apis) as
4370/// `{var}`.
4371///
4372/// If a variable contains multiple path segments, such as `"{var=foo/*}"`
4373/// or `"{var=**}"`, when such a variable is expanded into a URL path on the
4374/// client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded.
4375/// The server side does the reverse decoding, except "%2F" and "%2f" are left
4376/// unchanged. Such variables show up in the
4377/// [Discovery
4378/// Document](https://developers.google.com/discovery/v1/reference/apis) as
4379/// `{+var}`.
4380///
4381/// Using gRPC API Service Configuration
4382///
4383/// gRPC API Service Configuration (service config) is a configuration language
4384/// for configuring a gRPC service to become a user-facing product. The
4385/// service config is simply the YAML representation of the `google.api.Service`
4386/// proto message.
4387///
4388/// As an alternative to annotating your proto file, you can configure gRPC
4389/// transcoding in your service config YAML files. You do this by specifying a
4390/// `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same
4391/// effect as the proto annotation. This can be particularly useful if you
4392/// have a proto that is reused in multiple services. Note that any transcoding
4393/// specified in the service config will override any matching transcoding
4394/// configuration in the proto.
4395///
4396/// The following example selects a gRPC method and applies an `HttpRule` to it:
4397///
4398/// ```norust
4399/// http:
4400/// rules:
4401/// - selector: example.v1.Messaging.GetMessage
4402/// get: /v1/messages/{message_id}/{sub.subfield}
4403/// ```
4404///
4405/// Special notes
4406///
4407/// When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the
4408/// proto to JSON conversion must follow the [proto3
4409/// specification](https://developers.google.com/protocol-buffers/docs/proto3#json).
4410///
4411/// While the single segment variable follows the semantics of
4412/// [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String
4413/// Expansion, the multi segment variable **does not** follow RFC 6570 Section
4414/// 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion
4415/// does not expand special characters like `?` and `#`, which would lead
4416/// to invalid URLs. As the result, gRPC Transcoding uses a custom encoding
4417/// for multi segment variables.
4418///
4419/// The path variables **must not** refer to any repeated or mapped field,
4420/// because client libraries are not capable of handling such variable expansion.
4421///
4422/// The path variables **must not** capture the leading "/" character. The reason
4423/// is that the most common use case "{var}" does not capture the leading "/"
4424/// character. For consistency, all path variables must share the same behavior.
4425///
4426/// Repeated message fields must not be mapped to URL query parameters, because
4427/// no client library can support such complicated mapping.
4428///
4429/// If an API needs to use a JSON array for request or response body, it can map
4430/// the request or response body to a repeated field. However, some gRPC
4431/// Transcoding implementations may not support this feature.
4432///
4433/// [google.api.HttpRule.body]: crate::model::HttpRule::body
4434#[serde_with::serde_as]
4435#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
4436#[serde(default, rename_all = "camelCase")]
4437#[non_exhaustive]
4438pub struct HttpRule {
4439 /// Selects a method to which this rule applies.
4440 ///
4441 /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
4442 /// details.
4443 ///
4444 /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
4445 #[serde(skip_serializing_if = "std::string::String::is_empty")]
4446 pub selector: std::string::String,
4447
4448 /// The name of the request field whose value is mapped to the HTTP request
4449 /// body, or `*` for mapping all request fields not captured by the path
4450 /// pattern to the HTTP body, or omitted for not having any HTTP request body.
4451 ///
4452 /// NOTE: the referred field must be present at the top-level of the request
4453 /// message type.
4454 #[serde(skip_serializing_if = "std::string::String::is_empty")]
4455 pub body: std::string::String,
4456
4457 /// Optional. The name of the response field whose value is mapped to the HTTP
4458 /// response body. When omitted, the entire response message will be used
4459 /// as the HTTP response body.
4460 ///
4461 /// NOTE: The referred field must be present at the top-level of the response
4462 /// message type.
4463 #[serde(skip_serializing_if = "std::string::String::is_empty")]
4464 pub response_body: std::string::String,
4465
4466 /// Additional HTTP bindings for the selector. Nested bindings must
4467 /// not contain an `additional_bindings` field themselves (that is,
4468 /// the nesting may only be one level deep).
4469 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
4470 pub additional_bindings: std::vec::Vec<crate::model::HttpRule>,
4471
4472 /// Determines the URL pattern is matched by this rules. This pattern can be
4473 /// used with any of the {get|put|post|delete|patch} methods. A custom method
4474 /// can be defined using the 'custom' field.
4475 #[serde(flatten, skip_serializing_if = "std::option::Option::is_none")]
4476 pub pattern: std::option::Option<crate::model::http_rule::Pattern>,
4477
4478 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
4479 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4480}
4481
4482impl HttpRule {
4483 pub fn new() -> Self {
4484 std::default::Default::default()
4485 }
4486
4487 /// Sets the value of [selector][crate::model::HttpRule::selector].
4488 pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4489 self.selector = v.into();
4490 self
4491 }
4492
4493 /// Sets the value of [body][crate::model::HttpRule::body].
4494 pub fn set_body<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4495 self.body = v.into();
4496 self
4497 }
4498
4499 /// Sets the value of [response_body][crate::model::HttpRule::response_body].
4500 pub fn set_response_body<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4501 self.response_body = v.into();
4502 self
4503 }
4504
4505 /// Sets the value of [additional_bindings][crate::model::HttpRule::additional_bindings].
4506 pub fn set_additional_bindings<T, V>(mut self, v: T) -> Self
4507 where
4508 T: std::iter::IntoIterator<Item = V>,
4509 V: std::convert::Into<crate::model::HttpRule>,
4510 {
4511 use std::iter::Iterator;
4512 self.additional_bindings = v.into_iter().map(|i| i.into()).collect();
4513 self
4514 }
4515
4516 /// Sets the value of [pattern][crate::model::HttpRule::pattern].
4517 ///
4518 /// Note that all the setters affecting `pattern` are mutually
4519 /// exclusive.
4520 pub fn set_pattern<
4521 T: std::convert::Into<std::option::Option<crate::model::http_rule::Pattern>>,
4522 >(
4523 mut self,
4524 v: T,
4525 ) -> Self {
4526 self.pattern = v.into();
4527 self
4528 }
4529
4530 /// The value of [pattern][crate::model::HttpRule::pattern]
4531 /// if it holds a `Get`, `None` if the field is not set or
4532 /// holds a different branch.
4533 pub fn get(&self) -> std::option::Option<&std::string::String> {
4534 #[allow(unreachable_patterns)]
4535 self.pattern.as_ref().and_then(|v| match v {
4536 crate::model::http_rule::Pattern::Get(v) => std::option::Option::Some(v),
4537 _ => std::option::Option::None,
4538 })
4539 }
4540
4541 /// The value of [pattern][crate::model::HttpRule::pattern]
4542 /// if it holds a `Put`, `None` if the field is not set or
4543 /// holds a different branch.
4544 pub fn put(&self) -> std::option::Option<&std::string::String> {
4545 #[allow(unreachable_patterns)]
4546 self.pattern.as_ref().and_then(|v| match v {
4547 crate::model::http_rule::Pattern::Put(v) => std::option::Option::Some(v),
4548 _ => std::option::Option::None,
4549 })
4550 }
4551
4552 /// The value of [pattern][crate::model::HttpRule::pattern]
4553 /// if it holds a `Post`, `None` if the field is not set or
4554 /// holds a different branch.
4555 pub fn post(&self) -> std::option::Option<&std::string::String> {
4556 #[allow(unreachable_patterns)]
4557 self.pattern.as_ref().and_then(|v| match v {
4558 crate::model::http_rule::Pattern::Post(v) => std::option::Option::Some(v),
4559 _ => std::option::Option::None,
4560 })
4561 }
4562
4563 /// The value of [pattern][crate::model::HttpRule::pattern]
4564 /// if it holds a `Delete`, `None` if the field is not set or
4565 /// holds a different branch.
4566 pub fn delete(&self) -> std::option::Option<&std::string::String> {
4567 #[allow(unreachable_patterns)]
4568 self.pattern.as_ref().and_then(|v| match v {
4569 crate::model::http_rule::Pattern::Delete(v) => std::option::Option::Some(v),
4570 _ => std::option::Option::None,
4571 })
4572 }
4573
4574 /// The value of [pattern][crate::model::HttpRule::pattern]
4575 /// if it holds a `Patch`, `None` if the field is not set or
4576 /// holds a different branch.
4577 pub fn patch(&self) -> std::option::Option<&std::string::String> {
4578 #[allow(unreachable_patterns)]
4579 self.pattern.as_ref().and_then(|v| match v {
4580 crate::model::http_rule::Pattern::Patch(v) => std::option::Option::Some(v),
4581 _ => std::option::Option::None,
4582 })
4583 }
4584
4585 /// The value of [pattern][crate::model::HttpRule::pattern]
4586 /// if it holds a `Custom`, `None` if the field is not set or
4587 /// holds a different branch.
4588 pub fn custom(&self) -> std::option::Option<&std::boxed::Box<crate::model::CustomHttpPattern>> {
4589 #[allow(unreachable_patterns)]
4590 self.pattern.as_ref().and_then(|v| match v {
4591 crate::model::http_rule::Pattern::Custom(v) => std::option::Option::Some(v),
4592 _ => std::option::Option::None,
4593 })
4594 }
4595
4596 /// Sets the value of [pattern][crate::model::HttpRule::pattern]
4597 /// to hold a `Get`.
4598 ///
4599 /// Note that all the setters affecting `pattern` are
4600 /// mutually exclusive.
4601 pub fn set_get<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4602 self.pattern = std::option::Option::Some(crate::model::http_rule::Pattern::Get(v.into()));
4603 self
4604 }
4605
4606 /// Sets the value of [pattern][crate::model::HttpRule::pattern]
4607 /// to hold a `Put`.
4608 ///
4609 /// Note that all the setters affecting `pattern` are
4610 /// mutually exclusive.
4611 pub fn set_put<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4612 self.pattern = std::option::Option::Some(crate::model::http_rule::Pattern::Put(v.into()));
4613 self
4614 }
4615
4616 /// Sets the value of [pattern][crate::model::HttpRule::pattern]
4617 /// to hold a `Post`.
4618 ///
4619 /// Note that all the setters affecting `pattern` are
4620 /// mutually exclusive.
4621 pub fn set_post<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4622 self.pattern = std::option::Option::Some(crate::model::http_rule::Pattern::Post(v.into()));
4623 self
4624 }
4625
4626 /// Sets the value of [pattern][crate::model::HttpRule::pattern]
4627 /// to hold a `Delete`.
4628 ///
4629 /// Note that all the setters affecting `pattern` are
4630 /// mutually exclusive.
4631 pub fn set_delete<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4632 self.pattern =
4633 std::option::Option::Some(crate::model::http_rule::Pattern::Delete(v.into()));
4634 self
4635 }
4636
4637 /// Sets the value of [pattern][crate::model::HttpRule::pattern]
4638 /// to hold a `Patch`.
4639 ///
4640 /// Note that all the setters affecting `pattern` are
4641 /// mutually exclusive.
4642 pub fn set_patch<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4643 self.pattern = std::option::Option::Some(crate::model::http_rule::Pattern::Patch(v.into()));
4644 self
4645 }
4646
4647 /// Sets the value of [pattern][crate::model::HttpRule::pattern]
4648 /// to hold a `Custom`.
4649 ///
4650 /// Note that all the setters affecting `pattern` are
4651 /// mutually exclusive.
4652 pub fn set_custom<T: std::convert::Into<std::boxed::Box<crate::model::CustomHttpPattern>>>(
4653 mut self,
4654 v: T,
4655 ) -> Self {
4656 self.pattern =
4657 std::option::Option::Some(crate::model::http_rule::Pattern::Custom(v.into()));
4658 self
4659 }
4660}
4661
4662impl wkt::message::Message for HttpRule {
4663 fn typename() -> &'static str {
4664 "type.googleapis.com/google.api.HttpRule"
4665 }
4666}
4667
4668/// Defines additional types related to [HttpRule].
4669pub mod http_rule {
4670 #[allow(unused_imports)]
4671 use super::*;
4672
4673 /// Determines the URL pattern is matched by this rules. This pattern can be
4674 /// used with any of the {get|put|post|delete|patch} methods. A custom method
4675 /// can be defined using the 'custom' field.
4676 #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
4677 #[serde(rename_all = "camelCase")]
4678 #[non_exhaustive]
4679 pub enum Pattern {
4680 /// Maps to HTTP GET. Used for listing and getting information about
4681 /// resources.
4682 Get(std::string::String),
4683 /// Maps to HTTP PUT. Used for replacing a resource.
4684 Put(std::string::String),
4685 /// Maps to HTTP POST. Used for creating a resource or performing an action.
4686 Post(std::string::String),
4687 /// Maps to HTTP DELETE. Used for deleting a resource.
4688 Delete(std::string::String),
4689 /// Maps to HTTP PATCH. Used for updating a resource.
4690 Patch(std::string::String),
4691 /// The custom pattern is used for specifying an HTTP method that is not
4692 /// included in the `pattern` field, such as HEAD, or "*" to leave the
4693 /// HTTP method unspecified for this rule. The wild-card rule is useful
4694 /// for services that provide content to Web (HTML) clients.
4695 Custom(std::boxed::Box<crate::model::CustomHttpPattern>),
4696 }
4697}
4698
4699/// A custom pattern is used for defining custom HTTP verb.
4700#[serde_with::serde_as]
4701#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
4702#[serde(default, rename_all = "camelCase")]
4703#[non_exhaustive]
4704pub struct CustomHttpPattern {
4705 /// The name of this custom HTTP verb.
4706 #[serde(skip_serializing_if = "std::string::String::is_empty")]
4707 pub kind: std::string::String,
4708
4709 /// The path matched by this custom verb.
4710 #[serde(skip_serializing_if = "std::string::String::is_empty")]
4711 pub path: std::string::String,
4712
4713 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
4714 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4715}
4716
4717impl CustomHttpPattern {
4718 pub fn new() -> Self {
4719 std::default::Default::default()
4720 }
4721
4722 /// Sets the value of [kind][crate::model::CustomHttpPattern::kind].
4723 pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4724 self.kind = v.into();
4725 self
4726 }
4727
4728 /// Sets the value of [path][crate::model::CustomHttpPattern::path].
4729 pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4730 self.path = v.into();
4731 self
4732 }
4733}
4734
4735impl wkt::message::Message for CustomHttpPattern {
4736 fn typename() -> &'static str {
4737 "type.googleapis.com/google.api.CustomHttpPattern"
4738 }
4739}
4740
4741/// Message that represents an arbitrary HTTP body. It should only be used for
4742/// payload formats that can't be represented as JSON, such as raw binary or
4743/// an HTML page.
4744///
4745/// This message can be used both in streaming and non-streaming API methods in
4746/// the request as well as the response.
4747///
4748/// It can be used as a top-level request field, which is convenient if one
4749/// wants to extract parameters from either the URL or HTTP template into the
4750/// request fields and also want access to the raw HTTP body.
4751///
4752/// Example:
4753///
4754/// ```norust
4755/// message GetResourceRequest {
4756/// // A unique request id.
4757/// string request_id = 1;
4758///
4759/// // The raw HTTP body is bound to this field.
4760/// google.api.HttpBody http_body = 2;
4761///
4762/// }
4763///
4764/// service ResourceService {
4765/// rpc GetResource(GetResourceRequest)
4766/// returns (google.api.HttpBody);
4767/// rpc UpdateResource(google.api.HttpBody)
4768/// returns (google.protobuf.Empty);
4769///
4770/// }
4771/// ```
4772///
4773/// Example with streaming methods:
4774///
4775/// ```norust
4776/// service CaldavService {
4777/// rpc GetCalendar(stream google.api.HttpBody)
4778/// returns (stream google.api.HttpBody);
4779/// rpc UpdateCalendar(stream google.api.HttpBody)
4780/// returns (stream google.api.HttpBody);
4781///
4782/// }
4783/// ```
4784///
4785/// Use of this type only changes how the request and response bodies are
4786/// handled, all other features will continue to work unchanged.
4787#[serde_with::serde_as]
4788#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
4789#[serde(default, rename_all = "camelCase")]
4790#[non_exhaustive]
4791pub struct HttpBody {
4792 /// The HTTP Content-Type header value specifying the content type of the body.
4793 #[serde(skip_serializing_if = "std::string::String::is_empty")]
4794 pub content_type: std::string::String,
4795
4796 /// The HTTP request/response body as raw binary.
4797 #[serde(skip_serializing_if = "::bytes::Bytes::is_empty")]
4798 #[serde_as(as = "serde_with::base64::Base64")]
4799 pub data: ::bytes::Bytes,
4800
4801 /// Application specific response metadata. Must be set in the first response
4802 /// for streaming APIs.
4803 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
4804 pub extensions: std::vec::Vec<wkt::Any>,
4805
4806 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
4807 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4808}
4809
4810impl HttpBody {
4811 pub fn new() -> Self {
4812 std::default::Default::default()
4813 }
4814
4815 /// Sets the value of [content_type][crate::model::HttpBody::content_type].
4816 pub fn set_content_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4817 self.content_type = v.into();
4818 self
4819 }
4820
4821 /// Sets the value of [data][crate::model::HttpBody::data].
4822 pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
4823 self.data = v.into();
4824 self
4825 }
4826
4827 /// Sets the value of [extensions][crate::model::HttpBody::extensions].
4828 pub fn set_extensions<T, V>(mut self, v: T) -> Self
4829 where
4830 T: std::iter::IntoIterator<Item = V>,
4831 V: std::convert::Into<wkt::Any>,
4832 {
4833 use std::iter::Iterator;
4834 self.extensions = v.into_iter().map(|i| i.into()).collect();
4835 self
4836 }
4837}
4838
4839impl wkt::message::Message for HttpBody {
4840 fn typename() -> &'static str {
4841 "type.googleapis.com/google.api.HttpBody"
4842 }
4843}
4844
4845/// A description of a label.
4846#[serde_with::serde_as]
4847#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
4848#[serde(default, rename_all = "camelCase")]
4849#[non_exhaustive]
4850pub struct LabelDescriptor {
4851 /// The label key.
4852 #[serde(skip_serializing_if = "std::string::String::is_empty")]
4853 pub key: std::string::String,
4854
4855 /// The type of data that can be assigned to the label.
4856 pub value_type: crate::model::label_descriptor::ValueType,
4857
4858 /// A human-readable description for the label.
4859 #[serde(skip_serializing_if = "std::string::String::is_empty")]
4860 pub description: std::string::String,
4861
4862 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
4863 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4864}
4865
4866impl LabelDescriptor {
4867 pub fn new() -> Self {
4868 std::default::Default::default()
4869 }
4870
4871 /// Sets the value of [key][crate::model::LabelDescriptor::key].
4872 pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4873 self.key = v.into();
4874 self
4875 }
4876
4877 /// Sets the value of [value_type][crate::model::LabelDescriptor::value_type].
4878 pub fn set_value_type<T: std::convert::Into<crate::model::label_descriptor::ValueType>>(
4879 mut self,
4880 v: T,
4881 ) -> Self {
4882 self.value_type = v.into();
4883 self
4884 }
4885
4886 /// Sets the value of [description][crate::model::LabelDescriptor::description].
4887 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4888 self.description = v.into();
4889 self
4890 }
4891}
4892
4893impl wkt::message::Message for LabelDescriptor {
4894 fn typename() -> &'static str {
4895 "type.googleapis.com/google.api.LabelDescriptor"
4896 }
4897}
4898
4899/// Defines additional types related to [LabelDescriptor].
4900pub mod label_descriptor {
4901 #[allow(unused_imports)]
4902 use super::*;
4903
4904 /// Value types that can be used as label values.
4905 #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
4906 pub struct ValueType(i32);
4907
4908 impl ValueType {
4909 /// A variable-length string. This is the default.
4910 pub const STRING: ValueType = ValueType::new(0);
4911
4912 /// Boolean; true or false.
4913 pub const BOOL: ValueType = ValueType::new(1);
4914
4915 /// A 64-bit signed integer.
4916 pub const INT64: ValueType = ValueType::new(2);
4917
4918 /// Creates a new ValueType instance.
4919 pub(crate) const fn new(value: i32) -> Self {
4920 Self(value)
4921 }
4922
4923 /// Gets the enum value.
4924 pub fn value(&self) -> i32 {
4925 self.0
4926 }
4927
4928 /// Gets the enum value as a string.
4929 pub fn as_str_name(&self) -> std::borrow::Cow<'static, str> {
4930 match self.0 {
4931 0 => std::borrow::Cow::Borrowed("STRING"),
4932 1 => std::borrow::Cow::Borrowed("BOOL"),
4933 2 => std::borrow::Cow::Borrowed("INT64"),
4934 _ => std::borrow::Cow::Owned(std::format!("UNKNOWN-VALUE:{}", self.0)),
4935 }
4936 }
4937
4938 /// Creates an enum value from the value name.
4939 pub fn from_str_name(name: &str) -> std::option::Option<Self> {
4940 match name {
4941 "STRING" => std::option::Option::Some(Self::STRING),
4942 "BOOL" => std::option::Option::Some(Self::BOOL),
4943 "INT64" => std::option::Option::Some(Self::INT64),
4944 _ => std::option::Option::None,
4945 }
4946 }
4947 }
4948
4949 impl std::convert::From<i32> for ValueType {
4950 fn from(value: i32) -> Self {
4951 Self::new(value)
4952 }
4953 }
4954
4955 impl std::default::Default for ValueType {
4956 fn default() -> Self {
4957 Self::new(0)
4958 }
4959 }
4960}
4961
4962/// A description of a log type. Example in YAML format:
4963///
4964/// ```norust
4965/// - name: library.googleapis.com/activity_history
4966/// description: The history of borrowing and returning library items.
4967/// display_name: Activity
4968/// labels:
4969/// - key: /customer_id
4970/// description: Identifier of a library customer
4971/// ```
4972#[serde_with::serde_as]
4973#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
4974#[serde(default, rename_all = "camelCase")]
4975#[non_exhaustive]
4976pub struct LogDescriptor {
4977 /// The name of the log. It must be less than 512 characters long and can
4978 /// include the following characters: upper- and lower-case alphanumeric
4979 /// characters [A-Za-z0-9], and punctuation characters including
4980 /// slash, underscore, hyphen, period [/_-.].
4981 #[serde(skip_serializing_if = "std::string::String::is_empty")]
4982 pub name: std::string::String,
4983
4984 /// The set of labels that are available to describe a specific log entry.
4985 /// Runtime requests that contain labels not specified here are
4986 /// considered invalid.
4987 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
4988 pub labels: std::vec::Vec<crate::model::LabelDescriptor>,
4989
4990 /// A human-readable description of this log. This information appears in
4991 /// the documentation and can contain details.
4992 #[serde(skip_serializing_if = "std::string::String::is_empty")]
4993 pub description: std::string::String,
4994
4995 /// The human-readable name for this log. This information appears on
4996 /// the user interface and should be concise.
4997 #[serde(skip_serializing_if = "std::string::String::is_empty")]
4998 pub display_name: std::string::String,
4999
5000 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
5001 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5002}
5003
5004impl LogDescriptor {
5005 pub fn new() -> Self {
5006 std::default::Default::default()
5007 }
5008
5009 /// Sets the value of [name][crate::model::LogDescriptor::name].
5010 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5011 self.name = v.into();
5012 self
5013 }
5014
5015 /// Sets the value of [description][crate::model::LogDescriptor::description].
5016 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5017 self.description = v.into();
5018 self
5019 }
5020
5021 /// Sets the value of [display_name][crate::model::LogDescriptor::display_name].
5022 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5023 self.display_name = v.into();
5024 self
5025 }
5026
5027 /// Sets the value of [labels][crate::model::LogDescriptor::labels].
5028 pub fn set_labels<T, V>(mut self, v: T) -> Self
5029 where
5030 T: std::iter::IntoIterator<Item = V>,
5031 V: std::convert::Into<crate::model::LabelDescriptor>,
5032 {
5033 use std::iter::Iterator;
5034 self.labels = v.into_iter().map(|i| i.into()).collect();
5035 self
5036 }
5037}
5038
5039impl wkt::message::Message for LogDescriptor {
5040 fn typename() -> &'static str {
5041 "type.googleapis.com/google.api.LogDescriptor"
5042 }
5043}
5044
5045/// Logging configuration of the service.
5046///
5047/// The following example shows how to configure logs to be sent to the
5048/// producer and consumer projects. In the example, the `activity_history`
5049/// log is sent to both the producer and consumer projects, whereas the
5050/// `purchase_history` log is only sent to the producer project.
5051///
5052/// ```norust
5053/// monitored_resources:
5054/// - type: library.googleapis.com/branch
5055/// labels:
5056/// - key: /city
5057/// description: The city where the library branch is located in.
5058/// - key: /name
5059/// description: The name of the branch.
5060/// logs:
5061/// - name: activity_history
5062/// labels:
5063/// - key: /customer_id
5064/// - name: purchase_history
5065/// logging:
5066/// producer_destinations:
5067/// - monitored_resource: library.googleapis.com/branch
5068/// logs:
5069/// - activity_history
5070/// - purchase_history
5071/// consumer_destinations:
5072/// - monitored_resource: library.googleapis.com/branch
5073/// logs:
5074/// - activity_history
5075/// ```
5076#[serde_with::serde_as]
5077#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
5078#[serde(default, rename_all = "camelCase")]
5079#[non_exhaustive]
5080pub struct Logging {
5081 /// Logging configurations for sending logs to the producer project.
5082 /// There can be multiple producer destinations, each one must have a
5083 /// different monitored resource type. A log can be used in at most
5084 /// one producer destination.
5085 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
5086 pub producer_destinations: std::vec::Vec<crate::model::logging::LoggingDestination>,
5087
5088 /// Logging configurations for sending logs to the consumer project.
5089 /// There can be multiple consumer destinations, each one must have a
5090 /// different monitored resource type. A log can be used in at most
5091 /// one consumer destination.
5092 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
5093 pub consumer_destinations: std::vec::Vec<crate::model::logging::LoggingDestination>,
5094
5095 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
5096 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5097}
5098
5099impl Logging {
5100 pub fn new() -> Self {
5101 std::default::Default::default()
5102 }
5103
5104 /// Sets the value of [producer_destinations][crate::model::Logging::producer_destinations].
5105 pub fn set_producer_destinations<T, V>(mut self, v: T) -> Self
5106 where
5107 T: std::iter::IntoIterator<Item = V>,
5108 V: std::convert::Into<crate::model::logging::LoggingDestination>,
5109 {
5110 use std::iter::Iterator;
5111 self.producer_destinations = v.into_iter().map(|i| i.into()).collect();
5112 self
5113 }
5114
5115 /// Sets the value of [consumer_destinations][crate::model::Logging::consumer_destinations].
5116 pub fn set_consumer_destinations<T, V>(mut self, v: T) -> Self
5117 where
5118 T: std::iter::IntoIterator<Item = V>,
5119 V: std::convert::Into<crate::model::logging::LoggingDestination>,
5120 {
5121 use std::iter::Iterator;
5122 self.consumer_destinations = v.into_iter().map(|i| i.into()).collect();
5123 self
5124 }
5125}
5126
5127impl wkt::message::Message for Logging {
5128 fn typename() -> &'static str {
5129 "type.googleapis.com/google.api.Logging"
5130 }
5131}
5132
5133/// Defines additional types related to [Logging].
5134pub mod logging {
5135 #[allow(unused_imports)]
5136 use super::*;
5137
5138 /// Configuration of a specific logging destination (the producer project
5139 /// or the consumer project).
5140 #[serde_with::serde_as]
5141 #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
5142 #[serde(default, rename_all = "camelCase")]
5143 #[non_exhaustive]
5144 pub struct LoggingDestination {
5145 /// The monitored resource type. The type must be defined in the
5146 /// [Service.monitored_resources][google.api.Service.monitored_resources]
5147 /// section.
5148 ///
5149 /// [google.api.Service.monitored_resources]: crate::model::Service::monitored_resources
5150 #[serde(skip_serializing_if = "std::string::String::is_empty")]
5151 pub monitored_resource: std::string::String,
5152
5153 /// Names of the logs to be sent to this destination. Each name must
5154 /// be defined in the [Service.logs][google.api.Service.logs] section. If the
5155 /// log name is not a domain scoped name, it will be automatically prefixed
5156 /// with the service name followed by "/".
5157 ///
5158 /// [google.api.Service.logs]: crate::model::Service::logs
5159 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
5160 pub logs: std::vec::Vec<std::string::String>,
5161
5162 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
5163 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5164 }
5165
5166 impl LoggingDestination {
5167 pub fn new() -> Self {
5168 std::default::Default::default()
5169 }
5170
5171 /// Sets the value of [monitored_resource][crate::model::logging::LoggingDestination::monitored_resource].
5172 pub fn set_monitored_resource<T: std::convert::Into<std::string::String>>(
5173 mut self,
5174 v: T,
5175 ) -> Self {
5176 self.monitored_resource = v.into();
5177 self
5178 }
5179
5180 /// Sets the value of [logs][crate::model::logging::LoggingDestination::logs].
5181 pub fn set_logs<T, V>(mut self, v: T) -> Self
5182 where
5183 T: std::iter::IntoIterator<Item = V>,
5184 V: std::convert::Into<std::string::String>,
5185 {
5186 use std::iter::Iterator;
5187 self.logs = v.into_iter().map(|i| i.into()).collect();
5188 self
5189 }
5190 }
5191
5192 impl wkt::message::Message for LoggingDestination {
5193 fn typename() -> &'static str {
5194 "type.googleapis.com/google.api.Logging.LoggingDestination"
5195 }
5196 }
5197}
5198
5199/// Defines a metric type and its schema. Once a metric descriptor is created,
5200/// deleting or altering it stops data collection and makes the metric type's
5201/// existing data unusable.
5202#[serde_with::serde_as]
5203#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
5204#[serde(default, rename_all = "camelCase")]
5205#[non_exhaustive]
5206pub struct MetricDescriptor {
5207 /// The resource name of the metric descriptor.
5208 #[serde(skip_serializing_if = "std::string::String::is_empty")]
5209 pub name: std::string::String,
5210
5211 /// The metric type, including its DNS name prefix. The type is not
5212 /// URL-encoded. All user-defined metric types have the DNS name
5213 /// `custom.googleapis.com` or `external.googleapis.com`. Metric types should
5214 /// use a natural hierarchical grouping. For example:
5215 ///
5216 /// ```norust
5217 /// "custom.googleapis.com/invoice/paid/amount"
5218 /// "external.googleapis.com/prometheus/up"
5219 /// "appengine.googleapis.com/http/server/response_latencies"
5220 /// ```
5221 #[serde(rename = "type")]
5222 #[serde(skip_serializing_if = "std::string::String::is_empty")]
5223 pub r#type: std::string::String,
5224
5225 /// The set of labels that can be used to describe a specific
5226 /// instance of this metric type. For example, the
5227 /// `appengine.googleapis.com/http/server/response_latencies` metric
5228 /// type has a label for the HTTP response code, `response_code`, so
5229 /// you can look at latencies for successful responses or just
5230 /// for responses that failed.
5231 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
5232 pub labels: std::vec::Vec<crate::model::LabelDescriptor>,
5233
5234 /// Whether the metric records instantaneous values, changes to a value, etc.
5235 /// Some combinations of `metric_kind` and `value_type` might not be supported.
5236 pub metric_kind: crate::model::metric_descriptor::MetricKind,
5237
5238 /// Whether the measurement is an integer, a floating-point number, etc.
5239 /// Some combinations of `metric_kind` and `value_type` might not be supported.
5240 pub value_type: crate::model::metric_descriptor::ValueType,
5241
5242 /// The units in which the metric value is reported. It is only applicable
5243 /// if the `value_type` is `INT64`, `DOUBLE`, or `DISTRIBUTION`. The `unit`
5244 /// defines the representation of the stored metric values.
5245 ///
5246 /// Different systems might scale the values to be more easily displayed (so a
5247 /// value of `0.02kBy` _might_ be displayed as `20By`, and a value of
5248 /// `3523kBy` _might_ be displayed as `3.5MBy`). However, if the `unit` is
5249 /// `kBy`, then the value of the metric is always in thousands of bytes, no
5250 /// matter how it might be displayed.
5251 ///
5252 /// If you want a custom metric to record the exact number of CPU-seconds used
5253 /// by a job, you can create an `INT64 CUMULATIVE` metric whose `unit` is
5254 /// `s{CPU}` (or equivalently `1s{CPU}` or just `s`). If the job uses 12,005
5255 /// CPU-seconds, then the value is written as `12005`.
5256 ///
5257 /// Alternatively, if you want a custom metric to record data in a more
5258 /// granular way, you can create a `DOUBLE CUMULATIVE` metric whose `unit` is
5259 /// `ks{CPU}`, and then write the value `12.005` (which is `12005/1000`),
5260 /// or use `Kis{CPU}` and write `11.723` (which is `12005/1024`).
5261 ///
5262 /// The supported units are a subset of [The Unified Code for Units of
5263 /// Measure](https://unitsofmeasure.org/ucum.html) standard:
5264 ///
5265 /// **Basic units (UNIT)**
5266 ///
5267 /// * `bit` bit
5268 /// * `By` byte
5269 /// * `s` second
5270 /// * `min` minute
5271 /// * `h` hour
5272 /// * `d` day
5273 /// * `1` dimensionless
5274 ///
5275 /// **Prefixes (PREFIX)**
5276 ///
5277 /// * `k` kilo (10^3)
5278 ///
5279 /// * `M` mega (10^6)
5280 ///
5281 /// * `G` giga (10^9)
5282 ///
5283 /// * `T` tera (10^12)
5284 ///
5285 /// * `P` peta (10^15)
5286 ///
5287 /// * `E` exa (10^18)
5288 ///
5289 /// * `Z` zetta (10^21)
5290 ///
5291 /// * `Y` yotta (10^24)
5292 ///
5293 /// * `m` milli (10^-3)
5294 ///
5295 /// * `u` micro (10^-6)
5296 ///
5297 /// * `n` nano (10^-9)
5298 ///
5299 /// * `p` pico (10^-12)
5300 ///
5301 /// * `f` femto (10^-15)
5302 ///
5303 /// * `a` atto (10^-18)
5304 ///
5305 /// * `z` zepto (10^-21)
5306 ///
5307 /// * `y` yocto (10^-24)
5308 ///
5309 /// * `Ki` kibi (2^10)
5310 ///
5311 /// * `Mi` mebi (2^20)
5312 ///
5313 /// * `Gi` gibi (2^30)
5314 ///
5315 /// * `Ti` tebi (2^40)
5316 ///
5317 /// * `Pi` pebi (2^50)
5318 ///
5319 ///
5320 /// **Grammar**
5321 ///
5322 /// The grammar also includes these connectors:
5323 ///
5324 /// * `/` division or ratio (as an infix operator). For examples,
5325 /// `kBy/{email}` or `MiBy/10ms` (although you should almost never
5326 /// have `/s` in a metric `unit`; rates should always be computed at
5327 /// query time from the underlying cumulative or delta value).
5328 /// * `.` multiplication or composition (as an infix operator). For
5329 /// examples, `GBy.d` or `k{watt}.h`.
5330 ///
5331 /// The grammar for a unit is as follows:
5332 ///
5333 /// ```norust
5334 /// Expression = Component { "." Component } { "/" Component } ;
5335 ///
5336 /// Component = ( [ PREFIX ] UNIT | "%" ) [ Annotation ]
5337 /// | Annotation
5338 /// | "1"
5339 /// ;
5340 ///
5341 /// Annotation = "{" NAME "}" ;
5342 /// ```
5343 ///
5344 /// Notes:
5345 ///
5346 /// * `Annotation` is just a comment if it follows a `UNIT`. If the annotation
5347 /// is used alone, then the unit is equivalent to `1`. For examples,
5348 /// `{request}/s == 1/s`, `By{transmitted}/s == By/s`.
5349 /// * `NAME` is a sequence of non-blank printable ASCII characters not
5350 /// containing `{` or `}`.
5351 /// * `1` represents a unitary [dimensionless
5352 /// unit](https://en.wikipedia.org/wiki/Dimensionless_quantity) of 1, such
5353 /// as in `1/s`. It is typically used when none of the basic units are
5354 /// appropriate. For example, "new users per day" can be represented as
5355 /// `1/d` or `{new-users}/d` (and a metric value `5` would mean "5 new
5356 /// users). Alternatively, "thousands of page views per day" would be
5357 /// represented as `1000/d` or `k1/d` or `k{page_views}/d` (and a metric
5358 /// value of `5.3` would mean "5300 page views per day").
5359 /// * `%` represents dimensionless value of 1/100, and annotates values giving
5360 /// a percentage (so the metric values are typically in the range of 0..100,
5361 /// and a metric value `3` means "3 percent").
5362 /// * `10^2.%` indicates a metric contains a ratio, typically in the range
5363 /// 0..1, that will be multiplied by 100 and displayed as a percentage
5364 /// (so a metric value `0.03` means "3 percent").
5365 #[serde(skip_serializing_if = "std::string::String::is_empty")]
5366 pub unit: std::string::String,
5367
5368 /// A detailed description of the metric, which can be used in documentation.
5369 #[serde(skip_serializing_if = "std::string::String::is_empty")]
5370 pub description: std::string::String,
5371
5372 /// A concise name for the metric, which can be displayed in user interfaces.
5373 /// Use sentence case without an ending period, for example "Request count".
5374 /// This field is optional but it is recommended to be set for any metrics
5375 /// associated with user-visible concepts, such as Quota.
5376 #[serde(skip_serializing_if = "std::string::String::is_empty")]
5377 pub display_name: std::string::String,
5378
5379 /// Optional. Metadata which can be used to guide usage of the metric.
5380 #[serde(skip_serializing_if = "std::option::Option::is_none")]
5381 pub metadata: std::option::Option<crate::model::metric_descriptor::MetricDescriptorMetadata>,
5382
5383 /// Optional. The launch stage of the metric definition.
5384 pub launch_stage: crate::model::LaunchStage,
5385
5386 /// Read-only. If present, then a [time
5387 /// series][google.monitoring.v3.TimeSeries], which is identified partially by
5388 /// a metric type and a
5389 /// [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor], that
5390 /// is associated with this metric type can only be associated with one of the
5391 /// monitored resource types listed here.
5392 ///
5393 /// [google.api.MonitoredResourceDescriptor]: crate::model::MonitoredResourceDescriptor
5394 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
5395 pub monitored_resource_types: std::vec::Vec<std::string::String>,
5396
5397 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
5398 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5399}
5400
5401impl MetricDescriptor {
5402 pub fn new() -> Self {
5403 std::default::Default::default()
5404 }
5405
5406 /// Sets the value of [name][crate::model::MetricDescriptor::name].
5407 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5408 self.name = v.into();
5409 self
5410 }
5411
5412 /// Sets the value of [r#type][crate::model::MetricDescriptor::type].
5413 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5414 self.r#type = v.into();
5415 self
5416 }
5417
5418 /// Sets the value of [metric_kind][crate::model::MetricDescriptor::metric_kind].
5419 pub fn set_metric_kind<T: std::convert::Into<crate::model::metric_descriptor::MetricKind>>(
5420 mut self,
5421 v: T,
5422 ) -> Self {
5423 self.metric_kind = v.into();
5424 self
5425 }
5426
5427 /// Sets the value of [value_type][crate::model::MetricDescriptor::value_type].
5428 pub fn set_value_type<T: std::convert::Into<crate::model::metric_descriptor::ValueType>>(
5429 mut self,
5430 v: T,
5431 ) -> Self {
5432 self.value_type = v.into();
5433 self
5434 }
5435
5436 /// Sets the value of [unit][crate::model::MetricDescriptor::unit].
5437 pub fn set_unit<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5438 self.unit = v.into();
5439 self
5440 }
5441
5442 /// Sets the value of [description][crate::model::MetricDescriptor::description].
5443 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5444 self.description = v.into();
5445 self
5446 }
5447
5448 /// Sets the value of [display_name][crate::model::MetricDescriptor::display_name].
5449 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5450 self.display_name = v.into();
5451 self
5452 }
5453
5454 /// Sets the value of [metadata][crate::model::MetricDescriptor::metadata].
5455 pub fn set_metadata<
5456 T: std::convert::Into<
5457 std::option::Option<crate::model::metric_descriptor::MetricDescriptorMetadata>,
5458 >,
5459 >(
5460 mut self,
5461 v: T,
5462 ) -> Self {
5463 self.metadata = v.into();
5464 self
5465 }
5466
5467 /// Sets the value of [launch_stage][crate::model::MetricDescriptor::launch_stage].
5468 pub fn set_launch_stage<T: std::convert::Into<crate::model::LaunchStage>>(
5469 mut self,
5470 v: T,
5471 ) -> Self {
5472 self.launch_stage = v.into();
5473 self
5474 }
5475
5476 /// Sets the value of [labels][crate::model::MetricDescriptor::labels].
5477 pub fn set_labels<T, V>(mut self, v: T) -> Self
5478 where
5479 T: std::iter::IntoIterator<Item = V>,
5480 V: std::convert::Into<crate::model::LabelDescriptor>,
5481 {
5482 use std::iter::Iterator;
5483 self.labels = v.into_iter().map(|i| i.into()).collect();
5484 self
5485 }
5486
5487 /// Sets the value of [monitored_resource_types][crate::model::MetricDescriptor::monitored_resource_types].
5488 pub fn set_monitored_resource_types<T, V>(mut self, v: T) -> Self
5489 where
5490 T: std::iter::IntoIterator<Item = V>,
5491 V: std::convert::Into<std::string::String>,
5492 {
5493 use std::iter::Iterator;
5494 self.monitored_resource_types = v.into_iter().map(|i| i.into()).collect();
5495 self
5496 }
5497}
5498
5499impl wkt::message::Message for MetricDescriptor {
5500 fn typename() -> &'static str {
5501 "type.googleapis.com/google.api.MetricDescriptor"
5502 }
5503}
5504
5505/// Defines additional types related to [MetricDescriptor].
5506pub mod metric_descriptor {
5507 #[allow(unused_imports)]
5508 use super::*;
5509
5510 /// Additional annotations that can be used to guide the usage of a metric.
5511 #[serde_with::serde_as]
5512 #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
5513 #[serde(default, rename_all = "camelCase")]
5514 #[non_exhaustive]
5515 pub struct MetricDescriptorMetadata {
5516
5517 /// Deprecated. Must use the
5518 /// [MetricDescriptor.launch_stage][google.api.MetricDescriptor.launch_stage]
5519 /// instead.
5520 ///
5521 /// [google.api.MetricDescriptor.launch_stage]: crate::model::MetricDescriptor::launch_stage
5522 pub launch_stage: crate::model::LaunchStage,
5523
5524 /// The sampling period of metric data points. For metrics which are written
5525 /// periodically, consecutive data points are stored at this time interval,
5526 /// excluding data loss due to errors. Metrics with a higher granularity have
5527 /// a smaller sampling period.
5528 #[serde(skip_serializing_if = "std::option::Option::is_none")]
5529 pub sample_period: std::option::Option<wkt::Duration>,
5530
5531 /// The delay of data points caused by ingestion. Data points older than this
5532 /// age are guaranteed to be ingested and available to be read, excluding
5533 /// data loss due to errors.
5534 #[serde(skip_serializing_if = "std::option::Option::is_none")]
5535 pub ingest_delay: std::option::Option<wkt::Duration>,
5536
5537 /// The scope of the timeseries data of the metric.
5538 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
5539 pub time_series_resource_hierarchy_level: std::vec::Vec<crate::model::metric_descriptor::metric_descriptor_metadata::TimeSeriesResourceHierarchyLevel>,
5540
5541 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
5542 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5543 }
5544
5545 impl MetricDescriptorMetadata {
5546 pub fn new() -> Self {
5547 std::default::Default::default()
5548 }
5549
5550 /// Sets the value of [launch_stage][crate::model::metric_descriptor::MetricDescriptorMetadata::launch_stage].
5551 pub fn set_launch_stage<T: std::convert::Into<crate::model::LaunchStage>>(
5552 mut self,
5553 v: T,
5554 ) -> Self {
5555 self.launch_stage = v.into();
5556 self
5557 }
5558
5559 /// Sets the value of [sample_period][crate::model::metric_descriptor::MetricDescriptorMetadata::sample_period].
5560 pub fn set_sample_period<T: std::convert::Into<std::option::Option<wkt::Duration>>>(
5561 mut self,
5562 v: T,
5563 ) -> Self {
5564 self.sample_period = v.into();
5565 self
5566 }
5567
5568 /// Sets the value of [ingest_delay][crate::model::metric_descriptor::MetricDescriptorMetadata::ingest_delay].
5569 pub fn set_ingest_delay<T: std::convert::Into<std::option::Option<wkt::Duration>>>(
5570 mut self,
5571 v: T,
5572 ) -> Self {
5573 self.ingest_delay = v.into();
5574 self
5575 }
5576
5577 /// Sets the value of [time_series_resource_hierarchy_level][crate::model::metric_descriptor::MetricDescriptorMetadata::time_series_resource_hierarchy_level].
5578 pub fn set_time_series_resource_hierarchy_level<T, V>(mut self, v: T) -> Self
5579 where
5580 T: std::iter::IntoIterator<Item = V>,
5581 V: std::convert::Into<crate::model::metric_descriptor::metric_descriptor_metadata::TimeSeriesResourceHierarchyLevel>
5582 {
5583 use std::iter::Iterator;
5584 self.time_series_resource_hierarchy_level = v.into_iter().map(|i| i.into()).collect();
5585 self
5586 }
5587 }
5588
5589 impl wkt::message::Message for MetricDescriptorMetadata {
5590 fn typename() -> &'static str {
5591 "type.googleapis.com/google.api.MetricDescriptor.MetricDescriptorMetadata"
5592 }
5593 }
5594
5595 /// Defines additional types related to [MetricDescriptorMetadata].
5596 pub mod metric_descriptor_metadata {
5597 #[allow(unused_imports)]
5598 use super::*;
5599
5600 /// The resource hierarchy level of the timeseries data of a metric.
5601 #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
5602 pub struct TimeSeriesResourceHierarchyLevel(i32);
5603
5604 impl TimeSeriesResourceHierarchyLevel {
5605 /// Do not use this default value.
5606 pub const TIME_SERIES_RESOURCE_HIERARCHY_LEVEL_UNSPECIFIED:
5607 TimeSeriesResourceHierarchyLevel = TimeSeriesResourceHierarchyLevel::new(0);
5608
5609 /// Scopes a metric to a project.
5610 pub const PROJECT: TimeSeriesResourceHierarchyLevel =
5611 TimeSeriesResourceHierarchyLevel::new(1);
5612
5613 /// Scopes a metric to an organization.
5614 pub const ORGANIZATION: TimeSeriesResourceHierarchyLevel =
5615 TimeSeriesResourceHierarchyLevel::new(2);
5616
5617 /// Scopes a metric to a folder.
5618 pub const FOLDER: TimeSeriesResourceHierarchyLevel =
5619 TimeSeriesResourceHierarchyLevel::new(3);
5620
5621 /// Creates a new TimeSeriesResourceHierarchyLevel instance.
5622 pub(crate) const fn new(value: i32) -> Self {
5623 Self(value)
5624 }
5625
5626 /// Gets the enum value.
5627 pub fn value(&self) -> i32 {
5628 self.0
5629 }
5630
5631 /// Gets the enum value as a string.
5632 pub fn as_str_name(&self) -> std::borrow::Cow<'static, str> {
5633 match self.0 {
5634 0 => std::borrow::Cow::Borrowed(
5635 "TIME_SERIES_RESOURCE_HIERARCHY_LEVEL_UNSPECIFIED",
5636 ),
5637 1 => std::borrow::Cow::Borrowed("PROJECT"),
5638 2 => std::borrow::Cow::Borrowed("ORGANIZATION"),
5639 3 => std::borrow::Cow::Borrowed("FOLDER"),
5640 _ => std::borrow::Cow::Owned(std::format!("UNKNOWN-VALUE:{}", self.0)),
5641 }
5642 }
5643
5644 /// Creates an enum value from the value name.
5645 pub fn from_str_name(name: &str) -> std::option::Option<Self> {
5646 match name {
5647 "TIME_SERIES_RESOURCE_HIERARCHY_LEVEL_UNSPECIFIED" => {
5648 std::option::Option::Some(
5649 Self::TIME_SERIES_RESOURCE_HIERARCHY_LEVEL_UNSPECIFIED,
5650 )
5651 }
5652 "PROJECT" => std::option::Option::Some(Self::PROJECT),
5653 "ORGANIZATION" => std::option::Option::Some(Self::ORGANIZATION),
5654 "FOLDER" => std::option::Option::Some(Self::FOLDER),
5655 _ => std::option::Option::None,
5656 }
5657 }
5658 }
5659
5660 impl std::convert::From<i32> for TimeSeriesResourceHierarchyLevel {
5661 fn from(value: i32) -> Self {
5662 Self::new(value)
5663 }
5664 }
5665
5666 impl std::default::Default for TimeSeriesResourceHierarchyLevel {
5667 fn default() -> Self {
5668 Self::new(0)
5669 }
5670 }
5671 }
5672
5673 /// The kind of measurement. It describes how the data is reported.
5674 /// For information on setting the start time and end time based on
5675 /// the MetricKind, see [TimeInterval][google.monitoring.v3.TimeInterval].
5676 #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
5677 pub struct MetricKind(i32);
5678
5679 impl MetricKind {
5680 /// Do not use this default value.
5681 pub const METRIC_KIND_UNSPECIFIED: MetricKind = MetricKind::new(0);
5682
5683 /// An instantaneous measurement of a value.
5684 pub const GAUGE: MetricKind = MetricKind::new(1);
5685
5686 /// The change in a value during a time interval.
5687 pub const DELTA: MetricKind = MetricKind::new(2);
5688
5689 /// A value accumulated over a time interval. Cumulative
5690 /// measurements in a time series should have the same start time
5691 /// and increasing end times, until an event resets the cumulative
5692 /// value to zero and sets a new start time for the following
5693 /// points.
5694 pub const CUMULATIVE: MetricKind = MetricKind::new(3);
5695
5696 /// Creates a new MetricKind instance.
5697 pub(crate) const fn new(value: i32) -> Self {
5698 Self(value)
5699 }
5700
5701 /// Gets the enum value.
5702 pub fn value(&self) -> i32 {
5703 self.0
5704 }
5705
5706 /// Gets the enum value as a string.
5707 pub fn as_str_name(&self) -> std::borrow::Cow<'static, str> {
5708 match self.0 {
5709 0 => std::borrow::Cow::Borrowed("METRIC_KIND_UNSPECIFIED"),
5710 1 => std::borrow::Cow::Borrowed("GAUGE"),
5711 2 => std::borrow::Cow::Borrowed("DELTA"),
5712 3 => std::borrow::Cow::Borrowed("CUMULATIVE"),
5713 _ => std::borrow::Cow::Owned(std::format!("UNKNOWN-VALUE:{}", self.0)),
5714 }
5715 }
5716
5717 /// Creates an enum value from the value name.
5718 pub fn from_str_name(name: &str) -> std::option::Option<Self> {
5719 match name {
5720 "METRIC_KIND_UNSPECIFIED" => {
5721 std::option::Option::Some(Self::METRIC_KIND_UNSPECIFIED)
5722 }
5723 "GAUGE" => std::option::Option::Some(Self::GAUGE),
5724 "DELTA" => std::option::Option::Some(Self::DELTA),
5725 "CUMULATIVE" => std::option::Option::Some(Self::CUMULATIVE),
5726 _ => std::option::Option::None,
5727 }
5728 }
5729 }
5730
5731 impl std::convert::From<i32> for MetricKind {
5732 fn from(value: i32) -> Self {
5733 Self::new(value)
5734 }
5735 }
5736
5737 impl std::default::Default for MetricKind {
5738 fn default() -> Self {
5739 Self::new(0)
5740 }
5741 }
5742
5743 /// The value type of a metric.
5744 #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
5745 pub struct ValueType(i32);
5746
5747 impl ValueType {
5748 /// Do not use this default value.
5749 pub const VALUE_TYPE_UNSPECIFIED: ValueType = ValueType::new(0);
5750
5751 /// The value is a boolean.
5752 /// This value type can be used only if the metric kind is `GAUGE`.
5753 pub const BOOL: ValueType = ValueType::new(1);
5754
5755 /// The value is a signed 64-bit integer.
5756 pub const INT64: ValueType = ValueType::new(2);
5757
5758 /// The value is a double precision floating point number.
5759 pub const DOUBLE: ValueType = ValueType::new(3);
5760
5761 /// The value is a text string.
5762 /// This value type can be used only if the metric kind is `GAUGE`.
5763 pub const STRING: ValueType = ValueType::new(4);
5764
5765 /// The value is a [`Distribution`][google.api.Distribution].
5766 ///
5767 /// [google.api.Distribution]: crate::model::Distribution
5768 pub const DISTRIBUTION: ValueType = ValueType::new(5);
5769
5770 /// The value is money.
5771 pub const MONEY: ValueType = ValueType::new(6);
5772
5773 /// Creates a new ValueType instance.
5774 pub(crate) const fn new(value: i32) -> Self {
5775 Self(value)
5776 }
5777
5778 /// Gets the enum value.
5779 pub fn value(&self) -> i32 {
5780 self.0
5781 }
5782
5783 /// Gets the enum value as a string.
5784 pub fn as_str_name(&self) -> std::borrow::Cow<'static, str> {
5785 match self.0 {
5786 0 => std::borrow::Cow::Borrowed("VALUE_TYPE_UNSPECIFIED"),
5787 1 => std::borrow::Cow::Borrowed("BOOL"),
5788 2 => std::borrow::Cow::Borrowed("INT64"),
5789 3 => std::borrow::Cow::Borrowed("DOUBLE"),
5790 4 => std::borrow::Cow::Borrowed("STRING"),
5791 5 => std::borrow::Cow::Borrowed("DISTRIBUTION"),
5792 6 => std::borrow::Cow::Borrowed("MONEY"),
5793 _ => std::borrow::Cow::Owned(std::format!("UNKNOWN-VALUE:{}", self.0)),
5794 }
5795 }
5796
5797 /// Creates an enum value from the value name.
5798 pub fn from_str_name(name: &str) -> std::option::Option<Self> {
5799 match name {
5800 "VALUE_TYPE_UNSPECIFIED" => std::option::Option::Some(Self::VALUE_TYPE_UNSPECIFIED),
5801 "BOOL" => std::option::Option::Some(Self::BOOL),
5802 "INT64" => std::option::Option::Some(Self::INT64),
5803 "DOUBLE" => std::option::Option::Some(Self::DOUBLE),
5804 "STRING" => std::option::Option::Some(Self::STRING),
5805 "DISTRIBUTION" => std::option::Option::Some(Self::DISTRIBUTION),
5806 "MONEY" => std::option::Option::Some(Self::MONEY),
5807 _ => std::option::Option::None,
5808 }
5809 }
5810 }
5811
5812 impl std::convert::From<i32> for ValueType {
5813 fn from(value: i32) -> Self {
5814 Self::new(value)
5815 }
5816 }
5817
5818 impl std::default::Default for ValueType {
5819 fn default() -> Self {
5820 Self::new(0)
5821 }
5822 }
5823}
5824
5825/// A specific metric, identified by specifying values for all of the
5826/// labels of a [`MetricDescriptor`][google.api.MetricDescriptor].
5827///
5828/// [google.api.MetricDescriptor]: crate::model::MetricDescriptor
5829#[serde_with::serde_as]
5830#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
5831#[serde(default, rename_all = "camelCase")]
5832#[non_exhaustive]
5833pub struct Metric {
5834 /// An existing metric type, see
5835 /// [google.api.MetricDescriptor][google.api.MetricDescriptor]. For example,
5836 /// `custom.googleapis.com/invoice/paid/amount`.
5837 ///
5838 /// [google.api.MetricDescriptor]: crate::model::MetricDescriptor
5839 #[serde(rename = "type")]
5840 #[serde(skip_serializing_if = "std::string::String::is_empty")]
5841 pub r#type: std::string::String,
5842
5843 /// The set of label values that uniquely identify this metric. All
5844 /// labels listed in the `MetricDescriptor` must be assigned values.
5845 #[serde(skip_serializing_if = "std::collections::HashMap::is_empty")]
5846 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
5847
5848 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
5849 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5850}
5851
5852impl Metric {
5853 pub fn new() -> Self {
5854 std::default::Default::default()
5855 }
5856
5857 /// Sets the value of [r#type][crate::model::Metric::type].
5858 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5859 self.r#type = v.into();
5860 self
5861 }
5862
5863 /// Sets the value of [labels][crate::model::Metric::labels].
5864 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
5865 where
5866 T: std::iter::IntoIterator<Item = (K, V)>,
5867 K: std::convert::Into<std::string::String>,
5868 V: std::convert::Into<std::string::String>,
5869 {
5870 use std::iter::Iterator;
5871 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
5872 self
5873 }
5874}
5875
5876impl wkt::message::Message for Metric {
5877 fn typename() -> &'static str {
5878 "type.googleapis.com/google.api.Metric"
5879 }
5880}
5881
5882/// An object that describes the schema of a
5883/// [MonitoredResource][google.api.MonitoredResource] object using a type name
5884/// and a set of labels. For example, the monitored resource descriptor for
5885/// Google Compute Engine VM instances has a type of
5886/// `"gce_instance"` and specifies the use of the labels `"instance_id"` and
5887/// `"zone"` to identify particular VM instances.
5888///
5889/// Different APIs can support different monitored resource types. APIs generally
5890/// provide a `list` method that returns the monitored resource descriptors used
5891/// by the API.
5892///
5893/// [google.api.MonitoredResource]: crate::model::MonitoredResource
5894#[serde_with::serde_as]
5895#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
5896#[serde(default, rename_all = "camelCase")]
5897#[non_exhaustive]
5898pub struct MonitoredResourceDescriptor {
5899 /// Optional. The resource name of the monitored resource descriptor:
5900 /// `"projects/{project_id}/monitoredResourceDescriptors/{type}"` where
5901 /// {type} is the value of the `type` field in this object and
5902 /// {project_id} is a project ID that provides API-specific context for
5903 /// accessing the type. APIs that do not use project information can use the
5904 /// resource name format `"monitoredResourceDescriptors/{type}"`.
5905 #[serde(skip_serializing_if = "std::string::String::is_empty")]
5906 pub name: std::string::String,
5907
5908 /// Required. The monitored resource type. For example, the type
5909 /// `"cloudsql_database"` represents databases in Google Cloud SQL.
5910 /// For a list of types, see [Monitored resource
5911 /// types](https://cloud.google.com/monitoring/api/resources)
5912 /// and [Logging resource
5913 /// types](https://cloud.google.com/logging/docs/api/v2/resource-list).
5914 #[serde(rename = "type")]
5915 #[serde(skip_serializing_if = "std::string::String::is_empty")]
5916 pub r#type: std::string::String,
5917
5918 /// Optional. A concise name for the monitored resource type that might be
5919 /// displayed in user interfaces. It should be a Title Cased Noun Phrase,
5920 /// without any article or other determiners. For example,
5921 /// `"Google Cloud SQL Database"`.
5922 #[serde(skip_serializing_if = "std::string::String::is_empty")]
5923 pub display_name: std::string::String,
5924
5925 /// Optional. A detailed description of the monitored resource type that might
5926 /// be used in documentation.
5927 #[serde(skip_serializing_if = "std::string::String::is_empty")]
5928 pub description: std::string::String,
5929
5930 /// Required. A set of labels used to describe instances of this monitored
5931 /// resource type. For example, an individual Google Cloud SQL database is
5932 /// identified by values for the labels `"database_id"` and `"zone"`.
5933 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
5934 pub labels: std::vec::Vec<crate::model::LabelDescriptor>,
5935
5936 /// Optional. The launch stage of the monitored resource definition.
5937 pub launch_stage: crate::model::LaunchStage,
5938
5939 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
5940 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5941}
5942
5943impl MonitoredResourceDescriptor {
5944 pub fn new() -> Self {
5945 std::default::Default::default()
5946 }
5947
5948 /// Sets the value of [name][crate::model::MonitoredResourceDescriptor::name].
5949 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5950 self.name = v.into();
5951 self
5952 }
5953
5954 /// Sets the value of [r#type][crate::model::MonitoredResourceDescriptor::type].
5955 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5956 self.r#type = v.into();
5957 self
5958 }
5959
5960 /// Sets the value of [display_name][crate::model::MonitoredResourceDescriptor::display_name].
5961 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5962 self.display_name = v.into();
5963 self
5964 }
5965
5966 /// Sets the value of [description][crate::model::MonitoredResourceDescriptor::description].
5967 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5968 self.description = v.into();
5969 self
5970 }
5971
5972 /// Sets the value of [launch_stage][crate::model::MonitoredResourceDescriptor::launch_stage].
5973 pub fn set_launch_stage<T: std::convert::Into<crate::model::LaunchStage>>(
5974 mut self,
5975 v: T,
5976 ) -> Self {
5977 self.launch_stage = v.into();
5978 self
5979 }
5980
5981 /// Sets the value of [labels][crate::model::MonitoredResourceDescriptor::labels].
5982 pub fn set_labels<T, V>(mut self, v: T) -> Self
5983 where
5984 T: std::iter::IntoIterator<Item = V>,
5985 V: std::convert::Into<crate::model::LabelDescriptor>,
5986 {
5987 use std::iter::Iterator;
5988 self.labels = v.into_iter().map(|i| i.into()).collect();
5989 self
5990 }
5991}
5992
5993impl wkt::message::Message for MonitoredResourceDescriptor {
5994 fn typename() -> &'static str {
5995 "type.googleapis.com/google.api.MonitoredResourceDescriptor"
5996 }
5997}
5998
5999/// An object representing a resource that can be used for monitoring, logging,
6000/// billing, or other purposes. Examples include virtual machine instances,
6001/// databases, and storage devices such as disks. The `type` field identifies a
6002/// [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] object
6003/// that describes the resource's schema. Information in the `labels` field
6004/// identifies the actual resource and its attributes according to the schema.
6005/// For example, a particular Compute Engine VM instance could be represented by
6006/// the following object, because the
6007/// [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] for
6008/// `"gce_instance"` has labels
6009/// `"project_id"`, `"instance_id"` and `"zone"`:
6010///
6011/// ```norust
6012/// { "type": "gce_instance",
6013/// "labels": { "project_id": "my-project",
6014/// "instance_id": "12345678901234",
6015/// "zone": "us-central1-a" }}
6016/// ```
6017///
6018/// [google.api.MonitoredResourceDescriptor]: crate::model::MonitoredResourceDescriptor
6019#[serde_with::serde_as]
6020#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
6021#[serde(default, rename_all = "camelCase")]
6022#[non_exhaustive]
6023pub struct MonitoredResource {
6024 /// Required. The monitored resource type. This field must match
6025 /// the `type` field of a
6026 /// [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor]
6027 /// object. For example, the type of a Compute Engine VM instance is
6028 /// `gce_instance`. Some descriptors include the service name in the type; for
6029 /// example, the type of a Datastream stream is
6030 /// `datastream.googleapis.com/Stream`.
6031 ///
6032 /// [google.api.MonitoredResourceDescriptor]: crate::model::MonitoredResourceDescriptor
6033 #[serde(rename = "type")]
6034 #[serde(skip_serializing_if = "std::string::String::is_empty")]
6035 pub r#type: std::string::String,
6036
6037 /// Required. Values for all of the labels listed in the associated monitored
6038 /// resource descriptor. For example, Compute Engine VM instances use the
6039 /// labels `"project_id"`, `"instance_id"`, and `"zone"`.
6040 #[serde(skip_serializing_if = "std::collections::HashMap::is_empty")]
6041 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
6042
6043 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
6044 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6045}
6046
6047impl MonitoredResource {
6048 pub fn new() -> Self {
6049 std::default::Default::default()
6050 }
6051
6052 /// Sets the value of [r#type][crate::model::MonitoredResource::type].
6053 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6054 self.r#type = v.into();
6055 self
6056 }
6057
6058 /// Sets the value of [labels][crate::model::MonitoredResource::labels].
6059 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
6060 where
6061 T: std::iter::IntoIterator<Item = (K, V)>,
6062 K: std::convert::Into<std::string::String>,
6063 V: std::convert::Into<std::string::String>,
6064 {
6065 use std::iter::Iterator;
6066 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6067 self
6068 }
6069}
6070
6071impl wkt::message::Message for MonitoredResource {
6072 fn typename() -> &'static str {
6073 "type.googleapis.com/google.api.MonitoredResource"
6074 }
6075}
6076
6077/// Auxiliary metadata for a [MonitoredResource][google.api.MonitoredResource]
6078/// object. [MonitoredResource][google.api.MonitoredResource] objects contain the
6079/// minimum set of information to uniquely identify a monitored resource
6080/// instance. There is some other useful auxiliary metadata. Monitoring and
6081/// Logging use an ingestion pipeline to extract metadata for cloud resources of
6082/// all types, and store the metadata in this message.
6083///
6084/// [google.api.MonitoredResource]: crate::model::MonitoredResource
6085#[serde_with::serde_as]
6086#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
6087#[serde(default, rename_all = "camelCase")]
6088#[non_exhaustive]
6089pub struct MonitoredResourceMetadata {
6090 /// Output only. Values for predefined system metadata labels.
6091 /// System labels are a kind of metadata extracted by Google, including
6092 /// "machine_image", "vpc", "subnet_id",
6093 /// "security_group", "name", etc.
6094 /// System label values can be only strings, Boolean values, or a list of
6095 /// strings. For example:
6096 ///
6097 /// ```norust
6098 /// { "name": "my-test-instance",
6099 /// "security_group": ["a", "b", "c"],
6100 /// "spot_instance": false }
6101 /// ```
6102 #[serde(skip_serializing_if = "std::option::Option::is_none")]
6103 pub system_labels: std::option::Option<wkt::Struct>,
6104
6105 /// Output only. A map of user-defined metadata labels.
6106 #[serde(skip_serializing_if = "std::collections::HashMap::is_empty")]
6107 pub user_labels: std::collections::HashMap<std::string::String, std::string::String>,
6108
6109 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
6110 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6111}
6112
6113impl MonitoredResourceMetadata {
6114 pub fn new() -> Self {
6115 std::default::Default::default()
6116 }
6117
6118 /// Sets the value of [system_labels][crate::model::MonitoredResourceMetadata::system_labels].
6119 pub fn set_system_labels<T: std::convert::Into<std::option::Option<wkt::Struct>>>(
6120 mut self,
6121 v: T,
6122 ) -> Self {
6123 self.system_labels = v.into();
6124 self
6125 }
6126
6127 /// Sets the value of [user_labels][crate::model::MonitoredResourceMetadata::user_labels].
6128 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
6129 where
6130 T: std::iter::IntoIterator<Item = (K, V)>,
6131 K: std::convert::Into<std::string::String>,
6132 V: std::convert::Into<std::string::String>,
6133 {
6134 use std::iter::Iterator;
6135 self.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6136 self
6137 }
6138}
6139
6140impl wkt::message::Message for MonitoredResourceMetadata {
6141 fn typename() -> &'static str {
6142 "type.googleapis.com/google.api.MonitoredResourceMetadata"
6143 }
6144}
6145
6146/// Monitoring configuration of the service.
6147///
6148/// The example below shows how to configure monitored resources and metrics
6149/// for monitoring. In the example, a monitored resource and two metrics are
6150/// defined. The `library.googleapis.com/book/returned_count` metric is sent
6151/// to both producer and consumer projects, whereas the
6152/// `library.googleapis.com/book/num_overdue` metric is only sent to the
6153/// consumer project.
6154///
6155/// ```norust
6156/// monitored_resources:
6157/// - type: library.googleapis.com/Branch
6158/// display_name: "Library Branch"
6159/// description: "A branch of a library."
6160/// launch_stage: GA
6161/// labels:
6162/// - key: resource_container
6163/// description: "The Cloud container (ie. project id) for the Branch."
6164/// - key: location
6165/// description: "The location of the library branch."
6166/// - key: branch_id
6167/// description: "The id of the branch."
6168/// metrics:
6169/// - name: library.googleapis.com/book/returned_count
6170/// display_name: "Books Returned"
6171/// description: "The count of books that have been returned."
6172/// launch_stage: GA
6173/// metric_kind: DELTA
6174/// value_type: INT64
6175/// unit: "1"
6176/// labels:
6177/// - key: customer_id
6178/// description: "The id of the customer."
6179/// - name: library.googleapis.com/book/num_overdue
6180/// display_name: "Books Overdue"
6181/// description: "The current number of overdue books."
6182/// launch_stage: GA
6183/// metric_kind: GAUGE
6184/// value_type: INT64
6185/// unit: "1"
6186/// labels:
6187/// - key: customer_id
6188/// description: "The id of the customer."
6189/// monitoring:
6190/// producer_destinations:
6191/// - monitored_resource: library.googleapis.com/Branch
6192/// metrics:
6193/// - library.googleapis.com/book/returned_count
6194/// consumer_destinations:
6195/// - monitored_resource: library.googleapis.com/Branch
6196/// metrics:
6197/// - library.googleapis.com/book/returned_count
6198/// - library.googleapis.com/book/num_overdue
6199/// ```
6200#[serde_with::serde_as]
6201#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
6202#[serde(default, rename_all = "camelCase")]
6203#[non_exhaustive]
6204pub struct Monitoring {
6205 /// Monitoring configurations for sending metrics to the producer project.
6206 /// There can be multiple producer destinations. A monitored resource type may
6207 /// appear in multiple monitoring destinations if different aggregations are
6208 /// needed for different sets of metrics associated with that monitored
6209 /// resource type. A monitored resource and metric pair may only be used once
6210 /// in the Monitoring configuration.
6211 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
6212 pub producer_destinations: std::vec::Vec<crate::model::monitoring::MonitoringDestination>,
6213
6214 /// Monitoring configurations for sending metrics to the consumer project.
6215 /// There can be multiple consumer destinations. A monitored resource type may
6216 /// appear in multiple monitoring destinations if different aggregations are
6217 /// needed for different sets of metrics associated with that monitored
6218 /// resource type. A monitored resource and metric pair may only be used once
6219 /// in the Monitoring configuration.
6220 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
6221 pub consumer_destinations: std::vec::Vec<crate::model::monitoring::MonitoringDestination>,
6222
6223 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
6224 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6225}
6226
6227impl Monitoring {
6228 pub fn new() -> Self {
6229 std::default::Default::default()
6230 }
6231
6232 /// Sets the value of [producer_destinations][crate::model::Monitoring::producer_destinations].
6233 pub fn set_producer_destinations<T, V>(mut self, v: T) -> Self
6234 where
6235 T: std::iter::IntoIterator<Item = V>,
6236 V: std::convert::Into<crate::model::monitoring::MonitoringDestination>,
6237 {
6238 use std::iter::Iterator;
6239 self.producer_destinations = v.into_iter().map(|i| i.into()).collect();
6240 self
6241 }
6242
6243 /// Sets the value of [consumer_destinations][crate::model::Monitoring::consumer_destinations].
6244 pub fn set_consumer_destinations<T, V>(mut self, v: T) -> Self
6245 where
6246 T: std::iter::IntoIterator<Item = V>,
6247 V: std::convert::Into<crate::model::monitoring::MonitoringDestination>,
6248 {
6249 use std::iter::Iterator;
6250 self.consumer_destinations = v.into_iter().map(|i| i.into()).collect();
6251 self
6252 }
6253}
6254
6255impl wkt::message::Message for Monitoring {
6256 fn typename() -> &'static str {
6257 "type.googleapis.com/google.api.Monitoring"
6258 }
6259}
6260
6261/// Defines additional types related to [Monitoring].
6262pub mod monitoring {
6263 #[allow(unused_imports)]
6264 use super::*;
6265
6266 /// Configuration of a specific monitoring destination (the producer project
6267 /// or the consumer project).
6268 #[serde_with::serde_as]
6269 #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
6270 #[serde(default, rename_all = "camelCase")]
6271 #[non_exhaustive]
6272 pub struct MonitoringDestination {
6273 /// The monitored resource type. The type must be defined in
6274 /// [Service.monitored_resources][google.api.Service.monitored_resources]
6275 /// section.
6276 ///
6277 /// [google.api.Service.monitored_resources]: crate::model::Service::monitored_resources
6278 #[serde(skip_serializing_if = "std::string::String::is_empty")]
6279 pub monitored_resource: std::string::String,
6280
6281 /// Types of the metrics to report to this monitoring destination.
6282 /// Each type must be defined in
6283 /// [Service.metrics][google.api.Service.metrics] section.
6284 ///
6285 /// [google.api.Service.metrics]: crate::model::Service::metrics
6286 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
6287 pub metrics: std::vec::Vec<std::string::String>,
6288
6289 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
6290 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6291 }
6292
6293 impl MonitoringDestination {
6294 pub fn new() -> Self {
6295 std::default::Default::default()
6296 }
6297
6298 /// Sets the value of [monitored_resource][crate::model::monitoring::MonitoringDestination::monitored_resource].
6299 pub fn set_monitored_resource<T: std::convert::Into<std::string::String>>(
6300 mut self,
6301 v: T,
6302 ) -> Self {
6303 self.monitored_resource = v.into();
6304 self
6305 }
6306
6307 /// Sets the value of [metrics][crate::model::monitoring::MonitoringDestination::metrics].
6308 pub fn set_metrics<T, V>(mut self, v: T) -> Self
6309 where
6310 T: std::iter::IntoIterator<Item = V>,
6311 V: std::convert::Into<std::string::String>,
6312 {
6313 use std::iter::Iterator;
6314 self.metrics = v.into_iter().map(|i| i.into()).collect();
6315 self
6316 }
6317 }
6318
6319 impl wkt::message::Message for MonitoringDestination {
6320 fn typename() -> &'static str {
6321 "type.googleapis.com/google.api.Monitoring.MonitoringDestination"
6322 }
6323 }
6324}
6325
6326/// Google API Policy Annotation
6327///
6328/// This message defines a simple API policy annotation that can be used to
6329/// annotate API request and response message fields with applicable policies.
6330/// One field may have multiple applicable policies that must all be satisfied
6331/// before a request can be processed. This policy annotation is used to
6332/// generate the overall policy that will be used for automatic runtime
6333/// policy enforcement and documentation generation.
6334#[serde_with::serde_as]
6335#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
6336#[serde(default, rename_all = "camelCase")]
6337#[non_exhaustive]
6338pub struct FieldPolicy {
6339 /// Selects one or more request or response message fields to apply this
6340 /// `FieldPolicy`.
6341 ///
6342 /// When a `FieldPolicy` is used in proto annotation, the selector must
6343 /// be left as empty. The service config generator will automatically fill
6344 /// the correct value.
6345 ///
6346 /// When a `FieldPolicy` is used in service config, the selector must be a
6347 /// comma-separated string with valid request or response field paths,
6348 /// such as "foo.bar" or "foo.bar,foo.baz".
6349 #[serde(skip_serializing_if = "std::string::String::is_empty")]
6350 pub selector: std::string::String,
6351
6352 /// Specifies the required permission(s) for the resource referred to by the
6353 /// field. It requires the field contains a valid resource reference, and
6354 /// the request must pass the permission checks to proceed. For example,
6355 /// "resourcemanager.projects.get".
6356 #[serde(skip_serializing_if = "std::string::String::is_empty")]
6357 pub resource_permission: std::string::String,
6358
6359 /// Specifies the resource type for the resource referred to by the field.
6360 #[serde(skip_serializing_if = "std::string::String::is_empty")]
6361 pub resource_type: std::string::String,
6362
6363 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
6364 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6365}
6366
6367impl FieldPolicy {
6368 pub fn new() -> Self {
6369 std::default::Default::default()
6370 }
6371
6372 /// Sets the value of [selector][crate::model::FieldPolicy::selector].
6373 pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6374 self.selector = v.into();
6375 self
6376 }
6377
6378 /// Sets the value of [resource_permission][crate::model::FieldPolicy::resource_permission].
6379 pub fn set_resource_permission<T: std::convert::Into<std::string::String>>(
6380 mut self,
6381 v: T,
6382 ) -> Self {
6383 self.resource_permission = v.into();
6384 self
6385 }
6386
6387 /// Sets the value of [resource_type][crate::model::FieldPolicy::resource_type].
6388 pub fn set_resource_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6389 self.resource_type = v.into();
6390 self
6391 }
6392}
6393
6394impl wkt::message::Message for FieldPolicy {
6395 fn typename() -> &'static str {
6396 "type.googleapis.com/google.api.FieldPolicy"
6397 }
6398}
6399
6400/// Defines policies applying to an RPC method.
6401#[serde_with::serde_as]
6402#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
6403#[serde(default, rename_all = "camelCase")]
6404#[non_exhaustive]
6405pub struct MethodPolicy {
6406 /// Selects a method to which these policies should be enforced, for example,
6407 /// "google.pubsub.v1.Subscriber.CreateSubscription".
6408 ///
6409 /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
6410 /// details.
6411 ///
6412 /// NOTE: This field must not be set in the proto annotation. It will be
6413 /// automatically filled by the service config compiler .
6414 ///
6415 /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
6416 #[serde(skip_serializing_if = "std::string::String::is_empty")]
6417 pub selector: std::string::String,
6418
6419 /// Policies that are applicable to the request message.
6420 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
6421 pub request_policies: std::vec::Vec<crate::model::FieldPolicy>,
6422
6423 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
6424 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6425}
6426
6427impl MethodPolicy {
6428 pub fn new() -> Self {
6429 std::default::Default::default()
6430 }
6431
6432 /// Sets the value of [selector][crate::model::MethodPolicy::selector].
6433 pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6434 self.selector = v.into();
6435 self
6436 }
6437
6438 /// Sets the value of [request_policies][crate::model::MethodPolicy::request_policies].
6439 pub fn set_request_policies<T, V>(mut self, v: T) -> Self
6440 where
6441 T: std::iter::IntoIterator<Item = V>,
6442 V: std::convert::Into<crate::model::FieldPolicy>,
6443 {
6444 use std::iter::Iterator;
6445 self.request_policies = v.into_iter().map(|i| i.into()).collect();
6446 self
6447 }
6448}
6449
6450impl wkt::message::Message for MethodPolicy {
6451 fn typename() -> &'static str {
6452 "type.googleapis.com/google.api.MethodPolicy"
6453 }
6454}
6455
6456/// Quota configuration helps to achieve fairness and budgeting in service
6457/// usage.
6458///
6459/// The metric based quota configuration works this way:
6460///
6461/// - The service configuration defines a set of metrics.
6462/// - For API calls, the quota.metric_rules maps methods to metrics with
6463/// corresponding costs.
6464/// - The quota.limits defines limits on the metrics, which will be used for
6465/// quota checks at runtime.
6466///
6467/// An example quota configuration in yaml format:
6468///
6469/// quota:
6470/// limits:
6471///
6472/// ```norust
6473/// - name: apiWriteQpsPerProject
6474/// metric: library.googleapis.com/write_calls
6475/// unit: "1/min/{project}" # rate limit for consumer projects
6476/// values:
6477/// STANDARD: 10000
6478///
6479///
6480/// (The metric rules bind all methods to the read_calls metric,
6481/// except for the UpdateBook and DeleteBook methods. These two methods
6482/// are mapped to the write_calls metric, with the UpdateBook method
6483/// consuming at twice rate as the DeleteBook method.)
6484/// metric_rules:
6485/// - selector: "*"
6486/// metric_costs:
6487/// library.googleapis.com/read_calls: 1
6488/// - selector: google.example.library.v1.LibraryService.UpdateBook
6489/// metric_costs:
6490/// library.googleapis.com/write_calls: 2
6491/// - selector: google.example.library.v1.LibraryService.DeleteBook
6492/// metric_costs:
6493/// library.googleapis.com/write_calls: 1
6494/// ```
6495///
6496/// Corresponding Metric definition:
6497///
6498/// ```norust
6499/// metrics:
6500/// - name: library.googleapis.com/read_calls
6501/// display_name: Read requests
6502/// metric_kind: DELTA
6503/// value_type: INT64
6504///
6505/// - name: library.googleapis.com/write_calls
6506/// display_name: Write requests
6507/// metric_kind: DELTA
6508/// value_type: INT64
6509/// ```
6510#[serde_with::serde_as]
6511#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
6512#[serde(default, rename_all = "camelCase")]
6513#[non_exhaustive]
6514pub struct Quota {
6515 /// List of QuotaLimit definitions for the service.
6516 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
6517 pub limits: std::vec::Vec<crate::model::QuotaLimit>,
6518
6519 /// List of MetricRule definitions, each one mapping a selected method to one
6520 /// or more metrics.
6521 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
6522 pub metric_rules: std::vec::Vec<crate::model::MetricRule>,
6523
6524 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
6525 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6526}
6527
6528impl Quota {
6529 pub fn new() -> Self {
6530 std::default::Default::default()
6531 }
6532
6533 /// Sets the value of [limits][crate::model::Quota::limits].
6534 pub fn set_limits<T, V>(mut self, v: T) -> Self
6535 where
6536 T: std::iter::IntoIterator<Item = V>,
6537 V: std::convert::Into<crate::model::QuotaLimit>,
6538 {
6539 use std::iter::Iterator;
6540 self.limits = v.into_iter().map(|i| i.into()).collect();
6541 self
6542 }
6543
6544 /// Sets the value of [metric_rules][crate::model::Quota::metric_rules].
6545 pub fn set_metric_rules<T, V>(mut self, v: T) -> Self
6546 where
6547 T: std::iter::IntoIterator<Item = V>,
6548 V: std::convert::Into<crate::model::MetricRule>,
6549 {
6550 use std::iter::Iterator;
6551 self.metric_rules = v.into_iter().map(|i| i.into()).collect();
6552 self
6553 }
6554}
6555
6556impl wkt::message::Message for Quota {
6557 fn typename() -> &'static str {
6558 "type.googleapis.com/google.api.Quota"
6559 }
6560}
6561
6562/// Bind API methods to metrics. Binding a method to a metric causes that
6563/// metric's configured quota behaviors to apply to the method call.
6564#[serde_with::serde_as]
6565#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
6566#[serde(default, rename_all = "camelCase")]
6567#[non_exhaustive]
6568pub struct MetricRule {
6569 /// Selects the methods to which this rule applies.
6570 ///
6571 /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
6572 /// details.
6573 ///
6574 /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
6575 #[serde(skip_serializing_if = "std::string::String::is_empty")]
6576 pub selector: std::string::String,
6577
6578 /// Metrics to update when the selected methods are called, and the associated
6579 /// cost applied to each metric.
6580 ///
6581 /// The key of the map is the metric name, and the values are the amount
6582 /// increased for the metric against which the quota limits are defined.
6583 /// The value must not be negative.
6584 #[serde(skip_serializing_if = "std::collections::HashMap::is_empty")]
6585 #[serde_as(as = "std::collections::HashMap<_, serde_with::DisplayFromStr>")]
6586 pub metric_costs: std::collections::HashMap<std::string::String, i64>,
6587
6588 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
6589 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6590}
6591
6592impl MetricRule {
6593 pub fn new() -> Self {
6594 std::default::Default::default()
6595 }
6596
6597 /// Sets the value of [selector][crate::model::MetricRule::selector].
6598 pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6599 self.selector = v.into();
6600 self
6601 }
6602
6603 /// Sets the value of [metric_costs][crate::model::MetricRule::metric_costs].
6604 pub fn set_metric_costs<T, K, V>(mut self, v: T) -> Self
6605 where
6606 T: std::iter::IntoIterator<Item = (K, V)>,
6607 K: std::convert::Into<std::string::String>,
6608 V: std::convert::Into<i64>,
6609 {
6610 use std::iter::Iterator;
6611 self.metric_costs = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6612 self
6613 }
6614}
6615
6616impl wkt::message::Message for MetricRule {
6617 fn typename() -> &'static str {
6618 "type.googleapis.com/google.api.MetricRule"
6619 }
6620}
6621
6622/// `QuotaLimit` defines a specific limit that applies over a specified duration
6623/// for a limit type. There can be at most one limit for a duration and limit
6624/// type combination defined within a `QuotaGroup`.
6625#[serde_with::serde_as]
6626#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
6627#[serde(default, rename_all = "camelCase")]
6628#[non_exhaustive]
6629pub struct QuotaLimit {
6630 /// Name of the quota limit.
6631 ///
6632 /// The name must be provided, and it must be unique within the service. The
6633 /// name can only include alphanumeric characters as well as '-'.
6634 ///
6635 /// The maximum length of the limit name is 64 characters.
6636 #[serde(skip_serializing_if = "std::string::String::is_empty")]
6637 pub name: std::string::String,
6638
6639 /// Optional. User-visible, extended description for this quota limit.
6640 /// Should be used only when more context is needed to understand this limit
6641 /// than provided by the limit's display name (see: `display_name`).
6642 #[serde(skip_serializing_if = "std::string::String::is_empty")]
6643 pub description: std::string::String,
6644
6645 /// Default number of tokens that can be consumed during the specified
6646 /// duration. This is the number of tokens assigned when a client
6647 /// application developer activates the service for his/her project.
6648 ///
6649 /// Specifying a value of 0 will block all requests. This can be used if you
6650 /// are provisioning quota to selected consumers and blocking others.
6651 /// Similarly, a value of -1 will indicate an unlimited quota. No other
6652 /// negative values are allowed.
6653 ///
6654 /// Used by group-based quotas only.
6655 #[serde_as(as = "serde_with::DisplayFromStr")]
6656 pub default_limit: i64,
6657
6658 /// Maximum number of tokens that can be consumed during the specified
6659 /// duration. Client application developers can override the default limit up
6660 /// to this maximum. If specified, this value cannot be set to a value less
6661 /// than the default limit. If not specified, it is set to the default limit.
6662 ///
6663 /// To allow clients to apply overrides with no upper bound, set this to -1,
6664 /// indicating unlimited maximum quota.
6665 ///
6666 /// Used by group-based quotas only.
6667 #[serde_as(as = "serde_with::DisplayFromStr")]
6668 pub max_limit: i64,
6669
6670 /// Free tier value displayed in the Developers Console for this limit.
6671 /// The free tier is the number of tokens that will be subtracted from the
6672 /// billed amount when billing is enabled.
6673 /// This field can only be set on a limit with duration "1d", in a billable
6674 /// group; it is invalid on any other limit. If this field is not set, it
6675 /// defaults to 0, indicating that there is no free tier for this service.
6676 ///
6677 /// Used by group-based quotas only.
6678 #[serde_as(as = "serde_with::DisplayFromStr")]
6679 pub free_tier: i64,
6680
6681 /// Duration of this limit in textual notation. Must be "100s" or "1d".
6682 ///
6683 /// Used by group-based quotas only.
6684 #[serde(skip_serializing_if = "std::string::String::is_empty")]
6685 pub duration: std::string::String,
6686
6687 /// The name of the metric this quota limit applies to. The quota limits with
6688 /// the same metric will be checked together during runtime. The metric must be
6689 /// defined within the service config.
6690 #[serde(skip_serializing_if = "std::string::String::is_empty")]
6691 pub metric: std::string::String,
6692
6693 /// Specify the unit of the quota limit. It uses the same syntax as
6694 /// [MetricDescriptor.unit][google.api.MetricDescriptor.unit]. The supported
6695 /// unit kinds are determined by the quota backend system.
6696 ///
6697 /// Here are some examples:
6698 ///
6699 /// * "1/min/{project}" for quota per minute per project.
6700 ///
6701 /// Note: the order of unit components is insignificant.
6702 /// The "1" at the beginning is required to follow the metric unit syntax.
6703 ///
6704 /// [google.api.MetricDescriptor.unit]: crate::model::MetricDescriptor::unit
6705 #[serde(skip_serializing_if = "std::string::String::is_empty")]
6706 pub unit: std::string::String,
6707
6708 /// Tiered limit values. You must specify this as a key:value pair, with an
6709 /// integer value that is the maximum number of requests allowed for the
6710 /// specified unit. Currently only STANDARD is supported.
6711 #[serde(skip_serializing_if = "std::collections::HashMap::is_empty")]
6712 #[serde_as(as = "std::collections::HashMap<_, serde_with::DisplayFromStr>")]
6713 pub values: std::collections::HashMap<std::string::String, i64>,
6714
6715 /// User-visible display name for this limit.
6716 /// Optional. If not set, the UI will provide a default display name based on
6717 /// the quota configuration. This field can be used to override the default
6718 /// display name generated from the configuration.
6719 #[serde(skip_serializing_if = "std::string::String::is_empty")]
6720 pub display_name: std::string::String,
6721
6722 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
6723 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6724}
6725
6726impl QuotaLimit {
6727 pub fn new() -> Self {
6728 std::default::Default::default()
6729 }
6730
6731 /// Sets the value of [name][crate::model::QuotaLimit::name].
6732 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6733 self.name = v.into();
6734 self
6735 }
6736
6737 /// Sets the value of [description][crate::model::QuotaLimit::description].
6738 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6739 self.description = v.into();
6740 self
6741 }
6742
6743 /// Sets the value of [default_limit][crate::model::QuotaLimit::default_limit].
6744 pub fn set_default_limit<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
6745 self.default_limit = v.into();
6746 self
6747 }
6748
6749 /// Sets the value of [max_limit][crate::model::QuotaLimit::max_limit].
6750 pub fn set_max_limit<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
6751 self.max_limit = v.into();
6752 self
6753 }
6754
6755 /// Sets the value of [free_tier][crate::model::QuotaLimit::free_tier].
6756 pub fn set_free_tier<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
6757 self.free_tier = v.into();
6758 self
6759 }
6760
6761 /// Sets the value of [duration][crate::model::QuotaLimit::duration].
6762 pub fn set_duration<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6763 self.duration = v.into();
6764 self
6765 }
6766
6767 /// Sets the value of [metric][crate::model::QuotaLimit::metric].
6768 pub fn set_metric<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6769 self.metric = v.into();
6770 self
6771 }
6772
6773 /// Sets the value of [unit][crate::model::QuotaLimit::unit].
6774 pub fn set_unit<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6775 self.unit = v.into();
6776 self
6777 }
6778
6779 /// Sets the value of [display_name][crate::model::QuotaLimit::display_name].
6780 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6781 self.display_name = v.into();
6782 self
6783 }
6784
6785 /// Sets the value of [values][crate::model::QuotaLimit::values].
6786 pub fn set_values<T, K, V>(mut self, v: T) -> Self
6787 where
6788 T: std::iter::IntoIterator<Item = (K, V)>,
6789 K: std::convert::Into<std::string::String>,
6790 V: std::convert::Into<i64>,
6791 {
6792 use std::iter::Iterator;
6793 self.values = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6794 self
6795 }
6796}
6797
6798impl wkt::message::Message for QuotaLimit {
6799 fn typename() -> &'static str {
6800 "type.googleapis.com/google.api.QuotaLimit"
6801 }
6802}
6803
6804/// A simple descriptor of a resource type.
6805///
6806/// ResourceDescriptor annotates a resource message (either by means of a
6807/// protobuf annotation or use in the service config), and associates the
6808/// resource's schema, the resource type, and the pattern of the resource name.
6809///
6810/// Example:
6811///
6812/// ```norust
6813/// message Topic {
6814/// // Indicates this message defines a resource schema.
6815/// // Declares the resource type in the format of {service}/{kind}.
6816/// // For Kubernetes resources, the format is {api group}/{kind}.
6817/// option (google.api.resource) = {
6818/// type: "pubsub.googleapis.com/Topic"
6819/// pattern: "projects/{project}/topics/{topic}"
6820/// };
6821/// }
6822/// ```
6823///
6824/// The ResourceDescriptor Yaml config will look like:
6825///
6826/// ```norust
6827/// resources:
6828/// - type: "pubsub.googleapis.com/Topic"
6829/// pattern: "projects/{project}/topics/{topic}"
6830/// ```
6831///
6832/// Sometimes, resources have multiple patterns, typically because they can
6833/// live under multiple parents.
6834///
6835/// Example:
6836///
6837/// ```norust
6838/// message LogEntry {
6839/// option (google.api.resource) = {
6840/// type: "logging.googleapis.com/LogEntry"
6841/// pattern: "projects/{project}/logs/{log}"
6842/// pattern: "folders/{folder}/logs/{log}"
6843/// pattern: "organizations/{organization}/logs/{log}"
6844/// pattern: "billingAccounts/{billing_account}/logs/{log}"
6845/// };
6846/// }
6847/// ```
6848///
6849/// The ResourceDescriptor Yaml config will look like:
6850///
6851/// ```norust
6852/// resources:
6853/// - type: 'logging.googleapis.com/LogEntry'
6854/// pattern: "projects/{project}/logs/{log}"
6855/// pattern: "folders/{folder}/logs/{log}"
6856/// pattern: "organizations/{organization}/logs/{log}"
6857/// pattern: "billingAccounts/{billing_account}/logs/{log}"
6858/// ```
6859#[serde_with::serde_as]
6860#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
6861#[serde(default, rename_all = "camelCase")]
6862#[non_exhaustive]
6863pub struct ResourceDescriptor {
6864 /// The resource type. It must be in the format of
6865 /// {service_name}/{resource_type_kind}. The `resource_type_kind` must be
6866 /// singular and must not include version numbers.
6867 ///
6868 /// Example: `storage.googleapis.com/Bucket`
6869 ///
6870 /// The value of the resource_type_kind must follow the regular expression
6871 /// /[A-Za-z][a-zA-Z0-9]+/. It should start with an upper case character and
6872 /// should use PascalCase (UpperCamelCase). The maximum number of
6873 /// characters allowed for the `resource_type_kind` is 100.
6874 #[serde(rename = "type")]
6875 #[serde(skip_serializing_if = "std::string::String::is_empty")]
6876 pub r#type: std::string::String,
6877
6878 /// Optional. The relative resource name pattern associated with this resource
6879 /// type. The DNS prefix of the full resource name shouldn't be specified here.
6880 ///
6881 /// The path pattern must follow the syntax, which aligns with HTTP binding
6882 /// syntax:
6883 ///
6884 /// ```norust
6885 /// Template = Segment { "/" Segment } ;
6886 /// Segment = LITERAL | Variable ;
6887 /// Variable = "{" LITERAL "}" ;
6888 /// ```
6889 ///
6890 /// Examples:
6891 ///
6892 /// ```norust
6893 /// - "projects/{project}/topics/{topic}"
6894 /// - "projects/{project}/knowledgeBases/{knowledge_base}"
6895 /// ```
6896 ///
6897 /// The components in braces correspond to the IDs for each resource in the
6898 /// hierarchy. It is expected that, if multiple patterns are provided,
6899 /// the same component name (e.g. "project") refers to IDs of the same
6900 /// type of resource.
6901 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
6902 pub pattern: std::vec::Vec<std::string::String>,
6903
6904 /// Optional. The field on the resource that designates the resource name
6905 /// field. If omitted, this is assumed to be "name".
6906 #[serde(skip_serializing_if = "std::string::String::is_empty")]
6907 pub name_field: std::string::String,
6908
6909 /// Optional. The historical or future-looking state of the resource pattern.
6910 ///
6911 /// Example:
6912 ///
6913 /// ```norust
6914 /// // The InspectTemplate message originally only supported resource
6915 /// // names with organization, and project was added later.
6916 /// message InspectTemplate {
6917 /// option (google.api.resource) = {
6918 /// type: "dlp.googleapis.com/InspectTemplate"
6919 /// pattern:
6920 /// "organizations/{organization}/inspectTemplates/{inspect_template}"
6921 /// pattern: "projects/{project}/inspectTemplates/{inspect_template}"
6922 /// history: ORIGINALLY_SINGLE_PATTERN
6923 /// };
6924 /// }
6925 /// ```
6926 pub history: crate::model::resource_descriptor::History,
6927
6928 /// The plural name used in the resource name and permission names, such as
6929 /// 'projects' for the resource name of 'projects/{project}' and the permission
6930 /// name of 'cloudresourcemanager.googleapis.com/projects.get'. One exception
6931 /// to this is for Nested Collections that have stuttering names, as defined
6932 /// in [AIP-122](https://google.aip.dev/122#nested-collections), where the
6933 /// collection ID in the resource name pattern does not necessarily directly
6934 /// match the `plural` value.
6935 ///
6936 /// It is the same concept of the `plural` field in k8s CRD spec
6937 /// <https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/>
6938 ///
6939 /// Note: The plural form is required even for singleton resources. See
6940 /// <https://aip.dev/156>
6941 #[serde(skip_serializing_if = "std::string::String::is_empty")]
6942 pub plural: std::string::String,
6943
6944 /// The same concept of the `singular` field in k8s CRD spec
6945 /// <https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/>
6946 /// Such as "project" for the `resourcemanager.googleapis.com/Project` type.
6947 #[serde(skip_serializing_if = "std::string::String::is_empty")]
6948 pub singular: std::string::String,
6949
6950 /// Style flag(s) for this resource.
6951 /// These indicate that a resource is expected to conform to a given
6952 /// style. See the specific style flags for additional information.
6953 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
6954 pub style: std::vec::Vec<crate::model::resource_descriptor::Style>,
6955
6956 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
6957 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6958}
6959
6960impl ResourceDescriptor {
6961 pub fn new() -> Self {
6962 std::default::Default::default()
6963 }
6964
6965 /// Sets the value of [r#type][crate::model::ResourceDescriptor::type].
6966 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6967 self.r#type = v.into();
6968 self
6969 }
6970
6971 /// Sets the value of [name_field][crate::model::ResourceDescriptor::name_field].
6972 pub fn set_name_field<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6973 self.name_field = v.into();
6974 self
6975 }
6976
6977 /// Sets the value of [history][crate::model::ResourceDescriptor::history].
6978 pub fn set_history<T: std::convert::Into<crate::model::resource_descriptor::History>>(
6979 mut self,
6980 v: T,
6981 ) -> Self {
6982 self.history = v.into();
6983 self
6984 }
6985
6986 /// Sets the value of [plural][crate::model::ResourceDescriptor::plural].
6987 pub fn set_plural<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6988 self.plural = v.into();
6989 self
6990 }
6991
6992 /// Sets the value of [singular][crate::model::ResourceDescriptor::singular].
6993 pub fn set_singular<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6994 self.singular = v.into();
6995 self
6996 }
6997
6998 /// Sets the value of [pattern][crate::model::ResourceDescriptor::pattern].
6999 pub fn set_pattern<T, V>(mut self, v: T) -> Self
7000 where
7001 T: std::iter::IntoIterator<Item = V>,
7002 V: std::convert::Into<std::string::String>,
7003 {
7004 use std::iter::Iterator;
7005 self.pattern = v.into_iter().map(|i| i.into()).collect();
7006 self
7007 }
7008
7009 /// Sets the value of [style][crate::model::ResourceDescriptor::style].
7010 pub fn set_style<T, V>(mut self, v: T) -> Self
7011 where
7012 T: std::iter::IntoIterator<Item = V>,
7013 V: std::convert::Into<crate::model::resource_descriptor::Style>,
7014 {
7015 use std::iter::Iterator;
7016 self.style = v.into_iter().map(|i| i.into()).collect();
7017 self
7018 }
7019}
7020
7021impl wkt::message::Message for ResourceDescriptor {
7022 fn typename() -> &'static str {
7023 "type.googleapis.com/google.api.ResourceDescriptor"
7024 }
7025}
7026
7027/// Defines additional types related to [ResourceDescriptor].
7028pub mod resource_descriptor {
7029 #[allow(unused_imports)]
7030 use super::*;
7031
7032 /// A description of the historical or future-looking state of the
7033 /// resource pattern.
7034 #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
7035 pub struct History(i32);
7036
7037 impl History {
7038 /// The "unset" value.
7039 pub const HISTORY_UNSPECIFIED: History = History::new(0);
7040
7041 /// The resource originally had one pattern and launched as such, and
7042 /// additional patterns were added later.
7043 pub const ORIGINALLY_SINGLE_PATTERN: History = History::new(1);
7044
7045 /// The resource has one pattern, but the API owner expects to add more
7046 /// later. (This is the inverse of ORIGINALLY_SINGLE_PATTERN, and prevents
7047 /// that from being necessary once there are multiple patterns.)
7048 pub const FUTURE_MULTI_PATTERN: History = History::new(2);
7049
7050 /// Creates a new History instance.
7051 pub(crate) const fn new(value: i32) -> Self {
7052 Self(value)
7053 }
7054
7055 /// Gets the enum value.
7056 pub fn value(&self) -> i32 {
7057 self.0
7058 }
7059
7060 /// Gets the enum value as a string.
7061 pub fn as_str_name(&self) -> std::borrow::Cow<'static, str> {
7062 match self.0 {
7063 0 => std::borrow::Cow::Borrowed("HISTORY_UNSPECIFIED"),
7064 1 => std::borrow::Cow::Borrowed("ORIGINALLY_SINGLE_PATTERN"),
7065 2 => std::borrow::Cow::Borrowed("FUTURE_MULTI_PATTERN"),
7066 _ => std::borrow::Cow::Owned(std::format!("UNKNOWN-VALUE:{}", self.0)),
7067 }
7068 }
7069
7070 /// Creates an enum value from the value name.
7071 pub fn from_str_name(name: &str) -> std::option::Option<Self> {
7072 match name {
7073 "HISTORY_UNSPECIFIED" => std::option::Option::Some(Self::HISTORY_UNSPECIFIED),
7074 "ORIGINALLY_SINGLE_PATTERN" => {
7075 std::option::Option::Some(Self::ORIGINALLY_SINGLE_PATTERN)
7076 }
7077 "FUTURE_MULTI_PATTERN" => std::option::Option::Some(Self::FUTURE_MULTI_PATTERN),
7078 _ => std::option::Option::None,
7079 }
7080 }
7081 }
7082
7083 impl std::convert::From<i32> for History {
7084 fn from(value: i32) -> Self {
7085 Self::new(value)
7086 }
7087 }
7088
7089 impl std::default::Default for History {
7090 fn default() -> Self {
7091 Self::new(0)
7092 }
7093 }
7094
7095 /// A flag representing a specific style that a resource claims to conform to.
7096 #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
7097 pub struct Style(i32);
7098
7099 impl Style {
7100 /// The unspecified value. Do not use.
7101 pub const STYLE_UNSPECIFIED: Style = Style::new(0);
7102
7103 /// This resource is intended to be "declarative-friendly".
7104 ///
7105 /// Declarative-friendly resources must be more strictly consistent, and
7106 /// setting this to true communicates to tools that this resource should
7107 /// adhere to declarative-friendly expectations.
7108 ///
7109 /// Note: This is used by the API linter (linter.aip.dev) to enable
7110 /// additional checks.
7111 pub const DECLARATIVE_FRIENDLY: Style = Style::new(1);
7112
7113 /// Creates a new Style instance.
7114 pub(crate) const fn new(value: i32) -> Self {
7115 Self(value)
7116 }
7117
7118 /// Gets the enum value.
7119 pub fn value(&self) -> i32 {
7120 self.0
7121 }
7122
7123 /// Gets the enum value as a string.
7124 pub fn as_str_name(&self) -> std::borrow::Cow<'static, str> {
7125 match self.0 {
7126 0 => std::borrow::Cow::Borrowed("STYLE_UNSPECIFIED"),
7127 1 => std::borrow::Cow::Borrowed("DECLARATIVE_FRIENDLY"),
7128 _ => std::borrow::Cow::Owned(std::format!("UNKNOWN-VALUE:{}", self.0)),
7129 }
7130 }
7131
7132 /// Creates an enum value from the value name.
7133 pub fn from_str_name(name: &str) -> std::option::Option<Self> {
7134 match name {
7135 "STYLE_UNSPECIFIED" => std::option::Option::Some(Self::STYLE_UNSPECIFIED),
7136 "DECLARATIVE_FRIENDLY" => std::option::Option::Some(Self::DECLARATIVE_FRIENDLY),
7137 _ => std::option::Option::None,
7138 }
7139 }
7140 }
7141
7142 impl std::convert::From<i32> for Style {
7143 fn from(value: i32) -> Self {
7144 Self::new(value)
7145 }
7146 }
7147
7148 impl std::default::Default for Style {
7149 fn default() -> Self {
7150 Self::new(0)
7151 }
7152 }
7153}
7154
7155/// Defines a proto annotation that describes a string field that refers to
7156/// an API resource.
7157#[serde_with::serde_as]
7158#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
7159#[serde(default, rename_all = "camelCase")]
7160#[non_exhaustive]
7161pub struct ResourceReference {
7162 /// The resource type that the annotated field references.
7163 ///
7164 /// Example:
7165 ///
7166 /// ```norust
7167 /// message Subscription {
7168 /// string topic = 2 [(google.api.resource_reference) = {
7169 /// type: "pubsub.googleapis.com/Topic"
7170 /// }];
7171 /// }
7172 /// ```
7173 ///
7174 /// Occasionally, a field may reference an arbitrary resource. In this case,
7175 /// APIs use the special value * in their resource reference.
7176 ///
7177 /// Example:
7178 ///
7179 /// ```norust
7180 /// message GetIamPolicyRequest {
7181 /// string resource = 2 [(google.api.resource_reference) = {
7182 /// type: "*"
7183 /// }];
7184 /// }
7185 /// ```
7186 #[serde(rename = "type")]
7187 #[serde(skip_serializing_if = "std::string::String::is_empty")]
7188 pub r#type: std::string::String,
7189
7190 /// The resource type of a child collection that the annotated field
7191 /// references. This is useful for annotating the `parent` field that
7192 /// doesn't have a fixed resource type.
7193 ///
7194 /// Example:
7195 ///
7196 /// ```norust
7197 /// message ListLogEntriesRequest {
7198 /// string parent = 1 [(google.api.resource_reference) = {
7199 /// child_type: "logging.googleapis.com/LogEntry"
7200 /// };
7201 /// }
7202 /// ```
7203 #[serde(skip_serializing_if = "std::string::String::is_empty")]
7204 pub child_type: std::string::String,
7205
7206 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
7207 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7208}
7209
7210impl ResourceReference {
7211 pub fn new() -> Self {
7212 std::default::Default::default()
7213 }
7214
7215 /// Sets the value of [r#type][crate::model::ResourceReference::type].
7216 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7217 self.r#type = v.into();
7218 self
7219 }
7220
7221 /// Sets the value of [child_type][crate::model::ResourceReference::child_type].
7222 pub fn set_child_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7223 self.child_type = v.into();
7224 self
7225 }
7226}
7227
7228impl wkt::message::Message for ResourceReference {
7229 fn typename() -> &'static str {
7230 "type.googleapis.com/google.api.ResourceReference"
7231 }
7232}
7233
7234/// Specifies the routing information that should be sent along with the request
7235/// in the form of routing header.
7236/// **NOTE:** All service configuration rules follow the "last one wins" order.
7237///
7238/// The examples below will apply to an RPC which has the following request type:
7239///
7240/// Message Definition:
7241///
7242/// ```norust
7243/// message Request {
7244/// // The name of the Table
7245/// // Values can be of the following formats:
7246/// // - `projects/<project>/tables/<table>`
7247/// // - `projects/<project>/instances/<instance>/tables/<table>`
7248/// // - `region/<region>/zones/<zone>/tables/<table>`
7249/// string table_name = 1;
7250///
7251/// // This value specifies routing for replication.
7252/// // It can be in the following formats:
7253/// // - `profiles/<profile_id>`
7254/// // - a legacy `profile_id` that can be any string
7255/// string app_profile_id = 2;
7256/// }
7257/// ```
7258///
7259/// Example message:
7260///
7261/// ```norust
7262/// {
7263/// table_name: projects/proj_foo/instances/instance_bar/table/table_baz,
7264/// app_profile_id: profiles/prof_qux
7265/// }
7266/// ```
7267///
7268/// The routing header consists of one or multiple key-value pairs. Every key
7269/// and value must be percent-encoded, and joined together in the format of
7270/// `key1=value1&key2=value2`.
7271/// The examples below skip the percent-encoding for readability.
7272///
7273/// Example 1
7274///
7275/// Extracting a field from the request to put into the routing header
7276/// unchanged, with the key equal to the field name.
7277///
7278/// annotation:
7279///
7280/// ```norust
7281/// option (google.api.routing) = {
7282/// // Take the `app_profile_id`.
7283/// routing_parameters {
7284/// field: "app_profile_id"
7285/// }
7286/// };
7287/// ```
7288///
7289/// result:
7290///
7291/// ```norust
7292/// x-goog-request-params: app_profile_id=profiles/prof_qux
7293/// ```
7294///
7295/// Example 2
7296///
7297/// Extracting a field from the request to put into the routing header
7298/// unchanged, with the key different from the field name.
7299///
7300/// annotation:
7301///
7302/// ```norust
7303/// option (google.api.routing) = {
7304/// // Take the `app_profile_id`, but name it `routing_id` in the header.
7305/// routing_parameters {
7306/// field: "app_profile_id"
7307/// path_template: "{routing_id=**}"
7308/// }
7309/// };
7310/// ```
7311///
7312/// result:
7313///
7314/// ```norust
7315/// x-goog-request-params: routing_id=profiles/prof_qux
7316/// ```
7317///
7318/// Example 3
7319///
7320/// Extracting a field from the request to put into the routing
7321/// header, while matching a path template syntax on the field's value.
7322///
7323/// NB: it is more useful to send nothing than to send garbage for the purpose
7324/// of dynamic routing, since garbage pollutes cache. Thus the matching.
7325///
7326/// Sub-example 3a
7327///
7328/// The field matches the template.
7329///
7330/// annotation:
7331///
7332/// ```norust
7333/// option (google.api.routing) = {
7334/// // Take the `table_name`, if it's well-formed (with project-based
7335/// // syntax).
7336/// routing_parameters {
7337/// field: "table_name"
7338/// path_template: "{table_name=projects/*/instances/*/**}"
7339/// }
7340/// };
7341/// ```
7342///
7343/// result:
7344///
7345/// ```norust
7346/// x-goog-request-params:
7347/// table_name=projects/proj_foo/instances/instance_bar/table/table_baz
7348/// ```
7349///
7350/// Sub-example 3b
7351///
7352/// The field does not match the template.
7353///
7354/// annotation:
7355///
7356/// ```norust
7357/// option (google.api.routing) = {
7358/// // Take the `table_name`, if it's well-formed (with region-based
7359/// // syntax).
7360/// routing_parameters {
7361/// field: "table_name"
7362/// path_template: "{table_name=regions/*/zones/*/**}"
7363/// }
7364/// };
7365/// ```
7366///
7367/// result:
7368///
7369/// ```norust
7370/// <no routing header will be sent>
7371/// ```
7372///
7373/// Sub-example 3c
7374///
7375/// Multiple alternative conflictingly named path templates are
7376/// specified. The one that matches is used to construct the header.
7377///
7378/// annotation:
7379///
7380/// ```norust
7381/// option (google.api.routing) = {
7382/// // Take the `table_name`, if it's well-formed, whether
7383/// // using the region- or projects-based syntax.
7384///
7385/// routing_parameters {
7386/// field: "table_name"
7387/// path_template: "{table_name=regions/*/zones/*/**}"
7388/// }
7389/// routing_parameters {
7390/// field: "table_name"
7391/// path_template: "{table_name=projects/*/instances/*/**}"
7392/// }
7393/// };
7394/// ```
7395///
7396/// result:
7397///
7398/// ```norust
7399/// x-goog-request-params:
7400/// table_name=projects/proj_foo/instances/instance_bar/table/table_baz
7401/// ```
7402///
7403/// Example 4
7404///
7405/// Extracting a single routing header key-value pair by matching a
7406/// template syntax on (a part of) a single request field.
7407///
7408/// annotation:
7409///
7410/// ```norust
7411/// option (google.api.routing) = {
7412/// // Take just the project id from the `table_name` field.
7413/// routing_parameters {
7414/// field: "table_name"
7415/// path_template: "{routing_id=projects/*}/**"
7416/// }
7417/// };
7418/// ```
7419///
7420/// result:
7421///
7422/// ```norust
7423/// x-goog-request-params: routing_id=projects/proj_foo
7424/// ```
7425///
7426/// Example 5
7427///
7428/// Extracting a single routing header key-value pair by matching
7429/// several conflictingly named path templates on (parts of) a single request
7430/// field. The last template to match "wins" the conflict.
7431///
7432/// annotation:
7433///
7434/// ```norust
7435/// option (google.api.routing) = {
7436/// // If the `table_name` does not have instances information,
7437/// // take just the project id for routing.
7438/// // Otherwise take project + instance.
7439///
7440/// routing_parameters {
7441/// field: "table_name"
7442/// path_template: "{routing_id=projects/*}/**"
7443/// }
7444/// routing_parameters {
7445/// field: "table_name"
7446/// path_template: "{routing_id=projects/*/instances/*}/**"
7447/// }
7448/// };
7449/// ```
7450///
7451/// result:
7452///
7453/// ```norust
7454/// x-goog-request-params:
7455/// routing_id=projects/proj_foo/instances/instance_bar
7456/// ```
7457///
7458/// Example 6
7459///
7460/// Extracting multiple routing header key-value pairs by matching
7461/// several non-conflicting path templates on (parts of) a single request field.
7462///
7463/// Sub-example 6a
7464///
7465/// Make the templates strict, so that if the `table_name` does not
7466/// have an instance information, nothing is sent.
7467///
7468/// annotation:
7469///
7470/// ```norust
7471/// option (google.api.routing) = {
7472/// // The routing code needs two keys instead of one composite
7473/// // but works only for the tables with the "project-instance" name
7474/// // syntax.
7475///
7476/// routing_parameters {
7477/// field: "table_name"
7478/// path_template: "{project_id=projects/*}/instances/*/**"
7479/// }
7480/// routing_parameters {
7481/// field: "table_name"
7482/// path_template: "projects/*/{instance_id=instances/*}/**"
7483/// }
7484/// };
7485/// ```
7486///
7487/// result:
7488///
7489/// ```norust
7490/// x-goog-request-params:
7491/// project_id=projects/proj_foo&instance_id=instances/instance_bar
7492/// ```
7493///
7494/// Sub-example 6b
7495///
7496/// Make the templates loose, so that if the `table_name` does not
7497/// have an instance information, just the project id part is sent.
7498///
7499/// annotation:
7500///
7501/// ```norust
7502/// option (google.api.routing) = {
7503/// // The routing code wants two keys instead of one composite
7504/// // but will work with just the `project_id` for tables without
7505/// // an instance in the `table_name`.
7506///
7507/// routing_parameters {
7508/// field: "table_name"
7509/// path_template: "{project_id=projects/*}/**"
7510/// }
7511/// routing_parameters {
7512/// field: "table_name"
7513/// path_template: "projects/*/{instance_id=instances/*}/**"
7514/// }
7515/// };
7516/// ```
7517///
7518/// result (is the same as 6a for our example message because it has the instance
7519/// information):
7520///
7521/// ```norust
7522/// x-goog-request-params:
7523/// project_id=projects/proj_foo&instance_id=instances/instance_bar
7524/// ```
7525///
7526/// Example 7
7527///
7528/// Extracting multiple routing header key-value pairs by matching
7529/// several path templates on multiple request fields.
7530///
7531/// NB: note that here there is no way to specify sending nothing if one of the
7532/// fields does not match its template. E.g. if the `table_name` is in the wrong
7533/// format, the `project_id` will not be sent, but the `routing_id` will be.
7534/// The backend routing code has to be aware of that and be prepared to not
7535/// receive a full complement of keys if it expects multiple.
7536///
7537/// annotation:
7538///
7539/// ```norust
7540/// option (google.api.routing) = {
7541/// // The routing needs both `project_id` and `routing_id`
7542/// // (from the `app_profile_id` field) for routing.
7543///
7544/// routing_parameters {
7545/// field: "table_name"
7546/// path_template: "{project_id=projects/*}/**"
7547/// }
7548/// routing_parameters {
7549/// field: "app_profile_id"
7550/// path_template: "{routing_id=**}"
7551/// }
7552/// };
7553/// ```
7554///
7555/// result:
7556///
7557/// ```norust
7558/// x-goog-request-params:
7559/// project_id=projects/proj_foo&routing_id=profiles/prof_qux
7560/// ```
7561///
7562/// Example 8
7563///
7564/// Extracting a single routing header key-value pair by matching
7565/// several conflictingly named path templates on several request fields. The
7566/// last template to match "wins" the conflict.
7567///
7568/// annotation:
7569///
7570/// ```norust
7571/// option (google.api.routing) = {
7572/// // The `routing_id` can be a project id or a region id depending on
7573/// // the table name format, but only if the `app_profile_id` is not set.
7574/// // If `app_profile_id` is set it should be used instead.
7575///
7576/// routing_parameters {
7577/// field: "table_name"
7578/// path_template: "{routing_id=projects/*}/**"
7579/// }
7580/// routing_parameters {
7581/// field: "table_name"
7582/// path_template: "{routing_id=regions/*}/**"
7583/// }
7584/// routing_parameters {
7585/// field: "app_profile_id"
7586/// path_template: "{routing_id=**}"
7587/// }
7588/// };
7589/// ```
7590///
7591/// result:
7592///
7593/// ```norust
7594/// x-goog-request-params: routing_id=profiles/prof_qux
7595/// ```
7596///
7597/// Example 9
7598///
7599/// Bringing it all together.
7600///
7601/// annotation:
7602///
7603/// ```norust
7604/// option (google.api.routing) = {
7605/// // For routing both `table_location` and a `routing_id` are needed.
7606/// //
7607/// // table_location can be either an instance id or a region+zone id.
7608/// //
7609/// // For `routing_id`, take the value of `app_profile_id`
7610/// // - If it's in the format `profiles/<profile_id>`, send
7611/// // just the `<profile_id>` part.
7612/// // - If it's any other literal, send it as is.
7613/// // If the `app_profile_id` is empty, and the `table_name` starts with
7614/// // the project_id, send that instead.
7615///
7616/// routing_parameters {
7617/// field: "table_name"
7618/// path_template: "projects/*/{table_location=instances/*}/tables/*"
7619/// }
7620/// routing_parameters {
7621/// field: "table_name"
7622/// path_template: "{table_location=regions/*/zones/*}/tables/*"
7623/// }
7624/// routing_parameters {
7625/// field: "table_name"
7626/// path_template: "{routing_id=projects/*}/**"
7627/// }
7628/// routing_parameters {
7629/// field: "app_profile_id"
7630/// path_template: "{routing_id=**}"
7631/// }
7632/// routing_parameters {
7633/// field: "app_profile_id"
7634/// path_template: "profiles/{routing_id=*}"
7635/// }
7636/// };
7637/// ```
7638///
7639/// result:
7640///
7641/// ```norust
7642/// x-goog-request-params:
7643/// table_location=instances/instance_bar&routing_id=prof_qux
7644/// ```
7645#[serde_with::serde_as]
7646#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
7647#[serde(default, rename_all = "camelCase")]
7648#[non_exhaustive]
7649pub struct RoutingRule {
7650 /// A collection of Routing Parameter specifications.
7651 /// **NOTE:** If multiple Routing Parameters describe the same key
7652 /// (via the `path_template` field or via the `field` field when
7653 /// `path_template` is not provided), "last one wins" rule
7654 /// determines which Parameter gets used.
7655 /// See the examples for more details.
7656 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
7657 pub routing_parameters: std::vec::Vec<crate::model::RoutingParameter>,
7658
7659 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
7660 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7661}
7662
7663impl RoutingRule {
7664 pub fn new() -> Self {
7665 std::default::Default::default()
7666 }
7667
7668 /// Sets the value of [routing_parameters][crate::model::RoutingRule::routing_parameters].
7669 pub fn set_routing_parameters<T, V>(mut self, v: T) -> Self
7670 where
7671 T: std::iter::IntoIterator<Item = V>,
7672 V: std::convert::Into<crate::model::RoutingParameter>,
7673 {
7674 use std::iter::Iterator;
7675 self.routing_parameters = v.into_iter().map(|i| i.into()).collect();
7676 self
7677 }
7678}
7679
7680impl wkt::message::Message for RoutingRule {
7681 fn typename() -> &'static str {
7682 "type.googleapis.com/google.api.RoutingRule"
7683 }
7684}
7685
7686/// A projection from an input message to the GRPC or REST header.
7687#[serde_with::serde_as]
7688#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
7689#[serde(default, rename_all = "camelCase")]
7690#[non_exhaustive]
7691pub struct RoutingParameter {
7692 /// A request field to extract the header key-value pair from.
7693 #[serde(skip_serializing_if = "std::string::String::is_empty")]
7694 pub field: std::string::String,
7695
7696 /// A pattern matching the key-value field. Optional.
7697 /// If not specified, the whole field specified in the `field` field will be
7698 /// taken as value, and its name used as key. If specified, it MUST contain
7699 /// exactly one named segment (along with any number of unnamed segments) The
7700 /// pattern will be matched over the field specified in the `field` field, then
7701 /// if the match is successful:
7702 ///
7703 /// - the name of the single named segment will be used as a header name,
7704 /// - the match value of the segment will be used as a header value;
7705 /// if the match is NOT successful, nothing will be sent.
7706 ///
7707 /// Example:
7708 ///
7709 /// ```norust
7710 /// -- This is a field in the request message
7711 /// | that the header value will be extracted from.
7712 /// |
7713 /// | -- This is the key name in the
7714 /// | | routing header.
7715 /// V |
7716 /// field: "table_name" v
7717 /// path_template: "projects/*/{table_location=instances/*}/tables/*"
7718 /// ^ ^
7719 /// | |
7720 /// In the {} brackets is the pattern that -- |
7721 /// specifies what to extract from the |
7722 /// field as a value to be sent. |
7723 /// |
7724 /// The string in the field must match the whole pattern --
7725 /// before brackets, inside brackets, after brackets.
7726 /// ```
7727 ///
7728 /// When looking at this specific example, we can see that:
7729 ///
7730 /// - A key-value pair with the key `table_location`
7731 /// and the value matching `instances/*` should be added
7732 /// to the x-goog-request-params routing header.
7733 /// - The value is extracted from the request message's `table_name` field
7734 /// if it matches the full pattern specified:
7735 /// `projects/*/instances/*/tables/*`.
7736 ///
7737 /// **NB:** If the `path_template` field is not provided, the key name is
7738 /// equal to the field name, and the whole field should be sent as a value.
7739 /// This makes the pattern for the field and the value functionally equivalent
7740 /// to `**`, and the configuration
7741 ///
7742 /// ```norust
7743 /// {
7744 /// field: "table_name"
7745 /// }
7746 /// ```
7747 ///
7748 /// is a functionally equivalent shorthand to:
7749 ///
7750 /// ```norust
7751 /// {
7752 /// field: "table_name"
7753 /// path_template: "{table_name=**}"
7754 /// }
7755 /// ```
7756 ///
7757 /// See Example 1 for more details.
7758 #[serde(skip_serializing_if = "std::string::String::is_empty")]
7759 pub path_template: std::string::String,
7760
7761 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
7762 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7763}
7764
7765impl RoutingParameter {
7766 pub fn new() -> Self {
7767 std::default::Default::default()
7768 }
7769
7770 /// Sets the value of [field][crate::model::RoutingParameter::field].
7771 pub fn set_field<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7772 self.field = v.into();
7773 self
7774 }
7775
7776 /// Sets the value of [path_template][crate::model::RoutingParameter::path_template].
7777 pub fn set_path_template<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7778 self.path_template = v.into();
7779 self
7780 }
7781}
7782
7783impl wkt::message::Message for RoutingParameter {
7784 fn typename() -> &'static str {
7785 "type.googleapis.com/google.api.RoutingParameter"
7786 }
7787}
7788
7789/// `Service` is the root object of Google API service configuration (service
7790/// config). It describes the basic information about a logical service,
7791/// such as the service name and the user-facing title, and delegates other
7792/// aspects to sub-sections. Each sub-section is either a proto message or a
7793/// repeated proto message that configures a specific aspect, such as auth.
7794/// For more information, see each proto message definition.
7795///
7796/// Example:
7797///
7798/// ```norust
7799/// type: google.api.Service
7800/// name: calendar.googleapis.com
7801/// title: Google Calendar API
7802/// apis:
7803/// - name: google.calendar.v3.Calendar
7804///
7805/// visibility:
7806/// rules:
7807/// - selector: "google.calendar.v3.*"
7808/// restriction: PREVIEW
7809/// backend:
7810/// rules:
7811/// - selector: "google.calendar.v3.*"
7812/// address: calendar.example.com
7813///
7814/// authentication:
7815/// providers:
7816/// - id: google_calendar_auth
7817/// jwks_uri: https://www.googleapis.com/oauth2/v1/certs
7818/// issuer: https://securetoken.google.com
7819/// rules:
7820/// - selector: "*"
7821/// requirements:
7822/// provider_id: google_calendar_auth
7823/// ```
7824#[serde_with::serde_as]
7825#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
7826#[serde(default, rename_all = "camelCase")]
7827#[non_exhaustive]
7828pub struct Service {
7829 /// The service name, which is a DNS-like logical identifier for the
7830 /// service, such as `calendar.googleapis.com`. The service name
7831 /// typically goes through DNS verification to make sure the owner
7832 /// of the service also owns the DNS name.
7833 #[serde(skip_serializing_if = "std::string::String::is_empty")]
7834 pub name: std::string::String,
7835
7836 /// The product title for this service, it is the name displayed in Google
7837 /// Cloud Console.
7838 #[serde(skip_serializing_if = "std::string::String::is_empty")]
7839 pub title: std::string::String,
7840
7841 /// The Google project that owns this service.
7842 #[serde(skip_serializing_if = "std::string::String::is_empty")]
7843 pub producer_project_id: std::string::String,
7844
7845 /// A unique ID for a specific instance of this message, typically assigned
7846 /// by the client for tracking purpose. Must be no longer than 63 characters
7847 /// and only lower case letters, digits, '.', '_' and '-' are allowed. If
7848 /// empty, the server may choose to generate one instead.
7849 #[serde(skip_serializing_if = "std::string::String::is_empty")]
7850 pub id: std::string::String,
7851
7852 /// A list of API interfaces exported by this service. Only the `name` field
7853 /// of the [google.protobuf.Api][google.protobuf.Api] needs to be provided by
7854 /// the configuration author, as the remaining fields will be derived from the
7855 /// IDL during the normalization process. It is an error to specify an API
7856 /// interface here which cannot be resolved against the associated IDL files.
7857 ///
7858 /// [google.protobuf.Api]: wkt::Api
7859 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
7860 pub apis: std::vec::Vec<wkt::Api>,
7861
7862 /// A list of all proto message types included in this API service.
7863 /// Types referenced directly or indirectly by the `apis` are automatically
7864 /// included. Messages which are not referenced but shall be included, such as
7865 /// types used by the `google.protobuf.Any` type, should be listed here by
7866 /// name by the configuration author. Example:
7867 ///
7868 /// ```norust
7869 /// types:
7870 /// - name: google.protobuf.Int32
7871 /// ```
7872 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
7873 pub types: std::vec::Vec<wkt::Type>,
7874
7875 /// A list of all enum types included in this API service. Enums referenced
7876 /// directly or indirectly by the `apis` are automatically included. Enums
7877 /// which are not referenced but shall be included should be listed here by
7878 /// name by the configuration author. Example:
7879 ///
7880 /// ```norust
7881 /// enums:
7882 /// - name: google.someapi.v1.SomeEnum
7883 /// ```
7884 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
7885 pub enums: std::vec::Vec<wkt::Enum>,
7886
7887 /// Additional API documentation.
7888 #[serde(skip_serializing_if = "std::option::Option::is_none")]
7889 pub documentation: std::option::Option<crate::model::Documentation>,
7890
7891 /// API backend configuration.
7892 #[serde(skip_serializing_if = "std::option::Option::is_none")]
7893 pub backend: std::option::Option<crate::model::Backend>,
7894
7895 /// HTTP configuration.
7896 #[serde(skip_serializing_if = "std::option::Option::is_none")]
7897 pub http: std::option::Option<crate::model::Http>,
7898
7899 /// Quota configuration.
7900 #[serde(skip_serializing_if = "std::option::Option::is_none")]
7901 pub quota: std::option::Option<crate::model::Quota>,
7902
7903 /// Auth configuration.
7904 #[serde(skip_serializing_if = "std::option::Option::is_none")]
7905 pub authentication: std::option::Option<crate::model::Authentication>,
7906
7907 /// Context configuration.
7908 #[serde(skip_serializing_if = "std::option::Option::is_none")]
7909 pub context: std::option::Option<crate::model::Context>,
7910
7911 /// Configuration controlling usage of this service.
7912 #[serde(skip_serializing_if = "std::option::Option::is_none")]
7913 pub usage: std::option::Option<crate::model::Usage>,
7914
7915 /// Configuration for network endpoints. If this is empty, then an endpoint
7916 /// with the same name as the service is automatically generated to service all
7917 /// defined APIs.
7918 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
7919 pub endpoints: std::vec::Vec<crate::model::Endpoint>,
7920
7921 /// Configuration for the service control plane.
7922 #[serde(skip_serializing_if = "std::option::Option::is_none")]
7923 pub control: std::option::Option<crate::model::Control>,
7924
7925 /// Defines the logs used by this service.
7926 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
7927 pub logs: std::vec::Vec<crate::model::LogDescriptor>,
7928
7929 /// Defines the metrics used by this service.
7930 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
7931 pub metrics: std::vec::Vec<crate::model::MetricDescriptor>,
7932
7933 /// Defines the monitored resources used by this service. This is required
7934 /// by the [Service.monitoring][google.api.Service.monitoring] and
7935 /// [Service.logging][google.api.Service.logging] configurations.
7936 ///
7937 /// [google.api.Service.logging]: crate::model::Service::logging
7938 /// [google.api.Service.monitoring]: crate::model::Service::monitoring
7939 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
7940 pub monitored_resources: std::vec::Vec<crate::model::MonitoredResourceDescriptor>,
7941
7942 /// Billing configuration.
7943 #[serde(skip_serializing_if = "std::option::Option::is_none")]
7944 pub billing: std::option::Option<crate::model::Billing>,
7945
7946 /// Logging configuration.
7947 #[serde(skip_serializing_if = "std::option::Option::is_none")]
7948 pub logging: std::option::Option<crate::model::Logging>,
7949
7950 /// Monitoring configuration.
7951 #[serde(skip_serializing_if = "std::option::Option::is_none")]
7952 pub monitoring: std::option::Option<crate::model::Monitoring>,
7953
7954 /// System parameter configuration.
7955 #[serde(skip_serializing_if = "std::option::Option::is_none")]
7956 pub system_parameters: std::option::Option<crate::model::SystemParameters>,
7957
7958 /// Output only. The source information for this configuration if available.
7959 #[serde(skip_serializing_if = "std::option::Option::is_none")]
7960 pub source_info: std::option::Option<crate::model::SourceInfo>,
7961
7962 /// Settings for [Google Cloud Client
7963 /// libraries](https://cloud.google.com/apis/docs/cloud-client-libraries)
7964 /// generated from APIs defined as protocol buffers.
7965 #[serde(skip_serializing_if = "std::option::Option::is_none")]
7966 pub publishing: std::option::Option<crate::model::Publishing>,
7967
7968 /// Obsolete. Do not use.
7969 ///
7970 /// This field has no semantic meaning. The service config compiler always
7971 /// sets this field to `3`.
7972 #[serde(skip_serializing_if = "std::option::Option::is_none")]
7973 pub config_version: std::option::Option<wkt::UInt32Value>,
7974
7975 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
7976 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7977}
7978
7979impl Service {
7980 pub fn new() -> Self {
7981 std::default::Default::default()
7982 }
7983
7984 /// Sets the value of [name][crate::model::Service::name].
7985 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7986 self.name = v.into();
7987 self
7988 }
7989
7990 /// Sets the value of [title][crate::model::Service::title].
7991 pub fn set_title<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7992 self.title = v.into();
7993 self
7994 }
7995
7996 /// Sets the value of [producer_project_id][crate::model::Service::producer_project_id].
7997 pub fn set_producer_project_id<T: std::convert::Into<std::string::String>>(
7998 mut self,
7999 v: T,
8000 ) -> Self {
8001 self.producer_project_id = v.into();
8002 self
8003 }
8004
8005 /// Sets the value of [id][crate::model::Service::id].
8006 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8007 self.id = v.into();
8008 self
8009 }
8010
8011 /// Sets the value of [documentation][crate::model::Service::documentation].
8012 pub fn set_documentation<
8013 T: std::convert::Into<std::option::Option<crate::model::Documentation>>,
8014 >(
8015 mut self,
8016 v: T,
8017 ) -> Self {
8018 self.documentation = v.into();
8019 self
8020 }
8021
8022 /// Sets the value of [backend][crate::model::Service::backend].
8023 pub fn set_backend<T: std::convert::Into<std::option::Option<crate::model::Backend>>>(
8024 mut self,
8025 v: T,
8026 ) -> Self {
8027 self.backend = v.into();
8028 self
8029 }
8030
8031 /// Sets the value of [http][crate::model::Service::http].
8032 pub fn set_http<T: std::convert::Into<std::option::Option<crate::model::Http>>>(
8033 mut self,
8034 v: T,
8035 ) -> Self {
8036 self.http = v.into();
8037 self
8038 }
8039
8040 /// Sets the value of [quota][crate::model::Service::quota].
8041 pub fn set_quota<T: std::convert::Into<std::option::Option<crate::model::Quota>>>(
8042 mut self,
8043 v: T,
8044 ) -> Self {
8045 self.quota = v.into();
8046 self
8047 }
8048
8049 /// Sets the value of [authentication][crate::model::Service::authentication].
8050 pub fn set_authentication<
8051 T: std::convert::Into<std::option::Option<crate::model::Authentication>>,
8052 >(
8053 mut self,
8054 v: T,
8055 ) -> Self {
8056 self.authentication = v.into();
8057 self
8058 }
8059
8060 /// Sets the value of [context][crate::model::Service::context].
8061 pub fn set_context<T: std::convert::Into<std::option::Option<crate::model::Context>>>(
8062 mut self,
8063 v: T,
8064 ) -> Self {
8065 self.context = v.into();
8066 self
8067 }
8068
8069 /// Sets the value of [usage][crate::model::Service::usage].
8070 pub fn set_usage<T: std::convert::Into<std::option::Option<crate::model::Usage>>>(
8071 mut self,
8072 v: T,
8073 ) -> Self {
8074 self.usage = v.into();
8075 self
8076 }
8077
8078 /// Sets the value of [control][crate::model::Service::control].
8079 pub fn set_control<T: std::convert::Into<std::option::Option<crate::model::Control>>>(
8080 mut self,
8081 v: T,
8082 ) -> Self {
8083 self.control = v.into();
8084 self
8085 }
8086
8087 /// Sets the value of [billing][crate::model::Service::billing].
8088 pub fn set_billing<T: std::convert::Into<std::option::Option<crate::model::Billing>>>(
8089 mut self,
8090 v: T,
8091 ) -> Self {
8092 self.billing = v.into();
8093 self
8094 }
8095
8096 /// Sets the value of [logging][crate::model::Service::logging].
8097 pub fn set_logging<T: std::convert::Into<std::option::Option<crate::model::Logging>>>(
8098 mut self,
8099 v: T,
8100 ) -> Self {
8101 self.logging = v.into();
8102 self
8103 }
8104
8105 /// Sets the value of [monitoring][crate::model::Service::monitoring].
8106 pub fn set_monitoring<T: std::convert::Into<std::option::Option<crate::model::Monitoring>>>(
8107 mut self,
8108 v: T,
8109 ) -> Self {
8110 self.monitoring = v.into();
8111 self
8112 }
8113
8114 /// Sets the value of [system_parameters][crate::model::Service::system_parameters].
8115 pub fn set_system_parameters<
8116 T: std::convert::Into<std::option::Option<crate::model::SystemParameters>>,
8117 >(
8118 mut self,
8119 v: T,
8120 ) -> Self {
8121 self.system_parameters = v.into();
8122 self
8123 }
8124
8125 /// Sets the value of [source_info][crate::model::Service::source_info].
8126 pub fn set_source_info<T: std::convert::Into<std::option::Option<crate::model::SourceInfo>>>(
8127 mut self,
8128 v: T,
8129 ) -> Self {
8130 self.source_info = v.into();
8131 self
8132 }
8133
8134 /// Sets the value of [publishing][crate::model::Service::publishing].
8135 pub fn set_publishing<T: std::convert::Into<std::option::Option<crate::model::Publishing>>>(
8136 mut self,
8137 v: T,
8138 ) -> Self {
8139 self.publishing = v.into();
8140 self
8141 }
8142
8143 /// Sets the value of [config_version][crate::model::Service::config_version].
8144 pub fn set_config_version<T: std::convert::Into<std::option::Option<wkt::UInt32Value>>>(
8145 mut self,
8146 v: T,
8147 ) -> Self {
8148 self.config_version = v.into();
8149 self
8150 }
8151
8152 /// Sets the value of [apis][crate::model::Service::apis].
8153 pub fn set_apis<T, V>(mut self, v: T) -> Self
8154 where
8155 T: std::iter::IntoIterator<Item = V>,
8156 V: std::convert::Into<wkt::Api>,
8157 {
8158 use std::iter::Iterator;
8159 self.apis = v.into_iter().map(|i| i.into()).collect();
8160 self
8161 }
8162
8163 /// Sets the value of [types][crate::model::Service::types].
8164 pub fn set_types<T, V>(mut self, v: T) -> Self
8165 where
8166 T: std::iter::IntoIterator<Item = V>,
8167 V: std::convert::Into<wkt::Type>,
8168 {
8169 use std::iter::Iterator;
8170 self.types = v.into_iter().map(|i| i.into()).collect();
8171 self
8172 }
8173
8174 /// Sets the value of [enums][crate::model::Service::enums].
8175 pub fn set_enums<T, V>(mut self, v: T) -> Self
8176 where
8177 T: std::iter::IntoIterator<Item = V>,
8178 V: std::convert::Into<wkt::Enum>,
8179 {
8180 use std::iter::Iterator;
8181 self.enums = v.into_iter().map(|i| i.into()).collect();
8182 self
8183 }
8184
8185 /// Sets the value of [endpoints][crate::model::Service::endpoints].
8186 pub fn set_endpoints<T, V>(mut self, v: T) -> Self
8187 where
8188 T: std::iter::IntoIterator<Item = V>,
8189 V: std::convert::Into<crate::model::Endpoint>,
8190 {
8191 use std::iter::Iterator;
8192 self.endpoints = v.into_iter().map(|i| i.into()).collect();
8193 self
8194 }
8195
8196 /// Sets the value of [logs][crate::model::Service::logs].
8197 pub fn set_logs<T, V>(mut self, v: T) -> Self
8198 where
8199 T: std::iter::IntoIterator<Item = V>,
8200 V: std::convert::Into<crate::model::LogDescriptor>,
8201 {
8202 use std::iter::Iterator;
8203 self.logs = v.into_iter().map(|i| i.into()).collect();
8204 self
8205 }
8206
8207 /// Sets the value of [metrics][crate::model::Service::metrics].
8208 pub fn set_metrics<T, V>(mut self, v: T) -> Self
8209 where
8210 T: std::iter::IntoIterator<Item = V>,
8211 V: std::convert::Into<crate::model::MetricDescriptor>,
8212 {
8213 use std::iter::Iterator;
8214 self.metrics = v.into_iter().map(|i| i.into()).collect();
8215 self
8216 }
8217
8218 /// Sets the value of [monitored_resources][crate::model::Service::monitored_resources].
8219 pub fn set_monitored_resources<T, V>(mut self, v: T) -> Self
8220 where
8221 T: std::iter::IntoIterator<Item = V>,
8222 V: std::convert::Into<crate::model::MonitoredResourceDescriptor>,
8223 {
8224 use std::iter::Iterator;
8225 self.monitored_resources = v.into_iter().map(|i| i.into()).collect();
8226 self
8227 }
8228}
8229
8230impl wkt::message::Message for Service {
8231 fn typename() -> &'static str {
8232 "type.googleapis.com/google.api.Service"
8233 }
8234}
8235
8236/// Source information used to create a Service Config
8237#[serde_with::serde_as]
8238#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
8239#[serde(default, rename_all = "camelCase")]
8240#[non_exhaustive]
8241pub struct SourceInfo {
8242 /// All files used during config generation.
8243 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
8244 pub source_files: std::vec::Vec<wkt::Any>,
8245
8246 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
8247 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8248}
8249
8250impl SourceInfo {
8251 pub fn new() -> Self {
8252 std::default::Default::default()
8253 }
8254
8255 /// Sets the value of [source_files][crate::model::SourceInfo::source_files].
8256 pub fn set_source_files<T, V>(mut self, v: T) -> Self
8257 where
8258 T: std::iter::IntoIterator<Item = V>,
8259 V: std::convert::Into<wkt::Any>,
8260 {
8261 use std::iter::Iterator;
8262 self.source_files = v.into_iter().map(|i| i.into()).collect();
8263 self
8264 }
8265}
8266
8267impl wkt::message::Message for SourceInfo {
8268 fn typename() -> &'static str {
8269 "type.googleapis.com/google.api.SourceInfo"
8270 }
8271}
8272
8273/// ### System parameter configuration
8274///
8275/// A system parameter is a special kind of parameter defined by the API
8276/// system, not by an individual API. It is typically mapped to an HTTP header
8277/// and/or a URL query parameter. This configuration specifies which methods
8278/// change the names of the system parameters.
8279#[serde_with::serde_as]
8280#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
8281#[serde(default, rename_all = "camelCase")]
8282#[non_exhaustive]
8283pub struct SystemParameters {
8284 /// Define system parameters.
8285 ///
8286 /// The parameters defined here will override the default parameters
8287 /// implemented by the system. If this field is missing from the service
8288 /// config, default system parameters will be used. Default system parameters
8289 /// and names is implementation-dependent.
8290 ///
8291 /// Example: define api key for all methods
8292 ///
8293 /// ```norust
8294 /// system_parameters
8295 /// rules:
8296 /// - selector: "*"
8297 /// parameters:
8298 /// - name: api_key
8299 /// url_query_parameter: api_key
8300 /// ```
8301 ///
8302 /// Example: define 2 api key names for a specific method.
8303 ///
8304 /// ```norust
8305 /// system_parameters
8306 /// rules:
8307 /// - selector: "/ListShelves"
8308 /// parameters:
8309 /// - name: api_key
8310 /// http_header: Api-Key1
8311 /// - name: api_key
8312 /// http_header: Api-Key2
8313 /// ```
8314 ///
8315 /// **NOTE:** All service configuration rules follow "last one wins" order.
8316 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
8317 pub rules: std::vec::Vec<crate::model::SystemParameterRule>,
8318
8319 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
8320 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8321}
8322
8323impl SystemParameters {
8324 pub fn new() -> Self {
8325 std::default::Default::default()
8326 }
8327
8328 /// Sets the value of [rules][crate::model::SystemParameters::rules].
8329 pub fn set_rules<T, V>(mut self, v: T) -> Self
8330 where
8331 T: std::iter::IntoIterator<Item = V>,
8332 V: std::convert::Into<crate::model::SystemParameterRule>,
8333 {
8334 use std::iter::Iterator;
8335 self.rules = v.into_iter().map(|i| i.into()).collect();
8336 self
8337 }
8338}
8339
8340impl wkt::message::Message for SystemParameters {
8341 fn typename() -> &'static str {
8342 "type.googleapis.com/google.api.SystemParameters"
8343 }
8344}
8345
8346/// Define a system parameter rule mapping system parameter definitions to
8347/// methods.
8348#[serde_with::serde_as]
8349#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
8350#[serde(default, rename_all = "camelCase")]
8351#[non_exhaustive]
8352pub struct SystemParameterRule {
8353 /// Selects the methods to which this rule applies. Use '*' to indicate all
8354 /// methods in all APIs.
8355 ///
8356 /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
8357 /// details.
8358 ///
8359 /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
8360 #[serde(skip_serializing_if = "std::string::String::is_empty")]
8361 pub selector: std::string::String,
8362
8363 /// Define parameters. Multiple names may be defined for a parameter.
8364 /// For a given method call, only one of them should be used. If multiple
8365 /// names are used the behavior is implementation-dependent.
8366 /// If none of the specified names are present the behavior is
8367 /// parameter-dependent.
8368 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
8369 pub parameters: std::vec::Vec<crate::model::SystemParameter>,
8370
8371 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
8372 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8373}
8374
8375impl SystemParameterRule {
8376 pub fn new() -> Self {
8377 std::default::Default::default()
8378 }
8379
8380 /// Sets the value of [selector][crate::model::SystemParameterRule::selector].
8381 pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8382 self.selector = v.into();
8383 self
8384 }
8385
8386 /// Sets the value of [parameters][crate::model::SystemParameterRule::parameters].
8387 pub fn set_parameters<T, V>(mut self, v: T) -> Self
8388 where
8389 T: std::iter::IntoIterator<Item = V>,
8390 V: std::convert::Into<crate::model::SystemParameter>,
8391 {
8392 use std::iter::Iterator;
8393 self.parameters = v.into_iter().map(|i| i.into()).collect();
8394 self
8395 }
8396}
8397
8398impl wkt::message::Message for SystemParameterRule {
8399 fn typename() -> &'static str {
8400 "type.googleapis.com/google.api.SystemParameterRule"
8401 }
8402}
8403
8404/// Define a parameter's name and location. The parameter may be passed as either
8405/// an HTTP header or a URL query parameter, and if both are passed the behavior
8406/// is implementation-dependent.
8407#[serde_with::serde_as]
8408#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
8409#[serde(default, rename_all = "camelCase")]
8410#[non_exhaustive]
8411pub struct SystemParameter {
8412 /// Define the name of the parameter, such as "api_key" . It is case sensitive.
8413 #[serde(skip_serializing_if = "std::string::String::is_empty")]
8414 pub name: std::string::String,
8415
8416 /// Define the HTTP header name to use for the parameter. It is case
8417 /// insensitive.
8418 #[serde(skip_serializing_if = "std::string::String::is_empty")]
8419 pub http_header: std::string::String,
8420
8421 /// Define the URL query parameter name to use for the parameter. It is case
8422 /// sensitive.
8423 #[serde(skip_serializing_if = "std::string::String::is_empty")]
8424 pub url_query_parameter: std::string::String,
8425
8426 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
8427 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8428}
8429
8430impl SystemParameter {
8431 pub fn new() -> Self {
8432 std::default::Default::default()
8433 }
8434
8435 /// Sets the value of [name][crate::model::SystemParameter::name].
8436 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8437 self.name = v.into();
8438 self
8439 }
8440
8441 /// Sets the value of [http_header][crate::model::SystemParameter::http_header].
8442 pub fn set_http_header<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8443 self.http_header = v.into();
8444 self
8445 }
8446
8447 /// Sets the value of [url_query_parameter][crate::model::SystemParameter::url_query_parameter].
8448 pub fn set_url_query_parameter<T: std::convert::Into<std::string::String>>(
8449 mut self,
8450 v: T,
8451 ) -> Self {
8452 self.url_query_parameter = v.into();
8453 self
8454 }
8455}
8456
8457impl wkt::message::Message for SystemParameter {
8458 fn typename() -> &'static str {
8459 "type.googleapis.com/google.api.SystemParameter"
8460 }
8461}
8462
8463/// Configuration controlling usage of a service.
8464#[serde_with::serde_as]
8465#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
8466#[serde(default, rename_all = "camelCase")]
8467#[non_exhaustive]
8468pub struct Usage {
8469 /// Requirements that must be satisfied before a consumer project can use the
8470 /// service. Each requirement is of the form <service.name>/\<requirement-id\>;
8471 /// for example 'serviceusage.googleapis.com/billing-enabled'.
8472 ///
8473 /// For Google APIs, a Terms of Service requirement must be included here.
8474 /// Google Cloud APIs must include "serviceusage.googleapis.com/tos/cloud".
8475 /// Other Google APIs should include
8476 /// "serviceusage.googleapis.com/tos/universal". Additional ToS can be
8477 /// included based on the business needs.
8478 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
8479 pub requirements: std::vec::Vec<std::string::String>,
8480
8481 /// A list of usage rules that apply to individual API methods.
8482 ///
8483 /// **NOTE:** All service configuration rules follow "last one wins" order.
8484 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
8485 pub rules: std::vec::Vec<crate::model::UsageRule>,
8486
8487 /// The full resource name of a channel used for sending notifications to the
8488 /// service producer.
8489 ///
8490 /// Google Service Management currently only supports
8491 /// [Google Cloud Pub/Sub](https://cloud.google.com/pubsub) as a notification
8492 /// channel. To use Google Cloud Pub/Sub as the channel, this must be the name
8493 /// of a Cloud Pub/Sub topic that uses the Cloud Pub/Sub topic name format
8494 /// documented in <https://cloud.google.com/pubsub/docs/overview>.
8495 #[serde(skip_serializing_if = "std::string::String::is_empty")]
8496 pub producer_notification_channel: std::string::String,
8497
8498 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
8499 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8500}
8501
8502impl Usage {
8503 pub fn new() -> Self {
8504 std::default::Default::default()
8505 }
8506
8507 /// Sets the value of [producer_notification_channel][crate::model::Usage::producer_notification_channel].
8508 pub fn set_producer_notification_channel<T: std::convert::Into<std::string::String>>(
8509 mut self,
8510 v: T,
8511 ) -> Self {
8512 self.producer_notification_channel = v.into();
8513 self
8514 }
8515
8516 /// Sets the value of [requirements][crate::model::Usage::requirements].
8517 pub fn set_requirements<T, V>(mut self, v: T) -> Self
8518 where
8519 T: std::iter::IntoIterator<Item = V>,
8520 V: std::convert::Into<std::string::String>,
8521 {
8522 use std::iter::Iterator;
8523 self.requirements = v.into_iter().map(|i| i.into()).collect();
8524 self
8525 }
8526
8527 /// Sets the value of [rules][crate::model::Usage::rules].
8528 pub fn set_rules<T, V>(mut self, v: T) -> Self
8529 where
8530 T: std::iter::IntoIterator<Item = V>,
8531 V: std::convert::Into<crate::model::UsageRule>,
8532 {
8533 use std::iter::Iterator;
8534 self.rules = v.into_iter().map(|i| i.into()).collect();
8535 self
8536 }
8537}
8538
8539impl wkt::message::Message for Usage {
8540 fn typename() -> &'static str {
8541 "type.googleapis.com/google.api.Usage"
8542 }
8543}
8544
8545/// Usage configuration rules for the service.
8546///
8547/// NOTE: Under development.
8548///
8549/// Use this rule to configure unregistered calls for the service. Unregistered
8550/// calls are calls that do not contain consumer project identity.
8551/// (Example: calls that do not contain an API key).
8552/// By default, API methods do not allow unregistered calls, and each method call
8553/// must be identified by a consumer project identity. Use this rule to
8554/// allow/disallow unregistered calls.
8555///
8556/// Example of an API that wants to allow unregistered calls for entire service.
8557///
8558/// ```norust
8559/// usage:
8560/// rules:
8561/// - selector: "*"
8562/// allow_unregistered_calls: true
8563/// ```
8564///
8565/// Example of a method that wants to allow unregistered calls.
8566///
8567/// ```norust
8568/// usage:
8569/// rules:
8570/// - selector: "google.example.library.v1.LibraryService.CreateBook"
8571/// allow_unregistered_calls: true
8572/// ```
8573#[serde_with::serde_as]
8574#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
8575#[serde(default, rename_all = "camelCase")]
8576#[non_exhaustive]
8577pub struct UsageRule {
8578 /// Selects the methods to which this rule applies. Use '*' to indicate all
8579 /// methods in all APIs.
8580 ///
8581 /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
8582 /// details.
8583 ///
8584 /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
8585 #[serde(skip_serializing_if = "std::string::String::is_empty")]
8586 pub selector: std::string::String,
8587
8588 /// If true, the selected method allows unregistered calls, e.g. calls
8589 /// that don't identify any user or application.
8590 pub allow_unregistered_calls: bool,
8591
8592 /// If true, the selected method should skip service control and the control
8593 /// plane features, such as quota and billing, will not be available.
8594 /// This flag is used by Google Cloud Endpoints to bypass checks for internal
8595 /// methods, such as service health check methods.
8596 pub skip_service_control: bool,
8597
8598 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
8599 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8600}
8601
8602impl UsageRule {
8603 pub fn new() -> Self {
8604 std::default::Default::default()
8605 }
8606
8607 /// Sets the value of [selector][crate::model::UsageRule::selector].
8608 pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8609 self.selector = v.into();
8610 self
8611 }
8612
8613 /// Sets the value of [allow_unregistered_calls][crate::model::UsageRule::allow_unregistered_calls].
8614 pub fn set_allow_unregistered_calls<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8615 self.allow_unregistered_calls = v.into();
8616 self
8617 }
8618
8619 /// Sets the value of [skip_service_control][crate::model::UsageRule::skip_service_control].
8620 pub fn set_skip_service_control<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8621 self.skip_service_control = v.into();
8622 self
8623 }
8624}
8625
8626impl wkt::message::Message for UsageRule {
8627 fn typename() -> &'static str {
8628 "type.googleapis.com/google.api.UsageRule"
8629 }
8630}
8631
8632/// `Visibility` restricts service consumer's access to service elements,
8633/// such as whether an application can call a visibility-restricted method.
8634/// The restriction is expressed by applying visibility labels on service
8635/// elements. The visibility labels are elsewhere linked to service consumers.
8636///
8637/// A service can define multiple visibility labels, but a service consumer
8638/// should be granted at most one visibility label. Multiple visibility
8639/// labels for a single service consumer are not supported.
8640///
8641/// If an element and all its parents have no visibility label, its visibility
8642/// is unconditionally granted.
8643///
8644/// Example:
8645///
8646/// ```norust
8647/// visibility:
8648/// rules:
8649/// - selector: google.calendar.Calendar.EnhancedSearch
8650/// restriction: PREVIEW
8651/// - selector: google.calendar.Calendar.Delegate
8652/// restriction: INTERNAL
8653/// ```
8654///
8655/// Here, all methods are publicly visible except for the restricted methods
8656/// EnhancedSearch and Delegate.
8657#[serde_with::serde_as]
8658#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
8659#[serde(default, rename_all = "camelCase")]
8660#[non_exhaustive]
8661pub struct Visibility {
8662 /// A list of visibility rules that apply to individual API elements.
8663 ///
8664 /// **NOTE:** All service configuration rules follow "last one wins" order.
8665 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
8666 pub rules: std::vec::Vec<crate::model::VisibilityRule>,
8667
8668 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
8669 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8670}
8671
8672impl Visibility {
8673 pub fn new() -> Self {
8674 std::default::Default::default()
8675 }
8676
8677 /// Sets the value of [rules][crate::model::Visibility::rules].
8678 pub fn set_rules<T, V>(mut self, v: T) -> Self
8679 where
8680 T: std::iter::IntoIterator<Item = V>,
8681 V: std::convert::Into<crate::model::VisibilityRule>,
8682 {
8683 use std::iter::Iterator;
8684 self.rules = v.into_iter().map(|i| i.into()).collect();
8685 self
8686 }
8687}
8688
8689impl wkt::message::Message for Visibility {
8690 fn typename() -> &'static str {
8691 "type.googleapis.com/google.api.Visibility"
8692 }
8693}
8694
8695/// A visibility rule provides visibility configuration for an individual API
8696/// element.
8697#[serde_with::serde_as]
8698#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
8699#[serde(default, rename_all = "camelCase")]
8700#[non_exhaustive]
8701pub struct VisibilityRule {
8702 /// Selects methods, messages, fields, enums, etc. to which this rule applies.
8703 ///
8704 /// Refer to [selector][google.api.DocumentationRule.selector] for syntax
8705 /// details.
8706 ///
8707 /// [google.api.DocumentationRule.selector]: crate::model::DocumentationRule::selector
8708 #[serde(skip_serializing_if = "std::string::String::is_empty")]
8709 pub selector: std::string::String,
8710
8711 /// A comma-separated list of visibility labels that apply to the `selector`.
8712 /// Any of the listed labels can be used to grant the visibility.
8713 ///
8714 /// If a rule has multiple labels, removing one of the labels but not all of
8715 /// them can break clients.
8716 ///
8717 /// Example:
8718 ///
8719 /// ```norust
8720 /// visibility:
8721 /// rules:
8722 /// - selector: google.calendar.Calendar.EnhancedSearch
8723 /// restriction: INTERNAL, PREVIEW
8724 /// ```
8725 ///
8726 /// Removing INTERNAL from this restriction will break clients that rely on
8727 /// this method and only had access to it through INTERNAL.
8728 #[serde(skip_serializing_if = "std::string::String::is_empty")]
8729 pub restriction: std::string::String,
8730
8731 #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
8732 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8733}
8734
8735impl VisibilityRule {
8736 pub fn new() -> Self {
8737 std::default::Default::default()
8738 }
8739
8740 /// Sets the value of [selector][crate::model::VisibilityRule::selector].
8741 pub fn set_selector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8742 self.selector = v.into();
8743 self
8744 }
8745
8746 /// Sets the value of [restriction][crate::model::VisibilityRule::restriction].
8747 pub fn set_restriction<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8748 self.restriction = v.into();
8749 self
8750 }
8751}
8752
8753impl wkt::message::Message for VisibilityRule {
8754 fn typename() -> &'static str {
8755 "type.googleapis.com/google.api.VisibilityRule"
8756 }
8757}
8758
8759/// The organization for which the client libraries are being published.
8760/// Affects the url where generated docs are published, etc.
8761#[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
8762pub struct ClientLibraryOrganization(i32);
8763
8764impl ClientLibraryOrganization {
8765 /// Not useful.
8766 pub const CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED: ClientLibraryOrganization =
8767 ClientLibraryOrganization::new(0);
8768
8769 /// Google Cloud Platform Org.
8770 pub const CLOUD: ClientLibraryOrganization = ClientLibraryOrganization::new(1);
8771
8772 /// Ads (Advertising) Org.
8773 pub const ADS: ClientLibraryOrganization = ClientLibraryOrganization::new(2);
8774
8775 /// Photos Org.
8776 pub const PHOTOS: ClientLibraryOrganization = ClientLibraryOrganization::new(3);
8777
8778 /// Street View Org.
8779 pub const STREET_VIEW: ClientLibraryOrganization = ClientLibraryOrganization::new(4);
8780
8781 /// Shopping Org.
8782 pub const SHOPPING: ClientLibraryOrganization = ClientLibraryOrganization::new(5);
8783
8784 /// Geo Org.
8785 pub const GEO: ClientLibraryOrganization = ClientLibraryOrganization::new(6);
8786
8787 /// Generative AI - <https://developers.generativeai.google>
8788 pub const GENERATIVE_AI: ClientLibraryOrganization = ClientLibraryOrganization::new(7);
8789
8790 /// Creates a new ClientLibraryOrganization instance.
8791 pub(crate) const fn new(value: i32) -> Self {
8792 Self(value)
8793 }
8794
8795 /// Gets the enum value.
8796 pub fn value(&self) -> i32 {
8797 self.0
8798 }
8799
8800 /// Gets the enum value as a string.
8801 pub fn as_str_name(&self) -> std::borrow::Cow<'static, str> {
8802 match self.0 {
8803 0 => std::borrow::Cow::Borrowed("CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED"),
8804 1 => std::borrow::Cow::Borrowed("CLOUD"),
8805 2 => std::borrow::Cow::Borrowed("ADS"),
8806 3 => std::borrow::Cow::Borrowed("PHOTOS"),
8807 4 => std::borrow::Cow::Borrowed("STREET_VIEW"),
8808 5 => std::borrow::Cow::Borrowed("SHOPPING"),
8809 6 => std::borrow::Cow::Borrowed("GEO"),
8810 7 => std::borrow::Cow::Borrowed("GENERATIVE_AI"),
8811 _ => std::borrow::Cow::Owned(std::format!("UNKNOWN-VALUE:{}", self.0)),
8812 }
8813 }
8814
8815 /// Creates an enum value from the value name.
8816 pub fn from_str_name(name: &str) -> std::option::Option<Self> {
8817 match name {
8818 "CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED" => {
8819 std::option::Option::Some(Self::CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED)
8820 }
8821 "CLOUD" => std::option::Option::Some(Self::CLOUD),
8822 "ADS" => std::option::Option::Some(Self::ADS),
8823 "PHOTOS" => std::option::Option::Some(Self::PHOTOS),
8824 "STREET_VIEW" => std::option::Option::Some(Self::STREET_VIEW),
8825 "SHOPPING" => std::option::Option::Some(Self::SHOPPING),
8826 "GEO" => std::option::Option::Some(Self::GEO),
8827 "GENERATIVE_AI" => std::option::Option::Some(Self::GENERATIVE_AI),
8828 _ => std::option::Option::None,
8829 }
8830 }
8831}
8832
8833impl std::convert::From<i32> for ClientLibraryOrganization {
8834 fn from(value: i32) -> Self {
8835 Self::new(value)
8836 }
8837}
8838
8839impl std::default::Default for ClientLibraryOrganization {
8840 fn default() -> Self {
8841 Self::new(0)
8842 }
8843}
8844
8845/// To where should client libraries be published?
8846#[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
8847pub struct ClientLibraryDestination(i32);
8848
8849impl ClientLibraryDestination {
8850 /// Client libraries will neither be generated nor published to package
8851 /// managers.
8852 pub const CLIENT_LIBRARY_DESTINATION_UNSPECIFIED: ClientLibraryDestination =
8853 ClientLibraryDestination::new(0);
8854
8855 /// Generate the client library in a repo under github.com/googleapis,
8856 /// but don't publish it to package managers.
8857 pub const GITHUB: ClientLibraryDestination = ClientLibraryDestination::new(10);
8858
8859 /// Publish the library to package managers like nuget.org and npmjs.com.
8860 pub const PACKAGE_MANAGER: ClientLibraryDestination = ClientLibraryDestination::new(20);
8861
8862 /// Creates a new ClientLibraryDestination instance.
8863 pub(crate) const fn new(value: i32) -> Self {
8864 Self(value)
8865 }
8866
8867 /// Gets the enum value.
8868 pub fn value(&self) -> i32 {
8869 self.0
8870 }
8871
8872 /// Gets the enum value as a string.
8873 pub fn as_str_name(&self) -> std::borrow::Cow<'static, str> {
8874 match self.0 {
8875 0 => std::borrow::Cow::Borrowed("CLIENT_LIBRARY_DESTINATION_UNSPECIFIED"),
8876 10 => std::borrow::Cow::Borrowed("GITHUB"),
8877 20 => std::borrow::Cow::Borrowed("PACKAGE_MANAGER"),
8878 _ => std::borrow::Cow::Owned(std::format!("UNKNOWN-VALUE:{}", self.0)),
8879 }
8880 }
8881
8882 /// Creates an enum value from the value name.
8883 pub fn from_str_name(name: &str) -> std::option::Option<Self> {
8884 match name {
8885 "CLIENT_LIBRARY_DESTINATION_UNSPECIFIED" => {
8886 std::option::Option::Some(Self::CLIENT_LIBRARY_DESTINATION_UNSPECIFIED)
8887 }
8888 "GITHUB" => std::option::Option::Some(Self::GITHUB),
8889 "PACKAGE_MANAGER" => std::option::Option::Some(Self::PACKAGE_MANAGER),
8890 _ => std::option::Option::None,
8891 }
8892 }
8893}
8894
8895impl std::convert::From<i32> for ClientLibraryDestination {
8896 fn from(value: i32) -> Self {
8897 Self::new(value)
8898 }
8899}
8900
8901impl std::default::Default for ClientLibraryDestination {
8902 fn default() -> Self {
8903 Self::new(0)
8904 }
8905}
8906
8907/// Classifies set of possible modifications to an object in the service
8908/// configuration.
8909#[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
8910pub struct ChangeType(i32);
8911
8912impl ChangeType {
8913 /// No value was provided.
8914 pub const CHANGE_TYPE_UNSPECIFIED: ChangeType = ChangeType::new(0);
8915
8916 /// The changed object exists in the 'new' service configuration, but not
8917 /// in the 'old' service configuration.
8918 pub const ADDED: ChangeType = ChangeType::new(1);
8919
8920 /// The changed object exists in the 'old' service configuration, but not
8921 /// in the 'new' service configuration.
8922 pub const REMOVED: ChangeType = ChangeType::new(2);
8923
8924 /// The changed object exists in both service configurations, but its value
8925 /// is different.
8926 pub const MODIFIED: ChangeType = ChangeType::new(3);
8927
8928 /// Creates a new ChangeType instance.
8929 pub(crate) const fn new(value: i32) -> Self {
8930 Self(value)
8931 }
8932
8933 /// Gets the enum value.
8934 pub fn value(&self) -> i32 {
8935 self.0
8936 }
8937
8938 /// Gets the enum value as a string.
8939 pub fn as_str_name(&self) -> std::borrow::Cow<'static, str> {
8940 match self.0 {
8941 0 => std::borrow::Cow::Borrowed("CHANGE_TYPE_UNSPECIFIED"),
8942 1 => std::borrow::Cow::Borrowed("ADDED"),
8943 2 => std::borrow::Cow::Borrowed("REMOVED"),
8944 3 => std::borrow::Cow::Borrowed("MODIFIED"),
8945 _ => std::borrow::Cow::Owned(std::format!("UNKNOWN-VALUE:{}", self.0)),
8946 }
8947 }
8948
8949 /// Creates an enum value from the value name.
8950 pub fn from_str_name(name: &str) -> std::option::Option<Self> {
8951 match name {
8952 "CHANGE_TYPE_UNSPECIFIED" => std::option::Option::Some(Self::CHANGE_TYPE_UNSPECIFIED),
8953 "ADDED" => std::option::Option::Some(Self::ADDED),
8954 "REMOVED" => std::option::Option::Some(Self::REMOVED),
8955 "MODIFIED" => std::option::Option::Some(Self::MODIFIED),
8956 _ => std::option::Option::None,
8957 }
8958 }
8959}
8960
8961impl std::convert::From<i32> for ChangeType {
8962 fn from(value: i32) -> Self {
8963 Self::new(value)
8964 }
8965}
8966
8967impl std::default::Default for ChangeType {
8968 fn default() -> Self {
8969 Self::new(0)
8970 }
8971}
8972
8973/// Defines the supported values for `google.rpc.ErrorInfo.reason` for the
8974/// `googleapis.com` error domain. This error domain is reserved for [Service
8975/// Infrastructure](https://cloud.google.com/service-infrastructure/docs/overview).
8976/// For each error info of this domain, the metadata key "service" refers to the
8977/// logical identifier of an API service, such as "pubsub.googleapis.com". The
8978/// "consumer" refers to the entity that consumes an API Service. It typically is
8979/// a Google project that owns the client application or the server resource,
8980/// such as "projects/123". Other metadata keys are specific to each error
8981/// reason. For more information, see the definition of the specific error
8982/// reason.
8983#[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
8984pub struct ErrorReason(i32);
8985
8986impl ErrorReason {
8987 /// Do not use this default value.
8988 pub const ERROR_REASON_UNSPECIFIED: ErrorReason = ErrorReason::new(0);
8989
8990 /// The request is calling a disabled service for a consumer.
8991 ///
8992 /// Example of an ErrorInfo when the consumer "projects/123" contacting
8993 /// "pubsub.googleapis.com" service which is disabled:
8994 ///
8995 /// ```norust
8996 /// { "reason": "SERVICE_DISABLED",
8997 /// "domain": "googleapis.com",
8998 /// "metadata": {
8999 /// "consumer": "projects/123",
9000 /// "service": "pubsub.googleapis.com"
9001 /// }
9002 /// }
9003 /// ```
9004 ///
9005 /// This response indicates the "pubsub.googleapis.com" has been disabled in
9006 /// "projects/123".
9007 pub const SERVICE_DISABLED: ErrorReason = ErrorReason::new(1);
9008
9009 /// The request whose associated billing account is disabled.
9010 ///
9011 /// Example of an ErrorInfo when the consumer "projects/123" fails to contact
9012 /// "pubsub.googleapis.com" service because the associated billing account is
9013 /// disabled:
9014 ///
9015 /// ```norust
9016 /// { "reason": "BILLING_DISABLED",
9017 /// "domain": "googleapis.com",
9018 /// "metadata": {
9019 /// "consumer": "projects/123",
9020 /// "service": "pubsub.googleapis.com"
9021 /// }
9022 /// }
9023 /// ```
9024 ///
9025 /// This response indicates the billing account associated has been disabled.
9026 pub const BILLING_DISABLED: ErrorReason = ErrorReason::new(2);
9027
9028 /// The request is denied because the provided [API
9029 /// key](https://cloud.google.com/docs/authentication/api-keys) is invalid. It
9030 /// may be in a bad format, cannot be found, or has been expired).
9031 ///
9032 /// Example of an ErrorInfo when the request is contacting
9033 /// "storage.googleapis.com" service with an invalid API key:
9034 ///
9035 /// ```norust
9036 /// { "reason": "API_KEY_INVALID",
9037 /// "domain": "googleapis.com",
9038 /// "metadata": {
9039 /// "service": "storage.googleapis.com",
9040 /// }
9041 /// }
9042 /// ```
9043 pub const API_KEY_INVALID: ErrorReason = ErrorReason::new(3);
9044
9045 /// The request is denied because it violates [API key API
9046 /// restrictions](https://cloud.google.com/docs/authentication/api-keys#adding_api_restrictions).
9047 ///
9048 /// Example of an ErrorInfo when the consumer "projects/123" fails to call the
9049 /// "storage.googleapis.com" service because this service is restricted in the
9050 /// API key:
9051 ///
9052 /// ```norust
9053 /// { "reason": "API_KEY_SERVICE_BLOCKED",
9054 /// "domain": "googleapis.com",
9055 /// "metadata": {
9056 /// "consumer": "projects/123",
9057 /// "service": "storage.googleapis.com"
9058 /// }
9059 /// }
9060 /// ```
9061 pub const API_KEY_SERVICE_BLOCKED: ErrorReason = ErrorReason::new(4);
9062
9063 /// The request is denied because it violates [API key HTTP
9064 /// restrictions](https://cloud.google.com/docs/authentication/api-keys#adding_http_restrictions).
9065 ///
9066 /// Example of an ErrorInfo when the consumer "projects/123" fails to call
9067 /// "storage.googleapis.com" service because the http referrer of the request
9068 /// violates API key HTTP restrictions:
9069 ///
9070 /// ```norust
9071 /// { "reason": "API_KEY_HTTP_REFERRER_BLOCKED",
9072 /// "domain": "googleapis.com",
9073 /// "metadata": {
9074 /// "consumer": "projects/123",
9075 /// "service": "storage.googleapis.com",
9076 /// }
9077 /// }
9078 /// ```
9079 pub const API_KEY_HTTP_REFERRER_BLOCKED: ErrorReason = ErrorReason::new(7);
9080
9081 /// The request is denied because it violates [API key IP address
9082 /// restrictions](https://cloud.google.com/docs/authentication/api-keys#adding_application_restrictions).
9083 ///
9084 /// Example of an ErrorInfo when the consumer "projects/123" fails to call
9085 /// "storage.googleapis.com" service because the caller IP of the request
9086 /// violates API key IP address restrictions:
9087 ///
9088 /// ```norust
9089 /// { "reason": "API_KEY_IP_ADDRESS_BLOCKED",
9090 /// "domain": "googleapis.com",
9091 /// "metadata": {
9092 /// "consumer": "projects/123",
9093 /// "service": "storage.googleapis.com",
9094 /// }
9095 /// }
9096 /// ```
9097 pub const API_KEY_IP_ADDRESS_BLOCKED: ErrorReason = ErrorReason::new(8);
9098
9099 /// The request is denied because it violates [API key Android application
9100 /// restrictions](https://cloud.google.com/docs/authentication/api-keys#adding_application_restrictions).
9101 ///
9102 /// Example of an ErrorInfo when the consumer "projects/123" fails to call
9103 /// "storage.googleapis.com" service because the request from the Android apps
9104 /// violates the API key Android application restrictions:
9105 ///
9106 /// ```norust
9107 /// { "reason": "API_KEY_ANDROID_APP_BLOCKED",
9108 /// "domain": "googleapis.com",
9109 /// "metadata": {
9110 /// "consumer": "projects/123",
9111 /// "service": "storage.googleapis.com"
9112 /// }
9113 /// }
9114 /// ```
9115 pub const API_KEY_ANDROID_APP_BLOCKED: ErrorReason = ErrorReason::new(9);
9116
9117 /// The request is denied because it violates [API key iOS application
9118 /// restrictions](https://cloud.google.com/docs/authentication/api-keys#adding_application_restrictions).
9119 ///
9120 /// Example of an ErrorInfo when the consumer "projects/123" fails to call
9121 /// "storage.googleapis.com" service because the request from the iOS apps
9122 /// violates the API key iOS application restrictions:
9123 ///
9124 /// ```norust
9125 /// { "reason": "API_KEY_IOS_APP_BLOCKED",
9126 /// "domain": "googleapis.com",
9127 /// "metadata": {
9128 /// "consumer": "projects/123",
9129 /// "service": "storage.googleapis.com"
9130 /// }
9131 /// }
9132 /// ```
9133 pub const API_KEY_IOS_APP_BLOCKED: ErrorReason = ErrorReason::new(13);
9134
9135 /// The request is denied because there is not enough rate quota for the
9136 /// consumer.
9137 ///
9138 /// Example of an ErrorInfo when the consumer "projects/123" fails to contact
9139 /// "pubsub.googleapis.com" service because consumer's rate quota usage has
9140 /// reached the maximum value set for the quota limit
9141 /// "ReadsPerMinutePerProject" on the quota metric
9142 /// "pubsub.googleapis.com/read_requests":
9143 ///
9144 /// ```norust
9145 /// { "reason": "RATE_LIMIT_EXCEEDED",
9146 /// "domain": "googleapis.com",
9147 /// "metadata": {
9148 /// "consumer": "projects/123",
9149 /// "service": "pubsub.googleapis.com",
9150 /// "quota_metric": "pubsub.googleapis.com/read_requests",
9151 /// "quota_limit": "ReadsPerMinutePerProject"
9152 /// }
9153 /// }
9154 /// ```
9155 ///
9156 /// Example of an ErrorInfo when the consumer "projects/123" checks quota on
9157 /// the service "dataflow.googleapis.com" and hits the organization quota
9158 /// limit "DefaultRequestsPerMinutePerOrganization" on the metric
9159 /// "dataflow.googleapis.com/default_requests".
9160 ///
9161 /// ```norust
9162 /// { "reason": "RATE_LIMIT_EXCEEDED",
9163 /// "domain": "googleapis.com",
9164 /// "metadata": {
9165 /// "consumer": "projects/123",
9166 /// "service": "dataflow.googleapis.com",
9167 /// "quota_metric": "dataflow.googleapis.com/default_requests",
9168 /// "quota_limit": "DefaultRequestsPerMinutePerOrganization"
9169 /// }
9170 /// }
9171 /// ```
9172 pub const RATE_LIMIT_EXCEEDED: ErrorReason = ErrorReason::new(5);
9173
9174 /// The request is denied because there is not enough resource quota for the
9175 /// consumer.
9176 ///
9177 /// Example of an ErrorInfo when the consumer "projects/123" fails to contact
9178 /// "compute.googleapis.com" service because consumer's resource quota usage
9179 /// has reached the maximum value set for the quota limit "VMsPerProject"
9180 /// on the quota metric "compute.googleapis.com/vms":
9181 ///
9182 /// ```norust
9183 /// { "reason": "RESOURCE_QUOTA_EXCEEDED",
9184 /// "domain": "googleapis.com",
9185 /// "metadata": {
9186 /// "consumer": "projects/123",
9187 /// "service": "compute.googleapis.com",
9188 /// "quota_metric": "compute.googleapis.com/vms",
9189 /// "quota_limit": "VMsPerProject"
9190 /// }
9191 /// }
9192 /// ```
9193 ///
9194 /// Example of an ErrorInfo when the consumer "projects/123" checks resource
9195 /// quota on the service "dataflow.googleapis.com" and hits the organization
9196 /// quota limit "jobs-per-organization" on the metric
9197 /// "dataflow.googleapis.com/job_count".
9198 ///
9199 /// ```norust
9200 /// { "reason": "RESOURCE_QUOTA_EXCEEDED",
9201 /// "domain": "googleapis.com",
9202 /// "metadata": {
9203 /// "consumer": "projects/123",
9204 /// "service": "dataflow.googleapis.com",
9205 /// "quota_metric": "dataflow.googleapis.com/job_count",
9206 /// "quota_limit": "jobs-per-organization"
9207 /// }
9208 /// }
9209 /// ```
9210 pub const RESOURCE_QUOTA_EXCEEDED: ErrorReason = ErrorReason::new(6);
9211
9212 /// The request whose associated billing account address is in a tax restricted
9213 /// location, violates the local tax restrictions when creating resources in
9214 /// the restricted region.
9215 ///
9216 /// Example of an ErrorInfo when creating the Cloud Storage Bucket in the
9217 /// container "projects/123" under a tax restricted region
9218 /// "locations/asia-northeast3":
9219 ///
9220 /// ```norust
9221 /// { "reason": "LOCATION_TAX_POLICY_VIOLATED",
9222 /// "domain": "googleapis.com",
9223 /// "metadata": {
9224 /// "consumer": "projects/123",
9225 /// "service": "storage.googleapis.com",
9226 /// "location": "locations/asia-northeast3"
9227 /// }
9228 /// }
9229 /// ```
9230 ///
9231 /// This response indicates creating the Cloud Storage Bucket in
9232 /// "locations/asia-northeast3" violates the location tax restriction.
9233 pub const LOCATION_TAX_POLICY_VIOLATED: ErrorReason = ErrorReason::new(10);
9234
9235 /// The request is denied because the caller does not have required permission
9236 /// on the user project "projects/123" or the user project is invalid. For more
9237 /// information, check the [userProject System
9238 /// Parameters](https://cloud.google.com/apis/docs/system-parameters).
9239 ///
9240 /// Example of an ErrorInfo when the caller is calling Cloud Storage service
9241 /// with insufficient permissions on the user project:
9242 ///
9243 /// ```norust
9244 /// { "reason": "USER_PROJECT_DENIED",
9245 /// "domain": "googleapis.com",
9246 /// "metadata": {
9247 /// "consumer": "projects/123",
9248 /// "service": "storage.googleapis.com"
9249 /// }
9250 /// }
9251 /// ```
9252 pub const USER_PROJECT_DENIED: ErrorReason = ErrorReason::new(11);
9253
9254 /// The request is denied because the consumer "projects/123" is suspended due
9255 /// to Terms of Service(Tos) violations. Check [Project suspension
9256 /// guidelines](https://cloud.google.com/resource-manager/docs/project-suspension-guidelines)
9257 /// for more information.
9258 ///
9259 /// Example of an ErrorInfo when calling Cloud Storage service with the
9260 /// suspended consumer "projects/123":
9261 ///
9262 /// ```norust
9263 /// { "reason": "CONSUMER_SUSPENDED",
9264 /// "domain": "googleapis.com",
9265 /// "metadata": {
9266 /// "consumer": "projects/123",
9267 /// "service": "storage.googleapis.com"
9268 /// }
9269 /// }
9270 /// ```
9271 pub const CONSUMER_SUSPENDED: ErrorReason = ErrorReason::new(12);
9272
9273 /// The request is denied because the associated consumer is invalid. It may be
9274 /// in a bad format, cannot be found, or have been deleted.
9275 ///
9276 /// Example of an ErrorInfo when calling Cloud Storage service with the
9277 /// invalid consumer "projects/123":
9278 ///
9279 /// ```norust
9280 /// { "reason": "CONSUMER_INVALID",
9281 /// "domain": "googleapis.com",
9282 /// "metadata": {
9283 /// "consumer": "projects/123",
9284 /// "service": "storage.googleapis.com"
9285 /// }
9286 /// }
9287 /// ```
9288 pub const CONSUMER_INVALID: ErrorReason = ErrorReason::new(14);
9289
9290 /// The request is denied because it violates [VPC Service
9291 /// Controls](https://cloud.google.com/vpc-service-controls/docs/overview).
9292 /// The 'uid' field is a random generated identifier that customer can use it
9293 /// to search the audit log for a request rejected by VPC Service Controls. For
9294 /// more information, please refer [VPC Service Controls
9295 /// Troubleshooting](https://cloud.google.com/vpc-service-controls/docs/troubleshooting#unique-id)
9296 ///
9297 /// Example of an ErrorInfo when the consumer "projects/123" fails to call
9298 /// Cloud Storage service because the request is prohibited by the VPC Service
9299 /// Controls.
9300 ///
9301 /// ```norust
9302 /// { "reason": "SECURITY_POLICY_VIOLATED",
9303 /// "domain": "googleapis.com",
9304 /// "metadata": {
9305 /// "uid": "123456789abcde",
9306 /// "consumer": "projects/123",
9307 /// "service": "storage.googleapis.com"
9308 /// }
9309 /// }
9310 /// ```
9311 pub const SECURITY_POLICY_VIOLATED: ErrorReason = ErrorReason::new(15);
9312
9313 /// The request is denied because the provided access token has expired.
9314 ///
9315 /// Example of an ErrorInfo when the request is calling Cloud Storage service
9316 /// with an expired access token:
9317 ///
9318 /// ```norust
9319 /// { "reason": "ACCESS_TOKEN_EXPIRED",
9320 /// "domain": "googleapis.com",
9321 /// "metadata": {
9322 /// "service": "storage.googleapis.com",
9323 /// "method": "google.storage.v1.Storage.GetObject"
9324 /// }
9325 /// }
9326 /// ```
9327 pub const ACCESS_TOKEN_EXPIRED: ErrorReason = ErrorReason::new(16);
9328
9329 /// The request is denied because the provided access token doesn't have at
9330 /// least one of the acceptable scopes required for the API. Please check
9331 /// [OAuth 2.0 Scopes for Google
9332 /// APIs](https://developers.google.com/identity/protocols/oauth2/scopes) for
9333 /// the list of the OAuth 2.0 scopes that you might need to request to access
9334 /// the API.
9335 ///
9336 /// Example of an ErrorInfo when the request is calling Cloud Storage service
9337 /// with an access token that is missing required scopes:
9338 ///
9339 /// ```norust
9340 /// { "reason": "ACCESS_TOKEN_SCOPE_INSUFFICIENT",
9341 /// "domain": "googleapis.com",
9342 /// "metadata": {
9343 /// "service": "storage.googleapis.com",
9344 /// "method": "google.storage.v1.Storage.GetObject"
9345 /// }
9346 /// }
9347 /// ```
9348 pub const ACCESS_TOKEN_SCOPE_INSUFFICIENT: ErrorReason = ErrorReason::new(17);
9349
9350 /// The request is denied because the account associated with the provided
9351 /// access token is in an invalid state, such as disabled or deleted.
9352 /// For more information, see <https://cloud.google.com/docs/authentication>.
9353 ///
9354 /// Warning: For privacy reasons, the server may not be able to disclose the
9355 /// email address for some accounts. The client MUST NOT depend on the
9356 /// availability of the `email` attribute.
9357 ///
9358 /// Example of an ErrorInfo when the request is to the Cloud Storage API with
9359 /// an access token that is associated with a disabled or deleted [service
9360 /// account](http://cloud/iam/docs/service-accounts):
9361 ///
9362 /// ```norust
9363 /// { "reason": "ACCOUNT_STATE_INVALID",
9364 /// "domain": "googleapis.com",
9365 /// "metadata": {
9366 /// "service": "storage.googleapis.com",
9367 /// "method": "google.storage.v1.Storage.GetObject",
9368 /// "email": "user@123.iam.gserviceaccount.com"
9369 /// }
9370 /// }
9371 /// ```
9372 pub const ACCOUNT_STATE_INVALID: ErrorReason = ErrorReason::new(18);
9373
9374 /// The request is denied because the type of the provided access token is not
9375 /// supported by the API being called.
9376 ///
9377 /// Example of an ErrorInfo when the request is to the Cloud Storage API with
9378 /// an unsupported token type.
9379 ///
9380 /// ```norust
9381 /// { "reason": "ACCESS_TOKEN_TYPE_UNSUPPORTED",
9382 /// "domain": "googleapis.com",
9383 /// "metadata": {
9384 /// "service": "storage.googleapis.com",
9385 /// "method": "google.storage.v1.Storage.GetObject"
9386 /// }
9387 /// }
9388 /// ```
9389 pub const ACCESS_TOKEN_TYPE_UNSUPPORTED: ErrorReason = ErrorReason::new(19);
9390
9391 /// The request is denied because the request doesn't have any authentication
9392 /// credentials. For more information regarding the supported authentication
9393 /// strategies for Google Cloud APIs, see
9394 /// <https://cloud.google.com/docs/authentication>.
9395 ///
9396 /// Example of an ErrorInfo when the request is to the Cloud Storage API
9397 /// without any authentication credentials.
9398 ///
9399 /// ```norust
9400 /// { "reason": "CREDENTIALS_MISSING",
9401 /// "domain": "googleapis.com",
9402 /// "metadata": {
9403 /// "service": "storage.googleapis.com",
9404 /// "method": "google.storage.v1.Storage.GetObject"
9405 /// }
9406 /// }
9407 /// ```
9408 pub const CREDENTIALS_MISSING: ErrorReason = ErrorReason::new(20);
9409
9410 /// The request is denied because the provided project owning the resource
9411 /// which acts as the [API
9412 /// consumer](https://cloud.google.com/apis/design/glossary#api_consumer) is
9413 /// invalid. It may be in a bad format or empty.
9414 ///
9415 /// Example of an ErrorInfo when the request is to the Cloud Functions API,
9416 /// but the offered resource project in the request in a bad format which can't
9417 /// perform the ListFunctions method.
9418 ///
9419 /// ```norust
9420 /// { "reason": "RESOURCE_PROJECT_INVALID",
9421 /// "domain": "googleapis.com",
9422 /// "metadata": {
9423 /// "service": "cloudfunctions.googleapis.com",
9424 /// "method":
9425 /// "google.cloud.functions.v1.CloudFunctionsService.ListFunctions"
9426 /// }
9427 /// }
9428 /// ```
9429 pub const RESOURCE_PROJECT_INVALID: ErrorReason = ErrorReason::new(21);
9430
9431 /// The request is denied because the provided session cookie is missing,
9432 /// invalid or failed to decode.
9433 ///
9434 /// Example of an ErrorInfo when the request is calling Cloud Storage service
9435 /// with a SID cookie which can't be decoded.
9436 ///
9437 /// ```norust
9438 /// { "reason": "SESSION_COOKIE_INVALID",
9439 /// "domain": "googleapis.com",
9440 /// "metadata": {
9441 /// "service": "storage.googleapis.com",
9442 /// "method": "google.storage.v1.Storage.GetObject",
9443 /// "cookie": "SID"
9444 /// }
9445 /// }
9446 /// ```
9447 pub const SESSION_COOKIE_INVALID: ErrorReason = ErrorReason::new(23);
9448
9449 /// The request is denied because the user is from a Google Workspace customer
9450 /// that blocks their users from accessing a particular service.
9451 ///
9452 /// Example scenario: <https://support.google.com/a/answer/9197205?hl=en>
9453 ///
9454 /// Example of an ErrorInfo when access to Google Cloud Storage service is
9455 /// blocked by the Google Workspace administrator:
9456 ///
9457 /// ```norust
9458 /// { "reason": "USER_BLOCKED_BY_ADMIN",
9459 /// "domain": "googleapis.com",
9460 /// "metadata": {
9461 /// "service": "storage.googleapis.com",
9462 /// "method": "google.storage.v1.Storage.GetObject",
9463 /// }
9464 /// }
9465 /// ```
9466 pub const USER_BLOCKED_BY_ADMIN: ErrorReason = ErrorReason::new(24);
9467
9468 /// The request is denied because the resource service usage is restricted
9469 /// by administrators according to the organization policy constraint.
9470 /// For more information see
9471 /// <https://cloud.google.com/resource-manager/docs/organization-policy/restricting-services>.
9472 ///
9473 /// Example of an ErrorInfo when access to Google Cloud Storage service is
9474 /// restricted by Resource Usage Restriction policy:
9475 ///
9476 /// ```norust
9477 /// { "reason": "RESOURCE_USAGE_RESTRICTION_VIOLATED",
9478 /// "domain": "googleapis.com",
9479 /// "metadata": {
9480 /// "consumer": "projects/project-123",
9481 /// "service": "storage.googleapis.com"
9482 /// }
9483 /// }
9484 /// ```
9485 pub const RESOURCE_USAGE_RESTRICTION_VIOLATED: ErrorReason = ErrorReason::new(25);
9486
9487 /// Unimplemented. Do not use.
9488 ///
9489 /// The request is denied because it contains unsupported system parameters in
9490 /// URL query parameters or HTTP headers. For more information,
9491 /// see <https://cloud.google.com/apis/docs/system-parameters>
9492 ///
9493 /// Example of an ErrorInfo when access "pubsub.googleapis.com" service with
9494 /// a request header of "x-goog-user-ip":
9495 ///
9496 /// ```norust
9497 /// { "reason": "SYSTEM_PARAMETER_UNSUPPORTED",
9498 /// "domain": "googleapis.com",
9499 /// "metadata": {
9500 /// "service": "pubsub.googleapis.com"
9501 /// "parameter": "x-goog-user-ip"
9502 /// }
9503 /// }
9504 /// ```
9505 pub const SYSTEM_PARAMETER_UNSUPPORTED: ErrorReason = ErrorReason::new(26);
9506
9507 /// The request is denied because it violates Org Restriction: the requested
9508 /// resource does not belong to allowed organizations specified in
9509 /// "X-Goog-Allowed-Resources" header.
9510 ///
9511 /// Example of an ErrorInfo when accessing a GCP resource that is restricted by
9512 /// Org Restriction for "pubsub.googleapis.com" service.
9513 ///
9514 /// {
9515 /// reason: "ORG_RESTRICTION_VIOLATION"
9516 /// domain: "googleapis.com"
9517 /// metadata {
9518 /// "consumer":"projects/123456"
9519 /// "service": "pubsub.googleapis.com"
9520 /// }
9521 /// }
9522 pub const ORG_RESTRICTION_VIOLATION: ErrorReason = ErrorReason::new(27);
9523
9524 /// The request is denied because "X-Goog-Allowed-Resources" header is in a bad
9525 /// format.
9526 ///
9527 /// Example of an ErrorInfo when
9528 /// accessing "pubsub.googleapis.com" service with an invalid
9529 /// "X-Goog-Allowed-Resources" request header.
9530 ///
9531 /// {
9532 /// reason: "ORG_RESTRICTION_HEADER_INVALID"
9533 /// domain: "googleapis.com"
9534 /// metadata {
9535 /// "consumer":"projects/123456"
9536 /// "service": "pubsub.googleapis.com"
9537 /// }
9538 /// }
9539 pub const ORG_RESTRICTION_HEADER_INVALID: ErrorReason = ErrorReason::new(28);
9540
9541 /// Unimplemented. Do not use.
9542 ///
9543 /// The request is calling a service that is not visible to the consumer.
9544 ///
9545 /// Example of an ErrorInfo when the consumer "projects/123" contacting
9546 /// "pubsub.googleapis.com" service which is not visible to the consumer.
9547 ///
9548 /// ```norust
9549 /// { "reason": "SERVICE_NOT_VISIBLE",
9550 /// "domain": "googleapis.com",
9551 /// "metadata": {
9552 /// "consumer": "projects/123",
9553 /// "service": "pubsub.googleapis.com"
9554 /// }
9555 /// }
9556 /// ```
9557 ///
9558 /// This response indicates the "pubsub.googleapis.com" is not visible to
9559 /// "projects/123" (or it may not exist).
9560 pub const SERVICE_NOT_VISIBLE: ErrorReason = ErrorReason::new(29);
9561
9562 /// The request is related to a project for which GCP access is suspended.
9563 ///
9564 /// Example of an ErrorInfo when the consumer "projects/123" fails to contact
9565 /// "pubsub.googleapis.com" service because GCP access is suspended:
9566 ///
9567 /// ```norust
9568 /// { "reason": "GCP_SUSPENDED",
9569 /// "domain": "googleapis.com",
9570 /// "metadata": {
9571 /// "consumer": "projects/123",
9572 /// "service": "pubsub.googleapis.com"
9573 /// }
9574 /// }
9575 /// ```
9576 ///
9577 /// This response indicates the associated GCP account has been suspended.
9578 pub const GCP_SUSPENDED: ErrorReason = ErrorReason::new(30);
9579
9580 /// The request violates the location policies when creating resources in
9581 /// the restricted region.
9582 ///
9583 /// Example of an ErrorInfo when creating the Cloud Storage Bucket by
9584 /// "projects/123" for service storage.googleapis.com:
9585 ///
9586 /// ```norust
9587 /// { "reason": "LOCATION_POLICY_VIOLATED",
9588 /// "domain": "googleapis.com",
9589 /// "metadata": {
9590 /// "consumer": "projects/123",
9591 /// "service": "storage.googleapis.com",
9592 /// }
9593 /// }
9594 /// ```
9595 ///
9596 /// This response indicates creating the Cloud Storage Bucket in
9597 /// "locations/asia-northeast3" violates at least one location policy.
9598 /// The troubleshooting guidance is provided in the Help links.
9599 pub const LOCATION_POLICY_VIOLATED: ErrorReason = ErrorReason::new(31);
9600
9601 /// The request is denied because origin request header is missing.
9602 ///
9603 /// Example of an ErrorInfo when
9604 /// accessing "pubsub.googleapis.com" service with an empty "Origin" request
9605 /// header.
9606 ///
9607 /// {
9608 /// reason: "MISSING_ORIGIN"
9609 /// domain: "googleapis.com"
9610 /// metadata {
9611 /// "consumer":"projects/123456"
9612 /// "service": "pubsub.googleapis.com"
9613 /// }
9614 /// }
9615 pub const MISSING_ORIGIN: ErrorReason = ErrorReason::new(33);
9616
9617 /// The request is denied because the request contains more than one credential
9618 /// type that are individually acceptable, but not together. The customer
9619 /// should retry their request with only one set of credentials.
9620 ///
9621 /// Example of an ErrorInfo when
9622 /// accessing "pubsub.googleapis.com" service with overloaded credentials.
9623 ///
9624 /// {
9625 /// reason: "OVERLOADED_CREDENTIALS"
9626 /// domain: "googleapis.com"
9627 /// metadata {
9628 /// "consumer":"projects/123456"
9629 /// "service": "pubsub.googleapis.com"
9630 /// }
9631 /// }
9632 pub const OVERLOADED_CREDENTIALS: ErrorReason = ErrorReason::new(34);
9633
9634 /// Creates a new ErrorReason instance.
9635 pub(crate) const fn new(value: i32) -> Self {
9636 Self(value)
9637 }
9638
9639 /// Gets the enum value.
9640 pub fn value(&self) -> i32 {
9641 self.0
9642 }
9643
9644 /// Gets the enum value as a string.
9645 pub fn as_str_name(&self) -> std::borrow::Cow<'static, str> {
9646 match self.0 {
9647 0 => std::borrow::Cow::Borrowed("ERROR_REASON_UNSPECIFIED"),
9648 1 => std::borrow::Cow::Borrowed("SERVICE_DISABLED"),
9649 2 => std::borrow::Cow::Borrowed("BILLING_DISABLED"),
9650 3 => std::borrow::Cow::Borrowed("API_KEY_INVALID"),
9651 4 => std::borrow::Cow::Borrowed("API_KEY_SERVICE_BLOCKED"),
9652 5 => std::borrow::Cow::Borrowed("RATE_LIMIT_EXCEEDED"),
9653 6 => std::borrow::Cow::Borrowed("RESOURCE_QUOTA_EXCEEDED"),
9654 7 => std::borrow::Cow::Borrowed("API_KEY_HTTP_REFERRER_BLOCKED"),
9655 8 => std::borrow::Cow::Borrowed("API_KEY_IP_ADDRESS_BLOCKED"),
9656 9 => std::borrow::Cow::Borrowed("API_KEY_ANDROID_APP_BLOCKED"),
9657 10 => std::borrow::Cow::Borrowed("LOCATION_TAX_POLICY_VIOLATED"),
9658 11 => std::borrow::Cow::Borrowed("USER_PROJECT_DENIED"),
9659 12 => std::borrow::Cow::Borrowed("CONSUMER_SUSPENDED"),
9660 13 => std::borrow::Cow::Borrowed("API_KEY_IOS_APP_BLOCKED"),
9661 14 => std::borrow::Cow::Borrowed("CONSUMER_INVALID"),
9662 15 => std::borrow::Cow::Borrowed("SECURITY_POLICY_VIOLATED"),
9663 16 => std::borrow::Cow::Borrowed("ACCESS_TOKEN_EXPIRED"),
9664 17 => std::borrow::Cow::Borrowed("ACCESS_TOKEN_SCOPE_INSUFFICIENT"),
9665 18 => std::borrow::Cow::Borrowed("ACCOUNT_STATE_INVALID"),
9666 19 => std::borrow::Cow::Borrowed("ACCESS_TOKEN_TYPE_UNSUPPORTED"),
9667 20 => std::borrow::Cow::Borrowed("CREDENTIALS_MISSING"),
9668 21 => std::borrow::Cow::Borrowed("RESOURCE_PROJECT_INVALID"),
9669 23 => std::borrow::Cow::Borrowed("SESSION_COOKIE_INVALID"),
9670 24 => std::borrow::Cow::Borrowed("USER_BLOCKED_BY_ADMIN"),
9671 25 => std::borrow::Cow::Borrowed("RESOURCE_USAGE_RESTRICTION_VIOLATED"),
9672 26 => std::borrow::Cow::Borrowed("SYSTEM_PARAMETER_UNSUPPORTED"),
9673 27 => std::borrow::Cow::Borrowed("ORG_RESTRICTION_VIOLATION"),
9674 28 => std::borrow::Cow::Borrowed("ORG_RESTRICTION_HEADER_INVALID"),
9675 29 => std::borrow::Cow::Borrowed("SERVICE_NOT_VISIBLE"),
9676 30 => std::borrow::Cow::Borrowed("GCP_SUSPENDED"),
9677 31 => std::borrow::Cow::Borrowed("LOCATION_POLICY_VIOLATED"),
9678 33 => std::borrow::Cow::Borrowed("MISSING_ORIGIN"),
9679 34 => std::borrow::Cow::Borrowed("OVERLOADED_CREDENTIALS"),
9680 _ => std::borrow::Cow::Owned(std::format!("UNKNOWN-VALUE:{}", self.0)),
9681 }
9682 }
9683
9684 /// Creates an enum value from the value name.
9685 pub fn from_str_name(name: &str) -> std::option::Option<Self> {
9686 match name {
9687 "ERROR_REASON_UNSPECIFIED" => std::option::Option::Some(Self::ERROR_REASON_UNSPECIFIED),
9688 "SERVICE_DISABLED" => std::option::Option::Some(Self::SERVICE_DISABLED),
9689 "BILLING_DISABLED" => std::option::Option::Some(Self::BILLING_DISABLED),
9690 "API_KEY_INVALID" => std::option::Option::Some(Self::API_KEY_INVALID),
9691 "API_KEY_SERVICE_BLOCKED" => std::option::Option::Some(Self::API_KEY_SERVICE_BLOCKED),
9692 "API_KEY_HTTP_REFERRER_BLOCKED" => {
9693 std::option::Option::Some(Self::API_KEY_HTTP_REFERRER_BLOCKED)
9694 }
9695 "API_KEY_IP_ADDRESS_BLOCKED" => {
9696 std::option::Option::Some(Self::API_KEY_IP_ADDRESS_BLOCKED)
9697 }
9698 "API_KEY_ANDROID_APP_BLOCKED" => {
9699 std::option::Option::Some(Self::API_KEY_ANDROID_APP_BLOCKED)
9700 }
9701 "API_KEY_IOS_APP_BLOCKED" => std::option::Option::Some(Self::API_KEY_IOS_APP_BLOCKED),
9702 "RATE_LIMIT_EXCEEDED" => std::option::Option::Some(Self::RATE_LIMIT_EXCEEDED),
9703 "RESOURCE_QUOTA_EXCEEDED" => std::option::Option::Some(Self::RESOURCE_QUOTA_EXCEEDED),
9704 "LOCATION_TAX_POLICY_VIOLATED" => {
9705 std::option::Option::Some(Self::LOCATION_TAX_POLICY_VIOLATED)
9706 }
9707 "USER_PROJECT_DENIED" => std::option::Option::Some(Self::USER_PROJECT_DENIED),
9708 "CONSUMER_SUSPENDED" => std::option::Option::Some(Self::CONSUMER_SUSPENDED),
9709 "CONSUMER_INVALID" => std::option::Option::Some(Self::CONSUMER_INVALID),
9710 "SECURITY_POLICY_VIOLATED" => std::option::Option::Some(Self::SECURITY_POLICY_VIOLATED),
9711 "ACCESS_TOKEN_EXPIRED" => std::option::Option::Some(Self::ACCESS_TOKEN_EXPIRED),
9712 "ACCESS_TOKEN_SCOPE_INSUFFICIENT" => {
9713 std::option::Option::Some(Self::ACCESS_TOKEN_SCOPE_INSUFFICIENT)
9714 }
9715 "ACCOUNT_STATE_INVALID" => std::option::Option::Some(Self::ACCOUNT_STATE_INVALID),
9716 "ACCESS_TOKEN_TYPE_UNSUPPORTED" => {
9717 std::option::Option::Some(Self::ACCESS_TOKEN_TYPE_UNSUPPORTED)
9718 }
9719 "CREDENTIALS_MISSING" => std::option::Option::Some(Self::CREDENTIALS_MISSING),
9720 "RESOURCE_PROJECT_INVALID" => std::option::Option::Some(Self::RESOURCE_PROJECT_INVALID),
9721 "SESSION_COOKIE_INVALID" => std::option::Option::Some(Self::SESSION_COOKIE_INVALID),
9722 "USER_BLOCKED_BY_ADMIN" => std::option::Option::Some(Self::USER_BLOCKED_BY_ADMIN),
9723 "RESOURCE_USAGE_RESTRICTION_VIOLATED" => {
9724 std::option::Option::Some(Self::RESOURCE_USAGE_RESTRICTION_VIOLATED)
9725 }
9726 "SYSTEM_PARAMETER_UNSUPPORTED" => {
9727 std::option::Option::Some(Self::SYSTEM_PARAMETER_UNSUPPORTED)
9728 }
9729 "ORG_RESTRICTION_VIOLATION" => {
9730 std::option::Option::Some(Self::ORG_RESTRICTION_VIOLATION)
9731 }
9732 "ORG_RESTRICTION_HEADER_INVALID" => {
9733 std::option::Option::Some(Self::ORG_RESTRICTION_HEADER_INVALID)
9734 }
9735 "SERVICE_NOT_VISIBLE" => std::option::Option::Some(Self::SERVICE_NOT_VISIBLE),
9736 "GCP_SUSPENDED" => std::option::Option::Some(Self::GCP_SUSPENDED),
9737 "LOCATION_POLICY_VIOLATED" => std::option::Option::Some(Self::LOCATION_POLICY_VIOLATED),
9738 "MISSING_ORIGIN" => std::option::Option::Some(Self::MISSING_ORIGIN),
9739 "OVERLOADED_CREDENTIALS" => std::option::Option::Some(Self::OVERLOADED_CREDENTIALS),
9740 _ => std::option::Option::None,
9741 }
9742 }
9743}
9744
9745impl std::convert::From<i32> for ErrorReason {
9746 fn from(value: i32) -> Self {
9747 Self::new(value)
9748 }
9749}
9750
9751impl std::default::Default for ErrorReason {
9752 fn default() -> Self {
9753 Self::new(0)
9754 }
9755}
9756
9757/// An indicator of the behavior of a given field (for example, that a field
9758/// is required in requests, or given as output but ignored as input).
9759/// This **does not** change the behavior in protocol buffers itself; it only
9760/// denotes the behavior and may affect how API tooling handles the field.
9761///
9762/// Note: This enum **may** receive new values in the future.
9763#[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
9764pub struct FieldBehavior(i32);
9765
9766impl FieldBehavior {
9767 /// Conventional default for enums. Do not use this.
9768 pub const FIELD_BEHAVIOR_UNSPECIFIED: FieldBehavior = FieldBehavior::new(0);
9769
9770 /// Specifically denotes a field as optional.
9771 /// While all fields in protocol buffers are optional, this may be specified
9772 /// for emphasis if appropriate.
9773 pub const OPTIONAL: FieldBehavior = FieldBehavior::new(1);
9774
9775 /// Denotes a field as required.
9776 /// This indicates that the field **must** be provided as part of the request,
9777 /// and failure to do so will cause an error (usually `INVALID_ARGUMENT`).
9778 pub const REQUIRED: FieldBehavior = FieldBehavior::new(2);
9779
9780 /// Denotes a field as output only.
9781 /// This indicates that the field is provided in responses, but including the
9782 /// field in a request does nothing (the server *must* ignore it and
9783 /// *must not* throw an error as a result of the field's presence).
9784 pub const OUTPUT_ONLY: FieldBehavior = FieldBehavior::new(3);
9785
9786 /// Denotes a field as input only.
9787 /// This indicates that the field is provided in requests, and the
9788 /// corresponding field is not included in output.
9789 pub const INPUT_ONLY: FieldBehavior = FieldBehavior::new(4);
9790
9791 /// Denotes a field as immutable.
9792 /// This indicates that the field may be set once in a request to create a
9793 /// resource, but may not be changed thereafter.
9794 pub const IMMUTABLE: FieldBehavior = FieldBehavior::new(5);
9795
9796 /// Denotes that a (repeated) field is an unordered list.
9797 /// This indicates that the service may provide the elements of the list
9798 /// in any arbitrary order, rather than the order the user originally
9799 /// provided. Additionally, the list's order may or may not be stable.
9800 pub const UNORDERED_LIST: FieldBehavior = FieldBehavior::new(6);
9801
9802 /// Denotes that this field returns a non-empty default value if not set.
9803 /// This indicates that if the user provides the empty value in a request,
9804 /// a non-empty value will be returned. The user will not be aware of what
9805 /// non-empty value to expect.
9806 pub const NON_EMPTY_DEFAULT: FieldBehavior = FieldBehavior::new(7);
9807
9808 /// Denotes that the field in a resource (a message annotated with
9809 /// google.api.resource) is used in the resource name to uniquely identify the
9810 /// resource. For AIP-compliant APIs, this should only be applied to the
9811 /// `name` field on the resource.
9812 ///
9813 /// This behavior should not be applied to references to other resources within
9814 /// the message.
9815 ///
9816 /// The identifier field of resources often have different field behavior
9817 /// depending on the request it is embedded in (e.g. for Create methods name
9818 /// is optional and unused, while for Update methods it is required). Instead
9819 /// of method-specific annotations, only `IDENTIFIER` is required.
9820 pub const IDENTIFIER: FieldBehavior = FieldBehavior::new(8);
9821
9822 /// Creates a new FieldBehavior instance.
9823 pub(crate) const fn new(value: i32) -> Self {
9824 Self(value)
9825 }
9826
9827 /// Gets the enum value.
9828 pub fn value(&self) -> i32 {
9829 self.0
9830 }
9831
9832 /// Gets the enum value as a string.
9833 pub fn as_str_name(&self) -> std::borrow::Cow<'static, str> {
9834 match self.0 {
9835 0 => std::borrow::Cow::Borrowed("FIELD_BEHAVIOR_UNSPECIFIED"),
9836 1 => std::borrow::Cow::Borrowed("OPTIONAL"),
9837 2 => std::borrow::Cow::Borrowed("REQUIRED"),
9838 3 => std::borrow::Cow::Borrowed("OUTPUT_ONLY"),
9839 4 => std::borrow::Cow::Borrowed("INPUT_ONLY"),
9840 5 => std::borrow::Cow::Borrowed("IMMUTABLE"),
9841 6 => std::borrow::Cow::Borrowed("UNORDERED_LIST"),
9842 7 => std::borrow::Cow::Borrowed("NON_EMPTY_DEFAULT"),
9843 8 => std::borrow::Cow::Borrowed("IDENTIFIER"),
9844 _ => std::borrow::Cow::Owned(std::format!("UNKNOWN-VALUE:{}", self.0)),
9845 }
9846 }
9847
9848 /// Creates an enum value from the value name.
9849 pub fn from_str_name(name: &str) -> std::option::Option<Self> {
9850 match name {
9851 "FIELD_BEHAVIOR_UNSPECIFIED" => {
9852 std::option::Option::Some(Self::FIELD_BEHAVIOR_UNSPECIFIED)
9853 }
9854 "OPTIONAL" => std::option::Option::Some(Self::OPTIONAL),
9855 "REQUIRED" => std::option::Option::Some(Self::REQUIRED),
9856 "OUTPUT_ONLY" => std::option::Option::Some(Self::OUTPUT_ONLY),
9857 "INPUT_ONLY" => std::option::Option::Some(Self::INPUT_ONLY),
9858 "IMMUTABLE" => std::option::Option::Some(Self::IMMUTABLE),
9859 "UNORDERED_LIST" => std::option::Option::Some(Self::UNORDERED_LIST),
9860 "NON_EMPTY_DEFAULT" => std::option::Option::Some(Self::NON_EMPTY_DEFAULT),
9861 "IDENTIFIER" => std::option::Option::Some(Self::IDENTIFIER),
9862 _ => std::option::Option::None,
9863 }
9864 }
9865}
9866
9867impl std::convert::From<i32> for FieldBehavior {
9868 fn from(value: i32) -> Self {
9869 Self::new(value)
9870 }
9871}
9872
9873impl std::default::Default for FieldBehavior {
9874 fn default() -> Self {
9875 Self::new(0)
9876 }
9877}
9878
9879/// The launch stage as defined by [Google Cloud Platform
9880/// Launch Stages](https://cloud.google.com/terms/launch-stages).
9881#[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
9882pub struct LaunchStage(i32);
9883
9884impl LaunchStage {
9885 /// Do not use this default value.
9886 pub const LAUNCH_STAGE_UNSPECIFIED: LaunchStage = LaunchStage::new(0);
9887
9888 /// The feature is not yet implemented. Users can not use it.
9889 pub const UNIMPLEMENTED: LaunchStage = LaunchStage::new(6);
9890
9891 /// Prelaunch features are hidden from users and are only visible internally.
9892 pub const PRELAUNCH: LaunchStage = LaunchStage::new(7);
9893
9894 /// Early Access features are limited to a closed group of testers. To use
9895 /// these features, you must sign up in advance and sign a Trusted Tester
9896 /// agreement (which includes confidentiality provisions). These features may
9897 /// be unstable, changed in backward-incompatible ways, and are not
9898 /// guaranteed to be released.
9899 pub const EARLY_ACCESS: LaunchStage = LaunchStage::new(1);
9900
9901 /// Alpha is a limited availability test for releases before they are cleared
9902 /// for widespread use. By Alpha, all significant design issues are resolved
9903 /// and we are in the process of verifying functionality. Alpha customers
9904 /// need to apply for access, agree to applicable terms, and have their
9905 /// projects allowlisted. Alpha releases don't have to be feature complete,
9906 /// no SLAs are provided, and there are no technical support obligations, but
9907 /// they will be far enough along that customers can actually use them in
9908 /// test environments or for limited-use tests -- just like they would in
9909 /// normal production cases.
9910 pub const ALPHA: LaunchStage = LaunchStage::new(2);
9911
9912 /// Beta is the point at which we are ready to open a release for any
9913 /// customer to use. There are no SLA or technical support obligations in a
9914 /// Beta release. Products will be complete from a feature perspective, but
9915 /// may have some open outstanding issues. Beta releases are suitable for
9916 /// limited production use cases.
9917 pub const BETA: LaunchStage = LaunchStage::new(3);
9918
9919 /// GA features are open to all developers and are considered stable and
9920 /// fully qualified for production use.
9921 pub const GA: LaunchStage = LaunchStage::new(4);
9922
9923 /// Deprecated features are scheduled to be shut down and removed. For more
9924 /// information, see the "Deprecation Policy" section of our [Terms of
9925 /// Service](https://cloud.google.com/terms/)
9926 /// and the [Google Cloud Platform Subject to the Deprecation
9927 /// Policy](https://cloud.google.com/terms/deprecation) documentation.
9928 pub const DEPRECATED: LaunchStage = LaunchStage::new(5);
9929
9930 /// Creates a new LaunchStage instance.
9931 pub(crate) const fn new(value: i32) -> Self {
9932 Self(value)
9933 }
9934
9935 /// Gets the enum value.
9936 pub fn value(&self) -> i32 {
9937 self.0
9938 }
9939
9940 /// Gets the enum value as a string.
9941 pub fn as_str_name(&self) -> std::borrow::Cow<'static, str> {
9942 match self.0 {
9943 0 => std::borrow::Cow::Borrowed("LAUNCH_STAGE_UNSPECIFIED"),
9944 1 => std::borrow::Cow::Borrowed("EARLY_ACCESS"),
9945 2 => std::borrow::Cow::Borrowed("ALPHA"),
9946 3 => std::borrow::Cow::Borrowed("BETA"),
9947 4 => std::borrow::Cow::Borrowed("GA"),
9948 5 => std::borrow::Cow::Borrowed("DEPRECATED"),
9949 6 => std::borrow::Cow::Borrowed("UNIMPLEMENTED"),
9950 7 => std::borrow::Cow::Borrowed("PRELAUNCH"),
9951 _ => std::borrow::Cow::Owned(std::format!("UNKNOWN-VALUE:{}", self.0)),
9952 }
9953 }
9954
9955 /// Creates an enum value from the value name.
9956 pub fn from_str_name(name: &str) -> std::option::Option<Self> {
9957 match name {
9958 "LAUNCH_STAGE_UNSPECIFIED" => std::option::Option::Some(Self::LAUNCH_STAGE_UNSPECIFIED),
9959 "UNIMPLEMENTED" => std::option::Option::Some(Self::UNIMPLEMENTED),
9960 "PRELAUNCH" => std::option::Option::Some(Self::PRELAUNCH),
9961 "EARLY_ACCESS" => std::option::Option::Some(Self::EARLY_ACCESS),
9962 "ALPHA" => std::option::Option::Some(Self::ALPHA),
9963 "BETA" => std::option::Option::Some(Self::BETA),
9964 "GA" => std::option::Option::Some(Self::GA),
9965 "DEPRECATED" => std::option::Option::Some(Self::DEPRECATED),
9966 _ => std::option::Option::None,
9967 }
9968 }
9969}
9970
9971impl std::convert::From<i32> for LaunchStage {
9972 fn from(value: i32) -> Self {
9973 Self::new(value)
9974 }
9975}
9976
9977impl std::default::Default for LaunchStage {
9978 fn default() -> Self {
9979 Self::new(0)
9980 }
9981}