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