google_cloud_parallelstore_v1/builder.rs
1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17pub mod parallelstore {
18 use crate::Result;
19
20 /// A builder for [Parallelstore][crate::client::Parallelstore].
21 ///
22 /// ```
23 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
24 /// # use google_cloud_parallelstore_v1::*;
25 /// # use builder::parallelstore::ClientBuilder;
26 /// # use client::Parallelstore;
27 /// let builder : ClientBuilder = Parallelstore::builder();
28 /// let client = builder
29 /// .with_endpoint("https://parallelstore.googleapis.com")
30 /// .build().await?;
31 /// # Ok(()) }
32 /// ```
33 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
34
35 pub(crate) mod client {
36 use super::super::super::client::Parallelstore;
37 pub struct Factory;
38 impl crate::ClientFactory for Factory {
39 type Client = Parallelstore;
40 type Credentials = gaxi::options::Credentials;
41 async fn build(
42 self,
43 config: gaxi::options::ClientConfig,
44 ) -> crate::ClientBuilderResult<Self::Client> {
45 Self::Client::new(config).await
46 }
47 }
48 }
49
50 /// Common implementation for [crate::client::Parallelstore] request builders.
51 #[derive(Clone, Debug)]
52 pub(crate) struct RequestBuilder<R: std::default::Default> {
53 stub: std::sync::Arc<dyn super::super::stub::dynamic::Parallelstore>,
54 request: R,
55 options: crate::RequestOptions,
56 }
57
58 impl<R> RequestBuilder<R>
59 where
60 R: std::default::Default,
61 {
62 pub(crate) fn new(
63 stub: std::sync::Arc<dyn super::super::stub::dynamic::Parallelstore>,
64 ) -> Self {
65 Self {
66 stub,
67 request: R::default(),
68 options: crate::RequestOptions::default(),
69 }
70 }
71 }
72
73 /// The request builder for [Parallelstore::list_instances][crate::client::Parallelstore::list_instances] calls.
74 ///
75 /// # Example
76 /// ```
77 /// # use google_cloud_parallelstore_v1::builder::parallelstore::ListInstances;
78 /// # async fn sample() -> google_cloud_parallelstore_v1::Result<()> {
79 /// use google_cloud_gax::paginator::ItemPaginator;
80 ///
81 /// let builder = prepare_request_builder();
82 /// let mut items = builder.by_item();
83 /// while let Some(result) = items.next().await {
84 /// let item = result?;
85 /// }
86 /// # Ok(()) }
87 ///
88 /// fn prepare_request_builder() -> ListInstances {
89 /// # panic!();
90 /// // ... details omitted ...
91 /// }
92 /// ```
93 #[derive(Clone, Debug)]
94 pub struct ListInstances(RequestBuilder<crate::model::ListInstancesRequest>);
95
96 impl ListInstances {
97 pub(crate) fn new(
98 stub: std::sync::Arc<dyn super::super::stub::dynamic::Parallelstore>,
99 ) -> Self {
100 Self(RequestBuilder::new(stub))
101 }
102
103 /// Sets the full request, replacing any prior values.
104 pub fn with_request<V: Into<crate::model::ListInstancesRequest>>(mut self, v: V) -> Self {
105 self.0.request = v.into();
106 self
107 }
108
109 /// Sets all the options, replacing any prior values.
110 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
111 self.0.options = v.into();
112 self
113 }
114
115 /// Sends the request.
116 pub async fn send(self) -> Result<crate::model::ListInstancesResponse> {
117 (*self.0.stub)
118 .list_instances(self.0.request, self.0.options)
119 .await
120 .map(crate::Response::into_body)
121 }
122
123 /// Streams each page in the collection.
124 pub fn by_page(
125 self,
126 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListInstancesResponse, crate::Error>
127 {
128 use std::clone::Clone;
129 let token = self.0.request.page_token.clone();
130 let execute = move |token: String| {
131 let mut builder = self.clone();
132 builder.0.request = builder.0.request.set_page_token(token);
133 builder.send()
134 };
135 google_cloud_gax::paginator::internal::new_paginator(token, execute)
136 }
137
138 /// Streams each item in the collection.
139 pub fn by_item(
140 self,
141 ) -> impl google_cloud_gax::paginator::ItemPaginator<
142 crate::model::ListInstancesResponse,
143 crate::Error,
144 > {
145 use google_cloud_gax::paginator::Paginator;
146 self.by_page().items()
147 }
148
149 /// Sets the value of [parent][crate::model::ListInstancesRequest::parent].
150 ///
151 /// This is a **required** field for requests.
152 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
153 self.0.request.parent = v.into();
154 self
155 }
156
157 /// Sets the value of [page_size][crate::model::ListInstancesRequest::page_size].
158 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
159 self.0.request.page_size = v.into();
160 self
161 }
162
163 /// Sets the value of [page_token][crate::model::ListInstancesRequest::page_token].
164 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
165 self.0.request.page_token = v.into();
166 self
167 }
168
169 /// Sets the value of [filter][crate::model::ListInstancesRequest::filter].
170 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
171 self.0.request.filter = v.into();
172 self
173 }
174
175 /// Sets the value of [order_by][crate::model::ListInstancesRequest::order_by].
176 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
177 self.0.request.order_by = v.into();
178 self
179 }
180 }
181
182 #[doc(hidden)]
183 impl crate::RequestBuilder for ListInstances {
184 fn request_options(&mut self) -> &mut crate::RequestOptions {
185 &mut self.0.options
186 }
187 }
188
189 /// The request builder for [Parallelstore::get_instance][crate::client::Parallelstore::get_instance] calls.
190 ///
191 /// # Example
192 /// ```
193 /// # use google_cloud_parallelstore_v1::builder::parallelstore::GetInstance;
194 /// # async fn sample() -> google_cloud_parallelstore_v1::Result<()> {
195 ///
196 /// let builder = prepare_request_builder();
197 /// let response = builder.send().await?;
198 /// # Ok(()) }
199 ///
200 /// fn prepare_request_builder() -> GetInstance {
201 /// # panic!();
202 /// // ... details omitted ...
203 /// }
204 /// ```
205 #[derive(Clone, Debug)]
206 pub struct GetInstance(RequestBuilder<crate::model::GetInstanceRequest>);
207
208 impl GetInstance {
209 pub(crate) fn new(
210 stub: std::sync::Arc<dyn super::super::stub::dynamic::Parallelstore>,
211 ) -> Self {
212 Self(RequestBuilder::new(stub))
213 }
214
215 /// Sets the full request, replacing any prior values.
216 pub fn with_request<V: Into<crate::model::GetInstanceRequest>>(mut self, v: V) -> Self {
217 self.0.request = v.into();
218 self
219 }
220
221 /// Sets all the options, replacing any prior values.
222 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
223 self.0.options = v.into();
224 self
225 }
226
227 /// Sends the request.
228 pub async fn send(self) -> Result<crate::model::Instance> {
229 (*self.0.stub)
230 .get_instance(self.0.request, self.0.options)
231 .await
232 .map(crate::Response::into_body)
233 }
234
235 /// Sets the value of [name][crate::model::GetInstanceRequest::name].
236 ///
237 /// This is a **required** field for requests.
238 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
239 self.0.request.name = v.into();
240 self
241 }
242 }
243
244 #[doc(hidden)]
245 impl crate::RequestBuilder for GetInstance {
246 fn request_options(&mut self) -> &mut crate::RequestOptions {
247 &mut self.0.options
248 }
249 }
250
251 /// The request builder for [Parallelstore::create_instance][crate::client::Parallelstore::create_instance] calls.
252 ///
253 /// # Example
254 /// ```
255 /// # use google_cloud_parallelstore_v1::builder::parallelstore::CreateInstance;
256 /// # async fn sample() -> google_cloud_parallelstore_v1::Result<()> {
257 /// use google_cloud_lro::Poller;
258 ///
259 /// let builder = prepare_request_builder();
260 /// let response = builder.poller().until_done().await?;
261 /// # Ok(()) }
262 ///
263 /// fn prepare_request_builder() -> CreateInstance {
264 /// # panic!();
265 /// // ... details omitted ...
266 /// }
267 /// ```
268 #[derive(Clone, Debug)]
269 pub struct CreateInstance(RequestBuilder<crate::model::CreateInstanceRequest>);
270
271 impl CreateInstance {
272 pub(crate) fn new(
273 stub: std::sync::Arc<dyn super::super::stub::dynamic::Parallelstore>,
274 ) -> Self {
275 Self(RequestBuilder::new(stub))
276 }
277
278 /// Sets the full request, replacing any prior values.
279 pub fn with_request<V: Into<crate::model::CreateInstanceRequest>>(mut self, v: V) -> Self {
280 self.0.request = v.into();
281 self
282 }
283
284 /// Sets all the options, replacing any prior values.
285 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
286 self.0.options = v.into();
287 self
288 }
289
290 /// Sends the request.
291 ///
292 /// # Long running operations
293 ///
294 /// This starts, but does not poll, a longrunning operation. More information
295 /// on [create_instance][crate::client::Parallelstore::create_instance].
296 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
297 (*self.0.stub)
298 .create_instance(self.0.request, self.0.options)
299 .await
300 .map(crate::Response::into_body)
301 }
302
303 /// Creates a [Poller][google_cloud_lro::Poller] to work with `create_instance`.
304 pub fn poller(
305 self,
306 ) -> impl google_cloud_lro::Poller<crate::model::Instance, crate::model::OperationMetadata>
307 {
308 type Operation = google_cloud_lro::internal::Operation<
309 crate::model::Instance,
310 crate::model::OperationMetadata,
311 >;
312 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
313 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
314
315 let stub = self.0.stub.clone();
316 let mut options = self.0.options.clone();
317 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
318 let query = move |name| {
319 let stub = stub.clone();
320 let options = options.clone();
321 async {
322 let op = GetOperation::new(stub)
323 .set_name(name)
324 .with_options(options)
325 .send()
326 .await?;
327 Ok(Operation::new(op))
328 }
329 };
330
331 let start = move || async {
332 let op = self.send().await?;
333 Ok(Operation::new(op))
334 };
335
336 google_cloud_lro::internal::new_poller(
337 polling_error_policy,
338 polling_backoff_policy,
339 start,
340 query,
341 )
342 }
343
344 /// Sets the value of [parent][crate::model::CreateInstanceRequest::parent].
345 ///
346 /// This is a **required** field for requests.
347 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
348 self.0.request.parent = v.into();
349 self
350 }
351
352 /// Sets the value of [instance_id][crate::model::CreateInstanceRequest::instance_id].
353 ///
354 /// This is a **required** field for requests.
355 pub fn set_instance_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
356 self.0.request.instance_id = v.into();
357 self
358 }
359
360 /// Sets the value of [instance][crate::model::CreateInstanceRequest::instance].
361 ///
362 /// This is a **required** field for requests.
363 pub fn set_instance<T>(mut self, v: T) -> Self
364 where
365 T: std::convert::Into<crate::model::Instance>,
366 {
367 self.0.request.instance = std::option::Option::Some(v.into());
368 self
369 }
370
371 /// Sets or clears the value of [instance][crate::model::CreateInstanceRequest::instance].
372 ///
373 /// This is a **required** field for requests.
374 pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
375 where
376 T: std::convert::Into<crate::model::Instance>,
377 {
378 self.0.request.instance = v.map(|x| x.into());
379 self
380 }
381
382 /// Sets the value of [request_id][crate::model::CreateInstanceRequest::request_id].
383 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
384 self.0.request.request_id = v.into();
385 self
386 }
387 }
388
389 #[doc(hidden)]
390 impl crate::RequestBuilder for CreateInstance {
391 fn request_options(&mut self) -> &mut crate::RequestOptions {
392 &mut self.0.options
393 }
394 }
395
396 /// The request builder for [Parallelstore::update_instance][crate::client::Parallelstore::update_instance] calls.
397 ///
398 /// # Example
399 /// ```
400 /// # use google_cloud_parallelstore_v1::builder::parallelstore::UpdateInstance;
401 /// # async fn sample() -> google_cloud_parallelstore_v1::Result<()> {
402 /// use google_cloud_lro::Poller;
403 ///
404 /// let builder = prepare_request_builder();
405 /// let response = builder.poller().until_done().await?;
406 /// # Ok(()) }
407 ///
408 /// fn prepare_request_builder() -> UpdateInstance {
409 /// # panic!();
410 /// // ... details omitted ...
411 /// }
412 /// ```
413 #[derive(Clone, Debug)]
414 pub struct UpdateInstance(RequestBuilder<crate::model::UpdateInstanceRequest>);
415
416 impl UpdateInstance {
417 pub(crate) fn new(
418 stub: std::sync::Arc<dyn super::super::stub::dynamic::Parallelstore>,
419 ) -> Self {
420 Self(RequestBuilder::new(stub))
421 }
422
423 /// Sets the full request, replacing any prior values.
424 pub fn with_request<V: Into<crate::model::UpdateInstanceRequest>>(mut self, v: V) -> Self {
425 self.0.request = v.into();
426 self
427 }
428
429 /// Sets all the options, replacing any prior values.
430 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
431 self.0.options = v.into();
432 self
433 }
434
435 /// Sends the request.
436 ///
437 /// # Long running operations
438 ///
439 /// This starts, but does not poll, a longrunning operation. More information
440 /// on [update_instance][crate::client::Parallelstore::update_instance].
441 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
442 (*self.0.stub)
443 .update_instance(self.0.request, self.0.options)
444 .await
445 .map(crate::Response::into_body)
446 }
447
448 /// Creates a [Poller][google_cloud_lro::Poller] to work with `update_instance`.
449 pub fn poller(
450 self,
451 ) -> impl google_cloud_lro::Poller<crate::model::Instance, crate::model::OperationMetadata>
452 {
453 type Operation = google_cloud_lro::internal::Operation<
454 crate::model::Instance,
455 crate::model::OperationMetadata,
456 >;
457 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
458 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
459
460 let stub = self.0.stub.clone();
461 let mut options = self.0.options.clone();
462 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
463 let query = move |name| {
464 let stub = stub.clone();
465 let options = options.clone();
466 async {
467 let op = GetOperation::new(stub)
468 .set_name(name)
469 .with_options(options)
470 .send()
471 .await?;
472 Ok(Operation::new(op))
473 }
474 };
475
476 let start = move || async {
477 let op = self.send().await?;
478 Ok(Operation::new(op))
479 };
480
481 google_cloud_lro::internal::new_poller(
482 polling_error_policy,
483 polling_backoff_policy,
484 start,
485 query,
486 )
487 }
488
489 /// Sets the value of [update_mask][crate::model::UpdateInstanceRequest::update_mask].
490 ///
491 /// This is a **required** field for requests.
492 pub fn set_update_mask<T>(mut self, v: T) -> Self
493 where
494 T: std::convert::Into<wkt::FieldMask>,
495 {
496 self.0.request.update_mask = std::option::Option::Some(v.into());
497 self
498 }
499
500 /// Sets or clears the value of [update_mask][crate::model::UpdateInstanceRequest::update_mask].
501 ///
502 /// This is a **required** field for requests.
503 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
504 where
505 T: std::convert::Into<wkt::FieldMask>,
506 {
507 self.0.request.update_mask = v.map(|x| x.into());
508 self
509 }
510
511 /// Sets the value of [instance][crate::model::UpdateInstanceRequest::instance].
512 ///
513 /// This is a **required** field for requests.
514 pub fn set_instance<T>(mut self, v: T) -> Self
515 where
516 T: std::convert::Into<crate::model::Instance>,
517 {
518 self.0.request.instance = std::option::Option::Some(v.into());
519 self
520 }
521
522 /// Sets or clears the value of [instance][crate::model::UpdateInstanceRequest::instance].
523 ///
524 /// This is a **required** field for requests.
525 pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
526 where
527 T: std::convert::Into<crate::model::Instance>,
528 {
529 self.0.request.instance = v.map(|x| x.into());
530 self
531 }
532
533 /// Sets the value of [request_id][crate::model::UpdateInstanceRequest::request_id].
534 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
535 self.0.request.request_id = v.into();
536 self
537 }
538 }
539
540 #[doc(hidden)]
541 impl crate::RequestBuilder for UpdateInstance {
542 fn request_options(&mut self) -> &mut crate::RequestOptions {
543 &mut self.0.options
544 }
545 }
546
547 /// The request builder for [Parallelstore::delete_instance][crate::client::Parallelstore::delete_instance] calls.
548 ///
549 /// # Example
550 /// ```
551 /// # use google_cloud_parallelstore_v1::builder::parallelstore::DeleteInstance;
552 /// # async fn sample() -> google_cloud_parallelstore_v1::Result<()> {
553 /// use google_cloud_lro::Poller;
554 ///
555 /// let builder = prepare_request_builder();
556 /// let response = builder.poller().until_done().await?;
557 /// # Ok(()) }
558 ///
559 /// fn prepare_request_builder() -> DeleteInstance {
560 /// # panic!();
561 /// // ... details omitted ...
562 /// }
563 /// ```
564 #[derive(Clone, Debug)]
565 pub struct DeleteInstance(RequestBuilder<crate::model::DeleteInstanceRequest>);
566
567 impl DeleteInstance {
568 pub(crate) fn new(
569 stub: std::sync::Arc<dyn super::super::stub::dynamic::Parallelstore>,
570 ) -> Self {
571 Self(RequestBuilder::new(stub))
572 }
573
574 /// Sets the full request, replacing any prior values.
575 pub fn with_request<V: Into<crate::model::DeleteInstanceRequest>>(mut self, v: V) -> Self {
576 self.0.request = v.into();
577 self
578 }
579
580 /// Sets all the options, replacing any prior values.
581 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
582 self.0.options = v.into();
583 self
584 }
585
586 /// Sends the request.
587 ///
588 /// # Long running operations
589 ///
590 /// This starts, but does not poll, a longrunning operation. More information
591 /// on [delete_instance][crate::client::Parallelstore::delete_instance].
592 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
593 (*self.0.stub)
594 .delete_instance(self.0.request, self.0.options)
595 .await
596 .map(crate::Response::into_body)
597 }
598
599 /// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_instance`.
600 pub fn poller(self) -> impl google_cloud_lro::Poller<(), crate::model::OperationMetadata> {
601 type Operation =
602 google_cloud_lro::internal::Operation<wkt::Empty, crate::model::OperationMetadata>;
603 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
604 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
605
606 let stub = self.0.stub.clone();
607 let mut options = self.0.options.clone();
608 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
609 let query = move |name| {
610 let stub = stub.clone();
611 let options = options.clone();
612 async {
613 let op = GetOperation::new(stub)
614 .set_name(name)
615 .with_options(options)
616 .send()
617 .await?;
618 Ok(Operation::new(op))
619 }
620 };
621
622 let start = move || async {
623 let op = self.send().await?;
624 Ok(Operation::new(op))
625 };
626
627 google_cloud_lro::internal::new_unit_response_poller(
628 polling_error_policy,
629 polling_backoff_policy,
630 start,
631 query,
632 )
633 }
634
635 /// Sets the value of [name][crate::model::DeleteInstanceRequest::name].
636 ///
637 /// This is a **required** field for requests.
638 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
639 self.0.request.name = v.into();
640 self
641 }
642
643 /// Sets the value of [request_id][crate::model::DeleteInstanceRequest::request_id].
644 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
645 self.0.request.request_id = v.into();
646 self
647 }
648 }
649
650 #[doc(hidden)]
651 impl crate::RequestBuilder for DeleteInstance {
652 fn request_options(&mut self) -> &mut crate::RequestOptions {
653 &mut self.0.options
654 }
655 }
656
657 /// The request builder for [Parallelstore::import_data][crate::client::Parallelstore::import_data] calls.
658 ///
659 /// # Example
660 /// ```
661 /// # use google_cloud_parallelstore_v1::builder::parallelstore::ImportData;
662 /// # async fn sample() -> google_cloud_parallelstore_v1::Result<()> {
663 /// use google_cloud_lro::Poller;
664 ///
665 /// let builder = prepare_request_builder();
666 /// let response = builder.poller().until_done().await?;
667 /// # Ok(()) }
668 ///
669 /// fn prepare_request_builder() -> ImportData {
670 /// # panic!();
671 /// // ... details omitted ...
672 /// }
673 /// ```
674 #[derive(Clone, Debug)]
675 pub struct ImportData(RequestBuilder<crate::model::ImportDataRequest>);
676
677 impl ImportData {
678 pub(crate) fn new(
679 stub: std::sync::Arc<dyn super::super::stub::dynamic::Parallelstore>,
680 ) -> Self {
681 Self(RequestBuilder::new(stub))
682 }
683
684 /// Sets the full request, replacing any prior values.
685 pub fn with_request<V: Into<crate::model::ImportDataRequest>>(mut self, v: V) -> Self {
686 self.0.request = v.into();
687 self
688 }
689
690 /// Sets all the options, replacing any prior values.
691 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
692 self.0.options = v.into();
693 self
694 }
695
696 /// Sends the request.
697 ///
698 /// # Long running operations
699 ///
700 /// This starts, but does not poll, a longrunning operation. More information
701 /// on [import_data][crate::client::Parallelstore::import_data].
702 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
703 (*self.0.stub)
704 .import_data(self.0.request, self.0.options)
705 .await
706 .map(crate::Response::into_body)
707 }
708
709 /// Creates a [Poller][google_cloud_lro::Poller] to work with `import_data`.
710 pub fn poller(
711 self,
712 ) -> impl google_cloud_lro::Poller<
713 crate::model::ImportDataResponse,
714 crate::model::ImportDataMetadata,
715 > {
716 type Operation = google_cloud_lro::internal::Operation<
717 crate::model::ImportDataResponse,
718 crate::model::ImportDataMetadata,
719 >;
720 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
721 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
722
723 let stub = self.0.stub.clone();
724 let mut options = self.0.options.clone();
725 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
726 let query = move |name| {
727 let stub = stub.clone();
728 let options = options.clone();
729 async {
730 let op = GetOperation::new(stub)
731 .set_name(name)
732 .with_options(options)
733 .send()
734 .await?;
735 Ok(Operation::new(op))
736 }
737 };
738
739 let start = move || async {
740 let op = self.send().await?;
741 Ok(Operation::new(op))
742 };
743
744 google_cloud_lro::internal::new_poller(
745 polling_error_policy,
746 polling_backoff_policy,
747 start,
748 query,
749 )
750 }
751
752 /// Sets the value of [name][crate::model::ImportDataRequest::name].
753 ///
754 /// This is a **required** field for requests.
755 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
756 self.0.request.name = v.into();
757 self
758 }
759
760 /// Sets the value of [request_id][crate::model::ImportDataRequest::request_id].
761 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
762 self.0.request.request_id = v.into();
763 self
764 }
765
766 /// Sets the value of [service_account][crate::model::ImportDataRequest::service_account].
767 pub fn set_service_account<T: Into<std::string::String>>(mut self, v: T) -> Self {
768 self.0.request.service_account = v.into();
769 self
770 }
771
772 /// Sets the value of [metadata_options][crate::model::ImportDataRequest::metadata_options].
773 pub fn set_metadata_options<T>(mut self, v: T) -> Self
774 where
775 T: std::convert::Into<crate::model::TransferMetadataOptions>,
776 {
777 self.0.request.metadata_options = std::option::Option::Some(v.into());
778 self
779 }
780
781 /// Sets or clears the value of [metadata_options][crate::model::ImportDataRequest::metadata_options].
782 pub fn set_or_clear_metadata_options<T>(mut self, v: std::option::Option<T>) -> Self
783 where
784 T: std::convert::Into<crate::model::TransferMetadataOptions>,
785 {
786 self.0.request.metadata_options = v.map(|x| x.into());
787 self
788 }
789
790 /// Sets the value of [source][crate::model::ImportDataRequest::source].
791 ///
792 /// Note that all the setters affecting `source` are
793 /// mutually exclusive.
794 pub fn set_source<T: Into<Option<crate::model::import_data_request::Source>>>(
795 mut self,
796 v: T,
797 ) -> Self {
798 self.0.request.source = v.into();
799 self
800 }
801
802 /// Sets the value of [source][crate::model::ImportDataRequest::source]
803 /// to hold a `SourceGcsBucket`.
804 ///
805 /// Note that all the setters affecting `source` are
806 /// mutually exclusive.
807 pub fn set_source_gcs_bucket<
808 T: std::convert::Into<std::boxed::Box<crate::model::SourceGcsBucket>>,
809 >(
810 mut self,
811 v: T,
812 ) -> Self {
813 self.0.request = self.0.request.set_source_gcs_bucket(v);
814 self
815 }
816
817 /// Sets the value of [destination][crate::model::ImportDataRequest::destination].
818 ///
819 /// Note that all the setters affecting `destination` are
820 /// mutually exclusive.
821 pub fn set_destination<T: Into<Option<crate::model::import_data_request::Destination>>>(
822 mut self,
823 v: T,
824 ) -> Self {
825 self.0.request.destination = v.into();
826 self
827 }
828
829 /// Sets the value of [destination][crate::model::ImportDataRequest::destination]
830 /// to hold a `DestinationParallelstore`.
831 ///
832 /// Note that all the setters affecting `destination` are
833 /// mutually exclusive.
834 pub fn set_destination_parallelstore<
835 T: std::convert::Into<std::boxed::Box<crate::model::DestinationParallelstore>>,
836 >(
837 mut self,
838 v: T,
839 ) -> Self {
840 self.0.request = self.0.request.set_destination_parallelstore(v);
841 self
842 }
843 }
844
845 #[doc(hidden)]
846 impl crate::RequestBuilder for ImportData {
847 fn request_options(&mut self) -> &mut crate::RequestOptions {
848 &mut self.0.options
849 }
850 }
851
852 /// The request builder for [Parallelstore::export_data][crate::client::Parallelstore::export_data] calls.
853 ///
854 /// # Example
855 /// ```
856 /// # use google_cloud_parallelstore_v1::builder::parallelstore::ExportData;
857 /// # async fn sample() -> google_cloud_parallelstore_v1::Result<()> {
858 /// use google_cloud_lro::Poller;
859 ///
860 /// let builder = prepare_request_builder();
861 /// let response = builder.poller().until_done().await?;
862 /// # Ok(()) }
863 ///
864 /// fn prepare_request_builder() -> ExportData {
865 /// # panic!();
866 /// // ... details omitted ...
867 /// }
868 /// ```
869 #[derive(Clone, Debug)]
870 pub struct ExportData(RequestBuilder<crate::model::ExportDataRequest>);
871
872 impl ExportData {
873 pub(crate) fn new(
874 stub: std::sync::Arc<dyn super::super::stub::dynamic::Parallelstore>,
875 ) -> Self {
876 Self(RequestBuilder::new(stub))
877 }
878
879 /// Sets the full request, replacing any prior values.
880 pub fn with_request<V: Into<crate::model::ExportDataRequest>>(mut self, v: V) -> Self {
881 self.0.request = v.into();
882 self
883 }
884
885 /// Sets all the options, replacing any prior values.
886 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
887 self.0.options = v.into();
888 self
889 }
890
891 /// Sends the request.
892 ///
893 /// # Long running operations
894 ///
895 /// This starts, but does not poll, a longrunning operation. More information
896 /// on [export_data][crate::client::Parallelstore::export_data].
897 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
898 (*self.0.stub)
899 .export_data(self.0.request, self.0.options)
900 .await
901 .map(crate::Response::into_body)
902 }
903
904 /// Creates a [Poller][google_cloud_lro::Poller] to work with `export_data`.
905 pub fn poller(
906 self,
907 ) -> impl google_cloud_lro::Poller<
908 crate::model::ExportDataResponse,
909 crate::model::ExportDataMetadata,
910 > {
911 type Operation = google_cloud_lro::internal::Operation<
912 crate::model::ExportDataResponse,
913 crate::model::ExportDataMetadata,
914 >;
915 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
916 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
917
918 let stub = self.0.stub.clone();
919 let mut options = self.0.options.clone();
920 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
921 let query = move |name| {
922 let stub = stub.clone();
923 let options = options.clone();
924 async {
925 let op = GetOperation::new(stub)
926 .set_name(name)
927 .with_options(options)
928 .send()
929 .await?;
930 Ok(Operation::new(op))
931 }
932 };
933
934 let start = move || async {
935 let op = self.send().await?;
936 Ok(Operation::new(op))
937 };
938
939 google_cloud_lro::internal::new_poller(
940 polling_error_policy,
941 polling_backoff_policy,
942 start,
943 query,
944 )
945 }
946
947 /// Sets the value of [name][crate::model::ExportDataRequest::name].
948 ///
949 /// This is a **required** field for requests.
950 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
951 self.0.request.name = v.into();
952 self
953 }
954
955 /// Sets the value of [request_id][crate::model::ExportDataRequest::request_id].
956 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
957 self.0.request.request_id = v.into();
958 self
959 }
960
961 /// Sets the value of [service_account][crate::model::ExportDataRequest::service_account].
962 pub fn set_service_account<T: Into<std::string::String>>(mut self, v: T) -> Self {
963 self.0.request.service_account = v.into();
964 self
965 }
966
967 /// Sets the value of [metadata_options][crate::model::ExportDataRequest::metadata_options].
968 pub fn set_metadata_options<T>(mut self, v: T) -> Self
969 where
970 T: std::convert::Into<crate::model::TransferMetadataOptions>,
971 {
972 self.0.request.metadata_options = std::option::Option::Some(v.into());
973 self
974 }
975
976 /// Sets or clears the value of [metadata_options][crate::model::ExportDataRequest::metadata_options].
977 pub fn set_or_clear_metadata_options<T>(mut self, v: std::option::Option<T>) -> Self
978 where
979 T: std::convert::Into<crate::model::TransferMetadataOptions>,
980 {
981 self.0.request.metadata_options = v.map(|x| x.into());
982 self
983 }
984
985 /// Sets the value of [source][crate::model::ExportDataRequest::source].
986 ///
987 /// Note that all the setters affecting `source` are
988 /// mutually exclusive.
989 pub fn set_source<T: Into<Option<crate::model::export_data_request::Source>>>(
990 mut self,
991 v: T,
992 ) -> Self {
993 self.0.request.source = v.into();
994 self
995 }
996
997 /// Sets the value of [source][crate::model::ExportDataRequest::source]
998 /// to hold a `SourceParallelstore`.
999 ///
1000 /// Note that all the setters affecting `source` are
1001 /// mutually exclusive.
1002 pub fn set_source_parallelstore<
1003 T: std::convert::Into<std::boxed::Box<crate::model::SourceParallelstore>>,
1004 >(
1005 mut self,
1006 v: T,
1007 ) -> Self {
1008 self.0.request = self.0.request.set_source_parallelstore(v);
1009 self
1010 }
1011
1012 /// Sets the value of [destination][crate::model::ExportDataRequest::destination].
1013 ///
1014 /// Note that all the setters affecting `destination` are
1015 /// mutually exclusive.
1016 pub fn set_destination<T: Into<Option<crate::model::export_data_request::Destination>>>(
1017 mut self,
1018 v: T,
1019 ) -> Self {
1020 self.0.request.destination = v.into();
1021 self
1022 }
1023
1024 /// Sets the value of [destination][crate::model::ExportDataRequest::destination]
1025 /// to hold a `DestinationGcsBucket`.
1026 ///
1027 /// Note that all the setters affecting `destination` are
1028 /// mutually exclusive.
1029 pub fn set_destination_gcs_bucket<
1030 T: std::convert::Into<std::boxed::Box<crate::model::DestinationGcsBucket>>,
1031 >(
1032 mut self,
1033 v: T,
1034 ) -> Self {
1035 self.0.request = self.0.request.set_destination_gcs_bucket(v);
1036 self
1037 }
1038 }
1039
1040 #[doc(hidden)]
1041 impl crate::RequestBuilder for ExportData {
1042 fn request_options(&mut self) -> &mut crate::RequestOptions {
1043 &mut self.0.options
1044 }
1045 }
1046
1047 /// The request builder for [Parallelstore::list_locations][crate::client::Parallelstore::list_locations] calls.
1048 ///
1049 /// # Example
1050 /// ```
1051 /// # use google_cloud_parallelstore_v1::builder::parallelstore::ListLocations;
1052 /// # async fn sample() -> google_cloud_parallelstore_v1::Result<()> {
1053 /// use google_cloud_gax::paginator::ItemPaginator;
1054 ///
1055 /// let builder = prepare_request_builder();
1056 /// let mut items = builder.by_item();
1057 /// while let Some(result) = items.next().await {
1058 /// let item = result?;
1059 /// }
1060 /// # Ok(()) }
1061 ///
1062 /// fn prepare_request_builder() -> ListLocations {
1063 /// # panic!();
1064 /// // ... details omitted ...
1065 /// }
1066 /// ```
1067 #[derive(Clone, Debug)]
1068 pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
1069
1070 impl ListLocations {
1071 pub(crate) fn new(
1072 stub: std::sync::Arc<dyn super::super::stub::dynamic::Parallelstore>,
1073 ) -> Self {
1074 Self(RequestBuilder::new(stub))
1075 }
1076
1077 /// Sets the full request, replacing any prior values.
1078 pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
1079 mut self,
1080 v: V,
1081 ) -> Self {
1082 self.0.request = v.into();
1083 self
1084 }
1085
1086 /// Sets all the options, replacing any prior values.
1087 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1088 self.0.options = v.into();
1089 self
1090 }
1091
1092 /// Sends the request.
1093 pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
1094 (*self.0.stub)
1095 .list_locations(self.0.request, self.0.options)
1096 .await
1097 .map(crate::Response::into_body)
1098 }
1099
1100 /// Streams each page in the collection.
1101 pub fn by_page(
1102 self,
1103 ) -> impl google_cloud_gax::paginator::Paginator<
1104 google_cloud_location::model::ListLocationsResponse,
1105 crate::Error,
1106 > {
1107 use std::clone::Clone;
1108 let token = self.0.request.page_token.clone();
1109 let execute = move |token: String| {
1110 let mut builder = self.clone();
1111 builder.0.request = builder.0.request.set_page_token(token);
1112 builder.send()
1113 };
1114 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1115 }
1116
1117 /// Streams each item in the collection.
1118 pub fn by_item(
1119 self,
1120 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1121 google_cloud_location::model::ListLocationsResponse,
1122 crate::Error,
1123 > {
1124 use google_cloud_gax::paginator::Paginator;
1125 self.by_page().items()
1126 }
1127
1128 /// Sets the value of [name][google_cloud_location::model::ListLocationsRequest::name].
1129 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1130 self.0.request.name = v.into();
1131 self
1132 }
1133
1134 /// Sets the value of [filter][google_cloud_location::model::ListLocationsRequest::filter].
1135 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1136 self.0.request.filter = v.into();
1137 self
1138 }
1139
1140 /// Sets the value of [page_size][google_cloud_location::model::ListLocationsRequest::page_size].
1141 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1142 self.0.request.page_size = v.into();
1143 self
1144 }
1145
1146 /// Sets the value of [page_token][google_cloud_location::model::ListLocationsRequest::page_token].
1147 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1148 self.0.request.page_token = v.into();
1149 self
1150 }
1151 }
1152
1153 #[doc(hidden)]
1154 impl crate::RequestBuilder for ListLocations {
1155 fn request_options(&mut self) -> &mut crate::RequestOptions {
1156 &mut self.0.options
1157 }
1158 }
1159
1160 /// The request builder for [Parallelstore::get_location][crate::client::Parallelstore::get_location] calls.
1161 ///
1162 /// # Example
1163 /// ```
1164 /// # use google_cloud_parallelstore_v1::builder::parallelstore::GetLocation;
1165 /// # async fn sample() -> google_cloud_parallelstore_v1::Result<()> {
1166 ///
1167 /// let builder = prepare_request_builder();
1168 /// let response = builder.send().await?;
1169 /// # Ok(()) }
1170 ///
1171 /// fn prepare_request_builder() -> GetLocation {
1172 /// # panic!();
1173 /// // ... details omitted ...
1174 /// }
1175 /// ```
1176 #[derive(Clone, Debug)]
1177 pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
1178
1179 impl GetLocation {
1180 pub(crate) fn new(
1181 stub: std::sync::Arc<dyn super::super::stub::dynamic::Parallelstore>,
1182 ) -> Self {
1183 Self(RequestBuilder::new(stub))
1184 }
1185
1186 /// Sets the full request, replacing any prior values.
1187 pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
1188 mut self,
1189 v: V,
1190 ) -> Self {
1191 self.0.request = v.into();
1192 self
1193 }
1194
1195 /// Sets all the options, replacing any prior values.
1196 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1197 self.0.options = v.into();
1198 self
1199 }
1200
1201 /// Sends the request.
1202 pub async fn send(self) -> Result<google_cloud_location::model::Location> {
1203 (*self.0.stub)
1204 .get_location(self.0.request, self.0.options)
1205 .await
1206 .map(crate::Response::into_body)
1207 }
1208
1209 /// Sets the value of [name][google_cloud_location::model::GetLocationRequest::name].
1210 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1211 self.0.request.name = v.into();
1212 self
1213 }
1214 }
1215
1216 #[doc(hidden)]
1217 impl crate::RequestBuilder for GetLocation {
1218 fn request_options(&mut self) -> &mut crate::RequestOptions {
1219 &mut self.0.options
1220 }
1221 }
1222
1223 /// The request builder for [Parallelstore::list_operations][crate::client::Parallelstore::list_operations] calls.
1224 ///
1225 /// # Example
1226 /// ```
1227 /// # use google_cloud_parallelstore_v1::builder::parallelstore::ListOperations;
1228 /// # async fn sample() -> google_cloud_parallelstore_v1::Result<()> {
1229 /// use google_cloud_gax::paginator::ItemPaginator;
1230 ///
1231 /// let builder = prepare_request_builder();
1232 /// let mut items = builder.by_item();
1233 /// while let Some(result) = items.next().await {
1234 /// let item = result?;
1235 /// }
1236 /// # Ok(()) }
1237 ///
1238 /// fn prepare_request_builder() -> ListOperations {
1239 /// # panic!();
1240 /// // ... details omitted ...
1241 /// }
1242 /// ```
1243 #[derive(Clone, Debug)]
1244 pub struct ListOperations(
1245 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
1246 );
1247
1248 impl ListOperations {
1249 pub(crate) fn new(
1250 stub: std::sync::Arc<dyn super::super::stub::dynamic::Parallelstore>,
1251 ) -> Self {
1252 Self(RequestBuilder::new(stub))
1253 }
1254
1255 /// Sets the full request, replacing any prior values.
1256 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
1257 mut self,
1258 v: V,
1259 ) -> Self {
1260 self.0.request = v.into();
1261 self
1262 }
1263
1264 /// Sets all the options, replacing any prior values.
1265 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1266 self.0.options = v.into();
1267 self
1268 }
1269
1270 /// Sends the request.
1271 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
1272 (*self.0.stub)
1273 .list_operations(self.0.request, self.0.options)
1274 .await
1275 .map(crate::Response::into_body)
1276 }
1277
1278 /// Streams each page in the collection.
1279 pub fn by_page(
1280 self,
1281 ) -> impl google_cloud_gax::paginator::Paginator<
1282 google_cloud_longrunning::model::ListOperationsResponse,
1283 crate::Error,
1284 > {
1285 use std::clone::Clone;
1286 let token = self.0.request.page_token.clone();
1287 let execute = move |token: String| {
1288 let mut builder = self.clone();
1289 builder.0.request = builder.0.request.set_page_token(token);
1290 builder.send()
1291 };
1292 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1293 }
1294
1295 /// Streams each item in the collection.
1296 pub fn by_item(
1297 self,
1298 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1299 google_cloud_longrunning::model::ListOperationsResponse,
1300 crate::Error,
1301 > {
1302 use google_cloud_gax::paginator::Paginator;
1303 self.by_page().items()
1304 }
1305
1306 /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
1307 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1308 self.0.request.name = v.into();
1309 self
1310 }
1311
1312 /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
1313 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1314 self.0.request.filter = v.into();
1315 self
1316 }
1317
1318 /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
1319 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1320 self.0.request.page_size = v.into();
1321 self
1322 }
1323
1324 /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
1325 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1326 self.0.request.page_token = v.into();
1327 self
1328 }
1329
1330 /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
1331 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
1332 self.0.request.return_partial_success = v.into();
1333 self
1334 }
1335 }
1336
1337 #[doc(hidden)]
1338 impl crate::RequestBuilder for ListOperations {
1339 fn request_options(&mut self) -> &mut crate::RequestOptions {
1340 &mut self.0.options
1341 }
1342 }
1343
1344 /// The request builder for [Parallelstore::get_operation][crate::client::Parallelstore::get_operation] calls.
1345 ///
1346 /// # Example
1347 /// ```
1348 /// # use google_cloud_parallelstore_v1::builder::parallelstore::GetOperation;
1349 /// # async fn sample() -> google_cloud_parallelstore_v1::Result<()> {
1350 ///
1351 /// let builder = prepare_request_builder();
1352 /// let response = builder.send().await?;
1353 /// # Ok(()) }
1354 ///
1355 /// fn prepare_request_builder() -> GetOperation {
1356 /// # panic!();
1357 /// // ... details omitted ...
1358 /// }
1359 /// ```
1360 #[derive(Clone, Debug)]
1361 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
1362
1363 impl GetOperation {
1364 pub(crate) fn new(
1365 stub: std::sync::Arc<dyn super::super::stub::dynamic::Parallelstore>,
1366 ) -> Self {
1367 Self(RequestBuilder::new(stub))
1368 }
1369
1370 /// Sets the full request, replacing any prior values.
1371 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
1372 mut self,
1373 v: V,
1374 ) -> Self {
1375 self.0.request = v.into();
1376 self
1377 }
1378
1379 /// Sets all the options, replacing any prior values.
1380 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1381 self.0.options = v.into();
1382 self
1383 }
1384
1385 /// Sends the request.
1386 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1387 (*self.0.stub)
1388 .get_operation(self.0.request, self.0.options)
1389 .await
1390 .map(crate::Response::into_body)
1391 }
1392
1393 /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
1394 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1395 self.0.request.name = v.into();
1396 self
1397 }
1398 }
1399
1400 #[doc(hidden)]
1401 impl crate::RequestBuilder for GetOperation {
1402 fn request_options(&mut self) -> &mut crate::RequestOptions {
1403 &mut self.0.options
1404 }
1405 }
1406
1407 /// The request builder for [Parallelstore::delete_operation][crate::client::Parallelstore::delete_operation] calls.
1408 ///
1409 /// # Example
1410 /// ```
1411 /// # use google_cloud_parallelstore_v1::builder::parallelstore::DeleteOperation;
1412 /// # async fn sample() -> google_cloud_parallelstore_v1::Result<()> {
1413 ///
1414 /// let builder = prepare_request_builder();
1415 /// let response = builder.send().await?;
1416 /// # Ok(()) }
1417 ///
1418 /// fn prepare_request_builder() -> DeleteOperation {
1419 /// # panic!();
1420 /// // ... details omitted ...
1421 /// }
1422 /// ```
1423 #[derive(Clone, Debug)]
1424 pub struct DeleteOperation(
1425 RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
1426 );
1427
1428 impl DeleteOperation {
1429 pub(crate) fn new(
1430 stub: std::sync::Arc<dyn super::super::stub::dynamic::Parallelstore>,
1431 ) -> Self {
1432 Self(RequestBuilder::new(stub))
1433 }
1434
1435 /// Sets the full request, replacing any prior values.
1436 pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
1437 mut self,
1438 v: V,
1439 ) -> Self {
1440 self.0.request = v.into();
1441 self
1442 }
1443
1444 /// Sets all the options, replacing any prior values.
1445 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1446 self.0.options = v.into();
1447 self
1448 }
1449
1450 /// Sends the request.
1451 pub async fn send(self) -> Result<()> {
1452 (*self.0.stub)
1453 .delete_operation(self.0.request, self.0.options)
1454 .await
1455 .map(crate::Response::into_body)
1456 }
1457
1458 /// Sets the value of [name][google_cloud_longrunning::model::DeleteOperationRequest::name].
1459 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1460 self.0.request.name = v.into();
1461 self
1462 }
1463 }
1464
1465 #[doc(hidden)]
1466 impl crate::RequestBuilder for DeleteOperation {
1467 fn request_options(&mut self) -> &mut crate::RequestOptions {
1468 &mut self.0.options
1469 }
1470 }
1471
1472 /// The request builder for [Parallelstore::cancel_operation][crate::client::Parallelstore::cancel_operation] calls.
1473 ///
1474 /// # Example
1475 /// ```
1476 /// # use google_cloud_parallelstore_v1::builder::parallelstore::CancelOperation;
1477 /// # async fn sample() -> google_cloud_parallelstore_v1::Result<()> {
1478 ///
1479 /// let builder = prepare_request_builder();
1480 /// let response = builder.send().await?;
1481 /// # Ok(()) }
1482 ///
1483 /// fn prepare_request_builder() -> CancelOperation {
1484 /// # panic!();
1485 /// // ... details omitted ...
1486 /// }
1487 /// ```
1488 #[derive(Clone, Debug)]
1489 pub struct CancelOperation(
1490 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
1491 );
1492
1493 impl CancelOperation {
1494 pub(crate) fn new(
1495 stub: std::sync::Arc<dyn super::super::stub::dynamic::Parallelstore>,
1496 ) -> Self {
1497 Self(RequestBuilder::new(stub))
1498 }
1499
1500 /// Sets the full request, replacing any prior values.
1501 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
1502 mut self,
1503 v: V,
1504 ) -> Self {
1505 self.0.request = v.into();
1506 self
1507 }
1508
1509 /// Sets all the options, replacing any prior values.
1510 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1511 self.0.options = v.into();
1512 self
1513 }
1514
1515 /// Sends the request.
1516 pub async fn send(self) -> Result<()> {
1517 (*self.0.stub)
1518 .cancel_operation(self.0.request, self.0.options)
1519 .await
1520 .map(crate::Response::into_body)
1521 }
1522
1523 /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
1524 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1525 self.0.request.name = v.into();
1526 self
1527 }
1528 }
1529
1530 #[doc(hidden)]
1531 impl crate::RequestBuilder for CancelOperation {
1532 fn request_options(&mut self) -> &mut crate::RequestOptions {
1533 &mut self.0.options
1534 }
1535 }
1536}