google_cloud_baremetalsolution_v2/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 bare_metal_solution {
18 use crate::Result;
19
20 /// A builder for [BareMetalSolution][crate::client::BareMetalSolution].
21 ///
22 /// ```
23 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
24 /// # use google_cloud_baremetalsolution_v2::*;
25 /// # use builder::bare_metal_solution::ClientBuilder;
26 /// # use client::BareMetalSolution;
27 /// let builder : ClientBuilder = BareMetalSolution::builder();
28 /// let client = builder
29 /// .with_endpoint("https://baremetalsolution.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::BareMetalSolution;
37 pub struct Factory;
38 impl crate::ClientFactory for Factory {
39 type Client = BareMetalSolution;
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::BareMetalSolution] 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::BareMetalSolution>,
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::BareMetalSolution>,
64 ) -> Self {
65 Self {
66 stub,
67 request: R::default(),
68 options: crate::RequestOptions::default(),
69 }
70 }
71 }
72
73 /// The request builder for [BareMetalSolution::list_instances][crate::client::BareMetalSolution::list_instances] calls.
74 ///
75 /// # Example
76 /// ```
77 /// # use google_cloud_baremetalsolution_v2::builder::bare_metal_solution::ListInstances;
78 /// # async fn sample() -> google_cloud_baremetalsolution_v2::Result<()> {
79 /// use google_cloud_gax::paginator::ItemPaginator;
80 ///
81 /// let builder = prepare_request_builder();
82 /// let mut items = builder.by_item();
83 /// while let Some(result) = items.next().await {
84 /// let item = result?;
85 /// }
86 /// # Ok(()) }
87 ///
88 /// fn prepare_request_builder() -> ListInstances {
89 /// # panic!();
90 /// // ... details omitted ...
91 /// }
92 /// ```
93 #[derive(Clone, Debug)]
94 pub struct ListInstances(RequestBuilder<crate::model::ListInstancesRequest>);
95
96 impl ListInstances {
97 pub(crate) fn new(
98 stub: std::sync::Arc<dyn super::super::stub::dynamic::BareMetalSolution>,
99 ) -> Self {
100 Self(RequestBuilder::new(stub))
101 }
102
103 /// Sets the full request, replacing any prior values.
104 pub fn with_request<V: Into<crate::model::ListInstancesRequest>>(mut self, v: V) -> Self {
105 self.0.request = v.into();
106 self
107 }
108
109 /// Sets all the options, replacing any prior values.
110 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
111 self.0.options = v.into();
112 self
113 }
114
115 /// Sends the request.
116 pub async fn send(self) -> Result<crate::model::ListInstancesResponse> {
117 (*self.0.stub)
118 .list_instances(self.0.request, self.0.options)
119 .await
120 .map(crate::Response::into_body)
121 }
122
123 /// Streams each page in the collection.
124 pub fn by_page(
125 self,
126 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListInstancesResponse, crate::Error>
127 {
128 use std::clone::Clone;
129 let token = self.0.request.page_token.clone();
130 let execute = move |token: String| {
131 let mut builder = self.clone();
132 builder.0.request = builder.0.request.set_page_token(token);
133 builder.send()
134 };
135 google_cloud_gax::paginator::internal::new_paginator(token, execute)
136 }
137
138 /// Streams each item in the collection.
139 pub fn by_item(
140 self,
141 ) -> impl google_cloud_gax::paginator::ItemPaginator<
142 crate::model::ListInstancesResponse,
143 crate::Error,
144 > {
145 use google_cloud_gax::paginator::Paginator;
146 self.by_page().items()
147 }
148
149 /// Sets the value of [parent][crate::model::ListInstancesRequest::parent].
150 ///
151 /// This is a **required** field for requests.
152 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
153 self.0.request.parent = v.into();
154 self
155 }
156
157 /// Sets the value of [page_size][crate::model::ListInstancesRequest::page_size].
158 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
159 self.0.request.page_size = v.into();
160 self
161 }
162
163 /// Sets the value of [page_token][crate::model::ListInstancesRequest::page_token].
164 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
165 self.0.request.page_token = v.into();
166 self
167 }
168
169 /// Sets the value of [filter][crate::model::ListInstancesRequest::filter].
170 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
171 self.0.request.filter = v.into();
172 self
173 }
174 }
175
176 #[doc(hidden)]
177 impl crate::RequestBuilder for ListInstances {
178 fn request_options(&mut self) -> &mut crate::RequestOptions {
179 &mut self.0.options
180 }
181 }
182
183 /// The request builder for [BareMetalSolution::get_instance][crate::client::BareMetalSolution::get_instance] calls.
184 ///
185 /// # Example
186 /// ```
187 /// # use google_cloud_baremetalsolution_v2::builder::bare_metal_solution::GetInstance;
188 /// # async fn sample() -> google_cloud_baremetalsolution_v2::Result<()> {
189 ///
190 /// let builder = prepare_request_builder();
191 /// let response = builder.send().await?;
192 /// # Ok(()) }
193 ///
194 /// fn prepare_request_builder() -> GetInstance {
195 /// # panic!();
196 /// // ... details omitted ...
197 /// }
198 /// ```
199 #[derive(Clone, Debug)]
200 pub struct GetInstance(RequestBuilder<crate::model::GetInstanceRequest>);
201
202 impl GetInstance {
203 pub(crate) fn new(
204 stub: std::sync::Arc<dyn super::super::stub::dynamic::BareMetalSolution>,
205 ) -> Self {
206 Self(RequestBuilder::new(stub))
207 }
208
209 /// Sets the full request, replacing any prior values.
210 pub fn with_request<V: Into<crate::model::GetInstanceRequest>>(mut self, v: V) -> Self {
211 self.0.request = v.into();
212 self
213 }
214
215 /// Sets all the options, replacing any prior values.
216 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
217 self.0.options = v.into();
218 self
219 }
220
221 /// Sends the request.
222 pub async fn send(self) -> Result<crate::model::Instance> {
223 (*self.0.stub)
224 .get_instance(self.0.request, self.0.options)
225 .await
226 .map(crate::Response::into_body)
227 }
228
229 /// Sets the value of [name][crate::model::GetInstanceRequest::name].
230 ///
231 /// This is a **required** field for requests.
232 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
233 self.0.request.name = v.into();
234 self
235 }
236 }
237
238 #[doc(hidden)]
239 impl crate::RequestBuilder for GetInstance {
240 fn request_options(&mut self) -> &mut crate::RequestOptions {
241 &mut self.0.options
242 }
243 }
244
245 /// The request builder for [BareMetalSolution::update_instance][crate::client::BareMetalSolution::update_instance] calls.
246 ///
247 /// # Example
248 /// ```
249 /// # use google_cloud_baremetalsolution_v2::builder::bare_metal_solution::UpdateInstance;
250 /// # async fn sample() -> google_cloud_baremetalsolution_v2::Result<()> {
251 /// use google_cloud_lro::Poller;
252 ///
253 /// let builder = prepare_request_builder();
254 /// let response = builder.poller().until_done().await?;
255 /// # Ok(()) }
256 ///
257 /// fn prepare_request_builder() -> UpdateInstance {
258 /// # panic!();
259 /// // ... details omitted ...
260 /// }
261 /// ```
262 #[derive(Clone, Debug)]
263 pub struct UpdateInstance(RequestBuilder<crate::model::UpdateInstanceRequest>);
264
265 impl UpdateInstance {
266 pub(crate) fn new(
267 stub: std::sync::Arc<dyn super::super::stub::dynamic::BareMetalSolution>,
268 ) -> Self {
269 Self(RequestBuilder::new(stub))
270 }
271
272 /// Sets the full request, replacing any prior values.
273 pub fn with_request<V: Into<crate::model::UpdateInstanceRequest>>(mut self, v: V) -> Self {
274 self.0.request = v.into();
275 self
276 }
277
278 /// Sets all the options, replacing any prior values.
279 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
280 self.0.options = v.into();
281 self
282 }
283
284 /// Sends the request.
285 ///
286 /// # Long running operations
287 ///
288 /// This starts, but does not poll, a longrunning operation. More information
289 /// on [update_instance][crate::client::BareMetalSolution::update_instance].
290 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
291 (*self.0.stub)
292 .update_instance(self.0.request, self.0.options)
293 .await
294 .map(crate::Response::into_body)
295 }
296
297 /// Creates a [Poller][google_cloud_lro::Poller] to work with `update_instance`.
298 pub fn poller(
299 self,
300 ) -> impl google_cloud_lro::Poller<crate::model::Instance, crate::model::OperationMetadata>
301 {
302 type Operation = google_cloud_lro::internal::Operation<
303 crate::model::Instance,
304 crate::model::OperationMetadata,
305 >;
306 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
307 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
308
309 let stub = self.0.stub.clone();
310 let mut options = self.0.options.clone();
311 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
312 let query = move |name| {
313 let stub = stub.clone();
314 let options = options.clone();
315 async {
316 let op = GetOperation::new(stub)
317 .set_name(name)
318 .with_options(options)
319 .send()
320 .await?;
321 Ok(Operation::new(op))
322 }
323 };
324
325 let start = move || async {
326 let op = self.send().await?;
327 Ok(Operation::new(op))
328 };
329
330 google_cloud_lro::internal::new_poller(
331 polling_error_policy,
332 polling_backoff_policy,
333 start,
334 query,
335 )
336 }
337
338 /// Sets the value of [instance][crate::model::UpdateInstanceRequest::instance].
339 ///
340 /// This is a **required** field for requests.
341 pub fn set_instance<T>(mut self, v: T) -> Self
342 where
343 T: std::convert::Into<crate::model::Instance>,
344 {
345 self.0.request.instance = std::option::Option::Some(v.into());
346 self
347 }
348
349 /// Sets or clears the value of [instance][crate::model::UpdateInstanceRequest::instance].
350 ///
351 /// This is a **required** field for requests.
352 pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
353 where
354 T: std::convert::Into<crate::model::Instance>,
355 {
356 self.0.request.instance = v.map(|x| x.into());
357 self
358 }
359
360 /// Sets the value of [update_mask][crate::model::UpdateInstanceRequest::update_mask].
361 pub fn set_update_mask<T>(mut self, v: T) -> Self
362 where
363 T: std::convert::Into<wkt::FieldMask>,
364 {
365 self.0.request.update_mask = std::option::Option::Some(v.into());
366 self
367 }
368
369 /// Sets or clears the value of [update_mask][crate::model::UpdateInstanceRequest::update_mask].
370 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
371 where
372 T: std::convert::Into<wkt::FieldMask>,
373 {
374 self.0.request.update_mask = v.map(|x| x.into());
375 self
376 }
377 }
378
379 #[doc(hidden)]
380 impl crate::RequestBuilder for UpdateInstance {
381 fn request_options(&mut self) -> &mut crate::RequestOptions {
382 &mut self.0.options
383 }
384 }
385
386 /// The request builder for [BareMetalSolution::rename_instance][crate::client::BareMetalSolution::rename_instance] calls.
387 ///
388 /// # Example
389 /// ```
390 /// # use google_cloud_baremetalsolution_v2::builder::bare_metal_solution::RenameInstance;
391 /// # async fn sample() -> google_cloud_baremetalsolution_v2::Result<()> {
392 ///
393 /// let builder = prepare_request_builder();
394 /// let response = builder.send().await?;
395 /// # Ok(()) }
396 ///
397 /// fn prepare_request_builder() -> RenameInstance {
398 /// # panic!();
399 /// // ... details omitted ...
400 /// }
401 /// ```
402 #[derive(Clone, Debug)]
403 pub struct RenameInstance(RequestBuilder<crate::model::RenameInstanceRequest>);
404
405 impl RenameInstance {
406 pub(crate) fn new(
407 stub: std::sync::Arc<dyn super::super::stub::dynamic::BareMetalSolution>,
408 ) -> Self {
409 Self(RequestBuilder::new(stub))
410 }
411
412 /// Sets the full request, replacing any prior values.
413 pub fn with_request<V: Into<crate::model::RenameInstanceRequest>>(mut self, v: V) -> Self {
414 self.0.request = v.into();
415 self
416 }
417
418 /// Sets all the options, replacing any prior values.
419 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
420 self.0.options = v.into();
421 self
422 }
423
424 /// Sends the request.
425 pub async fn send(self) -> Result<crate::model::Instance> {
426 (*self.0.stub)
427 .rename_instance(self.0.request, self.0.options)
428 .await
429 .map(crate::Response::into_body)
430 }
431
432 /// Sets the value of [name][crate::model::RenameInstanceRequest::name].
433 ///
434 /// This is a **required** field for requests.
435 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
436 self.0.request.name = v.into();
437 self
438 }
439
440 /// Sets the value of [new_instance_id][crate::model::RenameInstanceRequest::new_instance_id].
441 ///
442 /// This is a **required** field for requests.
443 pub fn set_new_instance_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
444 self.0.request.new_instance_id = v.into();
445 self
446 }
447 }
448
449 #[doc(hidden)]
450 impl crate::RequestBuilder for RenameInstance {
451 fn request_options(&mut self) -> &mut crate::RequestOptions {
452 &mut self.0.options
453 }
454 }
455
456 /// The request builder for [BareMetalSolution::reset_instance][crate::client::BareMetalSolution::reset_instance] calls.
457 ///
458 /// # Example
459 /// ```
460 /// # use google_cloud_baremetalsolution_v2::builder::bare_metal_solution::ResetInstance;
461 /// # async fn sample() -> google_cloud_baremetalsolution_v2::Result<()> {
462 /// use google_cloud_lro::Poller;
463 ///
464 /// let builder = prepare_request_builder();
465 /// let response = builder.poller().until_done().await?;
466 /// # Ok(()) }
467 ///
468 /// fn prepare_request_builder() -> ResetInstance {
469 /// # panic!();
470 /// // ... details omitted ...
471 /// }
472 /// ```
473 #[derive(Clone, Debug)]
474 pub struct ResetInstance(RequestBuilder<crate::model::ResetInstanceRequest>);
475
476 impl ResetInstance {
477 pub(crate) fn new(
478 stub: std::sync::Arc<dyn super::super::stub::dynamic::BareMetalSolution>,
479 ) -> Self {
480 Self(RequestBuilder::new(stub))
481 }
482
483 /// Sets the full request, replacing any prior values.
484 pub fn with_request<V: Into<crate::model::ResetInstanceRequest>>(mut self, v: V) -> Self {
485 self.0.request = v.into();
486 self
487 }
488
489 /// Sets all the options, replacing any prior values.
490 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
491 self.0.options = v.into();
492 self
493 }
494
495 /// Sends the request.
496 ///
497 /// # Long running operations
498 ///
499 /// This starts, but does not poll, a longrunning operation. More information
500 /// on [reset_instance][crate::client::BareMetalSolution::reset_instance].
501 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
502 (*self.0.stub)
503 .reset_instance(self.0.request, self.0.options)
504 .await
505 .map(crate::Response::into_body)
506 }
507
508 /// Creates a [Poller][google_cloud_lro::Poller] to work with `reset_instance`.
509 pub fn poller(
510 self,
511 ) -> impl google_cloud_lro::Poller<
512 crate::model::ResetInstanceResponse,
513 crate::model::OperationMetadata,
514 > {
515 type Operation = google_cloud_lro::internal::Operation<
516 crate::model::ResetInstanceResponse,
517 crate::model::OperationMetadata,
518 >;
519 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
520 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
521
522 let stub = self.0.stub.clone();
523 let mut options = self.0.options.clone();
524 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
525 let query = move |name| {
526 let stub = stub.clone();
527 let options = options.clone();
528 async {
529 let op = GetOperation::new(stub)
530 .set_name(name)
531 .with_options(options)
532 .send()
533 .await?;
534 Ok(Operation::new(op))
535 }
536 };
537
538 let start = move || async {
539 let op = self.send().await?;
540 Ok(Operation::new(op))
541 };
542
543 google_cloud_lro::internal::new_poller(
544 polling_error_policy,
545 polling_backoff_policy,
546 start,
547 query,
548 )
549 }
550
551 /// Sets the value of [name][crate::model::ResetInstanceRequest::name].
552 ///
553 /// This is a **required** field for requests.
554 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
555 self.0.request.name = v.into();
556 self
557 }
558 }
559
560 #[doc(hidden)]
561 impl crate::RequestBuilder for ResetInstance {
562 fn request_options(&mut self) -> &mut crate::RequestOptions {
563 &mut self.0.options
564 }
565 }
566
567 /// The request builder for [BareMetalSolution::start_instance][crate::client::BareMetalSolution::start_instance] calls.
568 ///
569 /// # Example
570 /// ```
571 /// # use google_cloud_baremetalsolution_v2::builder::bare_metal_solution::StartInstance;
572 /// # async fn sample() -> google_cloud_baremetalsolution_v2::Result<()> {
573 /// use google_cloud_lro::Poller;
574 ///
575 /// let builder = prepare_request_builder();
576 /// let response = builder.poller().until_done().await?;
577 /// # Ok(()) }
578 ///
579 /// fn prepare_request_builder() -> StartInstance {
580 /// # panic!();
581 /// // ... details omitted ...
582 /// }
583 /// ```
584 #[derive(Clone, Debug)]
585 pub struct StartInstance(RequestBuilder<crate::model::StartInstanceRequest>);
586
587 impl StartInstance {
588 pub(crate) fn new(
589 stub: std::sync::Arc<dyn super::super::stub::dynamic::BareMetalSolution>,
590 ) -> Self {
591 Self(RequestBuilder::new(stub))
592 }
593
594 /// Sets the full request, replacing any prior values.
595 pub fn with_request<V: Into<crate::model::StartInstanceRequest>>(mut self, v: V) -> Self {
596 self.0.request = v.into();
597 self
598 }
599
600 /// Sets all the options, replacing any prior values.
601 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
602 self.0.options = v.into();
603 self
604 }
605
606 /// Sends the request.
607 ///
608 /// # Long running operations
609 ///
610 /// This starts, but does not poll, a longrunning operation. More information
611 /// on [start_instance][crate::client::BareMetalSolution::start_instance].
612 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
613 (*self.0.stub)
614 .start_instance(self.0.request, self.0.options)
615 .await
616 .map(crate::Response::into_body)
617 }
618
619 /// Creates a [Poller][google_cloud_lro::Poller] to work with `start_instance`.
620 pub fn poller(
621 self,
622 ) -> impl google_cloud_lro::Poller<
623 crate::model::StartInstanceResponse,
624 crate::model::OperationMetadata,
625 > {
626 type Operation = google_cloud_lro::internal::Operation<
627 crate::model::StartInstanceResponse,
628 crate::model::OperationMetadata,
629 >;
630 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
631 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
632
633 let stub = self.0.stub.clone();
634 let mut options = self.0.options.clone();
635 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
636 let query = move |name| {
637 let stub = stub.clone();
638 let options = options.clone();
639 async {
640 let op = GetOperation::new(stub)
641 .set_name(name)
642 .with_options(options)
643 .send()
644 .await?;
645 Ok(Operation::new(op))
646 }
647 };
648
649 let start = move || async {
650 let op = self.send().await?;
651 Ok(Operation::new(op))
652 };
653
654 google_cloud_lro::internal::new_poller(
655 polling_error_policy,
656 polling_backoff_policy,
657 start,
658 query,
659 )
660 }
661
662 /// Sets the value of [name][crate::model::StartInstanceRequest::name].
663 ///
664 /// This is a **required** field for requests.
665 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
666 self.0.request.name = v.into();
667 self
668 }
669 }
670
671 #[doc(hidden)]
672 impl crate::RequestBuilder for StartInstance {
673 fn request_options(&mut self) -> &mut crate::RequestOptions {
674 &mut self.0.options
675 }
676 }
677
678 /// The request builder for [BareMetalSolution::stop_instance][crate::client::BareMetalSolution::stop_instance] calls.
679 ///
680 /// # Example
681 /// ```
682 /// # use google_cloud_baremetalsolution_v2::builder::bare_metal_solution::StopInstance;
683 /// # async fn sample() -> google_cloud_baremetalsolution_v2::Result<()> {
684 /// use google_cloud_lro::Poller;
685 ///
686 /// let builder = prepare_request_builder();
687 /// let response = builder.poller().until_done().await?;
688 /// # Ok(()) }
689 ///
690 /// fn prepare_request_builder() -> StopInstance {
691 /// # panic!();
692 /// // ... details omitted ...
693 /// }
694 /// ```
695 #[derive(Clone, Debug)]
696 pub struct StopInstance(RequestBuilder<crate::model::StopInstanceRequest>);
697
698 impl StopInstance {
699 pub(crate) fn new(
700 stub: std::sync::Arc<dyn super::super::stub::dynamic::BareMetalSolution>,
701 ) -> Self {
702 Self(RequestBuilder::new(stub))
703 }
704
705 /// Sets the full request, replacing any prior values.
706 pub fn with_request<V: Into<crate::model::StopInstanceRequest>>(mut self, v: V) -> Self {
707 self.0.request = v.into();
708 self
709 }
710
711 /// Sets all the options, replacing any prior values.
712 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
713 self.0.options = v.into();
714 self
715 }
716
717 /// Sends the request.
718 ///
719 /// # Long running operations
720 ///
721 /// This starts, but does not poll, a longrunning operation. More information
722 /// on [stop_instance][crate::client::BareMetalSolution::stop_instance].
723 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
724 (*self.0.stub)
725 .stop_instance(self.0.request, self.0.options)
726 .await
727 .map(crate::Response::into_body)
728 }
729
730 /// Creates a [Poller][google_cloud_lro::Poller] to work with `stop_instance`.
731 pub fn poller(
732 self,
733 ) -> impl google_cloud_lro::Poller<
734 crate::model::StopInstanceResponse,
735 crate::model::OperationMetadata,
736 > {
737 type Operation = google_cloud_lro::internal::Operation<
738 crate::model::StopInstanceResponse,
739 crate::model::OperationMetadata,
740 >;
741 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
742 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
743
744 let stub = self.0.stub.clone();
745 let mut options = self.0.options.clone();
746 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
747 let query = move |name| {
748 let stub = stub.clone();
749 let options = options.clone();
750 async {
751 let op = GetOperation::new(stub)
752 .set_name(name)
753 .with_options(options)
754 .send()
755 .await?;
756 Ok(Operation::new(op))
757 }
758 };
759
760 let start = move || async {
761 let op = self.send().await?;
762 Ok(Operation::new(op))
763 };
764
765 google_cloud_lro::internal::new_poller(
766 polling_error_policy,
767 polling_backoff_policy,
768 start,
769 query,
770 )
771 }
772
773 /// Sets the value of [name][crate::model::StopInstanceRequest::name].
774 ///
775 /// This is a **required** field for requests.
776 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
777 self.0.request.name = v.into();
778 self
779 }
780 }
781
782 #[doc(hidden)]
783 impl crate::RequestBuilder for StopInstance {
784 fn request_options(&mut self) -> &mut crate::RequestOptions {
785 &mut self.0.options
786 }
787 }
788
789 /// The request builder for [BareMetalSolution::enable_interactive_serial_console][crate::client::BareMetalSolution::enable_interactive_serial_console] calls.
790 ///
791 /// # Example
792 /// ```
793 /// # use google_cloud_baremetalsolution_v2::builder::bare_metal_solution::EnableInteractiveSerialConsole;
794 /// # async fn sample() -> google_cloud_baremetalsolution_v2::Result<()> {
795 /// use google_cloud_lro::Poller;
796 ///
797 /// let builder = prepare_request_builder();
798 /// let response = builder.poller().until_done().await?;
799 /// # Ok(()) }
800 ///
801 /// fn prepare_request_builder() -> EnableInteractiveSerialConsole {
802 /// # panic!();
803 /// // ... details omitted ...
804 /// }
805 /// ```
806 #[derive(Clone, Debug)]
807 pub struct EnableInteractiveSerialConsole(
808 RequestBuilder<crate::model::EnableInteractiveSerialConsoleRequest>,
809 );
810
811 impl EnableInteractiveSerialConsole {
812 pub(crate) fn new(
813 stub: std::sync::Arc<dyn super::super::stub::dynamic::BareMetalSolution>,
814 ) -> Self {
815 Self(RequestBuilder::new(stub))
816 }
817
818 /// Sets the full request, replacing any prior values.
819 pub fn with_request<V: Into<crate::model::EnableInteractiveSerialConsoleRequest>>(
820 mut self,
821 v: V,
822 ) -> Self {
823 self.0.request = v.into();
824 self
825 }
826
827 /// Sets all the options, replacing any prior values.
828 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
829 self.0.options = v.into();
830 self
831 }
832
833 /// Sends the request.
834 ///
835 /// # Long running operations
836 ///
837 /// This starts, but does not poll, a longrunning operation. More information
838 /// on [enable_interactive_serial_console][crate::client::BareMetalSolution::enable_interactive_serial_console].
839 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
840 (*self.0.stub)
841 .enable_interactive_serial_console(self.0.request, self.0.options)
842 .await
843 .map(crate::Response::into_body)
844 }
845
846 /// Creates a [Poller][google_cloud_lro::Poller] to work with `enable_interactive_serial_console`.
847 pub fn poller(
848 self,
849 ) -> impl google_cloud_lro::Poller<
850 crate::model::EnableInteractiveSerialConsoleResponse,
851 crate::model::OperationMetadata,
852 > {
853 type Operation = google_cloud_lro::internal::Operation<
854 crate::model::EnableInteractiveSerialConsoleResponse,
855 crate::model::OperationMetadata,
856 >;
857 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
858 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
859
860 let stub = self.0.stub.clone();
861 let mut options = self.0.options.clone();
862 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
863 let query = move |name| {
864 let stub = stub.clone();
865 let options = options.clone();
866 async {
867 let op = GetOperation::new(stub)
868 .set_name(name)
869 .with_options(options)
870 .send()
871 .await?;
872 Ok(Operation::new(op))
873 }
874 };
875
876 let start = move || async {
877 let op = self.send().await?;
878 Ok(Operation::new(op))
879 };
880
881 google_cloud_lro::internal::new_poller(
882 polling_error_policy,
883 polling_backoff_policy,
884 start,
885 query,
886 )
887 }
888
889 /// Sets the value of [name][crate::model::EnableInteractiveSerialConsoleRequest::name].
890 ///
891 /// This is a **required** field for requests.
892 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
893 self.0.request.name = v.into();
894 self
895 }
896 }
897
898 #[doc(hidden)]
899 impl crate::RequestBuilder for EnableInteractiveSerialConsole {
900 fn request_options(&mut self) -> &mut crate::RequestOptions {
901 &mut self.0.options
902 }
903 }
904
905 /// The request builder for [BareMetalSolution::disable_interactive_serial_console][crate::client::BareMetalSolution::disable_interactive_serial_console] calls.
906 ///
907 /// # Example
908 /// ```
909 /// # use google_cloud_baremetalsolution_v2::builder::bare_metal_solution::DisableInteractiveSerialConsole;
910 /// # async fn sample() -> google_cloud_baremetalsolution_v2::Result<()> {
911 /// use google_cloud_lro::Poller;
912 ///
913 /// let builder = prepare_request_builder();
914 /// let response = builder.poller().until_done().await?;
915 /// # Ok(()) }
916 ///
917 /// fn prepare_request_builder() -> DisableInteractiveSerialConsole {
918 /// # panic!();
919 /// // ... details omitted ...
920 /// }
921 /// ```
922 #[derive(Clone, Debug)]
923 pub struct DisableInteractiveSerialConsole(
924 RequestBuilder<crate::model::DisableInteractiveSerialConsoleRequest>,
925 );
926
927 impl DisableInteractiveSerialConsole {
928 pub(crate) fn new(
929 stub: std::sync::Arc<dyn super::super::stub::dynamic::BareMetalSolution>,
930 ) -> Self {
931 Self(RequestBuilder::new(stub))
932 }
933
934 /// Sets the full request, replacing any prior values.
935 pub fn with_request<V: Into<crate::model::DisableInteractiveSerialConsoleRequest>>(
936 mut self,
937 v: V,
938 ) -> Self {
939 self.0.request = v.into();
940 self
941 }
942
943 /// Sets all the options, replacing any prior values.
944 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
945 self.0.options = v.into();
946 self
947 }
948
949 /// Sends the request.
950 ///
951 /// # Long running operations
952 ///
953 /// This starts, but does not poll, a longrunning operation. More information
954 /// on [disable_interactive_serial_console][crate::client::BareMetalSolution::disable_interactive_serial_console].
955 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
956 (*self.0.stub)
957 .disable_interactive_serial_console(self.0.request, self.0.options)
958 .await
959 .map(crate::Response::into_body)
960 }
961
962 /// Creates a [Poller][google_cloud_lro::Poller] to work with `disable_interactive_serial_console`.
963 pub fn poller(
964 self,
965 ) -> impl google_cloud_lro::Poller<
966 crate::model::DisableInteractiveSerialConsoleResponse,
967 crate::model::OperationMetadata,
968 > {
969 type Operation = google_cloud_lro::internal::Operation<
970 crate::model::DisableInteractiveSerialConsoleResponse,
971 crate::model::OperationMetadata,
972 >;
973 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
974 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
975
976 let stub = self.0.stub.clone();
977 let mut options = self.0.options.clone();
978 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
979 let query = move |name| {
980 let stub = stub.clone();
981 let options = options.clone();
982 async {
983 let op = GetOperation::new(stub)
984 .set_name(name)
985 .with_options(options)
986 .send()
987 .await?;
988 Ok(Operation::new(op))
989 }
990 };
991
992 let start = move || async {
993 let op = self.send().await?;
994 Ok(Operation::new(op))
995 };
996
997 google_cloud_lro::internal::new_poller(
998 polling_error_policy,
999 polling_backoff_policy,
1000 start,
1001 query,
1002 )
1003 }
1004
1005 /// Sets the value of [name][crate::model::DisableInteractiveSerialConsoleRequest::name].
1006 ///
1007 /// This is a **required** field for requests.
1008 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1009 self.0.request.name = v.into();
1010 self
1011 }
1012 }
1013
1014 #[doc(hidden)]
1015 impl crate::RequestBuilder for DisableInteractiveSerialConsole {
1016 fn request_options(&mut self) -> &mut crate::RequestOptions {
1017 &mut self.0.options
1018 }
1019 }
1020
1021 /// The request builder for [BareMetalSolution::detach_lun][crate::client::BareMetalSolution::detach_lun] calls.
1022 ///
1023 /// # Example
1024 /// ```
1025 /// # use google_cloud_baremetalsolution_v2::builder::bare_metal_solution::DetachLun;
1026 /// # async fn sample() -> google_cloud_baremetalsolution_v2::Result<()> {
1027 /// use google_cloud_lro::Poller;
1028 ///
1029 /// let builder = prepare_request_builder();
1030 /// let response = builder.poller().until_done().await?;
1031 /// # Ok(()) }
1032 ///
1033 /// fn prepare_request_builder() -> DetachLun {
1034 /// # panic!();
1035 /// // ... details omitted ...
1036 /// }
1037 /// ```
1038 #[derive(Clone, Debug)]
1039 pub struct DetachLun(RequestBuilder<crate::model::DetachLunRequest>);
1040
1041 impl DetachLun {
1042 pub(crate) fn new(
1043 stub: std::sync::Arc<dyn super::super::stub::dynamic::BareMetalSolution>,
1044 ) -> Self {
1045 Self(RequestBuilder::new(stub))
1046 }
1047
1048 /// Sets the full request, replacing any prior values.
1049 pub fn with_request<V: Into<crate::model::DetachLunRequest>>(mut self, v: V) -> Self {
1050 self.0.request = v.into();
1051 self
1052 }
1053
1054 /// Sets all the options, replacing any prior values.
1055 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1056 self.0.options = v.into();
1057 self
1058 }
1059
1060 /// Sends the request.
1061 ///
1062 /// # Long running operations
1063 ///
1064 /// This starts, but does not poll, a longrunning operation. More information
1065 /// on [detach_lun][crate::client::BareMetalSolution::detach_lun].
1066 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1067 (*self.0.stub)
1068 .detach_lun(self.0.request, self.0.options)
1069 .await
1070 .map(crate::Response::into_body)
1071 }
1072
1073 /// Creates a [Poller][google_cloud_lro::Poller] to work with `detach_lun`.
1074 pub fn poller(
1075 self,
1076 ) -> impl google_cloud_lro::Poller<crate::model::Instance, crate::model::OperationMetadata>
1077 {
1078 type Operation = google_cloud_lro::internal::Operation<
1079 crate::model::Instance,
1080 crate::model::OperationMetadata,
1081 >;
1082 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1083 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1084
1085 let stub = self.0.stub.clone();
1086 let mut options = self.0.options.clone();
1087 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1088 let query = move |name| {
1089 let stub = stub.clone();
1090 let options = options.clone();
1091 async {
1092 let op = GetOperation::new(stub)
1093 .set_name(name)
1094 .with_options(options)
1095 .send()
1096 .await?;
1097 Ok(Operation::new(op))
1098 }
1099 };
1100
1101 let start = move || async {
1102 let op = self.send().await?;
1103 Ok(Operation::new(op))
1104 };
1105
1106 google_cloud_lro::internal::new_poller(
1107 polling_error_policy,
1108 polling_backoff_policy,
1109 start,
1110 query,
1111 )
1112 }
1113
1114 /// Sets the value of [instance][crate::model::DetachLunRequest::instance].
1115 ///
1116 /// This is a **required** field for requests.
1117 pub fn set_instance<T: Into<std::string::String>>(mut self, v: T) -> Self {
1118 self.0.request.instance = v.into();
1119 self
1120 }
1121
1122 /// Sets the value of [lun][crate::model::DetachLunRequest::lun].
1123 ///
1124 /// This is a **required** field for requests.
1125 pub fn set_lun<T: Into<std::string::String>>(mut self, v: T) -> Self {
1126 self.0.request.lun = v.into();
1127 self
1128 }
1129
1130 /// Sets the value of [skip_reboot][crate::model::DetachLunRequest::skip_reboot].
1131 pub fn set_skip_reboot<T: Into<bool>>(mut self, v: T) -> Self {
1132 self.0.request.skip_reboot = v.into();
1133 self
1134 }
1135 }
1136
1137 #[doc(hidden)]
1138 impl crate::RequestBuilder for DetachLun {
1139 fn request_options(&mut self) -> &mut crate::RequestOptions {
1140 &mut self.0.options
1141 }
1142 }
1143
1144 /// The request builder for [BareMetalSolution::list_ssh_keys][crate::client::BareMetalSolution::list_ssh_keys] calls.
1145 ///
1146 /// # Example
1147 /// ```
1148 /// # use google_cloud_baremetalsolution_v2::builder::bare_metal_solution::ListSSHKeys;
1149 /// # async fn sample() -> google_cloud_baremetalsolution_v2::Result<()> {
1150 /// use google_cloud_gax::paginator::ItemPaginator;
1151 ///
1152 /// let builder = prepare_request_builder();
1153 /// let mut items = builder.by_item();
1154 /// while let Some(result) = items.next().await {
1155 /// let item = result?;
1156 /// }
1157 /// # Ok(()) }
1158 ///
1159 /// fn prepare_request_builder() -> ListSSHKeys {
1160 /// # panic!();
1161 /// // ... details omitted ...
1162 /// }
1163 /// ```
1164 #[derive(Clone, Debug)]
1165 pub struct ListSSHKeys(RequestBuilder<crate::model::ListSSHKeysRequest>);
1166
1167 impl ListSSHKeys {
1168 pub(crate) fn new(
1169 stub: std::sync::Arc<dyn super::super::stub::dynamic::BareMetalSolution>,
1170 ) -> Self {
1171 Self(RequestBuilder::new(stub))
1172 }
1173
1174 /// Sets the full request, replacing any prior values.
1175 pub fn with_request<V: Into<crate::model::ListSSHKeysRequest>>(mut self, v: V) -> Self {
1176 self.0.request = v.into();
1177 self
1178 }
1179
1180 /// Sets all the options, replacing any prior values.
1181 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1182 self.0.options = v.into();
1183 self
1184 }
1185
1186 /// Sends the request.
1187 pub async fn send(self) -> Result<crate::model::ListSSHKeysResponse> {
1188 (*self.0.stub)
1189 .list_ssh_keys(self.0.request, self.0.options)
1190 .await
1191 .map(crate::Response::into_body)
1192 }
1193
1194 /// Streams each page in the collection.
1195 pub fn by_page(
1196 self,
1197 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListSSHKeysResponse, crate::Error>
1198 {
1199 use std::clone::Clone;
1200 let token = self.0.request.page_token.clone();
1201 let execute = move |token: String| {
1202 let mut builder = self.clone();
1203 builder.0.request = builder.0.request.set_page_token(token);
1204 builder.send()
1205 };
1206 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1207 }
1208
1209 /// Streams each item in the collection.
1210 pub fn by_item(
1211 self,
1212 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1213 crate::model::ListSSHKeysResponse,
1214 crate::Error,
1215 > {
1216 use google_cloud_gax::paginator::Paginator;
1217 self.by_page().items()
1218 }
1219
1220 /// Sets the value of [parent][crate::model::ListSSHKeysRequest::parent].
1221 ///
1222 /// This is a **required** field for requests.
1223 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1224 self.0.request.parent = v.into();
1225 self
1226 }
1227
1228 /// Sets the value of [page_size][crate::model::ListSSHKeysRequest::page_size].
1229 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1230 self.0.request.page_size = v.into();
1231 self
1232 }
1233
1234 /// Sets the value of [page_token][crate::model::ListSSHKeysRequest::page_token].
1235 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1236 self.0.request.page_token = v.into();
1237 self
1238 }
1239 }
1240
1241 #[doc(hidden)]
1242 impl crate::RequestBuilder for ListSSHKeys {
1243 fn request_options(&mut self) -> &mut crate::RequestOptions {
1244 &mut self.0.options
1245 }
1246 }
1247
1248 /// The request builder for [BareMetalSolution::create_ssh_key][crate::client::BareMetalSolution::create_ssh_key] calls.
1249 ///
1250 /// # Example
1251 /// ```
1252 /// # use google_cloud_baremetalsolution_v2::builder::bare_metal_solution::CreateSSHKey;
1253 /// # async fn sample() -> google_cloud_baremetalsolution_v2::Result<()> {
1254 ///
1255 /// let builder = prepare_request_builder();
1256 /// let response = builder.send().await?;
1257 /// # Ok(()) }
1258 ///
1259 /// fn prepare_request_builder() -> CreateSSHKey {
1260 /// # panic!();
1261 /// // ... details omitted ...
1262 /// }
1263 /// ```
1264 #[derive(Clone, Debug)]
1265 pub struct CreateSSHKey(RequestBuilder<crate::model::CreateSSHKeyRequest>);
1266
1267 impl CreateSSHKey {
1268 pub(crate) fn new(
1269 stub: std::sync::Arc<dyn super::super::stub::dynamic::BareMetalSolution>,
1270 ) -> Self {
1271 Self(RequestBuilder::new(stub))
1272 }
1273
1274 /// Sets the full request, replacing any prior values.
1275 pub fn with_request<V: Into<crate::model::CreateSSHKeyRequest>>(mut self, v: V) -> Self {
1276 self.0.request = v.into();
1277 self
1278 }
1279
1280 /// Sets all the options, replacing any prior values.
1281 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1282 self.0.options = v.into();
1283 self
1284 }
1285
1286 /// Sends the request.
1287 pub async fn send(self) -> Result<crate::model::SSHKey> {
1288 (*self.0.stub)
1289 .create_ssh_key(self.0.request, self.0.options)
1290 .await
1291 .map(crate::Response::into_body)
1292 }
1293
1294 /// Sets the value of [parent][crate::model::CreateSSHKeyRequest::parent].
1295 ///
1296 /// This is a **required** field for requests.
1297 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1298 self.0.request.parent = v.into();
1299 self
1300 }
1301
1302 /// Sets the value of [ssh_key][crate::model::CreateSSHKeyRequest::ssh_key].
1303 ///
1304 /// This is a **required** field for requests.
1305 pub fn set_ssh_key<T>(mut self, v: T) -> Self
1306 where
1307 T: std::convert::Into<crate::model::SSHKey>,
1308 {
1309 self.0.request.ssh_key = std::option::Option::Some(v.into());
1310 self
1311 }
1312
1313 /// Sets or clears the value of [ssh_key][crate::model::CreateSSHKeyRequest::ssh_key].
1314 ///
1315 /// This is a **required** field for requests.
1316 pub fn set_or_clear_ssh_key<T>(mut self, v: std::option::Option<T>) -> Self
1317 where
1318 T: std::convert::Into<crate::model::SSHKey>,
1319 {
1320 self.0.request.ssh_key = v.map(|x| x.into());
1321 self
1322 }
1323
1324 /// Sets the value of [ssh_key_id][crate::model::CreateSSHKeyRequest::ssh_key_id].
1325 ///
1326 /// This is a **required** field for requests.
1327 pub fn set_ssh_key_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1328 self.0.request.ssh_key_id = v.into();
1329 self
1330 }
1331 }
1332
1333 #[doc(hidden)]
1334 impl crate::RequestBuilder for CreateSSHKey {
1335 fn request_options(&mut self) -> &mut crate::RequestOptions {
1336 &mut self.0.options
1337 }
1338 }
1339
1340 /// The request builder for [BareMetalSolution::delete_ssh_key][crate::client::BareMetalSolution::delete_ssh_key] calls.
1341 ///
1342 /// # Example
1343 /// ```
1344 /// # use google_cloud_baremetalsolution_v2::builder::bare_metal_solution::DeleteSSHKey;
1345 /// # async fn sample() -> google_cloud_baremetalsolution_v2::Result<()> {
1346 ///
1347 /// let builder = prepare_request_builder();
1348 /// let response = builder.send().await?;
1349 /// # Ok(()) }
1350 ///
1351 /// fn prepare_request_builder() -> DeleteSSHKey {
1352 /// # panic!();
1353 /// // ... details omitted ...
1354 /// }
1355 /// ```
1356 #[derive(Clone, Debug)]
1357 pub struct DeleteSSHKey(RequestBuilder<crate::model::DeleteSSHKeyRequest>);
1358
1359 impl DeleteSSHKey {
1360 pub(crate) fn new(
1361 stub: std::sync::Arc<dyn super::super::stub::dynamic::BareMetalSolution>,
1362 ) -> Self {
1363 Self(RequestBuilder::new(stub))
1364 }
1365
1366 /// Sets the full request, replacing any prior values.
1367 pub fn with_request<V: Into<crate::model::DeleteSSHKeyRequest>>(mut self, v: V) -> Self {
1368 self.0.request = v.into();
1369 self
1370 }
1371
1372 /// Sets all the options, replacing any prior values.
1373 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1374 self.0.options = v.into();
1375 self
1376 }
1377
1378 /// Sends the request.
1379 pub async fn send(self) -> Result<()> {
1380 (*self.0.stub)
1381 .delete_ssh_key(self.0.request, self.0.options)
1382 .await
1383 .map(crate::Response::into_body)
1384 }
1385
1386 /// Sets the value of [name][crate::model::DeleteSSHKeyRequest::name].
1387 ///
1388 /// This is a **required** field for requests.
1389 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1390 self.0.request.name = v.into();
1391 self
1392 }
1393 }
1394
1395 #[doc(hidden)]
1396 impl crate::RequestBuilder for DeleteSSHKey {
1397 fn request_options(&mut self) -> &mut crate::RequestOptions {
1398 &mut self.0.options
1399 }
1400 }
1401
1402 /// The request builder for [BareMetalSolution::list_volumes][crate::client::BareMetalSolution::list_volumes] calls.
1403 ///
1404 /// # Example
1405 /// ```
1406 /// # use google_cloud_baremetalsolution_v2::builder::bare_metal_solution::ListVolumes;
1407 /// # async fn sample() -> google_cloud_baremetalsolution_v2::Result<()> {
1408 /// use google_cloud_gax::paginator::ItemPaginator;
1409 ///
1410 /// let builder = prepare_request_builder();
1411 /// let mut items = builder.by_item();
1412 /// while let Some(result) = items.next().await {
1413 /// let item = result?;
1414 /// }
1415 /// # Ok(()) }
1416 ///
1417 /// fn prepare_request_builder() -> ListVolumes {
1418 /// # panic!();
1419 /// // ... details omitted ...
1420 /// }
1421 /// ```
1422 #[derive(Clone, Debug)]
1423 pub struct ListVolumes(RequestBuilder<crate::model::ListVolumesRequest>);
1424
1425 impl ListVolumes {
1426 pub(crate) fn new(
1427 stub: std::sync::Arc<dyn super::super::stub::dynamic::BareMetalSolution>,
1428 ) -> Self {
1429 Self(RequestBuilder::new(stub))
1430 }
1431
1432 /// Sets the full request, replacing any prior values.
1433 pub fn with_request<V: Into<crate::model::ListVolumesRequest>>(mut self, v: V) -> Self {
1434 self.0.request = v.into();
1435 self
1436 }
1437
1438 /// Sets all the options, replacing any prior values.
1439 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1440 self.0.options = v.into();
1441 self
1442 }
1443
1444 /// Sends the request.
1445 pub async fn send(self) -> Result<crate::model::ListVolumesResponse> {
1446 (*self.0.stub)
1447 .list_volumes(self.0.request, self.0.options)
1448 .await
1449 .map(crate::Response::into_body)
1450 }
1451
1452 /// Streams each page in the collection.
1453 pub fn by_page(
1454 self,
1455 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListVolumesResponse, crate::Error>
1456 {
1457 use std::clone::Clone;
1458 let token = self.0.request.page_token.clone();
1459 let execute = move |token: String| {
1460 let mut builder = self.clone();
1461 builder.0.request = builder.0.request.set_page_token(token);
1462 builder.send()
1463 };
1464 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1465 }
1466
1467 /// Streams each item in the collection.
1468 pub fn by_item(
1469 self,
1470 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1471 crate::model::ListVolumesResponse,
1472 crate::Error,
1473 > {
1474 use google_cloud_gax::paginator::Paginator;
1475 self.by_page().items()
1476 }
1477
1478 /// Sets the value of [parent][crate::model::ListVolumesRequest::parent].
1479 ///
1480 /// This is a **required** field for requests.
1481 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1482 self.0.request.parent = v.into();
1483 self
1484 }
1485
1486 /// Sets the value of [page_size][crate::model::ListVolumesRequest::page_size].
1487 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1488 self.0.request.page_size = v.into();
1489 self
1490 }
1491
1492 /// Sets the value of [page_token][crate::model::ListVolumesRequest::page_token].
1493 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1494 self.0.request.page_token = v.into();
1495 self
1496 }
1497
1498 /// Sets the value of [filter][crate::model::ListVolumesRequest::filter].
1499 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1500 self.0.request.filter = v.into();
1501 self
1502 }
1503 }
1504
1505 #[doc(hidden)]
1506 impl crate::RequestBuilder for ListVolumes {
1507 fn request_options(&mut self) -> &mut crate::RequestOptions {
1508 &mut self.0.options
1509 }
1510 }
1511
1512 /// The request builder for [BareMetalSolution::get_volume][crate::client::BareMetalSolution::get_volume] calls.
1513 ///
1514 /// # Example
1515 /// ```
1516 /// # use google_cloud_baremetalsolution_v2::builder::bare_metal_solution::GetVolume;
1517 /// # async fn sample() -> google_cloud_baremetalsolution_v2::Result<()> {
1518 ///
1519 /// let builder = prepare_request_builder();
1520 /// let response = builder.send().await?;
1521 /// # Ok(()) }
1522 ///
1523 /// fn prepare_request_builder() -> GetVolume {
1524 /// # panic!();
1525 /// // ... details omitted ...
1526 /// }
1527 /// ```
1528 #[derive(Clone, Debug)]
1529 pub struct GetVolume(RequestBuilder<crate::model::GetVolumeRequest>);
1530
1531 impl GetVolume {
1532 pub(crate) fn new(
1533 stub: std::sync::Arc<dyn super::super::stub::dynamic::BareMetalSolution>,
1534 ) -> Self {
1535 Self(RequestBuilder::new(stub))
1536 }
1537
1538 /// Sets the full request, replacing any prior values.
1539 pub fn with_request<V: Into<crate::model::GetVolumeRequest>>(mut self, v: V) -> Self {
1540 self.0.request = v.into();
1541 self
1542 }
1543
1544 /// Sets all the options, replacing any prior values.
1545 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1546 self.0.options = v.into();
1547 self
1548 }
1549
1550 /// Sends the request.
1551 pub async fn send(self) -> Result<crate::model::Volume> {
1552 (*self.0.stub)
1553 .get_volume(self.0.request, self.0.options)
1554 .await
1555 .map(crate::Response::into_body)
1556 }
1557
1558 /// Sets the value of [name][crate::model::GetVolumeRequest::name].
1559 ///
1560 /// This is a **required** field for requests.
1561 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1562 self.0.request.name = v.into();
1563 self
1564 }
1565 }
1566
1567 #[doc(hidden)]
1568 impl crate::RequestBuilder for GetVolume {
1569 fn request_options(&mut self) -> &mut crate::RequestOptions {
1570 &mut self.0.options
1571 }
1572 }
1573
1574 /// The request builder for [BareMetalSolution::update_volume][crate::client::BareMetalSolution::update_volume] calls.
1575 ///
1576 /// # Example
1577 /// ```
1578 /// # use google_cloud_baremetalsolution_v2::builder::bare_metal_solution::UpdateVolume;
1579 /// # async fn sample() -> google_cloud_baremetalsolution_v2::Result<()> {
1580 /// use google_cloud_lro::Poller;
1581 ///
1582 /// let builder = prepare_request_builder();
1583 /// let response = builder.poller().until_done().await?;
1584 /// # Ok(()) }
1585 ///
1586 /// fn prepare_request_builder() -> UpdateVolume {
1587 /// # panic!();
1588 /// // ... details omitted ...
1589 /// }
1590 /// ```
1591 #[derive(Clone, Debug)]
1592 pub struct UpdateVolume(RequestBuilder<crate::model::UpdateVolumeRequest>);
1593
1594 impl UpdateVolume {
1595 pub(crate) fn new(
1596 stub: std::sync::Arc<dyn super::super::stub::dynamic::BareMetalSolution>,
1597 ) -> Self {
1598 Self(RequestBuilder::new(stub))
1599 }
1600
1601 /// Sets the full request, replacing any prior values.
1602 pub fn with_request<V: Into<crate::model::UpdateVolumeRequest>>(mut self, v: V) -> Self {
1603 self.0.request = v.into();
1604 self
1605 }
1606
1607 /// Sets all the options, replacing any prior values.
1608 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1609 self.0.options = v.into();
1610 self
1611 }
1612
1613 /// Sends the request.
1614 ///
1615 /// # Long running operations
1616 ///
1617 /// This starts, but does not poll, a longrunning operation. More information
1618 /// on [update_volume][crate::client::BareMetalSolution::update_volume].
1619 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1620 (*self.0.stub)
1621 .update_volume(self.0.request, self.0.options)
1622 .await
1623 .map(crate::Response::into_body)
1624 }
1625
1626 /// Creates a [Poller][google_cloud_lro::Poller] to work with `update_volume`.
1627 pub fn poller(
1628 self,
1629 ) -> impl google_cloud_lro::Poller<crate::model::Volume, crate::model::OperationMetadata>
1630 {
1631 type Operation = google_cloud_lro::internal::Operation<
1632 crate::model::Volume,
1633 crate::model::OperationMetadata,
1634 >;
1635 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1636 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1637
1638 let stub = self.0.stub.clone();
1639 let mut options = self.0.options.clone();
1640 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1641 let query = move |name| {
1642 let stub = stub.clone();
1643 let options = options.clone();
1644 async {
1645 let op = GetOperation::new(stub)
1646 .set_name(name)
1647 .with_options(options)
1648 .send()
1649 .await?;
1650 Ok(Operation::new(op))
1651 }
1652 };
1653
1654 let start = move || async {
1655 let op = self.send().await?;
1656 Ok(Operation::new(op))
1657 };
1658
1659 google_cloud_lro::internal::new_poller(
1660 polling_error_policy,
1661 polling_backoff_policy,
1662 start,
1663 query,
1664 )
1665 }
1666
1667 /// Sets the value of [volume][crate::model::UpdateVolumeRequest::volume].
1668 ///
1669 /// This is a **required** field for requests.
1670 pub fn set_volume<T>(mut self, v: T) -> Self
1671 where
1672 T: std::convert::Into<crate::model::Volume>,
1673 {
1674 self.0.request.volume = std::option::Option::Some(v.into());
1675 self
1676 }
1677
1678 /// Sets or clears the value of [volume][crate::model::UpdateVolumeRequest::volume].
1679 ///
1680 /// This is a **required** field for requests.
1681 pub fn set_or_clear_volume<T>(mut self, v: std::option::Option<T>) -> Self
1682 where
1683 T: std::convert::Into<crate::model::Volume>,
1684 {
1685 self.0.request.volume = v.map(|x| x.into());
1686 self
1687 }
1688
1689 /// Sets the value of [update_mask][crate::model::UpdateVolumeRequest::update_mask].
1690 pub fn set_update_mask<T>(mut self, v: T) -> Self
1691 where
1692 T: std::convert::Into<wkt::FieldMask>,
1693 {
1694 self.0.request.update_mask = std::option::Option::Some(v.into());
1695 self
1696 }
1697
1698 /// Sets or clears the value of [update_mask][crate::model::UpdateVolumeRequest::update_mask].
1699 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1700 where
1701 T: std::convert::Into<wkt::FieldMask>,
1702 {
1703 self.0.request.update_mask = v.map(|x| x.into());
1704 self
1705 }
1706 }
1707
1708 #[doc(hidden)]
1709 impl crate::RequestBuilder for UpdateVolume {
1710 fn request_options(&mut self) -> &mut crate::RequestOptions {
1711 &mut self.0.options
1712 }
1713 }
1714
1715 /// The request builder for [BareMetalSolution::rename_volume][crate::client::BareMetalSolution::rename_volume] calls.
1716 ///
1717 /// # Example
1718 /// ```
1719 /// # use google_cloud_baremetalsolution_v2::builder::bare_metal_solution::RenameVolume;
1720 /// # async fn sample() -> google_cloud_baremetalsolution_v2::Result<()> {
1721 ///
1722 /// let builder = prepare_request_builder();
1723 /// let response = builder.send().await?;
1724 /// # Ok(()) }
1725 ///
1726 /// fn prepare_request_builder() -> RenameVolume {
1727 /// # panic!();
1728 /// // ... details omitted ...
1729 /// }
1730 /// ```
1731 #[derive(Clone, Debug)]
1732 pub struct RenameVolume(RequestBuilder<crate::model::RenameVolumeRequest>);
1733
1734 impl RenameVolume {
1735 pub(crate) fn new(
1736 stub: std::sync::Arc<dyn super::super::stub::dynamic::BareMetalSolution>,
1737 ) -> Self {
1738 Self(RequestBuilder::new(stub))
1739 }
1740
1741 /// Sets the full request, replacing any prior values.
1742 pub fn with_request<V: Into<crate::model::RenameVolumeRequest>>(mut self, v: V) -> Self {
1743 self.0.request = v.into();
1744 self
1745 }
1746
1747 /// Sets all the options, replacing any prior values.
1748 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1749 self.0.options = v.into();
1750 self
1751 }
1752
1753 /// Sends the request.
1754 pub async fn send(self) -> Result<crate::model::Volume> {
1755 (*self.0.stub)
1756 .rename_volume(self.0.request, self.0.options)
1757 .await
1758 .map(crate::Response::into_body)
1759 }
1760
1761 /// Sets the value of [name][crate::model::RenameVolumeRequest::name].
1762 ///
1763 /// This is a **required** field for requests.
1764 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1765 self.0.request.name = v.into();
1766 self
1767 }
1768
1769 /// Sets the value of [new_volume_id][crate::model::RenameVolumeRequest::new_volume_id].
1770 ///
1771 /// This is a **required** field for requests.
1772 pub fn set_new_volume_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1773 self.0.request.new_volume_id = v.into();
1774 self
1775 }
1776 }
1777
1778 #[doc(hidden)]
1779 impl crate::RequestBuilder for RenameVolume {
1780 fn request_options(&mut self) -> &mut crate::RequestOptions {
1781 &mut self.0.options
1782 }
1783 }
1784
1785 /// The request builder for [BareMetalSolution::evict_volume][crate::client::BareMetalSolution::evict_volume] calls.
1786 ///
1787 /// # Example
1788 /// ```
1789 /// # use google_cloud_baremetalsolution_v2::builder::bare_metal_solution::EvictVolume;
1790 /// # async fn sample() -> google_cloud_baremetalsolution_v2::Result<()> {
1791 /// use google_cloud_lro::Poller;
1792 ///
1793 /// let builder = prepare_request_builder();
1794 /// let response = builder.poller().until_done().await?;
1795 /// # Ok(()) }
1796 ///
1797 /// fn prepare_request_builder() -> EvictVolume {
1798 /// # panic!();
1799 /// // ... details omitted ...
1800 /// }
1801 /// ```
1802 #[derive(Clone, Debug)]
1803 pub struct EvictVolume(RequestBuilder<crate::model::EvictVolumeRequest>);
1804
1805 impl EvictVolume {
1806 pub(crate) fn new(
1807 stub: std::sync::Arc<dyn super::super::stub::dynamic::BareMetalSolution>,
1808 ) -> Self {
1809 Self(RequestBuilder::new(stub))
1810 }
1811
1812 /// Sets the full request, replacing any prior values.
1813 pub fn with_request<V: Into<crate::model::EvictVolumeRequest>>(mut self, v: V) -> Self {
1814 self.0.request = v.into();
1815 self
1816 }
1817
1818 /// Sets all the options, replacing any prior values.
1819 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1820 self.0.options = v.into();
1821 self
1822 }
1823
1824 /// Sends the request.
1825 ///
1826 /// # Long running operations
1827 ///
1828 /// This starts, but does not poll, a longrunning operation. More information
1829 /// on [evict_volume][crate::client::BareMetalSolution::evict_volume].
1830 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1831 (*self.0.stub)
1832 .evict_volume(self.0.request, self.0.options)
1833 .await
1834 .map(crate::Response::into_body)
1835 }
1836
1837 /// Creates a [Poller][google_cloud_lro::Poller] to work with `evict_volume`.
1838 pub fn poller(self) -> impl google_cloud_lro::Poller<(), crate::model::OperationMetadata> {
1839 type Operation =
1840 google_cloud_lro::internal::Operation<wkt::Empty, crate::model::OperationMetadata>;
1841 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1842 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1843
1844 let stub = self.0.stub.clone();
1845 let mut options = self.0.options.clone();
1846 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1847 let query = move |name| {
1848 let stub = stub.clone();
1849 let options = options.clone();
1850 async {
1851 let op = GetOperation::new(stub)
1852 .set_name(name)
1853 .with_options(options)
1854 .send()
1855 .await?;
1856 Ok(Operation::new(op))
1857 }
1858 };
1859
1860 let start = move || async {
1861 let op = self.send().await?;
1862 Ok(Operation::new(op))
1863 };
1864
1865 google_cloud_lro::internal::new_unit_response_poller(
1866 polling_error_policy,
1867 polling_backoff_policy,
1868 start,
1869 query,
1870 )
1871 }
1872
1873 /// Sets the value of [name][crate::model::EvictVolumeRequest::name].
1874 ///
1875 /// This is a **required** field for requests.
1876 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1877 self.0.request.name = v.into();
1878 self
1879 }
1880 }
1881
1882 #[doc(hidden)]
1883 impl crate::RequestBuilder for EvictVolume {
1884 fn request_options(&mut self) -> &mut crate::RequestOptions {
1885 &mut self.0.options
1886 }
1887 }
1888
1889 /// The request builder for [BareMetalSolution::resize_volume][crate::client::BareMetalSolution::resize_volume] calls.
1890 ///
1891 /// # Example
1892 /// ```
1893 /// # use google_cloud_baremetalsolution_v2::builder::bare_metal_solution::ResizeVolume;
1894 /// # async fn sample() -> google_cloud_baremetalsolution_v2::Result<()> {
1895 /// use google_cloud_lro::Poller;
1896 ///
1897 /// let builder = prepare_request_builder();
1898 /// let response = builder.poller().until_done().await?;
1899 /// # Ok(()) }
1900 ///
1901 /// fn prepare_request_builder() -> ResizeVolume {
1902 /// # panic!();
1903 /// // ... details omitted ...
1904 /// }
1905 /// ```
1906 #[derive(Clone, Debug)]
1907 pub struct ResizeVolume(RequestBuilder<crate::model::ResizeVolumeRequest>);
1908
1909 impl ResizeVolume {
1910 pub(crate) fn new(
1911 stub: std::sync::Arc<dyn super::super::stub::dynamic::BareMetalSolution>,
1912 ) -> Self {
1913 Self(RequestBuilder::new(stub))
1914 }
1915
1916 /// Sets the full request, replacing any prior values.
1917 pub fn with_request<V: Into<crate::model::ResizeVolumeRequest>>(mut self, v: V) -> Self {
1918 self.0.request = v.into();
1919 self
1920 }
1921
1922 /// Sets all the options, replacing any prior values.
1923 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1924 self.0.options = v.into();
1925 self
1926 }
1927
1928 /// Sends the request.
1929 ///
1930 /// # Long running operations
1931 ///
1932 /// This starts, but does not poll, a longrunning operation. More information
1933 /// on [resize_volume][crate::client::BareMetalSolution::resize_volume].
1934 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1935 (*self.0.stub)
1936 .resize_volume(self.0.request, self.0.options)
1937 .await
1938 .map(crate::Response::into_body)
1939 }
1940
1941 /// Creates a [Poller][google_cloud_lro::Poller] to work with `resize_volume`.
1942 pub fn poller(
1943 self,
1944 ) -> impl google_cloud_lro::Poller<crate::model::Volume, crate::model::OperationMetadata>
1945 {
1946 type Operation = google_cloud_lro::internal::Operation<
1947 crate::model::Volume,
1948 crate::model::OperationMetadata,
1949 >;
1950 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1951 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1952
1953 let stub = self.0.stub.clone();
1954 let mut options = self.0.options.clone();
1955 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1956 let query = move |name| {
1957 let stub = stub.clone();
1958 let options = options.clone();
1959 async {
1960 let op = GetOperation::new(stub)
1961 .set_name(name)
1962 .with_options(options)
1963 .send()
1964 .await?;
1965 Ok(Operation::new(op))
1966 }
1967 };
1968
1969 let start = move || async {
1970 let op = self.send().await?;
1971 Ok(Operation::new(op))
1972 };
1973
1974 google_cloud_lro::internal::new_poller(
1975 polling_error_policy,
1976 polling_backoff_policy,
1977 start,
1978 query,
1979 )
1980 }
1981
1982 /// Sets the value of [volume][crate::model::ResizeVolumeRequest::volume].
1983 ///
1984 /// This is a **required** field for requests.
1985 pub fn set_volume<T: Into<std::string::String>>(mut self, v: T) -> Self {
1986 self.0.request.volume = v.into();
1987 self
1988 }
1989
1990 /// Sets the value of [size_gib][crate::model::ResizeVolumeRequest::size_gib].
1991 pub fn set_size_gib<T: Into<i64>>(mut self, v: T) -> Self {
1992 self.0.request.size_gib = v.into();
1993 self
1994 }
1995 }
1996
1997 #[doc(hidden)]
1998 impl crate::RequestBuilder for ResizeVolume {
1999 fn request_options(&mut self) -> &mut crate::RequestOptions {
2000 &mut self.0.options
2001 }
2002 }
2003
2004 /// The request builder for [BareMetalSolution::list_networks][crate::client::BareMetalSolution::list_networks] calls.
2005 ///
2006 /// # Example
2007 /// ```
2008 /// # use google_cloud_baremetalsolution_v2::builder::bare_metal_solution::ListNetworks;
2009 /// # async fn sample() -> google_cloud_baremetalsolution_v2::Result<()> {
2010 /// use google_cloud_gax::paginator::ItemPaginator;
2011 ///
2012 /// let builder = prepare_request_builder();
2013 /// let mut items = builder.by_item();
2014 /// while let Some(result) = items.next().await {
2015 /// let item = result?;
2016 /// }
2017 /// # Ok(()) }
2018 ///
2019 /// fn prepare_request_builder() -> ListNetworks {
2020 /// # panic!();
2021 /// // ... details omitted ...
2022 /// }
2023 /// ```
2024 #[derive(Clone, Debug)]
2025 pub struct ListNetworks(RequestBuilder<crate::model::ListNetworksRequest>);
2026
2027 impl ListNetworks {
2028 pub(crate) fn new(
2029 stub: std::sync::Arc<dyn super::super::stub::dynamic::BareMetalSolution>,
2030 ) -> Self {
2031 Self(RequestBuilder::new(stub))
2032 }
2033
2034 /// Sets the full request, replacing any prior values.
2035 pub fn with_request<V: Into<crate::model::ListNetworksRequest>>(mut self, v: V) -> Self {
2036 self.0.request = v.into();
2037 self
2038 }
2039
2040 /// Sets all the options, replacing any prior values.
2041 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2042 self.0.options = v.into();
2043 self
2044 }
2045
2046 /// Sends the request.
2047 pub async fn send(self) -> Result<crate::model::ListNetworksResponse> {
2048 (*self.0.stub)
2049 .list_networks(self.0.request, self.0.options)
2050 .await
2051 .map(crate::Response::into_body)
2052 }
2053
2054 /// Streams each page in the collection.
2055 pub fn by_page(
2056 self,
2057 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListNetworksResponse, crate::Error>
2058 {
2059 use std::clone::Clone;
2060 let token = self.0.request.page_token.clone();
2061 let execute = move |token: String| {
2062 let mut builder = self.clone();
2063 builder.0.request = builder.0.request.set_page_token(token);
2064 builder.send()
2065 };
2066 google_cloud_gax::paginator::internal::new_paginator(token, execute)
2067 }
2068
2069 /// Streams each item in the collection.
2070 pub fn by_item(
2071 self,
2072 ) -> impl google_cloud_gax::paginator::ItemPaginator<
2073 crate::model::ListNetworksResponse,
2074 crate::Error,
2075 > {
2076 use google_cloud_gax::paginator::Paginator;
2077 self.by_page().items()
2078 }
2079
2080 /// Sets the value of [parent][crate::model::ListNetworksRequest::parent].
2081 ///
2082 /// This is a **required** field for requests.
2083 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2084 self.0.request.parent = v.into();
2085 self
2086 }
2087
2088 /// Sets the value of [page_size][crate::model::ListNetworksRequest::page_size].
2089 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2090 self.0.request.page_size = v.into();
2091 self
2092 }
2093
2094 /// Sets the value of [page_token][crate::model::ListNetworksRequest::page_token].
2095 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2096 self.0.request.page_token = v.into();
2097 self
2098 }
2099
2100 /// Sets the value of [filter][crate::model::ListNetworksRequest::filter].
2101 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2102 self.0.request.filter = v.into();
2103 self
2104 }
2105 }
2106
2107 #[doc(hidden)]
2108 impl crate::RequestBuilder for ListNetworks {
2109 fn request_options(&mut self) -> &mut crate::RequestOptions {
2110 &mut self.0.options
2111 }
2112 }
2113
2114 /// The request builder for [BareMetalSolution::list_network_usage][crate::client::BareMetalSolution::list_network_usage] calls.
2115 ///
2116 /// # Example
2117 /// ```
2118 /// # use google_cloud_baremetalsolution_v2::builder::bare_metal_solution::ListNetworkUsage;
2119 /// # async fn sample() -> google_cloud_baremetalsolution_v2::Result<()> {
2120 ///
2121 /// let builder = prepare_request_builder();
2122 /// let response = builder.send().await?;
2123 /// # Ok(()) }
2124 ///
2125 /// fn prepare_request_builder() -> ListNetworkUsage {
2126 /// # panic!();
2127 /// // ... details omitted ...
2128 /// }
2129 /// ```
2130 #[derive(Clone, Debug)]
2131 pub struct ListNetworkUsage(RequestBuilder<crate::model::ListNetworkUsageRequest>);
2132
2133 impl ListNetworkUsage {
2134 pub(crate) fn new(
2135 stub: std::sync::Arc<dyn super::super::stub::dynamic::BareMetalSolution>,
2136 ) -> Self {
2137 Self(RequestBuilder::new(stub))
2138 }
2139
2140 /// Sets the full request, replacing any prior values.
2141 pub fn with_request<V: Into<crate::model::ListNetworkUsageRequest>>(
2142 mut self,
2143 v: V,
2144 ) -> Self {
2145 self.0.request = v.into();
2146 self
2147 }
2148
2149 /// Sets all the options, replacing any prior values.
2150 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2151 self.0.options = v.into();
2152 self
2153 }
2154
2155 /// Sends the request.
2156 pub async fn send(self) -> Result<crate::model::ListNetworkUsageResponse> {
2157 (*self.0.stub)
2158 .list_network_usage(self.0.request, self.0.options)
2159 .await
2160 .map(crate::Response::into_body)
2161 }
2162
2163 /// Sets the value of [location][crate::model::ListNetworkUsageRequest::location].
2164 ///
2165 /// This is a **required** field for requests.
2166 pub fn set_location<T: Into<std::string::String>>(mut self, v: T) -> Self {
2167 self.0.request.location = v.into();
2168 self
2169 }
2170 }
2171
2172 #[doc(hidden)]
2173 impl crate::RequestBuilder for ListNetworkUsage {
2174 fn request_options(&mut self) -> &mut crate::RequestOptions {
2175 &mut self.0.options
2176 }
2177 }
2178
2179 /// The request builder for [BareMetalSolution::get_network][crate::client::BareMetalSolution::get_network] calls.
2180 ///
2181 /// # Example
2182 /// ```
2183 /// # use google_cloud_baremetalsolution_v2::builder::bare_metal_solution::GetNetwork;
2184 /// # async fn sample() -> google_cloud_baremetalsolution_v2::Result<()> {
2185 ///
2186 /// let builder = prepare_request_builder();
2187 /// let response = builder.send().await?;
2188 /// # Ok(()) }
2189 ///
2190 /// fn prepare_request_builder() -> GetNetwork {
2191 /// # panic!();
2192 /// // ... details omitted ...
2193 /// }
2194 /// ```
2195 #[derive(Clone, Debug)]
2196 pub struct GetNetwork(RequestBuilder<crate::model::GetNetworkRequest>);
2197
2198 impl GetNetwork {
2199 pub(crate) fn new(
2200 stub: std::sync::Arc<dyn super::super::stub::dynamic::BareMetalSolution>,
2201 ) -> Self {
2202 Self(RequestBuilder::new(stub))
2203 }
2204
2205 /// Sets the full request, replacing any prior values.
2206 pub fn with_request<V: Into<crate::model::GetNetworkRequest>>(mut self, v: V) -> Self {
2207 self.0.request = v.into();
2208 self
2209 }
2210
2211 /// Sets all the options, replacing any prior values.
2212 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2213 self.0.options = v.into();
2214 self
2215 }
2216
2217 /// Sends the request.
2218 pub async fn send(self) -> Result<crate::model::Network> {
2219 (*self.0.stub)
2220 .get_network(self.0.request, self.0.options)
2221 .await
2222 .map(crate::Response::into_body)
2223 }
2224
2225 /// Sets the value of [name][crate::model::GetNetworkRequest::name].
2226 ///
2227 /// This is a **required** field for requests.
2228 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2229 self.0.request.name = v.into();
2230 self
2231 }
2232 }
2233
2234 #[doc(hidden)]
2235 impl crate::RequestBuilder for GetNetwork {
2236 fn request_options(&mut self) -> &mut crate::RequestOptions {
2237 &mut self.0.options
2238 }
2239 }
2240
2241 /// The request builder for [BareMetalSolution::update_network][crate::client::BareMetalSolution::update_network] calls.
2242 ///
2243 /// # Example
2244 /// ```
2245 /// # use google_cloud_baremetalsolution_v2::builder::bare_metal_solution::UpdateNetwork;
2246 /// # async fn sample() -> google_cloud_baremetalsolution_v2::Result<()> {
2247 /// use google_cloud_lro::Poller;
2248 ///
2249 /// let builder = prepare_request_builder();
2250 /// let response = builder.poller().until_done().await?;
2251 /// # Ok(()) }
2252 ///
2253 /// fn prepare_request_builder() -> UpdateNetwork {
2254 /// # panic!();
2255 /// // ... details omitted ...
2256 /// }
2257 /// ```
2258 #[derive(Clone, Debug)]
2259 pub struct UpdateNetwork(RequestBuilder<crate::model::UpdateNetworkRequest>);
2260
2261 impl UpdateNetwork {
2262 pub(crate) fn new(
2263 stub: std::sync::Arc<dyn super::super::stub::dynamic::BareMetalSolution>,
2264 ) -> Self {
2265 Self(RequestBuilder::new(stub))
2266 }
2267
2268 /// Sets the full request, replacing any prior values.
2269 pub fn with_request<V: Into<crate::model::UpdateNetworkRequest>>(mut self, v: V) -> Self {
2270 self.0.request = v.into();
2271 self
2272 }
2273
2274 /// Sets all the options, replacing any prior values.
2275 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2276 self.0.options = v.into();
2277 self
2278 }
2279
2280 /// Sends the request.
2281 ///
2282 /// # Long running operations
2283 ///
2284 /// This starts, but does not poll, a longrunning operation. More information
2285 /// on [update_network][crate::client::BareMetalSolution::update_network].
2286 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2287 (*self.0.stub)
2288 .update_network(self.0.request, self.0.options)
2289 .await
2290 .map(crate::Response::into_body)
2291 }
2292
2293 /// Creates a [Poller][google_cloud_lro::Poller] to work with `update_network`.
2294 pub fn poller(
2295 self,
2296 ) -> impl google_cloud_lro::Poller<crate::model::Network, crate::model::OperationMetadata>
2297 {
2298 type Operation = google_cloud_lro::internal::Operation<
2299 crate::model::Network,
2300 crate::model::OperationMetadata,
2301 >;
2302 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2303 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2304
2305 let stub = self.0.stub.clone();
2306 let mut options = self.0.options.clone();
2307 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
2308 let query = move |name| {
2309 let stub = stub.clone();
2310 let options = options.clone();
2311 async {
2312 let op = GetOperation::new(stub)
2313 .set_name(name)
2314 .with_options(options)
2315 .send()
2316 .await?;
2317 Ok(Operation::new(op))
2318 }
2319 };
2320
2321 let start = move || async {
2322 let op = self.send().await?;
2323 Ok(Operation::new(op))
2324 };
2325
2326 google_cloud_lro::internal::new_poller(
2327 polling_error_policy,
2328 polling_backoff_policy,
2329 start,
2330 query,
2331 )
2332 }
2333
2334 /// Sets the value of [network][crate::model::UpdateNetworkRequest::network].
2335 ///
2336 /// This is a **required** field for requests.
2337 pub fn set_network<T>(mut self, v: T) -> Self
2338 where
2339 T: std::convert::Into<crate::model::Network>,
2340 {
2341 self.0.request.network = std::option::Option::Some(v.into());
2342 self
2343 }
2344
2345 /// Sets or clears the value of [network][crate::model::UpdateNetworkRequest::network].
2346 ///
2347 /// This is a **required** field for requests.
2348 pub fn set_or_clear_network<T>(mut self, v: std::option::Option<T>) -> Self
2349 where
2350 T: std::convert::Into<crate::model::Network>,
2351 {
2352 self.0.request.network = v.map(|x| x.into());
2353 self
2354 }
2355
2356 /// Sets the value of [update_mask][crate::model::UpdateNetworkRequest::update_mask].
2357 pub fn set_update_mask<T>(mut self, v: T) -> Self
2358 where
2359 T: std::convert::Into<wkt::FieldMask>,
2360 {
2361 self.0.request.update_mask = std::option::Option::Some(v.into());
2362 self
2363 }
2364
2365 /// Sets or clears the value of [update_mask][crate::model::UpdateNetworkRequest::update_mask].
2366 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2367 where
2368 T: std::convert::Into<wkt::FieldMask>,
2369 {
2370 self.0.request.update_mask = v.map(|x| x.into());
2371 self
2372 }
2373 }
2374
2375 #[doc(hidden)]
2376 impl crate::RequestBuilder for UpdateNetwork {
2377 fn request_options(&mut self) -> &mut crate::RequestOptions {
2378 &mut self.0.options
2379 }
2380 }
2381
2382 /// The request builder for [BareMetalSolution::create_volume_snapshot][crate::client::BareMetalSolution::create_volume_snapshot] calls.
2383 ///
2384 /// # Example
2385 /// ```
2386 /// # use google_cloud_baremetalsolution_v2::builder::bare_metal_solution::CreateVolumeSnapshot;
2387 /// # async fn sample() -> google_cloud_baremetalsolution_v2::Result<()> {
2388 ///
2389 /// let builder = prepare_request_builder();
2390 /// let response = builder.send().await?;
2391 /// # Ok(()) }
2392 ///
2393 /// fn prepare_request_builder() -> CreateVolumeSnapshot {
2394 /// # panic!();
2395 /// // ... details omitted ...
2396 /// }
2397 /// ```
2398 #[derive(Clone, Debug)]
2399 pub struct CreateVolumeSnapshot(RequestBuilder<crate::model::CreateVolumeSnapshotRequest>);
2400
2401 impl CreateVolumeSnapshot {
2402 pub(crate) fn new(
2403 stub: std::sync::Arc<dyn super::super::stub::dynamic::BareMetalSolution>,
2404 ) -> Self {
2405 Self(RequestBuilder::new(stub))
2406 }
2407
2408 /// Sets the full request, replacing any prior values.
2409 pub fn with_request<V: Into<crate::model::CreateVolumeSnapshotRequest>>(
2410 mut self,
2411 v: V,
2412 ) -> Self {
2413 self.0.request = v.into();
2414 self
2415 }
2416
2417 /// Sets all the options, replacing any prior values.
2418 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2419 self.0.options = v.into();
2420 self
2421 }
2422
2423 /// Sends the request.
2424 pub async fn send(self) -> Result<crate::model::VolumeSnapshot> {
2425 (*self.0.stub)
2426 .create_volume_snapshot(self.0.request, self.0.options)
2427 .await
2428 .map(crate::Response::into_body)
2429 }
2430
2431 /// Sets the value of [parent][crate::model::CreateVolumeSnapshotRequest::parent].
2432 ///
2433 /// This is a **required** field for requests.
2434 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2435 self.0.request.parent = v.into();
2436 self
2437 }
2438
2439 /// Sets the value of [volume_snapshot][crate::model::CreateVolumeSnapshotRequest::volume_snapshot].
2440 ///
2441 /// This is a **required** field for requests.
2442 pub fn set_volume_snapshot<T>(mut self, v: T) -> Self
2443 where
2444 T: std::convert::Into<crate::model::VolumeSnapshot>,
2445 {
2446 self.0.request.volume_snapshot = std::option::Option::Some(v.into());
2447 self
2448 }
2449
2450 /// Sets or clears the value of [volume_snapshot][crate::model::CreateVolumeSnapshotRequest::volume_snapshot].
2451 ///
2452 /// This is a **required** field for requests.
2453 pub fn set_or_clear_volume_snapshot<T>(mut self, v: std::option::Option<T>) -> Self
2454 where
2455 T: std::convert::Into<crate::model::VolumeSnapshot>,
2456 {
2457 self.0.request.volume_snapshot = v.map(|x| x.into());
2458 self
2459 }
2460 }
2461
2462 #[doc(hidden)]
2463 impl crate::RequestBuilder for CreateVolumeSnapshot {
2464 fn request_options(&mut self) -> &mut crate::RequestOptions {
2465 &mut self.0.options
2466 }
2467 }
2468
2469 /// The request builder for [BareMetalSolution::restore_volume_snapshot][crate::client::BareMetalSolution::restore_volume_snapshot] calls.
2470 ///
2471 /// # Example
2472 /// ```
2473 /// # use google_cloud_baremetalsolution_v2::builder::bare_metal_solution::RestoreVolumeSnapshot;
2474 /// # async fn sample() -> google_cloud_baremetalsolution_v2::Result<()> {
2475 /// use google_cloud_lro::Poller;
2476 ///
2477 /// let builder = prepare_request_builder();
2478 /// let response = builder.poller().until_done().await?;
2479 /// # Ok(()) }
2480 ///
2481 /// fn prepare_request_builder() -> RestoreVolumeSnapshot {
2482 /// # panic!();
2483 /// // ... details omitted ...
2484 /// }
2485 /// ```
2486 #[derive(Clone, Debug)]
2487 pub struct RestoreVolumeSnapshot(RequestBuilder<crate::model::RestoreVolumeSnapshotRequest>);
2488
2489 impl RestoreVolumeSnapshot {
2490 pub(crate) fn new(
2491 stub: std::sync::Arc<dyn super::super::stub::dynamic::BareMetalSolution>,
2492 ) -> Self {
2493 Self(RequestBuilder::new(stub))
2494 }
2495
2496 /// Sets the full request, replacing any prior values.
2497 pub fn with_request<V: Into<crate::model::RestoreVolumeSnapshotRequest>>(
2498 mut self,
2499 v: V,
2500 ) -> Self {
2501 self.0.request = v.into();
2502 self
2503 }
2504
2505 /// Sets all the options, replacing any prior values.
2506 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2507 self.0.options = v.into();
2508 self
2509 }
2510
2511 /// Sends the request.
2512 ///
2513 /// # Long running operations
2514 ///
2515 /// This starts, but does not poll, a longrunning operation. More information
2516 /// on [restore_volume_snapshot][crate::client::BareMetalSolution::restore_volume_snapshot].
2517 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2518 (*self.0.stub)
2519 .restore_volume_snapshot(self.0.request, self.0.options)
2520 .await
2521 .map(crate::Response::into_body)
2522 }
2523
2524 /// Creates a [Poller][google_cloud_lro::Poller] to work with `restore_volume_snapshot`.
2525 pub fn poller(
2526 self,
2527 ) -> impl google_cloud_lro::Poller<crate::model::VolumeSnapshot, crate::model::OperationMetadata>
2528 {
2529 type Operation = google_cloud_lro::internal::Operation<
2530 crate::model::VolumeSnapshot,
2531 crate::model::OperationMetadata,
2532 >;
2533 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2534 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2535
2536 let stub = self.0.stub.clone();
2537 let mut options = self.0.options.clone();
2538 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
2539 let query = move |name| {
2540 let stub = stub.clone();
2541 let options = options.clone();
2542 async {
2543 let op = GetOperation::new(stub)
2544 .set_name(name)
2545 .with_options(options)
2546 .send()
2547 .await?;
2548 Ok(Operation::new(op))
2549 }
2550 };
2551
2552 let start = move || async {
2553 let op = self.send().await?;
2554 Ok(Operation::new(op))
2555 };
2556
2557 google_cloud_lro::internal::new_poller(
2558 polling_error_policy,
2559 polling_backoff_policy,
2560 start,
2561 query,
2562 )
2563 }
2564
2565 /// Sets the value of [volume_snapshot][crate::model::RestoreVolumeSnapshotRequest::volume_snapshot].
2566 ///
2567 /// This is a **required** field for requests.
2568 pub fn set_volume_snapshot<T: Into<std::string::String>>(mut self, v: T) -> Self {
2569 self.0.request.volume_snapshot = v.into();
2570 self
2571 }
2572 }
2573
2574 #[doc(hidden)]
2575 impl crate::RequestBuilder for RestoreVolumeSnapshot {
2576 fn request_options(&mut self) -> &mut crate::RequestOptions {
2577 &mut self.0.options
2578 }
2579 }
2580
2581 /// The request builder for [BareMetalSolution::delete_volume_snapshot][crate::client::BareMetalSolution::delete_volume_snapshot] calls.
2582 ///
2583 /// # Example
2584 /// ```
2585 /// # use google_cloud_baremetalsolution_v2::builder::bare_metal_solution::DeleteVolumeSnapshot;
2586 /// # async fn sample() -> google_cloud_baremetalsolution_v2::Result<()> {
2587 ///
2588 /// let builder = prepare_request_builder();
2589 /// let response = builder.send().await?;
2590 /// # Ok(()) }
2591 ///
2592 /// fn prepare_request_builder() -> DeleteVolumeSnapshot {
2593 /// # panic!();
2594 /// // ... details omitted ...
2595 /// }
2596 /// ```
2597 #[derive(Clone, Debug)]
2598 pub struct DeleteVolumeSnapshot(RequestBuilder<crate::model::DeleteVolumeSnapshotRequest>);
2599
2600 impl DeleteVolumeSnapshot {
2601 pub(crate) fn new(
2602 stub: std::sync::Arc<dyn super::super::stub::dynamic::BareMetalSolution>,
2603 ) -> Self {
2604 Self(RequestBuilder::new(stub))
2605 }
2606
2607 /// Sets the full request, replacing any prior values.
2608 pub fn with_request<V: Into<crate::model::DeleteVolumeSnapshotRequest>>(
2609 mut self,
2610 v: V,
2611 ) -> Self {
2612 self.0.request = v.into();
2613 self
2614 }
2615
2616 /// Sets all the options, replacing any prior values.
2617 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2618 self.0.options = v.into();
2619 self
2620 }
2621
2622 /// Sends the request.
2623 pub async fn send(self) -> Result<()> {
2624 (*self.0.stub)
2625 .delete_volume_snapshot(self.0.request, self.0.options)
2626 .await
2627 .map(crate::Response::into_body)
2628 }
2629
2630 /// Sets the value of [name][crate::model::DeleteVolumeSnapshotRequest::name].
2631 ///
2632 /// This is a **required** field for requests.
2633 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2634 self.0.request.name = v.into();
2635 self
2636 }
2637 }
2638
2639 #[doc(hidden)]
2640 impl crate::RequestBuilder for DeleteVolumeSnapshot {
2641 fn request_options(&mut self) -> &mut crate::RequestOptions {
2642 &mut self.0.options
2643 }
2644 }
2645
2646 /// The request builder for [BareMetalSolution::get_volume_snapshot][crate::client::BareMetalSolution::get_volume_snapshot] calls.
2647 ///
2648 /// # Example
2649 /// ```
2650 /// # use google_cloud_baremetalsolution_v2::builder::bare_metal_solution::GetVolumeSnapshot;
2651 /// # async fn sample() -> google_cloud_baremetalsolution_v2::Result<()> {
2652 ///
2653 /// let builder = prepare_request_builder();
2654 /// let response = builder.send().await?;
2655 /// # Ok(()) }
2656 ///
2657 /// fn prepare_request_builder() -> GetVolumeSnapshot {
2658 /// # panic!();
2659 /// // ... details omitted ...
2660 /// }
2661 /// ```
2662 #[derive(Clone, Debug)]
2663 pub struct GetVolumeSnapshot(RequestBuilder<crate::model::GetVolumeSnapshotRequest>);
2664
2665 impl GetVolumeSnapshot {
2666 pub(crate) fn new(
2667 stub: std::sync::Arc<dyn super::super::stub::dynamic::BareMetalSolution>,
2668 ) -> Self {
2669 Self(RequestBuilder::new(stub))
2670 }
2671
2672 /// Sets the full request, replacing any prior values.
2673 pub fn with_request<V: Into<crate::model::GetVolumeSnapshotRequest>>(
2674 mut self,
2675 v: V,
2676 ) -> Self {
2677 self.0.request = v.into();
2678 self
2679 }
2680
2681 /// Sets all the options, replacing any prior values.
2682 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2683 self.0.options = v.into();
2684 self
2685 }
2686
2687 /// Sends the request.
2688 pub async fn send(self) -> Result<crate::model::VolumeSnapshot> {
2689 (*self.0.stub)
2690 .get_volume_snapshot(self.0.request, self.0.options)
2691 .await
2692 .map(crate::Response::into_body)
2693 }
2694
2695 /// Sets the value of [name][crate::model::GetVolumeSnapshotRequest::name].
2696 ///
2697 /// This is a **required** field for requests.
2698 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2699 self.0.request.name = v.into();
2700 self
2701 }
2702 }
2703
2704 #[doc(hidden)]
2705 impl crate::RequestBuilder for GetVolumeSnapshot {
2706 fn request_options(&mut self) -> &mut crate::RequestOptions {
2707 &mut self.0.options
2708 }
2709 }
2710
2711 /// The request builder for [BareMetalSolution::list_volume_snapshots][crate::client::BareMetalSolution::list_volume_snapshots] calls.
2712 ///
2713 /// # Example
2714 /// ```
2715 /// # use google_cloud_baremetalsolution_v2::builder::bare_metal_solution::ListVolumeSnapshots;
2716 /// # async fn sample() -> google_cloud_baremetalsolution_v2::Result<()> {
2717 /// use google_cloud_gax::paginator::ItemPaginator;
2718 ///
2719 /// let builder = prepare_request_builder();
2720 /// let mut items = builder.by_item();
2721 /// while let Some(result) = items.next().await {
2722 /// let item = result?;
2723 /// }
2724 /// # Ok(()) }
2725 ///
2726 /// fn prepare_request_builder() -> ListVolumeSnapshots {
2727 /// # panic!();
2728 /// // ... details omitted ...
2729 /// }
2730 /// ```
2731 #[derive(Clone, Debug)]
2732 pub struct ListVolumeSnapshots(RequestBuilder<crate::model::ListVolumeSnapshotsRequest>);
2733
2734 impl ListVolumeSnapshots {
2735 pub(crate) fn new(
2736 stub: std::sync::Arc<dyn super::super::stub::dynamic::BareMetalSolution>,
2737 ) -> Self {
2738 Self(RequestBuilder::new(stub))
2739 }
2740
2741 /// Sets the full request, replacing any prior values.
2742 pub fn with_request<V: Into<crate::model::ListVolumeSnapshotsRequest>>(
2743 mut self,
2744 v: V,
2745 ) -> Self {
2746 self.0.request = v.into();
2747 self
2748 }
2749
2750 /// Sets all the options, replacing any prior values.
2751 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2752 self.0.options = v.into();
2753 self
2754 }
2755
2756 /// Sends the request.
2757 pub async fn send(self) -> Result<crate::model::ListVolumeSnapshotsResponse> {
2758 (*self.0.stub)
2759 .list_volume_snapshots(self.0.request, self.0.options)
2760 .await
2761 .map(crate::Response::into_body)
2762 }
2763
2764 /// Streams each page in the collection.
2765 pub fn by_page(
2766 self,
2767 ) -> impl google_cloud_gax::paginator::Paginator<
2768 crate::model::ListVolumeSnapshotsResponse,
2769 crate::Error,
2770 > {
2771 use std::clone::Clone;
2772 let token = self.0.request.page_token.clone();
2773 let execute = move |token: String| {
2774 let mut builder = self.clone();
2775 builder.0.request = builder.0.request.set_page_token(token);
2776 builder.send()
2777 };
2778 google_cloud_gax::paginator::internal::new_paginator(token, execute)
2779 }
2780
2781 /// Streams each item in the collection.
2782 pub fn by_item(
2783 self,
2784 ) -> impl google_cloud_gax::paginator::ItemPaginator<
2785 crate::model::ListVolumeSnapshotsResponse,
2786 crate::Error,
2787 > {
2788 use google_cloud_gax::paginator::Paginator;
2789 self.by_page().items()
2790 }
2791
2792 /// Sets the value of [parent][crate::model::ListVolumeSnapshotsRequest::parent].
2793 ///
2794 /// This is a **required** field for requests.
2795 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2796 self.0.request.parent = v.into();
2797 self
2798 }
2799
2800 /// Sets the value of [page_size][crate::model::ListVolumeSnapshotsRequest::page_size].
2801 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2802 self.0.request.page_size = v.into();
2803 self
2804 }
2805
2806 /// Sets the value of [page_token][crate::model::ListVolumeSnapshotsRequest::page_token].
2807 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2808 self.0.request.page_token = v.into();
2809 self
2810 }
2811 }
2812
2813 #[doc(hidden)]
2814 impl crate::RequestBuilder for ListVolumeSnapshots {
2815 fn request_options(&mut self) -> &mut crate::RequestOptions {
2816 &mut self.0.options
2817 }
2818 }
2819
2820 /// The request builder for [BareMetalSolution::get_lun][crate::client::BareMetalSolution::get_lun] calls.
2821 ///
2822 /// # Example
2823 /// ```
2824 /// # use google_cloud_baremetalsolution_v2::builder::bare_metal_solution::GetLun;
2825 /// # async fn sample() -> google_cloud_baremetalsolution_v2::Result<()> {
2826 ///
2827 /// let builder = prepare_request_builder();
2828 /// let response = builder.send().await?;
2829 /// # Ok(()) }
2830 ///
2831 /// fn prepare_request_builder() -> GetLun {
2832 /// # panic!();
2833 /// // ... details omitted ...
2834 /// }
2835 /// ```
2836 #[derive(Clone, Debug)]
2837 pub struct GetLun(RequestBuilder<crate::model::GetLunRequest>);
2838
2839 impl GetLun {
2840 pub(crate) fn new(
2841 stub: std::sync::Arc<dyn super::super::stub::dynamic::BareMetalSolution>,
2842 ) -> Self {
2843 Self(RequestBuilder::new(stub))
2844 }
2845
2846 /// Sets the full request, replacing any prior values.
2847 pub fn with_request<V: Into<crate::model::GetLunRequest>>(mut self, v: V) -> Self {
2848 self.0.request = v.into();
2849 self
2850 }
2851
2852 /// Sets all the options, replacing any prior values.
2853 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2854 self.0.options = v.into();
2855 self
2856 }
2857
2858 /// Sends the request.
2859 pub async fn send(self) -> Result<crate::model::Lun> {
2860 (*self.0.stub)
2861 .get_lun(self.0.request, self.0.options)
2862 .await
2863 .map(crate::Response::into_body)
2864 }
2865
2866 /// Sets the value of [name][crate::model::GetLunRequest::name].
2867 ///
2868 /// This is a **required** field for requests.
2869 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2870 self.0.request.name = v.into();
2871 self
2872 }
2873 }
2874
2875 #[doc(hidden)]
2876 impl crate::RequestBuilder for GetLun {
2877 fn request_options(&mut self) -> &mut crate::RequestOptions {
2878 &mut self.0.options
2879 }
2880 }
2881
2882 /// The request builder for [BareMetalSolution::list_luns][crate::client::BareMetalSolution::list_luns] calls.
2883 ///
2884 /// # Example
2885 /// ```
2886 /// # use google_cloud_baremetalsolution_v2::builder::bare_metal_solution::ListLuns;
2887 /// # async fn sample() -> google_cloud_baremetalsolution_v2::Result<()> {
2888 /// use google_cloud_gax::paginator::ItemPaginator;
2889 ///
2890 /// let builder = prepare_request_builder();
2891 /// let mut items = builder.by_item();
2892 /// while let Some(result) = items.next().await {
2893 /// let item = result?;
2894 /// }
2895 /// # Ok(()) }
2896 ///
2897 /// fn prepare_request_builder() -> ListLuns {
2898 /// # panic!();
2899 /// // ... details omitted ...
2900 /// }
2901 /// ```
2902 #[derive(Clone, Debug)]
2903 pub struct ListLuns(RequestBuilder<crate::model::ListLunsRequest>);
2904
2905 impl ListLuns {
2906 pub(crate) fn new(
2907 stub: std::sync::Arc<dyn super::super::stub::dynamic::BareMetalSolution>,
2908 ) -> Self {
2909 Self(RequestBuilder::new(stub))
2910 }
2911
2912 /// Sets the full request, replacing any prior values.
2913 pub fn with_request<V: Into<crate::model::ListLunsRequest>>(mut self, v: V) -> Self {
2914 self.0.request = v.into();
2915 self
2916 }
2917
2918 /// Sets all the options, replacing any prior values.
2919 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2920 self.0.options = v.into();
2921 self
2922 }
2923
2924 /// Sends the request.
2925 pub async fn send(self) -> Result<crate::model::ListLunsResponse> {
2926 (*self.0.stub)
2927 .list_luns(self.0.request, self.0.options)
2928 .await
2929 .map(crate::Response::into_body)
2930 }
2931
2932 /// Streams each page in the collection.
2933 pub fn by_page(
2934 self,
2935 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListLunsResponse, crate::Error>
2936 {
2937 use std::clone::Clone;
2938 let token = self.0.request.page_token.clone();
2939 let execute = move |token: String| {
2940 let mut builder = self.clone();
2941 builder.0.request = builder.0.request.set_page_token(token);
2942 builder.send()
2943 };
2944 google_cloud_gax::paginator::internal::new_paginator(token, execute)
2945 }
2946
2947 /// Streams each item in the collection.
2948 pub fn by_item(
2949 self,
2950 ) -> impl google_cloud_gax::paginator::ItemPaginator<crate::model::ListLunsResponse, crate::Error>
2951 {
2952 use google_cloud_gax::paginator::Paginator;
2953 self.by_page().items()
2954 }
2955
2956 /// Sets the value of [parent][crate::model::ListLunsRequest::parent].
2957 ///
2958 /// This is a **required** field for requests.
2959 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2960 self.0.request.parent = v.into();
2961 self
2962 }
2963
2964 /// Sets the value of [page_size][crate::model::ListLunsRequest::page_size].
2965 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2966 self.0.request.page_size = v.into();
2967 self
2968 }
2969
2970 /// Sets the value of [page_token][crate::model::ListLunsRequest::page_token].
2971 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2972 self.0.request.page_token = v.into();
2973 self
2974 }
2975 }
2976
2977 #[doc(hidden)]
2978 impl crate::RequestBuilder for ListLuns {
2979 fn request_options(&mut self) -> &mut crate::RequestOptions {
2980 &mut self.0.options
2981 }
2982 }
2983
2984 /// The request builder for [BareMetalSolution::evict_lun][crate::client::BareMetalSolution::evict_lun] calls.
2985 ///
2986 /// # Example
2987 /// ```
2988 /// # use google_cloud_baremetalsolution_v2::builder::bare_metal_solution::EvictLun;
2989 /// # async fn sample() -> google_cloud_baremetalsolution_v2::Result<()> {
2990 /// use google_cloud_lro::Poller;
2991 ///
2992 /// let builder = prepare_request_builder();
2993 /// let response = builder.poller().until_done().await?;
2994 /// # Ok(()) }
2995 ///
2996 /// fn prepare_request_builder() -> EvictLun {
2997 /// # panic!();
2998 /// // ... details omitted ...
2999 /// }
3000 /// ```
3001 #[derive(Clone, Debug)]
3002 pub struct EvictLun(RequestBuilder<crate::model::EvictLunRequest>);
3003
3004 impl EvictLun {
3005 pub(crate) fn new(
3006 stub: std::sync::Arc<dyn super::super::stub::dynamic::BareMetalSolution>,
3007 ) -> Self {
3008 Self(RequestBuilder::new(stub))
3009 }
3010
3011 /// Sets the full request, replacing any prior values.
3012 pub fn with_request<V: Into<crate::model::EvictLunRequest>>(mut self, v: V) -> Self {
3013 self.0.request = v.into();
3014 self
3015 }
3016
3017 /// Sets all the options, replacing any prior values.
3018 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3019 self.0.options = v.into();
3020 self
3021 }
3022
3023 /// Sends the request.
3024 ///
3025 /// # Long running operations
3026 ///
3027 /// This starts, but does not poll, a longrunning operation. More information
3028 /// on [evict_lun][crate::client::BareMetalSolution::evict_lun].
3029 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
3030 (*self.0.stub)
3031 .evict_lun(self.0.request, self.0.options)
3032 .await
3033 .map(crate::Response::into_body)
3034 }
3035
3036 /// Creates a [Poller][google_cloud_lro::Poller] to work with `evict_lun`.
3037 pub fn poller(self) -> impl google_cloud_lro::Poller<(), crate::model::OperationMetadata> {
3038 type Operation =
3039 google_cloud_lro::internal::Operation<wkt::Empty, crate::model::OperationMetadata>;
3040 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
3041 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
3042
3043 let stub = self.0.stub.clone();
3044 let mut options = self.0.options.clone();
3045 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
3046 let query = move |name| {
3047 let stub = stub.clone();
3048 let options = options.clone();
3049 async {
3050 let op = GetOperation::new(stub)
3051 .set_name(name)
3052 .with_options(options)
3053 .send()
3054 .await?;
3055 Ok(Operation::new(op))
3056 }
3057 };
3058
3059 let start = move || async {
3060 let op = self.send().await?;
3061 Ok(Operation::new(op))
3062 };
3063
3064 google_cloud_lro::internal::new_unit_response_poller(
3065 polling_error_policy,
3066 polling_backoff_policy,
3067 start,
3068 query,
3069 )
3070 }
3071
3072 /// Sets the value of [name][crate::model::EvictLunRequest::name].
3073 ///
3074 /// This is a **required** field for requests.
3075 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3076 self.0.request.name = v.into();
3077 self
3078 }
3079 }
3080
3081 #[doc(hidden)]
3082 impl crate::RequestBuilder for EvictLun {
3083 fn request_options(&mut self) -> &mut crate::RequestOptions {
3084 &mut self.0.options
3085 }
3086 }
3087
3088 /// The request builder for [BareMetalSolution::get_nfs_share][crate::client::BareMetalSolution::get_nfs_share] calls.
3089 ///
3090 /// # Example
3091 /// ```
3092 /// # use google_cloud_baremetalsolution_v2::builder::bare_metal_solution::GetNfsShare;
3093 /// # async fn sample() -> google_cloud_baremetalsolution_v2::Result<()> {
3094 ///
3095 /// let builder = prepare_request_builder();
3096 /// let response = builder.send().await?;
3097 /// # Ok(()) }
3098 ///
3099 /// fn prepare_request_builder() -> GetNfsShare {
3100 /// # panic!();
3101 /// // ... details omitted ...
3102 /// }
3103 /// ```
3104 #[derive(Clone, Debug)]
3105 pub struct GetNfsShare(RequestBuilder<crate::model::GetNfsShareRequest>);
3106
3107 impl GetNfsShare {
3108 pub(crate) fn new(
3109 stub: std::sync::Arc<dyn super::super::stub::dynamic::BareMetalSolution>,
3110 ) -> Self {
3111 Self(RequestBuilder::new(stub))
3112 }
3113
3114 /// Sets the full request, replacing any prior values.
3115 pub fn with_request<V: Into<crate::model::GetNfsShareRequest>>(mut self, v: V) -> Self {
3116 self.0.request = v.into();
3117 self
3118 }
3119
3120 /// Sets all the options, replacing any prior values.
3121 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3122 self.0.options = v.into();
3123 self
3124 }
3125
3126 /// Sends the request.
3127 pub async fn send(self) -> Result<crate::model::NfsShare> {
3128 (*self.0.stub)
3129 .get_nfs_share(self.0.request, self.0.options)
3130 .await
3131 .map(crate::Response::into_body)
3132 }
3133
3134 /// Sets the value of [name][crate::model::GetNfsShareRequest::name].
3135 ///
3136 /// This is a **required** field for requests.
3137 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3138 self.0.request.name = v.into();
3139 self
3140 }
3141 }
3142
3143 #[doc(hidden)]
3144 impl crate::RequestBuilder for GetNfsShare {
3145 fn request_options(&mut self) -> &mut crate::RequestOptions {
3146 &mut self.0.options
3147 }
3148 }
3149
3150 /// The request builder for [BareMetalSolution::list_nfs_shares][crate::client::BareMetalSolution::list_nfs_shares] calls.
3151 ///
3152 /// # Example
3153 /// ```
3154 /// # use google_cloud_baremetalsolution_v2::builder::bare_metal_solution::ListNfsShares;
3155 /// # async fn sample() -> google_cloud_baremetalsolution_v2::Result<()> {
3156 /// use google_cloud_gax::paginator::ItemPaginator;
3157 ///
3158 /// let builder = prepare_request_builder();
3159 /// let mut items = builder.by_item();
3160 /// while let Some(result) = items.next().await {
3161 /// let item = result?;
3162 /// }
3163 /// # Ok(()) }
3164 ///
3165 /// fn prepare_request_builder() -> ListNfsShares {
3166 /// # panic!();
3167 /// // ... details omitted ...
3168 /// }
3169 /// ```
3170 #[derive(Clone, Debug)]
3171 pub struct ListNfsShares(RequestBuilder<crate::model::ListNfsSharesRequest>);
3172
3173 impl ListNfsShares {
3174 pub(crate) fn new(
3175 stub: std::sync::Arc<dyn super::super::stub::dynamic::BareMetalSolution>,
3176 ) -> Self {
3177 Self(RequestBuilder::new(stub))
3178 }
3179
3180 /// Sets the full request, replacing any prior values.
3181 pub fn with_request<V: Into<crate::model::ListNfsSharesRequest>>(mut self, v: V) -> Self {
3182 self.0.request = v.into();
3183 self
3184 }
3185
3186 /// Sets all the options, replacing any prior values.
3187 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3188 self.0.options = v.into();
3189 self
3190 }
3191
3192 /// Sends the request.
3193 pub async fn send(self) -> Result<crate::model::ListNfsSharesResponse> {
3194 (*self.0.stub)
3195 .list_nfs_shares(self.0.request, self.0.options)
3196 .await
3197 .map(crate::Response::into_body)
3198 }
3199
3200 /// Streams each page in the collection.
3201 pub fn by_page(
3202 self,
3203 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListNfsSharesResponse, crate::Error>
3204 {
3205 use std::clone::Clone;
3206 let token = self.0.request.page_token.clone();
3207 let execute = move |token: String| {
3208 let mut builder = self.clone();
3209 builder.0.request = builder.0.request.set_page_token(token);
3210 builder.send()
3211 };
3212 google_cloud_gax::paginator::internal::new_paginator(token, execute)
3213 }
3214
3215 /// Streams each item in the collection.
3216 pub fn by_item(
3217 self,
3218 ) -> impl google_cloud_gax::paginator::ItemPaginator<
3219 crate::model::ListNfsSharesResponse,
3220 crate::Error,
3221 > {
3222 use google_cloud_gax::paginator::Paginator;
3223 self.by_page().items()
3224 }
3225
3226 /// Sets the value of [parent][crate::model::ListNfsSharesRequest::parent].
3227 ///
3228 /// This is a **required** field for requests.
3229 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3230 self.0.request.parent = v.into();
3231 self
3232 }
3233
3234 /// Sets the value of [page_size][crate::model::ListNfsSharesRequest::page_size].
3235 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3236 self.0.request.page_size = v.into();
3237 self
3238 }
3239
3240 /// Sets the value of [page_token][crate::model::ListNfsSharesRequest::page_token].
3241 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3242 self.0.request.page_token = v.into();
3243 self
3244 }
3245
3246 /// Sets the value of [filter][crate::model::ListNfsSharesRequest::filter].
3247 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3248 self.0.request.filter = v.into();
3249 self
3250 }
3251 }
3252
3253 #[doc(hidden)]
3254 impl crate::RequestBuilder for ListNfsShares {
3255 fn request_options(&mut self) -> &mut crate::RequestOptions {
3256 &mut self.0.options
3257 }
3258 }
3259
3260 /// The request builder for [BareMetalSolution::update_nfs_share][crate::client::BareMetalSolution::update_nfs_share] calls.
3261 ///
3262 /// # Example
3263 /// ```
3264 /// # use google_cloud_baremetalsolution_v2::builder::bare_metal_solution::UpdateNfsShare;
3265 /// # async fn sample() -> google_cloud_baremetalsolution_v2::Result<()> {
3266 /// use google_cloud_lro::Poller;
3267 ///
3268 /// let builder = prepare_request_builder();
3269 /// let response = builder.poller().until_done().await?;
3270 /// # Ok(()) }
3271 ///
3272 /// fn prepare_request_builder() -> UpdateNfsShare {
3273 /// # panic!();
3274 /// // ... details omitted ...
3275 /// }
3276 /// ```
3277 #[derive(Clone, Debug)]
3278 pub struct UpdateNfsShare(RequestBuilder<crate::model::UpdateNfsShareRequest>);
3279
3280 impl UpdateNfsShare {
3281 pub(crate) fn new(
3282 stub: std::sync::Arc<dyn super::super::stub::dynamic::BareMetalSolution>,
3283 ) -> Self {
3284 Self(RequestBuilder::new(stub))
3285 }
3286
3287 /// Sets the full request, replacing any prior values.
3288 pub fn with_request<V: Into<crate::model::UpdateNfsShareRequest>>(mut self, v: V) -> Self {
3289 self.0.request = v.into();
3290 self
3291 }
3292
3293 /// Sets all the options, replacing any prior values.
3294 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3295 self.0.options = v.into();
3296 self
3297 }
3298
3299 /// Sends the request.
3300 ///
3301 /// # Long running operations
3302 ///
3303 /// This starts, but does not poll, a longrunning operation. More information
3304 /// on [update_nfs_share][crate::client::BareMetalSolution::update_nfs_share].
3305 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
3306 (*self.0.stub)
3307 .update_nfs_share(self.0.request, self.0.options)
3308 .await
3309 .map(crate::Response::into_body)
3310 }
3311
3312 /// Creates a [Poller][google_cloud_lro::Poller] to work with `update_nfs_share`.
3313 pub fn poller(
3314 self,
3315 ) -> impl google_cloud_lro::Poller<crate::model::NfsShare, crate::model::OperationMetadata>
3316 {
3317 type Operation = google_cloud_lro::internal::Operation<
3318 crate::model::NfsShare,
3319 crate::model::OperationMetadata,
3320 >;
3321 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
3322 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
3323
3324 let stub = self.0.stub.clone();
3325 let mut options = self.0.options.clone();
3326 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
3327 let query = move |name| {
3328 let stub = stub.clone();
3329 let options = options.clone();
3330 async {
3331 let op = GetOperation::new(stub)
3332 .set_name(name)
3333 .with_options(options)
3334 .send()
3335 .await?;
3336 Ok(Operation::new(op))
3337 }
3338 };
3339
3340 let start = move || async {
3341 let op = self.send().await?;
3342 Ok(Operation::new(op))
3343 };
3344
3345 google_cloud_lro::internal::new_poller(
3346 polling_error_policy,
3347 polling_backoff_policy,
3348 start,
3349 query,
3350 )
3351 }
3352
3353 /// Sets the value of [nfs_share][crate::model::UpdateNfsShareRequest::nfs_share].
3354 ///
3355 /// This is a **required** field for requests.
3356 pub fn set_nfs_share<T>(mut self, v: T) -> Self
3357 where
3358 T: std::convert::Into<crate::model::NfsShare>,
3359 {
3360 self.0.request.nfs_share = std::option::Option::Some(v.into());
3361 self
3362 }
3363
3364 /// Sets or clears the value of [nfs_share][crate::model::UpdateNfsShareRequest::nfs_share].
3365 ///
3366 /// This is a **required** field for requests.
3367 pub fn set_or_clear_nfs_share<T>(mut self, v: std::option::Option<T>) -> Self
3368 where
3369 T: std::convert::Into<crate::model::NfsShare>,
3370 {
3371 self.0.request.nfs_share = v.map(|x| x.into());
3372 self
3373 }
3374
3375 /// Sets the value of [update_mask][crate::model::UpdateNfsShareRequest::update_mask].
3376 pub fn set_update_mask<T>(mut self, v: T) -> Self
3377 where
3378 T: std::convert::Into<wkt::FieldMask>,
3379 {
3380 self.0.request.update_mask = std::option::Option::Some(v.into());
3381 self
3382 }
3383
3384 /// Sets or clears the value of [update_mask][crate::model::UpdateNfsShareRequest::update_mask].
3385 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3386 where
3387 T: std::convert::Into<wkt::FieldMask>,
3388 {
3389 self.0.request.update_mask = v.map(|x| x.into());
3390 self
3391 }
3392 }
3393
3394 #[doc(hidden)]
3395 impl crate::RequestBuilder for UpdateNfsShare {
3396 fn request_options(&mut self) -> &mut crate::RequestOptions {
3397 &mut self.0.options
3398 }
3399 }
3400
3401 /// The request builder for [BareMetalSolution::create_nfs_share][crate::client::BareMetalSolution::create_nfs_share] calls.
3402 ///
3403 /// # Example
3404 /// ```
3405 /// # use google_cloud_baremetalsolution_v2::builder::bare_metal_solution::CreateNfsShare;
3406 /// # async fn sample() -> google_cloud_baremetalsolution_v2::Result<()> {
3407 /// use google_cloud_lro::Poller;
3408 ///
3409 /// let builder = prepare_request_builder();
3410 /// let response = builder.poller().until_done().await?;
3411 /// # Ok(()) }
3412 ///
3413 /// fn prepare_request_builder() -> CreateNfsShare {
3414 /// # panic!();
3415 /// // ... details omitted ...
3416 /// }
3417 /// ```
3418 #[derive(Clone, Debug)]
3419 pub struct CreateNfsShare(RequestBuilder<crate::model::CreateNfsShareRequest>);
3420
3421 impl CreateNfsShare {
3422 pub(crate) fn new(
3423 stub: std::sync::Arc<dyn super::super::stub::dynamic::BareMetalSolution>,
3424 ) -> Self {
3425 Self(RequestBuilder::new(stub))
3426 }
3427
3428 /// Sets the full request, replacing any prior values.
3429 pub fn with_request<V: Into<crate::model::CreateNfsShareRequest>>(mut self, v: V) -> Self {
3430 self.0.request = v.into();
3431 self
3432 }
3433
3434 /// Sets all the options, replacing any prior values.
3435 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3436 self.0.options = v.into();
3437 self
3438 }
3439
3440 /// Sends the request.
3441 ///
3442 /// # Long running operations
3443 ///
3444 /// This starts, but does not poll, a longrunning operation. More information
3445 /// on [create_nfs_share][crate::client::BareMetalSolution::create_nfs_share].
3446 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
3447 (*self.0.stub)
3448 .create_nfs_share(self.0.request, self.0.options)
3449 .await
3450 .map(crate::Response::into_body)
3451 }
3452
3453 /// Creates a [Poller][google_cloud_lro::Poller] to work with `create_nfs_share`.
3454 pub fn poller(
3455 self,
3456 ) -> impl google_cloud_lro::Poller<crate::model::NfsShare, crate::model::OperationMetadata>
3457 {
3458 type Operation = google_cloud_lro::internal::Operation<
3459 crate::model::NfsShare,
3460 crate::model::OperationMetadata,
3461 >;
3462 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
3463 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
3464
3465 let stub = self.0.stub.clone();
3466 let mut options = self.0.options.clone();
3467 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
3468 let query = move |name| {
3469 let stub = stub.clone();
3470 let options = options.clone();
3471 async {
3472 let op = GetOperation::new(stub)
3473 .set_name(name)
3474 .with_options(options)
3475 .send()
3476 .await?;
3477 Ok(Operation::new(op))
3478 }
3479 };
3480
3481 let start = move || async {
3482 let op = self.send().await?;
3483 Ok(Operation::new(op))
3484 };
3485
3486 google_cloud_lro::internal::new_poller(
3487 polling_error_policy,
3488 polling_backoff_policy,
3489 start,
3490 query,
3491 )
3492 }
3493
3494 /// Sets the value of [parent][crate::model::CreateNfsShareRequest::parent].
3495 ///
3496 /// This is a **required** field for requests.
3497 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3498 self.0.request.parent = v.into();
3499 self
3500 }
3501
3502 /// Sets the value of [nfs_share][crate::model::CreateNfsShareRequest::nfs_share].
3503 ///
3504 /// This is a **required** field for requests.
3505 pub fn set_nfs_share<T>(mut self, v: T) -> Self
3506 where
3507 T: std::convert::Into<crate::model::NfsShare>,
3508 {
3509 self.0.request.nfs_share = std::option::Option::Some(v.into());
3510 self
3511 }
3512
3513 /// Sets or clears the value of [nfs_share][crate::model::CreateNfsShareRequest::nfs_share].
3514 ///
3515 /// This is a **required** field for requests.
3516 pub fn set_or_clear_nfs_share<T>(mut self, v: std::option::Option<T>) -> Self
3517 where
3518 T: std::convert::Into<crate::model::NfsShare>,
3519 {
3520 self.0.request.nfs_share = v.map(|x| x.into());
3521 self
3522 }
3523 }
3524
3525 #[doc(hidden)]
3526 impl crate::RequestBuilder for CreateNfsShare {
3527 fn request_options(&mut self) -> &mut crate::RequestOptions {
3528 &mut self.0.options
3529 }
3530 }
3531
3532 /// The request builder for [BareMetalSolution::rename_nfs_share][crate::client::BareMetalSolution::rename_nfs_share] calls.
3533 ///
3534 /// # Example
3535 /// ```
3536 /// # use google_cloud_baremetalsolution_v2::builder::bare_metal_solution::RenameNfsShare;
3537 /// # async fn sample() -> google_cloud_baremetalsolution_v2::Result<()> {
3538 ///
3539 /// let builder = prepare_request_builder();
3540 /// let response = builder.send().await?;
3541 /// # Ok(()) }
3542 ///
3543 /// fn prepare_request_builder() -> RenameNfsShare {
3544 /// # panic!();
3545 /// // ... details omitted ...
3546 /// }
3547 /// ```
3548 #[derive(Clone, Debug)]
3549 pub struct RenameNfsShare(RequestBuilder<crate::model::RenameNfsShareRequest>);
3550
3551 impl RenameNfsShare {
3552 pub(crate) fn new(
3553 stub: std::sync::Arc<dyn super::super::stub::dynamic::BareMetalSolution>,
3554 ) -> Self {
3555 Self(RequestBuilder::new(stub))
3556 }
3557
3558 /// Sets the full request, replacing any prior values.
3559 pub fn with_request<V: Into<crate::model::RenameNfsShareRequest>>(mut self, v: V) -> Self {
3560 self.0.request = v.into();
3561 self
3562 }
3563
3564 /// Sets all the options, replacing any prior values.
3565 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3566 self.0.options = v.into();
3567 self
3568 }
3569
3570 /// Sends the request.
3571 pub async fn send(self) -> Result<crate::model::NfsShare> {
3572 (*self.0.stub)
3573 .rename_nfs_share(self.0.request, self.0.options)
3574 .await
3575 .map(crate::Response::into_body)
3576 }
3577
3578 /// Sets the value of [name][crate::model::RenameNfsShareRequest::name].
3579 ///
3580 /// This is a **required** field for requests.
3581 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3582 self.0.request.name = v.into();
3583 self
3584 }
3585
3586 /// Sets the value of [new_nfsshare_id][crate::model::RenameNfsShareRequest::new_nfsshare_id].
3587 ///
3588 /// This is a **required** field for requests.
3589 pub fn set_new_nfsshare_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3590 self.0.request.new_nfsshare_id = v.into();
3591 self
3592 }
3593 }
3594
3595 #[doc(hidden)]
3596 impl crate::RequestBuilder for RenameNfsShare {
3597 fn request_options(&mut self) -> &mut crate::RequestOptions {
3598 &mut self.0.options
3599 }
3600 }
3601
3602 /// The request builder for [BareMetalSolution::delete_nfs_share][crate::client::BareMetalSolution::delete_nfs_share] calls.
3603 ///
3604 /// # Example
3605 /// ```
3606 /// # use google_cloud_baremetalsolution_v2::builder::bare_metal_solution::DeleteNfsShare;
3607 /// # async fn sample() -> google_cloud_baremetalsolution_v2::Result<()> {
3608 /// use google_cloud_lro::Poller;
3609 ///
3610 /// let builder = prepare_request_builder();
3611 /// let response = builder.poller().until_done().await?;
3612 /// # Ok(()) }
3613 ///
3614 /// fn prepare_request_builder() -> DeleteNfsShare {
3615 /// # panic!();
3616 /// // ... details omitted ...
3617 /// }
3618 /// ```
3619 #[derive(Clone, Debug)]
3620 pub struct DeleteNfsShare(RequestBuilder<crate::model::DeleteNfsShareRequest>);
3621
3622 impl DeleteNfsShare {
3623 pub(crate) fn new(
3624 stub: std::sync::Arc<dyn super::super::stub::dynamic::BareMetalSolution>,
3625 ) -> Self {
3626 Self(RequestBuilder::new(stub))
3627 }
3628
3629 /// Sets the full request, replacing any prior values.
3630 pub fn with_request<V: Into<crate::model::DeleteNfsShareRequest>>(mut self, v: V) -> Self {
3631 self.0.request = v.into();
3632 self
3633 }
3634
3635 /// Sets all the options, replacing any prior values.
3636 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3637 self.0.options = v.into();
3638 self
3639 }
3640
3641 /// Sends the request.
3642 ///
3643 /// # Long running operations
3644 ///
3645 /// This starts, but does not poll, a longrunning operation. More information
3646 /// on [delete_nfs_share][crate::client::BareMetalSolution::delete_nfs_share].
3647 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
3648 (*self.0.stub)
3649 .delete_nfs_share(self.0.request, self.0.options)
3650 .await
3651 .map(crate::Response::into_body)
3652 }
3653
3654 /// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_nfs_share`.
3655 pub fn poller(self) -> impl google_cloud_lro::Poller<(), crate::model::OperationMetadata> {
3656 type Operation =
3657 google_cloud_lro::internal::Operation<wkt::Empty, crate::model::OperationMetadata>;
3658 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
3659 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
3660
3661 let stub = self.0.stub.clone();
3662 let mut options = self.0.options.clone();
3663 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
3664 let query = move |name| {
3665 let stub = stub.clone();
3666 let options = options.clone();
3667 async {
3668 let op = GetOperation::new(stub)
3669 .set_name(name)
3670 .with_options(options)
3671 .send()
3672 .await?;
3673 Ok(Operation::new(op))
3674 }
3675 };
3676
3677 let start = move || async {
3678 let op = self.send().await?;
3679 Ok(Operation::new(op))
3680 };
3681
3682 google_cloud_lro::internal::new_unit_response_poller(
3683 polling_error_policy,
3684 polling_backoff_policy,
3685 start,
3686 query,
3687 )
3688 }
3689
3690 /// Sets the value of [name][crate::model::DeleteNfsShareRequest::name].
3691 ///
3692 /// This is a **required** field for requests.
3693 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3694 self.0.request.name = v.into();
3695 self
3696 }
3697 }
3698
3699 #[doc(hidden)]
3700 impl crate::RequestBuilder for DeleteNfsShare {
3701 fn request_options(&mut self) -> &mut crate::RequestOptions {
3702 &mut self.0.options
3703 }
3704 }
3705
3706 /// The request builder for [BareMetalSolution::list_provisioning_quotas][crate::client::BareMetalSolution::list_provisioning_quotas] calls.
3707 ///
3708 /// # Example
3709 /// ```
3710 /// # use google_cloud_baremetalsolution_v2::builder::bare_metal_solution::ListProvisioningQuotas;
3711 /// # async fn sample() -> google_cloud_baremetalsolution_v2::Result<()> {
3712 /// use google_cloud_gax::paginator::ItemPaginator;
3713 ///
3714 /// let builder = prepare_request_builder();
3715 /// let mut items = builder.by_item();
3716 /// while let Some(result) = items.next().await {
3717 /// let item = result?;
3718 /// }
3719 /// # Ok(()) }
3720 ///
3721 /// fn prepare_request_builder() -> ListProvisioningQuotas {
3722 /// # panic!();
3723 /// // ... details omitted ...
3724 /// }
3725 /// ```
3726 #[derive(Clone, Debug)]
3727 pub struct ListProvisioningQuotas(RequestBuilder<crate::model::ListProvisioningQuotasRequest>);
3728
3729 impl ListProvisioningQuotas {
3730 pub(crate) fn new(
3731 stub: std::sync::Arc<dyn super::super::stub::dynamic::BareMetalSolution>,
3732 ) -> Self {
3733 Self(RequestBuilder::new(stub))
3734 }
3735
3736 /// Sets the full request, replacing any prior values.
3737 pub fn with_request<V: Into<crate::model::ListProvisioningQuotasRequest>>(
3738 mut self,
3739 v: V,
3740 ) -> Self {
3741 self.0.request = v.into();
3742 self
3743 }
3744
3745 /// Sets all the options, replacing any prior values.
3746 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3747 self.0.options = v.into();
3748 self
3749 }
3750
3751 /// Sends the request.
3752 pub async fn send(self) -> Result<crate::model::ListProvisioningQuotasResponse> {
3753 (*self.0.stub)
3754 .list_provisioning_quotas(self.0.request, self.0.options)
3755 .await
3756 .map(crate::Response::into_body)
3757 }
3758
3759 /// Streams each page in the collection.
3760 pub fn by_page(
3761 self,
3762 ) -> impl google_cloud_gax::paginator::Paginator<
3763 crate::model::ListProvisioningQuotasResponse,
3764 crate::Error,
3765 > {
3766 use std::clone::Clone;
3767 let token = self.0.request.page_token.clone();
3768 let execute = move |token: String| {
3769 let mut builder = self.clone();
3770 builder.0.request = builder.0.request.set_page_token(token);
3771 builder.send()
3772 };
3773 google_cloud_gax::paginator::internal::new_paginator(token, execute)
3774 }
3775
3776 /// Streams each item in the collection.
3777 pub fn by_item(
3778 self,
3779 ) -> impl google_cloud_gax::paginator::ItemPaginator<
3780 crate::model::ListProvisioningQuotasResponse,
3781 crate::Error,
3782 > {
3783 use google_cloud_gax::paginator::Paginator;
3784 self.by_page().items()
3785 }
3786
3787 /// Sets the value of [parent][crate::model::ListProvisioningQuotasRequest::parent].
3788 ///
3789 /// This is a **required** field for requests.
3790 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3791 self.0.request.parent = v.into();
3792 self
3793 }
3794
3795 /// Sets the value of [page_size][crate::model::ListProvisioningQuotasRequest::page_size].
3796 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3797 self.0.request.page_size = v.into();
3798 self
3799 }
3800
3801 /// Sets the value of [page_token][crate::model::ListProvisioningQuotasRequest::page_token].
3802 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3803 self.0.request.page_token = v.into();
3804 self
3805 }
3806 }
3807
3808 #[doc(hidden)]
3809 impl crate::RequestBuilder for ListProvisioningQuotas {
3810 fn request_options(&mut self) -> &mut crate::RequestOptions {
3811 &mut self.0.options
3812 }
3813 }
3814
3815 /// The request builder for [BareMetalSolution::submit_provisioning_config][crate::client::BareMetalSolution::submit_provisioning_config] calls.
3816 ///
3817 /// # Example
3818 /// ```
3819 /// # use google_cloud_baremetalsolution_v2::builder::bare_metal_solution::SubmitProvisioningConfig;
3820 /// # async fn sample() -> google_cloud_baremetalsolution_v2::Result<()> {
3821 ///
3822 /// let builder = prepare_request_builder();
3823 /// let response = builder.send().await?;
3824 /// # Ok(()) }
3825 ///
3826 /// fn prepare_request_builder() -> SubmitProvisioningConfig {
3827 /// # panic!();
3828 /// // ... details omitted ...
3829 /// }
3830 /// ```
3831 #[derive(Clone, Debug)]
3832 pub struct SubmitProvisioningConfig(
3833 RequestBuilder<crate::model::SubmitProvisioningConfigRequest>,
3834 );
3835
3836 impl SubmitProvisioningConfig {
3837 pub(crate) fn new(
3838 stub: std::sync::Arc<dyn super::super::stub::dynamic::BareMetalSolution>,
3839 ) -> Self {
3840 Self(RequestBuilder::new(stub))
3841 }
3842
3843 /// Sets the full request, replacing any prior values.
3844 pub fn with_request<V: Into<crate::model::SubmitProvisioningConfigRequest>>(
3845 mut self,
3846 v: V,
3847 ) -> Self {
3848 self.0.request = v.into();
3849 self
3850 }
3851
3852 /// Sets all the options, replacing any prior values.
3853 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3854 self.0.options = v.into();
3855 self
3856 }
3857
3858 /// Sends the request.
3859 pub async fn send(self) -> Result<crate::model::SubmitProvisioningConfigResponse> {
3860 (*self.0.stub)
3861 .submit_provisioning_config(self.0.request, self.0.options)
3862 .await
3863 .map(crate::Response::into_body)
3864 }
3865
3866 /// Sets the value of [parent][crate::model::SubmitProvisioningConfigRequest::parent].
3867 ///
3868 /// This is a **required** field for requests.
3869 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3870 self.0.request.parent = v.into();
3871 self
3872 }
3873
3874 /// Sets the value of [provisioning_config][crate::model::SubmitProvisioningConfigRequest::provisioning_config].
3875 ///
3876 /// This is a **required** field for requests.
3877 pub fn set_provisioning_config<T>(mut self, v: T) -> Self
3878 where
3879 T: std::convert::Into<crate::model::ProvisioningConfig>,
3880 {
3881 self.0.request.provisioning_config = std::option::Option::Some(v.into());
3882 self
3883 }
3884
3885 /// Sets or clears the value of [provisioning_config][crate::model::SubmitProvisioningConfigRequest::provisioning_config].
3886 ///
3887 /// This is a **required** field for requests.
3888 pub fn set_or_clear_provisioning_config<T>(mut self, v: std::option::Option<T>) -> Self
3889 where
3890 T: std::convert::Into<crate::model::ProvisioningConfig>,
3891 {
3892 self.0.request.provisioning_config = v.map(|x| x.into());
3893 self
3894 }
3895
3896 /// Sets the value of [email][crate::model::SubmitProvisioningConfigRequest::email].
3897 pub fn set_email<T: Into<std::string::String>>(mut self, v: T) -> Self {
3898 self.0.request.email = v.into();
3899 self
3900 }
3901 }
3902
3903 #[doc(hidden)]
3904 impl crate::RequestBuilder for SubmitProvisioningConfig {
3905 fn request_options(&mut self) -> &mut crate::RequestOptions {
3906 &mut self.0.options
3907 }
3908 }
3909
3910 /// The request builder for [BareMetalSolution::get_provisioning_config][crate::client::BareMetalSolution::get_provisioning_config] calls.
3911 ///
3912 /// # Example
3913 /// ```
3914 /// # use google_cloud_baremetalsolution_v2::builder::bare_metal_solution::GetProvisioningConfig;
3915 /// # async fn sample() -> google_cloud_baremetalsolution_v2::Result<()> {
3916 ///
3917 /// let builder = prepare_request_builder();
3918 /// let response = builder.send().await?;
3919 /// # Ok(()) }
3920 ///
3921 /// fn prepare_request_builder() -> GetProvisioningConfig {
3922 /// # panic!();
3923 /// // ... details omitted ...
3924 /// }
3925 /// ```
3926 #[derive(Clone, Debug)]
3927 pub struct GetProvisioningConfig(RequestBuilder<crate::model::GetProvisioningConfigRequest>);
3928
3929 impl GetProvisioningConfig {
3930 pub(crate) fn new(
3931 stub: std::sync::Arc<dyn super::super::stub::dynamic::BareMetalSolution>,
3932 ) -> Self {
3933 Self(RequestBuilder::new(stub))
3934 }
3935
3936 /// Sets the full request, replacing any prior values.
3937 pub fn with_request<V: Into<crate::model::GetProvisioningConfigRequest>>(
3938 mut self,
3939 v: V,
3940 ) -> Self {
3941 self.0.request = v.into();
3942 self
3943 }
3944
3945 /// Sets all the options, replacing any prior values.
3946 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3947 self.0.options = v.into();
3948 self
3949 }
3950
3951 /// Sends the request.
3952 pub async fn send(self) -> Result<crate::model::ProvisioningConfig> {
3953 (*self.0.stub)
3954 .get_provisioning_config(self.0.request, self.0.options)
3955 .await
3956 .map(crate::Response::into_body)
3957 }
3958
3959 /// Sets the value of [name][crate::model::GetProvisioningConfigRequest::name].
3960 ///
3961 /// This is a **required** field for requests.
3962 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3963 self.0.request.name = v.into();
3964 self
3965 }
3966 }
3967
3968 #[doc(hidden)]
3969 impl crate::RequestBuilder for GetProvisioningConfig {
3970 fn request_options(&mut self) -> &mut crate::RequestOptions {
3971 &mut self.0.options
3972 }
3973 }
3974
3975 /// The request builder for [BareMetalSolution::create_provisioning_config][crate::client::BareMetalSolution::create_provisioning_config] calls.
3976 ///
3977 /// # Example
3978 /// ```
3979 /// # use google_cloud_baremetalsolution_v2::builder::bare_metal_solution::CreateProvisioningConfig;
3980 /// # async fn sample() -> google_cloud_baremetalsolution_v2::Result<()> {
3981 ///
3982 /// let builder = prepare_request_builder();
3983 /// let response = builder.send().await?;
3984 /// # Ok(()) }
3985 ///
3986 /// fn prepare_request_builder() -> CreateProvisioningConfig {
3987 /// # panic!();
3988 /// // ... details omitted ...
3989 /// }
3990 /// ```
3991 #[derive(Clone, Debug)]
3992 pub struct CreateProvisioningConfig(
3993 RequestBuilder<crate::model::CreateProvisioningConfigRequest>,
3994 );
3995
3996 impl CreateProvisioningConfig {
3997 pub(crate) fn new(
3998 stub: std::sync::Arc<dyn super::super::stub::dynamic::BareMetalSolution>,
3999 ) -> Self {
4000 Self(RequestBuilder::new(stub))
4001 }
4002
4003 /// Sets the full request, replacing any prior values.
4004 pub fn with_request<V: Into<crate::model::CreateProvisioningConfigRequest>>(
4005 mut self,
4006 v: V,
4007 ) -> Self {
4008 self.0.request = v.into();
4009 self
4010 }
4011
4012 /// Sets all the options, replacing any prior values.
4013 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4014 self.0.options = v.into();
4015 self
4016 }
4017
4018 /// Sends the request.
4019 pub async fn send(self) -> Result<crate::model::ProvisioningConfig> {
4020 (*self.0.stub)
4021 .create_provisioning_config(self.0.request, self.0.options)
4022 .await
4023 .map(crate::Response::into_body)
4024 }
4025
4026 /// Sets the value of [parent][crate::model::CreateProvisioningConfigRequest::parent].
4027 ///
4028 /// This is a **required** field for requests.
4029 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4030 self.0.request.parent = v.into();
4031 self
4032 }
4033
4034 /// Sets the value of [provisioning_config][crate::model::CreateProvisioningConfigRequest::provisioning_config].
4035 ///
4036 /// This is a **required** field for requests.
4037 pub fn set_provisioning_config<T>(mut self, v: T) -> Self
4038 where
4039 T: std::convert::Into<crate::model::ProvisioningConfig>,
4040 {
4041 self.0.request.provisioning_config = std::option::Option::Some(v.into());
4042 self
4043 }
4044
4045 /// Sets or clears the value of [provisioning_config][crate::model::CreateProvisioningConfigRequest::provisioning_config].
4046 ///
4047 /// This is a **required** field for requests.
4048 pub fn set_or_clear_provisioning_config<T>(mut self, v: std::option::Option<T>) -> Self
4049 where
4050 T: std::convert::Into<crate::model::ProvisioningConfig>,
4051 {
4052 self.0.request.provisioning_config = v.map(|x| x.into());
4053 self
4054 }
4055
4056 /// Sets the value of [email][crate::model::CreateProvisioningConfigRequest::email].
4057 pub fn set_email<T: Into<std::string::String>>(mut self, v: T) -> Self {
4058 self.0.request.email = v.into();
4059 self
4060 }
4061 }
4062
4063 #[doc(hidden)]
4064 impl crate::RequestBuilder for CreateProvisioningConfig {
4065 fn request_options(&mut self) -> &mut crate::RequestOptions {
4066 &mut self.0.options
4067 }
4068 }
4069
4070 /// The request builder for [BareMetalSolution::update_provisioning_config][crate::client::BareMetalSolution::update_provisioning_config] calls.
4071 ///
4072 /// # Example
4073 /// ```
4074 /// # use google_cloud_baremetalsolution_v2::builder::bare_metal_solution::UpdateProvisioningConfig;
4075 /// # async fn sample() -> google_cloud_baremetalsolution_v2::Result<()> {
4076 ///
4077 /// let builder = prepare_request_builder();
4078 /// let response = builder.send().await?;
4079 /// # Ok(()) }
4080 ///
4081 /// fn prepare_request_builder() -> UpdateProvisioningConfig {
4082 /// # panic!();
4083 /// // ... details omitted ...
4084 /// }
4085 /// ```
4086 #[derive(Clone, Debug)]
4087 pub struct UpdateProvisioningConfig(
4088 RequestBuilder<crate::model::UpdateProvisioningConfigRequest>,
4089 );
4090
4091 impl UpdateProvisioningConfig {
4092 pub(crate) fn new(
4093 stub: std::sync::Arc<dyn super::super::stub::dynamic::BareMetalSolution>,
4094 ) -> Self {
4095 Self(RequestBuilder::new(stub))
4096 }
4097
4098 /// Sets the full request, replacing any prior values.
4099 pub fn with_request<V: Into<crate::model::UpdateProvisioningConfigRequest>>(
4100 mut self,
4101 v: V,
4102 ) -> Self {
4103 self.0.request = v.into();
4104 self
4105 }
4106
4107 /// Sets all the options, replacing any prior values.
4108 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4109 self.0.options = v.into();
4110 self
4111 }
4112
4113 /// Sends the request.
4114 pub async fn send(self) -> Result<crate::model::ProvisioningConfig> {
4115 (*self.0.stub)
4116 .update_provisioning_config(self.0.request, self.0.options)
4117 .await
4118 .map(crate::Response::into_body)
4119 }
4120
4121 /// Sets the value of [provisioning_config][crate::model::UpdateProvisioningConfigRequest::provisioning_config].
4122 ///
4123 /// This is a **required** field for requests.
4124 pub fn set_provisioning_config<T>(mut self, v: T) -> Self
4125 where
4126 T: std::convert::Into<crate::model::ProvisioningConfig>,
4127 {
4128 self.0.request.provisioning_config = std::option::Option::Some(v.into());
4129 self
4130 }
4131
4132 /// Sets or clears the value of [provisioning_config][crate::model::UpdateProvisioningConfigRequest::provisioning_config].
4133 ///
4134 /// This is a **required** field for requests.
4135 pub fn set_or_clear_provisioning_config<T>(mut self, v: std::option::Option<T>) -> Self
4136 where
4137 T: std::convert::Into<crate::model::ProvisioningConfig>,
4138 {
4139 self.0.request.provisioning_config = v.map(|x| x.into());
4140 self
4141 }
4142
4143 /// Sets the value of [update_mask][crate::model::UpdateProvisioningConfigRequest::update_mask].
4144 ///
4145 /// This is a **required** field for requests.
4146 pub fn set_update_mask<T>(mut self, v: T) -> Self
4147 where
4148 T: std::convert::Into<wkt::FieldMask>,
4149 {
4150 self.0.request.update_mask = std::option::Option::Some(v.into());
4151 self
4152 }
4153
4154 /// Sets or clears the value of [update_mask][crate::model::UpdateProvisioningConfigRequest::update_mask].
4155 ///
4156 /// This is a **required** field for requests.
4157 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4158 where
4159 T: std::convert::Into<wkt::FieldMask>,
4160 {
4161 self.0.request.update_mask = v.map(|x| x.into());
4162 self
4163 }
4164
4165 /// Sets the value of [email][crate::model::UpdateProvisioningConfigRequest::email].
4166 pub fn set_email<T: Into<std::string::String>>(mut self, v: T) -> Self {
4167 self.0.request.email = v.into();
4168 self
4169 }
4170 }
4171
4172 #[doc(hidden)]
4173 impl crate::RequestBuilder for UpdateProvisioningConfig {
4174 fn request_options(&mut self) -> &mut crate::RequestOptions {
4175 &mut self.0.options
4176 }
4177 }
4178
4179 /// The request builder for [BareMetalSolution::rename_network][crate::client::BareMetalSolution::rename_network] calls.
4180 ///
4181 /// # Example
4182 /// ```
4183 /// # use google_cloud_baremetalsolution_v2::builder::bare_metal_solution::RenameNetwork;
4184 /// # async fn sample() -> google_cloud_baremetalsolution_v2::Result<()> {
4185 ///
4186 /// let builder = prepare_request_builder();
4187 /// let response = builder.send().await?;
4188 /// # Ok(()) }
4189 ///
4190 /// fn prepare_request_builder() -> RenameNetwork {
4191 /// # panic!();
4192 /// // ... details omitted ...
4193 /// }
4194 /// ```
4195 #[derive(Clone, Debug)]
4196 pub struct RenameNetwork(RequestBuilder<crate::model::RenameNetworkRequest>);
4197
4198 impl RenameNetwork {
4199 pub(crate) fn new(
4200 stub: std::sync::Arc<dyn super::super::stub::dynamic::BareMetalSolution>,
4201 ) -> Self {
4202 Self(RequestBuilder::new(stub))
4203 }
4204
4205 /// Sets the full request, replacing any prior values.
4206 pub fn with_request<V: Into<crate::model::RenameNetworkRequest>>(mut self, v: V) -> Self {
4207 self.0.request = v.into();
4208 self
4209 }
4210
4211 /// Sets all the options, replacing any prior values.
4212 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4213 self.0.options = v.into();
4214 self
4215 }
4216
4217 /// Sends the request.
4218 pub async fn send(self) -> Result<crate::model::Network> {
4219 (*self.0.stub)
4220 .rename_network(self.0.request, self.0.options)
4221 .await
4222 .map(crate::Response::into_body)
4223 }
4224
4225 /// Sets the value of [name][crate::model::RenameNetworkRequest::name].
4226 ///
4227 /// This is a **required** field for requests.
4228 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4229 self.0.request.name = v.into();
4230 self
4231 }
4232
4233 /// Sets the value of [new_network_id][crate::model::RenameNetworkRequest::new_network_id].
4234 ///
4235 /// This is a **required** field for requests.
4236 pub fn set_new_network_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4237 self.0.request.new_network_id = v.into();
4238 self
4239 }
4240 }
4241
4242 #[doc(hidden)]
4243 impl crate::RequestBuilder for RenameNetwork {
4244 fn request_options(&mut self) -> &mut crate::RequestOptions {
4245 &mut self.0.options
4246 }
4247 }
4248
4249 /// The request builder for [BareMetalSolution::list_os_images][crate::client::BareMetalSolution::list_os_images] calls.
4250 ///
4251 /// # Example
4252 /// ```
4253 /// # use google_cloud_baremetalsolution_v2::builder::bare_metal_solution::ListOSImages;
4254 /// # async fn sample() -> google_cloud_baremetalsolution_v2::Result<()> {
4255 /// use google_cloud_gax::paginator::ItemPaginator;
4256 ///
4257 /// let builder = prepare_request_builder();
4258 /// let mut items = builder.by_item();
4259 /// while let Some(result) = items.next().await {
4260 /// let item = result?;
4261 /// }
4262 /// # Ok(()) }
4263 ///
4264 /// fn prepare_request_builder() -> ListOSImages {
4265 /// # panic!();
4266 /// // ... details omitted ...
4267 /// }
4268 /// ```
4269 #[derive(Clone, Debug)]
4270 pub struct ListOSImages(RequestBuilder<crate::model::ListOSImagesRequest>);
4271
4272 impl ListOSImages {
4273 pub(crate) fn new(
4274 stub: std::sync::Arc<dyn super::super::stub::dynamic::BareMetalSolution>,
4275 ) -> Self {
4276 Self(RequestBuilder::new(stub))
4277 }
4278
4279 /// Sets the full request, replacing any prior values.
4280 pub fn with_request<V: Into<crate::model::ListOSImagesRequest>>(mut self, v: V) -> Self {
4281 self.0.request = v.into();
4282 self
4283 }
4284
4285 /// Sets all the options, replacing any prior values.
4286 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4287 self.0.options = v.into();
4288 self
4289 }
4290
4291 /// Sends the request.
4292 pub async fn send(self) -> Result<crate::model::ListOSImagesResponse> {
4293 (*self.0.stub)
4294 .list_os_images(self.0.request, self.0.options)
4295 .await
4296 .map(crate::Response::into_body)
4297 }
4298
4299 /// Streams each page in the collection.
4300 pub fn by_page(
4301 self,
4302 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListOSImagesResponse, crate::Error>
4303 {
4304 use std::clone::Clone;
4305 let token = self.0.request.page_token.clone();
4306 let execute = move |token: String| {
4307 let mut builder = self.clone();
4308 builder.0.request = builder.0.request.set_page_token(token);
4309 builder.send()
4310 };
4311 google_cloud_gax::paginator::internal::new_paginator(token, execute)
4312 }
4313
4314 /// Streams each item in the collection.
4315 pub fn by_item(
4316 self,
4317 ) -> impl google_cloud_gax::paginator::ItemPaginator<
4318 crate::model::ListOSImagesResponse,
4319 crate::Error,
4320 > {
4321 use google_cloud_gax::paginator::Paginator;
4322 self.by_page().items()
4323 }
4324
4325 /// Sets the value of [parent][crate::model::ListOSImagesRequest::parent].
4326 ///
4327 /// This is a **required** field for requests.
4328 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4329 self.0.request.parent = v.into();
4330 self
4331 }
4332
4333 /// Sets the value of [page_size][crate::model::ListOSImagesRequest::page_size].
4334 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4335 self.0.request.page_size = v.into();
4336 self
4337 }
4338
4339 /// Sets the value of [page_token][crate::model::ListOSImagesRequest::page_token].
4340 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4341 self.0.request.page_token = v.into();
4342 self
4343 }
4344 }
4345
4346 #[doc(hidden)]
4347 impl crate::RequestBuilder for ListOSImages {
4348 fn request_options(&mut self) -> &mut crate::RequestOptions {
4349 &mut self.0.options
4350 }
4351 }
4352
4353 /// The request builder for [BareMetalSolution::list_locations][crate::client::BareMetalSolution::list_locations] calls.
4354 ///
4355 /// # Example
4356 /// ```
4357 /// # use google_cloud_baremetalsolution_v2::builder::bare_metal_solution::ListLocations;
4358 /// # async fn sample() -> google_cloud_baremetalsolution_v2::Result<()> {
4359 /// use google_cloud_gax::paginator::ItemPaginator;
4360 ///
4361 /// let builder = prepare_request_builder();
4362 /// let mut items = builder.by_item();
4363 /// while let Some(result) = items.next().await {
4364 /// let item = result?;
4365 /// }
4366 /// # Ok(()) }
4367 ///
4368 /// fn prepare_request_builder() -> ListLocations {
4369 /// # panic!();
4370 /// // ... details omitted ...
4371 /// }
4372 /// ```
4373 #[derive(Clone, Debug)]
4374 pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
4375
4376 impl ListLocations {
4377 pub(crate) fn new(
4378 stub: std::sync::Arc<dyn super::super::stub::dynamic::BareMetalSolution>,
4379 ) -> Self {
4380 Self(RequestBuilder::new(stub))
4381 }
4382
4383 /// Sets the full request, replacing any prior values.
4384 pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
4385 mut self,
4386 v: V,
4387 ) -> Self {
4388 self.0.request = v.into();
4389 self
4390 }
4391
4392 /// Sets all the options, replacing any prior values.
4393 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4394 self.0.options = v.into();
4395 self
4396 }
4397
4398 /// Sends the request.
4399 pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
4400 (*self.0.stub)
4401 .list_locations(self.0.request, self.0.options)
4402 .await
4403 .map(crate::Response::into_body)
4404 }
4405
4406 /// Streams each page in the collection.
4407 pub fn by_page(
4408 self,
4409 ) -> impl google_cloud_gax::paginator::Paginator<
4410 google_cloud_location::model::ListLocationsResponse,
4411 crate::Error,
4412 > {
4413 use std::clone::Clone;
4414 let token = self.0.request.page_token.clone();
4415 let execute = move |token: String| {
4416 let mut builder = self.clone();
4417 builder.0.request = builder.0.request.set_page_token(token);
4418 builder.send()
4419 };
4420 google_cloud_gax::paginator::internal::new_paginator(token, execute)
4421 }
4422
4423 /// Streams each item in the collection.
4424 pub fn by_item(
4425 self,
4426 ) -> impl google_cloud_gax::paginator::ItemPaginator<
4427 google_cloud_location::model::ListLocationsResponse,
4428 crate::Error,
4429 > {
4430 use google_cloud_gax::paginator::Paginator;
4431 self.by_page().items()
4432 }
4433
4434 /// Sets the value of [name][google_cloud_location::model::ListLocationsRequest::name].
4435 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4436 self.0.request.name = v.into();
4437 self
4438 }
4439
4440 /// Sets the value of [filter][google_cloud_location::model::ListLocationsRequest::filter].
4441 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4442 self.0.request.filter = v.into();
4443 self
4444 }
4445
4446 /// Sets the value of [page_size][google_cloud_location::model::ListLocationsRequest::page_size].
4447 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4448 self.0.request.page_size = v.into();
4449 self
4450 }
4451
4452 /// Sets the value of [page_token][google_cloud_location::model::ListLocationsRequest::page_token].
4453 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4454 self.0.request.page_token = v.into();
4455 self
4456 }
4457 }
4458
4459 #[doc(hidden)]
4460 impl crate::RequestBuilder for ListLocations {
4461 fn request_options(&mut self) -> &mut crate::RequestOptions {
4462 &mut self.0.options
4463 }
4464 }
4465
4466 /// The request builder for [BareMetalSolution::get_location][crate::client::BareMetalSolution::get_location] calls.
4467 ///
4468 /// # Example
4469 /// ```
4470 /// # use google_cloud_baremetalsolution_v2::builder::bare_metal_solution::GetLocation;
4471 /// # async fn sample() -> google_cloud_baremetalsolution_v2::Result<()> {
4472 ///
4473 /// let builder = prepare_request_builder();
4474 /// let response = builder.send().await?;
4475 /// # Ok(()) }
4476 ///
4477 /// fn prepare_request_builder() -> GetLocation {
4478 /// # panic!();
4479 /// // ... details omitted ...
4480 /// }
4481 /// ```
4482 #[derive(Clone, Debug)]
4483 pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
4484
4485 impl GetLocation {
4486 pub(crate) fn new(
4487 stub: std::sync::Arc<dyn super::super::stub::dynamic::BareMetalSolution>,
4488 ) -> Self {
4489 Self(RequestBuilder::new(stub))
4490 }
4491
4492 /// Sets the full request, replacing any prior values.
4493 pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
4494 mut self,
4495 v: V,
4496 ) -> Self {
4497 self.0.request = v.into();
4498 self
4499 }
4500
4501 /// Sets all the options, replacing any prior values.
4502 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4503 self.0.options = v.into();
4504 self
4505 }
4506
4507 /// Sends the request.
4508 pub async fn send(self) -> Result<google_cloud_location::model::Location> {
4509 (*self.0.stub)
4510 .get_location(self.0.request, self.0.options)
4511 .await
4512 .map(crate::Response::into_body)
4513 }
4514
4515 /// Sets the value of [name][google_cloud_location::model::GetLocationRequest::name].
4516 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4517 self.0.request.name = v.into();
4518 self
4519 }
4520 }
4521
4522 #[doc(hidden)]
4523 impl crate::RequestBuilder for GetLocation {
4524 fn request_options(&mut self) -> &mut crate::RequestOptions {
4525 &mut self.0.options
4526 }
4527 }
4528
4529 /// The request builder for [BareMetalSolution::get_operation][crate::client::BareMetalSolution::get_operation] calls.
4530 ///
4531 /// # Example
4532 /// ```
4533 /// # use google_cloud_baremetalsolution_v2::builder::bare_metal_solution::GetOperation;
4534 /// # async fn sample() -> google_cloud_baremetalsolution_v2::Result<()> {
4535 ///
4536 /// let builder = prepare_request_builder();
4537 /// let response = builder.send().await?;
4538 /// # Ok(()) }
4539 ///
4540 /// fn prepare_request_builder() -> GetOperation {
4541 /// # panic!();
4542 /// // ... details omitted ...
4543 /// }
4544 /// ```
4545 #[derive(Clone, Debug)]
4546 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
4547
4548 impl GetOperation {
4549 pub(crate) fn new(
4550 stub: std::sync::Arc<dyn super::super::stub::dynamic::BareMetalSolution>,
4551 ) -> Self {
4552 Self(RequestBuilder::new(stub))
4553 }
4554
4555 /// Sets the full request, replacing any prior values.
4556 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
4557 mut self,
4558 v: V,
4559 ) -> Self {
4560 self.0.request = v.into();
4561 self
4562 }
4563
4564 /// Sets all the options, replacing any prior values.
4565 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4566 self.0.options = v.into();
4567 self
4568 }
4569
4570 /// Sends the request.
4571 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4572 (*self.0.stub)
4573 .get_operation(self.0.request, self.0.options)
4574 .await
4575 .map(crate::Response::into_body)
4576 }
4577
4578 /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
4579 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4580 self.0.request.name = v.into();
4581 self
4582 }
4583 }
4584
4585 #[doc(hidden)]
4586 impl crate::RequestBuilder for GetOperation {
4587 fn request_options(&mut self) -> &mut crate::RequestOptions {
4588 &mut self.0.options
4589 }
4590 }
4591}