google_cloud_api_cloudquotas_v1/
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 async_trait;
21extern crate bytes;
22extern crate gax;
23extern crate gaxi;
24extern crate lazy_static;
25extern crate reqwest;
26extern crate serde;
27extern crate serde_json;
28extern crate serde_with;
29extern crate std;
30extern crate tracing;
31extern crate wkt;
32
33mod debug;
34mod deserialize;
35mod serialize;
36
37/// Message for requesting list of QuotaInfos
38#[derive(Clone, Default, PartialEq)]
39#[non_exhaustive]
40pub struct ListQuotaInfosRequest {
41    /// Required. Parent value of QuotaInfo resources.
42    /// Listing across different resource containers (such as 'projects/-') is not
43    /// allowed.
44    ///
45    /// Example names:
46    /// `projects/123/locations/global/services/compute.googleapis.com`
47    /// `folders/234/locations/global/services/compute.googleapis.com`
48    /// `organizations/345/locations/global/services/compute.googleapis.com`
49    pub parent: std::string::String,
50
51    /// Optional. Requested page size. Server may return fewer items than
52    /// requested. If unspecified, server will pick an appropriate default.
53    pub page_size: i32,
54
55    /// Optional. A token identifying a page of results the server should return.
56    pub page_token: std::string::String,
57
58    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
59}
60
61impl ListQuotaInfosRequest {
62    pub fn new() -> Self {
63        std::default::Default::default()
64    }
65
66    /// Sets the value of [parent][crate::model::ListQuotaInfosRequest::parent].
67    ///
68    /// # Example
69    /// ```ignore,no_run
70    /// # use google_cloud_api_cloudquotas_v1::model::ListQuotaInfosRequest;
71    /// let x = ListQuotaInfosRequest::new().set_parent("example");
72    /// ```
73    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
74        self.parent = v.into();
75        self
76    }
77
78    /// Sets the value of [page_size][crate::model::ListQuotaInfosRequest::page_size].
79    ///
80    /// # Example
81    /// ```ignore,no_run
82    /// # use google_cloud_api_cloudquotas_v1::model::ListQuotaInfosRequest;
83    /// let x = ListQuotaInfosRequest::new().set_page_size(42);
84    /// ```
85    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
86        self.page_size = v.into();
87        self
88    }
89
90    /// Sets the value of [page_token][crate::model::ListQuotaInfosRequest::page_token].
91    ///
92    /// # Example
93    /// ```ignore,no_run
94    /// # use google_cloud_api_cloudquotas_v1::model::ListQuotaInfosRequest;
95    /// let x = ListQuotaInfosRequest::new().set_page_token("example");
96    /// ```
97    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
98        self.page_token = v.into();
99        self
100    }
101}
102
103impl wkt::message::Message for ListQuotaInfosRequest {
104    fn typename() -> &'static str {
105        "type.googleapis.com/google.api.cloudquotas.v1.ListQuotaInfosRequest"
106    }
107}
108
109/// Message for response to listing QuotaInfos
110#[derive(Clone, Default, PartialEq)]
111#[non_exhaustive]
112pub struct ListQuotaInfosResponse {
113    /// The list of QuotaInfo
114    pub quota_infos: std::vec::Vec<crate::model::QuotaInfo>,
115
116    /// A token, which can be sent as `page_token` to retrieve the next page.
117    /// If this field is omitted, there are no subsequent pages.
118    pub next_page_token: std::string::String,
119
120    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
121}
122
123impl ListQuotaInfosResponse {
124    pub fn new() -> Self {
125        std::default::Default::default()
126    }
127
128    /// Sets the value of [quota_infos][crate::model::ListQuotaInfosResponse::quota_infos].
129    ///
130    /// # Example
131    /// ```ignore,no_run
132    /// # use google_cloud_api_cloudquotas_v1::model::ListQuotaInfosResponse;
133    /// use google_cloud_api_cloudquotas_v1::model::QuotaInfo;
134    /// let x = ListQuotaInfosResponse::new()
135    ///     .set_quota_infos([
136    ///         QuotaInfo::default()/* use setters */,
137    ///         QuotaInfo::default()/* use (different) setters */,
138    ///     ]);
139    /// ```
140    pub fn set_quota_infos<T, V>(mut self, v: T) -> Self
141    where
142        T: std::iter::IntoIterator<Item = V>,
143        V: std::convert::Into<crate::model::QuotaInfo>,
144    {
145        use std::iter::Iterator;
146        self.quota_infos = v.into_iter().map(|i| i.into()).collect();
147        self
148    }
149
150    /// Sets the value of [next_page_token][crate::model::ListQuotaInfosResponse::next_page_token].
151    ///
152    /// # Example
153    /// ```ignore,no_run
154    /// # use google_cloud_api_cloudquotas_v1::model::ListQuotaInfosResponse;
155    /// let x = ListQuotaInfosResponse::new().set_next_page_token("example");
156    /// ```
157    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
158        self.next_page_token = v.into();
159        self
160    }
161}
162
163impl wkt::message::Message for ListQuotaInfosResponse {
164    fn typename() -> &'static str {
165        "type.googleapis.com/google.api.cloudquotas.v1.ListQuotaInfosResponse"
166    }
167}
168
169#[doc(hidden)]
170impl gax::paginator::internal::PageableResponse for ListQuotaInfosResponse {
171    type PageItem = crate::model::QuotaInfo;
172
173    fn items(self) -> std::vec::Vec<Self::PageItem> {
174        self.quota_infos
175    }
176
177    fn next_page_token(&self) -> std::string::String {
178        use std::clone::Clone;
179        self.next_page_token.clone()
180    }
181}
182
183/// Message for getting a QuotaInfo
184#[derive(Clone, Default, PartialEq)]
185#[non_exhaustive]
186pub struct GetQuotaInfoRequest {
187    /// Required. The resource name of the quota info.
188    ///
189    /// An example name:
190    /// `projects/123/locations/global/services/compute.googleapis.com/quotaInfos/CpusPerProjectPerRegion`
191    pub name: std::string::String,
192
193    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
194}
195
196impl GetQuotaInfoRequest {
197    pub fn new() -> Self {
198        std::default::Default::default()
199    }
200
201    /// Sets the value of [name][crate::model::GetQuotaInfoRequest::name].
202    ///
203    /// # Example
204    /// ```ignore,no_run
205    /// # use google_cloud_api_cloudquotas_v1::model::GetQuotaInfoRequest;
206    /// let x = GetQuotaInfoRequest::new().set_name("example");
207    /// ```
208    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
209        self.name = v.into();
210        self
211    }
212}
213
214impl wkt::message::Message for GetQuotaInfoRequest {
215    fn typename() -> &'static str {
216        "type.googleapis.com/google.api.cloudquotas.v1.GetQuotaInfoRequest"
217    }
218}
219
220/// Message for requesting list of QuotaPreferences
221#[derive(Clone, Default, PartialEq)]
222#[non_exhaustive]
223pub struct ListQuotaPreferencesRequest {
224    /// Required. Parent value of QuotaPreference resources.
225    /// Listing across different resource containers (such as 'projects/-') is not
226    /// allowed.
227    ///
228    /// When the value starts with 'folders' or 'organizations', it lists the
229    /// QuotaPreferences for org quotas in the container. It does not list the
230    /// QuotaPreferences in the descendant projects of the container.
231    ///
232    /// Example parents:
233    /// `projects/123/locations/global`
234    pub parent: std::string::String,
235
236    /// Optional. Requested page size. Server may return fewer items than
237    /// requested. If unspecified, server will pick an appropriate default.
238    pub page_size: i32,
239
240    /// Optional. A token identifying a page of results the server should return.
241    pub page_token: std::string::String,
242
243    /// Optional. Filter result QuotaPreferences by their state, type,
244    /// create/update time range.
245    ///
246    /// Example filters:
247    /// `reconciling=true AND request_type=CLOUD_CONSOLE`,
248    /// `reconciling=true OR creation_time>2022-12-03T10:30:00`
249    pub filter: std::string::String,
250
251    /// Optional. How to order of the results. By default, the results are ordered
252    /// by create time.
253    ///
254    /// Example orders:
255    /// `quota_id`,
256    /// `service, create_time`
257    pub order_by: std::string::String,
258
259    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
260}
261
262impl ListQuotaPreferencesRequest {
263    pub fn new() -> Self {
264        std::default::Default::default()
265    }
266
267    /// Sets the value of [parent][crate::model::ListQuotaPreferencesRequest::parent].
268    ///
269    /// # Example
270    /// ```ignore,no_run
271    /// # use google_cloud_api_cloudquotas_v1::model::ListQuotaPreferencesRequest;
272    /// let x = ListQuotaPreferencesRequest::new().set_parent("example");
273    /// ```
274    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
275        self.parent = v.into();
276        self
277    }
278
279    /// Sets the value of [page_size][crate::model::ListQuotaPreferencesRequest::page_size].
280    ///
281    /// # Example
282    /// ```ignore,no_run
283    /// # use google_cloud_api_cloudquotas_v1::model::ListQuotaPreferencesRequest;
284    /// let x = ListQuotaPreferencesRequest::new().set_page_size(42);
285    /// ```
286    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
287        self.page_size = v.into();
288        self
289    }
290
291    /// Sets the value of [page_token][crate::model::ListQuotaPreferencesRequest::page_token].
292    ///
293    /// # Example
294    /// ```ignore,no_run
295    /// # use google_cloud_api_cloudquotas_v1::model::ListQuotaPreferencesRequest;
296    /// let x = ListQuotaPreferencesRequest::new().set_page_token("example");
297    /// ```
298    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
299        self.page_token = v.into();
300        self
301    }
302
303    /// Sets the value of [filter][crate::model::ListQuotaPreferencesRequest::filter].
304    ///
305    /// # Example
306    /// ```ignore,no_run
307    /// # use google_cloud_api_cloudquotas_v1::model::ListQuotaPreferencesRequest;
308    /// let x = ListQuotaPreferencesRequest::new().set_filter("example");
309    /// ```
310    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
311        self.filter = v.into();
312        self
313    }
314
315    /// Sets the value of [order_by][crate::model::ListQuotaPreferencesRequest::order_by].
316    ///
317    /// # Example
318    /// ```ignore,no_run
319    /// # use google_cloud_api_cloudquotas_v1::model::ListQuotaPreferencesRequest;
320    /// let x = ListQuotaPreferencesRequest::new().set_order_by("example");
321    /// ```
322    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
323        self.order_by = v.into();
324        self
325    }
326}
327
328impl wkt::message::Message for ListQuotaPreferencesRequest {
329    fn typename() -> &'static str {
330        "type.googleapis.com/google.api.cloudquotas.v1.ListQuotaPreferencesRequest"
331    }
332}
333
334/// Message for response to listing QuotaPreferences
335#[derive(Clone, Default, PartialEq)]
336#[non_exhaustive]
337pub struct ListQuotaPreferencesResponse {
338    /// The list of QuotaPreference
339    pub quota_preferences: std::vec::Vec<crate::model::QuotaPreference>,
340
341    /// A token, which can be sent as `page_token` to retrieve the next page.
342    /// If this field is omitted, there are no subsequent pages.
343    pub next_page_token: std::string::String,
344
345    /// Locations that could not be reached.
346    pub unreachable: std::vec::Vec<std::string::String>,
347
348    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
349}
350
351impl ListQuotaPreferencesResponse {
352    pub fn new() -> Self {
353        std::default::Default::default()
354    }
355
356    /// Sets the value of [quota_preferences][crate::model::ListQuotaPreferencesResponse::quota_preferences].
357    ///
358    /// # Example
359    /// ```ignore,no_run
360    /// # use google_cloud_api_cloudquotas_v1::model::ListQuotaPreferencesResponse;
361    /// use google_cloud_api_cloudquotas_v1::model::QuotaPreference;
362    /// let x = ListQuotaPreferencesResponse::new()
363    ///     .set_quota_preferences([
364    ///         QuotaPreference::default()/* use setters */,
365    ///         QuotaPreference::default()/* use (different) setters */,
366    ///     ]);
367    /// ```
368    pub fn set_quota_preferences<T, V>(mut self, v: T) -> Self
369    where
370        T: std::iter::IntoIterator<Item = V>,
371        V: std::convert::Into<crate::model::QuotaPreference>,
372    {
373        use std::iter::Iterator;
374        self.quota_preferences = v.into_iter().map(|i| i.into()).collect();
375        self
376    }
377
378    /// Sets the value of [next_page_token][crate::model::ListQuotaPreferencesResponse::next_page_token].
379    ///
380    /// # Example
381    /// ```ignore,no_run
382    /// # use google_cloud_api_cloudquotas_v1::model::ListQuotaPreferencesResponse;
383    /// let x = ListQuotaPreferencesResponse::new().set_next_page_token("example");
384    /// ```
385    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
386        self.next_page_token = v.into();
387        self
388    }
389
390    /// Sets the value of [unreachable][crate::model::ListQuotaPreferencesResponse::unreachable].
391    ///
392    /// # Example
393    /// ```ignore,no_run
394    /// # use google_cloud_api_cloudquotas_v1::model::ListQuotaPreferencesResponse;
395    /// let x = ListQuotaPreferencesResponse::new().set_unreachable(["a", "b", "c"]);
396    /// ```
397    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
398    where
399        T: std::iter::IntoIterator<Item = V>,
400        V: std::convert::Into<std::string::String>,
401    {
402        use std::iter::Iterator;
403        self.unreachable = v.into_iter().map(|i| i.into()).collect();
404        self
405    }
406}
407
408impl wkt::message::Message for ListQuotaPreferencesResponse {
409    fn typename() -> &'static str {
410        "type.googleapis.com/google.api.cloudquotas.v1.ListQuotaPreferencesResponse"
411    }
412}
413
414#[doc(hidden)]
415impl gax::paginator::internal::PageableResponse for ListQuotaPreferencesResponse {
416    type PageItem = crate::model::QuotaPreference;
417
418    fn items(self) -> std::vec::Vec<Self::PageItem> {
419        self.quota_preferences
420    }
421
422    fn next_page_token(&self) -> std::string::String {
423        use std::clone::Clone;
424        self.next_page_token.clone()
425    }
426}
427
428/// Message for getting a QuotaPreference
429#[derive(Clone, Default, PartialEq)]
430#[non_exhaustive]
431pub struct GetQuotaPreferenceRequest {
432    /// Required. Name of the resource
433    ///
434    /// Example name:
435    /// `projects/123/locations/global/quota_preferences/my-config-for-us-east1`
436    pub name: std::string::String,
437
438    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
439}
440
441impl GetQuotaPreferenceRequest {
442    pub fn new() -> Self {
443        std::default::Default::default()
444    }
445
446    /// Sets the value of [name][crate::model::GetQuotaPreferenceRequest::name].
447    ///
448    /// # Example
449    /// ```ignore,no_run
450    /// # use google_cloud_api_cloudquotas_v1::model::GetQuotaPreferenceRequest;
451    /// let x = GetQuotaPreferenceRequest::new().set_name("example");
452    /// ```
453    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
454        self.name = v.into();
455        self
456    }
457}
458
459impl wkt::message::Message for GetQuotaPreferenceRequest {
460    fn typename() -> &'static str {
461        "type.googleapis.com/google.api.cloudquotas.v1.GetQuotaPreferenceRequest"
462    }
463}
464
465/// Message for creating a QuotaPreference
466#[derive(Clone, Default, PartialEq)]
467#[non_exhaustive]
468pub struct CreateQuotaPreferenceRequest {
469    /// Required. Value for parent.
470    ///
471    /// Example:
472    /// `projects/123/locations/global`
473    pub parent: std::string::String,
474
475    /// Optional. Id of the requesting object, must be unique under its parent.
476    /// If client does not set this field, the service will generate one.
477    pub quota_preference_id: std::string::String,
478
479    /// Required. The resource being created
480    pub quota_preference: std::option::Option<crate::model::QuotaPreference>,
481
482    /// The list of quota safety checks to be ignored.
483    pub ignore_safety_checks: std::vec::Vec<crate::model::QuotaSafetyCheck>,
484
485    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
486}
487
488impl CreateQuotaPreferenceRequest {
489    pub fn new() -> Self {
490        std::default::Default::default()
491    }
492
493    /// Sets the value of [parent][crate::model::CreateQuotaPreferenceRequest::parent].
494    ///
495    /// # Example
496    /// ```ignore,no_run
497    /// # use google_cloud_api_cloudquotas_v1::model::CreateQuotaPreferenceRequest;
498    /// let x = CreateQuotaPreferenceRequest::new().set_parent("example");
499    /// ```
500    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
501        self.parent = v.into();
502        self
503    }
504
505    /// Sets the value of [quota_preference_id][crate::model::CreateQuotaPreferenceRequest::quota_preference_id].
506    ///
507    /// # Example
508    /// ```ignore,no_run
509    /// # use google_cloud_api_cloudquotas_v1::model::CreateQuotaPreferenceRequest;
510    /// let x = CreateQuotaPreferenceRequest::new().set_quota_preference_id("example");
511    /// ```
512    pub fn set_quota_preference_id<T: std::convert::Into<std::string::String>>(
513        mut self,
514        v: T,
515    ) -> Self {
516        self.quota_preference_id = v.into();
517        self
518    }
519
520    /// Sets the value of [quota_preference][crate::model::CreateQuotaPreferenceRequest::quota_preference].
521    ///
522    /// # Example
523    /// ```ignore,no_run
524    /// # use google_cloud_api_cloudquotas_v1::model::CreateQuotaPreferenceRequest;
525    /// use google_cloud_api_cloudquotas_v1::model::QuotaPreference;
526    /// let x = CreateQuotaPreferenceRequest::new().set_quota_preference(QuotaPreference::default()/* use setters */);
527    /// ```
528    pub fn set_quota_preference<T>(mut self, v: T) -> Self
529    where
530        T: std::convert::Into<crate::model::QuotaPreference>,
531    {
532        self.quota_preference = std::option::Option::Some(v.into());
533        self
534    }
535
536    /// Sets or clears the value of [quota_preference][crate::model::CreateQuotaPreferenceRequest::quota_preference].
537    ///
538    /// # Example
539    /// ```ignore,no_run
540    /// # use google_cloud_api_cloudquotas_v1::model::CreateQuotaPreferenceRequest;
541    /// use google_cloud_api_cloudquotas_v1::model::QuotaPreference;
542    /// let x = CreateQuotaPreferenceRequest::new().set_or_clear_quota_preference(Some(QuotaPreference::default()/* use setters */));
543    /// let x = CreateQuotaPreferenceRequest::new().set_or_clear_quota_preference(None::<QuotaPreference>);
544    /// ```
545    pub fn set_or_clear_quota_preference<T>(mut self, v: std::option::Option<T>) -> Self
546    where
547        T: std::convert::Into<crate::model::QuotaPreference>,
548    {
549        self.quota_preference = v.map(|x| x.into());
550        self
551    }
552
553    /// Sets the value of [ignore_safety_checks][crate::model::CreateQuotaPreferenceRequest::ignore_safety_checks].
554    ///
555    /// # Example
556    /// ```ignore,no_run
557    /// # use google_cloud_api_cloudquotas_v1::model::CreateQuotaPreferenceRequest;
558    /// use google_cloud_api_cloudquotas_v1::model::QuotaSafetyCheck;
559    /// let x = CreateQuotaPreferenceRequest::new().set_ignore_safety_checks([
560    ///     QuotaSafetyCheck::QuotaDecreaseBelowUsage,
561    ///     QuotaSafetyCheck::QuotaDecreasePercentageTooHigh,
562    /// ]);
563    /// ```
564    pub fn set_ignore_safety_checks<T, V>(mut self, v: T) -> Self
565    where
566        T: std::iter::IntoIterator<Item = V>,
567        V: std::convert::Into<crate::model::QuotaSafetyCheck>,
568    {
569        use std::iter::Iterator;
570        self.ignore_safety_checks = v.into_iter().map(|i| i.into()).collect();
571        self
572    }
573}
574
575impl wkt::message::Message for CreateQuotaPreferenceRequest {
576    fn typename() -> &'static str {
577        "type.googleapis.com/google.api.cloudquotas.v1.CreateQuotaPreferenceRequest"
578    }
579}
580
581/// Message for updating a QuotaPreference
582#[derive(Clone, Default, PartialEq)]
583#[non_exhaustive]
584pub struct UpdateQuotaPreferenceRequest {
585    /// Optional. Field mask is used to specify the fields to be overwritten in the
586    /// QuotaPreference resource by the update.
587    /// The fields specified in the update_mask are relative to the resource, not
588    /// the full request. A field will be overwritten if it is in the mask. If the
589    /// user does not provide a mask then all fields will be overwritten.
590    pub update_mask: std::option::Option<wkt::FieldMask>,
591
592    /// Required. The resource being updated
593    pub quota_preference: std::option::Option<crate::model::QuotaPreference>,
594
595    /// Optional. If set to true, and the quota preference is not found, a new one
596    /// will be created. In this situation, `update_mask` is ignored.
597    pub allow_missing: bool,
598
599    /// Optional. If set to true, validate the request, but do not actually update.
600    /// Note that a request being valid does not mean that the request is
601    /// guaranteed to be fulfilled.
602    pub validate_only: bool,
603
604    /// The list of quota safety checks to be ignored.
605    pub ignore_safety_checks: std::vec::Vec<crate::model::QuotaSafetyCheck>,
606
607    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
608}
609
610impl UpdateQuotaPreferenceRequest {
611    pub fn new() -> Self {
612        std::default::Default::default()
613    }
614
615    /// Sets the value of [update_mask][crate::model::UpdateQuotaPreferenceRequest::update_mask].
616    ///
617    /// # Example
618    /// ```ignore,no_run
619    /// # use google_cloud_api_cloudquotas_v1::model::UpdateQuotaPreferenceRequest;
620    /// use wkt::FieldMask;
621    /// let x = UpdateQuotaPreferenceRequest::new().set_update_mask(FieldMask::default()/* use setters */);
622    /// ```
623    pub fn set_update_mask<T>(mut self, v: T) -> Self
624    where
625        T: std::convert::Into<wkt::FieldMask>,
626    {
627        self.update_mask = std::option::Option::Some(v.into());
628        self
629    }
630
631    /// Sets or clears the value of [update_mask][crate::model::UpdateQuotaPreferenceRequest::update_mask].
632    ///
633    /// # Example
634    /// ```ignore,no_run
635    /// # use google_cloud_api_cloudquotas_v1::model::UpdateQuotaPreferenceRequest;
636    /// use wkt::FieldMask;
637    /// let x = UpdateQuotaPreferenceRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
638    /// let x = UpdateQuotaPreferenceRequest::new().set_or_clear_update_mask(None::<FieldMask>);
639    /// ```
640    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
641    where
642        T: std::convert::Into<wkt::FieldMask>,
643    {
644        self.update_mask = v.map(|x| x.into());
645        self
646    }
647
648    /// Sets the value of [quota_preference][crate::model::UpdateQuotaPreferenceRequest::quota_preference].
649    ///
650    /// # Example
651    /// ```ignore,no_run
652    /// # use google_cloud_api_cloudquotas_v1::model::UpdateQuotaPreferenceRequest;
653    /// use google_cloud_api_cloudquotas_v1::model::QuotaPreference;
654    /// let x = UpdateQuotaPreferenceRequest::new().set_quota_preference(QuotaPreference::default()/* use setters */);
655    /// ```
656    pub fn set_quota_preference<T>(mut self, v: T) -> Self
657    where
658        T: std::convert::Into<crate::model::QuotaPreference>,
659    {
660        self.quota_preference = std::option::Option::Some(v.into());
661        self
662    }
663
664    /// Sets or clears the value of [quota_preference][crate::model::UpdateQuotaPreferenceRequest::quota_preference].
665    ///
666    /// # Example
667    /// ```ignore,no_run
668    /// # use google_cloud_api_cloudquotas_v1::model::UpdateQuotaPreferenceRequest;
669    /// use google_cloud_api_cloudquotas_v1::model::QuotaPreference;
670    /// let x = UpdateQuotaPreferenceRequest::new().set_or_clear_quota_preference(Some(QuotaPreference::default()/* use setters */));
671    /// let x = UpdateQuotaPreferenceRequest::new().set_or_clear_quota_preference(None::<QuotaPreference>);
672    /// ```
673    pub fn set_or_clear_quota_preference<T>(mut self, v: std::option::Option<T>) -> Self
674    where
675        T: std::convert::Into<crate::model::QuotaPreference>,
676    {
677        self.quota_preference = v.map(|x| x.into());
678        self
679    }
680
681    /// Sets the value of [allow_missing][crate::model::UpdateQuotaPreferenceRequest::allow_missing].
682    ///
683    /// # Example
684    /// ```ignore,no_run
685    /// # use google_cloud_api_cloudquotas_v1::model::UpdateQuotaPreferenceRequest;
686    /// let x = UpdateQuotaPreferenceRequest::new().set_allow_missing(true);
687    /// ```
688    pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
689        self.allow_missing = v.into();
690        self
691    }
692
693    /// Sets the value of [validate_only][crate::model::UpdateQuotaPreferenceRequest::validate_only].
694    ///
695    /// # Example
696    /// ```ignore,no_run
697    /// # use google_cloud_api_cloudquotas_v1::model::UpdateQuotaPreferenceRequest;
698    /// let x = UpdateQuotaPreferenceRequest::new().set_validate_only(true);
699    /// ```
700    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
701        self.validate_only = v.into();
702        self
703    }
704
705    /// Sets the value of [ignore_safety_checks][crate::model::UpdateQuotaPreferenceRequest::ignore_safety_checks].
706    ///
707    /// # Example
708    /// ```ignore,no_run
709    /// # use google_cloud_api_cloudquotas_v1::model::UpdateQuotaPreferenceRequest;
710    /// use google_cloud_api_cloudquotas_v1::model::QuotaSafetyCheck;
711    /// let x = UpdateQuotaPreferenceRequest::new().set_ignore_safety_checks([
712    ///     QuotaSafetyCheck::QuotaDecreaseBelowUsage,
713    ///     QuotaSafetyCheck::QuotaDecreasePercentageTooHigh,
714    /// ]);
715    /// ```
716    pub fn set_ignore_safety_checks<T, V>(mut self, v: T) -> Self
717    where
718        T: std::iter::IntoIterator<Item = V>,
719        V: std::convert::Into<crate::model::QuotaSafetyCheck>,
720    {
721        use std::iter::Iterator;
722        self.ignore_safety_checks = v.into_iter().map(|i| i.into()).collect();
723        self
724    }
725}
726
727impl wkt::message::Message for UpdateQuotaPreferenceRequest {
728    fn typename() -> &'static str {
729        "type.googleapis.com/google.api.cloudquotas.v1.UpdateQuotaPreferenceRequest"
730    }
731}
732
733/// QuotaInfo represents information about a particular quota for a given
734/// project, folder or organization.
735#[derive(Clone, Default, PartialEq)]
736#[non_exhaustive]
737pub struct QuotaInfo {
738    /// Resource name of this QuotaInfo.
739    /// The ID component following "locations/" must be "global".
740    /// Example:
741    /// `projects/123/locations/global/services/compute.googleapis.com/quotaInfos/CpusPerProjectPerRegion`
742    pub name: std::string::String,
743
744    /// The id of the quota, which is unquie within the service.
745    /// Example: `CpusPerProjectPerRegion`
746    pub quota_id: std::string::String,
747
748    /// The metric of the quota. It specifies the resources consumption the quota
749    /// is defined for.
750    /// Example: `compute.googleapis.com/cpus`
751    pub metric: std::string::String,
752
753    /// The name of the service in which the quota is defined.
754    /// Example: `compute.googleapis.com`
755    pub service: std::string::String,
756
757    /// Whether this is a precise quota. A precise quota is tracked with absolute
758    /// precision. In contrast, an imprecise quota is not tracked with precision.
759    pub is_precise: bool,
760
761    /// The reset time interval for the quota. Refresh interval applies to rate
762    /// quota only.
763    /// Example: "minute" for per minute, "day" for per day, or "10 seconds" for
764    /// every 10 seconds.
765    pub refresh_interval: std::string::String,
766
767    /// The container type of the QuotaInfo.
768    pub container_type: crate::model::quota_info::ContainerType,
769
770    /// The dimensions the quota is defined on.
771    pub dimensions: std::vec::Vec<std::string::String>,
772
773    /// The display name of the quota metric
774    pub metric_display_name: std::string::String,
775
776    /// The display name of the quota.
777    pub quota_display_name: std::string::String,
778
779    /// The unit in which the metric value is reported, e.g., "MByte".
780    pub metric_unit: std::string::String,
781
782    /// Whether it is eligible to request a higher quota value for this quota.
783    pub quota_increase_eligibility: std::option::Option<crate::model::QuotaIncreaseEligibility>,
784
785    /// Whether the quota value is fixed or adjustable
786    pub is_fixed: bool,
787
788    /// The collection of dimensions info ordered by their dimensions from more
789    /// specific ones to less specific ones.
790    pub dimensions_infos: std::vec::Vec<crate::model::DimensionsInfo>,
791
792    /// Whether the quota is a concurrent quota. Concurrent quotas are enforced
793    /// on the total number of concurrent operations in flight at any given time.
794    pub is_concurrent: bool,
795
796    /// URI to the page where users can request more quota for the cloud
797    /// service—for example,
798    /// <https://console.cloud.google.com/iam-admin/quotas>.
799    pub service_request_quota_uri: std::string::String,
800
801    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
802}
803
804impl QuotaInfo {
805    pub fn new() -> Self {
806        std::default::Default::default()
807    }
808
809    /// Sets the value of [name][crate::model::QuotaInfo::name].
810    ///
811    /// # Example
812    /// ```ignore,no_run
813    /// # use google_cloud_api_cloudquotas_v1::model::QuotaInfo;
814    /// let x = QuotaInfo::new().set_name("example");
815    /// ```
816    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
817        self.name = v.into();
818        self
819    }
820
821    /// Sets the value of [quota_id][crate::model::QuotaInfo::quota_id].
822    ///
823    /// # Example
824    /// ```ignore,no_run
825    /// # use google_cloud_api_cloudquotas_v1::model::QuotaInfo;
826    /// let x = QuotaInfo::new().set_quota_id("example");
827    /// ```
828    pub fn set_quota_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
829        self.quota_id = v.into();
830        self
831    }
832
833    /// Sets the value of [metric][crate::model::QuotaInfo::metric].
834    ///
835    /// # Example
836    /// ```ignore,no_run
837    /// # use google_cloud_api_cloudquotas_v1::model::QuotaInfo;
838    /// let x = QuotaInfo::new().set_metric("example");
839    /// ```
840    pub fn set_metric<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
841        self.metric = v.into();
842        self
843    }
844
845    /// Sets the value of [service][crate::model::QuotaInfo::service].
846    ///
847    /// # Example
848    /// ```ignore,no_run
849    /// # use google_cloud_api_cloudquotas_v1::model::QuotaInfo;
850    /// let x = QuotaInfo::new().set_service("example");
851    /// ```
852    pub fn set_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
853        self.service = v.into();
854        self
855    }
856
857    /// Sets the value of [is_precise][crate::model::QuotaInfo::is_precise].
858    ///
859    /// # Example
860    /// ```ignore,no_run
861    /// # use google_cloud_api_cloudquotas_v1::model::QuotaInfo;
862    /// let x = QuotaInfo::new().set_is_precise(true);
863    /// ```
864    pub fn set_is_precise<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
865        self.is_precise = v.into();
866        self
867    }
868
869    /// Sets the value of [refresh_interval][crate::model::QuotaInfo::refresh_interval].
870    ///
871    /// # Example
872    /// ```ignore,no_run
873    /// # use google_cloud_api_cloudquotas_v1::model::QuotaInfo;
874    /// let x = QuotaInfo::new().set_refresh_interval("example");
875    /// ```
876    pub fn set_refresh_interval<T: std::convert::Into<std::string::String>>(
877        mut self,
878        v: T,
879    ) -> Self {
880        self.refresh_interval = v.into();
881        self
882    }
883
884    /// Sets the value of [container_type][crate::model::QuotaInfo::container_type].
885    ///
886    /// # Example
887    /// ```ignore,no_run
888    /// # use google_cloud_api_cloudquotas_v1::model::QuotaInfo;
889    /// use google_cloud_api_cloudquotas_v1::model::quota_info::ContainerType;
890    /// let x0 = QuotaInfo::new().set_container_type(ContainerType::Project);
891    /// let x1 = QuotaInfo::new().set_container_type(ContainerType::Folder);
892    /// let x2 = QuotaInfo::new().set_container_type(ContainerType::Organization);
893    /// ```
894    pub fn set_container_type<T: std::convert::Into<crate::model::quota_info::ContainerType>>(
895        mut self,
896        v: T,
897    ) -> Self {
898        self.container_type = v.into();
899        self
900    }
901
902    /// Sets the value of [dimensions][crate::model::QuotaInfo::dimensions].
903    ///
904    /// # Example
905    /// ```ignore,no_run
906    /// # use google_cloud_api_cloudquotas_v1::model::QuotaInfo;
907    /// let x = QuotaInfo::new().set_dimensions(["a", "b", "c"]);
908    /// ```
909    pub fn set_dimensions<T, V>(mut self, v: T) -> Self
910    where
911        T: std::iter::IntoIterator<Item = V>,
912        V: std::convert::Into<std::string::String>,
913    {
914        use std::iter::Iterator;
915        self.dimensions = v.into_iter().map(|i| i.into()).collect();
916        self
917    }
918
919    /// Sets the value of [metric_display_name][crate::model::QuotaInfo::metric_display_name].
920    ///
921    /// # Example
922    /// ```ignore,no_run
923    /// # use google_cloud_api_cloudquotas_v1::model::QuotaInfo;
924    /// let x = QuotaInfo::new().set_metric_display_name("example");
925    /// ```
926    pub fn set_metric_display_name<T: std::convert::Into<std::string::String>>(
927        mut self,
928        v: T,
929    ) -> Self {
930        self.metric_display_name = v.into();
931        self
932    }
933
934    /// Sets the value of [quota_display_name][crate::model::QuotaInfo::quota_display_name].
935    ///
936    /// # Example
937    /// ```ignore,no_run
938    /// # use google_cloud_api_cloudquotas_v1::model::QuotaInfo;
939    /// let x = QuotaInfo::new().set_quota_display_name("example");
940    /// ```
941    pub fn set_quota_display_name<T: std::convert::Into<std::string::String>>(
942        mut self,
943        v: T,
944    ) -> Self {
945        self.quota_display_name = v.into();
946        self
947    }
948
949    /// Sets the value of [metric_unit][crate::model::QuotaInfo::metric_unit].
950    ///
951    /// # Example
952    /// ```ignore,no_run
953    /// # use google_cloud_api_cloudquotas_v1::model::QuotaInfo;
954    /// let x = QuotaInfo::new().set_metric_unit("example");
955    /// ```
956    pub fn set_metric_unit<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
957        self.metric_unit = v.into();
958        self
959    }
960
961    /// Sets the value of [quota_increase_eligibility][crate::model::QuotaInfo::quota_increase_eligibility].
962    ///
963    /// # Example
964    /// ```ignore,no_run
965    /// # use google_cloud_api_cloudquotas_v1::model::QuotaInfo;
966    /// use google_cloud_api_cloudquotas_v1::model::QuotaIncreaseEligibility;
967    /// let x = QuotaInfo::new().set_quota_increase_eligibility(QuotaIncreaseEligibility::default()/* use setters */);
968    /// ```
969    pub fn set_quota_increase_eligibility<T>(mut self, v: T) -> Self
970    where
971        T: std::convert::Into<crate::model::QuotaIncreaseEligibility>,
972    {
973        self.quota_increase_eligibility = std::option::Option::Some(v.into());
974        self
975    }
976
977    /// Sets or clears the value of [quota_increase_eligibility][crate::model::QuotaInfo::quota_increase_eligibility].
978    ///
979    /// # Example
980    /// ```ignore,no_run
981    /// # use google_cloud_api_cloudquotas_v1::model::QuotaInfo;
982    /// use google_cloud_api_cloudquotas_v1::model::QuotaIncreaseEligibility;
983    /// let x = QuotaInfo::new().set_or_clear_quota_increase_eligibility(Some(QuotaIncreaseEligibility::default()/* use setters */));
984    /// let x = QuotaInfo::new().set_or_clear_quota_increase_eligibility(None::<QuotaIncreaseEligibility>);
985    /// ```
986    pub fn set_or_clear_quota_increase_eligibility<T>(mut self, v: std::option::Option<T>) -> Self
987    where
988        T: std::convert::Into<crate::model::QuotaIncreaseEligibility>,
989    {
990        self.quota_increase_eligibility = v.map(|x| x.into());
991        self
992    }
993
994    /// Sets the value of [is_fixed][crate::model::QuotaInfo::is_fixed].
995    ///
996    /// # Example
997    /// ```ignore,no_run
998    /// # use google_cloud_api_cloudquotas_v1::model::QuotaInfo;
999    /// let x = QuotaInfo::new().set_is_fixed(true);
1000    /// ```
1001    pub fn set_is_fixed<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1002        self.is_fixed = v.into();
1003        self
1004    }
1005
1006    /// Sets the value of [dimensions_infos][crate::model::QuotaInfo::dimensions_infos].
1007    ///
1008    /// # Example
1009    /// ```ignore,no_run
1010    /// # use google_cloud_api_cloudquotas_v1::model::QuotaInfo;
1011    /// use google_cloud_api_cloudquotas_v1::model::DimensionsInfo;
1012    /// let x = QuotaInfo::new()
1013    ///     .set_dimensions_infos([
1014    ///         DimensionsInfo::default()/* use setters */,
1015    ///         DimensionsInfo::default()/* use (different) setters */,
1016    ///     ]);
1017    /// ```
1018    pub fn set_dimensions_infos<T, V>(mut self, v: T) -> Self
1019    where
1020        T: std::iter::IntoIterator<Item = V>,
1021        V: std::convert::Into<crate::model::DimensionsInfo>,
1022    {
1023        use std::iter::Iterator;
1024        self.dimensions_infos = v.into_iter().map(|i| i.into()).collect();
1025        self
1026    }
1027
1028    /// Sets the value of [is_concurrent][crate::model::QuotaInfo::is_concurrent].
1029    ///
1030    /// # Example
1031    /// ```ignore,no_run
1032    /// # use google_cloud_api_cloudquotas_v1::model::QuotaInfo;
1033    /// let x = QuotaInfo::new().set_is_concurrent(true);
1034    /// ```
1035    pub fn set_is_concurrent<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1036        self.is_concurrent = v.into();
1037        self
1038    }
1039
1040    /// Sets the value of [service_request_quota_uri][crate::model::QuotaInfo::service_request_quota_uri].
1041    ///
1042    /// # Example
1043    /// ```ignore,no_run
1044    /// # use google_cloud_api_cloudquotas_v1::model::QuotaInfo;
1045    /// let x = QuotaInfo::new().set_service_request_quota_uri("example");
1046    /// ```
1047    pub fn set_service_request_quota_uri<T: std::convert::Into<std::string::String>>(
1048        mut self,
1049        v: T,
1050    ) -> Self {
1051        self.service_request_quota_uri = v.into();
1052        self
1053    }
1054}
1055
1056impl wkt::message::Message for QuotaInfo {
1057    fn typename() -> &'static str {
1058        "type.googleapis.com/google.api.cloudquotas.v1.QuotaInfo"
1059    }
1060}
1061
1062/// Defines additional types related to [QuotaInfo].
1063pub mod quota_info {
1064    #[allow(unused_imports)]
1065    use super::*;
1066
1067    /// The enumeration of the types of a cloud resource container.
1068    ///
1069    /// # Working with unknown values
1070    ///
1071    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1072    /// additional enum variants at any time. Adding new variants is not considered
1073    /// a breaking change. Applications should write their code in anticipation of:
1074    ///
1075    /// - New values appearing in future releases of the client library, **and**
1076    /// - New values received dynamically, without application changes.
1077    ///
1078    /// Please consult the [Working with enums] section in the user guide for some
1079    /// guidelines.
1080    ///
1081    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1082    #[derive(Clone, Debug, PartialEq)]
1083    #[non_exhaustive]
1084    pub enum ContainerType {
1085        /// Unspecified container type.
1086        Unspecified,
1087        /// consumer project
1088        Project,
1089        /// folder
1090        Folder,
1091        /// organization
1092        Organization,
1093        /// If set, the enum was initialized with an unknown value.
1094        ///
1095        /// Applications can examine the value using [ContainerType::value] or
1096        /// [ContainerType::name].
1097        UnknownValue(container_type::UnknownValue),
1098    }
1099
1100    #[doc(hidden)]
1101    pub mod container_type {
1102        #[allow(unused_imports)]
1103        use super::*;
1104        #[derive(Clone, Debug, PartialEq)]
1105        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1106    }
1107
1108    impl ContainerType {
1109        /// Gets the enum value.
1110        ///
1111        /// Returns `None` if the enum contains an unknown value deserialized from
1112        /// the string representation of enums.
1113        pub fn value(&self) -> std::option::Option<i32> {
1114            match self {
1115                Self::Unspecified => std::option::Option::Some(0),
1116                Self::Project => std::option::Option::Some(1),
1117                Self::Folder => std::option::Option::Some(2),
1118                Self::Organization => std::option::Option::Some(3),
1119                Self::UnknownValue(u) => u.0.value(),
1120            }
1121        }
1122
1123        /// Gets the enum value as a string.
1124        ///
1125        /// Returns `None` if the enum contains an unknown value deserialized from
1126        /// the integer representation of enums.
1127        pub fn name(&self) -> std::option::Option<&str> {
1128            match self {
1129                Self::Unspecified => std::option::Option::Some("CONTAINER_TYPE_UNSPECIFIED"),
1130                Self::Project => std::option::Option::Some("PROJECT"),
1131                Self::Folder => std::option::Option::Some("FOLDER"),
1132                Self::Organization => std::option::Option::Some("ORGANIZATION"),
1133                Self::UnknownValue(u) => u.0.name(),
1134            }
1135        }
1136    }
1137
1138    impl std::default::Default for ContainerType {
1139        fn default() -> Self {
1140            use std::convert::From;
1141            Self::from(0)
1142        }
1143    }
1144
1145    impl std::fmt::Display for ContainerType {
1146        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1147            wkt::internal::display_enum(f, self.name(), self.value())
1148        }
1149    }
1150
1151    impl std::convert::From<i32> for ContainerType {
1152        fn from(value: i32) -> Self {
1153            match value {
1154                0 => Self::Unspecified,
1155                1 => Self::Project,
1156                2 => Self::Folder,
1157                3 => Self::Organization,
1158                _ => Self::UnknownValue(container_type::UnknownValue(
1159                    wkt::internal::UnknownEnumValue::Integer(value),
1160                )),
1161            }
1162        }
1163    }
1164
1165    impl std::convert::From<&str> for ContainerType {
1166        fn from(value: &str) -> Self {
1167            use std::string::ToString;
1168            match value {
1169                "CONTAINER_TYPE_UNSPECIFIED" => Self::Unspecified,
1170                "PROJECT" => Self::Project,
1171                "FOLDER" => Self::Folder,
1172                "ORGANIZATION" => Self::Organization,
1173                _ => Self::UnknownValue(container_type::UnknownValue(
1174                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1175                )),
1176            }
1177        }
1178    }
1179
1180    impl serde::ser::Serialize for ContainerType {
1181        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1182        where
1183            S: serde::Serializer,
1184        {
1185            match self {
1186                Self::Unspecified => serializer.serialize_i32(0),
1187                Self::Project => serializer.serialize_i32(1),
1188                Self::Folder => serializer.serialize_i32(2),
1189                Self::Organization => serializer.serialize_i32(3),
1190                Self::UnknownValue(u) => u.0.serialize(serializer),
1191            }
1192        }
1193    }
1194
1195    impl<'de> serde::de::Deserialize<'de> for ContainerType {
1196        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1197        where
1198            D: serde::Deserializer<'de>,
1199        {
1200            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ContainerType>::new(
1201                ".google.api.cloudquotas.v1.QuotaInfo.ContainerType",
1202            ))
1203        }
1204    }
1205}
1206
1207/// Eligibility information regarding requesting increase adjustment of a quota.
1208#[derive(Clone, Default, PartialEq)]
1209#[non_exhaustive]
1210pub struct QuotaIncreaseEligibility {
1211    /// Whether a higher quota value can be requested for the quota.
1212    pub is_eligible: bool,
1213
1214    /// The reason of why it is ineligible to request increased value of the quota.
1215    /// If the is_eligible field is true, it defaults to
1216    /// INELIGIBILITY_REASON_UNSPECIFIED.
1217    pub ineligibility_reason: crate::model::quota_increase_eligibility::IneligibilityReason,
1218
1219    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1220}
1221
1222impl QuotaIncreaseEligibility {
1223    pub fn new() -> Self {
1224        std::default::Default::default()
1225    }
1226
1227    /// Sets the value of [is_eligible][crate::model::QuotaIncreaseEligibility::is_eligible].
1228    ///
1229    /// # Example
1230    /// ```ignore,no_run
1231    /// # use google_cloud_api_cloudquotas_v1::model::QuotaIncreaseEligibility;
1232    /// let x = QuotaIncreaseEligibility::new().set_is_eligible(true);
1233    /// ```
1234    pub fn set_is_eligible<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1235        self.is_eligible = v.into();
1236        self
1237    }
1238
1239    /// Sets the value of [ineligibility_reason][crate::model::QuotaIncreaseEligibility::ineligibility_reason].
1240    ///
1241    /// # Example
1242    /// ```ignore,no_run
1243    /// # use google_cloud_api_cloudquotas_v1::model::QuotaIncreaseEligibility;
1244    /// use google_cloud_api_cloudquotas_v1::model::quota_increase_eligibility::IneligibilityReason;
1245    /// let x0 = QuotaIncreaseEligibility::new().set_ineligibility_reason(IneligibilityReason::NoValidBillingAccount);
1246    /// let x1 = QuotaIncreaseEligibility::new().set_ineligibility_reason(IneligibilityReason::NotSupported);
1247    /// let x2 = QuotaIncreaseEligibility::new().set_ineligibility_reason(IneligibilityReason::NotEnoughUsageHistory);
1248    /// ```
1249    pub fn set_ineligibility_reason<
1250        T: std::convert::Into<crate::model::quota_increase_eligibility::IneligibilityReason>,
1251    >(
1252        mut self,
1253        v: T,
1254    ) -> Self {
1255        self.ineligibility_reason = v.into();
1256        self
1257    }
1258}
1259
1260impl wkt::message::Message for QuotaIncreaseEligibility {
1261    fn typename() -> &'static str {
1262        "type.googleapis.com/google.api.cloudquotas.v1.QuotaIncreaseEligibility"
1263    }
1264}
1265
1266/// Defines additional types related to [QuotaIncreaseEligibility].
1267pub mod quota_increase_eligibility {
1268    #[allow(unused_imports)]
1269    use super::*;
1270
1271    /// The enumeration of reasons when it is ineligible to request increase
1272    /// adjustment.
1273    ///
1274    /// # Working with unknown values
1275    ///
1276    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1277    /// additional enum variants at any time. Adding new variants is not considered
1278    /// a breaking change. Applications should write their code in anticipation of:
1279    ///
1280    /// - New values appearing in future releases of the client library, **and**
1281    /// - New values received dynamically, without application changes.
1282    ///
1283    /// Please consult the [Working with enums] section in the user guide for some
1284    /// guidelines.
1285    ///
1286    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1287    #[derive(Clone, Debug, PartialEq)]
1288    #[non_exhaustive]
1289    pub enum IneligibilityReason {
1290        /// Default value when is_eligible is true.
1291        Unspecified,
1292        /// The container is not linked with a valid billing account.
1293        NoValidBillingAccount,
1294        /// Quota increase is not supported for the quota.
1295        NotSupported,
1296        /// There is not enough usage history to determine the eligibility.
1297        NotEnoughUsageHistory,
1298        /// Other reasons.
1299        Other,
1300        /// If set, the enum was initialized with an unknown value.
1301        ///
1302        /// Applications can examine the value using [IneligibilityReason::value] or
1303        /// [IneligibilityReason::name].
1304        UnknownValue(ineligibility_reason::UnknownValue),
1305    }
1306
1307    #[doc(hidden)]
1308    pub mod ineligibility_reason {
1309        #[allow(unused_imports)]
1310        use super::*;
1311        #[derive(Clone, Debug, PartialEq)]
1312        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1313    }
1314
1315    impl IneligibilityReason {
1316        /// Gets the enum value.
1317        ///
1318        /// Returns `None` if the enum contains an unknown value deserialized from
1319        /// the string representation of enums.
1320        pub fn value(&self) -> std::option::Option<i32> {
1321            match self {
1322                Self::Unspecified => std::option::Option::Some(0),
1323                Self::NoValidBillingAccount => std::option::Option::Some(1),
1324                Self::NotSupported => std::option::Option::Some(3),
1325                Self::NotEnoughUsageHistory => std::option::Option::Some(4),
1326                Self::Other => std::option::Option::Some(2),
1327                Self::UnknownValue(u) => u.0.value(),
1328            }
1329        }
1330
1331        /// Gets the enum value as a string.
1332        ///
1333        /// Returns `None` if the enum contains an unknown value deserialized from
1334        /// the integer representation of enums.
1335        pub fn name(&self) -> std::option::Option<&str> {
1336            match self {
1337                Self::Unspecified => std::option::Option::Some("INELIGIBILITY_REASON_UNSPECIFIED"),
1338                Self::NoValidBillingAccount => {
1339                    std::option::Option::Some("NO_VALID_BILLING_ACCOUNT")
1340                }
1341                Self::NotSupported => std::option::Option::Some("NOT_SUPPORTED"),
1342                Self::NotEnoughUsageHistory => {
1343                    std::option::Option::Some("NOT_ENOUGH_USAGE_HISTORY")
1344                }
1345                Self::Other => std::option::Option::Some("OTHER"),
1346                Self::UnknownValue(u) => u.0.name(),
1347            }
1348        }
1349    }
1350
1351    impl std::default::Default for IneligibilityReason {
1352        fn default() -> Self {
1353            use std::convert::From;
1354            Self::from(0)
1355        }
1356    }
1357
1358    impl std::fmt::Display for IneligibilityReason {
1359        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1360            wkt::internal::display_enum(f, self.name(), self.value())
1361        }
1362    }
1363
1364    impl std::convert::From<i32> for IneligibilityReason {
1365        fn from(value: i32) -> Self {
1366            match value {
1367                0 => Self::Unspecified,
1368                1 => Self::NoValidBillingAccount,
1369                2 => Self::Other,
1370                3 => Self::NotSupported,
1371                4 => Self::NotEnoughUsageHistory,
1372                _ => Self::UnknownValue(ineligibility_reason::UnknownValue(
1373                    wkt::internal::UnknownEnumValue::Integer(value),
1374                )),
1375            }
1376        }
1377    }
1378
1379    impl std::convert::From<&str> for IneligibilityReason {
1380        fn from(value: &str) -> Self {
1381            use std::string::ToString;
1382            match value {
1383                "INELIGIBILITY_REASON_UNSPECIFIED" => Self::Unspecified,
1384                "NO_VALID_BILLING_ACCOUNT" => Self::NoValidBillingAccount,
1385                "NOT_SUPPORTED" => Self::NotSupported,
1386                "NOT_ENOUGH_USAGE_HISTORY" => Self::NotEnoughUsageHistory,
1387                "OTHER" => Self::Other,
1388                _ => Self::UnknownValue(ineligibility_reason::UnknownValue(
1389                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1390                )),
1391            }
1392        }
1393    }
1394
1395    impl serde::ser::Serialize for IneligibilityReason {
1396        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1397        where
1398            S: serde::Serializer,
1399        {
1400            match self {
1401                Self::Unspecified => serializer.serialize_i32(0),
1402                Self::NoValidBillingAccount => serializer.serialize_i32(1),
1403                Self::NotSupported => serializer.serialize_i32(3),
1404                Self::NotEnoughUsageHistory => serializer.serialize_i32(4),
1405                Self::Other => serializer.serialize_i32(2),
1406                Self::UnknownValue(u) => u.0.serialize(serializer),
1407            }
1408        }
1409    }
1410
1411    impl<'de> serde::de::Deserialize<'de> for IneligibilityReason {
1412        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1413        where
1414            D: serde::Deserializer<'de>,
1415        {
1416            deserializer.deserialize_any(wkt::internal::EnumVisitor::<IneligibilityReason>::new(
1417                ".google.api.cloudquotas.v1.QuotaIncreaseEligibility.IneligibilityReason",
1418            ))
1419        }
1420    }
1421}
1422
1423/// QuotaPreference represents the preferred quota configuration specified for
1424/// a project, folder or organization. There is only one QuotaPreference
1425/// resource for a quota value targeting a unique set of dimensions.
1426#[derive(Clone, Default, PartialEq)]
1427#[non_exhaustive]
1428pub struct QuotaPreference {
1429    /// Required except in the CREATE requests.
1430    /// The resource name of the quota preference.
1431    /// The ID component following "locations/" must be "global".
1432    /// Example:
1433    /// `projects/123/locations/global/quotaPreferences/my-config-for-us-east1`
1434    pub name: std::string::String,
1435
1436    /// Immutable. The dimensions that this quota preference applies to. The key of
1437    /// the map entry is the name of a dimension, such as "region", "zone",
1438    /// "network_id", and the value of the map entry is the dimension value.
1439    ///
1440    /// If a dimension is missing from the map of dimensions, the quota preference
1441    /// applies to all the dimension values except for those that have other quota
1442    /// preferences configured for the specific value.
1443    ///
1444    /// NOTE: QuotaPreferences can only be applied across all values of "user" and
1445    /// "resource" dimension. Do not set values for "user" or "resource" in the
1446    /// dimension map.
1447    ///
1448    /// Example: {"provider", "Foo Inc"} where "provider" is a service specific
1449    /// dimension.
1450    pub dimensions: std::collections::HashMap<std::string::String, std::string::String>,
1451
1452    /// Required. Preferred quota configuration.
1453    pub quota_config: std::option::Option<crate::model::QuotaConfig>,
1454
1455    /// Optional. The current etag of the quota preference. If an etag is provided
1456    /// on update and does not match the current server's etag of the quota
1457    /// preference, the request will be blocked and an ABORTED error will be
1458    /// returned. See <https://google.aip.dev/134#etags> for more details on etags.
1459    pub etag: std::string::String,
1460
1461    /// Output only. Create time stamp
1462    pub create_time: std::option::Option<wkt::Timestamp>,
1463
1464    /// Output only. Update time stamp
1465    pub update_time: std::option::Option<wkt::Timestamp>,
1466
1467    /// Required. The name of the service to which the quota preference is applied.
1468    pub service: std::string::String,
1469
1470    /// Required. The id of the quota to which the quota preference is applied. A
1471    /// quota name is unique in the service. Example: `CpusPerProjectPerRegion`
1472    pub quota_id: std::string::String,
1473
1474    /// Output only. Is the quota preference pending Google Cloud approval and
1475    /// fulfillment.
1476    pub reconciling: bool,
1477
1478    /// The reason / justification for this quota preference.
1479    pub justification: std::string::String,
1480
1481    /// Input only. An email address that can be used to contact the the user, in
1482    /// case Google Cloud needs more information to make a decision before
1483    /// additional quota can be granted.
1484    ///
1485    /// When requesting a quota increase, the email address is required.
1486    /// When requesting a quota decrease, the email address is optional.
1487    /// For example, the email address is optional when the
1488    /// `QuotaConfig.preferred_value` is smaller than the
1489    /// `QuotaDetails.reset_value`.
1490    pub contact_email: std::string::String,
1491
1492    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1493}
1494
1495impl QuotaPreference {
1496    pub fn new() -> Self {
1497        std::default::Default::default()
1498    }
1499
1500    /// Sets the value of [name][crate::model::QuotaPreference::name].
1501    ///
1502    /// # Example
1503    /// ```ignore,no_run
1504    /// # use google_cloud_api_cloudquotas_v1::model::QuotaPreference;
1505    /// let x = QuotaPreference::new().set_name("example");
1506    /// ```
1507    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1508        self.name = v.into();
1509        self
1510    }
1511
1512    /// Sets the value of [dimensions][crate::model::QuotaPreference::dimensions].
1513    ///
1514    /// # Example
1515    /// ```ignore,no_run
1516    /// # use google_cloud_api_cloudquotas_v1::model::QuotaPreference;
1517    /// let x = QuotaPreference::new().set_dimensions([
1518    ///     ("key0", "abc"),
1519    ///     ("key1", "xyz"),
1520    /// ]);
1521    /// ```
1522    pub fn set_dimensions<T, K, V>(mut self, v: T) -> Self
1523    where
1524        T: std::iter::IntoIterator<Item = (K, V)>,
1525        K: std::convert::Into<std::string::String>,
1526        V: std::convert::Into<std::string::String>,
1527    {
1528        use std::iter::Iterator;
1529        self.dimensions = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1530        self
1531    }
1532
1533    /// Sets the value of [quota_config][crate::model::QuotaPreference::quota_config].
1534    ///
1535    /// # Example
1536    /// ```ignore,no_run
1537    /// # use google_cloud_api_cloudquotas_v1::model::QuotaPreference;
1538    /// use google_cloud_api_cloudquotas_v1::model::QuotaConfig;
1539    /// let x = QuotaPreference::new().set_quota_config(QuotaConfig::default()/* use setters */);
1540    /// ```
1541    pub fn set_quota_config<T>(mut self, v: T) -> Self
1542    where
1543        T: std::convert::Into<crate::model::QuotaConfig>,
1544    {
1545        self.quota_config = std::option::Option::Some(v.into());
1546        self
1547    }
1548
1549    /// Sets or clears the value of [quota_config][crate::model::QuotaPreference::quota_config].
1550    ///
1551    /// # Example
1552    /// ```ignore,no_run
1553    /// # use google_cloud_api_cloudquotas_v1::model::QuotaPreference;
1554    /// use google_cloud_api_cloudquotas_v1::model::QuotaConfig;
1555    /// let x = QuotaPreference::new().set_or_clear_quota_config(Some(QuotaConfig::default()/* use setters */));
1556    /// let x = QuotaPreference::new().set_or_clear_quota_config(None::<QuotaConfig>);
1557    /// ```
1558    pub fn set_or_clear_quota_config<T>(mut self, v: std::option::Option<T>) -> Self
1559    where
1560        T: std::convert::Into<crate::model::QuotaConfig>,
1561    {
1562        self.quota_config = v.map(|x| x.into());
1563        self
1564    }
1565
1566    /// Sets the value of [etag][crate::model::QuotaPreference::etag].
1567    ///
1568    /// # Example
1569    /// ```ignore,no_run
1570    /// # use google_cloud_api_cloudquotas_v1::model::QuotaPreference;
1571    /// let x = QuotaPreference::new().set_etag("example");
1572    /// ```
1573    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1574        self.etag = v.into();
1575        self
1576    }
1577
1578    /// Sets the value of [create_time][crate::model::QuotaPreference::create_time].
1579    ///
1580    /// # Example
1581    /// ```ignore,no_run
1582    /// # use google_cloud_api_cloudquotas_v1::model::QuotaPreference;
1583    /// use wkt::Timestamp;
1584    /// let x = QuotaPreference::new().set_create_time(Timestamp::default()/* use setters */);
1585    /// ```
1586    pub fn set_create_time<T>(mut self, v: T) -> Self
1587    where
1588        T: std::convert::Into<wkt::Timestamp>,
1589    {
1590        self.create_time = std::option::Option::Some(v.into());
1591        self
1592    }
1593
1594    /// Sets or clears the value of [create_time][crate::model::QuotaPreference::create_time].
1595    ///
1596    /// # Example
1597    /// ```ignore,no_run
1598    /// # use google_cloud_api_cloudquotas_v1::model::QuotaPreference;
1599    /// use wkt::Timestamp;
1600    /// let x = QuotaPreference::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
1601    /// let x = QuotaPreference::new().set_or_clear_create_time(None::<Timestamp>);
1602    /// ```
1603    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
1604    where
1605        T: std::convert::Into<wkt::Timestamp>,
1606    {
1607        self.create_time = v.map(|x| x.into());
1608        self
1609    }
1610
1611    /// Sets the value of [update_time][crate::model::QuotaPreference::update_time].
1612    ///
1613    /// # Example
1614    /// ```ignore,no_run
1615    /// # use google_cloud_api_cloudquotas_v1::model::QuotaPreference;
1616    /// use wkt::Timestamp;
1617    /// let x = QuotaPreference::new().set_update_time(Timestamp::default()/* use setters */);
1618    /// ```
1619    pub fn set_update_time<T>(mut self, v: T) -> Self
1620    where
1621        T: std::convert::Into<wkt::Timestamp>,
1622    {
1623        self.update_time = std::option::Option::Some(v.into());
1624        self
1625    }
1626
1627    /// Sets or clears the value of [update_time][crate::model::QuotaPreference::update_time].
1628    ///
1629    /// # Example
1630    /// ```ignore,no_run
1631    /// # use google_cloud_api_cloudquotas_v1::model::QuotaPreference;
1632    /// use wkt::Timestamp;
1633    /// let x = QuotaPreference::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
1634    /// let x = QuotaPreference::new().set_or_clear_update_time(None::<Timestamp>);
1635    /// ```
1636    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
1637    where
1638        T: std::convert::Into<wkt::Timestamp>,
1639    {
1640        self.update_time = v.map(|x| x.into());
1641        self
1642    }
1643
1644    /// Sets the value of [service][crate::model::QuotaPreference::service].
1645    ///
1646    /// # Example
1647    /// ```ignore,no_run
1648    /// # use google_cloud_api_cloudquotas_v1::model::QuotaPreference;
1649    /// let x = QuotaPreference::new().set_service("example");
1650    /// ```
1651    pub fn set_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1652        self.service = v.into();
1653        self
1654    }
1655
1656    /// Sets the value of [quota_id][crate::model::QuotaPreference::quota_id].
1657    ///
1658    /// # Example
1659    /// ```ignore,no_run
1660    /// # use google_cloud_api_cloudquotas_v1::model::QuotaPreference;
1661    /// let x = QuotaPreference::new().set_quota_id("example");
1662    /// ```
1663    pub fn set_quota_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1664        self.quota_id = v.into();
1665        self
1666    }
1667
1668    /// Sets the value of [reconciling][crate::model::QuotaPreference::reconciling].
1669    ///
1670    /// # Example
1671    /// ```ignore,no_run
1672    /// # use google_cloud_api_cloudquotas_v1::model::QuotaPreference;
1673    /// let x = QuotaPreference::new().set_reconciling(true);
1674    /// ```
1675    pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1676        self.reconciling = v.into();
1677        self
1678    }
1679
1680    /// Sets the value of [justification][crate::model::QuotaPreference::justification].
1681    ///
1682    /// # Example
1683    /// ```ignore,no_run
1684    /// # use google_cloud_api_cloudquotas_v1::model::QuotaPreference;
1685    /// let x = QuotaPreference::new().set_justification("example");
1686    /// ```
1687    pub fn set_justification<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1688        self.justification = v.into();
1689        self
1690    }
1691
1692    /// Sets the value of [contact_email][crate::model::QuotaPreference::contact_email].
1693    ///
1694    /// # Example
1695    /// ```ignore,no_run
1696    /// # use google_cloud_api_cloudquotas_v1::model::QuotaPreference;
1697    /// let x = QuotaPreference::new().set_contact_email("example");
1698    /// ```
1699    pub fn set_contact_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1700        self.contact_email = v.into();
1701        self
1702    }
1703}
1704
1705impl wkt::message::Message for QuotaPreference {
1706    fn typename() -> &'static str {
1707        "type.googleapis.com/google.api.cloudquotas.v1.QuotaPreference"
1708    }
1709}
1710
1711/// The preferred quota configuration.
1712#[derive(Clone, Default, PartialEq)]
1713#[non_exhaustive]
1714pub struct QuotaConfig {
1715    /// Required. The preferred value. Must be greater than or equal to -1. If set
1716    /// to -1, it means the value is "unlimited".
1717    pub preferred_value: i64,
1718
1719    /// Output only. Optional details about the state of this quota preference.
1720    pub state_detail: std::string::String,
1721
1722    /// Output only. Granted quota value.
1723    pub granted_value: std::option::Option<wkt::Int64Value>,
1724
1725    /// Output only. The trace id that the Google Cloud uses to provision the
1726    /// requested quota. This trace id may be used by the client to contact Cloud
1727    /// support to track the state of a quota preference request. The trace id is
1728    /// only produced for increase requests and is unique for each request. The
1729    /// quota decrease requests do not have a trace id.
1730    pub trace_id: std::string::String,
1731
1732    /// Optional. The annotations map for clients to store small amounts of
1733    /// arbitrary data. Do not put PII or other sensitive information here. See
1734    /// <https://google.aip.dev/128#annotations>
1735    pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
1736
1737    /// Output only. The origin of the quota preference request.
1738    pub request_origin: crate::model::quota_config::Origin,
1739
1740    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1741}
1742
1743impl QuotaConfig {
1744    pub fn new() -> Self {
1745        std::default::Default::default()
1746    }
1747
1748    /// Sets the value of [preferred_value][crate::model::QuotaConfig::preferred_value].
1749    ///
1750    /// # Example
1751    /// ```ignore,no_run
1752    /// # use google_cloud_api_cloudquotas_v1::model::QuotaConfig;
1753    /// let x = QuotaConfig::new().set_preferred_value(42);
1754    /// ```
1755    pub fn set_preferred_value<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
1756        self.preferred_value = v.into();
1757        self
1758    }
1759
1760    /// Sets the value of [state_detail][crate::model::QuotaConfig::state_detail].
1761    ///
1762    /// # Example
1763    /// ```ignore,no_run
1764    /// # use google_cloud_api_cloudquotas_v1::model::QuotaConfig;
1765    /// let x = QuotaConfig::new().set_state_detail("example");
1766    /// ```
1767    pub fn set_state_detail<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1768        self.state_detail = v.into();
1769        self
1770    }
1771
1772    /// Sets the value of [granted_value][crate::model::QuotaConfig::granted_value].
1773    ///
1774    /// # Example
1775    /// ```ignore,no_run
1776    /// # use google_cloud_api_cloudquotas_v1::model::QuotaConfig;
1777    /// use wkt::Int64Value;
1778    /// let x = QuotaConfig::new().set_granted_value(Int64Value::default()/* use setters */);
1779    /// ```
1780    pub fn set_granted_value<T>(mut self, v: T) -> Self
1781    where
1782        T: std::convert::Into<wkt::Int64Value>,
1783    {
1784        self.granted_value = std::option::Option::Some(v.into());
1785        self
1786    }
1787
1788    /// Sets or clears the value of [granted_value][crate::model::QuotaConfig::granted_value].
1789    ///
1790    /// # Example
1791    /// ```ignore,no_run
1792    /// # use google_cloud_api_cloudquotas_v1::model::QuotaConfig;
1793    /// use wkt::Int64Value;
1794    /// let x = QuotaConfig::new().set_or_clear_granted_value(Some(Int64Value::default()/* use setters */));
1795    /// let x = QuotaConfig::new().set_or_clear_granted_value(None::<Int64Value>);
1796    /// ```
1797    pub fn set_or_clear_granted_value<T>(mut self, v: std::option::Option<T>) -> Self
1798    where
1799        T: std::convert::Into<wkt::Int64Value>,
1800    {
1801        self.granted_value = v.map(|x| x.into());
1802        self
1803    }
1804
1805    /// Sets the value of [trace_id][crate::model::QuotaConfig::trace_id].
1806    ///
1807    /// # Example
1808    /// ```ignore,no_run
1809    /// # use google_cloud_api_cloudquotas_v1::model::QuotaConfig;
1810    /// let x = QuotaConfig::new().set_trace_id("example");
1811    /// ```
1812    pub fn set_trace_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1813        self.trace_id = v.into();
1814        self
1815    }
1816
1817    /// Sets the value of [annotations][crate::model::QuotaConfig::annotations].
1818    ///
1819    /// # Example
1820    /// ```ignore,no_run
1821    /// # use google_cloud_api_cloudquotas_v1::model::QuotaConfig;
1822    /// let x = QuotaConfig::new().set_annotations([
1823    ///     ("key0", "abc"),
1824    ///     ("key1", "xyz"),
1825    /// ]);
1826    /// ```
1827    pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
1828    where
1829        T: std::iter::IntoIterator<Item = (K, V)>,
1830        K: std::convert::Into<std::string::String>,
1831        V: std::convert::Into<std::string::String>,
1832    {
1833        use std::iter::Iterator;
1834        self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1835        self
1836    }
1837
1838    /// Sets the value of [request_origin][crate::model::QuotaConfig::request_origin].
1839    ///
1840    /// # Example
1841    /// ```ignore,no_run
1842    /// # use google_cloud_api_cloudquotas_v1::model::QuotaConfig;
1843    /// use google_cloud_api_cloudquotas_v1::model::quota_config::Origin;
1844    /// let x0 = QuotaConfig::new().set_request_origin(Origin::CloudConsole);
1845    /// let x1 = QuotaConfig::new().set_request_origin(Origin::AutoAdjuster);
1846    /// ```
1847    pub fn set_request_origin<T: std::convert::Into<crate::model::quota_config::Origin>>(
1848        mut self,
1849        v: T,
1850    ) -> Self {
1851        self.request_origin = v.into();
1852        self
1853    }
1854}
1855
1856impl wkt::message::Message for QuotaConfig {
1857    fn typename() -> &'static str {
1858        "type.googleapis.com/google.api.cloudquotas.v1.QuotaConfig"
1859    }
1860}
1861
1862/// Defines additional types related to [QuotaConfig].
1863pub mod quota_config {
1864    #[allow(unused_imports)]
1865    use super::*;
1866
1867    /// The enumeration of the origins of quota preference requests.
1868    ///
1869    /// # Working with unknown values
1870    ///
1871    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1872    /// additional enum variants at any time. Adding new variants is not considered
1873    /// a breaking change. Applications should write their code in anticipation of:
1874    ///
1875    /// - New values appearing in future releases of the client library, **and**
1876    /// - New values received dynamically, without application changes.
1877    ///
1878    /// Please consult the [Working with enums] section in the user guide for some
1879    /// guidelines.
1880    ///
1881    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1882    #[derive(Clone, Debug, PartialEq)]
1883    #[non_exhaustive]
1884    pub enum Origin {
1885        /// The unspecified value.
1886        Unspecified,
1887        /// Created through Cloud Console.
1888        CloudConsole,
1889        /// Generated by automatic quota adjustment.
1890        AutoAdjuster,
1891        /// If set, the enum was initialized with an unknown value.
1892        ///
1893        /// Applications can examine the value using [Origin::value] or
1894        /// [Origin::name].
1895        UnknownValue(origin::UnknownValue),
1896    }
1897
1898    #[doc(hidden)]
1899    pub mod origin {
1900        #[allow(unused_imports)]
1901        use super::*;
1902        #[derive(Clone, Debug, PartialEq)]
1903        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1904    }
1905
1906    impl Origin {
1907        /// Gets the enum value.
1908        ///
1909        /// Returns `None` if the enum contains an unknown value deserialized from
1910        /// the string representation of enums.
1911        pub fn value(&self) -> std::option::Option<i32> {
1912            match self {
1913                Self::Unspecified => std::option::Option::Some(0),
1914                Self::CloudConsole => std::option::Option::Some(1),
1915                Self::AutoAdjuster => std::option::Option::Some(2),
1916                Self::UnknownValue(u) => u.0.value(),
1917            }
1918        }
1919
1920        /// Gets the enum value as a string.
1921        ///
1922        /// Returns `None` if the enum contains an unknown value deserialized from
1923        /// the integer representation of enums.
1924        pub fn name(&self) -> std::option::Option<&str> {
1925            match self {
1926                Self::Unspecified => std::option::Option::Some("ORIGIN_UNSPECIFIED"),
1927                Self::CloudConsole => std::option::Option::Some("CLOUD_CONSOLE"),
1928                Self::AutoAdjuster => std::option::Option::Some("AUTO_ADJUSTER"),
1929                Self::UnknownValue(u) => u.0.name(),
1930            }
1931        }
1932    }
1933
1934    impl std::default::Default for Origin {
1935        fn default() -> Self {
1936            use std::convert::From;
1937            Self::from(0)
1938        }
1939    }
1940
1941    impl std::fmt::Display for Origin {
1942        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1943            wkt::internal::display_enum(f, self.name(), self.value())
1944        }
1945    }
1946
1947    impl std::convert::From<i32> for Origin {
1948        fn from(value: i32) -> Self {
1949            match value {
1950                0 => Self::Unspecified,
1951                1 => Self::CloudConsole,
1952                2 => Self::AutoAdjuster,
1953                _ => Self::UnknownValue(origin::UnknownValue(
1954                    wkt::internal::UnknownEnumValue::Integer(value),
1955                )),
1956            }
1957        }
1958    }
1959
1960    impl std::convert::From<&str> for Origin {
1961        fn from(value: &str) -> Self {
1962            use std::string::ToString;
1963            match value {
1964                "ORIGIN_UNSPECIFIED" => Self::Unspecified,
1965                "CLOUD_CONSOLE" => Self::CloudConsole,
1966                "AUTO_ADJUSTER" => Self::AutoAdjuster,
1967                _ => Self::UnknownValue(origin::UnknownValue(
1968                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1969                )),
1970            }
1971        }
1972    }
1973
1974    impl serde::ser::Serialize for Origin {
1975        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1976        where
1977            S: serde::Serializer,
1978        {
1979            match self {
1980                Self::Unspecified => serializer.serialize_i32(0),
1981                Self::CloudConsole => serializer.serialize_i32(1),
1982                Self::AutoAdjuster => serializer.serialize_i32(2),
1983                Self::UnknownValue(u) => u.0.serialize(serializer),
1984            }
1985        }
1986    }
1987
1988    impl<'de> serde::de::Deserialize<'de> for Origin {
1989        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1990        where
1991            D: serde::Deserializer<'de>,
1992        {
1993            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Origin>::new(
1994                ".google.api.cloudquotas.v1.QuotaConfig.Origin",
1995            ))
1996        }
1997    }
1998}
1999
2000/// The detailed quota information such as effective quota value for a
2001/// combination of dimensions.
2002#[derive(Clone, Default, PartialEq)]
2003#[non_exhaustive]
2004pub struct DimensionsInfo {
2005    /// The map of dimensions for this dimensions info. The key of a map entry
2006    /// is "region", "zone" or the name of a service specific dimension, and the
2007    /// value of a map entry is the value of the dimension.  If a dimension does
2008    /// not appear in the map of dimensions, the dimensions info applies to all
2009    /// the dimension values except for those that have another DimenisonInfo
2010    /// instance configured for the specific value.
2011    /// Example: {"provider" : "Foo Inc"} where "provider" is a service specific
2012    /// dimension of a quota.
2013    pub dimensions: std::collections::HashMap<std::string::String, std::string::String>,
2014
2015    /// Quota details for the specified dimensions.
2016    pub details: std::option::Option<crate::model::QuotaDetails>,
2017
2018    /// The applicable regions or zones of this dimensions info. The field will be
2019    /// set to ['global'] for quotas that are not per region or per zone.
2020    /// Otherwise, it will be set to the list of locations this dimension info is
2021    /// applicable to.
2022    pub applicable_locations: std::vec::Vec<std::string::String>,
2023
2024    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2025}
2026
2027impl DimensionsInfo {
2028    pub fn new() -> Self {
2029        std::default::Default::default()
2030    }
2031
2032    /// Sets the value of [dimensions][crate::model::DimensionsInfo::dimensions].
2033    ///
2034    /// # Example
2035    /// ```ignore,no_run
2036    /// # use google_cloud_api_cloudquotas_v1::model::DimensionsInfo;
2037    /// let x = DimensionsInfo::new().set_dimensions([
2038    ///     ("key0", "abc"),
2039    ///     ("key1", "xyz"),
2040    /// ]);
2041    /// ```
2042    pub fn set_dimensions<T, K, V>(mut self, v: T) -> Self
2043    where
2044        T: std::iter::IntoIterator<Item = (K, V)>,
2045        K: std::convert::Into<std::string::String>,
2046        V: std::convert::Into<std::string::String>,
2047    {
2048        use std::iter::Iterator;
2049        self.dimensions = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2050        self
2051    }
2052
2053    /// Sets the value of [details][crate::model::DimensionsInfo::details].
2054    ///
2055    /// # Example
2056    /// ```ignore,no_run
2057    /// # use google_cloud_api_cloudquotas_v1::model::DimensionsInfo;
2058    /// use google_cloud_api_cloudquotas_v1::model::QuotaDetails;
2059    /// let x = DimensionsInfo::new().set_details(QuotaDetails::default()/* use setters */);
2060    /// ```
2061    pub fn set_details<T>(mut self, v: T) -> Self
2062    where
2063        T: std::convert::Into<crate::model::QuotaDetails>,
2064    {
2065        self.details = std::option::Option::Some(v.into());
2066        self
2067    }
2068
2069    /// Sets or clears the value of [details][crate::model::DimensionsInfo::details].
2070    ///
2071    /// # Example
2072    /// ```ignore,no_run
2073    /// # use google_cloud_api_cloudquotas_v1::model::DimensionsInfo;
2074    /// use google_cloud_api_cloudquotas_v1::model::QuotaDetails;
2075    /// let x = DimensionsInfo::new().set_or_clear_details(Some(QuotaDetails::default()/* use setters */));
2076    /// let x = DimensionsInfo::new().set_or_clear_details(None::<QuotaDetails>);
2077    /// ```
2078    pub fn set_or_clear_details<T>(mut self, v: std::option::Option<T>) -> Self
2079    where
2080        T: std::convert::Into<crate::model::QuotaDetails>,
2081    {
2082        self.details = v.map(|x| x.into());
2083        self
2084    }
2085
2086    /// Sets the value of [applicable_locations][crate::model::DimensionsInfo::applicable_locations].
2087    ///
2088    /// # Example
2089    /// ```ignore,no_run
2090    /// # use google_cloud_api_cloudquotas_v1::model::DimensionsInfo;
2091    /// let x = DimensionsInfo::new().set_applicable_locations(["a", "b", "c"]);
2092    /// ```
2093    pub fn set_applicable_locations<T, V>(mut self, v: T) -> Self
2094    where
2095        T: std::iter::IntoIterator<Item = V>,
2096        V: std::convert::Into<std::string::String>,
2097    {
2098        use std::iter::Iterator;
2099        self.applicable_locations = v.into_iter().map(|i| i.into()).collect();
2100        self
2101    }
2102}
2103
2104impl wkt::message::Message for DimensionsInfo {
2105    fn typename() -> &'static str {
2106        "type.googleapis.com/google.api.cloudquotas.v1.DimensionsInfo"
2107    }
2108}
2109
2110/// The quota details for a map of dimensions.
2111#[derive(Clone, Default, PartialEq)]
2112#[non_exhaustive]
2113pub struct QuotaDetails {
2114    /// The value currently in effect and being enforced.
2115    pub value: i64,
2116
2117    /// Rollout information of this quota.
2118    /// This field is present only if the effective limit will change due to the
2119    /// ongoing rollout of the service config.
2120    pub rollout_info: std::option::Option<crate::model::RolloutInfo>,
2121
2122    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2123}
2124
2125impl QuotaDetails {
2126    pub fn new() -> Self {
2127        std::default::Default::default()
2128    }
2129
2130    /// Sets the value of [value][crate::model::QuotaDetails::value].
2131    ///
2132    /// # Example
2133    /// ```ignore,no_run
2134    /// # use google_cloud_api_cloudquotas_v1::model::QuotaDetails;
2135    /// let x = QuotaDetails::new().set_value(42);
2136    /// ```
2137    pub fn set_value<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
2138        self.value = v.into();
2139        self
2140    }
2141
2142    /// Sets the value of [rollout_info][crate::model::QuotaDetails::rollout_info].
2143    ///
2144    /// # Example
2145    /// ```ignore,no_run
2146    /// # use google_cloud_api_cloudquotas_v1::model::QuotaDetails;
2147    /// use google_cloud_api_cloudquotas_v1::model::RolloutInfo;
2148    /// let x = QuotaDetails::new().set_rollout_info(RolloutInfo::default()/* use setters */);
2149    /// ```
2150    pub fn set_rollout_info<T>(mut self, v: T) -> Self
2151    where
2152        T: std::convert::Into<crate::model::RolloutInfo>,
2153    {
2154        self.rollout_info = std::option::Option::Some(v.into());
2155        self
2156    }
2157
2158    /// Sets or clears the value of [rollout_info][crate::model::QuotaDetails::rollout_info].
2159    ///
2160    /// # Example
2161    /// ```ignore,no_run
2162    /// # use google_cloud_api_cloudquotas_v1::model::QuotaDetails;
2163    /// use google_cloud_api_cloudquotas_v1::model::RolloutInfo;
2164    /// let x = QuotaDetails::new().set_or_clear_rollout_info(Some(RolloutInfo::default()/* use setters */));
2165    /// let x = QuotaDetails::new().set_or_clear_rollout_info(None::<RolloutInfo>);
2166    /// ```
2167    pub fn set_or_clear_rollout_info<T>(mut self, v: std::option::Option<T>) -> Self
2168    where
2169        T: std::convert::Into<crate::model::RolloutInfo>,
2170    {
2171        self.rollout_info = v.map(|x| x.into());
2172        self
2173    }
2174}
2175
2176impl wkt::message::Message for QuotaDetails {
2177    fn typename() -> &'static str {
2178        "type.googleapis.com/google.api.cloudquotas.v1.QuotaDetails"
2179    }
2180}
2181
2182/// [Output only] Rollout information of a quota.
2183#[derive(Clone, Default, PartialEq)]
2184#[non_exhaustive]
2185pub struct RolloutInfo {
2186    /// Whether there is an ongoing rollout for a quota or not.
2187    pub ongoing_rollout: bool,
2188
2189    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2190}
2191
2192impl RolloutInfo {
2193    pub fn new() -> Self {
2194        std::default::Default::default()
2195    }
2196
2197    /// Sets the value of [ongoing_rollout][crate::model::RolloutInfo::ongoing_rollout].
2198    ///
2199    /// # Example
2200    /// ```ignore,no_run
2201    /// # use google_cloud_api_cloudquotas_v1::model::RolloutInfo;
2202    /// let x = RolloutInfo::new().set_ongoing_rollout(true);
2203    /// ```
2204    pub fn set_ongoing_rollout<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2205        self.ongoing_rollout = v.into();
2206        self
2207    }
2208}
2209
2210impl wkt::message::Message for RolloutInfo {
2211    fn typename() -> &'static str {
2212        "type.googleapis.com/google.api.cloudquotas.v1.RolloutInfo"
2213    }
2214}
2215
2216/// Enumerations of quota safety checks.
2217///
2218/// # Working with unknown values
2219///
2220/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2221/// additional enum variants at any time. Adding new variants is not considered
2222/// a breaking change. Applications should write their code in anticipation of:
2223///
2224/// - New values appearing in future releases of the client library, **and**
2225/// - New values received dynamically, without application changes.
2226///
2227/// Please consult the [Working with enums] section in the user guide for some
2228/// guidelines.
2229///
2230/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2231#[derive(Clone, Debug, PartialEq)]
2232#[non_exhaustive]
2233pub enum QuotaSafetyCheck {
2234    /// Unspecified quota safety check.
2235    Unspecified,
2236    /// Validates that a quota mutation would not cause the consumer's effective
2237    /// limit to be lower than the consumer's quota usage.
2238    QuotaDecreaseBelowUsage,
2239    /// Validates that a quota mutation would not cause the consumer's effective
2240    /// limit to decrease by more than 10 percent.
2241    QuotaDecreasePercentageTooHigh,
2242    /// If set, the enum was initialized with an unknown value.
2243    ///
2244    /// Applications can examine the value using [QuotaSafetyCheck::value] or
2245    /// [QuotaSafetyCheck::name].
2246    UnknownValue(quota_safety_check::UnknownValue),
2247}
2248
2249#[doc(hidden)]
2250pub mod quota_safety_check {
2251    #[allow(unused_imports)]
2252    use super::*;
2253    #[derive(Clone, Debug, PartialEq)]
2254    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2255}
2256
2257impl QuotaSafetyCheck {
2258    /// Gets the enum value.
2259    ///
2260    /// Returns `None` if the enum contains an unknown value deserialized from
2261    /// the string representation of enums.
2262    pub fn value(&self) -> std::option::Option<i32> {
2263        match self {
2264            Self::Unspecified => std::option::Option::Some(0),
2265            Self::QuotaDecreaseBelowUsage => std::option::Option::Some(1),
2266            Self::QuotaDecreasePercentageTooHigh => std::option::Option::Some(2),
2267            Self::UnknownValue(u) => u.0.value(),
2268        }
2269    }
2270
2271    /// Gets the enum value as a string.
2272    ///
2273    /// Returns `None` if the enum contains an unknown value deserialized from
2274    /// the integer representation of enums.
2275    pub fn name(&self) -> std::option::Option<&str> {
2276        match self {
2277            Self::Unspecified => std::option::Option::Some("QUOTA_SAFETY_CHECK_UNSPECIFIED"),
2278            Self::QuotaDecreaseBelowUsage => {
2279                std::option::Option::Some("QUOTA_DECREASE_BELOW_USAGE")
2280            }
2281            Self::QuotaDecreasePercentageTooHigh => {
2282                std::option::Option::Some("QUOTA_DECREASE_PERCENTAGE_TOO_HIGH")
2283            }
2284            Self::UnknownValue(u) => u.0.name(),
2285        }
2286    }
2287}
2288
2289impl std::default::Default for QuotaSafetyCheck {
2290    fn default() -> Self {
2291        use std::convert::From;
2292        Self::from(0)
2293    }
2294}
2295
2296impl std::fmt::Display for QuotaSafetyCheck {
2297    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2298        wkt::internal::display_enum(f, self.name(), self.value())
2299    }
2300}
2301
2302impl std::convert::From<i32> for QuotaSafetyCheck {
2303    fn from(value: i32) -> Self {
2304        match value {
2305            0 => Self::Unspecified,
2306            1 => Self::QuotaDecreaseBelowUsage,
2307            2 => Self::QuotaDecreasePercentageTooHigh,
2308            _ => Self::UnknownValue(quota_safety_check::UnknownValue(
2309                wkt::internal::UnknownEnumValue::Integer(value),
2310            )),
2311        }
2312    }
2313}
2314
2315impl std::convert::From<&str> for QuotaSafetyCheck {
2316    fn from(value: &str) -> Self {
2317        use std::string::ToString;
2318        match value {
2319            "QUOTA_SAFETY_CHECK_UNSPECIFIED" => Self::Unspecified,
2320            "QUOTA_DECREASE_BELOW_USAGE" => Self::QuotaDecreaseBelowUsage,
2321            "QUOTA_DECREASE_PERCENTAGE_TOO_HIGH" => Self::QuotaDecreasePercentageTooHigh,
2322            _ => Self::UnknownValue(quota_safety_check::UnknownValue(
2323                wkt::internal::UnknownEnumValue::String(value.to_string()),
2324            )),
2325        }
2326    }
2327}
2328
2329impl serde::ser::Serialize for QuotaSafetyCheck {
2330    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2331    where
2332        S: serde::Serializer,
2333    {
2334        match self {
2335            Self::Unspecified => serializer.serialize_i32(0),
2336            Self::QuotaDecreaseBelowUsage => serializer.serialize_i32(1),
2337            Self::QuotaDecreasePercentageTooHigh => serializer.serialize_i32(2),
2338            Self::UnknownValue(u) => u.0.serialize(serializer),
2339        }
2340    }
2341}
2342
2343impl<'de> serde::de::Deserialize<'de> for QuotaSafetyCheck {
2344    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2345    where
2346        D: serde::Deserializer<'de>,
2347    {
2348        deserializer.deserialize_any(wkt::internal::EnumVisitor::<QuotaSafetyCheck>::new(
2349            ".google.api.cloudquotas.v1.QuotaSafetyCheck",
2350        ))
2351    }
2352}