Skip to main content

google_cloud_notebooks_v2/
builder.rs

1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17pub mod notebook_service {
18    use crate::Result;
19
20    /// A builder for [NotebookService][crate::client::NotebookService].
21    ///
22    /// ```
23    /// # async fn sample() -> gax::client_builder::Result<()> {
24    /// # use google_cloud_notebooks_v2::*;
25    /// # use builder::notebook_service::ClientBuilder;
26    /// # use client::NotebookService;
27    /// let builder : ClientBuilder = NotebookService::builder();
28    /// let client = builder
29    ///     .with_endpoint("https://notebooks.googleapis.com")
30    ///     .build().await?;
31    /// # 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::NotebookService;
38        pub struct Factory;
39        impl gax::client_builder::internal::ClientFactory for Factory {
40            type Client = NotebookService;
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::NotebookService] 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::NotebookService>,
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::NotebookService>,
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 [NotebookService::list_instances][crate::client::NotebookService::list_instances] calls.
75    ///
76    /// # Example
77    /// ```
78    /// # use google_cloud_notebooks_v2::builder::notebook_service::ListInstances;
79    /// # async fn sample() -> gax::Result<()> {
80    /// use gax::paginator::ItemPaginator;
81    ///
82    /// let builder = prepare_request_builder();
83    /// let mut items = builder.by_item();
84    /// while let Some(result) = items.next().await {
85    ///   let item = result?;
86    /// }
87    /// # Ok(()) }
88    ///
89    /// fn prepare_request_builder() -> ListInstances {
90    ///   # panic!();
91    ///   // ... details omitted ...
92    /// }
93    /// ```
94    #[derive(Clone, Debug)]
95    pub struct ListInstances(RequestBuilder<crate::model::ListInstancesRequest>);
96
97    impl ListInstances {
98        pub(crate) fn new(
99            stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
100        ) -> Self {
101            Self(RequestBuilder::new(stub))
102        }
103
104        /// Sets the full request, replacing any prior values.
105        pub fn with_request<V: Into<crate::model::ListInstancesRequest>>(mut self, v: V) -> Self {
106            self.0.request = v.into();
107            self
108        }
109
110        /// Sets all the options, replacing any prior values.
111        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
112            self.0.options = v.into();
113            self
114        }
115
116        /// Sends the request.
117        pub async fn send(self) -> Result<crate::model::ListInstancesResponse> {
118            (*self.0.stub)
119                .list_instances(self.0.request, self.0.options)
120                .await
121                .map(gax::response::Response::into_body)
122        }
123
124        /// Streams each page in the collection.
125        pub fn by_page(
126            self,
127        ) -> impl gax::paginator::Paginator<crate::model::ListInstancesResponse, gax::error::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            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 gax::paginator::ItemPaginator<crate::model::ListInstancesResponse, gax::error::Error>
143        {
144            use gax::paginator::Paginator;
145            self.by_page().items()
146        }
147
148        /// Sets the value of [parent][crate::model::ListInstancesRequest::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 [page_size][crate::model::ListInstancesRequest::page_size].
157        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
158            self.0.request.page_size = v.into();
159            self
160        }
161
162        /// Sets the value of [page_token][crate::model::ListInstancesRequest::page_token].
163        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
164            self.0.request.page_token = v.into();
165            self
166        }
167
168        /// Sets the value of [order_by][crate::model::ListInstancesRequest::order_by].
169        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
170            self.0.request.order_by = v.into();
171            self
172        }
173
174        /// Sets the value of [filter][crate::model::ListInstancesRequest::filter].
175        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
176            self.0.request.filter = v.into();
177            self
178        }
179    }
180
181    #[doc(hidden)]
182    impl gax::options::internal::RequestBuilder for ListInstances {
183        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
184            &mut self.0.options
185        }
186    }
187
188    /// The request builder for [NotebookService::get_instance][crate::client::NotebookService::get_instance] calls.
189    ///
190    /// # Example
191    /// ```
192    /// # use google_cloud_notebooks_v2::builder::notebook_service::GetInstance;
193    /// # async fn sample() -> gax::Result<()> {
194    ///
195    /// let builder = prepare_request_builder();
196    /// let response = builder.send().await?;
197    /// # Ok(()) }
198    ///
199    /// fn prepare_request_builder() -> GetInstance {
200    ///   # panic!();
201    ///   // ... details omitted ...
202    /// }
203    /// ```
204    #[derive(Clone, Debug)]
205    pub struct GetInstance(RequestBuilder<crate::model::GetInstanceRequest>);
206
207    impl GetInstance {
208        pub(crate) fn new(
209            stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
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::GetInstanceRequest>>(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<gax::options::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::Instance> {
228            (*self.0.stub)
229                .get_instance(self.0.request, self.0.options)
230                .await
231                .map(gax::response::Response::into_body)
232        }
233
234        /// Sets the value of [name][crate::model::GetInstanceRequest::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 gax::options::internal::RequestBuilder for GetInstance {
245        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
246            &mut self.0.options
247        }
248    }
249
250    /// The request builder for [NotebookService::create_instance][crate::client::NotebookService::create_instance] calls.
251    ///
252    /// # Example
253    /// ```
254    /// # use google_cloud_notebooks_v2::builder::notebook_service::CreateInstance;
255    /// # async fn sample() -> gax::Result<()> {
256    /// use 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() -> CreateInstance {
263    ///   # panic!();
264    ///   // ... details omitted ...
265    /// }
266    /// ```
267    #[derive(Clone, Debug)]
268    pub struct CreateInstance(RequestBuilder<crate::model::CreateInstanceRequest>);
269
270    impl CreateInstance {
271        pub(crate) fn new(
272            stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
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::CreateInstanceRequest>>(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<gax::options::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_instance][crate::client::NotebookService::create_instance].
295        pub async fn send(self) -> Result<longrunning::model::Operation> {
296            (*self.0.stub)
297                .create_instance(self.0.request, self.0.options)
298                .await
299                .map(gax::response::Response::into_body)
300        }
301
302        /// Creates a [Poller][lro::Poller] to work with `create_instance`.
303        pub fn poller(
304            self,
305        ) -> impl lro::Poller<crate::model::Instance, crate::model::OperationMetadata> {
306            type Operation =
307                lro::internal::Operation<crate::model::Instance, crate::model::OperationMetadata>;
308            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
309            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
310
311            let stub = self.0.stub.clone();
312            let mut options = self.0.options.clone();
313            options.set_retry_policy(gax::retry_policy::NeverRetry);
314            let query = move |name| {
315                let stub = stub.clone();
316                let options = options.clone();
317                async {
318                    let op = GetOperation::new(stub)
319                        .set_name(name)
320                        .with_options(options)
321                        .send()
322                        .await?;
323                    Ok(Operation::new(op))
324                }
325            };
326
327            let start = move || async {
328                let op = self.send().await?;
329                Ok(Operation::new(op))
330            };
331
332            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
333        }
334
335        /// Sets the value of [parent][crate::model::CreateInstanceRequest::parent].
336        ///
337        /// This is a **required** field for requests.
338        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
339            self.0.request.parent = v.into();
340            self
341        }
342
343        /// Sets the value of [instance_id][crate::model::CreateInstanceRequest::instance_id].
344        ///
345        /// This is a **required** field for requests.
346        pub fn set_instance_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
347            self.0.request.instance_id = v.into();
348            self
349        }
350
351        /// Sets the value of [instance][crate::model::CreateInstanceRequest::instance].
352        ///
353        /// This is a **required** field for requests.
354        pub fn set_instance<T>(mut self, v: T) -> Self
355        where
356            T: std::convert::Into<crate::model::Instance>,
357        {
358            self.0.request.instance = std::option::Option::Some(v.into());
359            self
360        }
361
362        /// Sets or clears the value of [instance][crate::model::CreateInstanceRequest::instance].
363        ///
364        /// This is a **required** field for requests.
365        pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
366        where
367            T: std::convert::Into<crate::model::Instance>,
368        {
369            self.0.request.instance = v.map(|x| x.into());
370            self
371        }
372
373        /// Sets the value of [request_id][crate::model::CreateInstanceRequest::request_id].
374        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
375            self.0.request.request_id = v.into();
376            self
377        }
378    }
379
380    #[doc(hidden)]
381    impl gax::options::internal::RequestBuilder for CreateInstance {
382        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
383            &mut self.0.options
384        }
385    }
386
387    /// The request builder for [NotebookService::update_instance][crate::client::NotebookService::update_instance] calls.
388    ///
389    /// # Example
390    /// ```
391    /// # use google_cloud_notebooks_v2::builder::notebook_service::UpdateInstance;
392    /// # async fn sample() -> gax::Result<()> {
393    /// use lro::Poller;
394    ///
395    /// let builder = prepare_request_builder();
396    /// let response = builder.poller().until_done().await?;
397    /// # Ok(()) }
398    ///
399    /// fn prepare_request_builder() -> UpdateInstance {
400    ///   # panic!();
401    ///   // ... details omitted ...
402    /// }
403    /// ```
404    #[derive(Clone, Debug)]
405    pub struct UpdateInstance(RequestBuilder<crate::model::UpdateInstanceRequest>);
406
407    impl UpdateInstance {
408        pub(crate) fn new(
409            stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
410        ) -> Self {
411            Self(RequestBuilder::new(stub))
412        }
413
414        /// Sets the full request, replacing any prior values.
415        pub fn with_request<V: Into<crate::model::UpdateInstanceRequest>>(mut self, v: V) -> Self {
416            self.0.request = v.into();
417            self
418        }
419
420        /// Sets all the options, replacing any prior values.
421        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
422            self.0.options = v.into();
423            self
424        }
425
426        /// Sends the request.
427        ///
428        /// # Long running operations
429        ///
430        /// This starts, but does not poll, a longrunning operation. More information
431        /// on [update_instance][crate::client::NotebookService::update_instance].
432        pub async fn send(self) -> Result<longrunning::model::Operation> {
433            (*self.0.stub)
434                .update_instance(self.0.request, self.0.options)
435                .await
436                .map(gax::response::Response::into_body)
437        }
438
439        /// Creates a [Poller][lro::Poller] to work with `update_instance`.
440        pub fn poller(
441            self,
442        ) -> impl lro::Poller<crate::model::Instance, crate::model::OperationMetadata> {
443            type Operation =
444                lro::internal::Operation<crate::model::Instance, crate::model::OperationMetadata>;
445            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
446            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
447
448            let stub = self.0.stub.clone();
449            let mut options = self.0.options.clone();
450            options.set_retry_policy(gax::retry_policy::NeverRetry);
451            let query = move |name| {
452                let stub = stub.clone();
453                let options = options.clone();
454                async {
455                    let op = GetOperation::new(stub)
456                        .set_name(name)
457                        .with_options(options)
458                        .send()
459                        .await?;
460                    Ok(Operation::new(op))
461                }
462            };
463
464            let start = move || async {
465                let op = self.send().await?;
466                Ok(Operation::new(op))
467            };
468
469            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
470        }
471
472        /// Sets the value of [instance][crate::model::UpdateInstanceRequest::instance].
473        ///
474        /// This is a **required** field for requests.
475        pub fn set_instance<T>(mut self, v: T) -> Self
476        where
477            T: std::convert::Into<crate::model::Instance>,
478        {
479            self.0.request.instance = std::option::Option::Some(v.into());
480            self
481        }
482
483        /// Sets or clears the value of [instance][crate::model::UpdateInstanceRequest::instance].
484        ///
485        /// This is a **required** field for requests.
486        pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
487        where
488            T: std::convert::Into<crate::model::Instance>,
489        {
490            self.0.request.instance = v.map(|x| x.into());
491            self
492        }
493
494        /// Sets the value of [update_mask][crate::model::UpdateInstanceRequest::update_mask].
495        ///
496        /// This is a **required** field for requests.
497        pub fn set_update_mask<T>(mut self, v: T) -> Self
498        where
499            T: std::convert::Into<wkt::FieldMask>,
500        {
501            self.0.request.update_mask = std::option::Option::Some(v.into());
502            self
503        }
504
505        /// Sets or clears the value of [update_mask][crate::model::UpdateInstanceRequest::update_mask].
506        ///
507        /// This is a **required** field for requests.
508        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
509        where
510            T: std::convert::Into<wkt::FieldMask>,
511        {
512            self.0.request.update_mask = v.map(|x| x.into());
513            self
514        }
515
516        /// Sets the value of [request_id][crate::model::UpdateInstanceRequest::request_id].
517        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
518            self.0.request.request_id = v.into();
519            self
520        }
521    }
522
523    #[doc(hidden)]
524    impl gax::options::internal::RequestBuilder for UpdateInstance {
525        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
526            &mut self.0.options
527        }
528    }
529
530    /// The request builder for [NotebookService::delete_instance][crate::client::NotebookService::delete_instance] calls.
531    ///
532    /// # Example
533    /// ```
534    /// # use google_cloud_notebooks_v2::builder::notebook_service::DeleteInstance;
535    /// # async fn sample() -> gax::Result<()> {
536    /// use lro::Poller;
537    ///
538    /// let builder = prepare_request_builder();
539    /// let response = builder.poller().until_done().await?;
540    /// # Ok(()) }
541    ///
542    /// fn prepare_request_builder() -> DeleteInstance {
543    ///   # panic!();
544    ///   // ... details omitted ...
545    /// }
546    /// ```
547    #[derive(Clone, Debug)]
548    pub struct DeleteInstance(RequestBuilder<crate::model::DeleteInstanceRequest>);
549
550    impl DeleteInstance {
551        pub(crate) fn new(
552            stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
553        ) -> Self {
554            Self(RequestBuilder::new(stub))
555        }
556
557        /// Sets the full request, replacing any prior values.
558        pub fn with_request<V: Into<crate::model::DeleteInstanceRequest>>(mut self, v: V) -> Self {
559            self.0.request = v.into();
560            self
561        }
562
563        /// Sets all the options, replacing any prior values.
564        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
565            self.0.options = v.into();
566            self
567        }
568
569        /// Sends the request.
570        ///
571        /// # Long running operations
572        ///
573        /// This starts, but does not poll, a longrunning operation. More information
574        /// on [delete_instance][crate::client::NotebookService::delete_instance].
575        pub async fn send(self) -> Result<longrunning::model::Operation> {
576            (*self.0.stub)
577                .delete_instance(self.0.request, self.0.options)
578                .await
579                .map(gax::response::Response::into_body)
580        }
581
582        /// Creates a [Poller][lro::Poller] to work with `delete_instance`.
583        pub fn poller(self) -> impl lro::Poller<(), crate::model::OperationMetadata> {
584            type Operation = lro::internal::Operation<wkt::Empty, crate::model::OperationMetadata>;
585            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
586            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
587
588            let stub = self.0.stub.clone();
589            let mut options = self.0.options.clone();
590            options.set_retry_policy(gax::retry_policy::NeverRetry);
591            let query = move |name| {
592                let stub = stub.clone();
593                let options = options.clone();
594                async {
595                    let op = GetOperation::new(stub)
596                        .set_name(name)
597                        .with_options(options)
598                        .send()
599                        .await?;
600                    Ok(Operation::new(op))
601                }
602            };
603
604            let start = move || async {
605                let op = self.send().await?;
606                Ok(Operation::new(op))
607            };
608
609            lro::internal::new_unit_response_poller(
610                polling_error_policy,
611                polling_backoff_policy,
612                start,
613                query,
614            )
615        }
616
617        /// Sets the value of [name][crate::model::DeleteInstanceRequest::name].
618        ///
619        /// This is a **required** field for requests.
620        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
621            self.0.request.name = v.into();
622            self
623        }
624
625        /// Sets the value of [request_id][crate::model::DeleteInstanceRequest::request_id].
626        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
627            self.0.request.request_id = v.into();
628            self
629        }
630    }
631
632    #[doc(hidden)]
633    impl gax::options::internal::RequestBuilder for DeleteInstance {
634        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
635            &mut self.0.options
636        }
637    }
638
639    /// The request builder for [NotebookService::start_instance][crate::client::NotebookService::start_instance] calls.
640    ///
641    /// # Example
642    /// ```
643    /// # use google_cloud_notebooks_v2::builder::notebook_service::StartInstance;
644    /// # async fn sample() -> gax::Result<()> {
645    /// use lro::Poller;
646    ///
647    /// let builder = prepare_request_builder();
648    /// let response = builder.poller().until_done().await?;
649    /// # Ok(()) }
650    ///
651    /// fn prepare_request_builder() -> StartInstance {
652    ///   # panic!();
653    ///   // ... details omitted ...
654    /// }
655    /// ```
656    #[derive(Clone, Debug)]
657    pub struct StartInstance(RequestBuilder<crate::model::StartInstanceRequest>);
658
659    impl StartInstance {
660        pub(crate) fn new(
661            stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
662        ) -> Self {
663            Self(RequestBuilder::new(stub))
664        }
665
666        /// Sets the full request, replacing any prior values.
667        pub fn with_request<V: Into<crate::model::StartInstanceRequest>>(mut self, v: V) -> Self {
668            self.0.request = v.into();
669            self
670        }
671
672        /// Sets all the options, replacing any prior values.
673        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
674            self.0.options = v.into();
675            self
676        }
677
678        /// Sends the request.
679        ///
680        /// # Long running operations
681        ///
682        /// This starts, but does not poll, a longrunning operation. More information
683        /// on [start_instance][crate::client::NotebookService::start_instance].
684        pub async fn send(self) -> Result<longrunning::model::Operation> {
685            (*self.0.stub)
686                .start_instance(self.0.request, self.0.options)
687                .await
688                .map(gax::response::Response::into_body)
689        }
690
691        /// Creates a [Poller][lro::Poller] to work with `start_instance`.
692        pub fn poller(
693            self,
694        ) -> impl lro::Poller<crate::model::Instance, crate::model::OperationMetadata> {
695            type Operation =
696                lro::internal::Operation<crate::model::Instance, crate::model::OperationMetadata>;
697            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
698            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
699
700            let stub = self.0.stub.clone();
701            let mut options = self.0.options.clone();
702            options.set_retry_policy(gax::retry_policy::NeverRetry);
703            let query = move |name| {
704                let stub = stub.clone();
705                let options = options.clone();
706                async {
707                    let op = GetOperation::new(stub)
708                        .set_name(name)
709                        .with_options(options)
710                        .send()
711                        .await?;
712                    Ok(Operation::new(op))
713                }
714            };
715
716            let start = move || async {
717                let op = self.send().await?;
718                Ok(Operation::new(op))
719            };
720
721            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
722        }
723
724        /// Sets the value of [name][crate::model::StartInstanceRequest::name].
725        ///
726        /// This is a **required** field for requests.
727        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
728            self.0.request.name = v.into();
729            self
730        }
731    }
732
733    #[doc(hidden)]
734    impl gax::options::internal::RequestBuilder for StartInstance {
735        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
736            &mut self.0.options
737        }
738    }
739
740    /// The request builder for [NotebookService::stop_instance][crate::client::NotebookService::stop_instance] calls.
741    ///
742    /// # Example
743    /// ```
744    /// # use google_cloud_notebooks_v2::builder::notebook_service::StopInstance;
745    /// # async fn sample() -> gax::Result<()> {
746    /// use lro::Poller;
747    ///
748    /// let builder = prepare_request_builder();
749    /// let response = builder.poller().until_done().await?;
750    /// # Ok(()) }
751    ///
752    /// fn prepare_request_builder() -> StopInstance {
753    ///   # panic!();
754    ///   // ... details omitted ...
755    /// }
756    /// ```
757    #[derive(Clone, Debug)]
758    pub struct StopInstance(RequestBuilder<crate::model::StopInstanceRequest>);
759
760    impl StopInstance {
761        pub(crate) fn new(
762            stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
763        ) -> Self {
764            Self(RequestBuilder::new(stub))
765        }
766
767        /// Sets the full request, replacing any prior values.
768        pub fn with_request<V: Into<crate::model::StopInstanceRequest>>(mut self, v: V) -> Self {
769            self.0.request = v.into();
770            self
771        }
772
773        /// Sets all the options, replacing any prior values.
774        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
775            self.0.options = v.into();
776            self
777        }
778
779        /// Sends the request.
780        ///
781        /// # Long running operations
782        ///
783        /// This starts, but does not poll, a longrunning operation. More information
784        /// on [stop_instance][crate::client::NotebookService::stop_instance].
785        pub async fn send(self) -> Result<longrunning::model::Operation> {
786            (*self.0.stub)
787                .stop_instance(self.0.request, self.0.options)
788                .await
789                .map(gax::response::Response::into_body)
790        }
791
792        /// Creates a [Poller][lro::Poller] to work with `stop_instance`.
793        pub fn poller(
794            self,
795        ) -> impl lro::Poller<crate::model::Instance, crate::model::OperationMetadata> {
796            type Operation =
797                lro::internal::Operation<crate::model::Instance, crate::model::OperationMetadata>;
798            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
799            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
800
801            let stub = self.0.stub.clone();
802            let mut options = self.0.options.clone();
803            options.set_retry_policy(gax::retry_policy::NeverRetry);
804            let query = move |name| {
805                let stub = stub.clone();
806                let options = options.clone();
807                async {
808                    let op = GetOperation::new(stub)
809                        .set_name(name)
810                        .with_options(options)
811                        .send()
812                        .await?;
813                    Ok(Operation::new(op))
814                }
815            };
816
817            let start = move || async {
818                let op = self.send().await?;
819                Ok(Operation::new(op))
820            };
821
822            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
823        }
824
825        /// Sets the value of [name][crate::model::StopInstanceRequest::name].
826        ///
827        /// This is a **required** field for requests.
828        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
829            self.0.request.name = v.into();
830            self
831        }
832    }
833
834    #[doc(hidden)]
835    impl gax::options::internal::RequestBuilder for StopInstance {
836        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
837            &mut self.0.options
838        }
839    }
840
841    /// The request builder for [NotebookService::reset_instance][crate::client::NotebookService::reset_instance] calls.
842    ///
843    /// # Example
844    /// ```
845    /// # use google_cloud_notebooks_v2::builder::notebook_service::ResetInstance;
846    /// # async fn sample() -> gax::Result<()> {
847    /// use lro::Poller;
848    ///
849    /// let builder = prepare_request_builder();
850    /// let response = builder.poller().until_done().await?;
851    /// # Ok(()) }
852    ///
853    /// fn prepare_request_builder() -> ResetInstance {
854    ///   # panic!();
855    ///   // ... details omitted ...
856    /// }
857    /// ```
858    #[derive(Clone, Debug)]
859    pub struct ResetInstance(RequestBuilder<crate::model::ResetInstanceRequest>);
860
861    impl ResetInstance {
862        pub(crate) fn new(
863            stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
864        ) -> Self {
865            Self(RequestBuilder::new(stub))
866        }
867
868        /// Sets the full request, replacing any prior values.
869        pub fn with_request<V: Into<crate::model::ResetInstanceRequest>>(mut self, v: V) -> Self {
870            self.0.request = v.into();
871            self
872        }
873
874        /// Sets all the options, replacing any prior values.
875        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
876            self.0.options = v.into();
877            self
878        }
879
880        /// Sends the request.
881        ///
882        /// # Long running operations
883        ///
884        /// This starts, but does not poll, a longrunning operation. More information
885        /// on [reset_instance][crate::client::NotebookService::reset_instance].
886        pub async fn send(self) -> Result<longrunning::model::Operation> {
887            (*self.0.stub)
888                .reset_instance(self.0.request, self.0.options)
889                .await
890                .map(gax::response::Response::into_body)
891        }
892
893        /// Creates a [Poller][lro::Poller] to work with `reset_instance`.
894        pub fn poller(
895            self,
896        ) -> impl lro::Poller<crate::model::Instance, crate::model::OperationMetadata> {
897            type Operation =
898                lro::internal::Operation<crate::model::Instance, crate::model::OperationMetadata>;
899            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
900            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
901
902            let stub = self.0.stub.clone();
903            let mut options = self.0.options.clone();
904            options.set_retry_policy(gax::retry_policy::NeverRetry);
905            let query = move |name| {
906                let stub = stub.clone();
907                let options = options.clone();
908                async {
909                    let op = GetOperation::new(stub)
910                        .set_name(name)
911                        .with_options(options)
912                        .send()
913                        .await?;
914                    Ok(Operation::new(op))
915                }
916            };
917
918            let start = move || async {
919                let op = self.send().await?;
920                Ok(Operation::new(op))
921            };
922
923            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
924        }
925
926        /// Sets the value of [name][crate::model::ResetInstanceRequest::name].
927        ///
928        /// This is a **required** field for requests.
929        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
930            self.0.request.name = v.into();
931            self
932        }
933    }
934
935    #[doc(hidden)]
936    impl gax::options::internal::RequestBuilder for ResetInstance {
937        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
938            &mut self.0.options
939        }
940    }
941
942    /// The request builder for [NotebookService::check_instance_upgradability][crate::client::NotebookService::check_instance_upgradability] calls.
943    ///
944    /// # Example
945    /// ```
946    /// # use google_cloud_notebooks_v2::builder::notebook_service::CheckInstanceUpgradability;
947    /// # async fn sample() -> gax::Result<()> {
948    ///
949    /// let builder = prepare_request_builder();
950    /// let response = builder.send().await?;
951    /// # Ok(()) }
952    ///
953    /// fn prepare_request_builder() -> CheckInstanceUpgradability {
954    ///   # panic!();
955    ///   // ... details omitted ...
956    /// }
957    /// ```
958    #[derive(Clone, Debug)]
959    pub struct CheckInstanceUpgradability(
960        RequestBuilder<crate::model::CheckInstanceUpgradabilityRequest>,
961    );
962
963    impl CheckInstanceUpgradability {
964        pub(crate) fn new(
965            stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
966        ) -> Self {
967            Self(RequestBuilder::new(stub))
968        }
969
970        /// Sets the full request, replacing any prior values.
971        pub fn with_request<V: Into<crate::model::CheckInstanceUpgradabilityRequest>>(
972            mut self,
973            v: V,
974        ) -> Self {
975            self.0.request = v.into();
976            self
977        }
978
979        /// Sets all the options, replacing any prior values.
980        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
981            self.0.options = v.into();
982            self
983        }
984
985        /// Sends the request.
986        pub async fn send(self) -> Result<crate::model::CheckInstanceUpgradabilityResponse> {
987            (*self.0.stub)
988                .check_instance_upgradability(self.0.request, self.0.options)
989                .await
990                .map(gax::response::Response::into_body)
991        }
992
993        /// Sets the value of [notebook_instance][crate::model::CheckInstanceUpgradabilityRequest::notebook_instance].
994        ///
995        /// This is a **required** field for requests.
996        pub fn set_notebook_instance<T: Into<std::string::String>>(mut self, v: T) -> Self {
997            self.0.request.notebook_instance = v.into();
998            self
999        }
1000    }
1001
1002    #[doc(hidden)]
1003    impl gax::options::internal::RequestBuilder for CheckInstanceUpgradability {
1004        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1005            &mut self.0.options
1006        }
1007    }
1008
1009    /// The request builder for [NotebookService::upgrade_instance][crate::client::NotebookService::upgrade_instance] calls.
1010    ///
1011    /// # Example
1012    /// ```
1013    /// # use google_cloud_notebooks_v2::builder::notebook_service::UpgradeInstance;
1014    /// # async fn sample() -> gax::Result<()> {
1015    /// use lro::Poller;
1016    ///
1017    /// let builder = prepare_request_builder();
1018    /// let response = builder.poller().until_done().await?;
1019    /// # Ok(()) }
1020    ///
1021    /// fn prepare_request_builder() -> UpgradeInstance {
1022    ///   # panic!();
1023    ///   // ... details omitted ...
1024    /// }
1025    /// ```
1026    #[derive(Clone, Debug)]
1027    pub struct UpgradeInstance(RequestBuilder<crate::model::UpgradeInstanceRequest>);
1028
1029    impl UpgradeInstance {
1030        pub(crate) fn new(
1031            stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
1032        ) -> Self {
1033            Self(RequestBuilder::new(stub))
1034        }
1035
1036        /// Sets the full request, replacing any prior values.
1037        pub fn with_request<V: Into<crate::model::UpgradeInstanceRequest>>(mut self, v: V) -> Self {
1038            self.0.request = v.into();
1039            self
1040        }
1041
1042        /// Sets all the options, replacing any prior values.
1043        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1044            self.0.options = v.into();
1045            self
1046        }
1047
1048        /// Sends the request.
1049        ///
1050        /// # Long running operations
1051        ///
1052        /// This starts, but does not poll, a longrunning operation. More information
1053        /// on [upgrade_instance][crate::client::NotebookService::upgrade_instance].
1054        pub async fn send(self) -> Result<longrunning::model::Operation> {
1055            (*self.0.stub)
1056                .upgrade_instance(self.0.request, self.0.options)
1057                .await
1058                .map(gax::response::Response::into_body)
1059        }
1060
1061        /// Creates a [Poller][lro::Poller] to work with `upgrade_instance`.
1062        pub fn poller(
1063            self,
1064        ) -> impl lro::Poller<crate::model::Instance, crate::model::OperationMetadata> {
1065            type Operation =
1066                lro::internal::Operation<crate::model::Instance, crate::model::OperationMetadata>;
1067            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1068            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1069
1070            let stub = self.0.stub.clone();
1071            let mut options = self.0.options.clone();
1072            options.set_retry_policy(gax::retry_policy::NeverRetry);
1073            let query = move |name| {
1074                let stub = stub.clone();
1075                let options = options.clone();
1076                async {
1077                    let op = GetOperation::new(stub)
1078                        .set_name(name)
1079                        .with_options(options)
1080                        .send()
1081                        .await?;
1082                    Ok(Operation::new(op))
1083                }
1084            };
1085
1086            let start = move || async {
1087                let op = self.send().await?;
1088                Ok(Operation::new(op))
1089            };
1090
1091            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1092        }
1093
1094        /// Sets the value of [name][crate::model::UpgradeInstanceRequest::name].
1095        ///
1096        /// This is a **required** field for requests.
1097        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1098            self.0.request.name = v.into();
1099            self
1100        }
1101    }
1102
1103    #[doc(hidden)]
1104    impl gax::options::internal::RequestBuilder for UpgradeInstance {
1105        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1106            &mut self.0.options
1107        }
1108    }
1109
1110    /// The request builder for [NotebookService::rollback_instance][crate::client::NotebookService::rollback_instance] calls.
1111    ///
1112    /// # Example
1113    /// ```
1114    /// # use google_cloud_notebooks_v2::builder::notebook_service::RollbackInstance;
1115    /// # async fn sample() -> gax::Result<()> {
1116    /// use lro::Poller;
1117    ///
1118    /// let builder = prepare_request_builder();
1119    /// let response = builder.poller().until_done().await?;
1120    /// # Ok(()) }
1121    ///
1122    /// fn prepare_request_builder() -> RollbackInstance {
1123    ///   # panic!();
1124    ///   // ... details omitted ...
1125    /// }
1126    /// ```
1127    #[derive(Clone, Debug)]
1128    pub struct RollbackInstance(RequestBuilder<crate::model::RollbackInstanceRequest>);
1129
1130    impl RollbackInstance {
1131        pub(crate) fn new(
1132            stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
1133        ) -> Self {
1134            Self(RequestBuilder::new(stub))
1135        }
1136
1137        /// Sets the full request, replacing any prior values.
1138        pub fn with_request<V: Into<crate::model::RollbackInstanceRequest>>(
1139            mut self,
1140            v: V,
1141        ) -> Self {
1142            self.0.request = v.into();
1143            self
1144        }
1145
1146        /// Sets all the options, replacing any prior values.
1147        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1148            self.0.options = v.into();
1149            self
1150        }
1151
1152        /// Sends the request.
1153        ///
1154        /// # Long running operations
1155        ///
1156        /// This starts, but does not poll, a longrunning operation. More information
1157        /// on [rollback_instance][crate::client::NotebookService::rollback_instance].
1158        pub async fn send(self) -> Result<longrunning::model::Operation> {
1159            (*self.0.stub)
1160                .rollback_instance(self.0.request, self.0.options)
1161                .await
1162                .map(gax::response::Response::into_body)
1163        }
1164
1165        /// Creates a [Poller][lro::Poller] to work with `rollback_instance`.
1166        pub fn poller(
1167            self,
1168        ) -> impl lro::Poller<crate::model::Instance, crate::model::OperationMetadata> {
1169            type Operation =
1170                lro::internal::Operation<crate::model::Instance, crate::model::OperationMetadata>;
1171            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1172            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1173
1174            let stub = self.0.stub.clone();
1175            let mut options = self.0.options.clone();
1176            options.set_retry_policy(gax::retry_policy::NeverRetry);
1177            let query = move |name| {
1178                let stub = stub.clone();
1179                let options = options.clone();
1180                async {
1181                    let op = GetOperation::new(stub)
1182                        .set_name(name)
1183                        .with_options(options)
1184                        .send()
1185                        .await?;
1186                    Ok(Operation::new(op))
1187                }
1188            };
1189
1190            let start = move || async {
1191                let op = self.send().await?;
1192                Ok(Operation::new(op))
1193            };
1194
1195            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1196        }
1197
1198        /// Sets the value of [name][crate::model::RollbackInstanceRequest::name].
1199        ///
1200        /// This is a **required** field for requests.
1201        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1202            self.0.request.name = v.into();
1203            self
1204        }
1205
1206        /// Sets the value of [target_snapshot][crate::model::RollbackInstanceRequest::target_snapshot].
1207        ///
1208        /// This is a **required** field for requests.
1209        pub fn set_target_snapshot<T: Into<std::string::String>>(mut self, v: T) -> Self {
1210            self.0.request.target_snapshot = v.into();
1211            self
1212        }
1213
1214        /// Sets the value of [revision_id][crate::model::RollbackInstanceRequest::revision_id].
1215        ///
1216        /// This is a **required** field for requests.
1217        pub fn set_revision_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1218            self.0.request.revision_id = v.into();
1219            self
1220        }
1221    }
1222
1223    #[doc(hidden)]
1224    impl gax::options::internal::RequestBuilder for RollbackInstance {
1225        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1226            &mut self.0.options
1227        }
1228    }
1229
1230    /// The request builder for [NotebookService::diagnose_instance][crate::client::NotebookService::diagnose_instance] calls.
1231    ///
1232    /// # Example
1233    /// ```
1234    /// # use google_cloud_notebooks_v2::builder::notebook_service::DiagnoseInstance;
1235    /// # async fn sample() -> gax::Result<()> {
1236    /// use lro::Poller;
1237    ///
1238    /// let builder = prepare_request_builder();
1239    /// let response = builder.poller().until_done().await?;
1240    /// # Ok(()) }
1241    ///
1242    /// fn prepare_request_builder() -> DiagnoseInstance {
1243    ///   # panic!();
1244    ///   // ... details omitted ...
1245    /// }
1246    /// ```
1247    #[derive(Clone, Debug)]
1248    pub struct DiagnoseInstance(RequestBuilder<crate::model::DiagnoseInstanceRequest>);
1249
1250    impl DiagnoseInstance {
1251        pub(crate) fn new(
1252            stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
1253        ) -> Self {
1254            Self(RequestBuilder::new(stub))
1255        }
1256
1257        /// Sets the full request, replacing any prior values.
1258        pub fn with_request<V: Into<crate::model::DiagnoseInstanceRequest>>(
1259            mut self,
1260            v: V,
1261        ) -> Self {
1262            self.0.request = v.into();
1263            self
1264        }
1265
1266        /// Sets all the options, replacing any prior values.
1267        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1268            self.0.options = v.into();
1269            self
1270        }
1271
1272        /// Sends the request.
1273        ///
1274        /// # Long running operations
1275        ///
1276        /// This starts, but does not poll, a longrunning operation. More information
1277        /// on [diagnose_instance][crate::client::NotebookService::diagnose_instance].
1278        pub async fn send(self) -> Result<longrunning::model::Operation> {
1279            (*self.0.stub)
1280                .diagnose_instance(self.0.request, self.0.options)
1281                .await
1282                .map(gax::response::Response::into_body)
1283        }
1284
1285        /// Creates a [Poller][lro::Poller] to work with `diagnose_instance`.
1286        pub fn poller(
1287            self,
1288        ) -> impl lro::Poller<crate::model::Instance, crate::model::OperationMetadata> {
1289            type Operation =
1290                lro::internal::Operation<crate::model::Instance, crate::model::OperationMetadata>;
1291            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1292            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1293
1294            let stub = self.0.stub.clone();
1295            let mut options = self.0.options.clone();
1296            options.set_retry_policy(gax::retry_policy::NeverRetry);
1297            let query = move |name| {
1298                let stub = stub.clone();
1299                let options = options.clone();
1300                async {
1301                    let op = GetOperation::new(stub)
1302                        .set_name(name)
1303                        .with_options(options)
1304                        .send()
1305                        .await?;
1306                    Ok(Operation::new(op))
1307                }
1308            };
1309
1310            let start = move || async {
1311                let op = self.send().await?;
1312                Ok(Operation::new(op))
1313            };
1314
1315            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1316        }
1317
1318        /// Sets the value of [name][crate::model::DiagnoseInstanceRequest::name].
1319        ///
1320        /// This is a **required** field for requests.
1321        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1322            self.0.request.name = v.into();
1323            self
1324        }
1325
1326        /// Sets the value of [diagnostic_config][crate::model::DiagnoseInstanceRequest::diagnostic_config].
1327        ///
1328        /// This is a **required** field for requests.
1329        pub fn set_diagnostic_config<T>(mut self, v: T) -> Self
1330        where
1331            T: std::convert::Into<crate::model::DiagnosticConfig>,
1332        {
1333            self.0.request.diagnostic_config = std::option::Option::Some(v.into());
1334            self
1335        }
1336
1337        /// Sets or clears the value of [diagnostic_config][crate::model::DiagnoseInstanceRequest::diagnostic_config].
1338        ///
1339        /// This is a **required** field for requests.
1340        pub fn set_or_clear_diagnostic_config<T>(mut self, v: std::option::Option<T>) -> Self
1341        where
1342            T: std::convert::Into<crate::model::DiagnosticConfig>,
1343        {
1344            self.0.request.diagnostic_config = v.map(|x| x.into());
1345            self
1346        }
1347
1348        /// Sets the value of [timeout_minutes][crate::model::DiagnoseInstanceRequest::timeout_minutes].
1349        pub fn set_timeout_minutes<T: Into<i32>>(mut self, v: T) -> Self {
1350            self.0.request.timeout_minutes = v.into();
1351            self
1352        }
1353    }
1354
1355    #[doc(hidden)]
1356    impl gax::options::internal::RequestBuilder for DiagnoseInstance {
1357        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1358            &mut self.0.options
1359        }
1360    }
1361
1362    /// The request builder for [NotebookService::list_locations][crate::client::NotebookService::list_locations] calls.
1363    ///
1364    /// # Example
1365    /// ```
1366    /// # use google_cloud_notebooks_v2::builder::notebook_service::ListLocations;
1367    /// # async fn sample() -> gax::Result<()> {
1368    /// use gax::paginator::ItemPaginator;
1369    ///
1370    /// let builder = prepare_request_builder();
1371    /// let mut items = builder.by_item();
1372    /// while let Some(result) = items.next().await {
1373    ///   let item = result?;
1374    /// }
1375    /// # Ok(()) }
1376    ///
1377    /// fn prepare_request_builder() -> ListLocations {
1378    ///   # panic!();
1379    ///   // ... details omitted ...
1380    /// }
1381    /// ```
1382    #[derive(Clone, Debug)]
1383    pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
1384
1385    impl ListLocations {
1386        pub(crate) fn new(
1387            stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
1388        ) -> Self {
1389            Self(RequestBuilder::new(stub))
1390        }
1391
1392        /// Sets the full request, replacing any prior values.
1393        pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
1394            mut self,
1395            v: V,
1396        ) -> Self {
1397            self.0.request = v.into();
1398            self
1399        }
1400
1401        /// Sets all the options, replacing any prior values.
1402        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1403            self.0.options = v.into();
1404            self
1405        }
1406
1407        /// Sends the request.
1408        pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
1409            (*self.0.stub)
1410                .list_locations(self.0.request, self.0.options)
1411                .await
1412                .map(gax::response::Response::into_body)
1413        }
1414
1415        /// Streams each page in the collection.
1416        pub fn by_page(
1417            self,
1418        ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
1419        {
1420            use std::clone::Clone;
1421            let token = self.0.request.page_token.clone();
1422            let execute = move |token: String| {
1423                let mut builder = self.clone();
1424                builder.0.request = builder.0.request.set_page_token(token);
1425                builder.send()
1426            };
1427            gax::paginator::internal::new_paginator(token, execute)
1428        }
1429
1430        /// Streams each item in the collection.
1431        pub fn by_item(
1432            self,
1433        ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
1434        {
1435            use gax::paginator::Paginator;
1436            self.by_page().items()
1437        }
1438
1439        /// Sets the value of [name][location::model::ListLocationsRequest::name].
1440        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1441            self.0.request.name = v.into();
1442            self
1443        }
1444
1445        /// Sets the value of [filter][location::model::ListLocationsRequest::filter].
1446        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1447            self.0.request.filter = v.into();
1448            self
1449        }
1450
1451        /// Sets the value of [page_size][location::model::ListLocationsRequest::page_size].
1452        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1453            self.0.request.page_size = v.into();
1454            self
1455        }
1456
1457        /// Sets the value of [page_token][location::model::ListLocationsRequest::page_token].
1458        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1459            self.0.request.page_token = v.into();
1460            self
1461        }
1462    }
1463
1464    #[doc(hidden)]
1465    impl gax::options::internal::RequestBuilder for ListLocations {
1466        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1467            &mut self.0.options
1468        }
1469    }
1470
1471    /// The request builder for [NotebookService::get_location][crate::client::NotebookService::get_location] calls.
1472    ///
1473    /// # Example
1474    /// ```
1475    /// # use google_cloud_notebooks_v2::builder::notebook_service::GetLocation;
1476    /// # async fn sample() -> gax::Result<()> {
1477    ///
1478    /// let builder = prepare_request_builder();
1479    /// let response = builder.send().await?;
1480    /// # Ok(()) }
1481    ///
1482    /// fn prepare_request_builder() -> GetLocation {
1483    ///   # panic!();
1484    ///   // ... details omitted ...
1485    /// }
1486    /// ```
1487    #[derive(Clone, Debug)]
1488    pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
1489
1490    impl GetLocation {
1491        pub(crate) fn new(
1492            stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
1493        ) -> Self {
1494            Self(RequestBuilder::new(stub))
1495        }
1496
1497        /// Sets the full request, replacing any prior values.
1498        pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
1499            self.0.request = v.into();
1500            self
1501        }
1502
1503        /// Sets all the options, replacing any prior values.
1504        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1505            self.0.options = v.into();
1506            self
1507        }
1508
1509        /// Sends the request.
1510        pub async fn send(self) -> Result<location::model::Location> {
1511            (*self.0.stub)
1512                .get_location(self.0.request, self.0.options)
1513                .await
1514                .map(gax::response::Response::into_body)
1515        }
1516
1517        /// Sets the value of [name][location::model::GetLocationRequest::name].
1518        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1519            self.0.request.name = v.into();
1520            self
1521        }
1522    }
1523
1524    #[doc(hidden)]
1525    impl gax::options::internal::RequestBuilder for GetLocation {
1526        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1527            &mut self.0.options
1528        }
1529    }
1530
1531    /// The request builder for [NotebookService::set_iam_policy][crate::client::NotebookService::set_iam_policy] calls.
1532    ///
1533    /// # Example
1534    /// ```
1535    /// # use google_cloud_notebooks_v2::builder::notebook_service::SetIamPolicy;
1536    /// # async fn sample() -> gax::Result<()> {
1537    ///
1538    /// let builder = prepare_request_builder();
1539    /// let response = builder.send().await?;
1540    /// # Ok(()) }
1541    ///
1542    /// fn prepare_request_builder() -> SetIamPolicy {
1543    ///   # panic!();
1544    ///   // ... details omitted ...
1545    /// }
1546    /// ```
1547    #[derive(Clone, Debug)]
1548    pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
1549
1550    impl SetIamPolicy {
1551        pub(crate) fn new(
1552            stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
1553        ) -> Self {
1554            Self(RequestBuilder::new(stub))
1555        }
1556
1557        /// Sets the full request, replacing any prior values.
1558        pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
1559            self.0.request = v.into();
1560            self
1561        }
1562
1563        /// Sets all the options, replacing any prior values.
1564        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1565            self.0.options = v.into();
1566            self
1567        }
1568
1569        /// Sends the request.
1570        pub async fn send(self) -> Result<iam_v1::model::Policy> {
1571            (*self.0.stub)
1572                .set_iam_policy(self.0.request, self.0.options)
1573                .await
1574                .map(gax::response::Response::into_body)
1575        }
1576
1577        /// Sets the value of [resource][iam_v1::model::SetIamPolicyRequest::resource].
1578        ///
1579        /// This is a **required** field for requests.
1580        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1581            self.0.request.resource = v.into();
1582            self
1583        }
1584
1585        /// Sets the value of [policy][iam_v1::model::SetIamPolicyRequest::policy].
1586        ///
1587        /// This is a **required** field for requests.
1588        pub fn set_policy<T>(mut self, v: T) -> Self
1589        where
1590            T: std::convert::Into<iam_v1::model::Policy>,
1591        {
1592            self.0.request.policy = std::option::Option::Some(v.into());
1593            self
1594        }
1595
1596        /// Sets or clears the value of [policy][iam_v1::model::SetIamPolicyRequest::policy].
1597        ///
1598        /// This is a **required** field for requests.
1599        pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
1600        where
1601            T: std::convert::Into<iam_v1::model::Policy>,
1602        {
1603            self.0.request.policy = v.map(|x| x.into());
1604            self
1605        }
1606
1607        /// Sets the value of [update_mask][iam_v1::model::SetIamPolicyRequest::update_mask].
1608        pub fn set_update_mask<T>(mut self, v: T) -> Self
1609        where
1610            T: std::convert::Into<wkt::FieldMask>,
1611        {
1612            self.0.request.update_mask = std::option::Option::Some(v.into());
1613            self
1614        }
1615
1616        /// Sets or clears the value of [update_mask][iam_v1::model::SetIamPolicyRequest::update_mask].
1617        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1618        where
1619            T: std::convert::Into<wkt::FieldMask>,
1620        {
1621            self.0.request.update_mask = v.map(|x| x.into());
1622            self
1623        }
1624    }
1625
1626    #[doc(hidden)]
1627    impl gax::options::internal::RequestBuilder for SetIamPolicy {
1628        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1629            &mut self.0.options
1630        }
1631    }
1632
1633    /// The request builder for [NotebookService::get_iam_policy][crate::client::NotebookService::get_iam_policy] calls.
1634    ///
1635    /// # Example
1636    /// ```
1637    /// # use google_cloud_notebooks_v2::builder::notebook_service::GetIamPolicy;
1638    /// # async fn sample() -> gax::Result<()> {
1639    ///
1640    /// let builder = prepare_request_builder();
1641    /// let response = builder.send().await?;
1642    /// # Ok(()) }
1643    ///
1644    /// fn prepare_request_builder() -> GetIamPolicy {
1645    ///   # panic!();
1646    ///   // ... details omitted ...
1647    /// }
1648    /// ```
1649    #[derive(Clone, Debug)]
1650    pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
1651
1652    impl GetIamPolicy {
1653        pub(crate) fn new(
1654            stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
1655        ) -> Self {
1656            Self(RequestBuilder::new(stub))
1657        }
1658
1659        /// Sets the full request, replacing any prior values.
1660        pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
1661            self.0.request = v.into();
1662            self
1663        }
1664
1665        /// Sets all the options, replacing any prior values.
1666        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1667            self.0.options = v.into();
1668            self
1669        }
1670
1671        /// Sends the request.
1672        pub async fn send(self) -> Result<iam_v1::model::Policy> {
1673            (*self.0.stub)
1674                .get_iam_policy(self.0.request, self.0.options)
1675                .await
1676                .map(gax::response::Response::into_body)
1677        }
1678
1679        /// Sets the value of [resource][iam_v1::model::GetIamPolicyRequest::resource].
1680        ///
1681        /// This is a **required** field for requests.
1682        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1683            self.0.request.resource = v.into();
1684            self
1685        }
1686
1687        /// Sets the value of [options][iam_v1::model::GetIamPolicyRequest::options].
1688        pub fn set_options<T>(mut self, v: T) -> Self
1689        where
1690            T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
1691        {
1692            self.0.request.options = std::option::Option::Some(v.into());
1693            self
1694        }
1695
1696        /// Sets or clears the value of [options][iam_v1::model::GetIamPolicyRequest::options].
1697        pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
1698        where
1699            T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
1700        {
1701            self.0.request.options = v.map(|x| x.into());
1702            self
1703        }
1704    }
1705
1706    #[doc(hidden)]
1707    impl gax::options::internal::RequestBuilder for GetIamPolicy {
1708        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1709            &mut self.0.options
1710        }
1711    }
1712
1713    /// The request builder for [NotebookService::test_iam_permissions][crate::client::NotebookService::test_iam_permissions] calls.
1714    ///
1715    /// # Example
1716    /// ```
1717    /// # use google_cloud_notebooks_v2::builder::notebook_service::TestIamPermissions;
1718    /// # async fn sample() -> gax::Result<()> {
1719    ///
1720    /// let builder = prepare_request_builder();
1721    /// let response = builder.send().await?;
1722    /// # Ok(()) }
1723    ///
1724    /// fn prepare_request_builder() -> TestIamPermissions {
1725    ///   # panic!();
1726    ///   // ... details omitted ...
1727    /// }
1728    /// ```
1729    #[derive(Clone, Debug)]
1730    pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
1731
1732    impl TestIamPermissions {
1733        pub(crate) fn new(
1734            stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
1735        ) -> Self {
1736            Self(RequestBuilder::new(stub))
1737        }
1738
1739        /// Sets the full request, replacing any prior values.
1740        pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
1741            mut self,
1742            v: V,
1743        ) -> Self {
1744            self.0.request = v.into();
1745            self
1746        }
1747
1748        /// Sets all the options, replacing any prior values.
1749        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1750            self.0.options = v.into();
1751            self
1752        }
1753
1754        /// Sends the request.
1755        pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
1756            (*self.0.stub)
1757                .test_iam_permissions(self.0.request, self.0.options)
1758                .await
1759                .map(gax::response::Response::into_body)
1760        }
1761
1762        /// Sets the value of [resource][iam_v1::model::TestIamPermissionsRequest::resource].
1763        ///
1764        /// This is a **required** field for requests.
1765        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1766            self.0.request.resource = v.into();
1767            self
1768        }
1769
1770        /// Sets the value of [permissions][iam_v1::model::TestIamPermissionsRequest::permissions].
1771        ///
1772        /// This is a **required** field for requests.
1773        pub fn set_permissions<T, V>(mut self, v: T) -> Self
1774        where
1775            T: std::iter::IntoIterator<Item = V>,
1776            V: std::convert::Into<std::string::String>,
1777        {
1778            use std::iter::Iterator;
1779            self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
1780            self
1781        }
1782    }
1783
1784    #[doc(hidden)]
1785    impl gax::options::internal::RequestBuilder for TestIamPermissions {
1786        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1787            &mut self.0.options
1788        }
1789    }
1790
1791    /// The request builder for [NotebookService::list_operations][crate::client::NotebookService::list_operations] calls.
1792    ///
1793    /// # Example
1794    /// ```
1795    /// # use google_cloud_notebooks_v2::builder::notebook_service::ListOperations;
1796    /// # async fn sample() -> gax::Result<()> {
1797    /// use gax::paginator::ItemPaginator;
1798    ///
1799    /// let builder = prepare_request_builder();
1800    /// let mut items = builder.by_item();
1801    /// while let Some(result) = items.next().await {
1802    ///   let item = result?;
1803    /// }
1804    /// # Ok(()) }
1805    ///
1806    /// fn prepare_request_builder() -> ListOperations {
1807    ///   # panic!();
1808    ///   // ... details omitted ...
1809    /// }
1810    /// ```
1811    #[derive(Clone, Debug)]
1812    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
1813
1814    impl ListOperations {
1815        pub(crate) fn new(
1816            stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
1817        ) -> Self {
1818            Self(RequestBuilder::new(stub))
1819        }
1820
1821        /// Sets the full request, replacing any prior values.
1822        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
1823            mut self,
1824            v: V,
1825        ) -> Self {
1826            self.0.request = v.into();
1827            self
1828        }
1829
1830        /// Sets all the options, replacing any prior values.
1831        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1832            self.0.options = v.into();
1833            self
1834        }
1835
1836        /// Sends the request.
1837        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
1838            (*self.0.stub)
1839                .list_operations(self.0.request, self.0.options)
1840                .await
1841                .map(gax::response::Response::into_body)
1842        }
1843
1844        /// Streams each page in the collection.
1845        pub fn by_page(
1846            self,
1847        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
1848        {
1849            use std::clone::Clone;
1850            let token = self.0.request.page_token.clone();
1851            let execute = move |token: String| {
1852                let mut builder = self.clone();
1853                builder.0.request = builder.0.request.set_page_token(token);
1854                builder.send()
1855            };
1856            gax::paginator::internal::new_paginator(token, execute)
1857        }
1858
1859        /// Streams each item in the collection.
1860        pub fn by_item(
1861            self,
1862        ) -> impl gax::paginator::ItemPaginator<
1863            longrunning::model::ListOperationsResponse,
1864            gax::error::Error,
1865        > {
1866            use gax::paginator::Paginator;
1867            self.by_page().items()
1868        }
1869
1870        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
1871        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1872            self.0.request.name = v.into();
1873            self
1874        }
1875
1876        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
1877        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1878            self.0.request.filter = v.into();
1879            self
1880        }
1881
1882        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
1883        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1884            self.0.request.page_size = v.into();
1885            self
1886        }
1887
1888        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
1889        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1890            self.0.request.page_token = v.into();
1891            self
1892        }
1893
1894        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
1895        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
1896            self.0.request.return_partial_success = v.into();
1897            self
1898        }
1899    }
1900
1901    #[doc(hidden)]
1902    impl gax::options::internal::RequestBuilder for ListOperations {
1903        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1904            &mut self.0.options
1905        }
1906    }
1907
1908    /// The request builder for [NotebookService::get_operation][crate::client::NotebookService::get_operation] calls.
1909    ///
1910    /// # Example
1911    /// ```
1912    /// # use google_cloud_notebooks_v2::builder::notebook_service::GetOperation;
1913    /// # async fn sample() -> gax::Result<()> {
1914    ///
1915    /// let builder = prepare_request_builder();
1916    /// let response = builder.send().await?;
1917    /// # Ok(()) }
1918    ///
1919    /// fn prepare_request_builder() -> GetOperation {
1920    ///   # panic!();
1921    ///   // ... details omitted ...
1922    /// }
1923    /// ```
1924    #[derive(Clone, Debug)]
1925    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
1926
1927    impl GetOperation {
1928        pub(crate) fn new(
1929            stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
1930        ) -> Self {
1931            Self(RequestBuilder::new(stub))
1932        }
1933
1934        /// Sets the full request, replacing any prior values.
1935        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
1936            mut self,
1937            v: V,
1938        ) -> Self {
1939            self.0.request = v.into();
1940            self
1941        }
1942
1943        /// Sets all the options, replacing any prior values.
1944        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1945            self.0.options = v.into();
1946            self
1947        }
1948
1949        /// Sends the request.
1950        pub async fn send(self) -> Result<longrunning::model::Operation> {
1951            (*self.0.stub)
1952                .get_operation(self.0.request, self.0.options)
1953                .await
1954                .map(gax::response::Response::into_body)
1955        }
1956
1957        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
1958        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1959            self.0.request.name = v.into();
1960            self
1961        }
1962    }
1963
1964    #[doc(hidden)]
1965    impl gax::options::internal::RequestBuilder for GetOperation {
1966        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1967            &mut self.0.options
1968        }
1969    }
1970
1971    /// The request builder for [NotebookService::delete_operation][crate::client::NotebookService::delete_operation] calls.
1972    ///
1973    /// # Example
1974    /// ```
1975    /// # use google_cloud_notebooks_v2::builder::notebook_service::DeleteOperation;
1976    /// # async fn sample() -> gax::Result<()> {
1977    ///
1978    /// let builder = prepare_request_builder();
1979    /// let response = builder.send().await?;
1980    /// # Ok(()) }
1981    ///
1982    /// fn prepare_request_builder() -> DeleteOperation {
1983    ///   # panic!();
1984    ///   // ... details omitted ...
1985    /// }
1986    /// ```
1987    #[derive(Clone, Debug)]
1988    pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
1989
1990    impl DeleteOperation {
1991        pub(crate) fn new(
1992            stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
1993        ) -> Self {
1994            Self(RequestBuilder::new(stub))
1995        }
1996
1997        /// Sets the full request, replacing any prior values.
1998        pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
1999            mut self,
2000            v: V,
2001        ) -> Self {
2002            self.0.request = v.into();
2003            self
2004        }
2005
2006        /// Sets all the options, replacing any prior values.
2007        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2008            self.0.options = v.into();
2009            self
2010        }
2011
2012        /// Sends the request.
2013        pub async fn send(self) -> Result<()> {
2014            (*self.0.stub)
2015                .delete_operation(self.0.request, self.0.options)
2016                .await
2017                .map(gax::response::Response::into_body)
2018        }
2019
2020        /// Sets the value of [name][longrunning::model::DeleteOperationRequest::name].
2021        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2022            self.0.request.name = v.into();
2023            self
2024        }
2025    }
2026
2027    #[doc(hidden)]
2028    impl gax::options::internal::RequestBuilder for DeleteOperation {
2029        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2030            &mut self.0.options
2031        }
2032    }
2033
2034    /// The request builder for [NotebookService::cancel_operation][crate::client::NotebookService::cancel_operation] calls.
2035    ///
2036    /// # Example
2037    /// ```
2038    /// # use google_cloud_notebooks_v2::builder::notebook_service::CancelOperation;
2039    /// # async fn sample() -> gax::Result<()> {
2040    ///
2041    /// let builder = prepare_request_builder();
2042    /// let response = builder.send().await?;
2043    /// # Ok(()) }
2044    ///
2045    /// fn prepare_request_builder() -> CancelOperation {
2046    ///   # panic!();
2047    ///   // ... details omitted ...
2048    /// }
2049    /// ```
2050    #[derive(Clone, Debug)]
2051    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
2052
2053    impl CancelOperation {
2054        pub(crate) fn new(
2055            stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
2056        ) -> Self {
2057            Self(RequestBuilder::new(stub))
2058        }
2059
2060        /// Sets the full request, replacing any prior values.
2061        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
2062            mut self,
2063            v: V,
2064        ) -> Self {
2065            self.0.request = v.into();
2066            self
2067        }
2068
2069        /// Sets all the options, replacing any prior values.
2070        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2071            self.0.options = v.into();
2072            self
2073        }
2074
2075        /// Sends the request.
2076        pub async fn send(self) -> Result<()> {
2077            (*self.0.stub)
2078                .cancel_operation(self.0.request, self.0.options)
2079                .await
2080                .map(gax::response::Response::into_body)
2081        }
2082
2083        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
2084        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2085            self.0.request.name = v.into();
2086            self
2087        }
2088    }
2089
2090    #[doc(hidden)]
2091    impl gax::options::internal::RequestBuilder for CancelOperation {
2092        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2093            &mut self.0.options
2094        }
2095    }
2096}