google_cloud_tasks_v2/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
17pub mod cloud_tasks {
18 use crate::Result;
19
20 /// A builder for [CloudTasks][super::super::client::CloudTasks].
21 ///
22 /// ```
23 /// # tokio_test::block_on(async {
24 /// # use google_cloud_tasks_v2::*;
25 /// # use builder::cloud_tasks::ClientBuilder;
26 /// # use client::CloudTasks;
27 /// let builder : ClientBuilder = CloudTasks::builder();
28 /// let client = builder
29 /// .with_endpoint("https://cloudtasks.googleapis.com")
30 /// .build().await?;
31 /// # gax::Result::<()>::Ok(()) });
32 /// ```
33 pub type ClientBuilder =
34 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
35
36 pub(crate) mod client {
37 use super::super::super::client::CloudTasks;
38 pub struct Factory;
39 impl gax::client_builder::internal::ClientFactory for Factory {
40 type Client = CloudTasks;
41 type Credentials = gaxi::options::Credentials;
42 async fn build(self, config: gaxi::options::ClientConfig) -> gax::Result<Self::Client> {
43 Self::Client::new(config).await
44 }
45 }
46 }
47
48 /// Common implementation for [super::super::client::CloudTasks] request builders.
49 #[derive(Clone, Debug)]
50 pub(crate) struct RequestBuilder<R: std::default::Default> {
51 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudTasks>,
52 request: R,
53 options: gax::options::RequestOptions,
54 }
55
56 impl<R> RequestBuilder<R>
57 where
58 R: std::default::Default,
59 {
60 pub(crate) fn new(
61 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudTasks>,
62 ) -> Self {
63 Self {
64 stub,
65 request: R::default(),
66 options: gax::options::RequestOptions::default(),
67 }
68 }
69 }
70
71 /// The request builder for [CloudTasks::list_queues][super::super::client::CloudTasks::list_queues] calls.
72 ///
73 /// # Example
74 /// ```no_run
75 /// # use google_cloud_tasks_v2::builder;
76 /// use builder::cloud_tasks::ListQueues;
77 /// # tokio_test::block_on(async {
78 /// let builder = prepare_request_builder();
79 /// use gax::paginator::ItemPaginator;
80 /// let mut items = builder.by_item();
81 /// while let Some(result) = items.next().await {
82 /// let item = result?;
83 /// }
84 /// # gax::Result::<()>::Ok(()) });
85 ///
86 /// fn prepare_request_builder() -> ListQueues {
87 /// # panic!();
88 /// // ... details omitted ...
89 /// }
90 /// ```
91 #[derive(Clone, Debug)]
92 pub struct ListQueues(RequestBuilder<crate::model::ListQueuesRequest>);
93
94 impl ListQueues {
95 pub(crate) fn new(
96 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudTasks>,
97 ) -> Self {
98 Self(RequestBuilder::new(stub))
99 }
100
101 /// Sets the full request, replacing any prior values.
102 pub fn with_request<V: Into<crate::model::ListQueuesRequest>>(mut self, v: V) -> Self {
103 self.0.request = v.into();
104 self
105 }
106
107 /// Sets all the options, replacing any prior values.
108 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
109 self.0.options = v.into();
110 self
111 }
112
113 /// Sends the request.
114 pub async fn send(self) -> Result<crate::model::ListQueuesResponse> {
115 (*self.0.stub)
116 .list_queues(self.0.request, self.0.options)
117 .await
118 .map(gax::response::Response::into_body)
119 }
120
121 /// Streams each page in the collection.
122 pub fn by_page(
123 self,
124 ) -> impl gax::paginator::Paginator<crate::model::ListQueuesResponse, gax::error::Error>
125 {
126 use std::clone::Clone;
127 let token = self.0.request.page_token.clone();
128 let execute = move |token: String| {
129 let mut builder = self.clone();
130 builder.0.request = builder.0.request.set_page_token(token);
131 builder.send()
132 };
133 gax::paginator::internal::new_paginator(token, execute)
134 }
135
136 /// Streams each item in the collection.
137 pub fn by_item(
138 self,
139 ) -> impl gax::paginator::ItemPaginator<crate::model::ListQueuesResponse, gax::error::Error>
140 {
141 use gax::paginator::Paginator;
142 self.by_page().items()
143 }
144
145 /// Sets the value of [parent][crate::model::ListQueuesRequest::parent].
146 ///
147 /// This is a **required** field for requests.
148 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
149 self.0.request.parent = v.into();
150 self
151 }
152
153 /// Sets the value of [filter][crate::model::ListQueuesRequest::filter].
154 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
155 self.0.request.filter = v.into();
156 self
157 }
158
159 /// Sets the value of [page_size][crate::model::ListQueuesRequest::page_size].
160 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
161 self.0.request.page_size = v.into();
162 self
163 }
164
165 /// Sets the value of [page_token][crate::model::ListQueuesRequest::page_token].
166 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
167 self.0.request.page_token = v.into();
168 self
169 }
170 }
171
172 #[doc(hidden)]
173 impl gax::options::internal::RequestBuilder for ListQueues {
174 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
175 &mut self.0.options
176 }
177 }
178
179 /// The request builder for [CloudTasks::get_queue][super::super::client::CloudTasks::get_queue] calls.
180 ///
181 /// # Example
182 /// ```no_run
183 /// # use google_cloud_tasks_v2::builder;
184 /// use builder::cloud_tasks::GetQueue;
185 /// # tokio_test::block_on(async {
186 /// let builder = prepare_request_builder();
187 /// let response = builder.send().await?;
188 /// # gax::Result::<()>::Ok(()) });
189 ///
190 /// fn prepare_request_builder() -> GetQueue {
191 /// # panic!();
192 /// // ... details omitted ...
193 /// }
194 /// ```
195 #[derive(Clone, Debug)]
196 pub struct GetQueue(RequestBuilder<crate::model::GetQueueRequest>);
197
198 impl GetQueue {
199 pub(crate) fn new(
200 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudTasks>,
201 ) -> Self {
202 Self(RequestBuilder::new(stub))
203 }
204
205 /// Sets the full request, replacing any prior values.
206 pub fn with_request<V: Into<crate::model::GetQueueRequest>>(mut self, v: V) -> Self {
207 self.0.request = v.into();
208 self
209 }
210
211 /// Sets all the options, replacing any prior values.
212 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
213 self.0.options = v.into();
214 self
215 }
216
217 /// Sends the request.
218 pub async fn send(self) -> Result<crate::model::Queue> {
219 (*self.0.stub)
220 .get_queue(self.0.request, self.0.options)
221 .await
222 .map(gax::response::Response::into_body)
223 }
224
225 /// Sets the value of [name][crate::model::GetQueueRequest::name].
226 ///
227 /// This is a **required** field for requests.
228 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
229 self.0.request.name = v.into();
230 self
231 }
232 }
233
234 #[doc(hidden)]
235 impl gax::options::internal::RequestBuilder for GetQueue {
236 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
237 &mut self.0.options
238 }
239 }
240
241 /// The request builder for [CloudTasks::create_queue][super::super::client::CloudTasks::create_queue] calls.
242 ///
243 /// # Example
244 /// ```no_run
245 /// # use google_cloud_tasks_v2::builder;
246 /// use builder::cloud_tasks::CreateQueue;
247 /// # tokio_test::block_on(async {
248 /// let builder = prepare_request_builder();
249 /// let response = builder.send().await?;
250 /// # gax::Result::<()>::Ok(()) });
251 ///
252 /// fn prepare_request_builder() -> CreateQueue {
253 /// # panic!();
254 /// // ... details omitted ...
255 /// }
256 /// ```
257 #[derive(Clone, Debug)]
258 pub struct CreateQueue(RequestBuilder<crate::model::CreateQueueRequest>);
259
260 impl CreateQueue {
261 pub(crate) fn new(
262 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudTasks>,
263 ) -> Self {
264 Self(RequestBuilder::new(stub))
265 }
266
267 /// Sets the full request, replacing any prior values.
268 pub fn with_request<V: Into<crate::model::CreateQueueRequest>>(mut self, v: V) -> Self {
269 self.0.request = v.into();
270 self
271 }
272
273 /// Sets all the options, replacing any prior values.
274 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
275 self.0.options = v.into();
276 self
277 }
278
279 /// Sends the request.
280 pub async fn send(self) -> Result<crate::model::Queue> {
281 (*self.0.stub)
282 .create_queue(self.0.request, self.0.options)
283 .await
284 .map(gax::response::Response::into_body)
285 }
286
287 /// Sets the value of [parent][crate::model::CreateQueueRequest::parent].
288 ///
289 /// This is a **required** field for requests.
290 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
291 self.0.request.parent = v.into();
292 self
293 }
294
295 /// Sets the value of [queue][crate::model::CreateQueueRequest::queue].
296 ///
297 /// This is a **required** field for requests.
298 pub fn set_queue<T: Into<std::option::Option<crate::model::Queue>>>(
299 mut self,
300 v: T,
301 ) -> Self {
302 self.0.request.queue = v.into();
303 self
304 }
305 }
306
307 #[doc(hidden)]
308 impl gax::options::internal::RequestBuilder for CreateQueue {
309 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
310 &mut self.0.options
311 }
312 }
313
314 /// The request builder for [CloudTasks::update_queue][super::super::client::CloudTasks::update_queue] calls.
315 ///
316 /// # Example
317 /// ```no_run
318 /// # use google_cloud_tasks_v2::builder;
319 /// use builder::cloud_tasks::UpdateQueue;
320 /// # tokio_test::block_on(async {
321 /// let builder = prepare_request_builder();
322 /// let response = builder.send().await?;
323 /// # gax::Result::<()>::Ok(()) });
324 ///
325 /// fn prepare_request_builder() -> UpdateQueue {
326 /// # panic!();
327 /// // ... details omitted ...
328 /// }
329 /// ```
330 #[derive(Clone, Debug)]
331 pub struct UpdateQueue(RequestBuilder<crate::model::UpdateQueueRequest>);
332
333 impl UpdateQueue {
334 pub(crate) fn new(
335 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudTasks>,
336 ) -> Self {
337 Self(RequestBuilder::new(stub))
338 }
339
340 /// Sets the full request, replacing any prior values.
341 pub fn with_request<V: Into<crate::model::UpdateQueueRequest>>(mut self, v: V) -> Self {
342 self.0.request = v.into();
343 self
344 }
345
346 /// Sets all the options, replacing any prior values.
347 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
348 self.0.options = v.into();
349 self
350 }
351
352 /// Sends the request.
353 pub async fn send(self) -> Result<crate::model::Queue> {
354 (*self.0.stub)
355 .update_queue(self.0.request, self.0.options)
356 .await
357 .map(gax::response::Response::into_body)
358 }
359
360 /// Sets the value of [queue][crate::model::UpdateQueueRequest::queue].
361 ///
362 /// This is a **required** field for requests.
363 pub fn set_queue<T: Into<std::option::Option<crate::model::Queue>>>(
364 mut self,
365 v: T,
366 ) -> Self {
367 self.0.request.queue = v.into();
368 self
369 }
370
371 /// Sets the value of [update_mask][crate::model::UpdateQueueRequest::update_mask].
372 pub fn set_update_mask<T: Into<std::option::Option<wkt::FieldMask>>>(
373 mut self,
374 v: T,
375 ) -> Self {
376 self.0.request.update_mask = v.into();
377 self
378 }
379 }
380
381 #[doc(hidden)]
382 impl gax::options::internal::RequestBuilder for UpdateQueue {
383 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
384 &mut self.0.options
385 }
386 }
387
388 /// The request builder for [CloudTasks::delete_queue][super::super::client::CloudTasks::delete_queue] calls.
389 ///
390 /// # Example
391 /// ```no_run
392 /// # use google_cloud_tasks_v2::builder;
393 /// use builder::cloud_tasks::DeleteQueue;
394 /// # tokio_test::block_on(async {
395 /// let builder = prepare_request_builder();
396 /// let response = builder.send().await?;
397 /// # gax::Result::<()>::Ok(()) });
398 ///
399 /// fn prepare_request_builder() -> DeleteQueue {
400 /// # panic!();
401 /// // ... details omitted ...
402 /// }
403 /// ```
404 #[derive(Clone, Debug)]
405 pub struct DeleteQueue(RequestBuilder<crate::model::DeleteQueueRequest>);
406
407 impl DeleteQueue {
408 pub(crate) fn new(
409 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudTasks>,
410 ) -> Self {
411 Self(RequestBuilder::new(stub))
412 }
413
414 /// Sets the full request, replacing any prior values.
415 pub fn with_request<V: Into<crate::model::DeleteQueueRequest>>(mut self, v: V) -> Self {
416 self.0.request = v.into();
417 self
418 }
419
420 /// Sets all the options, replacing any prior values.
421 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
422 self.0.options = v.into();
423 self
424 }
425
426 /// Sends the request.
427 pub async fn send(self) -> Result<()> {
428 (*self.0.stub)
429 .delete_queue(self.0.request, self.0.options)
430 .await
431 .map(gax::response::Response::into_body)
432 }
433
434 /// Sets the value of [name][crate::model::DeleteQueueRequest::name].
435 ///
436 /// This is a **required** field for requests.
437 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
438 self.0.request.name = v.into();
439 self
440 }
441 }
442
443 #[doc(hidden)]
444 impl gax::options::internal::RequestBuilder for DeleteQueue {
445 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
446 &mut self.0.options
447 }
448 }
449
450 /// The request builder for [CloudTasks::purge_queue][super::super::client::CloudTasks::purge_queue] calls.
451 ///
452 /// # Example
453 /// ```no_run
454 /// # use google_cloud_tasks_v2::builder;
455 /// use builder::cloud_tasks::PurgeQueue;
456 /// # tokio_test::block_on(async {
457 /// let builder = prepare_request_builder();
458 /// let response = builder.send().await?;
459 /// # gax::Result::<()>::Ok(()) });
460 ///
461 /// fn prepare_request_builder() -> PurgeQueue {
462 /// # panic!();
463 /// // ... details omitted ...
464 /// }
465 /// ```
466 #[derive(Clone, Debug)]
467 pub struct PurgeQueue(RequestBuilder<crate::model::PurgeQueueRequest>);
468
469 impl PurgeQueue {
470 pub(crate) fn new(
471 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudTasks>,
472 ) -> Self {
473 Self(RequestBuilder::new(stub))
474 }
475
476 /// Sets the full request, replacing any prior values.
477 pub fn with_request<V: Into<crate::model::PurgeQueueRequest>>(mut self, v: V) -> Self {
478 self.0.request = v.into();
479 self
480 }
481
482 /// Sets all the options, replacing any prior values.
483 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
484 self.0.options = v.into();
485 self
486 }
487
488 /// Sends the request.
489 pub async fn send(self) -> Result<crate::model::Queue> {
490 (*self.0.stub)
491 .purge_queue(self.0.request, self.0.options)
492 .await
493 .map(gax::response::Response::into_body)
494 }
495
496 /// Sets the value of [name][crate::model::PurgeQueueRequest::name].
497 ///
498 /// This is a **required** field for requests.
499 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
500 self.0.request.name = v.into();
501 self
502 }
503 }
504
505 #[doc(hidden)]
506 impl gax::options::internal::RequestBuilder for PurgeQueue {
507 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
508 &mut self.0.options
509 }
510 }
511
512 /// The request builder for [CloudTasks::pause_queue][super::super::client::CloudTasks::pause_queue] calls.
513 ///
514 /// # Example
515 /// ```no_run
516 /// # use google_cloud_tasks_v2::builder;
517 /// use builder::cloud_tasks::PauseQueue;
518 /// # tokio_test::block_on(async {
519 /// let builder = prepare_request_builder();
520 /// let response = builder.send().await?;
521 /// # gax::Result::<()>::Ok(()) });
522 ///
523 /// fn prepare_request_builder() -> PauseQueue {
524 /// # panic!();
525 /// // ... details omitted ...
526 /// }
527 /// ```
528 #[derive(Clone, Debug)]
529 pub struct PauseQueue(RequestBuilder<crate::model::PauseQueueRequest>);
530
531 impl PauseQueue {
532 pub(crate) fn new(
533 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudTasks>,
534 ) -> Self {
535 Self(RequestBuilder::new(stub))
536 }
537
538 /// Sets the full request, replacing any prior values.
539 pub fn with_request<V: Into<crate::model::PauseQueueRequest>>(mut self, v: V) -> Self {
540 self.0.request = v.into();
541 self
542 }
543
544 /// Sets all the options, replacing any prior values.
545 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
546 self.0.options = v.into();
547 self
548 }
549
550 /// Sends the request.
551 pub async fn send(self) -> Result<crate::model::Queue> {
552 (*self.0.stub)
553 .pause_queue(self.0.request, self.0.options)
554 .await
555 .map(gax::response::Response::into_body)
556 }
557
558 /// Sets the value of [name][crate::model::PauseQueueRequest::name].
559 ///
560 /// This is a **required** field for requests.
561 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
562 self.0.request.name = v.into();
563 self
564 }
565 }
566
567 #[doc(hidden)]
568 impl gax::options::internal::RequestBuilder for PauseQueue {
569 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
570 &mut self.0.options
571 }
572 }
573
574 /// The request builder for [CloudTasks::resume_queue][super::super::client::CloudTasks::resume_queue] calls.
575 ///
576 /// # Example
577 /// ```no_run
578 /// # use google_cloud_tasks_v2::builder;
579 /// use builder::cloud_tasks::ResumeQueue;
580 /// # tokio_test::block_on(async {
581 /// let builder = prepare_request_builder();
582 /// let response = builder.send().await?;
583 /// # gax::Result::<()>::Ok(()) });
584 ///
585 /// fn prepare_request_builder() -> ResumeQueue {
586 /// # panic!();
587 /// // ... details omitted ...
588 /// }
589 /// ```
590 #[derive(Clone, Debug)]
591 pub struct ResumeQueue(RequestBuilder<crate::model::ResumeQueueRequest>);
592
593 impl ResumeQueue {
594 pub(crate) fn new(
595 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudTasks>,
596 ) -> Self {
597 Self(RequestBuilder::new(stub))
598 }
599
600 /// Sets the full request, replacing any prior values.
601 pub fn with_request<V: Into<crate::model::ResumeQueueRequest>>(mut self, v: V) -> Self {
602 self.0.request = v.into();
603 self
604 }
605
606 /// Sets all the options, replacing any prior values.
607 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
608 self.0.options = v.into();
609 self
610 }
611
612 /// Sends the request.
613 pub async fn send(self) -> Result<crate::model::Queue> {
614 (*self.0.stub)
615 .resume_queue(self.0.request, self.0.options)
616 .await
617 .map(gax::response::Response::into_body)
618 }
619
620 /// Sets the value of [name][crate::model::ResumeQueueRequest::name].
621 ///
622 /// This is a **required** field for requests.
623 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
624 self.0.request.name = v.into();
625 self
626 }
627 }
628
629 #[doc(hidden)]
630 impl gax::options::internal::RequestBuilder for ResumeQueue {
631 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
632 &mut self.0.options
633 }
634 }
635
636 /// The request builder for [CloudTasks::get_iam_policy][super::super::client::CloudTasks::get_iam_policy] calls.
637 ///
638 /// # Example
639 /// ```no_run
640 /// # use google_cloud_tasks_v2::builder;
641 /// use builder::cloud_tasks::GetIamPolicy;
642 /// # tokio_test::block_on(async {
643 /// let builder = prepare_request_builder();
644 /// let response = builder.send().await?;
645 /// # gax::Result::<()>::Ok(()) });
646 ///
647 /// fn prepare_request_builder() -> GetIamPolicy {
648 /// # panic!();
649 /// // ... details omitted ...
650 /// }
651 /// ```
652 #[derive(Clone, Debug)]
653 pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
654
655 impl GetIamPolicy {
656 pub(crate) fn new(
657 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudTasks>,
658 ) -> Self {
659 Self(RequestBuilder::new(stub))
660 }
661
662 /// Sets the full request, replacing any prior values.
663 pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
664 self.0.request = v.into();
665 self
666 }
667
668 /// Sets all the options, replacing any prior values.
669 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
670 self.0.options = v.into();
671 self
672 }
673
674 /// Sends the request.
675 pub async fn send(self) -> Result<iam_v1::model::Policy> {
676 (*self.0.stub)
677 .get_iam_policy(self.0.request, self.0.options)
678 .await
679 .map(gax::response::Response::into_body)
680 }
681
682 /// Sets the value of [resource][iam_v1::model::GetIamPolicyRequest::resource].
683 ///
684 /// This is a **required** field for requests.
685 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
686 self.0.request.resource = v.into();
687 self
688 }
689
690 /// Sets the value of [options][iam_v1::model::GetIamPolicyRequest::options].
691 pub fn set_options<T: Into<std::option::Option<iam_v1::model::GetPolicyOptions>>>(
692 mut self,
693 v: T,
694 ) -> Self {
695 self.0.request.options = v.into();
696 self
697 }
698 }
699
700 #[doc(hidden)]
701 impl gax::options::internal::RequestBuilder for GetIamPolicy {
702 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
703 &mut self.0.options
704 }
705 }
706
707 /// The request builder for [CloudTasks::set_iam_policy][super::super::client::CloudTasks::set_iam_policy] calls.
708 ///
709 /// # Example
710 /// ```no_run
711 /// # use google_cloud_tasks_v2::builder;
712 /// use builder::cloud_tasks::SetIamPolicy;
713 /// # tokio_test::block_on(async {
714 /// let builder = prepare_request_builder();
715 /// let response = builder.send().await?;
716 /// # gax::Result::<()>::Ok(()) });
717 ///
718 /// fn prepare_request_builder() -> SetIamPolicy {
719 /// # panic!();
720 /// // ... details omitted ...
721 /// }
722 /// ```
723 #[derive(Clone, Debug)]
724 pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
725
726 impl SetIamPolicy {
727 pub(crate) fn new(
728 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudTasks>,
729 ) -> Self {
730 Self(RequestBuilder::new(stub))
731 }
732
733 /// Sets the full request, replacing any prior values.
734 pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
735 self.0.request = v.into();
736 self
737 }
738
739 /// Sets all the options, replacing any prior values.
740 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
741 self.0.options = v.into();
742 self
743 }
744
745 /// Sends the request.
746 pub async fn send(self) -> Result<iam_v1::model::Policy> {
747 (*self.0.stub)
748 .set_iam_policy(self.0.request, self.0.options)
749 .await
750 .map(gax::response::Response::into_body)
751 }
752
753 /// Sets the value of [resource][iam_v1::model::SetIamPolicyRequest::resource].
754 ///
755 /// This is a **required** field for requests.
756 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
757 self.0.request.resource = v.into();
758 self
759 }
760
761 /// Sets the value of [policy][iam_v1::model::SetIamPolicyRequest::policy].
762 ///
763 /// This is a **required** field for requests.
764 pub fn set_policy<T: Into<std::option::Option<iam_v1::model::Policy>>>(
765 mut self,
766 v: T,
767 ) -> Self {
768 self.0.request.policy = v.into();
769 self
770 }
771
772 /// Sets the value of [update_mask][iam_v1::model::SetIamPolicyRequest::update_mask].
773 pub fn set_update_mask<T: Into<std::option::Option<wkt::FieldMask>>>(
774 mut self,
775 v: T,
776 ) -> Self {
777 self.0.request.update_mask = v.into();
778 self
779 }
780 }
781
782 #[doc(hidden)]
783 impl gax::options::internal::RequestBuilder for SetIamPolicy {
784 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
785 &mut self.0.options
786 }
787 }
788
789 /// The request builder for [CloudTasks::test_iam_permissions][super::super::client::CloudTasks::test_iam_permissions] calls.
790 ///
791 /// # Example
792 /// ```no_run
793 /// # use google_cloud_tasks_v2::builder;
794 /// use builder::cloud_tasks::TestIamPermissions;
795 /// # tokio_test::block_on(async {
796 /// let builder = prepare_request_builder();
797 /// let response = builder.send().await?;
798 /// # gax::Result::<()>::Ok(()) });
799 ///
800 /// fn prepare_request_builder() -> TestIamPermissions {
801 /// # panic!();
802 /// // ... details omitted ...
803 /// }
804 /// ```
805 #[derive(Clone, Debug)]
806 pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
807
808 impl TestIamPermissions {
809 pub(crate) fn new(
810 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudTasks>,
811 ) -> Self {
812 Self(RequestBuilder::new(stub))
813 }
814
815 /// Sets the full request, replacing any prior values.
816 pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
817 mut self,
818 v: V,
819 ) -> Self {
820 self.0.request = v.into();
821 self
822 }
823
824 /// Sets all the options, replacing any prior values.
825 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
826 self.0.options = v.into();
827 self
828 }
829
830 /// Sends the request.
831 pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
832 (*self.0.stub)
833 .test_iam_permissions(self.0.request, self.0.options)
834 .await
835 .map(gax::response::Response::into_body)
836 }
837
838 /// Sets the value of [resource][iam_v1::model::TestIamPermissionsRequest::resource].
839 ///
840 /// This is a **required** field for requests.
841 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
842 self.0.request.resource = v.into();
843 self
844 }
845
846 /// Sets the value of [permissions][iam_v1::model::TestIamPermissionsRequest::permissions].
847 ///
848 /// This is a **required** field for requests.
849 pub fn set_permissions<T, V>(mut self, v: T) -> Self
850 where
851 T: std::iter::IntoIterator<Item = V>,
852 V: std::convert::Into<std::string::String>,
853 {
854 use std::iter::Iterator;
855 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
856 self
857 }
858 }
859
860 #[doc(hidden)]
861 impl gax::options::internal::RequestBuilder for TestIamPermissions {
862 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
863 &mut self.0.options
864 }
865 }
866
867 /// The request builder for [CloudTasks::list_tasks][super::super::client::CloudTasks::list_tasks] calls.
868 ///
869 /// # Example
870 /// ```no_run
871 /// # use google_cloud_tasks_v2::builder;
872 /// use builder::cloud_tasks::ListTasks;
873 /// # tokio_test::block_on(async {
874 /// let builder = prepare_request_builder();
875 /// use gax::paginator::ItemPaginator;
876 /// let mut items = builder.by_item();
877 /// while let Some(result) = items.next().await {
878 /// let item = result?;
879 /// }
880 /// # gax::Result::<()>::Ok(()) });
881 ///
882 /// fn prepare_request_builder() -> ListTasks {
883 /// # panic!();
884 /// // ... details omitted ...
885 /// }
886 /// ```
887 #[derive(Clone, Debug)]
888 pub struct ListTasks(RequestBuilder<crate::model::ListTasksRequest>);
889
890 impl ListTasks {
891 pub(crate) fn new(
892 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudTasks>,
893 ) -> Self {
894 Self(RequestBuilder::new(stub))
895 }
896
897 /// Sets the full request, replacing any prior values.
898 pub fn with_request<V: Into<crate::model::ListTasksRequest>>(mut self, v: V) -> Self {
899 self.0.request = v.into();
900 self
901 }
902
903 /// Sets all the options, replacing any prior values.
904 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
905 self.0.options = v.into();
906 self
907 }
908
909 /// Sends the request.
910 pub async fn send(self) -> Result<crate::model::ListTasksResponse> {
911 (*self.0.stub)
912 .list_tasks(self.0.request, self.0.options)
913 .await
914 .map(gax::response::Response::into_body)
915 }
916
917 /// Streams each page in the collection.
918 pub fn by_page(
919 self,
920 ) -> impl gax::paginator::Paginator<crate::model::ListTasksResponse, gax::error::Error>
921 {
922 use std::clone::Clone;
923 let token = self.0.request.page_token.clone();
924 let execute = move |token: String| {
925 let mut builder = self.clone();
926 builder.0.request = builder.0.request.set_page_token(token);
927 builder.send()
928 };
929 gax::paginator::internal::new_paginator(token, execute)
930 }
931
932 /// Streams each item in the collection.
933 pub fn by_item(
934 self,
935 ) -> impl gax::paginator::ItemPaginator<crate::model::ListTasksResponse, gax::error::Error>
936 {
937 use gax::paginator::Paginator;
938 self.by_page().items()
939 }
940
941 /// Sets the value of [parent][crate::model::ListTasksRequest::parent].
942 ///
943 /// This is a **required** field for requests.
944 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
945 self.0.request.parent = v.into();
946 self
947 }
948
949 /// Sets the value of [response_view][crate::model::ListTasksRequest::response_view].
950 pub fn set_response_view<T: Into<crate::model::task::View>>(mut self, v: T) -> Self {
951 self.0.request.response_view = v.into();
952 self
953 }
954
955 /// Sets the value of [page_size][crate::model::ListTasksRequest::page_size].
956 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
957 self.0.request.page_size = v.into();
958 self
959 }
960
961 /// Sets the value of [page_token][crate::model::ListTasksRequest::page_token].
962 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
963 self.0.request.page_token = v.into();
964 self
965 }
966 }
967
968 #[doc(hidden)]
969 impl gax::options::internal::RequestBuilder for ListTasks {
970 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
971 &mut self.0.options
972 }
973 }
974
975 /// The request builder for [CloudTasks::get_task][super::super::client::CloudTasks::get_task] calls.
976 ///
977 /// # Example
978 /// ```no_run
979 /// # use google_cloud_tasks_v2::builder;
980 /// use builder::cloud_tasks::GetTask;
981 /// # tokio_test::block_on(async {
982 /// let builder = prepare_request_builder();
983 /// let response = builder.send().await?;
984 /// # gax::Result::<()>::Ok(()) });
985 ///
986 /// fn prepare_request_builder() -> GetTask {
987 /// # panic!();
988 /// // ... details omitted ...
989 /// }
990 /// ```
991 #[derive(Clone, Debug)]
992 pub struct GetTask(RequestBuilder<crate::model::GetTaskRequest>);
993
994 impl GetTask {
995 pub(crate) fn new(
996 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudTasks>,
997 ) -> Self {
998 Self(RequestBuilder::new(stub))
999 }
1000
1001 /// Sets the full request, replacing any prior values.
1002 pub fn with_request<V: Into<crate::model::GetTaskRequest>>(mut self, v: V) -> Self {
1003 self.0.request = v.into();
1004 self
1005 }
1006
1007 /// Sets all the options, replacing any prior values.
1008 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1009 self.0.options = v.into();
1010 self
1011 }
1012
1013 /// Sends the request.
1014 pub async fn send(self) -> Result<crate::model::Task> {
1015 (*self.0.stub)
1016 .get_task(self.0.request, self.0.options)
1017 .await
1018 .map(gax::response::Response::into_body)
1019 }
1020
1021 /// Sets the value of [name][crate::model::GetTaskRequest::name].
1022 ///
1023 /// This is a **required** field for requests.
1024 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1025 self.0.request.name = v.into();
1026 self
1027 }
1028
1029 /// Sets the value of [response_view][crate::model::GetTaskRequest::response_view].
1030 pub fn set_response_view<T: Into<crate::model::task::View>>(mut self, v: T) -> Self {
1031 self.0.request.response_view = v.into();
1032 self
1033 }
1034 }
1035
1036 #[doc(hidden)]
1037 impl gax::options::internal::RequestBuilder for GetTask {
1038 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1039 &mut self.0.options
1040 }
1041 }
1042
1043 /// The request builder for [CloudTasks::create_task][super::super::client::CloudTasks::create_task] calls.
1044 ///
1045 /// # Example
1046 /// ```no_run
1047 /// # use google_cloud_tasks_v2::builder;
1048 /// use builder::cloud_tasks::CreateTask;
1049 /// # tokio_test::block_on(async {
1050 /// let builder = prepare_request_builder();
1051 /// let response = builder.send().await?;
1052 /// # gax::Result::<()>::Ok(()) });
1053 ///
1054 /// fn prepare_request_builder() -> CreateTask {
1055 /// # panic!();
1056 /// // ... details omitted ...
1057 /// }
1058 /// ```
1059 #[derive(Clone, Debug)]
1060 pub struct CreateTask(RequestBuilder<crate::model::CreateTaskRequest>);
1061
1062 impl CreateTask {
1063 pub(crate) fn new(
1064 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudTasks>,
1065 ) -> Self {
1066 Self(RequestBuilder::new(stub))
1067 }
1068
1069 /// Sets the full request, replacing any prior values.
1070 pub fn with_request<V: Into<crate::model::CreateTaskRequest>>(mut self, v: V) -> Self {
1071 self.0.request = v.into();
1072 self
1073 }
1074
1075 /// Sets all the options, replacing any prior values.
1076 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1077 self.0.options = v.into();
1078 self
1079 }
1080
1081 /// Sends the request.
1082 pub async fn send(self) -> Result<crate::model::Task> {
1083 (*self.0.stub)
1084 .create_task(self.0.request, self.0.options)
1085 .await
1086 .map(gax::response::Response::into_body)
1087 }
1088
1089 /// Sets the value of [parent][crate::model::CreateTaskRequest::parent].
1090 ///
1091 /// This is a **required** field for requests.
1092 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1093 self.0.request.parent = v.into();
1094 self
1095 }
1096
1097 /// Sets the value of [task][crate::model::CreateTaskRequest::task].
1098 ///
1099 /// This is a **required** field for requests.
1100 pub fn set_task<T: Into<std::option::Option<crate::model::Task>>>(mut self, v: T) -> Self {
1101 self.0.request.task = v.into();
1102 self
1103 }
1104
1105 /// Sets the value of [response_view][crate::model::CreateTaskRequest::response_view].
1106 pub fn set_response_view<T: Into<crate::model::task::View>>(mut self, v: T) -> Self {
1107 self.0.request.response_view = v.into();
1108 self
1109 }
1110 }
1111
1112 #[doc(hidden)]
1113 impl gax::options::internal::RequestBuilder for CreateTask {
1114 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1115 &mut self.0.options
1116 }
1117 }
1118
1119 /// The request builder for [CloudTasks::delete_task][super::super::client::CloudTasks::delete_task] calls.
1120 ///
1121 /// # Example
1122 /// ```no_run
1123 /// # use google_cloud_tasks_v2::builder;
1124 /// use builder::cloud_tasks::DeleteTask;
1125 /// # tokio_test::block_on(async {
1126 /// let builder = prepare_request_builder();
1127 /// let response = builder.send().await?;
1128 /// # gax::Result::<()>::Ok(()) });
1129 ///
1130 /// fn prepare_request_builder() -> DeleteTask {
1131 /// # panic!();
1132 /// // ... details omitted ...
1133 /// }
1134 /// ```
1135 #[derive(Clone, Debug)]
1136 pub struct DeleteTask(RequestBuilder<crate::model::DeleteTaskRequest>);
1137
1138 impl DeleteTask {
1139 pub(crate) fn new(
1140 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudTasks>,
1141 ) -> Self {
1142 Self(RequestBuilder::new(stub))
1143 }
1144
1145 /// Sets the full request, replacing any prior values.
1146 pub fn with_request<V: Into<crate::model::DeleteTaskRequest>>(mut self, v: V) -> Self {
1147 self.0.request = v.into();
1148 self
1149 }
1150
1151 /// Sets all the options, replacing any prior values.
1152 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1153 self.0.options = v.into();
1154 self
1155 }
1156
1157 /// Sends the request.
1158 pub async fn send(self) -> Result<()> {
1159 (*self.0.stub)
1160 .delete_task(self.0.request, self.0.options)
1161 .await
1162 .map(gax::response::Response::into_body)
1163 }
1164
1165 /// Sets the value of [name][crate::model::DeleteTaskRequest::name].
1166 ///
1167 /// This is a **required** field for requests.
1168 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1169 self.0.request.name = v.into();
1170 self
1171 }
1172 }
1173
1174 #[doc(hidden)]
1175 impl gax::options::internal::RequestBuilder for DeleteTask {
1176 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1177 &mut self.0.options
1178 }
1179 }
1180
1181 /// The request builder for [CloudTasks::run_task][super::super::client::CloudTasks::run_task] calls.
1182 ///
1183 /// # Example
1184 /// ```no_run
1185 /// # use google_cloud_tasks_v2::builder;
1186 /// use builder::cloud_tasks::RunTask;
1187 /// # tokio_test::block_on(async {
1188 /// let builder = prepare_request_builder();
1189 /// let response = builder.send().await?;
1190 /// # gax::Result::<()>::Ok(()) });
1191 ///
1192 /// fn prepare_request_builder() -> RunTask {
1193 /// # panic!();
1194 /// // ... details omitted ...
1195 /// }
1196 /// ```
1197 #[derive(Clone, Debug)]
1198 pub struct RunTask(RequestBuilder<crate::model::RunTaskRequest>);
1199
1200 impl RunTask {
1201 pub(crate) fn new(
1202 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudTasks>,
1203 ) -> Self {
1204 Self(RequestBuilder::new(stub))
1205 }
1206
1207 /// Sets the full request, replacing any prior values.
1208 pub fn with_request<V: Into<crate::model::RunTaskRequest>>(mut self, v: V) -> Self {
1209 self.0.request = v.into();
1210 self
1211 }
1212
1213 /// Sets all the options, replacing any prior values.
1214 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1215 self.0.options = v.into();
1216 self
1217 }
1218
1219 /// Sends the request.
1220 pub async fn send(self) -> Result<crate::model::Task> {
1221 (*self.0.stub)
1222 .run_task(self.0.request, self.0.options)
1223 .await
1224 .map(gax::response::Response::into_body)
1225 }
1226
1227 /// Sets the value of [name][crate::model::RunTaskRequest::name].
1228 ///
1229 /// This is a **required** field for requests.
1230 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1231 self.0.request.name = v.into();
1232 self
1233 }
1234
1235 /// Sets the value of [response_view][crate::model::RunTaskRequest::response_view].
1236 pub fn set_response_view<T: Into<crate::model::task::View>>(mut self, v: T) -> Self {
1237 self.0.request.response_view = v.into();
1238 self
1239 }
1240 }
1241
1242 #[doc(hidden)]
1243 impl gax::options::internal::RequestBuilder for RunTask {
1244 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1245 &mut self.0.options
1246 }
1247 }
1248
1249 /// The request builder for [CloudTasks::list_locations][super::super::client::CloudTasks::list_locations] calls.
1250 ///
1251 /// # Example
1252 /// ```no_run
1253 /// # use google_cloud_tasks_v2::builder;
1254 /// use builder::cloud_tasks::ListLocations;
1255 /// # tokio_test::block_on(async {
1256 /// let builder = prepare_request_builder();
1257 /// use gax::paginator::ItemPaginator;
1258 /// let mut items = builder.by_item();
1259 /// while let Some(result) = items.next().await {
1260 /// let item = result?;
1261 /// }
1262 /// # gax::Result::<()>::Ok(()) });
1263 ///
1264 /// fn prepare_request_builder() -> ListLocations {
1265 /// # panic!();
1266 /// // ... details omitted ...
1267 /// }
1268 /// ```
1269 #[derive(Clone, Debug)]
1270 pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
1271
1272 impl ListLocations {
1273 pub(crate) fn new(
1274 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudTasks>,
1275 ) -> Self {
1276 Self(RequestBuilder::new(stub))
1277 }
1278
1279 /// Sets the full request, replacing any prior values.
1280 pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
1281 mut self,
1282 v: V,
1283 ) -> Self {
1284 self.0.request = v.into();
1285 self
1286 }
1287
1288 /// Sets all the options, replacing any prior values.
1289 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1290 self.0.options = v.into();
1291 self
1292 }
1293
1294 /// Sends the request.
1295 pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
1296 (*self.0.stub)
1297 .list_locations(self.0.request, self.0.options)
1298 .await
1299 .map(gax::response::Response::into_body)
1300 }
1301
1302 /// Streams each page in the collection.
1303 pub fn by_page(
1304 self,
1305 ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
1306 {
1307 use std::clone::Clone;
1308 let token = self.0.request.page_token.clone();
1309 let execute = move |token: String| {
1310 let mut builder = self.clone();
1311 builder.0.request = builder.0.request.set_page_token(token);
1312 builder.send()
1313 };
1314 gax::paginator::internal::new_paginator(token, execute)
1315 }
1316
1317 /// Streams each item in the collection.
1318 pub fn by_item(
1319 self,
1320 ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
1321 {
1322 use gax::paginator::Paginator;
1323 self.by_page().items()
1324 }
1325
1326 /// Sets the value of [name][location::model::ListLocationsRequest::name].
1327 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1328 self.0.request.name = v.into();
1329 self
1330 }
1331
1332 /// Sets the value of [filter][location::model::ListLocationsRequest::filter].
1333 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1334 self.0.request.filter = v.into();
1335 self
1336 }
1337
1338 /// Sets the value of [page_size][location::model::ListLocationsRequest::page_size].
1339 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1340 self.0.request.page_size = v.into();
1341 self
1342 }
1343
1344 /// Sets the value of [page_token][location::model::ListLocationsRequest::page_token].
1345 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1346 self.0.request.page_token = v.into();
1347 self
1348 }
1349 }
1350
1351 #[doc(hidden)]
1352 impl gax::options::internal::RequestBuilder for ListLocations {
1353 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1354 &mut self.0.options
1355 }
1356 }
1357
1358 /// The request builder for [CloudTasks::get_location][super::super::client::CloudTasks::get_location] calls.
1359 ///
1360 /// # Example
1361 /// ```no_run
1362 /// # use google_cloud_tasks_v2::builder;
1363 /// use builder::cloud_tasks::GetLocation;
1364 /// # tokio_test::block_on(async {
1365 /// let builder = prepare_request_builder();
1366 /// let response = builder.send().await?;
1367 /// # gax::Result::<()>::Ok(()) });
1368 ///
1369 /// fn prepare_request_builder() -> GetLocation {
1370 /// # panic!();
1371 /// // ... details omitted ...
1372 /// }
1373 /// ```
1374 #[derive(Clone, Debug)]
1375 pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
1376
1377 impl GetLocation {
1378 pub(crate) fn new(
1379 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudTasks>,
1380 ) -> Self {
1381 Self(RequestBuilder::new(stub))
1382 }
1383
1384 /// Sets the full request, replacing any prior values.
1385 pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
1386 self.0.request = v.into();
1387 self
1388 }
1389
1390 /// Sets all the options, replacing any prior values.
1391 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1392 self.0.options = v.into();
1393 self
1394 }
1395
1396 /// Sends the request.
1397 pub async fn send(self) -> Result<location::model::Location> {
1398 (*self.0.stub)
1399 .get_location(self.0.request, self.0.options)
1400 .await
1401 .map(gax::response::Response::into_body)
1402 }
1403
1404 /// Sets the value of [name][location::model::GetLocationRequest::name].
1405 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1406 self.0.request.name = v.into();
1407 self
1408 }
1409 }
1410
1411 #[doc(hidden)]
1412 impl gax::options::internal::RequestBuilder for GetLocation {
1413 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1414 &mut self.0.options
1415 }
1416 }
1417}