google_cloud_bigquery_connection_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
17pub mod connection_service {
18 use crate::Result;
19
20 /// A builder for [ConnectionService][crate::client::ConnectionService].
21 ///
22 /// ```
23 /// # async fn sample() -> gax::client_builder::Result<()> {
24 /// # use google_cloud_bigquery_connection_v1::*;
25 /// # use builder::connection_service::ClientBuilder;
26 /// # use client::ConnectionService;
27 /// let builder : ClientBuilder = ConnectionService::builder();
28 /// let client = builder
29 /// .with_endpoint("https://bigqueryconnection.googleapis.com")
30 /// .build().await?;
31 /// # 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::ConnectionService;
38 pub struct Factory;
39 impl gax::client_builder::internal::ClientFactory for Factory {
40 type Client = ConnectionService;
41 type Credentials = gaxi::options::Credentials;
42 async fn build(
43 self,
44 config: gaxi::options::ClientConfig,
45 ) -> gax::client_builder::Result<Self::Client> {
46 Self::Client::new(config).await
47 }
48 }
49 }
50
51 /// Common implementation for [crate::client::ConnectionService] 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::ConnectionService>,
55 request: R,
56 options: gax::options::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::ConnectionService>,
65 ) -> Self {
66 Self {
67 stub,
68 request: R::default(),
69 options: gax::options::RequestOptions::default(),
70 }
71 }
72 }
73
74 /// The request builder for [ConnectionService::create_connection][crate::client::ConnectionService::create_connection] calls.
75 ///
76 /// # Example
77 /// ```
78 /// # use google_cloud_bigquery_connection_v1::builder::connection_service::CreateConnection;
79 /// # async fn sample() -> gax::Result<()> {
80 ///
81 /// let builder = prepare_request_builder();
82 /// let response = builder.send().await?;
83 /// # Ok(()) }
84 ///
85 /// fn prepare_request_builder() -> CreateConnection {
86 /// # panic!();
87 /// // ... details omitted ...
88 /// }
89 /// ```
90 #[derive(Clone, Debug)]
91 pub struct CreateConnection(RequestBuilder<crate::model::CreateConnectionRequest>);
92
93 impl CreateConnection {
94 pub(crate) fn new(
95 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConnectionService>,
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::CreateConnectionRequest>>(
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<gax::options::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::Connection> {
117 (*self.0.stub)
118 .create_connection(self.0.request, self.0.options)
119 .await
120 .map(gax::response::Response::into_body)
121 }
122
123 /// Sets the value of [parent][crate::model::CreateConnectionRequest::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 [connection_id][crate::model::CreateConnectionRequest::connection_id].
132 pub fn set_connection_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
133 self.0.request.connection_id = v.into();
134 self
135 }
136
137 /// Sets the value of [connection][crate::model::CreateConnectionRequest::connection].
138 ///
139 /// This is a **required** field for requests.
140 pub fn set_connection<T>(mut self, v: T) -> Self
141 where
142 T: std::convert::Into<crate::model::Connection>,
143 {
144 self.0.request.connection = std::option::Option::Some(v.into());
145 self
146 }
147
148 /// Sets or clears the value of [connection][crate::model::CreateConnectionRequest::connection].
149 ///
150 /// This is a **required** field for requests.
151 pub fn set_or_clear_connection<T>(mut self, v: std::option::Option<T>) -> Self
152 where
153 T: std::convert::Into<crate::model::Connection>,
154 {
155 self.0.request.connection = v.map(|x| x.into());
156 self
157 }
158 }
159
160 #[doc(hidden)]
161 impl gax::options::internal::RequestBuilder for CreateConnection {
162 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
163 &mut self.0.options
164 }
165 }
166
167 /// The request builder for [ConnectionService::get_connection][crate::client::ConnectionService::get_connection] calls.
168 ///
169 /// # Example
170 /// ```
171 /// # use google_cloud_bigquery_connection_v1::builder::connection_service::GetConnection;
172 /// # async fn sample() -> gax::Result<()> {
173 ///
174 /// let builder = prepare_request_builder();
175 /// let response = builder.send().await?;
176 /// # Ok(()) }
177 ///
178 /// fn prepare_request_builder() -> GetConnection {
179 /// # panic!();
180 /// // ... details omitted ...
181 /// }
182 /// ```
183 #[derive(Clone, Debug)]
184 pub struct GetConnection(RequestBuilder<crate::model::GetConnectionRequest>);
185
186 impl GetConnection {
187 pub(crate) fn new(
188 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConnectionService>,
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::GetConnectionRequest>>(mut self, v: V) -> Self {
195 self.0.request = v.into();
196 self
197 }
198
199 /// Sets all the options, replacing any prior values.
200 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
201 self.0.options = v.into();
202 self
203 }
204
205 /// Sends the request.
206 pub async fn send(self) -> Result<crate::model::Connection> {
207 (*self.0.stub)
208 .get_connection(self.0.request, self.0.options)
209 .await
210 .map(gax::response::Response::into_body)
211 }
212
213 /// Sets the value of [name][crate::model::GetConnectionRequest::name].
214 ///
215 /// This is a **required** field for requests.
216 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
217 self.0.request.name = v.into();
218 self
219 }
220 }
221
222 #[doc(hidden)]
223 impl gax::options::internal::RequestBuilder for GetConnection {
224 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
225 &mut self.0.options
226 }
227 }
228
229 /// The request builder for [ConnectionService::list_connections][crate::client::ConnectionService::list_connections] calls.
230 ///
231 /// # Example
232 /// ```
233 /// # use google_cloud_bigquery_connection_v1::builder::connection_service::ListConnections;
234 /// # async fn sample() -> gax::Result<()> {
235 /// use gax::paginator::ItemPaginator;
236 ///
237 /// let builder = prepare_request_builder();
238 /// let mut items = builder.by_item();
239 /// while let Some(result) = items.next().await {
240 /// let item = result?;
241 /// }
242 /// # Ok(()) }
243 ///
244 /// fn prepare_request_builder() -> ListConnections {
245 /// # panic!();
246 /// // ... details omitted ...
247 /// }
248 /// ```
249 #[derive(Clone, Debug)]
250 pub struct ListConnections(RequestBuilder<crate::model::ListConnectionsRequest>);
251
252 impl ListConnections {
253 pub(crate) fn new(
254 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConnectionService>,
255 ) -> Self {
256 Self(RequestBuilder::new(stub))
257 }
258
259 /// Sets the full request, replacing any prior values.
260 pub fn with_request<V: Into<crate::model::ListConnectionsRequest>>(mut self, v: V) -> Self {
261 self.0.request = v.into();
262 self
263 }
264
265 /// Sets all the options, replacing any prior values.
266 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
267 self.0.options = v.into();
268 self
269 }
270
271 /// Sends the request.
272 pub async fn send(self) -> Result<crate::model::ListConnectionsResponse> {
273 (*self.0.stub)
274 .list_connections(self.0.request, self.0.options)
275 .await
276 .map(gax::response::Response::into_body)
277 }
278
279 /// Streams each page in the collection.
280 pub fn by_page(
281 self,
282 ) -> impl gax::paginator::Paginator<crate::model::ListConnectionsResponse, gax::error::Error>
283 {
284 use std::clone::Clone;
285 let token = self.0.request.page_token.clone();
286 let execute = move |token: String| {
287 let mut builder = self.clone();
288 builder.0.request = builder.0.request.set_page_token(token);
289 builder.send()
290 };
291 gax::paginator::internal::new_paginator(token, execute)
292 }
293
294 /// Streams each item in the collection.
295 pub fn by_item(
296 self,
297 ) -> impl gax::paginator::ItemPaginator<crate::model::ListConnectionsResponse, gax::error::Error>
298 {
299 use gax::paginator::Paginator;
300 self.by_page().items()
301 }
302
303 /// Sets the value of [parent][crate::model::ListConnectionsRequest::parent].
304 ///
305 /// This is a **required** field for requests.
306 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
307 self.0.request.parent = v.into();
308 self
309 }
310
311 /// Sets the value of [page_size][crate::model::ListConnectionsRequest::page_size].
312 ///
313 /// This is a **required** field for requests.
314 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
315 self.0.request.page_size = v.into();
316 self
317 }
318
319 /// Sets the value of [page_token][crate::model::ListConnectionsRequest::page_token].
320 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
321 self.0.request.page_token = v.into();
322 self
323 }
324 }
325
326 #[doc(hidden)]
327 impl gax::options::internal::RequestBuilder for ListConnections {
328 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
329 &mut self.0.options
330 }
331 }
332
333 /// The request builder for [ConnectionService::update_connection][crate::client::ConnectionService::update_connection] calls.
334 ///
335 /// # Example
336 /// ```
337 /// # use google_cloud_bigquery_connection_v1::builder::connection_service::UpdateConnection;
338 /// # async fn sample() -> gax::Result<()> {
339 ///
340 /// let builder = prepare_request_builder();
341 /// let response = builder.send().await?;
342 /// # Ok(()) }
343 ///
344 /// fn prepare_request_builder() -> UpdateConnection {
345 /// # panic!();
346 /// // ... details omitted ...
347 /// }
348 /// ```
349 #[derive(Clone, Debug)]
350 pub struct UpdateConnection(RequestBuilder<crate::model::UpdateConnectionRequest>);
351
352 impl UpdateConnection {
353 pub(crate) fn new(
354 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConnectionService>,
355 ) -> Self {
356 Self(RequestBuilder::new(stub))
357 }
358
359 /// Sets the full request, replacing any prior values.
360 pub fn with_request<V: Into<crate::model::UpdateConnectionRequest>>(
361 mut self,
362 v: V,
363 ) -> Self {
364 self.0.request = v.into();
365 self
366 }
367
368 /// Sets all the options, replacing any prior values.
369 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
370 self.0.options = v.into();
371 self
372 }
373
374 /// Sends the request.
375 pub async fn send(self) -> Result<crate::model::Connection> {
376 (*self.0.stub)
377 .update_connection(self.0.request, self.0.options)
378 .await
379 .map(gax::response::Response::into_body)
380 }
381
382 /// Sets the value of [name][crate::model::UpdateConnectionRequest::name].
383 ///
384 /// This is a **required** field for requests.
385 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
386 self.0.request.name = v.into();
387 self
388 }
389
390 /// Sets the value of [connection][crate::model::UpdateConnectionRequest::connection].
391 ///
392 /// This is a **required** field for requests.
393 pub fn set_connection<T>(mut self, v: T) -> Self
394 where
395 T: std::convert::Into<crate::model::Connection>,
396 {
397 self.0.request.connection = std::option::Option::Some(v.into());
398 self
399 }
400
401 /// Sets or clears the value of [connection][crate::model::UpdateConnectionRequest::connection].
402 ///
403 /// This is a **required** field for requests.
404 pub fn set_or_clear_connection<T>(mut self, v: std::option::Option<T>) -> Self
405 where
406 T: std::convert::Into<crate::model::Connection>,
407 {
408 self.0.request.connection = v.map(|x| x.into());
409 self
410 }
411
412 /// Sets the value of [update_mask][crate::model::UpdateConnectionRequest::update_mask].
413 ///
414 /// This is a **required** field for requests.
415 pub fn set_update_mask<T>(mut self, v: T) -> Self
416 where
417 T: std::convert::Into<wkt::FieldMask>,
418 {
419 self.0.request.update_mask = std::option::Option::Some(v.into());
420 self
421 }
422
423 /// Sets or clears the value of [update_mask][crate::model::UpdateConnectionRequest::update_mask].
424 ///
425 /// This is a **required** field for requests.
426 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
427 where
428 T: std::convert::Into<wkt::FieldMask>,
429 {
430 self.0.request.update_mask = v.map(|x| x.into());
431 self
432 }
433 }
434
435 #[doc(hidden)]
436 impl gax::options::internal::RequestBuilder for UpdateConnection {
437 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
438 &mut self.0.options
439 }
440 }
441
442 /// The request builder for [ConnectionService::delete_connection][crate::client::ConnectionService::delete_connection] calls.
443 ///
444 /// # Example
445 /// ```
446 /// # use google_cloud_bigquery_connection_v1::builder::connection_service::DeleteConnection;
447 /// # async fn sample() -> gax::Result<()> {
448 ///
449 /// let builder = prepare_request_builder();
450 /// let response = builder.send().await?;
451 /// # Ok(()) }
452 ///
453 /// fn prepare_request_builder() -> DeleteConnection {
454 /// # panic!();
455 /// // ... details omitted ...
456 /// }
457 /// ```
458 #[derive(Clone, Debug)]
459 pub struct DeleteConnection(RequestBuilder<crate::model::DeleteConnectionRequest>);
460
461 impl DeleteConnection {
462 pub(crate) fn new(
463 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConnectionService>,
464 ) -> Self {
465 Self(RequestBuilder::new(stub))
466 }
467
468 /// Sets the full request, replacing any prior values.
469 pub fn with_request<V: Into<crate::model::DeleteConnectionRequest>>(
470 mut self,
471 v: V,
472 ) -> Self {
473 self.0.request = v.into();
474 self
475 }
476
477 /// Sets all the options, replacing any prior values.
478 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
479 self.0.options = v.into();
480 self
481 }
482
483 /// Sends the request.
484 pub async fn send(self) -> Result<()> {
485 (*self.0.stub)
486 .delete_connection(self.0.request, self.0.options)
487 .await
488 .map(gax::response::Response::into_body)
489 }
490
491 /// Sets the value of [name][crate::model::DeleteConnectionRequest::name].
492 ///
493 /// This is a **required** field for requests.
494 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
495 self.0.request.name = v.into();
496 self
497 }
498 }
499
500 #[doc(hidden)]
501 impl gax::options::internal::RequestBuilder for DeleteConnection {
502 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
503 &mut self.0.options
504 }
505 }
506
507 /// The request builder for [ConnectionService::get_iam_policy][crate::client::ConnectionService::get_iam_policy] calls.
508 ///
509 /// # Example
510 /// ```
511 /// # use google_cloud_bigquery_connection_v1::builder::connection_service::GetIamPolicy;
512 /// # async fn sample() -> gax::Result<()> {
513 ///
514 /// let builder = prepare_request_builder();
515 /// let response = builder.send().await?;
516 /// # Ok(()) }
517 ///
518 /// fn prepare_request_builder() -> GetIamPolicy {
519 /// # panic!();
520 /// // ... details omitted ...
521 /// }
522 /// ```
523 #[derive(Clone, Debug)]
524 pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
525
526 impl GetIamPolicy {
527 pub(crate) fn new(
528 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConnectionService>,
529 ) -> Self {
530 Self(RequestBuilder::new(stub))
531 }
532
533 /// Sets the full request, replacing any prior values.
534 pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
535 self.0.request = v.into();
536 self
537 }
538
539 /// Sets all the options, replacing any prior values.
540 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
541 self.0.options = v.into();
542 self
543 }
544
545 /// Sends the request.
546 pub async fn send(self) -> Result<iam_v1::model::Policy> {
547 (*self.0.stub)
548 .get_iam_policy(self.0.request, self.0.options)
549 .await
550 .map(gax::response::Response::into_body)
551 }
552
553 /// Sets the value of [resource][iam_v1::model::GetIamPolicyRequest::resource].
554 ///
555 /// This is a **required** field for requests.
556 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
557 self.0.request.resource = v.into();
558 self
559 }
560
561 /// Sets the value of [options][iam_v1::model::GetIamPolicyRequest::options].
562 pub fn set_options<T>(mut self, v: T) -> Self
563 where
564 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
565 {
566 self.0.request.options = std::option::Option::Some(v.into());
567 self
568 }
569
570 /// Sets or clears the value of [options][iam_v1::model::GetIamPolicyRequest::options].
571 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
572 where
573 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
574 {
575 self.0.request.options = v.map(|x| x.into());
576 self
577 }
578 }
579
580 #[doc(hidden)]
581 impl gax::options::internal::RequestBuilder for GetIamPolicy {
582 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
583 &mut self.0.options
584 }
585 }
586
587 /// The request builder for [ConnectionService::set_iam_policy][crate::client::ConnectionService::set_iam_policy] calls.
588 ///
589 /// # Example
590 /// ```
591 /// # use google_cloud_bigquery_connection_v1::builder::connection_service::SetIamPolicy;
592 /// # async fn sample() -> gax::Result<()> {
593 ///
594 /// let builder = prepare_request_builder();
595 /// let response = builder.send().await?;
596 /// # Ok(()) }
597 ///
598 /// fn prepare_request_builder() -> SetIamPolicy {
599 /// # panic!();
600 /// // ... details omitted ...
601 /// }
602 /// ```
603 #[derive(Clone, Debug)]
604 pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
605
606 impl SetIamPolicy {
607 pub(crate) fn new(
608 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConnectionService>,
609 ) -> Self {
610 Self(RequestBuilder::new(stub))
611 }
612
613 /// Sets the full request, replacing any prior values.
614 pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
615 self.0.request = v.into();
616 self
617 }
618
619 /// Sets all the options, replacing any prior values.
620 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
621 self.0.options = v.into();
622 self
623 }
624
625 /// Sends the request.
626 pub async fn send(self) -> Result<iam_v1::model::Policy> {
627 (*self.0.stub)
628 .set_iam_policy(self.0.request, self.0.options)
629 .await
630 .map(gax::response::Response::into_body)
631 }
632
633 /// Sets the value of [resource][iam_v1::model::SetIamPolicyRequest::resource].
634 ///
635 /// This is a **required** field for requests.
636 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
637 self.0.request.resource = v.into();
638 self
639 }
640
641 /// Sets the value of [policy][iam_v1::model::SetIamPolicyRequest::policy].
642 ///
643 /// This is a **required** field for requests.
644 pub fn set_policy<T>(mut self, v: T) -> Self
645 where
646 T: std::convert::Into<iam_v1::model::Policy>,
647 {
648 self.0.request.policy = std::option::Option::Some(v.into());
649 self
650 }
651
652 /// Sets or clears the value of [policy][iam_v1::model::SetIamPolicyRequest::policy].
653 ///
654 /// This is a **required** field for requests.
655 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
656 where
657 T: std::convert::Into<iam_v1::model::Policy>,
658 {
659 self.0.request.policy = v.map(|x| x.into());
660 self
661 }
662
663 /// Sets the value of [update_mask][iam_v1::model::SetIamPolicyRequest::update_mask].
664 pub fn set_update_mask<T>(mut self, v: T) -> Self
665 where
666 T: std::convert::Into<wkt::FieldMask>,
667 {
668 self.0.request.update_mask = std::option::Option::Some(v.into());
669 self
670 }
671
672 /// Sets or clears the value of [update_mask][iam_v1::model::SetIamPolicyRequest::update_mask].
673 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
674 where
675 T: std::convert::Into<wkt::FieldMask>,
676 {
677 self.0.request.update_mask = v.map(|x| x.into());
678 self
679 }
680 }
681
682 #[doc(hidden)]
683 impl gax::options::internal::RequestBuilder for SetIamPolicy {
684 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
685 &mut self.0.options
686 }
687 }
688
689 /// The request builder for [ConnectionService::test_iam_permissions][crate::client::ConnectionService::test_iam_permissions] calls.
690 ///
691 /// # Example
692 /// ```
693 /// # use google_cloud_bigquery_connection_v1::builder::connection_service::TestIamPermissions;
694 /// # async fn sample() -> gax::Result<()> {
695 ///
696 /// let builder = prepare_request_builder();
697 /// let response = builder.send().await?;
698 /// # Ok(()) }
699 ///
700 /// fn prepare_request_builder() -> TestIamPermissions {
701 /// # panic!();
702 /// // ... details omitted ...
703 /// }
704 /// ```
705 #[derive(Clone, Debug)]
706 pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
707
708 impl TestIamPermissions {
709 pub(crate) fn new(
710 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConnectionService>,
711 ) -> Self {
712 Self(RequestBuilder::new(stub))
713 }
714
715 /// Sets the full request, replacing any prior values.
716 pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
717 mut self,
718 v: V,
719 ) -> Self {
720 self.0.request = v.into();
721 self
722 }
723
724 /// Sets all the options, replacing any prior values.
725 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
726 self.0.options = v.into();
727 self
728 }
729
730 /// Sends the request.
731 pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
732 (*self.0.stub)
733 .test_iam_permissions(self.0.request, self.0.options)
734 .await
735 .map(gax::response::Response::into_body)
736 }
737
738 /// Sets the value of [resource][iam_v1::model::TestIamPermissionsRequest::resource].
739 ///
740 /// This is a **required** field for requests.
741 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
742 self.0.request.resource = v.into();
743 self
744 }
745
746 /// Sets the value of [permissions][iam_v1::model::TestIamPermissionsRequest::permissions].
747 ///
748 /// This is a **required** field for requests.
749 pub fn set_permissions<T, V>(mut self, v: T) -> Self
750 where
751 T: std::iter::IntoIterator<Item = V>,
752 V: std::convert::Into<std::string::String>,
753 {
754 use std::iter::Iterator;
755 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
756 self
757 }
758 }
759
760 #[doc(hidden)]
761 impl gax::options::internal::RequestBuilder for TestIamPermissions {
762 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
763 &mut self.0.options
764 }
765 }
766}