google_cloud_confidentialcomputing_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 confidential_computing {
18    use crate::Result;
19
20    /// A builder for [ConfidentialComputing][crate::client::ConfidentialComputing].
21    ///
22    /// ```
23    /// # tokio_test::block_on(async {
24    /// # use google_cloud_confidentialcomputing_v1::*;
25    /// # use builder::confidential_computing::ClientBuilder;
26    /// # use client::ConfidentialComputing;
27    /// let builder : ClientBuilder = ConfidentialComputing::builder();
28    /// let client = builder
29    ///     .with_endpoint("https://confidentialcomputing.googleapis.com")
30    ///     .build().await?;
31    /// # gax::client_builder::Result::<()>::Ok(()) });
32    /// ```
33    pub type ClientBuilder =
34        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
35
36    pub(crate) mod client {
37        use super::super::super::client::ConfidentialComputing;
38        pub struct Factory;
39        impl gax::client_builder::internal::ClientFactory for Factory {
40            type Client = ConfidentialComputing;
41            type Credentials = gaxi::options::Credentials;
42            async fn build(
43                self,
44                config: gaxi::options::ClientConfig,
45            ) -> gax::client_builder::Result<Self::Client> {
46                Self::Client::new(config).await
47            }
48        }
49    }
50
51    /// Common implementation for [crate::client::ConfidentialComputing] 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::ConfidentialComputing>,
55        request: R,
56        options: gax::options::RequestOptions,
57    }
58
59    impl<R> RequestBuilder<R>
60    where
61        R: std::default::Default,
62    {
63        pub(crate) fn new(
64            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConfidentialComputing>,
65        ) -> Self {
66            Self {
67                stub,
68                request: R::default(),
69                options: gax::options::RequestOptions::default(),
70            }
71        }
72    }
73
74    /// The request builder for [ConfidentialComputing::create_challenge][crate::client::ConfidentialComputing::create_challenge] calls.
75    ///
76    /// # Example
77    /// ```no_run
78    /// # use google_cloud_confidentialcomputing_v1::builder;
79    /// use builder::confidential_computing::CreateChallenge;
80    /// # tokio_test::block_on(async {
81    ///
82    /// let builder = prepare_request_builder();
83    /// let response = builder.send().await?;
84    /// # gax::Result::<()>::Ok(()) });
85    ///
86    /// fn prepare_request_builder() -> CreateChallenge {
87    ///   # panic!();
88    ///   // ... details omitted ...
89    /// }
90    /// ```
91    #[derive(Clone, Debug)]
92    pub struct CreateChallenge(RequestBuilder<crate::model::CreateChallengeRequest>);
93
94    impl CreateChallenge {
95        pub(crate) fn new(
96            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConfidentialComputing>,
97        ) -> Self {
98            Self(RequestBuilder::new(stub))
99        }
100
101        /// Sets the full request, replacing any prior values.
102        pub fn with_request<V: Into<crate::model::CreateChallengeRequest>>(mut self, v: V) -> Self {
103            self.0.request = v.into();
104            self
105        }
106
107        /// Sets all the options, replacing any prior values.
108        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
109            self.0.options = v.into();
110            self
111        }
112
113        /// Sends the request.
114        pub async fn send(self) -> Result<crate::model::Challenge> {
115            (*self.0.stub)
116                .create_challenge(self.0.request, self.0.options)
117                .await
118                .map(gax::response::Response::into_body)
119        }
120
121        /// Sets the value of [parent][crate::model::CreateChallengeRequest::parent].
122        ///
123        /// This is a **required** field for requests.
124        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
125            self.0.request.parent = v.into();
126            self
127        }
128
129        /// Sets the value of [challenge][crate::model::CreateChallengeRequest::challenge].
130        ///
131        /// This is a **required** field for requests.
132        pub fn set_challenge<T>(mut self, v: T) -> Self
133        where
134            T: std::convert::Into<crate::model::Challenge>,
135        {
136            self.0.request.challenge = std::option::Option::Some(v.into());
137            self
138        }
139
140        /// Sets or clears the value of [challenge][crate::model::CreateChallengeRequest::challenge].
141        ///
142        /// This is a **required** field for requests.
143        pub fn set_or_clear_challenge<T>(mut self, v: std::option::Option<T>) -> Self
144        where
145            T: std::convert::Into<crate::model::Challenge>,
146        {
147            self.0.request.challenge = v.map(|x| x.into());
148            self
149        }
150    }
151
152    #[doc(hidden)]
153    impl gax::options::internal::RequestBuilder for CreateChallenge {
154        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
155            &mut self.0.options
156        }
157    }
158
159    /// The request builder for [ConfidentialComputing::verify_attestation][crate::client::ConfidentialComputing::verify_attestation] calls.
160    ///
161    /// # Example
162    /// ```no_run
163    /// # use google_cloud_confidentialcomputing_v1::builder;
164    /// use builder::confidential_computing::VerifyAttestation;
165    /// # tokio_test::block_on(async {
166    ///
167    /// let builder = prepare_request_builder();
168    /// let response = builder.send().await?;
169    /// # gax::Result::<()>::Ok(()) });
170    ///
171    /// fn prepare_request_builder() -> VerifyAttestation {
172    ///   # panic!();
173    ///   // ... details omitted ...
174    /// }
175    /// ```
176    #[derive(Clone, Debug)]
177    pub struct VerifyAttestation(RequestBuilder<crate::model::VerifyAttestationRequest>);
178
179    impl VerifyAttestation {
180        pub(crate) fn new(
181            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConfidentialComputing>,
182        ) -> Self {
183            Self(RequestBuilder::new(stub))
184        }
185
186        /// Sets the full request, replacing any prior values.
187        pub fn with_request<V: Into<crate::model::VerifyAttestationRequest>>(
188            mut self,
189            v: V,
190        ) -> Self {
191            self.0.request = v.into();
192            self
193        }
194
195        /// Sets all the options, replacing any prior values.
196        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
197            self.0.options = v.into();
198            self
199        }
200
201        /// Sends the request.
202        pub async fn send(self) -> Result<crate::model::VerifyAttestationResponse> {
203            (*self.0.stub)
204                .verify_attestation(self.0.request, self.0.options)
205                .await
206                .map(gax::response::Response::into_body)
207        }
208
209        /// Sets the value of [challenge][crate::model::VerifyAttestationRequest::challenge].
210        ///
211        /// This is a **required** field for requests.
212        pub fn set_challenge<T: Into<std::string::String>>(mut self, v: T) -> Self {
213            self.0.request.challenge = v.into();
214            self
215        }
216
217        /// Sets the value of [gcp_credentials][crate::model::VerifyAttestationRequest::gcp_credentials].
218        pub fn set_gcp_credentials<T>(mut self, v: T) -> Self
219        where
220            T: std::convert::Into<crate::model::GcpCredentials>,
221        {
222            self.0.request.gcp_credentials = std::option::Option::Some(v.into());
223            self
224        }
225
226        /// Sets or clears the value of [gcp_credentials][crate::model::VerifyAttestationRequest::gcp_credentials].
227        pub fn set_or_clear_gcp_credentials<T>(mut self, v: std::option::Option<T>) -> Self
228        where
229            T: std::convert::Into<crate::model::GcpCredentials>,
230        {
231            self.0.request.gcp_credentials = v.map(|x| x.into());
232            self
233        }
234
235        /// Sets the value of [tpm_attestation][crate::model::VerifyAttestationRequest::tpm_attestation].
236        ///
237        /// This is a **required** field for requests.
238        pub fn set_tpm_attestation<T>(mut self, v: T) -> Self
239        where
240            T: std::convert::Into<crate::model::TpmAttestation>,
241        {
242            self.0.request.tpm_attestation = std::option::Option::Some(v.into());
243            self
244        }
245
246        /// Sets or clears the value of [tpm_attestation][crate::model::VerifyAttestationRequest::tpm_attestation].
247        ///
248        /// This is a **required** field for requests.
249        pub fn set_or_clear_tpm_attestation<T>(mut self, v: std::option::Option<T>) -> Self
250        where
251            T: std::convert::Into<crate::model::TpmAttestation>,
252        {
253            self.0.request.tpm_attestation = v.map(|x| x.into());
254            self
255        }
256
257        /// Sets the value of [confidential_space_info][crate::model::VerifyAttestationRequest::confidential_space_info].
258        pub fn set_confidential_space_info<T>(mut self, v: T) -> Self
259        where
260            T: std::convert::Into<crate::model::ConfidentialSpaceInfo>,
261        {
262            self.0.request.confidential_space_info = std::option::Option::Some(v.into());
263            self
264        }
265
266        /// Sets or clears the value of [confidential_space_info][crate::model::VerifyAttestationRequest::confidential_space_info].
267        pub fn set_or_clear_confidential_space_info<T>(mut self, v: std::option::Option<T>) -> Self
268        where
269            T: std::convert::Into<crate::model::ConfidentialSpaceInfo>,
270        {
271            self.0.request.confidential_space_info = v.map(|x| x.into());
272            self
273        }
274
275        /// Sets the value of [token_options][crate::model::VerifyAttestationRequest::token_options].
276        pub fn set_token_options<T>(mut self, v: T) -> Self
277        where
278            T: std::convert::Into<crate::model::TokenOptions>,
279        {
280            self.0.request.token_options = std::option::Option::Some(v.into());
281            self
282        }
283
284        /// Sets or clears the value of [token_options][crate::model::VerifyAttestationRequest::token_options].
285        pub fn set_or_clear_token_options<T>(mut self, v: std::option::Option<T>) -> Self
286        where
287            T: std::convert::Into<crate::model::TokenOptions>,
288        {
289            self.0.request.token_options = v.map(|x| x.into());
290            self
291        }
292
293        /// Sets the value of [attester][crate::model::VerifyAttestationRequest::attester].
294        pub fn set_attester<T: Into<std::string::String>>(mut self, v: T) -> Self {
295            self.0.request.attester = v.into();
296            self
297        }
298
299        /// Sets the value of [tee_attestation][crate::model::VerifyAttestationRequest::tee_attestation].
300        ///
301        /// Note that all the setters affecting `tee_attestation` are
302        /// mutually exclusive.
303        pub fn set_tee_attestation<
304            T: Into<Option<crate::model::verify_attestation_request::TeeAttestation>>,
305        >(
306            mut self,
307            v: T,
308        ) -> Self {
309            self.0.request.tee_attestation = v.into();
310            self
311        }
312
313        /// Sets the value of [tee_attestation][crate::model::VerifyAttestationRequest::tee_attestation]
314        /// to hold a `TdCcel`.
315        ///
316        /// Note that all the setters affecting `tee_attestation` are
317        /// mutually exclusive.
318        pub fn set_td_ccel<
319            T: std::convert::Into<std::boxed::Box<crate::model::TdxCcelAttestation>>,
320        >(
321            mut self,
322            v: T,
323        ) -> Self {
324            self.0.request = self.0.request.set_td_ccel(v);
325            self
326        }
327
328        /// Sets the value of [tee_attestation][crate::model::VerifyAttestationRequest::tee_attestation]
329        /// to hold a `SevSnpAttestation`.
330        ///
331        /// Note that all the setters affecting `tee_attestation` are
332        /// mutually exclusive.
333        pub fn set_sev_snp_attestation<
334            T: std::convert::Into<std::boxed::Box<crate::model::SevSnpAttestation>>,
335        >(
336            mut self,
337            v: T,
338        ) -> Self {
339            self.0.request = self.0.request.set_sev_snp_attestation(v);
340            self
341        }
342    }
343
344    #[doc(hidden)]
345    impl gax::options::internal::RequestBuilder for VerifyAttestation {
346        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
347            &mut self.0.options
348        }
349    }
350
351    /// The request builder for [ConfidentialComputing::verify_confidential_space][crate::client::ConfidentialComputing::verify_confidential_space] calls.
352    ///
353    /// # Example
354    /// ```no_run
355    /// # use google_cloud_confidentialcomputing_v1::builder;
356    /// use builder::confidential_computing::VerifyConfidentialSpace;
357    /// # tokio_test::block_on(async {
358    ///
359    /// let builder = prepare_request_builder();
360    /// let response = builder.send().await?;
361    /// # gax::Result::<()>::Ok(()) });
362    ///
363    /// fn prepare_request_builder() -> VerifyConfidentialSpace {
364    ///   # panic!();
365    ///   // ... details omitted ...
366    /// }
367    /// ```
368    #[derive(Clone, Debug)]
369    pub struct VerifyConfidentialSpace(
370        RequestBuilder<crate::model::VerifyConfidentialSpaceRequest>,
371    );
372
373    impl VerifyConfidentialSpace {
374        pub(crate) fn new(
375            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConfidentialComputing>,
376        ) -> Self {
377            Self(RequestBuilder::new(stub))
378        }
379
380        /// Sets the full request, replacing any prior values.
381        pub fn with_request<V: Into<crate::model::VerifyConfidentialSpaceRequest>>(
382            mut self,
383            v: V,
384        ) -> Self {
385            self.0.request = v.into();
386            self
387        }
388
389        /// Sets all the options, replacing any prior values.
390        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
391            self.0.options = v.into();
392            self
393        }
394
395        /// Sends the request.
396        pub async fn send(self) -> Result<crate::model::VerifyConfidentialSpaceResponse> {
397            (*self.0.stub)
398                .verify_confidential_space(self.0.request, self.0.options)
399                .await
400                .map(gax::response::Response::into_body)
401        }
402
403        /// Sets the value of [challenge][crate::model::VerifyConfidentialSpaceRequest::challenge].
404        ///
405        /// This is a **required** field for requests.
406        pub fn set_challenge<T: Into<std::string::String>>(mut self, v: T) -> Self {
407            self.0.request.challenge = v.into();
408            self
409        }
410
411        /// Sets the value of [gcp_credentials][crate::model::VerifyConfidentialSpaceRequest::gcp_credentials].
412        pub fn set_gcp_credentials<T>(mut self, v: T) -> Self
413        where
414            T: std::convert::Into<crate::model::GcpCredentials>,
415        {
416            self.0.request.gcp_credentials = std::option::Option::Some(v.into());
417            self
418        }
419
420        /// Sets or clears the value of [gcp_credentials][crate::model::VerifyConfidentialSpaceRequest::gcp_credentials].
421        pub fn set_or_clear_gcp_credentials<T>(mut self, v: std::option::Option<T>) -> Self
422        where
423            T: std::convert::Into<crate::model::GcpCredentials>,
424        {
425            self.0.request.gcp_credentials = v.map(|x| x.into());
426            self
427        }
428
429        /// Sets the value of [signed_entities][crate::model::VerifyConfidentialSpaceRequest::signed_entities].
430        pub fn set_signed_entities<T, V>(mut self, v: T) -> Self
431        where
432            T: std::iter::IntoIterator<Item = V>,
433            V: std::convert::Into<crate::model::SignedEntity>,
434        {
435            use std::iter::Iterator;
436            self.0.request.signed_entities = v.into_iter().map(|i| i.into()).collect();
437            self
438        }
439
440        /// Sets the value of [gce_shielded_identity][crate::model::VerifyConfidentialSpaceRequest::gce_shielded_identity].
441        pub fn set_gce_shielded_identity<T>(mut self, v: T) -> Self
442        where
443            T: std::convert::Into<crate::model::GceShieldedIdentity>,
444        {
445            self.0.request.gce_shielded_identity = std::option::Option::Some(v.into());
446            self
447        }
448
449        /// Sets or clears the value of [gce_shielded_identity][crate::model::VerifyConfidentialSpaceRequest::gce_shielded_identity].
450        pub fn set_or_clear_gce_shielded_identity<T>(mut self, v: std::option::Option<T>) -> Self
451        where
452            T: std::convert::Into<crate::model::GceShieldedIdentity>,
453        {
454            self.0.request.gce_shielded_identity = v.map(|x| x.into());
455            self
456        }
457
458        /// Sets the value of [options][crate::model::VerifyConfidentialSpaceRequest::options].
459        pub fn set_options<T>(mut self, v: T) -> Self
460        where
461            T: std::convert::Into<
462                    crate::model::verify_confidential_space_request::ConfidentialSpaceOptions,
463                >,
464        {
465            self.0.request.options = std::option::Option::Some(v.into());
466            self
467        }
468
469        /// Sets or clears the value of [options][crate::model::VerifyConfidentialSpaceRequest::options].
470        pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
471        where
472            T: std::convert::Into<
473                    crate::model::verify_confidential_space_request::ConfidentialSpaceOptions,
474                >,
475        {
476            self.0.request.options = v.map(|x| x.into());
477            self
478        }
479
480        /// Sets the value of [tee_attestation][crate::model::VerifyConfidentialSpaceRequest::tee_attestation].
481        ///
482        /// Note that all the setters affecting `tee_attestation` are
483        /// mutually exclusive.
484        pub fn set_tee_attestation<
485            T: Into<Option<crate::model::verify_confidential_space_request::TeeAttestation>>,
486        >(
487            mut self,
488            v: T,
489        ) -> Self {
490            self.0.request.tee_attestation = v.into();
491            self
492        }
493
494        /// Sets the value of [tee_attestation][crate::model::VerifyConfidentialSpaceRequest::tee_attestation]
495        /// to hold a `TdCcel`.
496        ///
497        /// Note that all the setters affecting `tee_attestation` are
498        /// mutually exclusive.
499        pub fn set_td_ccel<
500            T: std::convert::Into<std::boxed::Box<crate::model::TdxCcelAttestation>>,
501        >(
502            mut self,
503            v: T,
504        ) -> Self {
505            self.0.request = self.0.request.set_td_ccel(v);
506            self
507        }
508
509        /// Sets the value of [tee_attestation][crate::model::VerifyConfidentialSpaceRequest::tee_attestation]
510        /// to hold a `TpmAttestation`.
511        ///
512        /// Note that all the setters affecting `tee_attestation` are
513        /// mutually exclusive.
514        pub fn set_tpm_attestation<
515            T: std::convert::Into<std::boxed::Box<crate::model::TpmAttestation>>,
516        >(
517            mut self,
518            v: T,
519        ) -> Self {
520            self.0.request = self.0.request.set_tpm_attestation(v);
521            self
522        }
523    }
524
525    #[doc(hidden)]
526    impl gax::options::internal::RequestBuilder for VerifyConfidentialSpace {
527        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
528            &mut self.0.options
529        }
530    }
531
532    /// The request builder for [ConfidentialComputing::verify_confidential_gke][crate::client::ConfidentialComputing::verify_confidential_gke] calls.
533    ///
534    /// # Example
535    /// ```no_run
536    /// # use google_cloud_confidentialcomputing_v1::builder;
537    /// use builder::confidential_computing::VerifyConfidentialGke;
538    /// # tokio_test::block_on(async {
539    ///
540    /// let builder = prepare_request_builder();
541    /// let response = builder.send().await?;
542    /// # gax::Result::<()>::Ok(()) });
543    ///
544    /// fn prepare_request_builder() -> VerifyConfidentialGke {
545    ///   # panic!();
546    ///   // ... details omitted ...
547    /// }
548    /// ```
549    #[derive(Clone, Debug)]
550    pub struct VerifyConfidentialGke(RequestBuilder<crate::model::VerifyConfidentialGkeRequest>);
551
552    impl VerifyConfidentialGke {
553        pub(crate) fn new(
554            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConfidentialComputing>,
555        ) -> Self {
556            Self(RequestBuilder::new(stub))
557        }
558
559        /// Sets the full request, replacing any prior values.
560        pub fn with_request<V: Into<crate::model::VerifyConfidentialGkeRequest>>(
561            mut self,
562            v: V,
563        ) -> Self {
564            self.0.request = v.into();
565            self
566        }
567
568        /// Sets all the options, replacing any prior values.
569        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
570            self.0.options = v.into();
571            self
572        }
573
574        /// Sends the request.
575        pub async fn send(self) -> Result<crate::model::VerifyConfidentialGkeResponse> {
576            (*self.0.stub)
577                .verify_confidential_gke(self.0.request, self.0.options)
578                .await
579                .map(gax::response::Response::into_body)
580        }
581
582        /// Sets the value of [challenge][crate::model::VerifyConfidentialGkeRequest::challenge].
583        ///
584        /// This is a **required** field for requests.
585        pub fn set_challenge<T: Into<std::string::String>>(mut self, v: T) -> Self {
586            self.0.request.challenge = v.into();
587            self
588        }
589
590        /// Sets the value of [tee_attestation][crate::model::VerifyConfidentialGkeRequest::tee_attestation].
591        ///
592        /// Note that all the setters affecting `tee_attestation` are
593        /// mutually exclusive.
594        pub fn set_tee_attestation<
595            T: Into<Option<crate::model::verify_confidential_gke_request::TeeAttestation>>,
596        >(
597            mut self,
598            v: T,
599        ) -> Self {
600            self.0.request.tee_attestation = v.into();
601            self
602        }
603
604        /// Sets the value of [tee_attestation][crate::model::VerifyConfidentialGkeRequest::tee_attestation]
605        /// to hold a `TpmAttestation`.
606        ///
607        /// Note that all the setters affecting `tee_attestation` are
608        /// mutually exclusive.
609        pub fn set_tpm_attestation<
610            T: std::convert::Into<std::boxed::Box<crate::model::TpmAttestation>>,
611        >(
612            mut self,
613            v: T,
614        ) -> Self {
615            self.0.request = self.0.request.set_tpm_attestation(v);
616            self
617        }
618    }
619
620    #[doc(hidden)]
621    impl gax::options::internal::RequestBuilder for VerifyConfidentialGke {
622        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
623            &mut self.0.options
624        }
625    }
626
627    /// The request builder for [ConfidentialComputing::list_locations][crate::client::ConfidentialComputing::list_locations] calls.
628    ///
629    /// # Example
630    /// ```no_run
631    /// # use google_cloud_confidentialcomputing_v1::builder;
632    /// use builder::confidential_computing::ListLocations;
633    /// # tokio_test::block_on(async {
634    /// use gax::paginator::ItemPaginator;
635    ///
636    /// let builder = prepare_request_builder();
637    /// let mut items = builder.by_item();
638    /// while let Some(result) = items.next().await {
639    ///   let item = result?;
640    /// }
641    /// # gax::Result::<()>::Ok(()) });
642    ///
643    /// fn prepare_request_builder() -> ListLocations {
644    ///   # panic!();
645    ///   // ... details omitted ...
646    /// }
647    /// ```
648    #[derive(Clone, Debug)]
649    pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
650
651    impl ListLocations {
652        pub(crate) fn new(
653            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConfidentialComputing>,
654        ) -> Self {
655            Self(RequestBuilder::new(stub))
656        }
657
658        /// Sets the full request, replacing any prior values.
659        pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
660            mut self,
661            v: V,
662        ) -> Self {
663            self.0.request = v.into();
664            self
665        }
666
667        /// Sets all the options, replacing any prior values.
668        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
669            self.0.options = v.into();
670            self
671        }
672
673        /// Sends the request.
674        pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
675            (*self.0.stub)
676                .list_locations(self.0.request, self.0.options)
677                .await
678                .map(gax::response::Response::into_body)
679        }
680
681        /// Streams each page in the collection.
682        pub fn by_page(
683            self,
684        ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
685        {
686            use std::clone::Clone;
687            let token = self.0.request.page_token.clone();
688            let execute = move |token: String| {
689                let mut builder = self.clone();
690                builder.0.request = builder.0.request.set_page_token(token);
691                builder.send()
692            };
693            gax::paginator::internal::new_paginator(token, execute)
694        }
695
696        /// Streams each item in the collection.
697        pub fn by_item(
698            self,
699        ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
700        {
701            use gax::paginator::Paginator;
702            self.by_page().items()
703        }
704
705        /// Sets the value of [name][location::model::ListLocationsRequest::name].
706        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
707            self.0.request.name = v.into();
708            self
709        }
710
711        /// Sets the value of [filter][location::model::ListLocationsRequest::filter].
712        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
713            self.0.request.filter = v.into();
714            self
715        }
716
717        /// Sets the value of [page_size][location::model::ListLocationsRequest::page_size].
718        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
719            self.0.request.page_size = v.into();
720            self
721        }
722
723        /// Sets the value of [page_token][location::model::ListLocationsRequest::page_token].
724        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
725            self.0.request.page_token = v.into();
726            self
727        }
728    }
729
730    #[doc(hidden)]
731    impl gax::options::internal::RequestBuilder for ListLocations {
732        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
733            &mut self.0.options
734        }
735    }
736
737    /// The request builder for [ConfidentialComputing::get_location][crate::client::ConfidentialComputing::get_location] calls.
738    ///
739    /// # Example
740    /// ```no_run
741    /// # use google_cloud_confidentialcomputing_v1::builder;
742    /// use builder::confidential_computing::GetLocation;
743    /// # tokio_test::block_on(async {
744    ///
745    /// let builder = prepare_request_builder();
746    /// let response = builder.send().await?;
747    /// # gax::Result::<()>::Ok(()) });
748    ///
749    /// fn prepare_request_builder() -> GetLocation {
750    ///   # panic!();
751    ///   // ... details omitted ...
752    /// }
753    /// ```
754    #[derive(Clone, Debug)]
755    pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
756
757    impl GetLocation {
758        pub(crate) fn new(
759            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConfidentialComputing>,
760        ) -> Self {
761            Self(RequestBuilder::new(stub))
762        }
763
764        /// Sets the full request, replacing any prior values.
765        pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
766            self.0.request = v.into();
767            self
768        }
769
770        /// Sets all the options, replacing any prior values.
771        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
772            self.0.options = v.into();
773            self
774        }
775
776        /// Sends the request.
777        pub async fn send(self) -> Result<location::model::Location> {
778            (*self.0.stub)
779                .get_location(self.0.request, self.0.options)
780                .await
781                .map(gax::response::Response::into_body)
782        }
783
784        /// Sets the value of [name][location::model::GetLocationRequest::name].
785        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
786            self.0.request.name = v.into();
787            self
788        }
789    }
790
791    #[doc(hidden)]
792    impl gax::options::internal::RequestBuilder for GetLocation {
793        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
794            &mut self.0.options
795        }
796    }
797}