Skip to main content

google_cloud_binaryauthorization_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 [BinauthzManagementServiceV1][crate::client::BinauthzManagementServiceV1].
18pub mod binauthz_management_service_v_1 {
19    use crate::Result;
20
21    /// A builder for [BinauthzManagementServiceV1][crate::client::BinauthzManagementServiceV1].
22    ///
23    /// ```
24    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
25    /// # use google_cloud_binaryauthorization_v1::*;
26    /// # use builder::binauthz_management_service_v_1::ClientBuilder;
27    /// # use client::BinauthzManagementServiceV1;
28    /// let builder : ClientBuilder = BinauthzManagementServiceV1::builder();
29    /// let client = builder
30    ///     .with_endpoint("https://binaryauthorization.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::BinauthzManagementServiceV1;
38        pub struct Factory;
39        impl crate::ClientFactory for Factory {
40            type Client = BinauthzManagementServiceV1;
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::BinauthzManagementServiceV1] 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::BinauthzManagementServiceV1>,
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::BinauthzManagementServiceV1>,
65        ) -> Self {
66            Self {
67                stub,
68                request: R::default(),
69                options: crate::RequestOptions::default(),
70            }
71        }
72    }
73
74    /// The request builder for [BinauthzManagementServiceV1::get_policy][crate::client::BinauthzManagementServiceV1::get_policy] calls.
75    ///
76    /// # Example
77    /// ```
78    /// # use google_cloud_binaryauthorization_v1::builder::binauthz_management_service_v_1::GetPolicy;
79    /// # async fn sample() -> google_cloud_binaryauthorization_v1::Result<()> {
80    ///
81    /// let builder = prepare_request_builder();
82    /// let response = builder.send().await?;
83    /// # Ok(()) }
84    ///
85    /// fn prepare_request_builder() -> GetPolicy {
86    ///   # panic!();
87    ///   // ... details omitted ...
88    /// }
89    /// ```
90    #[derive(Clone, Debug)]
91    pub struct GetPolicy(RequestBuilder<crate::model::GetPolicyRequest>);
92
93    impl GetPolicy {
94        pub(crate) fn new(
95            stub: std::sync::Arc<dyn super::super::stub::dynamic::BinauthzManagementServiceV1>,
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::GetPolicyRequest>>(mut self, v: V) -> Self {
102            self.0.request = v.into();
103            self
104        }
105
106        /// Sets all the options, replacing any prior values.
107        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
108            self.0.options = v.into();
109            self
110        }
111
112        /// Sends the request.
113        pub async fn send(self) -> Result<crate::model::Policy> {
114            (*self.0.stub)
115                .get_policy(self.0.request, self.0.options)
116                .await
117                .map(crate::Response::into_body)
118        }
119
120        /// Sets the value of [name][crate::model::GetPolicyRequest::name].
121        ///
122        /// This is a **required** field for requests.
123        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
124            self.0.request.name = v.into();
125            self
126        }
127    }
128
129    #[doc(hidden)]
130    impl crate::RequestBuilder for GetPolicy {
131        fn request_options(&mut self) -> &mut crate::RequestOptions {
132            &mut self.0.options
133        }
134    }
135
136    /// The request builder for [BinauthzManagementServiceV1::update_policy][crate::client::BinauthzManagementServiceV1::update_policy] calls.
137    ///
138    /// # Example
139    /// ```
140    /// # use google_cloud_binaryauthorization_v1::builder::binauthz_management_service_v_1::UpdatePolicy;
141    /// # async fn sample() -> google_cloud_binaryauthorization_v1::Result<()> {
142    ///
143    /// let builder = prepare_request_builder();
144    /// let response = builder.send().await?;
145    /// # Ok(()) }
146    ///
147    /// fn prepare_request_builder() -> UpdatePolicy {
148    ///   # panic!();
149    ///   // ... details omitted ...
150    /// }
151    /// ```
152    #[derive(Clone, Debug)]
153    pub struct UpdatePolicy(RequestBuilder<crate::model::UpdatePolicyRequest>);
154
155    impl UpdatePolicy {
156        pub(crate) fn new(
157            stub: std::sync::Arc<dyn super::super::stub::dynamic::BinauthzManagementServiceV1>,
158        ) -> Self {
159            Self(RequestBuilder::new(stub))
160        }
161
162        /// Sets the full request, replacing any prior values.
163        pub fn with_request<V: Into<crate::model::UpdatePolicyRequest>>(mut self, v: V) -> Self {
164            self.0.request = v.into();
165            self
166        }
167
168        /// Sets all the options, replacing any prior values.
169        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
170            self.0.options = v.into();
171            self
172        }
173
174        /// Sends the request.
175        pub async fn send(self) -> Result<crate::model::Policy> {
176            (*self.0.stub)
177                .update_policy(self.0.request, self.0.options)
178                .await
179                .map(crate::Response::into_body)
180        }
181
182        /// Sets the value of [policy][crate::model::UpdatePolicyRequest::policy].
183        ///
184        /// This is a **required** field for requests.
185        pub fn set_policy<T>(mut self, v: T) -> Self
186        where
187            T: std::convert::Into<crate::model::Policy>,
188        {
189            self.0.request.policy = std::option::Option::Some(v.into());
190            self
191        }
192
193        /// Sets or clears the value of [policy][crate::model::UpdatePolicyRequest::policy].
194        ///
195        /// This is a **required** field for requests.
196        pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
197        where
198            T: std::convert::Into<crate::model::Policy>,
199        {
200            self.0.request.policy = v.map(|x| x.into());
201            self
202        }
203    }
204
205    #[doc(hidden)]
206    impl crate::RequestBuilder for UpdatePolicy {
207        fn request_options(&mut self) -> &mut crate::RequestOptions {
208            &mut self.0.options
209        }
210    }
211
212    /// The request builder for [BinauthzManagementServiceV1::create_attestor][crate::client::BinauthzManagementServiceV1::create_attestor] calls.
213    ///
214    /// # Example
215    /// ```
216    /// # use google_cloud_binaryauthorization_v1::builder::binauthz_management_service_v_1::CreateAttestor;
217    /// # async fn sample() -> google_cloud_binaryauthorization_v1::Result<()> {
218    ///
219    /// let builder = prepare_request_builder();
220    /// let response = builder.send().await?;
221    /// # Ok(()) }
222    ///
223    /// fn prepare_request_builder() -> CreateAttestor {
224    ///   # panic!();
225    ///   // ... details omitted ...
226    /// }
227    /// ```
228    #[derive(Clone, Debug)]
229    pub struct CreateAttestor(RequestBuilder<crate::model::CreateAttestorRequest>);
230
231    impl CreateAttestor {
232        pub(crate) fn new(
233            stub: std::sync::Arc<dyn super::super::stub::dynamic::BinauthzManagementServiceV1>,
234        ) -> Self {
235            Self(RequestBuilder::new(stub))
236        }
237
238        /// Sets the full request, replacing any prior values.
239        pub fn with_request<V: Into<crate::model::CreateAttestorRequest>>(mut self, v: V) -> Self {
240            self.0.request = v.into();
241            self
242        }
243
244        /// Sets all the options, replacing any prior values.
245        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
246            self.0.options = v.into();
247            self
248        }
249
250        /// Sends the request.
251        pub async fn send(self) -> Result<crate::model::Attestor> {
252            (*self.0.stub)
253                .create_attestor(self.0.request, self.0.options)
254                .await
255                .map(crate::Response::into_body)
256        }
257
258        /// Sets the value of [parent][crate::model::CreateAttestorRequest::parent].
259        ///
260        /// This is a **required** field for requests.
261        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
262            self.0.request.parent = v.into();
263            self
264        }
265
266        /// Sets the value of [attestor_id][crate::model::CreateAttestorRequest::attestor_id].
267        ///
268        /// This is a **required** field for requests.
269        pub fn set_attestor_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
270            self.0.request.attestor_id = v.into();
271            self
272        }
273
274        /// Sets the value of [attestor][crate::model::CreateAttestorRequest::attestor].
275        ///
276        /// This is a **required** field for requests.
277        pub fn set_attestor<T>(mut self, v: T) -> Self
278        where
279            T: std::convert::Into<crate::model::Attestor>,
280        {
281            self.0.request.attestor = std::option::Option::Some(v.into());
282            self
283        }
284
285        /// Sets or clears the value of [attestor][crate::model::CreateAttestorRequest::attestor].
286        ///
287        /// This is a **required** field for requests.
288        pub fn set_or_clear_attestor<T>(mut self, v: std::option::Option<T>) -> Self
289        where
290            T: std::convert::Into<crate::model::Attestor>,
291        {
292            self.0.request.attestor = v.map(|x| x.into());
293            self
294        }
295    }
296
297    #[doc(hidden)]
298    impl crate::RequestBuilder for CreateAttestor {
299        fn request_options(&mut self) -> &mut crate::RequestOptions {
300            &mut self.0.options
301        }
302    }
303
304    /// The request builder for [BinauthzManagementServiceV1::get_attestor][crate::client::BinauthzManagementServiceV1::get_attestor] calls.
305    ///
306    /// # Example
307    /// ```
308    /// # use google_cloud_binaryauthorization_v1::builder::binauthz_management_service_v_1::GetAttestor;
309    /// # async fn sample() -> google_cloud_binaryauthorization_v1::Result<()> {
310    ///
311    /// let builder = prepare_request_builder();
312    /// let response = builder.send().await?;
313    /// # Ok(()) }
314    ///
315    /// fn prepare_request_builder() -> GetAttestor {
316    ///   # panic!();
317    ///   // ... details omitted ...
318    /// }
319    /// ```
320    #[derive(Clone, Debug)]
321    pub struct GetAttestor(RequestBuilder<crate::model::GetAttestorRequest>);
322
323    impl GetAttestor {
324        pub(crate) fn new(
325            stub: std::sync::Arc<dyn super::super::stub::dynamic::BinauthzManagementServiceV1>,
326        ) -> Self {
327            Self(RequestBuilder::new(stub))
328        }
329
330        /// Sets the full request, replacing any prior values.
331        pub fn with_request<V: Into<crate::model::GetAttestorRequest>>(mut self, v: V) -> Self {
332            self.0.request = v.into();
333            self
334        }
335
336        /// Sets all the options, replacing any prior values.
337        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
338            self.0.options = v.into();
339            self
340        }
341
342        /// Sends the request.
343        pub async fn send(self) -> Result<crate::model::Attestor> {
344            (*self.0.stub)
345                .get_attestor(self.0.request, self.0.options)
346                .await
347                .map(crate::Response::into_body)
348        }
349
350        /// Sets the value of [name][crate::model::GetAttestorRequest::name].
351        ///
352        /// This is a **required** field for requests.
353        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
354            self.0.request.name = v.into();
355            self
356        }
357    }
358
359    #[doc(hidden)]
360    impl crate::RequestBuilder for GetAttestor {
361        fn request_options(&mut self) -> &mut crate::RequestOptions {
362            &mut self.0.options
363        }
364    }
365
366    /// The request builder for [BinauthzManagementServiceV1::update_attestor][crate::client::BinauthzManagementServiceV1::update_attestor] calls.
367    ///
368    /// # Example
369    /// ```
370    /// # use google_cloud_binaryauthorization_v1::builder::binauthz_management_service_v_1::UpdateAttestor;
371    /// # async fn sample() -> google_cloud_binaryauthorization_v1::Result<()> {
372    ///
373    /// let builder = prepare_request_builder();
374    /// let response = builder.send().await?;
375    /// # Ok(()) }
376    ///
377    /// fn prepare_request_builder() -> UpdateAttestor {
378    ///   # panic!();
379    ///   // ... details omitted ...
380    /// }
381    /// ```
382    #[derive(Clone, Debug)]
383    pub struct UpdateAttestor(RequestBuilder<crate::model::UpdateAttestorRequest>);
384
385    impl UpdateAttestor {
386        pub(crate) fn new(
387            stub: std::sync::Arc<dyn super::super::stub::dynamic::BinauthzManagementServiceV1>,
388        ) -> Self {
389            Self(RequestBuilder::new(stub))
390        }
391
392        /// Sets the full request, replacing any prior values.
393        pub fn with_request<V: Into<crate::model::UpdateAttestorRequest>>(mut self, v: V) -> Self {
394            self.0.request = v.into();
395            self
396        }
397
398        /// Sets all the options, replacing any prior values.
399        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
400            self.0.options = v.into();
401            self
402        }
403
404        /// Sends the request.
405        pub async fn send(self) -> Result<crate::model::Attestor> {
406            (*self.0.stub)
407                .update_attestor(self.0.request, self.0.options)
408                .await
409                .map(crate::Response::into_body)
410        }
411
412        /// Sets the value of [attestor][crate::model::UpdateAttestorRequest::attestor].
413        ///
414        /// This is a **required** field for requests.
415        pub fn set_attestor<T>(mut self, v: T) -> Self
416        where
417            T: std::convert::Into<crate::model::Attestor>,
418        {
419            self.0.request.attestor = std::option::Option::Some(v.into());
420            self
421        }
422
423        /// Sets or clears the value of [attestor][crate::model::UpdateAttestorRequest::attestor].
424        ///
425        /// This is a **required** field for requests.
426        pub fn set_or_clear_attestor<T>(mut self, v: std::option::Option<T>) -> Self
427        where
428            T: std::convert::Into<crate::model::Attestor>,
429        {
430            self.0.request.attestor = v.map(|x| x.into());
431            self
432        }
433    }
434
435    #[doc(hidden)]
436    impl crate::RequestBuilder for UpdateAttestor {
437        fn request_options(&mut self) -> &mut crate::RequestOptions {
438            &mut self.0.options
439        }
440    }
441
442    /// The request builder for [BinauthzManagementServiceV1::list_attestors][crate::client::BinauthzManagementServiceV1::list_attestors] calls.
443    ///
444    /// # Example
445    /// ```
446    /// # use google_cloud_binaryauthorization_v1::builder::binauthz_management_service_v_1::ListAttestors;
447    /// # async fn sample() -> google_cloud_binaryauthorization_v1::Result<()> {
448    /// use google_cloud_gax::paginator::ItemPaginator;
449    ///
450    /// let builder = prepare_request_builder();
451    /// let mut items = builder.by_item();
452    /// while let Some(result) = items.next().await {
453    ///   let item = result?;
454    /// }
455    /// # Ok(()) }
456    ///
457    /// fn prepare_request_builder() -> ListAttestors {
458    ///   # panic!();
459    ///   // ... details omitted ...
460    /// }
461    /// ```
462    #[derive(Clone, Debug)]
463    pub struct ListAttestors(RequestBuilder<crate::model::ListAttestorsRequest>);
464
465    impl ListAttestors {
466        pub(crate) fn new(
467            stub: std::sync::Arc<dyn super::super::stub::dynamic::BinauthzManagementServiceV1>,
468        ) -> Self {
469            Self(RequestBuilder::new(stub))
470        }
471
472        /// Sets the full request, replacing any prior values.
473        pub fn with_request<V: Into<crate::model::ListAttestorsRequest>>(mut self, v: V) -> Self {
474            self.0.request = v.into();
475            self
476        }
477
478        /// Sets all the options, replacing any prior values.
479        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
480            self.0.options = v.into();
481            self
482        }
483
484        /// Sends the request.
485        pub async fn send(self) -> Result<crate::model::ListAttestorsResponse> {
486            (*self.0.stub)
487                .list_attestors(self.0.request, self.0.options)
488                .await
489                .map(crate::Response::into_body)
490        }
491
492        /// Streams each page in the collection.
493        pub fn by_page(
494            self,
495        ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListAttestorsResponse, crate::Error>
496        {
497            use std::clone::Clone;
498            let token = self.0.request.page_token.clone();
499            let execute = move |token: String| {
500                let mut builder = self.clone();
501                builder.0.request = builder.0.request.set_page_token(token);
502                builder.send()
503            };
504            google_cloud_gax::paginator::internal::new_paginator(token, execute)
505        }
506
507        /// Streams each item in the collection.
508        pub fn by_item(
509            self,
510        ) -> impl google_cloud_gax::paginator::ItemPaginator<
511            crate::model::ListAttestorsResponse,
512            crate::Error,
513        > {
514            use google_cloud_gax::paginator::Paginator;
515            self.by_page().items()
516        }
517
518        /// Sets the value of [parent][crate::model::ListAttestorsRequest::parent].
519        ///
520        /// This is a **required** field for requests.
521        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
522            self.0.request.parent = v.into();
523            self
524        }
525
526        /// Sets the value of [page_size][crate::model::ListAttestorsRequest::page_size].
527        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
528            self.0.request.page_size = v.into();
529            self
530        }
531
532        /// Sets the value of [page_token][crate::model::ListAttestorsRequest::page_token].
533        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
534            self.0.request.page_token = v.into();
535            self
536        }
537    }
538
539    #[doc(hidden)]
540    impl crate::RequestBuilder for ListAttestors {
541        fn request_options(&mut self) -> &mut crate::RequestOptions {
542            &mut self.0.options
543        }
544    }
545
546    /// The request builder for [BinauthzManagementServiceV1::delete_attestor][crate::client::BinauthzManagementServiceV1::delete_attestor] calls.
547    ///
548    /// # Example
549    /// ```
550    /// # use google_cloud_binaryauthorization_v1::builder::binauthz_management_service_v_1::DeleteAttestor;
551    /// # async fn sample() -> google_cloud_binaryauthorization_v1::Result<()> {
552    ///
553    /// let builder = prepare_request_builder();
554    /// let response = builder.send().await?;
555    /// # Ok(()) }
556    ///
557    /// fn prepare_request_builder() -> DeleteAttestor {
558    ///   # panic!();
559    ///   // ... details omitted ...
560    /// }
561    /// ```
562    #[derive(Clone, Debug)]
563    pub struct DeleteAttestor(RequestBuilder<crate::model::DeleteAttestorRequest>);
564
565    impl DeleteAttestor {
566        pub(crate) fn new(
567            stub: std::sync::Arc<dyn super::super::stub::dynamic::BinauthzManagementServiceV1>,
568        ) -> Self {
569            Self(RequestBuilder::new(stub))
570        }
571
572        /// Sets the full request, replacing any prior values.
573        pub fn with_request<V: Into<crate::model::DeleteAttestorRequest>>(mut self, v: V) -> Self {
574            self.0.request = v.into();
575            self
576        }
577
578        /// Sets all the options, replacing any prior values.
579        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
580            self.0.options = v.into();
581            self
582        }
583
584        /// Sends the request.
585        pub async fn send(self) -> Result<()> {
586            (*self.0.stub)
587                .delete_attestor(self.0.request, self.0.options)
588                .await
589                .map(crate::Response::into_body)
590        }
591
592        /// Sets the value of [name][crate::model::DeleteAttestorRequest::name].
593        ///
594        /// This is a **required** field for requests.
595        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
596            self.0.request.name = v.into();
597            self
598        }
599    }
600
601    #[doc(hidden)]
602    impl crate::RequestBuilder for DeleteAttestor {
603        fn request_options(&mut self) -> &mut crate::RequestOptions {
604            &mut self.0.options
605        }
606    }
607
608    /// The request builder for [BinauthzManagementServiceV1::set_iam_policy][crate::client::BinauthzManagementServiceV1::set_iam_policy] calls.
609    ///
610    /// # Example
611    /// ```
612    /// # use google_cloud_binaryauthorization_v1::builder::binauthz_management_service_v_1::SetIamPolicy;
613    /// # async fn sample() -> google_cloud_binaryauthorization_v1::Result<()> {
614    ///
615    /// let builder = prepare_request_builder();
616    /// let response = builder.send().await?;
617    /// # Ok(()) }
618    ///
619    /// fn prepare_request_builder() -> SetIamPolicy {
620    ///   # panic!();
621    ///   // ... details omitted ...
622    /// }
623    /// ```
624    #[derive(Clone, Debug)]
625    pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
626
627    impl SetIamPolicy {
628        pub(crate) fn new(
629            stub: std::sync::Arc<dyn super::super::stub::dynamic::BinauthzManagementServiceV1>,
630        ) -> Self {
631            Self(RequestBuilder::new(stub))
632        }
633
634        /// Sets the full request, replacing any prior values.
635        pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
636            mut self,
637            v: V,
638        ) -> Self {
639            self.0.request = v.into();
640            self
641        }
642
643        /// Sets all the options, replacing any prior values.
644        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
645            self.0.options = v.into();
646            self
647        }
648
649        /// Sends the request.
650        pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
651            (*self.0.stub)
652                .set_iam_policy(self.0.request, self.0.options)
653                .await
654                .map(crate::Response::into_body)
655        }
656
657        /// Sets the value of [resource][google_cloud_iam_v1::model::SetIamPolicyRequest::resource].
658        ///
659        /// This is a **required** field for requests.
660        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
661            self.0.request.resource = v.into();
662            self
663        }
664
665        /// Sets the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
666        ///
667        /// This is a **required** field for requests.
668        pub fn set_policy<T>(mut self, v: T) -> Self
669        where
670            T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
671        {
672            self.0.request.policy = std::option::Option::Some(v.into());
673            self
674        }
675
676        /// Sets or clears the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
677        ///
678        /// This is a **required** field for requests.
679        pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
680        where
681            T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
682        {
683            self.0.request.policy = v.map(|x| x.into());
684            self
685        }
686
687        /// Sets the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
688        pub fn set_update_mask<T>(mut self, v: T) -> Self
689        where
690            T: std::convert::Into<wkt::FieldMask>,
691        {
692            self.0.request.update_mask = std::option::Option::Some(v.into());
693            self
694        }
695
696        /// Sets or clears the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
697        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
698        where
699            T: std::convert::Into<wkt::FieldMask>,
700        {
701            self.0.request.update_mask = v.map(|x| x.into());
702            self
703        }
704    }
705
706    #[doc(hidden)]
707    impl crate::RequestBuilder for SetIamPolicy {
708        fn request_options(&mut self) -> &mut crate::RequestOptions {
709            &mut self.0.options
710        }
711    }
712
713    /// The request builder for [BinauthzManagementServiceV1::get_iam_policy][crate::client::BinauthzManagementServiceV1::get_iam_policy] calls.
714    ///
715    /// # Example
716    /// ```
717    /// # use google_cloud_binaryauthorization_v1::builder::binauthz_management_service_v_1::GetIamPolicy;
718    /// # async fn sample() -> google_cloud_binaryauthorization_v1::Result<()> {
719    ///
720    /// let builder = prepare_request_builder();
721    /// let response = builder.send().await?;
722    /// # Ok(()) }
723    ///
724    /// fn prepare_request_builder() -> GetIamPolicy {
725    ///   # panic!();
726    ///   // ... details omitted ...
727    /// }
728    /// ```
729    #[derive(Clone, Debug)]
730    pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
731
732    impl GetIamPolicy {
733        pub(crate) fn new(
734            stub: std::sync::Arc<dyn super::super::stub::dynamic::BinauthzManagementServiceV1>,
735        ) -> Self {
736            Self(RequestBuilder::new(stub))
737        }
738
739        /// Sets the full request, replacing any prior values.
740        pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
741            mut self,
742            v: V,
743        ) -> Self {
744            self.0.request = v.into();
745            self
746        }
747
748        /// Sets all the options, replacing any prior values.
749        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
750            self.0.options = v.into();
751            self
752        }
753
754        /// Sends the request.
755        pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
756            (*self.0.stub)
757                .get_iam_policy(self.0.request, self.0.options)
758                .await
759                .map(crate::Response::into_body)
760        }
761
762        /// Sets the value of [resource][google_cloud_iam_v1::model::GetIamPolicyRequest::resource].
763        ///
764        /// This is a **required** field for requests.
765        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
766            self.0.request.resource = v.into();
767            self
768        }
769
770        /// Sets the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
771        pub fn set_options<T>(mut self, v: T) -> Self
772        where
773            T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
774        {
775            self.0.request.options = std::option::Option::Some(v.into());
776            self
777        }
778
779        /// Sets or clears the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
780        pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
781        where
782            T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
783        {
784            self.0.request.options = v.map(|x| x.into());
785            self
786        }
787    }
788
789    #[doc(hidden)]
790    impl crate::RequestBuilder for GetIamPolicy {
791        fn request_options(&mut self) -> &mut crate::RequestOptions {
792            &mut self.0.options
793        }
794    }
795
796    /// The request builder for [BinauthzManagementServiceV1::test_iam_permissions][crate::client::BinauthzManagementServiceV1::test_iam_permissions] calls.
797    ///
798    /// # Example
799    /// ```
800    /// # use google_cloud_binaryauthorization_v1::builder::binauthz_management_service_v_1::TestIamPermissions;
801    /// # async fn sample() -> google_cloud_binaryauthorization_v1::Result<()> {
802    ///
803    /// let builder = prepare_request_builder();
804    /// let response = builder.send().await?;
805    /// # Ok(()) }
806    ///
807    /// fn prepare_request_builder() -> TestIamPermissions {
808    ///   # panic!();
809    ///   // ... details omitted ...
810    /// }
811    /// ```
812    #[derive(Clone, Debug)]
813    pub struct TestIamPermissions(
814        RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
815    );
816
817    impl TestIamPermissions {
818        pub(crate) fn new(
819            stub: std::sync::Arc<dyn super::super::stub::dynamic::BinauthzManagementServiceV1>,
820        ) -> Self {
821            Self(RequestBuilder::new(stub))
822        }
823
824        /// Sets the full request, replacing any prior values.
825        pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
826            mut self,
827            v: V,
828        ) -> Self {
829            self.0.request = v.into();
830            self
831        }
832
833        /// Sets all the options, replacing any prior values.
834        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
835            self.0.options = v.into();
836            self
837        }
838
839        /// Sends the request.
840        pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
841            (*self.0.stub)
842                .test_iam_permissions(self.0.request, self.0.options)
843                .await
844                .map(crate::Response::into_body)
845        }
846
847        /// Sets the value of [resource][google_cloud_iam_v1::model::TestIamPermissionsRequest::resource].
848        ///
849        /// This is a **required** field for requests.
850        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
851            self.0.request.resource = v.into();
852            self
853        }
854
855        /// Sets the value of [permissions][google_cloud_iam_v1::model::TestIamPermissionsRequest::permissions].
856        ///
857        /// This is a **required** field for requests.
858        pub fn set_permissions<T, V>(mut self, v: T) -> Self
859        where
860            T: std::iter::IntoIterator<Item = V>,
861            V: std::convert::Into<std::string::String>,
862        {
863            use std::iter::Iterator;
864            self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
865            self
866        }
867    }
868
869    #[doc(hidden)]
870    impl crate::RequestBuilder for TestIamPermissions {
871        fn request_options(&mut self) -> &mut crate::RequestOptions {
872            &mut self.0.options
873        }
874    }
875}
876
877/// Request and client builders for [SystemPolicyV1][crate::client::SystemPolicyV1].
878pub mod system_policy_v_1 {
879    use crate::Result;
880
881    /// A builder for [SystemPolicyV1][crate::client::SystemPolicyV1].
882    ///
883    /// ```
884    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
885    /// # use google_cloud_binaryauthorization_v1::*;
886    /// # use builder::system_policy_v_1::ClientBuilder;
887    /// # use client::SystemPolicyV1;
888    /// let builder : ClientBuilder = SystemPolicyV1::builder();
889    /// let client = builder
890    ///     .with_endpoint("https://binaryauthorization.googleapis.com")
891    ///     .build().await?;
892    /// # Ok(()) }
893    /// ```
894    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
895
896    pub(crate) mod client {
897        use super::super::super::client::SystemPolicyV1;
898        pub struct Factory;
899        impl crate::ClientFactory for Factory {
900            type Client = SystemPolicyV1;
901            type Credentials = gaxi::options::Credentials;
902            async fn build(
903                self,
904                config: gaxi::options::ClientConfig,
905            ) -> crate::ClientBuilderResult<Self::Client> {
906                Self::Client::new(config).await
907            }
908        }
909    }
910
911    /// Common implementation for [crate::client::SystemPolicyV1] request builders.
912    #[derive(Clone, Debug)]
913    pub(crate) struct RequestBuilder<R: std::default::Default> {
914        stub: std::sync::Arc<dyn super::super::stub::dynamic::SystemPolicyV1>,
915        request: R,
916        options: crate::RequestOptions,
917    }
918
919    impl<R> RequestBuilder<R>
920    where
921        R: std::default::Default,
922    {
923        pub(crate) fn new(
924            stub: std::sync::Arc<dyn super::super::stub::dynamic::SystemPolicyV1>,
925        ) -> Self {
926            Self {
927                stub,
928                request: R::default(),
929                options: crate::RequestOptions::default(),
930            }
931        }
932    }
933
934    /// The request builder for [SystemPolicyV1::get_system_policy][crate::client::SystemPolicyV1::get_system_policy] calls.
935    ///
936    /// # Example
937    /// ```
938    /// # use google_cloud_binaryauthorization_v1::builder::system_policy_v_1::GetSystemPolicy;
939    /// # async fn sample() -> google_cloud_binaryauthorization_v1::Result<()> {
940    ///
941    /// let builder = prepare_request_builder();
942    /// let response = builder.send().await?;
943    /// # Ok(()) }
944    ///
945    /// fn prepare_request_builder() -> GetSystemPolicy {
946    ///   # panic!();
947    ///   // ... details omitted ...
948    /// }
949    /// ```
950    #[derive(Clone, Debug)]
951    pub struct GetSystemPolicy(RequestBuilder<crate::model::GetSystemPolicyRequest>);
952
953    impl GetSystemPolicy {
954        pub(crate) fn new(
955            stub: std::sync::Arc<dyn super::super::stub::dynamic::SystemPolicyV1>,
956        ) -> Self {
957            Self(RequestBuilder::new(stub))
958        }
959
960        /// Sets the full request, replacing any prior values.
961        pub fn with_request<V: Into<crate::model::GetSystemPolicyRequest>>(mut self, v: V) -> Self {
962            self.0.request = v.into();
963            self
964        }
965
966        /// Sets all the options, replacing any prior values.
967        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
968            self.0.options = v.into();
969            self
970        }
971
972        /// Sends the request.
973        pub async fn send(self) -> Result<crate::model::Policy> {
974            (*self.0.stub)
975                .get_system_policy(self.0.request, self.0.options)
976                .await
977                .map(crate::Response::into_body)
978        }
979
980        /// Sets the value of [name][crate::model::GetSystemPolicyRequest::name].
981        ///
982        /// This is a **required** field for requests.
983        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
984            self.0.request.name = v.into();
985            self
986        }
987    }
988
989    #[doc(hidden)]
990    impl crate::RequestBuilder for GetSystemPolicy {
991        fn request_options(&mut self) -> &mut crate::RequestOptions {
992            &mut self.0.options
993        }
994    }
995
996    /// The request builder for [SystemPolicyV1::set_iam_policy][crate::client::SystemPolicyV1::set_iam_policy] calls.
997    ///
998    /// # Example
999    /// ```
1000    /// # use google_cloud_binaryauthorization_v1::builder::system_policy_v_1::SetIamPolicy;
1001    /// # async fn sample() -> google_cloud_binaryauthorization_v1::Result<()> {
1002    ///
1003    /// let builder = prepare_request_builder();
1004    /// let response = builder.send().await?;
1005    /// # Ok(()) }
1006    ///
1007    /// fn prepare_request_builder() -> SetIamPolicy {
1008    ///   # panic!();
1009    ///   // ... details omitted ...
1010    /// }
1011    /// ```
1012    #[derive(Clone, Debug)]
1013    pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
1014
1015    impl SetIamPolicy {
1016        pub(crate) fn new(
1017            stub: std::sync::Arc<dyn super::super::stub::dynamic::SystemPolicyV1>,
1018        ) -> Self {
1019            Self(RequestBuilder::new(stub))
1020        }
1021
1022        /// Sets the full request, replacing any prior values.
1023        pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
1024            mut self,
1025            v: V,
1026        ) -> Self {
1027            self.0.request = v.into();
1028            self
1029        }
1030
1031        /// Sets all the options, replacing any prior values.
1032        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1033            self.0.options = v.into();
1034            self
1035        }
1036
1037        /// Sends the request.
1038        pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
1039            (*self.0.stub)
1040                .set_iam_policy(self.0.request, self.0.options)
1041                .await
1042                .map(crate::Response::into_body)
1043        }
1044
1045        /// Sets the value of [resource][google_cloud_iam_v1::model::SetIamPolicyRequest::resource].
1046        ///
1047        /// This is a **required** field for requests.
1048        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1049            self.0.request.resource = v.into();
1050            self
1051        }
1052
1053        /// Sets the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
1054        ///
1055        /// This is a **required** field for requests.
1056        pub fn set_policy<T>(mut self, v: T) -> Self
1057        where
1058            T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
1059        {
1060            self.0.request.policy = std::option::Option::Some(v.into());
1061            self
1062        }
1063
1064        /// Sets or clears the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
1065        ///
1066        /// This is a **required** field for requests.
1067        pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
1068        where
1069            T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
1070        {
1071            self.0.request.policy = v.map(|x| x.into());
1072            self
1073        }
1074
1075        /// Sets the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
1076        pub fn set_update_mask<T>(mut self, v: T) -> Self
1077        where
1078            T: std::convert::Into<wkt::FieldMask>,
1079        {
1080            self.0.request.update_mask = std::option::Option::Some(v.into());
1081            self
1082        }
1083
1084        /// Sets or clears the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
1085        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1086        where
1087            T: std::convert::Into<wkt::FieldMask>,
1088        {
1089            self.0.request.update_mask = v.map(|x| x.into());
1090            self
1091        }
1092    }
1093
1094    #[doc(hidden)]
1095    impl crate::RequestBuilder for SetIamPolicy {
1096        fn request_options(&mut self) -> &mut crate::RequestOptions {
1097            &mut self.0.options
1098        }
1099    }
1100
1101    /// The request builder for [SystemPolicyV1::get_iam_policy][crate::client::SystemPolicyV1::get_iam_policy] calls.
1102    ///
1103    /// # Example
1104    /// ```
1105    /// # use google_cloud_binaryauthorization_v1::builder::system_policy_v_1::GetIamPolicy;
1106    /// # async fn sample() -> google_cloud_binaryauthorization_v1::Result<()> {
1107    ///
1108    /// let builder = prepare_request_builder();
1109    /// let response = builder.send().await?;
1110    /// # Ok(()) }
1111    ///
1112    /// fn prepare_request_builder() -> GetIamPolicy {
1113    ///   # panic!();
1114    ///   // ... details omitted ...
1115    /// }
1116    /// ```
1117    #[derive(Clone, Debug)]
1118    pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
1119
1120    impl GetIamPolicy {
1121        pub(crate) fn new(
1122            stub: std::sync::Arc<dyn super::super::stub::dynamic::SystemPolicyV1>,
1123        ) -> Self {
1124            Self(RequestBuilder::new(stub))
1125        }
1126
1127        /// Sets the full request, replacing any prior values.
1128        pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
1129            mut self,
1130            v: V,
1131        ) -> Self {
1132            self.0.request = v.into();
1133            self
1134        }
1135
1136        /// Sets all the options, replacing any prior values.
1137        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1138            self.0.options = v.into();
1139            self
1140        }
1141
1142        /// Sends the request.
1143        pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
1144            (*self.0.stub)
1145                .get_iam_policy(self.0.request, self.0.options)
1146                .await
1147                .map(crate::Response::into_body)
1148        }
1149
1150        /// Sets the value of [resource][google_cloud_iam_v1::model::GetIamPolicyRequest::resource].
1151        ///
1152        /// This is a **required** field for requests.
1153        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1154            self.0.request.resource = v.into();
1155            self
1156        }
1157
1158        /// Sets the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
1159        pub fn set_options<T>(mut self, v: T) -> Self
1160        where
1161            T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
1162        {
1163            self.0.request.options = std::option::Option::Some(v.into());
1164            self
1165        }
1166
1167        /// Sets or clears the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
1168        pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
1169        where
1170            T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
1171        {
1172            self.0.request.options = v.map(|x| x.into());
1173            self
1174        }
1175    }
1176
1177    #[doc(hidden)]
1178    impl crate::RequestBuilder for GetIamPolicy {
1179        fn request_options(&mut self) -> &mut crate::RequestOptions {
1180            &mut self.0.options
1181        }
1182    }
1183
1184    /// The request builder for [SystemPolicyV1::test_iam_permissions][crate::client::SystemPolicyV1::test_iam_permissions] calls.
1185    ///
1186    /// # Example
1187    /// ```
1188    /// # use google_cloud_binaryauthorization_v1::builder::system_policy_v_1::TestIamPermissions;
1189    /// # async fn sample() -> google_cloud_binaryauthorization_v1::Result<()> {
1190    ///
1191    /// let builder = prepare_request_builder();
1192    /// let response = builder.send().await?;
1193    /// # Ok(()) }
1194    ///
1195    /// fn prepare_request_builder() -> TestIamPermissions {
1196    ///   # panic!();
1197    ///   // ... details omitted ...
1198    /// }
1199    /// ```
1200    #[derive(Clone, Debug)]
1201    pub struct TestIamPermissions(
1202        RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
1203    );
1204
1205    impl TestIamPermissions {
1206        pub(crate) fn new(
1207            stub: std::sync::Arc<dyn super::super::stub::dynamic::SystemPolicyV1>,
1208        ) -> Self {
1209            Self(RequestBuilder::new(stub))
1210        }
1211
1212        /// Sets the full request, replacing any prior values.
1213        pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
1214            mut self,
1215            v: V,
1216        ) -> Self {
1217            self.0.request = v.into();
1218            self
1219        }
1220
1221        /// Sets all the options, replacing any prior values.
1222        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1223            self.0.options = v.into();
1224            self
1225        }
1226
1227        /// Sends the request.
1228        pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
1229            (*self.0.stub)
1230                .test_iam_permissions(self.0.request, self.0.options)
1231                .await
1232                .map(crate::Response::into_body)
1233        }
1234
1235        /// Sets the value of [resource][google_cloud_iam_v1::model::TestIamPermissionsRequest::resource].
1236        ///
1237        /// This is a **required** field for requests.
1238        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1239            self.0.request.resource = v.into();
1240            self
1241        }
1242
1243        /// Sets the value of [permissions][google_cloud_iam_v1::model::TestIamPermissionsRequest::permissions].
1244        ///
1245        /// This is a **required** field for requests.
1246        pub fn set_permissions<T, V>(mut self, v: T) -> Self
1247        where
1248            T: std::iter::IntoIterator<Item = V>,
1249            V: std::convert::Into<std::string::String>,
1250        {
1251            use std::iter::Iterator;
1252            self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
1253            self
1254        }
1255    }
1256
1257    #[doc(hidden)]
1258    impl crate::RequestBuilder for TestIamPermissions {
1259        fn request_options(&mut self) -> &mut crate::RequestOptions {
1260            &mut self.0.options
1261        }
1262    }
1263}
1264
1265/// Request and client builders for [ValidationHelperV1][crate::client::ValidationHelperV1].
1266pub mod validation_helper_v_1 {
1267    use crate::Result;
1268
1269    /// A builder for [ValidationHelperV1][crate::client::ValidationHelperV1].
1270    ///
1271    /// ```
1272    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1273    /// # use google_cloud_binaryauthorization_v1::*;
1274    /// # use builder::validation_helper_v_1::ClientBuilder;
1275    /// # use client::ValidationHelperV1;
1276    /// let builder : ClientBuilder = ValidationHelperV1::builder();
1277    /// let client = builder
1278    ///     .with_endpoint("https://binaryauthorization.googleapis.com")
1279    ///     .build().await?;
1280    /// # Ok(()) }
1281    /// ```
1282    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
1283
1284    pub(crate) mod client {
1285        use super::super::super::client::ValidationHelperV1;
1286        pub struct Factory;
1287        impl crate::ClientFactory for Factory {
1288            type Client = ValidationHelperV1;
1289            type Credentials = gaxi::options::Credentials;
1290            async fn build(
1291                self,
1292                config: gaxi::options::ClientConfig,
1293            ) -> crate::ClientBuilderResult<Self::Client> {
1294                Self::Client::new(config).await
1295            }
1296        }
1297    }
1298
1299    /// Common implementation for [crate::client::ValidationHelperV1] request builders.
1300    #[derive(Clone, Debug)]
1301    pub(crate) struct RequestBuilder<R: std::default::Default> {
1302        stub: std::sync::Arc<dyn super::super::stub::dynamic::ValidationHelperV1>,
1303        request: R,
1304        options: crate::RequestOptions,
1305    }
1306
1307    impl<R> RequestBuilder<R>
1308    where
1309        R: std::default::Default,
1310    {
1311        pub(crate) fn new(
1312            stub: std::sync::Arc<dyn super::super::stub::dynamic::ValidationHelperV1>,
1313        ) -> Self {
1314            Self {
1315                stub,
1316                request: R::default(),
1317                options: crate::RequestOptions::default(),
1318            }
1319        }
1320    }
1321
1322    /// The request builder for [ValidationHelperV1::validate_attestation_occurrence][crate::client::ValidationHelperV1::validate_attestation_occurrence] calls.
1323    ///
1324    /// # Example
1325    /// ```
1326    /// # use google_cloud_binaryauthorization_v1::builder::validation_helper_v_1::ValidateAttestationOccurrence;
1327    /// # async fn sample() -> google_cloud_binaryauthorization_v1::Result<()> {
1328    ///
1329    /// let builder = prepare_request_builder();
1330    /// let response = builder.send().await?;
1331    /// # Ok(()) }
1332    ///
1333    /// fn prepare_request_builder() -> ValidateAttestationOccurrence {
1334    ///   # panic!();
1335    ///   // ... details omitted ...
1336    /// }
1337    /// ```
1338    #[derive(Clone, Debug)]
1339    pub struct ValidateAttestationOccurrence(
1340        RequestBuilder<crate::model::ValidateAttestationOccurrenceRequest>,
1341    );
1342
1343    impl ValidateAttestationOccurrence {
1344        pub(crate) fn new(
1345            stub: std::sync::Arc<dyn super::super::stub::dynamic::ValidationHelperV1>,
1346        ) -> Self {
1347            Self(RequestBuilder::new(stub))
1348        }
1349
1350        /// Sets the full request, replacing any prior values.
1351        pub fn with_request<V: Into<crate::model::ValidateAttestationOccurrenceRequest>>(
1352            mut self,
1353            v: V,
1354        ) -> Self {
1355            self.0.request = v.into();
1356            self
1357        }
1358
1359        /// Sets all the options, replacing any prior values.
1360        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1361            self.0.options = v.into();
1362            self
1363        }
1364
1365        /// Sends the request.
1366        pub async fn send(self) -> Result<crate::model::ValidateAttestationOccurrenceResponse> {
1367            (*self.0.stub)
1368                .validate_attestation_occurrence(self.0.request, self.0.options)
1369                .await
1370                .map(crate::Response::into_body)
1371        }
1372
1373        /// Sets the value of [attestor][crate::model::ValidateAttestationOccurrenceRequest::attestor].
1374        ///
1375        /// This is a **required** field for requests.
1376        pub fn set_attestor<T: Into<std::string::String>>(mut self, v: T) -> Self {
1377            self.0.request.attestor = v.into();
1378            self
1379        }
1380
1381        /// Sets the value of [attestation][crate::model::ValidateAttestationOccurrenceRequest::attestation].
1382        ///
1383        /// This is a **required** field for requests.
1384        pub fn set_attestation<T>(mut self, v: T) -> Self
1385        where
1386            T: std::convert::Into<google_cloud_grafeas_v1::model::AttestationOccurrence>,
1387        {
1388            self.0.request.attestation = std::option::Option::Some(v.into());
1389            self
1390        }
1391
1392        /// Sets or clears the value of [attestation][crate::model::ValidateAttestationOccurrenceRequest::attestation].
1393        ///
1394        /// This is a **required** field for requests.
1395        pub fn set_or_clear_attestation<T>(mut self, v: std::option::Option<T>) -> Self
1396        where
1397            T: std::convert::Into<google_cloud_grafeas_v1::model::AttestationOccurrence>,
1398        {
1399            self.0.request.attestation = v.map(|x| x.into());
1400            self
1401        }
1402
1403        /// Sets the value of [occurrence_note][crate::model::ValidateAttestationOccurrenceRequest::occurrence_note].
1404        ///
1405        /// This is a **required** field for requests.
1406        pub fn set_occurrence_note<T: Into<std::string::String>>(mut self, v: T) -> Self {
1407            self.0.request.occurrence_note = v.into();
1408            self
1409        }
1410
1411        /// Sets the value of [occurrence_resource_uri][crate::model::ValidateAttestationOccurrenceRequest::occurrence_resource_uri].
1412        ///
1413        /// This is a **required** field for requests.
1414        pub fn set_occurrence_resource_uri<T: Into<std::string::String>>(mut self, v: T) -> Self {
1415            self.0.request.occurrence_resource_uri = v.into();
1416            self
1417        }
1418    }
1419
1420    #[doc(hidden)]
1421    impl crate::RequestBuilder for ValidateAttestationOccurrence {
1422        fn request_options(&mut self) -> &mut crate::RequestOptions {
1423            &mut self.0.options
1424        }
1425    }
1426
1427    /// The request builder for [ValidationHelperV1::set_iam_policy][crate::client::ValidationHelperV1::set_iam_policy] calls.
1428    ///
1429    /// # Example
1430    /// ```
1431    /// # use google_cloud_binaryauthorization_v1::builder::validation_helper_v_1::SetIamPolicy;
1432    /// # async fn sample() -> google_cloud_binaryauthorization_v1::Result<()> {
1433    ///
1434    /// let builder = prepare_request_builder();
1435    /// let response = builder.send().await?;
1436    /// # Ok(()) }
1437    ///
1438    /// fn prepare_request_builder() -> SetIamPolicy {
1439    ///   # panic!();
1440    ///   // ... details omitted ...
1441    /// }
1442    /// ```
1443    #[derive(Clone, Debug)]
1444    pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
1445
1446    impl SetIamPolicy {
1447        pub(crate) fn new(
1448            stub: std::sync::Arc<dyn super::super::stub::dynamic::ValidationHelperV1>,
1449        ) -> Self {
1450            Self(RequestBuilder::new(stub))
1451        }
1452
1453        /// Sets the full request, replacing any prior values.
1454        pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
1455            mut self,
1456            v: V,
1457        ) -> Self {
1458            self.0.request = v.into();
1459            self
1460        }
1461
1462        /// Sets all the options, replacing any prior values.
1463        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1464            self.0.options = v.into();
1465            self
1466        }
1467
1468        /// Sends the request.
1469        pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
1470            (*self.0.stub)
1471                .set_iam_policy(self.0.request, self.0.options)
1472                .await
1473                .map(crate::Response::into_body)
1474        }
1475
1476        /// Sets the value of [resource][google_cloud_iam_v1::model::SetIamPolicyRequest::resource].
1477        ///
1478        /// This is a **required** field for requests.
1479        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1480            self.0.request.resource = v.into();
1481            self
1482        }
1483
1484        /// Sets the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
1485        ///
1486        /// This is a **required** field for requests.
1487        pub fn set_policy<T>(mut self, v: T) -> Self
1488        where
1489            T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
1490        {
1491            self.0.request.policy = std::option::Option::Some(v.into());
1492            self
1493        }
1494
1495        /// Sets or clears the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
1496        ///
1497        /// This is a **required** field for requests.
1498        pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
1499        where
1500            T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
1501        {
1502            self.0.request.policy = v.map(|x| x.into());
1503            self
1504        }
1505
1506        /// Sets the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
1507        pub fn set_update_mask<T>(mut self, v: T) -> Self
1508        where
1509            T: std::convert::Into<wkt::FieldMask>,
1510        {
1511            self.0.request.update_mask = std::option::Option::Some(v.into());
1512            self
1513        }
1514
1515        /// Sets or clears the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
1516        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1517        where
1518            T: std::convert::Into<wkt::FieldMask>,
1519        {
1520            self.0.request.update_mask = v.map(|x| x.into());
1521            self
1522        }
1523    }
1524
1525    #[doc(hidden)]
1526    impl crate::RequestBuilder for SetIamPolicy {
1527        fn request_options(&mut self) -> &mut crate::RequestOptions {
1528            &mut self.0.options
1529        }
1530    }
1531
1532    /// The request builder for [ValidationHelperV1::get_iam_policy][crate::client::ValidationHelperV1::get_iam_policy] calls.
1533    ///
1534    /// # Example
1535    /// ```
1536    /// # use google_cloud_binaryauthorization_v1::builder::validation_helper_v_1::GetIamPolicy;
1537    /// # async fn sample() -> google_cloud_binaryauthorization_v1::Result<()> {
1538    ///
1539    /// let builder = prepare_request_builder();
1540    /// let response = builder.send().await?;
1541    /// # Ok(()) }
1542    ///
1543    /// fn prepare_request_builder() -> GetIamPolicy {
1544    ///   # panic!();
1545    ///   // ... details omitted ...
1546    /// }
1547    /// ```
1548    #[derive(Clone, Debug)]
1549    pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
1550
1551    impl GetIamPolicy {
1552        pub(crate) fn new(
1553            stub: std::sync::Arc<dyn super::super::stub::dynamic::ValidationHelperV1>,
1554        ) -> Self {
1555            Self(RequestBuilder::new(stub))
1556        }
1557
1558        /// Sets the full request, replacing any prior values.
1559        pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
1560            mut self,
1561            v: V,
1562        ) -> Self {
1563            self.0.request = v.into();
1564            self
1565        }
1566
1567        /// Sets all the options, replacing any prior values.
1568        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1569            self.0.options = v.into();
1570            self
1571        }
1572
1573        /// Sends the request.
1574        pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
1575            (*self.0.stub)
1576                .get_iam_policy(self.0.request, self.0.options)
1577                .await
1578                .map(crate::Response::into_body)
1579        }
1580
1581        /// Sets the value of [resource][google_cloud_iam_v1::model::GetIamPolicyRequest::resource].
1582        ///
1583        /// This is a **required** field for requests.
1584        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1585            self.0.request.resource = v.into();
1586            self
1587        }
1588
1589        /// Sets the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
1590        pub fn set_options<T>(mut self, v: T) -> Self
1591        where
1592            T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
1593        {
1594            self.0.request.options = std::option::Option::Some(v.into());
1595            self
1596        }
1597
1598        /// Sets or clears the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
1599        pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
1600        where
1601            T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
1602        {
1603            self.0.request.options = v.map(|x| x.into());
1604            self
1605        }
1606    }
1607
1608    #[doc(hidden)]
1609    impl crate::RequestBuilder for GetIamPolicy {
1610        fn request_options(&mut self) -> &mut crate::RequestOptions {
1611            &mut self.0.options
1612        }
1613    }
1614
1615    /// The request builder for [ValidationHelperV1::test_iam_permissions][crate::client::ValidationHelperV1::test_iam_permissions] calls.
1616    ///
1617    /// # Example
1618    /// ```
1619    /// # use google_cloud_binaryauthorization_v1::builder::validation_helper_v_1::TestIamPermissions;
1620    /// # async fn sample() -> google_cloud_binaryauthorization_v1::Result<()> {
1621    ///
1622    /// let builder = prepare_request_builder();
1623    /// let response = builder.send().await?;
1624    /// # Ok(()) }
1625    ///
1626    /// fn prepare_request_builder() -> TestIamPermissions {
1627    ///   # panic!();
1628    ///   // ... details omitted ...
1629    /// }
1630    /// ```
1631    #[derive(Clone, Debug)]
1632    pub struct TestIamPermissions(
1633        RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
1634    );
1635
1636    impl TestIamPermissions {
1637        pub(crate) fn new(
1638            stub: std::sync::Arc<dyn super::super::stub::dynamic::ValidationHelperV1>,
1639        ) -> Self {
1640            Self(RequestBuilder::new(stub))
1641        }
1642
1643        /// Sets the full request, replacing any prior values.
1644        pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
1645            mut self,
1646            v: V,
1647        ) -> Self {
1648            self.0.request = v.into();
1649            self
1650        }
1651
1652        /// Sets all the options, replacing any prior values.
1653        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1654            self.0.options = v.into();
1655            self
1656        }
1657
1658        /// Sends the request.
1659        pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
1660            (*self.0.stub)
1661                .test_iam_permissions(self.0.request, self.0.options)
1662                .await
1663                .map(crate::Response::into_body)
1664        }
1665
1666        /// Sets the value of [resource][google_cloud_iam_v1::model::TestIamPermissionsRequest::resource].
1667        ///
1668        /// This is a **required** field for requests.
1669        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1670            self.0.request.resource = v.into();
1671            self
1672        }
1673
1674        /// Sets the value of [permissions][google_cloud_iam_v1::model::TestIamPermissionsRequest::permissions].
1675        ///
1676        /// This is a **required** field for requests.
1677        pub fn set_permissions<T, V>(mut self, v: T) -> Self
1678        where
1679            T: std::iter::IntoIterator<Item = V>,
1680            V: std::convert::Into<std::string::String>,
1681        {
1682            use std::iter::Iterator;
1683            self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
1684            self
1685        }
1686    }
1687
1688    #[doc(hidden)]
1689    impl crate::RequestBuilder for TestIamPermissions {
1690        fn request_options(&mut self) -> &mut crate::RequestOptions {
1691            &mut self.0.options
1692        }
1693    }
1694}