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