google_cloud_storagebatchoperations_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
17/// Request and client builders for [StorageBatchOperations][crate::client::StorageBatchOperations].
18pub mod storage_batch_operations {
19 use crate::Result;
20
21 /// A builder for [StorageBatchOperations][crate::client::StorageBatchOperations].
22 ///
23 /// ```
24 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
25 /// # use google_cloud_storagebatchoperations_v1::*;
26 /// # use builder::storage_batch_operations::ClientBuilder;
27 /// # use client::StorageBatchOperations;
28 /// let builder : ClientBuilder = StorageBatchOperations::builder();
29 /// let client = builder
30 /// .with_endpoint("https://storagebatchoperations.googleapis.com")
31 /// .build().await?;
32 /// # Ok(()) }
33 /// ```
34 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
35
36 pub(crate) mod client {
37 use super::super::super::client::StorageBatchOperations;
38 pub struct Factory;
39 impl crate::ClientFactory for Factory {
40 type Client = StorageBatchOperations;
41 type Credentials = gaxi::options::Credentials;
42 async fn build(
43 self,
44 config: gaxi::options::ClientConfig,
45 ) -> crate::ClientBuilderResult<Self::Client> {
46 Self::Client::new(config).await
47 }
48 }
49 }
50
51 /// Common implementation for [crate::client::StorageBatchOperations] 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::StorageBatchOperations>,
55 request: R,
56 options: crate::RequestOptions,
57 }
58
59 impl<R> RequestBuilder<R>
60 where
61 R: std::default::Default,
62 {
63 pub(crate) fn new(
64 stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageBatchOperations>,
65 ) -> Self {
66 Self {
67 stub,
68 request: R::default(),
69 options: crate::RequestOptions::default(),
70 }
71 }
72 }
73
74 /// The request builder for [StorageBatchOperations::list_jobs][crate::client::StorageBatchOperations::list_jobs] calls.
75 ///
76 /// # Example
77 /// ```
78 /// # use google_cloud_storagebatchoperations_v1::builder::storage_batch_operations::ListJobs;
79 /// # async fn sample() -> google_cloud_storagebatchoperations_v1::Result<()> {
80 /// use google_cloud_gax::paginator::ItemPaginator;
81 ///
82 /// let builder = prepare_request_builder();
83 /// let mut items = builder.by_item();
84 /// while let Some(result) = items.next().await {
85 /// let item = result?;
86 /// }
87 /// # Ok(()) }
88 ///
89 /// fn prepare_request_builder() -> ListJobs {
90 /// # panic!();
91 /// // ... details omitted ...
92 /// }
93 /// ```
94 #[derive(Clone, Debug)]
95 pub struct ListJobs(RequestBuilder<crate::model::ListJobsRequest>);
96
97 impl ListJobs {
98 pub(crate) fn new(
99 stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageBatchOperations>,
100 ) -> Self {
101 Self(RequestBuilder::new(stub))
102 }
103
104 /// Sets the full request, replacing any prior values.
105 pub fn with_request<V: Into<crate::model::ListJobsRequest>>(mut self, v: V) -> Self {
106 self.0.request = v.into();
107 self
108 }
109
110 /// Sets all the options, replacing any prior values.
111 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
112 self.0.options = v.into();
113 self
114 }
115
116 /// Sends the request.
117 pub async fn send(self) -> Result<crate::model::ListJobsResponse> {
118 (*self.0.stub)
119 .list_jobs(self.0.request, self.0.options)
120 .await
121 .map(crate::Response::into_body)
122 }
123
124 /// Streams each page in the collection.
125 pub fn by_page(
126 self,
127 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListJobsResponse, crate::Error>
128 {
129 use std::clone::Clone;
130 let token = self.0.request.page_token.clone();
131 let execute = move |token: String| {
132 let mut builder = self.clone();
133 builder.0.request = builder.0.request.set_page_token(token);
134 builder.send()
135 };
136 google_cloud_gax::paginator::internal::new_paginator(token, execute)
137 }
138
139 /// Streams each item in the collection.
140 pub fn by_item(
141 self,
142 ) -> impl google_cloud_gax::paginator::ItemPaginator<crate::model::ListJobsResponse, crate::Error>
143 {
144 use google_cloud_gax::paginator::Paginator;
145 self.by_page().items()
146 }
147
148 /// Sets the value of [parent][crate::model::ListJobsRequest::parent].
149 ///
150 /// This is a **required** field for requests.
151 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
152 self.0.request.parent = v.into();
153 self
154 }
155
156 /// Sets the value of [filter][crate::model::ListJobsRequest::filter].
157 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
158 self.0.request.filter = v.into();
159 self
160 }
161
162 /// Sets the value of [page_size][crate::model::ListJobsRequest::page_size].
163 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
164 self.0.request.page_size = v.into();
165 self
166 }
167
168 /// Sets the value of [page_token][crate::model::ListJobsRequest::page_token].
169 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
170 self.0.request.page_token = v.into();
171 self
172 }
173
174 /// Sets the value of [order_by][crate::model::ListJobsRequest::order_by].
175 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
176 self.0.request.order_by = v.into();
177 self
178 }
179 }
180
181 #[doc(hidden)]
182 impl crate::RequestBuilder for ListJobs {
183 fn request_options(&mut self) -> &mut crate::RequestOptions {
184 &mut self.0.options
185 }
186 }
187
188 /// The request builder for [StorageBatchOperations::get_job][crate::client::StorageBatchOperations::get_job] calls.
189 ///
190 /// # Example
191 /// ```
192 /// # use google_cloud_storagebatchoperations_v1::builder::storage_batch_operations::GetJob;
193 /// # async fn sample() -> google_cloud_storagebatchoperations_v1::Result<()> {
194 ///
195 /// let builder = prepare_request_builder();
196 /// let response = builder.send().await?;
197 /// # Ok(()) }
198 ///
199 /// fn prepare_request_builder() -> GetJob {
200 /// # panic!();
201 /// // ... details omitted ...
202 /// }
203 /// ```
204 #[derive(Clone, Debug)]
205 pub struct GetJob(RequestBuilder<crate::model::GetJobRequest>);
206
207 impl GetJob {
208 pub(crate) fn new(
209 stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageBatchOperations>,
210 ) -> Self {
211 Self(RequestBuilder::new(stub))
212 }
213
214 /// Sets the full request, replacing any prior values.
215 pub fn with_request<V: Into<crate::model::GetJobRequest>>(mut self, v: V) -> Self {
216 self.0.request = v.into();
217 self
218 }
219
220 /// Sets all the options, replacing any prior values.
221 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
222 self.0.options = v.into();
223 self
224 }
225
226 /// Sends the request.
227 pub async fn send(self) -> Result<crate::model::Job> {
228 (*self.0.stub)
229 .get_job(self.0.request, self.0.options)
230 .await
231 .map(crate::Response::into_body)
232 }
233
234 /// Sets the value of [name][crate::model::GetJobRequest::name].
235 ///
236 /// This is a **required** field for requests.
237 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
238 self.0.request.name = v.into();
239 self
240 }
241 }
242
243 #[doc(hidden)]
244 impl crate::RequestBuilder for GetJob {
245 fn request_options(&mut self) -> &mut crate::RequestOptions {
246 &mut self.0.options
247 }
248 }
249
250 /// The request builder for [StorageBatchOperations::create_job][crate::client::StorageBatchOperations::create_job] calls.
251 ///
252 /// # Example
253 /// ```
254 /// # use google_cloud_storagebatchoperations_v1::builder::storage_batch_operations::CreateJob;
255 /// # async fn sample() -> google_cloud_storagebatchoperations_v1::Result<()> {
256 /// use google_cloud_lro::Poller;
257 ///
258 /// let builder = prepare_request_builder();
259 /// let response = builder.poller().until_done().await?;
260 /// # Ok(()) }
261 ///
262 /// fn prepare_request_builder() -> CreateJob {
263 /// # panic!();
264 /// // ... details omitted ...
265 /// }
266 /// ```
267 #[derive(Clone, Debug)]
268 pub struct CreateJob(RequestBuilder<crate::model::CreateJobRequest>);
269
270 impl CreateJob {
271 pub(crate) fn new(
272 stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageBatchOperations>,
273 ) -> Self {
274 Self(RequestBuilder::new(stub))
275 }
276
277 /// Sets the full request, replacing any prior values.
278 pub fn with_request<V: Into<crate::model::CreateJobRequest>>(mut self, v: V) -> Self {
279 self.0.request = v.into();
280 self
281 }
282
283 /// Sets all the options, replacing any prior values.
284 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
285 self.0.options = v.into();
286 self
287 }
288
289 /// Sends the request.
290 ///
291 /// # Long running operations
292 ///
293 /// This starts, but does not poll, a longrunning operation. More information
294 /// on [create_job][crate::client::StorageBatchOperations::create_job].
295 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
296 (*self.0.stub)
297 .create_job(self.0.request, self.0.options)
298 .await
299 .map(crate::Response::into_body)
300 }
301
302 /// Creates a [Poller][google_cloud_lro::Poller] to work with `create_job`.
303 pub fn poller(
304 self,
305 ) -> impl google_cloud_lro::Poller<crate::model::Job, crate::model::OperationMetadata>
306 {
307 type Operation = google_cloud_lro::internal::Operation<
308 crate::model::Job,
309 crate::model::OperationMetadata,
310 >;
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(google_cloud_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 google_cloud_lro::internal::new_poller(
336 polling_error_policy,
337 polling_backoff_policy,
338 start,
339 query,
340 )
341 }
342
343 /// Sets the value of [parent][crate::model::CreateJobRequest::parent].
344 ///
345 /// This is a **required** field for requests.
346 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
347 self.0.request.parent = v.into();
348 self
349 }
350
351 /// Sets the value of [job_id][crate::model::CreateJobRequest::job_id].
352 ///
353 /// This is a **required** field for requests.
354 pub fn set_job_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
355 self.0.request.job_id = v.into();
356 self
357 }
358
359 /// Sets the value of [job][crate::model::CreateJobRequest::job].
360 ///
361 /// This is a **required** field for requests.
362 pub fn set_job<T>(mut self, v: T) -> Self
363 where
364 T: std::convert::Into<crate::model::Job>,
365 {
366 self.0.request.job = std::option::Option::Some(v.into());
367 self
368 }
369
370 /// Sets or clears the value of [job][crate::model::CreateJobRequest::job].
371 ///
372 /// This is a **required** field for requests.
373 pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
374 where
375 T: std::convert::Into<crate::model::Job>,
376 {
377 self.0.request.job = v.map(|x| x.into());
378 self
379 }
380
381 /// Sets the value of [request_id][crate::model::CreateJobRequest::request_id].
382 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
383 self.0.request.request_id = v.into();
384 self
385 }
386 }
387
388 #[doc(hidden)]
389 impl crate::RequestBuilder for CreateJob {
390 fn request_options(&mut self) -> &mut crate::RequestOptions {
391 &mut self.0.options
392 }
393 }
394
395 /// The request builder for [StorageBatchOperations::delete_job][crate::client::StorageBatchOperations::delete_job] calls.
396 ///
397 /// # Example
398 /// ```
399 /// # use google_cloud_storagebatchoperations_v1::builder::storage_batch_operations::DeleteJob;
400 /// # async fn sample() -> google_cloud_storagebatchoperations_v1::Result<()> {
401 ///
402 /// let builder = prepare_request_builder();
403 /// let response = builder.send().await?;
404 /// # Ok(()) }
405 ///
406 /// fn prepare_request_builder() -> DeleteJob {
407 /// # panic!();
408 /// // ... details omitted ...
409 /// }
410 /// ```
411 #[derive(Clone, Debug)]
412 pub struct DeleteJob(RequestBuilder<crate::model::DeleteJobRequest>);
413
414 impl DeleteJob {
415 pub(crate) fn new(
416 stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageBatchOperations>,
417 ) -> Self {
418 Self(RequestBuilder::new(stub))
419 }
420
421 /// Sets the full request, replacing any prior values.
422 pub fn with_request<V: Into<crate::model::DeleteJobRequest>>(mut self, v: V) -> Self {
423 self.0.request = v.into();
424 self
425 }
426
427 /// Sets all the options, replacing any prior values.
428 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
429 self.0.options = v.into();
430 self
431 }
432
433 /// Sends the request.
434 pub async fn send(self) -> Result<()> {
435 (*self.0.stub)
436 .delete_job(self.0.request, self.0.options)
437 .await
438 .map(crate::Response::into_body)
439 }
440
441 /// Sets the value of [name][crate::model::DeleteJobRequest::name].
442 ///
443 /// This is a **required** field for requests.
444 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
445 self.0.request.name = v.into();
446 self
447 }
448
449 /// Sets the value of [request_id][crate::model::DeleteJobRequest::request_id].
450 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
451 self.0.request.request_id = v.into();
452 self
453 }
454
455 /// Sets the value of [force][crate::model::DeleteJobRequest::force].
456 pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
457 self.0.request.force = v.into();
458 self
459 }
460 }
461
462 #[doc(hidden)]
463 impl crate::RequestBuilder for DeleteJob {
464 fn request_options(&mut self) -> &mut crate::RequestOptions {
465 &mut self.0.options
466 }
467 }
468
469 /// The request builder for [StorageBatchOperations::cancel_job][crate::client::StorageBatchOperations::cancel_job] calls.
470 ///
471 /// # Example
472 /// ```
473 /// # use google_cloud_storagebatchoperations_v1::builder::storage_batch_operations::CancelJob;
474 /// # async fn sample() -> google_cloud_storagebatchoperations_v1::Result<()> {
475 ///
476 /// let builder = prepare_request_builder();
477 /// let response = builder.send().await?;
478 /// # Ok(()) }
479 ///
480 /// fn prepare_request_builder() -> CancelJob {
481 /// # panic!();
482 /// // ... details omitted ...
483 /// }
484 /// ```
485 #[derive(Clone, Debug)]
486 pub struct CancelJob(RequestBuilder<crate::model::CancelJobRequest>);
487
488 impl CancelJob {
489 pub(crate) fn new(
490 stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageBatchOperations>,
491 ) -> Self {
492 Self(RequestBuilder::new(stub))
493 }
494
495 /// Sets the full request, replacing any prior values.
496 pub fn with_request<V: Into<crate::model::CancelJobRequest>>(mut self, v: V) -> Self {
497 self.0.request = v.into();
498 self
499 }
500
501 /// Sets all the options, replacing any prior values.
502 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
503 self.0.options = v.into();
504 self
505 }
506
507 /// Sends the request.
508 pub async fn send(self) -> Result<crate::model::CancelJobResponse> {
509 (*self.0.stub)
510 .cancel_job(self.0.request, self.0.options)
511 .await
512 .map(crate::Response::into_body)
513 }
514
515 /// Sets the value of [name][crate::model::CancelJobRequest::name].
516 ///
517 /// This is a **required** field for requests.
518 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
519 self.0.request.name = v.into();
520 self
521 }
522
523 /// Sets the value of [request_id][crate::model::CancelJobRequest::request_id].
524 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
525 self.0.request.request_id = v.into();
526 self
527 }
528 }
529
530 #[doc(hidden)]
531 impl crate::RequestBuilder for CancelJob {
532 fn request_options(&mut self) -> &mut crate::RequestOptions {
533 &mut self.0.options
534 }
535 }
536
537 /// The request builder for [StorageBatchOperations::list_bucket_operations][crate::client::StorageBatchOperations::list_bucket_operations] calls.
538 ///
539 /// # Example
540 /// ```
541 /// # use google_cloud_storagebatchoperations_v1::builder::storage_batch_operations::ListBucketOperations;
542 /// # async fn sample() -> google_cloud_storagebatchoperations_v1::Result<()> {
543 /// use google_cloud_gax::paginator::ItemPaginator;
544 ///
545 /// let builder = prepare_request_builder();
546 /// let mut items = builder.by_item();
547 /// while let Some(result) = items.next().await {
548 /// let item = result?;
549 /// }
550 /// # Ok(()) }
551 ///
552 /// fn prepare_request_builder() -> ListBucketOperations {
553 /// # panic!();
554 /// // ... details omitted ...
555 /// }
556 /// ```
557 #[derive(Clone, Debug)]
558 pub struct ListBucketOperations(RequestBuilder<crate::model::ListBucketOperationsRequest>);
559
560 impl ListBucketOperations {
561 pub(crate) fn new(
562 stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageBatchOperations>,
563 ) -> Self {
564 Self(RequestBuilder::new(stub))
565 }
566
567 /// Sets the full request, replacing any prior values.
568 pub fn with_request<V: Into<crate::model::ListBucketOperationsRequest>>(
569 mut self,
570 v: V,
571 ) -> Self {
572 self.0.request = v.into();
573 self
574 }
575
576 /// Sets all the options, replacing any prior values.
577 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
578 self.0.options = v.into();
579 self
580 }
581
582 /// Sends the request.
583 pub async fn send(self) -> Result<crate::model::ListBucketOperationsResponse> {
584 (*self.0.stub)
585 .list_bucket_operations(self.0.request, self.0.options)
586 .await
587 .map(crate::Response::into_body)
588 }
589
590 /// Streams each page in the collection.
591 pub fn by_page(
592 self,
593 ) -> impl google_cloud_gax::paginator::Paginator<
594 crate::model::ListBucketOperationsResponse,
595 crate::Error,
596 > {
597 use std::clone::Clone;
598 let token = self.0.request.page_token.clone();
599 let execute = move |token: String| {
600 let mut builder = self.clone();
601 builder.0.request = builder.0.request.set_page_token(token);
602 builder.send()
603 };
604 google_cloud_gax::paginator::internal::new_paginator(token, execute)
605 }
606
607 /// Streams each item in the collection.
608 pub fn by_item(
609 self,
610 ) -> impl google_cloud_gax::paginator::ItemPaginator<
611 crate::model::ListBucketOperationsResponse,
612 crate::Error,
613 > {
614 use google_cloud_gax::paginator::Paginator;
615 self.by_page().items()
616 }
617
618 /// Sets the value of [parent][crate::model::ListBucketOperationsRequest::parent].
619 ///
620 /// This is a **required** field for requests.
621 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
622 self.0.request.parent = v.into();
623 self
624 }
625
626 /// Sets the value of [filter][crate::model::ListBucketOperationsRequest::filter].
627 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
628 self.0.request.filter = v.into();
629 self
630 }
631
632 /// Sets the value of [page_size][crate::model::ListBucketOperationsRequest::page_size].
633 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
634 self.0.request.page_size = v.into();
635 self
636 }
637
638 /// Sets the value of [page_token][crate::model::ListBucketOperationsRequest::page_token].
639 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
640 self.0.request.page_token = v.into();
641 self
642 }
643
644 /// Sets the value of [order_by][crate::model::ListBucketOperationsRequest::order_by].
645 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
646 self.0.request.order_by = v.into();
647 self
648 }
649 }
650
651 #[doc(hidden)]
652 impl crate::RequestBuilder for ListBucketOperations {
653 fn request_options(&mut self) -> &mut crate::RequestOptions {
654 &mut self.0.options
655 }
656 }
657
658 /// The request builder for [StorageBatchOperations::get_bucket_operation][crate::client::StorageBatchOperations::get_bucket_operation] calls.
659 ///
660 /// # Example
661 /// ```
662 /// # use google_cloud_storagebatchoperations_v1::builder::storage_batch_operations::GetBucketOperation;
663 /// # async fn sample() -> google_cloud_storagebatchoperations_v1::Result<()> {
664 ///
665 /// let builder = prepare_request_builder();
666 /// let response = builder.send().await?;
667 /// # Ok(()) }
668 ///
669 /// fn prepare_request_builder() -> GetBucketOperation {
670 /// # panic!();
671 /// // ... details omitted ...
672 /// }
673 /// ```
674 #[derive(Clone, Debug)]
675 pub struct GetBucketOperation(RequestBuilder<crate::model::GetBucketOperationRequest>);
676
677 impl GetBucketOperation {
678 pub(crate) fn new(
679 stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageBatchOperations>,
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::GetBucketOperationRequest>>(
686 mut self,
687 v: V,
688 ) -> Self {
689 self.0.request = v.into();
690 self
691 }
692
693 /// Sets all the options, replacing any prior values.
694 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
695 self.0.options = v.into();
696 self
697 }
698
699 /// Sends the request.
700 pub async fn send(self) -> Result<crate::model::BucketOperation> {
701 (*self.0.stub)
702 .get_bucket_operation(self.0.request, self.0.options)
703 .await
704 .map(crate::Response::into_body)
705 }
706
707 /// Sets the value of [name][crate::model::GetBucketOperationRequest::name].
708 ///
709 /// This is a **required** field for requests.
710 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
711 self.0.request.name = v.into();
712 self
713 }
714 }
715
716 #[doc(hidden)]
717 impl crate::RequestBuilder for GetBucketOperation {
718 fn request_options(&mut self) -> &mut crate::RequestOptions {
719 &mut self.0.options
720 }
721 }
722
723 /// The request builder for [StorageBatchOperations::list_locations][crate::client::StorageBatchOperations::list_locations] calls.
724 ///
725 /// # Example
726 /// ```
727 /// # use google_cloud_storagebatchoperations_v1::builder::storage_batch_operations::ListLocations;
728 /// # async fn sample() -> google_cloud_storagebatchoperations_v1::Result<()> {
729 /// use google_cloud_gax::paginator::ItemPaginator;
730 ///
731 /// let builder = prepare_request_builder();
732 /// let mut items = builder.by_item();
733 /// while let Some(result) = items.next().await {
734 /// let item = result?;
735 /// }
736 /// # Ok(()) }
737 ///
738 /// fn prepare_request_builder() -> ListLocations {
739 /// # panic!();
740 /// // ... details omitted ...
741 /// }
742 /// ```
743 #[derive(Clone, Debug)]
744 pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
745
746 impl ListLocations {
747 pub(crate) fn new(
748 stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageBatchOperations>,
749 ) -> Self {
750 Self(RequestBuilder::new(stub))
751 }
752
753 /// Sets the full request, replacing any prior values.
754 pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
755 mut self,
756 v: V,
757 ) -> Self {
758 self.0.request = v.into();
759 self
760 }
761
762 /// Sets all the options, replacing any prior values.
763 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
764 self.0.options = v.into();
765 self
766 }
767
768 /// Sends the request.
769 pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
770 (*self.0.stub)
771 .list_locations(self.0.request, self.0.options)
772 .await
773 .map(crate::Response::into_body)
774 }
775
776 /// Streams each page in the collection.
777 pub fn by_page(
778 self,
779 ) -> impl google_cloud_gax::paginator::Paginator<
780 google_cloud_location::model::ListLocationsResponse,
781 crate::Error,
782 > {
783 use std::clone::Clone;
784 let token = self.0.request.page_token.clone();
785 let execute = move |token: String| {
786 let mut builder = self.clone();
787 builder.0.request = builder.0.request.set_page_token(token);
788 builder.send()
789 };
790 google_cloud_gax::paginator::internal::new_paginator(token, execute)
791 }
792
793 /// Streams each item in the collection.
794 pub fn by_item(
795 self,
796 ) -> impl google_cloud_gax::paginator::ItemPaginator<
797 google_cloud_location::model::ListLocationsResponse,
798 crate::Error,
799 > {
800 use google_cloud_gax::paginator::Paginator;
801 self.by_page().items()
802 }
803
804 /// Sets the value of [name][google_cloud_location::model::ListLocationsRequest::name].
805 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
806 self.0.request.name = v.into();
807 self
808 }
809
810 /// Sets the value of [filter][google_cloud_location::model::ListLocationsRequest::filter].
811 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
812 self.0.request.filter = v.into();
813 self
814 }
815
816 /// Sets the value of [page_size][google_cloud_location::model::ListLocationsRequest::page_size].
817 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
818 self.0.request.page_size = v.into();
819 self
820 }
821
822 /// Sets the value of [page_token][google_cloud_location::model::ListLocationsRequest::page_token].
823 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
824 self.0.request.page_token = v.into();
825 self
826 }
827 }
828
829 #[doc(hidden)]
830 impl crate::RequestBuilder for ListLocations {
831 fn request_options(&mut self) -> &mut crate::RequestOptions {
832 &mut self.0.options
833 }
834 }
835
836 /// The request builder for [StorageBatchOperations::get_location][crate::client::StorageBatchOperations::get_location] calls.
837 ///
838 /// # Example
839 /// ```
840 /// # use google_cloud_storagebatchoperations_v1::builder::storage_batch_operations::GetLocation;
841 /// # async fn sample() -> google_cloud_storagebatchoperations_v1::Result<()> {
842 ///
843 /// let builder = prepare_request_builder();
844 /// let response = builder.send().await?;
845 /// # Ok(()) }
846 ///
847 /// fn prepare_request_builder() -> GetLocation {
848 /// # panic!();
849 /// // ... details omitted ...
850 /// }
851 /// ```
852 #[derive(Clone, Debug)]
853 pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
854
855 impl GetLocation {
856 pub(crate) fn new(
857 stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageBatchOperations>,
858 ) -> Self {
859 Self(RequestBuilder::new(stub))
860 }
861
862 /// Sets the full request, replacing any prior values.
863 pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
864 mut self,
865 v: V,
866 ) -> Self {
867 self.0.request = v.into();
868 self
869 }
870
871 /// Sets all the options, replacing any prior values.
872 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
873 self.0.options = v.into();
874 self
875 }
876
877 /// Sends the request.
878 pub async fn send(self) -> Result<google_cloud_location::model::Location> {
879 (*self.0.stub)
880 .get_location(self.0.request, self.0.options)
881 .await
882 .map(crate::Response::into_body)
883 }
884
885 /// Sets the value of [name][google_cloud_location::model::GetLocationRequest::name].
886 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
887 self.0.request.name = v.into();
888 self
889 }
890 }
891
892 #[doc(hidden)]
893 impl crate::RequestBuilder for GetLocation {
894 fn request_options(&mut self) -> &mut crate::RequestOptions {
895 &mut self.0.options
896 }
897 }
898
899 /// The request builder for [StorageBatchOperations::list_operations][crate::client::StorageBatchOperations::list_operations] calls.
900 ///
901 /// # Example
902 /// ```
903 /// # use google_cloud_storagebatchoperations_v1::builder::storage_batch_operations::ListOperations;
904 /// # async fn sample() -> google_cloud_storagebatchoperations_v1::Result<()> {
905 /// use google_cloud_gax::paginator::ItemPaginator;
906 ///
907 /// let builder = prepare_request_builder();
908 /// let mut items = builder.by_item();
909 /// while let Some(result) = items.next().await {
910 /// let item = result?;
911 /// }
912 /// # Ok(()) }
913 ///
914 /// fn prepare_request_builder() -> ListOperations {
915 /// # panic!();
916 /// // ... details omitted ...
917 /// }
918 /// ```
919 #[derive(Clone, Debug)]
920 pub struct ListOperations(
921 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
922 );
923
924 impl ListOperations {
925 pub(crate) fn new(
926 stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageBatchOperations>,
927 ) -> Self {
928 Self(RequestBuilder::new(stub))
929 }
930
931 /// Sets the full request, replacing any prior values.
932 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
933 mut self,
934 v: V,
935 ) -> Self {
936 self.0.request = v.into();
937 self
938 }
939
940 /// Sets all the options, replacing any prior values.
941 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
942 self.0.options = v.into();
943 self
944 }
945
946 /// Sends the request.
947 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
948 (*self.0.stub)
949 .list_operations(self.0.request, self.0.options)
950 .await
951 .map(crate::Response::into_body)
952 }
953
954 /// Streams each page in the collection.
955 pub fn by_page(
956 self,
957 ) -> impl google_cloud_gax::paginator::Paginator<
958 google_cloud_longrunning::model::ListOperationsResponse,
959 crate::Error,
960 > {
961 use std::clone::Clone;
962 let token = self.0.request.page_token.clone();
963 let execute = move |token: String| {
964 let mut builder = self.clone();
965 builder.0.request = builder.0.request.set_page_token(token);
966 builder.send()
967 };
968 google_cloud_gax::paginator::internal::new_paginator(token, execute)
969 }
970
971 /// Streams each item in the collection.
972 pub fn by_item(
973 self,
974 ) -> impl google_cloud_gax::paginator::ItemPaginator<
975 google_cloud_longrunning::model::ListOperationsResponse,
976 crate::Error,
977 > {
978 use google_cloud_gax::paginator::Paginator;
979 self.by_page().items()
980 }
981
982 /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
983 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
984 self.0.request.name = v.into();
985 self
986 }
987
988 /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
989 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
990 self.0.request.filter = v.into();
991 self
992 }
993
994 /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
995 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
996 self.0.request.page_size = v.into();
997 self
998 }
999
1000 /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
1001 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1002 self.0.request.page_token = v.into();
1003 self
1004 }
1005
1006 /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
1007 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
1008 self.0.request.return_partial_success = v.into();
1009 self
1010 }
1011 }
1012
1013 #[doc(hidden)]
1014 impl crate::RequestBuilder for ListOperations {
1015 fn request_options(&mut self) -> &mut crate::RequestOptions {
1016 &mut self.0.options
1017 }
1018 }
1019
1020 /// The request builder for [StorageBatchOperations::get_operation][crate::client::StorageBatchOperations::get_operation] calls.
1021 ///
1022 /// # Example
1023 /// ```
1024 /// # use google_cloud_storagebatchoperations_v1::builder::storage_batch_operations::GetOperation;
1025 /// # async fn sample() -> google_cloud_storagebatchoperations_v1::Result<()> {
1026 ///
1027 /// let builder = prepare_request_builder();
1028 /// let response = builder.send().await?;
1029 /// # Ok(()) }
1030 ///
1031 /// fn prepare_request_builder() -> GetOperation {
1032 /// # panic!();
1033 /// // ... details omitted ...
1034 /// }
1035 /// ```
1036 #[derive(Clone, Debug)]
1037 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
1038
1039 impl GetOperation {
1040 pub(crate) fn new(
1041 stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageBatchOperations>,
1042 ) -> Self {
1043 Self(RequestBuilder::new(stub))
1044 }
1045
1046 /// Sets the full request, replacing any prior values.
1047 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
1048 mut self,
1049 v: V,
1050 ) -> Self {
1051 self.0.request = v.into();
1052 self
1053 }
1054
1055 /// Sets all the options, replacing any prior values.
1056 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1057 self.0.options = v.into();
1058 self
1059 }
1060
1061 /// Sends the request.
1062 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1063 (*self.0.stub)
1064 .get_operation(self.0.request, self.0.options)
1065 .await
1066 .map(crate::Response::into_body)
1067 }
1068
1069 /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
1070 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1071 self.0.request.name = v.into();
1072 self
1073 }
1074 }
1075
1076 #[doc(hidden)]
1077 impl crate::RequestBuilder for GetOperation {
1078 fn request_options(&mut self) -> &mut crate::RequestOptions {
1079 &mut self.0.options
1080 }
1081 }
1082
1083 /// The request builder for [StorageBatchOperations::delete_operation][crate::client::StorageBatchOperations::delete_operation] calls.
1084 ///
1085 /// # Example
1086 /// ```
1087 /// # use google_cloud_storagebatchoperations_v1::builder::storage_batch_operations::DeleteOperation;
1088 /// # async fn sample() -> google_cloud_storagebatchoperations_v1::Result<()> {
1089 ///
1090 /// let builder = prepare_request_builder();
1091 /// let response = builder.send().await?;
1092 /// # Ok(()) }
1093 ///
1094 /// fn prepare_request_builder() -> DeleteOperation {
1095 /// # panic!();
1096 /// // ... details omitted ...
1097 /// }
1098 /// ```
1099 #[derive(Clone, Debug)]
1100 pub struct DeleteOperation(
1101 RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
1102 );
1103
1104 impl DeleteOperation {
1105 pub(crate) fn new(
1106 stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageBatchOperations>,
1107 ) -> Self {
1108 Self(RequestBuilder::new(stub))
1109 }
1110
1111 /// Sets the full request, replacing any prior values.
1112 pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
1113 mut self,
1114 v: V,
1115 ) -> Self {
1116 self.0.request = v.into();
1117 self
1118 }
1119
1120 /// Sets all the options, replacing any prior values.
1121 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1122 self.0.options = v.into();
1123 self
1124 }
1125
1126 /// Sends the request.
1127 pub async fn send(self) -> Result<()> {
1128 (*self.0.stub)
1129 .delete_operation(self.0.request, self.0.options)
1130 .await
1131 .map(crate::Response::into_body)
1132 }
1133
1134 /// Sets the value of [name][google_cloud_longrunning::model::DeleteOperationRequest::name].
1135 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1136 self.0.request.name = v.into();
1137 self
1138 }
1139 }
1140
1141 #[doc(hidden)]
1142 impl crate::RequestBuilder for DeleteOperation {
1143 fn request_options(&mut self) -> &mut crate::RequestOptions {
1144 &mut self.0.options
1145 }
1146 }
1147
1148 /// The request builder for [StorageBatchOperations::cancel_operation][crate::client::StorageBatchOperations::cancel_operation] calls.
1149 ///
1150 /// # Example
1151 /// ```
1152 /// # use google_cloud_storagebatchoperations_v1::builder::storage_batch_operations::CancelOperation;
1153 /// # async fn sample() -> google_cloud_storagebatchoperations_v1::Result<()> {
1154 ///
1155 /// let builder = prepare_request_builder();
1156 /// let response = builder.send().await?;
1157 /// # Ok(()) }
1158 ///
1159 /// fn prepare_request_builder() -> CancelOperation {
1160 /// # panic!();
1161 /// // ... details omitted ...
1162 /// }
1163 /// ```
1164 #[derive(Clone, Debug)]
1165 pub struct CancelOperation(
1166 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
1167 );
1168
1169 impl CancelOperation {
1170 pub(crate) fn new(
1171 stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageBatchOperations>,
1172 ) -> Self {
1173 Self(RequestBuilder::new(stub))
1174 }
1175
1176 /// Sets the full request, replacing any prior values.
1177 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
1178 mut self,
1179 v: V,
1180 ) -> Self {
1181 self.0.request = v.into();
1182 self
1183 }
1184
1185 /// Sets all the options, replacing any prior values.
1186 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1187 self.0.options = v.into();
1188 self
1189 }
1190
1191 /// Sends the request.
1192 pub async fn send(self) -> Result<()> {
1193 (*self.0.stub)
1194 .cancel_operation(self.0.request, self.0.options)
1195 .await
1196 .map(crate::Response::into_body)
1197 }
1198
1199 /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
1200 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1201 self.0.request.name = v.into();
1202 self
1203 }
1204 }
1205
1206 #[doc(hidden)]
1207 impl crate::RequestBuilder for CancelOperation {
1208 fn request_options(&mut self) -> &mut crate::RequestOptions {
1209 &mut self.0.options
1210 }
1211 }
1212}