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
17pub mod binauthz_management_service_v_1 {
18    use crate::Result;
19
20    /// A builder for [BinauthzManagementServiceV1][crate::client::BinauthzManagementServiceV1].
21    ///
22    /// ```
23    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
24    /// # use google_cloud_binaryauthorization_v1::*;
25    /// # use builder::binauthz_management_service_v_1::ClientBuilder;
26    /// # use client::BinauthzManagementServiceV1;
27    /// let builder : ClientBuilder = BinauthzManagementServiceV1::builder();
28    /// let client = builder
29    ///     .with_endpoint("https://binaryauthorization.googleapis.com")
30    ///     .build().await?;
31    /// # Ok(()) }
32    /// ```
33    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
34
35    pub(crate) mod client {
36        use super::super::super::client::BinauthzManagementServiceV1;
37        pub struct Factory;
38        impl crate::ClientFactory for Factory {
39            type Client = BinauthzManagementServiceV1;
40            type Credentials = gaxi::options::Credentials;
41            async fn build(
42                self,
43                config: gaxi::options::ClientConfig,
44            ) -> crate::ClientBuilderResult<Self::Client> {
45                Self::Client::new(config).await
46            }
47        }
48    }
49
50    /// Common implementation for [crate::client::BinauthzManagementServiceV1] request builders.
51    #[derive(Clone, Debug)]
52    pub(crate) struct RequestBuilder<R: std::default::Default> {
53        stub: std::sync::Arc<dyn super::super::stub::dynamic::BinauthzManagementServiceV1>,
54        request: R,
55        options: crate::RequestOptions,
56    }
57
58    impl<R> RequestBuilder<R>
59    where
60        R: std::default::Default,
61    {
62        pub(crate) fn new(
63            stub: std::sync::Arc<dyn super::super::stub::dynamic::BinauthzManagementServiceV1>,
64        ) -> Self {
65            Self {
66                stub,
67                request: R::default(),
68                options: crate::RequestOptions::default(),
69            }
70        }
71    }
72
73    /// The request builder for [BinauthzManagementServiceV1::get_policy][crate::client::BinauthzManagementServiceV1::get_policy] calls.
74    ///
75    /// # Example
76    /// ```
77    /// # use google_cloud_binaryauthorization_v1::builder::binauthz_management_service_v_1::GetPolicy;
78    /// # async fn sample() -> google_cloud_binaryauthorization_v1::Result<()> {
79    ///
80    /// let builder = prepare_request_builder();
81    /// let response = builder.send().await?;
82    /// # Ok(()) }
83    ///
84    /// fn prepare_request_builder() -> GetPolicy {
85    ///   # panic!();
86    ///   // ... details omitted ...
87    /// }
88    /// ```
89    #[derive(Clone, Debug)]
90    pub struct GetPolicy(RequestBuilder<crate::model::GetPolicyRequest>);
91
92    impl GetPolicy {
93        pub(crate) fn new(
94            stub: std::sync::Arc<dyn super::super::stub::dynamic::BinauthzManagementServiceV1>,
95        ) -> Self {
96            Self(RequestBuilder::new(stub))
97        }
98
99        /// Sets the full request, replacing any prior values.
100        pub fn with_request<V: Into<crate::model::GetPolicyRequest>>(mut self, v: V) -> Self {
101            self.0.request = v.into();
102            self
103        }
104
105        /// Sets all the options, replacing any prior values.
106        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
107            self.0.options = v.into();
108            self
109        }
110
111        /// Sends the request.
112        pub async fn send(self) -> Result<crate::model::Policy> {
113            (*self.0.stub)
114                .get_policy(self.0.request, self.0.options)
115                .await
116                .map(crate::Response::into_body)
117        }
118
119        /// Sets the value of [name][crate::model::GetPolicyRequest::name].
120        ///
121        /// This is a **required** field for requests.
122        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
123            self.0.request.name = v.into();
124            self
125        }
126    }
127
128    #[doc(hidden)]
129    impl crate::RequestBuilder for GetPolicy {
130        fn request_options(&mut self) -> &mut crate::RequestOptions {
131            &mut self.0.options
132        }
133    }
134
135    /// The request builder for [BinauthzManagementServiceV1::update_policy][crate::client::BinauthzManagementServiceV1::update_policy] calls.
136    ///
137    /// # Example
138    /// ```
139    /// # use google_cloud_binaryauthorization_v1::builder::binauthz_management_service_v_1::UpdatePolicy;
140    /// # async fn sample() -> google_cloud_binaryauthorization_v1::Result<()> {
141    ///
142    /// let builder = prepare_request_builder();
143    /// let response = builder.send().await?;
144    /// # Ok(()) }
145    ///
146    /// fn prepare_request_builder() -> UpdatePolicy {
147    ///   # panic!();
148    ///   // ... details omitted ...
149    /// }
150    /// ```
151    #[derive(Clone, Debug)]
152    pub struct UpdatePolicy(RequestBuilder<crate::model::UpdatePolicyRequest>);
153
154    impl UpdatePolicy {
155        pub(crate) fn new(
156            stub: std::sync::Arc<dyn super::super::stub::dynamic::BinauthzManagementServiceV1>,
157        ) -> Self {
158            Self(RequestBuilder::new(stub))
159        }
160
161        /// Sets the full request, replacing any prior values.
162        pub fn with_request<V: Into<crate::model::UpdatePolicyRequest>>(mut self, v: V) -> Self {
163            self.0.request = v.into();
164            self
165        }
166
167        /// Sets all the options, replacing any prior values.
168        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
169            self.0.options = v.into();
170            self
171        }
172
173        /// Sends the request.
174        pub async fn send(self) -> Result<crate::model::Policy> {
175            (*self.0.stub)
176                .update_policy(self.0.request, self.0.options)
177                .await
178                .map(crate::Response::into_body)
179        }
180
181        /// Sets the value of [policy][crate::model::UpdatePolicyRequest::policy].
182        ///
183        /// This is a **required** field for requests.
184        pub fn set_policy<T>(mut self, v: T) -> Self
185        where
186            T: std::convert::Into<crate::model::Policy>,
187        {
188            self.0.request.policy = std::option::Option::Some(v.into());
189            self
190        }
191
192        /// Sets or clears the value of [policy][crate::model::UpdatePolicyRequest::policy].
193        ///
194        /// This is a **required** field for requests.
195        pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
196        where
197            T: std::convert::Into<crate::model::Policy>,
198        {
199            self.0.request.policy = v.map(|x| x.into());
200            self
201        }
202    }
203
204    #[doc(hidden)]
205    impl crate::RequestBuilder for UpdatePolicy {
206        fn request_options(&mut self) -> &mut crate::RequestOptions {
207            &mut self.0.options
208        }
209    }
210
211    /// The request builder for [BinauthzManagementServiceV1::create_attestor][crate::client::BinauthzManagementServiceV1::create_attestor] calls.
212    ///
213    /// # Example
214    /// ```
215    /// # use google_cloud_binaryauthorization_v1::builder::binauthz_management_service_v_1::CreateAttestor;
216    /// # async fn sample() -> google_cloud_binaryauthorization_v1::Result<()> {
217    ///
218    /// let builder = prepare_request_builder();
219    /// let response = builder.send().await?;
220    /// # Ok(()) }
221    ///
222    /// fn prepare_request_builder() -> CreateAttestor {
223    ///   # panic!();
224    ///   // ... details omitted ...
225    /// }
226    /// ```
227    #[derive(Clone, Debug)]
228    pub struct CreateAttestor(RequestBuilder<crate::model::CreateAttestorRequest>);
229
230    impl CreateAttestor {
231        pub(crate) fn new(
232            stub: std::sync::Arc<dyn super::super::stub::dynamic::BinauthzManagementServiceV1>,
233        ) -> Self {
234            Self(RequestBuilder::new(stub))
235        }
236
237        /// Sets the full request, replacing any prior values.
238        pub fn with_request<V: Into<crate::model::CreateAttestorRequest>>(mut self, v: V) -> Self {
239            self.0.request = v.into();
240            self
241        }
242
243        /// Sets all the options, replacing any prior values.
244        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
245            self.0.options = v.into();
246            self
247        }
248
249        /// Sends the request.
250        pub async fn send(self) -> Result<crate::model::Attestor> {
251            (*self.0.stub)
252                .create_attestor(self.0.request, self.0.options)
253                .await
254                .map(crate::Response::into_body)
255        }
256
257        /// Sets the value of [parent][crate::model::CreateAttestorRequest::parent].
258        ///
259        /// This is a **required** field for requests.
260        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
261            self.0.request.parent = v.into();
262            self
263        }
264
265        /// Sets the value of [attestor_id][crate::model::CreateAttestorRequest::attestor_id].
266        ///
267        /// This is a **required** field for requests.
268        pub fn set_attestor_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
269            self.0.request.attestor_id = v.into();
270            self
271        }
272
273        /// Sets the value of [attestor][crate::model::CreateAttestorRequest::attestor].
274        ///
275        /// This is a **required** field for requests.
276        pub fn set_attestor<T>(mut self, v: T) -> Self
277        where
278            T: std::convert::Into<crate::model::Attestor>,
279        {
280            self.0.request.attestor = std::option::Option::Some(v.into());
281            self
282        }
283
284        /// Sets or clears the value of [attestor][crate::model::CreateAttestorRequest::attestor].
285        ///
286        /// This is a **required** field for requests.
287        pub fn set_or_clear_attestor<T>(mut self, v: std::option::Option<T>) -> Self
288        where
289            T: std::convert::Into<crate::model::Attestor>,
290        {
291            self.0.request.attestor = v.map(|x| x.into());
292            self
293        }
294    }
295
296    #[doc(hidden)]
297    impl crate::RequestBuilder for CreateAttestor {
298        fn request_options(&mut self) -> &mut crate::RequestOptions {
299            &mut self.0.options
300        }
301    }
302
303    /// The request builder for [BinauthzManagementServiceV1::get_attestor][crate::client::BinauthzManagementServiceV1::get_attestor] calls.
304    ///
305    /// # Example
306    /// ```
307    /// # use google_cloud_binaryauthorization_v1::builder::binauthz_management_service_v_1::GetAttestor;
308    /// # async fn sample() -> google_cloud_binaryauthorization_v1::Result<()> {
309    ///
310    /// let builder = prepare_request_builder();
311    /// let response = builder.send().await?;
312    /// # Ok(()) }
313    ///
314    /// fn prepare_request_builder() -> GetAttestor {
315    ///   # panic!();
316    ///   // ... details omitted ...
317    /// }
318    /// ```
319    #[derive(Clone, Debug)]
320    pub struct GetAttestor(RequestBuilder<crate::model::GetAttestorRequest>);
321
322    impl GetAttestor {
323        pub(crate) fn new(
324            stub: std::sync::Arc<dyn super::super::stub::dynamic::BinauthzManagementServiceV1>,
325        ) -> Self {
326            Self(RequestBuilder::new(stub))
327        }
328
329        /// Sets the full request, replacing any prior values.
330        pub fn with_request<V: Into<crate::model::GetAttestorRequest>>(mut self, v: V) -> Self {
331            self.0.request = v.into();
332            self
333        }
334
335        /// Sets all the options, replacing any prior values.
336        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
337            self.0.options = v.into();
338            self
339        }
340
341        /// Sends the request.
342        pub async fn send(self) -> Result<crate::model::Attestor> {
343            (*self.0.stub)
344                .get_attestor(self.0.request, self.0.options)
345                .await
346                .map(crate::Response::into_body)
347        }
348
349        /// Sets the value of [name][crate::model::GetAttestorRequest::name].
350        ///
351        /// This is a **required** field for requests.
352        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
353            self.0.request.name = v.into();
354            self
355        }
356    }
357
358    #[doc(hidden)]
359    impl crate::RequestBuilder for GetAttestor {
360        fn request_options(&mut self) -> &mut crate::RequestOptions {
361            &mut self.0.options
362        }
363    }
364
365    /// The request builder for [BinauthzManagementServiceV1::update_attestor][crate::client::BinauthzManagementServiceV1::update_attestor] calls.
366    ///
367    /// # Example
368    /// ```
369    /// # use google_cloud_binaryauthorization_v1::builder::binauthz_management_service_v_1::UpdateAttestor;
370    /// # async fn sample() -> google_cloud_binaryauthorization_v1::Result<()> {
371    ///
372    /// let builder = prepare_request_builder();
373    /// let response = builder.send().await?;
374    /// # Ok(()) }
375    ///
376    /// fn prepare_request_builder() -> UpdateAttestor {
377    ///   # panic!();
378    ///   // ... details omitted ...
379    /// }
380    /// ```
381    #[derive(Clone, Debug)]
382    pub struct UpdateAttestor(RequestBuilder<crate::model::UpdateAttestorRequest>);
383
384    impl UpdateAttestor {
385        pub(crate) fn new(
386            stub: std::sync::Arc<dyn super::super::stub::dynamic::BinauthzManagementServiceV1>,
387        ) -> Self {
388            Self(RequestBuilder::new(stub))
389        }
390
391        /// Sets the full request, replacing any prior values.
392        pub fn with_request<V: Into<crate::model::UpdateAttestorRequest>>(mut self, v: V) -> Self {
393            self.0.request = v.into();
394            self
395        }
396
397        /// Sets all the options, replacing any prior values.
398        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
399            self.0.options = v.into();
400            self
401        }
402
403        /// Sends the request.
404        pub async fn send(self) -> Result<crate::model::Attestor> {
405            (*self.0.stub)
406                .update_attestor(self.0.request, self.0.options)
407                .await
408                .map(crate::Response::into_body)
409        }
410
411        /// Sets the value of [attestor][crate::model::UpdateAttestorRequest::attestor].
412        ///
413        /// This is a **required** field for requests.
414        pub fn set_attestor<T>(mut self, v: T) -> Self
415        where
416            T: std::convert::Into<crate::model::Attestor>,
417        {
418            self.0.request.attestor = std::option::Option::Some(v.into());
419            self
420        }
421
422        /// Sets or clears the value of [attestor][crate::model::UpdateAttestorRequest::attestor].
423        ///
424        /// This is a **required** field for requests.
425        pub fn set_or_clear_attestor<T>(mut self, v: std::option::Option<T>) -> Self
426        where
427            T: std::convert::Into<crate::model::Attestor>,
428        {
429            self.0.request.attestor = v.map(|x| x.into());
430            self
431        }
432    }
433
434    #[doc(hidden)]
435    impl crate::RequestBuilder for UpdateAttestor {
436        fn request_options(&mut self) -> &mut crate::RequestOptions {
437            &mut self.0.options
438        }
439    }
440
441    /// The request builder for [BinauthzManagementServiceV1::list_attestors][crate::client::BinauthzManagementServiceV1::list_attestors] calls.
442    ///
443    /// # Example
444    /// ```
445    /// # use google_cloud_binaryauthorization_v1::builder::binauthz_management_service_v_1::ListAttestors;
446    /// # async fn sample() -> google_cloud_binaryauthorization_v1::Result<()> {
447    /// use google_cloud_gax::paginator::ItemPaginator;
448    ///
449    /// let builder = prepare_request_builder();
450    /// let mut items = builder.by_item();
451    /// while let Some(result) = items.next().await {
452    ///   let item = result?;
453    /// }
454    /// # Ok(()) }
455    ///
456    /// fn prepare_request_builder() -> ListAttestors {
457    ///   # panic!();
458    ///   // ... details omitted ...
459    /// }
460    /// ```
461    #[derive(Clone, Debug)]
462    pub struct ListAttestors(RequestBuilder<crate::model::ListAttestorsRequest>);
463
464    impl ListAttestors {
465        pub(crate) fn new(
466            stub: std::sync::Arc<dyn super::super::stub::dynamic::BinauthzManagementServiceV1>,
467        ) -> Self {
468            Self(RequestBuilder::new(stub))
469        }
470
471        /// Sets the full request, replacing any prior values.
472        pub fn with_request<V: Into<crate::model::ListAttestorsRequest>>(mut self, v: V) -> Self {
473            self.0.request = v.into();
474            self
475        }
476
477        /// Sets all the options, replacing any prior values.
478        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
479            self.0.options = v.into();
480            self
481        }
482
483        /// Sends the request.
484        pub async fn send(self) -> Result<crate::model::ListAttestorsResponse> {
485            (*self.0.stub)
486                .list_attestors(self.0.request, self.0.options)
487                .await
488                .map(crate::Response::into_body)
489        }
490
491        /// Streams each page in the collection.
492        pub fn by_page(
493            self,
494        ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListAttestorsResponse, crate::Error>
495        {
496            use std::clone::Clone;
497            let token = self.0.request.page_token.clone();
498            let execute = move |token: String| {
499                let mut builder = self.clone();
500                builder.0.request = builder.0.request.set_page_token(token);
501                builder.send()
502            };
503            google_cloud_gax::paginator::internal::new_paginator(token, execute)
504        }
505
506        /// Streams each item in the collection.
507        pub fn by_item(
508            self,
509        ) -> impl google_cloud_gax::paginator::ItemPaginator<
510            crate::model::ListAttestorsResponse,
511            crate::Error,
512        > {
513            use google_cloud_gax::paginator::Paginator;
514            self.by_page().items()
515        }
516
517        /// Sets the value of [parent][crate::model::ListAttestorsRequest::parent].
518        ///
519        /// This is a **required** field for requests.
520        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
521            self.0.request.parent = v.into();
522            self
523        }
524
525        /// Sets the value of [page_size][crate::model::ListAttestorsRequest::page_size].
526        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
527            self.0.request.page_size = v.into();
528            self
529        }
530
531        /// Sets the value of [page_token][crate::model::ListAttestorsRequest::page_token].
532        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
533            self.0.request.page_token = v.into();
534            self
535        }
536    }
537
538    #[doc(hidden)]
539    impl crate::RequestBuilder for ListAttestors {
540        fn request_options(&mut self) -> &mut crate::RequestOptions {
541            &mut self.0.options
542        }
543    }
544
545    /// The request builder for [BinauthzManagementServiceV1::delete_attestor][crate::client::BinauthzManagementServiceV1::delete_attestor] calls.
546    ///
547    /// # Example
548    /// ```
549    /// # use google_cloud_binaryauthorization_v1::builder::binauthz_management_service_v_1::DeleteAttestor;
550    /// # async fn sample() -> google_cloud_binaryauthorization_v1::Result<()> {
551    ///
552    /// let builder = prepare_request_builder();
553    /// let response = builder.send().await?;
554    /// # Ok(()) }
555    ///
556    /// fn prepare_request_builder() -> DeleteAttestor {
557    ///   # panic!();
558    ///   // ... details omitted ...
559    /// }
560    /// ```
561    #[derive(Clone, Debug)]
562    pub struct DeleteAttestor(RequestBuilder<crate::model::DeleteAttestorRequest>);
563
564    impl DeleteAttestor {
565        pub(crate) fn new(
566            stub: std::sync::Arc<dyn super::super::stub::dynamic::BinauthzManagementServiceV1>,
567        ) -> Self {
568            Self(RequestBuilder::new(stub))
569        }
570
571        /// Sets the full request, replacing any prior values.
572        pub fn with_request<V: Into<crate::model::DeleteAttestorRequest>>(mut self, v: V) -> Self {
573            self.0.request = v.into();
574            self
575        }
576
577        /// Sets all the options, replacing any prior values.
578        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
579            self.0.options = v.into();
580            self
581        }
582
583        /// Sends the request.
584        pub async fn send(self) -> Result<()> {
585            (*self.0.stub)
586                .delete_attestor(self.0.request, self.0.options)
587                .await
588                .map(crate::Response::into_body)
589        }
590
591        /// Sets the value of [name][crate::model::DeleteAttestorRequest::name].
592        ///
593        /// This is a **required** field for requests.
594        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
595            self.0.request.name = v.into();
596            self
597        }
598    }
599
600    #[doc(hidden)]
601    impl crate::RequestBuilder for DeleteAttestor {
602        fn request_options(&mut self) -> &mut crate::RequestOptions {
603            &mut self.0.options
604        }
605    }
606}
607
608pub mod system_policy_v_1 {
609    use crate::Result;
610
611    /// A builder for [SystemPolicyV1][crate::client::SystemPolicyV1].
612    ///
613    /// ```
614    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
615    /// # use google_cloud_binaryauthorization_v1::*;
616    /// # use builder::system_policy_v_1::ClientBuilder;
617    /// # use client::SystemPolicyV1;
618    /// let builder : ClientBuilder = SystemPolicyV1::builder();
619    /// let client = builder
620    ///     .with_endpoint("https://binaryauthorization.googleapis.com")
621    ///     .build().await?;
622    /// # Ok(()) }
623    /// ```
624    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
625
626    pub(crate) mod client {
627        use super::super::super::client::SystemPolicyV1;
628        pub struct Factory;
629        impl crate::ClientFactory for Factory {
630            type Client = SystemPolicyV1;
631            type Credentials = gaxi::options::Credentials;
632            async fn build(
633                self,
634                config: gaxi::options::ClientConfig,
635            ) -> crate::ClientBuilderResult<Self::Client> {
636                Self::Client::new(config).await
637            }
638        }
639    }
640
641    /// Common implementation for [crate::client::SystemPolicyV1] request builders.
642    #[derive(Clone, Debug)]
643    pub(crate) struct RequestBuilder<R: std::default::Default> {
644        stub: std::sync::Arc<dyn super::super::stub::dynamic::SystemPolicyV1>,
645        request: R,
646        options: crate::RequestOptions,
647    }
648
649    impl<R> RequestBuilder<R>
650    where
651        R: std::default::Default,
652    {
653        pub(crate) fn new(
654            stub: std::sync::Arc<dyn super::super::stub::dynamic::SystemPolicyV1>,
655        ) -> Self {
656            Self {
657                stub,
658                request: R::default(),
659                options: crate::RequestOptions::default(),
660            }
661        }
662    }
663
664    /// The request builder for [SystemPolicyV1::get_system_policy][crate::client::SystemPolicyV1::get_system_policy] calls.
665    ///
666    /// # Example
667    /// ```
668    /// # use google_cloud_binaryauthorization_v1::builder::system_policy_v_1::GetSystemPolicy;
669    /// # async fn sample() -> google_cloud_binaryauthorization_v1::Result<()> {
670    ///
671    /// let builder = prepare_request_builder();
672    /// let response = builder.send().await?;
673    /// # Ok(()) }
674    ///
675    /// fn prepare_request_builder() -> GetSystemPolicy {
676    ///   # panic!();
677    ///   // ... details omitted ...
678    /// }
679    /// ```
680    #[derive(Clone, Debug)]
681    pub struct GetSystemPolicy(RequestBuilder<crate::model::GetSystemPolicyRequest>);
682
683    impl GetSystemPolicy {
684        pub(crate) fn new(
685            stub: std::sync::Arc<dyn super::super::stub::dynamic::SystemPolicyV1>,
686        ) -> Self {
687            Self(RequestBuilder::new(stub))
688        }
689
690        /// Sets the full request, replacing any prior values.
691        pub fn with_request<V: Into<crate::model::GetSystemPolicyRequest>>(mut self, v: V) -> Self {
692            self.0.request = v.into();
693            self
694        }
695
696        /// Sets all the options, replacing any prior values.
697        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
698            self.0.options = v.into();
699            self
700        }
701
702        /// Sends the request.
703        pub async fn send(self) -> Result<crate::model::Policy> {
704            (*self.0.stub)
705                .get_system_policy(self.0.request, self.0.options)
706                .await
707                .map(crate::Response::into_body)
708        }
709
710        /// Sets the value of [name][crate::model::GetSystemPolicyRequest::name].
711        ///
712        /// This is a **required** field for requests.
713        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
714            self.0.request.name = v.into();
715            self
716        }
717    }
718
719    #[doc(hidden)]
720    impl crate::RequestBuilder for GetSystemPolicy {
721        fn request_options(&mut self) -> &mut crate::RequestOptions {
722            &mut self.0.options
723        }
724    }
725}
726
727pub mod validation_helper_v_1 {
728    use crate::Result;
729
730    /// A builder for [ValidationHelperV1][crate::client::ValidationHelperV1].
731    ///
732    /// ```
733    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
734    /// # use google_cloud_binaryauthorization_v1::*;
735    /// # use builder::validation_helper_v_1::ClientBuilder;
736    /// # use client::ValidationHelperV1;
737    /// let builder : ClientBuilder = ValidationHelperV1::builder();
738    /// let client = builder
739    ///     .with_endpoint("https://binaryauthorization.googleapis.com")
740    ///     .build().await?;
741    /// # Ok(()) }
742    /// ```
743    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
744
745    pub(crate) mod client {
746        use super::super::super::client::ValidationHelperV1;
747        pub struct Factory;
748        impl crate::ClientFactory for Factory {
749            type Client = ValidationHelperV1;
750            type Credentials = gaxi::options::Credentials;
751            async fn build(
752                self,
753                config: gaxi::options::ClientConfig,
754            ) -> crate::ClientBuilderResult<Self::Client> {
755                Self::Client::new(config).await
756            }
757        }
758    }
759
760    /// Common implementation for [crate::client::ValidationHelperV1] request builders.
761    #[derive(Clone, Debug)]
762    pub(crate) struct RequestBuilder<R: std::default::Default> {
763        stub: std::sync::Arc<dyn super::super::stub::dynamic::ValidationHelperV1>,
764        request: R,
765        options: crate::RequestOptions,
766    }
767
768    impl<R> RequestBuilder<R>
769    where
770        R: std::default::Default,
771    {
772        pub(crate) fn new(
773            stub: std::sync::Arc<dyn super::super::stub::dynamic::ValidationHelperV1>,
774        ) -> Self {
775            Self {
776                stub,
777                request: R::default(),
778                options: crate::RequestOptions::default(),
779            }
780        }
781    }
782
783    /// The request builder for [ValidationHelperV1::validate_attestation_occurrence][crate::client::ValidationHelperV1::validate_attestation_occurrence] calls.
784    ///
785    /// # Example
786    /// ```
787    /// # use google_cloud_binaryauthorization_v1::builder::validation_helper_v_1::ValidateAttestationOccurrence;
788    /// # async fn sample() -> google_cloud_binaryauthorization_v1::Result<()> {
789    ///
790    /// let builder = prepare_request_builder();
791    /// let response = builder.send().await?;
792    /// # Ok(()) }
793    ///
794    /// fn prepare_request_builder() -> ValidateAttestationOccurrence {
795    ///   # panic!();
796    ///   // ... details omitted ...
797    /// }
798    /// ```
799    #[derive(Clone, Debug)]
800    pub struct ValidateAttestationOccurrence(
801        RequestBuilder<crate::model::ValidateAttestationOccurrenceRequest>,
802    );
803
804    impl ValidateAttestationOccurrence {
805        pub(crate) fn new(
806            stub: std::sync::Arc<dyn super::super::stub::dynamic::ValidationHelperV1>,
807        ) -> Self {
808            Self(RequestBuilder::new(stub))
809        }
810
811        /// Sets the full request, replacing any prior values.
812        pub fn with_request<V: Into<crate::model::ValidateAttestationOccurrenceRequest>>(
813            mut self,
814            v: V,
815        ) -> Self {
816            self.0.request = v.into();
817            self
818        }
819
820        /// Sets all the options, replacing any prior values.
821        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
822            self.0.options = v.into();
823            self
824        }
825
826        /// Sends the request.
827        pub async fn send(self) -> Result<crate::model::ValidateAttestationOccurrenceResponse> {
828            (*self.0.stub)
829                .validate_attestation_occurrence(self.0.request, self.0.options)
830                .await
831                .map(crate::Response::into_body)
832        }
833
834        /// Sets the value of [attestor][crate::model::ValidateAttestationOccurrenceRequest::attestor].
835        ///
836        /// This is a **required** field for requests.
837        pub fn set_attestor<T: Into<std::string::String>>(mut self, v: T) -> Self {
838            self.0.request.attestor = v.into();
839            self
840        }
841
842        /// Sets the value of [attestation][crate::model::ValidateAttestationOccurrenceRequest::attestation].
843        ///
844        /// This is a **required** field for requests.
845        pub fn set_attestation<T>(mut self, v: T) -> Self
846        where
847            T: std::convert::Into<google_cloud_grafeas_v1::model::AttestationOccurrence>,
848        {
849            self.0.request.attestation = std::option::Option::Some(v.into());
850            self
851        }
852
853        /// Sets or clears the value of [attestation][crate::model::ValidateAttestationOccurrenceRequest::attestation].
854        ///
855        /// This is a **required** field for requests.
856        pub fn set_or_clear_attestation<T>(mut self, v: std::option::Option<T>) -> Self
857        where
858            T: std::convert::Into<google_cloud_grafeas_v1::model::AttestationOccurrence>,
859        {
860            self.0.request.attestation = v.map(|x| x.into());
861            self
862        }
863
864        /// Sets the value of [occurrence_note][crate::model::ValidateAttestationOccurrenceRequest::occurrence_note].
865        ///
866        /// This is a **required** field for requests.
867        pub fn set_occurrence_note<T: Into<std::string::String>>(mut self, v: T) -> Self {
868            self.0.request.occurrence_note = v.into();
869            self
870        }
871
872        /// Sets the value of [occurrence_resource_uri][crate::model::ValidateAttestationOccurrenceRequest::occurrence_resource_uri].
873        ///
874        /// This is a **required** field for requests.
875        pub fn set_occurrence_resource_uri<T: Into<std::string::String>>(mut self, v: T) -> Self {
876            self.0.request.occurrence_resource_uri = v.into();
877            self
878        }
879    }
880
881    #[doc(hidden)]
882    impl crate::RequestBuilder for ValidateAttestationOccurrence {
883        fn request_options(&mut self) -> &mut crate::RequestOptions {
884            &mut self.0.options
885        }
886    }
887}