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