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