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