Skip to main content

google_cloud_hypercomputecluster_v1/
builder.rs

1// Copyright 2026 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 [HypercomputeCluster][crate::client::HypercomputeCluster].
18pub mod hypercompute_cluster {
19    use crate::Result;
20
21    /// A builder for [HypercomputeCluster][crate::client::HypercomputeCluster].
22    ///
23    /// ```
24    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
25    /// # use google_cloud_hypercomputecluster_v1::*;
26    /// # use builder::hypercompute_cluster::ClientBuilder;
27    /// # use client::HypercomputeCluster;
28    /// let builder : ClientBuilder = HypercomputeCluster::builder();
29    /// let client = builder
30    ///     .with_endpoint("https://hypercomputecluster.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::HypercomputeCluster;
38        pub struct Factory;
39        impl crate::ClientFactory for Factory {
40            type Client = HypercomputeCluster;
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::HypercomputeCluster] 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::HypercomputeCluster>,
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::HypercomputeCluster>,
65        ) -> Self {
66            Self {
67                stub,
68                request: R::default(),
69                options: crate::RequestOptions::default(),
70            }
71        }
72    }
73
74    /// The request builder for [HypercomputeCluster::list_clusters][crate::client::HypercomputeCluster::list_clusters] calls.
75    ///
76    /// # Example
77    /// ```
78    /// # use google_cloud_hypercomputecluster_v1::builder::hypercompute_cluster::ListClusters;
79    /// # async fn sample() -> google_cloud_hypercomputecluster_v1::Result<()> {
80    /// use google_cloud_gax::paginator::ItemPaginator;
81    ///
82    /// let builder = prepare_request_builder();
83    /// let mut items = builder.by_item();
84    /// while let Some(result) = items.next().await {
85    ///   let item = result?;
86    /// }
87    /// # Ok(()) }
88    ///
89    /// fn prepare_request_builder() -> ListClusters {
90    ///   # panic!();
91    ///   // ... details omitted ...
92    /// }
93    /// ```
94    #[derive(Clone, Debug)]
95    pub struct ListClusters(RequestBuilder<crate::model::ListClustersRequest>);
96
97    impl ListClusters {
98        pub(crate) fn new(
99            stub: std::sync::Arc<dyn super::super::stub::dynamic::HypercomputeCluster>,
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::ListClustersRequest>>(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::ListClustersResponse> {
118            (*self.0.stub)
119                .list_clusters(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::ListClustersResponse, 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::ListClustersResponse,
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::ListClustersRequest::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::ListClustersRequest::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::ListClustersRequest::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 [filter][crate::model::ListClustersRequest::filter].
171        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
172            self.0.request.filter = v.into();
173            self
174        }
175
176        /// Sets the value of [order_by][crate::model::ListClustersRequest::order_by].
177        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
178            self.0.request.order_by = v.into();
179            self
180        }
181    }
182
183    #[doc(hidden)]
184    impl crate::RequestBuilder for ListClusters {
185        fn request_options(&mut self) -> &mut crate::RequestOptions {
186            &mut self.0.options
187        }
188    }
189
190    /// The request builder for [HypercomputeCluster::get_cluster][crate::client::HypercomputeCluster::get_cluster] calls.
191    ///
192    /// # Example
193    /// ```
194    /// # use google_cloud_hypercomputecluster_v1::builder::hypercompute_cluster::GetCluster;
195    /// # async fn sample() -> google_cloud_hypercomputecluster_v1::Result<()> {
196    ///
197    /// let builder = prepare_request_builder();
198    /// let response = builder.send().await?;
199    /// # Ok(()) }
200    ///
201    /// fn prepare_request_builder() -> GetCluster {
202    ///   # panic!();
203    ///   // ... details omitted ...
204    /// }
205    /// ```
206    #[derive(Clone, Debug)]
207    pub struct GetCluster(RequestBuilder<crate::model::GetClusterRequest>);
208
209    impl GetCluster {
210        pub(crate) fn new(
211            stub: std::sync::Arc<dyn super::super::stub::dynamic::HypercomputeCluster>,
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::GetClusterRequest>>(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::Cluster> {
230            (*self.0.stub)
231                .get_cluster(self.0.request, self.0.options)
232                .await
233                .map(crate::Response::into_body)
234        }
235
236        /// Sets the value of [name][crate::model::GetClusterRequest::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 GetCluster {
247        fn request_options(&mut self) -> &mut crate::RequestOptions {
248            &mut self.0.options
249        }
250    }
251
252    /// The request builder for [HypercomputeCluster::create_cluster][crate::client::HypercomputeCluster::create_cluster] calls.
253    ///
254    /// # Example
255    /// ```
256    /// # use google_cloud_hypercomputecluster_v1::builder::hypercompute_cluster::CreateCluster;
257    /// # async fn sample() -> google_cloud_hypercomputecluster_v1::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() -> CreateCluster {
265    ///   # panic!();
266    ///   // ... details omitted ...
267    /// }
268    /// ```
269    #[derive(Clone, Debug)]
270    pub struct CreateCluster(RequestBuilder<crate::model::CreateClusterRequest>);
271
272    impl CreateCluster {
273        pub(crate) fn new(
274            stub: std::sync::Arc<dyn super::super::stub::dynamic::HypercomputeCluster>,
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::CreateClusterRequest>>(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_cluster][crate::client::HypercomputeCluster::create_cluster].
297        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
298            (*self.0.stub)
299                .create_cluster(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_cluster`.
305        pub fn poller(
306            self,
307        ) -> impl google_cloud_lro::Poller<crate::model::Cluster, crate::model::OperationMetadata>
308        {
309            type Operation = google_cloud_lro::internal::Operation<
310                crate::model::Cluster,
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            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
316            if let Some(ref mut details) = poller_options.tracing {
317                details.method_name = "google_cloud_hypercomputecluster_v1::client::HypercomputeCluster::create_cluster::until_done";
318            }
319
320            let stub = self.0.stub.clone();
321            let mut options = self.0.options.clone();
322            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
323            let query = move |name| {
324                let stub = stub.clone();
325                let options = options.clone();
326                async {
327                    let op = GetOperation::new(stub)
328                        .set_name(name)
329                        .with_options(options)
330                        .send()
331                        .await?;
332                    Ok(Operation::new(op))
333                }
334            };
335
336            let start = move || async {
337                let op = self.send().await?;
338                Ok(Operation::new(op))
339            };
340
341            use google_cloud_lro::internal::PollerExt;
342            {
343                google_cloud_lro::internal::new_poller(
344                    polling_error_policy,
345                    polling_backoff_policy,
346                    start,
347                    query,
348                )
349            }
350            .with_options(poller_options)
351        }
352
353        /// Sets the value of [parent][crate::model::CreateClusterRequest::parent].
354        ///
355        /// This is a **required** field for requests.
356        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
357            self.0.request.parent = v.into();
358            self
359        }
360
361        /// Sets the value of [cluster_id][crate::model::CreateClusterRequest::cluster_id].
362        ///
363        /// This is a **required** field for requests.
364        pub fn set_cluster_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
365            self.0.request.cluster_id = v.into();
366            self
367        }
368
369        /// Sets the value of [cluster][crate::model::CreateClusterRequest::cluster].
370        ///
371        /// This is a **required** field for requests.
372        pub fn set_cluster<T>(mut self, v: T) -> Self
373        where
374            T: std::convert::Into<crate::model::Cluster>,
375        {
376            self.0.request.cluster = std::option::Option::Some(v.into());
377            self
378        }
379
380        /// Sets or clears the value of [cluster][crate::model::CreateClusterRequest::cluster].
381        ///
382        /// This is a **required** field for requests.
383        pub fn set_or_clear_cluster<T>(mut self, v: std::option::Option<T>) -> Self
384        where
385            T: std::convert::Into<crate::model::Cluster>,
386        {
387            self.0.request.cluster = v.map(|x| x.into());
388            self
389        }
390
391        /// Sets the value of [request_id][crate::model::CreateClusterRequest::request_id].
392        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
393            self.0.request.request_id = v.into();
394            self
395        }
396    }
397
398    #[doc(hidden)]
399    impl crate::RequestBuilder for CreateCluster {
400        fn request_options(&mut self) -> &mut crate::RequestOptions {
401            &mut self.0.options
402        }
403    }
404
405    /// The request builder for [HypercomputeCluster::update_cluster][crate::client::HypercomputeCluster::update_cluster] calls.
406    ///
407    /// # Example
408    /// ```
409    /// # use google_cloud_hypercomputecluster_v1::builder::hypercompute_cluster::UpdateCluster;
410    /// # async fn sample() -> google_cloud_hypercomputecluster_v1::Result<()> {
411    /// use google_cloud_lro::Poller;
412    ///
413    /// let builder = prepare_request_builder();
414    /// let response = builder.poller().until_done().await?;
415    /// # Ok(()) }
416    ///
417    /// fn prepare_request_builder() -> UpdateCluster {
418    ///   # panic!();
419    ///   // ... details omitted ...
420    /// }
421    /// ```
422    #[derive(Clone, Debug)]
423    pub struct UpdateCluster(RequestBuilder<crate::model::UpdateClusterRequest>);
424
425    impl UpdateCluster {
426        pub(crate) fn new(
427            stub: std::sync::Arc<dyn super::super::stub::dynamic::HypercomputeCluster>,
428        ) -> Self {
429            Self(RequestBuilder::new(stub))
430        }
431
432        /// Sets the full request, replacing any prior values.
433        pub fn with_request<V: Into<crate::model::UpdateClusterRequest>>(mut self, v: V) -> Self {
434            self.0.request = v.into();
435            self
436        }
437
438        /// Sets all the options, replacing any prior values.
439        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
440            self.0.options = v.into();
441            self
442        }
443
444        /// Sends the request.
445        ///
446        /// # Long running operations
447        ///
448        /// This starts, but does not poll, a longrunning operation. More information
449        /// on [update_cluster][crate::client::HypercomputeCluster::update_cluster].
450        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
451            (*self.0.stub)
452                .update_cluster(self.0.request, self.0.options)
453                .await
454                .map(crate::Response::into_body)
455        }
456
457        /// Creates a [Poller][google_cloud_lro::Poller] to work with `update_cluster`.
458        pub fn poller(
459            self,
460        ) -> impl google_cloud_lro::Poller<crate::model::Cluster, crate::model::OperationMetadata>
461        {
462            type Operation = google_cloud_lro::internal::Operation<
463                crate::model::Cluster,
464                crate::model::OperationMetadata,
465            >;
466            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
467            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
468            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
469            if let Some(ref mut details) = poller_options.tracing {
470                details.method_name = "google_cloud_hypercomputecluster_v1::client::HypercomputeCluster::update_cluster::until_done";
471            }
472
473            let stub = self.0.stub.clone();
474            let mut options = self.0.options.clone();
475            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
476            let query = move |name| {
477                let stub = stub.clone();
478                let options = options.clone();
479                async {
480                    let op = GetOperation::new(stub)
481                        .set_name(name)
482                        .with_options(options)
483                        .send()
484                        .await?;
485                    Ok(Operation::new(op))
486                }
487            };
488
489            let start = move || async {
490                let op = self.send().await?;
491                Ok(Operation::new(op))
492            };
493
494            use google_cloud_lro::internal::PollerExt;
495            {
496                google_cloud_lro::internal::new_poller(
497                    polling_error_policy,
498                    polling_backoff_policy,
499                    start,
500                    query,
501                )
502            }
503            .with_options(poller_options)
504        }
505
506        /// Sets the value of [cluster][crate::model::UpdateClusterRequest::cluster].
507        ///
508        /// This is a **required** field for requests.
509        pub fn set_cluster<T>(mut self, v: T) -> Self
510        where
511            T: std::convert::Into<crate::model::Cluster>,
512        {
513            self.0.request.cluster = std::option::Option::Some(v.into());
514            self
515        }
516
517        /// Sets or clears the value of [cluster][crate::model::UpdateClusterRequest::cluster].
518        ///
519        /// This is a **required** field for requests.
520        pub fn set_or_clear_cluster<T>(mut self, v: std::option::Option<T>) -> Self
521        where
522            T: std::convert::Into<crate::model::Cluster>,
523        {
524            self.0.request.cluster = v.map(|x| x.into());
525            self
526        }
527
528        /// Sets the value of [update_mask][crate::model::UpdateClusterRequest::update_mask].
529        pub fn set_update_mask<T>(mut self, v: T) -> Self
530        where
531            T: std::convert::Into<wkt::FieldMask>,
532        {
533            self.0.request.update_mask = std::option::Option::Some(v.into());
534            self
535        }
536
537        /// Sets or clears the value of [update_mask][crate::model::UpdateClusterRequest::update_mask].
538        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
539        where
540            T: std::convert::Into<wkt::FieldMask>,
541        {
542            self.0.request.update_mask = v.map(|x| x.into());
543            self
544        }
545
546        /// Sets the value of [request_id][crate::model::UpdateClusterRequest::request_id].
547        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
548            self.0.request.request_id = v.into();
549            self
550        }
551    }
552
553    #[doc(hidden)]
554    impl crate::RequestBuilder for UpdateCluster {
555        fn request_options(&mut self) -> &mut crate::RequestOptions {
556            &mut self.0.options
557        }
558    }
559
560    /// The request builder for [HypercomputeCluster::delete_cluster][crate::client::HypercomputeCluster::delete_cluster] calls.
561    ///
562    /// # Example
563    /// ```
564    /// # use google_cloud_hypercomputecluster_v1::builder::hypercompute_cluster::DeleteCluster;
565    /// # async fn sample() -> google_cloud_hypercomputecluster_v1::Result<()> {
566    /// use google_cloud_lro::Poller;
567    ///
568    /// let builder = prepare_request_builder();
569    /// let response = builder.poller().until_done().await?;
570    /// # Ok(()) }
571    ///
572    /// fn prepare_request_builder() -> DeleteCluster {
573    ///   # panic!();
574    ///   // ... details omitted ...
575    /// }
576    /// ```
577    #[derive(Clone, Debug)]
578    pub struct DeleteCluster(RequestBuilder<crate::model::DeleteClusterRequest>);
579
580    impl DeleteCluster {
581        pub(crate) fn new(
582            stub: std::sync::Arc<dyn super::super::stub::dynamic::HypercomputeCluster>,
583        ) -> Self {
584            Self(RequestBuilder::new(stub))
585        }
586
587        /// Sets the full request, replacing any prior values.
588        pub fn with_request<V: Into<crate::model::DeleteClusterRequest>>(mut self, v: V) -> Self {
589            self.0.request = v.into();
590            self
591        }
592
593        /// Sets all the options, replacing any prior values.
594        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
595            self.0.options = v.into();
596            self
597        }
598
599        /// Sends the request.
600        ///
601        /// # Long running operations
602        ///
603        /// This starts, but does not poll, a longrunning operation. More information
604        /// on [delete_cluster][crate::client::HypercomputeCluster::delete_cluster].
605        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
606            (*self.0.stub)
607                .delete_cluster(self.0.request, self.0.options)
608                .await
609                .map(crate::Response::into_body)
610        }
611
612        /// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_cluster`.
613        pub fn poller(self) -> impl google_cloud_lro::Poller<(), crate::model::OperationMetadata> {
614            type Operation =
615                google_cloud_lro::internal::Operation<wkt::Empty, crate::model::OperationMetadata>;
616            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
617            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
618            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
619            if let Some(ref mut details) = poller_options.tracing {
620                details.method_name = "google_cloud_hypercomputecluster_v1::client::HypercomputeCluster::delete_cluster::until_done";
621            }
622
623            let stub = self.0.stub.clone();
624            let mut options = self.0.options.clone();
625            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
626            let query = move |name| {
627                let stub = stub.clone();
628                let options = options.clone();
629                async {
630                    let op = GetOperation::new(stub)
631                        .set_name(name)
632                        .with_options(options)
633                        .send()
634                        .await?;
635                    Ok(Operation::new(op))
636                }
637            };
638
639            let start = move || async {
640                let op = self.send().await?;
641                Ok(Operation::new(op))
642            };
643
644            use google_cloud_lro::internal::PollerExt;
645            {
646                google_cloud_lro::internal::new_unit_response_poller(
647                    polling_error_policy,
648                    polling_backoff_policy,
649                    start,
650                    query,
651                )
652            }
653            .with_options(poller_options)
654        }
655
656        /// Sets the value of [name][crate::model::DeleteClusterRequest::name].
657        ///
658        /// This is a **required** field for requests.
659        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
660            self.0.request.name = v.into();
661            self
662        }
663
664        /// Sets the value of [request_id][crate::model::DeleteClusterRequest::request_id].
665        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
666            self.0.request.request_id = v.into();
667            self
668        }
669    }
670
671    #[doc(hidden)]
672    impl crate::RequestBuilder for DeleteCluster {
673        fn request_options(&mut self) -> &mut crate::RequestOptions {
674            &mut self.0.options
675        }
676    }
677
678    /// The request builder for [HypercomputeCluster::list_locations][crate::client::HypercomputeCluster::list_locations] calls.
679    ///
680    /// # Example
681    /// ```
682    /// # use google_cloud_hypercomputecluster_v1::builder::hypercompute_cluster::ListLocations;
683    /// # async fn sample() -> google_cloud_hypercomputecluster_v1::Result<()> {
684    /// use google_cloud_gax::paginator::ItemPaginator;
685    ///
686    /// let builder = prepare_request_builder();
687    /// let mut items = builder.by_item();
688    /// while let Some(result) = items.next().await {
689    ///   let item = result?;
690    /// }
691    /// # Ok(()) }
692    ///
693    /// fn prepare_request_builder() -> ListLocations {
694    ///   # panic!();
695    ///   // ... details omitted ...
696    /// }
697    /// ```
698    #[derive(Clone, Debug)]
699    pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
700
701    impl ListLocations {
702        pub(crate) fn new(
703            stub: std::sync::Arc<dyn super::super::stub::dynamic::HypercomputeCluster>,
704        ) -> Self {
705            Self(RequestBuilder::new(stub))
706        }
707
708        /// Sets the full request, replacing any prior values.
709        pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
710            mut self,
711            v: V,
712        ) -> Self {
713            self.0.request = v.into();
714            self
715        }
716
717        /// Sets all the options, replacing any prior values.
718        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
719            self.0.options = v.into();
720            self
721        }
722
723        /// Sends the request.
724        pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
725            (*self.0.stub)
726                .list_locations(self.0.request, self.0.options)
727                .await
728                .map(crate::Response::into_body)
729        }
730
731        /// Streams each page in the collection.
732        pub fn by_page(
733            self,
734        ) -> impl google_cloud_gax::paginator::Paginator<
735            google_cloud_location::model::ListLocationsResponse,
736            crate::Error,
737        > {
738            use std::clone::Clone;
739            let token = self.0.request.page_token.clone();
740            let execute = move |token: String| {
741                let mut builder = self.clone();
742                builder.0.request = builder.0.request.set_page_token(token);
743                builder.send()
744            };
745            google_cloud_gax::paginator::internal::new_paginator(token, execute)
746        }
747
748        /// Streams each item in the collection.
749        pub fn by_item(
750            self,
751        ) -> impl google_cloud_gax::paginator::ItemPaginator<
752            google_cloud_location::model::ListLocationsResponse,
753            crate::Error,
754        > {
755            use google_cloud_gax::paginator::Paginator;
756            self.by_page().items()
757        }
758
759        /// Sets the value of [name][google_cloud_location::model::ListLocationsRequest::name].
760        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
761            self.0.request.name = v.into();
762            self
763        }
764
765        /// Sets the value of [filter][google_cloud_location::model::ListLocationsRequest::filter].
766        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
767            self.0.request.filter = v.into();
768            self
769        }
770
771        /// Sets the value of [page_size][google_cloud_location::model::ListLocationsRequest::page_size].
772        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
773            self.0.request.page_size = v.into();
774            self
775        }
776
777        /// Sets the value of [page_token][google_cloud_location::model::ListLocationsRequest::page_token].
778        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
779            self.0.request.page_token = v.into();
780            self
781        }
782    }
783
784    #[doc(hidden)]
785    impl crate::RequestBuilder for ListLocations {
786        fn request_options(&mut self) -> &mut crate::RequestOptions {
787            &mut self.0.options
788        }
789    }
790
791    /// The request builder for [HypercomputeCluster::get_location][crate::client::HypercomputeCluster::get_location] calls.
792    ///
793    /// # Example
794    /// ```
795    /// # use google_cloud_hypercomputecluster_v1::builder::hypercompute_cluster::GetLocation;
796    /// # async fn sample() -> google_cloud_hypercomputecluster_v1::Result<()> {
797    ///
798    /// let builder = prepare_request_builder();
799    /// let response = builder.send().await?;
800    /// # Ok(()) }
801    ///
802    /// fn prepare_request_builder() -> GetLocation {
803    ///   # panic!();
804    ///   // ... details omitted ...
805    /// }
806    /// ```
807    #[derive(Clone, Debug)]
808    pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
809
810    impl GetLocation {
811        pub(crate) fn new(
812            stub: std::sync::Arc<dyn super::super::stub::dynamic::HypercomputeCluster>,
813        ) -> Self {
814            Self(RequestBuilder::new(stub))
815        }
816
817        /// Sets the full request, replacing any prior values.
818        pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
819            mut self,
820            v: V,
821        ) -> Self {
822            self.0.request = v.into();
823            self
824        }
825
826        /// Sets all the options, replacing any prior values.
827        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
828            self.0.options = v.into();
829            self
830        }
831
832        /// Sends the request.
833        pub async fn send(self) -> Result<google_cloud_location::model::Location> {
834            (*self.0.stub)
835                .get_location(self.0.request, self.0.options)
836                .await
837                .map(crate::Response::into_body)
838        }
839
840        /// Sets the value of [name][google_cloud_location::model::GetLocationRequest::name].
841        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
842            self.0.request.name = v.into();
843            self
844        }
845    }
846
847    #[doc(hidden)]
848    impl crate::RequestBuilder for GetLocation {
849        fn request_options(&mut self) -> &mut crate::RequestOptions {
850            &mut self.0.options
851        }
852    }
853
854    /// The request builder for [HypercomputeCluster::list_operations][crate::client::HypercomputeCluster::list_operations] calls.
855    ///
856    /// # Example
857    /// ```
858    /// # use google_cloud_hypercomputecluster_v1::builder::hypercompute_cluster::ListOperations;
859    /// # async fn sample() -> google_cloud_hypercomputecluster_v1::Result<()> {
860    /// use google_cloud_gax::paginator::ItemPaginator;
861    ///
862    /// let builder = prepare_request_builder();
863    /// let mut items = builder.by_item();
864    /// while let Some(result) = items.next().await {
865    ///   let item = result?;
866    /// }
867    /// # Ok(()) }
868    ///
869    /// fn prepare_request_builder() -> ListOperations {
870    ///   # panic!();
871    ///   // ... details omitted ...
872    /// }
873    /// ```
874    #[derive(Clone, Debug)]
875    pub struct ListOperations(
876        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
877    );
878
879    impl ListOperations {
880        pub(crate) fn new(
881            stub: std::sync::Arc<dyn super::super::stub::dynamic::HypercomputeCluster>,
882        ) -> Self {
883            Self(RequestBuilder::new(stub))
884        }
885
886        /// Sets the full request, replacing any prior values.
887        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
888            mut self,
889            v: V,
890        ) -> Self {
891            self.0.request = v.into();
892            self
893        }
894
895        /// Sets all the options, replacing any prior values.
896        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
897            self.0.options = v.into();
898            self
899        }
900
901        /// Sends the request.
902        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
903            (*self.0.stub)
904                .list_operations(self.0.request, self.0.options)
905                .await
906                .map(crate::Response::into_body)
907        }
908
909        /// Streams each page in the collection.
910        pub fn by_page(
911            self,
912        ) -> impl google_cloud_gax::paginator::Paginator<
913            google_cloud_longrunning::model::ListOperationsResponse,
914            crate::Error,
915        > {
916            use std::clone::Clone;
917            let token = self.0.request.page_token.clone();
918            let execute = move |token: String| {
919                let mut builder = self.clone();
920                builder.0.request = builder.0.request.set_page_token(token);
921                builder.send()
922            };
923            google_cloud_gax::paginator::internal::new_paginator(token, execute)
924        }
925
926        /// Streams each item in the collection.
927        pub fn by_item(
928            self,
929        ) -> impl google_cloud_gax::paginator::ItemPaginator<
930            google_cloud_longrunning::model::ListOperationsResponse,
931            crate::Error,
932        > {
933            use google_cloud_gax::paginator::Paginator;
934            self.by_page().items()
935        }
936
937        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
938        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
939            self.0.request.name = v.into();
940            self
941        }
942
943        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
944        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
945            self.0.request.filter = v.into();
946            self
947        }
948
949        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
950        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
951            self.0.request.page_size = v.into();
952            self
953        }
954
955        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
956        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
957            self.0.request.page_token = v.into();
958            self
959        }
960
961        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
962        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
963            self.0.request.return_partial_success = v.into();
964            self
965        }
966    }
967
968    #[doc(hidden)]
969    impl crate::RequestBuilder for ListOperations {
970        fn request_options(&mut self) -> &mut crate::RequestOptions {
971            &mut self.0.options
972        }
973    }
974
975    /// The request builder for [HypercomputeCluster::get_operation][crate::client::HypercomputeCluster::get_operation] calls.
976    ///
977    /// # Example
978    /// ```
979    /// # use google_cloud_hypercomputecluster_v1::builder::hypercompute_cluster::GetOperation;
980    /// # async fn sample() -> google_cloud_hypercomputecluster_v1::Result<()> {
981    ///
982    /// let builder = prepare_request_builder();
983    /// let response = builder.send().await?;
984    /// # Ok(()) }
985    ///
986    /// fn prepare_request_builder() -> GetOperation {
987    ///   # panic!();
988    ///   // ... details omitted ...
989    /// }
990    /// ```
991    #[derive(Clone, Debug)]
992    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
993
994    impl GetOperation {
995        pub(crate) fn new(
996            stub: std::sync::Arc<dyn super::super::stub::dynamic::HypercomputeCluster>,
997        ) -> Self {
998            Self(RequestBuilder::new(stub))
999        }
1000
1001        /// Sets the full request, replacing any prior values.
1002        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
1003            mut self,
1004            v: V,
1005        ) -> Self {
1006            self.0.request = v.into();
1007            self
1008        }
1009
1010        /// Sets all the options, replacing any prior values.
1011        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1012            self.0.options = v.into();
1013            self
1014        }
1015
1016        /// Sends the request.
1017        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1018            (*self.0.stub)
1019                .get_operation(self.0.request, self.0.options)
1020                .await
1021                .map(crate::Response::into_body)
1022        }
1023
1024        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
1025        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1026            self.0.request.name = v.into();
1027            self
1028        }
1029    }
1030
1031    #[doc(hidden)]
1032    impl crate::RequestBuilder for GetOperation {
1033        fn request_options(&mut self) -> &mut crate::RequestOptions {
1034            &mut self.0.options
1035        }
1036    }
1037
1038    /// The request builder for [HypercomputeCluster::delete_operation][crate::client::HypercomputeCluster::delete_operation] calls.
1039    ///
1040    /// # Example
1041    /// ```
1042    /// # use google_cloud_hypercomputecluster_v1::builder::hypercompute_cluster::DeleteOperation;
1043    /// # async fn sample() -> google_cloud_hypercomputecluster_v1::Result<()> {
1044    ///
1045    /// let builder = prepare_request_builder();
1046    /// let response = builder.send().await?;
1047    /// # Ok(()) }
1048    ///
1049    /// fn prepare_request_builder() -> DeleteOperation {
1050    ///   # panic!();
1051    ///   // ... details omitted ...
1052    /// }
1053    /// ```
1054    #[derive(Clone, Debug)]
1055    pub struct DeleteOperation(
1056        RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
1057    );
1058
1059    impl DeleteOperation {
1060        pub(crate) fn new(
1061            stub: std::sync::Arc<dyn super::super::stub::dynamic::HypercomputeCluster>,
1062        ) -> Self {
1063            Self(RequestBuilder::new(stub))
1064        }
1065
1066        /// Sets the full request, replacing any prior values.
1067        pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
1068            mut self,
1069            v: V,
1070        ) -> Self {
1071            self.0.request = v.into();
1072            self
1073        }
1074
1075        /// Sets all the options, replacing any prior values.
1076        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1077            self.0.options = v.into();
1078            self
1079        }
1080
1081        /// Sends the request.
1082        pub async fn send(self) -> Result<()> {
1083            (*self.0.stub)
1084                .delete_operation(self.0.request, self.0.options)
1085                .await
1086                .map(crate::Response::into_body)
1087        }
1088
1089        /// Sets the value of [name][google_cloud_longrunning::model::DeleteOperationRequest::name].
1090        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1091            self.0.request.name = v.into();
1092            self
1093        }
1094    }
1095
1096    #[doc(hidden)]
1097    impl crate::RequestBuilder for DeleteOperation {
1098        fn request_options(&mut self) -> &mut crate::RequestOptions {
1099            &mut self.0.options
1100        }
1101    }
1102
1103    /// The request builder for [HypercomputeCluster::cancel_operation][crate::client::HypercomputeCluster::cancel_operation] calls.
1104    ///
1105    /// # Example
1106    /// ```
1107    /// # use google_cloud_hypercomputecluster_v1::builder::hypercompute_cluster::CancelOperation;
1108    /// # async fn sample() -> google_cloud_hypercomputecluster_v1::Result<()> {
1109    ///
1110    /// let builder = prepare_request_builder();
1111    /// let response = builder.send().await?;
1112    /// # Ok(()) }
1113    ///
1114    /// fn prepare_request_builder() -> CancelOperation {
1115    ///   # panic!();
1116    ///   // ... details omitted ...
1117    /// }
1118    /// ```
1119    #[derive(Clone, Debug)]
1120    pub struct CancelOperation(
1121        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
1122    );
1123
1124    impl CancelOperation {
1125        pub(crate) fn new(
1126            stub: std::sync::Arc<dyn super::super::stub::dynamic::HypercomputeCluster>,
1127        ) -> Self {
1128            Self(RequestBuilder::new(stub))
1129        }
1130
1131        /// Sets the full request, replacing any prior values.
1132        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
1133            mut self,
1134            v: V,
1135        ) -> Self {
1136            self.0.request = v.into();
1137            self
1138        }
1139
1140        /// Sets all the options, replacing any prior values.
1141        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1142            self.0.options = v.into();
1143            self
1144        }
1145
1146        /// Sends the request.
1147        pub async fn send(self) -> Result<()> {
1148            (*self.0.stub)
1149                .cancel_operation(self.0.request, self.0.options)
1150                .await
1151                .map(crate::Response::into_body)
1152        }
1153
1154        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
1155        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1156            self.0.request.name = v.into();
1157            self
1158        }
1159    }
1160
1161    #[doc(hidden)]
1162    impl crate::RequestBuilder for CancelOperation {
1163        fn request_options(&mut self) -> &mut crate::RequestOptions {
1164            &mut self.0.options
1165        }
1166    }
1167}