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