Skip to main content

google_cloud_notebooks_v2/
builder.rs

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