Skip to main content

google_cloud_bigquery_reservation_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::bare_urls)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![allow(rustdoc::invalid_html_tags)]
20#![allow(rustdoc::redundant_explicit_links)]
21#![no_implicit_prelude]
22extern crate async_trait;
23extern crate bytes;
24extern crate gaxi;
25extern crate google_cloud_gax;
26extern crate google_cloud_iam_v1;
27extern crate google_cloud_rpc;
28extern crate serde;
29extern crate serde_json;
30extern crate serde_with;
31extern crate std;
32extern crate tracing;
33extern crate wkt;
34
35mod debug;
36mod deserialize;
37mod serialize;
38
39/// A reservation is a mechanism used to guarantee slots to users.
40#[derive(Clone, Default, PartialEq)]
41#[non_exhaustive]
42pub struct Reservation {
43    /// Identifier. The resource name of the reservation, e.g.,
44    /// `projects/*/locations/*/reservations/team1-prod`.
45    /// The reservation_id must only contain lower case alphanumeric characters or
46    /// dashes. It must start with a letter and must not end with a dash. Its
47    /// maximum length is 64 characters.
48    pub name: std::string::String,
49
50    /// Optional. Baseline slots available to this reservation. A slot is a unit of
51    /// computational power in BigQuery, and serves as the unit of parallelism.
52    ///
53    /// Queries using this reservation might use more slots during runtime if
54    /// ignore_idle_slots is set to false, or autoscaling is enabled.
55    ///
56    /// The total slot_capacity of the reservation and its siblings
57    /// may exceed the total slot_count of capacity commitments. In that case, the
58    /// exceeding slots will be charged with the autoscale SKU. You can increase
59    /// the number of baseline slots in a reservation every few minutes. If you
60    /// want to decrease your baseline slots, you are limited to once an hour if
61    /// you have recently changed your baseline slot capacity and your baseline
62    /// slots exceed your committed slots. Otherwise, you can decrease your
63    /// baseline slots every few minutes.
64    pub slot_capacity: i64,
65
66    /// Optional. If false, any query or pipeline job using this reservation will
67    /// use idle slots from other reservations within the same admin project. If
68    /// true, a query or pipeline job using this reservation will execute with the
69    /// slot capacity specified in the slot_capacity field at most.
70    pub ignore_idle_slots: bool,
71
72    /// Optional. The configuration parameters for the auto scaling feature.
73    pub autoscale: std::option::Option<crate::model::reservation::Autoscale>,
74
75    /// Optional. Job concurrency target which sets a soft upper bound on the
76    /// number of jobs that can run concurrently in this reservation. This is a
77    /// soft target due to asynchronous nature of the system and various
78    /// optimizations for small queries. Default value is 0 which means that
79    /// concurrency target will be automatically computed by the system. NOTE: this
80    /// field is exposed as target job concurrency in the Information Schema, DDL
81    /// and BigQuery CLI.
82    pub concurrency: i64,
83
84    /// Output only. Creation time of the reservation.
85    pub creation_time: std::option::Option<wkt::Timestamp>,
86
87    /// Output only. Last update time of the reservation.
88    pub update_time: std::option::Option<wkt::Timestamp>,
89
90    /// Applicable only for reservations located within one of the BigQuery
91    /// multi-regions (US or EU).
92    ///
93    /// If set to true, this reservation is placed in the organization's
94    /// secondary region which is designated for disaster recovery purposes.
95    /// If false, this reservation is placed in the organization's default region.
96    ///
97    /// NOTE: this is a preview feature. Project must be allow-listed in order to
98    /// set this field.
99    #[deprecated]
100    pub multi_region_auxiliary: bool,
101
102    /// Optional. Edition of the reservation.
103    pub edition: crate::model::Edition,
104
105    /// Output only. The current location of the reservation's primary replica.
106    /// This field is only set for reservations using the managed disaster recovery
107    /// feature.
108    pub primary_location: std::string::String,
109
110    /// Optional. The current location of the reservation's secondary replica. This
111    /// field is only set for reservations using the managed disaster recovery
112    /// feature. Users can set this in create reservation calls
113    /// to create a failover reservation or in update reservation calls to convert
114    /// a non-failover reservation to a failover reservation(or vice versa).
115    pub secondary_location: std::string::String,
116
117    /// Output only. The location where the reservation was originally created.
118    /// This is set only during the failover reservation's creation. All billing
119    /// charges for the failover reservation will be applied to this location.
120    pub original_primary_location: std::string::String,
121
122    /// Optional. The overall max slots for the reservation, covering slot_capacity
123    /// (baseline), idle slots (if ignore_idle_slots is false) and scaled slots.
124    /// If present, the reservation won't use more than the specified number of
125    /// slots, even if there is demand and supply (from idle slots).
126    /// NOTE: capping a reservation's idle slot usage is best effort and its
127    /// usage may exceed the max_slots value. However, in terms of
128    /// autoscale.current_slots (which accounts for the additional added slots), it
129    /// will never exceed the max_slots - baseline.
130    ///
131    /// This field must be set together with the scaling_mode enum value,
132    /// otherwise the request will be rejected with error code
133    /// `google.rpc.Code.INVALID_ARGUMENT`.
134    ///
135    /// If the max_slots and scaling_mode are set, the autoscale or
136    /// autoscale.max_slots field must be unset. Otherwise the request will be
137    /// rejected with error code `google.rpc.Code.INVALID_ARGUMENT`. However, the
138    /// autoscale field may still be in the output. The autopscale.max_slots will
139    /// always show as 0 and the autoscaler.current_slots will represent the
140    /// current slots from autoscaler excluding idle slots.
141    /// For example, if the max_slots is 1000 and scaling_mode is AUTOSCALE_ONLY,
142    /// then in the output, the autoscaler.max_slots will be 0 and the
143    /// autoscaler.current_slots may be any value between 0 and 1000.
144    ///
145    /// If the max_slots is 1000, scaling_mode is ALL_SLOTS, the baseline is 100
146    /// and idle slots usage is 200, then in the output, the autoscaler.max_slots
147    /// will be 0 and the autoscaler.current_slots will not be higher than 700.
148    ///
149    /// If the max_slots is 1000, scaling_mode is IDLE_SLOTS_ONLY, then in the
150    /// output, the autoscaler field will be null.
151    ///
152    /// If the max_slots and scaling_mode are set, then the ignore_idle_slots field
153    /// must be aligned with the scaling_mode enum value.(See details in
154    /// ScalingMode comments). Otherwise the request will be rejected with
155    /// error code `google.rpc.Code.INVALID_ARGUMENT`.
156    ///
157    /// Please note,  the max_slots is for user to manage the part of slots greater
158    /// than the baseline. Therefore, we don't allow users to set max_slots smaller
159    /// or equal to the baseline as it will not be meaningful. If the field is
160    /// present and slot_capacity>=max_slots, requests will be rejected with error
161    /// code `google.rpc.Code.INVALID_ARGUMENT`.
162    ///
163    /// Please note that if max_slots is set to 0, we will treat it as unset.
164    /// Customers can set max_slots to 0 and set scaling_mode to
165    /// SCALING_MODE_UNSPECIFIED to disable the max_slots feature.
166    pub max_slots: std::option::Option<i64>,
167
168    /// Optional. The scaling mode for the reservation.
169    /// If the field is present but max_slots is not present, requests will be
170    /// rejected with error code `google.rpc.Code.INVALID_ARGUMENT`.
171    pub scaling_mode: crate::model::reservation::ScalingMode,
172
173    /// Optional. The labels associated with this reservation. You can use these
174    /// to organize and group your reservations.
175    /// You can set this property when you create or update a reservation.
176    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
177
178    /// Optional. The reservation group that this reservation belongs to.
179    /// You can set this property when you create or update a reservation.
180    /// Reservations do not need to belong to a reservation group.
181    /// Format:
182    /// projects/{project}/locations/{location}/reservationGroups/{reservation_group}
183    /// or just {reservation_group}
184    pub reservation_group: std::string::String,
185
186    /// Output only. The Disaster Recovery(DR) replication status of the
187    /// reservation. This is only available for the primary replicas of DR/failover
188    /// reservations and provides information about the both the staleness of the
189    /// secondary and the last error encountered while trying to replicate changes
190    /// from the primary to the secondary. If this field is blank, it means that
191    /// the reservation is either not a DR reservation or the reservation is a DR
192    /// secondary or that any replication operations on the reservation have
193    /// succeeded.
194    pub replication_status: std::option::Option<crate::model::reservation::ReplicationStatus>,
195
196    /// Optional. The scheduling policy to use for jobs and queries running under
197    /// this reservation. The scheduling policy controls how the reservation's
198    /// resources are distributed.
199    ///
200    /// This feature is not yet generally available.
201    pub scheduling_policy: std::option::Option<crate::model::SchedulingPolicy>,
202
203    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
204}
205
206impl Reservation {
207    /// Creates a new default instance.
208    pub fn new() -> Self {
209        std::default::Default::default()
210    }
211
212    /// Sets the value of [name][crate::model::Reservation::name].
213    ///
214    /// # Example
215    /// ```ignore,no_run
216    /// # use google_cloud_bigquery_reservation_v1::model::Reservation;
217    /// # let project_id = "project_id";
218    /// # let location_id = "location_id";
219    /// # let reservation_id = "reservation_id";
220    /// let x = Reservation::new().set_name(format!("projects/{project_id}/locations/{location_id}/reservations/{reservation_id}"));
221    /// ```
222    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
223        self.name = v.into();
224        self
225    }
226
227    /// Sets the value of [slot_capacity][crate::model::Reservation::slot_capacity].
228    ///
229    /// # Example
230    /// ```ignore,no_run
231    /// # use google_cloud_bigquery_reservation_v1::model::Reservation;
232    /// let x = Reservation::new().set_slot_capacity(42);
233    /// ```
234    pub fn set_slot_capacity<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
235        self.slot_capacity = v.into();
236        self
237    }
238
239    /// Sets the value of [ignore_idle_slots][crate::model::Reservation::ignore_idle_slots].
240    ///
241    /// # Example
242    /// ```ignore,no_run
243    /// # use google_cloud_bigquery_reservation_v1::model::Reservation;
244    /// let x = Reservation::new().set_ignore_idle_slots(true);
245    /// ```
246    pub fn set_ignore_idle_slots<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
247        self.ignore_idle_slots = v.into();
248        self
249    }
250
251    /// Sets the value of [autoscale][crate::model::Reservation::autoscale].
252    ///
253    /// # Example
254    /// ```ignore,no_run
255    /// # use google_cloud_bigquery_reservation_v1::model::Reservation;
256    /// use google_cloud_bigquery_reservation_v1::model::reservation::Autoscale;
257    /// let x = Reservation::new().set_autoscale(Autoscale::default()/* use setters */);
258    /// ```
259    pub fn set_autoscale<T>(mut self, v: T) -> Self
260    where
261        T: std::convert::Into<crate::model::reservation::Autoscale>,
262    {
263        self.autoscale = std::option::Option::Some(v.into());
264        self
265    }
266
267    /// Sets or clears the value of [autoscale][crate::model::Reservation::autoscale].
268    ///
269    /// # Example
270    /// ```ignore,no_run
271    /// # use google_cloud_bigquery_reservation_v1::model::Reservation;
272    /// use google_cloud_bigquery_reservation_v1::model::reservation::Autoscale;
273    /// let x = Reservation::new().set_or_clear_autoscale(Some(Autoscale::default()/* use setters */));
274    /// let x = Reservation::new().set_or_clear_autoscale(None::<Autoscale>);
275    /// ```
276    pub fn set_or_clear_autoscale<T>(mut self, v: std::option::Option<T>) -> Self
277    where
278        T: std::convert::Into<crate::model::reservation::Autoscale>,
279    {
280        self.autoscale = v.map(|x| x.into());
281        self
282    }
283
284    /// Sets the value of [concurrency][crate::model::Reservation::concurrency].
285    ///
286    /// # Example
287    /// ```ignore,no_run
288    /// # use google_cloud_bigquery_reservation_v1::model::Reservation;
289    /// let x = Reservation::new().set_concurrency(42);
290    /// ```
291    pub fn set_concurrency<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
292        self.concurrency = v.into();
293        self
294    }
295
296    /// Sets the value of [creation_time][crate::model::Reservation::creation_time].
297    ///
298    /// # Example
299    /// ```ignore,no_run
300    /// # use google_cloud_bigquery_reservation_v1::model::Reservation;
301    /// use wkt::Timestamp;
302    /// let x = Reservation::new().set_creation_time(Timestamp::default()/* use setters */);
303    /// ```
304    pub fn set_creation_time<T>(mut self, v: T) -> Self
305    where
306        T: std::convert::Into<wkt::Timestamp>,
307    {
308        self.creation_time = std::option::Option::Some(v.into());
309        self
310    }
311
312    /// Sets or clears the value of [creation_time][crate::model::Reservation::creation_time].
313    ///
314    /// # Example
315    /// ```ignore,no_run
316    /// # use google_cloud_bigquery_reservation_v1::model::Reservation;
317    /// use wkt::Timestamp;
318    /// let x = Reservation::new().set_or_clear_creation_time(Some(Timestamp::default()/* use setters */));
319    /// let x = Reservation::new().set_or_clear_creation_time(None::<Timestamp>);
320    /// ```
321    pub fn set_or_clear_creation_time<T>(mut self, v: std::option::Option<T>) -> Self
322    where
323        T: std::convert::Into<wkt::Timestamp>,
324    {
325        self.creation_time = v.map(|x| x.into());
326        self
327    }
328
329    /// Sets the value of [update_time][crate::model::Reservation::update_time].
330    ///
331    /// # Example
332    /// ```ignore,no_run
333    /// # use google_cloud_bigquery_reservation_v1::model::Reservation;
334    /// use wkt::Timestamp;
335    /// let x = Reservation::new().set_update_time(Timestamp::default()/* use setters */);
336    /// ```
337    pub fn set_update_time<T>(mut self, v: T) -> Self
338    where
339        T: std::convert::Into<wkt::Timestamp>,
340    {
341        self.update_time = std::option::Option::Some(v.into());
342        self
343    }
344
345    /// Sets or clears the value of [update_time][crate::model::Reservation::update_time].
346    ///
347    /// # Example
348    /// ```ignore,no_run
349    /// # use google_cloud_bigquery_reservation_v1::model::Reservation;
350    /// use wkt::Timestamp;
351    /// let x = Reservation::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
352    /// let x = Reservation::new().set_or_clear_update_time(None::<Timestamp>);
353    /// ```
354    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
355    where
356        T: std::convert::Into<wkt::Timestamp>,
357    {
358        self.update_time = v.map(|x| x.into());
359        self
360    }
361
362    /// Sets the value of [multi_region_auxiliary][crate::model::Reservation::multi_region_auxiliary].
363    ///
364    /// # Example
365    /// ```ignore,no_run
366    /// # use google_cloud_bigquery_reservation_v1::model::Reservation;
367    /// let x = Reservation::new().set_multi_region_auxiliary(true);
368    /// ```
369    #[deprecated]
370    pub fn set_multi_region_auxiliary<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
371        self.multi_region_auxiliary = v.into();
372        self
373    }
374
375    /// Sets the value of [edition][crate::model::Reservation::edition].
376    ///
377    /// # Example
378    /// ```ignore,no_run
379    /// # use google_cloud_bigquery_reservation_v1::model::Reservation;
380    /// use google_cloud_bigquery_reservation_v1::model::Edition;
381    /// let x0 = Reservation::new().set_edition(Edition::Standard);
382    /// let x1 = Reservation::new().set_edition(Edition::Enterprise);
383    /// let x2 = Reservation::new().set_edition(Edition::EnterprisePlus);
384    /// ```
385    pub fn set_edition<T: std::convert::Into<crate::model::Edition>>(mut self, v: T) -> Self {
386        self.edition = v.into();
387        self
388    }
389
390    /// Sets the value of [primary_location][crate::model::Reservation::primary_location].
391    ///
392    /// # Example
393    /// ```ignore,no_run
394    /// # use google_cloud_bigquery_reservation_v1::model::Reservation;
395    /// let x = Reservation::new().set_primary_location("example");
396    /// ```
397    pub fn set_primary_location<T: std::convert::Into<std::string::String>>(
398        mut self,
399        v: T,
400    ) -> Self {
401        self.primary_location = v.into();
402        self
403    }
404
405    /// Sets the value of [secondary_location][crate::model::Reservation::secondary_location].
406    ///
407    /// # Example
408    /// ```ignore,no_run
409    /// # use google_cloud_bigquery_reservation_v1::model::Reservation;
410    /// let x = Reservation::new().set_secondary_location("example");
411    /// ```
412    pub fn set_secondary_location<T: std::convert::Into<std::string::String>>(
413        mut self,
414        v: T,
415    ) -> Self {
416        self.secondary_location = v.into();
417        self
418    }
419
420    /// Sets the value of [original_primary_location][crate::model::Reservation::original_primary_location].
421    ///
422    /// # Example
423    /// ```ignore,no_run
424    /// # use google_cloud_bigquery_reservation_v1::model::Reservation;
425    /// let x = Reservation::new().set_original_primary_location("example");
426    /// ```
427    pub fn set_original_primary_location<T: std::convert::Into<std::string::String>>(
428        mut self,
429        v: T,
430    ) -> Self {
431        self.original_primary_location = v.into();
432        self
433    }
434
435    /// Sets the value of [max_slots][crate::model::Reservation::max_slots].
436    ///
437    /// # Example
438    /// ```ignore,no_run
439    /// # use google_cloud_bigquery_reservation_v1::model::Reservation;
440    /// let x = Reservation::new().set_max_slots(42);
441    /// ```
442    pub fn set_max_slots<T>(mut self, v: T) -> Self
443    where
444        T: std::convert::Into<i64>,
445    {
446        self.max_slots = std::option::Option::Some(v.into());
447        self
448    }
449
450    /// Sets or clears the value of [max_slots][crate::model::Reservation::max_slots].
451    ///
452    /// # Example
453    /// ```ignore,no_run
454    /// # use google_cloud_bigquery_reservation_v1::model::Reservation;
455    /// let x = Reservation::new().set_or_clear_max_slots(Some(42));
456    /// let x = Reservation::new().set_or_clear_max_slots(None::<i32>);
457    /// ```
458    pub fn set_or_clear_max_slots<T>(mut self, v: std::option::Option<T>) -> Self
459    where
460        T: std::convert::Into<i64>,
461    {
462        self.max_slots = v.map(|x| x.into());
463        self
464    }
465
466    /// Sets the value of [scaling_mode][crate::model::Reservation::scaling_mode].
467    ///
468    /// # Example
469    /// ```ignore,no_run
470    /// # use google_cloud_bigquery_reservation_v1::model::Reservation;
471    /// use google_cloud_bigquery_reservation_v1::model::reservation::ScalingMode;
472    /// let x0 = Reservation::new().set_scaling_mode(ScalingMode::AutoscaleOnly);
473    /// let x1 = Reservation::new().set_scaling_mode(ScalingMode::IdleSlotsOnly);
474    /// let x2 = Reservation::new().set_scaling_mode(ScalingMode::AllSlots);
475    /// ```
476    pub fn set_scaling_mode<T: std::convert::Into<crate::model::reservation::ScalingMode>>(
477        mut self,
478        v: T,
479    ) -> Self {
480        self.scaling_mode = v.into();
481        self
482    }
483
484    /// Sets the value of [labels][crate::model::Reservation::labels].
485    ///
486    /// # Example
487    /// ```ignore,no_run
488    /// # use google_cloud_bigquery_reservation_v1::model::Reservation;
489    /// let x = Reservation::new().set_labels([
490    ///     ("key0", "abc"),
491    ///     ("key1", "xyz"),
492    /// ]);
493    /// ```
494    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
495    where
496        T: std::iter::IntoIterator<Item = (K, V)>,
497        K: std::convert::Into<std::string::String>,
498        V: std::convert::Into<std::string::String>,
499    {
500        use std::iter::Iterator;
501        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
502        self
503    }
504
505    /// Sets the value of [reservation_group][crate::model::Reservation::reservation_group].
506    ///
507    /// # Example
508    /// ```ignore,no_run
509    /// # use google_cloud_bigquery_reservation_v1::model::Reservation;
510    /// let x = Reservation::new().set_reservation_group("example");
511    /// ```
512    pub fn set_reservation_group<T: std::convert::Into<std::string::String>>(
513        mut self,
514        v: T,
515    ) -> Self {
516        self.reservation_group = v.into();
517        self
518    }
519
520    /// Sets the value of [replication_status][crate::model::Reservation::replication_status].
521    ///
522    /// # Example
523    /// ```ignore,no_run
524    /// # use google_cloud_bigquery_reservation_v1::model::Reservation;
525    /// use google_cloud_bigquery_reservation_v1::model::reservation::ReplicationStatus;
526    /// let x = Reservation::new().set_replication_status(ReplicationStatus::default()/* use setters */);
527    /// ```
528    pub fn set_replication_status<T>(mut self, v: T) -> Self
529    where
530        T: std::convert::Into<crate::model::reservation::ReplicationStatus>,
531    {
532        self.replication_status = std::option::Option::Some(v.into());
533        self
534    }
535
536    /// Sets or clears the value of [replication_status][crate::model::Reservation::replication_status].
537    ///
538    /// # Example
539    /// ```ignore,no_run
540    /// # use google_cloud_bigquery_reservation_v1::model::Reservation;
541    /// use google_cloud_bigquery_reservation_v1::model::reservation::ReplicationStatus;
542    /// let x = Reservation::new().set_or_clear_replication_status(Some(ReplicationStatus::default()/* use setters */));
543    /// let x = Reservation::new().set_or_clear_replication_status(None::<ReplicationStatus>);
544    /// ```
545    pub fn set_or_clear_replication_status<T>(mut self, v: std::option::Option<T>) -> Self
546    where
547        T: std::convert::Into<crate::model::reservation::ReplicationStatus>,
548    {
549        self.replication_status = v.map(|x| x.into());
550        self
551    }
552
553    /// Sets the value of [scheduling_policy][crate::model::Reservation::scheduling_policy].
554    ///
555    /// # Example
556    /// ```ignore,no_run
557    /// # use google_cloud_bigquery_reservation_v1::model::Reservation;
558    /// use google_cloud_bigquery_reservation_v1::model::SchedulingPolicy;
559    /// let x = Reservation::new().set_scheduling_policy(SchedulingPolicy::default()/* use setters */);
560    /// ```
561    pub fn set_scheduling_policy<T>(mut self, v: T) -> Self
562    where
563        T: std::convert::Into<crate::model::SchedulingPolicy>,
564    {
565        self.scheduling_policy = std::option::Option::Some(v.into());
566        self
567    }
568
569    /// Sets or clears the value of [scheduling_policy][crate::model::Reservation::scheduling_policy].
570    ///
571    /// # Example
572    /// ```ignore,no_run
573    /// # use google_cloud_bigquery_reservation_v1::model::Reservation;
574    /// use google_cloud_bigquery_reservation_v1::model::SchedulingPolicy;
575    /// let x = Reservation::new().set_or_clear_scheduling_policy(Some(SchedulingPolicy::default()/* use setters */));
576    /// let x = Reservation::new().set_or_clear_scheduling_policy(None::<SchedulingPolicy>);
577    /// ```
578    pub fn set_or_clear_scheduling_policy<T>(mut self, v: std::option::Option<T>) -> Self
579    where
580        T: std::convert::Into<crate::model::SchedulingPolicy>,
581    {
582        self.scheduling_policy = v.map(|x| x.into());
583        self
584    }
585}
586
587impl wkt::message::Message for Reservation {
588    fn typename() -> &'static str {
589        "type.googleapis.com/google.cloud.bigquery.reservation.v1.Reservation"
590    }
591}
592
593/// Defines additional types related to [Reservation].
594pub mod reservation {
595    #[allow(unused_imports)]
596    use super::*;
597
598    /// Auto scaling settings.
599    #[derive(Clone, Default, PartialEq)]
600    #[non_exhaustive]
601    pub struct Autoscale {
602        /// Output only. The slot capacity added to this reservation when autoscale
603        /// happens. Will be between [0, max_slots]. Note: after users reduce
604        /// max_slots, it may take a while before it can be propagated, so
605        /// current_slots may stay in the original value and could be larger than
606        /// max_slots for that brief period (less than one minute)
607        pub current_slots: i64,
608
609        /// Optional. Number of slots to be scaled when needed.
610        pub max_slots: i64,
611
612        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
613    }
614
615    impl Autoscale {
616        /// Creates a new default instance.
617        pub fn new() -> Self {
618            std::default::Default::default()
619        }
620
621        /// Sets the value of [current_slots][crate::model::reservation::Autoscale::current_slots].
622        ///
623        /// # Example
624        /// ```ignore,no_run
625        /// # use google_cloud_bigquery_reservation_v1::model::reservation::Autoscale;
626        /// let x = Autoscale::new().set_current_slots(42);
627        /// ```
628        pub fn set_current_slots<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
629            self.current_slots = v.into();
630            self
631        }
632
633        /// Sets the value of [max_slots][crate::model::reservation::Autoscale::max_slots].
634        ///
635        /// # Example
636        /// ```ignore,no_run
637        /// # use google_cloud_bigquery_reservation_v1::model::reservation::Autoscale;
638        /// let x = Autoscale::new().set_max_slots(42);
639        /// ```
640        pub fn set_max_slots<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
641            self.max_slots = v.into();
642            self
643        }
644    }
645
646    impl wkt::message::Message for Autoscale {
647        fn typename() -> &'static str {
648            "type.googleapis.com/google.cloud.bigquery.reservation.v1.Reservation.Autoscale"
649        }
650    }
651
652    /// Disaster Recovery(DR) replication status of the reservation.
653    #[derive(Clone, Default, PartialEq)]
654    #[non_exhaustive]
655    pub struct ReplicationStatus {
656        /// Output only. The last error encountered while trying to replicate changes
657        /// from the primary to the secondary. This field is only available if the
658        /// replication has not succeeded since.
659        pub error: std::option::Option<google_cloud_rpc::model::Status>,
660
661        /// Output only. The time at which the last error was encountered while
662        /// trying to replicate changes from the primary to the secondary. This field
663        /// is only available if the replication has not succeeded since.
664        pub last_error_time: std::option::Option<wkt::Timestamp>,
665
666        /// Output only. A timestamp corresponding to the last change on the primary
667        /// that was successfully replicated to the secondary.
668        pub last_replication_time: std::option::Option<wkt::Timestamp>,
669
670        /// Output only. The time at which a soft failover for the reservation and
671        /// its associated datasets was initiated. After this field is set, all
672        /// subsequent changes to the reservation will be rejected unless a hard
673        /// failover overrides this operation. This field will be cleared once the
674        /// failover is complete.
675        pub soft_failover_start_time: std::option::Option<wkt::Timestamp>,
676
677        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
678    }
679
680    impl ReplicationStatus {
681        /// Creates a new default instance.
682        pub fn new() -> Self {
683            std::default::Default::default()
684        }
685
686        /// Sets the value of [error][crate::model::reservation::ReplicationStatus::error].
687        ///
688        /// # Example
689        /// ```ignore,no_run
690        /// # use google_cloud_bigquery_reservation_v1::model::reservation::ReplicationStatus;
691        /// use google_cloud_rpc::model::Status;
692        /// let x = ReplicationStatus::new().set_error(Status::default()/* use setters */);
693        /// ```
694        pub fn set_error<T>(mut self, v: T) -> Self
695        where
696            T: std::convert::Into<google_cloud_rpc::model::Status>,
697        {
698            self.error = std::option::Option::Some(v.into());
699            self
700        }
701
702        /// Sets or clears the value of [error][crate::model::reservation::ReplicationStatus::error].
703        ///
704        /// # Example
705        /// ```ignore,no_run
706        /// # use google_cloud_bigquery_reservation_v1::model::reservation::ReplicationStatus;
707        /// use google_cloud_rpc::model::Status;
708        /// let x = ReplicationStatus::new().set_or_clear_error(Some(Status::default()/* use setters */));
709        /// let x = ReplicationStatus::new().set_or_clear_error(None::<Status>);
710        /// ```
711        pub fn set_or_clear_error<T>(mut self, v: std::option::Option<T>) -> Self
712        where
713            T: std::convert::Into<google_cloud_rpc::model::Status>,
714        {
715            self.error = v.map(|x| x.into());
716            self
717        }
718
719        /// Sets the value of [last_error_time][crate::model::reservation::ReplicationStatus::last_error_time].
720        ///
721        /// # Example
722        /// ```ignore,no_run
723        /// # use google_cloud_bigquery_reservation_v1::model::reservation::ReplicationStatus;
724        /// use wkt::Timestamp;
725        /// let x = ReplicationStatus::new().set_last_error_time(Timestamp::default()/* use setters */);
726        /// ```
727        pub fn set_last_error_time<T>(mut self, v: T) -> Self
728        where
729            T: std::convert::Into<wkt::Timestamp>,
730        {
731            self.last_error_time = std::option::Option::Some(v.into());
732            self
733        }
734
735        /// Sets or clears the value of [last_error_time][crate::model::reservation::ReplicationStatus::last_error_time].
736        ///
737        /// # Example
738        /// ```ignore,no_run
739        /// # use google_cloud_bigquery_reservation_v1::model::reservation::ReplicationStatus;
740        /// use wkt::Timestamp;
741        /// let x = ReplicationStatus::new().set_or_clear_last_error_time(Some(Timestamp::default()/* use setters */));
742        /// let x = ReplicationStatus::new().set_or_clear_last_error_time(None::<Timestamp>);
743        /// ```
744        pub fn set_or_clear_last_error_time<T>(mut self, v: std::option::Option<T>) -> Self
745        where
746            T: std::convert::Into<wkt::Timestamp>,
747        {
748            self.last_error_time = v.map(|x| x.into());
749            self
750        }
751
752        /// Sets the value of [last_replication_time][crate::model::reservation::ReplicationStatus::last_replication_time].
753        ///
754        /// # Example
755        /// ```ignore,no_run
756        /// # use google_cloud_bigquery_reservation_v1::model::reservation::ReplicationStatus;
757        /// use wkt::Timestamp;
758        /// let x = ReplicationStatus::new().set_last_replication_time(Timestamp::default()/* use setters */);
759        /// ```
760        pub fn set_last_replication_time<T>(mut self, v: T) -> Self
761        where
762            T: std::convert::Into<wkt::Timestamp>,
763        {
764            self.last_replication_time = std::option::Option::Some(v.into());
765            self
766        }
767
768        /// Sets or clears the value of [last_replication_time][crate::model::reservation::ReplicationStatus::last_replication_time].
769        ///
770        /// # Example
771        /// ```ignore,no_run
772        /// # use google_cloud_bigquery_reservation_v1::model::reservation::ReplicationStatus;
773        /// use wkt::Timestamp;
774        /// let x = ReplicationStatus::new().set_or_clear_last_replication_time(Some(Timestamp::default()/* use setters */));
775        /// let x = ReplicationStatus::new().set_or_clear_last_replication_time(None::<Timestamp>);
776        /// ```
777        pub fn set_or_clear_last_replication_time<T>(mut self, v: std::option::Option<T>) -> Self
778        where
779            T: std::convert::Into<wkt::Timestamp>,
780        {
781            self.last_replication_time = v.map(|x| x.into());
782            self
783        }
784
785        /// Sets the value of [soft_failover_start_time][crate::model::reservation::ReplicationStatus::soft_failover_start_time].
786        ///
787        /// # Example
788        /// ```ignore,no_run
789        /// # use google_cloud_bigquery_reservation_v1::model::reservation::ReplicationStatus;
790        /// use wkt::Timestamp;
791        /// let x = ReplicationStatus::new().set_soft_failover_start_time(Timestamp::default()/* use setters */);
792        /// ```
793        pub fn set_soft_failover_start_time<T>(mut self, v: T) -> Self
794        where
795            T: std::convert::Into<wkt::Timestamp>,
796        {
797            self.soft_failover_start_time = std::option::Option::Some(v.into());
798            self
799        }
800
801        /// Sets or clears the value of [soft_failover_start_time][crate::model::reservation::ReplicationStatus::soft_failover_start_time].
802        ///
803        /// # Example
804        /// ```ignore,no_run
805        /// # use google_cloud_bigquery_reservation_v1::model::reservation::ReplicationStatus;
806        /// use wkt::Timestamp;
807        /// let x = ReplicationStatus::new().set_or_clear_soft_failover_start_time(Some(Timestamp::default()/* use setters */));
808        /// let x = ReplicationStatus::new().set_or_clear_soft_failover_start_time(None::<Timestamp>);
809        /// ```
810        pub fn set_or_clear_soft_failover_start_time<T>(mut self, v: std::option::Option<T>) -> Self
811        where
812            T: std::convert::Into<wkt::Timestamp>,
813        {
814            self.soft_failover_start_time = v.map(|x| x.into());
815            self
816        }
817    }
818
819    impl wkt::message::Message for ReplicationStatus {
820        fn typename() -> &'static str {
821            "type.googleapis.com/google.cloud.bigquery.reservation.v1.Reservation.ReplicationStatus"
822        }
823    }
824
825    /// The scaling mode for the reservation. This enum determines how the
826    /// reservation scales up and down.
827    ///
828    /// # Working with unknown values
829    ///
830    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
831    /// additional enum variants at any time. Adding new variants is not considered
832    /// a breaking change. Applications should write their code in anticipation of:
833    ///
834    /// - New values appearing in future releases of the client library, **and**
835    /// - New values received dynamically, without application changes.
836    ///
837    /// Please consult the [Working with enums] section in the user guide for some
838    /// guidelines.
839    ///
840    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
841    #[derive(Clone, Debug, PartialEq)]
842    #[non_exhaustive]
843    pub enum ScalingMode {
844        /// Default value of ScalingMode.
845        Unspecified,
846        /// The reservation will scale up only using slots from autoscaling. It will
847        /// not use any idle slots even if there may be some available. The upper
848        /// limit that autoscaling can scale up to will be max_slots - baseline.
849        /// For example, if max_slots is 1000, baseline is 200 and customer sets
850        /// ScalingMode to AUTOSCALE_ONLY, then autoscalerg will scale up to 800
851        /// slots and no idle slots will be used.
852        ///
853        /// Please note, in this mode, the ignore_idle_slots field must be set to
854        /// true. Otherwise the request will be rejected with error code
855        /// `google.rpc.Code.INVALID_ARGUMENT`.
856        AutoscaleOnly,
857        /// The reservation will scale up using only idle slots contributed by
858        /// other reservations or from unassigned commitments. If no idle slots are
859        /// available it will not scale up further. If the idle slots which it is
860        /// using are reclaimed by the contributing reservation(s) it may be forced
861        /// to scale down. The max idle slots the reservation can be max_slots -
862        /// baseline capacity. For example, if max_slots is 1000, baseline is 200 and
863        /// customer sets ScalingMode to IDLE_SLOTS_ONLY,
864        ///
865        /// 1. if there are 1000 idle slots available in other reservations, the
866        ///    reservation will scale up to 1000 slots with 200 baseline and 800 idle
867        ///    slots.
868        /// 1. if there are 500 idle slots available in other reservations, the
869        ///    reservation will scale up to 700 slots with 200 baseline and 500 idle
870        ///    slots.
871        ///    Please note, in this mode, the reservation might not be able to scale up
872        ///    to max_slots.
873        ///
874        /// Please note, in this mode, the ignore_idle_slots field must be set to
875        /// false. Otherwise the request will be rejected with error code
876        /// `google.rpc.Code.INVALID_ARGUMENT`.
877        IdleSlotsOnly,
878        /// The reservation will scale up using all slots available to it. It will
879        /// use idle slots contributed by other reservations or from unassigned
880        /// commitments first. If no idle slots are available it will scale up using
881        /// autoscaling. For example, if max_slots is 1000, baseline is 200 and
882        /// customer sets ScalingMode to ALL_SLOTS,
883        ///
884        /// 1. if there are 800 idle slots available in other reservations, the
885        ///    reservation will scale up to 1000 slots with 200 baseline and 800 idle
886        ///    slots.
887        /// 1. if there are 500 idle slots available in other reservations, the
888        ///    reservation will scale up to 1000 slots with 200 baseline, 500 idle
889        ///    slots and 300 autoscaling slots.
890        /// 1. if there are no idle slots available in other reservations, it will
891        ///    scale up to 1000 slots with 200 baseline and 800 autoscaling slots.
892        ///
893        /// Please note, in this mode, the ignore_idle_slots field must be set to
894        /// false. Otherwise the request will be rejected with error code
895        /// `google.rpc.Code.INVALID_ARGUMENT`.
896        AllSlots,
897        /// If set, the enum was initialized with an unknown value.
898        ///
899        /// Applications can examine the value using [ScalingMode::value] or
900        /// [ScalingMode::name].
901        UnknownValue(scaling_mode::UnknownValue),
902    }
903
904    #[doc(hidden)]
905    pub mod scaling_mode {
906        #[allow(unused_imports)]
907        use super::*;
908        #[derive(Clone, Debug, PartialEq)]
909        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
910    }
911
912    impl ScalingMode {
913        /// Gets the enum value.
914        ///
915        /// Returns `None` if the enum contains an unknown value deserialized from
916        /// the string representation of enums.
917        pub fn value(&self) -> std::option::Option<i32> {
918            match self {
919                Self::Unspecified => std::option::Option::Some(0),
920                Self::AutoscaleOnly => std::option::Option::Some(1),
921                Self::IdleSlotsOnly => std::option::Option::Some(2),
922                Self::AllSlots => std::option::Option::Some(3),
923                Self::UnknownValue(u) => u.0.value(),
924            }
925        }
926
927        /// Gets the enum value as a string.
928        ///
929        /// Returns `None` if the enum contains an unknown value deserialized from
930        /// the integer representation of enums.
931        pub fn name(&self) -> std::option::Option<&str> {
932            match self {
933                Self::Unspecified => std::option::Option::Some("SCALING_MODE_UNSPECIFIED"),
934                Self::AutoscaleOnly => std::option::Option::Some("AUTOSCALE_ONLY"),
935                Self::IdleSlotsOnly => std::option::Option::Some("IDLE_SLOTS_ONLY"),
936                Self::AllSlots => std::option::Option::Some("ALL_SLOTS"),
937                Self::UnknownValue(u) => u.0.name(),
938            }
939        }
940    }
941
942    impl std::default::Default for ScalingMode {
943        fn default() -> Self {
944            use std::convert::From;
945            Self::from(0)
946        }
947    }
948
949    impl std::fmt::Display for ScalingMode {
950        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
951            wkt::internal::display_enum(f, self.name(), self.value())
952        }
953    }
954
955    impl std::convert::From<i32> for ScalingMode {
956        fn from(value: i32) -> Self {
957            match value {
958                0 => Self::Unspecified,
959                1 => Self::AutoscaleOnly,
960                2 => Self::IdleSlotsOnly,
961                3 => Self::AllSlots,
962                _ => Self::UnknownValue(scaling_mode::UnknownValue(
963                    wkt::internal::UnknownEnumValue::Integer(value),
964                )),
965            }
966        }
967    }
968
969    impl std::convert::From<&str> for ScalingMode {
970        fn from(value: &str) -> Self {
971            use std::string::ToString;
972            match value {
973                "SCALING_MODE_UNSPECIFIED" => Self::Unspecified,
974                "AUTOSCALE_ONLY" => Self::AutoscaleOnly,
975                "IDLE_SLOTS_ONLY" => Self::IdleSlotsOnly,
976                "ALL_SLOTS" => Self::AllSlots,
977                _ => Self::UnknownValue(scaling_mode::UnknownValue(
978                    wkt::internal::UnknownEnumValue::String(value.to_string()),
979                )),
980            }
981        }
982    }
983
984    impl serde::ser::Serialize for ScalingMode {
985        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
986        where
987            S: serde::Serializer,
988        {
989            match self {
990                Self::Unspecified => serializer.serialize_i32(0),
991                Self::AutoscaleOnly => serializer.serialize_i32(1),
992                Self::IdleSlotsOnly => serializer.serialize_i32(2),
993                Self::AllSlots => serializer.serialize_i32(3),
994                Self::UnknownValue(u) => u.0.serialize(serializer),
995            }
996        }
997    }
998
999    impl<'de> serde::de::Deserialize<'de> for ScalingMode {
1000        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1001        where
1002            D: serde::Deserializer<'de>,
1003        {
1004            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ScalingMode>::new(
1005                ".google.cloud.bigquery.reservation.v1.Reservation.ScalingMode",
1006            ))
1007        }
1008    }
1009}
1010
1011/// The scheduling policy controls how a reservation's resources are distributed.
1012#[derive(Clone, Default, PartialEq)]
1013#[non_exhaustive]
1014pub struct SchedulingPolicy {
1015    /// Optional. If present and > 0, the reservation will attempt to limit the
1016    /// concurrency of jobs running for any particular project within it to the
1017    /// given value.
1018    ///
1019    /// This feature is not yet generally available.
1020    pub concurrency: std::option::Option<i64>,
1021
1022    /// Optional. If present and > 0, the reservation will attempt to limit the
1023    /// slot consumption of queries running for any particular project within it to
1024    /// the given value.
1025    ///
1026    /// This feature is not yet generally available.
1027    pub max_slots: std::option::Option<i64>,
1028
1029    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1030}
1031
1032impl SchedulingPolicy {
1033    /// Creates a new default instance.
1034    pub fn new() -> Self {
1035        std::default::Default::default()
1036    }
1037
1038    /// Sets the value of [concurrency][crate::model::SchedulingPolicy::concurrency].
1039    ///
1040    /// # Example
1041    /// ```ignore,no_run
1042    /// # use google_cloud_bigquery_reservation_v1::model::SchedulingPolicy;
1043    /// let x = SchedulingPolicy::new().set_concurrency(42);
1044    /// ```
1045    pub fn set_concurrency<T>(mut self, v: T) -> Self
1046    where
1047        T: std::convert::Into<i64>,
1048    {
1049        self.concurrency = std::option::Option::Some(v.into());
1050        self
1051    }
1052
1053    /// Sets or clears the value of [concurrency][crate::model::SchedulingPolicy::concurrency].
1054    ///
1055    /// # Example
1056    /// ```ignore,no_run
1057    /// # use google_cloud_bigquery_reservation_v1::model::SchedulingPolicy;
1058    /// let x = SchedulingPolicy::new().set_or_clear_concurrency(Some(42));
1059    /// let x = SchedulingPolicy::new().set_or_clear_concurrency(None::<i32>);
1060    /// ```
1061    pub fn set_or_clear_concurrency<T>(mut self, v: std::option::Option<T>) -> Self
1062    where
1063        T: std::convert::Into<i64>,
1064    {
1065        self.concurrency = v.map(|x| x.into());
1066        self
1067    }
1068
1069    /// Sets the value of [max_slots][crate::model::SchedulingPolicy::max_slots].
1070    ///
1071    /// # Example
1072    /// ```ignore,no_run
1073    /// # use google_cloud_bigquery_reservation_v1::model::SchedulingPolicy;
1074    /// let x = SchedulingPolicy::new().set_max_slots(42);
1075    /// ```
1076    pub fn set_max_slots<T>(mut self, v: T) -> Self
1077    where
1078        T: std::convert::Into<i64>,
1079    {
1080        self.max_slots = std::option::Option::Some(v.into());
1081        self
1082    }
1083
1084    /// Sets or clears the value of [max_slots][crate::model::SchedulingPolicy::max_slots].
1085    ///
1086    /// # Example
1087    /// ```ignore,no_run
1088    /// # use google_cloud_bigquery_reservation_v1::model::SchedulingPolicy;
1089    /// let x = SchedulingPolicy::new().set_or_clear_max_slots(Some(42));
1090    /// let x = SchedulingPolicy::new().set_or_clear_max_slots(None::<i32>);
1091    /// ```
1092    pub fn set_or_clear_max_slots<T>(mut self, v: std::option::Option<T>) -> Self
1093    where
1094        T: std::convert::Into<i64>,
1095    {
1096        self.max_slots = v.map(|x| x.into());
1097        self
1098    }
1099}
1100
1101impl wkt::message::Message for SchedulingPolicy {
1102    fn typename() -> &'static str {
1103        "type.googleapis.com/google.cloud.bigquery.reservation.v1.SchedulingPolicy"
1104    }
1105}
1106
1107/// A reservation group is a container for reservations.
1108#[derive(Clone, Default, PartialEq)]
1109#[non_exhaustive]
1110pub struct ReservationGroup {
1111    /// Identifier. The resource name of the reservation group, e.g.,
1112    /// `projects/*/locations/*/reservationGroups/team1-prod`.
1113    /// The reservation_group_id must only contain lower case alphanumeric
1114    /// characters or dashes. It must start with a letter and must not end with a
1115    /// dash. Its maximum length is 64 characters.
1116    pub name: std::string::String,
1117
1118    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1119}
1120
1121impl ReservationGroup {
1122    /// Creates a new default instance.
1123    pub fn new() -> Self {
1124        std::default::Default::default()
1125    }
1126
1127    /// Sets the value of [name][crate::model::ReservationGroup::name].
1128    ///
1129    /// # Example
1130    /// ```ignore,no_run
1131    /// # use google_cloud_bigquery_reservation_v1::model::ReservationGroup;
1132    /// # let project_id = "project_id";
1133    /// # let location_id = "location_id";
1134    /// # let reservation_group_id = "reservation_group_id";
1135    /// let x = ReservationGroup::new().set_name(format!("projects/{project_id}/locations/{location_id}/reservationGroups/{reservation_group_id}"));
1136    /// ```
1137    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1138        self.name = v.into();
1139        self
1140    }
1141}
1142
1143impl wkt::message::Message for ReservationGroup {
1144    fn typename() -> &'static str {
1145        "type.googleapis.com/google.cloud.bigquery.reservation.v1.ReservationGroup"
1146    }
1147}
1148
1149/// Capacity commitment is a way to purchase compute capacity for BigQuery jobs
1150/// (in the form of slots) with some committed period of usage. Annual
1151/// commitments renew by default. Commitments can be removed after their
1152/// commitment end time passes.
1153///
1154/// In order to remove annual commitment, its plan needs to be changed
1155/// to monthly or flex first.
1156///
1157/// A capacity commitment resource exists as a child resource of the admin
1158/// project.
1159#[derive(Clone, Default, PartialEq)]
1160#[non_exhaustive]
1161pub struct CapacityCommitment {
1162    /// Output only. The resource name of the capacity commitment, e.g.,
1163    /// `projects/myproject/locations/US/capacityCommitments/123`
1164    /// The commitment_id must only contain lower case alphanumeric characters or
1165    /// dashes. It must start with a letter and must not end
1166    /// with a dash. Its maximum length is 64 characters.
1167    pub name: std::string::String,
1168
1169    /// Optional. Number of slots in this commitment.
1170    pub slot_count: i64,
1171
1172    /// Optional. Capacity commitment commitment plan.
1173    pub plan: crate::model::capacity_commitment::CommitmentPlan,
1174
1175    /// Output only. State of the commitment.
1176    pub state: crate::model::capacity_commitment::State,
1177
1178    /// Output only. The start of the current commitment period. It is applicable
1179    /// only for ACTIVE capacity commitments. Note after the commitment is renewed,
1180    /// commitment_start_time won't be changed. It refers to the start time of the
1181    /// original commitment.
1182    pub commitment_start_time: std::option::Option<wkt::Timestamp>,
1183
1184    /// Output only. The end of the current commitment period. It is applicable
1185    /// only for ACTIVE capacity commitments. Note after renewal,
1186    /// commitment_end_time is the time the renewed commitment expires. So itwould
1187    /// be at a time after commitment_start_time + committed period, because we
1188    /// don't change commitment_start_time ,
1189    pub commitment_end_time: std::option::Option<wkt::Timestamp>,
1190
1191    /// Output only. For FAILED commitment plan, provides the reason of failure.
1192    pub failure_status: std::option::Option<google_cloud_rpc::model::Status>,
1193
1194    /// Optional. The plan this capacity commitment is converted to after
1195    /// commitment_end_time passes. Once the plan is changed, committed period is
1196    /// extended according to commitment plan. Only applicable for ANNUAL and TRIAL
1197    /// commitments.
1198    pub renewal_plan: crate::model::capacity_commitment::CommitmentPlan,
1199
1200    /// Applicable only for commitments located within one of the BigQuery
1201    /// multi-regions (US or EU).
1202    ///
1203    /// If set to true, this commitment is placed in the organization's
1204    /// secondary region which is designated for disaster recovery purposes.
1205    /// If false, this commitment is placed in the organization's default region.
1206    ///
1207    /// NOTE: this is a preview feature. Project must be allow-listed in order to
1208    /// set this field.
1209    #[deprecated]
1210    pub multi_region_auxiliary: bool,
1211
1212    /// Optional. Edition of the capacity commitment.
1213    pub edition: crate::model::Edition,
1214
1215    /// Output only. If true, the commitment is a flat-rate commitment, otherwise,
1216    /// it's an edition commitment.
1217    pub is_flat_rate: bool,
1218
1219    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1220}
1221
1222impl CapacityCommitment {
1223    /// Creates a new default instance.
1224    pub fn new() -> Self {
1225        std::default::Default::default()
1226    }
1227
1228    /// Sets the value of [name][crate::model::CapacityCommitment::name].
1229    ///
1230    /// # Example
1231    /// ```ignore,no_run
1232    /// # use google_cloud_bigquery_reservation_v1::model::CapacityCommitment;
1233    /// # let project_id = "project_id";
1234    /// # let location_id = "location_id";
1235    /// # let capacity_commitment_id = "capacity_commitment_id";
1236    /// let x = CapacityCommitment::new().set_name(format!("projects/{project_id}/locations/{location_id}/capacityCommitments/{capacity_commitment_id}"));
1237    /// ```
1238    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1239        self.name = v.into();
1240        self
1241    }
1242
1243    /// Sets the value of [slot_count][crate::model::CapacityCommitment::slot_count].
1244    ///
1245    /// # Example
1246    /// ```ignore,no_run
1247    /// # use google_cloud_bigquery_reservation_v1::model::CapacityCommitment;
1248    /// let x = CapacityCommitment::new().set_slot_count(42);
1249    /// ```
1250    pub fn set_slot_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
1251        self.slot_count = v.into();
1252        self
1253    }
1254
1255    /// Sets the value of [plan][crate::model::CapacityCommitment::plan].
1256    ///
1257    /// # Example
1258    /// ```ignore,no_run
1259    /// # use google_cloud_bigquery_reservation_v1::model::CapacityCommitment;
1260    /// use google_cloud_bigquery_reservation_v1::model::capacity_commitment::CommitmentPlan;
1261    /// let x0 = CapacityCommitment::new().set_plan(CommitmentPlan::Flex);
1262    /// let x1 = CapacityCommitment::new().set_plan(CommitmentPlan::Monthly);
1263    /// let x2 = CapacityCommitment::new().set_plan(CommitmentPlan::Annual);
1264    /// ```
1265    pub fn set_plan<T: std::convert::Into<crate::model::capacity_commitment::CommitmentPlan>>(
1266        mut self,
1267        v: T,
1268    ) -> Self {
1269        self.plan = v.into();
1270        self
1271    }
1272
1273    /// Sets the value of [state][crate::model::CapacityCommitment::state].
1274    ///
1275    /// # Example
1276    /// ```ignore,no_run
1277    /// # use google_cloud_bigquery_reservation_v1::model::CapacityCommitment;
1278    /// use google_cloud_bigquery_reservation_v1::model::capacity_commitment::State;
1279    /// let x0 = CapacityCommitment::new().set_state(State::Pending);
1280    /// let x1 = CapacityCommitment::new().set_state(State::Active);
1281    /// let x2 = CapacityCommitment::new().set_state(State::Failed);
1282    /// ```
1283    pub fn set_state<T: std::convert::Into<crate::model::capacity_commitment::State>>(
1284        mut self,
1285        v: T,
1286    ) -> Self {
1287        self.state = v.into();
1288        self
1289    }
1290
1291    /// Sets the value of [commitment_start_time][crate::model::CapacityCommitment::commitment_start_time].
1292    ///
1293    /// # Example
1294    /// ```ignore,no_run
1295    /// # use google_cloud_bigquery_reservation_v1::model::CapacityCommitment;
1296    /// use wkt::Timestamp;
1297    /// let x = CapacityCommitment::new().set_commitment_start_time(Timestamp::default()/* use setters */);
1298    /// ```
1299    pub fn set_commitment_start_time<T>(mut self, v: T) -> Self
1300    where
1301        T: std::convert::Into<wkt::Timestamp>,
1302    {
1303        self.commitment_start_time = std::option::Option::Some(v.into());
1304        self
1305    }
1306
1307    /// Sets or clears the value of [commitment_start_time][crate::model::CapacityCommitment::commitment_start_time].
1308    ///
1309    /// # Example
1310    /// ```ignore,no_run
1311    /// # use google_cloud_bigquery_reservation_v1::model::CapacityCommitment;
1312    /// use wkt::Timestamp;
1313    /// let x = CapacityCommitment::new().set_or_clear_commitment_start_time(Some(Timestamp::default()/* use setters */));
1314    /// let x = CapacityCommitment::new().set_or_clear_commitment_start_time(None::<Timestamp>);
1315    /// ```
1316    pub fn set_or_clear_commitment_start_time<T>(mut self, v: std::option::Option<T>) -> Self
1317    where
1318        T: std::convert::Into<wkt::Timestamp>,
1319    {
1320        self.commitment_start_time = v.map(|x| x.into());
1321        self
1322    }
1323
1324    /// Sets the value of [commitment_end_time][crate::model::CapacityCommitment::commitment_end_time].
1325    ///
1326    /// # Example
1327    /// ```ignore,no_run
1328    /// # use google_cloud_bigquery_reservation_v1::model::CapacityCommitment;
1329    /// use wkt::Timestamp;
1330    /// let x = CapacityCommitment::new().set_commitment_end_time(Timestamp::default()/* use setters */);
1331    /// ```
1332    pub fn set_commitment_end_time<T>(mut self, v: T) -> Self
1333    where
1334        T: std::convert::Into<wkt::Timestamp>,
1335    {
1336        self.commitment_end_time = std::option::Option::Some(v.into());
1337        self
1338    }
1339
1340    /// Sets or clears the value of [commitment_end_time][crate::model::CapacityCommitment::commitment_end_time].
1341    ///
1342    /// # Example
1343    /// ```ignore,no_run
1344    /// # use google_cloud_bigquery_reservation_v1::model::CapacityCommitment;
1345    /// use wkt::Timestamp;
1346    /// let x = CapacityCommitment::new().set_or_clear_commitment_end_time(Some(Timestamp::default()/* use setters */));
1347    /// let x = CapacityCommitment::new().set_or_clear_commitment_end_time(None::<Timestamp>);
1348    /// ```
1349    pub fn set_or_clear_commitment_end_time<T>(mut self, v: std::option::Option<T>) -> Self
1350    where
1351        T: std::convert::Into<wkt::Timestamp>,
1352    {
1353        self.commitment_end_time = v.map(|x| x.into());
1354        self
1355    }
1356
1357    /// Sets the value of [failure_status][crate::model::CapacityCommitment::failure_status].
1358    ///
1359    /// # Example
1360    /// ```ignore,no_run
1361    /// # use google_cloud_bigquery_reservation_v1::model::CapacityCommitment;
1362    /// use google_cloud_rpc::model::Status;
1363    /// let x = CapacityCommitment::new().set_failure_status(Status::default()/* use setters */);
1364    /// ```
1365    pub fn set_failure_status<T>(mut self, v: T) -> Self
1366    where
1367        T: std::convert::Into<google_cloud_rpc::model::Status>,
1368    {
1369        self.failure_status = std::option::Option::Some(v.into());
1370        self
1371    }
1372
1373    /// Sets or clears the value of [failure_status][crate::model::CapacityCommitment::failure_status].
1374    ///
1375    /// # Example
1376    /// ```ignore,no_run
1377    /// # use google_cloud_bigquery_reservation_v1::model::CapacityCommitment;
1378    /// use google_cloud_rpc::model::Status;
1379    /// let x = CapacityCommitment::new().set_or_clear_failure_status(Some(Status::default()/* use setters */));
1380    /// let x = CapacityCommitment::new().set_or_clear_failure_status(None::<Status>);
1381    /// ```
1382    pub fn set_or_clear_failure_status<T>(mut self, v: std::option::Option<T>) -> Self
1383    where
1384        T: std::convert::Into<google_cloud_rpc::model::Status>,
1385    {
1386        self.failure_status = v.map(|x| x.into());
1387        self
1388    }
1389
1390    /// Sets the value of [renewal_plan][crate::model::CapacityCommitment::renewal_plan].
1391    ///
1392    /// # Example
1393    /// ```ignore,no_run
1394    /// # use google_cloud_bigquery_reservation_v1::model::CapacityCommitment;
1395    /// use google_cloud_bigquery_reservation_v1::model::capacity_commitment::CommitmentPlan;
1396    /// let x0 = CapacityCommitment::new().set_renewal_plan(CommitmentPlan::Flex);
1397    /// let x1 = CapacityCommitment::new().set_renewal_plan(CommitmentPlan::Monthly);
1398    /// let x2 = CapacityCommitment::new().set_renewal_plan(CommitmentPlan::Annual);
1399    /// ```
1400    pub fn set_renewal_plan<
1401        T: std::convert::Into<crate::model::capacity_commitment::CommitmentPlan>,
1402    >(
1403        mut self,
1404        v: T,
1405    ) -> Self {
1406        self.renewal_plan = v.into();
1407        self
1408    }
1409
1410    /// Sets the value of [multi_region_auxiliary][crate::model::CapacityCommitment::multi_region_auxiliary].
1411    ///
1412    /// # Example
1413    /// ```ignore,no_run
1414    /// # use google_cloud_bigquery_reservation_v1::model::CapacityCommitment;
1415    /// let x = CapacityCommitment::new().set_multi_region_auxiliary(true);
1416    /// ```
1417    #[deprecated]
1418    pub fn set_multi_region_auxiliary<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1419        self.multi_region_auxiliary = v.into();
1420        self
1421    }
1422
1423    /// Sets the value of [edition][crate::model::CapacityCommitment::edition].
1424    ///
1425    /// # Example
1426    /// ```ignore,no_run
1427    /// # use google_cloud_bigquery_reservation_v1::model::CapacityCommitment;
1428    /// use google_cloud_bigquery_reservation_v1::model::Edition;
1429    /// let x0 = CapacityCommitment::new().set_edition(Edition::Standard);
1430    /// let x1 = CapacityCommitment::new().set_edition(Edition::Enterprise);
1431    /// let x2 = CapacityCommitment::new().set_edition(Edition::EnterprisePlus);
1432    /// ```
1433    pub fn set_edition<T: std::convert::Into<crate::model::Edition>>(mut self, v: T) -> Self {
1434        self.edition = v.into();
1435        self
1436    }
1437
1438    /// Sets the value of [is_flat_rate][crate::model::CapacityCommitment::is_flat_rate].
1439    ///
1440    /// # Example
1441    /// ```ignore,no_run
1442    /// # use google_cloud_bigquery_reservation_v1::model::CapacityCommitment;
1443    /// let x = CapacityCommitment::new().set_is_flat_rate(true);
1444    /// ```
1445    pub fn set_is_flat_rate<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1446        self.is_flat_rate = v.into();
1447        self
1448    }
1449}
1450
1451impl wkt::message::Message for CapacityCommitment {
1452    fn typename() -> &'static str {
1453        "type.googleapis.com/google.cloud.bigquery.reservation.v1.CapacityCommitment"
1454    }
1455}
1456
1457/// Defines additional types related to [CapacityCommitment].
1458pub mod capacity_commitment {
1459    #[allow(unused_imports)]
1460    use super::*;
1461
1462    /// Commitment plan defines the current committed period. Capacity commitment
1463    /// cannot be deleted during it's committed period.
1464    ///
1465    /// # Working with unknown values
1466    ///
1467    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1468    /// additional enum variants at any time. Adding new variants is not considered
1469    /// a breaking change. Applications should write their code in anticipation of:
1470    ///
1471    /// - New values appearing in future releases of the client library, **and**
1472    /// - New values received dynamically, without application changes.
1473    ///
1474    /// Please consult the [Working with enums] section in the user guide for some
1475    /// guidelines.
1476    ///
1477    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1478    #[derive(Clone, Debug, PartialEq)]
1479    #[non_exhaustive]
1480    pub enum CommitmentPlan {
1481        /// Invalid plan value. Requests with this value will be rejected with
1482        /// error code `google.rpc.Code.INVALID_ARGUMENT`.
1483        Unspecified,
1484        /// Flex commitments have committed period of 1 minute after becoming ACTIVE.
1485        /// After that, they are not in a committed period anymore and can be removed
1486        /// any time.
1487        Flex,
1488        /// Same as FLEX, should only be used if flat-rate commitments are still
1489        /// available.
1490        #[deprecated]
1491        FlexFlatRate,
1492        /// Trial commitments have a committed period of 182 days after becoming
1493        /// ACTIVE. After that, they are converted to a new commitment based on the
1494        /// `renewal_plan`. Default `renewal_plan` for Trial commitment is Flex so
1495        /// that it can be deleted right after committed period ends.
1496        #[deprecated]
1497        Trial,
1498        /// Monthly commitments have a committed period of 30 days after becoming
1499        /// ACTIVE. After that, they are not in a committed period anymore and can be
1500        /// removed any time.
1501        Monthly,
1502        /// Same as MONTHLY, should only be used if flat-rate commitments are still
1503        /// available.
1504        #[deprecated]
1505        MonthlyFlatRate,
1506        /// Annual commitments have a committed period of 365 days after becoming
1507        /// ACTIVE. After that they are converted to a new commitment based on the
1508        /// renewal_plan.
1509        Annual,
1510        /// Same as ANNUAL, should only be used if flat-rate commitments are still
1511        /// available.
1512        #[deprecated]
1513        AnnualFlatRate,
1514        /// 3-year commitments have a committed period of 1095(3 * 365) days after
1515        /// becoming ACTIVE. After that they are converted to a new commitment based
1516        /// on the renewal_plan.
1517        ThreeYear,
1518        /// Should only be used for `renewal_plan` and is only meaningful if
1519        /// edition is specified to values other than EDITION_UNSPECIFIED. Otherwise
1520        /// CreateCapacityCommitmentRequest or UpdateCapacityCommitmentRequest will
1521        /// be rejected with error code `google.rpc.Code.INVALID_ARGUMENT`. If the
1522        /// renewal_plan is NONE, capacity commitment will be removed at the end of
1523        /// its commitment period.
1524        None,
1525        /// If set, the enum was initialized with an unknown value.
1526        ///
1527        /// Applications can examine the value using [CommitmentPlan::value] or
1528        /// [CommitmentPlan::name].
1529        UnknownValue(commitment_plan::UnknownValue),
1530    }
1531
1532    #[doc(hidden)]
1533    pub mod commitment_plan {
1534        #[allow(unused_imports)]
1535        use super::*;
1536        #[derive(Clone, Debug, PartialEq)]
1537        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1538    }
1539
1540    impl CommitmentPlan {
1541        /// Gets the enum value.
1542        ///
1543        /// Returns `None` if the enum contains an unknown value deserialized from
1544        /// the string representation of enums.
1545        pub fn value(&self) -> std::option::Option<i32> {
1546            match self {
1547                Self::Unspecified => std::option::Option::Some(0),
1548                Self::Flex => std::option::Option::Some(3),
1549                Self::FlexFlatRate => std::option::Option::Some(7),
1550                Self::Trial => std::option::Option::Some(5),
1551                Self::Monthly => std::option::Option::Some(2),
1552                Self::MonthlyFlatRate => std::option::Option::Some(8),
1553                Self::Annual => std::option::Option::Some(4),
1554                Self::AnnualFlatRate => std::option::Option::Some(9),
1555                Self::ThreeYear => std::option::Option::Some(10),
1556                Self::None => std::option::Option::Some(6),
1557                Self::UnknownValue(u) => u.0.value(),
1558            }
1559        }
1560
1561        /// Gets the enum value as a string.
1562        ///
1563        /// Returns `None` if the enum contains an unknown value deserialized from
1564        /// the integer representation of enums.
1565        pub fn name(&self) -> std::option::Option<&str> {
1566            match self {
1567                Self::Unspecified => std::option::Option::Some("COMMITMENT_PLAN_UNSPECIFIED"),
1568                Self::Flex => std::option::Option::Some("FLEX"),
1569                Self::FlexFlatRate => std::option::Option::Some("FLEX_FLAT_RATE"),
1570                Self::Trial => std::option::Option::Some("TRIAL"),
1571                Self::Monthly => std::option::Option::Some("MONTHLY"),
1572                Self::MonthlyFlatRate => std::option::Option::Some("MONTHLY_FLAT_RATE"),
1573                Self::Annual => std::option::Option::Some("ANNUAL"),
1574                Self::AnnualFlatRate => std::option::Option::Some("ANNUAL_FLAT_RATE"),
1575                Self::ThreeYear => std::option::Option::Some("THREE_YEAR"),
1576                Self::None => std::option::Option::Some("NONE"),
1577                Self::UnknownValue(u) => u.0.name(),
1578            }
1579        }
1580    }
1581
1582    impl std::default::Default for CommitmentPlan {
1583        fn default() -> Self {
1584            use std::convert::From;
1585            Self::from(0)
1586        }
1587    }
1588
1589    impl std::fmt::Display for CommitmentPlan {
1590        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1591            wkt::internal::display_enum(f, self.name(), self.value())
1592        }
1593    }
1594
1595    impl std::convert::From<i32> for CommitmentPlan {
1596        fn from(value: i32) -> Self {
1597            match value {
1598                0 => Self::Unspecified,
1599                2 => Self::Monthly,
1600                3 => Self::Flex,
1601                4 => Self::Annual,
1602                5 => Self::Trial,
1603                6 => Self::None,
1604                7 => Self::FlexFlatRate,
1605                8 => Self::MonthlyFlatRate,
1606                9 => Self::AnnualFlatRate,
1607                10 => Self::ThreeYear,
1608                _ => Self::UnknownValue(commitment_plan::UnknownValue(
1609                    wkt::internal::UnknownEnumValue::Integer(value),
1610                )),
1611            }
1612        }
1613    }
1614
1615    impl std::convert::From<&str> for CommitmentPlan {
1616        fn from(value: &str) -> Self {
1617            use std::string::ToString;
1618            match value {
1619                "COMMITMENT_PLAN_UNSPECIFIED" => Self::Unspecified,
1620                "FLEX" => Self::Flex,
1621                "FLEX_FLAT_RATE" => Self::FlexFlatRate,
1622                "TRIAL" => Self::Trial,
1623                "MONTHLY" => Self::Monthly,
1624                "MONTHLY_FLAT_RATE" => Self::MonthlyFlatRate,
1625                "ANNUAL" => Self::Annual,
1626                "ANNUAL_FLAT_RATE" => Self::AnnualFlatRate,
1627                "THREE_YEAR" => Self::ThreeYear,
1628                "NONE" => Self::None,
1629                _ => Self::UnknownValue(commitment_plan::UnknownValue(
1630                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1631                )),
1632            }
1633        }
1634    }
1635
1636    impl serde::ser::Serialize for CommitmentPlan {
1637        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1638        where
1639            S: serde::Serializer,
1640        {
1641            match self {
1642                Self::Unspecified => serializer.serialize_i32(0),
1643                Self::Flex => serializer.serialize_i32(3),
1644                Self::FlexFlatRate => serializer.serialize_i32(7),
1645                Self::Trial => serializer.serialize_i32(5),
1646                Self::Monthly => serializer.serialize_i32(2),
1647                Self::MonthlyFlatRate => serializer.serialize_i32(8),
1648                Self::Annual => serializer.serialize_i32(4),
1649                Self::AnnualFlatRate => serializer.serialize_i32(9),
1650                Self::ThreeYear => serializer.serialize_i32(10),
1651                Self::None => serializer.serialize_i32(6),
1652                Self::UnknownValue(u) => u.0.serialize(serializer),
1653            }
1654        }
1655    }
1656
1657    impl<'de> serde::de::Deserialize<'de> for CommitmentPlan {
1658        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1659        where
1660            D: serde::Deserializer<'de>,
1661        {
1662            deserializer.deserialize_any(wkt::internal::EnumVisitor::<CommitmentPlan>::new(
1663                ".google.cloud.bigquery.reservation.v1.CapacityCommitment.CommitmentPlan",
1664            ))
1665        }
1666    }
1667
1668    /// Capacity commitment can either become ACTIVE right away or transition
1669    /// from PENDING to ACTIVE or FAILED.
1670    ///
1671    /// # Working with unknown values
1672    ///
1673    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1674    /// additional enum variants at any time. Adding new variants is not considered
1675    /// a breaking change. Applications should write their code in anticipation of:
1676    ///
1677    /// - New values appearing in future releases of the client library, **and**
1678    /// - New values received dynamically, without application changes.
1679    ///
1680    /// Please consult the [Working with enums] section in the user guide for some
1681    /// guidelines.
1682    ///
1683    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1684    #[derive(Clone, Debug, PartialEq)]
1685    #[non_exhaustive]
1686    pub enum State {
1687        /// Invalid state value.
1688        Unspecified,
1689        /// Capacity commitment is pending provisioning. Pending capacity commitment
1690        /// does not contribute to the project's slot_capacity.
1691        Pending,
1692        /// Once slots are provisioned, capacity commitment becomes active.
1693        /// slot_count is added to the project's slot_capacity.
1694        Active,
1695        /// Capacity commitment is failed to be activated by the backend.
1696        Failed,
1697        /// If set, the enum was initialized with an unknown value.
1698        ///
1699        /// Applications can examine the value using [State::value] or
1700        /// [State::name].
1701        UnknownValue(state::UnknownValue),
1702    }
1703
1704    #[doc(hidden)]
1705    pub mod state {
1706        #[allow(unused_imports)]
1707        use super::*;
1708        #[derive(Clone, Debug, PartialEq)]
1709        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1710    }
1711
1712    impl State {
1713        /// Gets the enum value.
1714        ///
1715        /// Returns `None` if the enum contains an unknown value deserialized from
1716        /// the string representation of enums.
1717        pub fn value(&self) -> std::option::Option<i32> {
1718            match self {
1719                Self::Unspecified => std::option::Option::Some(0),
1720                Self::Pending => std::option::Option::Some(1),
1721                Self::Active => std::option::Option::Some(2),
1722                Self::Failed => std::option::Option::Some(3),
1723                Self::UnknownValue(u) => u.0.value(),
1724            }
1725        }
1726
1727        /// Gets the enum value as a string.
1728        ///
1729        /// Returns `None` if the enum contains an unknown value deserialized from
1730        /// the integer representation of enums.
1731        pub fn name(&self) -> std::option::Option<&str> {
1732            match self {
1733                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
1734                Self::Pending => std::option::Option::Some("PENDING"),
1735                Self::Active => std::option::Option::Some("ACTIVE"),
1736                Self::Failed => std::option::Option::Some("FAILED"),
1737                Self::UnknownValue(u) => u.0.name(),
1738            }
1739        }
1740    }
1741
1742    impl std::default::Default for State {
1743        fn default() -> Self {
1744            use std::convert::From;
1745            Self::from(0)
1746        }
1747    }
1748
1749    impl std::fmt::Display for State {
1750        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1751            wkt::internal::display_enum(f, self.name(), self.value())
1752        }
1753    }
1754
1755    impl std::convert::From<i32> for State {
1756        fn from(value: i32) -> Self {
1757            match value {
1758                0 => Self::Unspecified,
1759                1 => Self::Pending,
1760                2 => Self::Active,
1761                3 => Self::Failed,
1762                _ => Self::UnknownValue(state::UnknownValue(
1763                    wkt::internal::UnknownEnumValue::Integer(value),
1764                )),
1765            }
1766        }
1767    }
1768
1769    impl std::convert::From<&str> for State {
1770        fn from(value: &str) -> Self {
1771            use std::string::ToString;
1772            match value {
1773                "STATE_UNSPECIFIED" => Self::Unspecified,
1774                "PENDING" => Self::Pending,
1775                "ACTIVE" => Self::Active,
1776                "FAILED" => Self::Failed,
1777                _ => Self::UnknownValue(state::UnknownValue(
1778                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1779                )),
1780            }
1781        }
1782    }
1783
1784    impl serde::ser::Serialize for State {
1785        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1786        where
1787            S: serde::Serializer,
1788        {
1789            match self {
1790                Self::Unspecified => serializer.serialize_i32(0),
1791                Self::Pending => serializer.serialize_i32(1),
1792                Self::Active => serializer.serialize_i32(2),
1793                Self::Failed => serializer.serialize_i32(3),
1794                Self::UnknownValue(u) => u.0.serialize(serializer),
1795            }
1796        }
1797    }
1798
1799    impl<'de> serde::de::Deserialize<'de> for State {
1800        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1801        where
1802            D: serde::Deserializer<'de>,
1803        {
1804            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
1805                ".google.cloud.bigquery.reservation.v1.CapacityCommitment.State",
1806            ))
1807        }
1808    }
1809}
1810
1811/// The request for
1812/// [ReservationService.CreateReservation][google.cloud.bigquery.reservation.v1.ReservationService.CreateReservation].
1813///
1814/// [google.cloud.bigquery.reservation.v1.ReservationService.CreateReservation]: crate::client::ReservationService::create_reservation
1815#[derive(Clone, Default, PartialEq)]
1816#[non_exhaustive]
1817pub struct CreateReservationRequest {
1818    /// Required. Project, location. E.g.,
1819    /// `projects/myproject/locations/US`
1820    pub parent: std::string::String,
1821
1822    /// The reservation ID. It must only contain lower case alphanumeric
1823    /// characters or dashes. It must start with a letter and must not end
1824    /// with a dash. Its maximum length is 64 characters.
1825    pub reservation_id: std::string::String,
1826
1827    /// Definition of the new reservation to create.
1828    pub reservation: std::option::Option<crate::model::Reservation>,
1829
1830    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1831}
1832
1833impl CreateReservationRequest {
1834    /// Creates a new default instance.
1835    pub fn new() -> Self {
1836        std::default::Default::default()
1837    }
1838
1839    /// Sets the value of [parent][crate::model::CreateReservationRequest::parent].
1840    ///
1841    /// # Example
1842    /// ```ignore,no_run
1843    /// # use google_cloud_bigquery_reservation_v1::model::CreateReservationRequest;
1844    /// # let project_id = "project_id";
1845    /// # let location_id = "location_id";
1846    /// let x = CreateReservationRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
1847    /// ```
1848    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1849        self.parent = v.into();
1850        self
1851    }
1852
1853    /// Sets the value of [reservation_id][crate::model::CreateReservationRequest::reservation_id].
1854    ///
1855    /// # Example
1856    /// ```ignore,no_run
1857    /// # use google_cloud_bigquery_reservation_v1::model::CreateReservationRequest;
1858    /// let x = CreateReservationRequest::new().set_reservation_id("example");
1859    /// ```
1860    pub fn set_reservation_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1861        self.reservation_id = v.into();
1862        self
1863    }
1864
1865    /// Sets the value of [reservation][crate::model::CreateReservationRequest::reservation].
1866    ///
1867    /// # Example
1868    /// ```ignore,no_run
1869    /// # use google_cloud_bigquery_reservation_v1::model::CreateReservationRequest;
1870    /// use google_cloud_bigquery_reservation_v1::model::Reservation;
1871    /// let x = CreateReservationRequest::new().set_reservation(Reservation::default()/* use setters */);
1872    /// ```
1873    pub fn set_reservation<T>(mut self, v: T) -> Self
1874    where
1875        T: std::convert::Into<crate::model::Reservation>,
1876    {
1877        self.reservation = std::option::Option::Some(v.into());
1878        self
1879    }
1880
1881    /// Sets or clears the value of [reservation][crate::model::CreateReservationRequest::reservation].
1882    ///
1883    /// # Example
1884    /// ```ignore,no_run
1885    /// # use google_cloud_bigquery_reservation_v1::model::CreateReservationRequest;
1886    /// use google_cloud_bigquery_reservation_v1::model::Reservation;
1887    /// let x = CreateReservationRequest::new().set_or_clear_reservation(Some(Reservation::default()/* use setters */));
1888    /// let x = CreateReservationRequest::new().set_or_clear_reservation(None::<Reservation>);
1889    /// ```
1890    pub fn set_or_clear_reservation<T>(mut self, v: std::option::Option<T>) -> Self
1891    where
1892        T: std::convert::Into<crate::model::Reservation>,
1893    {
1894        self.reservation = v.map(|x| x.into());
1895        self
1896    }
1897}
1898
1899impl wkt::message::Message for CreateReservationRequest {
1900    fn typename() -> &'static str {
1901        "type.googleapis.com/google.cloud.bigquery.reservation.v1.CreateReservationRequest"
1902    }
1903}
1904
1905/// The request for
1906/// [ReservationService.ListReservations][google.cloud.bigquery.reservation.v1.ReservationService.ListReservations].
1907///
1908/// [google.cloud.bigquery.reservation.v1.ReservationService.ListReservations]: crate::client::ReservationService::list_reservations
1909#[derive(Clone, Default, PartialEq)]
1910#[non_exhaustive]
1911pub struct ListReservationsRequest {
1912    /// Required. The parent resource name containing project and location, e.g.:
1913    /// `projects/myproject/locations/US`
1914    pub parent: std::string::String,
1915
1916    /// The maximum number of items to return per page.
1917    pub page_size: i32,
1918
1919    /// The next_page_token value returned from a previous List request, if any.
1920    pub page_token: std::string::String,
1921
1922    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1923}
1924
1925impl ListReservationsRequest {
1926    /// Creates a new default instance.
1927    pub fn new() -> Self {
1928        std::default::Default::default()
1929    }
1930
1931    /// Sets the value of [parent][crate::model::ListReservationsRequest::parent].
1932    ///
1933    /// # Example
1934    /// ```ignore,no_run
1935    /// # use google_cloud_bigquery_reservation_v1::model::ListReservationsRequest;
1936    /// # let project_id = "project_id";
1937    /// # let location_id = "location_id";
1938    /// let x = ListReservationsRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
1939    /// ```
1940    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1941        self.parent = v.into();
1942        self
1943    }
1944
1945    /// Sets the value of [page_size][crate::model::ListReservationsRequest::page_size].
1946    ///
1947    /// # Example
1948    /// ```ignore,no_run
1949    /// # use google_cloud_bigquery_reservation_v1::model::ListReservationsRequest;
1950    /// let x = ListReservationsRequest::new().set_page_size(42);
1951    /// ```
1952    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1953        self.page_size = v.into();
1954        self
1955    }
1956
1957    /// Sets the value of [page_token][crate::model::ListReservationsRequest::page_token].
1958    ///
1959    /// # Example
1960    /// ```ignore,no_run
1961    /// # use google_cloud_bigquery_reservation_v1::model::ListReservationsRequest;
1962    /// let x = ListReservationsRequest::new().set_page_token("example");
1963    /// ```
1964    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1965        self.page_token = v.into();
1966        self
1967    }
1968}
1969
1970impl wkt::message::Message for ListReservationsRequest {
1971    fn typename() -> &'static str {
1972        "type.googleapis.com/google.cloud.bigquery.reservation.v1.ListReservationsRequest"
1973    }
1974}
1975
1976/// The response for
1977/// [ReservationService.ListReservations][google.cloud.bigquery.reservation.v1.ReservationService.ListReservations].
1978///
1979/// [google.cloud.bigquery.reservation.v1.ReservationService.ListReservations]: crate::client::ReservationService::list_reservations
1980#[derive(Clone, Default, PartialEq)]
1981#[non_exhaustive]
1982pub struct ListReservationsResponse {
1983    /// List of reservations visible to the user.
1984    pub reservations: std::vec::Vec<crate::model::Reservation>,
1985
1986    /// Token to retrieve the next page of results, or empty if there are no
1987    /// more results in the list.
1988    pub next_page_token: std::string::String,
1989
1990    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1991}
1992
1993impl ListReservationsResponse {
1994    /// Creates a new default instance.
1995    pub fn new() -> Self {
1996        std::default::Default::default()
1997    }
1998
1999    /// Sets the value of [reservations][crate::model::ListReservationsResponse::reservations].
2000    ///
2001    /// # Example
2002    /// ```ignore,no_run
2003    /// # use google_cloud_bigquery_reservation_v1::model::ListReservationsResponse;
2004    /// use google_cloud_bigquery_reservation_v1::model::Reservation;
2005    /// let x = ListReservationsResponse::new()
2006    ///     .set_reservations([
2007    ///         Reservation::default()/* use setters */,
2008    ///         Reservation::default()/* use (different) setters */,
2009    ///     ]);
2010    /// ```
2011    pub fn set_reservations<T, V>(mut self, v: T) -> Self
2012    where
2013        T: std::iter::IntoIterator<Item = V>,
2014        V: std::convert::Into<crate::model::Reservation>,
2015    {
2016        use std::iter::Iterator;
2017        self.reservations = v.into_iter().map(|i| i.into()).collect();
2018        self
2019    }
2020
2021    /// Sets the value of [next_page_token][crate::model::ListReservationsResponse::next_page_token].
2022    ///
2023    /// # Example
2024    /// ```ignore,no_run
2025    /// # use google_cloud_bigquery_reservation_v1::model::ListReservationsResponse;
2026    /// let x = ListReservationsResponse::new().set_next_page_token("example");
2027    /// ```
2028    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2029        self.next_page_token = v.into();
2030        self
2031    }
2032}
2033
2034impl wkt::message::Message for ListReservationsResponse {
2035    fn typename() -> &'static str {
2036        "type.googleapis.com/google.cloud.bigquery.reservation.v1.ListReservationsResponse"
2037    }
2038}
2039
2040#[doc(hidden)]
2041impl google_cloud_gax::paginator::internal::PageableResponse for ListReservationsResponse {
2042    type PageItem = crate::model::Reservation;
2043
2044    fn items(self) -> std::vec::Vec<Self::PageItem> {
2045        self.reservations
2046    }
2047
2048    fn next_page_token(&self) -> std::string::String {
2049        use std::clone::Clone;
2050        self.next_page_token.clone()
2051    }
2052}
2053
2054/// The request for
2055/// [ReservationService.GetReservation][google.cloud.bigquery.reservation.v1.ReservationService.GetReservation].
2056///
2057/// [google.cloud.bigquery.reservation.v1.ReservationService.GetReservation]: crate::client::ReservationService::get_reservation
2058#[derive(Clone, Default, PartialEq)]
2059#[non_exhaustive]
2060pub struct GetReservationRequest {
2061    /// Required. Resource name of the reservation to retrieve. E.g.,
2062    /// `projects/myproject/locations/US/reservations/team1-prod`
2063    pub name: std::string::String,
2064
2065    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2066}
2067
2068impl GetReservationRequest {
2069    /// Creates a new default instance.
2070    pub fn new() -> Self {
2071        std::default::Default::default()
2072    }
2073
2074    /// Sets the value of [name][crate::model::GetReservationRequest::name].
2075    ///
2076    /// # Example
2077    /// ```ignore,no_run
2078    /// # use google_cloud_bigquery_reservation_v1::model::GetReservationRequest;
2079    /// # let project_id = "project_id";
2080    /// # let location_id = "location_id";
2081    /// # let reservation_id = "reservation_id";
2082    /// let x = GetReservationRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/reservations/{reservation_id}"));
2083    /// ```
2084    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2085        self.name = v.into();
2086        self
2087    }
2088}
2089
2090impl wkt::message::Message for GetReservationRequest {
2091    fn typename() -> &'static str {
2092        "type.googleapis.com/google.cloud.bigquery.reservation.v1.GetReservationRequest"
2093    }
2094}
2095
2096/// The request for
2097/// [ReservationService.DeleteReservation][google.cloud.bigquery.reservation.v1.ReservationService.DeleteReservation].
2098///
2099/// [google.cloud.bigquery.reservation.v1.ReservationService.DeleteReservation]: crate::client::ReservationService::delete_reservation
2100#[derive(Clone, Default, PartialEq)]
2101#[non_exhaustive]
2102pub struct DeleteReservationRequest {
2103    /// Required. Resource name of the reservation to retrieve. E.g.,
2104    /// `projects/myproject/locations/US/reservations/team1-prod`
2105    pub name: std::string::String,
2106
2107    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2108}
2109
2110impl DeleteReservationRequest {
2111    /// Creates a new default instance.
2112    pub fn new() -> Self {
2113        std::default::Default::default()
2114    }
2115
2116    /// Sets the value of [name][crate::model::DeleteReservationRequest::name].
2117    ///
2118    /// # Example
2119    /// ```ignore,no_run
2120    /// # use google_cloud_bigquery_reservation_v1::model::DeleteReservationRequest;
2121    /// # let project_id = "project_id";
2122    /// # let location_id = "location_id";
2123    /// # let reservation_id = "reservation_id";
2124    /// let x = DeleteReservationRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/reservations/{reservation_id}"));
2125    /// ```
2126    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2127        self.name = v.into();
2128        self
2129    }
2130}
2131
2132impl wkt::message::Message for DeleteReservationRequest {
2133    fn typename() -> &'static str {
2134        "type.googleapis.com/google.cloud.bigquery.reservation.v1.DeleteReservationRequest"
2135    }
2136}
2137
2138/// The request for
2139/// [ReservationService.UpdateReservation][google.cloud.bigquery.reservation.v1.ReservationService.UpdateReservation].
2140///
2141/// [google.cloud.bigquery.reservation.v1.ReservationService.UpdateReservation]: crate::client::ReservationService::update_reservation
2142#[derive(Clone, Default, PartialEq)]
2143#[non_exhaustive]
2144pub struct UpdateReservationRequest {
2145    /// Content of the reservation to update.
2146    pub reservation: std::option::Option<crate::model::Reservation>,
2147
2148    /// Standard field mask for the set of fields to be updated.
2149    pub update_mask: std::option::Option<wkt::FieldMask>,
2150
2151    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2152}
2153
2154impl UpdateReservationRequest {
2155    /// Creates a new default instance.
2156    pub fn new() -> Self {
2157        std::default::Default::default()
2158    }
2159
2160    /// Sets the value of [reservation][crate::model::UpdateReservationRequest::reservation].
2161    ///
2162    /// # Example
2163    /// ```ignore,no_run
2164    /// # use google_cloud_bigquery_reservation_v1::model::UpdateReservationRequest;
2165    /// use google_cloud_bigquery_reservation_v1::model::Reservation;
2166    /// let x = UpdateReservationRequest::new().set_reservation(Reservation::default()/* use setters */);
2167    /// ```
2168    pub fn set_reservation<T>(mut self, v: T) -> Self
2169    where
2170        T: std::convert::Into<crate::model::Reservation>,
2171    {
2172        self.reservation = std::option::Option::Some(v.into());
2173        self
2174    }
2175
2176    /// Sets or clears the value of [reservation][crate::model::UpdateReservationRequest::reservation].
2177    ///
2178    /// # Example
2179    /// ```ignore,no_run
2180    /// # use google_cloud_bigquery_reservation_v1::model::UpdateReservationRequest;
2181    /// use google_cloud_bigquery_reservation_v1::model::Reservation;
2182    /// let x = UpdateReservationRequest::new().set_or_clear_reservation(Some(Reservation::default()/* use setters */));
2183    /// let x = UpdateReservationRequest::new().set_or_clear_reservation(None::<Reservation>);
2184    /// ```
2185    pub fn set_or_clear_reservation<T>(mut self, v: std::option::Option<T>) -> Self
2186    where
2187        T: std::convert::Into<crate::model::Reservation>,
2188    {
2189        self.reservation = v.map(|x| x.into());
2190        self
2191    }
2192
2193    /// Sets the value of [update_mask][crate::model::UpdateReservationRequest::update_mask].
2194    ///
2195    /// # Example
2196    /// ```ignore,no_run
2197    /// # use google_cloud_bigquery_reservation_v1::model::UpdateReservationRequest;
2198    /// use wkt::FieldMask;
2199    /// let x = UpdateReservationRequest::new().set_update_mask(FieldMask::default()/* use setters */);
2200    /// ```
2201    pub fn set_update_mask<T>(mut self, v: T) -> Self
2202    where
2203        T: std::convert::Into<wkt::FieldMask>,
2204    {
2205        self.update_mask = std::option::Option::Some(v.into());
2206        self
2207    }
2208
2209    /// Sets or clears the value of [update_mask][crate::model::UpdateReservationRequest::update_mask].
2210    ///
2211    /// # Example
2212    /// ```ignore,no_run
2213    /// # use google_cloud_bigquery_reservation_v1::model::UpdateReservationRequest;
2214    /// use wkt::FieldMask;
2215    /// let x = UpdateReservationRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
2216    /// let x = UpdateReservationRequest::new().set_or_clear_update_mask(None::<FieldMask>);
2217    /// ```
2218    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2219    where
2220        T: std::convert::Into<wkt::FieldMask>,
2221    {
2222        self.update_mask = v.map(|x| x.into());
2223        self
2224    }
2225}
2226
2227impl wkt::message::Message for UpdateReservationRequest {
2228    fn typename() -> &'static str {
2229        "type.googleapis.com/google.cloud.bigquery.reservation.v1.UpdateReservationRequest"
2230    }
2231}
2232
2233/// The request for ReservationService.FailoverReservation.
2234#[derive(Clone, Default, PartialEq)]
2235#[non_exhaustive]
2236pub struct FailoverReservationRequest {
2237    /// Required. Resource name of the reservation to failover. E.g.,
2238    /// `projects/myproject/locations/US/reservations/team1-prod`
2239    pub name: std::string::String,
2240
2241    /// Optional. A parameter that determines how writes that are pending
2242    /// replication are handled after a failover is initiated. If not specified,
2243    /// HARD failover mode is used by default.
2244    pub failover_mode: crate::model::FailoverMode,
2245
2246    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2247}
2248
2249impl FailoverReservationRequest {
2250    /// Creates a new default instance.
2251    pub fn new() -> Self {
2252        std::default::Default::default()
2253    }
2254
2255    /// Sets the value of [name][crate::model::FailoverReservationRequest::name].
2256    ///
2257    /// # Example
2258    /// ```ignore,no_run
2259    /// # use google_cloud_bigquery_reservation_v1::model::FailoverReservationRequest;
2260    /// # let project_id = "project_id";
2261    /// # let location_id = "location_id";
2262    /// # let reservation_id = "reservation_id";
2263    /// let x = FailoverReservationRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/reservations/{reservation_id}"));
2264    /// ```
2265    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2266        self.name = v.into();
2267        self
2268    }
2269
2270    /// Sets the value of [failover_mode][crate::model::FailoverReservationRequest::failover_mode].
2271    ///
2272    /// # Example
2273    /// ```ignore,no_run
2274    /// # use google_cloud_bigquery_reservation_v1::model::FailoverReservationRequest;
2275    /// use google_cloud_bigquery_reservation_v1::model::FailoverMode;
2276    /// let x0 = FailoverReservationRequest::new().set_failover_mode(FailoverMode::Soft);
2277    /// let x1 = FailoverReservationRequest::new().set_failover_mode(FailoverMode::Hard);
2278    /// ```
2279    pub fn set_failover_mode<T: std::convert::Into<crate::model::FailoverMode>>(
2280        mut self,
2281        v: T,
2282    ) -> Self {
2283        self.failover_mode = v.into();
2284        self
2285    }
2286}
2287
2288impl wkt::message::Message for FailoverReservationRequest {
2289    fn typename() -> &'static str {
2290        "type.googleapis.com/google.cloud.bigquery.reservation.v1.FailoverReservationRequest"
2291    }
2292}
2293
2294/// The request for
2295/// [ReservationService.CreateReservationGroup][google.cloud.bigquery.reservation.v1.ReservationService.CreateReservationGroup].
2296///
2297/// [google.cloud.bigquery.reservation.v1.ReservationService.CreateReservationGroup]: crate::client::ReservationService::create_reservation_group
2298#[derive(Clone, Default, PartialEq)]
2299#[non_exhaustive]
2300pub struct CreateReservationGroupRequest {
2301    /// Required. Project, location. E.g.,
2302    /// `projects/myproject/locations/US`
2303    pub parent: std::string::String,
2304
2305    /// Required. The reservation group ID. It must only contain lower case
2306    /// alphanumeric characters or dashes. It must start with a letter and must not
2307    /// end with a dash. Its maximum length is 64 characters.
2308    pub reservation_group_id: std::string::String,
2309
2310    /// Required. New Reservation Group to create.
2311    pub reservation_group: std::option::Option<crate::model::ReservationGroup>,
2312
2313    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2314}
2315
2316impl CreateReservationGroupRequest {
2317    /// Creates a new default instance.
2318    pub fn new() -> Self {
2319        std::default::Default::default()
2320    }
2321
2322    /// Sets the value of [parent][crate::model::CreateReservationGroupRequest::parent].
2323    ///
2324    /// # Example
2325    /// ```ignore,no_run
2326    /// # use google_cloud_bigquery_reservation_v1::model::CreateReservationGroupRequest;
2327    /// # let project_id = "project_id";
2328    /// # let location_id = "location_id";
2329    /// let x = CreateReservationGroupRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
2330    /// ```
2331    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2332        self.parent = v.into();
2333        self
2334    }
2335
2336    /// Sets the value of [reservation_group_id][crate::model::CreateReservationGroupRequest::reservation_group_id].
2337    ///
2338    /// # Example
2339    /// ```ignore,no_run
2340    /// # use google_cloud_bigquery_reservation_v1::model::CreateReservationGroupRequest;
2341    /// let x = CreateReservationGroupRequest::new().set_reservation_group_id("example");
2342    /// ```
2343    pub fn set_reservation_group_id<T: std::convert::Into<std::string::String>>(
2344        mut self,
2345        v: T,
2346    ) -> Self {
2347        self.reservation_group_id = v.into();
2348        self
2349    }
2350
2351    /// Sets the value of [reservation_group][crate::model::CreateReservationGroupRequest::reservation_group].
2352    ///
2353    /// # Example
2354    /// ```ignore,no_run
2355    /// # use google_cloud_bigquery_reservation_v1::model::CreateReservationGroupRequest;
2356    /// use google_cloud_bigquery_reservation_v1::model::ReservationGroup;
2357    /// let x = CreateReservationGroupRequest::new().set_reservation_group(ReservationGroup::default()/* use setters */);
2358    /// ```
2359    pub fn set_reservation_group<T>(mut self, v: T) -> Self
2360    where
2361        T: std::convert::Into<crate::model::ReservationGroup>,
2362    {
2363        self.reservation_group = std::option::Option::Some(v.into());
2364        self
2365    }
2366
2367    /// Sets or clears the value of [reservation_group][crate::model::CreateReservationGroupRequest::reservation_group].
2368    ///
2369    /// # Example
2370    /// ```ignore,no_run
2371    /// # use google_cloud_bigquery_reservation_v1::model::CreateReservationGroupRequest;
2372    /// use google_cloud_bigquery_reservation_v1::model::ReservationGroup;
2373    /// let x = CreateReservationGroupRequest::new().set_or_clear_reservation_group(Some(ReservationGroup::default()/* use setters */));
2374    /// let x = CreateReservationGroupRequest::new().set_or_clear_reservation_group(None::<ReservationGroup>);
2375    /// ```
2376    pub fn set_or_clear_reservation_group<T>(mut self, v: std::option::Option<T>) -> Self
2377    where
2378        T: std::convert::Into<crate::model::ReservationGroup>,
2379    {
2380        self.reservation_group = v.map(|x| x.into());
2381        self
2382    }
2383}
2384
2385impl wkt::message::Message for CreateReservationGroupRequest {
2386    fn typename() -> &'static str {
2387        "type.googleapis.com/google.cloud.bigquery.reservation.v1.CreateReservationGroupRequest"
2388    }
2389}
2390
2391/// The request for
2392/// [ReservationService.GetReservationGroup][google.cloud.bigquery.reservation.v1.ReservationService.GetReservationGroup].
2393///
2394/// [google.cloud.bigquery.reservation.v1.ReservationService.GetReservationGroup]: crate::client::ReservationService::get_reservation_group
2395#[derive(Clone, Default, PartialEq)]
2396#[non_exhaustive]
2397pub struct GetReservationGroupRequest {
2398    /// Required. Resource name of the reservation group to retrieve. E.g.,
2399    /// `projects/myproject/locations/US/reservationGroups/team1-prod`
2400    pub name: std::string::String,
2401
2402    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2403}
2404
2405impl GetReservationGroupRequest {
2406    /// Creates a new default instance.
2407    pub fn new() -> Self {
2408        std::default::Default::default()
2409    }
2410
2411    /// Sets the value of [name][crate::model::GetReservationGroupRequest::name].
2412    ///
2413    /// # Example
2414    /// ```ignore,no_run
2415    /// # use google_cloud_bigquery_reservation_v1::model::GetReservationGroupRequest;
2416    /// # let project_id = "project_id";
2417    /// # let location_id = "location_id";
2418    /// # let reservation_group_id = "reservation_group_id";
2419    /// let x = GetReservationGroupRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/reservationGroups/{reservation_group_id}"));
2420    /// ```
2421    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2422        self.name = v.into();
2423        self
2424    }
2425}
2426
2427impl wkt::message::Message for GetReservationGroupRequest {
2428    fn typename() -> &'static str {
2429        "type.googleapis.com/google.cloud.bigquery.reservation.v1.GetReservationGroupRequest"
2430    }
2431}
2432
2433/// The request for
2434/// [ReservationService.ListReservationGroups][google.cloud.bigquery.reservation.v1.ReservationService.ListReservationGroups].
2435///
2436/// [google.cloud.bigquery.reservation.v1.ReservationService.ListReservationGroups]: crate::client::ReservationService::list_reservation_groups
2437#[derive(Clone, Default, PartialEq)]
2438#[non_exhaustive]
2439pub struct ListReservationGroupsRequest {
2440    /// Required. The parent resource name containing project and location, e.g.:
2441    /// `projects/myproject/locations/US`
2442    pub parent: std::string::String,
2443
2444    /// The maximum number of items to return per page.
2445    pub page_size: i32,
2446
2447    /// The next_page_token value returned from a previous List request, if any.
2448    pub page_token: std::string::String,
2449
2450    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2451}
2452
2453impl ListReservationGroupsRequest {
2454    /// Creates a new default instance.
2455    pub fn new() -> Self {
2456        std::default::Default::default()
2457    }
2458
2459    /// Sets the value of [parent][crate::model::ListReservationGroupsRequest::parent].
2460    ///
2461    /// # Example
2462    /// ```ignore,no_run
2463    /// # use google_cloud_bigquery_reservation_v1::model::ListReservationGroupsRequest;
2464    /// # let project_id = "project_id";
2465    /// # let location_id = "location_id";
2466    /// let x = ListReservationGroupsRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
2467    /// ```
2468    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2469        self.parent = v.into();
2470        self
2471    }
2472
2473    /// Sets the value of [page_size][crate::model::ListReservationGroupsRequest::page_size].
2474    ///
2475    /// # Example
2476    /// ```ignore,no_run
2477    /// # use google_cloud_bigquery_reservation_v1::model::ListReservationGroupsRequest;
2478    /// let x = ListReservationGroupsRequest::new().set_page_size(42);
2479    /// ```
2480    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2481        self.page_size = v.into();
2482        self
2483    }
2484
2485    /// Sets the value of [page_token][crate::model::ListReservationGroupsRequest::page_token].
2486    ///
2487    /// # Example
2488    /// ```ignore,no_run
2489    /// # use google_cloud_bigquery_reservation_v1::model::ListReservationGroupsRequest;
2490    /// let x = ListReservationGroupsRequest::new().set_page_token("example");
2491    /// ```
2492    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2493        self.page_token = v.into();
2494        self
2495    }
2496}
2497
2498impl wkt::message::Message for ListReservationGroupsRequest {
2499    fn typename() -> &'static str {
2500        "type.googleapis.com/google.cloud.bigquery.reservation.v1.ListReservationGroupsRequest"
2501    }
2502}
2503
2504/// The response for
2505/// [ReservationService.ListReservationGroups][google.cloud.bigquery.reservation.v1.ReservationService.ListReservationGroups].
2506///
2507/// [google.cloud.bigquery.reservation.v1.ReservationService.ListReservationGroups]: crate::client::ReservationService::list_reservation_groups
2508#[derive(Clone, Default, PartialEq)]
2509#[non_exhaustive]
2510pub struct ListReservationGroupsResponse {
2511    /// List of reservations visible to the user.
2512    pub reservation_groups: std::vec::Vec<crate::model::ReservationGroup>,
2513
2514    /// Token to retrieve the next page of results, or empty if there are no
2515    /// more results in the list.
2516    pub next_page_token: std::string::String,
2517
2518    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2519}
2520
2521impl ListReservationGroupsResponse {
2522    /// Creates a new default instance.
2523    pub fn new() -> Self {
2524        std::default::Default::default()
2525    }
2526
2527    /// Sets the value of [reservation_groups][crate::model::ListReservationGroupsResponse::reservation_groups].
2528    ///
2529    /// # Example
2530    /// ```ignore,no_run
2531    /// # use google_cloud_bigquery_reservation_v1::model::ListReservationGroupsResponse;
2532    /// use google_cloud_bigquery_reservation_v1::model::ReservationGroup;
2533    /// let x = ListReservationGroupsResponse::new()
2534    ///     .set_reservation_groups([
2535    ///         ReservationGroup::default()/* use setters */,
2536    ///         ReservationGroup::default()/* use (different) setters */,
2537    ///     ]);
2538    /// ```
2539    pub fn set_reservation_groups<T, V>(mut self, v: T) -> Self
2540    where
2541        T: std::iter::IntoIterator<Item = V>,
2542        V: std::convert::Into<crate::model::ReservationGroup>,
2543    {
2544        use std::iter::Iterator;
2545        self.reservation_groups = v.into_iter().map(|i| i.into()).collect();
2546        self
2547    }
2548
2549    /// Sets the value of [next_page_token][crate::model::ListReservationGroupsResponse::next_page_token].
2550    ///
2551    /// # Example
2552    /// ```ignore,no_run
2553    /// # use google_cloud_bigquery_reservation_v1::model::ListReservationGroupsResponse;
2554    /// let x = ListReservationGroupsResponse::new().set_next_page_token("example");
2555    /// ```
2556    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2557        self.next_page_token = v.into();
2558        self
2559    }
2560}
2561
2562impl wkt::message::Message for ListReservationGroupsResponse {
2563    fn typename() -> &'static str {
2564        "type.googleapis.com/google.cloud.bigquery.reservation.v1.ListReservationGroupsResponse"
2565    }
2566}
2567
2568#[doc(hidden)]
2569impl google_cloud_gax::paginator::internal::PageableResponse for ListReservationGroupsResponse {
2570    type PageItem = crate::model::ReservationGroup;
2571
2572    fn items(self) -> std::vec::Vec<Self::PageItem> {
2573        self.reservation_groups
2574    }
2575
2576    fn next_page_token(&self) -> std::string::String {
2577        use std::clone::Clone;
2578        self.next_page_token.clone()
2579    }
2580}
2581
2582/// The request for
2583/// [ReservationService.DeleteReservationGroup][google.cloud.bigquery.reservation.v1.ReservationService.DeleteReservationGroup].
2584///
2585/// [google.cloud.bigquery.reservation.v1.ReservationService.DeleteReservationGroup]: crate::client::ReservationService::delete_reservation_group
2586#[derive(Clone, Default, PartialEq)]
2587#[non_exhaustive]
2588pub struct DeleteReservationGroupRequest {
2589    /// Required. Resource name of the reservation group to retrieve. E.g.,
2590    /// `projects/myproject/locations/US/reservationGroups/team1-prod`
2591    pub name: std::string::String,
2592
2593    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2594}
2595
2596impl DeleteReservationGroupRequest {
2597    /// Creates a new default instance.
2598    pub fn new() -> Self {
2599        std::default::Default::default()
2600    }
2601
2602    /// Sets the value of [name][crate::model::DeleteReservationGroupRequest::name].
2603    ///
2604    /// # Example
2605    /// ```ignore,no_run
2606    /// # use google_cloud_bigquery_reservation_v1::model::DeleteReservationGroupRequest;
2607    /// # let project_id = "project_id";
2608    /// # let location_id = "location_id";
2609    /// # let reservation_group_id = "reservation_group_id";
2610    /// let x = DeleteReservationGroupRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/reservationGroups/{reservation_group_id}"));
2611    /// ```
2612    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2613        self.name = v.into();
2614        self
2615    }
2616}
2617
2618impl wkt::message::Message for DeleteReservationGroupRequest {
2619    fn typename() -> &'static str {
2620        "type.googleapis.com/google.cloud.bigquery.reservation.v1.DeleteReservationGroupRequest"
2621    }
2622}
2623
2624/// The request for
2625/// [ReservationService.CreateCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.CreateCapacityCommitment].
2626///
2627/// [google.cloud.bigquery.reservation.v1.ReservationService.CreateCapacityCommitment]: crate::client::ReservationService::create_capacity_commitment
2628#[derive(Clone, Default, PartialEq)]
2629#[non_exhaustive]
2630pub struct CreateCapacityCommitmentRequest {
2631    /// Required. Resource name of the parent reservation. E.g.,
2632    /// `projects/myproject/locations/US`
2633    pub parent: std::string::String,
2634
2635    /// Content of the capacity commitment to create.
2636    pub capacity_commitment: std::option::Option<crate::model::CapacityCommitment>,
2637
2638    /// If true, fail the request if another project in the organization has a
2639    /// capacity commitment.
2640    pub enforce_single_admin_project_per_org: bool,
2641
2642    /// The optional capacity commitment ID. Capacity commitment name will be
2643    /// generated automatically if this field is empty.
2644    /// This field must only contain lower case alphanumeric characters or dashes.
2645    /// The first and last character cannot be a dash. Max length is 64 characters.
2646    /// NOTE: this ID won't be kept if the capacity commitment is split or merged.
2647    pub capacity_commitment_id: std::string::String,
2648
2649    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2650}
2651
2652impl CreateCapacityCommitmentRequest {
2653    /// Creates a new default instance.
2654    pub fn new() -> Self {
2655        std::default::Default::default()
2656    }
2657
2658    /// Sets the value of [parent][crate::model::CreateCapacityCommitmentRequest::parent].
2659    ///
2660    /// # Example
2661    /// ```ignore,no_run
2662    /// # use google_cloud_bigquery_reservation_v1::model::CreateCapacityCommitmentRequest;
2663    /// # let project_id = "project_id";
2664    /// # let location_id = "location_id";
2665    /// let x = CreateCapacityCommitmentRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
2666    /// ```
2667    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2668        self.parent = v.into();
2669        self
2670    }
2671
2672    /// Sets the value of [capacity_commitment][crate::model::CreateCapacityCommitmentRequest::capacity_commitment].
2673    ///
2674    /// # Example
2675    /// ```ignore,no_run
2676    /// # use google_cloud_bigquery_reservation_v1::model::CreateCapacityCommitmentRequest;
2677    /// use google_cloud_bigquery_reservation_v1::model::CapacityCommitment;
2678    /// let x = CreateCapacityCommitmentRequest::new().set_capacity_commitment(CapacityCommitment::default()/* use setters */);
2679    /// ```
2680    pub fn set_capacity_commitment<T>(mut self, v: T) -> Self
2681    where
2682        T: std::convert::Into<crate::model::CapacityCommitment>,
2683    {
2684        self.capacity_commitment = std::option::Option::Some(v.into());
2685        self
2686    }
2687
2688    /// Sets or clears the value of [capacity_commitment][crate::model::CreateCapacityCommitmentRequest::capacity_commitment].
2689    ///
2690    /// # Example
2691    /// ```ignore,no_run
2692    /// # use google_cloud_bigquery_reservation_v1::model::CreateCapacityCommitmentRequest;
2693    /// use google_cloud_bigquery_reservation_v1::model::CapacityCommitment;
2694    /// let x = CreateCapacityCommitmentRequest::new().set_or_clear_capacity_commitment(Some(CapacityCommitment::default()/* use setters */));
2695    /// let x = CreateCapacityCommitmentRequest::new().set_or_clear_capacity_commitment(None::<CapacityCommitment>);
2696    /// ```
2697    pub fn set_or_clear_capacity_commitment<T>(mut self, v: std::option::Option<T>) -> Self
2698    where
2699        T: std::convert::Into<crate::model::CapacityCommitment>,
2700    {
2701        self.capacity_commitment = v.map(|x| x.into());
2702        self
2703    }
2704
2705    /// Sets the value of [enforce_single_admin_project_per_org][crate::model::CreateCapacityCommitmentRequest::enforce_single_admin_project_per_org].
2706    ///
2707    /// # Example
2708    /// ```ignore,no_run
2709    /// # use google_cloud_bigquery_reservation_v1::model::CreateCapacityCommitmentRequest;
2710    /// let x = CreateCapacityCommitmentRequest::new().set_enforce_single_admin_project_per_org(true);
2711    /// ```
2712    pub fn set_enforce_single_admin_project_per_org<T: std::convert::Into<bool>>(
2713        mut self,
2714        v: T,
2715    ) -> Self {
2716        self.enforce_single_admin_project_per_org = v.into();
2717        self
2718    }
2719
2720    /// Sets the value of [capacity_commitment_id][crate::model::CreateCapacityCommitmentRequest::capacity_commitment_id].
2721    ///
2722    /// # Example
2723    /// ```ignore,no_run
2724    /// # use google_cloud_bigquery_reservation_v1::model::CreateCapacityCommitmentRequest;
2725    /// let x = CreateCapacityCommitmentRequest::new().set_capacity_commitment_id("example");
2726    /// ```
2727    pub fn set_capacity_commitment_id<T: std::convert::Into<std::string::String>>(
2728        mut self,
2729        v: T,
2730    ) -> Self {
2731        self.capacity_commitment_id = v.into();
2732        self
2733    }
2734}
2735
2736impl wkt::message::Message for CreateCapacityCommitmentRequest {
2737    fn typename() -> &'static str {
2738        "type.googleapis.com/google.cloud.bigquery.reservation.v1.CreateCapacityCommitmentRequest"
2739    }
2740}
2741
2742/// The request for
2743/// [ReservationService.ListCapacityCommitments][google.cloud.bigquery.reservation.v1.ReservationService.ListCapacityCommitments].
2744///
2745/// [google.cloud.bigquery.reservation.v1.ReservationService.ListCapacityCommitments]: crate::client::ReservationService::list_capacity_commitments
2746#[derive(Clone, Default, PartialEq)]
2747#[non_exhaustive]
2748pub struct ListCapacityCommitmentsRequest {
2749    /// Required. Resource name of the parent reservation. E.g.,
2750    /// `projects/myproject/locations/US`
2751    pub parent: std::string::String,
2752
2753    /// The maximum number of items to return.
2754    pub page_size: i32,
2755
2756    /// The next_page_token value returned from a previous List request, if any.
2757    pub page_token: std::string::String,
2758
2759    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2760}
2761
2762impl ListCapacityCommitmentsRequest {
2763    /// Creates a new default instance.
2764    pub fn new() -> Self {
2765        std::default::Default::default()
2766    }
2767
2768    /// Sets the value of [parent][crate::model::ListCapacityCommitmentsRequest::parent].
2769    ///
2770    /// # Example
2771    /// ```ignore,no_run
2772    /// # use google_cloud_bigquery_reservation_v1::model::ListCapacityCommitmentsRequest;
2773    /// # let project_id = "project_id";
2774    /// # let location_id = "location_id";
2775    /// let x = ListCapacityCommitmentsRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
2776    /// ```
2777    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2778        self.parent = v.into();
2779        self
2780    }
2781
2782    /// Sets the value of [page_size][crate::model::ListCapacityCommitmentsRequest::page_size].
2783    ///
2784    /// # Example
2785    /// ```ignore,no_run
2786    /// # use google_cloud_bigquery_reservation_v1::model::ListCapacityCommitmentsRequest;
2787    /// let x = ListCapacityCommitmentsRequest::new().set_page_size(42);
2788    /// ```
2789    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2790        self.page_size = v.into();
2791        self
2792    }
2793
2794    /// Sets the value of [page_token][crate::model::ListCapacityCommitmentsRequest::page_token].
2795    ///
2796    /// # Example
2797    /// ```ignore,no_run
2798    /// # use google_cloud_bigquery_reservation_v1::model::ListCapacityCommitmentsRequest;
2799    /// let x = ListCapacityCommitmentsRequest::new().set_page_token("example");
2800    /// ```
2801    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2802        self.page_token = v.into();
2803        self
2804    }
2805}
2806
2807impl wkt::message::Message for ListCapacityCommitmentsRequest {
2808    fn typename() -> &'static str {
2809        "type.googleapis.com/google.cloud.bigquery.reservation.v1.ListCapacityCommitmentsRequest"
2810    }
2811}
2812
2813/// The response for
2814/// [ReservationService.ListCapacityCommitments][google.cloud.bigquery.reservation.v1.ReservationService.ListCapacityCommitments].
2815///
2816/// [google.cloud.bigquery.reservation.v1.ReservationService.ListCapacityCommitments]: crate::client::ReservationService::list_capacity_commitments
2817#[derive(Clone, Default, PartialEq)]
2818#[non_exhaustive]
2819pub struct ListCapacityCommitmentsResponse {
2820    /// List of capacity commitments visible to the user.
2821    pub capacity_commitments: std::vec::Vec<crate::model::CapacityCommitment>,
2822
2823    /// Token to retrieve the next page of results, or empty if there are no
2824    /// more results in the list.
2825    pub next_page_token: std::string::String,
2826
2827    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2828}
2829
2830impl ListCapacityCommitmentsResponse {
2831    /// Creates a new default instance.
2832    pub fn new() -> Self {
2833        std::default::Default::default()
2834    }
2835
2836    /// Sets the value of [capacity_commitments][crate::model::ListCapacityCommitmentsResponse::capacity_commitments].
2837    ///
2838    /// # Example
2839    /// ```ignore,no_run
2840    /// # use google_cloud_bigquery_reservation_v1::model::ListCapacityCommitmentsResponse;
2841    /// use google_cloud_bigquery_reservation_v1::model::CapacityCommitment;
2842    /// let x = ListCapacityCommitmentsResponse::new()
2843    ///     .set_capacity_commitments([
2844    ///         CapacityCommitment::default()/* use setters */,
2845    ///         CapacityCommitment::default()/* use (different) setters */,
2846    ///     ]);
2847    /// ```
2848    pub fn set_capacity_commitments<T, V>(mut self, v: T) -> Self
2849    where
2850        T: std::iter::IntoIterator<Item = V>,
2851        V: std::convert::Into<crate::model::CapacityCommitment>,
2852    {
2853        use std::iter::Iterator;
2854        self.capacity_commitments = v.into_iter().map(|i| i.into()).collect();
2855        self
2856    }
2857
2858    /// Sets the value of [next_page_token][crate::model::ListCapacityCommitmentsResponse::next_page_token].
2859    ///
2860    /// # Example
2861    /// ```ignore,no_run
2862    /// # use google_cloud_bigquery_reservation_v1::model::ListCapacityCommitmentsResponse;
2863    /// let x = ListCapacityCommitmentsResponse::new().set_next_page_token("example");
2864    /// ```
2865    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2866        self.next_page_token = v.into();
2867        self
2868    }
2869}
2870
2871impl wkt::message::Message for ListCapacityCommitmentsResponse {
2872    fn typename() -> &'static str {
2873        "type.googleapis.com/google.cloud.bigquery.reservation.v1.ListCapacityCommitmentsResponse"
2874    }
2875}
2876
2877#[doc(hidden)]
2878impl google_cloud_gax::paginator::internal::PageableResponse for ListCapacityCommitmentsResponse {
2879    type PageItem = crate::model::CapacityCommitment;
2880
2881    fn items(self) -> std::vec::Vec<Self::PageItem> {
2882        self.capacity_commitments
2883    }
2884
2885    fn next_page_token(&self) -> std::string::String {
2886        use std::clone::Clone;
2887        self.next_page_token.clone()
2888    }
2889}
2890
2891/// The request for
2892/// [ReservationService.GetCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.GetCapacityCommitment].
2893///
2894/// [google.cloud.bigquery.reservation.v1.ReservationService.GetCapacityCommitment]: crate::client::ReservationService::get_capacity_commitment
2895#[derive(Clone, Default, PartialEq)]
2896#[non_exhaustive]
2897pub struct GetCapacityCommitmentRequest {
2898    /// Required. Resource name of the capacity commitment to retrieve. E.g.,
2899    /// `projects/myproject/locations/US/capacityCommitments/123`
2900    pub name: std::string::String,
2901
2902    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2903}
2904
2905impl GetCapacityCommitmentRequest {
2906    /// Creates a new default instance.
2907    pub fn new() -> Self {
2908        std::default::Default::default()
2909    }
2910
2911    /// Sets the value of [name][crate::model::GetCapacityCommitmentRequest::name].
2912    ///
2913    /// # Example
2914    /// ```ignore,no_run
2915    /// # use google_cloud_bigquery_reservation_v1::model::GetCapacityCommitmentRequest;
2916    /// # let project_id = "project_id";
2917    /// # let location_id = "location_id";
2918    /// # let capacity_commitment_id = "capacity_commitment_id";
2919    /// let x = GetCapacityCommitmentRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/capacityCommitments/{capacity_commitment_id}"));
2920    /// ```
2921    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2922        self.name = v.into();
2923        self
2924    }
2925}
2926
2927impl wkt::message::Message for GetCapacityCommitmentRequest {
2928    fn typename() -> &'static str {
2929        "type.googleapis.com/google.cloud.bigquery.reservation.v1.GetCapacityCommitmentRequest"
2930    }
2931}
2932
2933/// The request for
2934/// [ReservationService.DeleteCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.DeleteCapacityCommitment].
2935///
2936/// [google.cloud.bigquery.reservation.v1.ReservationService.DeleteCapacityCommitment]: crate::client::ReservationService::delete_capacity_commitment
2937#[derive(Clone, Default, PartialEq)]
2938#[non_exhaustive]
2939pub struct DeleteCapacityCommitmentRequest {
2940    /// Required. Resource name of the capacity commitment to delete. E.g.,
2941    /// `projects/myproject/locations/US/capacityCommitments/123`
2942    pub name: std::string::String,
2943
2944    /// Can be used to force delete commitments even if assignments exist. Deleting
2945    /// commitments with assignments may cause queries to fail if they no longer
2946    /// have access to slots.
2947    pub force: bool,
2948
2949    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2950}
2951
2952impl DeleteCapacityCommitmentRequest {
2953    /// Creates a new default instance.
2954    pub fn new() -> Self {
2955        std::default::Default::default()
2956    }
2957
2958    /// Sets the value of [name][crate::model::DeleteCapacityCommitmentRequest::name].
2959    ///
2960    /// # Example
2961    /// ```ignore,no_run
2962    /// # use google_cloud_bigquery_reservation_v1::model::DeleteCapacityCommitmentRequest;
2963    /// # let project_id = "project_id";
2964    /// # let location_id = "location_id";
2965    /// # let capacity_commitment_id = "capacity_commitment_id";
2966    /// let x = DeleteCapacityCommitmentRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/capacityCommitments/{capacity_commitment_id}"));
2967    /// ```
2968    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2969        self.name = v.into();
2970        self
2971    }
2972
2973    /// Sets the value of [force][crate::model::DeleteCapacityCommitmentRequest::force].
2974    ///
2975    /// # Example
2976    /// ```ignore,no_run
2977    /// # use google_cloud_bigquery_reservation_v1::model::DeleteCapacityCommitmentRequest;
2978    /// let x = DeleteCapacityCommitmentRequest::new().set_force(true);
2979    /// ```
2980    pub fn set_force<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2981        self.force = v.into();
2982        self
2983    }
2984}
2985
2986impl wkt::message::Message for DeleteCapacityCommitmentRequest {
2987    fn typename() -> &'static str {
2988        "type.googleapis.com/google.cloud.bigquery.reservation.v1.DeleteCapacityCommitmentRequest"
2989    }
2990}
2991
2992/// The request for
2993/// [ReservationService.UpdateCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.UpdateCapacityCommitment].
2994///
2995/// [google.cloud.bigquery.reservation.v1.ReservationService.UpdateCapacityCommitment]: crate::client::ReservationService::update_capacity_commitment
2996#[derive(Clone, Default, PartialEq)]
2997#[non_exhaustive]
2998pub struct UpdateCapacityCommitmentRequest {
2999    /// Content of the capacity commitment to update.
3000    pub capacity_commitment: std::option::Option<crate::model::CapacityCommitment>,
3001
3002    /// Standard field mask for the set of fields to be updated.
3003    pub update_mask: std::option::Option<wkt::FieldMask>,
3004
3005    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3006}
3007
3008impl UpdateCapacityCommitmentRequest {
3009    /// Creates a new default instance.
3010    pub fn new() -> Self {
3011        std::default::Default::default()
3012    }
3013
3014    /// Sets the value of [capacity_commitment][crate::model::UpdateCapacityCommitmentRequest::capacity_commitment].
3015    ///
3016    /// # Example
3017    /// ```ignore,no_run
3018    /// # use google_cloud_bigquery_reservation_v1::model::UpdateCapacityCommitmentRequest;
3019    /// use google_cloud_bigquery_reservation_v1::model::CapacityCommitment;
3020    /// let x = UpdateCapacityCommitmentRequest::new().set_capacity_commitment(CapacityCommitment::default()/* use setters */);
3021    /// ```
3022    pub fn set_capacity_commitment<T>(mut self, v: T) -> Self
3023    where
3024        T: std::convert::Into<crate::model::CapacityCommitment>,
3025    {
3026        self.capacity_commitment = std::option::Option::Some(v.into());
3027        self
3028    }
3029
3030    /// Sets or clears the value of [capacity_commitment][crate::model::UpdateCapacityCommitmentRequest::capacity_commitment].
3031    ///
3032    /// # Example
3033    /// ```ignore,no_run
3034    /// # use google_cloud_bigquery_reservation_v1::model::UpdateCapacityCommitmentRequest;
3035    /// use google_cloud_bigquery_reservation_v1::model::CapacityCommitment;
3036    /// let x = UpdateCapacityCommitmentRequest::new().set_or_clear_capacity_commitment(Some(CapacityCommitment::default()/* use setters */));
3037    /// let x = UpdateCapacityCommitmentRequest::new().set_or_clear_capacity_commitment(None::<CapacityCommitment>);
3038    /// ```
3039    pub fn set_or_clear_capacity_commitment<T>(mut self, v: std::option::Option<T>) -> Self
3040    where
3041        T: std::convert::Into<crate::model::CapacityCommitment>,
3042    {
3043        self.capacity_commitment = v.map(|x| x.into());
3044        self
3045    }
3046
3047    /// Sets the value of [update_mask][crate::model::UpdateCapacityCommitmentRequest::update_mask].
3048    ///
3049    /// # Example
3050    /// ```ignore,no_run
3051    /// # use google_cloud_bigquery_reservation_v1::model::UpdateCapacityCommitmentRequest;
3052    /// use wkt::FieldMask;
3053    /// let x = UpdateCapacityCommitmentRequest::new().set_update_mask(FieldMask::default()/* use setters */);
3054    /// ```
3055    pub fn set_update_mask<T>(mut self, v: T) -> Self
3056    where
3057        T: std::convert::Into<wkt::FieldMask>,
3058    {
3059        self.update_mask = std::option::Option::Some(v.into());
3060        self
3061    }
3062
3063    /// Sets or clears the value of [update_mask][crate::model::UpdateCapacityCommitmentRequest::update_mask].
3064    ///
3065    /// # Example
3066    /// ```ignore,no_run
3067    /// # use google_cloud_bigquery_reservation_v1::model::UpdateCapacityCommitmentRequest;
3068    /// use wkt::FieldMask;
3069    /// let x = UpdateCapacityCommitmentRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
3070    /// let x = UpdateCapacityCommitmentRequest::new().set_or_clear_update_mask(None::<FieldMask>);
3071    /// ```
3072    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3073    where
3074        T: std::convert::Into<wkt::FieldMask>,
3075    {
3076        self.update_mask = v.map(|x| x.into());
3077        self
3078    }
3079}
3080
3081impl wkt::message::Message for UpdateCapacityCommitmentRequest {
3082    fn typename() -> &'static str {
3083        "type.googleapis.com/google.cloud.bigquery.reservation.v1.UpdateCapacityCommitmentRequest"
3084    }
3085}
3086
3087/// The request for
3088/// [ReservationService.SplitCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.SplitCapacityCommitment].
3089///
3090/// [google.cloud.bigquery.reservation.v1.ReservationService.SplitCapacityCommitment]: crate::client::ReservationService::split_capacity_commitment
3091#[derive(Clone, Default, PartialEq)]
3092#[non_exhaustive]
3093pub struct SplitCapacityCommitmentRequest {
3094    /// Required. The resource name e.g.,:
3095    /// `projects/myproject/locations/US/capacityCommitments/123`
3096    pub name: std::string::String,
3097
3098    /// Number of slots in the capacity commitment after the split.
3099    pub slot_count: i64,
3100
3101    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3102}
3103
3104impl SplitCapacityCommitmentRequest {
3105    /// Creates a new default instance.
3106    pub fn new() -> Self {
3107        std::default::Default::default()
3108    }
3109
3110    /// Sets the value of [name][crate::model::SplitCapacityCommitmentRequest::name].
3111    ///
3112    /// # Example
3113    /// ```ignore,no_run
3114    /// # use google_cloud_bigquery_reservation_v1::model::SplitCapacityCommitmentRequest;
3115    /// # let project_id = "project_id";
3116    /// # let location_id = "location_id";
3117    /// # let capacity_commitment_id = "capacity_commitment_id";
3118    /// let x = SplitCapacityCommitmentRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/capacityCommitments/{capacity_commitment_id}"));
3119    /// ```
3120    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3121        self.name = v.into();
3122        self
3123    }
3124
3125    /// Sets the value of [slot_count][crate::model::SplitCapacityCommitmentRequest::slot_count].
3126    ///
3127    /// # Example
3128    /// ```ignore,no_run
3129    /// # use google_cloud_bigquery_reservation_v1::model::SplitCapacityCommitmentRequest;
3130    /// let x = SplitCapacityCommitmentRequest::new().set_slot_count(42);
3131    /// ```
3132    pub fn set_slot_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
3133        self.slot_count = v.into();
3134        self
3135    }
3136}
3137
3138impl wkt::message::Message for SplitCapacityCommitmentRequest {
3139    fn typename() -> &'static str {
3140        "type.googleapis.com/google.cloud.bigquery.reservation.v1.SplitCapacityCommitmentRequest"
3141    }
3142}
3143
3144/// The response for
3145/// [ReservationService.SplitCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.SplitCapacityCommitment].
3146///
3147/// [google.cloud.bigquery.reservation.v1.ReservationService.SplitCapacityCommitment]: crate::client::ReservationService::split_capacity_commitment
3148#[derive(Clone, Default, PartialEq)]
3149#[non_exhaustive]
3150pub struct SplitCapacityCommitmentResponse {
3151    /// First capacity commitment, result of a split.
3152    pub first: std::option::Option<crate::model::CapacityCommitment>,
3153
3154    /// Second capacity commitment, result of a split.
3155    pub second: std::option::Option<crate::model::CapacityCommitment>,
3156
3157    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3158}
3159
3160impl SplitCapacityCommitmentResponse {
3161    /// Creates a new default instance.
3162    pub fn new() -> Self {
3163        std::default::Default::default()
3164    }
3165
3166    /// Sets the value of [first][crate::model::SplitCapacityCommitmentResponse::first].
3167    ///
3168    /// # Example
3169    /// ```ignore,no_run
3170    /// # use google_cloud_bigquery_reservation_v1::model::SplitCapacityCommitmentResponse;
3171    /// use google_cloud_bigquery_reservation_v1::model::CapacityCommitment;
3172    /// let x = SplitCapacityCommitmentResponse::new().set_first(CapacityCommitment::default()/* use setters */);
3173    /// ```
3174    pub fn set_first<T>(mut self, v: T) -> Self
3175    where
3176        T: std::convert::Into<crate::model::CapacityCommitment>,
3177    {
3178        self.first = std::option::Option::Some(v.into());
3179        self
3180    }
3181
3182    /// Sets or clears the value of [first][crate::model::SplitCapacityCommitmentResponse::first].
3183    ///
3184    /// # Example
3185    /// ```ignore,no_run
3186    /// # use google_cloud_bigquery_reservation_v1::model::SplitCapacityCommitmentResponse;
3187    /// use google_cloud_bigquery_reservation_v1::model::CapacityCommitment;
3188    /// let x = SplitCapacityCommitmentResponse::new().set_or_clear_first(Some(CapacityCommitment::default()/* use setters */));
3189    /// let x = SplitCapacityCommitmentResponse::new().set_or_clear_first(None::<CapacityCommitment>);
3190    /// ```
3191    pub fn set_or_clear_first<T>(mut self, v: std::option::Option<T>) -> Self
3192    where
3193        T: std::convert::Into<crate::model::CapacityCommitment>,
3194    {
3195        self.first = v.map(|x| x.into());
3196        self
3197    }
3198
3199    /// Sets the value of [second][crate::model::SplitCapacityCommitmentResponse::second].
3200    ///
3201    /// # Example
3202    /// ```ignore,no_run
3203    /// # use google_cloud_bigquery_reservation_v1::model::SplitCapacityCommitmentResponse;
3204    /// use google_cloud_bigquery_reservation_v1::model::CapacityCommitment;
3205    /// let x = SplitCapacityCommitmentResponse::new().set_second(CapacityCommitment::default()/* use setters */);
3206    /// ```
3207    pub fn set_second<T>(mut self, v: T) -> Self
3208    where
3209        T: std::convert::Into<crate::model::CapacityCommitment>,
3210    {
3211        self.second = std::option::Option::Some(v.into());
3212        self
3213    }
3214
3215    /// Sets or clears the value of [second][crate::model::SplitCapacityCommitmentResponse::second].
3216    ///
3217    /// # Example
3218    /// ```ignore,no_run
3219    /// # use google_cloud_bigquery_reservation_v1::model::SplitCapacityCommitmentResponse;
3220    /// use google_cloud_bigquery_reservation_v1::model::CapacityCommitment;
3221    /// let x = SplitCapacityCommitmentResponse::new().set_or_clear_second(Some(CapacityCommitment::default()/* use setters */));
3222    /// let x = SplitCapacityCommitmentResponse::new().set_or_clear_second(None::<CapacityCommitment>);
3223    /// ```
3224    pub fn set_or_clear_second<T>(mut self, v: std::option::Option<T>) -> Self
3225    where
3226        T: std::convert::Into<crate::model::CapacityCommitment>,
3227    {
3228        self.second = v.map(|x| x.into());
3229        self
3230    }
3231}
3232
3233impl wkt::message::Message for SplitCapacityCommitmentResponse {
3234    fn typename() -> &'static str {
3235        "type.googleapis.com/google.cloud.bigquery.reservation.v1.SplitCapacityCommitmentResponse"
3236    }
3237}
3238
3239/// The request for
3240/// [ReservationService.MergeCapacityCommitments][google.cloud.bigquery.reservation.v1.ReservationService.MergeCapacityCommitments].
3241///
3242/// [google.cloud.bigquery.reservation.v1.ReservationService.MergeCapacityCommitments]: crate::client::ReservationService::merge_capacity_commitments
3243#[derive(Clone, Default, PartialEq)]
3244#[non_exhaustive]
3245pub struct MergeCapacityCommitmentsRequest {
3246    /// Parent resource that identifies admin project and location e.g.,
3247    /// `projects/myproject/locations/us`
3248    pub parent: std::string::String,
3249
3250    /// Ids of capacity commitments to merge.
3251    /// These capacity commitments must exist under admin project and location
3252    /// specified in the parent.
3253    /// ID is the last portion of capacity commitment name e.g., 'abc' for
3254    /// projects/myproject/locations/US/capacityCommitments/abc
3255    pub capacity_commitment_ids: std::vec::Vec<std::string::String>,
3256
3257    /// Optional. The optional resulting capacity commitment ID. Capacity
3258    /// commitment name will be generated automatically if this field is empty.
3259    /// This field must only contain lower case alphanumeric characters or dashes.
3260    /// The first and last character cannot be a dash. Max length is 64 characters.
3261    pub capacity_commitment_id: std::string::String,
3262
3263    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3264}
3265
3266impl MergeCapacityCommitmentsRequest {
3267    /// Creates a new default instance.
3268    pub fn new() -> Self {
3269        std::default::Default::default()
3270    }
3271
3272    /// Sets the value of [parent][crate::model::MergeCapacityCommitmentsRequest::parent].
3273    ///
3274    /// # Example
3275    /// ```ignore,no_run
3276    /// # use google_cloud_bigquery_reservation_v1::model::MergeCapacityCommitmentsRequest;
3277    /// # let project_id = "project_id";
3278    /// # let location_id = "location_id";
3279    /// let x = MergeCapacityCommitmentsRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
3280    /// ```
3281    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3282        self.parent = v.into();
3283        self
3284    }
3285
3286    /// Sets the value of [capacity_commitment_ids][crate::model::MergeCapacityCommitmentsRequest::capacity_commitment_ids].
3287    ///
3288    /// # Example
3289    /// ```ignore,no_run
3290    /// # use google_cloud_bigquery_reservation_v1::model::MergeCapacityCommitmentsRequest;
3291    /// let x = MergeCapacityCommitmentsRequest::new().set_capacity_commitment_ids(["a", "b", "c"]);
3292    /// ```
3293    pub fn set_capacity_commitment_ids<T, V>(mut self, v: T) -> Self
3294    where
3295        T: std::iter::IntoIterator<Item = V>,
3296        V: std::convert::Into<std::string::String>,
3297    {
3298        use std::iter::Iterator;
3299        self.capacity_commitment_ids = v.into_iter().map(|i| i.into()).collect();
3300        self
3301    }
3302
3303    /// Sets the value of [capacity_commitment_id][crate::model::MergeCapacityCommitmentsRequest::capacity_commitment_id].
3304    ///
3305    /// # Example
3306    /// ```ignore,no_run
3307    /// # use google_cloud_bigquery_reservation_v1::model::MergeCapacityCommitmentsRequest;
3308    /// let x = MergeCapacityCommitmentsRequest::new().set_capacity_commitment_id("example");
3309    /// ```
3310    pub fn set_capacity_commitment_id<T: std::convert::Into<std::string::String>>(
3311        mut self,
3312        v: T,
3313    ) -> Self {
3314        self.capacity_commitment_id = v.into();
3315        self
3316    }
3317}
3318
3319impl wkt::message::Message for MergeCapacityCommitmentsRequest {
3320    fn typename() -> &'static str {
3321        "type.googleapis.com/google.cloud.bigquery.reservation.v1.MergeCapacityCommitmentsRequest"
3322    }
3323}
3324
3325/// An assignment allows a project to submit jobs
3326/// of a certain type using slots from the specified reservation.
3327#[derive(Clone, Default, PartialEq)]
3328#[non_exhaustive]
3329pub struct Assignment {
3330    /// Output only. Name of the resource. E.g.:
3331    /// `projects/myproject/locations/US/reservations/team1-prod/assignments/123`.
3332    /// The assignment_id must only contain lower case alphanumeric characters or
3333    /// dashes and the max length is 64 characters.
3334    pub name: std::string::String,
3335
3336    /// Optional. The resource which will use the reservation. E.g.
3337    /// `projects/myproject`, `folders/123`, or `organizations/456`.
3338    pub assignee: std::string::String,
3339
3340    /// Optional. Which type of jobs will use the reservation.
3341    pub job_type: crate::model::assignment::JobType,
3342
3343    /// Output only. State of the assignment.
3344    pub state: crate::model::assignment::State,
3345
3346    /// Optional. Deprecated: "Gemini in BigQuery" is now available by
3347    /// default for all BigQuery editions and should not be explicitly set.
3348    /// Controls if "Gemini in BigQuery"
3349    /// (<https://cloud.google.com/gemini/docs/bigquery/overview>) features should be
3350    /// enabled for this reservation assignment.
3351    #[deprecated]
3352    pub enable_gemini_in_bigquery: bool,
3353
3354    /// Optional. The scheduling policy to use for jobs and queries of this
3355    /// assignee when running under the associated reservation. The scheduling
3356    /// policy controls how the reservation's resources are distributed. This
3357    /// overrides the default scheduling policy specified on the reservation.
3358    ///
3359    /// This feature is not yet generally available.
3360    pub scheduling_policy: std::option::Option<crate::model::SchedulingPolicy>,
3361
3362    /// Optional. Represents the principal for this assignment. If not empty, jobs
3363    /// run by this principal will utilize the associated reservation. Otherwise,
3364    /// jobs will fall back to using the reservation assigned to the project,
3365    /// folder, or organization (in that order). If no reservation is assigned at
3366    /// any of these levels, on-demand capacity will be used.
3367    ///
3368    /// The supported formats are:
3369    ///
3370    /// * `principal://goog/subject/USER_EMAIL_ADDRESS` for users,
3371    /// * `principal://iam.googleapis.com/projects/-/serviceAccounts/SA_EMAIL_ADDRESS`
3372    ///   for service accounts,
3373    /// * `principal://iam.googleapis.com/projects/PROJECT_NUMBER/locations/global/workloadIdentityPools/POOL_ID/subject/SUBJECT_ID`
3374    ///   for workload identity pool identities.
3375    /// * The special value `unknown_or_deleted_user` represents principals which
3376    ///   cannot be read from the user info service, for example deleted users.
3377    pub principal: std::string::String,
3378
3379    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3380}
3381
3382impl Assignment {
3383    /// Creates a new default instance.
3384    pub fn new() -> Self {
3385        std::default::Default::default()
3386    }
3387
3388    /// Sets the value of [name][crate::model::Assignment::name].
3389    ///
3390    /// # Example
3391    /// ```ignore,no_run
3392    /// # use google_cloud_bigquery_reservation_v1::model::Assignment;
3393    /// # let project_id = "project_id";
3394    /// # let location_id = "location_id";
3395    /// # let reservation_id = "reservation_id";
3396    /// # let assignment_id = "assignment_id";
3397    /// let x = Assignment::new().set_name(format!("projects/{project_id}/locations/{location_id}/reservations/{reservation_id}/assignments/{assignment_id}"));
3398    /// ```
3399    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3400        self.name = v.into();
3401        self
3402    }
3403
3404    /// Sets the value of [assignee][crate::model::Assignment::assignee].
3405    ///
3406    /// # Example
3407    /// ```ignore,no_run
3408    /// # use google_cloud_bigquery_reservation_v1::model::Assignment;
3409    /// let x = Assignment::new().set_assignee("example");
3410    /// ```
3411    pub fn set_assignee<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3412        self.assignee = v.into();
3413        self
3414    }
3415
3416    /// Sets the value of [job_type][crate::model::Assignment::job_type].
3417    ///
3418    /// # Example
3419    /// ```ignore,no_run
3420    /// # use google_cloud_bigquery_reservation_v1::model::Assignment;
3421    /// use google_cloud_bigquery_reservation_v1::model::assignment::JobType;
3422    /// let x0 = Assignment::new().set_job_type(JobType::Pipeline);
3423    /// let x1 = Assignment::new().set_job_type(JobType::Query);
3424    /// let x2 = Assignment::new().set_job_type(JobType::MlExternal);
3425    /// ```
3426    pub fn set_job_type<T: std::convert::Into<crate::model::assignment::JobType>>(
3427        mut self,
3428        v: T,
3429    ) -> Self {
3430        self.job_type = v.into();
3431        self
3432    }
3433
3434    /// Sets the value of [state][crate::model::Assignment::state].
3435    ///
3436    /// # Example
3437    /// ```ignore,no_run
3438    /// # use google_cloud_bigquery_reservation_v1::model::Assignment;
3439    /// use google_cloud_bigquery_reservation_v1::model::assignment::State;
3440    /// let x0 = Assignment::new().set_state(State::Pending);
3441    /// let x1 = Assignment::new().set_state(State::Active);
3442    /// ```
3443    pub fn set_state<T: std::convert::Into<crate::model::assignment::State>>(
3444        mut self,
3445        v: T,
3446    ) -> Self {
3447        self.state = v.into();
3448        self
3449    }
3450
3451    /// Sets the value of [enable_gemini_in_bigquery][crate::model::Assignment::enable_gemini_in_bigquery].
3452    ///
3453    /// # Example
3454    /// ```ignore,no_run
3455    /// # use google_cloud_bigquery_reservation_v1::model::Assignment;
3456    /// let x = Assignment::new().set_enable_gemini_in_bigquery(true);
3457    /// ```
3458    #[deprecated]
3459    pub fn set_enable_gemini_in_bigquery<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3460        self.enable_gemini_in_bigquery = v.into();
3461        self
3462    }
3463
3464    /// Sets the value of [scheduling_policy][crate::model::Assignment::scheduling_policy].
3465    ///
3466    /// # Example
3467    /// ```ignore,no_run
3468    /// # use google_cloud_bigquery_reservation_v1::model::Assignment;
3469    /// use google_cloud_bigquery_reservation_v1::model::SchedulingPolicy;
3470    /// let x = Assignment::new().set_scheduling_policy(SchedulingPolicy::default()/* use setters */);
3471    /// ```
3472    pub fn set_scheduling_policy<T>(mut self, v: T) -> Self
3473    where
3474        T: std::convert::Into<crate::model::SchedulingPolicy>,
3475    {
3476        self.scheduling_policy = std::option::Option::Some(v.into());
3477        self
3478    }
3479
3480    /// Sets or clears the value of [scheduling_policy][crate::model::Assignment::scheduling_policy].
3481    ///
3482    /// # Example
3483    /// ```ignore,no_run
3484    /// # use google_cloud_bigquery_reservation_v1::model::Assignment;
3485    /// use google_cloud_bigquery_reservation_v1::model::SchedulingPolicy;
3486    /// let x = Assignment::new().set_or_clear_scheduling_policy(Some(SchedulingPolicy::default()/* use setters */));
3487    /// let x = Assignment::new().set_or_clear_scheduling_policy(None::<SchedulingPolicy>);
3488    /// ```
3489    pub fn set_or_clear_scheduling_policy<T>(mut self, v: std::option::Option<T>) -> Self
3490    where
3491        T: std::convert::Into<crate::model::SchedulingPolicy>,
3492    {
3493        self.scheduling_policy = v.map(|x| x.into());
3494        self
3495    }
3496
3497    /// Sets the value of [principal][crate::model::Assignment::principal].
3498    ///
3499    /// # Example
3500    /// ```ignore,no_run
3501    /// # use google_cloud_bigquery_reservation_v1::model::Assignment;
3502    /// let x = Assignment::new().set_principal("example");
3503    /// ```
3504    pub fn set_principal<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3505        self.principal = v.into();
3506        self
3507    }
3508}
3509
3510impl wkt::message::Message for Assignment {
3511    fn typename() -> &'static str {
3512        "type.googleapis.com/google.cloud.bigquery.reservation.v1.Assignment"
3513    }
3514}
3515
3516/// Defines additional types related to [Assignment].
3517pub mod assignment {
3518    #[allow(unused_imports)]
3519    use super::*;
3520
3521    /// Types of job, which could be specified when using the reservation.
3522    ///
3523    /// # Working with unknown values
3524    ///
3525    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3526    /// additional enum variants at any time. Adding new variants is not considered
3527    /// a breaking change. Applications should write their code in anticipation of:
3528    ///
3529    /// - New values appearing in future releases of the client library, **and**
3530    /// - New values received dynamically, without application changes.
3531    ///
3532    /// Please consult the [Working with enums] section in the user guide for some
3533    /// guidelines.
3534    ///
3535    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3536    #[derive(Clone, Debug, PartialEq)]
3537    #[non_exhaustive]
3538    pub enum JobType {
3539        /// Invalid type. Requests with this value will be rejected with
3540        /// error code `google.rpc.Code.INVALID_ARGUMENT`.
3541        Unspecified,
3542        /// Pipeline (load/export) jobs from the project will use the reservation.
3543        Pipeline,
3544        /// Query jobs from the project will use the reservation.
3545        Query,
3546        /// BigQuery ML jobs that use services external to BigQuery for model
3547        /// training. These jobs will not utilize idle slots from other reservations.
3548        MlExternal,
3549        /// Background jobs that BigQuery runs for the customers in the background.
3550        Background,
3551        /// Continuous SQL jobs will use this reservation. Reservations with
3552        /// continuous assignments cannot be mixed with non-continuous assignments.
3553        Continuous,
3554        /// Finer granularity background jobs for capturing changes in a source
3555        /// database and streaming them into BigQuery. Reservations with this job
3556        /// type take priority over a default BACKGROUND reservation assignment (if
3557        /// it exists).
3558        BackgroundChangeDataCapture,
3559        /// Finer granularity background jobs for refreshing cached metadata for
3560        /// BigQuery tables. Reservations with this job type take priority over a
3561        /// default BACKGROUND reservation assignment (if it exists).
3562        BackgroundColumnMetadataIndex,
3563        /// Finer granularity background jobs for refreshing search indexes upon
3564        /// BigQuery table columns. Reservations with this job type
3565        /// take priority over a default BACKGROUND reservation assignment (if it
3566        /// exists).
3567        BackgroundSearchIndexRefresh,
3568        /// If set, the enum was initialized with an unknown value.
3569        ///
3570        /// Applications can examine the value using [JobType::value] or
3571        /// [JobType::name].
3572        UnknownValue(job_type::UnknownValue),
3573    }
3574
3575    #[doc(hidden)]
3576    pub mod job_type {
3577        #[allow(unused_imports)]
3578        use super::*;
3579        #[derive(Clone, Debug, PartialEq)]
3580        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3581    }
3582
3583    impl JobType {
3584        /// Gets the enum value.
3585        ///
3586        /// Returns `None` if the enum contains an unknown value deserialized from
3587        /// the string representation of enums.
3588        pub fn value(&self) -> std::option::Option<i32> {
3589            match self {
3590                Self::Unspecified => std::option::Option::Some(0),
3591                Self::Pipeline => std::option::Option::Some(1),
3592                Self::Query => std::option::Option::Some(2),
3593                Self::MlExternal => std::option::Option::Some(3),
3594                Self::Background => std::option::Option::Some(4),
3595                Self::Continuous => std::option::Option::Some(6),
3596                Self::BackgroundChangeDataCapture => std::option::Option::Some(7),
3597                Self::BackgroundColumnMetadataIndex => std::option::Option::Some(8),
3598                Self::BackgroundSearchIndexRefresh => std::option::Option::Some(9),
3599                Self::UnknownValue(u) => u.0.value(),
3600            }
3601        }
3602
3603        /// Gets the enum value as a string.
3604        ///
3605        /// Returns `None` if the enum contains an unknown value deserialized from
3606        /// the integer representation of enums.
3607        pub fn name(&self) -> std::option::Option<&str> {
3608            match self {
3609                Self::Unspecified => std::option::Option::Some("JOB_TYPE_UNSPECIFIED"),
3610                Self::Pipeline => std::option::Option::Some("PIPELINE"),
3611                Self::Query => std::option::Option::Some("QUERY"),
3612                Self::MlExternal => std::option::Option::Some("ML_EXTERNAL"),
3613                Self::Background => std::option::Option::Some("BACKGROUND"),
3614                Self::Continuous => std::option::Option::Some("CONTINUOUS"),
3615                Self::BackgroundChangeDataCapture => {
3616                    std::option::Option::Some("BACKGROUND_CHANGE_DATA_CAPTURE")
3617                }
3618                Self::BackgroundColumnMetadataIndex => {
3619                    std::option::Option::Some("BACKGROUND_COLUMN_METADATA_INDEX")
3620                }
3621                Self::BackgroundSearchIndexRefresh => {
3622                    std::option::Option::Some("BACKGROUND_SEARCH_INDEX_REFRESH")
3623                }
3624                Self::UnknownValue(u) => u.0.name(),
3625            }
3626        }
3627    }
3628
3629    impl std::default::Default for JobType {
3630        fn default() -> Self {
3631            use std::convert::From;
3632            Self::from(0)
3633        }
3634    }
3635
3636    impl std::fmt::Display for JobType {
3637        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3638            wkt::internal::display_enum(f, self.name(), self.value())
3639        }
3640    }
3641
3642    impl std::convert::From<i32> for JobType {
3643        fn from(value: i32) -> Self {
3644            match value {
3645                0 => Self::Unspecified,
3646                1 => Self::Pipeline,
3647                2 => Self::Query,
3648                3 => Self::MlExternal,
3649                4 => Self::Background,
3650                6 => Self::Continuous,
3651                7 => Self::BackgroundChangeDataCapture,
3652                8 => Self::BackgroundColumnMetadataIndex,
3653                9 => Self::BackgroundSearchIndexRefresh,
3654                _ => Self::UnknownValue(job_type::UnknownValue(
3655                    wkt::internal::UnknownEnumValue::Integer(value),
3656                )),
3657            }
3658        }
3659    }
3660
3661    impl std::convert::From<&str> for JobType {
3662        fn from(value: &str) -> Self {
3663            use std::string::ToString;
3664            match value {
3665                "JOB_TYPE_UNSPECIFIED" => Self::Unspecified,
3666                "PIPELINE" => Self::Pipeline,
3667                "QUERY" => Self::Query,
3668                "ML_EXTERNAL" => Self::MlExternal,
3669                "BACKGROUND" => Self::Background,
3670                "CONTINUOUS" => Self::Continuous,
3671                "BACKGROUND_CHANGE_DATA_CAPTURE" => Self::BackgroundChangeDataCapture,
3672                "BACKGROUND_COLUMN_METADATA_INDEX" => Self::BackgroundColumnMetadataIndex,
3673                "BACKGROUND_SEARCH_INDEX_REFRESH" => Self::BackgroundSearchIndexRefresh,
3674                _ => Self::UnknownValue(job_type::UnknownValue(
3675                    wkt::internal::UnknownEnumValue::String(value.to_string()),
3676                )),
3677            }
3678        }
3679    }
3680
3681    impl serde::ser::Serialize for JobType {
3682        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3683        where
3684            S: serde::Serializer,
3685        {
3686            match self {
3687                Self::Unspecified => serializer.serialize_i32(0),
3688                Self::Pipeline => serializer.serialize_i32(1),
3689                Self::Query => serializer.serialize_i32(2),
3690                Self::MlExternal => serializer.serialize_i32(3),
3691                Self::Background => serializer.serialize_i32(4),
3692                Self::Continuous => serializer.serialize_i32(6),
3693                Self::BackgroundChangeDataCapture => serializer.serialize_i32(7),
3694                Self::BackgroundColumnMetadataIndex => serializer.serialize_i32(8),
3695                Self::BackgroundSearchIndexRefresh => serializer.serialize_i32(9),
3696                Self::UnknownValue(u) => u.0.serialize(serializer),
3697            }
3698        }
3699    }
3700
3701    impl<'de> serde::de::Deserialize<'de> for JobType {
3702        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3703        where
3704            D: serde::Deserializer<'de>,
3705        {
3706            deserializer.deserialize_any(wkt::internal::EnumVisitor::<JobType>::new(
3707                ".google.cloud.bigquery.reservation.v1.Assignment.JobType",
3708            ))
3709        }
3710    }
3711
3712    /// Assignment will remain in PENDING state if no active capacity commitment is
3713    /// present. It will become ACTIVE when some capacity commitment becomes
3714    /// active.
3715    ///
3716    /// # Working with unknown values
3717    ///
3718    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3719    /// additional enum variants at any time. Adding new variants is not considered
3720    /// a breaking change. Applications should write their code in anticipation of:
3721    ///
3722    /// - New values appearing in future releases of the client library, **and**
3723    /// - New values received dynamically, without application changes.
3724    ///
3725    /// Please consult the [Working with enums] section in the user guide for some
3726    /// guidelines.
3727    ///
3728    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3729    #[derive(Clone, Debug, PartialEq)]
3730    #[non_exhaustive]
3731    pub enum State {
3732        /// Invalid state value.
3733        Unspecified,
3734        /// Queries from assignee will be executed as on-demand, if related
3735        /// assignment is pending.
3736        Pending,
3737        /// Assignment is ready.
3738        Active,
3739        /// If set, the enum was initialized with an unknown value.
3740        ///
3741        /// Applications can examine the value using [State::value] or
3742        /// [State::name].
3743        UnknownValue(state::UnknownValue),
3744    }
3745
3746    #[doc(hidden)]
3747    pub mod state {
3748        #[allow(unused_imports)]
3749        use super::*;
3750        #[derive(Clone, Debug, PartialEq)]
3751        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3752    }
3753
3754    impl State {
3755        /// Gets the enum value.
3756        ///
3757        /// Returns `None` if the enum contains an unknown value deserialized from
3758        /// the string representation of enums.
3759        pub fn value(&self) -> std::option::Option<i32> {
3760            match self {
3761                Self::Unspecified => std::option::Option::Some(0),
3762                Self::Pending => std::option::Option::Some(1),
3763                Self::Active => std::option::Option::Some(2),
3764                Self::UnknownValue(u) => u.0.value(),
3765            }
3766        }
3767
3768        /// Gets the enum value as a string.
3769        ///
3770        /// Returns `None` if the enum contains an unknown value deserialized from
3771        /// the integer representation of enums.
3772        pub fn name(&self) -> std::option::Option<&str> {
3773            match self {
3774                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
3775                Self::Pending => std::option::Option::Some("PENDING"),
3776                Self::Active => std::option::Option::Some("ACTIVE"),
3777                Self::UnknownValue(u) => u.0.name(),
3778            }
3779        }
3780    }
3781
3782    impl std::default::Default for State {
3783        fn default() -> Self {
3784            use std::convert::From;
3785            Self::from(0)
3786        }
3787    }
3788
3789    impl std::fmt::Display for State {
3790        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3791            wkt::internal::display_enum(f, self.name(), self.value())
3792        }
3793    }
3794
3795    impl std::convert::From<i32> for State {
3796        fn from(value: i32) -> Self {
3797            match value {
3798                0 => Self::Unspecified,
3799                1 => Self::Pending,
3800                2 => Self::Active,
3801                _ => Self::UnknownValue(state::UnknownValue(
3802                    wkt::internal::UnknownEnumValue::Integer(value),
3803                )),
3804            }
3805        }
3806    }
3807
3808    impl std::convert::From<&str> for State {
3809        fn from(value: &str) -> Self {
3810            use std::string::ToString;
3811            match value {
3812                "STATE_UNSPECIFIED" => Self::Unspecified,
3813                "PENDING" => Self::Pending,
3814                "ACTIVE" => Self::Active,
3815                _ => Self::UnknownValue(state::UnknownValue(
3816                    wkt::internal::UnknownEnumValue::String(value.to_string()),
3817                )),
3818            }
3819        }
3820    }
3821
3822    impl serde::ser::Serialize for State {
3823        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3824        where
3825            S: serde::Serializer,
3826        {
3827            match self {
3828                Self::Unspecified => serializer.serialize_i32(0),
3829                Self::Pending => serializer.serialize_i32(1),
3830                Self::Active => serializer.serialize_i32(2),
3831                Self::UnknownValue(u) => u.0.serialize(serializer),
3832            }
3833        }
3834    }
3835
3836    impl<'de> serde::de::Deserialize<'de> for State {
3837        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3838        where
3839            D: serde::Deserializer<'de>,
3840        {
3841            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
3842                ".google.cloud.bigquery.reservation.v1.Assignment.State",
3843            ))
3844        }
3845    }
3846}
3847
3848/// The request for
3849/// [ReservationService.CreateAssignment][google.cloud.bigquery.reservation.v1.ReservationService.CreateAssignment].
3850/// Note: "bigquery.reservationAssignments.create" permission is required on the
3851/// related assignee.
3852///
3853/// [google.cloud.bigquery.reservation.v1.ReservationService.CreateAssignment]: crate::client::ReservationService::create_assignment
3854#[derive(Clone, Default, PartialEq)]
3855#[non_exhaustive]
3856pub struct CreateAssignmentRequest {
3857    /// Required. The parent resource name of the assignment
3858    /// E.g. `projects/myproject/locations/US/reservations/team1-prod`
3859    pub parent: std::string::String,
3860
3861    /// Assignment resource to create.
3862    pub assignment: std::option::Option<crate::model::Assignment>,
3863
3864    /// The optional assignment ID. Assignment name will be generated automatically
3865    /// if this field is empty.
3866    /// This field must only contain lower case alphanumeric characters or dashes.
3867    /// Max length is 64 characters.
3868    pub assignment_id: std::string::String,
3869
3870    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3871}
3872
3873impl CreateAssignmentRequest {
3874    /// Creates a new default instance.
3875    pub fn new() -> Self {
3876        std::default::Default::default()
3877    }
3878
3879    /// Sets the value of [parent][crate::model::CreateAssignmentRequest::parent].
3880    ///
3881    /// # Example
3882    /// ```ignore,no_run
3883    /// # use google_cloud_bigquery_reservation_v1::model::CreateAssignmentRequest;
3884    /// # let project_id = "project_id";
3885    /// # let location_id = "location_id";
3886    /// # let reservation_id = "reservation_id";
3887    /// let x = CreateAssignmentRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/reservations/{reservation_id}"));
3888    /// ```
3889    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3890        self.parent = v.into();
3891        self
3892    }
3893
3894    /// Sets the value of [assignment][crate::model::CreateAssignmentRequest::assignment].
3895    ///
3896    /// # Example
3897    /// ```ignore,no_run
3898    /// # use google_cloud_bigquery_reservation_v1::model::CreateAssignmentRequest;
3899    /// use google_cloud_bigquery_reservation_v1::model::Assignment;
3900    /// let x = CreateAssignmentRequest::new().set_assignment(Assignment::default()/* use setters */);
3901    /// ```
3902    pub fn set_assignment<T>(mut self, v: T) -> Self
3903    where
3904        T: std::convert::Into<crate::model::Assignment>,
3905    {
3906        self.assignment = std::option::Option::Some(v.into());
3907        self
3908    }
3909
3910    /// Sets or clears the value of [assignment][crate::model::CreateAssignmentRequest::assignment].
3911    ///
3912    /// # Example
3913    /// ```ignore,no_run
3914    /// # use google_cloud_bigquery_reservation_v1::model::CreateAssignmentRequest;
3915    /// use google_cloud_bigquery_reservation_v1::model::Assignment;
3916    /// let x = CreateAssignmentRequest::new().set_or_clear_assignment(Some(Assignment::default()/* use setters */));
3917    /// let x = CreateAssignmentRequest::new().set_or_clear_assignment(None::<Assignment>);
3918    /// ```
3919    pub fn set_or_clear_assignment<T>(mut self, v: std::option::Option<T>) -> Self
3920    where
3921        T: std::convert::Into<crate::model::Assignment>,
3922    {
3923        self.assignment = v.map(|x| x.into());
3924        self
3925    }
3926
3927    /// Sets the value of [assignment_id][crate::model::CreateAssignmentRequest::assignment_id].
3928    ///
3929    /// # Example
3930    /// ```ignore,no_run
3931    /// # use google_cloud_bigquery_reservation_v1::model::CreateAssignmentRequest;
3932    /// let x = CreateAssignmentRequest::new().set_assignment_id("example");
3933    /// ```
3934    pub fn set_assignment_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3935        self.assignment_id = v.into();
3936        self
3937    }
3938}
3939
3940impl wkt::message::Message for CreateAssignmentRequest {
3941    fn typename() -> &'static str {
3942        "type.googleapis.com/google.cloud.bigquery.reservation.v1.CreateAssignmentRequest"
3943    }
3944}
3945
3946/// The request for
3947/// [ReservationService.ListAssignments][google.cloud.bigquery.reservation.v1.ReservationService.ListAssignments].
3948///
3949/// [google.cloud.bigquery.reservation.v1.ReservationService.ListAssignments]: crate::client::ReservationService::list_assignments
3950#[derive(Clone, Default, PartialEq)]
3951#[non_exhaustive]
3952pub struct ListAssignmentsRequest {
3953    /// Required. The parent resource name e.g.:
3954    ///
3955    /// `projects/myproject/locations/US/reservations/team1-prod`
3956    ///
3957    /// Or:
3958    ///
3959    /// `projects/myproject/locations/US/reservations/-`
3960    pub parent: std::string::String,
3961
3962    /// The maximum number of items to return per page.
3963    pub page_size: i32,
3964
3965    /// The next_page_token value returned from a previous List request, if any.
3966    pub page_token: std::string::String,
3967
3968    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3969}
3970
3971impl ListAssignmentsRequest {
3972    /// Creates a new default instance.
3973    pub fn new() -> Self {
3974        std::default::Default::default()
3975    }
3976
3977    /// Sets the value of [parent][crate::model::ListAssignmentsRequest::parent].
3978    ///
3979    /// # Example
3980    /// ```ignore,no_run
3981    /// # use google_cloud_bigquery_reservation_v1::model::ListAssignmentsRequest;
3982    /// # let project_id = "project_id";
3983    /// # let location_id = "location_id";
3984    /// # let reservation_id = "reservation_id";
3985    /// let x = ListAssignmentsRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/reservations/{reservation_id}"));
3986    /// ```
3987    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3988        self.parent = v.into();
3989        self
3990    }
3991
3992    /// Sets the value of [page_size][crate::model::ListAssignmentsRequest::page_size].
3993    ///
3994    /// # Example
3995    /// ```ignore,no_run
3996    /// # use google_cloud_bigquery_reservation_v1::model::ListAssignmentsRequest;
3997    /// let x = ListAssignmentsRequest::new().set_page_size(42);
3998    /// ```
3999    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4000        self.page_size = v.into();
4001        self
4002    }
4003
4004    /// Sets the value of [page_token][crate::model::ListAssignmentsRequest::page_token].
4005    ///
4006    /// # Example
4007    /// ```ignore,no_run
4008    /// # use google_cloud_bigquery_reservation_v1::model::ListAssignmentsRequest;
4009    /// let x = ListAssignmentsRequest::new().set_page_token("example");
4010    /// ```
4011    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4012        self.page_token = v.into();
4013        self
4014    }
4015}
4016
4017impl wkt::message::Message for ListAssignmentsRequest {
4018    fn typename() -> &'static str {
4019        "type.googleapis.com/google.cloud.bigquery.reservation.v1.ListAssignmentsRequest"
4020    }
4021}
4022
4023/// The response for
4024/// [ReservationService.ListAssignments][google.cloud.bigquery.reservation.v1.ReservationService.ListAssignments].
4025///
4026/// [google.cloud.bigquery.reservation.v1.ReservationService.ListAssignments]: crate::client::ReservationService::list_assignments
4027#[derive(Clone, Default, PartialEq)]
4028#[non_exhaustive]
4029pub struct ListAssignmentsResponse {
4030    /// List of assignments visible to the user.
4031    pub assignments: std::vec::Vec<crate::model::Assignment>,
4032
4033    /// Token to retrieve the next page of results, or empty if there are no
4034    /// more results in the list.
4035    pub next_page_token: std::string::String,
4036
4037    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4038}
4039
4040impl ListAssignmentsResponse {
4041    /// Creates a new default instance.
4042    pub fn new() -> Self {
4043        std::default::Default::default()
4044    }
4045
4046    /// Sets the value of [assignments][crate::model::ListAssignmentsResponse::assignments].
4047    ///
4048    /// # Example
4049    /// ```ignore,no_run
4050    /// # use google_cloud_bigquery_reservation_v1::model::ListAssignmentsResponse;
4051    /// use google_cloud_bigquery_reservation_v1::model::Assignment;
4052    /// let x = ListAssignmentsResponse::new()
4053    ///     .set_assignments([
4054    ///         Assignment::default()/* use setters */,
4055    ///         Assignment::default()/* use (different) setters */,
4056    ///     ]);
4057    /// ```
4058    pub fn set_assignments<T, V>(mut self, v: T) -> Self
4059    where
4060        T: std::iter::IntoIterator<Item = V>,
4061        V: std::convert::Into<crate::model::Assignment>,
4062    {
4063        use std::iter::Iterator;
4064        self.assignments = v.into_iter().map(|i| i.into()).collect();
4065        self
4066    }
4067
4068    /// Sets the value of [next_page_token][crate::model::ListAssignmentsResponse::next_page_token].
4069    ///
4070    /// # Example
4071    /// ```ignore,no_run
4072    /// # use google_cloud_bigquery_reservation_v1::model::ListAssignmentsResponse;
4073    /// let x = ListAssignmentsResponse::new().set_next_page_token("example");
4074    /// ```
4075    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4076        self.next_page_token = v.into();
4077        self
4078    }
4079}
4080
4081impl wkt::message::Message for ListAssignmentsResponse {
4082    fn typename() -> &'static str {
4083        "type.googleapis.com/google.cloud.bigquery.reservation.v1.ListAssignmentsResponse"
4084    }
4085}
4086
4087#[doc(hidden)]
4088impl google_cloud_gax::paginator::internal::PageableResponse for ListAssignmentsResponse {
4089    type PageItem = crate::model::Assignment;
4090
4091    fn items(self) -> std::vec::Vec<Self::PageItem> {
4092        self.assignments
4093    }
4094
4095    fn next_page_token(&self) -> std::string::String {
4096        use std::clone::Clone;
4097        self.next_page_token.clone()
4098    }
4099}
4100
4101/// The request for
4102/// [ReservationService.DeleteAssignment][google.cloud.bigquery.reservation.v1.ReservationService.DeleteAssignment].
4103/// Note: "bigquery.reservationAssignments.delete" permission is required on the
4104/// related assignee.
4105///
4106/// [google.cloud.bigquery.reservation.v1.ReservationService.DeleteAssignment]: crate::client::ReservationService::delete_assignment
4107#[derive(Clone, Default, PartialEq)]
4108#[non_exhaustive]
4109pub struct DeleteAssignmentRequest {
4110    /// Required. Name of the resource, e.g.
4111    /// `projects/myproject/locations/US/reservations/team1-prod/assignments/123`
4112    pub name: std::string::String,
4113
4114    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4115}
4116
4117impl DeleteAssignmentRequest {
4118    /// Creates a new default instance.
4119    pub fn new() -> Self {
4120        std::default::Default::default()
4121    }
4122
4123    /// Sets the value of [name][crate::model::DeleteAssignmentRequest::name].
4124    ///
4125    /// # Example
4126    /// ```ignore,no_run
4127    /// # use google_cloud_bigquery_reservation_v1::model::DeleteAssignmentRequest;
4128    /// # let project_id = "project_id";
4129    /// # let location_id = "location_id";
4130    /// # let reservation_id = "reservation_id";
4131    /// # let assignment_id = "assignment_id";
4132    /// let x = DeleteAssignmentRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/reservations/{reservation_id}/assignments/{assignment_id}"));
4133    /// ```
4134    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4135        self.name = v.into();
4136        self
4137    }
4138}
4139
4140impl wkt::message::Message for DeleteAssignmentRequest {
4141    fn typename() -> &'static str {
4142        "type.googleapis.com/google.cloud.bigquery.reservation.v1.DeleteAssignmentRequest"
4143    }
4144}
4145
4146/// The request for
4147/// [ReservationService.SearchAssignments][google.cloud.bigquery.reservation.v1.ReservationService.SearchAssignments].
4148/// Note: "bigquery.reservationAssignments.search" permission is required on the
4149/// related assignee.
4150///
4151/// [google.cloud.bigquery.reservation.v1.ReservationService.SearchAssignments]: crate::client::ReservationService::search_assignments
4152#[derive(Clone, Default, PartialEq)]
4153#[non_exhaustive]
4154pub struct SearchAssignmentsRequest {
4155    /// Required. The resource name of the admin project(containing project and
4156    /// location), e.g.:
4157    /// `projects/myproject/locations/US`.
4158    pub parent: std::string::String,
4159
4160    /// Please specify resource name as assignee in the query.
4161    ///
4162    /// Examples:
4163    ///
4164    /// * `assignee=projects/myproject`
4165    /// * `assignee=folders/123`
4166    /// * `assignee=organizations/456`
4167    pub query: std::string::String,
4168
4169    /// The maximum number of items to return per page.
4170    pub page_size: i32,
4171
4172    /// The next_page_token value returned from a previous List request, if any.
4173    pub page_token: std::string::String,
4174
4175    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4176}
4177
4178impl SearchAssignmentsRequest {
4179    /// Creates a new default instance.
4180    pub fn new() -> Self {
4181        std::default::Default::default()
4182    }
4183
4184    /// Sets the value of [parent][crate::model::SearchAssignmentsRequest::parent].
4185    ///
4186    /// # Example
4187    /// ```ignore,no_run
4188    /// # use google_cloud_bigquery_reservation_v1::model::SearchAssignmentsRequest;
4189    /// let x = SearchAssignmentsRequest::new().set_parent("example");
4190    /// ```
4191    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4192        self.parent = v.into();
4193        self
4194    }
4195
4196    /// Sets the value of [query][crate::model::SearchAssignmentsRequest::query].
4197    ///
4198    /// # Example
4199    /// ```ignore,no_run
4200    /// # use google_cloud_bigquery_reservation_v1::model::SearchAssignmentsRequest;
4201    /// let x = SearchAssignmentsRequest::new().set_query("example");
4202    /// ```
4203    pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4204        self.query = v.into();
4205        self
4206    }
4207
4208    /// Sets the value of [page_size][crate::model::SearchAssignmentsRequest::page_size].
4209    ///
4210    /// # Example
4211    /// ```ignore,no_run
4212    /// # use google_cloud_bigquery_reservation_v1::model::SearchAssignmentsRequest;
4213    /// let x = SearchAssignmentsRequest::new().set_page_size(42);
4214    /// ```
4215    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4216        self.page_size = v.into();
4217        self
4218    }
4219
4220    /// Sets the value of [page_token][crate::model::SearchAssignmentsRequest::page_token].
4221    ///
4222    /// # Example
4223    /// ```ignore,no_run
4224    /// # use google_cloud_bigquery_reservation_v1::model::SearchAssignmentsRequest;
4225    /// let x = SearchAssignmentsRequest::new().set_page_token("example");
4226    /// ```
4227    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4228        self.page_token = v.into();
4229        self
4230    }
4231}
4232
4233impl wkt::message::Message for SearchAssignmentsRequest {
4234    fn typename() -> &'static str {
4235        "type.googleapis.com/google.cloud.bigquery.reservation.v1.SearchAssignmentsRequest"
4236    }
4237}
4238
4239/// The request for
4240/// [ReservationService.SearchAllAssignments][google.cloud.bigquery.reservation.v1.ReservationService.SearchAllAssignments].
4241/// Note: "bigquery.reservationAssignments.search" permission is required on the
4242/// related assignee.
4243///
4244/// [google.cloud.bigquery.reservation.v1.ReservationService.SearchAllAssignments]: crate::client::ReservationService::search_all_assignments
4245#[derive(Clone, Default, PartialEq)]
4246#[non_exhaustive]
4247pub struct SearchAllAssignmentsRequest {
4248    /// Required. The resource name with location (project name could be the
4249    /// wildcard '-'), e.g.:
4250    /// `projects/-/locations/US`.
4251    pub parent: std::string::String,
4252
4253    /// Please specify resource name as assignee in the query.
4254    ///
4255    /// Examples:
4256    ///
4257    /// * `assignee=projects/myproject`
4258    /// * `assignee=folders/123`
4259    /// * `assignee=organizations/456`
4260    pub query: std::string::String,
4261
4262    /// The maximum number of items to return per page.
4263    pub page_size: i32,
4264
4265    /// The next_page_token value returned from a previous List request, if any.
4266    pub page_token: std::string::String,
4267
4268    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4269}
4270
4271impl SearchAllAssignmentsRequest {
4272    /// Creates a new default instance.
4273    pub fn new() -> Self {
4274        std::default::Default::default()
4275    }
4276
4277    /// Sets the value of [parent][crate::model::SearchAllAssignmentsRequest::parent].
4278    ///
4279    /// # Example
4280    /// ```ignore,no_run
4281    /// # use google_cloud_bigquery_reservation_v1::model::SearchAllAssignmentsRequest;
4282    /// let x = SearchAllAssignmentsRequest::new().set_parent("example");
4283    /// ```
4284    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4285        self.parent = v.into();
4286        self
4287    }
4288
4289    /// Sets the value of [query][crate::model::SearchAllAssignmentsRequest::query].
4290    ///
4291    /// # Example
4292    /// ```ignore,no_run
4293    /// # use google_cloud_bigquery_reservation_v1::model::SearchAllAssignmentsRequest;
4294    /// let x = SearchAllAssignmentsRequest::new().set_query("example");
4295    /// ```
4296    pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4297        self.query = v.into();
4298        self
4299    }
4300
4301    /// Sets the value of [page_size][crate::model::SearchAllAssignmentsRequest::page_size].
4302    ///
4303    /// # Example
4304    /// ```ignore,no_run
4305    /// # use google_cloud_bigquery_reservation_v1::model::SearchAllAssignmentsRequest;
4306    /// let x = SearchAllAssignmentsRequest::new().set_page_size(42);
4307    /// ```
4308    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4309        self.page_size = v.into();
4310        self
4311    }
4312
4313    /// Sets the value of [page_token][crate::model::SearchAllAssignmentsRequest::page_token].
4314    ///
4315    /// # Example
4316    /// ```ignore,no_run
4317    /// # use google_cloud_bigquery_reservation_v1::model::SearchAllAssignmentsRequest;
4318    /// let x = SearchAllAssignmentsRequest::new().set_page_token("example");
4319    /// ```
4320    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4321        self.page_token = v.into();
4322        self
4323    }
4324}
4325
4326impl wkt::message::Message for SearchAllAssignmentsRequest {
4327    fn typename() -> &'static str {
4328        "type.googleapis.com/google.cloud.bigquery.reservation.v1.SearchAllAssignmentsRequest"
4329    }
4330}
4331
4332/// The response for
4333/// [ReservationService.SearchAssignments][google.cloud.bigquery.reservation.v1.ReservationService.SearchAssignments].
4334///
4335/// [google.cloud.bigquery.reservation.v1.ReservationService.SearchAssignments]: crate::client::ReservationService::search_assignments
4336#[derive(Clone, Default, PartialEq)]
4337#[non_exhaustive]
4338pub struct SearchAssignmentsResponse {
4339    /// List of assignments visible to the user.
4340    pub assignments: std::vec::Vec<crate::model::Assignment>,
4341
4342    /// Token to retrieve the next page of results, or empty if there are no
4343    /// more results in the list.
4344    pub next_page_token: std::string::String,
4345
4346    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4347}
4348
4349impl SearchAssignmentsResponse {
4350    /// Creates a new default instance.
4351    pub fn new() -> Self {
4352        std::default::Default::default()
4353    }
4354
4355    /// Sets the value of [assignments][crate::model::SearchAssignmentsResponse::assignments].
4356    ///
4357    /// # Example
4358    /// ```ignore,no_run
4359    /// # use google_cloud_bigquery_reservation_v1::model::SearchAssignmentsResponse;
4360    /// use google_cloud_bigquery_reservation_v1::model::Assignment;
4361    /// let x = SearchAssignmentsResponse::new()
4362    ///     .set_assignments([
4363    ///         Assignment::default()/* use setters */,
4364    ///         Assignment::default()/* use (different) setters */,
4365    ///     ]);
4366    /// ```
4367    pub fn set_assignments<T, V>(mut self, v: T) -> Self
4368    where
4369        T: std::iter::IntoIterator<Item = V>,
4370        V: std::convert::Into<crate::model::Assignment>,
4371    {
4372        use std::iter::Iterator;
4373        self.assignments = v.into_iter().map(|i| i.into()).collect();
4374        self
4375    }
4376
4377    /// Sets the value of [next_page_token][crate::model::SearchAssignmentsResponse::next_page_token].
4378    ///
4379    /// # Example
4380    /// ```ignore,no_run
4381    /// # use google_cloud_bigquery_reservation_v1::model::SearchAssignmentsResponse;
4382    /// let x = SearchAssignmentsResponse::new().set_next_page_token("example");
4383    /// ```
4384    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4385        self.next_page_token = v.into();
4386        self
4387    }
4388}
4389
4390impl wkt::message::Message for SearchAssignmentsResponse {
4391    fn typename() -> &'static str {
4392        "type.googleapis.com/google.cloud.bigquery.reservation.v1.SearchAssignmentsResponse"
4393    }
4394}
4395
4396#[doc(hidden)]
4397impl google_cloud_gax::paginator::internal::PageableResponse for SearchAssignmentsResponse {
4398    type PageItem = crate::model::Assignment;
4399
4400    fn items(self) -> std::vec::Vec<Self::PageItem> {
4401        self.assignments
4402    }
4403
4404    fn next_page_token(&self) -> std::string::String {
4405        use std::clone::Clone;
4406        self.next_page_token.clone()
4407    }
4408}
4409
4410/// The response for
4411/// [ReservationService.SearchAllAssignments][google.cloud.bigquery.reservation.v1.ReservationService.SearchAllAssignments].
4412///
4413/// [google.cloud.bigquery.reservation.v1.ReservationService.SearchAllAssignments]: crate::client::ReservationService::search_all_assignments
4414#[derive(Clone, Default, PartialEq)]
4415#[non_exhaustive]
4416pub struct SearchAllAssignmentsResponse {
4417    /// List of assignments visible to the user.
4418    pub assignments: std::vec::Vec<crate::model::Assignment>,
4419
4420    /// Token to retrieve the next page of results, or empty if there are no
4421    /// more results in the list.
4422    pub next_page_token: std::string::String,
4423
4424    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4425}
4426
4427impl SearchAllAssignmentsResponse {
4428    /// Creates a new default instance.
4429    pub fn new() -> Self {
4430        std::default::Default::default()
4431    }
4432
4433    /// Sets the value of [assignments][crate::model::SearchAllAssignmentsResponse::assignments].
4434    ///
4435    /// # Example
4436    /// ```ignore,no_run
4437    /// # use google_cloud_bigquery_reservation_v1::model::SearchAllAssignmentsResponse;
4438    /// use google_cloud_bigquery_reservation_v1::model::Assignment;
4439    /// let x = SearchAllAssignmentsResponse::new()
4440    ///     .set_assignments([
4441    ///         Assignment::default()/* use setters */,
4442    ///         Assignment::default()/* use (different) setters */,
4443    ///     ]);
4444    /// ```
4445    pub fn set_assignments<T, V>(mut self, v: T) -> Self
4446    where
4447        T: std::iter::IntoIterator<Item = V>,
4448        V: std::convert::Into<crate::model::Assignment>,
4449    {
4450        use std::iter::Iterator;
4451        self.assignments = v.into_iter().map(|i| i.into()).collect();
4452        self
4453    }
4454
4455    /// Sets the value of [next_page_token][crate::model::SearchAllAssignmentsResponse::next_page_token].
4456    ///
4457    /// # Example
4458    /// ```ignore,no_run
4459    /// # use google_cloud_bigquery_reservation_v1::model::SearchAllAssignmentsResponse;
4460    /// let x = SearchAllAssignmentsResponse::new().set_next_page_token("example");
4461    /// ```
4462    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4463        self.next_page_token = v.into();
4464        self
4465    }
4466}
4467
4468impl wkt::message::Message for SearchAllAssignmentsResponse {
4469    fn typename() -> &'static str {
4470        "type.googleapis.com/google.cloud.bigquery.reservation.v1.SearchAllAssignmentsResponse"
4471    }
4472}
4473
4474#[doc(hidden)]
4475impl google_cloud_gax::paginator::internal::PageableResponse for SearchAllAssignmentsResponse {
4476    type PageItem = crate::model::Assignment;
4477
4478    fn items(self) -> std::vec::Vec<Self::PageItem> {
4479        self.assignments
4480    }
4481
4482    fn next_page_token(&self) -> std::string::String {
4483        use std::clone::Clone;
4484        self.next_page_token.clone()
4485    }
4486}
4487
4488/// The request for
4489/// [ReservationService.MoveAssignment][google.cloud.bigquery.reservation.v1.ReservationService.MoveAssignment].
4490///
4491/// **Note**: "bigquery.reservationAssignments.create" permission is required on
4492/// the destination_id.
4493///
4494/// **Note**: "bigquery.reservationAssignments.create" and
4495/// "bigquery.reservationAssignments.delete" permission are required on the
4496/// related assignee.
4497///
4498/// [google.cloud.bigquery.reservation.v1.ReservationService.MoveAssignment]: crate::client::ReservationService::move_assignment
4499#[derive(Clone, Default, PartialEq)]
4500#[non_exhaustive]
4501pub struct MoveAssignmentRequest {
4502    /// Required. The resource name of the assignment,
4503    /// e.g.
4504    /// `projects/myproject/locations/US/reservations/team1-prod/assignments/123`
4505    pub name: std::string::String,
4506
4507    /// The new reservation ID, e.g.:
4508    /// `projects/myotherproject/locations/US/reservations/team2-prod`
4509    pub destination_id: std::string::String,
4510
4511    /// The optional assignment ID. A new assignment name is generated if this
4512    /// field is empty.
4513    ///
4514    /// This field can contain only lowercase alphanumeric characters or dashes.
4515    /// Max length is 64 characters.
4516    pub assignment_id: std::string::String,
4517
4518    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4519}
4520
4521impl MoveAssignmentRequest {
4522    /// Creates a new default instance.
4523    pub fn new() -> Self {
4524        std::default::Default::default()
4525    }
4526
4527    /// Sets the value of [name][crate::model::MoveAssignmentRequest::name].
4528    ///
4529    /// # Example
4530    /// ```ignore,no_run
4531    /// # use google_cloud_bigquery_reservation_v1::model::MoveAssignmentRequest;
4532    /// # let project_id = "project_id";
4533    /// # let location_id = "location_id";
4534    /// # let reservation_id = "reservation_id";
4535    /// # let assignment_id = "assignment_id";
4536    /// let x = MoveAssignmentRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/reservations/{reservation_id}/assignments/{assignment_id}"));
4537    /// ```
4538    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4539        self.name = v.into();
4540        self
4541    }
4542
4543    /// Sets the value of [destination_id][crate::model::MoveAssignmentRequest::destination_id].
4544    ///
4545    /// # Example
4546    /// ```ignore,no_run
4547    /// # use google_cloud_bigquery_reservation_v1::model::MoveAssignmentRequest;
4548    /// # let project_id = "project_id";
4549    /// # let location_id = "location_id";
4550    /// # let reservation_id = "reservation_id";
4551    /// let x = MoveAssignmentRequest::new().set_destination_id(format!("projects/{project_id}/locations/{location_id}/reservations/{reservation_id}"));
4552    /// ```
4553    pub fn set_destination_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4554        self.destination_id = v.into();
4555        self
4556    }
4557
4558    /// Sets the value of [assignment_id][crate::model::MoveAssignmentRequest::assignment_id].
4559    ///
4560    /// # Example
4561    /// ```ignore,no_run
4562    /// # use google_cloud_bigquery_reservation_v1::model::MoveAssignmentRequest;
4563    /// let x = MoveAssignmentRequest::new().set_assignment_id("example");
4564    /// ```
4565    pub fn set_assignment_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4566        self.assignment_id = v.into();
4567        self
4568    }
4569}
4570
4571impl wkt::message::Message for MoveAssignmentRequest {
4572    fn typename() -> &'static str {
4573        "type.googleapis.com/google.cloud.bigquery.reservation.v1.MoveAssignmentRequest"
4574    }
4575}
4576
4577/// The request for
4578/// [ReservationService.UpdateAssignment][google.cloud.bigquery.reservation.v1.ReservationService.UpdateAssignment].
4579///
4580/// [google.cloud.bigquery.reservation.v1.ReservationService.UpdateAssignment]: crate::client::ReservationService::update_assignment
4581#[derive(Clone, Default, PartialEq)]
4582#[non_exhaustive]
4583pub struct UpdateAssignmentRequest {
4584    /// Content of the assignment to update.
4585    pub assignment: std::option::Option<crate::model::Assignment>,
4586
4587    /// Standard field mask for the set of fields to be updated.
4588    pub update_mask: std::option::Option<wkt::FieldMask>,
4589
4590    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4591}
4592
4593impl UpdateAssignmentRequest {
4594    /// Creates a new default instance.
4595    pub fn new() -> Self {
4596        std::default::Default::default()
4597    }
4598
4599    /// Sets the value of [assignment][crate::model::UpdateAssignmentRequest::assignment].
4600    ///
4601    /// # Example
4602    /// ```ignore,no_run
4603    /// # use google_cloud_bigquery_reservation_v1::model::UpdateAssignmentRequest;
4604    /// use google_cloud_bigquery_reservation_v1::model::Assignment;
4605    /// let x = UpdateAssignmentRequest::new().set_assignment(Assignment::default()/* use setters */);
4606    /// ```
4607    pub fn set_assignment<T>(mut self, v: T) -> Self
4608    where
4609        T: std::convert::Into<crate::model::Assignment>,
4610    {
4611        self.assignment = std::option::Option::Some(v.into());
4612        self
4613    }
4614
4615    /// Sets or clears the value of [assignment][crate::model::UpdateAssignmentRequest::assignment].
4616    ///
4617    /// # Example
4618    /// ```ignore,no_run
4619    /// # use google_cloud_bigquery_reservation_v1::model::UpdateAssignmentRequest;
4620    /// use google_cloud_bigquery_reservation_v1::model::Assignment;
4621    /// let x = UpdateAssignmentRequest::new().set_or_clear_assignment(Some(Assignment::default()/* use setters */));
4622    /// let x = UpdateAssignmentRequest::new().set_or_clear_assignment(None::<Assignment>);
4623    /// ```
4624    pub fn set_or_clear_assignment<T>(mut self, v: std::option::Option<T>) -> Self
4625    where
4626        T: std::convert::Into<crate::model::Assignment>,
4627    {
4628        self.assignment = v.map(|x| x.into());
4629        self
4630    }
4631
4632    /// Sets the value of [update_mask][crate::model::UpdateAssignmentRequest::update_mask].
4633    ///
4634    /// # Example
4635    /// ```ignore,no_run
4636    /// # use google_cloud_bigquery_reservation_v1::model::UpdateAssignmentRequest;
4637    /// use wkt::FieldMask;
4638    /// let x = UpdateAssignmentRequest::new().set_update_mask(FieldMask::default()/* use setters */);
4639    /// ```
4640    pub fn set_update_mask<T>(mut self, v: T) -> Self
4641    where
4642        T: std::convert::Into<wkt::FieldMask>,
4643    {
4644        self.update_mask = std::option::Option::Some(v.into());
4645        self
4646    }
4647
4648    /// Sets or clears the value of [update_mask][crate::model::UpdateAssignmentRequest::update_mask].
4649    ///
4650    /// # Example
4651    /// ```ignore,no_run
4652    /// # use google_cloud_bigquery_reservation_v1::model::UpdateAssignmentRequest;
4653    /// use wkt::FieldMask;
4654    /// let x = UpdateAssignmentRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
4655    /// let x = UpdateAssignmentRequest::new().set_or_clear_update_mask(None::<FieldMask>);
4656    /// ```
4657    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4658    where
4659        T: std::convert::Into<wkt::FieldMask>,
4660    {
4661        self.update_mask = v.map(|x| x.into());
4662        self
4663    }
4664}
4665
4666impl wkt::message::Message for UpdateAssignmentRequest {
4667    fn typename() -> &'static str {
4668        "type.googleapis.com/google.cloud.bigquery.reservation.v1.UpdateAssignmentRequest"
4669    }
4670}
4671
4672/// Fully qualified reference to BigQuery table.
4673/// Internally stored as google.cloud.bi.v1.BqTableReference.
4674#[derive(Clone, Default, PartialEq)]
4675#[non_exhaustive]
4676pub struct TableReference {
4677    /// Optional. The assigned project ID of the project.
4678    pub project_id: std::string::String,
4679
4680    /// Optional. The ID of the dataset in the above project.
4681    pub dataset_id: std::string::String,
4682
4683    /// Optional. The ID of the table in the above dataset.
4684    pub table_id: std::string::String,
4685
4686    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4687}
4688
4689impl TableReference {
4690    /// Creates a new default instance.
4691    pub fn new() -> Self {
4692        std::default::Default::default()
4693    }
4694
4695    /// Sets the value of [project_id][crate::model::TableReference::project_id].
4696    ///
4697    /// # Example
4698    /// ```ignore,no_run
4699    /// # use google_cloud_bigquery_reservation_v1::model::TableReference;
4700    /// let x = TableReference::new().set_project_id("example");
4701    /// ```
4702    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4703        self.project_id = v.into();
4704        self
4705    }
4706
4707    /// Sets the value of [dataset_id][crate::model::TableReference::dataset_id].
4708    ///
4709    /// # Example
4710    /// ```ignore,no_run
4711    /// # use google_cloud_bigquery_reservation_v1::model::TableReference;
4712    /// let x = TableReference::new().set_dataset_id("example");
4713    /// ```
4714    pub fn set_dataset_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4715        self.dataset_id = v.into();
4716        self
4717    }
4718
4719    /// Sets the value of [table_id][crate::model::TableReference::table_id].
4720    ///
4721    /// # Example
4722    /// ```ignore,no_run
4723    /// # use google_cloud_bigquery_reservation_v1::model::TableReference;
4724    /// let x = TableReference::new().set_table_id("example");
4725    /// ```
4726    pub fn set_table_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4727        self.table_id = v.into();
4728        self
4729    }
4730}
4731
4732impl wkt::message::Message for TableReference {
4733    fn typename() -> &'static str {
4734        "type.googleapis.com/google.cloud.bigquery.reservation.v1.TableReference"
4735    }
4736}
4737
4738/// Represents a BI Reservation.
4739#[derive(Clone, Default, PartialEq)]
4740#[non_exhaustive]
4741pub struct BiReservation {
4742    /// Identifier. The resource name of the singleton BI reservation.
4743    /// Reservation names have the form
4744    /// `projects/{project_id}/locations/{location_id}/biReservation`.
4745    pub name: std::string::String,
4746
4747    /// Output only. The last update timestamp of a reservation.
4748    pub update_time: std::option::Option<wkt::Timestamp>,
4749
4750    /// Optional. Size of a reservation, in bytes.
4751    pub size: i64,
4752
4753    /// Optional. Preferred tables to use BI capacity for.
4754    pub preferred_tables: std::vec::Vec<crate::model::TableReference>,
4755
4756    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4757}
4758
4759impl BiReservation {
4760    /// Creates a new default instance.
4761    pub fn new() -> Self {
4762        std::default::Default::default()
4763    }
4764
4765    /// Sets the value of [name][crate::model::BiReservation::name].
4766    ///
4767    /// # Example
4768    /// ```ignore,no_run
4769    /// # use google_cloud_bigquery_reservation_v1::model::BiReservation;
4770    /// # let project_id = "project_id";
4771    /// # let location_id = "location_id";
4772    /// let x = BiReservation::new().set_name(format!("projects/{project_id}/locations/{location_id}/biReservation"));
4773    /// ```
4774    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4775        self.name = v.into();
4776        self
4777    }
4778
4779    /// Sets the value of [update_time][crate::model::BiReservation::update_time].
4780    ///
4781    /// # Example
4782    /// ```ignore,no_run
4783    /// # use google_cloud_bigquery_reservation_v1::model::BiReservation;
4784    /// use wkt::Timestamp;
4785    /// let x = BiReservation::new().set_update_time(Timestamp::default()/* use setters */);
4786    /// ```
4787    pub fn set_update_time<T>(mut self, v: T) -> Self
4788    where
4789        T: std::convert::Into<wkt::Timestamp>,
4790    {
4791        self.update_time = std::option::Option::Some(v.into());
4792        self
4793    }
4794
4795    /// Sets or clears the value of [update_time][crate::model::BiReservation::update_time].
4796    ///
4797    /// # Example
4798    /// ```ignore,no_run
4799    /// # use google_cloud_bigquery_reservation_v1::model::BiReservation;
4800    /// use wkt::Timestamp;
4801    /// let x = BiReservation::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
4802    /// let x = BiReservation::new().set_or_clear_update_time(None::<Timestamp>);
4803    /// ```
4804    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
4805    where
4806        T: std::convert::Into<wkt::Timestamp>,
4807    {
4808        self.update_time = v.map(|x| x.into());
4809        self
4810    }
4811
4812    /// Sets the value of [size][crate::model::BiReservation::size].
4813    ///
4814    /// # Example
4815    /// ```ignore,no_run
4816    /// # use google_cloud_bigquery_reservation_v1::model::BiReservation;
4817    /// let x = BiReservation::new().set_size(42);
4818    /// ```
4819    pub fn set_size<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
4820        self.size = v.into();
4821        self
4822    }
4823
4824    /// Sets the value of [preferred_tables][crate::model::BiReservation::preferred_tables].
4825    ///
4826    /// # Example
4827    /// ```ignore,no_run
4828    /// # use google_cloud_bigquery_reservation_v1::model::BiReservation;
4829    /// use google_cloud_bigquery_reservation_v1::model::TableReference;
4830    /// let x = BiReservation::new()
4831    ///     .set_preferred_tables([
4832    ///         TableReference::default()/* use setters */,
4833    ///         TableReference::default()/* use (different) setters */,
4834    ///     ]);
4835    /// ```
4836    pub fn set_preferred_tables<T, V>(mut self, v: T) -> Self
4837    where
4838        T: std::iter::IntoIterator<Item = V>,
4839        V: std::convert::Into<crate::model::TableReference>,
4840    {
4841        use std::iter::Iterator;
4842        self.preferred_tables = v.into_iter().map(|i| i.into()).collect();
4843        self
4844    }
4845}
4846
4847impl wkt::message::Message for BiReservation {
4848    fn typename() -> &'static str {
4849        "type.googleapis.com/google.cloud.bigquery.reservation.v1.BiReservation"
4850    }
4851}
4852
4853/// A request to get a singleton BI reservation.
4854#[derive(Clone, Default, PartialEq)]
4855#[non_exhaustive]
4856pub struct GetBiReservationRequest {
4857    /// Required. Name of the requested reservation, for example:
4858    /// `projects/{project_id}/locations/{location_id}/biReservation`
4859    pub name: std::string::String,
4860
4861    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4862}
4863
4864impl GetBiReservationRequest {
4865    /// Creates a new default instance.
4866    pub fn new() -> Self {
4867        std::default::Default::default()
4868    }
4869
4870    /// Sets the value of [name][crate::model::GetBiReservationRequest::name].
4871    ///
4872    /// # Example
4873    /// ```ignore,no_run
4874    /// # use google_cloud_bigquery_reservation_v1::model::GetBiReservationRequest;
4875    /// # let project_id = "project_id";
4876    /// # let location_id = "location_id";
4877    /// let x = GetBiReservationRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/biReservation"));
4878    /// ```
4879    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4880        self.name = v.into();
4881        self
4882    }
4883}
4884
4885impl wkt::message::Message for GetBiReservationRequest {
4886    fn typename() -> &'static str {
4887        "type.googleapis.com/google.cloud.bigquery.reservation.v1.GetBiReservationRequest"
4888    }
4889}
4890
4891/// A request to update a BI reservation.
4892#[derive(Clone, Default, PartialEq)]
4893#[non_exhaustive]
4894pub struct UpdateBiReservationRequest {
4895    /// A reservation to update.
4896    pub bi_reservation: std::option::Option<crate::model::BiReservation>,
4897
4898    /// A list of fields to be updated in this request.
4899    pub update_mask: std::option::Option<wkt::FieldMask>,
4900
4901    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4902}
4903
4904impl UpdateBiReservationRequest {
4905    /// Creates a new default instance.
4906    pub fn new() -> Self {
4907        std::default::Default::default()
4908    }
4909
4910    /// Sets the value of [bi_reservation][crate::model::UpdateBiReservationRequest::bi_reservation].
4911    ///
4912    /// # Example
4913    /// ```ignore,no_run
4914    /// # use google_cloud_bigquery_reservation_v1::model::UpdateBiReservationRequest;
4915    /// use google_cloud_bigquery_reservation_v1::model::BiReservation;
4916    /// let x = UpdateBiReservationRequest::new().set_bi_reservation(BiReservation::default()/* use setters */);
4917    /// ```
4918    pub fn set_bi_reservation<T>(mut self, v: T) -> Self
4919    where
4920        T: std::convert::Into<crate::model::BiReservation>,
4921    {
4922        self.bi_reservation = std::option::Option::Some(v.into());
4923        self
4924    }
4925
4926    /// Sets or clears the value of [bi_reservation][crate::model::UpdateBiReservationRequest::bi_reservation].
4927    ///
4928    /// # Example
4929    /// ```ignore,no_run
4930    /// # use google_cloud_bigquery_reservation_v1::model::UpdateBiReservationRequest;
4931    /// use google_cloud_bigquery_reservation_v1::model::BiReservation;
4932    /// let x = UpdateBiReservationRequest::new().set_or_clear_bi_reservation(Some(BiReservation::default()/* use setters */));
4933    /// let x = UpdateBiReservationRequest::new().set_or_clear_bi_reservation(None::<BiReservation>);
4934    /// ```
4935    pub fn set_or_clear_bi_reservation<T>(mut self, v: std::option::Option<T>) -> Self
4936    where
4937        T: std::convert::Into<crate::model::BiReservation>,
4938    {
4939        self.bi_reservation = v.map(|x| x.into());
4940        self
4941    }
4942
4943    /// Sets the value of [update_mask][crate::model::UpdateBiReservationRequest::update_mask].
4944    ///
4945    /// # Example
4946    /// ```ignore,no_run
4947    /// # use google_cloud_bigquery_reservation_v1::model::UpdateBiReservationRequest;
4948    /// use wkt::FieldMask;
4949    /// let x = UpdateBiReservationRequest::new().set_update_mask(FieldMask::default()/* use setters */);
4950    /// ```
4951    pub fn set_update_mask<T>(mut self, v: T) -> Self
4952    where
4953        T: std::convert::Into<wkt::FieldMask>,
4954    {
4955        self.update_mask = std::option::Option::Some(v.into());
4956        self
4957    }
4958
4959    /// Sets or clears the value of [update_mask][crate::model::UpdateBiReservationRequest::update_mask].
4960    ///
4961    /// # Example
4962    /// ```ignore,no_run
4963    /// # use google_cloud_bigquery_reservation_v1::model::UpdateBiReservationRequest;
4964    /// use wkt::FieldMask;
4965    /// let x = UpdateBiReservationRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
4966    /// let x = UpdateBiReservationRequest::new().set_or_clear_update_mask(None::<FieldMask>);
4967    /// ```
4968    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4969    where
4970        T: std::convert::Into<wkt::FieldMask>,
4971    {
4972        self.update_mask = v.map(|x| x.into());
4973        self
4974    }
4975}
4976
4977impl wkt::message::Message for UpdateBiReservationRequest {
4978    fn typename() -> &'static str {
4979        "type.googleapis.com/google.cloud.bigquery.reservation.v1.UpdateBiReservationRequest"
4980    }
4981}
4982
4983/// The type of editions.
4984/// Different features and behaviors are provided to different editions
4985/// Capacity commitments and reservations are linked to editions.
4986///
4987/// # Working with unknown values
4988///
4989/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4990/// additional enum variants at any time. Adding new variants is not considered
4991/// a breaking change. Applications should write their code in anticipation of:
4992///
4993/// - New values appearing in future releases of the client library, **and**
4994/// - New values received dynamically, without application changes.
4995///
4996/// Please consult the [Working with enums] section in the user guide for some
4997/// guidelines.
4998///
4999/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5000#[derive(Clone, Debug, PartialEq)]
5001#[non_exhaustive]
5002pub enum Edition {
5003    /// Default value, which will be treated as ENTERPRISE.
5004    Unspecified,
5005    /// Standard edition.
5006    Standard,
5007    /// Enterprise edition.
5008    Enterprise,
5009    /// Enterprise Plus edition.
5010    EnterprisePlus,
5011    /// If set, the enum was initialized with an unknown value.
5012    ///
5013    /// Applications can examine the value using [Edition::value] or
5014    /// [Edition::name].
5015    UnknownValue(edition::UnknownValue),
5016}
5017
5018#[doc(hidden)]
5019pub mod edition {
5020    #[allow(unused_imports)]
5021    use super::*;
5022    #[derive(Clone, Debug, PartialEq)]
5023    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5024}
5025
5026impl Edition {
5027    /// Gets the enum value.
5028    ///
5029    /// Returns `None` if the enum contains an unknown value deserialized from
5030    /// the string representation of enums.
5031    pub fn value(&self) -> std::option::Option<i32> {
5032        match self {
5033            Self::Unspecified => std::option::Option::Some(0),
5034            Self::Standard => std::option::Option::Some(1),
5035            Self::Enterprise => std::option::Option::Some(2),
5036            Self::EnterprisePlus => std::option::Option::Some(3),
5037            Self::UnknownValue(u) => u.0.value(),
5038        }
5039    }
5040
5041    /// Gets the enum value as a string.
5042    ///
5043    /// Returns `None` if the enum contains an unknown value deserialized from
5044    /// the integer representation of enums.
5045    pub fn name(&self) -> std::option::Option<&str> {
5046        match self {
5047            Self::Unspecified => std::option::Option::Some("EDITION_UNSPECIFIED"),
5048            Self::Standard => std::option::Option::Some("STANDARD"),
5049            Self::Enterprise => std::option::Option::Some("ENTERPRISE"),
5050            Self::EnterprisePlus => std::option::Option::Some("ENTERPRISE_PLUS"),
5051            Self::UnknownValue(u) => u.0.name(),
5052        }
5053    }
5054}
5055
5056impl std::default::Default for Edition {
5057    fn default() -> Self {
5058        use std::convert::From;
5059        Self::from(0)
5060    }
5061}
5062
5063impl std::fmt::Display for Edition {
5064    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5065        wkt::internal::display_enum(f, self.name(), self.value())
5066    }
5067}
5068
5069impl std::convert::From<i32> for Edition {
5070    fn from(value: i32) -> Self {
5071        match value {
5072            0 => Self::Unspecified,
5073            1 => Self::Standard,
5074            2 => Self::Enterprise,
5075            3 => Self::EnterprisePlus,
5076            _ => Self::UnknownValue(edition::UnknownValue(
5077                wkt::internal::UnknownEnumValue::Integer(value),
5078            )),
5079        }
5080    }
5081}
5082
5083impl std::convert::From<&str> for Edition {
5084    fn from(value: &str) -> Self {
5085        use std::string::ToString;
5086        match value {
5087            "EDITION_UNSPECIFIED" => Self::Unspecified,
5088            "STANDARD" => Self::Standard,
5089            "ENTERPRISE" => Self::Enterprise,
5090            "ENTERPRISE_PLUS" => Self::EnterprisePlus,
5091            _ => Self::UnknownValue(edition::UnknownValue(
5092                wkt::internal::UnknownEnumValue::String(value.to_string()),
5093            )),
5094        }
5095    }
5096}
5097
5098impl serde::ser::Serialize for Edition {
5099    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5100    where
5101        S: serde::Serializer,
5102    {
5103        match self {
5104            Self::Unspecified => serializer.serialize_i32(0),
5105            Self::Standard => serializer.serialize_i32(1),
5106            Self::Enterprise => serializer.serialize_i32(2),
5107            Self::EnterprisePlus => serializer.serialize_i32(3),
5108            Self::UnknownValue(u) => u.0.serialize(serializer),
5109        }
5110    }
5111}
5112
5113impl<'de> serde::de::Deserialize<'de> for Edition {
5114    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5115    where
5116        D: serde::Deserializer<'de>,
5117    {
5118        deserializer.deserialize_any(wkt::internal::EnumVisitor::<Edition>::new(
5119            ".google.cloud.bigquery.reservation.v1.Edition",
5120        ))
5121    }
5122}
5123
5124/// The failover mode when a user initiates a failover on a reservation
5125/// determines how writes that are pending replication are handled after the
5126/// failover is initiated.
5127///
5128/// # Working with unknown values
5129///
5130/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5131/// additional enum variants at any time. Adding new variants is not considered
5132/// a breaking change. Applications should write their code in anticipation of:
5133///
5134/// - New values appearing in future releases of the client library, **and**
5135/// - New values received dynamically, without application changes.
5136///
5137/// Please consult the [Working with enums] section in the user guide for some
5138/// guidelines.
5139///
5140/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5141#[derive(Clone, Debug, PartialEq)]
5142#[non_exhaustive]
5143pub enum FailoverMode {
5144    /// Invalid value.
5145    Unspecified,
5146    /// When customers initiate a soft failover, BigQuery will wait until all
5147    /// committed writes are replicated to the secondary. This mode requires both
5148    /// regions to be available for the failover to succeed and prevents data loss.
5149    Soft,
5150    /// When customers initiate a hard failover, BigQuery will not wait until all
5151    /// committed writes are replicated to the secondary. There can be data loss
5152    /// for hard failover.
5153    Hard,
5154    /// If set, the enum was initialized with an unknown value.
5155    ///
5156    /// Applications can examine the value using [FailoverMode::value] or
5157    /// [FailoverMode::name].
5158    UnknownValue(failover_mode::UnknownValue),
5159}
5160
5161#[doc(hidden)]
5162pub mod failover_mode {
5163    #[allow(unused_imports)]
5164    use super::*;
5165    #[derive(Clone, Debug, PartialEq)]
5166    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5167}
5168
5169impl FailoverMode {
5170    /// Gets the enum value.
5171    ///
5172    /// Returns `None` if the enum contains an unknown value deserialized from
5173    /// the string representation of enums.
5174    pub fn value(&self) -> std::option::Option<i32> {
5175        match self {
5176            Self::Unspecified => std::option::Option::Some(0),
5177            Self::Soft => std::option::Option::Some(1),
5178            Self::Hard => std::option::Option::Some(2),
5179            Self::UnknownValue(u) => u.0.value(),
5180        }
5181    }
5182
5183    /// Gets the enum value as a string.
5184    ///
5185    /// Returns `None` if the enum contains an unknown value deserialized from
5186    /// the integer representation of enums.
5187    pub fn name(&self) -> std::option::Option<&str> {
5188        match self {
5189            Self::Unspecified => std::option::Option::Some("FAILOVER_MODE_UNSPECIFIED"),
5190            Self::Soft => std::option::Option::Some("SOFT"),
5191            Self::Hard => std::option::Option::Some("HARD"),
5192            Self::UnknownValue(u) => u.0.name(),
5193        }
5194    }
5195}
5196
5197impl std::default::Default for FailoverMode {
5198    fn default() -> Self {
5199        use std::convert::From;
5200        Self::from(0)
5201    }
5202}
5203
5204impl std::fmt::Display for FailoverMode {
5205    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5206        wkt::internal::display_enum(f, self.name(), self.value())
5207    }
5208}
5209
5210impl std::convert::From<i32> for FailoverMode {
5211    fn from(value: i32) -> Self {
5212        match value {
5213            0 => Self::Unspecified,
5214            1 => Self::Soft,
5215            2 => Self::Hard,
5216            _ => Self::UnknownValue(failover_mode::UnknownValue(
5217                wkt::internal::UnknownEnumValue::Integer(value),
5218            )),
5219        }
5220    }
5221}
5222
5223impl std::convert::From<&str> for FailoverMode {
5224    fn from(value: &str) -> Self {
5225        use std::string::ToString;
5226        match value {
5227            "FAILOVER_MODE_UNSPECIFIED" => Self::Unspecified,
5228            "SOFT" => Self::Soft,
5229            "HARD" => Self::Hard,
5230            _ => Self::UnknownValue(failover_mode::UnknownValue(
5231                wkt::internal::UnknownEnumValue::String(value.to_string()),
5232            )),
5233        }
5234    }
5235}
5236
5237impl serde::ser::Serialize for FailoverMode {
5238    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5239    where
5240        S: serde::Serializer,
5241    {
5242        match self {
5243            Self::Unspecified => serializer.serialize_i32(0),
5244            Self::Soft => serializer.serialize_i32(1),
5245            Self::Hard => serializer.serialize_i32(2),
5246            Self::UnknownValue(u) => u.0.serialize(serializer),
5247        }
5248    }
5249}
5250
5251impl<'de> serde::de::Deserialize<'de> for FailoverMode {
5252    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5253    where
5254        D: serde::Deserializer<'de>,
5255    {
5256        deserializer.deserialize_any(wkt::internal::EnumVisitor::<FailoverMode>::new(
5257            ".google.cloud.bigquery.reservation.v1.FailoverMode",
5258        ))
5259    }
5260}