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