Skip to main content

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