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
609/// Request and client builders for [SystemPolicyV1][crate::client::SystemPolicyV1].
610pub mod system_policy_v_1 {
611    use crate::Result;
612
613    /// A builder for [SystemPolicyV1][crate::client::SystemPolicyV1].
614    ///
615    /// ```
616    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
617    /// # use google_cloud_binaryauthorization_v1::*;
618    /// # use builder::system_policy_v_1::ClientBuilder;
619    /// # use client::SystemPolicyV1;
620    /// let builder : ClientBuilder = SystemPolicyV1::builder();
621    /// let client = builder
622    ///     .with_endpoint("https://binaryauthorization.googleapis.com")
623    ///     .build().await?;
624    /// # Ok(()) }
625    /// ```
626    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
627
628    pub(crate) mod client {
629        use super::super::super::client::SystemPolicyV1;
630        pub struct Factory;
631        impl crate::ClientFactory for Factory {
632            type Client = SystemPolicyV1;
633            type Credentials = gaxi::options::Credentials;
634            async fn build(
635                self,
636                config: gaxi::options::ClientConfig,
637            ) -> crate::ClientBuilderResult<Self::Client> {
638                Self::Client::new(config).await
639            }
640        }
641    }
642
643    /// Common implementation for [crate::client::SystemPolicyV1] request builders.
644    #[derive(Clone, Debug)]
645    pub(crate) struct RequestBuilder<R: std::default::Default> {
646        stub: std::sync::Arc<dyn super::super::stub::dynamic::SystemPolicyV1>,
647        request: R,
648        options: crate::RequestOptions,
649    }
650
651    impl<R> RequestBuilder<R>
652    where
653        R: std::default::Default,
654    {
655        pub(crate) fn new(
656            stub: std::sync::Arc<dyn super::super::stub::dynamic::SystemPolicyV1>,
657        ) -> Self {
658            Self {
659                stub,
660                request: R::default(),
661                options: crate::RequestOptions::default(),
662            }
663        }
664    }
665
666    /// The request builder for [SystemPolicyV1::get_system_policy][crate::client::SystemPolicyV1::get_system_policy] calls.
667    ///
668    /// # Example
669    /// ```
670    /// # use google_cloud_binaryauthorization_v1::builder::system_policy_v_1::GetSystemPolicy;
671    /// # async fn sample() -> google_cloud_binaryauthorization_v1::Result<()> {
672    ///
673    /// let builder = prepare_request_builder();
674    /// let response = builder.send().await?;
675    /// # Ok(()) }
676    ///
677    /// fn prepare_request_builder() -> GetSystemPolicy {
678    ///   # panic!();
679    ///   // ... details omitted ...
680    /// }
681    /// ```
682    #[derive(Clone, Debug)]
683    pub struct GetSystemPolicy(RequestBuilder<crate::model::GetSystemPolicyRequest>);
684
685    impl GetSystemPolicy {
686        pub(crate) fn new(
687            stub: std::sync::Arc<dyn super::super::stub::dynamic::SystemPolicyV1>,
688        ) -> Self {
689            Self(RequestBuilder::new(stub))
690        }
691
692        /// Sets the full request, replacing any prior values.
693        pub fn with_request<V: Into<crate::model::GetSystemPolicyRequest>>(mut self, v: V) -> Self {
694            self.0.request = v.into();
695            self
696        }
697
698        /// Sets all the options, replacing any prior values.
699        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
700            self.0.options = v.into();
701            self
702        }
703
704        /// Sends the request.
705        pub async fn send(self) -> Result<crate::model::Policy> {
706            (*self.0.stub)
707                .get_system_policy(self.0.request, self.0.options)
708                .await
709                .map(crate::Response::into_body)
710        }
711
712        /// Sets the value of [name][crate::model::GetSystemPolicyRequest::name].
713        ///
714        /// This is a **required** field for requests.
715        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
716            self.0.request.name = v.into();
717            self
718        }
719    }
720
721    #[doc(hidden)]
722    impl crate::RequestBuilder for GetSystemPolicy {
723        fn request_options(&mut self) -> &mut crate::RequestOptions {
724            &mut self.0.options
725        }
726    }
727}
728
729/// Request and client builders for [ValidationHelperV1][crate::client::ValidationHelperV1].
730pub mod validation_helper_v_1 {
731    use crate::Result;
732
733    /// A builder for [ValidationHelperV1][crate::client::ValidationHelperV1].
734    ///
735    /// ```
736    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
737    /// # use google_cloud_binaryauthorization_v1::*;
738    /// # use builder::validation_helper_v_1::ClientBuilder;
739    /// # use client::ValidationHelperV1;
740    /// let builder : ClientBuilder = ValidationHelperV1::builder();
741    /// let client = builder
742    ///     .with_endpoint("https://binaryauthorization.googleapis.com")
743    ///     .build().await?;
744    /// # Ok(()) }
745    /// ```
746    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
747
748    pub(crate) mod client {
749        use super::super::super::client::ValidationHelperV1;
750        pub struct Factory;
751        impl crate::ClientFactory for Factory {
752            type Client = ValidationHelperV1;
753            type Credentials = gaxi::options::Credentials;
754            async fn build(
755                self,
756                config: gaxi::options::ClientConfig,
757            ) -> crate::ClientBuilderResult<Self::Client> {
758                Self::Client::new(config).await
759            }
760        }
761    }
762
763    /// Common implementation for [crate::client::ValidationHelperV1] request builders.
764    #[derive(Clone, Debug)]
765    pub(crate) struct RequestBuilder<R: std::default::Default> {
766        stub: std::sync::Arc<dyn super::super::stub::dynamic::ValidationHelperV1>,
767        request: R,
768        options: crate::RequestOptions,
769    }
770
771    impl<R> RequestBuilder<R>
772    where
773        R: std::default::Default,
774    {
775        pub(crate) fn new(
776            stub: std::sync::Arc<dyn super::super::stub::dynamic::ValidationHelperV1>,
777        ) -> Self {
778            Self {
779                stub,
780                request: R::default(),
781                options: crate::RequestOptions::default(),
782            }
783        }
784    }
785
786    /// The request builder for [ValidationHelperV1::validate_attestation_occurrence][crate::client::ValidationHelperV1::validate_attestation_occurrence] calls.
787    ///
788    /// # Example
789    /// ```
790    /// # use google_cloud_binaryauthorization_v1::builder::validation_helper_v_1::ValidateAttestationOccurrence;
791    /// # async fn sample() -> google_cloud_binaryauthorization_v1::Result<()> {
792    ///
793    /// let builder = prepare_request_builder();
794    /// let response = builder.send().await?;
795    /// # Ok(()) }
796    ///
797    /// fn prepare_request_builder() -> ValidateAttestationOccurrence {
798    ///   # panic!();
799    ///   // ... details omitted ...
800    /// }
801    /// ```
802    #[derive(Clone, Debug)]
803    pub struct ValidateAttestationOccurrence(
804        RequestBuilder<crate::model::ValidateAttestationOccurrenceRequest>,
805    );
806
807    impl ValidateAttestationOccurrence {
808        pub(crate) fn new(
809            stub: std::sync::Arc<dyn super::super::stub::dynamic::ValidationHelperV1>,
810        ) -> Self {
811            Self(RequestBuilder::new(stub))
812        }
813
814        /// Sets the full request, replacing any prior values.
815        pub fn with_request<V: Into<crate::model::ValidateAttestationOccurrenceRequest>>(
816            mut self,
817            v: V,
818        ) -> Self {
819            self.0.request = v.into();
820            self
821        }
822
823        /// Sets all the options, replacing any prior values.
824        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
825            self.0.options = v.into();
826            self
827        }
828
829        /// Sends the request.
830        pub async fn send(self) -> Result<crate::model::ValidateAttestationOccurrenceResponse> {
831            (*self.0.stub)
832                .validate_attestation_occurrence(self.0.request, self.0.options)
833                .await
834                .map(crate::Response::into_body)
835        }
836
837        /// Sets the value of [attestor][crate::model::ValidateAttestationOccurrenceRequest::attestor].
838        ///
839        /// This is a **required** field for requests.
840        pub fn set_attestor<T: Into<std::string::String>>(mut self, v: T) -> Self {
841            self.0.request.attestor = v.into();
842            self
843        }
844
845        /// Sets the value of [attestation][crate::model::ValidateAttestationOccurrenceRequest::attestation].
846        ///
847        /// This is a **required** field for requests.
848        pub fn set_attestation<T>(mut self, v: T) -> Self
849        where
850            T: std::convert::Into<google_cloud_grafeas_v1::model::AttestationOccurrence>,
851        {
852            self.0.request.attestation = std::option::Option::Some(v.into());
853            self
854        }
855
856        /// Sets or clears the value of [attestation][crate::model::ValidateAttestationOccurrenceRequest::attestation].
857        ///
858        /// This is a **required** field for requests.
859        pub fn set_or_clear_attestation<T>(mut self, v: std::option::Option<T>) -> Self
860        where
861            T: std::convert::Into<google_cloud_grafeas_v1::model::AttestationOccurrence>,
862        {
863            self.0.request.attestation = v.map(|x| x.into());
864            self
865        }
866
867        /// Sets the value of [occurrence_note][crate::model::ValidateAttestationOccurrenceRequest::occurrence_note].
868        ///
869        /// This is a **required** field for requests.
870        pub fn set_occurrence_note<T: Into<std::string::String>>(mut self, v: T) -> Self {
871            self.0.request.occurrence_note = v.into();
872            self
873        }
874
875        /// Sets the value of [occurrence_resource_uri][crate::model::ValidateAttestationOccurrenceRequest::occurrence_resource_uri].
876        ///
877        /// This is a **required** field for requests.
878        pub fn set_occurrence_resource_uri<T: Into<std::string::String>>(mut self, v: T) -> Self {
879            self.0.request.occurrence_resource_uri = v.into();
880            self
881        }
882    }
883
884    #[doc(hidden)]
885    impl crate::RequestBuilder for ValidateAttestationOccurrence {
886        fn request_options(&mut self) -> &mut crate::RequestOptions {
887            &mut self.0.options
888        }
889    }
890}