google_cloud_logging_v2/
builder.rs

1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17pub mod logging_service_v_2 {
18    use crate::Result;
19
20    /// A builder for [LoggingServiceV2][crate::client::LoggingServiceV2].
21    ///
22    /// ```
23    /// # tokio_test::block_on(async {
24    /// # use google_cloud_logging_v2::*;
25    /// # use builder::logging_service_v_2::ClientBuilder;
26    /// # use client::LoggingServiceV2;
27    /// let builder : ClientBuilder = LoggingServiceV2::builder();
28    /// let client = builder
29    ///     .with_endpoint("https://logging.googleapis.com")
30    ///     .build().await?;
31    /// # gax::client_builder::Result::<()>::Ok(()) });
32    /// ```
33    pub type ClientBuilder =
34        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
35
36    pub(crate) mod client {
37        use super::super::super::client::LoggingServiceV2;
38        pub struct Factory;
39        impl gax::client_builder::internal::ClientFactory for Factory {
40            type Client = LoggingServiceV2;
41            type Credentials = gaxi::options::Credentials;
42            async fn build(
43                self,
44                config: gaxi::options::ClientConfig,
45            ) -> gax::client_builder::Result<Self::Client> {
46                Self::Client::new(config).await
47            }
48        }
49    }
50
51    /// Common implementation for [crate::client::LoggingServiceV2] 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::LoggingServiceV2>,
55        request: R,
56        options: gax::options::RequestOptions,
57    }
58
59    impl<R> RequestBuilder<R>
60    where
61        R: std::default::Default,
62    {
63        pub(crate) fn new(
64            stub: std::sync::Arc<dyn super::super::stub::dynamic::LoggingServiceV2>,
65        ) -> Self {
66            Self {
67                stub,
68                request: R::default(),
69                options: gax::options::RequestOptions::default(),
70            }
71        }
72    }
73
74    /// The request builder for [LoggingServiceV2::delete_log][crate::client::LoggingServiceV2::delete_log] calls.
75    ///
76    /// # Example
77    /// ```no_run
78    /// # use google_cloud_logging_v2::builder;
79    /// use builder::logging_service_v_2::DeleteLog;
80    /// # tokio_test::block_on(async {
81    ///
82    /// let builder = prepare_request_builder();
83    /// let response = builder.send().await?;
84    /// # gax::Result::<()>::Ok(()) });
85    ///
86    /// fn prepare_request_builder() -> DeleteLog {
87    ///   # panic!();
88    ///   // ... details omitted ...
89    /// }
90    /// ```
91    #[derive(Clone, Debug)]
92    pub struct DeleteLog(RequestBuilder<crate::model::DeleteLogRequest>);
93
94    impl DeleteLog {
95        pub(crate) fn new(
96            stub: std::sync::Arc<dyn super::super::stub::dynamic::LoggingServiceV2>,
97        ) -> Self {
98            Self(RequestBuilder::new(stub))
99        }
100
101        /// Sets the full request, replacing any prior values.
102        pub fn with_request<V: Into<crate::model::DeleteLogRequest>>(mut self, v: V) -> Self {
103            self.0.request = v.into();
104            self
105        }
106
107        /// Sets all the options, replacing any prior values.
108        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
109            self.0.options = v.into();
110            self
111        }
112
113        /// Sends the request.
114        pub async fn send(self) -> Result<()> {
115            (*self.0.stub)
116                .delete_log(self.0.request, self.0.options)
117                .await
118                .map(gax::response::Response::into_body)
119        }
120
121        /// Sets the value of [log_name][crate::model::DeleteLogRequest::log_name].
122        ///
123        /// This is a **required** field for requests.
124        pub fn set_log_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
125            self.0.request.log_name = v.into();
126            self
127        }
128    }
129
130    #[doc(hidden)]
131    impl gax::options::internal::RequestBuilder for DeleteLog {
132        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
133            &mut self.0.options
134        }
135    }
136
137    /// The request builder for [LoggingServiceV2::write_log_entries][crate::client::LoggingServiceV2::write_log_entries] calls.
138    ///
139    /// # Example
140    /// ```no_run
141    /// # use google_cloud_logging_v2::builder;
142    /// use builder::logging_service_v_2::WriteLogEntries;
143    /// # tokio_test::block_on(async {
144    ///
145    /// let builder = prepare_request_builder();
146    /// let response = builder.send().await?;
147    /// # gax::Result::<()>::Ok(()) });
148    ///
149    /// fn prepare_request_builder() -> WriteLogEntries {
150    ///   # panic!();
151    ///   // ... details omitted ...
152    /// }
153    /// ```
154    #[derive(Clone, Debug)]
155    pub struct WriteLogEntries(RequestBuilder<crate::model::WriteLogEntriesRequest>);
156
157    impl WriteLogEntries {
158        pub(crate) fn new(
159            stub: std::sync::Arc<dyn super::super::stub::dynamic::LoggingServiceV2>,
160        ) -> Self {
161            Self(RequestBuilder::new(stub))
162        }
163
164        /// Sets the full request, replacing any prior values.
165        pub fn with_request<V: Into<crate::model::WriteLogEntriesRequest>>(mut self, v: V) -> Self {
166            self.0.request = v.into();
167            self
168        }
169
170        /// Sets all the options, replacing any prior values.
171        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
172            self.0.options = v.into();
173            self
174        }
175
176        /// Sends the request.
177        pub async fn send(self) -> Result<crate::model::WriteLogEntriesResponse> {
178            (*self.0.stub)
179                .write_log_entries(self.0.request, self.0.options)
180                .await
181                .map(gax::response::Response::into_body)
182        }
183
184        /// Sets the value of [log_name][crate::model::WriteLogEntriesRequest::log_name].
185        pub fn set_log_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
186            self.0.request.log_name = v.into();
187            self
188        }
189
190        /// Sets the value of [resource][crate::model::WriteLogEntriesRequest::resource].
191        pub fn set_resource<T>(mut self, v: T) -> Self
192        where
193            T: std::convert::Into<api::model::MonitoredResource>,
194        {
195            self.0.request.resource = std::option::Option::Some(v.into());
196            self
197        }
198
199        /// Sets or clears the value of [resource][crate::model::WriteLogEntriesRequest::resource].
200        pub fn set_or_clear_resource<T>(mut self, v: std::option::Option<T>) -> Self
201        where
202            T: std::convert::Into<api::model::MonitoredResource>,
203        {
204            self.0.request.resource = v.map(|x| x.into());
205            self
206        }
207
208        /// Sets the value of [labels][crate::model::WriteLogEntriesRequest::labels].
209        pub fn set_labels<T, K, V>(mut self, v: T) -> Self
210        where
211            T: std::iter::IntoIterator<Item = (K, V)>,
212            K: std::convert::Into<std::string::String>,
213            V: std::convert::Into<std::string::String>,
214        {
215            self.0.request.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
216            self
217        }
218
219        /// Sets the value of [entries][crate::model::WriteLogEntriesRequest::entries].
220        ///
221        /// This is a **required** field for requests.
222        pub fn set_entries<T, V>(mut self, v: T) -> Self
223        where
224            T: std::iter::IntoIterator<Item = V>,
225            V: std::convert::Into<crate::model::LogEntry>,
226        {
227            use std::iter::Iterator;
228            self.0.request.entries = v.into_iter().map(|i| i.into()).collect();
229            self
230        }
231
232        /// Sets the value of [partial_success][crate::model::WriteLogEntriesRequest::partial_success].
233        pub fn set_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
234            self.0.request.partial_success = v.into();
235            self
236        }
237
238        /// Sets the value of [dry_run][crate::model::WriteLogEntriesRequest::dry_run].
239        pub fn set_dry_run<T: Into<bool>>(mut self, v: T) -> Self {
240            self.0.request.dry_run = v.into();
241            self
242        }
243    }
244
245    #[doc(hidden)]
246    impl gax::options::internal::RequestBuilder for WriteLogEntries {
247        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
248            &mut self.0.options
249        }
250    }
251
252    /// The request builder for [LoggingServiceV2::list_log_entries][crate::client::LoggingServiceV2::list_log_entries] calls.
253    ///
254    /// # Example
255    /// ```no_run
256    /// # use google_cloud_logging_v2::builder;
257    /// use builder::logging_service_v_2::ListLogEntries;
258    /// # tokio_test::block_on(async {
259    /// use gax::paginator::ItemPaginator;
260    ///
261    /// let builder = prepare_request_builder();
262    /// let mut items = builder.by_item();
263    /// while let Some(result) = items.next().await {
264    ///   let item = result?;
265    /// }
266    /// # gax::Result::<()>::Ok(()) });
267    ///
268    /// fn prepare_request_builder() -> ListLogEntries {
269    ///   # panic!();
270    ///   // ... details omitted ...
271    /// }
272    /// ```
273    #[derive(Clone, Debug)]
274    pub struct ListLogEntries(RequestBuilder<crate::model::ListLogEntriesRequest>);
275
276    impl ListLogEntries {
277        pub(crate) fn new(
278            stub: std::sync::Arc<dyn super::super::stub::dynamic::LoggingServiceV2>,
279        ) -> Self {
280            Self(RequestBuilder::new(stub))
281        }
282
283        /// Sets the full request, replacing any prior values.
284        pub fn with_request<V: Into<crate::model::ListLogEntriesRequest>>(mut self, v: V) -> Self {
285            self.0.request = v.into();
286            self
287        }
288
289        /// Sets all the options, replacing any prior values.
290        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
291            self.0.options = v.into();
292            self
293        }
294
295        /// Sends the request.
296        pub async fn send(self) -> Result<crate::model::ListLogEntriesResponse> {
297            (*self.0.stub)
298                .list_log_entries(self.0.request, self.0.options)
299                .await
300                .map(gax::response::Response::into_body)
301        }
302
303        /// Streams each page in the collection.
304        pub fn by_page(
305            self,
306        ) -> impl gax::paginator::Paginator<crate::model::ListLogEntriesResponse, gax::error::Error>
307        {
308            use std::clone::Clone;
309            let token = self.0.request.page_token.clone();
310            let execute = move |token: String| {
311                let mut builder = self.clone();
312                builder.0.request = builder.0.request.set_page_token(token);
313                builder.send()
314            };
315            gax::paginator::internal::new_paginator(token, execute)
316        }
317
318        /// Streams each item in the collection.
319        pub fn by_item(
320            self,
321        ) -> impl gax::paginator::ItemPaginator<crate::model::ListLogEntriesResponse, gax::error::Error>
322        {
323            use gax::paginator::Paginator;
324            self.by_page().items()
325        }
326
327        /// Sets the value of [resource_names][crate::model::ListLogEntriesRequest::resource_names].
328        ///
329        /// This is a **required** field for requests.
330        pub fn set_resource_names<T, V>(mut self, v: T) -> Self
331        where
332            T: std::iter::IntoIterator<Item = V>,
333            V: std::convert::Into<std::string::String>,
334        {
335            use std::iter::Iterator;
336            self.0.request.resource_names = v.into_iter().map(|i| i.into()).collect();
337            self
338        }
339
340        /// Sets the value of [filter][crate::model::ListLogEntriesRequest::filter].
341        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
342            self.0.request.filter = v.into();
343            self
344        }
345
346        /// Sets the value of [order_by][crate::model::ListLogEntriesRequest::order_by].
347        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
348            self.0.request.order_by = v.into();
349            self
350        }
351
352        /// Sets the value of [page_size][crate::model::ListLogEntriesRequest::page_size].
353        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
354            self.0.request.page_size = v.into();
355            self
356        }
357
358        /// Sets the value of [page_token][crate::model::ListLogEntriesRequest::page_token].
359        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
360            self.0.request.page_token = v.into();
361            self
362        }
363    }
364
365    #[doc(hidden)]
366    impl gax::options::internal::RequestBuilder for ListLogEntries {
367        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
368            &mut self.0.options
369        }
370    }
371
372    /// The request builder for [LoggingServiceV2::list_monitored_resource_descriptors][crate::client::LoggingServiceV2::list_monitored_resource_descriptors] calls.
373    ///
374    /// # Example
375    /// ```no_run
376    /// # use google_cloud_logging_v2::builder;
377    /// use builder::logging_service_v_2::ListMonitoredResourceDescriptors;
378    /// # tokio_test::block_on(async {
379    /// use gax::paginator::ItemPaginator;
380    ///
381    /// let builder = prepare_request_builder();
382    /// let mut items = builder.by_item();
383    /// while let Some(result) = items.next().await {
384    ///   let item = result?;
385    /// }
386    /// # gax::Result::<()>::Ok(()) });
387    ///
388    /// fn prepare_request_builder() -> ListMonitoredResourceDescriptors {
389    ///   # panic!();
390    ///   // ... details omitted ...
391    /// }
392    /// ```
393    #[derive(Clone, Debug)]
394    pub struct ListMonitoredResourceDescriptors(
395        RequestBuilder<crate::model::ListMonitoredResourceDescriptorsRequest>,
396    );
397
398    impl ListMonitoredResourceDescriptors {
399        pub(crate) fn new(
400            stub: std::sync::Arc<dyn super::super::stub::dynamic::LoggingServiceV2>,
401        ) -> Self {
402            Self(RequestBuilder::new(stub))
403        }
404
405        /// Sets the full request, replacing any prior values.
406        pub fn with_request<V: Into<crate::model::ListMonitoredResourceDescriptorsRequest>>(
407            mut self,
408            v: V,
409        ) -> Self {
410            self.0.request = v.into();
411            self
412        }
413
414        /// Sets all the options, replacing any prior values.
415        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
416            self.0.options = v.into();
417            self
418        }
419
420        /// Sends the request.
421        pub async fn send(self) -> Result<crate::model::ListMonitoredResourceDescriptorsResponse> {
422            (*self.0.stub)
423                .list_monitored_resource_descriptors(self.0.request, self.0.options)
424                .await
425                .map(gax::response::Response::into_body)
426        }
427
428        /// Streams each page in the collection.
429        pub fn by_page(
430            self,
431        ) -> impl gax::paginator::Paginator<
432            crate::model::ListMonitoredResourceDescriptorsResponse,
433            gax::error::Error,
434        > {
435            use std::clone::Clone;
436            let token = self.0.request.page_token.clone();
437            let execute = move |token: String| {
438                let mut builder = self.clone();
439                builder.0.request = builder.0.request.set_page_token(token);
440                builder.send()
441            };
442            gax::paginator::internal::new_paginator(token, execute)
443        }
444
445        /// Streams each item in the collection.
446        pub fn by_item(
447            self,
448        ) -> impl gax::paginator::ItemPaginator<
449            crate::model::ListMonitoredResourceDescriptorsResponse,
450            gax::error::Error,
451        > {
452            use gax::paginator::Paginator;
453            self.by_page().items()
454        }
455
456        /// Sets the value of [page_size][crate::model::ListMonitoredResourceDescriptorsRequest::page_size].
457        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
458            self.0.request.page_size = v.into();
459            self
460        }
461
462        /// Sets the value of [page_token][crate::model::ListMonitoredResourceDescriptorsRequest::page_token].
463        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
464            self.0.request.page_token = v.into();
465            self
466        }
467    }
468
469    #[doc(hidden)]
470    impl gax::options::internal::RequestBuilder for ListMonitoredResourceDescriptors {
471        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
472            &mut self.0.options
473        }
474    }
475
476    /// The request builder for [LoggingServiceV2::list_logs][crate::client::LoggingServiceV2::list_logs] calls.
477    ///
478    /// # Example
479    /// ```no_run
480    /// # use google_cloud_logging_v2::builder;
481    /// use builder::logging_service_v_2::ListLogs;
482    /// # tokio_test::block_on(async {
483    ///
484    /// let builder = prepare_request_builder();
485    /// let response = builder.send().await?;
486    /// # gax::Result::<()>::Ok(()) });
487    ///
488    /// fn prepare_request_builder() -> ListLogs {
489    ///   # panic!();
490    ///   // ... details omitted ...
491    /// }
492    /// ```
493    #[derive(Clone, Debug)]
494    pub struct ListLogs(RequestBuilder<crate::model::ListLogsRequest>);
495
496    impl ListLogs {
497        pub(crate) fn new(
498            stub: std::sync::Arc<dyn super::super::stub::dynamic::LoggingServiceV2>,
499        ) -> Self {
500            Self(RequestBuilder::new(stub))
501        }
502
503        /// Sets the full request, replacing any prior values.
504        pub fn with_request<V: Into<crate::model::ListLogsRequest>>(mut self, v: V) -> Self {
505            self.0.request = v.into();
506            self
507        }
508
509        /// Sets all the options, replacing any prior values.
510        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
511            self.0.options = v.into();
512            self
513        }
514
515        /// Sends the request.
516        pub async fn send(self) -> Result<crate::model::ListLogsResponse> {
517            (*self.0.stub)
518                .list_logs(self.0.request, self.0.options)
519                .await
520                .map(gax::response::Response::into_body)
521        }
522
523        /// Sets the value of [parent][crate::model::ListLogsRequest::parent].
524        ///
525        /// This is a **required** field for requests.
526        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
527            self.0.request.parent = v.into();
528            self
529        }
530
531        /// Sets the value of [resource_names][crate::model::ListLogsRequest::resource_names].
532        pub fn set_resource_names<T, V>(mut self, v: T) -> Self
533        where
534            T: std::iter::IntoIterator<Item = V>,
535            V: std::convert::Into<std::string::String>,
536        {
537            use std::iter::Iterator;
538            self.0.request.resource_names = v.into_iter().map(|i| i.into()).collect();
539            self
540        }
541
542        /// Sets the value of [page_size][crate::model::ListLogsRequest::page_size].
543        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
544            self.0.request.page_size = v.into();
545            self
546        }
547
548        /// Sets the value of [page_token][crate::model::ListLogsRequest::page_token].
549        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
550            self.0.request.page_token = v.into();
551            self
552        }
553    }
554
555    #[doc(hidden)]
556    impl gax::options::internal::RequestBuilder for ListLogs {
557        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
558            &mut self.0.options
559        }
560    }
561
562    /// The request builder for [LoggingServiceV2::list_operations][crate::client::LoggingServiceV2::list_operations] calls.
563    ///
564    /// # Example
565    /// ```no_run
566    /// # use google_cloud_logging_v2::builder;
567    /// use builder::logging_service_v_2::ListOperations;
568    /// # tokio_test::block_on(async {
569    /// use gax::paginator::ItemPaginator;
570    ///
571    /// let builder = prepare_request_builder();
572    /// let mut items = builder.by_item();
573    /// while let Some(result) = items.next().await {
574    ///   let item = result?;
575    /// }
576    /// # gax::Result::<()>::Ok(()) });
577    ///
578    /// fn prepare_request_builder() -> ListOperations {
579    ///   # panic!();
580    ///   // ... details omitted ...
581    /// }
582    /// ```
583    #[derive(Clone, Debug)]
584    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
585
586    impl ListOperations {
587        pub(crate) fn new(
588            stub: std::sync::Arc<dyn super::super::stub::dynamic::LoggingServiceV2>,
589        ) -> Self {
590            Self(RequestBuilder::new(stub))
591        }
592
593        /// Sets the full request, replacing any prior values.
594        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
595            mut self,
596            v: V,
597        ) -> Self {
598            self.0.request = v.into();
599            self
600        }
601
602        /// Sets all the options, replacing any prior values.
603        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
604            self.0.options = v.into();
605            self
606        }
607
608        /// Sends the request.
609        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
610            (*self.0.stub)
611                .list_operations(self.0.request, self.0.options)
612                .await
613                .map(gax::response::Response::into_body)
614        }
615
616        /// Streams each page in the collection.
617        pub fn by_page(
618            self,
619        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
620        {
621            use std::clone::Clone;
622            let token = self.0.request.page_token.clone();
623            let execute = move |token: String| {
624                let mut builder = self.clone();
625                builder.0.request = builder.0.request.set_page_token(token);
626                builder.send()
627            };
628            gax::paginator::internal::new_paginator(token, execute)
629        }
630
631        /// Streams each item in the collection.
632        pub fn by_item(
633            self,
634        ) -> impl gax::paginator::ItemPaginator<
635            longrunning::model::ListOperationsResponse,
636            gax::error::Error,
637        > {
638            use gax::paginator::Paginator;
639            self.by_page().items()
640        }
641
642        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
643        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
644            self.0.request.name = v.into();
645            self
646        }
647
648        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
649        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
650            self.0.request.filter = v.into();
651            self
652        }
653
654        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
655        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
656            self.0.request.page_size = v.into();
657            self
658        }
659
660        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
661        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
662            self.0.request.page_token = v.into();
663            self
664        }
665    }
666
667    #[doc(hidden)]
668    impl gax::options::internal::RequestBuilder for ListOperations {
669        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
670            &mut self.0.options
671        }
672    }
673
674    /// The request builder for [LoggingServiceV2::get_operation][crate::client::LoggingServiceV2::get_operation] calls.
675    ///
676    /// # Example
677    /// ```no_run
678    /// # use google_cloud_logging_v2::builder;
679    /// use builder::logging_service_v_2::GetOperation;
680    /// # tokio_test::block_on(async {
681    ///
682    /// let builder = prepare_request_builder();
683    /// let response = builder.send().await?;
684    /// # gax::Result::<()>::Ok(()) });
685    ///
686    /// fn prepare_request_builder() -> GetOperation {
687    ///   # panic!();
688    ///   // ... details omitted ...
689    /// }
690    /// ```
691    #[derive(Clone, Debug)]
692    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
693
694    impl GetOperation {
695        pub(crate) fn new(
696            stub: std::sync::Arc<dyn super::super::stub::dynamic::LoggingServiceV2>,
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<longrunning::model::GetOperationRequest>>(
703            mut self,
704            v: V,
705        ) -> Self {
706            self.0.request = v.into();
707            self
708        }
709
710        /// Sets all the options, replacing any prior values.
711        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
712            self.0.options = v.into();
713            self
714        }
715
716        /// Sends the request.
717        pub async fn send(self) -> Result<longrunning::model::Operation> {
718            (*self.0.stub)
719                .get_operation(self.0.request, self.0.options)
720                .await
721                .map(gax::response::Response::into_body)
722        }
723
724        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
725        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
726            self.0.request.name = v.into();
727            self
728        }
729    }
730
731    #[doc(hidden)]
732    impl gax::options::internal::RequestBuilder for GetOperation {
733        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
734            &mut self.0.options
735        }
736    }
737
738    /// The request builder for [LoggingServiceV2::cancel_operation][crate::client::LoggingServiceV2::cancel_operation] calls.
739    ///
740    /// # Example
741    /// ```no_run
742    /// # use google_cloud_logging_v2::builder;
743    /// use builder::logging_service_v_2::CancelOperation;
744    /// # tokio_test::block_on(async {
745    ///
746    /// let builder = prepare_request_builder();
747    /// let response = builder.send().await?;
748    /// # gax::Result::<()>::Ok(()) });
749    ///
750    /// fn prepare_request_builder() -> CancelOperation {
751    ///   # panic!();
752    ///   // ... details omitted ...
753    /// }
754    /// ```
755    #[derive(Clone, Debug)]
756    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
757
758    impl CancelOperation {
759        pub(crate) fn new(
760            stub: std::sync::Arc<dyn super::super::stub::dynamic::LoggingServiceV2>,
761        ) -> Self {
762            Self(RequestBuilder::new(stub))
763        }
764
765        /// Sets the full request, replacing any prior values.
766        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
767            mut self,
768            v: V,
769        ) -> Self {
770            self.0.request = v.into();
771            self
772        }
773
774        /// Sets all the options, replacing any prior values.
775        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
776            self.0.options = v.into();
777            self
778        }
779
780        /// Sends the request.
781        pub async fn send(self) -> Result<()> {
782            (*self.0.stub)
783                .cancel_operation(self.0.request, self.0.options)
784                .await
785                .map(gax::response::Response::into_body)
786        }
787
788        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
789        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
790            self.0.request.name = v.into();
791            self
792        }
793    }
794
795    #[doc(hidden)]
796    impl gax::options::internal::RequestBuilder for CancelOperation {
797        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
798            &mut self.0.options
799        }
800    }
801}
802
803pub mod config_service_v_2 {
804    use crate::Result;
805
806    /// A builder for [ConfigServiceV2][crate::client::ConfigServiceV2].
807    ///
808    /// ```
809    /// # tokio_test::block_on(async {
810    /// # use google_cloud_logging_v2::*;
811    /// # use builder::config_service_v_2::ClientBuilder;
812    /// # use client::ConfigServiceV2;
813    /// let builder : ClientBuilder = ConfigServiceV2::builder();
814    /// let client = builder
815    ///     .with_endpoint("https://logging.googleapis.com")
816    ///     .build().await?;
817    /// # gax::client_builder::Result::<()>::Ok(()) });
818    /// ```
819    pub type ClientBuilder =
820        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
821
822    pub(crate) mod client {
823        use super::super::super::client::ConfigServiceV2;
824        pub struct Factory;
825        impl gax::client_builder::internal::ClientFactory for Factory {
826            type Client = ConfigServiceV2;
827            type Credentials = gaxi::options::Credentials;
828            async fn build(
829                self,
830                config: gaxi::options::ClientConfig,
831            ) -> gax::client_builder::Result<Self::Client> {
832                Self::Client::new(config).await
833            }
834        }
835    }
836
837    /// Common implementation for [crate::client::ConfigServiceV2] request builders.
838    #[derive(Clone, Debug)]
839    pub(crate) struct RequestBuilder<R: std::default::Default> {
840        stub: std::sync::Arc<dyn super::super::stub::dynamic::ConfigServiceV2>,
841        request: R,
842        options: gax::options::RequestOptions,
843    }
844
845    impl<R> RequestBuilder<R>
846    where
847        R: std::default::Default,
848    {
849        pub(crate) fn new(
850            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConfigServiceV2>,
851        ) -> Self {
852            Self {
853                stub,
854                request: R::default(),
855                options: gax::options::RequestOptions::default(),
856            }
857        }
858    }
859
860    /// The request builder for [ConfigServiceV2::list_buckets][crate::client::ConfigServiceV2::list_buckets] calls.
861    ///
862    /// # Example
863    /// ```no_run
864    /// # use google_cloud_logging_v2::builder;
865    /// use builder::config_service_v_2::ListBuckets;
866    /// # tokio_test::block_on(async {
867    /// use gax::paginator::ItemPaginator;
868    ///
869    /// let builder = prepare_request_builder();
870    /// let mut items = builder.by_item();
871    /// while let Some(result) = items.next().await {
872    ///   let item = result?;
873    /// }
874    /// # gax::Result::<()>::Ok(()) });
875    ///
876    /// fn prepare_request_builder() -> ListBuckets {
877    ///   # panic!();
878    ///   // ... details omitted ...
879    /// }
880    /// ```
881    #[derive(Clone, Debug)]
882    pub struct ListBuckets(RequestBuilder<crate::model::ListBucketsRequest>);
883
884    impl ListBuckets {
885        pub(crate) fn new(
886            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConfigServiceV2>,
887        ) -> Self {
888            Self(RequestBuilder::new(stub))
889        }
890
891        /// Sets the full request, replacing any prior values.
892        pub fn with_request<V: Into<crate::model::ListBucketsRequest>>(mut self, v: V) -> Self {
893            self.0.request = v.into();
894            self
895        }
896
897        /// Sets all the options, replacing any prior values.
898        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
899            self.0.options = v.into();
900            self
901        }
902
903        /// Sends the request.
904        pub async fn send(self) -> Result<crate::model::ListBucketsResponse> {
905            (*self.0.stub)
906                .list_buckets(self.0.request, self.0.options)
907                .await
908                .map(gax::response::Response::into_body)
909        }
910
911        /// Streams each page in the collection.
912        pub fn by_page(
913            self,
914        ) -> impl gax::paginator::Paginator<crate::model::ListBucketsResponse, gax::error::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            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 gax::paginator::ItemPaginator<crate::model::ListBucketsResponse, gax::error::Error>
930        {
931            use gax::paginator::Paginator;
932            self.by_page().items()
933        }
934
935        /// Sets the value of [parent][crate::model::ListBucketsRequest::parent].
936        ///
937        /// This is a **required** field for requests.
938        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
939            self.0.request.parent = v.into();
940            self
941        }
942
943        /// Sets the value of [page_token][crate::model::ListBucketsRequest::page_token].
944        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
945            self.0.request.page_token = v.into();
946            self
947        }
948
949        /// Sets the value of [page_size][crate::model::ListBucketsRequest::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
956    #[doc(hidden)]
957    impl gax::options::internal::RequestBuilder for ListBuckets {
958        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
959            &mut self.0.options
960        }
961    }
962
963    /// The request builder for [ConfigServiceV2::get_bucket][crate::client::ConfigServiceV2::get_bucket] calls.
964    ///
965    /// # Example
966    /// ```no_run
967    /// # use google_cloud_logging_v2::builder;
968    /// use builder::config_service_v_2::GetBucket;
969    /// # tokio_test::block_on(async {
970    ///
971    /// let builder = prepare_request_builder();
972    /// let response = builder.send().await?;
973    /// # gax::Result::<()>::Ok(()) });
974    ///
975    /// fn prepare_request_builder() -> GetBucket {
976    ///   # panic!();
977    ///   // ... details omitted ...
978    /// }
979    /// ```
980    #[derive(Clone, Debug)]
981    pub struct GetBucket(RequestBuilder<crate::model::GetBucketRequest>);
982
983    impl GetBucket {
984        pub(crate) fn new(
985            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConfigServiceV2>,
986        ) -> Self {
987            Self(RequestBuilder::new(stub))
988        }
989
990        /// Sets the full request, replacing any prior values.
991        pub fn with_request<V: Into<crate::model::GetBucketRequest>>(mut self, v: V) -> Self {
992            self.0.request = v.into();
993            self
994        }
995
996        /// Sets all the options, replacing any prior values.
997        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
998            self.0.options = v.into();
999            self
1000        }
1001
1002        /// Sends the request.
1003        pub async fn send(self) -> Result<crate::model::LogBucket> {
1004            (*self.0.stub)
1005                .get_bucket(self.0.request, self.0.options)
1006                .await
1007                .map(gax::response::Response::into_body)
1008        }
1009
1010        /// Sets the value of [name][crate::model::GetBucketRequest::name].
1011        ///
1012        /// This is a **required** field for requests.
1013        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1014            self.0.request.name = v.into();
1015            self
1016        }
1017    }
1018
1019    #[doc(hidden)]
1020    impl gax::options::internal::RequestBuilder for GetBucket {
1021        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1022            &mut self.0.options
1023        }
1024    }
1025
1026    /// The request builder for [ConfigServiceV2::create_bucket_async][crate::client::ConfigServiceV2::create_bucket_async] calls.
1027    ///
1028    /// # Example
1029    /// ```no_run
1030    /// # use google_cloud_logging_v2::builder;
1031    /// use builder::config_service_v_2::CreateBucketAsync;
1032    /// # tokio_test::block_on(async {
1033    /// use lro::Poller;
1034    ///
1035    /// let builder = prepare_request_builder();
1036    /// let response = builder.poller().until_done().await?;
1037    /// # gax::Result::<()>::Ok(()) });
1038    ///
1039    /// fn prepare_request_builder() -> CreateBucketAsync {
1040    ///   # panic!();
1041    ///   // ... details omitted ...
1042    /// }
1043    /// ```
1044    #[derive(Clone, Debug)]
1045    pub struct CreateBucketAsync(RequestBuilder<crate::model::CreateBucketRequest>);
1046
1047    impl CreateBucketAsync {
1048        pub(crate) fn new(
1049            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConfigServiceV2>,
1050        ) -> Self {
1051            Self(RequestBuilder::new(stub))
1052        }
1053
1054        /// Sets the full request, replacing any prior values.
1055        pub fn with_request<V: Into<crate::model::CreateBucketRequest>>(mut self, v: V) -> Self {
1056            self.0.request = v.into();
1057            self
1058        }
1059
1060        /// Sets all the options, replacing any prior values.
1061        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1062            self.0.options = v.into();
1063            self
1064        }
1065
1066        /// Sends the request.
1067        ///
1068        /// # Long running operations
1069        ///
1070        /// This starts, but does not poll, a longrunning operation. More information
1071        /// on [create_bucket_async][crate::client::ConfigServiceV2::create_bucket_async].
1072        pub async fn send(self) -> Result<longrunning::model::Operation> {
1073            (*self.0.stub)
1074                .create_bucket_async(self.0.request, self.0.options)
1075                .await
1076                .map(gax::response::Response::into_body)
1077        }
1078
1079        /// Creates a [Poller][lro::Poller] to work with `create_bucket_async`.
1080        pub fn poller(
1081            self,
1082        ) -> impl lro::Poller<crate::model::LogBucket, crate::model::BucketMetadata> {
1083            type Operation =
1084                lro::internal::Operation<crate::model::LogBucket, crate::model::BucketMetadata>;
1085            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1086            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1087
1088            let stub = self.0.stub.clone();
1089            let mut options = self.0.options.clone();
1090            options.set_retry_policy(gax::retry_policy::NeverRetry);
1091            let query = move |name| {
1092                let stub = stub.clone();
1093                let options = options.clone();
1094                async {
1095                    let op = GetOperation::new(stub)
1096                        .set_name(name)
1097                        .with_options(options)
1098                        .send()
1099                        .await?;
1100                    Ok(Operation::new(op))
1101                }
1102            };
1103
1104            let start = move || async {
1105                let op = self.send().await?;
1106                Ok(Operation::new(op))
1107            };
1108
1109            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1110        }
1111
1112        /// Sets the value of [parent][crate::model::CreateBucketRequest::parent].
1113        ///
1114        /// This is a **required** field for requests.
1115        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1116            self.0.request.parent = v.into();
1117            self
1118        }
1119
1120        /// Sets the value of [bucket_id][crate::model::CreateBucketRequest::bucket_id].
1121        ///
1122        /// This is a **required** field for requests.
1123        pub fn set_bucket_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1124            self.0.request.bucket_id = v.into();
1125            self
1126        }
1127
1128        /// Sets the value of [bucket][crate::model::CreateBucketRequest::bucket].
1129        ///
1130        /// This is a **required** field for requests.
1131        pub fn set_bucket<T>(mut self, v: T) -> Self
1132        where
1133            T: std::convert::Into<crate::model::LogBucket>,
1134        {
1135            self.0.request.bucket = std::option::Option::Some(v.into());
1136            self
1137        }
1138
1139        /// Sets or clears the value of [bucket][crate::model::CreateBucketRequest::bucket].
1140        ///
1141        /// This is a **required** field for requests.
1142        pub fn set_or_clear_bucket<T>(mut self, v: std::option::Option<T>) -> Self
1143        where
1144            T: std::convert::Into<crate::model::LogBucket>,
1145        {
1146            self.0.request.bucket = v.map(|x| x.into());
1147            self
1148        }
1149    }
1150
1151    #[doc(hidden)]
1152    impl gax::options::internal::RequestBuilder for CreateBucketAsync {
1153        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1154            &mut self.0.options
1155        }
1156    }
1157
1158    /// The request builder for [ConfigServiceV2::update_bucket_async][crate::client::ConfigServiceV2::update_bucket_async] calls.
1159    ///
1160    /// # Example
1161    /// ```no_run
1162    /// # use google_cloud_logging_v2::builder;
1163    /// use builder::config_service_v_2::UpdateBucketAsync;
1164    /// # tokio_test::block_on(async {
1165    /// use lro::Poller;
1166    ///
1167    /// let builder = prepare_request_builder();
1168    /// let response = builder.poller().until_done().await?;
1169    /// # gax::Result::<()>::Ok(()) });
1170    ///
1171    /// fn prepare_request_builder() -> UpdateBucketAsync {
1172    ///   # panic!();
1173    ///   // ... details omitted ...
1174    /// }
1175    /// ```
1176    #[derive(Clone, Debug)]
1177    pub struct UpdateBucketAsync(RequestBuilder<crate::model::UpdateBucketRequest>);
1178
1179    impl UpdateBucketAsync {
1180        pub(crate) fn new(
1181            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConfigServiceV2>,
1182        ) -> Self {
1183            Self(RequestBuilder::new(stub))
1184        }
1185
1186        /// Sets the full request, replacing any prior values.
1187        pub fn with_request<V: Into<crate::model::UpdateBucketRequest>>(mut self, v: V) -> Self {
1188            self.0.request = v.into();
1189            self
1190        }
1191
1192        /// Sets all the options, replacing any prior values.
1193        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1194            self.0.options = v.into();
1195            self
1196        }
1197
1198        /// Sends the request.
1199        ///
1200        /// # Long running operations
1201        ///
1202        /// This starts, but does not poll, a longrunning operation. More information
1203        /// on [update_bucket_async][crate::client::ConfigServiceV2::update_bucket_async].
1204        pub async fn send(self) -> Result<longrunning::model::Operation> {
1205            (*self.0.stub)
1206                .update_bucket_async(self.0.request, self.0.options)
1207                .await
1208                .map(gax::response::Response::into_body)
1209        }
1210
1211        /// Creates a [Poller][lro::Poller] to work with `update_bucket_async`.
1212        pub fn poller(
1213            self,
1214        ) -> impl lro::Poller<crate::model::LogBucket, crate::model::BucketMetadata> {
1215            type Operation =
1216                lro::internal::Operation<crate::model::LogBucket, crate::model::BucketMetadata>;
1217            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1218            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1219
1220            let stub = self.0.stub.clone();
1221            let mut options = self.0.options.clone();
1222            options.set_retry_policy(gax::retry_policy::NeverRetry);
1223            let query = move |name| {
1224                let stub = stub.clone();
1225                let options = options.clone();
1226                async {
1227                    let op = GetOperation::new(stub)
1228                        .set_name(name)
1229                        .with_options(options)
1230                        .send()
1231                        .await?;
1232                    Ok(Operation::new(op))
1233                }
1234            };
1235
1236            let start = move || async {
1237                let op = self.send().await?;
1238                Ok(Operation::new(op))
1239            };
1240
1241            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1242        }
1243
1244        /// Sets the value of [name][crate::model::UpdateBucketRequest::name].
1245        ///
1246        /// This is a **required** field for requests.
1247        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1248            self.0.request.name = v.into();
1249            self
1250        }
1251
1252        /// Sets the value of [bucket][crate::model::UpdateBucketRequest::bucket].
1253        ///
1254        /// This is a **required** field for requests.
1255        pub fn set_bucket<T>(mut self, v: T) -> Self
1256        where
1257            T: std::convert::Into<crate::model::LogBucket>,
1258        {
1259            self.0.request.bucket = std::option::Option::Some(v.into());
1260            self
1261        }
1262
1263        /// Sets or clears the value of [bucket][crate::model::UpdateBucketRequest::bucket].
1264        ///
1265        /// This is a **required** field for requests.
1266        pub fn set_or_clear_bucket<T>(mut self, v: std::option::Option<T>) -> Self
1267        where
1268            T: std::convert::Into<crate::model::LogBucket>,
1269        {
1270            self.0.request.bucket = v.map(|x| x.into());
1271            self
1272        }
1273
1274        /// Sets the value of [update_mask][crate::model::UpdateBucketRequest::update_mask].
1275        ///
1276        /// This is a **required** field for requests.
1277        pub fn set_update_mask<T>(mut self, v: T) -> Self
1278        where
1279            T: std::convert::Into<wkt::FieldMask>,
1280        {
1281            self.0.request.update_mask = std::option::Option::Some(v.into());
1282            self
1283        }
1284
1285        /// Sets or clears the value of [update_mask][crate::model::UpdateBucketRequest::update_mask].
1286        ///
1287        /// This is a **required** field for requests.
1288        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1289        where
1290            T: std::convert::Into<wkt::FieldMask>,
1291        {
1292            self.0.request.update_mask = v.map(|x| x.into());
1293            self
1294        }
1295    }
1296
1297    #[doc(hidden)]
1298    impl gax::options::internal::RequestBuilder for UpdateBucketAsync {
1299        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1300            &mut self.0.options
1301        }
1302    }
1303
1304    /// The request builder for [ConfigServiceV2::create_bucket][crate::client::ConfigServiceV2::create_bucket] calls.
1305    ///
1306    /// # Example
1307    /// ```no_run
1308    /// # use google_cloud_logging_v2::builder;
1309    /// use builder::config_service_v_2::CreateBucket;
1310    /// # tokio_test::block_on(async {
1311    ///
1312    /// let builder = prepare_request_builder();
1313    /// let response = builder.send().await?;
1314    /// # gax::Result::<()>::Ok(()) });
1315    ///
1316    /// fn prepare_request_builder() -> CreateBucket {
1317    ///   # panic!();
1318    ///   // ... details omitted ...
1319    /// }
1320    /// ```
1321    #[derive(Clone, Debug)]
1322    pub struct CreateBucket(RequestBuilder<crate::model::CreateBucketRequest>);
1323
1324    impl CreateBucket {
1325        pub(crate) fn new(
1326            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConfigServiceV2>,
1327        ) -> Self {
1328            Self(RequestBuilder::new(stub))
1329        }
1330
1331        /// Sets the full request, replacing any prior values.
1332        pub fn with_request<V: Into<crate::model::CreateBucketRequest>>(mut self, v: V) -> Self {
1333            self.0.request = v.into();
1334            self
1335        }
1336
1337        /// Sets all the options, replacing any prior values.
1338        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1339            self.0.options = v.into();
1340            self
1341        }
1342
1343        /// Sends the request.
1344        pub async fn send(self) -> Result<crate::model::LogBucket> {
1345            (*self.0.stub)
1346                .create_bucket(self.0.request, self.0.options)
1347                .await
1348                .map(gax::response::Response::into_body)
1349        }
1350
1351        /// Sets the value of [parent][crate::model::CreateBucketRequest::parent].
1352        ///
1353        /// This is a **required** field for requests.
1354        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1355            self.0.request.parent = v.into();
1356            self
1357        }
1358
1359        /// Sets the value of [bucket_id][crate::model::CreateBucketRequest::bucket_id].
1360        ///
1361        /// This is a **required** field for requests.
1362        pub fn set_bucket_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1363            self.0.request.bucket_id = v.into();
1364            self
1365        }
1366
1367        /// Sets the value of [bucket][crate::model::CreateBucketRequest::bucket].
1368        ///
1369        /// This is a **required** field for requests.
1370        pub fn set_bucket<T>(mut self, v: T) -> Self
1371        where
1372            T: std::convert::Into<crate::model::LogBucket>,
1373        {
1374            self.0.request.bucket = std::option::Option::Some(v.into());
1375            self
1376        }
1377
1378        /// Sets or clears the value of [bucket][crate::model::CreateBucketRequest::bucket].
1379        ///
1380        /// This is a **required** field for requests.
1381        pub fn set_or_clear_bucket<T>(mut self, v: std::option::Option<T>) -> Self
1382        where
1383            T: std::convert::Into<crate::model::LogBucket>,
1384        {
1385            self.0.request.bucket = v.map(|x| x.into());
1386            self
1387        }
1388    }
1389
1390    #[doc(hidden)]
1391    impl gax::options::internal::RequestBuilder for CreateBucket {
1392        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1393            &mut self.0.options
1394        }
1395    }
1396
1397    /// The request builder for [ConfigServiceV2::update_bucket][crate::client::ConfigServiceV2::update_bucket] calls.
1398    ///
1399    /// # Example
1400    /// ```no_run
1401    /// # use google_cloud_logging_v2::builder;
1402    /// use builder::config_service_v_2::UpdateBucket;
1403    /// # tokio_test::block_on(async {
1404    ///
1405    /// let builder = prepare_request_builder();
1406    /// let response = builder.send().await?;
1407    /// # gax::Result::<()>::Ok(()) });
1408    ///
1409    /// fn prepare_request_builder() -> UpdateBucket {
1410    ///   # panic!();
1411    ///   // ... details omitted ...
1412    /// }
1413    /// ```
1414    #[derive(Clone, Debug)]
1415    pub struct UpdateBucket(RequestBuilder<crate::model::UpdateBucketRequest>);
1416
1417    impl UpdateBucket {
1418        pub(crate) fn new(
1419            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConfigServiceV2>,
1420        ) -> Self {
1421            Self(RequestBuilder::new(stub))
1422        }
1423
1424        /// Sets the full request, replacing any prior values.
1425        pub fn with_request<V: Into<crate::model::UpdateBucketRequest>>(mut self, v: V) -> Self {
1426            self.0.request = v.into();
1427            self
1428        }
1429
1430        /// Sets all the options, replacing any prior values.
1431        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1432            self.0.options = v.into();
1433            self
1434        }
1435
1436        /// Sends the request.
1437        pub async fn send(self) -> Result<crate::model::LogBucket> {
1438            (*self.0.stub)
1439                .update_bucket(self.0.request, self.0.options)
1440                .await
1441                .map(gax::response::Response::into_body)
1442        }
1443
1444        /// Sets the value of [name][crate::model::UpdateBucketRequest::name].
1445        ///
1446        /// This is a **required** field for requests.
1447        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1448            self.0.request.name = v.into();
1449            self
1450        }
1451
1452        /// Sets the value of [bucket][crate::model::UpdateBucketRequest::bucket].
1453        ///
1454        /// This is a **required** field for requests.
1455        pub fn set_bucket<T>(mut self, v: T) -> Self
1456        where
1457            T: std::convert::Into<crate::model::LogBucket>,
1458        {
1459            self.0.request.bucket = std::option::Option::Some(v.into());
1460            self
1461        }
1462
1463        /// Sets or clears the value of [bucket][crate::model::UpdateBucketRequest::bucket].
1464        ///
1465        /// This is a **required** field for requests.
1466        pub fn set_or_clear_bucket<T>(mut self, v: std::option::Option<T>) -> Self
1467        where
1468            T: std::convert::Into<crate::model::LogBucket>,
1469        {
1470            self.0.request.bucket = v.map(|x| x.into());
1471            self
1472        }
1473
1474        /// Sets the value of [update_mask][crate::model::UpdateBucketRequest::update_mask].
1475        ///
1476        /// This is a **required** field for requests.
1477        pub fn set_update_mask<T>(mut self, v: T) -> Self
1478        where
1479            T: std::convert::Into<wkt::FieldMask>,
1480        {
1481            self.0.request.update_mask = std::option::Option::Some(v.into());
1482            self
1483        }
1484
1485        /// Sets or clears the value of [update_mask][crate::model::UpdateBucketRequest::update_mask].
1486        ///
1487        /// This is a **required** field for requests.
1488        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1489        where
1490            T: std::convert::Into<wkt::FieldMask>,
1491        {
1492            self.0.request.update_mask = v.map(|x| x.into());
1493            self
1494        }
1495    }
1496
1497    #[doc(hidden)]
1498    impl gax::options::internal::RequestBuilder for UpdateBucket {
1499        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1500            &mut self.0.options
1501        }
1502    }
1503
1504    /// The request builder for [ConfigServiceV2::delete_bucket][crate::client::ConfigServiceV2::delete_bucket] calls.
1505    ///
1506    /// # Example
1507    /// ```no_run
1508    /// # use google_cloud_logging_v2::builder;
1509    /// use builder::config_service_v_2::DeleteBucket;
1510    /// # tokio_test::block_on(async {
1511    ///
1512    /// let builder = prepare_request_builder();
1513    /// let response = builder.send().await?;
1514    /// # gax::Result::<()>::Ok(()) });
1515    ///
1516    /// fn prepare_request_builder() -> DeleteBucket {
1517    ///   # panic!();
1518    ///   // ... details omitted ...
1519    /// }
1520    /// ```
1521    #[derive(Clone, Debug)]
1522    pub struct DeleteBucket(RequestBuilder<crate::model::DeleteBucketRequest>);
1523
1524    impl DeleteBucket {
1525        pub(crate) fn new(
1526            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConfigServiceV2>,
1527        ) -> Self {
1528            Self(RequestBuilder::new(stub))
1529        }
1530
1531        /// Sets the full request, replacing any prior values.
1532        pub fn with_request<V: Into<crate::model::DeleteBucketRequest>>(mut self, v: V) -> Self {
1533            self.0.request = v.into();
1534            self
1535        }
1536
1537        /// Sets all the options, replacing any prior values.
1538        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1539            self.0.options = v.into();
1540            self
1541        }
1542
1543        /// Sends the request.
1544        pub async fn send(self) -> Result<()> {
1545            (*self.0.stub)
1546                .delete_bucket(self.0.request, self.0.options)
1547                .await
1548                .map(gax::response::Response::into_body)
1549        }
1550
1551        /// Sets the value of [name][crate::model::DeleteBucketRequest::name].
1552        ///
1553        /// This is a **required** field for requests.
1554        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1555            self.0.request.name = v.into();
1556            self
1557        }
1558    }
1559
1560    #[doc(hidden)]
1561    impl gax::options::internal::RequestBuilder for DeleteBucket {
1562        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1563            &mut self.0.options
1564        }
1565    }
1566
1567    /// The request builder for [ConfigServiceV2::undelete_bucket][crate::client::ConfigServiceV2::undelete_bucket] calls.
1568    ///
1569    /// # Example
1570    /// ```no_run
1571    /// # use google_cloud_logging_v2::builder;
1572    /// use builder::config_service_v_2::UndeleteBucket;
1573    /// # tokio_test::block_on(async {
1574    ///
1575    /// let builder = prepare_request_builder();
1576    /// let response = builder.send().await?;
1577    /// # gax::Result::<()>::Ok(()) });
1578    ///
1579    /// fn prepare_request_builder() -> UndeleteBucket {
1580    ///   # panic!();
1581    ///   // ... details omitted ...
1582    /// }
1583    /// ```
1584    #[derive(Clone, Debug)]
1585    pub struct UndeleteBucket(RequestBuilder<crate::model::UndeleteBucketRequest>);
1586
1587    impl UndeleteBucket {
1588        pub(crate) fn new(
1589            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConfigServiceV2>,
1590        ) -> Self {
1591            Self(RequestBuilder::new(stub))
1592        }
1593
1594        /// Sets the full request, replacing any prior values.
1595        pub fn with_request<V: Into<crate::model::UndeleteBucketRequest>>(mut self, v: V) -> Self {
1596            self.0.request = v.into();
1597            self
1598        }
1599
1600        /// Sets all the options, replacing any prior values.
1601        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1602            self.0.options = v.into();
1603            self
1604        }
1605
1606        /// Sends the request.
1607        pub async fn send(self) -> Result<()> {
1608            (*self.0.stub)
1609                .undelete_bucket(self.0.request, self.0.options)
1610                .await
1611                .map(gax::response::Response::into_body)
1612        }
1613
1614        /// Sets the value of [name][crate::model::UndeleteBucketRequest::name].
1615        ///
1616        /// This is a **required** field for requests.
1617        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1618            self.0.request.name = v.into();
1619            self
1620        }
1621    }
1622
1623    #[doc(hidden)]
1624    impl gax::options::internal::RequestBuilder for UndeleteBucket {
1625        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1626            &mut self.0.options
1627        }
1628    }
1629
1630    /// The request builder for [ConfigServiceV2::list_views][crate::client::ConfigServiceV2::list_views] calls.
1631    ///
1632    /// # Example
1633    /// ```no_run
1634    /// # use google_cloud_logging_v2::builder;
1635    /// use builder::config_service_v_2::ListViews;
1636    /// # tokio_test::block_on(async {
1637    /// use gax::paginator::ItemPaginator;
1638    ///
1639    /// let builder = prepare_request_builder();
1640    /// let mut items = builder.by_item();
1641    /// while let Some(result) = items.next().await {
1642    ///   let item = result?;
1643    /// }
1644    /// # gax::Result::<()>::Ok(()) });
1645    ///
1646    /// fn prepare_request_builder() -> ListViews {
1647    ///   # panic!();
1648    ///   // ... details omitted ...
1649    /// }
1650    /// ```
1651    #[derive(Clone, Debug)]
1652    pub struct ListViews(RequestBuilder<crate::model::ListViewsRequest>);
1653
1654    impl ListViews {
1655        pub(crate) fn new(
1656            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConfigServiceV2>,
1657        ) -> Self {
1658            Self(RequestBuilder::new(stub))
1659        }
1660
1661        /// Sets the full request, replacing any prior values.
1662        pub fn with_request<V: Into<crate::model::ListViewsRequest>>(mut self, v: V) -> Self {
1663            self.0.request = v.into();
1664            self
1665        }
1666
1667        /// Sets all the options, replacing any prior values.
1668        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1669            self.0.options = v.into();
1670            self
1671        }
1672
1673        /// Sends the request.
1674        pub async fn send(self) -> Result<crate::model::ListViewsResponse> {
1675            (*self.0.stub)
1676                .list_views(self.0.request, self.0.options)
1677                .await
1678                .map(gax::response::Response::into_body)
1679        }
1680
1681        /// Streams each page in the collection.
1682        pub fn by_page(
1683            self,
1684        ) -> impl gax::paginator::Paginator<crate::model::ListViewsResponse, gax::error::Error>
1685        {
1686            use std::clone::Clone;
1687            let token = self.0.request.page_token.clone();
1688            let execute = move |token: String| {
1689                let mut builder = self.clone();
1690                builder.0.request = builder.0.request.set_page_token(token);
1691                builder.send()
1692            };
1693            gax::paginator::internal::new_paginator(token, execute)
1694        }
1695
1696        /// Streams each item in the collection.
1697        pub fn by_item(
1698            self,
1699        ) -> impl gax::paginator::ItemPaginator<crate::model::ListViewsResponse, gax::error::Error>
1700        {
1701            use gax::paginator::Paginator;
1702            self.by_page().items()
1703        }
1704
1705        /// Sets the value of [parent][crate::model::ListViewsRequest::parent].
1706        ///
1707        /// This is a **required** field for requests.
1708        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1709            self.0.request.parent = v.into();
1710            self
1711        }
1712
1713        /// Sets the value of [page_token][crate::model::ListViewsRequest::page_token].
1714        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1715            self.0.request.page_token = v.into();
1716            self
1717        }
1718
1719        /// Sets the value of [page_size][crate::model::ListViewsRequest::page_size].
1720        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1721            self.0.request.page_size = v.into();
1722            self
1723        }
1724    }
1725
1726    #[doc(hidden)]
1727    impl gax::options::internal::RequestBuilder for ListViews {
1728        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1729            &mut self.0.options
1730        }
1731    }
1732
1733    /// The request builder for [ConfigServiceV2::get_view][crate::client::ConfigServiceV2::get_view] calls.
1734    ///
1735    /// # Example
1736    /// ```no_run
1737    /// # use google_cloud_logging_v2::builder;
1738    /// use builder::config_service_v_2::GetView;
1739    /// # tokio_test::block_on(async {
1740    ///
1741    /// let builder = prepare_request_builder();
1742    /// let response = builder.send().await?;
1743    /// # gax::Result::<()>::Ok(()) });
1744    ///
1745    /// fn prepare_request_builder() -> GetView {
1746    ///   # panic!();
1747    ///   // ... details omitted ...
1748    /// }
1749    /// ```
1750    #[derive(Clone, Debug)]
1751    pub struct GetView(RequestBuilder<crate::model::GetViewRequest>);
1752
1753    impl GetView {
1754        pub(crate) fn new(
1755            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConfigServiceV2>,
1756        ) -> Self {
1757            Self(RequestBuilder::new(stub))
1758        }
1759
1760        /// Sets the full request, replacing any prior values.
1761        pub fn with_request<V: Into<crate::model::GetViewRequest>>(mut self, v: V) -> Self {
1762            self.0.request = v.into();
1763            self
1764        }
1765
1766        /// Sets all the options, replacing any prior values.
1767        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1768            self.0.options = v.into();
1769            self
1770        }
1771
1772        /// Sends the request.
1773        pub async fn send(self) -> Result<crate::model::LogView> {
1774            (*self.0.stub)
1775                .get_view(self.0.request, self.0.options)
1776                .await
1777                .map(gax::response::Response::into_body)
1778        }
1779
1780        /// Sets the value of [name][crate::model::GetViewRequest::name].
1781        ///
1782        /// This is a **required** field for requests.
1783        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1784            self.0.request.name = v.into();
1785            self
1786        }
1787    }
1788
1789    #[doc(hidden)]
1790    impl gax::options::internal::RequestBuilder for GetView {
1791        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1792            &mut self.0.options
1793        }
1794    }
1795
1796    /// The request builder for [ConfigServiceV2::create_view][crate::client::ConfigServiceV2::create_view] calls.
1797    ///
1798    /// # Example
1799    /// ```no_run
1800    /// # use google_cloud_logging_v2::builder;
1801    /// use builder::config_service_v_2::CreateView;
1802    /// # tokio_test::block_on(async {
1803    ///
1804    /// let builder = prepare_request_builder();
1805    /// let response = builder.send().await?;
1806    /// # gax::Result::<()>::Ok(()) });
1807    ///
1808    /// fn prepare_request_builder() -> CreateView {
1809    ///   # panic!();
1810    ///   // ... details omitted ...
1811    /// }
1812    /// ```
1813    #[derive(Clone, Debug)]
1814    pub struct CreateView(RequestBuilder<crate::model::CreateViewRequest>);
1815
1816    impl CreateView {
1817        pub(crate) fn new(
1818            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConfigServiceV2>,
1819        ) -> Self {
1820            Self(RequestBuilder::new(stub))
1821        }
1822
1823        /// Sets the full request, replacing any prior values.
1824        pub fn with_request<V: Into<crate::model::CreateViewRequest>>(mut self, v: V) -> Self {
1825            self.0.request = v.into();
1826            self
1827        }
1828
1829        /// Sets all the options, replacing any prior values.
1830        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1831            self.0.options = v.into();
1832            self
1833        }
1834
1835        /// Sends the request.
1836        pub async fn send(self) -> Result<crate::model::LogView> {
1837            (*self.0.stub)
1838                .create_view(self.0.request, self.0.options)
1839                .await
1840                .map(gax::response::Response::into_body)
1841        }
1842
1843        /// Sets the value of [parent][crate::model::CreateViewRequest::parent].
1844        ///
1845        /// This is a **required** field for requests.
1846        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1847            self.0.request.parent = v.into();
1848            self
1849        }
1850
1851        /// Sets the value of [view_id][crate::model::CreateViewRequest::view_id].
1852        ///
1853        /// This is a **required** field for requests.
1854        pub fn set_view_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1855            self.0.request.view_id = v.into();
1856            self
1857        }
1858
1859        /// Sets the value of [view][crate::model::CreateViewRequest::view].
1860        ///
1861        /// This is a **required** field for requests.
1862        pub fn set_view<T>(mut self, v: T) -> Self
1863        where
1864            T: std::convert::Into<crate::model::LogView>,
1865        {
1866            self.0.request.view = std::option::Option::Some(v.into());
1867            self
1868        }
1869
1870        /// Sets or clears the value of [view][crate::model::CreateViewRequest::view].
1871        ///
1872        /// This is a **required** field for requests.
1873        pub fn set_or_clear_view<T>(mut self, v: std::option::Option<T>) -> Self
1874        where
1875            T: std::convert::Into<crate::model::LogView>,
1876        {
1877            self.0.request.view = v.map(|x| x.into());
1878            self
1879        }
1880    }
1881
1882    #[doc(hidden)]
1883    impl gax::options::internal::RequestBuilder for CreateView {
1884        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1885            &mut self.0.options
1886        }
1887    }
1888
1889    /// The request builder for [ConfigServiceV2::update_view][crate::client::ConfigServiceV2::update_view] calls.
1890    ///
1891    /// # Example
1892    /// ```no_run
1893    /// # use google_cloud_logging_v2::builder;
1894    /// use builder::config_service_v_2::UpdateView;
1895    /// # tokio_test::block_on(async {
1896    ///
1897    /// let builder = prepare_request_builder();
1898    /// let response = builder.send().await?;
1899    /// # gax::Result::<()>::Ok(()) });
1900    ///
1901    /// fn prepare_request_builder() -> UpdateView {
1902    ///   # panic!();
1903    ///   // ... details omitted ...
1904    /// }
1905    /// ```
1906    #[derive(Clone, Debug)]
1907    pub struct UpdateView(RequestBuilder<crate::model::UpdateViewRequest>);
1908
1909    impl UpdateView {
1910        pub(crate) fn new(
1911            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConfigServiceV2>,
1912        ) -> Self {
1913            Self(RequestBuilder::new(stub))
1914        }
1915
1916        /// Sets the full request, replacing any prior values.
1917        pub fn with_request<V: Into<crate::model::UpdateViewRequest>>(mut self, v: V) -> Self {
1918            self.0.request = v.into();
1919            self
1920        }
1921
1922        /// Sets all the options, replacing any prior values.
1923        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1924            self.0.options = v.into();
1925            self
1926        }
1927
1928        /// Sends the request.
1929        pub async fn send(self) -> Result<crate::model::LogView> {
1930            (*self.0.stub)
1931                .update_view(self.0.request, self.0.options)
1932                .await
1933                .map(gax::response::Response::into_body)
1934        }
1935
1936        /// Sets the value of [name][crate::model::UpdateViewRequest::name].
1937        ///
1938        /// This is a **required** field for requests.
1939        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1940            self.0.request.name = v.into();
1941            self
1942        }
1943
1944        /// Sets the value of [view][crate::model::UpdateViewRequest::view].
1945        ///
1946        /// This is a **required** field for requests.
1947        pub fn set_view<T>(mut self, v: T) -> Self
1948        where
1949            T: std::convert::Into<crate::model::LogView>,
1950        {
1951            self.0.request.view = std::option::Option::Some(v.into());
1952            self
1953        }
1954
1955        /// Sets or clears the value of [view][crate::model::UpdateViewRequest::view].
1956        ///
1957        /// This is a **required** field for requests.
1958        pub fn set_or_clear_view<T>(mut self, v: std::option::Option<T>) -> Self
1959        where
1960            T: std::convert::Into<crate::model::LogView>,
1961        {
1962            self.0.request.view = v.map(|x| x.into());
1963            self
1964        }
1965
1966        /// Sets the value of [update_mask][crate::model::UpdateViewRequest::update_mask].
1967        pub fn set_update_mask<T>(mut self, v: T) -> Self
1968        where
1969            T: std::convert::Into<wkt::FieldMask>,
1970        {
1971            self.0.request.update_mask = std::option::Option::Some(v.into());
1972            self
1973        }
1974
1975        /// Sets or clears the value of [update_mask][crate::model::UpdateViewRequest::update_mask].
1976        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1977        where
1978            T: std::convert::Into<wkt::FieldMask>,
1979        {
1980            self.0.request.update_mask = v.map(|x| x.into());
1981            self
1982        }
1983    }
1984
1985    #[doc(hidden)]
1986    impl gax::options::internal::RequestBuilder for UpdateView {
1987        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1988            &mut self.0.options
1989        }
1990    }
1991
1992    /// The request builder for [ConfigServiceV2::delete_view][crate::client::ConfigServiceV2::delete_view] calls.
1993    ///
1994    /// # Example
1995    /// ```no_run
1996    /// # use google_cloud_logging_v2::builder;
1997    /// use builder::config_service_v_2::DeleteView;
1998    /// # tokio_test::block_on(async {
1999    ///
2000    /// let builder = prepare_request_builder();
2001    /// let response = builder.send().await?;
2002    /// # gax::Result::<()>::Ok(()) });
2003    ///
2004    /// fn prepare_request_builder() -> DeleteView {
2005    ///   # panic!();
2006    ///   // ... details omitted ...
2007    /// }
2008    /// ```
2009    #[derive(Clone, Debug)]
2010    pub struct DeleteView(RequestBuilder<crate::model::DeleteViewRequest>);
2011
2012    impl DeleteView {
2013        pub(crate) fn new(
2014            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConfigServiceV2>,
2015        ) -> Self {
2016            Self(RequestBuilder::new(stub))
2017        }
2018
2019        /// Sets the full request, replacing any prior values.
2020        pub fn with_request<V: Into<crate::model::DeleteViewRequest>>(mut self, v: V) -> Self {
2021            self.0.request = v.into();
2022            self
2023        }
2024
2025        /// Sets all the options, replacing any prior values.
2026        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2027            self.0.options = v.into();
2028            self
2029        }
2030
2031        /// Sends the request.
2032        pub async fn send(self) -> Result<()> {
2033            (*self.0.stub)
2034                .delete_view(self.0.request, self.0.options)
2035                .await
2036                .map(gax::response::Response::into_body)
2037        }
2038
2039        /// Sets the value of [name][crate::model::DeleteViewRequest::name].
2040        ///
2041        /// This is a **required** field for requests.
2042        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2043            self.0.request.name = v.into();
2044            self
2045        }
2046    }
2047
2048    #[doc(hidden)]
2049    impl gax::options::internal::RequestBuilder for DeleteView {
2050        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2051            &mut self.0.options
2052        }
2053    }
2054
2055    /// The request builder for [ConfigServiceV2::list_sinks][crate::client::ConfigServiceV2::list_sinks] calls.
2056    ///
2057    /// # Example
2058    /// ```no_run
2059    /// # use google_cloud_logging_v2::builder;
2060    /// use builder::config_service_v_2::ListSinks;
2061    /// # tokio_test::block_on(async {
2062    /// use gax::paginator::ItemPaginator;
2063    ///
2064    /// let builder = prepare_request_builder();
2065    /// let mut items = builder.by_item();
2066    /// while let Some(result) = items.next().await {
2067    ///   let item = result?;
2068    /// }
2069    /// # gax::Result::<()>::Ok(()) });
2070    ///
2071    /// fn prepare_request_builder() -> ListSinks {
2072    ///   # panic!();
2073    ///   // ... details omitted ...
2074    /// }
2075    /// ```
2076    #[derive(Clone, Debug)]
2077    pub struct ListSinks(RequestBuilder<crate::model::ListSinksRequest>);
2078
2079    impl ListSinks {
2080        pub(crate) fn new(
2081            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConfigServiceV2>,
2082        ) -> Self {
2083            Self(RequestBuilder::new(stub))
2084        }
2085
2086        /// Sets the full request, replacing any prior values.
2087        pub fn with_request<V: Into<crate::model::ListSinksRequest>>(mut self, v: V) -> Self {
2088            self.0.request = v.into();
2089            self
2090        }
2091
2092        /// Sets all the options, replacing any prior values.
2093        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2094            self.0.options = v.into();
2095            self
2096        }
2097
2098        /// Sends the request.
2099        pub async fn send(self) -> Result<crate::model::ListSinksResponse> {
2100            (*self.0.stub)
2101                .list_sinks(self.0.request, self.0.options)
2102                .await
2103                .map(gax::response::Response::into_body)
2104        }
2105
2106        /// Streams each page in the collection.
2107        pub fn by_page(
2108            self,
2109        ) -> impl gax::paginator::Paginator<crate::model::ListSinksResponse, gax::error::Error>
2110        {
2111            use std::clone::Clone;
2112            let token = self.0.request.page_token.clone();
2113            let execute = move |token: String| {
2114                let mut builder = self.clone();
2115                builder.0.request = builder.0.request.set_page_token(token);
2116                builder.send()
2117            };
2118            gax::paginator::internal::new_paginator(token, execute)
2119        }
2120
2121        /// Streams each item in the collection.
2122        pub fn by_item(
2123            self,
2124        ) -> impl gax::paginator::ItemPaginator<crate::model::ListSinksResponse, gax::error::Error>
2125        {
2126            use gax::paginator::Paginator;
2127            self.by_page().items()
2128        }
2129
2130        /// Sets the value of [parent][crate::model::ListSinksRequest::parent].
2131        ///
2132        /// This is a **required** field for requests.
2133        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2134            self.0.request.parent = v.into();
2135            self
2136        }
2137
2138        /// Sets the value of [page_token][crate::model::ListSinksRequest::page_token].
2139        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2140            self.0.request.page_token = v.into();
2141            self
2142        }
2143
2144        /// Sets the value of [page_size][crate::model::ListSinksRequest::page_size].
2145        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2146            self.0.request.page_size = v.into();
2147            self
2148        }
2149    }
2150
2151    #[doc(hidden)]
2152    impl gax::options::internal::RequestBuilder for ListSinks {
2153        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2154            &mut self.0.options
2155        }
2156    }
2157
2158    /// The request builder for [ConfigServiceV2::get_sink][crate::client::ConfigServiceV2::get_sink] calls.
2159    ///
2160    /// # Example
2161    /// ```no_run
2162    /// # use google_cloud_logging_v2::builder;
2163    /// use builder::config_service_v_2::GetSink;
2164    /// # tokio_test::block_on(async {
2165    ///
2166    /// let builder = prepare_request_builder();
2167    /// let response = builder.send().await?;
2168    /// # gax::Result::<()>::Ok(()) });
2169    ///
2170    /// fn prepare_request_builder() -> GetSink {
2171    ///   # panic!();
2172    ///   // ... details omitted ...
2173    /// }
2174    /// ```
2175    #[derive(Clone, Debug)]
2176    pub struct GetSink(RequestBuilder<crate::model::GetSinkRequest>);
2177
2178    impl GetSink {
2179        pub(crate) fn new(
2180            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConfigServiceV2>,
2181        ) -> Self {
2182            Self(RequestBuilder::new(stub))
2183        }
2184
2185        /// Sets the full request, replacing any prior values.
2186        pub fn with_request<V: Into<crate::model::GetSinkRequest>>(mut self, v: V) -> Self {
2187            self.0.request = v.into();
2188            self
2189        }
2190
2191        /// Sets all the options, replacing any prior values.
2192        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2193            self.0.options = v.into();
2194            self
2195        }
2196
2197        /// Sends the request.
2198        pub async fn send(self) -> Result<crate::model::LogSink> {
2199            (*self.0.stub)
2200                .get_sink(self.0.request, self.0.options)
2201                .await
2202                .map(gax::response::Response::into_body)
2203        }
2204
2205        /// Sets the value of [sink_name][crate::model::GetSinkRequest::sink_name].
2206        ///
2207        /// This is a **required** field for requests.
2208        pub fn set_sink_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2209            self.0.request.sink_name = v.into();
2210            self
2211        }
2212    }
2213
2214    #[doc(hidden)]
2215    impl gax::options::internal::RequestBuilder for GetSink {
2216        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2217            &mut self.0.options
2218        }
2219    }
2220
2221    /// The request builder for [ConfigServiceV2::create_sink][crate::client::ConfigServiceV2::create_sink] calls.
2222    ///
2223    /// # Example
2224    /// ```no_run
2225    /// # use google_cloud_logging_v2::builder;
2226    /// use builder::config_service_v_2::CreateSink;
2227    /// # tokio_test::block_on(async {
2228    ///
2229    /// let builder = prepare_request_builder();
2230    /// let response = builder.send().await?;
2231    /// # gax::Result::<()>::Ok(()) });
2232    ///
2233    /// fn prepare_request_builder() -> CreateSink {
2234    ///   # panic!();
2235    ///   // ... details omitted ...
2236    /// }
2237    /// ```
2238    #[derive(Clone, Debug)]
2239    pub struct CreateSink(RequestBuilder<crate::model::CreateSinkRequest>);
2240
2241    impl CreateSink {
2242        pub(crate) fn new(
2243            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConfigServiceV2>,
2244        ) -> Self {
2245            Self(RequestBuilder::new(stub))
2246        }
2247
2248        /// Sets the full request, replacing any prior values.
2249        pub fn with_request<V: Into<crate::model::CreateSinkRequest>>(mut self, v: V) -> Self {
2250            self.0.request = v.into();
2251            self
2252        }
2253
2254        /// Sets all the options, replacing any prior values.
2255        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2256            self.0.options = v.into();
2257            self
2258        }
2259
2260        /// Sends the request.
2261        pub async fn send(self) -> Result<crate::model::LogSink> {
2262            (*self.0.stub)
2263                .create_sink(self.0.request, self.0.options)
2264                .await
2265                .map(gax::response::Response::into_body)
2266        }
2267
2268        /// Sets the value of [parent][crate::model::CreateSinkRequest::parent].
2269        ///
2270        /// This is a **required** field for requests.
2271        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2272            self.0.request.parent = v.into();
2273            self
2274        }
2275
2276        /// Sets the value of [sink][crate::model::CreateSinkRequest::sink].
2277        ///
2278        /// This is a **required** field for requests.
2279        pub fn set_sink<T>(mut self, v: T) -> Self
2280        where
2281            T: std::convert::Into<crate::model::LogSink>,
2282        {
2283            self.0.request.sink = std::option::Option::Some(v.into());
2284            self
2285        }
2286
2287        /// Sets or clears the value of [sink][crate::model::CreateSinkRequest::sink].
2288        ///
2289        /// This is a **required** field for requests.
2290        pub fn set_or_clear_sink<T>(mut self, v: std::option::Option<T>) -> Self
2291        where
2292            T: std::convert::Into<crate::model::LogSink>,
2293        {
2294            self.0.request.sink = v.map(|x| x.into());
2295            self
2296        }
2297
2298        /// Sets the value of [unique_writer_identity][crate::model::CreateSinkRequest::unique_writer_identity].
2299        pub fn set_unique_writer_identity<T: Into<bool>>(mut self, v: T) -> Self {
2300            self.0.request.unique_writer_identity = v.into();
2301            self
2302        }
2303    }
2304
2305    #[doc(hidden)]
2306    impl gax::options::internal::RequestBuilder for CreateSink {
2307        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2308            &mut self.0.options
2309        }
2310    }
2311
2312    /// The request builder for [ConfigServiceV2::update_sink][crate::client::ConfigServiceV2::update_sink] calls.
2313    ///
2314    /// # Example
2315    /// ```no_run
2316    /// # use google_cloud_logging_v2::builder;
2317    /// use builder::config_service_v_2::UpdateSink;
2318    /// # tokio_test::block_on(async {
2319    ///
2320    /// let builder = prepare_request_builder();
2321    /// let response = builder.send().await?;
2322    /// # gax::Result::<()>::Ok(()) });
2323    ///
2324    /// fn prepare_request_builder() -> UpdateSink {
2325    ///   # panic!();
2326    ///   // ... details omitted ...
2327    /// }
2328    /// ```
2329    #[derive(Clone, Debug)]
2330    pub struct UpdateSink(RequestBuilder<crate::model::UpdateSinkRequest>);
2331
2332    impl UpdateSink {
2333        pub(crate) fn new(
2334            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConfigServiceV2>,
2335        ) -> Self {
2336            Self(RequestBuilder::new(stub))
2337        }
2338
2339        /// Sets the full request, replacing any prior values.
2340        pub fn with_request<V: Into<crate::model::UpdateSinkRequest>>(mut self, v: V) -> Self {
2341            self.0.request = v.into();
2342            self
2343        }
2344
2345        /// Sets all the options, replacing any prior values.
2346        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2347            self.0.options = v.into();
2348            self
2349        }
2350
2351        /// Sends the request.
2352        pub async fn send(self) -> Result<crate::model::LogSink> {
2353            (*self.0.stub)
2354                .update_sink(self.0.request, self.0.options)
2355                .await
2356                .map(gax::response::Response::into_body)
2357        }
2358
2359        /// Sets the value of [sink_name][crate::model::UpdateSinkRequest::sink_name].
2360        ///
2361        /// This is a **required** field for requests.
2362        pub fn set_sink_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2363            self.0.request.sink_name = v.into();
2364            self
2365        }
2366
2367        /// Sets the value of [sink][crate::model::UpdateSinkRequest::sink].
2368        ///
2369        /// This is a **required** field for requests.
2370        pub fn set_sink<T>(mut self, v: T) -> Self
2371        where
2372            T: std::convert::Into<crate::model::LogSink>,
2373        {
2374            self.0.request.sink = std::option::Option::Some(v.into());
2375            self
2376        }
2377
2378        /// Sets or clears the value of [sink][crate::model::UpdateSinkRequest::sink].
2379        ///
2380        /// This is a **required** field for requests.
2381        pub fn set_or_clear_sink<T>(mut self, v: std::option::Option<T>) -> Self
2382        where
2383            T: std::convert::Into<crate::model::LogSink>,
2384        {
2385            self.0.request.sink = v.map(|x| x.into());
2386            self
2387        }
2388
2389        /// Sets the value of [unique_writer_identity][crate::model::UpdateSinkRequest::unique_writer_identity].
2390        pub fn set_unique_writer_identity<T: Into<bool>>(mut self, v: T) -> Self {
2391            self.0.request.unique_writer_identity = v.into();
2392            self
2393        }
2394
2395        /// Sets the value of [update_mask][crate::model::UpdateSinkRequest::update_mask].
2396        pub fn set_update_mask<T>(mut self, v: T) -> Self
2397        where
2398            T: std::convert::Into<wkt::FieldMask>,
2399        {
2400            self.0.request.update_mask = std::option::Option::Some(v.into());
2401            self
2402        }
2403
2404        /// Sets or clears the value of [update_mask][crate::model::UpdateSinkRequest::update_mask].
2405        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2406        where
2407            T: std::convert::Into<wkt::FieldMask>,
2408        {
2409            self.0.request.update_mask = v.map(|x| x.into());
2410            self
2411        }
2412    }
2413
2414    #[doc(hidden)]
2415    impl gax::options::internal::RequestBuilder for UpdateSink {
2416        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2417            &mut self.0.options
2418        }
2419    }
2420
2421    /// The request builder for [ConfigServiceV2::delete_sink][crate::client::ConfigServiceV2::delete_sink] calls.
2422    ///
2423    /// # Example
2424    /// ```no_run
2425    /// # use google_cloud_logging_v2::builder;
2426    /// use builder::config_service_v_2::DeleteSink;
2427    /// # tokio_test::block_on(async {
2428    ///
2429    /// let builder = prepare_request_builder();
2430    /// let response = builder.send().await?;
2431    /// # gax::Result::<()>::Ok(()) });
2432    ///
2433    /// fn prepare_request_builder() -> DeleteSink {
2434    ///   # panic!();
2435    ///   // ... details omitted ...
2436    /// }
2437    /// ```
2438    #[derive(Clone, Debug)]
2439    pub struct DeleteSink(RequestBuilder<crate::model::DeleteSinkRequest>);
2440
2441    impl DeleteSink {
2442        pub(crate) fn new(
2443            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConfigServiceV2>,
2444        ) -> Self {
2445            Self(RequestBuilder::new(stub))
2446        }
2447
2448        /// Sets the full request, replacing any prior values.
2449        pub fn with_request<V: Into<crate::model::DeleteSinkRequest>>(mut self, v: V) -> Self {
2450            self.0.request = v.into();
2451            self
2452        }
2453
2454        /// Sets all the options, replacing any prior values.
2455        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2456            self.0.options = v.into();
2457            self
2458        }
2459
2460        /// Sends the request.
2461        pub async fn send(self) -> Result<()> {
2462            (*self.0.stub)
2463                .delete_sink(self.0.request, self.0.options)
2464                .await
2465                .map(gax::response::Response::into_body)
2466        }
2467
2468        /// Sets the value of [sink_name][crate::model::DeleteSinkRequest::sink_name].
2469        ///
2470        /// This is a **required** field for requests.
2471        pub fn set_sink_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2472            self.0.request.sink_name = v.into();
2473            self
2474        }
2475    }
2476
2477    #[doc(hidden)]
2478    impl gax::options::internal::RequestBuilder for DeleteSink {
2479        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2480            &mut self.0.options
2481        }
2482    }
2483
2484    /// The request builder for [ConfigServiceV2::create_link][crate::client::ConfigServiceV2::create_link] calls.
2485    ///
2486    /// # Example
2487    /// ```no_run
2488    /// # use google_cloud_logging_v2::builder;
2489    /// use builder::config_service_v_2::CreateLink;
2490    /// # tokio_test::block_on(async {
2491    /// use lro::Poller;
2492    ///
2493    /// let builder = prepare_request_builder();
2494    /// let response = builder.poller().until_done().await?;
2495    /// # gax::Result::<()>::Ok(()) });
2496    ///
2497    /// fn prepare_request_builder() -> CreateLink {
2498    ///   # panic!();
2499    ///   // ... details omitted ...
2500    /// }
2501    /// ```
2502    #[derive(Clone, Debug)]
2503    pub struct CreateLink(RequestBuilder<crate::model::CreateLinkRequest>);
2504
2505    impl CreateLink {
2506        pub(crate) fn new(
2507            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConfigServiceV2>,
2508        ) -> Self {
2509            Self(RequestBuilder::new(stub))
2510        }
2511
2512        /// Sets the full request, replacing any prior values.
2513        pub fn with_request<V: Into<crate::model::CreateLinkRequest>>(mut self, v: V) -> Self {
2514            self.0.request = v.into();
2515            self
2516        }
2517
2518        /// Sets all the options, replacing any prior values.
2519        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2520            self.0.options = v.into();
2521            self
2522        }
2523
2524        /// Sends the request.
2525        ///
2526        /// # Long running operations
2527        ///
2528        /// This starts, but does not poll, a longrunning operation. More information
2529        /// on [create_link][crate::client::ConfigServiceV2::create_link].
2530        pub async fn send(self) -> Result<longrunning::model::Operation> {
2531            (*self.0.stub)
2532                .create_link(self.0.request, self.0.options)
2533                .await
2534                .map(gax::response::Response::into_body)
2535        }
2536
2537        /// Creates a [Poller][lro::Poller] to work with `create_link`.
2538        pub fn poller(self) -> impl lro::Poller<crate::model::Link, crate::model::LinkMetadata> {
2539            type Operation =
2540                lro::internal::Operation<crate::model::Link, crate::model::LinkMetadata>;
2541            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2542            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2543
2544            let stub = self.0.stub.clone();
2545            let mut options = self.0.options.clone();
2546            options.set_retry_policy(gax::retry_policy::NeverRetry);
2547            let query = move |name| {
2548                let stub = stub.clone();
2549                let options = options.clone();
2550                async {
2551                    let op = GetOperation::new(stub)
2552                        .set_name(name)
2553                        .with_options(options)
2554                        .send()
2555                        .await?;
2556                    Ok(Operation::new(op))
2557                }
2558            };
2559
2560            let start = move || async {
2561                let op = self.send().await?;
2562                Ok(Operation::new(op))
2563            };
2564
2565            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2566        }
2567
2568        /// Sets the value of [parent][crate::model::CreateLinkRequest::parent].
2569        ///
2570        /// This is a **required** field for requests.
2571        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2572            self.0.request.parent = v.into();
2573            self
2574        }
2575
2576        /// Sets the value of [link][crate::model::CreateLinkRequest::link].
2577        ///
2578        /// This is a **required** field for requests.
2579        pub fn set_link<T>(mut self, v: T) -> Self
2580        where
2581            T: std::convert::Into<crate::model::Link>,
2582        {
2583            self.0.request.link = std::option::Option::Some(v.into());
2584            self
2585        }
2586
2587        /// Sets or clears the value of [link][crate::model::CreateLinkRequest::link].
2588        ///
2589        /// This is a **required** field for requests.
2590        pub fn set_or_clear_link<T>(mut self, v: std::option::Option<T>) -> Self
2591        where
2592            T: std::convert::Into<crate::model::Link>,
2593        {
2594            self.0.request.link = v.map(|x| x.into());
2595            self
2596        }
2597
2598        /// Sets the value of [link_id][crate::model::CreateLinkRequest::link_id].
2599        ///
2600        /// This is a **required** field for requests.
2601        pub fn set_link_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2602            self.0.request.link_id = v.into();
2603            self
2604        }
2605    }
2606
2607    #[doc(hidden)]
2608    impl gax::options::internal::RequestBuilder for CreateLink {
2609        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2610            &mut self.0.options
2611        }
2612    }
2613
2614    /// The request builder for [ConfigServiceV2::delete_link][crate::client::ConfigServiceV2::delete_link] calls.
2615    ///
2616    /// # Example
2617    /// ```no_run
2618    /// # use google_cloud_logging_v2::builder;
2619    /// use builder::config_service_v_2::DeleteLink;
2620    /// # tokio_test::block_on(async {
2621    /// use lro::Poller;
2622    ///
2623    /// let builder = prepare_request_builder();
2624    /// let response = builder.poller().until_done().await?;
2625    /// # gax::Result::<()>::Ok(()) });
2626    ///
2627    /// fn prepare_request_builder() -> DeleteLink {
2628    ///   # panic!();
2629    ///   // ... details omitted ...
2630    /// }
2631    /// ```
2632    #[derive(Clone, Debug)]
2633    pub struct DeleteLink(RequestBuilder<crate::model::DeleteLinkRequest>);
2634
2635    impl DeleteLink {
2636        pub(crate) fn new(
2637            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConfigServiceV2>,
2638        ) -> Self {
2639            Self(RequestBuilder::new(stub))
2640        }
2641
2642        /// Sets the full request, replacing any prior values.
2643        pub fn with_request<V: Into<crate::model::DeleteLinkRequest>>(mut self, v: V) -> Self {
2644            self.0.request = v.into();
2645            self
2646        }
2647
2648        /// Sets all the options, replacing any prior values.
2649        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2650            self.0.options = v.into();
2651            self
2652        }
2653
2654        /// Sends the request.
2655        ///
2656        /// # Long running operations
2657        ///
2658        /// This starts, but does not poll, a longrunning operation. More information
2659        /// on [delete_link][crate::client::ConfigServiceV2::delete_link].
2660        pub async fn send(self) -> Result<longrunning::model::Operation> {
2661            (*self.0.stub)
2662                .delete_link(self.0.request, self.0.options)
2663                .await
2664                .map(gax::response::Response::into_body)
2665        }
2666
2667        /// Creates a [Poller][lro::Poller] to work with `delete_link`.
2668        pub fn poller(self) -> impl lro::Poller<(), crate::model::LinkMetadata> {
2669            type Operation = lro::internal::Operation<wkt::Empty, crate::model::LinkMetadata>;
2670            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2671            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2672
2673            let stub = self.0.stub.clone();
2674            let mut options = self.0.options.clone();
2675            options.set_retry_policy(gax::retry_policy::NeverRetry);
2676            let query = move |name| {
2677                let stub = stub.clone();
2678                let options = options.clone();
2679                async {
2680                    let op = GetOperation::new(stub)
2681                        .set_name(name)
2682                        .with_options(options)
2683                        .send()
2684                        .await?;
2685                    Ok(Operation::new(op))
2686                }
2687            };
2688
2689            let start = move || async {
2690                let op = self.send().await?;
2691                Ok(Operation::new(op))
2692            };
2693
2694            lro::internal::new_unit_response_poller(
2695                polling_error_policy,
2696                polling_backoff_policy,
2697                start,
2698                query,
2699            )
2700        }
2701
2702        /// Sets the value of [name][crate::model::DeleteLinkRequest::name].
2703        ///
2704        /// This is a **required** field for requests.
2705        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2706            self.0.request.name = v.into();
2707            self
2708        }
2709    }
2710
2711    #[doc(hidden)]
2712    impl gax::options::internal::RequestBuilder for DeleteLink {
2713        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2714            &mut self.0.options
2715        }
2716    }
2717
2718    /// The request builder for [ConfigServiceV2::list_links][crate::client::ConfigServiceV2::list_links] calls.
2719    ///
2720    /// # Example
2721    /// ```no_run
2722    /// # use google_cloud_logging_v2::builder;
2723    /// use builder::config_service_v_2::ListLinks;
2724    /// # tokio_test::block_on(async {
2725    /// use gax::paginator::ItemPaginator;
2726    ///
2727    /// let builder = prepare_request_builder();
2728    /// let mut items = builder.by_item();
2729    /// while let Some(result) = items.next().await {
2730    ///   let item = result?;
2731    /// }
2732    /// # gax::Result::<()>::Ok(()) });
2733    ///
2734    /// fn prepare_request_builder() -> ListLinks {
2735    ///   # panic!();
2736    ///   // ... details omitted ...
2737    /// }
2738    /// ```
2739    #[derive(Clone, Debug)]
2740    pub struct ListLinks(RequestBuilder<crate::model::ListLinksRequest>);
2741
2742    impl ListLinks {
2743        pub(crate) fn new(
2744            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConfigServiceV2>,
2745        ) -> Self {
2746            Self(RequestBuilder::new(stub))
2747        }
2748
2749        /// Sets the full request, replacing any prior values.
2750        pub fn with_request<V: Into<crate::model::ListLinksRequest>>(mut self, v: V) -> Self {
2751            self.0.request = v.into();
2752            self
2753        }
2754
2755        /// Sets all the options, replacing any prior values.
2756        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2757            self.0.options = v.into();
2758            self
2759        }
2760
2761        /// Sends the request.
2762        pub async fn send(self) -> Result<crate::model::ListLinksResponse> {
2763            (*self.0.stub)
2764                .list_links(self.0.request, self.0.options)
2765                .await
2766                .map(gax::response::Response::into_body)
2767        }
2768
2769        /// Streams each page in the collection.
2770        pub fn by_page(
2771            self,
2772        ) -> impl gax::paginator::Paginator<crate::model::ListLinksResponse, gax::error::Error>
2773        {
2774            use std::clone::Clone;
2775            let token = self.0.request.page_token.clone();
2776            let execute = move |token: String| {
2777                let mut builder = self.clone();
2778                builder.0.request = builder.0.request.set_page_token(token);
2779                builder.send()
2780            };
2781            gax::paginator::internal::new_paginator(token, execute)
2782        }
2783
2784        /// Streams each item in the collection.
2785        pub fn by_item(
2786            self,
2787        ) -> impl gax::paginator::ItemPaginator<crate::model::ListLinksResponse, gax::error::Error>
2788        {
2789            use gax::paginator::Paginator;
2790            self.by_page().items()
2791        }
2792
2793        /// Sets the value of [parent][crate::model::ListLinksRequest::parent].
2794        ///
2795        /// This is a **required** field for requests.
2796        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2797            self.0.request.parent = v.into();
2798            self
2799        }
2800
2801        /// Sets the value of [page_token][crate::model::ListLinksRequest::page_token].
2802        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2803            self.0.request.page_token = v.into();
2804            self
2805        }
2806
2807        /// Sets the value of [page_size][crate::model::ListLinksRequest::page_size].
2808        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2809            self.0.request.page_size = v.into();
2810            self
2811        }
2812    }
2813
2814    #[doc(hidden)]
2815    impl gax::options::internal::RequestBuilder for ListLinks {
2816        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2817            &mut self.0.options
2818        }
2819    }
2820
2821    /// The request builder for [ConfigServiceV2::get_link][crate::client::ConfigServiceV2::get_link] calls.
2822    ///
2823    /// # Example
2824    /// ```no_run
2825    /// # use google_cloud_logging_v2::builder;
2826    /// use builder::config_service_v_2::GetLink;
2827    /// # tokio_test::block_on(async {
2828    ///
2829    /// let builder = prepare_request_builder();
2830    /// let response = builder.send().await?;
2831    /// # gax::Result::<()>::Ok(()) });
2832    ///
2833    /// fn prepare_request_builder() -> GetLink {
2834    ///   # panic!();
2835    ///   // ... details omitted ...
2836    /// }
2837    /// ```
2838    #[derive(Clone, Debug)]
2839    pub struct GetLink(RequestBuilder<crate::model::GetLinkRequest>);
2840
2841    impl GetLink {
2842        pub(crate) fn new(
2843            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConfigServiceV2>,
2844        ) -> Self {
2845            Self(RequestBuilder::new(stub))
2846        }
2847
2848        /// Sets the full request, replacing any prior values.
2849        pub fn with_request<V: Into<crate::model::GetLinkRequest>>(mut self, v: V) -> Self {
2850            self.0.request = v.into();
2851            self
2852        }
2853
2854        /// Sets all the options, replacing any prior values.
2855        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2856            self.0.options = v.into();
2857            self
2858        }
2859
2860        /// Sends the request.
2861        pub async fn send(self) -> Result<crate::model::Link> {
2862            (*self.0.stub)
2863                .get_link(self.0.request, self.0.options)
2864                .await
2865                .map(gax::response::Response::into_body)
2866        }
2867
2868        /// Sets the value of [name][crate::model::GetLinkRequest::name].
2869        ///
2870        /// This is a **required** field for requests.
2871        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2872            self.0.request.name = v.into();
2873            self
2874        }
2875    }
2876
2877    #[doc(hidden)]
2878    impl gax::options::internal::RequestBuilder for GetLink {
2879        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2880            &mut self.0.options
2881        }
2882    }
2883
2884    /// The request builder for [ConfigServiceV2::list_exclusions][crate::client::ConfigServiceV2::list_exclusions] calls.
2885    ///
2886    /// # Example
2887    /// ```no_run
2888    /// # use google_cloud_logging_v2::builder;
2889    /// use builder::config_service_v_2::ListExclusions;
2890    /// # tokio_test::block_on(async {
2891    /// use gax::paginator::ItemPaginator;
2892    ///
2893    /// let builder = prepare_request_builder();
2894    /// let mut items = builder.by_item();
2895    /// while let Some(result) = items.next().await {
2896    ///   let item = result?;
2897    /// }
2898    /// # gax::Result::<()>::Ok(()) });
2899    ///
2900    /// fn prepare_request_builder() -> ListExclusions {
2901    ///   # panic!();
2902    ///   // ... details omitted ...
2903    /// }
2904    /// ```
2905    #[derive(Clone, Debug)]
2906    pub struct ListExclusions(RequestBuilder<crate::model::ListExclusionsRequest>);
2907
2908    impl ListExclusions {
2909        pub(crate) fn new(
2910            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConfigServiceV2>,
2911        ) -> Self {
2912            Self(RequestBuilder::new(stub))
2913        }
2914
2915        /// Sets the full request, replacing any prior values.
2916        pub fn with_request<V: Into<crate::model::ListExclusionsRequest>>(mut self, v: V) -> Self {
2917            self.0.request = v.into();
2918            self
2919        }
2920
2921        /// Sets all the options, replacing any prior values.
2922        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2923            self.0.options = v.into();
2924            self
2925        }
2926
2927        /// Sends the request.
2928        pub async fn send(self) -> Result<crate::model::ListExclusionsResponse> {
2929            (*self.0.stub)
2930                .list_exclusions(self.0.request, self.0.options)
2931                .await
2932                .map(gax::response::Response::into_body)
2933        }
2934
2935        /// Streams each page in the collection.
2936        pub fn by_page(
2937            self,
2938        ) -> impl gax::paginator::Paginator<crate::model::ListExclusionsResponse, gax::error::Error>
2939        {
2940            use std::clone::Clone;
2941            let token = self.0.request.page_token.clone();
2942            let execute = move |token: String| {
2943                let mut builder = self.clone();
2944                builder.0.request = builder.0.request.set_page_token(token);
2945                builder.send()
2946            };
2947            gax::paginator::internal::new_paginator(token, execute)
2948        }
2949
2950        /// Streams each item in the collection.
2951        pub fn by_item(
2952            self,
2953        ) -> impl gax::paginator::ItemPaginator<crate::model::ListExclusionsResponse, gax::error::Error>
2954        {
2955            use gax::paginator::Paginator;
2956            self.by_page().items()
2957        }
2958
2959        /// Sets the value of [parent][crate::model::ListExclusionsRequest::parent].
2960        ///
2961        /// This is a **required** field for requests.
2962        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2963            self.0.request.parent = v.into();
2964            self
2965        }
2966
2967        /// Sets the value of [page_token][crate::model::ListExclusionsRequest::page_token].
2968        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2969            self.0.request.page_token = v.into();
2970            self
2971        }
2972
2973        /// Sets the value of [page_size][crate::model::ListExclusionsRequest::page_size].
2974        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2975            self.0.request.page_size = v.into();
2976            self
2977        }
2978    }
2979
2980    #[doc(hidden)]
2981    impl gax::options::internal::RequestBuilder for ListExclusions {
2982        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2983            &mut self.0.options
2984        }
2985    }
2986
2987    /// The request builder for [ConfigServiceV2::get_exclusion][crate::client::ConfigServiceV2::get_exclusion] calls.
2988    ///
2989    /// # Example
2990    /// ```no_run
2991    /// # use google_cloud_logging_v2::builder;
2992    /// use builder::config_service_v_2::GetExclusion;
2993    /// # tokio_test::block_on(async {
2994    ///
2995    /// let builder = prepare_request_builder();
2996    /// let response = builder.send().await?;
2997    /// # gax::Result::<()>::Ok(()) });
2998    ///
2999    /// fn prepare_request_builder() -> GetExclusion {
3000    ///   # panic!();
3001    ///   // ... details omitted ...
3002    /// }
3003    /// ```
3004    #[derive(Clone, Debug)]
3005    pub struct GetExclusion(RequestBuilder<crate::model::GetExclusionRequest>);
3006
3007    impl GetExclusion {
3008        pub(crate) fn new(
3009            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConfigServiceV2>,
3010        ) -> Self {
3011            Self(RequestBuilder::new(stub))
3012        }
3013
3014        /// Sets the full request, replacing any prior values.
3015        pub fn with_request<V: Into<crate::model::GetExclusionRequest>>(mut self, v: V) -> Self {
3016            self.0.request = v.into();
3017            self
3018        }
3019
3020        /// Sets all the options, replacing any prior values.
3021        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3022            self.0.options = v.into();
3023            self
3024        }
3025
3026        /// Sends the request.
3027        pub async fn send(self) -> Result<crate::model::LogExclusion> {
3028            (*self.0.stub)
3029                .get_exclusion(self.0.request, self.0.options)
3030                .await
3031                .map(gax::response::Response::into_body)
3032        }
3033
3034        /// Sets the value of [name][crate::model::GetExclusionRequest::name].
3035        ///
3036        /// This is a **required** field for requests.
3037        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3038            self.0.request.name = v.into();
3039            self
3040        }
3041    }
3042
3043    #[doc(hidden)]
3044    impl gax::options::internal::RequestBuilder for GetExclusion {
3045        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3046            &mut self.0.options
3047        }
3048    }
3049
3050    /// The request builder for [ConfigServiceV2::create_exclusion][crate::client::ConfigServiceV2::create_exclusion] calls.
3051    ///
3052    /// # Example
3053    /// ```no_run
3054    /// # use google_cloud_logging_v2::builder;
3055    /// use builder::config_service_v_2::CreateExclusion;
3056    /// # tokio_test::block_on(async {
3057    ///
3058    /// let builder = prepare_request_builder();
3059    /// let response = builder.send().await?;
3060    /// # gax::Result::<()>::Ok(()) });
3061    ///
3062    /// fn prepare_request_builder() -> CreateExclusion {
3063    ///   # panic!();
3064    ///   // ... details omitted ...
3065    /// }
3066    /// ```
3067    #[derive(Clone, Debug)]
3068    pub struct CreateExclusion(RequestBuilder<crate::model::CreateExclusionRequest>);
3069
3070    impl CreateExclusion {
3071        pub(crate) fn new(
3072            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConfigServiceV2>,
3073        ) -> Self {
3074            Self(RequestBuilder::new(stub))
3075        }
3076
3077        /// Sets the full request, replacing any prior values.
3078        pub fn with_request<V: Into<crate::model::CreateExclusionRequest>>(mut self, v: V) -> Self {
3079            self.0.request = v.into();
3080            self
3081        }
3082
3083        /// Sets all the options, replacing any prior values.
3084        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3085            self.0.options = v.into();
3086            self
3087        }
3088
3089        /// Sends the request.
3090        pub async fn send(self) -> Result<crate::model::LogExclusion> {
3091            (*self.0.stub)
3092                .create_exclusion(self.0.request, self.0.options)
3093                .await
3094                .map(gax::response::Response::into_body)
3095        }
3096
3097        /// Sets the value of [parent][crate::model::CreateExclusionRequest::parent].
3098        ///
3099        /// This is a **required** field for requests.
3100        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3101            self.0.request.parent = v.into();
3102            self
3103        }
3104
3105        /// Sets the value of [exclusion][crate::model::CreateExclusionRequest::exclusion].
3106        ///
3107        /// This is a **required** field for requests.
3108        pub fn set_exclusion<T>(mut self, v: T) -> Self
3109        where
3110            T: std::convert::Into<crate::model::LogExclusion>,
3111        {
3112            self.0.request.exclusion = std::option::Option::Some(v.into());
3113            self
3114        }
3115
3116        /// Sets or clears the value of [exclusion][crate::model::CreateExclusionRequest::exclusion].
3117        ///
3118        /// This is a **required** field for requests.
3119        pub fn set_or_clear_exclusion<T>(mut self, v: std::option::Option<T>) -> Self
3120        where
3121            T: std::convert::Into<crate::model::LogExclusion>,
3122        {
3123            self.0.request.exclusion = v.map(|x| x.into());
3124            self
3125        }
3126    }
3127
3128    #[doc(hidden)]
3129    impl gax::options::internal::RequestBuilder for CreateExclusion {
3130        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3131            &mut self.0.options
3132        }
3133    }
3134
3135    /// The request builder for [ConfigServiceV2::update_exclusion][crate::client::ConfigServiceV2::update_exclusion] calls.
3136    ///
3137    /// # Example
3138    /// ```no_run
3139    /// # use google_cloud_logging_v2::builder;
3140    /// use builder::config_service_v_2::UpdateExclusion;
3141    /// # tokio_test::block_on(async {
3142    ///
3143    /// let builder = prepare_request_builder();
3144    /// let response = builder.send().await?;
3145    /// # gax::Result::<()>::Ok(()) });
3146    ///
3147    /// fn prepare_request_builder() -> UpdateExclusion {
3148    ///   # panic!();
3149    ///   // ... details omitted ...
3150    /// }
3151    /// ```
3152    #[derive(Clone, Debug)]
3153    pub struct UpdateExclusion(RequestBuilder<crate::model::UpdateExclusionRequest>);
3154
3155    impl UpdateExclusion {
3156        pub(crate) fn new(
3157            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConfigServiceV2>,
3158        ) -> Self {
3159            Self(RequestBuilder::new(stub))
3160        }
3161
3162        /// Sets the full request, replacing any prior values.
3163        pub fn with_request<V: Into<crate::model::UpdateExclusionRequest>>(mut self, v: V) -> Self {
3164            self.0.request = v.into();
3165            self
3166        }
3167
3168        /// Sets all the options, replacing any prior values.
3169        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3170            self.0.options = v.into();
3171            self
3172        }
3173
3174        /// Sends the request.
3175        pub async fn send(self) -> Result<crate::model::LogExclusion> {
3176            (*self.0.stub)
3177                .update_exclusion(self.0.request, self.0.options)
3178                .await
3179                .map(gax::response::Response::into_body)
3180        }
3181
3182        /// Sets the value of [name][crate::model::UpdateExclusionRequest::name].
3183        ///
3184        /// This is a **required** field for requests.
3185        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3186            self.0.request.name = v.into();
3187            self
3188        }
3189
3190        /// Sets the value of [exclusion][crate::model::UpdateExclusionRequest::exclusion].
3191        ///
3192        /// This is a **required** field for requests.
3193        pub fn set_exclusion<T>(mut self, v: T) -> Self
3194        where
3195            T: std::convert::Into<crate::model::LogExclusion>,
3196        {
3197            self.0.request.exclusion = std::option::Option::Some(v.into());
3198            self
3199        }
3200
3201        /// Sets or clears the value of [exclusion][crate::model::UpdateExclusionRequest::exclusion].
3202        ///
3203        /// This is a **required** field for requests.
3204        pub fn set_or_clear_exclusion<T>(mut self, v: std::option::Option<T>) -> Self
3205        where
3206            T: std::convert::Into<crate::model::LogExclusion>,
3207        {
3208            self.0.request.exclusion = v.map(|x| x.into());
3209            self
3210        }
3211
3212        /// Sets the value of [update_mask][crate::model::UpdateExclusionRequest::update_mask].
3213        ///
3214        /// This is a **required** field for requests.
3215        pub fn set_update_mask<T>(mut self, v: T) -> Self
3216        where
3217            T: std::convert::Into<wkt::FieldMask>,
3218        {
3219            self.0.request.update_mask = std::option::Option::Some(v.into());
3220            self
3221        }
3222
3223        /// Sets or clears the value of [update_mask][crate::model::UpdateExclusionRequest::update_mask].
3224        ///
3225        /// This is a **required** field for requests.
3226        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3227        where
3228            T: std::convert::Into<wkt::FieldMask>,
3229        {
3230            self.0.request.update_mask = v.map(|x| x.into());
3231            self
3232        }
3233    }
3234
3235    #[doc(hidden)]
3236    impl gax::options::internal::RequestBuilder for UpdateExclusion {
3237        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3238            &mut self.0.options
3239        }
3240    }
3241
3242    /// The request builder for [ConfigServiceV2::delete_exclusion][crate::client::ConfigServiceV2::delete_exclusion] calls.
3243    ///
3244    /// # Example
3245    /// ```no_run
3246    /// # use google_cloud_logging_v2::builder;
3247    /// use builder::config_service_v_2::DeleteExclusion;
3248    /// # tokio_test::block_on(async {
3249    ///
3250    /// let builder = prepare_request_builder();
3251    /// let response = builder.send().await?;
3252    /// # gax::Result::<()>::Ok(()) });
3253    ///
3254    /// fn prepare_request_builder() -> DeleteExclusion {
3255    ///   # panic!();
3256    ///   // ... details omitted ...
3257    /// }
3258    /// ```
3259    #[derive(Clone, Debug)]
3260    pub struct DeleteExclusion(RequestBuilder<crate::model::DeleteExclusionRequest>);
3261
3262    impl DeleteExclusion {
3263        pub(crate) fn new(
3264            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConfigServiceV2>,
3265        ) -> Self {
3266            Self(RequestBuilder::new(stub))
3267        }
3268
3269        /// Sets the full request, replacing any prior values.
3270        pub fn with_request<V: Into<crate::model::DeleteExclusionRequest>>(mut self, v: V) -> Self {
3271            self.0.request = v.into();
3272            self
3273        }
3274
3275        /// Sets all the options, replacing any prior values.
3276        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3277            self.0.options = v.into();
3278            self
3279        }
3280
3281        /// Sends the request.
3282        pub async fn send(self) -> Result<()> {
3283            (*self.0.stub)
3284                .delete_exclusion(self.0.request, self.0.options)
3285                .await
3286                .map(gax::response::Response::into_body)
3287        }
3288
3289        /// Sets the value of [name][crate::model::DeleteExclusionRequest::name].
3290        ///
3291        /// This is a **required** field for requests.
3292        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3293            self.0.request.name = v.into();
3294            self
3295        }
3296    }
3297
3298    #[doc(hidden)]
3299    impl gax::options::internal::RequestBuilder for DeleteExclusion {
3300        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3301            &mut self.0.options
3302        }
3303    }
3304
3305    /// The request builder for [ConfigServiceV2::get_cmek_settings][crate::client::ConfigServiceV2::get_cmek_settings] calls.
3306    ///
3307    /// # Example
3308    /// ```no_run
3309    /// # use google_cloud_logging_v2::builder;
3310    /// use builder::config_service_v_2::GetCmekSettings;
3311    /// # tokio_test::block_on(async {
3312    ///
3313    /// let builder = prepare_request_builder();
3314    /// let response = builder.send().await?;
3315    /// # gax::Result::<()>::Ok(()) });
3316    ///
3317    /// fn prepare_request_builder() -> GetCmekSettings {
3318    ///   # panic!();
3319    ///   // ... details omitted ...
3320    /// }
3321    /// ```
3322    #[derive(Clone, Debug)]
3323    pub struct GetCmekSettings(RequestBuilder<crate::model::GetCmekSettingsRequest>);
3324
3325    impl GetCmekSettings {
3326        pub(crate) fn new(
3327            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConfigServiceV2>,
3328        ) -> Self {
3329            Self(RequestBuilder::new(stub))
3330        }
3331
3332        /// Sets the full request, replacing any prior values.
3333        pub fn with_request<V: Into<crate::model::GetCmekSettingsRequest>>(mut self, v: V) -> Self {
3334            self.0.request = v.into();
3335            self
3336        }
3337
3338        /// Sets all the options, replacing any prior values.
3339        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3340            self.0.options = v.into();
3341            self
3342        }
3343
3344        /// Sends the request.
3345        pub async fn send(self) -> Result<crate::model::CmekSettings> {
3346            (*self.0.stub)
3347                .get_cmek_settings(self.0.request, self.0.options)
3348                .await
3349                .map(gax::response::Response::into_body)
3350        }
3351
3352        /// Sets the value of [name][crate::model::GetCmekSettingsRequest::name].
3353        ///
3354        /// This is a **required** field for requests.
3355        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3356            self.0.request.name = v.into();
3357            self
3358        }
3359    }
3360
3361    #[doc(hidden)]
3362    impl gax::options::internal::RequestBuilder for GetCmekSettings {
3363        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3364            &mut self.0.options
3365        }
3366    }
3367
3368    /// The request builder for [ConfigServiceV2::update_cmek_settings][crate::client::ConfigServiceV2::update_cmek_settings] calls.
3369    ///
3370    /// # Example
3371    /// ```no_run
3372    /// # use google_cloud_logging_v2::builder;
3373    /// use builder::config_service_v_2::UpdateCmekSettings;
3374    /// # tokio_test::block_on(async {
3375    ///
3376    /// let builder = prepare_request_builder();
3377    /// let response = builder.send().await?;
3378    /// # gax::Result::<()>::Ok(()) });
3379    ///
3380    /// fn prepare_request_builder() -> UpdateCmekSettings {
3381    ///   # panic!();
3382    ///   // ... details omitted ...
3383    /// }
3384    /// ```
3385    #[derive(Clone, Debug)]
3386    pub struct UpdateCmekSettings(RequestBuilder<crate::model::UpdateCmekSettingsRequest>);
3387
3388    impl UpdateCmekSettings {
3389        pub(crate) fn new(
3390            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConfigServiceV2>,
3391        ) -> Self {
3392            Self(RequestBuilder::new(stub))
3393        }
3394
3395        /// Sets the full request, replacing any prior values.
3396        pub fn with_request<V: Into<crate::model::UpdateCmekSettingsRequest>>(
3397            mut self,
3398            v: V,
3399        ) -> Self {
3400            self.0.request = v.into();
3401            self
3402        }
3403
3404        /// Sets all the options, replacing any prior values.
3405        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3406            self.0.options = v.into();
3407            self
3408        }
3409
3410        /// Sends the request.
3411        pub async fn send(self) -> Result<crate::model::CmekSettings> {
3412            (*self.0.stub)
3413                .update_cmek_settings(self.0.request, self.0.options)
3414                .await
3415                .map(gax::response::Response::into_body)
3416        }
3417
3418        /// Sets the value of [name][crate::model::UpdateCmekSettingsRequest::name].
3419        ///
3420        /// This is a **required** field for requests.
3421        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3422            self.0.request.name = v.into();
3423            self
3424        }
3425
3426        /// Sets the value of [cmek_settings][crate::model::UpdateCmekSettingsRequest::cmek_settings].
3427        ///
3428        /// This is a **required** field for requests.
3429        pub fn set_cmek_settings<T>(mut self, v: T) -> Self
3430        where
3431            T: std::convert::Into<crate::model::CmekSettings>,
3432        {
3433            self.0.request.cmek_settings = std::option::Option::Some(v.into());
3434            self
3435        }
3436
3437        /// Sets or clears the value of [cmek_settings][crate::model::UpdateCmekSettingsRequest::cmek_settings].
3438        ///
3439        /// This is a **required** field for requests.
3440        pub fn set_or_clear_cmek_settings<T>(mut self, v: std::option::Option<T>) -> Self
3441        where
3442            T: std::convert::Into<crate::model::CmekSettings>,
3443        {
3444            self.0.request.cmek_settings = v.map(|x| x.into());
3445            self
3446        }
3447
3448        /// Sets the value of [update_mask][crate::model::UpdateCmekSettingsRequest::update_mask].
3449        pub fn set_update_mask<T>(mut self, v: T) -> Self
3450        where
3451            T: std::convert::Into<wkt::FieldMask>,
3452        {
3453            self.0.request.update_mask = std::option::Option::Some(v.into());
3454            self
3455        }
3456
3457        /// Sets or clears the value of [update_mask][crate::model::UpdateCmekSettingsRequest::update_mask].
3458        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3459        where
3460            T: std::convert::Into<wkt::FieldMask>,
3461        {
3462            self.0.request.update_mask = v.map(|x| x.into());
3463            self
3464        }
3465    }
3466
3467    #[doc(hidden)]
3468    impl gax::options::internal::RequestBuilder for UpdateCmekSettings {
3469        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3470            &mut self.0.options
3471        }
3472    }
3473
3474    /// The request builder for [ConfigServiceV2::get_settings][crate::client::ConfigServiceV2::get_settings] calls.
3475    ///
3476    /// # Example
3477    /// ```no_run
3478    /// # use google_cloud_logging_v2::builder;
3479    /// use builder::config_service_v_2::GetSettings;
3480    /// # tokio_test::block_on(async {
3481    ///
3482    /// let builder = prepare_request_builder();
3483    /// let response = builder.send().await?;
3484    /// # gax::Result::<()>::Ok(()) });
3485    ///
3486    /// fn prepare_request_builder() -> GetSettings {
3487    ///   # panic!();
3488    ///   // ... details omitted ...
3489    /// }
3490    /// ```
3491    #[derive(Clone, Debug)]
3492    pub struct GetSettings(RequestBuilder<crate::model::GetSettingsRequest>);
3493
3494    impl GetSettings {
3495        pub(crate) fn new(
3496            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConfigServiceV2>,
3497        ) -> Self {
3498            Self(RequestBuilder::new(stub))
3499        }
3500
3501        /// Sets the full request, replacing any prior values.
3502        pub fn with_request<V: Into<crate::model::GetSettingsRequest>>(mut self, v: V) -> Self {
3503            self.0.request = v.into();
3504            self
3505        }
3506
3507        /// Sets all the options, replacing any prior values.
3508        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3509            self.0.options = v.into();
3510            self
3511        }
3512
3513        /// Sends the request.
3514        pub async fn send(self) -> Result<crate::model::Settings> {
3515            (*self.0.stub)
3516                .get_settings(self.0.request, self.0.options)
3517                .await
3518                .map(gax::response::Response::into_body)
3519        }
3520
3521        /// Sets the value of [name][crate::model::GetSettingsRequest::name].
3522        ///
3523        /// This is a **required** field for requests.
3524        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3525            self.0.request.name = v.into();
3526            self
3527        }
3528    }
3529
3530    #[doc(hidden)]
3531    impl gax::options::internal::RequestBuilder for GetSettings {
3532        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3533            &mut self.0.options
3534        }
3535    }
3536
3537    /// The request builder for [ConfigServiceV2::update_settings][crate::client::ConfigServiceV2::update_settings] calls.
3538    ///
3539    /// # Example
3540    /// ```no_run
3541    /// # use google_cloud_logging_v2::builder;
3542    /// use builder::config_service_v_2::UpdateSettings;
3543    /// # tokio_test::block_on(async {
3544    ///
3545    /// let builder = prepare_request_builder();
3546    /// let response = builder.send().await?;
3547    /// # gax::Result::<()>::Ok(()) });
3548    ///
3549    /// fn prepare_request_builder() -> UpdateSettings {
3550    ///   # panic!();
3551    ///   // ... details omitted ...
3552    /// }
3553    /// ```
3554    #[derive(Clone, Debug)]
3555    pub struct UpdateSettings(RequestBuilder<crate::model::UpdateSettingsRequest>);
3556
3557    impl UpdateSettings {
3558        pub(crate) fn new(
3559            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConfigServiceV2>,
3560        ) -> Self {
3561            Self(RequestBuilder::new(stub))
3562        }
3563
3564        /// Sets the full request, replacing any prior values.
3565        pub fn with_request<V: Into<crate::model::UpdateSettingsRequest>>(mut self, v: V) -> Self {
3566            self.0.request = v.into();
3567            self
3568        }
3569
3570        /// Sets all the options, replacing any prior values.
3571        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3572            self.0.options = v.into();
3573            self
3574        }
3575
3576        /// Sends the request.
3577        pub async fn send(self) -> Result<crate::model::Settings> {
3578            (*self.0.stub)
3579                .update_settings(self.0.request, self.0.options)
3580                .await
3581                .map(gax::response::Response::into_body)
3582        }
3583
3584        /// Sets the value of [name][crate::model::UpdateSettingsRequest::name].
3585        ///
3586        /// This is a **required** field for requests.
3587        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3588            self.0.request.name = v.into();
3589            self
3590        }
3591
3592        /// Sets the value of [settings][crate::model::UpdateSettingsRequest::settings].
3593        ///
3594        /// This is a **required** field for requests.
3595        pub fn set_settings<T>(mut self, v: T) -> Self
3596        where
3597            T: std::convert::Into<crate::model::Settings>,
3598        {
3599            self.0.request.settings = std::option::Option::Some(v.into());
3600            self
3601        }
3602
3603        /// Sets or clears the value of [settings][crate::model::UpdateSettingsRequest::settings].
3604        ///
3605        /// This is a **required** field for requests.
3606        pub fn set_or_clear_settings<T>(mut self, v: std::option::Option<T>) -> Self
3607        where
3608            T: std::convert::Into<crate::model::Settings>,
3609        {
3610            self.0.request.settings = v.map(|x| x.into());
3611            self
3612        }
3613
3614        /// Sets the value of [update_mask][crate::model::UpdateSettingsRequest::update_mask].
3615        pub fn set_update_mask<T>(mut self, v: T) -> Self
3616        where
3617            T: std::convert::Into<wkt::FieldMask>,
3618        {
3619            self.0.request.update_mask = std::option::Option::Some(v.into());
3620            self
3621        }
3622
3623        /// Sets or clears the value of [update_mask][crate::model::UpdateSettingsRequest::update_mask].
3624        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3625        where
3626            T: std::convert::Into<wkt::FieldMask>,
3627        {
3628            self.0.request.update_mask = v.map(|x| x.into());
3629            self
3630        }
3631    }
3632
3633    #[doc(hidden)]
3634    impl gax::options::internal::RequestBuilder for UpdateSettings {
3635        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3636            &mut self.0.options
3637        }
3638    }
3639
3640    /// The request builder for [ConfigServiceV2::copy_log_entries][crate::client::ConfigServiceV2::copy_log_entries] calls.
3641    ///
3642    /// # Example
3643    /// ```no_run
3644    /// # use google_cloud_logging_v2::builder;
3645    /// use builder::config_service_v_2::CopyLogEntries;
3646    /// # tokio_test::block_on(async {
3647    /// use lro::Poller;
3648    ///
3649    /// let builder = prepare_request_builder();
3650    /// let response = builder.poller().until_done().await?;
3651    /// # gax::Result::<()>::Ok(()) });
3652    ///
3653    /// fn prepare_request_builder() -> CopyLogEntries {
3654    ///   # panic!();
3655    ///   // ... details omitted ...
3656    /// }
3657    /// ```
3658    #[derive(Clone, Debug)]
3659    pub struct CopyLogEntries(RequestBuilder<crate::model::CopyLogEntriesRequest>);
3660
3661    impl CopyLogEntries {
3662        pub(crate) fn new(
3663            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConfigServiceV2>,
3664        ) -> Self {
3665            Self(RequestBuilder::new(stub))
3666        }
3667
3668        /// Sets the full request, replacing any prior values.
3669        pub fn with_request<V: Into<crate::model::CopyLogEntriesRequest>>(mut self, v: V) -> Self {
3670            self.0.request = v.into();
3671            self
3672        }
3673
3674        /// Sets all the options, replacing any prior values.
3675        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3676            self.0.options = v.into();
3677            self
3678        }
3679
3680        /// Sends the request.
3681        ///
3682        /// # Long running operations
3683        ///
3684        /// This starts, but does not poll, a longrunning operation. More information
3685        /// on [copy_log_entries][crate::client::ConfigServiceV2::copy_log_entries].
3686        pub async fn send(self) -> Result<longrunning::model::Operation> {
3687            (*self.0.stub)
3688                .copy_log_entries(self.0.request, self.0.options)
3689                .await
3690                .map(gax::response::Response::into_body)
3691        }
3692
3693        /// Creates a [Poller][lro::Poller] to work with `copy_log_entries`.
3694        pub fn poller(
3695            self,
3696        ) -> impl lro::Poller<crate::model::CopyLogEntriesResponse, crate::model::CopyLogEntriesMetadata>
3697        {
3698            type Operation = lro::internal::Operation<
3699                crate::model::CopyLogEntriesResponse,
3700                crate::model::CopyLogEntriesMetadata,
3701            >;
3702            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
3703            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
3704
3705            let stub = self.0.stub.clone();
3706            let mut options = self.0.options.clone();
3707            options.set_retry_policy(gax::retry_policy::NeverRetry);
3708            let query = move |name| {
3709                let stub = stub.clone();
3710                let options = options.clone();
3711                async {
3712                    let op = GetOperation::new(stub)
3713                        .set_name(name)
3714                        .with_options(options)
3715                        .send()
3716                        .await?;
3717                    Ok(Operation::new(op))
3718                }
3719            };
3720
3721            let start = move || async {
3722                let op = self.send().await?;
3723                Ok(Operation::new(op))
3724            };
3725
3726            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
3727        }
3728
3729        /// Sets the value of [name][crate::model::CopyLogEntriesRequest::name].
3730        ///
3731        /// This is a **required** field for requests.
3732        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3733            self.0.request.name = v.into();
3734            self
3735        }
3736
3737        /// Sets the value of [filter][crate::model::CopyLogEntriesRequest::filter].
3738        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3739            self.0.request.filter = v.into();
3740            self
3741        }
3742
3743        /// Sets the value of [destination][crate::model::CopyLogEntriesRequest::destination].
3744        ///
3745        /// This is a **required** field for requests.
3746        pub fn set_destination<T: Into<std::string::String>>(mut self, v: T) -> Self {
3747            self.0.request.destination = v.into();
3748            self
3749        }
3750    }
3751
3752    #[doc(hidden)]
3753    impl gax::options::internal::RequestBuilder for CopyLogEntries {
3754        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3755            &mut self.0.options
3756        }
3757    }
3758
3759    /// The request builder for [ConfigServiceV2::list_operations][crate::client::ConfigServiceV2::list_operations] calls.
3760    ///
3761    /// # Example
3762    /// ```no_run
3763    /// # use google_cloud_logging_v2::builder;
3764    /// use builder::config_service_v_2::ListOperations;
3765    /// # tokio_test::block_on(async {
3766    /// use gax::paginator::ItemPaginator;
3767    ///
3768    /// let builder = prepare_request_builder();
3769    /// let mut items = builder.by_item();
3770    /// while let Some(result) = items.next().await {
3771    ///   let item = result?;
3772    /// }
3773    /// # gax::Result::<()>::Ok(()) });
3774    ///
3775    /// fn prepare_request_builder() -> ListOperations {
3776    ///   # panic!();
3777    ///   // ... details omitted ...
3778    /// }
3779    /// ```
3780    #[derive(Clone, Debug)]
3781    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
3782
3783    impl ListOperations {
3784        pub(crate) fn new(
3785            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConfigServiceV2>,
3786        ) -> Self {
3787            Self(RequestBuilder::new(stub))
3788        }
3789
3790        /// Sets the full request, replacing any prior values.
3791        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
3792            mut self,
3793            v: V,
3794        ) -> Self {
3795            self.0.request = v.into();
3796            self
3797        }
3798
3799        /// Sets all the options, replacing any prior values.
3800        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3801            self.0.options = v.into();
3802            self
3803        }
3804
3805        /// Sends the request.
3806        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
3807            (*self.0.stub)
3808                .list_operations(self.0.request, self.0.options)
3809                .await
3810                .map(gax::response::Response::into_body)
3811        }
3812
3813        /// Streams each page in the collection.
3814        pub fn by_page(
3815            self,
3816        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
3817        {
3818            use std::clone::Clone;
3819            let token = self.0.request.page_token.clone();
3820            let execute = move |token: String| {
3821                let mut builder = self.clone();
3822                builder.0.request = builder.0.request.set_page_token(token);
3823                builder.send()
3824            };
3825            gax::paginator::internal::new_paginator(token, execute)
3826        }
3827
3828        /// Streams each item in the collection.
3829        pub fn by_item(
3830            self,
3831        ) -> impl gax::paginator::ItemPaginator<
3832            longrunning::model::ListOperationsResponse,
3833            gax::error::Error,
3834        > {
3835            use gax::paginator::Paginator;
3836            self.by_page().items()
3837        }
3838
3839        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
3840        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3841            self.0.request.name = v.into();
3842            self
3843        }
3844
3845        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
3846        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3847            self.0.request.filter = v.into();
3848            self
3849        }
3850
3851        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
3852        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3853            self.0.request.page_size = v.into();
3854            self
3855        }
3856
3857        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
3858        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3859            self.0.request.page_token = v.into();
3860            self
3861        }
3862    }
3863
3864    #[doc(hidden)]
3865    impl gax::options::internal::RequestBuilder for ListOperations {
3866        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3867            &mut self.0.options
3868        }
3869    }
3870
3871    /// The request builder for [ConfigServiceV2::get_operation][crate::client::ConfigServiceV2::get_operation] calls.
3872    ///
3873    /// # Example
3874    /// ```no_run
3875    /// # use google_cloud_logging_v2::builder;
3876    /// use builder::config_service_v_2::GetOperation;
3877    /// # tokio_test::block_on(async {
3878    ///
3879    /// let builder = prepare_request_builder();
3880    /// let response = builder.send().await?;
3881    /// # gax::Result::<()>::Ok(()) });
3882    ///
3883    /// fn prepare_request_builder() -> GetOperation {
3884    ///   # panic!();
3885    ///   // ... details omitted ...
3886    /// }
3887    /// ```
3888    #[derive(Clone, Debug)]
3889    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
3890
3891    impl GetOperation {
3892        pub(crate) fn new(
3893            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConfigServiceV2>,
3894        ) -> Self {
3895            Self(RequestBuilder::new(stub))
3896        }
3897
3898        /// Sets the full request, replacing any prior values.
3899        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
3900            mut self,
3901            v: V,
3902        ) -> Self {
3903            self.0.request = v.into();
3904            self
3905        }
3906
3907        /// Sets all the options, replacing any prior values.
3908        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3909            self.0.options = v.into();
3910            self
3911        }
3912
3913        /// Sends the request.
3914        pub async fn send(self) -> Result<longrunning::model::Operation> {
3915            (*self.0.stub)
3916                .get_operation(self.0.request, self.0.options)
3917                .await
3918                .map(gax::response::Response::into_body)
3919        }
3920
3921        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
3922        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3923            self.0.request.name = v.into();
3924            self
3925        }
3926    }
3927
3928    #[doc(hidden)]
3929    impl gax::options::internal::RequestBuilder for GetOperation {
3930        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3931            &mut self.0.options
3932        }
3933    }
3934
3935    /// The request builder for [ConfigServiceV2::cancel_operation][crate::client::ConfigServiceV2::cancel_operation] calls.
3936    ///
3937    /// # Example
3938    /// ```no_run
3939    /// # use google_cloud_logging_v2::builder;
3940    /// use builder::config_service_v_2::CancelOperation;
3941    /// # tokio_test::block_on(async {
3942    ///
3943    /// let builder = prepare_request_builder();
3944    /// let response = builder.send().await?;
3945    /// # gax::Result::<()>::Ok(()) });
3946    ///
3947    /// fn prepare_request_builder() -> CancelOperation {
3948    ///   # panic!();
3949    ///   // ... details omitted ...
3950    /// }
3951    /// ```
3952    #[derive(Clone, Debug)]
3953    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
3954
3955    impl CancelOperation {
3956        pub(crate) fn new(
3957            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConfigServiceV2>,
3958        ) -> Self {
3959            Self(RequestBuilder::new(stub))
3960        }
3961
3962        /// Sets the full request, replacing any prior values.
3963        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
3964            mut self,
3965            v: V,
3966        ) -> Self {
3967            self.0.request = v.into();
3968            self
3969        }
3970
3971        /// Sets all the options, replacing any prior values.
3972        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3973            self.0.options = v.into();
3974            self
3975        }
3976
3977        /// Sends the request.
3978        pub async fn send(self) -> Result<()> {
3979            (*self.0.stub)
3980                .cancel_operation(self.0.request, self.0.options)
3981                .await
3982                .map(gax::response::Response::into_body)
3983        }
3984
3985        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
3986        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3987            self.0.request.name = v.into();
3988            self
3989        }
3990    }
3991
3992    #[doc(hidden)]
3993    impl gax::options::internal::RequestBuilder for CancelOperation {
3994        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3995            &mut self.0.options
3996        }
3997    }
3998}
3999
4000pub mod metrics_service_v_2 {
4001    use crate::Result;
4002
4003    /// A builder for [MetricsServiceV2][crate::client::MetricsServiceV2].
4004    ///
4005    /// ```
4006    /// # tokio_test::block_on(async {
4007    /// # use google_cloud_logging_v2::*;
4008    /// # use builder::metrics_service_v_2::ClientBuilder;
4009    /// # use client::MetricsServiceV2;
4010    /// let builder : ClientBuilder = MetricsServiceV2::builder();
4011    /// let client = builder
4012    ///     .with_endpoint("https://logging.googleapis.com")
4013    ///     .build().await?;
4014    /// # gax::client_builder::Result::<()>::Ok(()) });
4015    /// ```
4016    pub type ClientBuilder =
4017        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
4018
4019    pub(crate) mod client {
4020        use super::super::super::client::MetricsServiceV2;
4021        pub struct Factory;
4022        impl gax::client_builder::internal::ClientFactory for Factory {
4023            type Client = MetricsServiceV2;
4024            type Credentials = gaxi::options::Credentials;
4025            async fn build(
4026                self,
4027                config: gaxi::options::ClientConfig,
4028            ) -> gax::client_builder::Result<Self::Client> {
4029                Self::Client::new(config).await
4030            }
4031        }
4032    }
4033
4034    /// Common implementation for [crate::client::MetricsServiceV2] request builders.
4035    #[derive(Clone, Debug)]
4036    pub(crate) struct RequestBuilder<R: std::default::Default> {
4037        stub: std::sync::Arc<dyn super::super::stub::dynamic::MetricsServiceV2>,
4038        request: R,
4039        options: gax::options::RequestOptions,
4040    }
4041
4042    impl<R> RequestBuilder<R>
4043    where
4044        R: std::default::Default,
4045    {
4046        pub(crate) fn new(
4047            stub: std::sync::Arc<dyn super::super::stub::dynamic::MetricsServiceV2>,
4048        ) -> Self {
4049            Self {
4050                stub,
4051                request: R::default(),
4052                options: gax::options::RequestOptions::default(),
4053            }
4054        }
4055    }
4056
4057    /// The request builder for [MetricsServiceV2::list_log_metrics][crate::client::MetricsServiceV2::list_log_metrics] calls.
4058    ///
4059    /// # Example
4060    /// ```no_run
4061    /// # use google_cloud_logging_v2::builder;
4062    /// use builder::metrics_service_v_2::ListLogMetrics;
4063    /// # tokio_test::block_on(async {
4064    /// use gax::paginator::ItemPaginator;
4065    ///
4066    /// let builder = prepare_request_builder();
4067    /// let mut items = builder.by_item();
4068    /// while let Some(result) = items.next().await {
4069    ///   let item = result?;
4070    /// }
4071    /// # gax::Result::<()>::Ok(()) });
4072    ///
4073    /// fn prepare_request_builder() -> ListLogMetrics {
4074    ///   # panic!();
4075    ///   // ... details omitted ...
4076    /// }
4077    /// ```
4078    #[derive(Clone, Debug)]
4079    pub struct ListLogMetrics(RequestBuilder<crate::model::ListLogMetricsRequest>);
4080
4081    impl ListLogMetrics {
4082        pub(crate) fn new(
4083            stub: std::sync::Arc<dyn super::super::stub::dynamic::MetricsServiceV2>,
4084        ) -> Self {
4085            Self(RequestBuilder::new(stub))
4086        }
4087
4088        /// Sets the full request, replacing any prior values.
4089        pub fn with_request<V: Into<crate::model::ListLogMetricsRequest>>(mut self, v: V) -> Self {
4090            self.0.request = v.into();
4091            self
4092        }
4093
4094        /// Sets all the options, replacing any prior values.
4095        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4096            self.0.options = v.into();
4097            self
4098        }
4099
4100        /// Sends the request.
4101        pub async fn send(self) -> Result<crate::model::ListLogMetricsResponse> {
4102            (*self.0.stub)
4103                .list_log_metrics(self.0.request, self.0.options)
4104                .await
4105                .map(gax::response::Response::into_body)
4106        }
4107
4108        /// Streams each page in the collection.
4109        pub fn by_page(
4110            self,
4111        ) -> impl gax::paginator::Paginator<crate::model::ListLogMetricsResponse, gax::error::Error>
4112        {
4113            use std::clone::Clone;
4114            let token = self.0.request.page_token.clone();
4115            let execute = move |token: String| {
4116                let mut builder = self.clone();
4117                builder.0.request = builder.0.request.set_page_token(token);
4118                builder.send()
4119            };
4120            gax::paginator::internal::new_paginator(token, execute)
4121        }
4122
4123        /// Streams each item in the collection.
4124        pub fn by_item(
4125            self,
4126        ) -> impl gax::paginator::ItemPaginator<crate::model::ListLogMetricsResponse, gax::error::Error>
4127        {
4128            use gax::paginator::Paginator;
4129            self.by_page().items()
4130        }
4131
4132        /// Sets the value of [parent][crate::model::ListLogMetricsRequest::parent].
4133        ///
4134        /// This is a **required** field for requests.
4135        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4136            self.0.request.parent = v.into();
4137            self
4138        }
4139
4140        /// Sets the value of [page_token][crate::model::ListLogMetricsRequest::page_token].
4141        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4142            self.0.request.page_token = v.into();
4143            self
4144        }
4145
4146        /// Sets the value of [page_size][crate::model::ListLogMetricsRequest::page_size].
4147        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4148            self.0.request.page_size = v.into();
4149            self
4150        }
4151    }
4152
4153    #[doc(hidden)]
4154    impl gax::options::internal::RequestBuilder for ListLogMetrics {
4155        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4156            &mut self.0.options
4157        }
4158    }
4159
4160    /// The request builder for [MetricsServiceV2::get_log_metric][crate::client::MetricsServiceV2::get_log_metric] calls.
4161    ///
4162    /// # Example
4163    /// ```no_run
4164    /// # use google_cloud_logging_v2::builder;
4165    /// use builder::metrics_service_v_2::GetLogMetric;
4166    /// # tokio_test::block_on(async {
4167    ///
4168    /// let builder = prepare_request_builder();
4169    /// let response = builder.send().await?;
4170    /// # gax::Result::<()>::Ok(()) });
4171    ///
4172    /// fn prepare_request_builder() -> GetLogMetric {
4173    ///   # panic!();
4174    ///   // ... details omitted ...
4175    /// }
4176    /// ```
4177    #[derive(Clone, Debug)]
4178    pub struct GetLogMetric(RequestBuilder<crate::model::GetLogMetricRequest>);
4179
4180    impl GetLogMetric {
4181        pub(crate) fn new(
4182            stub: std::sync::Arc<dyn super::super::stub::dynamic::MetricsServiceV2>,
4183        ) -> Self {
4184            Self(RequestBuilder::new(stub))
4185        }
4186
4187        /// Sets the full request, replacing any prior values.
4188        pub fn with_request<V: Into<crate::model::GetLogMetricRequest>>(mut self, v: V) -> Self {
4189            self.0.request = v.into();
4190            self
4191        }
4192
4193        /// Sets all the options, replacing any prior values.
4194        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4195            self.0.options = v.into();
4196            self
4197        }
4198
4199        /// Sends the request.
4200        pub async fn send(self) -> Result<crate::model::LogMetric> {
4201            (*self.0.stub)
4202                .get_log_metric(self.0.request, self.0.options)
4203                .await
4204                .map(gax::response::Response::into_body)
4205        }
4206
4207        /// Sets the value of [metric_name][crate::model::GetLogMetricRequest::metric_name].
4208        ///
4209        /// This is a **required** field for requests.
4210        pub fn set_metric_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4211            self.0.request.metric_name = v.into();
4212            self
4213        }
4214    }
4215
4216    #[doc(hidden)]
4217    impl gax::options::internal::RequestBuilder for GetLogMetric {
4218        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4219            &mut self.0.options
4220        }
4221    }
4222
4223    /// The request builder for [MetricsServiceV2::create_log_metric][crate::client::MetricsServiceV2::create_log_metric] calls.
4224    ///
4225    /// # Example
4226    /// ```no_run
4227    /// # use google_cloud_logging_v2::builder;
4228    /// use builder::metrics_service_v_2::CreateLogMetric;
4229    /// # tokio_test::block_on(async {
4230    ///
4231    /// let builder = prepare_request_builder();
4232    /// let response = builder.send().await?;
4233    /// # gax::Result::<()>::Ok(()) });
4234    ///
4235    /// fn prepare_request_builder() -> CreateLogMetric {
4236    ///   # panic!();
4237    ///   // ... details omitted ...
4238    /// }
4239    /// ```
4240    #[derive(Clone, Debug)]
4241    pub struct CreateLogMetric(RequestBuilder<crate::model::CreateLogMetricRequest>);
4242
4243    impl CreateLogMetric {
4244        pub(crate) fn new(
4245            stub: std::sync::Arc<dyn super::super::stub::dynamic::MetricsServiceV2>,
4246        ) -> Self {
4247            Self(RequestBuilder::new(stub))
4248        }
4249
4250        /// Sets the full request, replacing any prior values.
4251        pub fn with_request<V: Into<crate::model::CreateLogMetricRequest>>(mut self, v: V) -> Self {
4252            self.0.request = v.into();
4253            self
4254        }
4255
4256        /// Sets all the options, replacing any prior values.
4257        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4258            self.0.options = v.into();
4259            self
4260        }
4261
4262        /// Sends the request.
4263        pub async fn send(self) -> Result<crate::model::LogMetric> {
4264            (*self.0.stub)
4265                .create_log_metric(self.0.request, self.0.options)
4266                .await
4267                .map(gax::response::Response::into_body)
4268        }
4269
4270        /// Sets the value of [parent][crate::model::CreateLogMetricRequest::parent].
4271        ///
4272        /// This is a **required** field for requests.
4273        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4274            self.0.request.parent = v.into();
4275            self
4276        }
4277
4278        /// Sets the value of [metric][crate::model::CreateLogMetricRequest::metric].
4279        ///
4280        /// This is a **required** field for requests.
4281        pub fn set_metric<T>(mut self, v: T) -> Self
4282        where
4283            T: std::convert::Into<crate::model::LogMetric>,
4284        {
4285            self.0.request.metric = std::option::Option::Some(v.into());
4286            self
4287        }
4288
4289        /// Sets or clears the value of [metric][crate::model::CreateLogMetricRequest::metric].
4290        ///
4291        /// This is a **required** field for requests.
4292        pub fn set_or_clear_metric<T>(mut self, v: std::option::Option<T>) -> Self
4293        where
4294            T: std::convert::Into<crate::model::LogMetric>,
4295        {
4296            self.0.request.metric = v.map(|x| x.into());
4297            self
4298        }
4299    }
4300
4301    #[doc(hidden)]
4302    impl gax::options::internal::RequestBuilder for CreateLogMetric {
4303        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4304            &mut self.0.options
4305        }
4306    }
4307
4308    /// The request builder for [MetricsServiceV2::update_log_metric][crate::client::MetricsServiceV2::update_log_metric] calls.
4309    ///
4310    /// # Example
4311    /// ```no_run
4312    /// # use google_cloud_logging_v2::builder;
4313    /// use builder::metrics_service_v_2::UpdateLogMetric;
4314    /// # tokio_test::block_on(async {
4315    ///
4316    /// let builder = prepare_request_builder();
4317    /// let response = builder.send().await?;
4318    /// # gax::Result::<()>::Ok(()) });
4319    ///
4320    /// fn prepare_request_builder() -> UpdateLogMetric {
4321    ///   # panic!();
4322    ///   // ... details omitted ...
4323    /// }
4324    /// ```
4325    #[derive(Clone, Debug)]
4326    pub struct UpdateLogMetric(RequestBuilder<crate::model::UpdateLogMetricRequest>);
4327
4328    impl UpdateLogMetric {
4329        pub(crate) fn new(
4330            stub: std::sync::Arc<dyn super::super::stub::dynamic::MetricsServiceV2>,
4331        ) -> Self {
4332            Self(RequestBuilder::new(stub))
4333        }
4334
4335        /// Sets the full request, replacing any prior values.
4336        pub fn with_request<V: Into<crate::model::UpdateLogMetricRequest>>(mut self, v: V) -> Self {
4337            self.0.request = v.into();
4338            self
4339        }
4340
4341        /// Sets all the options, replacing any prior values.
4342        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4343            self.0.options = v.into();
4344            self
4345        }
4346
4347        /// Sends the request.
4348        pub async fn send(self) -> Result<crate::model::LogMetric> {
4349            (*self.0.stub)
4350                .update_log_metric(self.0.request, self.0.options)
4351                .await
4352                .map(gax::response::Response::into_body)
4353        }
4354
4355        /// Sets the value of [metric_name][crate::model::UpdateLogMetricRequest::metric_name].
4356        ///
4357        /// This is a **required** field for requests.
4358        pub fn set_metric_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4359            self.0.request.metric_name = v.into();
4360            self
4361        }
4362
4363        /// Sets the value of [metric][crate::model::UpdateLogMetricRequest::metric].
4364        ///
4365        /// This is a **required** field for requests.
4366        pub fn set_metric<T>(mut self, v: T) -> Self
4367        where
4368            T: std::convert::Into<crate::model::LogMetric>,
4369        {
4370            self.0.request.metric = std::option::Option::Some(v.into());
4371            self
4372        }
4373
4374        /// Sets or clears the value of [metric][crate::model::UpdateLogMetricRequest::metric].
4375        ///
4376        /// This is a **required** field for requests.
4377        pub fn set_or_clear_metric<T>(mut self, v: std::option::Option<T>) -> Self
4378        where
4379            T: std::convert::Into<crate::model::LogMetric>,
4380        {
4381            self.0.request.metric = v.map(|x| x.into());
4382            self
4383        }
4384    }
4385
4386    #[doc(hidden)]
4387    impl gax::options::internal::RequestBuilder for UpdateLogMetric {
4388        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4389            &mut self.0.options
4390        }
4391    }
4392
4393    /// The request builder for [MetricsServiceV2::delete_log_metric][crate::client::MetricsServiceV2::delete_log_metric] calls.
4394    ///
4395    /// # Example
4396    /// ```no_run
4397    /// # use google_cloud_logging_v2::builder;
4398    /// use builder::metrics_service_v_2::DeleteLogMetric;
4399    /// # tokio_test::block_on(async {
4400    ///
4401    /// let builder = prepare_request_builder();
4402    /// let response = builder.send().await?;
4403    /// # gax::Result::<()>::Ok(()) });
4404    ///
4405    /// fn prepare_request_builder() -> DeleteLogMetric {
4406    ///   # panic!();
4407    ///   // ... details omitted ...
4408    /// }
4409    /// ```
4410    #[derive(Clone, Debug)]
4411    pub struct DeleteLogMetric(RequestBuilder<crate::model::DeleteLogMetricRequest>);
4412
4413    impl DeleteLogMetric {
4414        pub(crate) fn new(
4415            stub: std::sync::Arc<dyn super::super::stub::dynamic::MetricsServiceV2>,
4416        ) -> Self {
4417            Self(RequestBuilder::new(stub))
4418        }
4419
4420        /// Sets the full request, replacing any prior values.
4421        pub fn with_request<V: Into<crate::model::DeleteLogMetricRequest>>(mut self, v: V) -> Self {
4422            self.0.request = v.into();
4423            self
4424        }
4425
4426        /// Sets all the options, replacing any prior values.
4427        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4428            self.0.options = v.into();
4429            self
4430        }
4431
4432        /// Sends the request.
4433        pub async fn send(self) -> Result<()> {
4434            (*self.0.stub)
4435                .delete_log_metric(self.0.request, self.0.options)
4436                .await
4437                .map(gax::response::Response::into_body)
4438        }
4439
4440        /// Sets the value of [metric_name][crate::model::DeleteLogMetricRequest::metric_name].
4441        ///
4442        /// This is a **required** field for requests.
4443        pub fn set_metric_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4444            self.0.request.metric_name = v.into();
4445            self
4446        }
4447    }
4448
4449    #[doc(hidden)]
4450    impl gax::options::internal::RequestBuilder for DeleteLogMetric {
4451        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4452            &mut self.0.options
4453        }
4454    }
4455
4456    /// The request builder for [MetricsServiceV2::list_operations][crate::client::MetricsServiceV2::list_operations] calls.
4457    ///
4458    /// # Example
4459    /// ```no_run
4460    /// # use google_cloud_logging_v2::builder;
4461    /// use builder::metrics_service_v_2::ListOperations;
4462    /// # tokio_test::block_on(async {
4463    /// use gax::paginator::ItemPaginator;
4464    ///
4465    /// let builder = prepare_request_builder();
4466    /// let mut items = builder.by_item();
4467    /// while let Some(result) = items.next().await {
4468    ///   let item = result?;
4469    /// }
4470    /// # gax::Result::<()>::Ok(()) });
4471    ///
4472    /// fn prepare_request_builder() -> ListOperations {
4473    ///   # panic!();
4474    ///   // ... details omitted ...
4475    /// }
4476    /// ```
4477    #[derive(Clone, Debug)]
4478    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
4479
4480    impl ListOperations {
4481        pub(crate) fn new(
4482            stub: std::sync::Arc<dyn super::super::stub::dynamic::MetricsServiceV2>,
4483        ) -> Self {
4484            Self(RequestBuilder::new(stub))
4485        }
4486
4487        /// Sets the full request, replacing any prior values.
4488        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
4489            mut self,
4490            v: V,
4491        ) -> Self {
4492            self.0.request = v.into();
4493            self
4494        }
4495
4496        /// Sets all the options, replacing any prior values.
4497        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4498            self.0.options = v.into();
4499            self
4500        }
4501
4502        /// Sends the request.
4503        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
4504            (*self.0.stub)
4505                .list_operations(self.0.request, self.0.options)
4506                .await
4507                .map(gax::response::Response::into_body)
4508        }
4509
4510        /// Streams each page in the collection.
4511        pub fn by_page(
4512            self,
4513        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
4514        {
4515            use std::clone::Clone;
4516            let token = self.0.request.page_token.clone();
4517            let execute = move |token: String| {
4518                let mut builder = self.clone();
4519                builder.0.request = builder.0.request.set_page_token(token);
4520                builder.send()
4521            };
4522            gax::paginator::internal::new_paginator(token, execute)
4523        }
4524
4525        /// Streams each item in the collection.
4526        pub fn by_item(
4527            self,
4528        ) -> impl gax::paginator::ItemPaginator<
4529            longrunning::model::ListOperationsResponse,
4530            gax::error::Error,
4531        > {
4532            use gax::paginator::Paginator;
4533            self.by_page().items()
4534        }
4535
4536        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
4537        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4538            self.0.request.name = v.into();
4539            self
4540        }
4541
4542        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
4543        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4544            self.0.request.filter = v.into();
4545            self
4546        }
4547
4548        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
4549        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4550            self.0.request.page_size = v.into();
4551            self
4552        }
4553
4554        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
4555        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4556            self.0.request.page_token = v.into();
4557            self
4558        }
4559    }
4560
4561    #[doc(hidden)]
4562    impl gax::options::internal::RequestBuilder for ListOperations {
4563        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4564            &mut self.0.options
4565        }
4566    }
4567
4568    /// The request builder for [MetricsServiceV2::get_operation][crate::client::MetricsServiceV2::get_operation] calls.
4569    ///
4570    /// # Example
4571    /// ```no_run
4572    /// # use google_cloud_logging_v2::builder;
4573    /// use builder::metrics_service_v_2::GetOperation;
4574    /// # tokio_test::block_on(async {
4575    ///
4576    /// let builder = prepare_request_builder();
4577    /// let response = builder.send().await?;
4578    /// # gax::Result::<()>::Ok(()) });
4579    ///
4580    /// fn prepare_request_builder() -> GetOperation {
4581    ///   # panic!();
4582    ///   // ... details omitted ...
4583    /// }
4584    /// ```
4585    #[derive(Clone, Debug)]
4586    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
4587
4588    impl GetOperation {
4589        pub(crate) fn new(
4590            stub: std::sync::Arc<dyn super::super::stub::dynamic::MetricsServiceV2>,
4591        ) -> Self {
4592            Self(RequestBuilder::new(stub))
4593        }
4594
4595        /// Sets the full request, replacing any prior values.
4596        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
4597            mut self,
4598            v: V,
4599        ) -> Self {
4600            self.0.request = v.into();
4601            self
4602        }
4603
4604        /// Sets all the options, replacing any prior values.
4605        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4606            self.0.options = v.into();
4607            self
4608        }
4609
4610        /// Sends the request.
4611        pub async fn send(self) -> Result<longrunning::model::Operation> {
4612            (*self.0.stub)
4613                .get_operation(self.0.request, self.0.options)
4614                .await
4615                .map(gax::response::Response::into_body)
4616        }
4617
4618        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
4619        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4620            self.0.request.name = v.into();
4621            self
4622        }
4623    }
4624
4625    #[doc(hidden)]
4626    impl gax::options::internal::RequestBuilder for GetOperation {
4627        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4628            &mut self.0.options
4629        }
4630    }
4631
4632    /// The request builder for [MetricsServiceV2::cancel_operation][crate::client::MetricsServiceV2::cancel_operation] calls.
4633    ///
4634    /// # Example
4635    /// ```no_run
4636    /// # use google_cloud_logging_v2::builder;
4637    /// use builder::metrics_service_v_2::CancelOperation;
4638    /// # tokio_test::block_on(async {
4639    ///
4640    /// let builder = prepare_request_builder();
4641    /// let response = builder.send().await?;
4642    /// # gax::Result::<()>::Ok(()) });
4643    ///
4644    /// fn prepare_request_builder() -> CancelOperation {
4645    ///   # panic!();
4646    ///   // ... details omitted ...
4647    /// }
4648    /// ```
4649    #[derive(Clone, Debug)]
4650    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
4651
4652    impl CancelOperation {
4653        pub(crate) fn new(
4654            stub: std::sync::Arc<dyn super::super::stub::dynamic::MetricsServiceV2>,
4655        ) -> Self {
4656            Self(RequestBuilder::new(stub))
4657        }
4658
4659        /// Sets the full request, replacing any prior values.
4660        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
4661            mut self,
4662            v: V,
4663        ) -> Self {
4664            self.0.request = v.into();
4665            self
4666        }
4667
4668        /// Sets all the options, replacing any prior values.
4669        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4670            self.0.options = v.into();
4671            self
4672        }
4673
4674        /// Sends the request.
4675        pub async fn send(self) -> Result<()> {
4676            (*self.0.stub)
4677                .cancel_operation(self.0.request, self.0.options)
4678                .await
4679                .map(gax::response::Response::into_body)
4680        }
4681
4682        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
4683        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4684            self.0.request.name = v.into();
4685            self
4686        }
4687    }
4688
4689    #[doc(hidden)]
4690    impl gax::options::internal::RequestBuilder for CancelOperation {
4691        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4692            &mut self.0.options
4693        }
4694    }
4695}