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