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