google_cloud_bigquery_reservation_v1/builder.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/// Request and client builders for [ReservationService][crate::client::ReservationService].
18pub mod reservation_service {
19 use crate::Result;
20
21 /// A builder for [ReservationService][crate::client::ReservationService].
22 ///
23 /// ```
24 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
25 /// # use google_cloud_bigquery_reservation_v1::*;
26 /// # use builder::reservation_service::ClientBuilder;
27 /// # use client::ReservationService;
28 /// let builder : ClientBuilder = ReservationService::builder();
29 /// let client = builder
30 /// .with_endpoint("https://bigqueryreservation.googleapis.com")
31 /// .build().await?;
32 /// # Ok(()) }
33 /// ```
34 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
35
36 pub(crate) mod client {
37 use super::super::super::client::ReservationService;
38 pub struct Factory;
39 impl crate::ClientFactory for Factory {
40 type Client = ReservationService;
41 type Credentials = gaxi::options::Credentials;
42 async fn build(
43 self,
44 config: gaxi::options::ClientConfig,
45 ) -> crate::ClientBuilderResult<Self::Client> {
46 Self::Client::new(config).await
47 }
48 }
49 }
50
51 /// Common implementation for [crate::client::ReservationService] request builders.
52 #[derive(Clone, Debug)]
53 pub(crate) struct RequestBuilder<R: std::default::Default> {
54 stub: std::sync::Arc<dyn super::super::stub::dynamic::ReservationService>,
55 request: R,
56 options: crate::RequestOptions,
57 }
58
59 impl<R> RequestBuilder<R>
60 where
61 R: std::default::Default,
62 {
63 pub(crate) fn new(
64 stub: std::sync::Arc<dyn super::super::stub::dynamic::ReservationService>,
65 ) -> Self {
66 Self {
67 stub,
68 request: R::default(),
69 options: crate::RequestOptions::default(),
70 }
71 }
72 }
73
74 /// The request builder for [ReservationService::create_reservation][crate::client::ReservationService::create_reservation] calls.
75 ///
76 /// # Example
77 /// ```
78 /// # use google_cloud_bigquery_reservation_v1::builder::reservation_service::CreateReservation;
79 /// # async fn sample() -> google_cloud_bigquery_reservation_v1::Result<()> {
80 ///
81 /// let builder = prepare_request_builder();
82 /// let response = builder.send().await?;
83 /// # Ok(()) }
84 ///
85 /// fn prepare_request_builder() -> CreateReservation {
86 /// # panic!();
87 /// // ... details omitted ...
88 /// }
89 /// ```
90 #[derive(Clone, Debug)]
91 pub struct CreateReservation(RequestBuilder<crate::model::CreateReservationRequest>);
92
93 impl CreateReservation {
94 pub(crate) fn new(
95 stub: std::sync::Arc<dyn super::super::stub::dynamic::ReservationService>,
96 ) -> Self {
97 Self(RequestBuilder::new(stub))
98 }
99
100 /// Sets the full request, replacing any prior values.
101 pub fn with_request<V: Into<crate::model::CreateReservationRequest>>(
102 mut self,
103 v: V,
104 ) -> Self {
105 self.0.request = v.into();
106 self
107 }
108
109 /// Sets all the options, replacing any prior values.
110 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
111 self.0.options = v.into();
112 self
113 }
114
115 /// Sends the request.
116 pub async fn send(self) -> Result<crate::model::Reservation> {
117 (*self.0.stub)
118 .create_reservation(self.0.request, self.0.options)
119 .await
120 .map(crate::Response::into_body)
121 }
122
123 /// Sets the value of [parent][crate::model::CreateReservationRequest::parent].
124 ///
125 /// This is a **required** field for requests.
126 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
127 self.0.request.parent = v.into();
128 self
129 }
130
131 /// Sets the value of [reservation_id][crate::model::CreateReservationRequest::reservation_id].
132 pub fn set_reservation_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
133 self.0.request.reservation_id = v.into();
134 self
135 }
136
137 /// Sets the value of [reservation][crate::model::CreateReservationRequest::reservation].
138 pub fn set_reservation<T>(mut self, v: T) -> Self
139 where
140 T: std::convert::Into<crate::model::Reservation>,
141 {
142 self.0.request.reservation = std::option::Option::Some(v.into());
143 self
144 }
145
146 /// Sets or clears the value of [reservation][crate::model::CreateReservationRequest::reservation].
147 pub fn set_or_clear_reservation<T>(mut self, v: std::option::Option<T>) -> Self
148 where
149 T: std::convert::Into<crate::model::Reservation>,
150 {
151 self.0.request.reservation = v.map(|x| x.into());
152 self
153 }
154 }
155
156 #[doc(hidden)]
157 impl crate::RequestBuilder for CreateReservation {
158 fn request_options(&mut self) -> &mut crate::RequestOptions {
159 &mut self.0.options
160 }
161 }
162
163 /// The request builder for [ReservationService::list_reservations][crate::client::ReservationService::list_reservations] calls.
164 ///
165 /// # Example
166 /// ```
167 /// # use google_cloud_bigquery_reservation_v1::builder::reservation_service::ListReservations;
168 /// # async fn sample() -> google_cloud_bigquery_reservation_v1::Result<()> {
169 /// use google_cloud_gax::paginator::ItemPaginator;
170 ///
171 /// let builder = prepare_request_builder();
172 /// let mut items = builder.by_item();
173 /// while let Some(result) = items.next().await {
174 /// let item = result?;
175 /// }
176 /// # Ok(()) }
177 ///
178 /// fn prepare_request_builder() -> ListReservations {
179 /// # panic!();
180 /// // ... details omitted ...
181 /// }
182 /// ```
183 #[derive(Clone, Debug)]
184 pub struct ListReservations(RequestBuilder<crate::model::ListReservationsRequest>);
185
186 impl ListReservations {
187 pub(crate) fn new(
188 stub: std::sync::Arc<dyn super::super::stub::dynamic::ReservationService>,
189 ) -> Self {
190 Self(RequestBuilder::new(stub))
191 }
192
193 /// Sets the full request, replacing any prior values.
194 pub fn with_request<V: Into<crate::model::ListReservationsRequest>>(
195 mut self,
196 v: V,
197 ) -> Self {
198 self.0.request = v.into();
199 self
200 }
201
202 /// Sets all the options, replacing any prior values.
203 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
204 self.0.options = v.into();
205 self
206 }
207
208 /// Sends the request.
209 pub async fn send(self) -> Result<crate::model::ListReservationsResponse> {
210 (*self.0.stub)
211 .list_reservations(self.0.request, self.0.options)
212 .await
213 .map(crate::Response::into_body)
214 }
215
216 /// Streams each page in the collection.
217 pub fn by_page(
218 self,
219 ) -> impl google_cloud_gax::paginator::Paginator<
220 crate::model::ListReservationsResponse,
221 crate::Error,
222 > {
223 use std::clone::Clone;
224 let token = self.0.request.page_token.clone();
225 let execute = move |token: String| {
226 let mut builder = self.clone();
227 builder.0.request = builder.0.request.set_page_token(token);
228 builder.send()
229 };
230 google_cloud_gax::paginator::internal::new_paginator(token, execute)
231 }
232
233 /// Streams each item in the collection.
234 pub fn by_item(
235 self,
236 ) -> impl google_cloud_gax::paginator::ItemPaginator<
237 crate::model::ListReservationsResponse,
238 crate::Error,
239 > {
240 use google_cloud_gax::paginator::Paginator;
241 self.by_page().items()
242 }
243
244 /// Sets the value of [parent][crate::model::ListReservationsRequest::parent].
245 ///
246 /// This is a **required** field for requests.
247 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
248 self.0.request.parent = v.into();
249 self
250 }
251
252 /// Sets the value of [page_size][crate::model::ListReservationsRequest::page_size].
253 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
254 self.0.request.page_size = v.into();
255 self
256 }
257
258 /// Sets the value of [page_token][crate::model::ListReservationsRequest::page_token].
259 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
260 self.0.request.page_token = v.into();
261 self
262 }
263 }
264
265 #[doc(hidden)]
266 impl crate::RequestBuilder for ListReservations {
267 fn request_options(&mut self) -> &mut crate::RequestOptions {
268 &mut self.0.options
269 }
270 }
271
272 /// The request builder for [ReservationService::get_reservation][crate::client::ReservationService::get_reservation] calls.
273 ///
274 /// # Example
275 /// ```
276 /// # use google_cloud_bigquery_reservation_v1::builder::reservation_service::GetReservation;
277 /// # async fn sample() -> google_cloud_bigquery_reservation_v1::Result<()> {
278 ///
279 /// let builder = prepare_request_builder();
280 /// let response = builder.send().await?;
281 /// # Ok(()) }
282 ///
283 /// fn prepare_request_builder() -> GetReservation {
284 /// # panic!();
285 /// // ... details omitted ...
286 /// }
287 /// ```
288 #[derive(Clone, Debug)]
289 pub struct GetReservation(RequestBuilder<crate::model::GetReservationRequest>);
290
291 impl GetReservation {
292 pub(crate) fn new(
293 stub: std::sync::Arc<dyn super::super::stub::dynamic::ReservationService>,
294 ) -> Self {
295 Self(RequestBuilder::new(stub))
296 }
297
298 /// Sets the full request, replacing any prior values.
299 pub fn with_request<V: Into<crate::model::GetReservationRequest>>(mut self, v: V) -> Self {
300 self.0.request = v.into();
301 self
302 }
303
304 /// Sets all the options, replacing any prior values.
305 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
306 self.0.options = v.into();
307 self
308 }
309
310 /// Sends the request.
311 pub async fn send(self) -> Result<crate::model::Reservation> {
312 (*self.0.stub)
313 .get_reservation(self.0.request, self.0.options)
314 .await
315 .map(crate::Response::into_body)
316 }
317
318 /// Sets the value of [name][crate::model::GetReservationRequest::name].
319 ///
320 /// This is a **required** field for requests.
321 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
322 self.0.request.name = v.into();
323 self
324 }
325 }
326
327 #[doc(hidden)]
328 impl crate::RequestBuilder for GetReservation {
329 fn request_options(&mut self) -> &mut crate::RequestOptions {
330 &mut self.0.options
331 }
332 }
333
334 /// The request builder for [ReservationService::delete_reservation][crate::client::ReservationService::delete_reservation] calls.
335 ///
336 /// # Example
337 /// ```
338 /// # use google_cloud_bigquery_reservation_v1::builder::reservation_service::DeleteReservation;
339 /// # async fn sample() -> google_cloud_bigquery_reservation_v1::Result<()> {
340 ///
341 /// let builder = prepare_request_builder();
342 /// let response = builder.send().await?;
343 /// # Ok(()) }
344 ///
345 /// fn prepare_request_builder() -> DeleteReservation {
346 /// # panic!();
347 /// // ... details omitted ...
348 /// }
349 /// ```
350 #[derive(Clone, Debug)]
351 pub struct DeleteReservation(RequestBuilder<crate::model::DeleteReservationRequest>);
352
353 impl DeleteReservation {
354 pub(crate) fn new(
355 stub: std::sync::Arc<dyn super::super::stub::dynamic::ReservationService>,
356 ) -> Self {
357 Self(RequestBuilder::new(stub))
358 }
359
360 /// Sets the full request, replacing any prior values.
361 pub fn with_request<V: Into<crate::model::DeleteReservationRequest>>(
362 mut self,
363 v: V,
364 ) -> Self {
365 self.0.request = v.into();
366 self
367 }
368
369 /// Sets all the options, replacing any prior values.
370 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
371 self.0.options = v.into();
372 self
373 }
374
375 /// Sends the request.
376 pub async fn send(self) -> Result<()> {
377 (*self.0.stub)
378 .delete_reservation(self.0.request, self.0.options)
379 .await
380 .map(crate::Response::into_body)
381 }
382
383 /// Sets the value of [name][crate::model::DeleteReservationRequest::name].
384 ///
385 /// This is a **required** field for requests.
386 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
387 self.0.request.name = v.into();
388 self
389 }
390 }
391
392 #[doc(hidden)]
393 impl crate::RequestBuilder for DeleteReservation {
394 fn request_options(&mut self) -> &mut crate::RequestOptions {
395 &mut self.0.options
396 }
397 }
398
399 /// The request builder for [ReservationService::update_reservation][crate::client::ReservationService::update_reservation] calls.
400 ///
401 /// # Example
402 /// ```
403 /// # use google_cloud_bigquery_reservation_v1::builder::reservation_service::UpdateReservation;
404 /// # async fn sample() -> google_cloud_bigquery_reservation_v1::Result<()> {
405 ///
406 /// let builder = prepare_request_builder();
407 /// let response = builder.send().await?;
408 /// # Ok(()) }
409 ///
410 /// fn prepare_request_builder() -> UpdateReservation {
411 /// # panic!();
412 /// // ... details omitted ...
413 /// }
414 /// ```
415 #[derive(Clone, Debug)]
416 pub struct UpdateReservation(RequestBuilder<crate::model::UpdateReservationRequest>);
417
418 impl UpdateReservation {
419 pub(crate) fn new(
420 stub: std::sync::Arc<dyn super::super::stub::dynamic::ReservationService>,
421 ) -> Self {
422 Self(RequestBuilder::new(stub))
423 }
424
425 /// Sets the full request, replacing any prior values.
426 pub fn with_request<V: Into<crate::model::UpdateReservationRequest>>(
427 mut self,
428 v: V,
429 ) -> Self {
430 self.0.request = v.into();
431 self
432 }
433
434 /// Sets all the options, replacing any prior values.
435 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
436 self.0.options = v.into();
437 self
438 }
439
440 /// Sends the request.
441 pub async fn send(self) -> Result<crate::model::Reservation> {
442 (*self.0.stub)
443 .update_reservation(self.0.request, self.0.options)
444 .await
445 .map(crate::Response::into_body)
446 }
447
448 /// Sets the value of [reservation][crate::model::UpdateReservationRequest::reservation].
449 pub fn set_reservation<T>(mut self, v: T) -> Self
450 where
451 T: std::convert::Into<crate::model::Reservation>,
452 {
453 self.0.request.reservation = std::option::Option::Some(v.into());
454 self
455 }
456
457 /// Sets or clears the value of [reservation][crate::model::UpdateReservationRequest::reservation].
458 pub fn set_or_clear_reservation<T>(mut self, v: std::option::Option<T>) -> Self
459 where
460 T: std::convert::Into<crate::model::Reservation>,
461 {
462 self.0.request.reservation = v.map(|x| x.into());
463 self
464 }
465
466 /// Sets the value of [update_mask][crate::model::UpdateReservationRequest::update_mask].
467 pub fn set_update_mask<T>(mut self, v: T) -> Self
468 where
469 T: std::convert::Into<wkt::FieldMask>,
470 {
471 self.0.request.update_mask = std::option::Option::Some(v.into());
472 self
473 }
474
475 /// Sets or clears the value of [update_mask][crate::model::UpdateReservationRequest::update_mask].
476 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
477 where
478 T: std::convert::Into<wkt::FieldMask>,
479 {
480 self.0.request.update_mask = v.map(|x| x.into());
481 self
482 }
483 }
484
485 #[doc(hidden)]
486 impl crate::RequestBuilder for UpdateReservation {
487 fn request_options(&mut self) -> &mut crate::RequestOptions {
488 &mut self.0.options
489 }
490 }
491
492 /// The request builder for [ReservationService::failover_reservation][crate::client::ReservationService::failover_reservation] calls.
493 ///
494 /// # Example
495 /// ```
496 /// # use google_cloud_bigquery_reservation_v1::builder::reservation_service::FailoverReservation;
497 /// # async fn sample() -> google_cloud_bigquery_reservation_v1::Result<()> {
498 ///
499 /// let builder = prepare_request_builder();
500 /// let response = builder.send().await?;
501 /// # Ok(()) }
502 ///
503 /// fn prepare_request_builder() -> FailoverReservation {
504 /// # panic!();
505 /// // ... details omitted ...
506 /// }
507 /// ```
508 #[derive(Clone, Debug)]
509 pub struct FailoverReservation(RequestBuilder<crate::model::FailoverReservationRequest>);
510
511 impl FailoverReservation {
512 pub(crate) fn new(
513 stub: std::sync::Arc<dyn super::super::stub::dynamic::ReservationService>,
514 ) -> Self {
515 Self(RequestBuilder::new(stub))
516 }
517
518 /// Sets the full request, replacing any prior values.
519 pub fn with_request<V: Into<crate::model::FailoverReservationRequest>>(
520 mut self,
521 v: V,
522 ) -> Self {
523 self.0.request = v.into();
524 self
525 }
526
527 /// Sets all the options, replacing any prior values.
528 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
529 self.0.options = v.into();
530 self
531 }
532
533 /// Sends the request.
534 pub async fn send(self) -> Result<crate::model::Reservation> {
535 (*self.0.stub)
536 .failover_reservation(self.0.request, self.0.options)
537 .await
538 .map(crate::Response::into_body)
539 }
540
541 /// Sets the value of [name][crate::model::FailoverReservationRequest::name].
542 ///
543 /// This is a **required** field for requests.
544 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
545 self.0.request.name = v.into();
546 self
547 }
548
549 /// Sets the value of [failover_mode][crate::model::FailoverReservationRequest::failover_mode].
550 pub fn set_failover_mode<T: Into<crate::model::FailoverMode>>(mut self, v: T) -> Self {
551 self.0.request.failover_mode = v.into();
552 self
553 }
554 }
555
556 #[doc(hidden)]
557 impl crate::RequestBuilder for FailoverReservation {
558 fn request_options(&mut self) -> &mut crate::RequestOptions {
559 &mut self.0.options
560 }
561 }
562
563 /// The request builder for [ReservationService::create_capacity_commitment][crate::client::ReservationService::create_capacity_commitment] calls.
564 ///
565 /// # Example
566 /// ```
567 /// # use google_cloud_bigquery_reservation_v1::builder::reservation_service::CreateCapacityCommitment;
568 /// # async fn sample() -> google_cloud_bigquery_reservation_v1::Result<()> {
569 ///
570 /// let builder = prepare_request_builder();
571 /// let response = builder.send().await?;
572 /// # Ok(()) }
573 ///
574 /// fn prepare_request_builder() -> CreateCapacityCommitment {
575 /// # panic!();
576 /// // ... details omitted ...
577 /// }
578 /// ```
579 #[derive(Clone, Debug)]
580 pub struct CreateCapacityCommitment(
581 RequestBuilder<crate::model::CreateCapacityCommitmentRequest>,
582 );
583
584 impl CreateCapacityCommitment {
585 pub(crate) fn new(
586 stub: std::sync::Arc<dyn super::super::stub::dynamic::ReservationService>,
587 ) -> Self {
588 Self(RequestBuilder::new(stub))
589 }
590
591 /// Sets the full request, replacing any prior values.
592 pub fn with_request<V: Into<crate::model::CreateCapacityCommitmentRequest>>(
593 mut self,
594 v: V,
595 ) -> Self {
596 self.0.request = v.into();
597 self
598 }
599
600 /// Sets all the options, replacing any prior values.
601 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
602 self.0.options = v.into();
603 self
604 }
605
606 /// Sends the request.
607 pub async fn send(self) -> Result<crate::model::CapacityCommitment> {
608 (*self.0.stub)
609 .create_capacity_commitment(self.0.request, self.0.options)
610 .await
611 .map(crate::Response::into_body)
612 }
613
614 /// Sets the value of [parent][crate::model::CreateCapacityCommitmentRequest::parent].
615 ///
616 /// This is a **required** field for requests.
617 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
618 self.0.request.parent = v.into();
619 self
620 }
621
622 /// Sets the value of [capacity_commitment][crate::model::CreateCapacityCommitmentRequest::capacity_commitment].
623 pub fn set_capacity_commitment<T>(mut self, v: T) -> Self
624 where
625 T: std::convert::Into<crate::model::CapacityCommitment>,
626 {
627 self.0.request.capacity_commitment = std::option::Option::Some(v.into());
628 self
629 }
630
631 /// Sets or clears the value of [capacity_commitment][crate::model::CreateCapacityCommitmentRequest::capacity_commitment].
632 pub fn set_or_clear_capacity_commitment<T>(mut self, v: std::option::Option<T>) -> Self
633 where
634 T: std::convert::Into<crate::model::CapacityCommitment>,
635 {
636 self.0.request.capacity_commitment = v.map(|x| x.into());
637 self
638 }
639
640 /// Sets the value of [enforce_single_admin_project_per_org][crate::model::CreateCapacityCommitmentRequest::enforce_single_admin_project_per_org].
641 pub fn set_enforce_single_admin_project_per_org<T: Into<bool>>(mut self, v: T) -> Self {
642 self.0.request.enforce_single_admin_project_per_org = v.into();
643 self
644 }
645
646 /// Sets the value of [capacity_commitment_id][crate::model::CreateCapacityCommitmentRequest::capacity_commitment_id].
647 pub fn set_capacity_commitment_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
648 self.0.request.capacity_commitment_id = v.into();
649 self
650 }
651 }
652
653 #[doc(hidden)]
654 impl crate::RequestBuilder for CreateCapacityCommitment {
655 fn request_options(&mut self) -> &mut crate::RequestOptions {
656 &mut self.0.options
657 }
658 }
659
660 /// The request builder for [ReservationService::list_capacity_commitments][crate::client::ReservationService::list_capacity_commitments] calls.
661 ///
662 /// # Example
663 /// ```
664 /// # use google_cloud_bigquery_reservation_v1::builder::reservation_service::ListCapacityCommitments;
665 /// # async fn sample() -> google_cloud_bigquery_reservation_v1::Result<()> {
666 /// use google_cloud_gax::paginator::ItemPaginator;
667 ///
668 /// let builder = prepare_request_builder();
669 /// let mut items = builder.by_item();
670 /// while let Some(result) = items.next().await {
671 /// let item = result?;
672 /// }
673 /// # Ok(()) }
674 ///
675 /// fn prepare_request_builder() -> ListCapacityCommitments {
676 /// # panic!();
677 /// // ... details omitted ...
678 /// }
679 /// ```
680 #[derive(Clone, Debug)]
681 pub struct ListCapacityCommitments(
682 RequestBuilder<crate::model::ListCapacityCommitmentsRequest>,
683 );
684
685 impl ListCapacityCommitments {
686 pub(crate) fn new(
687 stub: std::sync::Arc<dyn super::super::stub::dynamic::ReservationService>,
688 ) -> Self {
689 Self(RequestBuilder::new(stub))
690 }
691
692 /// Sets the full request, replacing any prior values.
693 pub fn with_request<V: Into<crate::model::ListCapacityCommitmentsRequest>>(
694 mut self,
695 v: V,
696 ) -> Self {
697 self.0.request = v.into();
698 self
699 }
700
701 /// Sets all the options, replacing any prior values.
702 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
703 self.0.options = v.into();
704 self
705 }
706
707 /// Sends the request.
708 pub async fn send(self) -> Result<crate::model::ListCapacityCommitmentsResponse> {
709 (*self.0.stub)
710 .list_capacity_commitments(self.0.request, self.0.options)
711 .await
712 .map(crate::Response::into_body)
713 }
714
715 /// Streams each page in the collection.
716 pub fn by_page(
717 self,
718 ) -> impl google_cloud_gax::paginator::Paginator<
719 crate::model::ListCapacityCommitmentsResponse,
720 crate::Error,
721 > {
722 use std::clone::Clone;
723 let token = self.0.request.page_token.clone();
724 let execute = move |token: String| {
725 let mut builder = self.clone();
726 builder.0.request = builder.0.request.set_page_token(token);
727 builder.send()
728 };
729 google_cloud_gax::paginator::internal::new_paginator(token, execute)
730 }
731
732 /// Streams each item in the collection.
733 pub fn by_item(
734 self,
735 ) -> impl google_cloud_gax::paginator::ItemPaginator<
736 crate::model::ListCapacityCommitmentsResponse,
737 crate::Error,
738 > {
739 use google_cloud_gax::paginator::Paginator;
740 self.by_page().items()
741 }
742
743 /// Sets the value of [parent][crate::model::ListCapacityCommitmentsRequest::parent].
744 ///
745 /// This is a **required** field for requests.
746 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
747 self.0.request.parent = v.into();
748 self
749 }
750
751 /// Sets the value of [page_size][crate::model::ListCapacityCommitmentsRequest::page_size].
752 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
753 self.0.request.page_size = v.into();
754 self
755 }
756
757 /// Sets the value of [page_token][crate::model::ListCapacityCommitmentsRequest::page_token].
758 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
759 self.0.request.page_token = v.into();
760 self
761 }
762 }
763
764 #[doc(hidden)]
765 impl crate::RequestBuilder for ListCapacityCommitments {
766 fn request_options(&mut self) -> &mut crate::RequestOptions {
767 &mut self.0.options
768 }
769 }
770
771 /// The request builder for [ReservationService::get_capacity_commitment][crate::client::ReservationService::get_capacity_commitment] calls.
772 ///
773 /// # Example
774 /// ```
775 /// # use google_cloud_bigquery_reservation_v1::builder::reservation_service::GetCapacityCommitment;
776 /// # async fn sample() -> google_cloud_bigquery_reservation_v1::Result<()> {
777 ///
778 /// let builder = prepare_request_builder();
779 /// let response = builder.send().await?;
780 /// # Ok(()) }
781 ///
782 /// fn prepare_request_builder() -> GetCapacityCommitment {
783 /// # panic!();
784 /// // ... details omitted ...
785 /// }
786 /// ```
787 #[derive(Clone, Debug)]
788 pub struct GetCapacityCommitment(RequestBuilder<crate::model::GetCapacityCommitmentRequest>);
789
790 impl GetCapacityCommitment {
791 pub(crate) fn new(
792 stub: std::sync::Arc<dyn super::super::stub::dynamic::ReservationService>,
793 ) -> Self {
794 Self(RequestBuilder::new(stub))
795 }
796
797 /// Sets the full request, replacing any prior values.
798 pub fn with_request<V: Into<crate::model::GetCapacityCommitmentRequest>>(
799 mut self,
800 v: V,
801 ) -> Self {
802 self.0.request = v.into();
803 self
804 }
805
806 /// Sets all the options, replacing any prior values.
807 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
808 self.0.options = v.into();
809 self
810 }
811
812 /// Sends the request.
813 pub async fn send(self) -> Result<crate::model::CapacityCommitment> {
814 (*self.0.stub)
815 .get_capacity_commitment(self.0.request, self.0.options)
816 .await
817 .map(crate::Response::into_body)
818 }
819
820 /// Sets the value of [name][crate::model::GetCapacityCommitmentRequest::name].
821 ///
822 /// This is a **required** field for requests.
823 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
824 self.0.request.name = v.into();
825 self
826 }
827 }
828
829 #[doc(hidden)]
830 impl crate::RequestBuilder for GetCapacityCommitment {
831 fn request_options(&mut self) -> &mut crate::RequestOptions {
832 &mut self.0.options
833 }
834 }
835
836 /// The request builder for [ReservationService::delete_capacity_commitment][crate::client::ReservationService::delete_capacity_commitment] calls.
837 ///
838 /// # Example
839 /// ```
840 /// # use google_cloud_bigquery_reservation_v1::builder::reservation_service::DeleteCapacityCommitment;
841 /// # async fn sample() -> google_cloud_bigquery_reservation_v1::Result<()> {
842 ///
843 /// let builder = prepare_request_builder();
844 /// let response = builder.send().await?;
845 /// # Ok(()) }
846 ///
847 /// fn prepare_request_builder() -> DeleteCapacityCommitment {
848 /// # panic!();
849 /// // ... details omitted ...
850 /// }
851 /// ```
852 #[derive(Clone, Debug)]
853 pub struct DeleteCapacityCommitment(
854 RequestBuilder<crate::model::DeleteCapacityCommitmentRequest>,
855 );
856
857 impl DeleteCapacityCommitment {
858 pub(crate) fn new(
859 stub: std::sync::Arc<dyn super::super::stub::dynamic::ReservationService>,
860 ) -> Self {
861 Self(RequestBuilder::new(stub))
862 }
863
864 /// Sets the full request, replacing any prior values.
865 pub fn with_request<V: Into<crate::model::DeleteCapacityCommitmentRequest>>(
866 mut self,
867 v: V,
868 ) -> Self {
869 self.0.request = v.into();
870 self
871 }
872
873 /// Sets all the options, replacing any prior values.
874 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
875 self.0.options = v.into();
876 self
877 }
878
879 /// Sends the request.
880 pub async fn send(self) -> Result<()> {
881 (*self.0.stub)
882 .delete_capacity_commitment(self.0.request, self.0.options)
883 .await
884 .map(crate::Response::into_body)
885 }
886
887 /// Sets the value of [name][crate::model::DeleteCapacityCommitmentRequest::name].
888 ///
889 /// This is a **required** field for requests.
890 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
891 self.0.request.name = v.into();
892 self
893 }
894
895 /// Sets the value of [force][crate::model::DeleteCapacityCommitmentRequest::force].
896 pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
897 self.0.request.force = v.into();
898 self
899 }
900 }
901
902 #[doc(hidden)]
903 impl crate::RequestBuilder for DeleteCapacityCommitment {
904 fn request_options(&mut self) -> &mut crate::RequestOptions {
905 &mut self.0.options
906 }
907 }
908
909 /// The request builder for [ReservationService::update_capacity_commitment][crate::client::ReservationService::update_capacity_commitment] calls.
910 ///
911 /// # Example
912 /// ```
913 /// # use google_cloud_bigquery_reservation_v1::builder::reservation_service::UpdateCapacityCommitment;
914 /// # async fn sample() -> google_cloud_bigquery_reservation_v1::Result<()> {
915 ///
916 /// let builder = prepare_request_builder();
917 /// let response = builder.send().await?;
918 /// # Ok(()) }
919 ///
920 /// fn prepare_request_builder() -> UpdateCapacityCommitment {
921 /// # panic!();
922 /// // ... details omitted ...
923 /// }
924 /// ```
925 #[derive(Clone, Debug)]
926 pub struct UpdateCapacityCommitment(
927 RequestBuilder<crate::model::UpdateCapacityCommitmentRequest>,
928 );
929
930 impl UpdateCapacityCommitment {
931 pub(crate) fn new(
932 stub: std::sync::Arc<dyn super::super::stub::dynamic::ReservationService>,
933 ) -> Self {
934 Self(RequestBuilder::new(stub))
935 }
936
937 /// Sets the full request, replacing any prior values.
938 pub fn with_request<V: Into<crate::model::UpdateCapacityCommitmentRequest>>(
939 mut self,
940 v: V,
941 ) -> Self {
942 self.0.request = v.into();
943 self
944 }
945
946 /// Sets all the options, replacing any prior values.
947 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
948 self.0.options = v.into();
949 self
950 }
951
952 /// Sends the request.
953 pub async fn send(self) -> Result<crate::model::CapacityCommitment> {
954 (*self.0.stub)
955 .update_capacity_commitment(self.0.request, self.0.options)
956 .await
957 .map(crate::Response::into_body)
958 }
959
960 /// Sets the value of [capacity_commitment][crate::model::UpdateCapacityCommitmentRequest::capacity_commitment].
961 pub fn set_capacity_commitment<T>(mut self, v: T) -> Self
962 where
963 T: std::convert::Into<crate::model::CapacityCommitment>,
964 {
965 self.0.request.capacity_commitment = std::option::Option::Some(v.into());
966 self
967 }
968
969 /// Sets or clears the value of [capacity_commitment][crate::model::UpdateCapacityCommitmentRequest::capacity_commitment].
970 pub fn set_or_clear_capacity_commitment<T>(mut self, v: std::option::Option<T>) -> Self
971 where
972 T: std::convert::Into<crate::model::CapacityCommitment>,
973 {
974 self.0.request.capacity_commitment = v.map(|x| x.into());
975 self
976 }
977
978 /// Sets the value of [update_mask][crate::model::UpdateCapacityCommitmentRequest::update_mask].
979 pub fn set_update_mask<T>(mut self, v: T) -> Self
980 where
981 T: std::convert::Into<wkt::FieldMask>,
982 {
983 self.0.request.update_mask = std::option::Option::Some(v.into());
984 self
985 }
986
987 /// Sets or clears the value of [update_mask][crate::model::UpdateCapacityCommitmentRequest::update_mask].
988 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
989 where
990 T: std::convert::Into<wkt::FieldMask>,
991 {
992 self.0.request.update_mask = v.map(|x| x.into());
993 self
994 }
995 }
996
997 #[doc(hidden)]
998 impl crate::RequestBuilder for UpdateCapacityCommitment {
999 fn request_options(&mut self) -> &mut crate::RequestOptions {
1000 &mut self.0.options
1001 }
1002 }
1003
1004 /// The request builder for [ReservationService::split_capacity_commitment][crate::client::ReservationService::split_capacity_commitment] calls.
1005 ///
1006 /// # Example
1007 /// ```
1008 /// # use google_cloud_bigquery_reservation_v1::builder::reservation_service::SplitCapacityCommitment;
1009 /// # async fn sample() -> google_cloud_bigquery_reservation_v1::Result<()> {
1010 ///
1011 /// let builder = prepare_request_builder();
1012 /// let response = builder.send().await?;
1013 /// # Ok(()) }
1014 ///
1015 /// fn prepare_request_builder() -> SplitCapacityCommitment {
1016 /// # panic!();
1017 /// // ... details omitted ...
1018 /// }
1019 /// ```
1020 #[derive(Clone, Debug)]
1021 pub struct SplitCapacityCommitment(
1022 RequestBuilder<crate::model::SplitCapacityCommitmentRequest>,
1023 );
1024
1025 impl SplitCapacityCommitment {
1026 pub(crate) fn new(
1027 stub: std::sync::Arc<dyn super::super::stub::dynamic::ReservationService>,
1028 ) -> Self {
1029 Self(RequestBuilder::new(stub))
1030 }
1031
1032 /// Sets the full request, replacing any prior values.
1033 pub fn with_request<V: Into<crate::model::SplitCapacityCommitmentRequest>>(
1034 mut self,
1035 v: V,
1036 ) -> Self {
1037 self.0.request = v.into();
1038 self
1039 }
1040
1041 /// Sets all the options, replacing any prior values.
1042 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1043 self.0.options = v.into();
1044 self
1045 }
1046
1047 /// Sends the request.
1048 pub async fn send(self) -> Result<crate::model::SplitCapacityCommitmentResponse> {
1049 (*self.0.stub)
1050 .split_capacity_commitment(self.0.request, self.0.options)
1051 .await
1052 .map(crate::Response::into_body)
1053 }
1054
1055 /// Sets the value of [name][crate::model::SplitCapacityCommitmentRequest::name].
1056 ///
1057 /// This is a **required** field for requests.
1058 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1059 self.0.request.name = v.into();
1060 self
1061 }
1062
1063 /// Sets the value of [slot_count][crate::model::SplitCapacityCommitmentRequest::slot_count].
1064 pub fn set_slot_count<T: Into<i64>>(mut self, v: T) -> Self {
1065 self.0.request.slot_count = v.into();
1066 self
1067 }
1068 }
1069
1070 #[doc(hidden)]
1071 impl crate::RequestBuilder for SplitCapacityCommitment {
1072 fn request_options(&mut self) -> &mut crate::RequestOptions {
1073 &mut self.0.options
1074 }
1075 }
1076
1077 /// The request builder for [ReservationService::merge_capacity_commitments][crate::client::ReservationService::merge_capacity_commitments] calls.
1078 ///
1079 /// # Example
1080 /// ```
1081 /// # use google_cloud_bigquery_reservation_v1::builder::reservation_service::MergeCapacityCommitments;
1082 /// # async fn sample() -> google_cloud_bigquery_reservation_v1::Result<()> {
1083 ///
1084 /// let builder = prepare_request_builder();
1085 /// let response = builder.send().await?;
1086 /// # Ok(()) }
1087 ///
1088 /// fn prepare_request_builder() -> MergeCapacityCommitments {
1089 /// # panic!();
1090 /// // ... details omitted ...
1091 /// }
1092 /// ```
1093 #[derive(Clone, Debug)]
1094 pub struct MergeCapacityCommitments(
1095 RequestBuilder<crate::model::MergeCapacityCommitmentsRequest>,
1096 );
1097
1098 impl MergeCapacityCommitments {
1099 pub(crate) fn new(
1100 stub: std::sync::Arc<dyn super::super::stub::dynamic::ReservationService>,
1101 ) -> Self {
1102 Self(RequestBuilder::new(stub))
1103 }
1104
1105 /// Sets the full request, replacing any prior values.
1106 pub fn with_request<V: Into<crate::model::MergeCapacityCommitmentsRequest>>(
1107 mut self,
1108 v: V,
1109 ) -> Self {
1110 self.0.request = v.into();
1111 self
1112 }
1113
1114 /// Sets all the options, replacing any prior values.
1115 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1116 self.0.options = v.into();
1117 self
1118 }
1119
1120 /// Sends the request.
1121 pub async fn send(self) -> Result<crate::model::CapacityCommitment> {
1122 (*self.0.stub)
1123 .merge_capacity_commitments(self.0.request, self.0.options)
1124 .await
1125 .map(crate::Response::into_body)
1126 }
1127
1128 /// Sets the value of [parent][crate::model::MergeCapacityCommitmentsRequest::parent].
1129 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1130 self.0.request.parent = v.into();
1131 self
1132 }
1133
1134 /// Sets the value of [capacity_commitment_ids][crate::model::MergeCapacityCommitmentsRequest::capacity_commitment_ids].
1135 pub fn set_capacity_commitment_ids<T, V>(mut self, v: T) -> Self
1136 where
1137 T: std::iter::IntoIterator<Item = V>,
1138 V: std::convert::Into<std::string::String>,
1139 {
1140 use std::iter::Iterator;
1141 self.0.request.capacity_commitment_ids = v.into_iter().map(|i| i.into()).collect();
1142 self
1143 }
1144
1145 /// Sets the value of [capacity_commitment_id][crate::model::MergeCapacityCommitmentsRequest::capacity_commitment_id].
1146 pub fn set_capacity_commitment_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1147 self.0.request.capacity_commitment_id = v.into();
1148 self
1149 }
1150 }
1151
1152 #[doc(hidden)]
1153 impl crate::RequestBuilder for MergeCapacityCommitments {
1154 fn request_options(&mut self) -> &mut crate::RequestOptions {
1155 &mut self.0.options
1156 }
1157 }
1158
1159 /// The request builder for [ReservationService::create_assignment][crate::client::ReservationService::create_assignment] calls.
1160 ///
1161 /// # Example
1162 /// ```
1163 /// # use google_cloud_bigquery_reservation_v1::builder::reservation_service::CreateAssignment;
1164 /// # async fn sample() -> google_cloud_bigquery_reservation_v1::Result<()> {
1165 ///
1166 /// let builder = prepare_request_builder();
1167 /// let response = builder.send().await?;
1168 /// # Ok(()) }
1169 ///
1170 /// fn prepare_request_builder() -> CreateAssignment {
1171 /// # panic!();
1172 /// // ... details omitted ...
1173 /// }
1174 /// ```
1175 #[derive(Clone, Debug)]
1176 pub struct CreateAssignment(RequestBuilder<crate::model::CreateAssignmentRequest>);
1177
1178 impl CreateAssignment {
1179 pub(crate) fn new(
1180 stub: std::sync::Arc<dyn super::super::stub::dynamic::ReservationService>,
1181 ) -> Self {
1182 Self(RequestBuilder::new(stub))
1183 }
1184
1185 /// Sets the full request, replacing any prior values.
1186 pub fn with_request<V: Into<crate::model::CreateAssignmentRequest>>(
1187 mut self,
1188 v: V,
1189 ) -> Self {
1190 self.0.request = v.into();
1191 self
1192 }
1193
1194 /// Sets all the options, replacing any prior values.
1195 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1196 self.0.options = v.into();
1197 self
1198 }
1199
1200 /// Sends the request.
1201 pub async fn send(self) -> Result<crate::model::Assignment> {
1202 (*self.0.stub)
1203 .create_assignment(self.0.request, self.0.options)
1204 .await
1205 .map(crate::Response::into_body)
1206 }
1207
1208 /// Sets the value of [parent][crate::model::CreateAssignmentRequest::parent].
1209 ///
1210 /// This is a **required** field for requests.
1211 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1212 self.0.request.parent = v.into();
1213 self
1214 }
1215
1216 /// Sets the value of [assignment][crate::model::CreateAssignmentRequest::assignment].
1217 pub fn set_assignment<T>(mut self, v: T) -> Self
1218 where
1219 T: std::convert::Into<crate::model::Assignment>,
1220 {
1221 self.0.request.assignment = std::option::Option::Some(v.into());
1222 self
1223 }
1224
1225 /// Sets or clears the value of [assignment][crate::model::CreateAssignmentRequest::assignment].
1226 pub fn set_or_clear_assignment<T>(mut self, v: std::option::Option<T>) -> Self
1227 where
1228 T: std::convert::Into<crate::model::Assignment>,
1229 {
1230 self.0.request.assignment = v.map(|x| x.into());
1231 self
1232 }
1233
1234 /// Sets the value of [assignment_id][crate::model::CreateAssignmentRequest::assignment_id].
1235 pub fn set_assignment_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1236 self.0.request.assignment_id = v.into();
1237 self
1238 }
1239 }
1240
1241 #[doc(hidden)]
1242 impl crate::RequestBuilder for CreateAssignment {
1243 fn request_options(&mut self) -> &mut crate::RequestOptions {
1244 &mut self.0.options
1245 }
1246 }
1247
1248 /// The request builder for [ReservationService::list_assignments][crate::client::ReservationService::list_assignments] calls.
1249 ///
1250 /// # Example
1251 /// ```
1252 /// # use google_cloud_bigquery_reservation_v1::builder::reservation_service::ListAssignments;
1253 /// # async fn sample() -> google_cloud_bigquery_reservation_v1::Result<()> {
1254 /// use google_cloud_gax::paginator::ItemPaginator;
1255 ///
1256 /// let builder = prepare_request_builder();
1257 /// let mut items = builder.by_item();
1258 /// while let Some(result) = items.next().await {
1259 /// let item = result?;
1260 /// }
1261 /// # Ok(()) }
1262 ///
1263 /// fn prepare_request_builder() -> ListAssignments {
1264 /// # panic!();
1265 /// // ... details omitted ...
1266 /// }
1267 /// ```
1268 #[derive(Clone, Debug)]
1269 pub struct ListAssignments(RequestBuilder<crate::model::ListAssignmentsRequest>);
1270
1271 impl ListAssignments {
1272 pub(crate) fn new(
1273 stub: std::sync::Arc<dyn super::super::stub::dynamic::ReservationService>,
1274 ) -> Self {
1275 Self(RequestBuilder::new(stub))
1276 }
1277
1278 /// Sets the full request, replacing any prior values.
1279 pub fn with_request<V: Into<crate::model::ListAssignmentsRequest>>(mut self, v: V) -> Self {
1280 self.0.request = v.into();
1281 self
1282 }
1283
1284 /// Sets all the options, replacing any prior values.
1285 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1286 self.0.options = v.into();
1287 self
1288 }
1289
1290 /// Sends the request.
1291 pub async fn send(self) -> Result<crate::model::ListAssignmentsResponse> {
1292 (*self.0.stub)
1293 .list_assignments(self.0.request, self.0.options)
1294 .await
1295 .map(crate::Response::into_body)
1296 }
1297
1298 /// Streams each page in the collection.
1299 pub fn by_page(
1300 self,
1301 ) -> impl google_cloud_gax::paginator::Paginator<
1302 crate::model::ListAssignmentsResponse,
1303 crate::Error,
1304 > {
1305 use std::clone::Clone;
1306 let token = self.0.request.page_token.clone();
1307 let execute = move |token: String| {
1308 let mut builder = self.clone();
1309 builder.0.request = builder.0.request.set_page_token(token);
1310 builder.send()
1311 };
1312 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1313 }
1314
1315 /// Streams each item in the collection.
1316 pub fn by_item(
1317 self,
1318 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1319 crate::model::ListAssignmentsResponse,
1320 crate::Error,
1321 > {
1322 use google_cloud_gax::paginator::Paginator;
1323 self.by_page().items()
1324 }
1325
1326 /// Sets the value of [parent][crate::model::ListAssignmentsRequest::parent].
1327 ///
1328 /// This is a **required** field for requests.
1329 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1330 self.0.request.parent = v.into();
1331 self
1332 }
1333
1334 /// Sets the value of [page_size][crate::model::ListAssignmentsRequest::page_size].
1335 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1336 self.0.request.page_size = v.into();
1337 self
1338 }
1339
1340 /// Sets the value of [page_token][crate::model::ListAssignmentsRequest::page_token].
1341 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1342 self.0.request.page_token = v.into();
1343 self
1344 }
1345 }
1346
1347 #[doc(hidden)]
1348 impl crate::RequestBuilder for ListAssignments {
1349 fn request_options(&mut self) -> &mut crate::RequestOptions {
1350 &mut self.0.options
1351 }
1352 }
1353
1354 /// The request builder for [ReservationService::delete_assignment][crate::client::ReservationService::delete_assignment] calls.
1355 ///
1356 /// # Example
1357 /// ```
1358 /// # use google_cloud_bigquery_reservation_v1::builder::reservation_service::DeleteAssignment;
1359 /// # async fn sample() -> google_cloud_bigquery_reservation_v1::Result<()> {
1360 ///
1361 /// let builder = prepare_request_builder();
1362 /// let response = builder.send().await?;
1363 /// # Ok(()) }
1364 ///
1365 /// fn prepare_request_builder() -> DeleteAssignment {
1366 /// # panic!();
1367 /// // ... details omitted ...
1368 /// }
1369 /// ```
1370 #[derive(Clone, Debug)]
1371 pub struct DeleteAssignment(RequestBuilder<crate::model::DeleteAssignmentRequest>);
1372
1373 impl DeleteAssignment {
1374 pub(crate) fn new(
1375 stub: std::sync::Arc<dyn super::super::stub::dynamic::ReservationService>,
1376 ) -> Self {
1377 Self(RequestBuilder::new(stub))
1378 }
1379
1380 /// Sets the full request, replacing any prior values.
1381 pub fn with_request<V: Into<crate::model::DeleteAssignmentRequest>>(
1382 mut self,
1383 v: V,
1384 ) -> Self {
1385 self.0.request = v.into();
1386 self
1387 }
1388
1389 /// Sets all the options, replacing any prior values.
1390 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1391 self.0.options = v.into();
1392 self
1393 }
1394
1395 /// Sends the request.
1396 pub async fn send(self) -> Result<()> {
1397 (*self.0.stub)
1398 .delete_assignment(self.0.request, self.0.options)
1399 .await
1400 .map(crate::Response::into_body)
1401 }
1402
1403 /// Sets the value of [name][crate::model::DeleteAssignmentRequest::name].
1404 ///
1405 /// This is a **required** field for requests.
1406 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1407 self.0.request.name = v.into();
1408 self
1409 }
1410 }
1411
1412 #[doc(hidden)]
1413 impl crate::RequestBuilder for DeleteAssignment {
1414 fn request_options(&mut self) -> &mut crate::RequestOptions {
1415 &mut self.0.options
1416 }
1417 }
1418
1419 /// The request builder for [ReservationService::search_assignments][crate::client::ReservationService::search_assignments] calls.
1420 ///
1421 /// # Example
1422 /// ```
1423 /// # use google_cloud_bigquery_reservation_v1::builder::reservation_service::SearchAssignments;
1424 /// # async fn sample() -> google_cloud_bigquery_reservation_v1::Result<()> {
1425 /// use google_cloud_gax::paginator::ItemPaginator;
1426 ///
1427 /// let builder = prepare_request_builder();
1428 /// let mut items = builder.by_item();
1429 /// while let Some(result) = items.next().await {
1430 /// let item = result?;
1431 /// }
1432 /// # Ok(()) }
1433 ///
1434 /// fn prepare_request_builder() -> SearchAssignments {
1435 /// # panic!();
1436 /// // ... details omitted ...
1437 /// }
1438 /// ```
1439 #[derive(Clone, Debug)]
1440 pub struct SearchAssignments(RequestBuilder<crate::model::SearchAssignmentsRequest>);
1441
1442 impl SearchAssignments {
1443 pub(crate) fn new(
1444 stub: std::sync::Arc<dyn super::super::stub::dynamic::ReservationService>,
1445 ) -> Self {
1446 Self(RequestBuilder::new(stub))
1447 }
1448
1449 /// Sets the full request, replacing any prior values.
1450 pub fn with_request<V: Into<crate::model::SearchAssignmentsRequest>>(
1451 mut self,
1452 v: V,
1453 ) -> Self {
1454 self.0.request = v.into();
1455 self
1456 }
1457
1458 /// Sets all the options, replacing any prior values.
1459 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1460 self.0.options = v.into();
1461 self
1462 }
1463
1464 /// Sends the request.
1465 pub async fn send(self) -> Result<crate::model::SearchAssignmentsResponse> {
1466 (*self.0.stub)
1467 .search_assignments(self.0.request, self.0.options)
1468 .await
1469 .map(crate::Response::into_body)
1470 }
1471
1472 /// Streams each page in the collection.
1473 pub fn by_page(
1474 self,
1475 ) -> impl google_cloud_gax::paginator::Paginator<
1476 crate::model::SearchAssignmentsResponse,
1477 crate::Error,
1478 > {
1479 use std::clone::Clone;
1480 let token = self.0.request.page_token.clone();
1481 let execute = move |token: String| {
1482 let mut builder = self.clone();
1483 builder.0.request = builder.0.request.set_page_token(token);
1484 builder.send()
1485 };
1486 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1487 }
1488
1489 /// Streams each item in the collection.
1490 pub fn by_item(
1491 self,
1492 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1493 crate::model::SearchAssignmentsResponse,
1494 crate::Error,
1495 > {
1496 use google_cloud_gax::paginator::Paginator;
1497 self.by_page().items()
1498 }
1499
1500 /// Sets the value of [parent][crate::model::SearchAssignmentsRequest::parent].
1501 ///
1502 /// This is a **required** field for requests.
1503 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1504 self.0.request.parent = v.into();
1505 self
1506 }
1507
1508 /// Sets the value of [query][crate::model::SearchAssignmentsRequest::query].
1509 pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
1510 self.0.request.query = v.into();
1511 self
1512 }
1513
1514 /// Sets the value of [page_size][crate::model::SearchAssignmentsRequest::page_size].
1515 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1516 self.0.request.page_size = v.into();
1517 self
1518 }
1519
1520 /// Sets the value of [page_token][crate::model::SearchAssignmentsRequest::page_token].
1521 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1522 self.0.request.page_token = v.into();
1523 self
1524 }
1525 }
1526
1527 #[doc(hidden)]
1528 impl crate::RequestBuilder for SearchAssignments {
1529 fn request_options(&mut self) -> &mut crate::RequestOptions {
1530 &mut self.0.options
1531 }
1532 }
1533
1534 /// The request builder for [ReservationService::search_all_assignments][crate::client::ReservationService::search_all_assignments] calls.
1535 ///
1536 /// # Example
1537 /// ```
1538 /// # use google_cloud_bigquery_reservation_v1::builder::reservation_service::SearchAllAssignments;
1539 /// # async fn sample() -> google_cloud_bigquery_reservation_v1::Result<()> {
1540 /// use google_cloud_gax::paginator::ItemPaginator;
1541 ///
1542 /// let builder = prepare_request_builder();
1543 /// let mut items = builder.by_item();
1544 /// while let Some(result) = items.next().await {
1545 /// let item = result?;
1546 /// }
1547 /// # Ok(()) }
1548 ///
1549 /// fn prepare_request_builder() -> SearchAllAssignments {
1550 /// # panic!();
1551 /// // ... details omitted ...
1552 /// }
1553 /// ```
1554 #[derive(Clone, Debug)]
1555 pub struct SearchAllAssignments(RequestBuilder<crate::model::SearchAllAssignmentsRequest>);
1556
1557 impl SearchAllAssignments {
1558 pub(crate) fn new(
1559 stub: std::sync::Arc<dyn super::super::stub::dynamic::ReservationService>,
1560 ) -> Self {
1561 Self(RequestBuilder::new(stub))
1562 }
1563
1564 /// Sets the full request, replacing any prior values.
1565 pub fn with_request<V: Into<crate::model::SearchAllAssignmentsRequest>>(
1566 mut self,
1567 v: V,
1568 ) -> Self {
1569 self.0.request = v.into();
1570 self
1571 }
1572
1573 /// Sets all the options, replacing any prior values.
1574 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1575 self.0.options = v.into();
1576 self
1577 }
1578
1579 /// Sends the request.
1580 pub async fn send(self) -> Result<crate::model::SearchAllAssignmentsResponse> {
1581 (*self.0.stub)
1582 .search_all_assignments(self.0.request, self.0.options)
1583 .await
1584 .map(crate::Response::into_body)
1585 }
1586
1587 /// Streams each page in the collection.
1588 pub fn by_page(
1589 self,
1590 ) -> impl google_cloud_gax::paginator::Paginator<
1591 crate::model::SearchAllAssignmentsResponse,
1592 crate::Error,
1593 > {
1594 use std::clone::Clone;
1595 let token = self.0.request.page_token.clone();
1596 let execute = move |token: String| {
1597 let mut builder = self.clone();
1598 builder.0.request = builder.0.request.set_page_token(token);
1599 builder.send()
1600 };
1601 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1602 }
1603
1604 /// Streams each item in the collection.
1605 pub fn by_item(
1606 self,
1607 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1608 crate::model::SearchAllAssignmentsResponse,
1609 crate::Error,
1610 > {
1611 use google_cloud_gax::paginator::Paginator;
1612 self.by_page().items()
1613 }
1614
1615 /// Sets the value of [parent][crate::model::SearchAllAssignmentsRequest::parent].
1616 ///
1617 /// This is a **required** field for requests.
1618 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1619 self.0.request.parent = v.into();
1620 self
1621 }
1622
1623 /// Sets the value of [query][crate::model::SearchAllAssignmentsRequest::query].
1624 pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
1625 self.0.request.query = v.into();
1626 self
1627 }
1628
1629 /// Sets the value of [page_size][crate::model::SearchAllAssignmentsRequest::page_size].
1630 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1631 self.0.request.page_size = v.into();
1632 self
1633 }
1634
1635 /// Sets the value of [page_token][crate::model::SearchAllAssignmentsRequest::page_token].
1636 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1637 self.0.request.page_token = v.into();
1638 self
1639 }
1640 }
1641
1642 #[doc(hidden)]
1643 impl crate::RequestBuilder for SearchAllAssignments {
1644 fn request_options(&mut self) -> &mut crate::RequestOptions {
1645 &mut self.0.options
1646 }
1647 }
1648
1649 /// The request builder for [ReservationService::move_assignment][crate::client::ReservationService::move_assignment] calls.
1650 ///
1651 /// # Example
1652 /// ```
1653 /// # use google_cloud_bigquery_reservation_v1::builder::reservation_service::MoveAssignment;
1654 /// # async fn sample() -> google_cloud_bigquery_reservation_v1::Result<()> {
1655 ///
1656 /// let builder = prepare_request_builder();
1657 /// let response = builder.send().await?;
1658 /// # Ok(()) }
1659 ///
1660 /// fn prepare_request_builder() -> MoveAssignment {
1661 /// # panic!();
1662 /// // ... details omitted ...
1663 /// }
1664 /// ```
1665 #[derive(Clone, Debug)]
1666 pub struct MoveAssignment(RequestBuilder<crate::model::MoveAssignmentRequest>);
1667
1668 impl MoveAssignment {
1669 pub(crate) fn new(
1670 stub: std::sync::Arc<dyn super::super::stub::dynamic::ReservationService>,
1671 ) -> Self {
1672 Self(RequestBuilder::new(stub))
1673 }
1674
1675 /// Sets the full request, replacing any prior values.
1676 pub fn with_request<V: Into<crate::model::MoveAssignmentRequest>>(mut self, v: V) -> Self {
1677 self.0.request = v.into();
1678 self
1679 }
1680
1681 /// Sets all the options, replacing any prior values.
1682 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1683 self.0.options = v.into();
1684 self
1685 }
1686
1687 /// Sends the request.
1688 pub async fn send(self) -> Result<crate::model::Assignment> {
1689 (*self.0.stub)
1690 .move_assignment(self.0.request, self.0.options)
1691 .await
1692 .map(crate::Response::into_body)
1693 }
1694
1695 /// Sets the value of [name][crate::model::MoveAssignmentRequest::name].
1696 ///
1697 /// This is a **required** field for requests.
1698 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1699 self.0.request.name = v.into();
1700 self
1701 }
1702
1703 /// Sets the value of [destination_id][crate::model::MoveAssignmentRequest::destination_id].
1704 pub fn set_destination_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1705 self.0.request.destination_id = v.into();
1706 self
1707 }
1708
1709 /// Sets the value of [assignment_id][crate::model::MoveAssignmentRequest::assignment_id].
1710 pub fn set_assignment_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1711 self.0.request.assignment_id = v.into();
1712 self
1713 }
1714 }
1715
1716 #[doc(hidden)]
1717 impl crate::RequestBuilder for MoveAssignment {
1718 fn request_options(&mut self) -> &mut crate::RequestOptions {
1719 &mut self.0.options
1720 }
1721 }
1722
1723 /// The request builder for [ReservationService::update_assignment][crate::client::ReservationService::update_assignment] calls.
1724 ///
1725 /// # Example
1726 /// ```
1727 /// # use google_cloud_bigquery_reservation_v1::builder::reservation_service::UpdateAssignment;
1728 /// # async fn sample() -> google_cloud_bigquery_reservation_v1::Result<()> {
1729 ///
1730 /// let builder = prepare_request_builder();
1731 /// let response = builder.send().await?;
1732 /// # Ok(()) }
1733 ///
1734 /// fn prepare_request_builder() -> UpdateAssignment {
1735 /// # panic!();
1736 /// // ... details omitted ...
1737 /// }
1738 /// ```
1739 #[derive(Clone, Debug)]
1740 pub struct UpdateAssignment(RequestBuilder<crate::model::UpdateAssignmentRequest>);
1741
1742 impl UpdateAssignment {
1743 pub(crate) fn new(
1744 stub: std::sync::Arc<dyn super::super::stub::dynamic::ReservationService>,
1745 ) -> Self {
1746 Self(RequestBuilder::new(stub))
1747 }
1748
1749 /// Sets the full request, replacing any prior values.
1750 pub fn with_request<V: Into<crate::model::UpdateAssignmentRequest>>(
1751 mut self,
1752 v: V,
1753 ) -> Self {
1754 self.0.request = v.into();
1755 self
1756 }
1757
1758 /// Sets all the options, replacing any prior values.
1759 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1760 self.0.options = v.into();
1761 self
1762 }
1763
1764 /// Sends the request.
1765 pub async fn send(self) -> Result<crate::model::Assignment> {
1766 (*self.0.stub)
1767 .update_assignment(self.0.request, self.0.options)
1768 .await
1769 .map(crate::Response::into_body)
1770 }
1771
1772 /// Sets the value of [assignment][crate::model::UpdateAssignmentRequest::assignment].
1773 pub fn set_assignment<T>(mut self, v: T) -> Self
1774 where
1775 T: std::convert::Into<crate::model::Assignment>,
1776 {
1777 self.0.request.assignment = std::option::Option::Some(v.into());
1778 self
1779 }
1780
1781 /// Sets or clears the value of [assignment][crate::model::UpdateAssignmentRequest::assignment].
1782 pub fn set_or_clear_assignment<T>(mut self, v: std::option::Option<T>) -> Self
1783 where
1784 T: std::convert::Into<crate::model::Assignment>,
1785 {
1786 self.0.request.assignment = v.map(|x| x.into());
1787 self
1788 }
1789
1790 /// Sets the value of [update_mask][crate::model::UpdateAssignmentRequest::update_mask].
1791 pub fn set_update_mask<T>(mut self, v: T) -> Self
1792 where
1793 T: std::convert::Into<wkt::FieldMask>,
1794 {
1795 self.0.request.update_mask = std::option::Option::Some(v.into());
1796 self
1797 }
1798
1799 /// Sets or clears the value of [update_mask][crate::model::UpdateAssignmentRequest::update_mask].
1800 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1801 where
1802 T: std::convert::Into<wkt::FieldMask>,
1803 {
1804 self.0.request.update_mask = v.map(|x| x.into());
1805 self
1806 }
1807 }
1808
1809 #[doc(hidden)]
1810 impl crate::RequestBuilder for UpdateAssignment {
1811 fn request_options(&mut self) -> &mut crate::RequestOptions {
1812 &mut self.0.options
1813 }
1814 }
1815
1816 /// The request builder for [ReservationService::get_bi_reservation][crate::client::ReservationService::get_bi_reservation] calls.
1817 ///
1818 /// # Example
1819 /// ```
1820 /// # use google_cloud_bigquery_reservation_v1::builder::reservation_service::GetBiReservation;
1821 /// # async fn sample() -> google_cloud_bigquery_reservation_v1::Result<()> {
1822 ///
1823 /// let builder = prepare_request_builder();
1824 /// let response = builder.send().await?;
1825 /// # Ok(()) }
1826 ///
1827 /// fn prepare_request_builder() -> GetBiReservation {
1828 /// # panic!();
1829 /// // ... details omitted ...
1830 /// }
1831 /// ```
1832 #[derive(Clone, Debug)]
1833 pub struct GetBiReservation(RequestBuilder<crate::model::GetBiReservationRequest>);
1834
1835 impl GetBiReservation {
1836 pub(crate) fn new(
1837 stub: std::sync::Arc<dyn super::super::stub::dynamic::ReservationService>,
1838 ) -> Self {
1839 Self(RequestBuilder::new(stub))
1840 }
1841
1842 /// Sets the full request, replacing any prior values.
1843 pub fn with_request<V: Into<crate::model::GetBiReservationRequest>>(
1844 mut self,
1845 v: V,
1846 ) -> Self {
1847 self.0.request = v.into();
1848 self
1849 }
1850
1851 /// Sets all the options, replacing any prior values.
1852 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1853 self.0.options = v.into();
1854 self
1855 }
1856
1857 /// Sends the request.
1858 pub async fn send(self) -> Result<crate::model::BiReservation> {
1859 (*self.0.stub)
1860 .get_bi_reservation(self.0.request, self.0.options)
1861 .await
1862 .map(crate::Response::into_body)
1863 }
1864
1865 /// Sets the value of [name][crate::model::GetBiReservationRequest::name].
1866 ///
1867 /// This is a **required** field for requests.
1868 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1869 self.0.request.name = v.into();
1870 self
1871 }
1872 }
1873
1874 #[doc(hidden)]
1875 impl crate::RequestBuilder for GetBiReservation {
1876 fn request_options(&mut self) -> &mut crate::RequestOptions {
1877 &mut self.0.options
1878 }
1879 }
1880
1881 /// The request builder for [ReservationService::update_bi_reservation][crate::client::ReservationService::update_bi_reservation] calls.
1882 ///
1883 /// # Example
1884 /// ```
1885 /// # use google_cloud_bigquery_reservation_v1::builder::reservation_service::UpdateBiReservation;
1886 /// # async fn sample() -> google_cloud_bigquery_reservation_v1::Result<()> {
1887 ///
1888 /// let builder = prepare_request_builder();
1889 /// let response = builder.send().await?;
1890 /// # Ok(()) }
1891 ///
1892 /// fn prepare_request_builder() -> UpdateBiReservation {
1893 /// # panic!();
1894 /// // ... details omitted ...
1895 /// }
1896 /// ```
1897 #[derive(Clone, Debug)]
1898 pub struct UpdateBiReservation(RequestBuilder<crate::model::UpdateBiReservationRequest>);
1899
1900 impl UpdateBiReservation {
1901 pub(crate) fn new(
1902 stub: std::sync::Arc<dyn super::super::stub::dynamic::ReservationService>,
1903 ) -> Self {
1904 Self(RequestBuilder::new(stub))
1905 }
1906
1907 /// Sets the full request, replacing any prior values.
1908 pub fn with_request<V: Into<crate::model::UpdateBiReservationRequest>>(
1909 mut self,
1910 v: V,
1911 ) -> Self {
1912 self.0.request = v.into();
1913 self
1914 }
1915
1916 /// Sets all the options, replacing any prior values.
1917 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1918 self.0.options = v.into();
1919 self
1920 }
1921
1922 /// Sends the request.
1923 pub async fn send(self) -> Result<crate::model::BiReservation> {
1924 (*self.0.stub)
1925 .update_bi_reservation(self.0.request, self.0.options)
1926 .await
1927 .map(crate::Response::into_body)
1928 }
1929
1930 /// Sets the value of [bi_reservation][crate::model::UpdateBiReservationRequest::bi_reservation].
1931 pub fn set_bi_reservation<T>(mut self, v: T) -> Self
1932 where
1933 T: std::convert::Into<crate::model::BiReservation>,
1934 {
1935 self.0.request.bi_reservation = std::option::Option::Some(v.into());
1936 self
1937 }
1938
1939 /// Sets or clears the value of [bi_reservation][crate::model::UpdateBiReservationRequest::bi_reservation].
1940 pub fn set_or_clear_bi_reservation<T>(mut self, v: std::option::Option<T>) -> Self
1941 where
1942 T: std::convert::Into<crate::model::BiReservation>,
1943 {
1944 self.0.request.bi_reservation = v.map(|x| x.into());
1945 self
1946 }
1947
1948 /// Sets the value of [update_mask][crate::model::UpdateBiReservationRequest::update_mask].
1949 pub fn set_update_mask<T>(mut self, v: T) -> Self
1950 where
1951 T: std::convert::Into<wkt::FieldMask>,
1952 {
1953 self.0.request.update_mask = std::option::Option::Some(v.into());
1954 self
1955 }
1956
1957 /// Sets or clears the value of [update_mask][crate::model::UpdateBiReservationRequest::update_mask].
1958 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1959 where
1960 T: std::convert::Into<wkt::FieldMask>,
1961 {
1962 self.0.request.update_mask = v.map(|x| x.into());
1963 self
1964 }
1965 }
1966
1967 #[doc(hidden)]
1968 impl crate::RequestBuilder for UpdateBiReservation {
1969 fn request_options(&mut self) -> &mut crate::RequestOptions {
1970 &mut self.0.options
1971 }
1972 }
1973
1974 /// The request builder for [ReservationService::get_iam_policy][crate::client::ReservationService::get_iam_policy] calls.
1975 ///
1976 /// # Example
1977 /// ```
1978 /// # use google_cloud_bigquery_reservation_v1::builder::reservation_service::GetIamPolicy;
1979 /// # async fn sample() -> google_cloud_bigquery_reservation_v1::Result<()> {
1980 ///
1981 /// let builder = prepare_request_builder();
1982 /// let response = builder.send().await?;
1983 /// # Ok(()) }
1984 ///
1985 /// fn prepare_request_builder() -> GetIamPolicy {
1986 /// # panic!();
1987 /// // ... details omitted ...
1988 /// }
1989 /// ```
1990 #[derive(Clone, Debug)]
1991 pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
1992
1993 impl GetIamPolicy {
1994 pub(crate) fn new(
1995 stub: std::sync::Arc<dyn super::super::stub::dynamic::ReservationService>,
1996 ) -> Self {
1997 Self(RequestBuilder::new(stub))
1998 }
1999
2000 /// Sets the full request, replacing any prior values.
2001 pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
2002 mut self,
2003 v: V,
2004 ) -> Self {
2005 self.0.request = v.into();
2006 self
2007 }
2008
2009 /// Sets all the options, replacing any prior values.
2010 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2011 self.0.options = v.into();
2012 self
2013 }
2014
2015 /// Sends the request.
2016 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
2017 (*self.0.stub)
2018 .get_iam_policy(self.0.request, self.0.options)
2019 .await
2020 .map(crate::Response::into_body)
2021 }
2022
2023 /// Sets the value of [resource][google_cloud_iam_v1::model::GetIamPolicyRequest::resource].
2024 ///
2025 /// This is a **required** field for requests.
2026 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
2027 self.0.request.resource = v.into();
2028 self
2029 }
2030
2031 /// Sets the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
2032 pub fn set_options<T>(mut self, v: T) -> Self
2033 where
2034 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
2035 {
2036 self.0.request.options = std::option::Option::Some(v.into());
2037 self
2038 }
2039
2040 /// Sets or clears the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
2041 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
2042 where
2043 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
2044 {
2045 self.0.request.options = v.map(|x| x.into());
2046 self
2047 }
2048 }
2049
2050 #[doc(hidden)]
2051 impl crate::RequestBuilder for GetIamPolicy {
2052 fn request_options(&mut self) -> &mut crate::RequestOptions {
2053 &mut self.0.options
2054 }
2055 }
2056
2057 /// The request builder for [ReservationService::set_iam_policy][crate::client::ReservationService::set_iam_policy] calls.
2058 ///
2059 /// # Example
2060 /// ```
2061 /// # use google_cloud_bigquery_reservation_v1::builder::reservation_service::SetIamPolicy;
2062 /// # async fn sample() -> google_cloud_bigquery_reservation_v1::Result<()> {
2063 ///
2064 /// let builder = prepare_request_builder();
2065 /// let response = builder.send().await?;
2066 /// # Ok(()) }
2067 ///
2068 /// fn prepare_request_builder() -> SetIamPolicy {
2069 /// # panic!();
2070 /// // ... details omitted ...
2071 /// }
2072 /// ```
2073 #[derive(Clone, Debug)]
2074 pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
2075
2076 impl SetIamPolicy {
2077 pub(crate) fn new(
2078 stub: std::sync::Arc<dyn super::super::stub::dynamic::ReservationService>,
2079 ) -> Self {
2080 Self(RequestBuilder::new(stub))
2081 }
2082
2083 /// Sets the full request, replacing any prior values.
2084 pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
2085 mut self,
2086 v: V,
2087 ) -> Self {
2088 self.0.request = v.into();
2089 self
2090 }
2091
2092 /// Sets all the options, replacing any prior values.
2093 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2094 self.0.options = v.into();
2095 self
2096 }
2097
2098 /// Sends the request.
2099 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
2100 (*self.0.stub)
2101 .set_iam_policy(self.0.request, self.0.options)
2102 .await
2103 .map(crate::Response::into_body)
2104 }
2105
2106 /// Sets the value of [resource][google_cloud_iam_v1::model::SetIamPolicyRequest::resource].
2107 ///
2108 /// This is a **required** field for requests.
2109 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
2110 self.0.request.resource = v.into();
2111 self
2112 }
2113
2114 /// Sets the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
2115 ///
2116 /// This is a **required** field for requests.
2117 pub fn set_policy<T>(mut self, v: T) -> Self
2118 where
2119 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
2120 {
2121 self.0.request.policy = std::option::Option::Some(v.into());
2122 self
2123 }
2124
2125 /// Sets or clears the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
2126 ///
2127 /// This is a **required** field for requests.
2128 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
2129 where
2130 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
2131 {
2132 self.0.request.policy = v.map(|x| x.into());
2133 self
2134 }
2135
2136 /// Sets the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
2137 pub fn set_update_mask<T>(mut self, v: T) -> Self
2138 where
2139 T: std::convert::Into<wkt::FieldMask>,
2140 {
2141 self.0.request.update_mask = std::option::Option::Some(v.into());
2142 self
2143 }
2144
2145 /// Sets or clears the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
2146 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2147 where
2148 T: std::convert::Into<wkt::FieldMask>,
2149 {
2150 self.0.request.update_mask = v.map(|x| x.into());
2151 self
2152 }
2153 }
2154
2155 #[doc(hidden)]
2156 impl crate::RequestBuilder for SetIamPolicy {
2157 fn request_options(&mut self) -> &mut crate::RequestOptions {
2158 &mut self.0.options
2159 }
2160 }
2161
2162 /// The request builder for [ReservationService::test_iam_permissions][crate::client::ReservationService::test_iam_permissions] calls.
2163 ///
2164 /// # Example
2165 /// ```
2166 /// # use google_cloud_bigquery_reservation_v1::builder::reservation_service::TestIamPermissions;
2167 /// # async fn sample() -> google_cloud_bigquery_reservation_v1::Result<()> {
2168 ///
2169 /// let builder = prepare_request_builder();
2170 /// let response = builder.send().await?;
2171 /// # Ok(()) }
2172 ///
2173 /// fn prepare_request_builder() -> TestIamPermissions {
2174 /// # panic!();
2175 /// // ... details omitted ...
2176 /// }
2177 /// ```
2178 #[derive(Clone, Debug)]
2179 pub struct TestIamPermissions(
2180 RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
2181 );
2182
2183 impl TestIamPermissions {
2184 pub(crate) fn new(
2185 stub: std::sync::Arc<dyn super::super::stub::dynamic::ReservationService>,
2186 ) -> Self {
2187 Self(RequestBuilder::new(stub))
2188 }
2189
2190 /// Sets the full request, replacing any prior values.
2191 pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
2192 mut self,
2193 v: V,
2194 ) -> Self {
2195 self.0.request = v.into();
2196 self
2197 }
2198
2199 /// Sets all the options, replacing any prior values.
2200 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2201 self.0.options = v.into();
2202 self
2203 }
2204
2205 /// Sends the request.
2206 pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
2207 (*self.0.stub)
2208 .test_iam_permissions(self.0.request, self.0.options)
2209 .await
2210 .map(crate::Response::into_body)
2211 }
2212
2213 /// Sets the value of [resource][google_cloud_iam_v1::model::TestIamPermissionsRequest::resource].
2214 ///
2215 /// This is a **required** field for requests.
2216 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
2217 self.0.request.resource = v.into();
2218 self
2219 }
2220
2221 /// Sets the value of [permissions][google_cloud_iam_v1::model::TestIamPermissionsRequest::permissions].
2222 ///
2223 /// This is a **required** field for requests.
2224 pub fn set_permissions<T, V>(mut self, v: T) -> Self
2225 where
2226 T: std::iter::IntoIterator<Item = V>,
2227 V: std::convert::Into<std::string::String>,
2228 {
2229 use std::iter::Iterator;
2230 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
2231 self
2232 }
2233 }
2234
2235 #[doc(hidden)]
2236 impl crate::RequestBuilder for TestIamPermissions {
2237 fn request_options(&mut self) -> &mut crate::RequestOptions {
2238 &mut self.0.options
2239 }
2240 }
2241
2242 /// The request builder for [ReservationService::create_reservation_group][crate::client::ReservationService::create_reservation_group] calls.
2243 ///
2244 /// # Example
2245 /// ```
2246 /// # use google_cloud_bigquery_reservation_v1::builder::reservation_service::CreateReservationGroup;
2247 /// # async fn sample() -> google_cloud_bigquery_reservation_v1::Result<()> {
2248 ///
2249 /// let builder = prepare_request_builder();
2250 /// let response = builder.send().await?;
2251 /// # Ok(()) }
2252 ///
2253 /// fn prepare_request_builder() -> CreateReservationGroup {
2254 /// # panic!();
2255 /// // ... details omitted ...
2256 /// }
2257 /// ```
2258 #[derive(Clone, Debug)]
2259 pub struct CreateReservationGroup(RequestBuilder<crate::model::CreateReservationGroupRequest>);
2260
2261 impl CreateReservationGroup {
2262 pub(crate) fn new(
2263 stub: std::sync::Arc<dyn super::super::stub::dynamic::ReservationService>,
2264 ) -> Self {
2265 Self(RequestBuilder::new(stub))
2266 }
2267
2268 /// Sets the full request, replacing any prior values.
2269 pub fn with_request<V: Into<crate::model::CreateReservationGroupRequest>>(
2270 mut self,
2271 v: V,
2272 ) -> Self {
2273 self.0.request = v.into();
2274 self
2275 }
2276
2277 /// Sets all the options, replacing any prior values.
2278 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2279 self.0.options = v.into();
2280 self
2281 }
2282
2283 /// Sends the request.
2284 pub async fn send(self) -> Result<crate::model::ReservationGroup> {
2285 (*self.0.stub)
2286 .create_reservation_group(self.0.request, self.0.options)
2287 .await
2288 .map(crate::Response::into_body)
2289 }
2290
2291 /// Sets the value of [parent][crate::model::CreateReservationGroupRequest::parent].
2292 ///
2293 /// This is a **required** field for requests.
2294 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2295 self.0.request.parent = v.into();
2296 self
2297 }
2298
2299 /// Sets the value of [reservation_group_id][crate::model::CreateReservationGroupRequest::reservation_group_id].
2300 ///
2301 /// This is a **required** field for requests.
2302 pub fn set_reservation_group_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2303 self.0.request.reservation_group_id = v.into();
2304 self
2305 }
2306
2307 /// Sets the value of [reservation_group][crate::model::CreateReservationGroupRequest::reservation_group].
2308 ///
2309 /// This is a **required** field for requests.
2310 pub fn set_reservation_group<T>(mut self, v: T) -> Self
2311 where
2312 T: std::convert::Into<crate::model::ReservationGroup>,
2313 {
2314 self.0.request.reservation_group = std::option::Option::Some(v.into());
2315 self
2316 }
2317
2318 /// Sets or clears the value of [reservation_group][crate::model::CreateReservationGroupRequest::reservation_group].
2319 ///
2320 /// This is a **required** field for requests.
2321 pub fn set_or_clear_reservation_group<T>(mut self, v: std::option::Option<T>) -> Self
2322 where
2323 T: std::convert::Into<crate::model::ReservationGroup>,
2324 {
2325 self.0.request.reservation_group = v.map(|x| x.into());
2326 self
2327 }
2328 }
2329
2330 #[doc(hidden)]
2331 impl crate::RequestBuilder for CreateReservationGroup {
2332 fn request_options(&mut self) -> &mut crate::RequestOptions {
2333 &mut self.0.options
2334 }
2335 }
2336
2337 /// The request builder for [ReservationService::get_reservation_group][crate::client::ReservationService::get_reservation_group] calls.
2338 ///
2339 /// # Example
2340 /// ```
2341 /// # use google_cloud_bigquery_reservation_v1::builder::reservation_service::GetReservationGroup;
2342 /// # async fn sample() -> google_cloud_bigquery_reservation_v1::Result<()> {
2343 ///
2344 /// let builder = prepare_request_builder();
2345 /// let response = builder.send().await?;
2346 /// # Ok(()) }
2347 ///
2348 /// fn prepare_request_builder() -> GetReservationGroup {
2349 /// # panic!();
2350 /// // ... details omitted ...
2351 /// }
2352 /// ```
2353 #[derive(Clone, Debug)]
2354 pub struct GetReservationGroup(RequestBuilder<crate::model::GetReservationGroupRequest>);
2355
2356 impl GetReservationGroup {
2357 pub(crate) fn new(
2358 stub: std::sync::Arc<dyn super::super::stub::dynamic::ReservationService>,
2359 ) -> Self {
2360 Self(RequestBuilder::new(stub))
2361 }
2362
2363 /// Sets the full request, replacing any prior values.
2364 pub fn with_request<V: Into<crate::model::GetReservationGroupRequest>>(
2365 mut self,
2366 v: V,
2367 ) -> Self {
2368 self.0.request = v.into();
2369 self
2370 }
2371
2372 /// Sets all the options, replacing any prior values.
2373 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2374 self.0.options = v.into();
2375 self
2376 }
2377
2378 /// Sends the request.
2379 pub async fn send(self) -> Result<crate::model::ReservationGroup> {
2380 (*self.0.stub)
2381 .get_reservation_group(self.0.request, self.0.options)
2382 .await
2383 .map(crate::Response::into_body)
2384 }
2385
2386 /// Sets the value of [name][crate::model::GetReservationGroupRequest::name].
2387 ///
2388 /// This is a **required** field for requests.
2389 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2390 self.0.request.name = v.into();
2391 self
2392 }
2393 }
2394
2395 #[doc(hidden)]
2396 impl crate::RequestBuilder for GetReservationGroup {
2397 fn request_options(&mut self) -> &mut crate::RequestOptions {
2398 &mut self.0.options
2399 }
2400 }
2401
2402 /// The request builder for [ReservationService::delete_reservation_group][crate::client::ReservationService::delete_reservation_group] calls.
2403 ///
2404 /// # Example
2405 /// ```
2406 /// # use google_cloud_bigquery_reservation_v1::builder::reservation_service::DeleteReservationGroup;
2407 /// # async fn sample() -> google_cloud_bigquery_reservation_v1::Result<()> {
2408 ///
2409 /// let builder = prepare_request_builder();
2410 /// let response = builder.send().await?;
2411 /// # Ok(()) }
2412 ///
2413 /// fn prepare_request_builder() -> DeleteReservationGroup {
2414 /// # panic!();
2415 /// // ... details omitted ...
2416 /// }
2417 /// ```
2418 #[derive(Clone, Debug)]
2419 pub struct DeleteReservationGroup(RequestBuilder<crate::model::DeleteReservationGroupRequest>);
2420
2421 impl DeleteReservationGroup {
2422 pub(crate) fn new(
2423 stub: std::sync::Arc<dyn super::super::stub::dynamic::ReservationService>,
2424 ) -> Self {
2425 Self(RequestBuilder::new(stub))
2426 }
2427
2428 /// Sets the full request, replacing any prior values.
2429 pub fn with_request<V: Into<crate::model::DeleteReservationGroupRequest>>(
2430 mut self,
2431 v: V,
2432 ) -> Self {
2433 self.0.request = v.into();
2434 self
2435 }
2436
2437 /// Sets all the options, replacing any prior values.
2438 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2439 self.0.options = v.into();
2440 self
2441 }
2442
2443 /// Sends the request.
2444 pub async fn send(self) -> Result<()> {
2445 (*self.0.stub)
2446 .delete_reservation_group(self.0.request, self.0.options)
2447 .await
2448 .map(crate::Response::into_body)
2449 }
2450
2451 /// Sets the value of [name][crate::model::DeleteReservationGroupRequest::name].
2452 ///
2453 /// This is a **required** field for requests.
2454 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2455 self.0.request.name = v.into();
2456 self
2457 }
2458 }
2459
2460 #[doc(hidden)]
2461 impl crate::RequestBuilder for DeleteReservationGroup {
2462 fn request_options(&mut self) -> &mut crate::RequestOptions {
2463 &mut self.0.options
2464 }
2465 }
2466
2467 /// The request builder for [ReservationService::list_reservation_groups][crate::client::ReservationService::list_reservation_groups] calls.
2468 ///
2469 /// # Example
2470 /// ```
2471 /// # use google_cloud_bigquery_reservation_v1::builder::reservation_service::ListReservationGroups;
2472 /// # async fn sample() -> google_cloud_bigquery_reservation_v1::Result<()> {
2473 /// use google_cloud_gax::paginator::ItemPaginator;
2474 ///
2475 /// let builder = prepare_request_builder();
2476 /// let mut items = builder.by_item();
2477 /// while let Some(result) = items.next().await {
2478 /// let item = result?;
2479 /// }
2480 /// # Ok(()) }
2481 ///
2482 /// fn prepare_request_builder() -> ListReservationGroups {
2483 /// # panic!();
2484 /// // ... details omitted ...
2485 /// }
2486 /// ```
2487 #[derive(Clone, Debug)]
2488 pub struct ListReservationGroups(RequestBuilder<crate::model::ListReservationGroupsRequest>);
2489
2490 impl ListReservationGroups {
2491 pub(crate) fn new(
2492 stub: std::sync::Arc<dyn super::super::stub::dynamic::ReservationService>,
2493 ) -> Self {
2494 Self(RequestBuilder::new(stub))
2495 }
2496
2497 /// Sets the full request, replacing any prior values.
2498 pub fn with_request<V: Into<crate::model::ListReservationGroupsRequest>>(
2499 mut self,
2500 v: V,
2501 ) -> Self {
2502 self.0.request = v.into();
2503 self
2504 }
2505
2506 /// Sets all the options, replacing any prior values.
2507 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2508 self.0.options = v.into();
2509 self
2510 }
2511
2512 /// Sends the request.
2513 pub async fn send(self) -> Result<crate::model::ListReservationGroupsResponse> {
2514 (*self.0.stub)
2515 .list_reservation_groups(self.0.request, self.0.options)
2516 .await
2517 .map(crate::Response::into_body)
2518 }
2519
2520 /// Streams each page in the collection.
2521 pub fn by_page(
2522 self,
2523 ) -> impl google_cloud_gax::paginator::Paginator<
2524 crate::model::ListReservationGroupsResponse,
2525 crate::Error,
2526 > {
2527 use std::clone::Clone;
2528 let token = self.0.request.page_token.clone();
2529 let execute = move |token: String| {
2530 let mut builder = self.clone();
2531 builder.0.request = builder.0.request.set_page_token(token);
2532 builder.send()
2533 };
2534 google_cloud_gax::paginator::internal::new_paginator(token, execute)
2535 }
2536
2537 /// Streams each item in the collection.
2538 pub fn by_item(
2539 self,
2540 ) -> impl google_cloud_gax::paginator::ItemPaginator<
2541 crate::model::ListReservationGroupsResponse,
2542 crate::Error,
2543 > {
2544 use google_cloud_gax::paginator::Paginator;
2545 self.by_page().items()
2546 }
2547
2548 /// Sets the value of [parent][crate::model::ListReservationGroupsRequest::parent].
2549 ///
2550 /// This is a **required** field for requests.
2551 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2552 self.0.request.parent = v.into();
2553 self
2554 }
2555
2556 /// Sets the value of [page_size][crate::model::ListReservationGroupsRequest::page_size].
2557 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2558 self.0.request.page_size = v.into();
2559 self
2560 }
2561
2562 /// Sets the value of [page_token][crate::model::ListReservationGroupsRequest::page_token].
2563 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2564 self.0.request.page_token = v.into();
2565 self
2566 }
2567 }
2568
2569 #[doc(hidden)]
2570 impl crate::RequestBuilder for ListReservationGroups {
2571 fn request_options(&mut self) -> &mut crate::RequestOptions {
2572 &mut self.0.options
2573 }
2574 }
2575}