Skip to main content

google_cloud_licensemanager_v1/
builder.rs

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