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