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